@zerohash-sdk/csp-fiat-withdrawals-react 0.13.3 → 0.13.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 +53 -53
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { jsxs as U, jsx as d } from "react/jsx-runtime";
2
- import M, { useEffect as A, useState as L, useCallback as j, useRef as D } from "react";
3
- const $ = {
2
+ import D, { useEffect as B, 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
- }, I = (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(".");
@@ -43,10 +43,10 @@ const $ = {
43
43
  }, z = (e, t, o) => {
44
44
  const r = I(t, o);
45
45
  return e[r] ?? e[t] ?? e.prod;
46
- }, H = (e, t, o) => {
46
+ }, P = (e, t, o) => {
47
47
  const r = I(t, o);
48
48
  return e[r] ?? e[t];
49
- }, C = () => {
49
+ }, O = () => {
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,20 +91,20 @@ const $ = {
91
91
  } catch {
92
92
  }
93
93
  }, Z = (e) => {
94
- const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: a, fallbackScriptUrls: s, collectorUrls: c, env: n, jwt: i, timeoutMs: f = 15e3, onLoad: _, onError: g } = e;
94
+ const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: a, fallbackScriptUrls: s, collectorUrls: c, env: n, jwt: i, timeoutMs: f = 15e3, onLoad: b, onError: g } = e;
95
95
  if (typeof document > "u")
96
- return C;
96
+ return O;
97
97
  const h = `${t}-script-${n}`;
98
98
  if (customElements.get(t) || document.getElementById(h))
99
- return C;
100
- const S = P(i), k = e.report ?? ((p) => K(c && H(c, n, i), p, r));
101
- let m = !1, O = 0, v;
99
+ return O;
100
+ const S = H(i), k = e.report ?? ((p) => K(c && P(c, n, i), p, r));
101
+ let m = !1, x = 0, v;
102
102
  const R = () => {
103
103
  v !== void 0 && clearTimeout(v);
104
- }, w = (p, y, l) => {
104
+ }, C = (p, y, l) => {
105
105
  if (m)
106
106
  return;
107
- const W = Math.round(performance.now() - O), E = {
107
+ const W = Math.round(performance.now() - x), E = {
108
108
  webComponentTag: t,
109
109
  appName: o,
110
110
  env: n,
@@ -115,36 +115,36 @@ const $ = {
115
115
  claims: S
116
116
  };
117
117
  k(E);
118
- const x = l ? void 0 : z(s ?? {}, n, i);
119
- if (x && x !== y) {
120
- N(x, !0);
118
+ const w = l ? void 0 : z(s ?? {}, n, i);
119
+ if (w && w !== y) {
120
+ T(w, !0);
121
121
  return;
122
122
  }
123
123
  m = !0, R(), document.getElementById(h)?.remove(), g?.(E);
124
- }, N = (p, y) => {
125
- R(), O = performance.now();
124
+ }, T = (p, y) => {
125
+ R(), x = performance.now();
126
126
  const l = document.createElement("script");
127
127
  l.id = h, l.src = p, l.type = "module", l.async = !0, l.onload = () => {
128
128
  setTimeout(() => {
129
- m || (customElements.get(t) ? (m = !0, R(), _?.()) : w("not-defined", p, y));
129
+ m || (customElements.get(t) ? (m = !0, R(), b?.()) : C("not-defined", p, y));
130
130
  }, 0);
131
- }, l.onerror = () => w("network", p, y), v = setTimeout(() => w("timeout", p, y), f), document.getElementById(h)?.remove(), document.head.appendChild(l);
132
- }, T = z(a, n, i);
133
- return T ? (N(T, !1), () => {
131
+ }, l.onerror = () => C("network", p, y), v = setTimeout(() => C("timeout", p, y), f), document.getElementById(h)?.remove(), document.head.appendChild(l);
132
+ }, N = z(a, n, i);
133
+ return N ? (T(N, !1), () => {
134
134
  m = !0, R();
135
- }) : C;
136
- }, u = {
137
- local: "http://localhost:5173",
135
+ }) : O;
136
+ }, q = {}, Q = typeof import.meta < "u" && q?.VITE_LOCAL_CDN_HOST || "http://localhost:5173", u = {
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: a = !1, local: s = u.local } = o, c = (i) => `${i}/${e}/${t}`, n = {
145
145
  local: c(s),
146
146
  dev: c(u.dev),
147
- gating: c(q),
147
+ gating: c(X),
148
148
  cert: c(u.cert),
149
149
  prod: c(u.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 }) => U("div", { role: "alert", style: {
162
+ }, ee = ({ onRetry: e, onClose: t }) => U("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 && d("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: 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: b.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: {
188
+ }, 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: _.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: {
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
- A(() => {
199
+ }, children: "Try again" })] }), te = (e, t) => {
200
+ B(() => {
201
201
  const o = e.current;
202
202
  if (o)
203
203
  for (const [r, a] of Object.entries(t))
204
204
  a !== void 0 && (o[r] = a);
205
205
  });
206
- }, ee = (e) => {
207
- const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: a, fallbackScriptUrls: s, collectorUrls: c, env: n, jwt: i, timeoutMs: f } = e, [_, g] = L(!1), [h, S] = L(0);
208
- A(() => (g(!1), Z({
206
+ }, oe = (e) => {
207
+ const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: a, fallbackScriptUrls: s, collectorUrls: c, env: n, jwt: i, timeoutMs: f } = e, [b, g] = L(!1), [h, S] = L(0);
208
+ B(() => (g(!1), Z({
209
209
  webComponentTag: t,
210
210
  appName: o ?? t,
211
211
  appVersion: r,
212
212
  scriptUrls: a,
213
213
  fallbackScriptUrls: s,
214
- collectorUrls: c ?? $,
214
+ collectorUrls: c ?? V,
215
215
  env: n,
216
216
  jwt: i,
217
217
  timeoutMs: f,
@@ -228,9 +228,9 @@ const b = {
228
228
  f,
229
229
  h
230
230
  ]);
231
- const k = j(() => S((m) => m + 1), []);
232
- return { loadFailed: _, retry: k };
233
- }, te = Q("csp-fiat-withdrawals-web", "index.js", { eu: !0 }), B = "zerohash-csp-fiat-withdrawals", ne = ({
231
+ const k = M(() => S((m) => m + 1), []);
232
+ return { loadFailed: b, retry: k };
233
+ }, re = Y("csp-fiat-withdrawals-web", "index.js", { eu: !0 }), A = "zerohash-csp-fiat-withdrawals", ce = ({
234
234
  jwt: e,
235
235
  env: t = "prod",
236
236
  theme: o,
@@ -241,21 +241,21 @@ const b = {
241
241
  onEvent: n,
242
242
  ...i
243
243
  }) => {
244
- const f = D(null);
245
- Y(f, { theme: o, onCompleted: r, onError: a, onClose: s, onLoaded: c, onEvent: n });
246
- const { loadFailed: _, retry: g } = ee({
247
- webComponentTag: B,
248
- scriptUrls: te,
244
+ const f = j(null);
245
+ te(f, { theme: o, onCompleted: r, onError: a, onClose: s, onLoaded: c, onEvent: n });
246
+ const { loadFailed: b, retry: g } = oe({
247
+ webComponentTag: A,
248
+ scriptUrls: re,
249
249
  env: t,
250
250
  jwt: e
251
251
  });
252
- return _ ? /* @__PURE__ */ d(
253
- X,
252
+ return b ? /* @__PURE__ */ d(
253
+ ee,
254
254
  {
255
255
  onRetry: g,
256
256
  onClose: s
257
257
  }
258
- ) : M.createElement(B, {
258
+ ) : D.createElement(A, {
259
259
  ref: f,
260
260
  jwt: e,
261
261
  env: t,
@@ -264,5 +264,5 @@ const b = {
264
264
  });
265
265
  };
266
266
  export {
267
- ne as CspFiatWithdrawals
267
+ ce as CspFiatWithdrawals
268
268
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerohash-sdk/csp-fiat-withdrawals-react",
3
- "version": "0.13.3",
3
+ "version": "0.13.4",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",