@connect-xyz/auth-js 1.71.4 → 1.71.5

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
@@ -289,8 +289,10 @@ declare abstract class BaseJsSdk<Config extends BaseConfig<never> = BaseConfig>
289
289
  private getEffectiveScriptUrls(): Record<string, string> {
290
290
  // Support local development with Vite: an internal build pins the script
291
291
  // URL for the configured env, bypassing the CDN maps entirely.
292
- if (typeof import.meta !== 'undefined' && import.meta.env?.['VITE_INTERNAL_BUILD'] === 'true') {
293
- const override = import.meta.env['VITE_SCRIPT_URL'];
292
+ // Dot access, not brackets: Vite 8 replaces `import.meta.env.KEY` with its
293
+ // value but inlines the whole env object for a bracket lookup.
294
+ if (typeof import.meta !== 'undefined' && import.meta.env?.VITE_INTERNAL_BUILD === 'true') {
295
+ const override = import.meta.env.VITE_SCRIPT_URL;
294
296
  if (override) return { [this.getEnvironment()]: override };
295
297
  }
296
298
 
package/dist/index.js CHANGED
@@ -1,339 +1,295 @@
1
- const y = "production", M = "JWT token is required and must be a string.", z = {
2
- dev: "https://grafana-faro-collector.dev.0hash.com/collect",
3
- cert: "https://grafana-faro-collector.cert.zerohash.com/collect",
4
- prod: "https://grafana-faro-collector.zerohash.com/collect",
5
- "eu-cert": "https://grafana-faro-collector.cert.zerohash.eu/collect",
6
- "eu-prod": "https://grafana-faro-collector.zerohash.eu/collect",
7
- sandbox: "https://grafana-faro-collector.cert.zerohash.com/collect",
8
- production: "https://grafana-faro-collector.zerohash.com/collect"
9
- }, W = (e) => {
10
- if (!e || typeof e != "string")
11
- return null;
12
- const t = e.split(".");
13
- if (t.length < 2)
14
- return null;
15
- try {
16
- 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"), a = JSON.parse(o)?.payload?.region;
17
- if (typeof a != "string")
18
- return null;
19
- const s = a.toLowerCase();
20
- return s === "us" || s === "eu" ? s : null;
21
- } catch {
22
- return null;
23
- }
24
- }, O = (e, t) => W(t) !== "eu" ? e : e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e, P = (e) => {
25
- if (!e || typeof e != "string")
26
- return {};
27
- const t = e.split(".");
28
- if (t.length < 2)
29
- return {};
30
- try {
31
- 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"), l = JSON.parse(o), a = l?.payload ?? {}, s = (c) => typeof c == "string" && c.length > 0 ? c : void 0;
32
- return {
33
- participantCode: s(a.participant_code),
34
- platformName: s(a.platform_name),
35
- platformCode: s(l.platform_code),
36
- region: s(a.region)
37
- };
38
- } catch {
39
- return {};
40
- }
41
- }, C = (e, t, r) => {
42
- const n = O(t, r);
43
- return e[n] ?? e[t] ?? e.prod;
44
- }, U = (e, t, r) => {
45
- const n = O(t, r);
46
- return e[n] ?? e[t];
47
- }, _ = () => {
48
- }, F = () => {
49
- const e = new Uint8Array(8);
50
- return globalThis.crypto.getRandomValues(e), Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
51
- }, B = (e, t) => {
52
- const r = F(), n = globalThis.__ZH_WEB_SDK_VERSION__, o = {};
53
- 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);
54
- const l = {
55
- meta: {
56
- app: { name: e.appName, version: t ?? "unknown", environment: e.env },
57
- session: { id: r, attributes: o },
58
- browser: typeof navigator < "u" ? { userAgent: navigator.userAgent } : void 0,
59
- page: typeof window < "u" ? { url: window.location.origin } : void 0
60
- },
61
- logs: [
62
- {
63
- message: `Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,
64
- level: "error",
65
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
66
- context: {
67
- web_component: e.webComponentTag,
68
- script_url: e.scriptUrl,
69
- reason: e.reason,
70
- tried_fallback: String(e.triedFallback),
71
- elapsed_ms: String(e.elapsedMs)
72
- }
73
- }
74
- ]
75
- };
76
- return { sessionId: r, payload: l };
77
- }, k = (e, t, r) => {
78
- if (!e || typeof fetch > "u")
79
- return;
80
- const { sessionId: n, payload: o } = B(t, r);
81
- try {
82
- fetch(e, {
83
- method: "POST",
84
- headers: { "Content-Type": "application/json", "x-faro-session-id": n },
85
- body: JSON.stringify(o),
86
- keepalive: !0
87
- }).catch(() => {
88
- });
89
- } catch {
90
- }
91
- }, x = (e) => {
92
- const { webComponentTag: t, appName: r, appVersion: n, scriptUrls: o, fallbackScriptUrls: l, collectorUrls: a, env: s, jwt: c, timeoutMs: S = 15e3, onLoad: L, onError: I } = e;
93
- if (typeof document > "u")
94
- return _;
95
- const m = `${t}-script-${s}`;
96
- if (customElements.get(t) || document.getElementById(m))
97
- return _;
98
- const A = P(c), v = e.report ?? ((d) => k(a && U(a, s, c), d, n));
99
- let u = !1, w = 0, f;
100
- const h = () => {
101
- f !== void 0 && clearTimeout(f);
102
- }, g = (d, p, i) => {
103
- if (u)
104
- return;
105
- const D = Math.round(performance.now() - w), T = {
106
- webComponentTag: t,
107
- appName: r,
108
- env: s,
109
- scriptUrl: p,
110
- reason: d,
111
- triedFallback: i,
112
- elapsedMs: D,
113
- claims: A
114
- };
115
- v(T);
116
- const E = i ? void 0 : C(l ?? {}, s, c);
117
- if (E && E !== p) {
118
- R(E, !0);
119
- return;
120
- }
121
- u = !0, h(), document.getElementById(m)?.remove(), I?.(T);
122
- }, R = (d, p) => {
123
- h(), w = performance.now();
124
- const i = document.createElement("script");
125
- i.id = m, i.src = d, i.type = "module", i.async = !0, i.onload = () => {
126
- setTimeout(() => {
127
- u || (customElements.get(t) ? (u = !0, h(), L?.()) : g("not-defined", d, p));
128
- }, 0);
129
- }, i.onerror = () => g("network", d, p), f = setTimeout(() => g("timeout", d, p), S), document.getElementById(m)?.remove(), document.head.appendChild(i);
130
- }, b = C(o, s, c);
131
- return b ? (R(b, !1), () => {
132
- u = !0, h();
133
- }) : _;
134
- }, j = 1e4;
135
- class V {
136
- config;
137
- state;
138
- scriptLoadingPromise;
139
- constructor(t) {
140
- if (!t.jwt || typeof t.jwt != "string")
141
- throw new Error(M);
142
- this.config = {
143
- ...t,
144
- env: t.env || y,
145
- theme: t.theme
146
- }, this.state = {
147
- initialized: !1,
148
- scriptLoaded: !1,
149
- container: null,
150
- element: null
151
- };
152
- }
153
- /**
154
- * Render the widget to a container element
155
- * @param container - The container element to render the widget into
156
- * @returns Promise that resolves when the widget is rendered
157
- */
158
- async render(t) {
159
- if (!t || !(t instanceof HTMLElement))
160
- throw new Error(this.errorMessages.INVALID_CONTAINER);
161
- if (this.state.initialized)
162
- throw new Error(this.errorMessages.ALREADY_RENDERED);
163
- try {
164
- await this.ensureScriptLoaded();
165
- const r = this.createWebComponent();
166
- t.innerHTML = "", t.appendChild(r), this.state.container = t, this.state.element = r, this.state.initialized = !0;
167
- } catch (r) {
168
- throw console.error("Failed to render widget:", r), r;
169
- }
170
- }
171
- /**
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
- *
177
- * @param config - Partial configuration to update
178
- * @returns void
179
- */
180
- updateConfig(t) {
181
- if (!this.state.initialized || !this.state.element)
182
- throw new Error(this.errorMessages.NOT_RENDERED);
183
- const r = this.state.element;
184
- Object.entries(t).forEach(([n, o]) => {
185
- o && (this.config[n] = o, r[n] = o);
186
- });
187
- }
188
- /**
189
- * Destroy the widget and clean up resources
190
- */
191
- destroy() {
192
- 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);
193
- }
194
- /**
195
- * Check if the widget is currently rendered
196
- * @returns True if the widget is rendered, false otherwise
197
- */
198
- isRendered() {
199
- return this.state.initialized;
200
- }
201
- /**
202
- * Get the current configuration
203
- * @returns The current configuration object
204
- */
205
- getConfig() {
206
- return { ...this.config };
207
- }
208
- getEnvironment() {
209
- return this.config.env || y;
210
- }
211
- getScriptId() {
212
- return `${this.webComponentTag}-script-${this.getEnvironment()}`;
213
- }
214
- isScriptLoaded() {
215
- return !!document.getElementById(this.getScriptId());
216
- }
217
- getWebComponent() {
218
- return customElements.get(this.webComponentTag);
219
- }
220
- getEffectiveScriptUrls() {
221
- return this.scriptUrls;
222
- }
223
- async loadScript() {
224
- if (!(this.getWebComponent() || this.isScriptLoaded())) {
225
- if (this.scriptLoadingPromise)
226
- return this.scriptLoadingPromise;
227
- this.scriptLoadingPromise = new Promise((t, r) => {
228
- x({
229
- webComponentTag: this.webComponentTag,
230
- appName: this.webComponentTag,
231
- scriptUrls: this.getEffectiveScriptUrls(),
232
- collectorUrls: z,
233
- env: this.getEnvironment(),
234
- jwt: this.config.jwt,
235
- onLoad: t,
236
- onError: (n) => {
237
- r(new Error(n.reason === "not-defined" ? this.errorMessages.WEB_COMPONENT_NOT_DEFINED : `${this.errorMessages.SCRIPT_LOAD_FAILED} (${this.getEnvironment()})`));
238
- }
239
- });
240
- });
241
- try {
242
- await this.scriptLoadingPromise;
243
- } catch (t) {
244
- throw this.scriptLoadingPromise = void 0, t;
245
- }
246
- return this.scriptLoadingPromise;
247
- }
248
- }
249
- async waitForWebComponent() {
250
- if (!this.getWebComponent())
251
- return new Promise((t, r) => {
252
- const n = setTimeout(() => {
253
- r(new Error(`Timeout waiting for ${this.webComponentTag} to be defined`));
254
- }, j);
255
- customElements.whenDefined(this.webComponentTag).then(() => {
256
- clearTimeout(n), t();
257
- }).catch((o) => {
258
- clearTimeout(n), r(o);
259
- });
260
- });
261
- }
262
- /**
263
- * Load the web component script if not already loaded
264
- */
265
- async ensureScriptLoaded() {
266
- if (!this.state.scriptLoaded)
267
- try {
268
- await this.loadScript(), await this.waitForWebComponent(), this.state.scriptLoaded = !0;
269
- } catch (t) {
270
- throw console.error("Failed to load Connect script:", t), t;
271
- }
272
- }
273
- createWebComponent() {
274
- const t = document.createElement(this.webComponentTag);
275
- return Object.entries(this.config).forEach(([r, n]) => {
276
- n && (t[r] = n);
277
- }), t;
278
- }
279
- }
280
- var N;
281
- (function(e) {
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";
283
- })(N || (N = {}));
284
- const $ = {
285
- sandbox: "https://sdk.sandbox.connect.xyz/auth-web/index.js",
286
- production: "https://sdk.connect.xyz/auth-web/index.js"
1
+ var e = {
2
+ dev: "https://grafana-faro-collector.dev.0hash.com/collect",
3
+ cert: "https://grafana-faro-collector.cert.zerohash.com/collect",
4
+ prod: "https://grafana-faro-collector.zerohash.com/collect",
5
+ "eu-cert": "https://grafana-faro-collector.cert.zerohash.eu/collect",
6
+ "eu-prod": "https://grafana-faro-collector.zerohash.eu/collect",
7
+ sandbox: "https://grafana-faro-collector.cert.zerohash.com/collect",
8
+ production: "https://grafana-faro-collector.zerohash.com/collect"
9
+ }, t = (e) => {
10
+ if (!e || typeof e != "string") return null;
11
+ let t = e.split(".");
12
+ if (t.length < 2) return null;
13
+ try {
14
+ let e = t[1].replace(/-/g, "+").replace(/_/g, "/"), n = e + "===".slice(0, (4 - e.length % 4) % 4), r = typeof atob < "u" ? atob(n) : Buffer.from(n, "base64").toString("utf-8"), i = JSON.parse(r)?.payload?.region;
15
+ if (typeof i != "string") return null;
16
+ let a = i.toLowerCase();
17
+ return a === "us" || a === "eu" ? a : null;
18
+ } catch {
19
+ return null;
20
+ }
21
+ }, n = (e, n) => t(n) === "eu" ? e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e : e, r = (e) => {
22
+ if (!e || typeof e != "string") return {};
23
+ let t = e.split(".");
24
+ if (t.length < 2) return {};
25
+ try {
26
+ let e = t[1].replace(/-/g, "+").replace(/_/g, "/"), n = e + "===".slice(0, (4 - e.length % 4) % 4), r = typeof atob < "u" ? atob(n) : Buffer.from(n, "base64").toString("utf-8"), i = JSON.parse(r), a = i?.payload ?? {}, o = (e) => typeof e == "string" && e.length > 0 ? e : void 0;
27
+ return {
28
+ participantCode: o(a.participant_code),
29
+ platformName: o(a.platform_name),
30
+ platformCode: o(i.platform_code),
31
+ region: o(a.region)
32
+ };
33
+ } catch {
34
+ return {};
35
+ }
36
+ }, i = (e, t, r) => e[n(t, r)] ?? e[t] ?? e.prod, a = (e, t, r) => e[n(t, r)] ?? e[t], o = () => void 0, s = () => {
37
+ let e = /* @__PURE__ */ new Uint8Array(8);
38
+ return globalThis.crypto.getRandomValues(e), Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
39
+ }, c = (e, t) => {
40
+ let n = s(), r = globalThis.__ZH_WEB_SDK_VERSION__, i = {};
41
+ return e.claims.participantCode && (i.participant_code = e.claims.participantCode), e.claims.platformName && (i.platform_name = e.claims.platformName), e.claims.platformCode && (i.platform_code = e.claims.platformCode), e.claims.region && (i.region = e.claims.region), r && (i.zh_web_sdk_version = r), {
42
+ sessionId: n,
43
+ payload: {
44
+ meta: {
45
+ app: {
46
+ name: e.appName,
47
+ version: t ?? "unknown",
48
+ environment: e.env
49
+ },
50
+ session: {
51
+ id: n,
52
+ attributes: i
53
+ },
54
+ browser: typeof navigator < "u" ? { userAgent: navigator.userAgent } : void 0,
55
+ page: typeof window < "u" ? { url: window.location.origin } : void 0
56
+ },
57
+ logs: [{
58
+ message: `Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,
59
+ level: "error",
60
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
61
+ context: {
62
+ web_component: e.webComponentTag,
63
+ script_url: e.scriptUrl,
64
+ reason: e.reason,
65
+ tried_fallback: String(e.triedFallback),
66
+ elapsed_ms: String(e.elapsedMs)
67
+ }
68
+ }]
69
+ }
70
+ };
71
+ }, l = (e, t, n) => {
72
+ if (!e || typeof fetch > "u") return;
73
+ let { sessionId: r, payload: i } = c(t, n);
74
+ try {
75
+ fetch(e, {
76
+ method: "POST",
77
+ headers: {
78
+ "Content-Type": "application/json",
79
+ "x-faro-session-id": r
80
+ },
81
+ body: JSON.stringify(i),
82
+ keepalive: !0
83
+ }).catch(() => void 0);
84
+ } catch {}
85
+ }, u = (e) => {
86
+ let { webComponentTag: t, appName: n, appVersion: s, scriptUrls: c, fallbackScriptUrls: u, collectorUrls: d, env: f, jwt: p, timeoutMs: m = 15e3, onLoad: h, onError: g } = e;
87
+ if (typeof document > "u") return o;
88
+ let _ = `${t}-script-${f}`;
89
+ if (customElements.get(t) || document.getElementById(_)) return o;
90
+ let v = r(p), y = e.report ?? ((e) => l(d && a(d, f, p), e, s)), b = !1, x = 0, S, C = () => {
91
+ S !== void 0 && clearTimeout(S);
92
+ }, w = (e, r, a) => {
93
+ if (b) return;
94
+ let o = Math.round(performance.now() - x), s = {
95
+ webComponentTag: t,
96
+ appName: n,
97
+ env: f,
98
+ scriptUrl: r,
99
+ reason: e,
100
+ triedFallback: a,
101
+ elapsedMs: o,
102
+ claims: v
103
+ };
104
+ y(s);
105
+ let c = a ? void 0 : i(u ?? {}, f, p);
106
+ if (c && c !== r) {
107
+ T(c, !0);
108
+ return;
109
+ }
110
+ b = !0, C(), document.getElementById(_)?.remove(), g?.(s);
111
+ }, T = (e, n) => {
112
+ C(), x = performance.now();
113
+ let r = document.createElement("script");
114
+ r.id = _, r.src = e, r.type = "module", r.async = !0, r.onload = () => {
115
+ setTimeout(() => {
116
+ b || (customElements.get(t) ? (b = !0, C(), h?.()) : w("not-defined", e, n));
117
+ }, 0);
118
+ }, r.onerror = () => w("network", e, n), S = setTimeout(() => w("timeout", e, n), m), document.getElementById(_)?.remove(), document.head.appendChild(r);
119
+ }, E = i(c, f, p);
120
+ return E ? (T(E, !1), () => {
121
+ b = !0, C();
122
+ }) : o;
123
+ }, d = 1e4, f = class {
124
+ config;
125
+ state;
126
+ scriptLoadingPromise;
127
+ constructor(e) {
128
+ if (!e.jwt || typeof e.jwt != "string") throw Error("JWT token is required and must be a string.");
129
+ this.config = {
130
+ ...e,
131
+ env: e.env || "production",
132
+ theme: e.theme
133
+ }, this.state = {
134
+ initialized: !1,
135
+ scriptLoaded: !1,
136
+ container: null,
137
+ element: null
138
+ };
139
+ }
140
+ async render(e) {
141
+ if (!e || !(e instanceof HTMLElement)) throw Error(this.errorMessages.INVALID_CONTAINER);
142
+ if (this.state.initialized) throw Error(this.errorMessages.ALREADY_RENDERED);
143
+ try {
144
+ await this.ensureScriptLoaded();
145
+ let t = this.createWebComponent();
146
+ e.innerHTML = "", e.appendChild(t), this.state.container = e, this.state.element = t, this.state.initialized = !0;
147
+ } catch (e) {
148
+ throw console.error("Failed to render widget:", e), e;
149
+ }
150
+ }
151
+ updateConfig(e) {
152
+ if (!this.state.initialized || !this.state.element) throw Error(this.errorMessages.NOT_RENDERED);
153
+ let t = this.state.element;
154
+ Object.entries(e).forEach(([e, n]) => {
155
+ n && (this.config[e] = n, t[e] = n);
156
+ });
157
+ }
158
+ destroy() {
159
+ 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);
160
+ }
161
+ isRendered() {
162
+ return this.state.initialized;
163
+ }
164
+ getConfig() {
165
+ return { ...this.config };
166
+ }
167
+ getEnvironment() {
168
+ return this.config.env || "production";
169
+ }
170
+ getScriptId() {
171
+ return `${this.webComponentTag}-script-${this.getEnvironment()}`;
172
+ }
173
+ isScriptLoaded() {
174
+ return !!document.getElementById(this.getScriptId());
175
+ }
176
+ getWebComponent() {
177
+ return customElements.get(this.webComponentTag);
178
+ }
179
+ getEffectiveScriptUrls() {
180
+ return this.scriptUrls;
181
+ }
182
+ async loadScript() {
183
+ if (!(this.getWebComponent() || this.isScriptLoaded())) {
184
+ if (this.scriptLoadingPromise) return this.scriptLoadingPromise;
185
+ this.scriptLoadingPromise = new Promise((t, n) => {
186
+ u({
187
+ webComponentTag: this.webComponentTag,
188
+ appName: this.webComponentTag,
189
+ scriptUrls: this.getEffectiveScriptUrls(),
190
+ collectorUrls: e,
191
+ env: this.getEnvironment(),
192
+ jwt: this.config.jwt,
193
+ onLoad: t,
194
+ onError: (e) => {
195
+ n(Error(e.reason === "not-defined" ? this.errorMessages.WEB_COMPONENT_NOT_DEFINED : `${this.errorMessages.SCRIPT_LOAD_FAILED} (${this.getEnvironment()})`));
196
+ }
197
+ });
198
+ });
199
+ try {
200
+ await this.scriptLoadingPromise;
201
+ } catch (e) {
202
+ throw this.scriptLoadingPromise = void 0, e;
203
+ }
204
+ return this.scriptLoadingPromise;
205
+ }
206
+ }
207
+ async waitForWebComponent() {
208
+ if (!this.getWebComponent()) return new Promise((e, t) => {
209
+ let n = setTimeout(() => {
210
+ t(/* @__PURE__ */ Error(`Timeout waiting for ${this.webComponentTag} to be defined`));
211
+ }, d);
212
+ customElements.whenDefined(this.webComponentTag).then(() => {
213
+ clearTimeout(n), e();
214
+ }).catch((e) => {
215
+ clearTimeout(n), t(e);
216
+ });
217
+ });
218
+ }
219
+ async ensureScriptLoaded() {
220
+ if (!this.state.scriptLoaded) try {
221
+ await this.loadScript(), await this.waitForWebComponent(), this.state.scriptLoaded = !0;
222
+ } catch (e) {
223
+ throw console.error("Failed to load Connect script:", e), e;
224
+ }
225
+ }
226
+ createWebComponent() {
227
+ let e = document.createElement(this.webComponentTag);
228
+ return Object.entries(this.config).forEach(([t, n]) => {
229
+ n && (e[t] = n);
230
+ }), e;
231
+ }
287
232
  };
288
- class J extends V {
289
- errorMessages = {
290
- ALREADY_RENDERED: "Auth widget is already rendered. Call destroy() before rendering again.",
291
- NOT_RENDERED: "Auth widget is not rendered. Call render() first.",
292
- INVALID_CONTAINER: "Invalid container element provided.",
293
- SCRIPT_LOAD_FAILED: "Failed to load the Connect Auth script.",
294
- WEB_COMPONENT_NOT_DEFINED: "Web component is not defined. Script may not be loaded."
295
- };
296
- // protected override scriptUrls = EFFECTIVE_SCRIPT_URLS;
297
- scriptUrls = $;
298
- webComponentTag = "connect-auth";
299
- /**
300
- * Render the Auth widget to a container element
301
- * @param container - The container element to render the widget into
302
- * @returns Promise that resolves when the widget is rendered
303
- */
304
- render(t) {
305
- return super.render(t);
306
- }
307
- /**
308
- * Update the configuration of the Auth widget
309
- * @param config - Partial configuration to update
310
- */
311
- updateConfig(t) {
312
- return super.updateConfig(t);
313
- }
314
- /**
315
- * Get the current configuration
316
- * @returns The current configuration object
317
- */
318
- getConfig() {
319
- return super.getConfig();
320
- }
321
- /**
322
- * Check if the Auth widget is currently rendered
323
- * @returns True if the widget is rendered, false otherwise
324
- */
325
- isRendered() {
326
- return super.isRendered();
327
- }
328
- /**
329
- * Destroy the Auth widget and clean up resources
330
- */
331
- destroy() {
332
- return super.destroy();
333
- }
334
- }
335
- export {
336
- J as Auth,
337
- N as ErrorCode,
338
- J as default
233
+ ({
234
+ BASE_URL: "/",
235
+ DEV: !1,
236
+ MODE: "production",
237
+ PROD: !0,
238
+ SSR: !1,
239
+ VITE_ASSETS_SERVICE_URL: "http://localhost:5173/assets",
240
+ VITE_CONNECT_API_BASE_URL: "/api/v1",
241
+ VITE_CONNECT_ENV: "local",
242
+ VITE_CONNECT_SDK_API_BASE_URL: "/sdk/v1",
243
+ VITE_DYNAMIC_ENVIRONMENT_ID: "38ce0330-c85e-414a-80b4-6129c548018f",
244
+ VITE_FARO_COLLECTOR_URL: "https://grafana-faro-collector.dev.0hash.com/collect",
245
+ VITE_FEATURE_SERVER_PROXY_URL: "https://ff-edge.dev.0hash.com/api/frontend",
246
+ VITE_INTERNAL_BUILD: "false",
247
+ VITE_ONBOARDING_API_BASE_URL: "/onboarding",
248
+ VITE_POST_MESSAGE_COMMUNICATION_PLATFORMS: "UW6VWU",
249
+ VITE_REDIRECT_HANDLER_URL: "http://localhost:4202/redirect-handler/index.html",
250
+ VITE_SCRAPER_EXTENSION_ID_CHROMIUM: "kofibejdfkmnbobmbogndbiimkflcllf",
251
+ VITE_TRADE_API_BASE_URL: "/trade",
252
+ VITE_UNLEASH_APIKEY: "zerohash-sdk:dev.b0d8aa594e9b94564f885167881bcb9dc69332f935fcb253e656ff34"
253
+ }).VITE_LOCAL_CDN_HOST, {
254
+ LOADED: "travel_rule_loaded",
255
+ COMPLETED: "travel_rule_completed"
256
+ }.LOADED;
257
+ //#endregion
258
+ //#region ../../../common/callbacks/dist/shared/models.js
259
+ var p;
260
+ (function(e) {
261
+ 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";
262
+ })(p ||= {});
263
+ //#endregion
264
+ //#region src/lib/auth.ts
265
+ var m = {
266
+ sandbox: "https://sdk.sandbox.connect.xyz/auth-web/index.js",
267
+ production: "https://sdk.connect.xyz/auth-web/index.js"
268
+ }, h = class extends f {
269
+ errorMessages = {
270
+ ALREADY_RENDERED: "Auth widget is already rendered. Call destroy() before rendering again.",
271
+ NOT_RENDERED: "Auth widget is not rendered. Call render() first.",
272
+ INVALID_CONTAINER: "Invalid container element provided.",
273
+ SCRIPT_LOAD_FAILED: "Failed to load the Connect Auth script.",
274
+ WEB_COMPONENT_NOT_DEFINED: "Web component is not defined. Script may not be loaded."
275
+ };
276
+ scriptUrls = m;
277
+ webComponentTag = "connect-auth";
278
+ render(e) {
279
+ return super.render(e);
280
+ }
281
+ updateConfig(e) {
282
+ return super.updateConfig(e);
283
+ }
284
+ getConfig() {
285
+ return super.getConfig();
286
+ }
287
+ isRendered() {
288
+ return super.isRendered();
289
+ }
290
+ destroy() {
291
+ return super.destroy();
292
+ }
339
293
  };
294
+ //#endregion
295
+ export { h as Auth, h as default, p as ErrorCode };
@@ -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"},A=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"),c=JSON.parse(o)?.payload?.region;if(typeof c!="string")return null;const i=c.toLowerCase();return i==="us"||i==="eu"?i:null}catch{return null}},b=(e,t)=>A(t)!=="eu"?e:e==="cert"?"eu-cert":e==="prod"?"eu-prod":e,v=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"),p=JSON.parse(o),c=p?.payload??{},i=d=>typeof d=="string"&&d.length>0?d:void 0;return{participantCode:i(c.participant_code),platformName:i(c.platform_name),platformCode:i(p.platform_code),region:i(c.region)}}catch{return{}}},T=(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 p={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:p}},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:p,collectorUrls:c,env:i,jwt:d,timeoutMs:B=15e3,onLoad:k,onError:V}=e;if(typeof document>"u")return E;const h=`${t}-script-${i}`;if(customElements.get(t)||document.getElementById(h))return E;const $=v(d),x=e.report??(l=>P(c&&D(c,i,d),l,n));let f=!1,C=0,_;const g=()=>{_!==void 0&&clearTimeout(_)},w=(l,m,a)=>{if(f)return;const J=Math.round(performance.now()-C),O={webComponentTag:t,appName:r,env:i,scriptUrl:m,reason:l,triedFallback:a,elapsedMs:J,claims:$};x(O);const R=a?void 0:T(p??{},i,d);if(R&&R!==m){N(R,!0);return}f=!0,g(),document.getElementById(h)?.remove(),V?.(O)},N=(l,m)=>{g(),C=performance.now();const a=document.createElement("script");a.id=h,a.src=l,a.type="module",a.async=!0,a.onload=()=>{setTimeout(()=>{f||(customElements.get(t)?(f=!0,g(),k?.()):w("not-defined",l,m))},0)},a.onerror=()=>w("network",l,m),_=setTimeout(()=>w("timeout",l,m),B),document.getElementById(h)?.remove(),document.head.appendChild(a)},S=T(o,i,d);return S?(N(S,!1),()=>{f=!0,g()}):E},U=1e4;class F{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(){if(!this.getWebComponent())return new Promise((t,r)=>{const n=setTimeout(()=>{r(new Error(`Timeout waiting for ${this.webComponentTag} to be defined`))},U);customElements.whenDefined(this.webComponentTag).then(()=>{clearTimeout(n),t()}).catch(o=>{clearTimeout(n),r(o)})})}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 j={sandbox:"https://sdk.sandbox.connect.xyz/auth-web/index.js",production:"https://sdk.connect.xyz/auth-web/index.js"};class y extends F{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=j;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=y,s.default=y,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports):typeof define==`function`&&define.amd?define([`exports`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.Auth={}))})(this,function(e){Object.defineProperties(e,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var t=`JWT token is required and must be a string.`,n={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`},r=e=>{if(!e||typeof e!=`string`)return null;let t=e.split(`.`);if(t.length<2)return null;try{let e=t[1].replace(/-/g,`+`).replace(/_/g,`/`),n=e+`===`.slice(0,(4-e.length%4)%4),r=typeof atob<`u`?atob(n):Buffer.from(n,`base64`).toString(`utf-8`),i=JSON.parse(r)?.payload?.region;if(typeof i!=`string`)return null;let a=i.toLowerCase();return a===`us`||a===`eu`?a:null}catch{return null}},i=(e,t)=>r(t)===`eu`?e===`cert`?`eu-cert`:e===`prod`?`eu-prod`:e:e,a=e=>{if(!e||typeof e!=`string`)return{};let t=e.split(`.`);if(t.length<2)return{};try{let e=t[1].replace(/-/g,`+`).replace(/_/g,`/`),n=e+`===`.slice(0,(4-e.length%4)%4),r=typeof atob<`u`?atob(n):Buffer.from(n,`base64`).toString(`utf-8`),i=JSON.parse(r),a=i?.payload??{},o=e=>typeof e==`string`&&e.length>0?e:void 0;return{participantCode:o(a.participant_code),platformName:o(a.platform_name),platformCode:o(i.platform_code),region:o(a.region)}}catch{return{}}},o=(e,t,n)=>e[i(t,n)]??e[t]??e.prod,s=(e,t,n)=>e[i(t,n)]??e[t],c=()=>void 0,l=()=>{let e=new Uint8Array(8);return globalThis.crypto.getRandomValues(e),Array.from(e,e=>e.toString(16).padStart(2,`0`)).join(``)},u=(e,t)=>{let n=l(),r=globalThis.__ZH_WEB_SDK_VERSION__,i={};return e.claims.participantCode&&(i.participant_code=e.claims.participantCode),e.claims.platformName&&(i.platform_name=e.claims.platformName),e.claims.platformCode&&(i.platform_code=e.claims.platformCode),e.claims.region&&(i.region=e.claims.region),r&&(i.zh_web_sdk_version=r),{sessionId:n,payload:{meta:{app:{name:e.appName,version:t??`unknown`,environment:e.env},session:{id:n,attributes:i},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)}}]}}},d=(e,t,n)=>{if(!e||typeof fetch>`u`)return;let{sessionId:r,payload:i}=u(t,n);try{fetch(e,{method:`POST`,headers:{"Content-Type":`application/json`,"x-faro-session-id":r},body:JSON.stringify(i),keepalive:!0}).catch(()=>void 0)}catch{}},f=e=>{let{webComponentTag:t,appName:n,appVersion:r,scriptUrls:i,fallbackScriptUrls:l,collectorUrls:u,env:f,jwt:p,timeoutMs:m=15e3,onLoad:h,onError:g}=e;if(typeof document>`u`)return c;let _=`${t}-script-${f}`;if(customElements.get(t)||document.getElementById(_))return c;let v=a(p),y=e.report??(e=>d(u&&s(u,f,p),e,r)),b=!1,x=0,S,C=()=>{S!==void 0&&clearTimeout(S)},w=(e,r,i)=>{if(b)return;let a=Math.round(performance.now()-x),s={webComponentTag:t,appName:n,env:f,scriptUrl:r,reason:e,triedFallback:i,elapsedMs:a,claims:v};y(s);let c=i?void 0:o(l??{},f,p);if(c&&c!==r){T(c,!0);return}b=!0,C(),document.getElementById(_)?.remove(),g?.(s)},T=(e,n)=>{C(),x=performance.now();let r=document.createElement(`script`);r.id=_,r.src=e,r.type=`module`,r.async=!0,r.onload=()=>{setTimeout(()=>{b||(customElements.get(t)?(b=!0,C(),h?.()):w(`not-defined`,e,n))},0)},r.onerror=()=>w(`network`,e,n),S=setTimeout(()=>w(`timeout`,e,n),m),document.getElementById(_)?.remove(),document.head.appendChild(r)},E=o(i,f,p);return E?(T(E,!1),()=>{b=!0,C()}):c},p=1e4,m=class{config;state;scriptLoadingPromise;constructor(e){if(!e.jwt||typeof e.jwt!=`string`)throw Error(t);this.config={...e,env:e.env||`production`,theme:e.theme},this.state={initialized:!1,scriptLoaded:!1,container:null,element:null}}async render(e){if(!e||!(e instanceof HTMLElement))throw Error(this.errorMessages.INVALID_CONTAINER);if(this.state.initialized)throw Error(this.errorMessages.ALREADY_RENDERED);try{await this.ensureScriptLoaded();let t=this.createWebComponent();e.innerHTML=``,e.appendChild(t),this.state.container=e,this.state.element=t,this.state.initialized=!0}catch(e){throw console.error(`Failed to render widget:`,e),e}}updateConfig(e){if(!this.state.initialized||!this.state.element)throw Error(this.errorMessages.NOT_RENDERED);let t=this.state.element;Object.entries(e).forEach(([e,n])=>{n&&(this.config[e]=n,t[e]=n)})}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||`production`}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((e,t)=>{f({webComponentTag:this.webComponentTag,appName:this.webComponentTag,scriptUrls:this.getEffectiveScriptUrls(),collectorUrls:n,env:this.getEnvironment(),jwt:this.config.jwt,onLoad:e,onError:e=>{t(Error(e.reason===`not-defined`?this.errorMessages.WEB_COMPONENT_NOT_DEFINED:`${this.errorMessages.SCRIPT_LOAD_FAILED} (${this.getEnvironment()})`))}})});try{await this.scriptLoadingPromise}catch(e){throw this.scriptLoadingPromise=void 0,e}return this.scriptLoadingPromise}}async waitForWebComponent(){if(!this.getWebComponent())return new Promise((e,t)=>{let n=setTimeout(()=>{t(Error(`Timeout waiting for ${this.webComponentTag} to be defined`))},p);customElements.whenDefined(this.webComponentTag).then(()=>{clearTimeout(n),e()}).catch(e=>{clearTimeout(n),t(e)})})}async ensureScriptLoaded(){if(!this.state.scriptLoaded)try{await this.loadScript(),await this.waitForWebComponent(),this.state.scriptLoaded=!0}catch(e){throw console.error(`Failed to load Connect script:`,e),e}}createWebComponent(){let e=document.createElement(this.webComponentTag);return Object.entries(this.config).forEach(([t,n])=>{n&&(e[t]=n)}),e}};({BASE_URL:`/`,DEV:!1,MODE:`production`,PROD:!0,SSR:!1,VITE_ASSETS_SERVICE_URL:`http://localhost:5173/assets`,VITE_CONNECT_API_BASE_URL:`/api/v1`,VITE_CONNECT_ENV:`local`,VITE_CONNECT_SDK_API_BASE_URL:`/sdk/v1`,VITE_DYNAMIC_ENVIRONMENT_ID:`38ce0330-c85e-414a-80b4-6129c548018f`,VITE_FARO_COLLECTOR_URL:`https://grafana-faro-collector.dev.0hash.com/collect`,VITE_FEATURE_SERVER_PROXY_URL:`https://ff-edge.dev.0hash.com/api/frontend`,VITE_INTERNAL_BUILD:`false`,VITE_ONBOARDING_API_BASE_URL:`/onboarding`,VITE_POST_MESSAGE_COMMUNICATION_PLATFORMS:`UW6VWU`,VITE_REDIRECT_HANDLER_URL:`http://localhost:4202/redirect-handler/index.html`,VITE_SCRAPER_EXTENSION_ID_CHROMIUM:`kofibejdfkmnbobmbogndbiimkflcllf`,VITE_TRADE_API_BASE_URL:`/trade`,VITE_UNLEASH_APIKEY:`zerohash-sdk:dev.b0d8aa594e9b94564f885167881bcb9dc69332f935fcb253e656ff34`}).VITE_LOCAL_CDN_HOST,{LOADED:`travel_rule_loaded`,COMPLETED:`travel_rule_completed`}.LOADED;var h;(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`})(h||={});var g={sandbox:`https://sdk.sandbox.connect.xyz/auth-web/index.js`,production:`https://sdk.connect.xyz/auth-web/index.js`},_=class extends m{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=g;webComponentTag=`connect-auth`;render(e){return super.render(e)}updateConfig(e){return super.updateConfig(e)}getConfig(){return super.getConfig()}isRendered(){return super.isRendered()}destroy(){return super.destroy()}};e.Auth=_,e.default=_,Object.defineProperty(e,"ErrorCode",{enumerable:!0,get:function(){return h}})});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connect-xyz/auth-js",
3
- "version": "1.71.4",
3
+ "version": "1.71.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",