Skip to content

Commit

Permalink
feat(clerk-sdk-node): Pass clerkJSVersion in interstitial template
Browse files Browse the repository at this point in the history
  • Loading branch information
panteliselef committed Jun 14, 2023
1 parent 31f5dee commit b945c92
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .changeset/witty-books-jam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@clerk/clerk-sdk-node': patch
'@clerk/nextjs': patch
'@clerk/remix': patch
'@clerk/backend': patch
---

Allow `clerkJSVersion` to be passed when loading interstitial. Support for
- Nextjs
- Remix
- Node
3 changes: 3 additions & 0 deletions packages/sdk-node/src/authenticateRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export async function loadInterstitial({
clerkClient: ClerkClient;
requestState: RequestState;
}) {
const { clerkJSVersion, clerkJSUrl } = loadClientEnv();
/**
* When publishable key or frontendApi is present utilize the localInterstitial method
* and avoid the extra network call
Expand All @@ -32,6 +33,8 @@ export async function loadInterstitial({
signInUrl: requestState.signInUrl,
isSatellite: requestState.isSatellite,
domain: requestState.domain,
clerkJSVersion,
clerkJSUrl,
});
}
return await clerkClient.remotePrivateInterstitial();
Expand Down
3 changes: 3 additions & 0 deletions packages/sdk-node/src/clerkClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export const loadClientEnv = () => {
return {
publishableKey: process.env.CLERK_PUBLISHABLE_KEY || '',
frontendApi: process.env.CLERK_FRONTEND_API || '',
clerkJSUrl: process.env.CLERK_JS || '',
clerkJSVersion: process.env.CLERK_JS_VERSION || '',
};
};

Expand All @@ -23,6 +25,7 @@ export const loadApiEnv = () => {
isSatellite: process.env.CLERK_IS_SATELLITE === 'true',
};
};

/**
* This needs to be a *named* function in order to support the older
* new Clerk() syntax for v4 compatibility.
Expand Down

0 comments on commit b945c92

Please sign in to comment.