@zerohash-sdk/travel-rule-react 0.7.2 → 0.7.4

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 +55 -55
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsxs as A, jsx as p } from "react/jsx-runtime";
2
- import M, { useEffect as I, useState as L, useCallback as j, useRef as D } from "react";
3
- const $ = {
1
+ import { jsxs as W, jsx as p } from "react/jsx-runtime";
2
+ import D, { useEffect as A, useState as L, useCallback as M, useRef as j } from "react";
3
+ const V = {
4
4
  dev: "https://grafana-faro-collector.dev.0hash.com/collect",
5
5
  cert: "https://grafana-faro-collector.cert.zerohash.com/collect",
6
6
  prod: "https://grafana-faro-collector.zerohash.com/collect",
@@ -8,7 +8,7 @@ const $ = {
8
8
  "eu-prod": "https://grafana-faro-collector.zerohash.eu/collect",
9
9
  sandbox: "https://grafana-faro-collector.cert.zerohash.com/collect",
10
10
  production: "https://grafana-faro-collector.zerohash.com/collect"
11
- }, V = (e) => {
11
+ }, $ = (e) => {
12
12
  if (!e || typeof e != "string")
13
13
  return null;
14
14
  const t = e.split(".");
@@ -23,7 +23,7 @@ const $ = {
23
23
  } catch {
24
24
  return null;
25
25
  }
26
- }, U = (e, t) => V(t) !== "eu" ? e : e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e, P = (e) => {
26
+ }, I = (e, t) => $(t) !== "eu" ? e : e === "cert" ? "eu-cert" : e === "prod" ? "eu-prod" : e, H = (e) => {
27
27
  if (!e || typeof e != "string")
28
28
  return {};
29
29
  const t = e.split(".");
@@ -41,12 +41,12 @@ const $ = {
41
41
  return {};
42
42
  }
43
43
  }, z = (e, t, o) => {
44
- const r = U(t, o);
44
+ const r = I(t, o);
45
45
  return e[r] ?? e[t] ?? e.prod;
46
- }, H = (e, t, o) => {
47
- const r = U(t, o);
46
+ }, P = (e, t, o) => {
47
+ const r = I(t, o);
48
48
  return e[r] ?? e[t];
49
- }, O = () => {
49
+ }, x = () => {
50
50
  }, J = () => {
51
51
  const e = new Uint8Array(8);
52
52
  return globalThis.crypto.getRandomValues(e), Array.from(e, (t) => t.toString(16).padStart(2, "0")).join("");
@@ -91,60 +91,60 @@ const $ = {
91
91
  } catch {
92
92
  }
93
93
  }, Z = (e) => {
94
- const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: n, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: g = 15e3, onLoad: _, onError: h } = e;
94
+ const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: n, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: g = 15e3, onLoad: b, onError: h } = e;
95
95
  if (typeof document > "u")
96
- return O;
96
+ return x;
97
97
  const d = `${t}-script-${a}`;
98
98
  if (customElements.get(t) || document.getElementById(d))
99
- return O;
100
- const R = P(s), v = e.report ?? ((u) => K(c && H(c, a, s), u, r));
99
+ return x;
100
+ const R = H(s), v = e.report ?? ((u) => K(c && P(c, a, s), u, r));
101
101
  let m = !1, T = 0, k;
102
102
  const S = () => {
103
103
  k !== void 0 && clearTimeout(k);
104
- }, x = (u, y, l) => {
104
+ }, C = (u, y, l) => {
105
105
  if (m)
106
106
  return;
107
- const W = Math.round(performance.now() - T), E = {
107
+ const U = Math.round(performance.now() - T), E = {
108
108
  webComponentTag: t,
109
109
  appName: o,
110
110
  env: a,
111
111
  scriptUrl: y,
112
112
  reason: u,
113
113
  triedFallback: l,
114
- elapsedMs: W,
114
+ elapsedMs: U,
115
115
  claims: R
116
116
  };
117
117
  v(E);
118
- const C = l ? void 0 : z(i ?? {}, a, s);
119
- if (C && C !== y) {
120
- w(C, !0);
118
+ const O = l ? void 0 : z(i ?? {}, a, s);
119
+ if (O && O !== y) {
120
+ N(O, !0);
121
121
  return;
122
122
  }
123
123
  m = !0, S(), document.getElementById(d)?.remove(), h?.(E);
124
- }, w = (u, y) => {
124
+ }, N = (u, y) => {
125
125
  S(), T = performance.now();
126
126
  const l = document.createElement("script");
127
127
  l.id = d, l.src = u, l.type = "module", l.async = !0, l.onload = () => {
128
128
  setTimeout(() => {
129
- m || (customElements.get(t) ? (m = !0, S(), _?.()) : x("not-defined", u, y));
129
+ m || (customElements.get(t) ? (m = !0, S(), b?.()) : C("not-defined", u, y));
130
130
  }, 0);
131
- }, l.onerror = () => x("network", u, y), k = setTimeout(() => x("timeout", u, y), g), document.getElementById(d)?.remove(), document.head.appendChild(l);
132
- }, N = z(n, a, s);
133
- return N ? (w(N, !1), () => {
131
+ }, l.onerror = () => C("network", u, y), k = setTimeout(() => C("timeout", u, y), g), document.getElementById(d)?.remove(), document.head.appendChild(l);
132
+ }, w = z(n, a, s);
133
+ return w ? (N(w, !1), () => {
134
134
  m = !0, S();
135
- }) : O;
136
- }, f = {
137
- local: "http://localhost:5173",
135
+ }) : x;
136
+ }, q = {}, Q = typeof import.meta < "u" && q?.VITE_LOCAL_CDN_HOST || "http://localhost:5173", f = {
137
+ local: Q,
138
138
  dev: "https://sdk-cdn.dev.0hash.com",
139
139
  cert: "https://sdk-cdn.cert.zerohash.com",
140
140
  prod: "https://sdk-cdn.zerohash.com",
141
141
  "eu-cert": "https://sdk-cdn.cert.zerohash.eu",
142
142
  "eu-prod": "https://sdk-cdn.zerohash.eu"
143
- }, q = "https://sdk-cdn.gating.0hash.com", Q = (e, t, o = {}) => {
143
+ }, X = "https://sdk-cdn.gating.0hash.com", Y = (e, t, o = {}) => {
144
144
  const { eu: r = !1, legacyAliases: n = !1, local: i = f.local } = o, c = (s) => `${s}/${e}/${t}`, a = {
145
145
  local: c(i),
146
146
  dev: c(f.dev),
147
- gating: c(q),
147
+ gating: c(X),
148
148
  cert: c(f.cert),
149
149
  prod: c(f.prod)
150
150
  };
@@ -154,12 +154,12 @@ var F;
154
154
  (function(e) {
155
155
  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";
156
156
  })(F || (F = {}));
157
- const b = {
157
+ const _ = {
158
158
  evergreen: "#00381D",
159
159
  green: "#CCFFD0",
160
160
  offBlack: "#1C1B1C",
161
161
  grayLight: "#EBEBE9"
162
- }, X = ({ onRetry: e, onClose: t }) => A("div", { role: "alert", style: {
162
+ }, ee = ({ onRetry: e, onClose: t }) => W("div", { role: "alert", style: {
163
163
  position: "relative",
164
164
  display: "flex",
165
165
  flexDirection: "column",
@@ -170,9 +170,9 @@ const b = {
170
170
  padding: "32px 24px",
171
171
  textAlign: "center",
172
172
  fontFamily: "inherit",
173
- color: b.offBlack,
173
+ color: _.offBlack,
174
174
  background: "#FFFFFF",
175
- border: `1px solid ${b.grayLight}`,
175
+ border: `1px solid ${_.grayLight}`,
176
176
  borderRadius: "12px"
177
177
  }, children: [t && p("button", { type: "button", onClick: t, "aria-label": "Close", style: {
178
178
  position: "absolute",
@@ -180,38 +180,38 @@ const b = {
180
180
  right: "12px",
181
181
  display: "flex",
182
182
  padding: "4px",
183
- color: b.offBlack,
183
+ color: _.offBlack,
184
184
  background: "none",
185
185
  border: "none",
186
186
  cursor: "pointer",
187
187
  lineHeight: 0
188
- }, children: p("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: p("path", { d: "M18 6L6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), p("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: p("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: b.evergreen, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), p("p", { style: { margin: 0, fontSize: "16px", fontWeight: 600 }, children: "Something went wrong" }), p("p", { style: { margin: 0, fontSize: "14px", opacity: 0.75 }, children: "We couldn't load this content. Please check your internet connection and try again." }), p("button", { type: "button", onClick: e, style: {
188
+ }, children: p("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: p("path", { d: "M18 6L6 18M6 6l12 12", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), p("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: p("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: _.evergreen, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), p("p", { style: { margin: 0, fontSize: "16px", fontWeight: 600 }, children: "Something went wrong" }), p("p", { style: { margin: 0, fontSize: "14px", opacity: 0.75 }, children: "We couldn't load this content. Please check your internet connection and try again." }), p("button", { type: "button", onClick: e, style: {
189
189
  marginTop: "8px",
190
190
  padding: "8px 20px",
191
191
  fontSize: "14px",
192
192
  fontWeight: 600,
193
193
  fontFamily: "inherit",
194
- color: b.green,
195
- background: b.evergreen,
194
+ color: _.green,
195
+ background: _.evergreen,
196
196
  border: "none",
197
197
  borderRadius: "8px",
198
198
  cursor: "pointer"
199
- }, children: "Try again" })] }), Y = (e, t) => {
200
- I(() => {
199
+ }, children: "Try again" })] }), te = (e, t) => {
200
+ A(() => {
201
201
  const o = e.current;
202
202
  if (o)
203
203
  for (const [r, n] of Object.entries(t))
204
204
  n !== void 0 && (o[r] = n);
205
205
  });
206
- }, ee = (e) => {
207
- const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: n, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: g } = e, [_, h] = L(!1), [d, R] = L(0);
208
- I(() => (h(!1), Z({
206
+ }, oe = (e) => {
207
+ const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: n, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: g } = e, [b, h] = L(!1), [d, R] = L(0);
208
+ A(() => (h(!1), Z({
209
209
  webComponentTag: t,
210
210
  appName: o ?? t,
211
211
  appVersion: r,
212
212
  scriptUrls: n,
213
213
  fallbackScriptUrls: i,
214
- collectorUrls: c ?? $,
214
+ collectorUrls: c ?? V,
215
215
  env: a,
216
216
  jwt: s,
217
217
  timeoutMs: g,
@@ -228,9 +228,9 @@ const b = {
228
228
  g,
229
229
  d
230
230
  ]);
231
- const v = j(() => R((m) => m + 1), []);
232
- return { loadFailed: _, retry: v };
233
- }, te = Q("travel-rule-web", "index.js", { eu: !0 }), B = "zerohash-travel-rule", ne = ({
231
+ const v = M(() => R((m) => m + 1), []);
232
+ return { loadFailed: b, retry: v };
233
+ }, re = Y("travel-rule-web", "index.js", { eu: !0 }), B = "zerohash-travel-rule", ce = ({
234
234
  jwt: e,
235
235
  depositId: t,
236
236
  walletAddress: o,
@@ -241,11 +241,11 @@ const b = {
241
241
  onError: a,
242
242
  onClose: s,
243
243
  onLoaded: g,
244
- onEvent: _,
244
+ onEvent: b,
245
245
  ...h
246
246
  }) => {
247
- const d = D(null);
248
- Y(d, {
247
+ const d = j(null);
248
+ te(d, {
249
249
  theme: i,
250
250
  depositId: t,
251
251
  walletAddress: o,
@@ -254,21 +254,21 @@ const b = {
254
254
  onError: a,
255
255
  onClose: s,
256
256
  onLoaded: g,
257
- onEvent: _
257
+ onEvent: b
258
258
  });
259
- const { loadFailed: R, retry: v } = ee({
259
+ const { loadFailed: R, retry: v } = oe({
260
260
  webComponentTag: B,
261
- scriptUrls: te,
261
+ scriptUrls: re,
262
262
  env: n,
263
263
  jwt: e
264
264
  });
265
265
  return R ? /* @__PURE__ */ p(
266
- X,
266
+ ee,
267
267
  {
268
268
  onRetry: v,
269
269
  onClose: s
270
270
  }
271
- ) : M.createElement(B, {
271
+ ) : D.createElement(B, {
272
272
  ref: d,
273
273
  jwt: e,
274
274
  env: n,
@@ -284,5 +284,5 @@ const b = {
284
284
  });
285
285
  };
286
286
  export {
287
- ne as TravelRule
287
+ ce as TravelRule
288
288
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerohash-sdk/travel-rule-react",
3
- "version": "0.7.2",
3
+ "version": "0.7.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",