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