Skip to content

Commit d22b94f

Browse files
committed
Merge branch 'main' into keiran/com-974
2 parents 1bf510b + 56e014c commit d22b94f

File tree

82 files changed

+1256
-604
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1256
-604
lines changed

integration/tests/pricing-table.test.ts

Lines changed: 46 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -142,19 +142,6 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
142142
await newFakeUser.deleteIfExists();
143143
});
144144

145-
// test('can manage and cancel subscription', async ({ page, context }) => {
146-
// const u = createTestUtils({ app, page, context });
147-
// await u.po.signIn.goTo();
148-
// await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password });
149-
// await u.po.page.goToRelative('/pricing-table');
150-
151-
// await u.po.pricingTable.waitForMounted();
152-
// await u.po.pricingTable.clickManageSubscription();
153-
// await u.po.page.getByRole('button', { name: 'Cancel subscription' }).click();
154-
// await u.po.page.getByRole('alertdialog').getByRole('button', { name: 'Cancel subscription' }).click();
155-
// await expect(u.po.page.getByRole('button', { name: /resubscribe|re-subscribe/i }).first()).toBeVisible();
156-
// });
157-
158145
test.describe('redirects', () => {
159146
test('default navigates to afterSignInUrl', async ({ page, context }) => {
160147
const u = createTestUtils({ app, page, context });
@@ -260,6 +247,51 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
260247
await fakeUser.deleteIfExists();
261248
});
262249

250+
test('can unsubscribe from a plan', async ({ page, context }) => {
251+
const u = createTestUtils({ app, page, context });
252+
253+
const fakeUser = u.services.users.createFakeUser();
254+
await u.services.users.createBapiUser(fakeUser);
255+
256+
await u.po.signIn.goTo();
257+
await u.po.signIn.signInWithEmailAndInstantPassword({ email: fakeUser.email, password: fakeUser.password });
258+
await u.po.page.goToRelative('/user');
259+
260+
await u.po.userProfile.waitForMounted();
261+
await u.po.userProfile.switchToBillingTab();
262+
await expect(u.po.page.getByText(/Free/i)).toBeVisible();
263+
await u.po.page.getByRole('button', { name: 'Switch plans' }).click();
264+
await u.po.pricingTable.startCheckout({ planSlug: 'plus' });
265+
await u.po.checkout.waitForMounted();
266+
await u.po.checkout.fillTestCard();
267+
await u.po.checkout.clickPayOrSubscribe();
268+
await expect(u.po.page.getByText('Payment was successful!')).toBeVisible();
269+
270+
await u.po.checkout.confirmAndContinue();
271+
await u.po.page.locator('.cl-headerBackLink').getByText('Plans').click();
272+
273+
await u.page.waitForTimeout(1000);
274+
await expect(u.po.page.locator('.cl-profileSectionContent__subscriptionsList').getByText('Plus')).toBeVisible();
275+
await u.po.page.getByRole('button', { name: 'Manage subscription' }).first().click();
276+
await u.po.subscriptionDetails.waitForMounted();
277+
await u.po.subscriptionDetails.root.locator('.cl-menuButtonEllipsisBordered').click();
278+
await u.po.subscriptionDetails.root.getByText('Cancel subscription').click();
279+
await u.po.subscriptionDetails.root.locator('.cl-drawerConfirmationRoot').waitFor({ state: 'visible' });
280+
await u.po.subscriptionDetails.root.getByText('Cancel subscription').click();
281+
await u.po.subscriptionDetails.waitForUnmounted();
282+
283+
// Verify the Free plan with Upcoming status exists
284+
await expect(
285+
u.po.page
286+
.locator('.cl-profileSectionContent__subscriptionsList')
287+
.getByText('Free')
288+
.locator('xpath=..')
289+
.getByText('Upcoming'),
290+
).toBeVisible();
291+
292+
await fakeUser.deleteIfExists();
293+
});
294+
263295
test('checkout always revalidates on open', async ({ page, context }) => {
264296
const u = createTestUtils({ app, page, context });
265297

@@ -351,7 +383,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withBilling] })('pricing tabl
351383
page
352384
.locator('.cl-checkout-root')
353385
.getByText(
354-
'You cannot subscribe to this plan by paying monthly. To subscribe to this plan, you need to choose to pay annually',
386+
'You cannot subscribe to this plan by paying monthly. To subscribe to this plan, you need to choose to pay annually.',
355387
),
356388
).toBeVisible();
357389

integration/tests/session-tasks-sign-up.test.ts

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
1111

1212
let fakeUser: FakeUser;
1313

14-
test.beforeAll(() => {
14+
test.beforeEach(() => {
1515
const u = createTestUtils({ app });
1616
fakeUser = u.services.users.createFakeUser({
1717
fictionalEmail: true,
@@ -27,6 +27,12 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
2727
await app.teardown();
2828
});
2929

30+
test.afterEach(async ({ page, context }) => {
31+
const u = createTestUtils({ app, page, context });
32+
await u.page.signOut();
33+
await u.page.context().clearCookies();
34+
});
35+
3036
test('navigate to task on after sign-up', async ({ page, context }) => {
3137
// Performs sign-up
3238
const u = createTestUtils({ app, page, context });
@@ -51,5 +57,31 @@ testAgainstRunningApps({ withEnv: [appConfigs.envs.withSessionTasks] })(
5157
// Navigates to after sign-up
5258
await u.page.waitForAppUrl('/');
5359
});
60+
61+
test('with sso, navigate to task on after sign-up', async ({ page, context }) => {
62+
const u = createTestUtils({ app, page, context });
63+
64+
await u.po.signUp.goTo();
65+
await u.page.getByRole('button', { name: 'E2E OAuth Provider' }).click();
66+
67+
await u.po.signIn.waitForMounted();
68+
await u.po.signIn.getGoToSignUp().click();
69+
70+
await u.po.signUp.waitForMounted();
71+
await u.po.signUp.setEmailAddress(fakeUser.email);
72+
await u.po.signUp.continue();
73+
await u.po.signUp.enterTestOtpCode();
74+
75+
// Resolves task
76+
await u.po.signIn.waitForMounted();
77+
const fakeOrganization = Object.assign(u.services.organizations.createFakeOrganization(), {
78+
slug: u.services.organizations.createFakeOrganization().slug + '-with-sign-in-sso',
79+
});
80+
await u.po.sessionTask.resolveForceOrganizationSelectionTask(fakeOrganization);
81+
await u.po.expect.toHaveResolvedTask();
82+
83+
// Navigates to after sign-up
84+
await u.page.waitForAppUrl('/');
85+
});
5486
},
5587
);

packages/agent-toolkit/CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
# @clerk/agent-toolkit
22

3+
## 0.1.11
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [[`d2f6f9e`](https://github.com/clerk/javascript/commit/d2f6f9e02036a4288916fcce14f24be5d56561c4), [`a329836`](https://github.com/clerk/javascript/commit/a329836a6c64f0a551a277ccae07043456a70523), [`5fbf8df`](https://github.com/clerk/javascript/commit/5fbf8df84b6d47082a76047451274790b8579b2d), [`6041c39`](https://github.com/clerk/javascript/commit/6041c39a31e787a6065dbc3f21e1c569982a06de), [`3f1270d`](https://github.com/clerk/javascript/commit/3f1270db86a21ead0ed6f0bd4f9986485203e973), [`1d9c409`](https://github.com/clerk/javascript/commit/1d9c409d10cc88667e354664d66c5f74b8bf4ca7), [`df49349`](https://github.com/clerk/javascript/commit/df4934983ee60246cd9df217afd7384aad556387)]:
8+
- @clerk/types@4.68.0
9+
- @clerk/shared@3.13.0
10+
- @clerk/backend@2.5.0
11+
312
## 0.1.10
413

514
### Patch Changes

packages/agent-toolkit/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clerk/agent-toolkit",
3-
"version": "0.1.10",
3+
"version": "0.1.11",
44
"description": "Clerk Toolkit for AI Agents",
55
"homepage": "https://clerk.com/",
66
"bugs": {

packages/astro/CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# @clerk/astro
22

3+
## 2.10.8
4+
5+
### Patch Changes
6+
7+
- Ensure proper typing for `SignUpButton` and only allow `unsafeMetadata={...}` when `mode="modal"` ([#6340](https://github.com/clerk/javascript/pull/6340)) by [@tmilewski](https://github.com/tmilewski)
8+
9+
- Updated dependencies [[`d2f6f9e`](https://github.com/clerk/javascript/commit/d2f6f9e02036a4288916fcce14f24be5d56561c4), [`a329836`](https://github.com/clerk/javascript/commit/a329836a6c64f0a551a277ccae07043456a70523), [`5fbf8df`](https://github.com/clerk/javascript/commit/5fbf8df84b6d47082a76047451274790b8579b2d), [`6041c39`](https://github.com/clerk/javascript/commit/6041c39a31e787a6065dbc3f21e1c569982a06de), [`3f1270d`](https://github.com/clerk/javascript/commit/3f1270db86a21ead0ed6f0bd4f9986485203e973), [`1d9c409`](https://github.com/clerk/javascript/commit/1d9c409d10cc88667e354664d66c5f74b8bf4ca7), [`df49349`](https://github.com/clerk/javascript/commit/df4934983ee60246cd9df217afd7384aad556387)]:
10+
- @clerk/types@4.68.0
11+
- @clerk/shared@3.13.0
12+
- @clerk/backend@2.5.0
13+
314
## 2.10.7
415

516
### Patch Changes

packages/astro/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clerk/astro",
3-
"version": "2.10.7",
3+
"version": "2.10.8",
44
"description": "Clerk SDK for Astro",
55
"keywords": [
66
"auth",

packages/astro/src/react/SignUpButton.tsx

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,8 @@ export type { SignUpButtonProps };
77

88
export const SignUpButton = withClerk(
99
({ clerk, children, ...props }: WithClerkProp<React.PropsWithChildren<SignUpButtonProps>>) => {
10-
const {
11-
fallbackRedirectUrl,
12-
forceRedirectUrl,
13-
signInFallbackRedirectUrl,
14-
signInForceRedirectUrl,
15-
mode,
16-
unsafeMetadata,
17-
...rest
18-
} = props;
10+
const { fallbackRedirectUrl, forceRedirectUrl, signInFallbackRedirectUrl, signInForceRedirectUrl, mode, ...rest } =
11+
props;
1912

2013
children = normalizeWithDefaultValue(children, 'Sign up');
2114
const child = assertSingleChild(children)('SignUpButton');
@@ -26,15 +19,18 @@ export const SignUpButton = withClerk(
2619
forceRedirectUrl,
2720
signInFallbackRedirectUrl,
2821
signInForceRedirectUrl,
29-
unsafeMetadata,
3022
};
3123

3224
if (!clerk) {
3325
return;
3426
}
3527

3628
if (mode === 'modal') {
37-
return clerk.openSignUp({ ...opts, appearance: props.appearance });
29+
return clerk.openSignUp({
30+
...opts,
31+
appearance: props.appearance,
32+
unsafeMetadata: props.unsafeMetadata,
33+
});
3834
}
3935

4036
return clerk.redirectToSignUp({

packages/backend/CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,21 @@
11
# Change Log
22

3+
## 2.5.0
4+
5+
### Minor Changes
6+
7+
- Add machines Backend API resource and methods ([#6335](https://github.com/clerk/javascript/pull/6335)) by [@wobsoriano](https://github.com/wobsoriano)
8+
9+
### Patch Changes
10+
11+
- Bump `snakecase-keys` to v9 which is the first ESM-only versions. This change should resolve any `TypeError: Cannot destructure property 'snakeCase' of 'require(...)' as it is undefined.` errors using Vitest. ([#6255](https://github.com/clerk/javascript/pull/6255)) by [@wobsoriano](https://github.com/wobsoriano)
12+
13+
- Update `clerk.samlConnections.getSamlConnectionList()` to return paginated data and export the `SamlConnection` type. ([#6332](https://github.com/clerk/javascript/pull/6332)) by [@jaredpiedt](https://github.com/jaredpiedt)
14+
15+
- Updated dependencies [[`d2f6f9e`](https://github.com/clerk/javascript/commit/d2f6f9e02036a4288916fcce14f24be5d56561c4), [`a329836`](https://github.com/clerk/javascript/commit/a329836a6c64f0a551a277ccae07043456a70523), [`6041c39`](https://github.com/clerk/javascript/commit/6041c39a31e787a6065dbc3f21e1c569982a06de), [`3f1270d`](https://github.com/clerk/javascript/commit/3f1270db86a21ead0ed6f0bd4f9986485203e973)]:
16+
- @clerk/types@4.68.0
17+
- @clerk/shared@3.13.0
18+
319
## 2.4.5
420

521
### Patch Changes

packages/backend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@clerk/backend",
3-
"version": "2.4.5",
3+
"version": "2.5.0",
44
"description": "Clerk Backend SDK - REST Client for Backend API & JWT verification utilities",
55
"homepage": "https://clerk.com/",
66
"bugs": {
@@ -110,7 +110,7 @@
110110
"@clerk/shared": "workspace:^",
111111
"@clerk/types": "workspace:^",
112112
"cookie": "1.0.2",
113-
"snakecase-keys": "8.0.1",
113+
"snakecase-keys": "9.0.1",
114114
"standardwebhooks": "^1.0.0",
115115
"tslib": "catalog:repo"
116116
},

packages/backend/src/api/__tests__/SamlConnectionApi.test.ts

Lines changed: 35 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -12,33 +12,36 @@ describe('SamlConnectionAPI', () => {
1212

1313
describe('getSamlConnectionList', () => {
1414
it('successfully fetches SAML connections with all parameters', async () => {
15-
const mockSamlConnectionsResponse = [
16-
{
17-
object: 'saml_connection',
18-
id: 'samlc_123',
19-
name: 'Test Connection',
20-
provider: 'saml_custom',
21-
domain: 'test.example.com',
22-
organization_id: 'org_123',
23-
created_at: 1672531200000,
24-
updated_at: 1672531200000,
25-
active: true,
26-
sync_user_attributes: false,
27-
allow_subdomains: false,
28-
allow_idp_initiated: false,
29-
idp_entity_id: 'entity_123',
30-
idp_sso_url: 'https://idp.example.com/sso',
31-
idp_certificate: 'cert_data',
32-
idp_metadata_url: null,
33-
idp_metadata: null,
34-
attribute_mapping: {
35-
user_id: 'userId',
36-
email_address: 'email',
37-
first_name: 'firstName',
38-
last_name: 'lastName',
15+
const mockSamlConnectionsResponse = {
16+
data: [
17+
{
18+
object: 'saml_connection',
19+
id: 'samlc_123',
20+
name: 'Test Connection',
21+
provider: 'saml_custom',
22+
domain: 'test.example.com',
23+
organization_id: 'org_123',
24+
created_at: 1672531200000,
25+
updated_at: 1672531200000,
26+
active: true,
27+
sync_user_attributes: false,
28+
allow_subdomains: false,
29+
allow_idp_initiated: false,
30+
idp_entity_id: 'entity_123',
31+
idp_sso_url: 'https://idp.example.com/sso',
32+
idp_certificate: 'cert_data',
33+
idp_metadata_url: null,
34+
idp_metadata: null,
35+
attribute_mapping: {
36+
user_id: 'userId',
37+
email_address: 'email',
38+
first_name: 'firstName',
39+
last_name: 'lastName',
40+
},
3941
},
40-
},
41-
];
42+
],
43+
total_count: 1,
44+
};
4245

4346
server.use(
4447
http.get(
@@ -50,7 +53,7 @@ describe('SamlConnectionAPI', () => {
5053
expect(url.searchParams.get('limit')).toBe('5');
5154
expect(url.searchParams.get('offset')).toBe('10');
5255
expect(url.searchParams.getAll('organization_id')).toEqual(['+org_123', '-org_456']);
53-
return HttpResponse.json({ data: mockSamlConnectionsResponse });
56+
return HttpResponse.json(mockSamlConnectionsResponse);
5457
}),
5558
),
5659
);
@@ -63,10 +66,11 @@ describe('SamlConnectionAPI', () => {
6366
offset: 10,
6467
});
6568

66-
expect(response).toHaveLength(1);
67-
expect(response[0].id).toBe('samlc_123');
68-
expect(response[0].name).toBe('Test Connection');
69-
expect(response[0].organizationId).toBe('org_123');
69+
expect(response.data).toHaveLength(1);
70+
expect(response.data[0].id).toBe('samlc_123');
71+
expect(response.data[0].name).toBe('Test Connection');
72+
expect(response.data[0].organizationId).toBe('org_123');
73+
expect(response.totalCount).toBe(1);
7074
});
7175
});
7276
});

0 commit comments

Comments
 (0)