@w3payments/react 1.1.1 → 1.1.3
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.js +7 -7
- package/dist/index.mjs +158 -155
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import './assets/main.css';var Re = Object.defineProperty, Oe = Object.defineProperties;
|
|
2
2
|
var Le = Object.getOwnPropertyDescriptors;
|
|
3
|
-
var
|
|
3
|
+
var Te = Object.getOwnPropertySymbols;
|
|
4
4
|
var Be = Object.prototype.hasOwnProperty, je = Object.prototype.propertyIsEnumerable;
|
|
5
|
-
var re = (n, e, o) => e in n ? Re(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o,
|
|
5
|
+
var re = (n, e, o) => e in n ? Re(n, e, { enumerable: !0, configurable: !0, writable: !0, value: o }) : n[e] = o, f = (n, e) => {
|
|
6
6
|
for (var o in e || (e = {}))
|
|
7
7
|
Be.call(e, o) && re(n, o, e[o]);
|
|
8
|
-
if (
|
|
9
|
-
for (var o of
|
|
8
|
+
if (Te)
|
|
9
|
+
for (var o of Te(e))
|
|
10
10
|
je.call(e, o) && re(n, o, e[o]);
|
|
11
11
|
return n;
|
|
12
|
-
},
|
|
12
|
+
}, N = (n, e) => Oe(n, Le(e));
|
|
13
13
|
var g = (n, e, o) => re(n, typeof e != "symbol" ? e + "" : e, o);
|
|
14
14
|
var S = (n, e, o) => new Promise((t, r) => {
|
|
15
15
|
var i = (d) => {
|
|
@@ -27,12 +27,12 @@ var S = (n, e, o) => new Promise((t, r) => {
|
|
|
27
27
|
}, l = (d) => d.done ? t(d.value) : Promise.resolve(d.value).then(i, a);
|
|
28
28
|
l((o = o.apply(n, e)).next());
|
|
29
29
|
});
|
|
30
|
-
import He, { createContext as Xe, useMemo as me, useEffect as Ve, useContext as
|
|
30
|
+
import He, { createContext as Xe, useMemo as me, useEffect as Ve, useContext as Ge, useState as ee, Children as We, isValidElement as ae } from "react";
|
|
31
31
|
var q = { exports: {} }, _ = {};
|
|
32
|
-
var
|
|
32
|
+
var De;
|
|
33
33
|
function Ze() {
|
|
34
|
-
if (
|
|
35
|
-
|
|
34
|
+
if (De) return _;
|
|
35
|
+
De = 1;
|
|
36
36
|
var n = Symbol.for("react.transitional.element"), e = Symbol.for("react.fragment");
|
|
37
37
|
function o(t, r, i) {
|
|
38
38
|
var a = null;
|
|
@@ -52,13 +52,13 @@ function Ze() {
|
|
|
52
52
|
return _.Fragment = e, _.jsx = o, _.jsxs = o, _;
|
|
53
53
|
}
|
|
54
54
|
var $ = {};
|
|
55
|
-
var
|
|
55
|
+
var ke;
|
|
56
56
|
function ze() {
|
|
57
|
-
return
|
|
57
|
+
return ke || (ke = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
58
58
|
function n(s) {
|
|
59
59
|
if (s == null) return null;
|
|
60
60
|
if (typeof s == "function")
|
|
61
|
-
return s.$$typeof ===
|
|
61
|
+
return s.$$typeof === P ? null : s.displayName || s.name || null;
|
|
62
62
|
if (typeof s == "string") return s;
|
|
63
63
|
switch (s) {
|
|
64
64
|
case T:
|
|
@@ -82,7 +82,7 @@ function ze() {
|
|
|
82
82
|
return "Portal";
|
|
83
83
|
case M:
|
|
84
84
|
return s.displayName || "Context";
|
|
85
|
-
case
|
|
85
|
+
case G:
|
|
86
86
|
return (s._context.displayName || "Context") + ".Consumer";
|
|
87
87
|
case K:
|
|
88
88
|
var p = s.render;
|
|
@@ -110,11 +110,11 @@ function ze() {
|
|
|
110
110
|
}
|
|
111
111
|
if (p) {
|
|
112
112
|
p = console;
|
|
113
|
-
var h = p.error,
|
|
113
|
+
var h = p.error, v = typeof Symbol == "function" && Symbol.toStringTag && s[Symbol.toStringTag] || s.constructor.name || "Object";
|
|
114
114
|
return h.call(
|
|
115
115
|
p,
|
|
116
116
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
117
|
-
|
|
117
|
+
v
|
|
118
118
|
), e(s);
|
|
119
119
|
}
|
|
120
120
|
}
|
|
@@ -161,15 +161,15 @@ function ze() {
|
|
|
161
161
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
162
162
|
)), s = this.props.ref, s !== void 0 ? s : null;
|
|
163
163
|
}
|
|
164
|
-
function u(s, p, h,
|
|
165
|
-
var
|
|
164
|
+
function u(s, p, h, v, J, ce) {
|
|
165
|
+
var y = h.ref;
|
|
166
166
|
return s = {
|
|
167
167
|
$$typeof: x,
|
|
168
168
|
type: s,
|
|
169
169
|
key: p,
|
|
170
170
|
props: h,
|
|
171
|
-
_owner:
|
|
172
|
-
}, (
|
|
171
|
+
_owner: v
|
|
172
|
+
}, (y !== void 0 ? y : null) !== null ? Object.defineProperty(s, "ref", {
|
|
173
173
|
enumerable: !1,
|
|
174
174
|
get: d
|
|
175
175
|
}) : Object.defineProperty(s, "ref", { enumerable: !1, value: null }), s._store = {}, Object.defineProperty(s._store, "validated", {
|
|
@@ -194,61 +194,61 @@ function ze() {
|
|
|
194
194
|
value: ce
|
|
195
195
|
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
198
|
-
var
|
|
199
|
-
if (
|
|
200
|
-
if (
|
|
201
|
-
if (se(
|
|
202
|
-
for (
|
|
203
|
-
|
|
204
|
-
Object.freeze && Object.freeze(
|
|
197
|
+
function U(s, p, h, v, J, ce) {
|
|
198
|
+
var y = p.children;
|
|
199
|
+
if (y !== void 0)
|
|
200
|
+
if (v)
|
|
201
|
+
if (se(y)) {
|
|
202
|
+
for (v = 0; v < y.length; v++)
|
|
203
|
+
w(y[v]);
|
|
204
|
+
Object.freeze && Object.freeze(y);
|
|
205
205
|
} else
|
|
206
206
|
console.error(
|
|
207
207
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
208
208
|
);
|
|
209
|
-
else
|
|
209
|
+
else w(y);
|
|
210
210
|
if (z.call(p, "key")) {
|
|
211
|
-
|
|
212
|
-
var
|
|
211
|
+
y = n(s);
|
|
212
|
+
var W = Object.keys(p).filter(function(Pe) {
|
|
213
213
|
return Pe !== "key";
|
|
214
214
|
});
|
|
215
|
-
|
|
215
|
+
v = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", ye[y + v] || (W = 0 < W.length ? "{" + W.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
216
216
|
`A props object containing a "key" prop is being spread into JSX:
|
|
217
217
|
let props = %s;
|
|
218
218
|
<%s {...props} />
|
|
219
219
|
React keys must be passed directly to JSX without using spread:
|
|
220
220
|
let props = %s;
|
|
221
221
|
<%s key={someKey} {...props} />`,
|
|
222
|
-
f,
|
|
223
222
|
v,
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
223
|
+
y,
|
|
224
|
+
W,
|
|
225
|
+
y
|
|
226
|
+
), ye[y + v] = !0);
|
|
227
227
|
}
|
|
228
|
-
if (
|
|
228
|
+
if (y = null, h !== void 0 && (o(h), y = "" + h), a(p) && (o(p.key), y = "" + p.key), "key" in p) {
|
|
229
229
|
h = {};
|
|
230
230
|
for (var ie in p)
|
|
231
231
|
ie !== "key" && (h[ie] = p[ie]);
|
|
232
232
|
} else h = p;
|
|
233
|
-
return
|
|
233
|
+
return y && l(
|
|
234
234
|
h,
|
|
235
235
|
typeof s == "function" ? s.displayName || s.name || "Unknown" : s
|
|
236
236
|
), u(
|
|
237
237
|
s,
|
|
238
|
-
|
|
238
|
+
y,
|
|
239
239
|
h,
|
|
240
240
|
r(),
|
|
241
241
|
J,
|
|
242
242
|
ce
|
|
243
243
|
);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
245
|
+
function w(s) {
|
|
246
246
|
C(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === B && (s._payload.status === "fulfilled" ? C(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
|
|
247
247
|
}
|
|
248
248
|
function C(s) {
|
|
249
249
|
return typeof s == "object" && s !== null && s.$$typeof === x;
|
|
250
250
|
}
|
|
251
|
-
var E = He, x = Symbol.for("react.transitional.element"), R = Symbol.for("react.portal"), T = Symbol.for("react.fragment"), I = Symbol.for("react.strict_mode"), ne = Symbol.for("react.profiler"),
|
|
251
|
+
var E = He, x = Symbol.for("react.transitional.element"), R = Symbol.for("react.portal"), T = Symbol.for("react.fragment"), I = Symbol.for("react.strict_mode"), ne = Symbol.for("react.profiler"), G = Symbol.for("react.consumer"), M = Symbol.for("react.context"), K = Symbol.for("react.forward_ref"), D = Symbol.for("react.suspense"), L = Symbol.for("react.suspense_list"), te = Symbol.for("react.memo"), B = Symbol.for("react.lazy"), A = Symbol.for("react.activity"), P = Symbol.for("react.client.reference"), Z = E.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, z = Object.prototype.hasOwnProperty, se = Array.isArray, F = console.createTask ? console.createTask : function() {
|
|
252
252
|
return null;
|
|
253
253
|
};
|
|
254
254
|
E = {
|
|
@@ -259,33 +259,33 @@ React keys must be passed directly to JSX without using spread:
|
|
|
259
259
|
var Y, m = {}, b = E.react_stack_bottom_frame.bind(
|
|
260
260
|
E,
|
|
261
261
|
i
|
|
262
|
-
)(), k = F(t(i)),
|
|
262
|
+
)(), k = F(t(i)), ye = {};
|
|
263
263
|
$.Fragment = T, $.jsx = function(s, p, h) {
|
|
264
|
-
var
|
|
265
|
-
return
|
|
264
|
+
var v = 1e4 > Z.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return U(
|
|
266
266
|
s,
|
|
267
267
|
p,
|
|
268
268
|
h,
|
|
269
269
|
!1,
|
|
270
|
-
|
|
271
|
-
|
|
270
|
+
v ? Error("react-stack-top-frame") : b,
|
|
271
|
+
v ? F(t(s)) : k
|
|
272
272
|
);
|
|
273
273
|
}, $.jsxs = function(s, p, h) {
|
|
274
|
-
var
|
|
275
|
-
return
|
|
274
|
+
var v = 1e4 > Z.recentlyCreatedOwnerStacks++;
|
|
275
|
+
return U(
|
|
276
276
|
s,
|
|
277
277
|
p,
|
|
278
278
|
h,
|
|
279
279
|
!0,
|
|
280
|
-
|
|
281
|
-
|
|
280
|
+
v ? Error("react-stack-top-frame") : b,
|
|
281
|
+
v ? F(t(s)) : k
|
|
282
282
|
);
|
|
283
283
|
};
|
|
284
284
|
})()), $;
|
|
285
285
|
}
|
|
286
|
-
var
|
|
286
|
+
var Se;
|
|
287
287
|
function Fe() {
|
|
288
|
-
return
|
|
288
|
+
return Se || (Se = 1, process.env.NODE_ENV === "production" ? q.exports = Ze() : q.exports = ze()), q.exports;
|
|
289
289
|
}
|
|
290
290
|
var c = Fe();
|
|
291
291
|
const H = class H {
|
|
@@ -431,17 +431,13 @@ const H = class H {
|
|
|
431
431
|
const o = this.getCryptoPaymentMethods().filter(
|
|
432
432
|
(r) => r.method === "wallet"
|
|
433
433
|
);
|
|
434
|
-
|
|
435
|
-
const t = o.filter((r) => {
|
|
434
|
+
return e ? o.filter((r) => {
|
|
436
435
|
var d;
|
|
437
436
|
const i = !((d = e.currencies) != null && d.length) || e.currencies.some(
|
|
438
437
|
(u) => r.currency.toLowerCase() === u.toLowerCase()
|
|
439
|
-
), a = (!e.targetCurrency || r.currency.toLowerCase() === e.targetCurrency.toLowerCase()) && (!e.targetNetwork || r.network.toLowerCase() === e.targetNetwork.toLowerCase())
|
|
440
|
-
return
|
|
441
|
-
|
|
442
|
-
), l;
|
|
443
|
-
});
|
|
444
|
-
return console.log("getWalletMethods: Filtered result:", t.length), t;
|
|
438
|
+
), a = (!e.targetCurrency || r.currency.toLowerCase() === e.targetCurrency.toLowerCase()) && (!e.targetNetwork || r.network.toLowerCase() === e.targetNetwork.toLowerCase());
|
|
439
|
+
return i && a;
|
|
440
|
+
}) : o;
|
|
445
441
|
}
|
|
446
442
|
/**
|
|
447
443
|
* Get exchange payment methods with optional exchange and target filters
|
|
@@ -476,23 +472,16 @@ const H = class H {
|
|
|
476
472
|
getDisplayOptions(e) {
|
|
477
473
|
var t, r, i;
|
|
478
474
|
const o = [];
|
|
479
|
-
return
|
|
480
|
-
|
|
481
|
-
e == null ? void 0 : e.walletFilter
|
|
482
|
-
), (t = e == null ? void 0 : e.walletFilter) == null || t.forEach((a) => {
|
|
483
|
-
console.log(`getDisplayOptions: Processing wallet currency: ${a}`);
|
|
484
|
-
const l = this.getWalletMethods({
|
|
475
|
+
return (t = e == null ? void 0 : e.walletFilter) == null || t.forEach((a) => {
|
|
476
|
+
this.getWalletMethods({
|
|
485
477
|
currencies: [a],
|
|
486
478
|
targetCurrency: e.targetCurrency,
|
|
487
479
|
targetNetwork: e.targetNetwork
|
|
488
|
-
})
|
|
489
|
-
console.log(
|
|
490
|
-
`getDisplayOptions: Found ${l.length} wallet methods for ${a}`
|
|
491
|
-
), l.length > 0 && (o.push({
|
|
480
|
+
}).length > 0 && o.push({
|
|
492
481
|
id: `wallet-${a.toLowerCase()}`,
|
|
493
482
|
displayName: a,
|
|
494
483
|
method: "wallet"
|
|
495
|
-
})
|
|
484
|
+
});
|
|
496
485
|
}), (r = e == null ? void 0 : e.exchangeFilter) == null || r.forEach((a) => {
|
|
497
486
|
this.getExchangeMethods({
|
|
498
487
|
exchanges: [a],
|
|
@@ -521,7 +510,7 @@ const H = class H {
|
|
|
521
510
|
};
|
|
522
511
|
g(H, "instance");
|
|
523
512
|
let be = H;
|
|
524
|
-
const
|
|
513
|
+
const Ue = be.getInstance(), X = class X {
|
|
525
514
|
constructor() {
|
|
526
515
|
g(this, "currencies", /* @__PURE__ */ new Map());
|
|
527
516
|
g(this, "supportedCurrencies", {
|
|
@@ -635,7 +624,7 @@ const Se = be.getInstance(), X = class X {
|
|
|
635
624
|
};
|
|
636
625
|
g(X, "instance");
|
|
637
626
|
let ge = X;
|
|
638
|
-
const
|
|
627
|
+
const ue = ge.getInstance(), V = class V {
|
|
639
628
|
constructor() {
|
|
640
629
|
g(this, "networks", /* @__PURE__ */ new Map());
|
|
641
630
|
}
|
|
@@ -692,8 +681,8 @@ const we = ge.getInstance(), V = class V {
|
|
|
692
681
|
}
|
|
693
682
|
};
|
|
694
683
|
g(V, "instance");
|
|
695
|
-
let
|
|
696
|
-
const
|
|
684
|
+
let he = V;
|
|
685
|
+
const we = he.getInstance(), le = /* @__PURE__ */ new Map();
|
|
697
686
|
function Ye(n, e = !1) {
|
|
698
687
|
const o = `${n}-${e}`;
|
|
699
688
|
return le.has(o) || le.set(
|
|
@@ -744,7 +733,7 @@ function Je(n) {
|
|
|
744
733
|
const e = Ke();
|
|
745
734
|
switch (n) {
|
|
746
735
|
case "dark":
|
|
747
|
-
return
|
|
736
|
+
return N(f({}, e), {
|
|
748
737
|
colorPrimary: "#6366f1",
|
|
749
738
|
colorPrimaryHover: "#7c3aed",
|
|
750
739
|
colorPrimaryLight: "#1e1b4b",
|
|
@@ -761,7 +750,7 @@ function Je(n) {
|
|
|
761
750
|
}
|
|
762
751
|
function qe(n, e) {
|
|
763
752
|
var i;
|
|
764
|
-
const o = typeof n == "string" ? { theme: n } : n, t = Je((i = o.theme) != null ? i : "light"), r =
|
|
753
|
+
const o = typeof n == "string" ? { theme: n } : n, t = Je((i = o.theme) != null ? i : "light"), r = f(f({}, t), o.variables);
|
|
765
754
|
Object.entries(r).forEach(([a, l]) => {
|
|
766
755
|
if (l !== void 0) {
|
|
767
756
|
const d = `--${Ee(a)}`;
|
|
@@ -866,7 +855,7 @@ const so = {
|
|
|
866
855
|
"coinbase-pro": "https://assets.coincap.io/assets/icons/256/coinbase.png",
|
|
867
856
|
"binance-us": "https://assets.coincap.io/assets/icons/256/binance.png"
|
|
868
857
|
};
|
|
869
|
-
function
|
|
858
|
+
function Ne(n) {
|
|
870
859
|
return so[n.toLowerCase()];
|
|
871
860
|
}
|
|
872
861
|
const co = {
|
|
@@ -885,7 +874,7 @@ const co = {
|
|
|
885
874
|
bank: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMgN1YxN0gyMVY3SDNaTTQgOEgyMFYxNkg0VjhaTTYgMTBWMTRIOVYxMEg2Wk0xMCAxMFYxMUgxOFYxMEgxMFpNMTAgMTJWMTNIMTVWMTJIMTBaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
|
|
886
875
|
other: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDhDMTMuMSA4IDE0IDcuMSAxNCA2UzEzLjEgNCAxMiA0IDEwIDQuOSAxMCA2UzEwLjkgOCAxMiA4Wk0xMiAxMEMxMC45IDEwIDEwIDEwLjkgMTAgMTJTMTAuOSAxNCAxMiAxNFMxNCAxMy4xIDE0IDEyUzEzLjEgMTAgMTIgMTBaTTEyIDE2QzEwLjkgMTYgMTAgMTYuOSAxMCAxOFMxMC45IDIwIDEyIDIwUzE0IDE5LjEgMTQgMThTMTMuMSAxNiAxMiAxNloiIGZpbGw9ImN1cnJlbnRDb2xvciIvPgo8L3N2Zz4K"
|
|
887
876
|
};
|
|
888
|
-
function
|
|
877
|
+
function xe(n) {
|
|
889
878
|
return co[n.toLowerCase()];
|
|
890
879
|
}
|
|
891
880
|
var io = {
|
|
@@ -4499,22 +4488,38 @@ var bo = class {
|
|
|
4499
4488
|
return S(this, null, function* () {
|
|
4500
4489
|
if (!this.config)
|
|
4501
4490
|
throw new Error("Adapter not initialized");
|
|
4502
|
-
const e =
|
|
4491
|
+
const e = ue.getCurrency(n.currency), o = (e == null ? void 0 : e.type) === "fiat";
|
|
4492
|
+
if (console.log("MeshPay createCheckoutSession:", {
|
|
4493
|
+
currency: n.currency,
|
|
4494
|
+
amount: n.amount,
|
|
4495
|
+
currencyType: e == null ? void 0 : e.type,
|
|
4496
|
+
isFiatCurrency: o,
|
|
4497
|
+
destinations: n.destinations
|
|
4498
|
+
}), o && n.currency !== "USD")
|
|
4499
|
+
throw new Error(
|
|
4500
|
+
`MeshPay adapter only supports USD as fiat currency, received: ${n.currency}`
|
|
4501
|
+
);
|
|
4502
|
+
const t = {
|
|
4503
4503
|
userId: n.customerId,
|
|
4504
4504
|
configurationId: this.config.configurationId,
|
|
4505
4505
|
restrictMultipleAccounts: !0,
|
|
4506
|
-
transferOptions: {
|
|
4507
|
-
toAddresses: n.destinations.map((
|
|
4508
|
-
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
|
|
4512
|
-
|
|
4506
|
+
transferOptions: N(f({
|
|
4507
|
+
toAddresses: n.destinations.map((a) => {
|
|
4508
|
+
const l = this.getNetworkIdFromName(a.networkId);
|
|
4509
|
+
return f({
|
|
4510
|
+
networkId: l,
|
|
4511
|
+
symbol: a.symbol,
|
|
4512
|
+
address: a.address
|
|
4513
|
+
}, !o && { amount: n.amount });
|
|
4514
|
+
})
|
|
4515
|
+
}, o && { amountInFiat: n.amount }), {
|
|
4513
4516
|
isInclusiveFeeEnabled: !1,
|
|
4514
4517
|
generatePayLink: !1
|
|
4515
|
-
},
|
|
4518
|
+
}),
|
|
4516
4519
|
disableApiKeyGeneration: !1
|
|
4517
|
-
}
|
|
4520
|
+
};
|
|
4521
|
+
console.log("MeshPay linkTokenRequest:", JSON.stringify(t, null, 2));
|
|
4522
|
+
const r = yield globalThis.fetch(
|
|
4518
4523
|
`${this.config.baseUrl}/api/v1/linktoken`,
|
|
4519
4524
|
{
|
|
4520
4525
|
method: "POST",
|
|
@@ -4523,21 +4528,21 @@ var bo = class {
|
|
|
4523
4528
|
"X-Client-Id": this.config.clientId,
|
|
4524
4529
|
"X-Client-Secret": this.config.clientSecret
|
|
4525
4530
|
},
|
|
4526
|
-
body: JSON.stringify(
|
|
4531
|
+
body: JSON.stringify(t)
|
|
4527
4532
|
}
|
|
4528
4533
|
);
|
|
4529
|
-
if (!
|
|
4530
|
-
const
|
|
4534
|
+
if (!r.ok) {
|
|
4535
|
+
const a = yield r.text();
|
|
4531
4536
|
throw new Error(
|
|
4532
|
-
`LinkToken generation failed: ${
|
|
4537
|
+
`LinkToken generation failed: ${r.status} ${a}`
|
|
4533
4538
|
);
|
|
4534
4539
|
}
|
|
4535
|
-
const
|
|
4536
|
-
if (
|
|
4540
|
+
const i = yield r.json();
|
|
4541
|
+
if (i.status !== "ok")
|
|
4537
4542
|
throw new Error(
|
|
4538
|
-
`MeshPay API error: ${
|
|
4543
|
+
`MeshPay API error: ${i.message || "Unknown error"}`
|
|
4539
4544
|
);
|
|
4540
|
-
return
|
|
4545
|
+
return i.content;
|
|
4541
4546
|
});
|
|
4542
4547
|
}
|
|
4543
4548
|
/**
|
|
@@ -4553,11 +4558,9 @@ var bo = class {
|
|
|
4553
4558
|
return new Promise((o, t) => {
|
|
4554
4559
|
e({
|
|
4555
4560
|
clientId: n.metadata.clientId,
|
|
4556
|
-
onIntegrationConnected: (
|
|
4557
|
-
console.log("MeshPay integration connected:", i);
|
|
4561
|
+
onIntegrationConnected: () => {
|
|
4558
4562
|
},
|
|
4559
4563
|
onTransferFinished: (i) => {
|
|
4560
|
-
console.log("MeshPay transfer finished:", i);
|
|
4561
4564
|
const a = i.status === "success";
|
|
4562
4565
|
o({
|
|
4563
4566
|
id: n.id,
|
|
@@ -4578,7 +4581,7 @@ var bo = class {
|
|
|
4578
4581
|
});
|
|
4579
4582
|
},
|
|
4580
4583
|
onExit: (i) => {
|
|
4581
|
-
|
|
4584
|
+
i ? t(new Error(`MeshPay error: ${i.message || i}`)) : o({
|
|
4582
4585
|
id: n.id,
|
|
4583
4586
|
status: "cancelled",
|
|
4584
4587
|
data: {
|
|
@@ -4761,12 +4764,12 @@ class Ce {
|
|
|
4761
4764
|
return o && this.adapters.size === 0 && (this.initialized = !1), o;
|
|
4762
4765
|
}
|
|
4763
4766
|
}
|
|
4764
|
-
class
|
|
4767
|
+
class fe {
|
|
4765
4768
|
constructor(e) {
|
|
4766
4769
|
g(this, "registry");
|
|
4767
|
-
g(this, "currencyService",
|
|
4768
|
-
g(this, "networkService",
|
|
4769
|
-
g(this, "paymentMethodService",
|
|
4770
|
+
g(this, "currencyService", ue);
|
|
4771
|
+
g(this, "networkService", we);
|
|
4772
|
+
g(this, "paymentMethodService", Ue);
|
|
4770
4773
|
g(this, "options");
|
|
4771
4774
|
g(this, "clientMode", !1);
|
|
4772
4775
|
/**
|
|
@@ -4799,7 +4802,7 @@ class he {
|
|
|
4799
4802
|
currency: e.currency,
|
|
4800
4803
|
customerId: e.customerId,
|
|
4801
4804
|
destinations: e.destinations,
|
|
4802
|
-
metadata:
|
|
4805
|
+
metadata: N(f({}, e.metadata), {
|
|
4803
4806
|
selectedBy: "w3payments-core",
|
|
4804
4807
|
selectionReason: "auto-selected",
|
|
4805
4808
|
selectedVendor: o
|
|
@@ -4807,7 +4810,7 @@ class he {
|
|
|
4807
4810
|
};
|
|
4808
4811
|
try {
|
|
4809
4812
|
const a = yield this.registry.get(o).createCheckoutSession(t);
|
|
4810
|
-
return
|
|
4813
|
+
return N(f({}, a), {
|
|
4811
4814
|
selectedVendor: ((r = a.metadata) == null ? void 0 : r.selectedVendor) || o
|
|
4812
4815
|
});
|
|
4813
4816
|
} catch (i) {
|
|
@@ -4844,8 +4847,8 @@ class he {
|
|
|
4844
4847
|
* Only initializes currencies, networks, and registers adapters without API initialization
|
|
4845
4848
|
*/
|
|
4846
4849
|
static createClient(e = "sandbox") {
|
|
4847
|
-
const o = Object.create(
|
|
4848
|
-
return o.currencyService =
|
|
4850
|
+
const o = Object.create(fe.prototype);
|
|
4851
|
+
return o.currencyService = ue, o.networkService = we, o.paymentMethodService = Ue, o.registry = new Ce(), o.clientMode = !0, o.options = {
|
|
4849
4852
|
config: {
|
|
4850
4853
|
environment: e
|
|
4851
4854
|
}
|
|
@@ -4876,7 +4879,7 @@ class he {
|
|
|
4876
4879
|
*/
|
|
4877
4880
|
initialize() {
|
|
4878
4881
|
return S(this, null, function* () {
|
|
4879
|
-
const e =
|
|
4882
|
+
const e = N(f({}, this.options.config), {
|
|
4880
4883
|
environment: this.options.environment || this.options.config.environment
|
|
4881
4884
|
});
|
|
4882
4885
|
yield this.registry.initialize(e), this.registerPaymentMethods();
|
|
@@ -4971,8 +4974,8 @@ class fo {
|
|
|
4971
4974
|
}
|
|
4972
4975
|
makeRequest(t) {
|
|
4973
4976
|
return S(this, arguments, function* (e, o = {}) {
|
|
4974
|
-
const r = yield globalThis.fetch(`${this.config.endpoint}${e}`,
|
|
4975
|
-
headers:
|
|
4977
|
+
const r = yield globalThis.fetch(`${this.config.endpoint}${e}`, f({
|
|
4978
|
+
headers: f(f({
|
|
4976
4979
|
"Content-Type": "application/json"
|
|
4977
4980
|
}, this.config.headers), o.headers)
|
|
4978
4981
|
}, o));
|
|
@@ -5000,10 +5003,10 @@ class fo {
|
|
|
5000
5003
|
return !!this.config.endpoint;
|
|
5001
5004
|
}
|
|
5002
5005
|
}
|
|
5003
|
-
const
|
|
5006
|
+
const ve = Xe(
|
|
5004
5007
|
null
|
|
5005
5008
|
);
|
|
5006
|
-
|
|
5009
|
+
ve.displayName = "W3PaymentsContext";
|
|
5007
5010
|
const Co = ({
|
|
5008
5011
|
endpoint: n,
|
|
5009
5012
|
environment: e = "sandbox",
|
|
@@ -5013,28 +5016,28 @@ const Co = ({
|
|
|
5013
5016
|
const { w3payments: r, httpClient: i, isInitialized: a, initError: l } = me(() => {
|
|
5014
5017
|
try {
|
|
5015
5018
|
console.debug("W3PaymentsProvider: Initializing clients...");
|
|
5016
|
-
const u =
|
|
5019
|
+
const u = fe.createClient(e), U = new fo({ endpoint: n });
|
|
5017
5020
|
return console.debug(
|
|
5018
5021
|
"W3PaymentsProvider: Both clients initialized successfully"
|
|
5019
5022
|
), {
|
|
5020
5023
|
w3payments: u,
|
|
5021
|
-
httpClient:
|
|
5024
|
+
httpClient: U,
|
|
5022
5025
|
isInitialized: !0,
|
|
5023
5026
|
initError: null
|
|
5024
5027
|
};
|
|
5025
5028
|
} catch (u) {
|
|
5026
|
-
const
|
|
5029
|
+
const U = u instanceof Error ? u.message : "Failed to initialize W3Payments clients";
|
|
5027
5030
|
return console.error("W3PaymentsProvider initialization error:", u), {
|
|
5028
5031
|
w3payments: null,
|
|
5029
5032
|
httpClient: null,
|
|
5030
5033
|
isInitialized: !1,
|
|
5031
|
-
initError:
|
|
5034
|
+
initError: U
|
|
5032
5035
|
};
|
|
5033
5036
|
}
|
|
5034
5037
|
}, [n, e]);
|
|
5035
5038
|
Ve(() => {
|
|
5036
|
-
o && document.querySelectorAll(".w3-widget").forEach((
|
|
5037
|
-
qe(o,
|
|
5039
|
+
o && document.querySelectorAll(".w3-widget").forEach((U) => {
|
|
5040
|
+
qe(o, U);
|
|
5038
5041
|
});
|
|
5039
5042
|
}, [o]);
|
|
5040
5043
|
const d = {
|
|
@@ -5061,7 +5064,7 @@ const Co = ({
|
|
|
5061
5064
|
/* @__PURE__ */ c.jsx("p", { style: { margin: "8px 0 0 0" }, children: l })
|
|
5062
5065
|
]
|
|
5063
5066
|
}
|
|
5064
|
-
) : a ? /* @__PURE__ */ c.jsx(
|
|
5067
|
+
) : a ? /* @__PURE__ */ c.jsx(ve.Provider, { value: d, children: t }) : /* @__PURE__ */ c.jsx(
|
|
5065
5068
|
"div",
|
|
5066
5069
|
{
|
|
5067
5070
|
className: "w3-loading-container",
|
|
@@ -5075,7 +5078,7 @@ const Co = ({
|
|
|
5075
5078
|
}
|
|
5076
5079
|
);
|
|
5077
5080
|
}, vo = () => {
|
|
5078
|
-
const n =
|
|
5081
|
+
const n = Ge(ve);
|
|
5079
5082
|
if (!n)
|
|
5080
5083
|
throw new Error(
|
|
5081
5084
|
"useW3Payments must be used within W3PaymentsProvider. Make sure your component is wrapped with <W3PaymentsProvider>."
|
|
@@ -5116,14 +5119,14 @@ const Co = ({
|
|
|
5116
5119
|
onAmountChange: i,
|
|
5117
5120
|
className: a = ""
|
|
5118
5121
|
}) => {
|
|
5119
|
-
const [l, d] = ee(null), u = (
|
|
5120
|
-
const
|
|
5121
|
-
if (
|
|
5122
|
-
const C = Qe(
|
|
5122
|
+
const [l, d] = ee(null), u = (U) => {
|
|
5123
|
+
const w = U.target.value;
|
|
5124
|
+
if (w && !$e(w, t)) {
|
|
5125
|
+
const C = Qe(w, t);
|
|
5123
5126
|
i == null || i(C);
|
|
5124
5127
|
return;
|
|
5125
5128
|
}
|
|
5126
|
-
i == null || i(
|
|
5129
|
+
i == null || i(w);
|
|
5127
5130
|
};
|
|
5128
5131
|
return /* @__PURE__ */ c.jsxs("div", { className: `${a}`, children: [
|
|
5129
5132
|
n && /* @__PURE__ */ c.jsx(
|
|
@@ -5255,13 +5258,13 @@ const Co = ({
|
|
|
5255
5258
|
children: o,
|
|
5256
5259
|
showDisabled: t = !0
|
|
5257
5260
|
}) => {
|
|
5258
|
-
const r =
|
|
5261
|
+
const r = We.toArray(o).filter((i) => {
|
|
5259
5262
|
var a, l, d;
|
|
5260
5263
|
return !t && ae(i) && (d = (l = (a = i.props) == null ? void 0 : a.method) == null ? void 0 : l.enabled) != null ? d : !0;
|
|
5261
5264
|
}).sort((i, a) => {
|
|
5262
|
-
var u,
|
|
5265
|
+
var u, U, w, C, E, x;
|
|
5263
5266
|
if (!ae(i) || !ae(a)) return 0;
|
|
5264
|
-
const l = (
|
|
5267
|
+
const l = (w = (U = (u = i.props) == null ? void 0 : u.method) == null ? void 0 : U.enabled) != null ? w : !0, d = (x = (E = (C = a.props) == null ? void 0 : C.method) == null ? void 0 : E.enabled) != null ? x : !0;
|
|
5265
5268
|
return l && !d ? -1 : !l && d ? 1 : 0;
|
|
5266
5269
|
});
|
|
5267
5270
|
return /* @__PURE__ */ c.jsxs(
|
|
@@ -5307,7 +5310,7 @@ const Co = ({
|
|
|
5307
5310
|
const t = n.enabled === !1, i = ((a) => {
|
|
5308
5311
|
const l = a.toLowerCase();
|
|
5309
5312
|
let d = Me(a);
|
|
5310
|
-
if (d || (d =
|
|
5313
|
+
if (d || (d = Ne(l), d) || (d = xe(l), d)) return d;
|
|
5311
5314
|
})(n.displayName);
|
|
5312
5315
|
return /* @__PURE__ */ c.jsxs("div", { className: "relative", children: [
|
|
5313
5316
|
/* @__PURE__ */ c.jsxs(
|
|
@@ -5353,7 +5356,7 @@ const Co = ({
|
|
|
5353
5356
|
const r = ((i) => {
|
|
5354
5357
|
const a = i.toLowerCase();
|
|
5355
5358
|
let l = Me(i);
|
|
5356
|
-
if (l || (l =
|
|
5359
|
+
if (l || (l = Ne(a), l) || (l = xe(a), l)) return l;
|
|
5357
5360
|
})(n.displayName);
|
|
5358
5361
|
return /* @__PURE__ */ c.jsx(
|
|
5359
5362
|
"div",
|
|
@@ -5511,7 +5514,7 @@ const Co = ({
|
|
|
5511
5514
|
] })
|
|
5512
5515
|
}
|
|
5513
5516
|
);
|
|
5514
|
-
},
|
|
5517
|
+
}, Uo = ({
|
|
5515
5518
|
brandingText: n = "Payments",
|
|
5516
5519
|
showSecured: e = !0
|
|
5517
5520
|
}) => /* @__PURE__ */ c.jsx(
|
|
@@ -5609,8 +5612,8 @@ const Co = ({
|
|
|
5609
5612
|
currency: l = "USD",
|
|
5610
5613
|
targetCurrency: d,
|
|
5611
5614
|
targetNetwork: u,
|
|
5612
|
-
destinations:
|
|
5613
|
-
walletFilter:
|
|
5615
|
+
destinations: U,
|
|
5616
|
+
walletFilter: w,
|
|
5614
5617
|
exchangeFilter: C,
|
|
5615
5618
|
fiatFilter: E,
|
|
5616
5619
|
onInitiate: x,
|
|
@@ -5618,28 +5621,28 @@ const Co = ({
|
|
|
5618
5621
|
onError: T
|
|
5619
5622
|
}) => {
|
|
5620
5623
|
var Y;
|
|
5621
|
-
const { w3payments: I, httpClient: ne, isInitialized:
|
|
5622
|
-
walletFilter:
|
|
5624
|
+
const { w3payments: I, httpClient: ne, isInitialized: G } = vo(), [M, K] = ee(r), [D, L] = ee(), [te, B] = ee(!1), A = me(() => I ? I.getCurrency(l) : null, [I, l]), P = me(() => !G || !I ? [] : I.paymentMethodService.getDisplayOptions({
|
|
5625
|
+
walletFilter: w,
|
|
5623
5626
|
exchangeFilter: C,
|
|
5624
5627
|
fiatFilter: E,
|
|
5625
5628
|
targetCurrency: d,
|
|
5626
5629
|
targetNetwork: u
|
|
5627
5630
|
}), [
|
|
5628
|
-
|
|
5631
|
+
G,
|
|
5629
5632
|
I,
|
|
5630
|
-
|
|
5633
|
+
w,
|
|
5631
5634
|
C,
|
|
5632
5635
|
E,
|
|
5633
5636
|
d,
|
|
5634
5637
|
u
|
|
5635
|
-
]), Z = (m) =>
|
|
5638
|
+
]), Z = (m) => P.find((b) => b.id === m), z = () => !!(M && D && A && I && G), se = () => {
|
|
5636
5639
|
K(""), L(void 0), B(!1);
|
|
5637
5640
|
}, F = () => S(null, null, function* () {
|
|
5638
5641
|
var m;
|
|
5639
5642
|
if (!(!z() || !I || !A)) {
|
|
5640
5643
|
B(!0);
|
|
5641
5644
|
try {
|
|
5642
|
-
yield x == null ? void 0 : x(
|
|
5645
|
+
yield x == null ? void 0 : x(f({
|
|
5643
5646
|
amount: M,
|
|
5644
5647
|
currency: A.code,
|
|
5645
5648
|
paymentMethodId: D
|
|
@@ -5653,7 +5656,7 @@ const Co = ({
|
|
|
5653
5656
|
amount: parseFloat(M),
|
|
5654
5657
|
currency: A.code,
|
|
5655
5658
|
customerId: o || "anonymous",
|
|
5656
|
-
destinations:
|
|
5659
|
+
destinations: U,
|
|
5657
5660
|
metadata: {
|
|
5658
5661
|
paymentMethodId: D
|
|
5659
5662
|
}
|
|
@@ -5664,7 +5667,7 @@ const Co = ({
|
|
|
5664
5667
|
id: b.id,
|
|
5665
5668
|
url: b.url,
|
|
5666
5669
|
expiresAt: b.expiresAt,
|
|
5667
|
-
metadata:
|
|
5670
|
+
metadata: N(f({}, b.metadata), {
|
|
5668
5671
|
selectedVendor: b.selectedVendor,
|
|
5669
5672
|
vendorId: b.selectedVendor
|
|
5670
5673
|
})
|
|
@@ -5686,7 +5689,7 @@ const Co = ({
|
|
|
5686
5689
|
});
|
|
5687
5690
|
return;
|
|
5688
5691
|
} else
|
|
5689
|
-
R == null || R(
|
|
5692
|
+
R == null || R(N(f({
|
|
5690
5693
|
amount: M,
|
|
5691
5694
|
currency: A.code,
|
|
5692
5695
|
paymentMethodId: D,
|
|
@@ -5705,7 +5708,7 @@ const Co = ({
|
|
|
5705
5708
|
});
|
|
5706
5709
|
}
|
|
5707
5710
|
else
|
|
5708
|
-
R == null || R(
|
|
5711
|
+
R == null || R(f({
|
|
5709
5712
|
amount: M,
|
|
5710
5713
|
currency: A.code,
|
|
5711
5714
|
paymentMethodId: D,
|
|
@@ -5714,7 +5717,7 @@ const Co = ({
|
|
|
5714
5717
|
status: "pending"
|
|
5715
5718
|
}, o && { userId: o }));
|
|
5716
5719
|
} catch (b) {
|
|
5717
|
-
console.error("Payment failed:", b), T == null || T(
|
|
5720
|
+
console.error("Payment failed:", b), T == null || T(N(f(f({
|
|
5718
5721
|
message: b instanceof Error ? b.message : "Payment failed"
|
|
5719
5722
|
}, t && { transactionId: t }), o && { userId: o }), {
|
|
5720
5723
|
details: b
|
|
@@ -5724,7 +5727,7 @@ const Co = ({
|
|
|
5724
5727
|
}
|
|
5725
5728
|
}
|
|
5726
5729
|
});
|
|
5727
|
-
return
|
|
5730
|
+
return G ? /* @__PURE__ */ c.jsxs(
|
|
5728
5731
|
"div",
|
|
5729
5732
|
{
|
|
5730
5733
|
className: `
|
|
@@ -5740,7 +5743,7 @@ const Co = ({
|
|
|
5740
5743
|
`,
|
|
5741
5744
|
children: [
|
|
5742
5745
|
/* @__PURE__ */ c.jsxs("div", { className: "flex flex-col gap-0.5 flex-1 overflow-y-auto pb-1", children: [
|
|
5743
|
-
/* @__PURE__ */ c.jsx(yo,
|
|
5746
|
+
/* @__PURE__ */ c.jsx(yo, f({ title: n }, e && { logo: e })),
|
|
5744
5747
|
A && /* @__PURE__ */ c.jsx("div", { className: "px-[var(--spacing)]", children: /* @__PURE__ */ c.jsx(
|
|
5745
5748
|
To,
|
|
5746
5749
|
{
|
|
@@ -5753,10 +5756,10 @@ const Co = ({
|
|
|
5753
5756
|
) }),
|
|
5754
5757
|
/* @__PURE__ */ c.jsxs(
|
|
5755
5758
|
Do,
|
|
5756
|
-
|
|
5759
|
+
N(f({}, D && { selectedMethodId: D }), {
|
|
5757
5760
|
onMethodSelect: L,
|
|
5758
5761
|
children: [
|
|
5759
|
-
|
|
5762
|
+
P.filter((m) => m.method === "wallet").length > 0 && /* @__PURE__ */ c.jsx(de, { label: "Crypto Wallets", children: P.filter((m) => m.method === "wallet").map((m, b) => /* @__PURE__ */ c.jsx(
|
|
5760
5763
|
pe,
|
|
5761
5764
|
{
|
|
5762
5765
|
data: {
|
|
@@ -5768,7 +5771,7 @@ const Co = ({
|
|
|
5768
5771
|
},
|
|
5769
5772
|
b
|
|
5770
5773
|
)) }),
|
|
5771
|
-
|
|
5774
|
+
P.filter((m) => m.method === "exchange").length > 0 && /* @__PURE__ */ c.jsx(de, { label: "Exchanges", children: P.filter((m) => m.method === "exchange").map((m, b) => /* @__PURE__ */ c.jsx(
|
|
5772
5775
|
pe,
|
|
5773
5776
|
{
|
|
5774
5777
|
data: {
|
|
@@ -5780,7 +5783,7 @@ const Co = ({
|
|
|
5780
5783
|
},
|
|
5781
5784
|
b
|
|
5782
5785
|
)) }),
|
|
5783
|
-
|
|
5786
|
+
P.filter((m) => m.method === "fiat").length > 0 && /* @__PURE__ */ c.jsx(de, { label: "Traditional Payment", children: P.filter((m) => m.method === "fiat").map((m, b) => /* @__PURE__ */ c.jsx(
|
|
5784
5787
|
pe,
|
|
5785
5788
|
{
|
|
5786
5789
|
data: {
|
|
@@ -5816,17 +5819,17 @@ const Co = ({
|
|
|
5816
5819
|
}
|
|
5817
5820
|
) })
|
|
5818
5821
|
] }),
|
|
5819
|
-
/* @__PURE__ */ c.jsx(
|
|
5822
|
+
/* @__PURE__ */ c.jsx(Uo, {})
|
|
5820
5823
|
]
|
|
5821
5824
|
}
|
|
5822
5825
|
) : /* @__PURE__ */ c.jsx("div", { children: "Loading payment widget..." });
|
|
5823
|
-
},
|
|
5824
|
-
W3_PAYMENTS_REACT_VERSION:
|
|
5826
|
+
}, wo = "1.0.0", Mo = {
|
|
5827
|
+
W3_PAYMENTS_REACT_VERSION: wo
|
|
5825
5828
|
};
|
|
5826
5829
|
export {
|
|
5827
5830
|
Eo as W3PaymentWidget,
|
|
5828
5831
|
Co as W3PaymentsProvider,
|
|
5829
|
-
|
|
5832
|
+
wo as W3_PAYMENTS_REACT_VERSION,
|
|
5830
5833
|
Mo as default,
|
|
5831
5834
|
vo as useW3Payments
|
|
5832
5835
|
};
|