@clerk/shared 3.45.1 → 3.46.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/runtime/alternativePhoneCode.d.mts +1 -1
- package/dist/runtime/alternativePhoneCode.d.ts +1 -1
- package/dist/runtime/{apiUrlFromPublishableKey-BP7H1KnO.d.mts → apiUrlFromPublishableKey-BMA_oB1l.d.mts} +2 -2
- package/dist/runtime/apiUrlFromPublishableKey-BMA_oB1l.d.mts.map +1 -0
- package/dist/runtime/apiUrlFromPublishableKey.d.mts +1 -1
- package/dist/runtime/authorization-errors.d.mts +1 -1
- package/dist/runtime/authorization-errors.d.ts +1 -1
- package/dist/runtime/authorization.d.mts +1 -1
- package/dist/runtime/authorization.d.mts.map +1 -1
- package/dist/runtime/authorization.d.ts +1 -1
- package/dist/runtime/authorization.d.ts.map +1 -1
- package/dist/runtime/clerkEventBus.d.mts +1 -1
- package/dist/runtime/clerkEventBus.d.ts +1 -1
- package/dist/runtime/{color-BPIJlM_q.d.mts → color-5EK-w4Pa.d.mts} +2 -2
- package/dist/runtime/{color-BPIJlM_q.d.mts.map → color-5EK-w4Pa.d.mts.map} +1 -1
- package/dist/runtime/{color-D9pV7PC1.d.ts → color-C7B_w9Xs.d.ts} +2 -2
- package/dist/runtime/{color-D9pV7PC1.d.ts.map → color-C7B_w9Xs.d.ts.map} +1 -1
- package/dist/runtime/color.d.mts +2 -2
- package/dist/runtime/color.d.ts +2 -2
- package/dist/runtime/{deriveState-CDRUMAcO.d.ts → deriveState-0XMAcFTN.d.ts} +2 -2
- package/dist/runtime/{deriveState-CDRUMAcO.d.ts.map → deriveState-0XMAcFTN.d.ts.map} +1 -1
- package/dist/runtime/{deriveState-CWCXneR1.d.mts → deriveState-l1EE4w-l.d.mts} +2 -2
- package/dist/runtime/{deriveState-CWCXneR1.d.mts.map → deriveState-l1EE4w-l.d.mts.map} +1 -1
- package/dist/runtime/deriveState.d.mts +2 -2
- package/dist/runtime/deriveState.d.ts +2 -2
- package/dist/runtime/{error-CXZSxpQx.d.ts → error-BF6UbvEX.d.ts} +2 -2
- package/dist/runtime/{error-CXZSxpQx.d.ts.map → error-BF6UbvEX.d.ts.map} +1 -1
- package/dist/runtime/{error-D82V0Ple.d.mts → error-Dyvw0cBN.d.mts} +2 -2
- package/dist/runtime/{error-D82V0Ple.d.mts.map → error-Dyvw0cBN.d.mts.map} +1 -1
- package/dist/runtime/error.d.mts +2 -2
- package/dist/runtime/error.d.ts +2 -2
- package/dist/runtime/globs.d.mts.map +1 -1
- package/dist/runtime/{index-C9ADSkZ3.d.mts → index-BX6sndeu.d.ts} +144 -3
- package/dist/runtime/index-BX6sndeu.d.ts.map +1 -0
- package/dist/runtime/{index-CXWCrlCX.d.ts → index-DRoX574n.d.mts} +144 -3
- package/dist/runtime/index-DRoX574n.d.mts.map +1 -0
- package/dist/runtime/index.d.mts +8 -8
- package/dist/runtime/index.d.ts +7 -7
- package/dist/runtime/index.js +2 -2
- package/dist/runtime/index.mjs +2 -2
- package/dist/runtime/jwtPayloadParser.d.mts +1 -1
- package/dist/runtime/jwtPayloadParser.d.ts +1 -1
- package/dist/runtime/{keys-Cl5EuXXY.d.mts → keys-83lzlaAG.d.mts} +2 -2
- package/dist/runtime/{keys-Cl5EuXXY.d.mts.map → keys-83lzlaAG.d.mts.map} +1 -1
- package/dist/runtime/{keys-3j7YU_LA.d.ts → keys-YrWvb2ed.d.ts} +2 -2
- package/dist/runtime/{keys-3j7YU_LA.d.ts.map → keys-YrWvb2ed.d.ts.map} +1 -1
- package/dist/runtime/keys.d.mts +2 -2
- package/dist/runtime/keys.d.ts +2 -2
- package/dist/runtime/{loadClerkJsScript-CjU8LpUt.d.ts → loadClerkJsScript-B6IzADUE.d.ts} +2 -2
- package/dist/runtime/{loadClerkJsScript-CjU8LpUt.d.ts.map → loadClerkJsScript-B6IzADUE.d.ts.map} +1 -1
- package/dist/runtime/{loadClerkJsScript-CkWw08yl.d.mts → loadClerkJsScript-BMs9X5iH.d.mts} +2 -2
- package/dist/runtime/{loadClerkJsScript-CkWw08yl.d.mts.map → loadClerkJsScript-BMs9X5iH.d.mts.map} +1 -1
- package/dist/runtime/{loadClerkJsScript-B6XF0Gc6.js → loadClerkJsScript-ClRfibaX.js} +2 -2
- package/dist/runtime/{loadClerkJsScript-B6XF0Gc6.js.map → loadClerkJsScript-ClRfibaX.js.map} +1 -1
- package/dist/runtime/{loadClerkJsScript-BJUJ-5JQ.mjs → loadClerkJsScript-DDvGauc8.mjs} +2 -2
- package/dist/runtime/{loadClerkJsScript-BJUJ-5JQ.mjs.map → loadClerkJsScript-DDvGauc8.mjs.map} +1 -1
- package/dist/runtime/loadClerkJsScript.d.mts +2 -2
- package/dist/runtime/loadClerkJsScript.d.ts +2 -2
- package/dist/runtime/loadClerkJsScript.js +2 -2
- package/dist/runtime/loadClerkJsScript.mjs +2 -2
- package/dist/runtime/oauth.d.mts +1 -1
- package/dist/runtime/oauth.d.ts +1 -1
- package/dist/runtime/organization.d.mts +1 -1
- package/dist/runtime/organization.d.ts +1 -1
- package/dist/runtime/{pathMatcher-C0F3pq5w.d.mts → pathMatcher--IdAeviC.d.mts} +2 -2
- package/dist/runtime/pathMatcher--IdAeviC.d.mts.map +1 -0
- package/dist/runtime/{pathMatcher-ksCPccgq.d.ts → pathMatcher-BUvD02EZ.d.ts} +2 -2
- package/dist/runtime/pathMatcher-BUvD02EZ.d.ts.map +1 -0
- package/dist/runtime/pathMatcher.d.mts +2 -2
- package/dist/runtime/pathMatcher.d.ts +2 -2
- package/dist/runtime/react/index.d.mts +8 -8
- package/dist/runtime/react/index.d.ts +7 -7
- package/dist/runtime/router.d.mts +1 -1
- package/dist/runtime/router.d.ts +1 -1
- package/dist/runtime/saml.d.mts +1 -1
- package/dist/runtime/saml.d.ts +1 -1
- package/dist/runtime/telemetry.d.mts +1 -1
- package/dist/runtime/telemetry.d.ts +1 -1
- package/dist/runtime/types/index.d.mts +2 -2
- package/dist/runtime/types/index.d.ts +2 -2
- package/dist/runtime/{versionSelector-CyRejX40.mjs → versionSelector-BTaEe_fh.mjs} +3 -3
- package/dist/runtime/{versionSelector-CyRejX40.mjs.map → versionSelector-BTaEe_fh.mjs.map} +1 -1
- package/dist/runtime/{versionSelector-BrBFWYRR.js → versionSelector-CPS7KdGH.js} +3 -3
- package/dist/runtime/{versionSelector-BrBFWYRR.js.map → versionSelector-CPS7KdGH.js.map} +1 -1
- package/dist/runtime/versionSelector.js +1 -1
- package/dist/runtime/versionSelector.mjs +1 -1
- package/dist/runtime/web3.d.mts +1 -1
- package/dist/runtime/web3.d.ts +1 -1
- package/dist/types/index.d.mts +143 -2
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.d.ts +143 -2
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/runtime/apiUrlFromPublishableKey-BP7H1KnO.d.mts.map +0 -1
- package/dist/runtime/index-C9ADSkZ3.d.mts.map +0 -1
- package/dist/runtime/index-CXWCrlCX.d.ts.map +0 -1
- package/dist/runtime/pathMatcher-C0F3pq5w.d.mts.map +0 -1
- package/dist/runtime/pathMatcher-ksCPccgq.d.ts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublishableKey } from "./index-
|
|
1
|
+
import { PublishableKey } from "./index-DRoX574n.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/keys.d.ts
|
|
4
4
|
|
|
@@ -100,4 +100,4 @@ declare function getCookieSuffix(publishableKey: string, subtle?: SubtleCrypto):
|
|
|
100
100
|
declare const getSuffixedCookieName: (cookieName: string, cookieSuffix: string) => string;
|
|
101
101
|
//#endregion
|
|
102
102
|
export { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey };
|
|
103
|
-
//# sourceMappingURL=keys-
|
|
103
|
+
//# sourceMappingURL=keys-83lzlaAG.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys-
|
|
1
|
+
{"version":3,"file":"keys-83lzlaAG.d.mts","names":[],"sources":["../../src/keys.ts"],"sourcesContent":[],"mappings":";;;;;;AAG8C;AAkC9C,KA7BK,0BAAA,GA6B8B;EA4BnB;EAIA,KAAA,CAAA,EAAA,OAAA;EA0EA;EA+BA,MAAA,CAAA,EAAA,MAAA;EAiCA;EAWA,QAAA,CAAA,EAAA,MAAA;EAWA;EAWA,WAAA,CAAA,EAAA,OAAA;AAYhB,CAAA;AAmBA;;;;;;iBA1OgB,mBAAA;iBA4BA,mBAAA,mCAEL;;IACR;iBACa,mBAAA,oCAEJ,6BACT;;;;;;;iBAuEa,gBAAA;;;;;;;iBA+BA,0BAAA,CAAA;;;;;;;oCAUsB;;;;;;;;;iBAuBtB,+BAAA;;;;;;;;iBAWA,8BAAA;;;;;;;;iBAWA,0BAAA;;;;;;;;iBAWA,yBAAA;;;;;;;;;iBAYM,eAAA,kCAEZ,eACP;;;;;;;;;cAgBU"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublishableKey } from "./index-
|
|
1
|
+
import { PublishableKey } from "./index-BX6sndeu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/keys.d.ts
|
|
4
4
|
|
|
@@ -100,4 +100,4 @@ declare function getCookieSuffix(publishableKey: string, subtle?: SubtleCrypto):
|
|
|
100
100
|
declare const getSuffixedCookieName: (cookieName: string, cookieSuffix: string) => string;
|
|
101
101
|
//#endregion
|
|
102
102
|
export { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey };
|
|
103
|
-
//# sourceMappingURL=keys-
|
|
103
|
+
//# sourceMappingURL=keys-YrWvb2ed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys-
|
|
1
|
+
{"version":3,"file":"keys-YrWvb2ed.d.ts","names":[],"sources":["../../src/keys.ts"],"sourcesContent":[],"mappings":";;;;;;AAG8C;AAkC9C,KA7BK,0BAAA,GA6B8B;EA4BnB;EAIA,KAAA,CAAA,EAAA,OAAA;EA0EA;EA+BA,MAAA,CAAA,EAAA,MAAA;EAiCA;EAWA,QAAA,CAAA,EAAA,MAAA;EAWA;EAWA,WAAA,CAAA,EAAA,OAAA;AAYhB,CAAA;AAmBA;;;;;;iBA1OgB,mBAAA;iBA4BA,mBAAA,mCAEL;;IACR;iBACa,mBAAA,oCAEJ,6BACT;;;;;;;iBAuEa,gBAAA;;;;;;;iBA+BA,0BAAA,CAAA;;;;;;;oCAUsB;;;;;;;;;iBAuBtB,+BAAA;;;;;;;;iBAWA,8BAAA;;;;;;;;iBAWA,0BAAA;;;;;;;;iBAWA,yBAAA;;;;;;;;;iBAYM,eAAA,kCAEZ,eACP;;;;;;;;;cAgBU"}
|
package/dist/runtime/keys.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey } from "./keys-
|
|
1
|
+
import "./index-DRoX574n.mjs";
|
|
2
|
+
import { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey } from "./keys-83lzlaAG.mjs";
|
|
3
3
|
export { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey };
|
package/dist/runtime/keys.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey } from "./keys-
|
|
1
|
+
import "./index-BX6sndeu.js";
|
|
2
|
+
import { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey } from "./keys-YrWvb2ed.js";
|
|
3
3
|
export { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClerkOptions, SDKMetadata, Without } from "./index-
|
|
1
|
+
import { ClerkOptions, SDKMetadata, Without } from "./index-BX6sndeu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/loadClerkJsScript.d.ts
|
|
4
4
|
|
|
@@ -74,4 +74,4 @@ declare const clerkJsScriptUrl: (opts: LoadClerkJsScriptOptions) => string;
|
|
|
74
74
|
declare const buildClerkJsScriptAttributes: (options: LoadClerkJsScriptOptions) => Record<string, string>;
|
|
75
75
|
//#endregion
|
|
76
76
|
export { type LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
77
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
77
|
+
//# sourceMappingURL=loadClerkJsScript-B6IzADUE.d.ts.map
|
package/dist/runtime/{loadClerkJsScript-CjU8LpUt.d.ts.map → loadClerkJsScript-B6IzADUE.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-B6IzADUE.d.ts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;AAEC;;;;;AAO0B;AAmKa,iBA5KxB,iCAAA,CA4KwB,WAAA,EAAA,MAAA,CAAA,EAAA,IAAA;KAxKnC,wBAAA,GAA2B,OAwK2C,CAxKnC,YAwKmC,EAAA,aAAA,CAAA,GAAA;EAAR,cAAA,EAAA,MAAA;EAAO,UAAA,CAAA,EAAA,MAAA;EAyDpE,cAAA,CAAA,EAAA,UAmBL,GAAA,EAnB+B;EA2B1B,cAAA,CAAA,EAAA,MAAA;gBAvPU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmKV,2BAAkC,6BAA2B,QAAQ;;;;;;;;;;;;;cAyDrE,yBAA0B;;;;;;;cA2B1B,wCAAyC,6BAAwB"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClerkOptions, SDKMetadata, Without } from "./index-
|
|
1
|
+
import { ClerkOptions, SDKMetadata, Without } from "./index-DRoX574n.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/loadClerkJsScript.d.ts
|
|
4
4
|
|
|
@@ -74,4 +74,4 @@ declare const clerkJsScriptUrl: (opts: LoadClerkJsScriptOptions) => string;
|
|
|
74
74
|
declare const buildClerkJsScriptAttributes: (options: LoadClerkJsScriptOptions) => Record<string, string>;
|
|
75
75
|
//#endregion
|
|
76
76
|
export { type LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
77
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
77
|
+
//# sourceMappingURL=loadClerkJsScript-BMs9X5iH.d.mts.map
|
package/dist/runtime/{loadClerkJsScript-CkWw08yl.d.mts.map → loadClerkJsScript-BMs9X5iH.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-BMs9X5iH.d.mts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;AAEC;;;;;AAO0B;AAmKa,iBA5KxB,iCAAA,CA4KwB,WAAA,EAAA,MAAA,CAAA,EAAA,IAAA;KAxKnC,wBAAA,GAA2B,OAwK2C,CAxKnC,YAwKmC,EAAA,aAAA,CAAA,GAAA;EAAR,cAAA,EAAA,MAAA;EAAO,UAAA,CAAA,EAAA,MAAA;EAyDpE,cAAA,CAAA,EAAA,UAmBL,GAAA,EAnB+B;EA2B1B,cAAA,CAAA,EAAA,MAAA;gBAvPU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmKV,2BAAkC,6BAA2B,QAAQ;;;;;;;;;;;;;cAyDrE,yBAA0B;;;;;;;cA2B1B,wCAAyC,6BAAwB"}
|
|
@@ -3,7 +3,7 @@ const require_error = require('./error-DIeXY7Ki.js');
|
|
|
3
3
|
const require_loadScript = require('./loadScript-D8zceEj8.js');
|
|
4
4
|
const require_proxy = require('./proxy-B_Yui2Mf.js');
|
|
5
5
|
const require_url = require('./url-Clb-n8zC.js');
|
|
6
|
-
const require_versionSelector = require('./versionSelector-
|
|
6
|
+
const require_versionSelector = require('./versionSelector-CPS7KdGH.js');
|
|
7
7
|
|
|
8
8
|
//#region src/loadClerkJsScript.ts
|
|
9
9
|
const ERROR_CODE = "failed_to_load_clerk_js";
|
|
@@ -226,4 +226,4 @@ Object.defineProperty(exports, 'setClerkJsLoadingErrorPackageName', {
|
|
|
226
226
|
return setClerkJsLoadingErrorPackageName;
|
|
227
227
|
}
|
|
228
228
|
});
|
|
229
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
229
|
+
//# sourceMappingURL=loadClerkJsScript-ClRfibaX.js.map
|
package/dist/runtime/{loadClerkJsScript-B6XF0Gc6.js.map → loadClerkJsScript-ClRfibaX.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-B6XF0Gc6.js","names":["createDevOrStagingUrlCache","buildErrorThrower","timeoutId","pollInterval","ClerkRuntimeError","isValidProxyUrl","proxyUrlToAbsoluteURL","parsePublishableKey","addClerkPrefix","versionSelector","obj: Record<string, string>"],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":["import { buildErrorThrower, ClerkRuntimeError } from './error';\nimport { createDevOrStagingUrlCache, parsePublishableKey } from './keys';\nimport { loadScript } from './loadScript';\nimport { isValidProxyUrl, proxyUrlToAbsoluteURL } from './proxy';\nimport type { ClerkOptions, SDKMetadata, Without } from './types';\nimport { addClerkPrefix } from './url';\nimport { versionSelector } from './versionSelector';\n\nconst ERROR_CODE = 'failed_to_load_clerk_js';\nconst ERROR_CODE_TIMEOUT = 'failed_to_load_clerk_js_timeout';\nconst FAILED_TO_LOAD_ERROR = 'Failed to load Clerk';\n\nconst { isDevOrStagingUrl } = createDevOrStagingUrlCache();\n\nconst errorThrower = buildErrorThrower({ packageName: '@clerk/shared' });\n\n/**\n * Sets the package name for error messages during ClerkJS script loading.\n *\n * @param packageName - The name of the package to use in error messages (e.g., '@clerk/clerk-react').\n * @example\n * ```typescript\n * setClerkJsLoadingErrorPackageName('@clerk/clerk-react');\n * ```\n */\nexport function setClerkJsLoadingErrorPackageName(packageName: string) {\n errorThrower.setPackageName({ packageName });\n}\n\ntype LoadClerkJsScriptOptions = Without<ClerkOptions, 'isSatellite'> & {\n publishableKey: string;\n clerkJSUrl?: string;\n clerkJSVariant?: 'headless' | '';\n clerkJSVersion?: string;\n sdkMetadata?: SDKMetadata;\n proxyUrl?: string;\n domain?: string;\n nonce?: string;\n /**\n * Timeout in milliseconds to wait for clerk-js to load before considering it failed.\n *\n * @default 15000 (15 seconds)\n */\n scriptLoadTimeout?: number;\n};\n\n/**\n * Validates that window.Clerk exists and is properly initialized.\n * This ensures we don't have false positives where the script loads but Clerk is malformed.\n *\n * @returns `true` if window.Clerk exists and has the expected structure with a load method.\n */\nfunction isClerkProperlyLoaded(): boolean {\n if (typeof window === 'undefined' || !(window as any).Clerk) {\n return false;\n }\n\n // Basic validation that window.Clerk has the expected structure\n const clerk = (window as any).Clerk;\n return typeof clerk === 'object' && typeof clerk.load === 'function';\n}\n\n/**\n * Checks if an existing script has a request error using Performance API.\n *\n * @param scriptUrl - The URL of the script to check.\n * @returns True if the script has failed to load due to a network/HTTP error.\n */\nfunction hasScriptRequestError(scriptUrl: string): boolean {\n if (typeof window === 'undefined' || !window.performance) {\n return false;\n }\n\n const entries = performance.getEntriesByName(scriptUrl, 'resource') as PerformanceResourceTiming[];\n\n if (entries.length === 0) {\n return false;\n }\n\n const scriptEntry = entries[entries.length - 1];\n\n // transferSize === 0 with responseEnd === 0 indicates network failure\n // transferSize === 0 with responseEnd > 0 might be a 4xx/5xx error or blocked request\n if (scriptEntry.transferSize === 0 && scriptEntry.decodedBodySize === 0) {\n // If there was no response at all, it's definitely an error\n if (scriptEntry.responseEnd === 0) {\n return true;\n }\n // If we got a response but no content, likely an HTTP error (4xx/5xx)\n if (scriptEntry.responseEnd > 0 && scriptEntry.responseStart > 0) {\n return true;\n }\n\n if ('responseStatus' in scriptEntry) {\n const status = (scriptEntry as any).responseStatus;\n if (status >= 400) {\n return true;\n }\n if (scriptEntry.responseStatus === 0) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Waits for Clerk to be properly loaded with a timeout mechanism.\n * Uses polling to check if Clerk becomes available within the specified timeout.\n *\n * @param timeoutMs - Maximum time to wait in milliseconds.\n * @param existingScript - The existing script element to wait for. Optional, for existing scripts.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(\n timeoutMs: number,\n existingScript?: HTMLScriptElement,\n): Promise<HTMLScriptElement | null> {\n return new Promise((resolve, reject) => {\n let resolved = false;\n\n const cleanup = (timeoutId: ReturnType<typeof setTimeout>, pollInterval: ReturnType<typeof setInterval>) => {\n clearTimeout(timeoutId);\n clearInterval(pollInterval);\n };\n\n // Bail out early if the script fails to load, instead of waiting for the entire timeout\n existingScript?.addEventListener('error', () => {\n cleanup(timeoutId, pollInterval);\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE }));\n });\n\n const checkAndResolve = () => {\n if (resolved) {\n return;\n }\n\n if (isClerkProperlyLoaded()) {\n resolved = true;\n cleanup(timeoutId, pollInterval);\n resolve(null);\n }\n };\n\n const handleTimeout = () => {\n if (resolved) {\n return;\n }\n\n resolved = true;\n cleanup(timeoutId, pollInterval);\n\n if (!isClerkProperlyLoaded()) {\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE_TIMEOUT }));\n } else {\n resolve(null);\n }\n };\n\n const timeoutId = setTimeout(handleTimeout, timeoutMs);\n\n checkAndResolve();\n\n const pollInterval = setInterval(() => {\n if (resolved) {\n clearInterval(pollInterval);\n return;\n }\n checkAndResolve();\n }, 100);\n });\n}\n\n/**\n * Hotloads the Clerk JS script with robust failure detection and retry logic.\n *\n * For existing scripts:\n * - If no request error detected: waits for timeout, then retries with loadScript if timeout expires\n * - If request error detected: immediately retries with loadScript.\n *\n * For new scripts: uses loadScript which has built-in retry logic via the retry utility.\n *\n * @param opts - The options used to build the Clerk JS script URL and load the script.\n * Must include a `publishableKey` if no existing script is found.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error.\n *\n * @example\n * ```typescript\n * try {\n * await loadClerkJsScript({ publishableKey: 'pk_test_...' });\n * console.log('Clerk loaded successfully');\n * } catch (error) {\n * console.error('Failed to load Clerk:', error.message);\n * }\n * ```\n */\nconst loadClerkJsScript = async (opts?: LoadClerkJsScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n\n if (isClerkProperlyLoaded()) {\n return null;\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const scriptUrl = clerkJsScriptUrl(opts);\n const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n if (hasScriptRequestError(scriptUrl)) {\n existingScript.remove();\n } else {\n try {\n await waitForClerkWithTimeout(timeout, existingScript);\n return null;\n } catch {\n existingScript.remove();\n }\n }\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(scriptUrl, {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyClerkJsScriptAttributes(opts),\n }).catch(error => {\n throw new ClerkRuntimeError(FAILED_TO_LOAD_ERROR + (error.message ? `, ${error.message}` : ''), {\n code: ERROR_CODE,\n cause: error,\n });\n });\n\n return loadPromise;\n};\n\n/**\n * Generates a Clerk JS script URL based on the provided options.\n *\n * @param opts - The options to use when building the Clerk JS script URL.\n * @returns The complete URL to the Clerk JS script.\n *\n * @example\n * ```typescript\n * const url = clerkJsScriptUrl({ publishableKey: 'pk_test_...' });\n * // Returns: \"https://example.clerk.accounts.dev/npm/@clerk/clerk-js@5/dist/clerk.browser.js\"\n * ```\n */\nconst clerkJsScriptUrl = (opts: LoadClerkJsScriptOptions) => {\n const { clerkJSUrl, clerkJSVariant, clerkJSVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkJSUrl) {\n return clerkJSUrl;\n }\n\n let scriptHost = '';\n if (!!proxyUrl && isValidProxyUrl(proxyUrl)) {\n scriptHost = proxyUrlToAbsoluteURL(proxyUrl).replace(/http(s)?:\\/\\//, '');\n } else if (domain && !isDevOrStagingUrl(parsePublishableKey(publishableKey)?.frontendApi || '')) {\n scriptHost = addClerkPrefix(domain);\n } else {\n scriptHost = parsePublishableKey(publishableKey)?.frontendApi || '';\n }\n\n const variant = clerkJSVariant ? `${clerkJSVariant.replace(/\\.+$/, '')}.` : '';\n const version = versionSelector(clerkJSVersion);\n return `https://${scriptHost}/npm/@clerk/clerk-js@${version}/dist/clerk.${variant}browser.js`;\n};\n\n/**\n * Builds an object of Clerk JS script attributes based on the provided options.\n *\n * @param options - The options containing the values for script attributes.\n * @returns An object containing data attributes to be applied to the script element.\n */\nconst buildClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => {\n const obj: Record<string, string> = {};\n\n if (options.publishableKey) {\n obj['data-clerk-publishable-key'] = options.publishableKey;\n }\n\n if (options.proxyUrl) {\n obj['data-clerk-proxy-url'] = options.proxyUrl;\n }\n\n if (options.domain) {\n obj['data-clerk-domain'] = options.domain;\n }\n\n if (options.nonce) {\n obj.nonce = options.nonce;\n }\n\n return obj;\n};\n\n/**\n * Returns a function that applies Clerk JS script attributes to a script element.\n *\n * @param options - The options containing the values for script attributes.\n * @returns A function that accepts a script element and applies the attributes to it.\n */\nconst applyClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => (script: HTMLScriptElement) => {\n const attributes = buildClerkJsScriptAttributes(options);\n for (const attribute in attributes) {\n script.setAttribute(attribute, attributes[attribute]);\n }\n};\n\nexport { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript };\nexport type { LoadClerkJsScriptOptions };\n"],"mappings":";;;;;;;;AAQA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,uBAAuB;AAE7B,MAAM,EAAE,sBAAsBA,yCAA4B;AAE1D,MAAM,eAAeC,gCAAkB,EAAE,aAAa,iBAAiB,CAAC;;;;;;;;;;AAWxE,SAAgB,kCAAkC,aAAqB;AACrE,cAAa,eAAe,EAAE,aAAa,CAAC;;;;;;;;AA0B9C,SAAS,wBAAiC;AACxC,KAAI,OAAO,WAAW,eAAe,CAAE,OAAe,MACpD,QAAO;CAIT,MAAM,QAAS,OAAe;AAC9B,QAAO,OAAO,UAAU,YAAY,OAAO,MAAM,SAAS;;;;;;;;AAS5D,SAAS,sBAAsB,WAA4B;AACzD,KAAI,OAAO,WAAW,eAAe,CAAC,OAAO,YAC3C,QAAO;CAGT,MAAM,UAAU,YAAY,iBAAiB,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CAAgC,QAAQ;AAG9C,KAAI,QAAQ,SACV,KAAI,0BAA0B,QAAQ;AAGxC,KAAI,QAAQ,OACV,KAAI,uBAAuB,QAAQ;AAGrC,KAAI,QAAQ,MACV,KAAI,QAAQ,QAAQ;AAGtB,QAAO;;;;;;;;AAST,MAAM,gCAAgC,aAAuC,WAA8B;CACzG,MAAM,aAAa,6BAA6B,QAAQ;AACxD,MAAK,MAAM,aAAa,WACtB,QAAO,aAAa,WAAW,WAAW,WAAW"}
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-ClRfibaX.js","names":["createDevOrStagingUrlCache","buildErrorThrower","timeoutId","pollInterval","ClerkRuntimeError","isValidProxyUrl","proxyUrlToAbsoluteURL","parsePublishableKey","addClerkPrefix","versionSelector","obj: Record<string, string>"],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":["import { buildErrorThrower, ClerkRuntimeError } from './error';\nimport { createDevOrStagingUrlCache, parsePublishableKey } from './keys';\nimport { loadScript } from './loadScript';\nimport { isValidProxyUrl, proxyUrlToAbsoluteURL } from './proxy';\nimport type { ClerkOptions, SDKMetadata, Without } from './types';\nimport { addClerkPrefix } from './url';\nimport { versionSelector } from './versionSelector';\n\nconst ERROR_CODE = 'failed_to_load_clerk_js';\nconst ERROR_CODE_TIMEOUT = 'failed_to_load_clerk_js_timeout';\nconst FAILED_TO_LOAD_ERROR = 'Failed to load Clerk';\n\nconst { isDevOrStagingUrl } = createDevOrStagingUrlCache();\n\nconst errorThrower = buildErrorThrower({ packageName: '@clerk/shared' });\n\n/**\n * Sets the package name for error messages during ClerkJS script loading.\n *\n * @param packageName - The name of the package to use in error messages (e.g., '@clerk/clerk-react').\n * @example\n * ```typescript\n * setClerkJsLoadingErrorPackageName('@clerk/clerk-react');\n * ```\n */\nexport function setClerkJsLoadingErrorPackageName(packageName: string) {\n errorThrower.setPackageName({ packageName });\n}\n\ntype LoadClerkJsScriptOptions = Without<ClerkOptions, 'isSatellite'> & {\n publishableKey: string;\n clerkJSUrl?: string;\n clerkJSVariant?: 'headless' | '';\n clerkJSVersion?: string;\n sdkMetadata?: SDKMetadata;\n proxyUrl?: string;\n domain?: string;\n nonce?: string;\n /**\n * Timeout in milliseconds to wait for clerk-js to load before considering it failed.\n *\n * @default 15000 (15 seconds)\n */\n scriptLoadTimeout?: number;\n};\n\n/**\n * Validates that window.Clerk exists and is properly initialized.\n * This ensures we don't have false positives where the script loads but Clerk is malformed.\n *\n * @returns `true` if window.Clerk exists and has the expected structure with a load method.\n */\nfunction isClerkProperlyLoaded(): boolean {\n if (typeof window === 'undefined' || !(window as any).Clerk) {\n return false;\n }\n\n // Basic validation that window.Clerk has the expected structure\n const clerk = (window as any).Clerk;\n return typeof clerk === 'object' && typeof clerk.load === 'function';\n}\n\n/**\n * Checks if an existing script has a request error using Performance API.\n *\n * @param scriptUrl - The URL of the script to check.\n * @returns True if the script has failed to load due to a network/HTTP error.\n */\nfunction hasScriptRequestError(scriptUrl: string): boolean {\n if (typeof window === 'undefined' || !window.performance) {\n return false;\n }\n\n const entries = performance.getEntriesByName(scriptUrl, 'resource') as PerformanceResourceTiming[];\n\n if (entries.length === 0) {\n return false;\n }\n\n const scriptEntry = entries[entries.length - 1];\n\n // transferSize === 0 with responseEnd === 0 indicates network failure\n // transferSize === 0 with responseEnd > 0 might be a 4xx/5xx error or blocked request\n if (scriptEntry.transferSize === 0 && scriptEntry.decodedBodySize === 0) {\n // If there was no response at all, it's definitely an error\n if (scriptEntry.responseEnd === 0) {\n return true;\n }\n // If we got a response but no content, likely an HTTP error (4xx/5xx)\n if (scriptEntry.responseEnd > 0 && scriptEntry.responseStart > 0) {\n return true;\n }\n\n if ('responseStatus' in scriptEntry) {\n const status = (scriptEntry as any).responseStatus;\n if (status >= 400) {\n return true;\n }\n if (scriptEntry.responseStatus === 0) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Waits for Clerk to be properly loaded with a timeout mechanism.\n * Uses polling to check if Clerk becomes available within the specified timeout.\n *\n * @param timeoutMs - Maximum time to wait in milliseconds.\n * @param existingScript - The existing script element to wait for. Optional, for existing scripts.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(\n timeoutMs: number,\n existingScript?: HTMLScriptElement,\n): Promise<HTMLScriptElement | null> {\n return new Promise((resolve, reject) => {\n let resolved = false;\n\n const cleanup = (timeoutId: ReturnType<typeof setTimeout>, pollInterval: ReturnType<typeof setInterval>) => {\n clearTimeout(timeoutId);\n clearInterval(pollInterval);\n };\n\n // Bail out early if the script fails to load, instead of waiting for the entire timeout\n existingScript?.addEventListener('error', () => {\n cleanup(timeoutId, pollInterval);\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE }));\n });\n\n const checkAndResolve = () => {\n if (resolved) {\n return;\n }\n\n if (isClerkProperlyLoaded()) {\n resolved = true;\n cleanup(timeoutId, pollInterval);\n resolve(null);\n }\n };\n\n const handleTimeout = () => {\n if (resolved) {\n return;\n }\n\n resolved = true;\n cleanup(timeoutId, pollInterval);\n\n if (!isClerkProperlyLoaded()) {\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE_TIMEOUT }));\n } else {\n resolve(null);\n }\n };\n\n const timeoutId = setTimeout(handleTimeout, timeoutMs);\n\n checkAndResolve();\n\n const pollInterval = setInterval(() => {\n if (resolved) {\n clearInterval(pollInterval);\n return;\n }\n checkAndResolve();\n }, 100);\n });\n}\n\n/**\n * Hotloads the Clerk JS script with robust failure detection and retry logic.\n *\n * For existing scripts:\n * - If no request error detected: waits for timeout, then retries with loadScript if timeout expires\n * - If request error detected: immediately retries with loadScript.\n *\n * For new scripts: uses loadScript which has built-in retry logic via the retry utility.\n *\n * @param opts - The options used to build the Clerk JS script URL and load the script.\n * Must include a `publishableKey` if no existing script is found.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error.\n *\n * @example\n * ```typescript\n * try {\n * await loadClerkJsScript({ publishableKey: 'pk_test_...' });\n * console.log('Clerk loaded successfully');\n * } catch (error) {\n * console.error('Failed to load Clerk:', error.message);\n * }\n * ```\n */\nconst loadClerkJsScript = async (opts?: LoadClerkJsScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n\n if (isClerkProperlyLoaded()) {\n return null;\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const scriptUrl = clerkJsScriptUrl(opts);\n const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n if (hasScriptRequestError(scriptUrl)) {\n existingScript.remove();\n } else {\n try {\n await waitForClerkWithTimeout(timeout, existingScript);\n return null;\n } catch {\n existingScript.remove();\n }\n }\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(scriptUrl, {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyClerkJsScriptAttributes(opts),\n }).catch(error => {\n throw new ClerkRuntimeError(FAILED_TO_LOAD_ERROR + (error.message ? `, ${error.message}` : ''), {\n code: ERROR_CODE,\n cause: error,\n });\n });\n\n return loadPromise;\n};\n\n/**\n * Generates a Clerk JS script URL based on the provided options.\n *\n * @param opts - The options to use when building the Clerk JS script URL.\n * @returns The complete URL to the Clerk JS script.\n *\n * @example\n * ```typescript\n * const url = clerkJsScriptUrl({ publishableKey: 'pk_test_...' });\n * // Returns: \"https://example.clerk.accounts.dev/npm/@clerk/clerk-js@5/dist/clerk.browser.js\"\n * ```\n */\nconst clerkJsScriptUrl = (opts: LoadClerkJsScriptOptions) => {\n const { clerkJSUrl, clerkJSVariant, clerkJSVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkJSUrl) {\n return clerkJSUrl;\n }\n\n let scriptHost = '';\n if (!!proxyUrl && isValidProxyUrl(proxyUrl)) {\n scriptHost = proxyUrlToAbsoluteURL(proxyUrl).replace(/http(s)?:\\/\\//, '');\n } else if (domain && !isDevOrStagingUrl(parsePublishableKey(publishableKey)?.frontendApi || '')) {\n scriptHost = addClerkPrefix(domain);\n } else {\n scriptHost = parsePublishableKey(publishableKey)?.frontendApi || '';\n }\n\n const variant = clerkJSVariant ? `${clerkJSVariant.replace(/\\.+$/, '')}.` : '';\n const version = versionSelector(clerkJSVersion);\n return `https://${scriptHost}/npm/@clerk/clerk-js@${version}/dist/clerk.${variant}browser.js`;\n};\n\n/**\n * Builds an object of Clerk JS script attributes based on the provided options.\n *\n * @param options - The options containing the values for script attributes.\n * @returns An object containing data attributes to be applied to the script element.\n */\nconst buildClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => {\n const obj: Record<string, string> = {};\n\n if (options.publishableKey) {\n obj['data-clerk-publishable-key'] = options.publishableKey;\n }\n\n if (options.proxyUrl) {\n obj['data-clerk-proxy-url'] = options.proxyUrl;\n }\n\n if (options.domain) {\n obj['data-clerk-domain'] = options.domain;\n }\n\n if (options.nonce) {\n obj.nonce = options.nonce;\n }\n\n return obj;\n};\n\n/**\n * Returns a function that applies Clerk JS script attributes to a script element.\n *\n * @param options - The options containing the values for script attributes.\n * @returns A function that accepts a script element and applies the attributes to it.\n */\nconst applyClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => (script: HTMLScriptElement) => {\n const attributes = buildClerkJsScriptAttributes(options);\n for (const attribute in attributes) {\n script.setAttribute(attribute, attributes[attribute]);\n }\n};\n\nexport { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript };\nexport type { LoadClerkJsScriptOptions };\n"],"mappings":";;;;;;;;AAQA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,uBAAuB;AAE7B,MAAM,EAAE,sBAAsBA,yCAA4B;AAE1D,MAAM,eAAeC,gCAAkB,EAAE,aAAa,iBAAiB,CAAC;;;;;;;;;;AAWxE,SAAgB,kCAAkC,aAAqB;AACrE,cAAa,eAAe,EAAE,aAAa,CAAC;;;;;;;;AA0B9C,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AE,eAAe;CAGnE,MAAM,UAAU,iBAAiB,GAAG,eAAe,QAAQ,QAAQ,GAAG,CAAC,KAAK;CAC5E,MAAM,UAAUE,wCAAgB,eAAe;AAC/C,QAAO,WAAW,WAAW,uBAAuB,QAAQ,cAAc,QAAQ;;;;;;;;AASpF,MAAM,gCAAgC,YAAsC;CAC1E,MAAMC,MAA8B,EAAE;AAEtC,KAAI,QAAQ,eACV,KAAI,gCAAgC,QAAQ;AAG9C,KAAI,QAAQ,SACV,KAAI,0BAA0B,QAAQ;AAGxC,KAAI,QAAQ,OACV,KAAI,uBAAuB,QAAQ;AAGrC,KAAI,QAAQ,MACV,KAAI,QAAQ,QAAQ;AAGtB,QAAO;;;;;;;;AAST,MAAM,gCAAgC,aAAuC,WAA8B;CACzG,MAAM,aAAa,6BAA6B,QAAQ;AACxD,MAAK,MAAM,aAAa,WACtB,QAAO,aAAa,WAAW,WAAW,WAAW"}
|
|
@@ -3,7 +3,7 @@ import { ClerkRuntimeError, buildErrorThrower } from "./error-Dl9xmUf3.mjs";
|
|
|
3
3
|
import { loadScript } from "./loadScript-t1vaIfy5.mjs";
|
|
4
4
|
import { isValidProxyUrl, proxyUrlToAbsoluteURL } from "./proxy-Bq8EHApG.mjs";
|
|
5
5
|
import { addClerkPrefix } from "./url-Cdy8w8vK.mjs";
|
|
6
|
-
import { versionSelector } from "./versionSelector-
|
|
6
|
+
import { versionSelector } from "./versionSelector-BTaEe_fh.mjs";
|
|
7
7
|
|
|
8
8
|
//#region src/loadClerkJsScript.ts
|
|
9
9
|
const ERROR_CODE = "failed_to_load_clerk_js";
|
|
@@ -203,4 +203,4 @@ const applyClerkJsScriptAttributes = (options) => (script) => {
|
|
|
203
203
|
|
|
204
204
|
//#endregion
|
|
205
205
|
export { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
206
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
206
|
+
//# sourceMappingURL=loadClerkJsScript-DDvGauc8.mjs.map
|
package/dist/runtime/{loadClerkJsScript-BJUJ-5JQ.mjs.map → loadClerkJsScript-DDvGauc8.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-BJUJ-5JQ.mjs","names":["timeoutId","pollInterval","obj: Record<string, string>"],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":["import { buildErrorThrower, ClerkRuntimeError } from './error';\nimport { createDevOrStagingUrlCache, parsePublishableKey } from './keys';\nimport { loadScript } from './loadScript';\nimport { isValidProxyUrl, proxyUrlToAbsoluteURL } from './proxy';\nimport type { ClerkOptions, SDKMetadata, Without } from './types';\nimport { addClerkPrefix } from './url';\nimport { versionSelector } from './versionSelector';\n\nconst ERROR_CODE = 'failed_to_load_clerk_js';\nconst ERROR_CODE_TIMEOUT = 'failed_to_load_clerk_js_timeout';\nconst FAILED_TO_LOAD_ERROR = 'Failed to load Clerk';\n\nconst { isDevOrStagingUrl } = createDevOrStagingUrlCache();\n\nconst errorThrower = buildErrorThrower({ packageName: '@clerk/shared' });\n\n/**\n * Sets the package name for error messages during ClerkJS script loading.\n *\n * @param packageName - The name of the package to use in error messages (e.g., '@clerk/clerk-react').\n * @example\n * ```typescript\n * setClerkJsLoadingErrorPackageName('@clerk/clerk-react');\n * ```\n */\nexport function setClerkJsLoadingErrorPackageName(packageName: string) {\n errorThrower.setPackageName({ packageName });\n}\n\ntype LoadClerkJsScriptOptions = Without<ClerkOptions, 'isSatellite'> & {\n publishableKey: string;\n clerkJSUrl?: string;\n clerkJSVariant?: 'headless' | '';\n clerkJSVersion?: string;\n sdkMetadata?: SDKMetadata;\n proxyUrl?: string;\n domain?: string;\n nonce?: string;\n /**\n * Timeout in milliseconds to wait for clerk-js to load before considering it failed.\n *\n * @default 15000 (15 seconds)\n */\n scriptLoadTimeout?: number;\n};\n\n/**\n * Validates that window.Clerk exists and is properly initialized.\n * This ensures we don't have false positives where the script loads but Clerk is malformed.\n *\n * @returns `true` if window.Clerk exists and has the expected structure with a load method.\n */\nfunction isClerkProperlyLoaded(): boolean {\n if (typeof window === 'undefined' || !(window as any).Clerk) {\n return false;\n }\n\n // Basic validation that window.Clerk has the expected structure\n const clerk = (window as any).Clerk;\n return typeof clerk === 'object' && typeof clerk.load === 'function';\n}\n\n/**\n * Checks if an existing script has a request error using Performance API.\n *\n * @param scriptUrl - The URL of the script to check.\n * @returns True if the script has failed to load due to a network/HTTP error.\n */\nfunction hasScriptRequestError(scriptUrl: string): boolean {\n if (typeof window === 'undefined' || !window.performance) {\n return false;\n }\n\n const entries = performance.getEntriesByName(scriptUrl, 'resource') as PerformanceResourceTiming[];\n\n if (entries.length === 0) {\n return false;\n }\n\n const scriptEntry = entries[entries.length - 1];\n\n // transferSize === 0 with responseEnd === 0 indicates network failure\n // transferSize === 0 with responseEnd > 0 might be a 4xx/5xx error or blocked request\n if (scriptEntry.transferSize === 0 && scriptEntry.decodedBodySize === 0) {\n // If there was no response at all, it's definitely an error\n if (scriptEntry.responseEnd === 0) {\n return true;\n }\n // If we got a response but no content, likely an HTTP error (4xx/5xx)\n if (scriptEntry.responseEnd > 0 && scriptEntry.responseStart > 0) {\n return true;\n }\n\n if ('responseStatus' in scriptEntry) {\n const status = (scriptEntry as any).responseStatus;\n if (status >= 400) {\n return true;\n }\n if (scriptEntry.responseStatus === 0) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Waits for Clerk to be properly loaded with a timeout mechanism.\n * Uses polling to check if Clerk becomes available within the specified timeout.\n *\n * @param timeoutMs - Maximum time to wait in milliseconds.\n * @param existingScript - The existing script element to wait for. Optional, for existing scripts.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(\n timeoutMs: number,\n existingScript?: HTMLScriptElement,\n): Promise<HTMLScriptElement | null> {\n return new Promise((resolve, reject) => {\n let resolved = false;\n\n const cleanup = (timeoutId: ReturnType<typeof setTimeout>, pollInterval: ReturnType<typeof setInterval>) => {\n clearTimeout(timeoutId);\n clearInterval(pollInterval);\n };\n\n // Bail out early if the script fails to load, instead of waiting for the entire timeout\n existingScript?.addEventListener('error', () => {\n cleanup(timeoutId, pollInterval);\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE }));\n });\n\n const checkAndResolve = () => {\n if (resolved) {\n return;\n }\n\n if (isClerkProperlyLoaded()) {\n resolved = true;\n cleanup(timeoutId, pollInterval);\n resolve(null);\n }\n };\n\n const handleTimeout = () => {\n if (resolved) {\n return;\n }\n\n resolved = true;\n cleanup(timeoutId, pollInterval);\n\n if (!isClerkProperlyLoaded()) {\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE_TIMEOUT }));\n } else {\n resolve(null);\n }\n };\n\n const timeoutId = setTimeout(handleTimeout, timeoutMs);\n\n checkAndResolve();\n\n const pollInterval = setInterval(() => {\n if (resolved) {\n clearInterval(pollInterval);\n return;\n }\n checkAndResolve();\n }, 100);\n });\n}\n\n/**\n * Hotloads the Clerk JS script with robust failure detection and retry logic.\n *\n * For existing scripts:\n * - If no request error detected: waits for timeout, then retries with loadScript if timeout expires\n * - If request error detected: immediately retries with loadScript.\n *\n * For new scripts: uses loadScript which has built-in retry logic via the retry utility.\n *\n * @param opts - The options used to build the Clerk JS script URL and load the script.\n * Must include a `publishableKey` if no existing script is found.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error.\n *\n * @example\n * ```typescript\n * try {\n * await loadClerkJsScript({ publishableKey: 'pk_test_...' });\n * console.log('Clerk loaded successfully');\n * } catch (error) {\n * console.error('Failed to load Clerk:', error.message);\n * }\n * ```\n */\nconst loadClerkJsScript = async (opts?: LoadClerkJsScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n\n if (isClerkProperlyLoaded()) {\n return null;\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const scriptUrl = clerkJsScriptUrl(opts);\n const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n if (hasScriptRequestError(scriptUrl)) {\n existingScript.remove();\n } else {\n try {\n await waitForClerkWithTimeout(timeout, existingScript);\n return null;\n } catch {\n existingScript.remove();\n }\n }\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(scriptUrl, {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyClerkJsScriptAttributes(opts),\n }).catch(error => {\n throw new ClerkRuntimeError(FAILED_TO_LOAD_ERROR + (error.message ? `, ${error.message}` : ''), {\n code: ERROR_CODE,\n cause: error,\n });\n });\n\n return loadPromise;\n};\n\n/**\n * Generates a Clerk JS script URL based on the provided options.\n *\n * @param opts - The options to use when building the Clerk JS script URL.\n * @returns The complete URL to the Clerk JS script.\n *\n * @example\n * ```typescript\n * const url = clerkJsScriptUrl({ publishableKey: 'pk_test_...' });\n * // Returns: \"https://example.clerk.accounts.dev/npm/@clerk/clerk-js@5/dist/clerk.browser.js\"\n * ```\n */\nconst clerkJsScriptUrl = (opts: LoadClerkJsScriptOptions) => {\n const { clerkJSUrl, clerkJSVariant, clerkJSVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkJSUrl) {\n return clerkJSUrl;\n }\n\n let scriptHost = '';\n if (!!proxyUrl && isValidProxyUrl(proxyUrl)) {\n scriptHost = proxyUrlToAbsoluteURL(proxyUrl).replace(/http(s)?:\\/\\//, '');\n } else if (domain && !isDevOrStagingUrl(parsePublishableKey(publishableKey)?.frontendApi || '')) {\n scriptHost = addClerkPrefix(domain);\n } else {\n scriptHost = parsePublishableKey(publishableKey)?.frontendApi || '';\n }\n\n const variant = clerkJSVariant ? `${clerkJSVariant.replace(/\\.+$/, '')}.` : '';\n const version = versionSelector(clerkJSVersion);\n return `https://${scriptHost}/npm/@clerk/clerk-js@${version}/dist/clerk.${variant}browser.js`;\n};\n\n/**\n * Builds an object of Clerk JS script attributes based on the provided options.\n *\n * @param options - The options containing the values for script attributes.\n * @returns An object containing data attributes to be applied to the script element.\n */\nconst buildClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => {\n const obj: Record<string, string> = {};\n\n if (options.publishableKey) {\n obj['data-clerk-publishable-key'] = options.publishableKey;\n }\n\n if (options.proxyUrl) {\n obj['data-clerk-proxy-url'] = options.proxyUrl;\n }\n\n if (options.domain) {\n obj['data-clerk-domain'] = options.domain;\n }\n\n if (options.nonce) {\n obj.nonce = options.nonce;\n }\n\n return obj;\n};\n\n/**\n * Returns a function that applies Clerk JS script attributes to a script element.\n *\n * @param options - The options containing the values for script attributes.\n * @returns A function that accepts a script element and applies the attributes to it.\n */\nconst applyClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => (script: HTMLScriptElement) => {\n const attributes = buildClerkJsScriptAttributes(options);\n for (const attribute in attributes) {\n script.setAttribute(attribute, attributes[attribute]);\n }\n};\n\nexport { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript };\nexport type { LoadClerkJsScriptOptions };\n"],"mappings":";;;;;;;;AAQA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,uBAAuB;AAE7B,MAAM,EAAE,sBAAsB,4BAA4B;AAE1D,MAAM,eAAe,kBAAkB,EAAE,aAAa,iBAAiB,CAAC;;;;;;;;;;AAWxE,SAAgB,kCAAkC,aAAqB;AACrE,cAAa,eAAe,EAAE,aAAa,CAAC;;;;;;;;AA0B9C,SAAS,wBAAiC;AACxC,KAAI,OAAO,WAAW,eAAe,CAAE,OAAe,MACpD,QAAO;CAIT,MAAM,QAAS,OAAe;AAC9B,QAAO,OAAO,UAAU,YAAY,OAAO,MAAM,SAAS;;;;;;;;AAS5D,SAAS,sBAAsB,WAA4B;AACzD,KAAI,OAAO,WAAW,eAAe,CAAC,OAAO,YAC3C,QAAO;CAGT,MAAM,UAAU,YAAY,iBAAiB,WAAW,WAAW;A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,QAAQ,SACV,KAAI,0BAA0B,QAAQ;AAGxC,KAAI,QAAQ,OACV,KAAI,uBAAuB,QAAQ;AAGrC,KAAI,QAAQ,MACV,KAAI,QAAQ,QAAQ;AAGtB,QAAO;;;;;;;;AAST,MAAM,gCAAgC,aAAuC,WAA8B;CACzG,MAAM,aAAa,6BAA6B,QAAQ;AACxD,MAAK,MAAM,aAAa,WACtB,QAAO,aAAa,WAAW,WAAW,WAAW"}
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-DDvGauc8.mjs","names":["timeoutId","pollInterval","obj: Record<string, string>"],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":["import { buildErrorThrower, ClerkRuntimeError } from './error';\nimport { createDevOrStagingUrlCache, parsePublishableKey } from './keys';\nimport { loadScript } from './loadScript';\nimport { isValidProxyUrl, proxyUrlToAbsoluteURL } from './proxy';\nimport type { ClerkOptions, SDKMetadata, Without } from './types';\nimport { addClerkPrefix } from './url';\nimport { versionSelector } from './versionSelector';\n\nconst ERROR_CODE = 'failed_to_load_clerk_js';\nconst ERROR_CODE_TIMEOUT = 'failed_to_load_clerk_js_timeout';\nconst FAILED_TO_LOAD_ERROR = 'Failed to load Clerk';\n\nconst { isDevOrStagingUrl } = createDevOrStagingUrlCache();\n\nconst errorThrower = buildErrorThrower({ packageName: '@clerk/shared' });\n\n/**\n * Sets the package name for error messages during ClerkJS script loading.\n *\n * @param packageName - The name of the package to use in error messages (e.g., '@clerk/clerk-react').\n * @example\n * ```typescript\n * setClerkJsLoadingErrorPackageName('@clerk/clerk-react');\n * ```\n */\nexport function setClerkJsLoadingErrorPackageName(packageName: string) {\n errorThrower.setPackageName({ packageName });\n}\n\ntype LoadClerkJsScriptOptions = Without<ClerkOptions, 'isSatellite'> & {\n publishableKey: string;\n clerkJSUrl?: string;\n clerkJSVariant?: 'headless' | '';\n clerkJSVersion?: string;\n sdkMetadata?: SDKMetadata;\n proxyUrl?: string;\n domain?: string;\n nonce?: string;\n /**\n * Timeout in milliseconds to wait for clerk-js to load before considering it failed.\n *\n * @default 15000 (15 seconds)\n */\n scriptLoadTimeout?: number;\n};\n\n/**\n * Validates that window.Clerk exists and is properly initialized.\n * This ensures we don't have false positives where the script loads but Clerk is malformed.\n *\n * @returns `true` if window.Clerk exists and has the expected structure with a load method.\n */\nfunction isClerkProperlyLoaded(): boolean {\n if (typeof window === 'undefined' || !(window as any).Clerk) {\n return false;\n }\n\n // Basic validation that window.Clerk has the expected structure\n const clerk = (window as any).Clerk;\n return typeof clerk === 'object' && typeof clerk.load === 'function';\n}\n\n/**\n * Checks if an existing script has a request error using Performance API.\n *\n * @param scriptUrl - The URL of the script to check.\n * @returns True if the script has failed to load due to a network/HTTP error.\n */\nfunction hasScriptRequestError(scriptUrl: string): boolean {\n if (typeof window === 'undefined' || !window.performance) {\n return false;\n }\n\n const entries = performance.getEntriesByName(scriptUrl, 'resource') as PerformanceResourceTiming[];\n\n if (entries.length === 0) {\n return false;\n }\n\n const scriptEntry = entries[entries.length - 1];\n\n // transferSize === 0 with responseEnd === 0 indicates network failure\n // transferSize === 0 with responseEnd > 0 might be a 4xx/5xx error or blocked request\n if (scriptEntry.transferSize === 0 && scriptEntry.decodedBodySize === 0) {\n // If there was no response at all, it's definitely an error\n if (scriptEntry.responseEnd === 0) {\n return true;\n }\n // If we got a response but no content, likely an HTTP error (4xx/5xx)\n if (scriptEntry.responseEnd > 0 && scriptEntry.responseStart > 0) {\n return true;\n }\n\n if ('responseStatus' in scriptEntry) {\n const status = (scriptEntry as any).responseStatus;\n if (status >= 400) {\n return true;\n }\n if (scriptEntry.responseStatus === 0) {\n return true;\n }\n }\n }\n\n return false;\n}\n\n/**\n * Waits for Clerk to be properly loaded with a timeout mechanism.\n * Uses polling to check if Clerk becomes available within the specified timeout.\n *\n * @param timeoutMs - Maximum time to wait in milliseconds.\n * @param existingScript - The existing script element to wait for. Optional, for existing scripts.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(\n timeoutMs: number,\n existingScript?: HTMLScriptElement,\n): Promise<HTMLScriptElement | null> {\n return new Promise((resolve, reject) => {\n let resolved = false;\n\n const cleanup = (timeoutId: ReturnType<typeof setTimeout>, pollInterval: ReturnType<typeof setInterval>) => {\n clearTimeout(timeoutId);\n clearInterval(pollInterval);\n };\n\n // Bail out early if the script fails to load, instead of waiting for the entire timeout\n existingScript?.addEventListener('error', () => {\n cleanup(timeoutId, pollInterval);\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE }));\n });\n\n const checkAndResolve = () => {\n if (resolved) {\n return;\n }\n\n if (isClerkProperlyLoaded()) {\n resolved = true;\n cleanup(timeoutId, pollInterval);\n resolve(null);\n }\n };\n\n const handleTimeout = () => {\n if (resolved) {\n return;\n }\n\n resolved = true;\n cleanup(timeoutId, pollInterval);\n\n if (!isClerkProperlyLoaded()) {\n reject(new ClerkRuntimeError(FAILED_TO_LOAD_ERROR, { code: ERROR_CODE_TIMEOUT }));\n } else {\n resolve(null);\n }\n };\n\n const timeoutId = setTimeout(handleTimeout, timeoutMs);\n\n checkAndResolve();\n\n const pollInterval = setInterval(() => {\n if (resolved) {\n clearInterval(pollInterval);\n return;\n }\n checkAndResolve();\n }, 100);\n });\n}\n\n/**\n * Hotloads the Clerk JS script with robust failure detection and retry logic.\n *\n * For existing scripts:\n * - If no request error detected: waits for timeout, then retries with loadScript if timeout expires\n * - If request error detected: immediately retries with loadScript.\n *\n * For new scripts: uses loadScript which has built-in retry logic via the retry utility.\n *\n * @param opts - The options used to build the Clerk JS script URL and load the script.\n * Must include a `publishableKey` if no existing script is found.\n * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error.\n *\n * @example\n * ```typescript\n * try {\n * await loadClerkJsScript({ publishableKey: 'pk_test_...' });\n * console.log('Clerk loaded successfully');\n * } catch (error) {\n * console.error('Failed to load Clerk:', error.message);\n * }\n * ```\n */\nconst loadClerkJsScript = async (opts?: LoadClerkJsScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n\n if (isClerkProperlyLoaded()) {\n return null;\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const scriptUrl = clerkJsScriptUrl(opts);\n const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n if (hasScriptRequestError(scriptUrl)) {\n existingScript.remove();\n } else {\n try {\n await waitForClerkWithTimeout(timeout, existingScript);\n return null;\n } catch {\n existingScript.remove();\n }\n }\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(scriptUrl, {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyClerkJsScriptAttributes(opts),\n }).catch(error => {\n throw new ClerkRuntimeError(FAILED_TO_LOAD_ERROR + (error.message ? `, ${error.message}` : ''), {\n code: ERROR_CODE,\n cause: error,\n });\n });\n\n return loadPromise;\n};\n\n/**\n * Generates a Clerk JS script URL based on the provided options.\n *\n * @param opts - The options to use when building the Clerk JS script URL.\n * @returns The complete URL to the Clerk JS script.\n *\n * @example\n * ```typescript\n * const url = clerkJsScriptUrl({ publishableKey: 'pk_test_...' });\n * // Returns: \"https://example.clerk.accounts.dev/npm/@clerk/clerk-js@5/dist/clerk.browser.js\"\n * ```\n */\nconst clerkJsScriptUrl = (opts: LoadClerkJsScriptOptions) => {\n const { clerkJSUrl, clerkJSVariant, clerkJSVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkJSUrl) {\n return clerkJSUrl;\n }\n\n let scriptHost = '';\n if (!!proxyUrl && isValidProxyUrl(proxyUrl)) {\n scriptHost = proxyUrlToAbsoluteURL(proxyUrl).replace(/http(s)?:\\/\\//, '');\n } else if (domain && !isDevOrStagingUrl(parsePublishableKey(publishableKey)?.frontendApi || '')) {\n scriptHost = addClerkPrefix(domain);\n } else {\n scriptHost = parsePublishableKey(publishableKey)?.frontendApi || '';\n }\n\n const variant = clerkJSVariant ? `${clerkJSVariant.replace(/\\.+$/, '')}.` : '';\n const version = versionSelector(clerkJSVersion);\n return `https://${scriptHost}/npm/@clerk/clerk-js@${version}/dist/clerk.${variant}browser.js`;\n};\n\n/**\n * Builds an object of Clerk JS script attributes based on the provided options.\n *\n * @param options - The options containing the values for script attributes.\n * @returns An object containing data attributes to be applied to the script element.\n */\nconst buildClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => {\n const obj: Record<string, string> = {};\n\n if (options.publishableKey) {\n obj['data-clerk-publishable-key'] = options.publishableKey;\n }\n\n if (options.proxyUrl) {\n obj['data-clerk-proxy-url'] = options.proxyUrl;\n }\n\n if (options.domain) {\n obj['data-clerk-domain'] = options.domain;\n }\n\n if (options.nonce) {\n obj.nonce = options.nonce;\n }\n\n return obj;\n};\n\n/**\n * Returns a function that applies Clerk JS script attributes to a script element.\n *\n * @param options - The options containing the values for script attributes.\n * @returns A function that accepts a script element and applies the attributes to it.\n */\nconst applyClerkJsScriptAttributes = (options: LoadClerkJsScriptOptions) => (script: HTMLScriptElement) => {\n const attributes = buildClerkJsScriptAttributes(options);\n for (const attribute in attributes) {\n script.setAttribute(attribute, attributes[attribute]);\n }\n};\n\nexport { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript };\nexport type { LoadClerkJsScriptOptions };\n"],"mappings":";;;;;;;;AAQA,MAAM,aAAa;AACnB,MAAM,qBAAqB;AAC3B,MAAM,uBAAuB;AAE7B,MAAM,EAAE,sBAAsB,4BAA4B;AAE1D,MAAM,eAAe,kBAAkB,EAAE,aAAa,iBAAiB,CAAC;;;;;;;;;;AAWxE,SAAgB,kCAAkC,aAAqB;AACrE,cAAa,eAAe,EAAE,aAAa,CAAC;;;;;;;;AA0B9C,SAAS,wBAAiC;AACxC,KAAI,OAAO,WAAW,eAAe,CAAE,OAAe,MACpD,QAAO;CAIT,MAAM,QAAS,OAAe;AAC9B,QAAO,OAAO,UAAU,YAAY,OAA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,uBAAuB,QAAQ,cAAc,QAAQ;;;;;;;;AASpF,MAAM,gCAAgC,YAAsC;CAC1E,MAAMC,MAA8B,EAAE;AAEtC,KAAI,QAAQ,eACV,KAAI,gCAAgC,QAAQ;AAG9C,KAAI,QAAQ,SACV,KAAI,0BAA0B,QAAQ;AAGxC,KAAI,QAAQ,OACV,KAAI,uBAAuB,QAAQ;AAGrC,KAAI,QAAQ,MACV,KAAI,QAAQ,QAAQ;AAGtB,QAAO;;;;;;;;AAST,MAAM,gCAAgC,aAAuC,WAA8B;CACzG,MAAM,aAAa,6BAA6B,QAAQ;AACxD,MAAK,MAAM,aAAa,WACtB,QAAO,aAAa,WAAW,WAAW,WAAW"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-
|
|
1
|
+
import "./index-DRoX574n.mjs";
|
|
2
|
+
import { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-BMs9X5iH.mjs";
|
|
3
3
|
export { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-
|
|
1
|
+
import "./index-BX6sndeu.js";
|
|
2
|
+
import { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-B6IzADUE.js";
|
|
3
3
|
export { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
@@ -8,8 +8,8 @@ require('./retry-rhkPbMCS.js');
|
|
|
8
8
|
require('./loadScript-D8zceEj8.js');
|
|
9
9
|
require('./proxy-B_Yui2Mf.js');
|
|
10
10
|
require('./url-Clb-n8zC.js');
|
|
11
|
-
require('./versionSelector-
|
|
12
|
-
const require_loadClerkJsScript = require('./loadClerkJsScript-
|
|
11
|
+
require('./versionSelector-CPS7KdGH.js');
|
|
12
|
+
const require_loadClerkJsScript = require('./loadClerkJsScript-ClRfibaX.js');
|
|
13
13
|
|
|
14
14
|
exports.buildClerkJsScriptAttributes = require_loadClerkJsScript.buildClerkJsScriptAttributes;
|
|
15
15
|
exports.clerkJsScriptUrl = require_loadClerkJsScript.clerkJsScriptUrl;
|
|
@@ -8,7 +8,7 @@ import "./retry-DAlTROH9.mjs";
|
|
|
8
8
|
import "./loadScript-t1vaIfy5.mjs";
|
|
9
9
|
import "./proxy-Bq8EHApG.mjs";
|
|
10
10
|
import "./url-Cdy8w8vK.mjs";
|
|
11
|
-
import "./versionSelector-
|
|
12
|
-
import { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-
|
|
11
|
+
import "./versionSelector-BTaEe_fh.mjs";
|
|
12
|
+
import { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-DDvGauc8.mjs";
|
|
13
13
|
|
|
14
14
|
export { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
package/dist/runtime/oauth.d.mts
CHANGED
package/dist/runtime/oauth.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Autocomplete } from "./index-
|
|
1
|
+
import { Autocomplete } from "./index-DRoX574n.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/pathMatcher.d.ts
|
|
4
4
|
type WithPathPatternWildcard<T = string> = `${T & string}(.*)`;
|
|
@@ -13,4 +13,4 @@ type PathMatcherParam = Array<RegExp | PathPattern> | RegExp | PathPattern;
|
|
|
13
13
|
declare const createPathMatcher: (patterns: PathMatcherParam) => (pathname: string) => boolean;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher };
|
|
16
|
-
//# sourceMappingURL=pathMatcher
|
|
16
|
+
//# sourceMappingURL=pathMatcher--IdAeviC.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathMatcher--IdAeviC.d.mts","names":[],"sources":["../../src/pathMatcher.ts"],"sourcesContent":[],"mappings":";;;KAGY,yCAAyC;KACzC,WAAA,GAAc,aAAa;AAD3B,KAEA,gBAAA,GAAmB,KAFI,CAEE,MAFF,GAEW,WAFQ,CAAA,GAEO,MAFP,GAEgB,WAFhB;AACtD;AACA;;;;;AAAsE,cAYzD,iBAZyD,EAAA,CAAA,QAAA,EAY1B,gBAZ0B,EAAA,GAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAAA,OAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Autocomplete } from "./index-
|
|
1
|
+
import { Autocomplete } from "./index-BX6sndeu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/pathMatcher.d.ts
|
|
4
4
|
type WithPathPatternWildcard<T = string> = `${T & string}(.*)`;
|
|
@@ -13,4 +13,4 @@ type PathMatcherParam = Array<RegExp | PathPattern> | RegExp | PathPattern;
|
|
|
13
13
|
declare const createPathMatcher: (patterns: PathMatcherParam) => (pathname: string) => boolean;
|
|
14
14
|
//#endregion
|
|
15
15
|
export { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher };
|
|
16
|
-
//# sourceMappingURL=pathMatcher-
|
|
16
|
+
//# sourceMappingURL=pathMatcher-BUvD02EZ.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathMatcher-BUvD02EZ.d.ts","names":[],"sources":["../../src/pathMatcher.ts"],"sourcesContent":[],"mappings":";;;KAGY,yCAAyC;KACzC,WAAA,GAAc,aAAa;AAD3B,KAEA,gBAAA,GAAmB,KAFI,CAEE,MAFF,GAEW,WAFQ,CAAA,GAEO,MAFP,GAEgB,WAFhB;AACtD;AACA;;;;;AAAsE,cAYzD,iBAZyD,EAAA,CAAA,QAAA,EAY1B,gBAZ0B,EAAA,GAAA,CAAA,QAAA,EAAA,MAAA,EAAA,GAAA,OAAA"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher } from "./pathMatcher
|
|
1
|
+
import "./index-DRoX574n.mjs";
|
|
2
|
+
import { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher } from "./pathMatcher--IdAeviC.mjs";
|
|
3
3
|
export { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import "./index-
|
|
2
|
-
import { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher } from "./pathMatcher-
|
|
1
|
+
import "./index-BX6sndeu.js";
|
|
2
|
+
import { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher } from "./pathMatcher-BUvD02EZ.js";
|
|
3
3
|
export { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { APIKeyResource, BillingCheckoutResource, BillingPaymentMethodResource, BillingPaymentResource, BillingPlanResource, BillingStatementResource, BillingSubscriptionPlanPeriod, BillingSubscriptionResource, ClerkAPIResponseError, ClerkAPIResponseError$1, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, OrganizationCreationDefaultsResource, OrganizationDomainResource, OrganizationInvitationResource, OrganizationMembershipRequestResource, OrganizationMembershipResource, OrganizationResource, OrganizationSuggestionResource, SessionVerificationLevel, SetActive, SetActiveNavigate, SignedInSessionResource, UseSessionListReturn, UseSessionReturn, UseUserReturn, UserOrganizationInvitationResource, UserResource, __experimental_CheckoutCacheState, __experimental_CheckoutInstance } from "../index-
|
|
2
|
-
import "../apiUrlFromPublishableKey-
|
|
1
|
+
import { APIKeyResource, BillingCheckoutResource, BillingPaymentMethodResource, BillingPaymentResource, BillingPlanResource, BillingStatementResource, BillingSubscriptionPlanPeriod, BillingSubscriptionResource, ClerkAPIResponseError, ClerkAPIResponseError$1, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, OrganizationCreationDefaultsResource, OrganizationDomainResource, OrganizationInvitationResource, OrganizationMembershipRequestResource, OrganizationMembershipResource, OrganizationResource, OrganizationSuggestionResource, SessionVerificationLevel, SetActive, SetActiveNavigate, SignedInSessionResource, UseSessionListReturn, UseSessionReturn, UseUserReturn, UserOrganizationInvitationResource, UserResource, __experimental_CheckoutCacheState, __experimental_CheckoutInstance } from "../index-DRoX574n.mjs";
|
|
2
|
+
import "../apiUrlFromPublishableKey-BMA_oB1l.mjs";
|
|
3
3
|
import "../browser-CwBluoYn.mjs";
|
|
4
|
-
import "../color-
|
|
4
|
+
import "../color-5EK-w4Pa.mjs";
|
|
5
5
|
import "../constants-UOcJjdve.mjs";
|
|
6
6
|
import "../date-DIGfFkoy.mjs";
|
|
7
7
|
import "../deprecated-BRApxWmG.mjs";
|
|
8
|
-
import "../deriveState-
|
|
8
|
+
import "../deriveState-l1EE4w-l.mjs";
|
|
9
9
|
import "../devBrowser-DGNGESpp.mjs";
|
|
10
|
-
import "../error-
|
|
10
|
+
import "../error-Dyvw0cBN.mjs";
|
|
11
11
|
import "../file-BgHDMp4o.mjs";
|
|
12
12
|
import "../getEnvVariable-58tQPflG.mjs";
|
|
13
13
|
import "../handleValueOrFn-2pqr_dC8.mjs";
|
|
14
14
|
import "../index-Dd9r-3AL.mjs";
|
|
15
15
|
import "../isomorphicAtob-DqIxJQZE.mjs";
|
|
16
16
|
import "../isomorphicBtoa-Cu4s1rFu.mjs";
|
|
17
|
-
import "../keys-
|
|
18
|
-
import "../loadClerkJsScript-
|
|
17
|
+
import "../keys-83lzlaAG.mjs";
|
|
18
|
+
import "../loadClerkJsScript-BMs9X5iH.mjs";
|
|
19
19
|
import "../loadScript-C6SUcPSp.mjs";
|
|
20
20
|
import "../localStorageBroadcastChannel-CNmeXxpW.mjs";
|
|
21
21
|
import "../poller-I92Dozmd.mjs";
|
|
@@ -26,7 +26,7 @@ import "../versionSelector-Btv3m_NV.mjs";
|
|
|
26
26
|
import "../object-CgEEf_DM.mjs";
|
|
27
27
|
import "../logger-CFsSyN6O.mjs";
|
|
28
28
|
import "../index-D_rS0fDT.mjs";
|
|
29
|
-
import "../pathMatcher
|
|
29
|
+
import "../pathMatcher--IdAeviC.mjs";
|
|
30
30
|
import "../netlifyCacheHandler-DaSimV39.mjs";
|
|
31
31
|
import "../index-CoUVmp_Q.mjs";
|
|
32
32
|
import React, { PropsWithChildren, ReactNode } from "react";
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { APIKeyResource, BillingCheckoutResource, BillingPaymentMethodResource, BillingPaymentResource, BillingPlanResource, BillingStatementResource, BillingSubscriptionPlanPeriod, BillingSubscriptionResource, ClerkAPIResponseError, ClerkAPIResponseError$1, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, OrganizationCreationDefaultsResource, OrganizationDomainResource, OrganizationInvitationResource, OrganizationMembershipRequestResource, OrganizationMembershipResource, OrganizationResource, OrganizationSuggestionResource, SessionVerificationLevel, SetActive, SetActiveNavigate, SignedInSessionResource, UseSessionListReturn, UseSessionReturn, UseUserReturn, UserOrganizationInvitationResource, UserResource, __experimental_CheckoutCacheState, __experimental_CheckoutInstance } from "../index-
|
|
1
|
+
import { APIKeyResource, BillingCheckoutResource, BillingPaymentMethodResource, BillingPaymentResource, BillingPlanResource, BillingStatementResource, BillingSubscriptionPlanPeriod, BillingSubscriptionResource, ClerkAPIResponseError, ClerkAPIResponseError$1, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, OrganizationCreationDefaultsResource, OrganizationDomainResource, OrganizationInvitationResource, OrganizationMembershipRequestResource, OrganizationMembershipResource, OrganizationResource, OrganizationSuggestionResource, SessionVerificationLevel, SetActive, SetActiveNavigate, SignedInSessionResource, UseSessionListReturn, UseSessionReturn, UseUserReturn, UserOrganizationInvitationResource, UserResource, __experimental_CheckoutCacheState, __experimental_CheckoutInstance } from "../index-BX6sndeu.js";
|
|
2
2
|
import "../apiUrlFromPublishableKey-BK2JHLjb.js";
|
|
3
3
|
import "../browser-CT1g0w-N.js";
|
|
4
|
-
import "../color-
|
|
4
|
+
import "../color-C7B_w9Xs.js";
|
|
5
5
|
import "../constants-DP5-fAPw.js";
|
|
6
6
|
import "../date-DDNRUU0r.js";
|
|
7
7
|
import "../deprecated-BnVl0yxv.js";
|
|
8
|
-
import "../deriveState-
|
|
8
|
+
import "../deriveState-0XMAcFTN.js";
|
|
9
9
|
import "../devBrowser-ezvLE7uo.js";
|
|
10
|
-
import "../error-
|
|
10
|
+
import "../error-BF6UbvEX.js";
|
|
11
11
|
import "../file-B_f0oD8h.js";
|
|
12
12
|
import "../getEnvVariable-BcT_PqmA.js";
|
|
13
13
|
import "../handleValueOrFn-BpIDq7Ek.js";
|
|
14
14
|
import "../index-DcfXAwQx.js";
|
|
15
15
|
import "../isomorphicAtob-D61jyCi3.js";
|
|
16
16
|
import "../isomorphicBtoa-DZZ0MKdz.js";
|
|
17
|
-
import "../keys-
|
|
18
|
-
import "../loadClerkJsScript-
|
|
17
|
+
import "../keys-YrWvb2ed.js";
|
|
18
|
+
import "../loadClerkJsScript-B6IzADUE.js";
|
|
19
19
|
import "../loadScript-BPX0RAWu.js";
|
|
20
20
|
import "../localStorageBroadcastChannel-BSisnDfR.js";
|
|
21
21
|
import "../poller-CIrx6NwR.js";
|
|
@@ -26,7 +26,7 @@ import "../versionSelector-CP0JpoAM.js";
|
|
|
26
26
|
import "../object-5d8ACLdH.js";
|
|
27
27
|
import "../logger-CWWjPZMR.js";
|
|
28
28
|
import "../index-z_SguuaJ.js";
|
|
29
|
-
import "../pathMatcher-
|
|
29
|
+
import "../pathMatcher-BUvD02EZ.js";
|
|
30
30
|
import "../netlifyCacheHandler-Di70sUEE.js";
|
|
31
31
|
import "../index-B5F3AfVc.js";
|
|
32
32
|
import React, { PropsWithChildren, ReactNode } from "react";
|
package/dist/runtime/router.d.ts
CHANGED
package/dist/runtime/saml.d.mts
CHANGED
package/dist/runtime/saml.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Appearance, TelemetryCollector as TelemetryCollector$1, TelemetryEventRaw, TelemetryLogEntry } from "./index-
|
|
1
|
+
import { Appearance, TelemetryCollector as TelemetryCollector$1, TelemetryEventRaw, TelemetryLogEntry } from "./index-DRoX574n.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/telemetry/types.d.ts
|
|
4
4
|
type TelemetryCollectorOptions = {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Appearance, TelemetryCollector as TelemetryCollector$1, TelemetryEventRaw, TelemetryLogEntry } from "./index-
|
|
1
|
+
import { Appearance, TelemetryCollector as TelemetryCollector$1, TelemetryEventRaw, TelemetryLogEntry } from "./index-BX6sndeu.js";
|
|
2
2
|
|
|
3
3
|
//#region src/telemetry/types.d.ts
|
|
4
4
|
type TelemetryCollectorOptions = {
|