@zerohash-sdk/csp-crypto-withdrawals-react 1.15.12 → 1.15.14

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.
Files changed (2) hide show
  1. package/dist/index.js +62 -60
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -9,24 +9,26 @@ var s = {
9
9
  "eu-prod": "https://grafana-faro-collector.zerohash.eu/collect",
10
10
  sandbox: "https://grafana-faro-collector.cert.zerohash.com/collect",
11
11
  production: "https://grafana-faro-collector.zerohash.com/collect"
12
- }, c = (e) => {
12
+ }, c = (e) => typeof e == "object" && !!e && !Array.isArray(e), l = (e) => {
13
13
  if (!e || typeof e != "string") return null;
14
14
  let t = e.split(".");
15
15
  if (t.length < 2) return null;
16
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;
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), a = c(i) ? i.payload : void 0, o = c(a) ? a.region : void 0;
18
+ if (typeof o != "string") return null;
19
+ let s = o.toLowerCase();
20
+ return s === "us" || s === "eu" ? s : null;
21
21
  } catch {
22
22
  return null;
23
23
  }
24
- }, l = (e, t) => c(t) === "eu" ? e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e : e, u = (e) => {
24
+ }, u = (e, t) => l(t) === "eu" ? e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e : e, d = (e) => {
25
25
  if (!e || typeof e != "string") return {};
26
26
  let t = e.split(".");
27
27
  if (t.length < 2) return {};
28
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;
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);
30
+ if (!c(i)) return {};
31
+ let a = c(i.payload) ? i.payload : {}, o = (e) => typeof e == "string" && e.length > 0 ? e : void 0;
30
32
  return {
31
33
  participantCode: o(a.participant_code),
32
34
  platformName: o(a.platform_name),
@@ -36,12 +38,12 @@ var s = {
36
38
  } catch {
37
39
  return {};
38
40
  }
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 = () => {
41
+ }, f = (e, t, n) => e[u(t, n)] ?? e[t] ?? e.prod, p = (e, t, n) => e[u(t, n)] ?? e[t], m = () => void 0, h = () => {
40
42
  let e = /* @__PURE__ */ new Uint8Array(8);
41
43
  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), {
44
+ }, g = (e, t) => {
45
+ let n = h(), r = Reflect.get(globalThis, "__ZH_WEB_SDK_VERSION__"), i = typeof r == "string" ? r : void 0, a = {};
46
+ return e.claims.participantCode && (a.participant_code = e.claims.participantCode), e.claims.platformName && (a.platform_name = e.claims.platformName), e.claims.platformCode && (a.platform_code = e.claims.platformCode), e.claims.region && (a.region = e.claims.region), i && (a.zh_web_sdk_version = i), {
45
47
  sessionId: n,
46
48
  payload: {
47
49
  meta: {
@@ -52,7 +54,7 @@ var s = {
52
54
  },
53
55
  session: {
54
56
  id: n,
55
- attributes: i
57
+ attributes: a
56
58
  },
57
59
  browser: typeof navigator < "u" ? { userAgent: navigator.userAgent } : void 0,
58
60
  page: typeof window < "u" ? { url: window.location.origin } : void 0
@@ -71,9 +73,9 @@ var s = {
71
73
  }]
72
74
  }
73
75
  };
74
- }, g = (e, t, n) => {
76
+ }, _ = (e, t, n) => {
75
77
  if (!e || typeof fetch > "u") return;
76
- let { sessionId: r, payload: i } = h(t, n);
78
+ let { sessionId: r, payload: i } = g(t, n);
77
79
  try {
78
80
  fetch(e, {
79
81
  method: "POST",
@@ -85,12 +87,12 @@ var s = {
85
87
  keepalive: !0
86
88
  }).catch(() => void 0);
87
89
  } 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 = () => {
90
+ }, v = (e) => {
91
+ let { webComponentTag: t, appName: n, appVersion: r, scriptUrls: i, fallbackScriptUrls: a, collectorUrls: o, env: s, jwt: c, timeoutMs: l = 15e3, onLoad: u, onError: h } = e;
92
+ if (typeof document > "u") return m;
93
+ let g = `${t}-script-${s}`;
94
+ if (customElements.get(t) || document.getElementById(g)) return m;
95
+ let v = d(c), y = e.report ?? ((e) => _(o && p(o, s, c), e, r)), b = !1, x = 0, S, C = () => {
94
96
  S !== void 0 && clearTimeout(S);
95
97
  }, w = (e, r, i) => {
96
98
  if (b) return;
@@ -105,25 +107,25 @@ var s = {
105
107
  claims: v
106
108
  };
107
109
  y(l);
108
- let u = i ? void 0 : d(a ?? {}, s, c);
110
+ let u = i ? void 0 : f(a ?? {}, s, c);
109
111
  if (u && u !== r) {
110
112
  T(u, !0);
111
113
  return;
112
114
  }
113
- b = !0, C(), document.getElementById(_)?.remove(), h?.(l);
115
+ b = !0, C(), document.getElementById(g)?.remove(), h?.(l);
114
116
  }, T = (e, n) => {
115
117
  C(), x = performance.now();
116
118
  let r = document.createElement("script");
117
- r.id = _, r.src = e, r.type = "module", r.async = !0, r.onload = () => {
119
+ r.id = g, r.src = e, r.type = "module", r.async = !0, r.addEventListener("load", () => {
118
120
  setTimeout(() => {
119
- b || (customElements.get(t) ? (b = !0, C(), m?.()) : w("not-defined", e, n));
121
+ b || (customElements.get(t) ? (b = !0, C(), u?.()) : w("not-defined", e, n));
120
122
  }, 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
+ }), r.addEventListener("error", () => w("network", e, n)), S = setTimeout(() => w("timeout", e, n), l), document.getElementById(g)?.remove(), document.head.appendChild(r);
124
+ }, E = f(i, s, c);
123
125
  return E ? (T(E, !1), () => {
124
126
  b = !0, C();
125
- }) : p;
126
- }, v = {
127
+ }) : m;
128
+ }, y = {
127
129
  local: {
128
130
  BASE_URL: "/",
129
131
  DEV: !1,
@@ -150,34 +152,34 @@ var s = {
150
152
  prod: "https://sdk-cdn.zerohash.com",
151
153
  "eu-cert": "https://sdk-cdn.cert.zerohash.eu",
152
154
  "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
+ }, b = "https://sdk-cdn.gating.0hash.com", x = (e, t, n = {}) => {
156
+ let { eu: r = !1, legacyAliases: i = !1, local: a = y.local } = n, o = (n) => `${n}/${e}/${t}`, s = {
155
157
  local: o(a),
156
- dev: o(v.dev),
157
- gating: o(y),
158
- cert: o(v.cert),
159
- prod: o(v.prod)
158
+ dev: o(y.dev),
159
+ gating: o(b),
160
+ cert: o(y.cert),
161
+ prod: o(y.prod)
160
162
  };
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;
163
+ return i && (s.sandbox = o(y.cert), s.production = o(y.prod)), r && (s["eu-cert"] = o(y["eu-cert"]), s["eu-prod"] = o(y["eu-prod"])), s;
162
164
  };
163
- [...Object.entries(v).filter(([e]) => e !== "local").map(([, e]) => e)], {
165
+ [...Object.entries(y).filter(([e]) => e !== "local").map(([, e]) => e)], {
164
166
  LOADED: "travel_rule_loaded",
165
167
  COMPLETED: "travel_rule_completed"
166
168
  }.LOADED;
167
169
  //#endregion
168
170
  //#region ../../../common/callbacks/dist/shared/models.js
169
- var x;
171
+ var S;
170
172
  (function(e) {
171
173
  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 ||= {});
174
+ })(S ||= {});
173
175
  //#endregion
174
176
  //#region ../../../common/react-sdk-base/dist/script-load-fallback.js
175
- var S = {
177
+ var C = {
176
178
  evergreen: "#00381D",
177
179
  green: "#CCFFD0",
178
180
  offBlack: "#1C1B1C",
179
181
  grayLight: "#EBEBE9"
180
- }, C = ({ onRetry: n, onClose: r }) => t("div", {
182
+ }, w = ({ onRetry: n, onClose: r }) => t("div", {
181
183
  role: "alert",
182
184
  style: {
183
185
  position: "relative",
@@ -190,9 +192,9 @@ var S = {
190
192
  padding: "32px 24px",
191
193
  textAlign: "center",
192
194
  fontFamily: "inherit",
193
- color: S.offBlack,
195
+ color: C.offBlack,
194
196
  background: "#FFFFFF",
195
- border: `1px solid ${S.grayLight}`,
197
+ border: `1px solid ${C.grayLight}`,
196
198
  borderRadius: "12px"
197
199
  },
198
200
  children: [
@@ -206,7 +208,7 @@ var S = {
206
208
  right: "12px",
207
209
  display: "flex",
208
210
  padding: "4px",
209
- color: S.offBlack,
211
+ color: C.offBlack,
210
212
  background: "none",
211
213
  border: "none",
212
214
  cursor: "pointer",
@@ -235,7 +237,7 @@ var S = {
235
237
  "aria-hidden": "true",
236
238
  children: e("path", {
237
239
  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,
240
+ stroke: C.evergreen,
239
241
  strokeWidth: "1.5",
240
242
  strokeLinecap: "round",
241
243
  strokeLinejoin: "round"
@@ -266,8 +268,8 @@ var S = {
266
268
  fontSize: "14px",
267
269
  fontWeight: 600,
268
270
  fontFamily: "inherit",
269
- color: S.green,
270
- background: S.evergreen,
271
+ color: C.green,
272
+ background: C.evergreen,
271
273
  border: "none",
272
274
  borderRadius: "8px",
273
275
  cursor: "pointer"
@@ -275,14 +277,14 @@ var S = {
275
277
  children: "Try again"
276
278
  })
277
279
  ]
278
- }), w = (e, t) => {
280
+ }), T = (e, t) => {
279
281
  i(() => {
280
282
  let n = e.current;
281
- if (n) for (let [e, r] of Object.entries(t)) r !== void 0 && (n[e] = r);
283
+ if (n) for (let [e, r] of Object.entries(t)) r !== void 0 && Reflect.set(n, e, r);
282
284
  });
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), _({
285
+ }, E = (e) => {
286
+ 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, _] = o(0);
287
+ return i(() => (h(!1), v({
286
288
  webComponentTag: t,
287
289
  appName: n ?? t,
288
290
  appVersion: a,
@@ -306,11 +308,11 @@ var S = {
306
308
  g
307
309
  ]), {
308
310
  loadFailed: m,
309
- retry: r(() => v((e) => e + 1), [])
311
+ retry: r(() => _((e) => e + 1), [])
310
312
  };
311
- }, E = b("csp-crypto-withdrawals-web", "index.js", { eu: !0 }), D = "zerohash-csp-crypto-withdrawals", O = ({ jwt: t, env: r = "prod", theme: i, onCompleted: o, onError: s, onClose: c, onLoaded: l, onEvent: u, ...d }) => {
313
+ }, D = x("csp-crypto-withdrawals-web", "index.js", { eu: !0 }), O = "zerohash-csp-crypto-withdrawals", k = ({ jwt: t, env: r = "prod", theme: i, onCompleted: o, onError: s, onClose: c, onLoaded: l, onEvent: u, ...d }) => {
312
314
  let f = a(null);
313
- w(f, {
315
+ T(f, {
314
316
  theme: i,
315
317
  onCompleted: o,
316
318
  onError: s,
@@ -318,16 +320,16 @@ var S = {
318
320
  onLoaded: l,
319
321
  onEvent: u
320
322
  });
321
- let { loadFailed: p, retry: m } = T({
322
- webComponentTag: D,
323
- scriptUrls: E,
323
+ let { loadFailed: p, retry: m } = E({
324
+ webComponentTag: O,
325
+ scriptUrls: D,
324
326
  env: r,
325
327
  jwt: t
326
328
  });
327
- return p ? /* @__PURE__ */ e(C, {
329
+ return p ? /* @__PURE__ */ e(w, {
328
330
  onRetry: m,
329
331
  onClose: c
330
- }) : n.createElement(D, {
332
+ }) : n.createElement(O, {
331
333
  ref: f,
332
334
  jwt: t,
333
335
  env: r,
@@ -336,4 +338,4 @@ var S = {
336
338
  });
337
339
  };
338
340
  //#endregion
339
- export { O as CspCryptoWithdrawals };
341
+ export { k as CspCryptoWithdrawals };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerohash-sdk/csp-crypto-withdrawals-react",
3
- "version": "1.15.12",
3
+ "version": "1.15.14",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",