@clerk/chrome-extension 3.0.0-canary-core3.v20251205142050 → 3.0.0-canary-core3.v20251207215551

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.
@@ -429,7 +429,7 @@ var BrowserStorageCache = createBrowserStorageCache();
429
429
  var clerk;
430
430
  noRhc.Clerk.sdkMetadata = {
431
431
  name: "@clerk/chrome-extension",
432
- version: "3.0.0-canary-core3.v20251205142050"
432
+ version: "3.0.0-canary-core3.v20251207215551"
433
433
  };
434
434
  function createClerkClient({
435
435
  __experimental_syncHostListener = false,
package/dist/cjs/index.js CHANGED
@@ -4016,7 +4016,7 @@ var retry = async (callback, options = {}) => {
4016
4016
  }
4017
4017
  };
4018
4018
 
4019
- // ../shared/dist/runtime/loadScript-DDWWb733.mjs
4019
+ // ../shared/dist/runtime/loadScript-CHWOPTAN.mjs
4020
4020
  var NO_DOCUMENT_ERROR = "loadScript cannot be called when document does not exist";
4021
4021
  var NO_SRC_ERROR = "loadScript cannot be called without a src";
4022
4022
  async function loadScript(src = "", opts) {
@@ -4030,7 +4030,6 @@ async function loadScript(src = "", opts) {
4030
4030
  script.async = async || false;
4031
4031
  script.defer = defer || false;
4032
4032
  script.addEventListener("load", () => {
4033
- console.log("this loaded ", src);
4034
4033
  script.remove();
4035
4034
  resolve(script);
4036
4035
  });
@@ -4046,7 +4045,6 @@ async function loadScript(src = "", opts) {
4046
4045
  });
4047
4046
  };
4048
4047
  return retry(load, { shouldRetry: (_, iterations) => {
4049
- console.log("nikos 3", _, iterations);
4050
4048
  return iterations <= 5;
4051
4049
  } });
4052
4050
  }
@@ -4077,12 +4075,12 @@ function addClerkPrefix(str) {
4077
4075
  return `clerk.${str.replace(regex, "")}`;
4078
4076
  }
4079
4077
 
4080
- // ../shared/dist/runtime/versionSelector-BxWn31ih.mjs
4081
- var versionSelector = (clerkJSVersion, packageVersion = "6.0.0-canary-core3.v20251205142050") => {
4078
+ // ../shared/dist/runtime/versionSelector-C__XHXrq.mjs
4079
+ var versionSelector = (clerkJSVersion, packageVersion = "6.0.0-canary-core3.v20251207215551") => {
4082
4080
  if (clerkJSVersion) return clerkJSVersion;
4083
4081
  const prereleaseTag = getPrereleaseTag(packageVersion);
4084
4082
  if (prereleaseTag) {
4085
- if (prereleaseTag === "snapshot") return "6.0.0-canary-core3.v20251205142050";
4083
+ if (prereleaseTag === "snapshot") return "6.0.0-canary-core3.v20251207215551";
4086
4084
  return prereleaseTag;
4087
4085
  }
4088
4086
  return getMajorVersion(packageVersion);
@@ -4101,6 +4099,21 @@ function isClerkGlobalProperlyLoaded(prop) {
4101
4099
  return !!window[prop];
4102
4100
  }
4103
4101
  var isClerkUiProperlyLoaded = () => isClerkGlobalProperlyLoaded("__internal_ClerkUiCtor");
4102
+ function hasScriptRequestError(scriptUrl) {
4103
+ if (typeof window === "undefined" || !window.performance) return false;
4104
+ const entries = performance.getEntriesByName(scriptUrl, "resource");
4105
+ if (entries.length === 0) return false;
4106
+ const scriptEntry = entries[entries.length - 1];
4107
+ if (scriptEntry.transferSize === 0 && scriptEntry.decodedBodySize === 0) {
4108
+ if (scriptEntry.responseEnd === 0) return true;
4109
+ if (scriptEntry.responseEnd > 0 && scriptEntry.responseStart > 0) return true;
4110
+ if ("responseStatus" in scriptEntry) {
4111
+ if (scriptEntry.responseStatus >= 400) return true;
4112
+ if (scriptEntry.responseStatus === 0) return true;
4113
+ }
4114
+ }
4115
+ return false;
4116
+ }
4104
4117
  var loadClerkUiScript = async (opts) => {
4105
4118
  var _a5;
4106
4119
  const timeout = (_a5 = opts == null ? void 0 : opts.scriptLoadTimeout) != null ? _a5 : 15e3;
@@ -4109,13 +4122,21 @@ var loadClerkUiScript = async (opts) => {
4109
4122
  cause: error
4110
4123
  });
4111
4124
  if (isClerkUiProperlyLoaded()) return null;
4112
- if (document.querySelector("script[data-clerk-ui-script]")) return waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());
4113
4125
  if (!(opts == null ? void 0 : opts.publishableKey)) {
4114
4126
  errorThrower2.throwMissingPublishableKeyError();
4115
4127
  return null;
4116
4128
  }
4129
+ const scriptUrl = clerkUiScriptUrl(opts);
4130
+ const existingScript = document.querySelector("script[data-clerk-ui-script]");
4131
+ if (existingScript) if (hasScriptRequestError(scriptUrl)) existingScript.remove();
4132
+ else try {
4133
+ await waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith(), existingScript);
4134
+ return null;
4135
+ } catch {
4136
+ existingScript.remove();
4137
+ }
4117
4138
  const loadPromise = waitForPredicateWithTimeout(timeout, isClerkUiProperlyLoaded, rejectWith());
4118
- loadScript(clerkUiScriptUrl(opts), {
4139
+ loadScript(scriptUrl, {
4119
4140
  async: true,
4120
4141
  crossOrigin: "anonymous",
4121
4142
  nonce: opts.nonce,
@@ -4155,13 +4176,17 @@ var buildScriptHost = (opts) => {
4155
4176
  else if (domain && !isDevOrStagingUrl(((_a5 = parsePublishableKey(publishableKey)) == null ? void 0 : _a5.frontendApi) || "")) return addClerkPrefix(domain);
4156
4177
  else return ((_b = parsePublishableKey(publishableKey)) == null ? void 0 : _b.frontendApi) || "";
4157
4178
  };
4158
- function waitForPredicateWithTimeout(timeoutMs, predicate, rejectWith) {
4179
+ function waitForPredicateWithTimeout(timeoutMs, predicate, rejectWith, existingScript) {
4159
4180
  return new Promise((resolve, reject) => {
4160
4181
  let resolved = false;
4161
4182
  const cleanup = (timeoutId$1, pollInterval$1) => {
4162
4183
  clearTimeout(timeoutId$1);
4163
4184
  clearInterval(pollInterval$1);
4164
4185
  };
4186
+ existingScript == null ? void 0 : existingScript.addEventListener("error", () => {
4187
+ cleanup(timeoutId, pollInterval);
4188
+ reject(rejectWith);
4189
+ });
4165
4190
  const checkAndResolve = () => {
4166
4191
  if (resolved) return;
4167
4192
  if (predicate()) {
@@ -4774,7 +4799,7 @@ if (typeof globalThis.__BUILD_DISABLE_RHC__ === "undefined") {
4774
4799
  }
4775
4800
  var SDK_METADATA = {
4776
4801
  name: "@clerk/react",
4777
- version: "6.0.0-canary-core3.v20251205142050",
4802
+ version: "6.0.0-canary-core3.v20251207215551",
4778
4803
  environment: process.env.NODE_ENV
4779
4804
  };
4780
4805
  var _status;
@@ -6353,7 +6378,7 @@ var BrowserStorageCache = createBrowserStorageCache();
6353
6378
  var clerk;
6354
6379
  noRhc.Clerk.sdkMetadata = {
6355
6380
  name: "@clerk/chrome-extension",
6356
- version: "3.0.0-canary-core3.v20251205142050"
6381
+ version: "3.0.0-canary-core3.v20251207215551"
6357
6382
  };
6358
6383
  function createClerkClient({
6359
6384
  __experimental_syncHostListener = false,