@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 +25 -0
- package/dist/index.js +323 -252
- package/package.json +1 -1
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 {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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
|
-
|
|
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
|
-
|
|
189
|
-
})(
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
},
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
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 };
|