@clerk/chrome-extension 2.8.5-canary.v20251124102636 → 3.0.0-canary-core3.v20251124105058

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.
@@ -3,6 +3,7 @@
3
3
  var React7 = require('react');
4
4
  require('use-sync-external-store/shim/index.js');
5
5
  var reactDom = require('react-dom');
6
+ var entry = require('@clerk/ui/entry');
6
7
  var noRhc = require('@clerk/clerk-js/no-rhc');
7
8
  var browser = require('webextension-polyfill');
8
9
  var jsxRuntime = require('react/jsx-runtime');
@@ -169,7 +170,7 @@ function buildErrorThrower({ packageName, customMessages }) {
169
170
  };
170
171
  }
171
172
  var _a4;
172
- (_a4 = class extends ClerkError {
173
+ var ClerkRuntimeError = (_a4 = class extends ClerkError {
173
174
  constructor(message, options) {
174
175
  super({
175
176
  ...options,
@@ -183,14 +184,27 @@ var _a4;
183
184
  }
184
185
  }, __publicField(_a4, "kind", "ClerkRuntimeError"), _a4);
185
186
 
186
- // ../shared/dist/runtime/isomorphicAtob-DybBXGFR.mjs
187
+ // ../shared/dist/runtime/constants-Bp0qtelQ.mjs
188
+ var DEV_OR_STAGING_SUFFIXES = [
189
+ ".lcl.dev",
190
+ ".stg.dev",
191
+ ".lclstage.dev",
192
+ ".stgstage.dev",
193
+ ".dev.lclclerk.com",
194
+ ".stg.lclclerk.com",
195
+ ".accounts.lclclerk.com",
196
+ "accountsstage.dev",
197
+ "accounts.dev"
198
+ ];
199
+
200
+ // ../shared/dist/runtime/isomorphicAtob-CYR5fxvZ.mjs
187
201
  var isomorphicAtob = (data) => {
188
202
  if (typeof atob !== "undefined" && typeof atob === "function") return atob(data);
189
203
  else if (typeof global !== "undefined" && global.Buffer) return new global.Buffer(data, "base64").toString();
190
204
  return data;
191
205
  };
192
206
 
193
- // ../shared/dist/runtime/keys-YNv6yjKk.mjs
207
+ // ../shared/dist/runtime/keys-BGyzAyGu.mjs
194
208
  var PUBLISHABLE_KEY_LIVE_PREFIX = "pk_live_";
195
209
  var PUBLISHABLE_KEY_TEST_PREFIX = "pk_test_";
196
210
  function isValidDecodedPublishableKey(decoded) {
@@ -238,8 +252,21 @@ function isPublishableKey(key = "") {
238
252
  return false;
239
253
  }
240
254
  }
255
+ function createDevOrStagingUrlCache() {
256
+ const devOrStagingUrlCache = /* @__PURE__ */ new Map();
257
+ return { isDevOrStagingUrl: (url) => {
258
+ if (!url) return false;
259
+ const hostname = typeof url === "string" ? url : url.hostname;
260
+ let res = devOrStagingUrlCache.get(hostname);
261
+ if (res === void 0) {
262
+ res = DEV_OR_STAGING_SUFFIXES.some((s) => hostname.endsWith(s));
263
+ devOrStagingUrlCache.set(hostname, res);
264
+ }
265
+ return res;
266
+ } };
267
+ }
241
268
 
242
- // ../../node_modules/.pnpm/swr@2.3.4_react@18.3.1/node_modules/swr/dist/_internal/events.mjs
269
+ // ../../node_modules/swr/dist/_internal/events.mjs
243
270
  var events_exports = {};
244
271
  __export(events_exports, {
245
272
  ERROR_REVALIDATE_EVENT: () => ERROR_REVALIDATE_EVENT,
@@ -252,7 +279,7 @@ var RECONNECT_EVENT = 1;
252
279
  var MUTATE_EVENT = 2;
253
280
  var ERROR_REVALIDATE_EVENT = 3;
254
281
 
255
- // ../../node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/lite/index.mjs
282
+ // ../../node_modules/dequal/lite/index.mjs
256
283
  var has = Object.prototype.hasOwnProperty;
257
284
  function dequal(foo, bar) {
258
285
  var ctor, len;
@@ -278,7 +305,7 @@ function dequal(foo, bar) {
278
305
  return foo !== foo && bar !== bar;
279
306
  }
280
307
 
281
- // ../../node_modules/.pnpm/swr@2.3.4_react@18.3.1/node_modules/swr/dist/_internal/config-context-client-BoS53ST9.mjs
308
+ // ../../node_modules/swr/dist/_internal/config-context-client-BoS53ST9.mjs
282
309
  var SWRGlobalState = /* @__PURE__ */ new WeakMap();
283
310
  var noop2 = () => {
284
311
  };
@@ -714,7 +741,7 @@ var SWRConfig = (props) => {
714
741
  }));
715
742
  };
716
743
 
717
- // ../../node_modules/.pnpm/swr@2.3.4_react@18.3.1/node_modules/swr/dist/_internal/constants.mjs
744
+ // ../../node_modules/swr/dist/_internal/constants.mjs
718
745
  var INFINITE_PREFIX = "$inf$";
719
746
  var enableDevtools = isWindowDefined && window.__SWR_DEVTOOLS_USE__;
720
747
  var use = enableDevtools ? window.__SWR_DEVTOOLS_USE__ : [];
@@ -768,7 +795,7 @@ var SWRConfig2 = OBJECT.defineProperty(SWRConfig, "defaultValue", {
768
795
  });
769
796
  Promise.resolve();
770
797
 
771
- // ../../node_modules/.pnpm/dequal@2.0.3/node_modules/dequal/dist/index.mjs
798
+ // ../../node_modules/dequal/dist/index.mjs
772
799
  var has2 = Object.prototype.hasOwnProperty;
773
800
  function find(iter, tar, key) {
774
801
  for (key of iter.keys()) {
@@ -1058,13 +1085,20 @@ var createElementComponent = (type, isServer) => {
1058
1085
  createElementComponent("payment", typeof window === "undefined");
1059
1086
  createContextAndHook("PaymentElementContext");
1060
1087
  createContextAndHook("StripeUtilsContext");
1061
- var errorThrower = buildErrorThrower({ packageName: "@clerk/clerk-react" });
1088
+
1089
+ // ../react/dist/chunk-MB46WFKC.mjs
1090
+ var errorThrower = buildErrorThrower({ packageName: "@clerk/react" });
1062
1091
  function setErrorThrowerOptions(options) {
1063
1092
  errorThrower.setMessages(options).setPackageName(options);
1064
1093
  }
1065
- var [AuthContext] = createContextAndHook("AuthContext");
1066
1094
  var IsomorphicClerkContext = ClerkInstanceContext;
1067
1095
  var useIsomorphicClerkContext = useClerkInstanceContext;
1096
+ var useAssertWrappedByClerkProvider2 = (source) => {
1097
+ useAssertWrappedByClerkProvider(() => {
1098
+ errorThrower.throwMissingClerkProviderError({ source });
1099
+ });
1100
+ };
1101
+ var [AuthContext] = createContextAndHook("AuthContext");
1068
1102
  var multipleClerkProvidersError = "You've added multiple <ClerkProvider> components in your React component tree. Wrap your components in a single <ClerkProvider>.";
1069
1103
  var multipleChildrenInButtonComponent = (name) => `You've passed multiple children components to <${name}/>. You can only pass a single child component or text.`;
1070
1104
  var unsupportedNonBrowserDomainOrProxyUrlFunction = "Unsupported usage of isSatellite, domain or proxyUrl. The usage of isSatellite, domain or proxyUrl as function is not supported in non-browser environments.";
@@ -1082,11 +1116,6 @@ var userButtonMenuActionRenderedError = "<UserButton.Action /> component needs t
1082
1116
  var userButtonMenuLinkRenderedError = "<UserButton.Link /> component needs to be a direct child of `<UserButton.MenuItems />`.";
1083
1117
  var userButtonMenuItemLinkWrongProps = "Missing props. <UserButton.Link /> component requires the following props: href, label and labelIcon.";
1084
1118
  var userButtonMenuItemsActionWrongsProps = "Missing props. <UserButton.Action /> component requires the following props: label.";
1085
- var useAssertWrappedByClerkProvider2 = (source) => {
1086
- useAssertWrappedByClerkProvider(() => {
1087
- errorThrower.throwMissingClerkProviderError({ source });
1088
- });
1089
- };
1090
1119
  var withClerk = (Component, displayNameOrOptions) => {
1091
1120
  const passedDisplayedName = typeof displayNameOrOptions === "string" ? displayNameOrOptions : displayNameOrOptions == null ? void 0 : displayNameOrOptions.component;
1092
1121
  const displayName = passedDisplayedName || Component.displayName || Component.name || "Component";
@@ -1111,7 +1140,7 @@ var withClerk = (Component, displayNameOrOptions) => {
1111
1140
  return HOC;
1112
1141
  };
1113
1142
 
1114
- // ../shared/dist/runtime/runtimeEnvironment-BB2sO-19.mjs
1143
+ // ../shared/dist/runtime/runtimeEnvironment-D1yr0yUs.mjs
1115
1144
  var isDevelopmentEnvironment = () => {
1116
1145
  try {
1117
1146
  return process.env.NODE_ENV === "development";
@@ -1134,7 +1163,7 @@ var isProductionEnvironment = () => {
1134
1163
  return false;
1135
1164
  };
1136
1165
 
1137
- // ../shared/dist/runtime/deprecated-BqlFbLHj.mjs
1166
+ // ../shared/dist/runtime/deprecated--jK9xTNh.mjs
1138
1167
  var displayedWarnings = /* @__PURE__ */ new Set();
1139
1168
  var deprecated = (fnName, warning, key) => {
1140
1169
  const hideWarning = isTestEnvironment() || isProductionEnvironment();
@@ -1202,19 +1231,19 @@ withClerk(
1202
1231
  "AuthenticateWithRedirectCallback"
1203
1232
  );
1204
1233
 
1205
- // ../shared/dist/runtime/handleValueOrFn-CcwnRX-K.mjs
1234
+ // ../shared/dist/runtime/handleValueOrFn-AOTAW6HQ.mjs
1206
1235
  function handleValueOrFn(value, url, defaultValue) {
1207
1236
  if (typeof value === "function") return value(url);
1208
1237
  if (typeof value !== "undefined") return value;
1209
1238
  if (typeof defaultValue !== "undefined") return defaultValue;
1210
1239
  }
1211
1240
 
1212
- // ../shared/dist/runtime/utils-DnE51LOo.mjs
1241
+ // ../shared/dist/runtime/utils-DIVknyRo.mjs
1213
1242
  var logErrorInDevMode = (message) => {
1214
1243
  if (isDevelopmentEnvironment()) console.error(`Clerk: ${message}`);
1215
1244
  };
1216
1245
 
1217
- // ../shared/dist/runtime/object-Be3MMNTQ.mjs
1246
+ // ../shared/dist/runtime/object-CPFrgK_j.mjs
1218
1247
  var without = (obj, ...props) => {
1219
1248
  const copy = { ...obj };
1220
1249
  for (const prop of props) delete copy[prop];
@@ -2158,12 +2187,219 @@ var __privateGet2 = (obj, member, getter) => (__accessCheck(obj, member, "read f
2158
2187
  var __privateAdd2 = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
2159
2188
  var __privateSet2 = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), member.set(obj, value), value);
2160
2189
  var __privateMethod2 = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
2190
+
2191
+ // ../shared/dist/runtime/retry-l1_iB-NH.mjs
2192
+ var defaultOptions = {
2193
+ initialDelay: 125,
2194
+ maxDelayBetweenRetries: 0,
2195
+ factor: 2,
2196
+ shouldRetry: (_, iteration) => iteration < 5,
2197
+ retryImmediately: false,
2198
+ jitter: true
2199
+ };
2200
+ var RETRY_IMMEDIATELY_DELAY = 100;
2201
+ var sleep = async (ms) => new Promise((s) => setTimeout(s, ms));
2202
+ var applyJitter = (delay, jitter) => {
2203
+ return jitter ? delay * (1 + Math.random()) : delay;
2204
+ };
2205
+ var createExponentialDelayAsyncFn = (opts) => {
2206
+ let timesCalled = 0;
2207
+ const calculateDelayInMs = () => {
2208
+ const constant = opts.initialDelay;
2209
+ const base = opts.factor;
2210
+ let delay = constant * Math.pow(base, timesCalled);
2211
+ delay = applyJitter(delay, opts.jitter);
2212
+ return Math.min(opts.maxDelayBetweenRetries || delay, delay);
2213
+ };
2214
+ return async () => {
2215
+ await sleep(calculateDelayInMs());
2216
+ timesCalled++;
2217
+ };
2218
+ };
2219
+ var retry = async (callback, options = {}) => {
2220
+ let iterations = 0;
2221
+ const { shouldRetry, initialDelay, maxDelayBetweenRetries, factor, retryImmediately, jitter, onBeforeRetry } = {
2222
+ ...defaultOptions,
2223
+ ...options
2224
+ };
2225
+ const delay = createExponentialDelayAsyncFn({
2226
+ initialDelay,
2227
+ maxDelayBetweenRetries,
2228
+ factor,
2229
+ jitter
2230
+ });
2231
+ while (true) try {
2232
+ return await callback();
2233
+ } catch (e) {
2234
+ iterations++;
2235
+ if (!shouldRetry(e, iterations)) throw e;
2236
+ if (onBeforeRetry) await onBeforeRetry(iterations);
2237
+ if (retryImmediately && iterations === 1) await sleep(applyJitter(RETRY_IMMEDIATELY_DELAY, jitter));
2238
+ else await delay();
2239
+ }
2240
+ };
2241
+
2242
+ // ../shared/dist/runtime/loadScript-DDWWb733.mjs
2243
+ var NO_DOCUMENT_ERROR = "loadScript cannot be called when document does not exist";
2244
+ var NO_SRC_ERROR = "loadScript cannot be called without a src";
2245
+ async function loadScript(src = "", opts) {
2246
+ const { async, defer, beforeLoad, crossOrigin, nonce } = opts || {};
2247
+ const load = () => {
2248
+ return new Promise((resolve, reject) => {
2249
+ if (!src) reject(new Error(NO_SRC_ERROR));
2250
+ if (!document || !document.body) reject(new Error(NO_DOCUMENT_ERROR));
2251
+ const script = document.createElement("script");
2252
+ if (crossOrigin) script.setAttribute("crossorigin", crossOrigin);
2253
+ script.async = async || false;
2254
+ script.defer = defer || false;
2255
+ script.addEventListener("load", () => {
2256
+ console.log("this loaded ", src);
2257
+ script.remove();
2258
+ resolve(script);
2259
+ });
2260
+ script.addEventListener("error", (event) => {
2261
+ var _a5;
2262
+ script.remove();
2263
+ reject((_a5 = event.error) != null ? _a5 : /* @__PURE__ */ new Error(`failed to load script: ${src}`));
2264
+ });
2265
+ script.src = src;
2266
+ script.nonce = nonce;
2267
+ beforeLoad == null ? void 0 : beforeLoad(script);
2268
+ document.body.appendChild(script);
2269
+ });
2270
+ };
2271
+ return retry(load, { shouldRetry: (_, iterations) => {
2272
+ console.log("nikos 3", _, iterations);
2273
+ return iterations <= 5;
2274
+ } });
2275
+ }
2276
+
2277
+ // ../shared/dist/runtime/proxy-C0HjCApu.mjs
2278
+ function isValidProxyUrl(key) {
2279
+ if (!key) return true;
2280
+ return isHttpOrHttps(key) || isProxyUrlRelative(key);
2281
+ }
2282
+ function isHttpOrHttps(key) {
2283
+ return /^http(s)?:\/\//.test(key || "");
2284
+ }
2285
+ function isProxyUrlRelative(key) {
2286
+ return key.startsWith("/");
2287
+ }
2288
+ function proxyUrlToAbsoluteURL(url) {
2289
+ if (!url) return "";
2290
+ return isProxyUrlRelative(url) ? new URL(url, window.location.origin).toString() : url;
2291
+ }
2292
+
2293
+ // ../shared/dist/runtime/url-DasDWsj9.mjs
2294
+ function addClerkPrefix(str) {
2295
+ if (!str) return "";
2296
+ let regex;
2297
+ if (str.match(/^(clerk\.)+\w*$/)) regex = /(clerk\.)*(?=clerk\.)/;
2298
+ else if (str.match(/\.clerk.accounts/)) return str;
2299
+ else regex = /^(clerk\.)*/gi;
2300
+ return `clerk.${str.replace(regex, "")}`;
2301
+ }
2302
+
2303
+ // ../shared/dist/runtime/loadClerkJsScript.mjs
2304
+ var { isDevOrStagingUrl } = createDevOrStagingUrlCache();
2161
2305
  var errorThrower2 = buildErrorThrower({ packageName: "@clerk/shared" });
2306
+ function isClerkGlobalProperlyLoaded(prop) {
2307
+ if (typeof window === "undefined" || !window[prop]) return false;
2308
+ return !!window[prop];
2309
+ }
2310
+ var isClerkUiProperlyLoaded = () => isClerkGlobalProperlyLoaded("__unstable_ClerkUiCtor");
2311
+ var loadClerkUiScript = async (opts) => {
2312
+ var _a5;
2313
+ const timeout = (_a5 = opts == null ? void 0 : opts.scriptLoadTimeout) != null ? _a5 : 15e3;
2314
+ const rejectWith = (error) => new ClerkRuntimeError("Failed to load Clerk UI" + ((error == null ? void 0 : error.message) ? `, ${error.message}` : ""), {
2315
+ code: "failed_to_load_clerk_ui",
2316
+ cause: error
2317
+ });
2318
+ if (isClerkUiProperlyLoaded()) return null;
2319
+ if (document.querySelector("script[data-clerk-ui-script]")) return waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());
2320
+ if (!(opts == null ? void 0 : opts.publishableKey)) {
2321
+ errorThrower2.throwMissingPublishableKeyError();
2322
+ return null;
2323
+ }
2324
+ const loadPromise = waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());
2325
+ loadScript(clerkUiScriptUrl(opts), {
2326
+ async: true,
2327
+ crossOrigin: "anonymous",
2328
+ nonce: opts.nonce,
2329
+ beforeLoad: applyAttributesToScript(buildClerkUiScriptAttributes(opts))
2330
+ }).catch((error) => {
2331
+ throw rejectWith(error);
2332
+ });
2333
+ return loadPromise;
2334
+ };
2335
+ var clerkUiScriptUrl = (opts) => {
2336
+ const { clerkUiUrl, proxyUrl, domain, publishableKey } = opts;
2337
+ if (clerkUiUrl) return clerkUiUrl;
2338
+ return `https://${buildScriptHost({
2339
+ publishableKey,
2340
+ proxyUrl,
2341
+ domain
2342
+ })}/npm/@clerk/ui@latest/dist/ui.browser.js`;
2343
+ };
2344
+ var buildClerkJsScriptAttributes = (options) => {
2345
+ const obj = {};
2346
+ if (options.publishableKey) obj["data-clerk-publishable-key"] = options.publishableKey;
2347
+ if (options.proxyUrl) obj["data-clerk-proxy-url"] = options.proxyUrl;
2348
+ if (options.domain) obj["data-clerk-domain"] = options.domain;
2349
+ if (options.nonce) obj.nonce = options.nonce;
2350
+ return obj;
2351
+ };
2352
+ var buildClerkUiScriptAttributes = (options) => {
2353
+ return buildClerkJsScriptAttributes(options);
2354
+ };
2355
+ var applyAttributesToScript = (attributes) => (script) => {
2356
+ for (const attribute in attributes) script.setAttribute(attribute, attributes[attribute]);
2357
+ };
2358
+ var buildScriptHost = (opts) => {
2359
+ var _a5, _b;
2360
+ const { proxyUrl, domain, publishableKey } = opts;
2361
+ if (!!proxyUrl && isValidProxyUrl(proxyUrl)) return proxyUrlToAbsoluteURL(proxyUrl).replace(/http(s)?:\/\//, "");
2362
+ else if (domain && !isDevOrStagingUrl(((_a5 = parsePublishableKey(publishableKey)) == null ? void 0 : _a5.frontendApi) || "")) return addClerkPrefix(domain);
2363
+ else return ((_b = parsePublishableKey(publishableKey)) == null ? void 0 : _b.frontendApi) || "";
2364
+ };
2365
+ function waitForPredicateWithTimeout(timeoutMs, predicate, rejectWith) {
2366
+ return new Promise((resolve, reject) => {
2367
+ let resolved = false;
2368
+ const cleanup = (timeoutId$1, pollInterval$1) => {
2369
+ clearTimeout(timeoutId$1);
2370
+ clearInterval(pollInterval$1);
2371
+ };
2372
+ const checkAndResolve = () => {
2373
+ if (resolved) return;
2374
+ if (predicate()) {
2375
+ resolved = true;
2376
+ cleanup(timeoutId, pollInterval);
2377
+ resolve(null);
2378
+ }
2379
+ };
2380
+ const handleTimeout = () => {
2381
+ if (resolved) return;
2382
+ resolved = true;
2383
+ cleanup(timeoutId, pollInterval);
2384
+ if (!predicate()) reject(rejectWith);
2385
+ else resolve(null);
2386
+ };
2387
+ const timeoutId = setTimeout(handleTimeout, timeoutMs);
2388
+ checkAndResolve();
2389
+ const pollInterval = setInterval(() => {
2390
+ if (resolved) {
2391
+ clearInterval(pollInterval);
2392
+ return;
2393
+ }
2394
+ checkAndResolve();
2395
+ }, 100);
2396
+ });
2397
+ }
2162
2398
  function setClerkJsLoadingErrorPackageName(packageName) {
2163
2399
  errorThrower2.setPackageName({ packageName });
2164
2400
  }
2165
2401
 
2166
- // ../shared/dist/runtime/deriveState-ChDqlleE.mjs
2402
+ // ../shared/dist/runtime/deriveState.mjs
2167
2403
  var deriveState = (clerkOperational, state, initialState) => {
2168
2404
  if (!clerkOperational && initialState) return deriveFromSsrInitialState(initialState);
2169
2405
  return deriveFromClientSideState(state);
@@ -2222,12 +2458,12 @@ var deriveFromClientSideState = (state) => {
2222
2458
  };
2223
2459
  };
2224
2460
 
2225
- // ../shared/dist/runtime/browser-D5e8obql.mjs
2461
+ // ../shared/dist/runtime/browser-DursrJlr.mjs
2226
2462
  function inBrowser() {
2227
2463
  return typeof window !== "undefined";
2228
2464
  }
2229
2465
 
2230
- // ../shared/dist/runtime/eventBus-UpdW-1JB.mjs
2466
+ // ../shared/dist/runtime/eventBus-TFTcHo0F.mjs
2231
2467
  var _on = (eventToHandlersMap, latestPayloadMap, event, handler, opts) => {
2232
2468
  const { notify } = opts || {};
2233
2469
  let handlers = eventToHandlersMap.get(event);
@@ -2436,6 +2672,9 @@ var StateProxy = class {
2436
2672
  signUpSignal() {
2437
2673
  return this.signUpSignalProxy;
2438
2674
  }
2675
+ checkoutSignal(params) {
2676
+ return this.buildCheckoutProxy(params);
2677
+ }
2439
2678
  buildSignInProxy() {
2440
2679
  const gateProperty = this.gateProperty.bind(this);
2441
2680
  const target = () => this.client.signIn.__internal_future;
@@ -2506,6 +2745,9 @@ var StateProxy = class {
2506
2745
  }
2507
2746
  });
2508
2747
  },
2748
+ get hasBeenFinalized() {
2749
+ return gateProperty(target, "hasBeenFinalized", false);
2750
+ },
2509
2751
  create: this.gateMethod(target, "create"),
2510
2752
  password: this.gateMethod(target, "password"),
2511
2753
  sso: this.gateMethod(target, "sso"),
@@ -2604,6 +2846,9 @@ var StateProxy = class {
2604
2846
  get isTransferable() {
2605
2847
  return gateProperty(target, "isTransferable", false);
2606
2848
  },
2849
+ get hasBeenFinalized() {
2850
+ return gateProperty(target, "hasBeenFinalized", false);
2851
+ },
2607
2852
  create: gateMethod(target, "create"),
2608
2853
  update: gateMethod(target, "update"),
2609
2854
  sso: gateMethod(target, "sso"),
@@ -2620,6 +2865,59 @@ var StateProxy = class {
2620
2865
  }
2621
2866
  };
2622
2867
  }
2868
+ buildCheckoutProxy(params) {
2869
+ const gateProperty = this.gateProperty.bind(this);
2870
+ const targetCheckout = () => this.checkout(params);
2871
+ const target = () => targetCheckout().checkout;
2872
+ return {
2873
+ errors: {
2874
+ raw: null,
2875
+ global: null
2876
+ },
2877
+ fetchStatus: "idle",
2878
+ checkout: {
2879
+ get status() {
2880
+ return gateProperty(target, "status", "needs_initialization");
2881
+ },
2882
+ get externalClientSecret() {
2883
+ return gateProperty(target, "externalClientSecret", null);
2884
+ },
2885
+ get externalGatewayId() {
2886
+ return gateProperty(target, "externalGatewayId", null);
2887
+ },
2888
+ get paymentMethod() {
2889
+ return gateProperty(target, "paymentMethod", null);
2890
+ },
2891
+ get plan() {
2892
+ return gateProperty(target, "plan", null);
2893
+ },
2894
+ get planPeriod() {
2895
+ return gateProperty(target, "planPeriod", null);
2896
+ },
2897
+ get totals() {
2898
+ return gateProperty(target, "totals", null);
2899
+ },
2900
+ get isImmediatePlanChange() {
2901
+ return gateProperty(target, "isImmediatePlanChange", false);
2902
+ },
2903
+ get freeTrialEndsAt() {
2904
+ return gateProperty(target, "freeTrialEndsAt", null);
2905
+ },
2906
+ get payer() {
2907
+ return gateProperty(target, "payer", null);
2908
+ },
2909
+ get planPeriodStart() {
2910
+ return gateProperty(target, "planPeriodStart", null);
2911
+ },
2912
+ get needsPaymentMethod() {
2913
+ return gateProperty(target, "needsPaymentMethod", null);
2914
+ },
2915
+ start: this.gateMethod(target, "start"),
2916
+ confirm: this.gateMethod(target, "confirm"),
2917
+ finalize: this.gateMethod(target, "finalize")
2918
+ }
2919
+ };
2920
+ }
2623
2921
  __internal_effect(_) {
2624
2922
  throw new Error("__internal_effect called before Clerk is loaded");
2625
2923
  }
@@ -2633,6 +2931,13 @@ var StateProxy = class {
2633
2931
  }
2634
2932
  return c;
2635
2933
  }
2934
+ get checkout() {
2935
+ const c = this.isomorphicClerk.__experimental_checkout;
2936
+ if (!c) {
2937
+ throw new Error("Clerk checkout not ready");
2938
+ }
2939
+ return c;
2940
+ }
2636
2941
  gateProperty(getTarget, key, defaultValue) {
2637
2942
  return (() => {
2638
2943
  if (!inBrowser() || !this.isomorphicClerk.loaded) {
@@ -2675,8 +2980,8 @@ if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") {
2675
2980
  globalThis.__BUILD_DISABLE_RHC__ = false;
2676
2981
  }
2677
2982
  var SDK_METADATA = {
2678
- name: "@clerk/clerk-react",
2679
- version: "5.56.3-canary.v20251124102636",
2983
+ name: "@clerk/react",
2984
+ version: "6.0.0-canary-core3.v20251124105058",
2680
2985
  environment: process.env.NODE_ENV
2681
2986
  };
2682
2987
  var _status;
@@ -2911,7 +3216,7 @@ var _IsomorphicClerk = class _IsomorphicClerk2 {
2911
3216
  throw new Error("Failed to hydrate latest Clerk JS");
2912
3217
  }
2913
3218
  };
2914
- this.hydrateClerkJS = (clerkjs) => {
3219
+ this.replayInterceptedInvocations = (clerkjs) => {
2915
3220
  var _a5, _b;
2916
3221
  if (!clerkjs) {
2917
3222
  throw new Error("Failed to hydrate latest Clerk JS");
@@ -3000,8 +3305,7 @@ var _IsomorphicClerk = class _IsomorphicClerk2 {
3000
3305
  return this.clerkjs;
3001
3306
  };
3002
3307
  this.__experimental_checkout = (...args) => {
3003
- var _a5;
3004
- return (_a5 = this.clerkjs) == null ? void 0 : _a5.__experimental_checkout(...args);
3308
+ return this.loaded && this.clerkjs ? this.clerkjs.__experimental_checkout(...args) : __privateGet2(this, _stateProxy).checkoutSignal(...args);
3005
3309
  };
3006
3310
  this.__unstable__updateProps = async (props) => {
3007
3311
  const clerkjs = await __privateMethod2(this, _IsomorphicClerk_instances, waitForClerkJS_fn).call(this);
@@ -3677,12 +3981,11 @@ var _IsomorphicClerk = class _IsomorphicClerk2 {
3677
3981
  this.premountMethodCalls.set("signOut", callback);
3678
3982
  }
3679
3983
  };
3680
- const { Clerk: Clerk2 = null, publishableKey } = options || {};
3681
- __privateSet2(this, _publishableKey, publishableKey);
3984
+ __privateSet2(this, _publishableKey, options == null ? void 0 : options.publishableKey);
3682
3985
  __privateSet2(this, _proxyUrl, options == null ? void 0 : options.proxyUrl);
3683
3986
  __privateSet2(this, _domain, options == null ? void 0 : options.domain);
3684
3987
  this.options = options;
3685
- this.Clerk = Clerk2;
3988
+ this.Clerk = (options == null ? void 0 : options.Clerk) || null;
3686
3989
  this.mode = inBrowser() ? "browser" : "server";
3687
3990
  __privateSet2(this, _stateProxy, new StateProxy(this));
3688
3991
  if (!this.options.sdkMetadata) {
@@ -3691,7 +3994,7 @@ var _IsomorphicClerk = class _IsomorphicClerk2 {
3691
3994
  __privateGet2(this, _eventBus).emit(clerkEvents.Status, "loading");
3692
3995
  __privateGet2(this, _eventBus).prioritizedOn(clerkEvents.Status, (status) => __privateSet2(this, _status, status));
3693
3996
  if (__privateGet2(this, _publishableKey)) {
3694
- void this.loadClerkJS();
3997
+ void this.getEntryChunks();
3695
3998
  }
3696
3999
  }
3697
4000
  get publishableKey() {
@@ -3780,8 +4083,7 @@ var _IsomorphicClerk = class _IsomorphicClerk2 {
3780
4083
  }
3781
4084
  return false;
3782
4085
  }
3783
- async loadClerkJS() {
3784
- var _a5;
4086
+ async getEntryChunks() {
3785
4087
  if (this.mode !== "browser" || this.loaded) {
3786
4088
  return;
3787
4089
  }
@@ -3791,28 +4093,15 @@ var _IsomorphicClerk = class _IsomorphicClerk2 {
3791
4093
  window.__clerk_domain = this.domain;
3792
4094
  }
3793
4095
  try {
3794
- if (this.Clerk) {
3795
- let c;
3796
- if (isConstructor(this.Clerk)) {
3797
- c = new this.Clerk(__privateGet2(this, _publishableKey), {
3798
- proxyUrl: this.proxyUrl,
3799
- domain: this.domain
3800
- });
3801
- this.beforeLoad(c);
3802
- await c.load(this.options);
3803
- } else {
3804
- c = this.Clerk;
3805
- if (!c.loaded) {
3806
- this.beforeLoad(c);
3807
- await c.load(this.options);
3808
- }
3809
- }
3810
- global.Clerk = c;
3811
- } else if (false) ;
3812
- if ((_a5 = global.Clerk) == null ? void 0 : _a5.loaded) {
3813
- return this.hydrateClerkJS(global.Clerk);
4096
+ const clerkUiCtor = this.getClerkUiEntryChunk();
4097
+ const clerk2 = await this.getClerkJsEntryChunk();
4098
+ if (!clerk2.loaded) {
4099
+ this.beforeLoad(clerk2);
4100
+ await clerk2.load({ ...this.options, clerkUiCtor });
4101
+ }
4102
+ if (clerk2.loaded) {
4103
+ this.replayInterceptedInvocations(clerk2);
3814
4104
  }
3815
- return;
3816
4105
  } catch (err) {
3817
4106
  const error = err;
3818
4107
  __privateGet2(this, _eventBus).emit(clerkEvents.Status, "error");
@@ -3820,6 +4109,32 @@ var _IsomorphicClerk = class _IsomorphicClerk2 {
3820
4109
  return;
3821
4110
  }
3822
4111
  }
4112
+ async getClerkJsEntryChunk() {
4113
+ if (!this.options.Clerk && false) ;
4114
+ if (this.options.Clerk) {
4115
+ global.Clerk = isConstructor(this.options.Clerk) ? new this.options.Clerk(__privateGet2(this, _publishableKey), { proxyUrl: this.proxyUrl, domain: this.domain }) : this.options.Clerk;
4116
+ }
4117
+ if (!global.Clerk) {
4118
+ throw new Error("Failed to download latest ClerkJS. Contact support@clerk.com.");
4119
+ }
4120
+ return global.Clerk;
4121
+ }
4122
+ async getClerkUiEntryChunk() {
4123
+ if (this.options.clerkUiCtor) {
4124
+ return this.options.clerkUiCtor;
4125
+ }
4126
+ await loadClerkUiScript({
4127
+ ...this.options,
4128
+ publishableKey: __privateGet2(this, _publishableKey),
4129
+ proxyUrl: this.proxyUrl,
4130
+ domain: this.domain,
4131
+ nonce: this.options.nonce
4132
+ });
4133
+ if (!global.__unstable_ClerkUiCtor) {
4134
+ throw new Error("Failed to download latest Clerk UI. Contact support@clerk.com.");
4135
+ }
4136
+ return global.__unstable_ClerkUiCtor;
4137
+ }
3823
4138
  get version() {
3824
4139
  var _a5;
3825
4140
  return (_a5 = this.clerkjs) == null ? void 0 : _a5.version;
@@ -4018,10 +4333,10 @@ function ClerkProviderBase(props) {
4018
4333
  }
4019
4334
  var ClerkProvider = withMaxAllowedInstancesGuard(ClerkProviderBase, "ClerkProvider", multipleClerkProvidersError);
4020
4335
  ClerkProvider.displayName = "ClerkProvider";
4021
- setErrorThrowerOptions({ packageName: "@clerk/clerk-react" });
4022
- setClerkJsLoadingErrorPackageName("@clerk/clerk-react");
4336
+ setErrorThrowerOptions({ packageName: "@clerk/react" });
4337
+ setClerkJsLoadingErrorPackageName("@clerk/react");
4023
4338
 
4024
- // ../shared/dist/runtime/devBrowser-Dm-lbUnV.mjs
4339
+ // ../shared/dist/runtime/devBrowser.mjs
4025
4340
  var DEV_BROWSER_JWT_KEY = "__clerk_db_jwt";
4026
4341
 
4027
4342
  // src/types.ts
@@ -4220,9 +4535,9 @@ var BrowserStorageCache = createBrowserStorageCache();
4220
4535
  var clerk;
4221
4536
  noRhc.Clerk.sdkMetadata = {
4222
4537
  name: "@clerk/chrome-extension",
4223
- version: "2.8.5-canary.v20251124102636"
4538
+ version: "3.0.0-canary-core3.v20251124105058"
4224
4539
  };
4225
- async function createClerkClient({
4540
+ function createClerkClient({
4226
4541
  __experimental_syncHostListener = false,
4227
4542
  publishableKey,
4228
4543
  scope,
@@ -4245,7 +4560,7 @@ async function createClerkClient({
4245
4560
  sync
4246
4561
  });
4247
4562
  const url = syncHost ? syncHost : DEFAULT_LOCAL_HOST_PERMISSION;
4248
- clerk = new noRhc.Clerk(publishableKey);
4563
+ clerk = new noRhc.Clerk(publishableKey, {});
4249
4564
  const jwtOptions = {
4250
4565
  frontendApi: key.frontendApi,
4251
4566
  name: isProd ? CLIENT_JWT_KEY : DEV_BROWSER_JWT_KEY,
@@ -4275,11 +4590,7 @@ function ClerkProvider2(props) {
4275
4590
  const { publishableKey = "" } = props;
4276
4591
  const [clerkInstance, setClerkInstance] = React7__default.default.useState(null);
4277
4592
  React7__default.default.useEffect(() => {
4278
- void (async () => {
4279
- setClerkInstance(
4280
- await createClerkClient({ publishableKey, storageCache, syncHost, __experimental_syncHostListener })
4281
- );
4282
- })();
4593
+ setClerkInstance(createClerkClient({ publishableKey, storageCache, syncHost, __experimental_syncHostListener }));
4283
4594
  }, [publishableKey, storageCache, syncHost, __experimental_syncHostListener]);
4284
4595
  if (!clerkInstance) {
4285
4596
  return null;
@@ -4289,6 +4600,7 @@ function ClerkProvider2(props) {
4289
4600
  {
4290
4601
  ...rest,
4291
4602
  Clerk: clerkInstance,
4603
+ clerkUiCtor: entry.ClerkUi,
4292
4604
  standardBrowser: !syncHost,
4293
4605
  children
4294
4606
  }