@clerk/shared 4.0.0-snapshot.v20251204175016 → 4.0.0-snapshot.v20251211120550
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.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.d.mts +1 -1
- package/dist/runtime/color.d.ts +1 -1
- package/dist/runtime/color.d.ts.map +1 -1
- package/dist/runtime/deriveState.d.mts +1 -1
- package/dist/runtime/deriveState.d.ts +1 -1
- package/dist/runtime/{error-D6MGXq-n.mjs → error--xlRIO4Z.mjs} +42 -2
- package/dist/runtime/error--xlRIO4Z.mjs.map +1 -0
- package/dist/runtime/{error-KRW-ECGa.d.mts → error-Bar-OO4s.d.mts} +40 -3
- package/dist/runtime/error-Bar-OO4s.d.mts.map +1 -0
- package/dist/runtime/{error-C4TyorFL.js → error-CJmIhSJi.js} +47 -1
- package/dist/runtime/error-CJmIhSJi.js.map +1 -0
- package/dist/runtime/{error-CwbYlf2s.d.ts → error-Du4UdKtF.d.ts} +40 -3
- package/dist/runtime/error-Du4UdKtF.d.ts.map +1 -0
- package/dist/runtime/error.d.mts +3 -3
- package/dist/runtime/error.d.ts +3 -3
- package/dist/runtime/error.js +2 -1
- package/dist/runtime/error.mjs +2 -2
- package/dist/runtime/{index-ChHWjn_I.d.mts → index-CPEYkfCA.d.mts} +162 -136
- package/dist/runtime/{index-ChHWjn_I.d.mts.map → index-CPEYkfCA.d.mts.map} +1 -1
- package/dist/runtime/{index-046BvqQ_.d.ts → index-D42gIYCP.d.ts} +162 -136
- package/dist/runtime/{index-046BvqQ_.d.ts.map → index-D42gIYCP.d.ts.map} +1 -1
- package/dist/runtime/index.js.map +1 -1
- package/dist/runtime/index.mjs.map +1 -1
- package/dist/runtime/internal/clerk-js/completeSignUpFlow.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/completeSignUpFlow.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/componentGuards.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/componentGuards.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/injectedWeb3Providers.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/injectedWeb3Providers.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/organization.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/organization.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/organization.js +1 -1
- package/dist/runtime/internal/clerk-js/organization.js.map +1 -1
- package/dist/runtime/internal/clerk-js/organization.mjs +1 -1
- package/dist/runtime/internal/clerk-js/organization.mjs.map +1 -1
- package/dist/runtime/internal/clerk-js/passkeys.d.mts +2 -2
- package/dist/runtime/internal/clerk-js/passkeys.d.ts +2 -2
- package/dist/runtime/internal/clerk-js/passkeys.js +1 -1
- package/dist/runtime/internal/clerk-js/passkeys.mjs +1 -1
- package/dist/runtime/internal/clerk-js/passwords/complexity.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/passwords/complexity.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/passwords/loadZxcvbn.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/passwords/password.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/passwords/password.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/passwords/strength.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/passwords/strength.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/queryParams.d.mts +2 -2
- package/dist/runtime/internal/clerk-js/queryParams.d.ts +2 -2
- package/dist/runtime/internal/clerk-js/redirectUrls.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/redirectUrls.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/sessionTasks.d.mts +2 -2
- package/dist/runtime/internal/clerk-js/sessionTasks.d.ts +2 -2
- package/dist/runtime/internal/clerk-js/url.d.mts +2 -2
- package/dist/runtime/internal/clerk-js/url.d.ts +2 -2
- package/dist/runtime/internal/clerk-js/user.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/user.d.ts +1 -1
- package/dist/runtime/internal/clerk-js/web3.d.mts +1 -1
- package/dist/runtime/internal/clerk-js/web3.d.ts +1 -1
- package/dist/runtime/jwtPayloadParser.d.mts +1 -1
- package/dist/runtime/jwtPayloadParser.d.ts +1 -1
- package/dist/runtime/keys.d.mts +1 -1
- package/dist/runtime/keys.d.ts +1 -1
- package/dist/runtime/loadClerkJsScript.d.mts +1 -1
- package/dist/runtime/loadClerkJsScript.d.mts.map +1 -1
- package/dist/runtime/loadClerkJsScript.d.ts +1 -1
- package/dist/runtime/loadClerkJsScript.d.ts.map +1 -1
- package/dist/runtime/loadClerkJsScript.js +50 -9
- package/dist/runtime/loadClerkJsScript.js.map +1 -1
- package/dist/runtime/loadClerkJsScript.mjs +50 -9
- package/dist/runtime/loadClerkJsScript.mjs.map +1 -1
- package/dist/runtime/{loadScript-DDWWb733.mjs → loadScript-CHWOPTAN.mjs} +1 -3
- package/dist/runtime/loadScript-CHWOPTAN.mjs.map +1 -0
- package/dist/runtime/{loadScript-B8aSacwz.js → loadScript-CW1MV2O0.js} +1 -3
- package/dist/runtime/loadScript-CW1MV2O0.js.map +1 -0
- package/dist/runtime/loadScript.js +1 -1
- package/dist/runtime/loadScript.mjs +1 -1
- package/dist/runtime/oauth.d.mts +1 -1
- package/dist/runtime/oauth.d.ts +1 -1
- package/dist/runtime/{organization-BzYWUtt4.js → organization-BOnxJJGM.js} +5 -6
- package/dist/runtime/organization-BOnxJJGM.js.map +1 -0
- package/dist/runtime/{organization-JwY1zGRo.mjs → organization-CDNOZNzF.mjs} +5 -6
- package/dist/runtime/organization-CDNOZNzF.mjs.map +1 -0
- package/dist/runtime/organization.d.mts +5 -6
- package/dist/runtime/organization.d.mts.map +1 -1
- package/dist/runtime/organization.d.ts +5 -6
- package/dist/runtime/organization.d.ts.map +1 -1
- package/dist/runtime/organization.js +1 -1
- package/dist/runtime/organization.mjs +1 -1
- package/dist/runtime/pathMatcher.d.mts +1 -1
- package/dist/runtime/pathMatcher.d.ts +1 -1
- package/dist/runtime/poller.d.ts.map +1 -1
- package/dist/runtime/react/index.d.mts +23 -23
- package/dist/runtime/react/index.d.ts +23 -23
- package/dist/runtime/react/index.js +7 -7
- package/dist/runtime/react/index.js.map +1 -1
- package/dist/runtime/react/index.mjs +7 -7
- 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/ui/index.d.mts +1 -1
- package/dist/runtime/ui/index.d.ts +1 -1
- package/dist/runtime/{url-2Vs8oqh-.d.ts → url-B0fryQyT.d.ts} +2 -2
- package/dist/runtime/{url-2Vs8oqh-.d.ts.map → url-B0fryQyT.d.ts.map} +1 -1
- package/dist/runtime/{url-Btmcqq0T.d.mts → url-BXe3Tvsn.d.mts} +2 -2
- package/dist/runtime/{url-Btmcqq0T.d.mts.map → url-BXe3Tvsn.d.mts.map} +1 -1
- package/dist/runtime/{versionSelector-CgdnX7F8.js → versionSelector-BMFwS2IR.js} +3 -3
- package/dist/runtime/{versionSelector-CgdnX7F8.js.map → versionSelector-BMFwS2IR.js.map} +1 -1
- package/dist/runtime/{versionSelector-C99RARtR.mjs → versionSelector-v6LvGO6I.mjs} +3 -3
- package/dist/runtime/{versionSelector-C99RARtR.mjs.map → versionSelector-v6LvGO6I.mjs.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 +161 -135
- package/dist/types/index.d.mts.map +1 -1
- package/dist/types/index.d.ts +161 -135
- package/dist/types/index.d.ts.map +1 -1
- package/package.json +11 -11
- package/dist/runtime/error-C4TyorFL.js.map +0 -1
- package/dist/runtime/error-CwbYlf2s.d.ts.map +0 -1
- package/dist/runtime/error-D6MGXq-n.mjs.map +0 -1
- package/dist/runtime/error-KRW-ECGa.d.mts.map +0 -1
- package/dist/runtime/loadScript-B8aSacwz.js.map +0 -1
- package/dist/runtime/loadScript-DDWWb733.mjs.map +0 -1
- package/dist/runtime/organization-BzYWUtt4.js.map +0 -1
- package/dist/runtime/organization-JwY1zGRo.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["throw new Error(\n 'Do not import from the top-level of @clerk/shared directly. Import from specific subpaths like @clerk/shared/react or @clerk/shared/authorization instead.',\n);\n\nexport {};\n"],"mappings":";;AAAA,MAAM,IAAI,MACR,6JACD"}
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../../src/index.ts"],"sourcesContent":["throw new Error(\n 'Do not import from the top-level of @clerk/shared directly. Import from specific subpaths like @clerk/shared/react or @clerk/shared/authorization instead.',\n);\n\nexport {};\n// Force rebuild for explicit exports (replacing wildcard)\n"],"mappings":";;AAAA,MAAM,IAAI,MACR,6JACD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["throw new Error(\n 'Do not import from the top-level of @clerk/shared directly. Import from specific subpaths like @clerk/shared/react or @clerk/shared/authorization instead.',\n);\n\nexport {};\n"],"mappings":";AAAA,MAAM,IAAI,MACR,6JACD"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../../src/index.ts"],"sourcesContent":["throw new Error(\n 'Do not import from the top-level of @clerk/shared directly. Import from specific subpaths like @clerk/shared/react or @clerk/shared/authorization instead.',\n);\n\nexport {};\n// Force rebuild for explicit exports (replacing wildcard)\n"],"mappings":";AAAA,MAAM,IAAI,MACR,6JACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as ClerkOptions, R as Clerk, b as EnvironmentResource } from "../../index-
|
|
1
|
+
import { H as ClerkOptions, R as Clerk, b as EnvironmentResource } from "../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../moduleManager-pxNnXwxv.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/componentGuards.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as ClerkOptions, R as Clerk, b as EnvironmentResource } from "../../index-
|
|
1
|
+
import { H as ClerkOptions, R as Clerk, b as EnvironmentResource } from "../../index-D42gIYCP.js";
|
|
2
2
|
import "../../moduleManager-WB15hU3T.js";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/componentGuards.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mu as MetamaskWeb3Provider, Nu as OKXWalletWeb3Provider } from "../../index-
|
|
1
|
+
import { Mu as MetamaskWeb3Provider, Nu as OKXWalletWeb3Provider } from "../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../moduleManager-pxNnXwxv.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/injectedWeb3Providers.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Mu as MetamaskWeb3Provider, Nu as OKXWalletWeb3Provider } from "../../index-
|
|
1
|
+
import { Mu as MetamaskWeb3Provider, Nu as OKXWalletWeb3Provider } from "../../index-D42gIYCP.js";
|
|
2
2
|
import "../../moduleManager-WB15hU3T.js";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/injectedWeb3Providers.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/internal/clerk-js/organization.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Checks and assumes a string is an
|
|
3
|
+
* Checks and assumes a string is an Organization ID if it starts with 'org_', specifically for
|
|
4
4
|
* disambiguating with slugs. `_` is a disallowed character in slug names, so slugs cannot
|
|
5
5
|
* start with `org_`.
|
|
6
6
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/internal/clerk-js/organization.d.ts
|
|
2
2
|
/**
|
|
3
|
-
* Checks and assumes a string is an
|
|
3
|
+
* Checks and assumes a string is an Organization ID if it starts with 'org_', specifically for
|
|
4
4
|
* disambiguating with slugs. `_` is a disallowed character in slug names, so slugs cannot
|
|
5
5
|
* start with `org_`.
|
|
6
6
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
//#region src/internal/clerk-js/organization.ts
|
|
3
3
|
/**
|
|
4
|
-
* Checks and assumes a string is an
|
|
4
|
+
* Checks and assumes a string is an Organization ID if it starts with 'org_', specifically for
|
|
5
5
|
* disambiguating with slugs. `_` is a disallowed character in slug names, so slugs cannot
|
|
6
6
|
* start with `org_`.
|
|
7
7
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.js","names":[],"sources":["../../../../src/internal/clerk-js/organization.ts"],"sourcesContent":["/**\n * Checks and assumes a string is an
|
|
1
|
+
{"version":3,"file":"organization.js","names":[],"sources":["../../../../src/internal/clerk-js/organization.ts"],"sourcesContent":["/**\n * Checks and assumes a string is an Organization ID if it starts with 'org_', specifically for\n * disambiguating with slugs. `_` is a disallowed character in slug names, so slugs cannot\n * start with `org_`.\n */\nexport function isOrganizationId(id: string | null | undefined): boolean {\n return typeof id === 'string' && id.startsWith('org_');\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,iBAAiB,IAAwC;AACvE,QAAO,OAAO,OAAO,YAAY,GAAG,WAAW,OAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/internal/clerk-js/organization.ts
|
|
2
2
|
/**
|
|
3
|
-
* Checks and assumes a string is an
|
|
3
|
+
* Checks and assumes a string is an Organization ID if it starts with 'org_', specifically for
|
|
4
4
|
* disambiguating with slugs. `_` is a disallowed character in slug names, so slugs cannot
|
|
5
5
|
* start with `org_`.
|
|
6
6
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organization.mjs","names":[],"sources":["../../../../src/internal/clerk-js/organization.ts"],"sourcesContent":["/**\n * Checks and assumes a string is an
|
|
1
|
+
{"version":3,"file":"organization.mjs","names":[],"sources":["../../../../src/internal/clerk-js/organization.ts"],"sourcesContent":["/**\n * Checks and assumes a string is an Organization ID if it starts with 'org_', specifically for\n * disambiguating with slugs. `_` is a disallowed character in slug names, so slugs cannot\n * start with `org_`.\n */\nexport function isOrganizationId(id: string | null | undefined): boolean {\n return typeof id === 'string' && id.startsWith('org_');\n}\n"],"mappings":";;;;;;AAKA,SAAgB,iBAAiB,IAAwC;AACvE,QAAO,OAAO,OAAO,YAAY,GAAG,WAAW,OAAO"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Gc as CredentialReturn, Jc as PublicKeyCredentialRequestOptionsWithoutExtensions, Kr as PublicKeyCredentialCreationOptionsJSON, Xc as PublicKeyCredentialWithAuthenticatorAttestationResponse, Yc as PublicKeyCredentialWithAuthenticatorAssertionResponse, jf as ClerkRuntimeError, qc as PublicKeyCredentialCreationOptionsWithoutExtensions, qr as PublicKeyCredentialRequestOptionsJSON } from "../../index-
|
|
1
|
+
import { Gc as CredentialReturn, Jc as PublicKeyCredentialRequestOptionsWithoutExtensions, Kr as PublicKeyCredentialCreationOptionsJSON, Xc as PublicKeyCredentialWithAuthenticatorAttestationResponse, Yc as PublicKeyCredentialWithAuthenticatorAssertionResponse, jf as ClerkRuntimeError, qc as PublicKeyCredentialCreationOptionsWithoutExtensions, qr as PublicKeyCredentialRequestOptionsJSON } from "../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../moduleManager-pxNnXwxv.mjs";
|
|
3
|
-
import { m as ClerkWebAuthnError } from "../../error-
|
|
3
|
+
import { m as ClerkWebAuthnError } from "../../error-Bar-OO4s.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/clerk-js/passkeys.d.ts
|
|
6
6
|
type WebAuthnCreateCredentialReturn = CredentialReturn<PublicKeyCredentialWithAuthenticatorAttestationResponse>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Gc as CredentialReturn, Jc as PublicKeyCredentialRequestOptionsWithoutExtensions, Kr as PublicKeyCredentialCreationOptionsJSON, Xc as PublicKeyCredentialWithAuthenticatorAttestationResponse, Yc as PublicKeyCredentialWithAuthenticatorAssertionResponse, jf as ClerkRuntimeError, qc as PublicKeyCredentialCreationOptionsWithoutExtensions, qr as PublicKeyCredentialRequestOptionsJSON } from "../../index-
|
|
1
|
+
import { Gc as CredentialReturn, Jc as PublicKeyCredentialRequestOptionsWithoutExtensions, Kr as PublicKeyCredentialCreationOptionsJSON, Xc as PublicKeyCredentialWithAuthenticatorAttestationResponse, Yc as PublicKeyCredentialWithAuthenticatorAssertionResponse, jf as ClerkRuntimeError, qc as PublicKeyCredentialCreationOptionsWithoutExtensions, qr as PublicKeyCredentialRequestOptionsJSON } from "../../index-D42gIYCP.js";
|
|
2
2
|
import "../../moduleManager-WB15hU3T.js";
|
|
3
|
-
import { m as ClerkWebAuthnError } from "../../error-
|
|
3
|
+
import { m as ClerkWebAuthnError } from "../../error-Du4UdKtF.js";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/clerk-js/passkeys.d.ts
|
|
6
6
|
type WebAuthnCreateCredentialReturn = CredentialReturn<PublicKeyCredentialWithAuthenticatorAttestationResponse>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dl as ZxcvbnResult, El as ValidatePasswordCallbacks, Rl as PasswordSettingsData } from "../../../index-
|
|
1
|
+
import { Dl as ZxcvbnResult, El as ValidatePasswordCallbacks, Rl as PasswordSettingsData } from "../../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../../moduleManager-pxNnXwxv.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/passwords/password.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dl as ZxcvbnResult, El as ValidatePasswordCallbacks, Rl as PasswordSettingsData } from "../../../index-
|
|
1
|
+
import { Dl as ZxcvbnResult, El as ValidatePasswordCallbacks, Rl as PasswordSettingsData } from "../../../index-D42gIYCP.js";
|
|
2
2
|
import "../../../moduleManager-WB15hU3T.js";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/passwords/password.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dl as ZxcvbnResult, Rl as PasswordSettingsData } from "../../../index-
|
|
1
|
+
import { Dl as ZxcvbnResult, Rl as PasswordSettingsData } from "../../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../../moduleManager-pxNnXwxv.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/passwords/strength.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Dl as ZxcvbnResult, Rl as PasswordSettingsData } from "../../../index-
|
|
1
|
+
import { Dl as ZxcvbnResult, Rl as PasswordSettingsData } from "../../../index-D42gIYCP.js";
|
|
2
2
|
import "../../../moduleManager-WB15hU3T.js";
|
|
3
3
|
|
|
4
4
|
//#region src/internal/clerk-js/passwords/strength.d.ts
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../index-
|
|
1
|
+
import "../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../moduleManager-pxNnXwxv.mjs";
|
|
3
|
-
import { v as EmailLinkErrorCodeStatus } from "../../error-
|
|
3
|
+
import { v as EmailLinkErrorCodeStatus } from "../../error-Bar-OO4s.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/clerk-js/queryParams.d.ts
|
|
6
6
|
declare const _ClerkQueryParams: readonly ["__clerk_status", "__clerk_created_session", "__clerk_invitation_token", "__clerk_ticket", "__clerk_modal_state", "__clerk_handshake", "__clerk_handshake_nonce", "__clerk_help", "__clerk_netlify_cache_bust", "__clerk_synced", "__clerk_satellite_url", "suffixed_cookies"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import "../../index-
|
|
1
|
+
import "../../index-D42gIYCP.js";
|
|
2
2
|
import "../../moduleManager-WB15hU3T.js";
|
|
3
|
-
import { v as EmailLinkErrorCodeStatus } from "../../error-
|
|
3
|
+
import { v as EmailLinkErrorCodeStatus } from "../../error-Du4UdKtF.js";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/clerk-js/queryParams.d.ts
|
|
6
6
|
declare const _ClerkQueryParams: readonly ["__clerk_status", "__clerk_created_session", "__clerk_invitation_token", "__clerk_ticket", "__clerk_modal_state", "__clerk_handshake", "__clerk_handshake_nonce", "__clerk_help", "__clerk_netlify_cache_bust", "__clerk_synced", "__clerk_satellite_url", "suffixed_cookies"];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fa as SessionTask, Na as SessionResource } from "../../index-
|
|
1
|
+
import { Fa as SessionTask, Na as SessionResource } from "../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../moduleManager-pxNnXwxv.mjs";
|
|
3
|
-
import { t as buildURL } from "../../url-
|
|
3
|
+
import { t as buildURL } from "../../url-BXe3Tvsn.mjs";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/clerk-js/sessionTasks.d.ts
|
|
6
6
|
/**
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { Fa as SessionTask, Na as SessionResource } from "../../index-
|
|
1
|
+
import { Fa as SessionTask, Na as SessionResource } from "../../index-D42gIYCP.js";
|
|
2
2
|
import "../../moduleManager-WB15hU3T.js";
|
|
3
|
-
import { t as buildURL } from "../../url-
|
|
3
|
+
import { t as buildURL } from "../../url-B0fryQyT.js";
|
|
4
4
|
|
|
5
5
|
//#region src/internal/clerk-js/sessionTasks.d.ts
|
|
6
6
|
/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../index-
|
|
1
|
+
import "../../index-CPEYkfCA.mjs";
|
|
2
2
|
import "../../moduleManager-pxNnXwxv.mjs";
|
|
3
|
-
import { C as trimLeadingSlash, S as toURL, _ as pathFromFullPath, a as hasBannedHrefProtocol, b as sanitizeHref, c as hasUrlInFragment, d as isDevAccountPortalOrigin, f as isDevOrStagingUrl, g as mergeFragmentIntoUrl, h as isValidUrl, i as getSearchParameterFromHash, l as isAllowedRedirect, m as isRedirectForFAPIInitiatedFlow, n as createAllowedRedirectOrigins, o as hasBannedProtocol, p as isProblematicUrl, r as getETLDPlusOneFromFrontendApi, s as hasExternalAccountSignUpError, t as buildURL, u as isDataUri, v as relativeToAbsoluteUrl, w as trimTrailingSlash, x as stripOrigin, y as requiresUserInput } from "../../url-
|
|
3
|
+
import { C as trimLeadingSlash, S as toURL, _ as pathFromFullPath, a as hasBannedHrefProtocol, b as sanitizeHref, c as hasUrlInFragment, d as isDevAccountPortalOrigin, f as isDevOrStagingUrl, g as mergeFragmentIntoUrl, h as isValidUrl, i as getSearchParameterFromHash, l as isAllowedRedirect, m as isRedirectForFAPIInitiatedFlow, n as createAllowedRedirectOrigins, o as hasBannedProtocol, p as isProblematicUrl, r as getETLDPlusOneFromFrontendApi, s as hasExternalAccountSignUpError, t as buildURL, u as isDataUri, v as relativeToAbsoluteUrl, w as trimTrailingSlash, x as stripOrigin, y as requiresUserInput } from "../../url-BXe3Tvsn.mjs";
|
|
4
4
|
export { buildURL, createAllowedRedirectOrigins, getETLDPlusOneFromFrontendApi, getSearchParameterFromHash, hasBannedHrefProtocol, hasBannedProtocol, hasExternalAccountSignUpError, hasUrlInFragment, isAllowedRedirect, isDataUri, isDevAccountPortalOrigin, isDevOrStagingUrl, isProblematicUrl, isRedirectForFAPIInitiatedFlow, isValidUrl, mergeFragmentIntoUrl, pathFromFullPath, relativeToAbsoluteUrl, requiresUserInput, sanitizeHref, stripOrigin, toURL, trimLeadingSlash, trimTrailingSlash };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import "../../index-
|
|
1
|
+
import "../../index-D42gIYCP.js";
|
|
2
2
|
import "../../moduleManager-WB15hU3T.js";
|
|
3
|
-
import { C as trimLeadingSlash, S as toURL, _ as pathFromFullPath, a as hasBannedHrefProtocol, b as sanitizeHref, c as hasUrlInFragment, d as isDevAccountPortalOrigin, f as isDevOrStagingUrl, g as mergeFragmentIntoUrl, h as isValidUrl, i as getSearchParameterFromHash, l as isAllowedRedirect, m as isRedirectForFAPIInitiatedFlow, n as createAllowedRedirectOrigins, o as hasBannedProtocol, p as isProblematicUrl, r as getETLDPlusOneFromFrontendApi, s as hasExternalAccountSignUpError, t as buildURL, u as isDataUri, v as relativeToAbsoluteUrl, w as trimTrailingSlash, x as stripOrigin, y as requiresUserInput } from "../../url-
|
|
3
|
+
import { C as trimLeadingSlash, S as toURL, _ as pathFromFullPath, a as hasBannedHrefProtocol, b as sanitizeHref, c as hasUrlInFragment, d as isDevAccountPortalOrigin, f as isDevOrStagingUrl, g as mergeFragmentIntoUrl, h as isValidUrl, i as getSearchParameterFromHash, l as isAllowedRedirect, m as isRedirectForFAPIInitiatedFlow, n as createAllowedRedirectOrigins, o as hasBannedProtocol, p as isProblematicUrl, r as getETLDPlusOneFromFrontendApi, s as hasExternalAccountSignUpError, t as buildURL, u as isDataUri, v as relativeToAbsoluteUrl, w as trimTrailingSlash, x as stripOrigin, y as requiresUserInput } from "../../url-B0fryQyT.js";
|
|
4
4
|
export { buildURL, createAllowedRedirectOrigins, getETLDPlusOneFromFrontendApi, getSearchParameterFromHash, hasBannedHrefProtocol, hasBannedProtocol, hasExternalAccountSignUpError, hasUrlInFragment, isAllowedRedirect, isDataUri, isDevAccountPortalOrigin, isDevOrStagingUrl, isProblematicUrl, isRedirectForFAPIInitiatedFlow, isValidUrl, mergeFragmentIntoUrl, pathFromFullPath, relativeToAbsoluteUrl, requiresUserInput, sanitizeHref, stripOrigin, toURL, trimLeadingSlash, trimTrailingSlash };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as SharedSignedInAuthObjectProperties, Ji as JwtPayload } from "./index-
|
|
1
|
+
import { C as SharedSignedInAuthObjectProperties, Ji as JwtPayload } from "./index-CPEYkfCA.mjs";
|
|
2
2
|
import "./moduleManager-pxNnXwxv.mjs";
|
|
3
3
|
|
|
4
4
|
//#region src/jwtPayloadParser.d.ts
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as SharedSignedInAuthObjectProperties, Ji as JwtPayload } from "./index-
|
|
1
|
+
import { C as SharedSignedInAuthObjectProperties, Ji as JwtPayload } from "./index-D42gIYCP.js";
|
|
2
2
|
import "./moduleManager-WB15hU3T.js";
|
|
3
3
|
|
|
4
4
|
//#region src/jwtPayloadParser.d.ts
|
package/dist/runtime/keys.d.mts
CHANGED
package/dist/runtime/keys.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript.d.mts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;KAYY,wBAAA;;;EAAA,cAAA,CAAA,EAAA,UAAwB,GAAA,EAAA;EAiBxB,cAAA,CAAA,EAAA,MAAA;
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript.d.mts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;KAYY,wBAAA;;;EAAA,cAAA,CAAA,EAAA,UAAwB,GAAA,EAAA;EAiBxB,cAAA,CAAA,EAAA,MAAA;EA8FC,WAAA,CAAA,EA1GG,WAuJf;EA7C8C,QAAA,CAAA,EAAA,MAAA;EAAmC,MAAA,CAAA,EAAA,MAAA;EAAR,KAAA,CAAA,EAAA,MAAA;EAAO;AA+CjF;;;;EAAiF,iBAAA,CAAA,EAAA,MAAA;AA+CjF,CAAA;AAaa,KAzMD,wBAAA,GAyM2B;EAY1B,cAAA,EAAA,MAAA;EAsBA,UAAA,CAAA,EAAA,MAAA;EAWA,cAAA,CAAA,EAAA,MAUZ;EA+De,QAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAjOH,2BAAkC,6BAA2B,QAAQ;cA+CrE,2BAAkC,6BAA2B,QAAQ;cA+CrE,yBAA0B;cAa1B,yBAA0B;cAY1B,wCAAyC,6BAAwB;cAsBjE,wCAAyC,6BAAwB;cAWjE;;;;;iBAyEG,iCAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript.d.ts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;KAYY,wBAAA;;;EAAA,cAAA,CAAA,EAAA,UAAwB,GAAA,EAAA;EAiBxB,cAAA,CAAA,EAAA,MAAA;
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript.d.ts","names":[],"sources":["../../src/loadClerkJsScript.ts"],"sourcesContent":[],"mappings":";;;;KAYY,wBAAA;;;EAAA,cAAA,CAAA,EAAA,UAAwB,GAAA,EAAA;EAiBxB,cAAA,CAAA,EAAA,MAAA;EA8FC,WAAA,CAAA,EA1GG,WAuJf;EA7C8C,QAAA,CAAA,EAAA,MAAA;EAAmC,MAAA,CAAA,EAAA,MAAA;EAAR,KAAA,CAAA,EAAA,MAAA;EAAO;AA+CjF;;;;EAAiF,iBAAA,CAAA,EAAA,MAAA;AA+CjF,CAAA;AAaa,KAzMD,wBAAA,GAyM2B;EAY1B,cAAA,EAAA,MAAA;EAsBA,UAAA,CAAA,EAAA,MAAA;EAWA,cAAA,CAAA,EAAA,MAUZ;EA+De,QAAA,CAAA,EAAA,MAAA;;;;;;;;;;;;;;;;;;;;;;;;;;cAjOH,2BAAkC,6BAA2B,QAAQ;cA+CrE,2BAAkC,6BAA2B,QAAQ;cA+CrE,yBAA0B;cAa1B,yBAA0B;cAY1B,wCAAyC,6BAAwB;cAsBjE,wCAAyC,6BAAwB;cAWjE;;;;;iBAyEG,iCAAA"}
|
|
@@ -2,13 +2,13 @@ require('./constants-B8tEdUlH.js');
|
|
|
2
2
|
require('./isomorphicAtob-Chnw1Md3.js');
|
|
3
3
|
require('./isomorphicBtoa-oWNvIgSP.js');
|
|
4
4
|
const require_keys = require('./keys-wr08qE7Y.js');
|
|
5
|
-
const require_error = require('./error-
|
|
5
|
+
const require_error = require('./error-CJmIhSJi.js');
|
|
6
6
|
require('./retry-pHsqGFr0.js');
|
|
7
|
-
const require_loadScript = require('./loadScript-
|
|
7
|
+
const require_loadScript = require('./loadScript-CW1MV2O0.js');
|
|
8
8
|
const require_proxy = require('./proxy-BVlsuX5g.js');
|
|
9
9
|
require('./instance-DykLn3Pi.js');
|
|
10
10
|
const require_url = require('./url-DwWU8E5q.js');
|
|
11
|
-
const require_versionSelector = require('./versionSelector-
|
|
11
|
+
const require_versionSelector = require('./versionSelector-BMFwS2IR.js');
|
|
12
12
|
|
|
13
13
|
//#region src/loadClerkJsScript.ts
|
|
14
14
|
const { isDevOrStagingUrl } = require_keys.createDevOrStagingUrlCache();
|
|
@@ -26,6 +26,27 @@ function isClerkGlobalProperlyLoaded(prop) {
|
|
|
26
26
|
const isClerkProperlyLoaded = () => isClerkGlobalProperlyLoaded("Clerk");
|
|
27
27
|
const isClerkUiProperlyLoaded = () => isClerkGlobalProperlyLoaded("__internal_ClerkUiCtor");
|
|
28
28
|
/**
|
|
29
|
+
* Checks if an existing script has a request error using Performance API.
|
|
30
|
+
*
|
|
31
|
+
* @param scriptUrl - The URL of the script to check.
|
|
32
|
+
* @returns True if the script has failed to load due to a network/HTTP error.
|
|
33
|
+
*/
|
|
34
|
+
function hasScriptRequestError(scriptUrl) {
|
|
35
|
+
if (typeof window === "undefined" || !window.performance) return false;
|
|
36
|
+
const entries = performance.getEntriesByName(scriptUrl, "resource");
|
|
37
|
+
if (entries.length === 0) return false;
|
|
38
|
+
const scriptEntry = entries[entries.length - 1];
|
|
39
|
+
if (scriptEntry.transferSize === 0 && scriptEntry.decodedBodySize === 0) {
|
|
40
|
+
if (scriptEntry.responseEnd === 0) return true;
|
|
41
|
+
if (scriptEntry.responseEnd > 0 && scriptEntry.responseStart > 0) return true;
|
|
42
|
+
if ("responseStatus" in scriptEntry) {
|
|
43
|
+
if (scriptEntry.responseStatus >= 400) return true;
|
|
44
|
+
if (scriptEntry.responseStatus === 0) return true;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
29
50
|
* Hotloads the Clerk JS script with robust failure detection.
|
|
30
51
|
*
|
|
31
52
|
* Uses a timeout-based approach to ensure absolute certainty about load success/failure.
|
|
@@ -53,13 +74,21 @@ const loadClerkJsScript = async (opts) => {
|
|
|
53
74
|
cause: error
|
|
54
75
|
});
|
|
55
76
|
if (isClerkProperlyLoaded()) return null;
|
|
56
|
-
if (document.querySelector("script[data-clerk-js-script]")) return waitForPredicateWithTimeout(timeout, isClerkProperlyLoaded, rejectWith());
|
|
57
77
|
if (!opts?.publishableKey) {
|
|
58
78
|
errorThrower.throwMissingPublishableKeyError();
|
|
59
79
|
return null;
|
|
60
80
|
}
|
|
81
|
+
const scriptUrl = clerkJsScriptUrl(opts);
|
|
82
|
+
const existingScript = document.querySelector("script[data-clerk-js-script]");
|
|
83
|
+
if (existingScript) if (hasScriptRequestError(scriptUrl)) existingScript.remove();
|
|
84
|
+
else try {
|
|
85
|
+
await waitForPredicateWithTimeout(timeout, isClerkProperlyLoaded, rejectWith(), existingScript);
|
|
86
|
+
return null;
|
|
87
|
+
} catch {
|
|
88
|
+
existingScript.remove();
|
|
89
|
+
}
|
|
61
90
|
const loadPromise = waitForPredicateWithTimeout(timeout, isClerkProperlyLoaded, rejectWith());
|
|
62
|
-
require_loadScript.loadScript(
|
|
91
|
+
require_loadScript.loadScript(scriptUrl, {
|
|
63
92
|
async: true,
|
|
64
93
|
crossOrigin: "anonymous",
|
|
65
94
|
nonce: opts.nonce,
|
|
@@ -76,13 +105,21 @@ const loadClerkUiScript = async (opts) => {
|
|
|
76
105
|
cause: error
|
|
77
106
|
});
|
|
78
107
|
if (isClerkUiProperlyLoaded()) return null;
|
|
79
|
-
if (document.querySelector("script[data-clerk-ui-script]")) return waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());
|
|
80
108
|
if (!opts?.publishableKey) {
|
|
81
109
|
errorThrower.throwMissingPublishableKeyError();
|
|
82
110
|
return null;
|
|
83
111
|
}
|
|
112
|
+
const scriptUrl = clerkUiScriptUrl(opts);
|
|
113
|
+
const existingScript = document.querySelector("script[data-clerk-ui-script]");
|
|
114
|
+
if (existingScript) if (hasScriptRequestError(scriptUrl)) existingScript.remove();
|
|
115
|
+
else try {
|
|
116
|
+
await waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith(), existingScript);
|
|
117
|
+
return null;
|
|
118
|
+
} catch {
|
|
119
|
+
existingScript.remove();
|
|
120
|
+
}
|
|
84
121
|
const loadPromise = waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());
|
|
85
|
-
require_loadScript.loadScript(
|
|
122
|
+
require_loadScript.loadScript(scriptUrl, {
|
|
86
123
|
async: true,
|
|
87
124
|
crossOrigin: "anonymous",
|
|
88
125
|
nonce: opts.nonce,
|
|
@@ -110,7 +147,7 @@ const clerkUiScriptUrl = (opts) => {
|
|
|
110
147
|
publishableKey,
|
|
111
148
|
proxyUrl,
|
|
112
149
|
domain
|
|
113
|
-
})}/npm/@clerk/ui@${require_versionSelector.versionSelector(clerkUiVersion)}/dist/ui.browser.js`;
|
|
150
|
+
})}/npm/@clerk/ui@${require_versionSelector.versionSelector(clerkUiVersion, "1.0.0-snapshot.v20251211120550")}/dist/ui.browser.js`;
|
|
114
151
|
};
|
|
115
152
|
const buildClerkJsScriptAttributes = (options) => {
|
|
116
153
|
const obj = {};
|
|
@@ -132,13 +169,17 @@ const buildScriptHost = (opts) => {
|
|
|
132
169
|
else if (domain && !isDevOrStagingUrl(require_keys.parsePublishableKey(publishableKey)?.frontendApi || "")) return require_url.addClerkPrefix(domain);
|
|
133
170
|
else return require_keys.parsePublishableKey(publishableKey)?.frontendApi || "";
|
|
134
171
|
};
|
|
135
|
-
function waitForPredicateWithTimeout(timeoutMs, predicate, rejectWith) {
|
|
172
|
+
function waitForPredicateWithTimeout(timeoutMs, predicate, rejectWith, existingScript) {
|
|
136
173
|
return new Promise((resolve, reject) => {
|
|
137
174
|
let resolved = false;
|
|
138
175
|
const cleanup = (timeoutId$1, pollInterval$1) => {
|
|
139
176
|
clearTimeout(timeoutId$1);
|
|
140
177
|
clearInterval(pollInterval$1);
|
|
141
178
|
};
|
|
179
|
+
existingScript?.addEventListener("error", () => {
|
|
180
|
+
cleanup(timeoutId, pollInterval);
|
|
181
|
+
reject(rejectWith);
|
|
182
|
+
});
|
|
142
183
|
const checkAndResolve = () => {
|
|
143
184
|
if (resolved) return;
|
|
144
185
|
if (predicate()) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loadClerkJsScript.js","names":["createDevOrStagingUrlCache","buildErrorThrower","ClerkRuntimeError","versionSelector","obj: Record<string, string>","isValidProxyUrl","proxyUrlToAbsoluteURL","parsePublishableKey","addClerkPrefix","timeoutId","pollInterval"],"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 { SDKMetadata } from './types';\nimport { addClerkPrefix } from './url';\nimport { versionSelector } from './versionSelector';\n\nconst { isDevOrStagingUrl } = createDevOrStagingUrlCache();\n\nconst errorThrower = buildErrorThrower({ packageName: '@clerk/shared' });\n\nexport type LoadClerkJsScriptOptions = {\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\nexport type LoadClerkUiScriptOptions = {\n publishableKey: string;\n clerkUiUrl?: string;\n clerkUiVersion?: string;\n proxyUrl?: string;\n domain?: string;\n nonce?: string;\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 isClerkGlobalProperlyLoaded(prop: 'Clerk' | '__internal_ClerkUiCtor'): boolean {\n if (typeof window === 'undefined' || !(window as any)[prop]) {\n return false;\n }\n\n // Basic validation that window.Clerk has the expected structure\n const val = (window as any)[prop];\n return !!val;\n}\nconst isClerkProperlyLoaded = () => isClerkGlobalProperlyLoaded('Clerk');\nconst isClerkUiProperlyLoaded = () => isClerkGlobalProperlyLoaded('__internal_ClerkUiCtor');\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 */\nexport const loadClerkJsScript = async (opts?: LoadClerkJsScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n const rejectWith = (error?: Error) =>\n new ClerkRuntimeError('Failed to load Clerk JS' + (error?.message ? `, ${error.message}` : ''), {\n code: 'failed_to_load_clerk_js',\n cause: error,\n });\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 waitForPredicateWithTimeout(timeout, isClerkProperlyLoaded, rejectWith());\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const loadPromise = waitForPredicateWithTimeout(timeout, isClerkProperlyLoaded, rejectWith());\n\n loadScript(clerkJsScriptUrl(opts), {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyAttributesToScript(buildClerkJsScriptAttributes(opts)),\n }).catch(error => {\n throw rejectWith(error);\n });\n\n return loadPromise;\n};\n\nexport const loadClerkUiScript = async (opts?: LoadClerkUiScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n const rejectWith = (error?: Error) =>\n new ClerkRuntimeError('Failed to load Clerk UI' + (error?.message ? `, ${error.message}` : ''), {\n code: 'failed_to_load_clerk_ui',\n cause: error,\n });\n\n if (isClerkUiProperlyLoaded()) {\n return null;\n }\n\n const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-ui-script]');\n\n if (existingScript) {\n return waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const loadPromise = waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());\n loadScript(clerkUiScriptUrl(opts), {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyAttributesToScript(buildClerkUiScriptAttributes(opts)),\n }).catch(error => {\n throw rejectWith(error);\n });\n\n return loadPromise;\n};\n\nexport const clerkJsScriptUrl = (opts: LoadClerkJsScriptOptions) => {\n const { clerkJSUrl, clerkJSVariant, clerkJSVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkJSUrl) {\n return clerkJSUrl;\n }\n\n const scriptHost = buildScriptHost({ publishableKey, proxyUrl, domain });\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\nexport const clerkUiScriptUrl = (opts: LoadClerkUiScriptOptions) => {\n const { clerkUiUrl, clerkUiVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkUiUrl) {\n return clerkUiUrl;\n }\n\n const scriptHost = buildScriptHost({ publishableKey, proxyUrl, domain });\n const version = versionSelector(clerkUiVersion);\n return `https://${scriptHost}/npm/@clerk/ui@${version}/dist/ui.browser.js`;\n};\n\nexport const 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\nexport const buildClerkUiScriptAttributes = (options: LoadClerkUiScriptOptions) => {\n // TODO @nikos do we need this?\n return buildClerkJsScriptAttributes(options);\n};\n\nconst applyAttributesToScript = (attributes: Record<string, string>) => (script: HTMLScriptElement) => {\n for (const attribute in attributes) {\n script.setAttribute(attribute, attributes[attribute]);\n }\n};\n\nexport const buildScriptHost = (opts: { publishableKey: string; proxyUrl?: string; domain?: string }) => {\n const { proxyUrl, domain, publishableKey } = opts;\n\n if (!!proxyUrl && isValidProxyUrl(proxyUrl)) {\n return proxyUrlToAbsoluteURL(proxyUrl).replace(/http(s)?:\\/\\//, '');\n } else if (domain && !isDevOrStagingUrl(parsePublishableKey(publishableKey)?.frontendApi || '')) {\n return addClerkPrefix(domain);\n } else {\n return parsePublishableKey(publishableKey)?.frontendApi || '';\n }\n};\n\nfunction waitForPredicateWithTimeout(\n timeoutMs: number,\n predicate: () => boolean,\n rejectWith: Error,\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 const checkAndResolve = () => {\n if (resolved) {\n return;\n }\n\n if (predicate()) {\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 (!predicate()) {\n reject(rejectWith);\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\nexport function setClerkJsLoadingErrorPackageName(packageName: string) {\n errorThrower.setPackageName({ packageName });\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,MAAM,EAAE,sBAAsBA,yCAA4B;AAE1D,MAAM,eAAeC,gCAAkB,EAAE,aAAa,iBAAiB,CAAC;;;;;;;AAmCxE,SAAS,4BAA4B,MAAmD;AACtF,KAAI,OAAO,WAAW,eAAe,CAAE,OAAe,MACpD,QAAO;AAKT,QAAO,CAAC,CADK,OAAe;;AAG9B,MAAM,8BAA8B,4BAA4B,QAAQ;AACxE,MAAM,gCAAgC,4BAA4B,yBAAyB;;;;;;;;;;;;;;;;;;;;;;AAuB3F,MAAa,oBAAoB,OAAO,SAAuE;CAC7G,MAAM,UAAU,MAAM,qBAAqB;CAC3C,MAAM,cAAc,U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MAAM,WAAW,aAA0C,mBAAiD;AAC1G,gBAAaE,YAAU;AACvB,iBAAcC,eAAa;;EAG7B,MAAM,wBAAwB;AAC5B,OAAI,SACF;AAGF,OAAI,WAAW,EAAE;AACf,eAAW;AACX,YAAQ,WAAW,aAAa;AAChC,YAAQ,KAAK;;;EAIjB,MAAM,sBAAsB;AAC1B,OAAI,SACF;AAGF,cAAW;AACX,WAAQ,WAAW,aAAa;AAEhC,OAAI,CAAC,WAAW,CACd,QAAO,WAAW;OAElB,SAAQ,KAAK;;EAIjB,MAAM,YAAY,WAAW,eAAe,UAAU;AAEtD,mBAAiB;EAEjB,MAAM,eAAe,kBAAkB;AACrC,OAAI,UAAU;AACZ,kBAAc,aAAa;AAC3B;;AAEF,oBAAiB;KAChB,IAAI;GACP;;AAGJ,SAAgB,kCAAkC,aAAqB;AACrE,cAAa,eAAe,EAAE,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"loadClerkJsScript.js","names":["createDevOrStagingUrlCache","buildErrorThrower","ClerkRuntimeError","versionSelector","obj: Record<string, string>","isValidProxyUrl","proxyUrlToAbsoluteURL","parsePublishableKey","addClerkPrefix","timeoutId","pollInterval"],"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 { SDKMetadata } from './types';\nimport { addClerkPrefix } from './url';\nimport { versionSelector } from './versionSelector';\n\nconst { isDevOrStagingUrl } = createDevOrStagingUrlCache();\n\nconst errorThrower = buildErrorThrower({ packageName: '@clerk/shared' });\n\nexport type LoadClerkJsScriptOptions = {\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\nexport type LoadClerkUiScriptOptions = {\n publishableKey: string;\n clerkUiUrl?: string;\n clerkUiVersion?: string;\n proxyUrl?: string;\n domain?: string;\n nonce?: string;\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 isClerkGlobalProperlyLoaded(prop: 'Clerk' | '__internal_ClerkUiCtor'): boolean {\n if (typeof window === 'undefined' || !(window as any)[prop]) {\n return false;\n }\n\n // Basic validation that window.Clerk has the expected structure\n const val = (window as any)[prop];\n return !!val;\n}\nconst isClerkProperlyLoaded = () => isClerkGlobalProperlyLoaded('Clerk');\nconst isClerkUiProperlyLoaded = () => isClerkGlobalProperlyLoaded('__internal_ClerkUiCtor');\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 * 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 */\nexport const loadClerkJsScript = async (opts?: LoadClerkJsScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n const rejectWith = (error?: Error) =>\n new ClerkRuntimeError('Failed to load Clerk JS' + (error?.message ? `, ${error.message}` : ''), {\n code: 'failed_to_load_clerk_js',\n cause: error,\n });\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 waitForPredicateWithTimeout(timeout, isClerkProperlyLoaded, rejectWith(), existingScript);\n return null;\n } catch {\n existingScript.remove();\n }\n }\n }\n\n const loadPromise = waitForPredicateWithTimeout(timeout, isClerkProperlyLoaded, rejectWith());\n\n loadScript(scriptUrl, {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyAttributesToScript(buildClerkJsScriptAttributes(opts)),\n }).catch(error => {\n throw rejectWith(error);\n });\n\n return loadPromise;\n};\n\nexport const loadClerkUiScript = async (opts?: LoadClerkUiScriptOptions): Promise<HTMLScriptElement | null> => {\n const timeout = opts?.scriptLoadTimeout ?? 15000;\n const rejectWith = (error?: Error) =>\n new ClerkRuntimeError('Failed to load Clerk UI' + (error?.message ? `, ${error.message}` : ''), {\n code: 'failed_to_load_clerk_ui',\n cause: error,\n });\n\n if (isClerkUiProperlyLoaded()) {\n return null;\n }\n\n if (!opts?.publishableKey) {\n errorThrower.throwMissingPublishableKeyError();\n return null;\n }\n\n const scriptUrl = clerkUiScriptUrl(opts);\n const existingScript = document.querySelector<HTMLScriptElement>('script[data-clerk-ui-script]');\n\n if (existingScript) {\n if (hasScriptRequestError(scriptUrl)) {\n existingScript.remove();\n } else {\n try {\n await waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith(), existingScript);\n return null;\n } catch {\n existingScript.remove();\n }\n }\n }\n\n const loadPromise = waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());\n\n loadScript(scriptUrl, {\n async: true,\n crossOrigin: 'anonymous',\n nonce: opts.nonce,\n beforeLoad: applyAttributesToScript(buildClerkUiScriptAttributes(opts)),\n }).catch(error => {\n throw rejectWith(error);\n });\n\n return loadPromise;\n};\n\nexport const clerkJsScriptUrl = (opts: LoadClerkJsScriptOptions) => {\n const { clerkJSUrl, clerkJSVariant, clerkJSVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkJSUrl) {\n return clerkJSUrl;\n }\n\n const scriptHost = buildScriptHost({ publishableKey, proxyUrl, domain });\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\nexport const clerkUiScriptUrl = (opts: LoadClerkUiScriptOptions) => {\n const { clerkUiUrl, clerkUiVersion, proxyUrl, domain, publishableKey } = opts;\n\n if (clerkUiUrl) {\n return clerkUiUrl;\n }\n\n const scriptHost = buildScriptHost({ publishableKey, proxyUrl, domain });\n const version = versionSelector(clerkUiVersion, UI_PACKAGE_VERSION);\n return `https://${scriptHost}/npm/@clerk/ui@${version}/dist/ui.browser.js`;\n};\n\nexport const 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\nexport const buildClerkUiScriptAttributes = (options: LoadClerkUiScriptOptions) => {\n // TODO @nikos do we need this?\n return buildClerkJsScriptAttributes(options);\n};\n\nconst applyAttributesToScript = (attributes: Record<string, string>) => (script: HTMLScriptElement) => {\n for (const attribute in attributes) {\n script.setAttribute(attribute, attributes[attribute]);\n }\n};\n\nexport const buildScriptHost = (opts: { publishableKey: string; proxyUrl?: string; domain?: string }) => {\n const { proxyUrl, domain, publishableKey } = opts;\n\n if (!!proxyUrl && isValidProxyUrl(proxyUrl)) {\n return proxyUrlToAbsoluteURL(proxyUrl).replace(/http(s)?:\\/\\//, '');\n } else if (domain && !isDevOrStagingUrl(parsePublishableKey(publishableKey)?.frontendApi || '')) {\n return addClerkPrefix(domain);\n } else {\n return parsePublishableKey(publishableKey)?.frontendApi || '';\n }\n};\n\nfunction waitForPredicateWithTimeout(\n timeoutMs: number,\n predicate: () => boolean,\n rejectWith: Error,\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(rejectWith);\n });\n\n const checkAndResolve = () => {\n if (resolved) {\n return;\n }\n\n if (predicate()) {\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 (!predicate()) {\n reject(rejectWith);\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\nexport function setClerkJsLoadingErrorPackageName(packageName: string) {\n errorThrower.setPackageName({ packageName });\n}\n"],"mappings":";;;;;;;;;;;;;AAQA,MAAM,EAAE,sBAAsBA,yCAA4B;AAE1D,MAAM,eAAeC,gCAAkB,EAAE,aAAa,iBAAiB,CAAC;;;;;;;AAmCxE,SAAS,4BAA4B,MAAmD;AACtF,KAAI,OAAO,WAAW,eAAe,CAAE,OAAe,MACpD,QAAO;AAKT,QAAO,CAAC,CADK,OAAe;;AAG9B,MAAM,8BAA8B,4BAA4B,QAAQ;AACxE,MAAM,gCAAgC,4BAA4B,yBAAyB;;;;;;;AAQ3F,SAAS,sBAAsB,WAA4B;AACzD,KAAI,OAAO,WAAW,eAAe,CAAC,OAAO,YAC3C,QAAO;CAGT,MAAM,UAAU,YAAY,iBAAiB,WAAW,WAAW;AAEnE,KAAI,QAAQ,WAAW,EACrB,QAAO;CAGT,MAAM,cAAc,QAAQ,QAAQ,SAAS;AAI7C,KAAI,YAAY,iBAAiB,KAAK,YAAY,oBAAoB,GAAG;AAEvE,MAAI,YAAY,gBAAgB,EAC9B,QAAO;AAGT,MAAI,YAAY,cAAc,KAAK,YAAY,gBAAgB,EAC7D,QAAO;AAGT,MAAI,oBAAoB,aAAa;AAEnC,OADgB,YAAoB,kBACtB,IACZ,QAAO;AAET,OAAI,YAAY,mBAAmB,EACjC,QAAO;;;AAKb,QAAO;;;;;;;;;;;;;;;;;;;;;;;AAw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