Skip to content

Commit b13aa55

Browse files
Merge branch 'main' into austin/optional-password-exploration
2 parents 7c7e54d + 615be5e commit b13aa55

File tree

13 files changed

+89
-26
lines changed

13 files changed

+89
-26
lines changed

.changeset/empty-hotels-sing.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+
Apply application name to Coinbase Wallet requests

.changeset/social-eels-camp.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

.changeset/tame-carpets-sink.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
---
2+
'@clerk/expo': major
3+
---
4+
5+
Remove deprecated `Clerk` export in favor of `getClerkInstance()`.
6+
7+
```diff
8+
- import { Clerk } from '@clerk/clerk-expo';
9+
+ import { getClerkInstance } from '@clerk/expo';
10+
11+
- const token = await Clerk.session?.getToken();
12+
+ const token = await getClerkInstance().session?.getToken();
13+
```
14+
15+
If you need to create the instance before `ClerkProvider` renders, pass the `publishableKey`:
16+
17+
```tsx
18+
import { ClerkProvider, getClerkInstance } from '@clerk/expo';
19+
20+
const clerkInstance = getClerkInstance({ publishableKey: 'pk_xxx' });
21+
22+
// Use the instance outside of React
23+
const token = await clerkInstance?.session?.getToken();
24+
fetch('https://example.com/api', { headers: { Authorization: `Bearer ${token}` } });
25+
```
26+
27+
> [!NOTE]
28+
> - Calling `getClerkInstance()` with different publishable keys will create a new Clerk instance.
29+
> - If `getClerkInstance` is called without a publishable key, and `ClerkProvider` has not rendered yet, an error will be thrown.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"dev": "TURBO_UI=0 FORCE_COLOR=1 turbo dev --filter=@clerk/* --filter=!@clerk/expo --filter=!@clerk/tanstack-react-start --filter=!@clerk/chrome-extension",
1414
"dev:fe-libs": "TURBO_UI=0 FORCE_COLOR=1 turbo dev --filter=@clerk/clerk-js --filter=@clerk/ui",
1515
"dev:js": "TURBO_UI=0 FORCE_COLOR=1 turbo dev:current --filter=@clerk/clerk-js",
16-
"dev:sandbox": "TURBO_UI=0 FORCE_COLOR=1 turbo dev:sandbox --filter=@clerk/clerk-js --filter=@clerk/ui",
16+
"dev:sandbox": "TURBO_UI=0 FORCE_COLOR=1 turbo dev:sandbox",
1717
"format": "turbo format && node scripts/format-non-workspace.mjs",
1818
"format:check": "turbo format:check && node scripts/format-non-workspace.mjs --check",
1919
"preinstall": "npx only-allow pnpm",

packages/clerk-js/turbo.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@
2626
"inputs": ["sandbox/**"],
2727
"outputs": ["dist/**"]
2828
},
29+
"dev:sandbox": {
30+
"cache": false,
31+
"dependsOn": ["build"],
32+
"persistent": true
33+
},
2934
"test": {
3035
"inputs": [
3136
"*.d.ts",

packages/expo/src/index.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,6 @@ export {
88
isClerkRuntimeError,
99
} from '@clerk/react/errors';
1010

11-
/**
12-
* @deprecated Use `getClerkInstance()` instead.
13-
*/
14-
export { clerk as Clerk } from './provider/singleton';
1511
export { getClerkInstance } from './provider/singleton';
1612

1713
export * from './provider/ClerkProvider';

packages/expo/src/provider/singleton/createClerkInstance.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,6 @@ import type { BuildClerkOptions } from './types';
2525

2626
const KEY = '__clerk_client_jwt';
2727

28-
/**
29-
* @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.
30-
*/
31-
export let clerk: HeadlessBrowserClerk | BrowserClerk;
3228
let __internal_clerk: HeadlessBrowserClerk | BrowserClerk | undefined;
3329

3430
export function createClerkInstance(ClerkClass: typeof Clerk) {
@@ -53,7 +49,7 @@ export function createClerkInstance(ClerkClass: typeof Clerk) {
5349

5450
const getToken = tokenCache.getToken;
5551
const saveToken = tokenCache.saveToken;
56-
__internal_clerk = clerk = new ClerkClass(publishableKey);
52+
__internal_clerk = new ClerkClass(publishableKey);
5753

5854
if (Platform.OS === 'ios' || Platform.OS === 'android') {
5955
// @ts-expect-error - This is an internal API

packages/expo/src/provider/singleton/singleton.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,6 @@ import { Clerk } from '@clerk/clerk-js/headless';
22

33
import { createClerkInstance } from './createClerkInstance';
44

5-
/**
6-
* @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.
7-
*/
8-
export { clerk } from './createClerkInstance';
9-
105
/**
116
* Access or create a Clerk instance outside of React. If you are using it in Expo Web then it will only access the existing instance from `window.Clerk`
127
* @example

packages/expo/src/provider/singleton/singleton.web.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,8 @@ import type { BrowserClerk, HeadlessBrowserClerk } from '@clerk/react';
33
import type { BuildClerkOptions } from './types';
44

55
/**
6-
* @deprecated Use `getClerkInstance()` instead. `Clerk` will be removed in the next major version.
7-
*/
8-
export const clerk = globalThis?.window?.Clerk;
9-
10-
/**
11-
* No need to use options here as we are not creating a new instance of Clerk, we are just getting the existing instance from the window
6+
* Access the existing Clerk instance from `window.Clerk` on the web.
7+
* Unlike the native implementation, this does not create a new instance—it only returns the existing one set by ClerkProvider.
128
*/
139
export const getClerkInstance = (_options?: BuildClerkOptions): HeadlessBrowserClerk | BrowserClerk | undefined =>
1410
globalThis?.window?.Clerk;

packages/shared/src/internal/clerk-js/web3.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,12 +149,19 @@ export function createWeb3(moduleManager: ModuleManager) {
149149
return null;
150150
}
151151
const sdk = coinbaseModule.createCoinbaseWalletSDK({
152+
appName:
153+
(typeof window !== 'undefined' &&
154+
// @ts-expect-error missing types
155+
(window.Clerk as any)?.__internal_environment?.displayConfig?.applicationName) ||
156+
(typeof document !== 'undefined' && document.title) ||
157+
'Web3 Application',
152158
preference: {
153159
options: 'all',
154160
},
155161
});
156162
return sdk.getProvider();
157163
}
164+
158165
if (provider === 'base') {
159166
if (__BUILD_DISABLE_RHC__) {
160167
clerkUnsupportedEnvironmentWarning('Base');

0 commit comments

Comments
 (0)