Skip to content

Commit 7f833da

Browse files
authored
chore(clerk-js): Drop deprecations (#2082)
* chore(clerk-react): Drop `frontendApi` * chore(clerk-react,chrome-extension): Drop `*MagicLink*` related exports * chore(clerk-js): Drop `*MagicLink*` related exports * chore(types): Drop `*MagicLink*` related exports * chore(clerk-js): Drop `orgs` claim * chore(clerk-js,types): Drop `afterSwitchOrganizationUrl` claim * chore(clerk-js): Drop support for `frontendApi` as parameter * chore(clerk-js,types): Drop image related properties - `ExternalAccount.avatarUrl` - `ExternalAccountJSON.avatar_url` - `Organization.logoUrl` - `OrganizationJSON.logo_url` - `User.profileImageUrl` - `UserJSON.profile_image_url` - `OrganizationMembershipPublicUserData.profileImageUrl` - `OrganizationMembershipPublicUserDataJSON.profile_image_url` * chore(clerk-js,types): Drop `*captcha` related methods from Clerk * chore(clerk-js,types): Drop `Organization` related deprecations * chore(*): Drop `useOrganizations` * chore(clerk-js,types): Drop `appearance.userProfile` * chore(clerk-js,clerk-react): Drop `membershipList` and `invitationList` params deprecations * chore(clerk-js,types): Drop `Clerk.setSession` * chore(clerk-js,types): Drop `redirect_url` deprecations * chore(clerk-js,types): Drop `GetMembershipsParams` * chore(clerk-js): Drop `generateSignature` * chore(clerk-js,types): Drop `password` * chore(clerk-js,types): Drop deprecated `addListener/removeListener` from matchMedia return * chore(repo): Add word spelling in vscode workspace + fix typos * chore(clerk-js,types): Use paginated responses in get memberships endpoints * chore(repo): Add changeset * chore(clerk-js,types): Address PR comments
1 parent 73d2491 commit 7f833da

File tree

77 files changed

+285
-1538
lines changed

Some content is hidden

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

77 files changed

+285
-1538
lines changed

.changeset/fast-games-hide.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
---
2+
'@clerk/chrome-extension': major
3+
'@clerk/clerk-js': major
4+
'@clerk/nextjs': major
5+
'@clerk/shared': major
6+
'@clerk/clerk-react': major
7+
'@clerk/types': major
8+
'@clerk/clerk-expo': major
9+
---
10+
11+
Drop deprecations. Migration steps:
12+
- use `publishableKey` instead of `frontendApi`
13+
- use `Clerk.handleEmailLinkVerification()` instead of `Clerk.handleMagicLinkVerification()`
14+
- use `isEmailLinkError` instead of `isMagicLinkError`
15+
- use `EmailLinkErrorCode` instead of `MagicLinkErrorCode`
16+
- use `useEmailLink` instead of `useMagicLink`
17+
- drop `orgs` jwt claim from session token
18+
- use `ExternalAccount.imageUrl` instead of `ExternalAccount.avatarUrl`
19+
- use `Organization.imageUrl` instead of `Organization.logoUrl`
20+
- use `User.imageUrl` instead of `User.profileImageUrl`
21+
- use `OrganizationMembershipPublicUserData.imageUrl` instead of `OrganizationMembershipPublicUserData.profileImageUrl`
22+
- use `useOrganizationList` instead of `useOrganizations`
23+
- use `userProfileProps` instead of `userProfile` in `Appearance`
24+
- use `Clerk.setActive()` instead of `Clerk.setSession()`
25+
- drop `password` param in `User.update()`
26+
- use `afterSelectOrganizationUrl` instead of `afterSwitchOrganizationUrl` in `OrganizationSwitcher`
27+
- drop `Clerk.experimental_canUseCaptcha` / `Clerk.Clerk.experimental_captchaSiteKey` / `Clerk.experimental_captchaURL` (were meant for internal use)
28+
- use `User.getOrganizationMemberships()` instead of `Clerk.getOrganizationMemberships()`
29+
- drop `lastOrganizationInvitation` / `lastOrganizationMember` from Clerk emitted events
30+
- drop `Clerk.__unstable__invitationUpdate` / `Clerk.__unstable__membershipUpdate`
31+
- drop support for string param in `Organization.create()`
32+
- use `Organization.getInvitations()` instead of `Organization.getPendingInvitations()`
33+
- use `pageSize` instead of `limit` in `OrganizationMembership.retrieve()`
34+
- use `initialPage` instead of `offset` in `OrganizationMembership.retrieve()`
35+
- drop `lastOrganizationInvitation` / `lastOrganizationMember` from ClerkProvider
36+
- use `invitations` instead of `invitationList` in `useOrganization`
37+
- use `memberships` instead of `membershipList` in `useOrganization`
38+
- use `redirectUrl` instead of `redirect_url` in `User.createExternalAccount()`
39+
- use `signature` instead of `generatedSignature` in `Signup.attemptWeb3WalletVerification()`

.vscode/settings.json

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,24 @@
55
"editor.codeActionsOnSave": {
66
"source.fixAll.eslint": true,
77
},
8-
"eslint.workingDirectories": [{ "mode": "auto" }],
8+
"eslint.workingDirectories": [
9+
{
10+
"mode": "auto"
11+
}
12+
],
13+
"cSpell.words": [
14+
"accountsstage",
15+
"adduser",
16+
"arethetypeswrong",
17+
"attw",
18+
"BAPI",
19+
"citty",
20+
"execa",
21+
"FAPI",
22+
"jwks",
23+
"lclclerk",
24+
"lclstage",
25+
"nextjs",
26+
"publint"
27+
],
928
}

packages/chrome-extension/src/__snapshots__/exports.test.ts.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ exports[`public exports should not include a breaking change 1`] = `
4141
"useEmailLink",
4242
"useOrganization",
4343
"useOrganizationList",
44-
"useOrganizations",
4544
"useSession",
4645
"useSessionList",
4746
"useSignIn",

packages/clerk-js/README.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,13 @@ There are two ways you can include ClerkJS in your project. You can either [impo
4444
npm install @clerk/clerk-js
4545
```
4646

47-
Once you have installed the package, you will need to import the ClerkJS object constructor into your code and pass it your [Frontend API](https://dashboard.clerk.com/last-active?path=api-keys) as a parameter.
47+
Once you have installed the package, you will need to import the ClerkJS object constructor into your code and pass it your [Publishable Key](https://dashboard.clerk.com/last-active?path=api-keys) as a parameter.
4848

4949
```js
5050
import Clerk from '@clerk/clerk-js';
5151

52-
const clerkFrontendApi = 'pk_[publishable_key]';
53-
const clerk = new Clerk(clerkFrontendApi);
52+
const clerkPublishableKey = 'pk_[publishable_key]';
53+
const clerk = new Clerk(clerkPublishableKey);
5454
await clerk.load({
5555
// Set load options here...
5656
});
@@ -65,14 +65,13 @@ Add the following script to your site's `<body>` element:
6565
```html
6666
<script>
6767
// Get this URL and Publishable Key from the Clerk Dashboard
68-
const clerkFrontendApi = 'pk_[publishable_key]';
68+
const clerkPublishableKey = 'pk_[publishable_key]';
6969
const frontendApi = '[your-domain].clerk.accounts.dev';
7070
const version = '@latest'; // Set to appropriate version
7171
7272
// Creates asynchronous script
7373
const script = document.createElement('script');
74-
script.setAttribute('data-clerk-frontend-api', frontendApi);
75-
script.setAttribute('data-clerk-publishable-key', clerkFrontendApi);
74+
script.setAttribute('data-clerk-publishable-key', clerkPublishableKey);
7675
script.async = true;
7776
script.src = `https://${frontendApi}/npm/@clerk/clerk-js${version}/dist/clerk.browser.js`;
7877

packages/clerk-js/jest.setup.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ if (typeof window !== 'undefined') {
1515
matches: false,
1616
media: query,
1717
onchange: null,
18-
addListener: jest.fn(), // deprecated
19-
removeListener: jest.fn(), // deprecated
2018
addEventListener: jest.fn(),
2119
removeEventListener: jest.fn(),
2220
dispatchEvent: jest.fn(),
@@ -28,7 +26,6 @@ if (typeof window !== 'undefined') {
2826

2927
//@ts-expect-error
3028
global.IntersectionObserver = class IntersectionObserver {
31-
// eslint-disable-next-line @typescript-eslint/no-empty-function
3229
constructor() {}
3330

3431
disconnect() {

packages/clerk-js/src/core/clerk.redirects.test.ts

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const mockUserSettings = {
5252
},
5353
};
5454

55-
const developmentFrontendApi = 'clerk.abcef.12345.dev.lclclerk.com';
56-
const productionFrontendApi = 'clerk.abcef.12345.prod.lclclerk.com';
55+
const developmentPublishableKey = 'pk_test_Y2xlcmsuYWJjZWYuMTIzNDUuZGV2LmxjbGNsZXJrLmNvbSQ';
56+
const productionPublishableKey = 'pk_live_Y2xlcmsuYWJjZWYuMTIzNDUucHJvZC5sY2xjbGVyay5jb20k';
5757

5858
describe('Clerk singleton - Redirects', () => {
5959
let mockNavigate = jest.fn();
@@ -111,12 +111,12 @@ describe('Clerk singleton - Redirects', () => {
111111

112112
mockUsesUrlBasedSessionSync.mockReturnValue(true);
113113

114-
clerkForProductionInstance = new Clerk(productionFrontendApi);
114+
clerkForProductionInstance = new Clerk(productionPublishableKey);
115115
await clerkForProductionInstance.load({
116116
navigate: mockNavigate,
117117
});
118118

119-
clerkForDevelopmentInstance = new Clerk(developmentFrontendApi);
119+
clerkForDevelopmentInstance = new Clerk(developmentPublishableKey);
120120
await clerkForDevelopmentInstance.load({
121121
navigate: mockNavigate,
122122
});
@@ -189,12 +189,12 @@ describe('Clerk singleton - Redirects', () => {
189189

190190
mockUsesUrlBasedSessionSync.mockReturnValue(true);
191191

192-
clerkForProductionInstance = new Clerk(productionFrontendApi);
192+
clerkForProductionInstance = new Clerk(productionPublishableKey);
193193
await clerkForProductionInstance.load({
194194
navigate: mockNavigate,
195195
});
196196

197-
clerkForDevelopmentInstance = new Clerk(developmentFrontendApi);
197+
clerkForDevelopmentInstance = new Clerk(developmentPublishableKey);
198198
await clerkForDevelopmentInstance.load({
199199
navigate: mockNavigate,
200200
});
@@ -280,12 +280,12 @@ describe('Clerk singleton - Redirects', () => {
280280
beforeEach(async () => {
281281
mockUsesUrlBasedSessionSync.mockReturnValue(false);
282282

283-
clerkForProductionInstance = new Clerk(productionFrontendApi);
283+
clerkForProductionInstance = new Clerk(productionPublishableKey);
284284
await clerkForProductionInstance.load({
285285
navigate: mockNavigate,
286286
});
287287

288-
clerkForDevelopmentInstance = new Clerk(developmentFrontendApi);
288+
clerkForDevelopmentInstance = new Clerk(developmentPublishableKey);
289289
await clerkForDevelopmentInstance.load({
290290
navigate: mockNavigate,
291291
});
@@ -313,12 +313,12 @@ describe('Clerk singleton - Redirects', () => {
313313
}),
314314
);
315315

316-
clerkForProductionInstance = new Clerk(productionFrontendApi);
316+
clerkForProductionInstance = new Clerk(productionPublishableKey);
317317
await clerkForProductionInstance.load({
318318
navigate: mockNavigate,
319319
});
320320

321-
clerkForDevelopmentInstance = new Clerk(developmentFrontendApi);
321+
clerkForDevelopmentInstance = new Clerk(developmentPublishableKey);
322322
await clerkForDevelopmentInstance.load({
323323
navigate: mockNavigate,
324324
});

0 commit comments

Comments
 (0)