@zerohash-sdk/fund-react 1.9.0 → 1.9.1

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 CHANGED
@@ -210,6 +210,8 @@ declare interface FundProps {
210
210
  * @param data - Details about the failed transaction (transactionId, fundId, amount…)
211
211
  */
212
212
  onFailed?: (data: FundCompletedData) => void;
213
+ /** Invoked when the user taps "Provide info" on the travel-rule pending screen; open the Travel Rule SDK scoped to `depositId`. */
214
+ onProvideInfo?: (data: FundProvideInfoData) => void;
213
215
  /**
214
216
  * Callback invoked when an error occurs during the fund flow.
215
217
  *
@@ -266,6 +268,10 @@ declare interface FundProps {
266
268
  onEvent?: (event: FundEvent) => void;
267
269
  }
268
270
 
271
+ declare type FundProvideInfoData = {
272
+ depositId: string;
273
+ };
274
+
269
275
  /**
270
276
  * Theme mode for the Connect Fund interface.
271
277
  *
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsxs as W, jsx as y } from "react/jsx-runtime";
1
+ import { jsxs as W, jsx as _ } from "react/jsx-runtime";
2
2
  import j, { useEffect as B, useState as z, useCallback as D, useRef as M } from "react";
3
3
  const $ = {
4
4
  dev: "https://grafana-faro-collector.dev.0hash.com/collect",
@@ -91,49 +91,49 @@ 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: m = 15e3, onLoad: _, onError: g } = e;
94
+ const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: n, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: m = 15e3, onLoad: b, onError: g } = e;
95
95
  if (typeof document > "u")
96
96
  return x;
97
- const d = `${t}-script-${a}`;
98
- if (customElements.get(t) || document.getElementById(d))
97
+ const p = `${t}-script-${a}`;
98
+ if (customElements.get(t) || document.getElementById(p))
99
99
  return x;
100
- const b = J(s), R = e.report ?? ((p) => G(c && P(c, a, s), p, r));
101
- let f = !1, w = 0, C;
100
+ const h = J(s), R = e.report ?? ((u) => G(c && P(c, a, s), u, r));
101
+ let d = !1, w = 0, C;
102
102
  const v = () => {
103
103
  C !== void 0 && clearTimeout(C);
104
- }, k = (p, h, l) => {
105
- if (f)
104
+ }, k = (u, y, l) => {
105
+ if (d)
106
106
  return;
107
107
  const U = Math.round(performance.now() - w), T = {
108
108
  webComponentTag: t,
109
109
  appName: o,
110
110
  env: a,
111
- scriptUrl: h,
112
- reason: p,
111
+ scriptUrl: y,
112
+ reason: u,
113
113
  triedFallback: l,
114
114
  elapsedMs: U,
115
- claims: b
115
+ claims: h
116
116
  };
117
117
  R(T);
118
118
  const O = l ? void 0 : F(i ?? {}, a, s);
119
- if (O && O !== h) {
119
+ if (O && O !== y) {
120
120
  E(O, !0);
121
121
  return;
122
122
  }
123
- f = !0, v(), document.getElementById(d)?.remove(), g?.(T);
124
- }, E = (p, h) => {
123
+ d = !0, v(), document.getElementById(p)?.remove(), g?.(T);
124
+ }, E = (u, y) => {
125
125
  v(), w = performance.now();
126
126
  const l = document.createElement("script");
127
- l.id = d, l.src = p, l.type = "module", l.async = !0, l.onload = () => {
127
+ l.id = p, l.src = u, l.type = "module", l.async = !0, l.onload = () => {
128
128
  setTimeout(() => {
129
- f || (customElements.get(t) ? (f = !0, v(), _?.()) : k("not-defined", p, h));
129
+ d || (customElements.get(t) ? (d = !0, v(), b?.()) : k("not-defined", u, y));
130
130
  }, 0);
131
- }, l.onerror = () => k("network", p, h), C = setTimeout(() => k("timeout", p, h), m), document.getElementById(d)?.remove(), document.head.appendChild(l);
131
+ }, l.onerror = () => k("network", u, y), C = setTimeout(() => k("timeout", u, y), m), document.getElementById(p)?.remove(), document.head.appendChild(l);
132
132
  }, N = F(n, a, s);
133
133
  return N ? (E(N, !1), () => {
134
- f = !0, v();
134
+ d = !0, v();
135
135
  }) : x;
136
- }, u = {
136
+ }, f = {
137
137
  local: "http://localhost:5173",
138
138
  dev: "https://sdk-cdn.dev.0hash.com",
139
139
  cert: "https://sdk-cdn.cert.zerohash.com",
@@ -141,13 +141,13 @@ const $ = {
141
141
  "eu-cert": "https://sdk-cdn.cert.zerohash.eu",
142
142
  "eu-prod": "https://sdk-cdn.zerohash.eu"
143
143
  }, q = (e, t, o = {}) => {
144
- const { eu: r = !1, legacyAliases: n = !1, local: i = u.local } = o, c = (s) => `${s}/${e}/${t}`, a = {
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
- dev: c(u.dev),
147
- cert: c(u.cert),
148
- prod: c(u.prod)
146
+ dev: c(f.dev),
147
+ cert: c(f.cert),
148
+ prod: c(f.prod)
149
149
  };
150
- return n && (a.sandbox = c(u.cert), a.production = c(u.prod)), r && (a["eu-cert"] = c(u["eu-cert"]), a["eu-prod"] = c(u["eu-prod"])), a;
150
+ return n && (a.sandbox = c(f.cert), a.production = c(f.prod)), r && (a["eu-cert"] = c(f["eu-cert"]), a["eu-prod"] = c(f["eu-prod"])), a;
151
151
  };
152
152
  var L;
153
153
  (function(e) {
@@ -172,7 +172,7 @@ const S = {
172
172
  background: "#FFFFFF",
173
173
  border: `1px solid ${S.grayLight}`,
174
174
  borderRadius: "12px"
175
- }, children: [y("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: y("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: S.evergreen, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), y("p", { style: { margin: 0, fontSize: "16px", fontWeight: 600 }, children: "Something went wrong" }), y("p", { style: { margin: 0, fontSize: "14px", opacity: 0.75 }, children: "We couldn't load this content. Please check your internet connection and try again." }), y("button", { type: "button", onClick: e, style: {
175
+ }, children: [_("svg", { width: "32", height: "32", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: _("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: S.evergreen, strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" }) }), _("p", { style: { margin: 0, fontSize: "16px", fontWeight: 600 }, children: "Something went wrong" }), _("p", { style: { margin: 0, fontSize: "14px", opacity: 0.75 }, children: "We couldn't load this content. Please check your internet connection and try again." }), _("button", { type: "button", onClick: e, style: {
176
176
  marginTop: "8px",
177
177
  padding: "8px 20px",
178
178
  fontSize: "14px",
@@ -191,7 +191,7 @@ const S = {
191
191
  n !== void 0 && (o[r] = n);
192
192
  });
193
193
  }, Y = (e) => {
194
- const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: n, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: m } = e, [_, g] = z(!1), [d, b] = z(0);
194
+ const { webComponentTag: t, appName: o, appVersion: r, scriptUrls: n, fallbackScriptUrls: i, collectorUrls: c, env: a, jwt: s, timeoutMs: m } = e, [b, g] = z(!1), [p, h] = z(0);
195
195
  B(() => (g(!1), Z({
196
196
  webComponentTag: t,
197
197
  appName: o ?? t,
@@ -213,10 +213,10 @@ const S = {
213
213
  a,
214
214
  s,
215
215
  m,
216
- d
216
+ p
217
217
  ]);
218
- const R = D(() => b((f) => f + 1), []);
219
- return { loadFailed: _, retry: R };
218
+ const R = D(() => h((d) => d + 1), []);
219
+ return { loadFailed: b, retry: R };
220
220
  }, ee = q("fund-web", "index.js", { eu: !0 }), A = "zerohash-fund", re = ({
221
221
  jwt: e,
222
222
  env: t = "prod",
@@ -225,28 +225,40 @@ const S = {
225
225
  isPay: n = !1,
226
226
  onCompleted: i,
227
227
  onFailed: c,
228
- onError: a,
229
- onClose: s,
230
- onLoaded: m,
231
- onEvent: _,
232
- ...g
228
+ onProvideInfo: a,
229
+ onError: s,
230
+ onClose: m,
231
+ onLoaded: b,
232
+ onEvent: g,
233
+ ...p
233
234
  }) => {
234
- const d = M(null);
235
- X(d, { isPay: n, theme: o, branding: r, onCompleted: i, onFailed: c, onError: a, onClose: s, onLoaded: m, onEvent: _ });
236
- const { loadFailed: b, retry: R } = Y({
235
+ const h = M(null);
236
+ X(h, {
237
+ isPay: n,
238
+ theme: o,
239
+ branding: r,
240
+ onCompleted: i,
241
+ onFailed: c,
242
+ onProvideInfo: a,
243
+ onError: s,
244
+ onClose: m,
245
+ onLoaded: b,
246
+ onEvent: g
247
+ });
248
+ const { loadFailed: R, retry: d } = Y({
237
249
  webComponentTag: A,
238
250
  scriptUrls: ee,
239
251
  // fallbackScriptUrls: FALLBACK_SCRIPT_URLS, // enable once the host is confirmed (AUTH-3095)
240
252
  env: t,
241
253
  jwt: e
242
254
  });
243
- return b ? /* @__PURE__ */ y(Q, { onRetry: R }) : j.createElement(A, {
244
- ref: d,
255
+ return R ? /* @__PURE__ */ _(Q, { onRetry: d }) : j.createElement(A, {
256
+ ref: h,
245
257
  jwt: e,
246
258
  env: t,
247
259
  theme: o,
248
260
  ispay: n ? "true" : void 0,
249
- ...g
261
+ ...p
250
262
  });
251
263
  };
252
264
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zerohash-sdk/fund-react",
3
- "version": "1.9.0",
3
+ "version": "1.9.1",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",