@connect-xyz/auth-react 0.84.4 → 0.84.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
@@ -229,3 +229,28 @@ declare type ErrorPayload = {
229
229
  declare type Theme = 'auto' | 'light' | 'dark';
230
230
 
231
231
  export { }
232
+
233
+
234
+ declare global {
235
+ namespace JSX {
236
+ interface IntrinsicElements {
237
+ /**
238
+ * Connect Auth web component element
239
+ */
240
+ [WEB_COMPONENT_TAG]: React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement> & {
241
+ /**
242
+ * JWT token for authentication
243
+ */
244
+ jwt: string;
245
+ /**
246
+ * Target environment ("sandbox" | "production")
247
+ */
248
+ env?: Environment;
249
+ /**
250
+ * Theme mode ("auto" | "light" | "dark")
251
+ */
252
+ theme?: Theme;
253
+ };
254
+ }
255
+ }
256
+ }
package/dist/index.js CHANGED
@@ -1,255 +1,326 @@
1
- import { jsxs as W, jsx as d } from "react/jsx-runtime";
2
- import A, { useEffect as I, useState as N, useCallback as j, useRef as M } from "react";
3
- const y = {
4
- evergreen: "#00381D",
5
- green: "#CCFFD0",
6
- offBlack: "#1C1B1C",
7
- grayLight: "#EBEBE9"
8
- }, V = ({ onRetry: e, onClose: t }) => W("div", { role: "alert", style: {
9
- position: "relative",
10
- display: "flex",
11
- flexDirection: "column",
12
- alignItems: "center",
13
- gap: "8px",
14
- maxWidth: "360px",
15
- margin: "0 auto",
16
- padding: "32px 24px",
17
- textAlign: "center",
18
- fontFamily: "inherit",
19
- color: y.offBlack,
20
- background: "#FFFFFF",
21
- border: `1px solid ${y.grayLight}`,
22
- borderRadius: "12px"
23
- }, children: [t && d("button", { type: "button", onClick: t, "aria-label": "Close", style: {
24
- position: "absolute",
25
- top: "12px",
26
- right: "12px",
27
- display: "flex",
28
- padding: "4px",
29
- color: y.offBlack,
30
- background: "none",
31
- border: "none",
32
- cursor: "pointer",
33
- lineHeight: 0
34
- }, children: d("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: d("path", { d: "M18 6L6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), d("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: d("path", { d: "M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z", stroke: y.evergreen, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), d("p", { style: { margin: 0, fontSize: "16px", fontWeight: 600 }, children: "Something went wrong" }), d("p", { style: { margin: 0, fontSize: "14px", opacity: 0.75 }, children: "We couldn't load this content. Please check your internet connection and try again." }), d("button", { type: "button", onClick: e, style: {
35
- marginTop: "8px",
36
- padding: "8px 20px",
37
- fontSize: "14px",
38
- fontWeight: 600,
39
- fontFamily: "inherit",
40
- color: y.green,
41
- background: y.evergreen,
42
- border: "none",
43
- borderRadius: "8px",
44
- cursor: "pointer"
45
- }, children: "Try again" })] }), D = (e, t) => {
46
- I(() => {
47
- const o = e.current;
48
- if (o)
49
- for (const [n, r] of Object.entries(t))
50
- r !== void 0 && (o[n] = r);
51
- });
52
- }, P = {
53
- dev: "https://grafana-faro-collector.dev.0hash.com/collect",
54
- cert: "https://grafana-faro-collector.cert.zerohash.com/collect",
55
- prod: "https://grafana-faro-collector.zerohash.com/collect",
56
- "eu-cert": "https://grafana-faro-collector.cert.zerohash.eu/collect",
57
- "eu-prod": "https://grafana-faro-collector.zerohash.eu/collect",
58
- sandbox: "https://grafana-faro-collector.cert.zerohash.com/collect",
59
- production: "https://grafana-faro-collector.zerohash.com/collect"
60
- }, J = (e) => {
61
- if (!e || typeof e != "string")
62
- return null;
63
- const t = e.split(".");
64
- if (t.length < 2)
65
- return null;
66
- try {
67
- const o = t[1].replace(/-/g, "+").replace(/_/g, "/"), n = o + "===".slice(0, (4 - o.length % 4) % 4), r = typeof atob < "u" ? atob(n) : Buffer.from(n, "base64").toString("utf-8"), c = JSON.parse(r)?.payload?.region;
68
- if (typeof c != "string")
69
- return null;
70
- const a = c.toLowerCase();
71
- return a === "us" || a === "eu" ? a : null;
72
- } catch {
73
- return null;
74
- }
75
- }, z = (e, t) => J(t) !== "eu" ? e : e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e, $ = (e) => {
76
- if (!e || typeof e != "string")
77
- return {};
78
- const t = e.split(".");
79
- if (t.length < 2)
80
- return {};
81
- try {
82
- const o = t[1].replace(/-/g, "+").replace(/_/g, "/"), n = o + "===".slice(0, (4 - o.length % 4) % 4), r = typeof atob < "u" ? atob(n) : Buffer.from(n, "base64").toString("utf-8"), i = JSON.parse(r), c = i?.payload ?? {}, a = (s) => typeof s == "string" && s.length > 0 ? s : void 0;
83
- return {
84
- participantCode: a(c.participant_code),
85
- platformName: a(c.platform_name),
86
- platformCode: a(i.platform_code),
87
- region: a(c.region)
88
- };
89
- } catch {
90
- return {};
91
- }
92
- }, L = (e, t, o) => {
93
- const n = z(t, o);
94
- return e[n] ?? e[t] ?? e.prod;
95
- }, H = (e, t, o) => {
96
- const n = z(t, o);
97
- return e[n] ?? e[t];
98
- }, C = () => {
99
- }, K = () => {
100
- const e = new Uint8Array(8);
101
- return globalThis.crypto.getRandomValues(e), Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
102
- }, G = (e, t) => {
103
- const o = K(), n = globalThis.__ZH_WEB_SDK_VERSION__, r = {};
104
- e.claims.participantCode && (r.participant_code = e.claims.participantCode), e.claims.platformName && (r.platform_name = e.claims.platformName), e.claims.platformCode && (r.platform_code = e.claims.platformCode), e.claims.region && (r.region = e.claims.region), n && (r.zh_web_sdk_version = n);
105
- const i = {
106
- meta: {
107
- app: { name: e.appName, version: t ?? "unknown", environment: e.env },
108
- session: { id: o, attributes: r },
109
- browser: typeof navigator < "u" ? { userAgent: navigator.userAgent } : void 0,
110
- page: typeof window < "u" ? { url: window.location.origin } : void 0
111
- },
112
- logs: [
113
- {
114
- message: `Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,
115
- level: "error",
116
- timestamp: (/* @__PURE__ */ new Date()).toISOString(),
117
- context: {
118
- web_component: e.webComponentTag,
119
- script_url: e.scriptUrl,
120
- reason: e.reason,
121
- tried_fallback: String(e.triedFallback),
122
- elapsed_ms: String(e.elapsedMs)
123
- }
124
- }
125
- ]
126
- };
127
- return { sessionId: o, payload: i };
128
- }, Z = (e, t, o) => {
129
- if (!e || typeof fetch > "u")
130
- return;
131
- const { sessionId: n, payload: r } = G(t, o);
132
- try {
133
- fetch(e, {
134
- method: "POST",
135
- headers: { "Content-Type": "application/json", "x-faro-session-id": n },
136
- body: JSON.stringify(r),
137
- keepalive: !0
138
- }).catch(() => {
139
- });
140
- } catch {
141
- }
142
- }, q = (e) => {
143
- const { webComponentTag: t, appName: o, appVersion: n, scriptUrls: r, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: u = 15e3, onLoad: b, onError: m } = e;
144
- if (typeof document > "u")
145
- return C;
146
- const g = `${t}-script-${a}`;
147
- if (customElements.get(t) || document.getElementById(g))
148
- return C;
149
- const R = $(s), x = e.report ?? ((p) => Z(c && H(c, a, s), p, n));
150
- let f = !1, w = 0, S;
151
- const _ = () => {
152
- S !== void 0 && clearTimeout(S);
153
- }, k = (p, h, l) => {
154
- if (f)
155
- return;
156
- const U = Math.round(performance.now() - w), T = {
157
- webComponentTag: t,
158
- appName: o,
159
- env: a,
160
- scriptUrl: h,
161
- reason: p,
162
- triedFallback: l,
163
- elapsedMs: U,
164
- claims: R
165
- };
166
- x(T);
167
- const v = l ? void 0 : L(i ?? {}, a, s);
168
- if (v && v !== h) {
169
- E(v, !0);
170
- return;
171
- }
172
- f = !0, _(), document.getElementById(g)?.remove(), m?.(T);
173
- }, E = (p, h) => {
174
- _(), w = performance.now();
175
- const l = document.createElement("script");
176
- l.id = g, l.src = p, l.type = "module", l.async = !0, l.onload = () => {
177
- setTimeout(() => {
178
- f || (customElements.get(t) ? (f = !0, _(), b?.()) : k("not-defined", p, h));
179
- }, 0);
180
- }, l.onerror = () => k("network", p, h), S = setTimeout(() => k("timeout", p, h), u), document.getElementById(g)?.remove(), document.head.appendChild(l);
181
- }, O = L(r, a, s);
182
- return O ? (E(O, !1), () => {
183
- f = !0, _();
184
- }) : C;
1
+ import { jsx as e, jsxs as t } from "react/jsx-runtime";
2
+ import n, { useCallback as r, useEffect as i, useRef as a, useState as o } from "react";
3
+ //#region ../../../common/react-sdk-base/dist/script-load-fallback.js
4
+ var s = {
5
+ evergreen: "#00381D",
6
+ green: "#CCFFD0",
7
+ offBlack: "#1C1B1C",
8
+ grayLight: "#EBEBE9"
9
+ }, c = ({ onRetry: n, onClose: r }) => t("div", {
10
+ role: "alert",
11
+ style: {
12
+ position: "relative",
13
+ display: "flex",
14
+ flexDirection: "column",
15
+ alignItems: "center",
16
+ gap: "8px",
17
+ maxWidth: "360px",
18
+ margin: "0 auto",
19
+ padding: "32px 24px",
20
+ textAlign: "center",
21
+ fontFamily: "inherit",
22
+ color: s.offBlack,
23
+ background: "#FFFFFF",
24
+ border: `1px solid ${s.grayLight}`,
25
+ borderRadius: "12px"
26
+ },
27
+ children: [
28
+ r && e("button", {
29
+ type: "button",
30
+ onClick: r,
31
+ "aria-label": "Close",
32
+ style: {
33
+ position: "absolute",
34
+ top: "12px",
35
+ right: "12px",
36
+ display: "flex",
37
+ padding: "4px",
38
+ color: s.offBlack,
39
+ background: "none",
40
+ border: "none",
41
+ cursor: "pointer",
42
+ lineHeight: 0
43
+ },
44
+ children: e("svg", {
45
+ width: "20",
46
+ height: "20",
47
+ viewBox: "0 0 24 24",
48
+ fill: "none",
49
+ "aria-hidden": "true",
50
+ children: e("path", {
51
+ d: "M18 6L6 18M6 6l12 12",
52
+ stroke: "currentColor",
53
+ strokeWidth: "1.5",
54
+ strokeLinecap: "round",
55
+ strokeLinejoin: "round"
56
+ })
57
+ })
58
+ }),
59
+ e("svg", {
60
+ width: "32",
61
+ height: "32",
62
+ viewBox: "0 0 24 24",
63
+ fill: "none",
64
+ "aria-hidden": "true",
65
+ children: e("path", {
66
+ d: "M12 9v4m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z",
67
+ stroke: s.evergreen,
68
+ strokeWidth: "1.5",
69
+ strokeLinecap: "round",
70
+ strokeLinejoin: "round"
71
+ })
72
+ }),
73
+ e("p", {
74
+ style: {
75
+ margin: 0,
76
+ fontSize: "16px",
77
+ fontWeight: 600
78
+ },
79
+ children: "Something went wrong"
80
+ }),
81
+ e("p", {
82
+ style: {
83
+ margin: 0,
84
+ fontSize: "14px",
85
+ opacity: .75
86
+ },
87
+ children: "We couldn't load this content. Please check your internet connection and try again."
88
+ }),
89
+ e("button", {
90
+ type: "button",
91
+ onClick: n,
92
+ style: {
93
+ marginTop: "8px",
94
+ padding: "8px 20px",
95
+ fontSize: "14px",
96
+ fontWeight: 600,
97
+ fontFamily: "inherit",
98
+ color: s.green,
99
+ background: s.evergreen,
100
+ border: "none",
101
+ borderRadius: "8px",
102
+ cursor: "pointer"
103
+ },
104
+ children: "Try again"
105
+ })
106
+ ]
107
+ }), l = (e, t) => {
108
+ i(() => {
109
+ let n = e.current;
110
+ if (n) for (let [e, r] of Object.entries(t)) r !== void 0 && (n[e] = r);
111
+ });
112
+ }, u = {
113
+ dev: "https://grafana-faro-collector.dev.0hash.com/collect",
114
+ cert: "https://grafana-faro-collector.cert.zerohash.com/collect",
115
+ prod: "https://grafana-faro-collector.zerohash.com/collect",
116
+ "eu-cert": "https://grafana-faro-collector.cert.zerohash.eu/collect",
117
+ "eu-prod": "https://grafana-faro-collector.zerohash.eu/collect",
118
+ sandbox: "https://grafana-faro-collector.cert.zerohash.com/collect",
119
+ production: "https://grafana-faro-collector.zerohash.com/collect"
120
+ }, d = (e) => {
121
+ if (!e || typeof e != "string") return null;
122
+ let t = e.split(".");
123
+ if (t.length < 2) return null;
124
+ try {
125
+ 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;
126
+ if (typeof i != "string") return null;
127
+ let a = i.toLowerCase();
128
+ return a === "us" || a === "eu" ? a : null;
129
+ } catch {
130
+ return null;
131
+ }
132
+ }, f = (e, t) => d(t) === "eu" ? e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e : e, p = (e) => {
133
+ if (!e || typeof e != "string") return {};
134
+ let t = e.split(".");
135
+ if (t.length < 2) return {};
136
+ try {
137
+ 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;
138
+ return {
139
+ participantCode: o(a.participant_code),
140
+ platformName: o(a.platform_name),
141
+ platformCode: o(i.platform_code),
142
+ region: o(a.region)
143
+ };
144
+ } catch {
145
+ return {};
146
+ }
147
+ }, m = (e, t, n) => e[f(t, n)] ?? e[t] ?? e.prod, h = (e, t, n) => e[f(t, n)] ?? e[t], g = () => void 0, _ = () => {
148
+ let e = /* @__PURE__ */ new Uint8Array(8);
149
+ return globalThis.crypto.getRandomValues(e), Array.from(e, (e) => e.toString(16).padStart(2, "0")).join("");
150
+ }, v = (e, t) => {
151
+ let n = _(), r = globalThis.__ZH_WEB_SDK_VERSION__, i = {};
152
+ 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), {
153
+ sessionId: n,
154
+ payload: {
155
+ meta: {
156
+ app: {
157
+ name: e.appName,
158
+ version: t ?? "unknown",
159
+ environment: e.env
160
+ },
161
+ session: {
162
+ id: n,
163
+ attributes: i
164
+ },
165
+ browser: typeof navigator < "u" ? { userAgent: navigator.userAgent } : void 0,
166
+ page: typeof window < "u" ? { url: window.location.origin } : void 0
167
+ },
168
+ logs: [{
169
+ message: `Failed to load the script for ${e.webComponentTag} from ${e.env} environment.`,
170
+ level: "error",
171
+ timestamp: (/* @__PURE__ */ new Date()).toISOString(),
172
+ context: {
173
+ web_component: e.webComponentTag,
174
+ script_url: e.scriptUrl,
175
+ reason: e.reason,
176
+ tried_fallback: String(e.triedFallback),
177
+ elapsed_ms: String(e.elapsedMs)
178
+ }
179
+ }]
180
+ }
181
+ };
182
+ }, y = (e, t, n) => {
183
+ if (!e || typeof fetch > "u") return;
184
+ let { sessionId: r, payload: i } = v(t, n);
185
+ try {
186
+ fetch(e, {
187
+ method: "POST",
188
+ headers: {
189
+ "Content-Type": "application/json",
190
+ "x-faro-session-id": r
191
+ },
192
+ body: JSON.stringify(i),
193
+ keepalive: !0
194
+ }).catch(() => void 0);
195
+ } catch {}
196
+ }, b = (e) => {
197
+ let { webComponentTag: t, appName: n, appVersion: r, scriptUrls: i, fallbackScriptUrls: a, collectorUrls: o, env: s, jwt: c, timeoutMs: l = 15e3, onLoad: u, onError: d } = e;
198
+ if (typeof document > "u") return g;
199
+ let f = `${t}-script-${s}`;
200
+ if (customElements.get(t) || document.getElementById(f)) return g;
201
+ let _ = p(c), v = e.report ?? ((e) => y(o && h(o, s, c), e, r)), b = !1, x = 0, S, C = () => {
202
+ S !== void 0 && clearTimeout(S);
203
+ }, w = (e, r, i) => {
204
+ if (b) return;
205
+ let o = Math.round(performance.now() - x), l = {
206
+ webComponentTag: t,
207
+ appName: n,
208
+ env: s,
209
+ scriptUrl: r,
210
+ reason: e,
211
+ triedFallback: i,
212
+ elapsedMs: o,
213
+ claims: _
214
+ };
215
+ v(l);
216
+ let u = i ? void 0 : m(a ?? {}, s, c);
217
+ if (u && u !== r) {
218
+ T(u, !0);
219
+ return;
220
+ }
221
+ b = !0, C(), document.getElementById(f)?.remove(), d?.(l);
222
+ }, T = (e, n) => {
223
+ C(), x = performance.now();
224
+ let r = document.createElement("script");
225
+ r.id = f, r.src = e, r.type = "module", r.async = !0, r.onload = () => {
226
+ setTimeout(() => {
227
+ b || (customElements.get(t) ? (b = !0, C(), u?.()) : w("not-defined", e, n));
228
+ }, 0);
229
+ }, r.onerror = () => w("network", e, n), S = setTimeout(() => w("timeout", e, n), l), document.getElementById(f)?.remove(), document.head.appendChild(r);
230
+ }, E = m(i, s, c);
231
+ return E ? (T(E, !1), () => {
232
+ b = !0, C();
233
+ }) : g;
185
234
  };
186
- var F;
235
+ ({
236
+ BASE_URL: "/",
237
+ DEV: !1,
238
+ MODE: "production",
239
+ PROD: !0,
240
+ SSR: !1,
241
+ VITE_ASSETS_SERVICE_URL: "http://localhost:5173/assets",
242
+ VITE_CONNECT_API_BASE_URL: "/api/v1",
243
+ VITE_CONNECT_ENV: "local",
244
+ VITE_CONNECT_SDK_API_BASE_URL: "/sdk/v1",
245
+ VITE_DYNAMIC_ENVIRONMENT_ID: "38ce0330-c85e-414a-80b4-6129c548018f",
246
+ VITE_FARO_COLLECTOR_URL: "https://grafana-faro-collector.dev.0hash.com/collect",
247
+ VITE_FEATURE_SERVER_PROXY_URL: "https://ff-edge.dev.0hash.com/api/frontend",
248
+ VITE_INTERNAL_BUILD: "false",
249
+ VITE_ONBOARDING_API_BASE_URL: "/onboarding",
250
+ VITE_POST_MESSAGE_COMMUNICATION_PLATFORMS: "UW6VWU",
251
+ VITE_REDIRECT_HANDLER_URL: "http://localhost:4202/redirect-handler/index.html",
252
+ VITE_SCRAPER_EXTENSION_ID_CHROMIUM: "kofibejdfkmnbobmbogndbiimkflcllf",
253
+ VITE_TRADE_API_BASE_URL: "/trade",
254
+ VITE_UNLEASH_APIKEY: "zerohash-sdk:dev.b0d8aa594e9b94564f885167881bcb9dc69332f935fcb253e656ff34"
255
+ }).VITE_LOCAL_CDN_HOST, {
256
+ LOADED: "travel_rule_loaded",
257
+ COMPLETED: "travel_rule_completed"
258
+ }.LOADED;
259
+ //#endregion
260
+ //#region ../../../common/callbacks/dist/shared/models.js
261
+ var x;
187
262
  (function(e) {
188
- 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";
189
- })(F || (F = {}));
190
- const Q = (e) => {
191
- const { webComponentTag: t, appName: o, appVersion: n, scriptUrls: r, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: u } = e, [b, m] = N(!1), [g, R] = N(0);
192
- I(() => (m(!1), q({
193
- webComponentTag: t,
194
- appName: o ?? t,
195
- appVersion: n,
196
- scriptUrls: r,
197
- fallbackScriptUrls: i,
198
- collectorUrls: c ?? P,
199
- env: a,
200
- jwt: s,
201
- timeoutMs: u,
202
- onError: () => m(!0)
203
- })), [
204
- t,
205
- o,
206
- n,
207
- r,
208
- i,
209
- c,
210
- a,
211
- s,
212
- u,
213
- g
214
- ]);
215
- const x = j(() => R((f) => f + 1), []);
216
- return { loadFailed: b, retry: x };
217
- }, X = {
218
- sandbox: "https://sdk.sandbox.connect.xyz/auth-web/index.js",
219
- production: "https://sdk.connect.xyz/auth-web/index.js"
220
- }, B = "connect-auth", Y = X, oe = ({
221
- jwt: e,
222
- env: t = "production",
223
- theme: o,
224
- onError: n,
225
- onClose: r,
226
- onDeposit: i,
227
- onEvent: c,
228
- onLoaded: a,
229
- ...s
230
- }) => {
231
- const u = M(null);
232
- D(u, { theme: o, onError: n, onClose: r, onDeposit: i, onEvent: c, onLoaded: a });
233
- const { loadFailed: b, retry: m } = Q({
234
- webComponentTag: B,
235
- scriptUrls: Y,
236
- env: t,
237
- jwt: e
238
- });
239
- return b ? /* @__PURE__ */ d(
240
- V,
241
- {
242
- onRetry: m,
243
- onClose: r
244
- }
245
- ) : A.createElement(B, {
246
- ref: u,
247
- jwt: e,
248
- env: t,
249
- theme: o,
250
- ...s
251
- });
252
- };
253
- export {
254
- oe as Auth
263
+ 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";
264
+ })(x ||= {});
265
+ //#endregion
266
+ //#region ../../../common/react-sdk-base/dist/use-web-component-script.js
267
+ var S = (e) => {
268
+ let { webComponentTag: t, appName: n, appVersion: a, scriptUrls: s, fallbackScriptUrls: c, collectorUrls: l, env: d, jwt: f, timeoutMs: p } = e, [m, h] = o(!1), [g, _] = o(0);
269
+ return i(() => (h(!1), b({
270
+ webComponentTag: t,
271
+ appName: n ?? t,
272
+ appVersion: a,
273
+ scriptUrls: s,
274
+ fallbackScriptUrls: c,
275
+ collectorUrls: l ?? u,
276
+ env: d,
277
+ jwt: f,
278
+ timeoutMs: p,
279
+ onError: () => h(!0)
280
+ })), [
281
+ t,
282
+ n,
283
+ a,
284
+ s,
285
+ c,
286
+ l,
287
+ d,
288
+ f,
289
+ p,
290
+ g
291
+ ]), {
292
+ loadFailed: m,
293
+ retry: r(() => _((e) => e + 1), [])
294
+ };
295
+ }, C = {
296
+ sandbox: "https://sdk.sandbox.connect.xyz/auth-web/index.js",
297
+ production: "https://sdk.connect.xyz/auth-web/index.js"
298
+ }, w = "connect-auth", T = C, E = ({ jwt: t, env: r = "production", theme: i, onError: o, onClose: s, onDeposit: u, onEvent: d, onLoaded: f, ...p }) => {
299
+ let m = a(null);
300
+ l(m, {
301
+ theme: i,
302
+ onError: o,
303
+ onClose: s,
304
+ onDeposit: u,
305
+ onEvent: d,
306
+ onLoaded: f
307
+ });
308
+ let { loadFailed: h, retry: g } = S({
309
+ webComponentTag: w,
310
+ scriptUrls: T,
311
+ env: r,
312
+ jwt: t
313
+ });
314
+ return h ? /* @__PURE__ */ e(c, {
315
+ onRetry: g,
316
+ onClose: s
317
+ }) : n.createElement(w, {
318
+ ref: m,
319
+ jwt: t,
320
+ env: r,
321
+ theme: i,
322
+ ...p
323
+ });
255
324
  };
325
+ //#endregion
326
+ export { E as Auth };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@connect-xyz/auth-react",
3
- "version": "0.84.4",
3
+ "version": "0.84.5",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",