Skip to content

Commit a488ba1

Browse files
authored
Merge branch 'main' into jacekradko/remove-swr
2 parents 4b8d27a + c088dde commit a488ba1

File tree

11 files changed

+106
-16
lines changed

11 files changed

+106
-16
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/expo': patch
3+
---
4+
5+
Broaden React peer dependency to `^18.0.0 || ^19.0.0` to resolve peer dependency conflicts for Expo 54 users

.changeset/little-planes-tease.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/shared': patch
3+
---
4+
5+
Export SignUpFutureAdditionalParams type.

.changeset/open-loops-vanish.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/shared': patch
3+
---
4+
5+
Use named types for function parameters in the Billing namespace.

.changeset/two-aliens-glow.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@clerk/react': patch
3+
---
4+
5+
Prevent props from leaking to child elements in SignUpButton & SignInButton

packages/expo/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@
118118
"expo-modules-core": ">=3.0.0",
119119
"expo-secure-store": ">=12.4.0",
120120
"expo-web-browser": ">=12.5.0",
121-
"react": "catalog:peer-react",
122-
"react-dom": "catalog:peer-react",
121+
"react": "^18.0.0 || ^19.0.0",
122+
"react-dom": "^18.0.0 || ^19.0.0",
123123
"react-native": ">=0.73"
124124
},
125125
"peerDependenciesMeta": {

packages/react/src/components/SignInButton.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ import { withClerk } from './withClerk';
88
export const SignInButton = withClerk(
99
({ clerk, children, ...props }: WithClerkProp<React.PropsWithChildren<SignInButtonProps>>) => {
1010
const {
11+
// @ts-expect-error - appearance is a valid prop for SignInProps & SignInButtonPropsModal
12+
appearance,
1113
signUpFallbackRedirectUrl,
1214
forceRedirectUrl,
1315
fallbackRedirectUrl,
@@ -33,7 +35,7 @@ export const SignInButton = withClerk(
3335
};
3436

3537
if (mode === 'modal') {
36-
return clerk.openSignIn({ ...opts, appearance: props.appearance });
38+
return clerk.openSignIn({ ...opts, appearance });
3739
}
3840
return clerk.redirectToSignIn({
3941
...opts,

packages/react/src/components/SignUpButton.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ import { withClerk } from './withClerk';
88
export const SignUpButton = withClerk(
99
({ clerk, children, ...props }: WithClerkProp<React.PropsWithChildren<SignUpButtonProps>>) => {
1010
const {
11+
// @ts-expect-error - appearance is a valid prop for SignUpProps & SignUpButtonPropsModal
12+
appearance,
13+
// @ts-expect-error - unsafeMetadata is a valid prop for SignUpProps & SignUpButtonPropsModal
14+
unsafeMetadata,
1115
fallbackRedirectUrl,
1216
forceRedirectUrl,
1317
signInFallbackRedirectUrl,
@@ -34,8 +38,8 @@ export const SignUpButton = withClerk(
3438
if (mode === 'modal') {
3539
return clerk.openSignUp({
3640
...opts,
37-
appearance: props.appearance,
38-
unsafeMetadata: props.unsafeMetadata,
41+
appearance,
42+
unsafeMetadata,
3943
});
4044
}
4145

packages/react/src/components/__tests__/SignInButton.test.tsx

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,4 +105,18 @@ describe('<SignInButton/>', () => {
105105
);
106106
}).toThrow();
107107
});
108+
109+
it('does not pass appearance prop to child element', () => {
110+
const { container } = render(
111+
<SignInButton
112+
mode='modal'
113+
appearance={{ elements: { rootBox: 'test' } }}
114+
>
115+
<button type='button'>Sign in</button>
116+
</SignInButton>,
117+
);
118+
119+
const button = container.querySelector('button');
120+
expect(button?.hasAttribute('appearance')).toBe(false);
121+
});
108122
});

packages/react/src/components/__tests__/SignUpButton.test.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,29 @@ describe('<SignUpButton/>', () => {
109109
);
110110
}).toThrow();
111111
});
112+
113+
it('does not pass unsafeMetadata prop to child element', () => {
114+
const { container } = render(
115+
<SignUpButton unsafeMetadata={{ customField: 'test' }}>
116+
<button type='button'>Sign up</button>
117+
</SignUpButton>,
118+
);
119+
120+
const button = container.querySelector('button');
121+
expect(button?.hasAttribute('unsafeMetadata')).toBe(false);
122+
});
123+
124+
it('does not pass appearance prop to child element', () => {
125+
const { container } = render(
126+
<SignUpButton
127+
mode='modal'
128+
appearance={{ elements: { rootBox: 'test' } }}
129+
>
130+
<button type='button'>Sign up</button>
131+
</SignUpButton>,
132+
);
133+
134+
const button = container.querySelector('button');
135+
expect(button?.hasAttribute('appearance')).toBe(false);
136+
});
112137
});

packages/shared/src/types/billing.ts

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,35 +25,35 @@ export interface BillingNamespace {
2525
getPaymentAttempts: (params: GetPaymentAttemptsParams) => Promise<ClerkPaginatedResponse<BillingPaymentResource>>;
2626

2727
/**
28-
* Returns details of a specific payment attempt for the current user or supplied organization.
28+
* Returns details of a specific payment attempt for the current user or supplied Organization.
2929
*
3030
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
3131
*/
32-
getPaymentAttempt: (params: { id: string; orgId?: string }) => Promise<BillingPaymentResource>;
32+
getPaymentAttempt: (params: GetPaymentAttemptParams) => Promise<BillingPaymentResource>;
3333

3434
/**
35-
* Returns a list of all publically visible billing plans.
35+
* Returns a list of all publically visible Billing Plans.
3636
*
3737
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
3838
*/
3939
getPlans: (params?: GetPlansParams) => Promise<ClerkPaginatedResponse<BillingPlanResource>>;
4040

4141
/**
42-
* Returns a billing plan by ID.
42+
* Returns a Billing Plan by ID.
4343
*
4444
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
4545
*/
46-
getPlan: (params: { id: string }) => Promise<BillingPlanResource>;
46+
getPlan: (params: GetPlanParams) => Promise<BillingPlanResource>;
4747

4848
/**
49-
* Returns the main billing subscription for the current user or supplied organization.
49+
* Returns the main Billing Subscription for the current user or supplied Organization.
5050
*
5151
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
5252
*/
5353
getSubscription: (params: GetSubscriptionParams) => Promise<BillingSubscriptionResource>;
5454

5555
/**
56-
* Returns a list of billing statements for the current user or supplied organization.
56+
* Returns a list of billing statements for the current user or supplied Organization.
5757
*
5858
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
5959
*/
@@ -64,10 +64,10 @@ export interface BillingNamespace {
6464
*
6565
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
6666
*/
67-
getStatement: (params: { id: string; orgId?: string }) => Promise<BillingStatementResource>;
67+
getStatement: (params: GetStatementParams) => Promise<BillingStatementResource>;
6868

6969
/**
70-
* Creates a new billing checkout for the current user or supplied organization.
70+
* Creates a new billing checkout for the current user or supplied Organization.
7171
*
7272
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
7373
*/
@@ -122,6 +122,16 @@ export interface BillingPayerMethods {
122122
) => Promise<ClerkPaginatedResponse<BillingPaymentMethodResource>>;
123123
}
124124

125+
/**
126+
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
127+
*/
128+
export type GetPlanParams = {
129+
/**
130+
* The ID of the Billing Plan to fetch.
131+
*/
132+
id: string;
133+
};
134+
125135
/**
126136
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
127137
*/
@@ -444,6 +454,21 @@ export interface BillingPaymentResource extends ClerkResource {
444454
*/
445455
export type GetPaymentAttemptsParams = WithOptionalOrgType<ClerkPaginationParams>;
446456

457+
/**
458+
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
459+
*/
460+
export type GetPaymentAttemptParams = { id: string } & WithOptionalOrgType<ClerkPaginationParams>;
461+
462+
/**
463+
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
464+
*/
465+
export type GetStatementParams = {
466+
/**
467+
* The ID of the statement to fetch.
468+
*/
469+
id: string;
470+
} & WithOptionalOrgType<ClerkPaginationParams>;
471+
447472
/**
448473
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
449474
*/
@@ -838,7 +863,7 @@ export interface BillingCheckoutResource extends ClerkResource {
838863
}
839864

840865
/**
841-
* The `BillingPayerResource` type represents a payer associated with a billing subscription.
866+
* The `BillingPayerResource` type represents a payer associated with a Billing Subscription.
842867
*
843868
* @experimental This is an experimental API for the Billing feature that is available under a public beta, and the API is subject to change. It is advised to [pin](https://clerk.com/docs/pinning) the SDK version and the clerk-js version to avoid breaking changes.
844869
*/

0 commit comments

Comments
 (0)