@clerk/shared 3.32.0 → 3.33.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-BK2JHLjb.d.ts → apiUrlFromPublishableKey-DOAlYzda.d.ts} +2 -2
- package/dist/runtime/apiUrlFromPublishableKey-DOAlYzda.d.ts.map +1 -0
- package/dist/runtime/{apiUrlFromPublishableKey-Bn4sVlIN.d.mts → apiUrlFromPublishableKey-DnRaRFJ_.d.mts} +2 -2
- package/dist/runtime/apiUrlFromPublishableKey-DnRaRFJ_.d.mts.map +1 -0
- package/dist/runtime/apiUrlFromPublishableKey.d.mts +1 -1
- package/dist/runtime/apiUrlFromPublishableKey.d.ts +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.ts +1 -1
- package/dist/runtime/clerkEventBus.d.mts +1 -1
- package/dist/runtime/clerkEventBus.d.ts +1 -1
- package/dist/runtime/{color-CS9T5fgL.d.mts → color-CHG_4-TR.d.mts} +2 -2
- package/dist/runtime/{color-CS9T5fgL.d.mts.map → color-CHG_4-TR.d.mts.map} +1 -1
- package/dist/runtime/{color-Ck2FZHKO.d.ts → color-wSg34wT2.d.ts} +2 -2
- package/dist/runtime/{color-Ck2FZHKO.d.ts.map → color-wSg34wT2.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-BH1Tzg_e.d.ts → deriveState-6Yc3Rk05.d.ts} +2 -2
- package/dist/runtime/{deriveState-BH1Tzg_e.d.ts.map → deriveState-6Yc3Rk05.d.ts.map} +1 -1
- package/dist/runtime/{deriveState-BCBC_fuW.d.mts → deriveState-DH9IbUXL.d.mts} +2 -2
- package/dist/runtime/{deriveState-BCBC_fuW.d.mts.map → deriveState-DH9IbUXL.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-XGZw5MIJ.d.mts → error-CYVmWc_r.d.mts} +2 -2
- package/dist/runtime/{error-XGZw5MIJ.d.mts.map → error-CYVmWc_r.d.mts.map} +1 -1
- package/dist/runtime/{error-BG-DU8Ml.d.ts → error-u7M5SRM0.d.ts} +2 -2
- package/dist/runtime/{error-BG-DU8Ml.d.ts.map → error-u7M5SRM0.d.ts.map} +1 -1
- package/dist/runtime/error.d.mts +2 -2
- package/dist/runtime/error.d.ts +2 -2
- package/dist/runtime/{index-TF-cYSgn.d.mts → index-QlnAPzs5.d.mts} +118 -89
- package/dist/runtime/index-QlnAPzs5.d.mts.map +1 -0
- package/dist/runtime/{index-kzWgBa8D.d.ts → index-s5-2Owl1.d.ts} +118 -89
- package/dist/runtime/index-s5-2Owl1.d.ts.map +1 -0
- package/dist/runtime/index.d.mts +8 -8
- package/dist/runtime/index.d.ts +8 -8
- 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-QePjYjbj.d.mts → keys-BLTsG2Vv.d.mts} +2 -2
- package/dist/runtime/{keys-QePjYjbj.d.mts.map → keys-BLTsG2Vv.d.mts.map} +1 -1
- package/dist/runtime/{keys-ClJEkXAA.d.ts → keys-BYSwdlWp.d.ts} +2 -2
- package/dist/runtime/{keys-ClJEkXAA.d.ts.map → keys-BYSwdlWp.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-CcZIvacT.d.mts → loadClerkJsScript-CDeYMT-M.d.mts} +2 -2
- package/dist/runtime/{loadClerkJsScript-CcZIvacT.d.mts.map → loadClerkJsScript-CDeYMT-M.d.mts.map} +1 -1
- package/dist/runtime/{loadClerkJsScript-DeKw5raq.js → loadClerkJsScript-DPV9ikAI.js} +2 -2
- package/dist/runtime/{loadClerkJsScript-DeKw5raq.js.map → loadClerkJsScript-DPV9ikAI.js.map} +1 -1
- package/dist/runtime/{loadClerkJsScript-XFbz-Rdu.d.ts → loadClerkJsScript-DVE-ngva.d.ts} +2 -2
- package/dist/runtime/{loadClerkJsScript-XFbz-Rdu.d.ts.map → loadClerkJsScript-DVE-ngva.d.ts.map} +1 -1
- package/dist/runtime/{loadClerkJsScript-GgNV375m.mjs → loadClerkJsScript-DrOMppui.mjs} +2 -2
- package/dist/runtime/{loadClerkJsScript-GgNV375m.mjs.map → loadClerkJsScript-DrOMppui.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-B18eFEEN.d.mts → pathMatcher-B3bDWbou.d.mts} +2 -2
- package/dist/runtime/pathMatcher-B3bDWbou.d.mts.map +1 -0
- package/dist/runtime/{pathMatcher-CWs_j1XB.d.ts → pathMatcher-C6_QTBhM.d.ts} +2 -2
- package/dist/runtime/{pathMatcher-CWs_j1XB.d.ts.map → pathMatcher-C6_QTBhM.d.ts.map} +1 -1
- 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 +8 -8
- package/dist/runtime/react/index.js +2 -1
- package/dist/runtime/react/index.js.map +1 -1
- package/dist/runtime/react/index.mjs +2 -1
- package/dist/runtime/react/index.mjs.map +1 -1
- 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 +1 -1
- package/dist/runtime/types/index.d.ts +1 -1
- package/dist/runtime/{versionSelector-Cc2UrQvl.mjs → versionSelector-5Bc59Peq.mjs} +3 -3
- package/dist/runtime/{versionSelector-Cc2UrQvl.mjs.map → versionSelector-5Bc59Peq.mjs.map} +1 -1
- package/dist/runtime/{versionSelector-BSFW88a6.js → versionSelector-TwNylrt4.js} +3 -3
- package/dist/runtime/{versionSelector-BSFW88a6.js.map → versionSelector-TwNylrt4.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 +117 -88
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.d.ts +117 -88
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/runtime/apiUrlFromPublishableKey-BK2JHLjb.d.ts.map +0 -1
- package/dist/runtime/apiUrlFromPublishableKey-Bn4sVlIN.d.mts.map +0 -1
- package/dist/runtime/index-TF-cYSgn.d.mts.map +0 -1
- package/dist/runtime/index-kzWgBa8D.d.ts.map +0 -1
- package/dist/runtime/pathMatcher-B18eFEEN.d.mts.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublishableKey } from "./index-
|
|
1
|
+
import { PublishableKey } from "./index-QlnAPzs5.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 as buildPublishableKey$1, createDevOrStagingUrlCache as createDevOrStagingUrlCache$1, getCookieSuffix as getCookieSuffix$1, getSuffixedCookieName as getSuffixedCookieName$1, isDevelopmentFromPublishableKey as isDevelopmentFromPublishableKey$1, isDevelopmentFromSecretKey as isDevelopmentFromSecretKey$1, isProductionFromPublishableKey as isProductionFromPublishableKey$1, isProductionFromSecretKey as isProductionFromSecretKey$1, isPublishableKey as isPublishableKey$1, parsePublishableKey as parsePublishableKey$1 };
|
|
103
|
-
//# sourceMappingURL=keys-
|
|
103
|
+
//# sourceMappingURL=keys-BLTsG2Vv.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys-
|
|
1
|
+
{"version":3,"file":"keys-BLTsG2Vv.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-s5-2Owl1.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-BYSwdlWp.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"keys-
|
|
1
|
+
{"version":3,"file":"keys-BYSwdlWp.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$1 as buildPublishableKey, createDevOrStagingUrlCache$1 as createDevOrStagingUrlCache, getCookieSuffix$1 as getCookieSuffix, getSuffixedCookieName$1 as getSuffixedCookieName, isDevelopmentFromPublishableKey$1 as isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey$1 as isDevelopmentFromSecretKey, isProductionFromPublishableKey$1 as isProductionFromPublishableKey, isProductionFromSecretKey$1 as isProductionFromSecretKey, isPublishableKey$1 as isPublishableKey, parsePublishableKey$1 as parsePublishableKey } from "./keys-
|
|
1
|
+
import "./index-QlnAPzs5.mjs";
|
|
2
|
+
import { buildPublishableKey$1 as buildPublishableKey, createDevOrStagingUrlCache$1 as createDevOrStagingUrlCache, getCookieSuffix$1 as getCookieSuffix, getSuffixedCookieName$1 as getSuffixedCookieName, isDevelopmentFromPublishableKey$1 as isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey$1 as isDevelopmentFromSecretKey, isProductionFromPublishableKey$1 as isProductionFromPublishableKey, isProductionFromSecretKey$1 as isProductionFromSecretKey, isPublishableKey$1 as isPublishableKey, parsePublishableKey$1 as parsePublishableKey } from "./keys-BLTsG2Vv.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-s5-2Owl1.js";
|
|
2
|
+
import { buildPublishableKey, createDevOrStagingUrlCache, getCookieSuffix, getSuffixedCookieName, isDevelopmentFromPublishableKey, isDevelopmentFromSecretKey, isProductionFromPublishableKey, isProductionFromSecretKey, isPublishableKey, parsePublishableKey } from "./keys-BYSwdlWp.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-QlnAPzs5.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/loadClerkJsScript.d.ts
|
|
4
4
|
|
|
@@ -72,4 +72,4 @@ declare const clerkJsScriptUrl: (opts: LoadClerkJsScriptOptions) => string;
|
|
|
72
72
|
declare const buildClerkJsScriptAttributes: (options: LoadClerkJsScriptOptions) => Record<string, string>;
|
|
73
73
|
//#endregion
|
|
74
74
|
export { type LoadClerkJsScriptOptions, buildClerkJsScriptAttributes as buildClerkJsScriptAttributes$1, clerkJsScriptUrl as clerkJsScriptUrl$1, loadClerkJsScript as loadClerkJsScript$1, setClerkJsLoadingErrorPackageName as setClerkJsLoadingErrorPackageName$1 };
|
|
75
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
75
|
+
//# sourceMappingURL=loadClerkJsScript-CDeYMT-M.d.mts.map
|
package/dist/runtime/{loadClerkJsScript-CcZIvacT.d.mts.map → loadClerkJsScript-CDeYMT-M.d.mts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-CDeYMT-M.d.mts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;AAEC;;;;AAO0B;AAAA;AA0Ga,iBAnHxB,iCAAA,CAmHwB,WAAA,EAAA,MAAA,CAAA,EAAA,IAAA;KA/GnC,wBAAA,GAA2B,OA+G2C,CA/GnC,YA+GmC,EAAA,aAAA,CAAA,GAAA;EAAR,cAAA,EAAA,MAAA;EAAO,UAAA,CAAA,EAAA,MAAA;EA+CpE,cAAA,CAAA,EAAA,UAmBL,GAAA,EAnB+B;EA2B1B,cAAA,CAAA,EAAA,MAAA;gBApLU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GV,2BAAkC,6BAA2B,QAAQ;;;;;;;;;;;;;cA+CrE,yBAA0B;;;;;;;cA2B1B,wCAAyC,6BAAwB"}
|
|
@@ -3,7 +3,7 @@ const require_error = require('./error-DCeYc93L.js');
|
|
|
3
3
|
const require_loadScript = require('./loadScript-CRbXHvGF.js');
|
|
4
4
|
const require_proxy = require('./proxy-B_Yui2Mf.js');
|
|
5
5
|
const require_url = require('./url-DngZvS9Y.js');
|
|
6
|
-
const require_versionSelector = require('./versionSelector-
|
|
6
|
+
const require_versionSelector = require('./versionSelector-TwNylrt4.js');
|
|
7
7
|
|
|
8
8
|
//#region src/loadClerkJsScript.ts
|
|
9
9
|
const ERROR_CODE = "failed_to_load_clerk_js";
|
|
@@ -191,4 +191,4 @@ Object.defineProperty(exports, 'setClerkJsLoadingErrorPackageName', {
|
|
|
191
191
|
return setClerkJsLoadingErrorPackageName;
|
|
192
192
|
}
|
|
193
193
|
});
|
|
194
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
194
|
+
//# sourceMappingURL=loadClerkJsScript-DPV9ikAI.js.map
|
package/dist/runtime/{loadClerkJsScript-DeKw5raq.js.map → loadClerkJsScript-DPV9ikAI.js.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-DeKw5raq.js","names":["packageName: string","timeoutMs: number","timeoutId: ReturnType<typeof setTimeout>","pollInterval: ReturnType<typeof setInterval>","timeoutId","pollInterval","ClerkRuntimeError","opts?: LoadClerkJsScriptOptions","opts: LoadClerkJsScriptOptions","options: LoadClerkJsScriptOptions","obj: Record<string, string>","script: HTMLScriptElement"],"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 * 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 * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(timeoutMs: number): 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 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.\n *\n * Uses a timeout-based approach to ensure absolute certainty about load success/failure.\n * If the script fails to load within the timeout period, or loads but doesn't create\n * a proper Clerk instance, the promise rejects with an error.\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 const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n return waitForClerkWithTimeout(timeout);\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(clerkJsScriptUrl(opts), {\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,mBAAmB,GAAG,yCAA4B;AAE1D,MAAM,eAAe,gCAAkB,EAAE,aAAa,gBAAiB,EAAC;;;;;;;;;;AAWxE,SAAgB,kCAAkCA,aAAqB;AACrE,cAAa,eAAe,EAAE,YAAa,EAAC;AAC7C;;;;;;;AAyBD,SAAS,wBAAiC;AACxC,YAAW,WAAW,gBAAiB,OAAe,MACpD,QAAO;CAIT,MAAM,QAAS,OAAe;AAC9B,eAAc,UAAU,mBAAmB,MAAM,SAAS;AAC3D;;;;;;;;AASD,SAAS,wBAAwBC,WAAsD;AACrF,QAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;EACtC,IAAI,WAAW;EAEf,MAAM,UAAU,CAACC,aAA0CC,mBAAiD;AAC1G,gBAAaC,YAAU;AACvB,iBAAcC,eAAa;EAC5B;EAED,MAAM,kBAAkB,MAAM;AAC5B,OAAI,SACF;AAGF,OAAI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B,SAAS,CAAC,QAAQ,iBAAiB,GAAG;UAChE,WAAW,kBAAkB,iCAAoB,eAAe,EAAE,eAAe,GAAG,CAC7F,cAAa,2BAAe,OAAO;KAEnC,cAAa,iCAAoB,eAAe,EAAE,eAAe;CAGnE,MAAM,UAAU,kBAAkB,EAAE,eAAe,QAAQ,QAAQ,GAAG,CAAC,KAAK;CAC5E,MAAM,UAAU,wCAAgB,eAAe;AAC/C,SAAQ,UAAU,WAAW,uBAAuB,QAAQ,cAAc,QAAQ;AACnF;;;;;;;AAQD,MAAM,+BAA+B,CAACC,YAAsC;CAC1E,MAAMC,MAA8B,CAAE;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;AACR;;;;;;;AAQD,MAAM,+BAA+B,CAACD,YAAsC,CAACE,WAA8B;CACzG,MAAM,aAAa,6BAA6B,QAAQ;AACxD,MAAK,MAAM,aAAa,WACtB,QAAO,aAAa,WAAW,WAAW,WAAW;AAExD"}
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-DPV9ikAI.js","names":["packageName: string","timeoutMs: number","timeoutId: ReturnType<typeof setTimeout>","pollInterval: ReturnType<typeof setInterval>","timeoutId","pollInterval","ClerkRuntimeError","opts?: LoadClerkJsScriptOptions","opts: LoadClerkJsScriptOptions","options: LoadClerkJsScriptOptions","obj: Record<string, string>","script: HTMLScriptElement"],"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 * 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 * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(timeoutMs: number): 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 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.\n *\n * Uses a timeout-based approach to ensure absolute certainty about load success/failure.\n * If the script fails to load within the timeout period, or loads but doesn't create\n * a proper Clerk instance, the promise rejects with an error.\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 const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n return waitForClerkWithTimeout(timeout);\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(clerkJsScriptUrl(opts), {\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,mBAAmB,GAAG,yCAA4B;AAE1D,MAAM,eAAe,gCAAkB,EAAE,aAAa,gBAAiB,EAAC;;;;;;;;;;AAWxE,SAAgB,kCAAkCA,aAAqB;AACrE,cAAa,eAAe,EAAE,YAAa,EAAC;AAC7C;;;;;;;AAyBD,SAAS,wBAAiC;AACxC,YAAW,WAAW,gBAAiB,OAAe,MACpD,QAAO;CAIT,MAAM,QAAS,OAAe;AAC9B,eAAc,UAAU,mBAAmB,MAAM,SAAS;AAC3D;;;;;;;;AASD,SAAS,wBAAwBC,WAAsD;AACrF,QAAO,IAAI,QAAQ,CAAC,SAAS,WAAW;EACtC,IAAI,WAAW;EAEf,MAAM,UAAU,CAACC,aAA0CC,mBAAiD;AAC1G,gBAAaC,YAAU;AACvB,iBAAcC,eAAa;EAC5B;EAED,MAAM,kBAAkB,MAAM;AAC5B,OAAI,SACF;AAGF,OAAI,uBAAuB,EAAE;AAC3B,eAAW;AACX,YAAQ,WAAW,aAAa;AAChC,YAAQ,KAAK;GACd;EACF;EAED,MAAM,gBAAgB,MAAM;AAC1B,OAAI,SACF;AAGF,cA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oB,eAAe,EAAE,eAAe;CAGnE,MAAM,UAAU,kBAAkB,EAAE,eAAe,QAAQ,QAAQ,GAAG,CAAC,KAAK;CAC5E,MAAM,UAAU,wCAAgB,eAAe;AAC/C,SAAQ,UAAU,WAAW,uBAAuB,QAAQ,cAAc,QAAQ;AACnF;;;;;;;AAQD,MAAM,+BAA+B,CAACC,YAAsC;CAC1E,MAAMC,MAA8B,CAAE;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;AACR;;;;;;;AAQD,MAAM,+BAA+B,CAACD,YAAsC,CAACE,WAA8B;CACzG,MAAM,aAAa,6BAA6B,QAAQ;AACxD,MAAK,MAAM,aAAa,WACtB,QAAO,aAAa,WAAW,WAAW,WAAW;AAExD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClerkOptions, SDKMetadata, Without } from "./index-
|
|
1
|
+
import { ClerkOptions, SDKMetadata, Without } from "./index-s5-2Owl1.js";
|
|
2
2
|
|
|
3
3
|
//#region src/loadClerkJsScript.d.ts
|
|
4
4
|
|
|
@@ -72,4 +72,4 @@ declare const clerkJsScriptUrl: (opts: LoadClerkJsScriptOptions) => string;
|
|
|
72
72
|
declare const buildClerkJsScriptAttributes: (options: LoadClerkJsScriptOptions) => Record<string, string>;
|
|
73
73
|
//#endregion
|
|
74
74
|
export { type LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
75
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
75
|
+
//# sourceMappingURL=loadClerkJsScript-DVE-ngva.d.ts.map
|
package/dist/runtime/{loadClerkJsScript-XFbz-Rdu.d.ts.map → loadClerkJsScript-DVE-ngva.d.ts.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-DVE-ngva.d.ts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;;;AAyBA;AAEC;;;;AAO0B;AAAA;AA0Ga,iBAnHxB,iCAAA,CAmHwB,WAAA,EAAA,MAAA,CAAA,EAAA,IAAA;KA/GnC,wBAAA,GAA2B,OA+G2C,CA/GnC,YA+GmC,EAAA,aAAA,CAAA,GAAA;EAAR,cAAA,EAAA,MAAA;EAAO,UAAA,CAAA,EAAA,MAAA;EA+CpE,cAAA,CAAA,EAAA,UAmBL,GAAA,EAnB+B;EA2B1B,cAAA,CAAA,EAAA,MAAA;gBApLU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA0GV,2BAAkC,6BAA2B,QAAQ;;;;;;;;;;;;;cA+CrE,yBAA0B;;;;;;;cA2B1B,wCAAyC,6BAAwB"}
|
|
@@ -3,7 +3,7 @@ import { ClerkRuntimeError, buildErrorThrower } from "./error-D_j0Opgy.mjs";
|
|
|
3
3
|
import { loadScript } from "./loadScript-Bll0Ohcb.mjs";
|
|
4
4
|
import { isValidProxyUrl, proxyUrlToAbsoluteURL } from "./proxy-Bq8EHApG.mjs";
|
|
5
5
|
import { addClerkPrefix } from "./url-BuzaT2V9.mjs";
|
|
6
|
-
import { versionSelector } from "./versionSelector-
|
|
6
|
+
import { versionSelector } from "./versionSelector-5Bc59Peq.mjs";
|
|
7
7
|
|
|
8
8
|
//#region src/loadClerkJsScript.ts
|
|
9
9
|
const ERROR_CODE = "failed_to_load_clerk_js";
|
|
@@ -168,4 +168,4 @@ const applyClerkJsScriptAttributes = (options) => (script) => {
|
|
|
168
168
|
|
|
169
169
|
//#endregion
|
|
170
170
|
export { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
171
|
-
//# sourceMappingURL=loadClerkJsScript-
|
|
171
|
+
//# sourceMappingURL=loadClerkJsScript-DrOMppui.mjs.map
|
package/dist/runtime/{loadClerkJsScript-GgNV375m.mjs.map → loadClerkJsScript-DrOMppui.mjs.map}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript-GgNV375m.mjs","names":["packageName: string","timeoutMs: number","timeoutId: ReturnType<typeof setTimeout>","pollInterval: ReturnType<typeof setInterval>","timeoutId","pollInterval","opts?: LoadClerkJsScriptOptions","opts: LoadClerkJsScriptOptions","options: LoadClerkJsScriptOptions","obj: Record<string, string>","script: HTMLScriptElement"],"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 * 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 * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(timeoutMs: number): 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 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.\n *\n * Uses a timeout-based approach to ensure absolute certainty about load success/failure.\n * If the script fails to load within the timeout period, or loads but doesn't create\n * a proper Clerk instance, the promise rejects with an error.\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 const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n return waitForClerkWithTimeout(timeout);\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(clerkJsScriptUrl(opts), {\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,mBAAmB,GAAG,4BAA4B;AAE1D,MAAM,eAAe,kB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WAAW,WAAW;AAExD"}
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript-DrOMppui.mjs","names":["packageName: string","timeoutMs: number","timeoutId: ReturnType<typeof setTimeout>","pollInterval: ReturnType<typeof setInterval>","timeoutId","pollInterval","opts?: LoadClerkJsScriptOptions","opts: LoadClerkJsScriptOptions","options: LoadClerkJsScriptOptions","obj: Record<string, string>","script: HTMLScriptElement"],"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 * 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 * @returns Promise that resolves with null if Clerk loads successfully, or rejects with an error if timeout is reached.\n */\nfunction waitForClerkWithTimeout(timeoutMs: number): 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 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.\n *\n * Uses a timeout-based approach to ensure absolute certainty about load success/failure.\n * If the script fails to load within the timeout period, or loads but doesn't create\n * a proper Clerk instance, the promise rejects with an error.\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 const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-js-script]');\n\n if (existingScript) {\n return waitForClerkWithTimeout(timeout);\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const loadPromise = waitForClerkWithTimeout(timeout);\n\n loadScript(clerkJsScriptUrl(opts), {\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,mBAAmB,GAAG,4BAA4B;AAE1D,MAAM,eAAe,kBAAkB,EAAE,aAAa,gBAAiB,EAAC;;;;;;;;;;AAWxE,SAAgB,kCAAkCA,aAAqB;AACrE,cAAa,eAAe,EAAE,YAAa,EAAC;AAC7C;;;;;;;AAyBD,SAAS,wBAAiC;AACx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l$1 as clerkJsScriptUrl, loadClerkJsScript$1 as loadClerkJsScript, setClerkJsLoadingErrorPackageName$1 as setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-
|
|
1
|
+
import "./index-QlnAPzs5.mjs";
|
|
2
|
+
import { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes$1 as buildClerkJsScriptAttributes, clerkJsScriptUrl$1 as clerkJsScriptUrl, loadClerkJsScript$1 as loadClerkJsScript, setClerkJsLoadingErrorPackageName$1 as setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-CDeYMT-M.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-s5-2Owl1.js";
|
|
2
|
+
import { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-DVE-ngva.js";
|
|
3
3
|
export { LoadClerkJsScriptOptions, buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName };
|
|
@@ -8,8 +8,8 @@ require('./retry-rhkPbMCS.js');
|
|
|
8
8
|
require('./loadScript-CRbXHvGF.js');
|
|
9
9
|
require('./proxy-B_Yui2Mf.js');
|
|
10
10
|
require('./url-DngZvS9Y.js');
|
|
11
|
-
require('./versionSelector-
|
|
12
|
-
const require_loadClerkJsScript = require('./loadClerkJsScript-
|
|
11
|
+
require('./versionSelector-TwNylrt4.js');
|
|
12
|
+
const require_loadClerkJsScript = require('./loadClerkJsScript-DPV9ikAI.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-Bll0Ohcb.mjs";
|
|
9
9
|
import "./proxy-Bq8EHApG.mjs";
|
|
10
10
|
import "./url-BuzaT2V9.mjs";
|
|
11
|
-
import "./versionSelector-
|
|
12
|
-
import { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-
|
|
11
|
+
import "./versionSelector-5Bc59Peq.mjs";
|
|
12
|
+
import { buildClerkJsScriptAttributes, clerkJsScriptUrl, loadClerkJsScript, setClerkJsLoadingErrorPackageName } from "./loadClerkJsScript-DrOMppui.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-QlnAPzs5.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 as createPathMatcher$1 };
|
|
16
|
-
//# sourceMappingURL=pathMatcher-
|
|
16
|
+
//# sourceMappingURL=pathMatcher-B3bDWbou.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pathMatcher-B3bDWbou.d.mts","names":[],"sources":["../../src/pathMatcher.ts"],"sourcesContent":[],"mappings":";;;KAGY,yCAAyC;KACzC,WAAA,GAAc,aAAa;AAD3B,KAEA,gBAAA,GAAmB,KAFI,CAEE,MAFgB,GAEP,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-s5-2Owl1.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-C6_QTBhM.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pathMatcher-
|
|
1
|
+
{"version":3,"file":"pathMatcher-C6_QTBhM.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$1 as createPathMatcher } from "./pathMatcher-
|
|
1
|
+
import "./index-QlnAPzs5.mjs";
|
|
2
|
+
import { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher$1 as createPathMatcher } from "./pathMatcher-B3bDWbou.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-s5-2Owl1.js";
|
|
2
|
+
import { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher } from "./pathMatcher-C6_QTBhM.js";
|
|
3
3
|
export { PathMatcherParam, PathPattern, WithPathPatternWildcard, createPathMatcher };
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { APIKeyResource, BillingCheckoutResource, BillingPaymentMethodResource, BillingPaymentResource, BillingPlanResource, BillingStatementResource, BillingSubscriptionPlanPeriod, BillingSubscriptionResource, ClerkAPIResponseError$1 as ClerkAPIResponseError, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, 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$1 as ClerkAPIResponseError, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, OrganizationDomainResource, OrganizationInvitationResource, OrganizationMembershipRequestResource, OrganizationMembershipResource, OrganizationResource, OrganizationSuggestionResource, SessionVerificationLevel, SetActive, SetActiveNavigate, SignedInSessionResource, UseSessionListReturn, UseSessionReturn, UseUserReturn, UserOrganizationInvitationResource, UserResource, __experimental_CheckoutCacheState, __experimental_CheckoutInstance } from "../index-QlnAPzs5.mjs";
|
|
2
|
+
import "../apiUrlFromPublishableKey-DnRaRFJ_.mjs";
|
|
3
3
|
import "../browser-BZxfK_h9.mjs";
|
|
4
|
-
import "../color-
|
|
4
|
+
import "../color-CHG_4-TR.mjs";
|
|
5
5
|
import "../constants-DOglH9d9.mjs";
|
|
6
6
|
import "../date-zJX4Bh-h.mjs";
|
|
7
7
|
import "../deprecated-RhqbBb4P.mjs";
|
|
8
|
-
import "../deriveState-
|
|
8
|
+
import "../deriveState-DH9IbUXL.mjs";
|
|
9
9
|
import "../devBrowser-BaOZgb06.mjs";
|
|
10
|
-
import "../error-
|
|
10
|
+
import "../error-CYVmWc_r.mjs";
|
|
11
11
|
import "../file-REpQjIf5.mjs";
|
|
12
12
|
import "../getEnvVariable-DSWxcBzg.mjs";
|
|
13
13
|
import "../handleValueOrFn-DDzNVpWF.mjs";
|
|
14
14
|
import "../index-Cq2zCNhv.mjs";
|
|
15
15
|
import "../isomorphicAtob-CjUFU8Gx.mjs";
|
|
16
16
|
import "../isomorphicBtoa-CrWZNFLW.mjs";
|
|
17
|
-
import "../keys-
|
|
18
|
-
import "../loadClerkJsScript-
|
|
17
|
+
import "../keys-BLTsG2Vv.mjs";
|
|
18
|
+
import "../loadClerkJsScript-CDeYMT-M.mjs";
|
|
19
19
|
import "../loadScript-pn9tVsQH.mjs";
|
|
20
20
|
import "../localStorageBroadcastChannel-6RgxS6Gn.mjs";
|
|
21
21
|
import "../poller-Cn-a74Uo.mjs";
|
|
@@ -26,7 +26,7 @@ import "../versionSelector-CX1qgO7X.mjs";
|
|
|
26
26
|
import "../object-rOX3tIZ7.mjs";
|
|
27
27
|
import "../logger-Dt3NshH5.mjs";
|
|
28
28
|
import "../index-Cc1Hn1M-.mjs";
|
|
29
|
-
import "../pathMatcher-
|
|
29
|
+
import "../pathMatcher-B3bDWbou.mjs";
|
|
30
30
|
import "../netlifyCacheHandler-CGIrch8G.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, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, 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, ClerkOptions, ClerkPaginatedResponse, ClientResource, CreateOrganizationParams, ForPayerType, GetAPIKeysParams, GetDomainsParams, GetInvitationsParams, GetMembersParams, GetMembershipRequestParams, GetUserOrganizationInvitationsParams, GetUserOrganizationMembershipParams, GetUserOrganizationSuggestionsParams, LoadedClerk, OrganizationDomainResource, OrganizationInvitationResource, OrganizationMembershipRequestResource, OrganizationMembershipResource, OrganizationResource, OrganizationSuggestionResource, SessionVerificationLevel, SetActive, SetActiveNavigate, SignedInSessionResource, UseSessionListReturn, UseSessionReturn, UseUserReturn, UserOrganizationInvitationResource, UserResource, __experimental_CheckoutCacheState, __experimental_CheckoutInstance } from "../index-s5-2Owl1.js";
|
|
2
|
+
import "../apiUrlFromPublishableKey-DOAlYzda.js";
|
|
3
3
|
import "../browser-CT1g0w-N.js";
|
|
4
|
-
import "../color-
|
|
4
|
+
import "../color-wSg34wT2.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-6Yc3Rk05.js";
|
|
9
9
|
import "../devBrowser-ezvLE7uo.js";
|
|
10
|
-
import "../error-
|
|
10
|
+
import "../error-u7M5SRM0.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-BYSwdlWp.js";
|
|
18
|
+
import "../loadClerkJsScript-DVE-ngva.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-C6_QTBhM.js";
|
|
30
30
|
import "../netlifyCacheHandler-Di70sUEE.js";
|
|
31
31
|
import "../index-B5F3AfVc.js";
|
|
32
32
|
import React, { PropsWithChildren, ReactNode } from "react";
|
|
@@ -1614,7 +1614,8 @@ const useCheckout = (options) => {
|
|
|
1614
1614
|
paymentMethod: null,
|
|
1615
1615
|
freeTrialEndsAt: null,
|
|
1616
1616
|
payer: null,
|
|
1617
|
-
needsPaymentMethod: null
|
|
1617
|
+
needsPaymentMethod: null,
|
|
1618
|
+
planPeriodStart: null
|
|
1618
1619
|
};
|
|
1619
1620
|
const { reload, confirm, pathRoot,...rest } = managerProperties.checkout;
|
|
1620
1621
|
return rest;
|