@connect-xyz/auth-js 1.67.5 → 1.69.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -54,8 +54,8 @@ declare class Auth extends BaseJsSdk<AuthConfig> {
54
54
  readonly WEB_COMPONENT_NOT_DEFINED: "Web component is not defined. Script may not be loaded.";
55
55
  };
56
56
  protected scriptUrls: {
57
- sandbox: string;
58
- production: string;
57
+ readonly sandbox: "https://sdk.sandbox.connect.xyz/auth-web/index.js";
58
+ readonly production: "https://sdk.connect.xyz/auth-web/index.js";
59
59
  };
60
60
  protected webComponentTag: string;
61
61
  /**
@@ -111,7 +111,8 @@ declare type AuthEventType = 'deposit.submitted';
111
111
  */
112
112
  declare interface BaseConfig<TEvent = AppEvent> extends CommonCallbacks<TEvent> {
113
113
  /**
114
- * JWT token used for authentication
114
+ * JWT token used for authentication. Provide/update it via `setJWT`
115
+ * (`updateConfig({ jwt })`).
115
116
  */
116
117
  jwt: string;
117
118
 
@@ -206,7 +207,11 @@ declare abstract class BaseJsSdk<Config extends BaseConfig<never> = BaseConfig>
206
207
  }
207
208
 
208
209
  /**
209
- * Update the configuration of the widget
210
+ * Update the configuration of the widget (e.g. `theme`, or the `jwt`).
211
+ *
212
+ * Passing a `jwt` is the JS-SDK equivalent of `setJWT` — it provides the JWT
213
+ * used to authenticate.
214
+ *
210
215
  * @param config - Partial configuration to update
211
216
  * @returns void
212
217
  */
package/dist/index.js CHANGED
@@ -21,7 +21,7 @@ const C = "production", z = "JWT token is required and must be a string.", M = {
21
21
  } catch {
22
22
  return null;
23
23
  }
24
- }, O = (e, t) => W(t) !== "eu" ? e : e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e, P = (e) => {
24
+ }, S = (e, t) => W(t) !== "eu" ? e : e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e, P = (e) => {
25
25
  if (!e || typeof e != "string")
26
26
  return {};
27
27
  const t = e.split(".");
@@ -39,10 +39,10 @@ const C = "production", z = "JWT token is required and must be a string.", M = {
39
39
  return {};
40
40
  }
41
41
  }, T = (e, t, r) => {
42
- const n = O(t, r);
42
+ const n = S(t, r);
43
43
  return e[n] ?? e[t] ?? e.prod;
44
44
  }, U = (e, t, r) => {
45
- const n = O(t, r);
45
+ const n = S(t, r);
46
46
  return e[n] ?? e[t];
47
47
  }, _ = () => {
48
48
  }, F = () => {
@@ -89,7 +89,7 @@ const C = "production", z = "JWT token is required and must be a string.", M = {
89
89
  } catch {
90
90
  }
91
91
  }, B = (e) => {
92
- const { webComponentTag: t, appName: r, appVersion: n, scriptUrls: o, fallbackScriptUrls: a, collectorUrls: c, env: s, jwt: d, timeoutMs: S = 15e3, onLoad: L, onError: I } = e;
92
+ const { webComponentTag: t, appName: r, appVersion: n, scriptUrls: o, fallbackScriptUrls: a, collectorUrls: c, env: s, jwt: d, timeoutMs: L = 15e3, onLoad: O, onError: I } = e;
93
93
  if (typeof document > "u")
94
94
  return _;
95
95
  const m = `${t}-script-${s}`;
@@ -124,9 +124,9 @@ const C = "production", z = "JWT token is required and must be a string.", M = {
124
124
  const i = document.createElement("script");
125
125
  i.id = m, i.src = l, i.type = "module", i.async = !0, i.onload = () => {
126
126
  setTimeout(() => {
127
- u || (customElements.get(t) ? (u = !0, h(), L?.()) : g("not-defined", l, p));
127
+ u || (customElements.get(t) ? (u = !0, h(), O?.()) : g("not-defined", l, p));
128
128
  }, 0);
129
- }, i.onerror = () => g("network", l, p), f = setTimeout(() => g("timeout", l, p), S), document.getElementById(m)?.remove(), document.head.appendChild(i);
129
+ }, i.onerror = () => g("network", l, p), f = setTimeout(() => g("timeout", l, p), L), document.getElementById(m)?.remove(), document.head.appendChild(i);
130
130
  }, b = T(o, s, d);
131
131
  return b ? (R(b, !1), () => {
132
132
  u = !0, h();
@@ -169,7 +169,11 @@ class j {
169
169
  }
170
170
  }
171
171
  /**
172
- * Update the configuration of the widget
172
+ * Update the configuration of the widget (e.g. `theme`, or the `jwt`).
173
+ *
174
+ * Passing a `jwt` is the JS-SDK equivalent of `setJWT` — it provides the JWT
175
+ * used to authenticate.
176
+ *
173
177
  * @param config - Partial configuration to update
174
178
  * @returns void
175
179
  */
@@ -277,7 +281,11 @@ var N;
277
281
  (function(e) {
278
282
  e.NETWORK_ERROR = "network_error", e.AUTH_ERROR = "auth_error", e.NOT_FOUND_ERROR = "not_found_error", e.VALIDATION_ERROR = "validation_error", e.SERVER_ERROR = "server_error", e.CLIENT_ERROR = "client_error", e.UNKNOWN_ERROR = "unknown_error";
279
283
  })(N || (N = {}));
280
- class V extends j {
284
+ const V = {
285
+ sandbox: "https://sdk.sandbox.connect.xyz/auth-web/index.js",
286
+ production: "https://sdk.connect.xyz/auth-web/index.js"
287
+ };
288
+ class $ extends j {
281
289
  errorMessages = {
282
290
  ALREADY_RENDERED: "Auth widget is already rendered. Call destroy() before rendering again.",
283
291
  NOT_RENDERED: "Auth widget is not rendered. Call render() first.",
@@ -285,10 +293,8 @@ class V extends j {
285
293
  SCRIPT_LOAD_FAILED: "Failed to load the Connect Auth script.",
286
294
  WEB_COMPONENT_NOT_DEFINED: "Web component is not defined. Script may not be loaded."
287
295
  };
288
- scriptUrls = {
289
- sandbox: "https://sdk.sandbox.connect.xyz/auth-web/index.js",
290
- production: "https://sdk.connect.xyz/auth-web/index.js"
291
- };
296
+ // protected override scriptUrls = EFFECTIVE_SCRIPT_URLS;
297
+ scriptUrls = V;
292
298
  webComponentTag = "connect-auth";
293
299
  /**
294
300
  * Render the Auth widget to a container element
@@ -327,7 +333,7 @@ class V extends j {
327
333
  }
328
334
  }
329
335
  export {
330
- V as Auth,
336
+ $ as Auth,
331
337
  N as ErrorCode,
332
- V as default
338
+ $ as default
333
339
  };
@@ -1 +1 @@
1
- (function(s,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(s=typeof globalThis<"u"?globalThis:s||self,u(s.Auth={}))})(this,(function(s){"use strict";const u="production",L="JWT token is required and must be a string.",I={dev:"https://grafana-faro-collector.dev.0hash.com/collect",cert:"https://grafana-faro-collector.cert.zerohash.com/collect",prod:"https://grafana-faro-collector.zerohash.com/collect","eu-cert":"https://grafana-faro-collector.cert.zerohash.eu/collect","eu-prod":"https://grafana-faro-collector.zerohash.eu/collect",sandbox:"https://grafana-faro-collector.cert.zerohash.com/collect",production:"https://grafana-faro-collector.zerohash.com/collect"},v=e=>{if(!e||typeof e!="string")return null;const t=e.split(".");if(t.length<2)return null;try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),d=JSON.parse(o)?.payload?.region;if(typeof d!="string")return null;const i=d.toLowerCase();return i==="us"||i==="eu"?i:null}catch{return null}},R=(e,t)=>v(t)!=="eu"?e:e==="cert"?"eu-cert":e==="prod"?"eu-prod":e,A=e=>{if(!e||typeof e!="string")return{};const t=e.split(".");if(t.length<2)return{};try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),c=JSON.parse(o),d=c?.payload??{},i=l=>typeof l=="string"&&l.length>0?l:void 0;return{participantCode:i(d.participant_code),platformName:i(d.platform_name),platformCode:i(c.platform_code),region:i(d.region)}}catch{return{}}},y=(e,t,r)=>{const n=R(t,r);return e[n]??e[t]??e.prod},D=(e,t,r)=>{const n=R(t,r);return e[n]??e[t]},E=()=>{},M=()=>{const e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")},z=(e,t)=>{const r=M(),n=globalThis.__ZH_WEB_SDK_VERSION__,o={};e.claims.participantCode&&(o.participant_code=e.claims.participantCode),e.claims.platformName&&(o.platform_name=e.claims.platformName),e.claims.platformCode&&(o.platform_code=e.claims.platformCode),e.claims.region&&(o.region=e.claims.region),n&&(o.zh_web_sdk_version=n);const c={meta:{app:{name:e.appName,version:t??"unknown",environment:e.env},session:{id:r,attributes:o},browser:typeof navigator<"u"?{userAgent:navigator.userAgent}:void 0,page:typeof window<"u"?{url:window.location.origin}:void 0},logs:[{message:`Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,level:"error",timestamp:new Date().toISOString(),context:{web_component:e.webComponentTag,script_url:e.scriptUrl,reason:e.reason,tried_fallback:String(e.triedFallback),elapsed_ms:String(e.elapsedMs)}}]};return{sessionId:r,payload:c}},W=(e,t,r)=>{if(!e||typeof fetch>"u")return;const{sessionId:n,payload:o}=z(t,r);try{fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-faro-session-id":n},body:JSON.stringify(o),keepalive:!0}).catch(()=>{})}catch{}},P=e=>{const{webComponentTag:t,appName:r,appVersion:n,scriptUrls:o,fallbackScriptUrls:c,collectorUrls:d,env:i,jwt:l,timeoutMs:F=15e3,onLoad:j,onError:k}=e;if(typeof document>"u")return E;const h=`${t}-script-${i}`;if(customElements.get(t)||document.getElementById(h))return E;const B=A(l),V=e.report??(p=>W(d&&D(d,i,l),p,n));let f=!1,T=0,_;const g=()=>{_!==void 0&&clearTimeout(_)},w=(p,m,a)=>{if(f)return;const $=Math.round(performance.now()-T),O={webComponentTag:t,appName:r,env:i,scriptUrl:m,reason:p,triedFallback:a,elapsedMs:$,claims:B};V(O);const b=a?void 0:y(c??{},i,l);if(b&&b!==m){N(b,!0);return}f=!0,g(),document.getElementById(h)?.remove(),k?.(O)},N=(p,m)=>{g(),T=performance.now();const a=document.createElement("script");a.id=h,a.src=p,a.type="module",a.async=!0,a.onload=()=>{setTimeout(()=>{f||(customElements.get(t)?(f=!0,g(),j?.()):w("not-defined",p,m))},0)},a.onerror=()=>w("network",p,m),_=setTimeout(()=>w("timeout",p,m),F),document.getElementById(h)?.remove(),document.head.appendChild(a)},S=y(o,i,l);return S?(N(S,!1),()=>{f=!0,g()}):E};class U{config;state;scriptLoadingPromise;constructor(t){if(!t.jwt||typeof t.jwt!="string")throw new Error(L);this.config={...t,env:t.env||u,theme:t.theme},this.state={initialized:!1,scriptLoaded:!1,container:null,element:null}}async render(t){if(!t||!(t instanceof HTMLElement))throw new Error(this.errorMessages.INVALID_CONTAINER);if(this.state.initialized)throw new Error(this.errorMessages.ALREADY_RENDERED);try{await this.ensureScriptLoaded();const r=this.createWebComponent();t.innerHTML="",t.appendChild(r),this.state.container=t,this.state.element=r,this.state.initialized=!0}catch(r){throw console.error("Failed to render widget:",r),r}}updateConfig(t){if(!this.state.initialized||!this.state.element)throw new Error(this.errorMessages.NOT_RENDERED);const r=this.state.element;Object.entries(t).forEach(([n,o])=>{o&&(this.config[n]=o,r[n]=o)})}destroy(){this.state.initialized&&(this.state.element&&this.state.element.parentNode&&this.state.element.parentNode.removeChild(this.state.element),this.state.container&&(this.state.container.innerHTML=""),this.state.container=null,this.state.element=null,this.state.initialized=!1)}isRendered(){return this.state.initialized}getConfig(){return{...this.config}}getEnvironment(){return this.config.env||u}getScriptId(){return`${this.webComponentTag}-script-${this.getEnvironment()}`}isScriptLoaded(){return!!document.getElementById(this.getScriptId())}getWebComponent(){return customElements.get(this.webComponentTag)}getEffectiveScriptUrls(){return this.scriptUrls}async loadScript(){if(!(this.getWebComponent()||this.isScriptLoaded())){if(this.scriptLoadingPromise)return this.scriptLoadingPromise;this.scriptLoadingPromise=new Promise((t,r)=>{P({webComponentTag:this.webComponentTag,appName:this.webComponentTag,scriptUrls:this.getEffectiveScriptUrls(),collectorUrls:I,env:this.getEnvironment(),jwt:this.config.jwt,onLoad:t,onError:n=>{r(new Error(n.reason==="not-defined"?this.errorMessages.WEB_COMPONENT_NOT_DEFINED:`${this.errorMessages.SCRIPT_LOAD_FAILED} (${this.getEnvironment()})`))}})});try{await this.scriptLoadingPromise}catch(t){throw this.scriptLoadingPromise=void 0,t}return this.scriptLoadingPromise}}async waitForWebComponent(t=5e3){if(!this.getWebComponent())return new Promise((r,n)=>{const o=setTimeout(()=>{n(new Error(`Timeout waiting for ${this.webComponentTag} to be defined`))},t);customElements.whenDefined(this.webComponentTag).then(()=>{clearTimeout(o),r()}).catch(c=>{clearTimeout(o),n(c)})})}async ensureScriptLoaded(){if(!this.state.scriptLoaded)try{await this.loadScript(),await this.waitForWebComponent(),this.state.scriptLoaded=!0}catch(t){throw console.error("Failed to load Connect script:",t),t}}createWebComponent(){const t=document.createElement(this.webComponentTag);return Object.entries(this.config).forEach(([r,n])=>{n&&(t[r]=n)}),t}}s.ErrorCode=void 0,(function(e){e.NETWORK_ERROR="network_error",e.AUTH_ERROR="auth_error",e.NOT_FOUND_ERROR="not_found_error",e.VALIDATION_ERROR="validation_error",e.SERVER_ERROR="server_error",e.CLIENT_ERROR="client_error",e.UNKNOWN_ERROR="unknown_error"})(s.ErrorCode||(s.ErrorCode={}));class C extends U{errorMessages={ALREADY_RENDERED:"Auth widget is already rendered. Call destroy() before rendering again.",NOT_RENDERED:"Auth widget is not rendered. Call render() first.",INVALID_CONTAINER:"Invalid container element provided.",SCRIPT_LOAD_FAILED:"Failed to load the Connect Auth script.",WEB_COMPONENT_NOT_DEFINED:"Web component is not defined. Script may not be loaded."};scriptUrls={sandbox:"https://sdk.sandbox.connect.xyz/auth-web/index.js",production:"https://sdk.connect.xyz/auth-web/index.js"};webComponentTag="connect-auth";render(t){return super.render(t)}updateConfig(t){return super.updateConfig(t)}getConfig(){return super.getConfig()}isRendered(){return super.isRendered()}destroy(){return super.destroy()}}s.Auth=C,s.default=C,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(s,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(s=typeof globalThis<"u"?globalThis:s||self,u(s.Auth={}))})(this,(function(s){"use strict";const u="production",L="JWT token is required and must be a string.",I={dev:"https://grafana-faro-collector.dev.0hash.com/collect",cert:"https://grafana-faro-collector.cert.zerohash.com/collect",prod:"https://grafana-faro-collector.zerohash.com/collect","eu-cert":"https://grafana-faro-collector.cert.zerohash.eu/collect","eu-prod":"https://grafana-faro-collector.zerohash.eu/collect",sandbox:"https://grafana-faro-collector.cert.zerohash.com/collect",production:"https://grafana-faro-collector.zerohash.com/collect"},v=e=>{if(!e||typeof e!="string")return null;const t=e.split(".");if(t.length<2)return null;try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),d=JSON.parse(o)?.payload?.region;if(typeof d!="string")return null;const i=d.toLowerCase();return i==="us"||i==="eu"?i:null}catch{return null}},b=(e,t)=>v(t)!=="eu"?e:e==="cert"?"eu-cert":e==="prod"?"eu-prod":e,A=e=>{if(!e||typeof e!="string")return{};const t=e.split(".");if(t.length<2)return{};try{const r=t[1].replace(/-/g,"+").replace(/_/g,"/"),n=r+"===".slice(0,(4-r.length%4)%4),o=typeof atob<"u"?atob(n):Buffer.from(n,"base64").toString("utf-8"),c=JSON.parse(o),d=c?.payload??{},i=l=>typeof l=="string"&&l.length>0?l:void 0;return{participantCode:i(d.participant_code),platformName:i(d.platform_name),platformCode:i(c.platform_code),region:i(d.region)}}catch{return{}}},y=(e,t,r)=>{const n=b(t,r);return e[n]??e[t]??e.prod},D=(e,t,r)=>{const n=b(t,r);return e[n]??e[t]},E=()=>{},M=()=>{const e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,t=>t.toString(16).padStart(2,"0")).join("")},z=(e,t)=>{const r=M(),n=globalThis.__ZH_WEB_SDK_VERSION__,o={};e.claims.participantCode&&(o.participant_code=e.claims.participantCode),e.claims.platformName&&(o.platform_name=e.claims.platformName),e.claims.platformCode&&(o.platform_code=e.claims.platformCode),e.claims.region&&(o.region=e.claims.region),n&&(o.zh_web_sdk_version=n);const c={meta:{app:{name:e.appName,version:t??"unknown",environment:e.env},session:{id:r,attributes:o},browser:typeof navigator<"u"?{userAgent:navigator.userAgent}:void 0,page:typeof window<"u"?{url:window.location.origin}:void 0},logs:[{message:`Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,level:"error",timestamp:new Date().toISOString(),context:{web_component:e.webComponentTag,script_url:e.scriptUrl,reason:e.reason,tried_fallback:String(e.triedFallback),elapsed_ms:String(e.elapsedMs)}}]};return{sessionId:r,payload:c}},P=(e,t,r)=>{if(!e||typeof fetch>"u")return;const{sessionId:n,payload:o}=z(t,r);try{fetch(e,{method:"POST",headers:{"Content-Type":"application/json","x-faro-session-id":n},body:JSON.stringify(o),keepalive:!0}).catch(()=>{})}catch{}},W=e=>{const{webComponentTag:t,appName:r,appVersion:n,scriptUrls:o,fallbackScriptUrls:c,collectorUrls:d,env:i,jwt:l,timeoutMs:j=15e3,onLoad:k,onError:B}=e;if(typeof document>"u")return E;const h=`${t}-script-${i}`;if(customElements.get(t)||document.getElementById(h))return E;const V=A(l),$=e.report??(p=>P(d&&D(d,i,l),p,n));let f=!1,T=0,_;const g=()=>{_!==void 0&&clearTimeout(_)},w=(p,m,a)=>{if(f)return;const x=Math.round(performance.now()-T),O={webComponentTag:t,appName:r,env:i,scriptUrl:m,reason:p,triedFallback:a,elapsedMs:x,claims:V};$(O);const R=a?void 0:y(c??{},i,l);if(R&&R!==m){N(R,!0);return}f=!0,g(),document.getElementById(h)?.remove(),B?.(O)},N=(p,m)=>{g(),T=performance.now();const a=document.createElement("script");a.id=h,a.src=p,a.type="module",a.async=!0,a.onload=()=>{setTimeout(()=>{f||(customElements.get(t)?(f=!0,g(),k?.()):w("not-defined",p,m))},0)},a.onerror=()=>w("network",p,m),_=setTimeout(()=>w("timeout",p,m),j),document.getElementById(h)?.remove(),document.head.appendChild(a)},S=y(o,i,l);return S?(N(S,!1),()=>{f=!0,g()}):E};class U{config;state;scriptLoadingPromise;constructor(t){if(!t.jwt||typeof t.jwt!="string")throw new Error(L);this.config={...t,env:t.env||u,theme:t.theme},this.state={initialized:!1,scriptLoaded:!1,container:null,element:null}}async render(t){if(!t||!(t instanceof HTMLElement))throw new Error(this.errorMessages.INVALID_CONTAINER);if(this.state.initialized)throw new Error(this.errorMessages.ALREADY_RENDERED);try{await this.ensureScriptLoaded();const r=this.createWebComponent();t.innerHTML="",t.appendChild(r),this.state.container=t,this.state.element=r,this.state.initialized=!0}catch(r){throw console.error("Failed to render widget:",r),r}}updateConfig(t){if(!this.state.initialized||!this.state.element)throw new Error(this.errorMessages.NOT_RENDERED);const r=this.state.element;Object.entries(t).forEach(([n,o])=>{o&&(this.config[n]=o,r[n]=o)})}destroy(){this.state.initialized&&(this.state.element&&this.state.element.parentNode&&this.state.element.parentNode.removeChild(this.state.element),this.state.container&&(this.state.container.innerHTML=""),this.state.container=null,this.state.element=null,this.state.initialized=!1)}isRendered(){return this.state.initialized}getConfig(){return{...this.config}}getEnvironment(){return this.config.env||u}getScriptId(){return`${this.webComponentTag}-script-${this.getEnvironment()}`}isScriptLoaded(){return!!document.getElementById(this.getScriptId())}getWebComponent(){return customElements.get(this.webComponentTag)}getEffectiveScriptUrls(){return this.scriptUrls}async loadScript(){if(!(this.getWebComponent()||this.isScriptLoaded())){if(this.scriptLoadingPromise)return this.scriptLoadingPromise;this.scriptLoadingPromise=new Promise((t,r)=>{W({webComponentTag:this.webComponentTag,appName:this.webComponentTag,scriptUrls:this.getEffectiveScriptUrls(),collectorUrls:I,env:this.getEnvironment(),jwt:this.config.jwt,onLoad:t,onError:n=>{r(new Error(n.reason==="not-defined"?this.errorMessages.WEB_COMPONENT_NOT_DEFINED:`${this.errorMessages.SCRIPT_LOAD_FAILED} (${this.getEnvironment()})`))}})});try{await this.scriptLoadingPromise}catch(t){throw this.scriptLoadingPromise=void 0,t}return this.scriptLoadingPromise}}async waitForWebComponent(t=5e3){if(!this.getWebComponent())return new Promise((r,n)=>{const o=setTimeout(()=>{n(new Error(`Timeout waiting for ${this.webComponentTag} to be defined`))},t);customElements.whenDefined(this.webComponentTag).then(()=>{clearTimeout(o),r()}).catch(c=>{clearTimeout(o),n(c)})})}async ensureScriptLoaded(){if(!this.state.scriptLoaded)try{await this.loadScript(),await this.waitForWebComponent(),this.state.scriptLoaded=!0}catch(t){throw console.error("Failed to load Connect script:",t),t}}createWebComponent(){const t=document.createElement(this.webComponentTag);return Object.entries(this.config).forEach(([r,n])=>{n&&(t[r]=n)}),t}}s.ErrorCode=void 0,(function(e){e.NETWORK_ERROR="network_error",e.AUTH_ERROR="auth_error",e.NOT_FOUND_ERROR="not_found_error",e.VALIDATION_ERROR="validation_error",e.SERVER_ERROR="server_error",e.CLIENT_ERROR="client_error",e.UNKNOWN_ERROR="unknown_error"})(s.ErrorCode||(s.ErrorCode={}));const F={sandbox:"https://sdk.sandbox.connect.xyz/auth-web/index.js",production:"https://sdk.connect.xyz/auth-web/index.js"};class C extends U{errorMessages={ALREADY_RENDERED:"Auth widget is already rendered. Call destroy() before rendering again.",NOT_RENDERED:"Auth widget is not rendered. Call render() first.",INVALID_CONTAINER:"Invalid container element provided.",SCRIPT_LOAD_FAILED:"Failed to load the Connect Auth script.",WEB_COMPONENT_NOT_DEFINED:"Web component is not defined. Script may not be loaded."};scriptUrls=F;webComponentTag="connect-auth";render(t){return super.render(t)}updateConfig(t){return super.updateConfig(t)}getConfig(){return super.getConfig()}isRendered(){return super.isRendered()}destroy(){return super.destroy()}}s.Auth=C,s.default=C,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connect-xyz/auth-js",
3
- "version": "1.67.5",
3
+ "version": "1.69.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",