@w3payments/react 1.1.0 → 1.1.2
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/assets/main.css +1 -1
- package/dist/components/PaymentInput.d.ts +0 -2
- package/dist/components/PaymentInput.d.ts.map +1 -1
- package/dist/components/W3PaymentWidget.d.ts +4 -2
- package/dist/components/W3PaymentWidget.d.ts.map +1 -1
- package/dist/index.js +11 -11
- package/dist/index.mjs +486 -480
- package/package.json +4 -4
- package/dist/utils/numbers.d.ts +0 -16
- package/dist/utils/numbers.d.ts.map +0 -1
- package/dist/utils/theme.d.ts +0 -6
- package/dist/utils/theme.d.ts.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import './assets/main.css';var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
var
|
|
5
|
-
var
|
|
1
|
+
import './assets/main.css';var Re = Object.defineProperty, Oe = Object.defineProperties;
|
|
2
|
+
var Le = Object.getOwnPropertyDescriptors;
|
|
3
|
+
var ye = Object.getOwnPropertySymbols;
|
|
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, y = (n, e) => {
|
|
6
6
|
for (var o in e || (e = {}))
|
|
7
|
-
|
|
8
|
-
if (
|
|
9
|
-
for (var o of
|
|
10
|
-
|
|
7
|
+
Be.call(e, o) && re(n, o, e[o]);
|
|
8
|
+
if (ye)
|
|
9
|
+
for (var o of ye(e))
|
|
10
|
+
je.call(e, o) && re(n, o, e[o]);
|
|
11
11
|
return n;
|
|
12
|
-
}, P = (n, e) =>
|
|
13
|
-
var g = (n, e, o) =>
|
|
14
|
-
var
|
|
12
|
+
}, P = (n, e) => Oe(n, Le(e));
|
|
13
|
+
var g = (n, e, o) => re(n, typeof e != "symbol" ? e + "" : e, o);
|
|
14
|
+
var S = (n, e, o) => new Promise((t, r) => {
|
|
15
15
|
var i = (d) => {
|
|
16
16
|
try {
|
|
17
17
|
l(o.next(d));
|
|
@@ -27,12 +27,12 @@ var w = (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
|
|
31
|
-
var
|
|
32
|
-
var
|
|
33
|
-
function
|
|
34
|
-
if (
|
|
35
|
-
|
|
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
|
+
var q = { exports: {} }, _ = {};
|
|
32
|
+
var Te;
|
|
33
|
+
function Ze() {
|
|
34
|
+
if (Te) return _;
|
|
35
|
+
Te = 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;
|
|
@@ -49,47 +49,47 @@ function We() {
|
|
|
49
49
|
props: i
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
return
|
|
52
|
+
return _.Fragment = e, _.jsx = o, _.jsxs = o, _;
|
|
53
53
|
}
|
|
54
|
-
var
|
|
55
|
-
var
|
|
54
|
+
var $ = {};
|
|
55
|
+
var De;
|
|
56
56
|
function ze() {
|
|
57
|
-
return
|
|
57
|
+
return De || (De = 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 === N ? null : s.displayName || s.name || null;
|
|
62
62
|
if (typeof s == "string") return s;
|
|
63
63
|
switch (s) {
|
|
64
|
-
case
|
|
64
|
+
case T:
|
|
65
65
|
return "Fragment";
|
|
66
|
-
case
|
|
66
|
+
case ne:
|
|
67
67
|
return "Profiler";
|
|
68
|
-
case
|
|
68
|
+
case I:
|
|
69
69
|
return "StrictMode";
|
|
70
|
-
case
|
|
70
|
+
case D:
|
|
71
71
|
return "Suspense";
|
|
72
|
-
case
|
|
72
|
+
case L:
|
|
73
73
|
return "SuspenseList";
|
|
74
|
-
case
|
|
74
|
+
case A:
|
|
75
75
|
return "Activity";
|
|
76
76
|
}
|
|
77
77
|
if (typeof s == "object")
|
|
78
78
|
switch (typeof s.tag == "number" && console.error(
|
|
79
79
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
80
80
|
), s.$$typeof) {
|
|
81
|
-
case
|
|
81
|
+
case R:
|
|
82
82
|
return "Portal";
|
|
83
|
-
case
|
|
83
|
+
case M:
|
|
84
84
|
return s.displayName || "Context";
|
|
85
|
-
case
|
|
85
|
+
case G:
|
|
86
86
|
return (s._context.displayName || "Context") + ".Consumer";
|
|
87
|
-
case
|
|
87
|
+
case K:
|
|
88
88
|
var p = s.render;
|
|
89
89
|
return s = s.displayName, s || (s = p.displayName || p.name || "", s = s !== "" ? "ForwardRef(" + s + ")" : "ForwardRef"), s;
|
|
90
|
-
case
|
|
90
|
+
case te:
|
|
91
91
|
return p = s.displayName || null, p !== null ? p : n(s.type) || "Memo";
|
|
92
|
-
case
|
|
92
|
+
case B:
|
|
93
93
|
p = s._payload, s = s._init;
|
|
94
94
|
try {
|
|
95
95
|
return n(s(p));
|
|
@@ -105,7 +105,7 @@ function ze() {
|
|
|
105
105
|
try {
|
|
106
106
|
e(s);
|
|
107
107
|
var p = !1;
|
|
108
|
-
} catch (
|
|
108
|
+
} catch (J) {
|
|
109
109
|
p = !0;
|
|
110
110
|
}
|
|
111
111
|
if (p) {
|
|
@@ -119,8 +119,8 @@ function ze() {
|
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
function t(s) {
|
|
122
|
-
if (s ===
|
|
123
|
-
if (typeof s == "object" && s !== null && s.$$typeof ===
|
|
122
|
+
if (s === T) return "<>";
|
|
123
|
+
if (typeof s == "object" && s !== null && s.$$typeof === B)
|
|
124
124
|
return "<...>";
|
|
125
125
|
try {
|
|
126
126
|
var p = n(s);
|
|
@@ -130,14 +130,14 @@ function ze() {
|
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
132
|
function r() {
|
|
133
|
-
var s =
|
|
133
|
+
var s = Z.A;
|
|
134
134
|
return s === null ? null : s.getOwner();
|
|
135
135
|
}
|
|
136
136
|
function i() {
|
|
137
137
|
return Error("react-stack-top-frame");
|
|
138
138
|
}
|
|
139
139
|
function a(s) {
|
|
140
|
-
if (
|
|
140
|
+
if (z.call(s, "key")) {
|
|
141
141
|
var p = Object.getOwnPropertyDescriptor(s, "key").get;
|
|
142
142
|
if (p && p.isReactWarning) return !1;
|
|
143
143
|
}
|
|
@@ -145,7 +145,7 @@ function ze() {
|
|
|
145
145
|
}
|
|
146
146
|
function l(s, p) {
|
|
147
147
|
function h() {
|
|
148
|
-
|
|
148
|
+
Y || (Y = !0, console.error(
|
|
149
149
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
150
150
|
p
|
|
151
151
|
));
|
|
@@ -157,14 +157,14 @@ function ze() {
|
|
|
157
157
|
}
|
|
158
158
|
function d() {
|
|
159
159
|
var s = n(this.type);
|
|
160
|
-
return
|
|
160
|
+
return m[s] || (m[s] = !0, console.error(
|
|
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, f,
|
|
164
|
+
function u(s, p, h, f, J, ce) {
|
|
165
165
|
var v = h.ref;
|
|
166
166
|
return s = {
|
|
167
|
-
$$typeof:
|
|
167
|
+
$$typeof: x,
|
|
168
168
|
type: s,
|
|
169
169
|
key: p,
|
|
170
170
|
props: h,
|
|
@@ -186,33 +186,33 @@ function ze() {
|
|
|
186
186
|
configurable: !1,
|
|
187
187
|
enumerable: !1,
|
|
188
188
|
writable: !0,
|
|
189
|
-
value:
|
|
189
|
+
value: J
|
|
190
190
|
}), Object.defineProperty(s, "_debugTask", {
|
|
191
191
|
configurable: !1,
|
|
192
192
|
enumerable: !1,
|
|
193
193
|
writable: !0,
|
|
194
|
-
value:
|
|
194
|
+
value: ce
|
|
195
195
|
}), Object.freeze && (Object.freeze(s.props), Object.freeze(s)), s;
|
|
196
196
|
}
|
|
197
|
-
function
|
|
197
|
+
function U(s, p, h, f, J, ce) {
|
|
198
198
|
var v = p.children;
|
|
199
199
|
if (v !== void 0)
|
|
200
200
|
if (f)
|
|
201
|
-
if (
|
|
201
|
+
if (se(v)) {
|
|
202
202
|
for (f = 0; f < v.length; f++)
|
|
203
|
-
|
|
203
|
+
w(v[f]);
|
|
204
204
|
Object.freeze && Object.freeze(v);
|
|
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
|
|
210
|
-
if (
|
|
209
|
+
else w(v);
|
|
210
|
+
if (z.call(p, "key")) {
|
|
211
211
|
v = n(s);
|
|
212
|
-
var W = Object.keys(p).filter(function(
|
|
213
|
-
return
|
|
212
|
+
var W = Object.keys(p).filter(function(Pe) {
|
|
213
|
+
return Pe !== "key";
|
|
214
214
|
});
|
|
215
|
-
f = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}",
|
|
215
|
+
f = 0 < W.length ? "{key: someKey, " + W.join(": ..., ") + ": ...}" : "{key: someKey}", ve[v + f] || (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} />
|
|
@@ -223,12 +223,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
223
223
|
v,
|
|
224
224
|
W,
|
|
225
225
|
v
|
|
226
|
-
),
|
|
226
|
+
), ve[v + f] = !0);
|
|
227
227
|
}
|
|
228
228
|
if (v = null, h !== void 0 && (o(h), v = "" + h), a(p) && (o(p.key), v = "" + p.key), "key" in p) {
|
|
229
229
|
h = {};
|
|
230
|
-
for (var
|
|
231
|
-
|
|
230
|
+
for (var ie in p)
|
|
231
|
+
ie !== "key" && (h[ie] = p[ie]);
|
|
232
232
|
} else h = p;
|
|
233
233
|
return v && l(
|
|
234
234
|
h,
|
|
@@ -238,62 +238,62 @@ React keys must be passed directly to JSX without using spread:
|
|
|
238
238
|
v,
|
|
239
239
|
h,
|
|
240
240
|
r(),
|
|
241
|
-
|
|
242
|
-
|
|
241
|
+
J,
|
|
242
|
+
ce
|
|
243
243
|
);
|
|
244
244
|
}
|
|
245
|
-
function
|
|
246
|
-
|
|
245
|
+
function w(s) {
|
|
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
|
-
function
|
|
249
|
-
return typeof s == "object" && s !== null && s.$$typeof ===
|
|
248
|
+
function C(s) {
|
|
249
|
+
return typeof s == "object" && s !== null && s.$$typeof === x;
|
|
250
250
|
}
|
|
251
|
-
var
|
|
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"), N = 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 = {
|
|
255
255
|
react_stack_bottom_frame: function(s) {
|
|
256
256
|
return s();
|
|
257
257
|
}
|
|
258
258
|
};
|
|
259
|
-
var
|
|
260
|
-
|
|
259
|
+
var Y, m = {}, b = E.react_stack_bottom_frame.bind(
|
|
260
|
+
E,
|
|
261
261
|
i
|
|
262
|
-
)(),
|
|
263
|
-
|
|
264
|
-
var f = 1e4 >
|
|
265
|
-
return
|
|
262
|
+
)(), k = F(t(i)), ve = {};
|
|
263
|
+
$.Fragment = T, $.jsx = function(s, p, h) {
|
|
264
|
+
var f = 1e4 > Z.recentlyCreatedOwnerStacks++;
|
|
265
|
+
return U(
|
|
266
266
|
s,
|
|
267
267
|
p,
|
|
268
268
|
h,
|
|
269
269
|
!1,
|
|
270
|
-
f ? Error("react-stack-top-frame") :
|
|
271
|
-
f ?
|
|
270
|
+
f ? Error("react-stack-top-frame") : b,
|
|
271
|
+
f ? F(t(s)) : k
|
|
272
272
|
);
|
|
273
|
-
},
|
|
274
|
-
var f = 1e4 >
|
|
275
|
-
return
|
|
273
|
+
}, $.jsxs = function(s, p, h) {
|
|
274
|
+
var f = 1e4 > Z.recentlyCreatedOwnerStacks++;
|
|
275
|
+
return U(
|
|
276
276
|
s,
|
|
277
277
|
p,
|
|
278
278
|
h,
|
|
279
279
|
!0,
|
|
280
|
-
f ? Error("react-stack-top-frame") :
|
|
281
|
-
f ?
|
|
280
|
+
f ? Error("react-stack-top-frame") : b,
|
|
281
|
+
f ? F(t(s)) : k
|
|
282
282
|
);
|
|
283
283
|
};
|
|
284
|
-
})()),
|
|
284
|
+
})()), $;
|
|
285
285
|
}
|
|
286
|
-
var
|
|
287
|
-
function
|
|
288
|
-
return
|
|
286
|
+
var ke;
|
|
287
|
+
function Fe() {
|
|
288
|
+
return ke || (ke = 1, process.env.NODE_ENV === "production" ? q.exports = Ze() : q.exports = ze()), q.exports;
|
|
289
289
|
}
|
|
290
|
-
var c =
|
|
291
|
-
const
|
|
290
|
+
var c = Fe();
|
|
291
|
+
const H = class H {
|
|
292
292
|
constructor() {
|
|
293
293
|
g(this, "paymentMethods", /* @__PURE__ */ new Map());
|
|
294
294
|
}
|
|
295
295
|
static getInstance() {
|
|
296
|
-
return
|
|
296
|
+
return H.instance || (H.instance = new H()), H.instance;
|
|
297
297
|
}
|
|
298
298
|
/**
|
|
299
299
|
* Register a new payment method
|
|
@@ -431,17 +431,13 @@ const B = class B {
|
|
|
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 B = class B {
|
|
|
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],
|
|
@@ -519,9 +508,9 @@ const B = class B {
|
|
|
519
508
|
this.paymentMethods.clear();
|
|
520
509
|
}
|
|
521
510
|
};
|
|
522
|
-
g(
|
|
523
|
-
let
|
|
524
|
-
const
|
|
511
|
+
g(H, "instance");
|
|
512
|
+
let be = H;
|
|
513
|
+
const Se = be.getInstance(), X = class X {
|
|
525
514
|
constructor() {
|
|
526
515
|
g(this, "currencies", /* @__PURE__ */ new Map());
|
|
527
516
|
g(this, "supportedCurrencies", {
|
|
@@ -530,7 +519,7 @@ const ke = pe.getInstance(), j = class j {
|
|
|
530
519
|
});
|
|
531
520
|
}
|
|
532
521
|
static getInstance() {
|
|
533
|
-
return
|
|
522
|
+
return X.instance || (X.instance = new X()), X.instance;
|
|
534
523
|
}
|
|
535
524
|
/**
|
|
536
525
|
* Register a new currency
|
|
@@ -633,14 +622,14 @@ const ke = pe.getInstance(), j = class j {
|
|
|
633
622
|
this.currencies.clear(), this.supportedCurrencies.sandbox.clear(), this.supportedCurrencies.production.clear();
|
|
634
623
|
}
|
|
635
624
|
};
|
|
636
|
-
g(
|
|
637
|
-
let
|
|
638
|
-
const
|
|
625
|
+
g(X, "instance");
|
|
626
|
+
let ge = X;
|
|
627
|
+
const Ue = ge.getInstance(), V = class V {
|
|
639
628
|
constructor() {
|
|
640
629
|
g(this, "networks", /* @__PURE__ */ new Map());
|
|
641
630
|
}
|
|
642
631
|
static getInstance() {
|
|
643
|
-
return
|
|
632
|
+
return V.instance || (V.instance = new V()), V.instance;
|
|
644
633
|
}
|
|
645
634
|
/**
|
|
646
635
|
* Register a new network
|
|
@@ -691,9 +680,96 @@ const Se = me.getInstance(), H = class H {
|
|
|
691
680
|
this.networks.clear();
|
|
692
681
|
}
|
|
693
682
|
};
|
|
694
|
-
g(
|
|
695
|
-
let
|
|
696
|
-
const we =
|
|
683
|
+
g(V, "instance");
|
|
684
|
+
let ue = V;
|
|
685
|
+
const we = ue.getInstance(), le = /* @__PURE__ */ new Map();
|
|
686
|
+
function Ye(n, e = !1) {
|
|
687
|
+
const o = `${n}-${e}`;
|
|
688
|
+
return le.has(o) || le.set(
|
|
689
|
+
o,
|
|
690
|
+
new Intl.NumberFormat("en-US", {
|
|
691
|
+
minimumFractionDigits: n,
|
|
692
|
+
maximumFractionDigits: n,
|
|
693
|
+
useGrouping: e
|
|
694
|
+
})
|
|
695
|
+
), le.get(o);
|
|
696
|
+
}
|
|
697
|
+
function _e(n, e) {
|
|
698
|
+
const o = n;
|
|
699
|
+
return isNaN(o) ? "" : Ye(e, !1).format(o);
|
|
700
|
+
}
|
|
701
|
+
function $e(n, e) {
|
|
702
|
+
const o = n.split(".");
|
|
703
|
+
return o.length <= 1 ? !0 : o[1].length <= e.decimals;
|
|
704
|
+
}
|
|
705
|
+
function Qe(n, e) {
|
|
706
|
+
const o = n.split(".");
|
|
707
|
+
if (o.length <= 1) return n;
|
|
708
|
+
const t = o[1].substring(0, e.decimals);
|
|
709
|
+
return t.length > 0 ? `${o[0]}.${t}` : o[0];
|
|
710
|
+
}
|
|
711
|
+
function Ee(n) {
|
|
712
|
+
return n.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
713
|
+
}
|
|
714
|
+
function Ke() {
|
|
715
|
+
return {
|
|
716
|
+
colorPrimary: "#6366f1",
|
|
717
|
+
colorPrimaryHover: "#4f46e5",
|
|
718
|
+
colorPrimaryLight: "#e0e7ff",
|
|
719
|
+
colorBackground: "#ffffff",
|
|
720
|
+
colorText: "#1f2937",
|
|
721
|
+
colorTextMuted: "#6b7280",
|
|
722
|
+
colorBorder: "#e5e7eb",
|
|
723
|
+
colorBorderLight: "#f3f4f6",
|
|
724
|
+
colorDanger: "#ef4444",
|
|
725
|
+
colorSuccess: "#10b981",
|
|
726
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
727
|
+
fontSize: "1rem",
|
|
728
|
+
borderRadius: "0.5rem",
|
|
729
|
+
spacing: "1rem"
|
|
730
|
+
};
|
|
731
|
+
}
|
|
732
|
+
function Je(n) {
|
|
733
|
+
const e = Ke();
|
|
734
|
+
switch (n) {
|
|
735
|
+
case "dark":
|
|
736
|
+
return P(y({}, e), {
|
|
737
|
+
colorPrimary: "#6366f1",
|
|
738
|
+
colorPrimaryHover: "#7c3aed",
|
|
739
|
+
colorPrimaryLight: "#1e1b4b",
|
|
740
|
+
colorBackground: "#111827",
|
|
741
|
+
colorText: "#f9fafb",
|
|
742
|
+
colorTextMuted: "#9ca3af",
|
|
743
|
+
colorBorder: "#374151",
|
|
744
|
+
colorBorderLight: "#4b5563"
|
|
745
|
+
});
|
|
746
|
+
case "light":
|
|
747
|
+
default:
|
|
748
|
+
return e;
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
function qe(n, e) {
|
|
752
|
+
var i;
|
|
753
|
+
const o = typeof n == "string" ? { theme: n } : n, t = Je((i = o.theme) != null ? i : "light"), r = y(y({}, t), o.variables);
|
|
754
|
+
Object.entries(r).forEach(([a, l]) => {
|
|
755
|
+
if (l !== void 0) {
|
|
756
|
+
const d = `--${Ee(a)}`;
|
|
757
|
+
e.style.setProperty(d, l);
|
|
758
|
+
}
|
|
759
|
+
}), o.theme && e.setAttribute("data-theme", o.theme), o.rules && eo(o.rules);
|
|
760
|
+
}
|
|
761
|
+
function eo(n) {
|
|
762
|
+
const e = "w3-theme-rules";
|
|
763
|
+
let o = document.getElementById(e);
|
|
764
|
+
o || (o = document.createElement("style"), o.id = e, document.head.appendChild(o));
|
|
765
|
+
const t = Object.entries(n).map(([r, i]) => {
|
|
766
|
+
const a = Object.entries(i).map(([l, d]) => `${Ee(l)}: ${d};`).join(" ");
|
|
767
|
+
return `.w3-widget ${r} { ${a} }`;
|
|
768
|
+
}).join(`
|
|
769
|
+
`);
|
|
770
|
+
o.textContent = t;
|
|
771
|
+
}
|
|
772
|
+
const oo = {
|
|
697
773
|
USD: {
|
|
698
774
|
code: "USD",
|
|
699
775
|
name: "US Dollar",
|
|
@@ -723,7 +799,7 @@ const we = be.getInstance(), Fe = {
|
|
|
723
799
|
isStablecoin: !1,
|
|
724
800
|
iconUrl: "https://cdn.jsdelivr.net/gh/atomiclabs/cryptocurrency-icons@1a63530be6e374711a8554f31b17e4cb92c25fa5/svg/icon/eth.svg"
|
|
725
801
|
}
|
|
726
|
-
},
|
|
802
|
+
}, no = {
|
|
727
803
|
bitcoin: {
|
|
728
804
|
id: "bitcoin",
|
|
729
805
|
name: "Bitcoin",
|
|
@@ -735,7 +811,7 @@ const we = be.getInstance(), Fe = {
|
|
|
735
811
|
symbol: "ETH",
|
|
736
812
|
chainId: 1
|
|
737
813
|
}
|
|
738
|
-
},
|
|
814
|
+
}, to = {
|
|
739
815
|
// Major Cryptocurrencies
|
|
740
816
|
BTC: "https://cryptologos.cc/logos/bitcoin-btc-logo.svg",
|
|
741
817
|
ETH: "https://cryptologos.cc/logos/ethereum-eth-logo.svg",
|
|
@@ -760,10 +836,10 @@ const we = be.getInstance(), Fe = {
|
|
|
760
836
|
ADA: "https://cryptologos.cc/logos/cardano-ada-logo.svg",
|
|
761
837
|
DOT: "https://cryptologos.cc/logos/polkadot-new-dot-logo.svg"
|
|
762
838
|
};
|
|
763
|
-
function
|
|
764
|
-
return
|
|
839
|
+
function Me(n) {
|
|
840
|
+
return to[n.toUpperCase()];
|
|
765
841
|
}
|
|
766
|
-
const
|
|
842
|
+
const so = {
|
|
767
843
|
// Major Exchanges
|
|
768
844
|
coinbase: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIGZpbGw9IiMwMDUyRkYiLz4KPHJlY3QgeD0iOSIgeT0iOSIgd2lkdGg9IjYiIGhlaWdodD0iNiIgcng9IjEiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
|
|
769
845
|
kraken: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIGZpbGw9IiM1NzQxOUEiLz4KPHBhdGggZD0iTTggN0wxNiA5VjE3TDggMTVWN1oiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
|
|
@@ -779,10 +855,10 @@ const $e = {
|
|
|
779
855
|
"coinbase-pro": "https://assets.coincap.io/assets/icons/256/coinbase.png",
|
|
780
856
|
"binance-us": "https://assets.coincap.io/assets/icons/256/binance.png"
|
|
781
857
|
};
|
|
782
|
-
function
|
|
783
|
-
return
|
|
858
|
+
function xe(n) {
|
|
859
|
+
return so[n.toLowerCase()];
|
|
784
860
|
}
|
|
785
|
-
const
|
|
861
|
+
const co = {
|
|
786
862
|
// Bank Transfer Methods
|
|
787
863
|
ach: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMgN1YxN0gyMVY3SDNaTTQgOEgyMFYxNkg0VjhaTTYgMTBWMTRIOVYxMEg2Wk0xMCAxMFYxMUgxOFYxMEgxMFpNMTAgMTJWMTNIMTVWMTJIMTBaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
|
|
788
864
|
wire: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMTMuMDkgOC4yNkwyMCA5TDEzLjA5IDE1Ljc0TDEyIDIyTDEwLjkxIDE1Ljc0TDQgOUwxMC45MSA4LjI2TDEyIDJaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
|
|
@@ -798,10 +874,10 @@ const Qe = {
|
|
|
798
874
|
bank: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMgN1YxN0gyMVY3SDNaTTQgOEgyMFYxNkg0VjhaTTYgMTBWMTRIOVYxMEg2Wk0xMCAxMFYxMUgxOFYxMEgxMFpNMTAgMTJWMTNIMTVWMTJIMTBaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
|
|
799
875
|
other: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDhDMTMuMSA4IDE0IDcuMSAxNCA2UzEzLjEgNCAxMiA0IDEwIDQuOSAxMCA2UzEwLjkgOCAxMiA4Wk0xMiAxMEMxMC45IDEwIDEwIDEwLjkgMTAgMTJTMTAuOSAxNCAxMiAxNFMxNCAxMy4xIDE0IDEyUzEzLjEgMTAgMTIgMTBaTTEyIDE2QzEwLjkgMTYgMTAgMTYuOSAxMCAxOFMxMC45IDIwIDEyIDIwUzE0IDE5LjEgMTQgMThTMTMuMSAxNiAxMiAxNloiIGZpbGw9ImN1cnJlbnRDb2xvciIvPgo8L3N2Zz4K"
|
|
800
876
|
};
|
|
801
|
-
function
|
|
802
|
-
return
|
|
877
|
+
function Ne(n) {
|
|
878
|
+
return co[n.toLowerCase()];
|
|
803
879
|
}
|
|
804
|
-
var
|
|
880
|
+
var io = {
|
|
805
881
|
content: {
|
|
806
882
|
integrations: [
|
|
807
883
|
{
|
|
@@ -2941,7 +3017,7 @@ var Ke = {
|
|
|
2941
3017
|
message: "",
|
|
2942
3018
|
errorHash: "41f47591",
|
|
2943
3019
|
errorType: ""
|
|
2944
|
-
},
|
|
3020
|
+
}, ro = {
|
|
2945
3021
|
content: {
|
|
2946
3022
|
networks: [
|
|
2947
3023
|
{
|
|
@@ -4205,7 +4281,7 @@ var Ke = {
|
|
|
4205
4281
|
message: "",
|
|
4206
4282
|
errorHash: "41f47591",
|
|
4207
4283
|
errorType: ""
|
|
4208
|
-
},
|
|
4284
|
+
}, ao = {
|
|
4209
4285
|
krakenDirect: "kraken",
|
|
4210
4286
|
coinbase: "coinbase",
|
|
4211
4287
|
binanceConnect: "binance",
|
|
@@ -4219,10 +4295,10 @@ var Ke = {
|
|
|
4219
4295
|
robinhood: "robinhood",
|
|
4220
4296
|
uphold: "uphold"
|
|
4221
4297
|
};
|
|
4222
|
-
function
|
|
4223
|
-
return
|
|
4298
|
+
function lo(n) {
|
|
4299
|
+
return ao[n] || null;
|
|
4224
4300
|
}
|
|
4225
|
-
var
|
|
4301
|
+
var po = {
|
|
4226
4302
|
Ethereum: "ethereum",
|
|
4227
4303
|
Bitcoin: "bitcoin",
|
|
4228
4304
|
Solana: "solana",
|
|
@@ -4240,10 +4316,10 @@ var oo = {
|
|
|
4240
4316
|
Injective: "injective",
|
|
4241
4317
|
Moonbeam: "moonbeam"
|
|
4242
4318
|
};
|
|
4243
|
-
function
|
|
4244
|
-
return
|
|
4319
|
+
function Ie(n) {
|
|
4320
|
+
return po[n] || n.toLowerCase();
|
|
4245
4321
|
}
|
|
4246
|
-
var
|
|
4322
|
+
var mo = {
|
|
4247
4323
|
// Most currencies are already normalized, but add special cases here
|
|
4248
4324
|
WETH: "ETH",
|
|
4249
4325
|
// Wrapped ETH maps to ETH
|
|
@@ -4252,9 +4328,9 @@ var no = {
|
|
|
4252
4328
|
// Add other wrapped/special tokens as needed
|
|
4253
4329
|
};
|
|
4254
4330
|
function Ae(n) {
|
|
4255
|
-
return
|
|
4331
|
+
return mo[n] || n;
|
|
4256
4332
|
}
|
|
4257
|
-
var
|
|
4333
|
+
var bo = class {
|
|
4258
4334
|
constructor(n = "sandbox") {
|
|
4259
4335
|
g(this, "id", "meshpay");
|
|
4260
4336
|
g(this, "name", "MeshPay");
|
|
@@ -4264,7 +4340,7 @@ var to = class {
|
|
|
4264
4340
|
this.environment = n;
|
|
4265
4341
|
}
|
|
4266
4342
|
initialize(n) {
|
|
4267
|
-
return
|
|
4343
|
+
return S(this, null, function* () {
|
|
4268
4344
|
const e = n[this.id];
|
|
4269
4345
|
if (!(e != null && e.clientId) || !(e != null && e.clientSecret))
|
|
4270
4346
|
throw new Error(
|
|
@@ -4289,7 +4365,7 @@ var to = class {
|
|
|
4289
4365
|
mapExchanges() {
|
|
4290
4366
|
const n = this.getIntegrationsData().content.integrations, e = [];
|
|
4291
4367
|
return n.forEach((o) => {
|
|
4292
|
-
const t =
|
|
4368
|
+
const t = lo(o.type);
|
|
4293
4369
|
if (!t) {
|
|
4294
4370
|
console.warn(
|
|
4295
4371
|
`Skipping unknown MeshPay integration type: ${o.type}`
|
|
@@ -4297,7 +4373,7 @@ var to = class {
|
|
|
4297
4373
|
return;
|
|
4298
4374
|
}
|
|
4299
4375
|
o.networks.forEach((r) => {
|
|
4300
|
-
const i =
|
|
4376
|
+
const i = Ie(r.name);
|
|
4301
4377
|
r.supportedTokens.forEach((a) => {
|
|
4302
4378
|
const l = Ae(a);
|
|
4303
4379
|
e.push({
|
|
@@ -4328,7 +4404,7 @@ var to = class {
|
|
|
4328
4404
|
mapWallets() {
|
|
4329
4405
|
const n = this.getNetworksData().content.networks, e = [];
|
|
4330
4406
|
return n.forEach((o) => {
|
|
4331
|
-
const t =
|
|
4407
|
+
const t = Ie(o.name);
|
|
4332
4408
|
o.supportedTokens.forEach((r) => {
|
|
4333
4409
|
const i = Ae(r);
|
|
4334
4410
|
e.push({
|
|
@@ -4357,16 +4433,16 @@ var to = class {
|
|
|
4357
4433
|
}
|
|
4358
4434
|
getIntegrationsData() {
|
|
4359
4435
|
if (this.environment === "sandbox")
|
|
4360
|
-
return
|
|
4436
|
+
return io;
|
|
4361
4437
|
throw new Error("Production integrations data loading not implemented");
|
|
4362
4438
|
}
|
|
4363
4439
|
getNetworksData() {
|
|
4364
4440
|
if (this.environment === "sandbox")
|
|
4365
|
-
return
|
|
4441
|
+
return ro;
|
|
4366
4442
|
throw new Error("Production networks data loading not implemented");
|
|
4367
4443
|
}
|
|
4368
4444
|
createCheckoutSession(n) {
|
|
4369
|
-
return
|
|
4445
|
+
return S(this, null, function* () {
|
|
4370
4446
|
if (!this.initialized)
|
|
4371
4447
|
throw new Error("MeshPay adapter not initialized");
|
|
4372
4448
|
try {
|
|
@@ -4409,7 +4485,7 @@ var to = class {
|
|
|
4409
4485
|
return o.id;
|
|
4410
4486
|
}
|
|
4411
4487
|
generateLinkToken(n) {
|
|
4412
|
-
return
|
|
4488
|
+
return S(this, null, function* () {
|
|
4413
4489
|
if (!this.config)
|
|
4414
4490
|
throw new Error("Adapter not initialized");
|
|
4415
4491
|
const e = {
|
|
@@ -4457,7 +4533,7 @@ var to = class {
|
|
|
4457
4533
|
* Open MeshPay checkout using their Web Link SDK
|
|
4458
4534
|
*/
|
|
4459
4535
|
openCheckout(n) {
|
|
4460
|
-
return
|
|
4536
|
+
return S(this, null, function* () {
|
|
4461
4537
|
if (!n.metadata || !n.metadata.linkToken)
|
|
4462
4538
|
throw new Error("Missing linkToken in checkout session metadata");
|
|
4463
4539
|
if (!n.metadata.clientId)
|
|
@@ -4505,19 +4581,19 @@ var to = class {
|
|
|
4505
4581
|
});
|
|
4506
4582
|
}
|
|
4507
4583
|
getPaymentStatus(n) {
|
|
4508
|
-
return
|
|
4584
|
+
return S(this, null, function* () {
|
|
4509
4585
|
throw new Error(
|
|
4510
4586
|
"getPaymentStatus not implemented - MeshPay uses webhooks for status updates"
|
|
4511
4587
|
);
|
|
4512
4588
|
});
|
|
4513
4589
|
}
|
|
4514
4590
|
};
|
|
4515
|
-
class
|
|
4591
|
+
class oe extends Error {
|
|
4516
4592
|
constructor(o, t = "PAYMENT_ERROR", r) {
|
|
4517
4593
|
super(o);
|
|
4518
4594
|
g(this, "code");
|
|
4519
4595
|
g(this, "context");
|
|
4520
|
-
this.name = "PaymentError", this.code = t, this.context = r, Error.captureStackTrace && Error.captureStackTrace(this,
|
|
4596
|
+
this.name = "PaymentError", this.code = t, this.context = r, Error.captureStackTrace && Error.captureStackTrace(this, oe);
|
|
4521
4597
|
}
|
|
4522
4598
|
toJSON() {
|
|
4523
4599
|
return {
|
|
@@ -4529,23 +4605,23 @@ class q extends Error {
|
|
|
4529
4605
|
};
|
|
4530
4606
|
}
|
|
4531
4607
|
}
|
|
4532
|
-
class
|
|
4608
|
+
class O extends oe {
|
|
4533
4609
|
constructor(e, o) {
|
|
4534
4610
|
super(e, "PAYMENT_VALIDATION_ERROR", o), this.name = "PaymentValidationError";
|
|
4535
4611
|
}
|
|
4536
4612
|
}
|
|
4537
|
-
class
|
|
4613
|
+
class j extends oe {
|
|
4538
4614
|
constructor(e, o) {
|
|
4539
4615
|
super(e, "PAYMENT_EXECUTION_ERROR", o), this.name = "PaymentExecutionError";
|
|
4540
4616
|
}
|
|
4541
4617
|
}
|
|
4542
|
-
class
|
|
4618
|
+
class Q extends Error {
|
|
4543
4619
|
constructor(o, t = "ADAPTER_ERROR", r, i) {
|
|
4544
4620
|
super(o);
|
|
4545
4621
|
g(this, "code");
|
|
4546
4622
|
g(this, "vendorId");
|
|
4547
4623
|
g(this, "context");
|
|
4548
|
-
this.name = "AdapterError", this.code = t, this.vendorId = r, this.context = i, Error.captureStackTrace && Error.captureStackTrace(this,
|
|
4624
|
+
this.name = "AdapterError", this.code = t, this.vendorId = r, this.context = i, Error.captureStackTrace && Error.captureStackTrace(this, Q);
|
|
4549
4625
|
}
|
|
4550
4626
|
toJSON() {
|
|
4551
4627
|
return {
|
|
@@ -4558,7 +4634,7 @@ class Y extends Error {
|
|
|
4558
4634
|
};
|
|
4559
4635
|
}
|
|
4560
4636
|
}
|
|
4561
|
-
class
|
|
4637
|
+
class go extends Q {
|
|
4562
4638
|
constructor(e, o) {
|
|
4563
4639
|
super(
|
|
4564
4640
|
`Payment adapter for vendor "${e}" not found`,
|
|
@@ -4568,7 +4644,7 @@ class so extends Y {
|
|
|
4568
4644
|
), this.name = "AdapterNotFoundError";
|
|
4569
4645
|
}
|
|
4570
4646
|
}
|
|
4571
|
-
class
|
|
4647
|
+
class uo extends Q {
|
|
4572
4648
|
constructor(e, o, t) {
|
|
4573
4649
|
super(
|
|
4574
4650
|
`Failed to initialize adapter for vendor "${e}": ${o}`,
|
|
@@ -4578,7 +4654,7 @@ class co extends Y {
|
|
|
4578
4654
|
), this.name = "AdapterInitializationError";
|
|
4579
4655
|
}
|
|
4580
4656
|
}
|
|
4581
|
-
class
|
|
4657
|
+
class ho extends Q {
|
|
4582
4658
|
constructor(e, o, t) {
|
|
4583
4659
|
super(
|
|
4584
4660
|
`Configuration error for adapter "${e}": ${o}`,
|
|
@@ -4588,7 +4664,7 @@ class io extends Y {
|
|
|
4588
4664
|
), this.name = "AdapterConfigurationError";
|
|
4589
4665
|
}
|
|
4590
4666
|
}
|
|
4591
|
-
class
|
|
4667
|
+
class Ce {
|
|
4592
4668
|
constructor() {
|
|
4593
4669
|
g(this, "adapters", /* @__PURE__ */ new Map());
|
|
4594
4670
|
g(this, "initialized", !1);
|
|
@@ -4598,7 +4674,7 @@ class Ie {
|
|
|
4598
4674
|
*/
|
|
4599
4675
|
register(e) {
|
|
4600
4676
|
if (this.adapters.has(e.id))
|
|
4601
|
-
throw new
|
|
4677
|
+
throw new ho(
|
|
4602
4678
|
e.id,
|
|
4603
4679
|
"Adapter already registered"
|
|
4604
4680
|
);
|
|
@@ -4610,7 +4686,7 @@ class Ie {
|
|
|
4610
4686
|
get(e) {
|
|
4611
4687
|
const o = this.adapters.get(e);
|
|
4612
4688
|
if (!o)
|
|
4613
|
-
throw new
|
|
4689
|
+
throw new go(e);
|
|
4614
4690
|
return o;
|
|
4615
4691
|
}
|
|
4616
4692
|
/**
|
|
@@ -4635,15 +4711,15 @@ class Ie {
|
|
|
4635
4711
|
* Initialize all registered adapters
|
|
4636
4712
|
*/
|
|
4637
4713
|
initialize(e) {
|
|
4638
|
-
return
|
|
4714
|
+
return S(this, null, function* () {
|
|
4639
4715
|
if (this.initialized)
|
|
4640
4716
|
return;
|
|
4641
4717
|
const o = Array.from(this.adapters.entries()).map(
|
|
4642
|
-
(i) =>
|
|
4718
|
+
(i) => S(this, [i], function* ([t, r]) {
|
|
4643
4719
|
try {
|
|
4644
4720
|
yield r.initialize(e);
|
|
4645
4721
|
} catch (a) {
|
|
4646
|
-
throw new
|
|
4722
|
+
throw new uo(
|
|
4647
4723
|
t,
|
|
4648
4724
|
a instanceof Error ? a.message : "Unknown error",
|
|
4649
4725
|
{ originalError: a }
|
|
@@ -4674,12 +4750,12 @@ class Ie {
|
|
|
4674
4750
|
return o && this.adapters.size === 0 && (this.initialized = !1), o;
|
|
4675
4751
|
}
|
|
4676
4752
|
}
|
|
4677
|
-
class
|
|
4753
|
+
class he {
|
|
4678
4754
|
constructor(e) {
|
|
4679
4755
|
g(this, "registry");
|
|
4680
|
-
g(this, "currencyService",
|
|
4756
|
+
g(this, "currencyService", Ue);
|
|
4681
4757
|
g(this, "networkService", we);
|
|
4682
|
-
g(this, "paymentMethodService",
|
|
4758
|
+
g(this, "paymentMethodService", Se);
|
|
4683
4759
|
g(this, "options");
|
|
4684
4760
|
g(this, "clientMode", !1);
|
|
4685
4761
|
/**
|
|
@@ -4690,20 +4766,20 @@ class ge {
|
|
|
4690
4766
|
* Create a payment intent and checkout session
|
|
4691
4767
|
* Automatically selects the best vendor
|
|
4692
4768
|
*/
|
|
4693
|
-
create: (e) =>
|
|
4769
|
+
create: (e) => S(this, null, function* () {
|
|
4694
4770
|
var r;
|
|
4695
4771
|
if (!this.isInitialized())
|
|
4696
|
-
throw new
|
|
4772
|
+
throw new j("W3Payments client not initialized");
|
|
4697
4773
|
if (!e.amount || e.amount <= 0)
|
|
4698
|
-
throw new
|
|
4774
|
+
throw new O("Amount must be greater than 0");
|
|
4699
4775
|
if (!e.currency)
|
|
4700
|
-
throw new
|
|
4776
|
+
throw new O("Currency is required");
|
|
4701
4777
|
if (!e.id)
|
|
4702
|
-
throw new
|
|
4778
|
+
throw new O("Payment ID is required");
|
|
4703
4779
|
if (!e.customerId)
|
|
4704
|
-
throw new
|
|
4780
|
+
throw new O("Customer ID is required");
|
|
4705
4781
|
if (!e.destinations || e.destinations.length === 0)
|
|
4706
|
-
throw new
|
|
4782
|
+
throw new O(
|
|
4707
4783
|
"At least one destination is required"
|
|
4708
4784
|
);
|
|
4709
4785
|
const o = this.selectBestVendor(e), t = {
|
|
@@ -4724,7 +4800,7 @@ class ge {
|
|
|
4724
4800
|
selectedVendor: ((r = a.metadata) == null ? void 0 : r.selectedVendor) || o
|
|
4725
4801
|
});
|
|
4726
4802
|
} catch (i) {
|
|
4727
|
-
throw new
|
|
4803
|
+
throw new j(
|
|
4728
4804
|
`Payment creation failed: ${i instanceof Error ? i.message : "Unknown error"}`,
|
|
4729
4805
|
{ intent: t, selectedVendor: o, originalError: i }
|
|
4730
4806
|
);
|
|
@@ -4733,32 +4809,32 @@ class ge {
|
|
|
4733
4809
|
/**
|
|
4734
4810
|
* Get payment status
|
|
4735
4811
|
*/
|
|
4736
|
-
retrieve: (e, o) =>
|
|
4812
|
+
retrieve: (e, o) => S(this, null, function* () {
|
|
4737
4813
|
if (!this.isInitialized())
|
|
4738
|
-
throw new
|
|
4814
|
+
throw new j("W3Payments client not initialized");
|
|
4739
4815
|
if (!e)
|
|
4740
|
-
throw new
|
|
4816
|
+
throw new O("Session ID is required");
|
|
4741
4817
|
if (!o)
|
|
4742
|
-
throw new
|
|
4818
|
+
throw new O("Vendor ID is required");
|
|
4743
4819
|
try {
|
|
4744
4820
|
return yield this.registry.get(o).getPaymentStatus(e);
|
|
4745
4821
|
} catch (t) {
|
|
4746
|
-
throw new
|
|
4822
|
+
throw new j(
|
|
4747
4823
|
`Payment status retrieval failed: ${t instanceof Error ? t.message : "Unknown error"}`,
|
|
4748
4824
|
{ sessionId: e, vendorId: o, originalError: t }
|
|
4749
4825
|
);
|
|
4750
4826
|
}
|
|
4751
4827
|
})
|
|
4752
4828
|
});
|
|
4753
|
-
this.options = e, this.registry = new
|
|
4829
|
+
this.options = e, this.registry = new Ce(), this.configureCurrencies(), this.configureNetworks(), this.registerAdapters();
|
|
4754
4830
|
}
|
|
4755
4831
|
/**
|
|
4756
4832
|
* Create a client-only instance for data access (no vendor secrets needed)
|
|
4757
4833
|
* Only initializes currencies, networks, and registers adapters without API initialization
|
|
4758
4834
|
*/
|
|
4759
4835
|
static createClient(e = "sandbox") {
|
|
4760
|
-
const o = Object.create(
|
|
4761
|
-
return o.currencyService =
|
|
4836
|
+
const o = Object.create(he.prototype);
|
|
4837
|
+
return o.currencyService = Ue, o.networkService = we, o.paymentMethodService = Se, o.registry = new Ce(), o.clientMode = !0, o.options = {
|
|
4762
4838
|
config: {
|
|
4763
4839
|
environment: e
|
|
4764
4840
|
}
|
|
@@ -4768,13 +4844,13 @@ class ge {
|
|
|
4768
4844
|
* Configure currencies from CURRENCIES data
|
|
4769
4845
|
*/
|
|
4770
4846
|
configureCurrencies() {
|
|
4771
|
-
this.currencyService.registerMany(Object.values(
|
|
4847
|
+
this.currencyService.registerMany(Object.values(oo));
|
|
4772
4848
|
}
|
|
4773
4849
|
/**
|
|
4774
4850
|
* Configure networks from NETWORKS data
|
|
4775
4851
|
*/
|
|
4776
4852
|
configureNetworks() {
|
|
4777
|
-
this.networkService.registerMany(Object.values(
|
|
4853
|
+
this.networkService.registerMany(Object.values(no));
|
|
4778
4854
|
}
|
|
4779
4855
|
/**
|
|
4780
4856
|
* Register all available adapters
|
|
@@ -4782,13 +4858,13 @@ class ge {
|
|
|
4782
4858
|
*/
|
|
4783
4859
|
registerAdapters() {
|
|
4784
4860
|
const e = this.options.config.environment || "sandbox";
|
|
4785
|
-
this.registry.register(new
|
|
4861
|
+
this.registry.register(new bo(e));
|
|
4786
4862
|
}
|
|
4787
4863
|
/**
|
|
4788
4864
|
* Initialize the W3Payments client and all adapters
|
|
4789
4865
|
*/
|
|
4790
4866
|
initialize() {
|
|
4791
|
-
return
|
|
4867
|
+
return S(this, null, function* () {
|
|
4792
4868
|
const e = P(y({}, this.options.config), {
|
|
4793
4869
|
environment: this.options.environment || this.options.config.environment
|
|
4794
4870
|
});
|
|
@@ -4844,22 +4920,22 @@ class ge {
|
|
|
4844
4920
|
* Uses the complete CheckoutSession returned from payment creation
|
|
4845
4921
|
*/
|
|
4846
4922
|
openCheckout(e) {
|
|
4847
|
-
return
|
|
4923
|
+
return S(this, null, function* () {
|
|
4848
4924
|
var t, r;
|
|
4849
4925
|
const o = ((t = e.metadata) == null ? void 0 : t.selectedVendor) || ((r = e.metadata) == null ? void 0 : r.vendorId);
|
|
4850
4926
|
if (!o)
|
|
4851
|
-
throw new
|
|
4927
|
+
throw new O(
|
|
4852
4928
|
"Vendor ID not found in session metadata"
|
|
4853
4929
|
);
|
|
4854
4930
|
try {
|
|
4855
4931
|
const i = this.registry.get(o);
|
|
4856
4932
|
if (!i.openCheckout)
|
|
4857
|
-
throw new
|
|
4933
|
+
throw new j(
|
|
4858
4934
|
`Vendor ${o} does not support client-side checkout opening`
|
|
4859
4935
|
);
|
|
4860
4936
|
return yield i.openCheckout(e);
|
|
4861
4937
|
} catch (i) {
|
|
4862
|
-
throw new
|
|
4938
|
+
throw new j(
|
|
4863
4939
|
`Checkout opening failed: ${i instanceof Error ? i.message : "Unknown error"}`,
|
|
4864
4940
|
{ sessionId: e.id, vendorId: o, originalError: i }
|
|
4865
4941
|
);
|
|
@@ -4873,78 +4949,17 @@ class ge {
|
|
|
4873
4949
|
selectBestVendor(e) {
|
|
4874
4950
|
const o = this.getAvailableVendors();
|
|
4875
4951
|
if (o.length === 0)
|
|
4876
|
-
throw new
|
|
4952
|
+
throw new j("No payment vendors available");
|
|
4877
4953
|
return e.preferredVendor && this.hasVendor(e.preferredVendor) ? e.preferredVendor : o[0];
|
|
4878
4954
|
}
|
|
4879
4955
|
}
|
|
4880
|
-
|
|
4881
|
-
return n.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
4882
|
-
}
|
|
4883
|
-
function ro() {
|
|
4884
|
-
return {
|
|
4885
|
-
colorPrimary: "#6366f1",
|
|
4886
|
-
colorPrimaryHover: "#4f46e5",
|
|
4887
|
-
colorPrimaryLight: "#e0e7ff",
|
|
4888
|
-
colorBackground: "#ffffff",
|
|
4889
|
-
colorText: "#1f2937",
|
|
4890
|
-
colorTextMuted: "#6b7280",
|
|
4891
|
-
colorBorder: "#e5e7eb",
|
|
4892
|
-
colorBorderLight: "#f3f4f6",
|
|
4893
|
-
colorDanger: "#ef4444",
|
|
4894
|
-
colorSuccess: "#10b981",
|
|
4895
|
-
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
4896
|
-
fontSize: "1rem",
|
|
4897
|
-
borderRadius: "0.5rem",
|
|
4898
|
-
spacing: "1rem"
|
|
4899
|
-
};
|
|
4900
|
-
}
|
|
4901
|
-
function ao(n) {
|
|
4902
|
-
const e = ro();
|
|
4903
|
-
switch (n) {
|
|
4904
|
-
case "dark":
|
|
4905
|
-
return P(y({}, e), {
|
|
4906
|
-
colorPrimary: "#6366f1",
|
|
4907
|
-
colorPrimaryHover: "#7c3aed",
|
|
4908
|
-
colorPrimaryLight: "#1e1b4b",
|
|
4909
|
-
colorBackground: "#111827",
|
|
4910
|
-
colorText: "#f9fafb",
|
|
4911
|
-
colorTextMuted: "#9ca3af",
|
|
4912
|
-
colorBorder: "#374151",
|
|
4913
|
-
colorBorderLight: "#4b5563"
|
|
4914
|
-
});
|
|
4915
|
-
case "light":
|
|
4916
|
-
default:
|
|
4917
|
-
return e;
|
|
4918
|
-
}
|
|
4919
|
-
}
|
|
4920
|
-
function lo(n, e) {
|
|
4921
|
-
var i;
|
|
4922
|
-
const o = typeof n == "string" ? { theme: n } : n, t = ao((i = o.theme) != null ? i : "light"), r = y(y({}, t), o.variables);
|
|
4923
|
-
Object.entries(r).forEach(([a, l]) => {
|
|
4924
|
-
if (l !== void 0) {
|
|
4925
|
-
const d = `--${xe(a)}`;
|
|
4926
|
-
e.style.setProperty(d, l);
|
|
4927
|
-
}
|
|
4928
|
-
}), o.theme && e.setAttribute("data-theme", o.theme), o.rules && po(o.rules);
|
|
4929
|
-
}
|
|
4930
|
-
function po(n) {
|
|
4931
|
-
const e = "w3-theme-rules";
|
|
4932
|
-
let o = document.getElementById(e);
|
|
4933
|
-
o || (o = document.createElement("style"), o.id = e, document.head.appendChild(o));
|
|
4934
|
-
const t = Object.entries(n).map(([r, i]) => {
|
|
4935
|
-
const a = Object.entries(i).map(([l, d]) => `${xe(l)}: ${d};`).join(" ");
|
|
4936
|
-
return `.w3-widget ${r} { ${a} }`;
|
|
4937
|
-
}).join(`
|
|
4938
|
-
`);
|
|
4939
|
-
o.textContent = t;
|
|
4940
|
-
}
|
|
4941
|
-
class mo {
|
|
4956
|
+
class fo {
|
|
4942
4957
|
constructor(e) {
|
|
4943
4958
|
g(this, "config");
|
|
4944
4959
|
this.config = e;
|
|
4945
4960
|
}
|
|
4946
4961
|
makeRequest(t) {
|
|
4947
|
-
return
|
|
4962
|
+
return S(this, arguments, function* (e, o = {}) {
|
|
4948
4963
|
const r = yield globalThis.fetch(`${this.config.endpoint}${e}`, y({
|
|
4949
4964
|
headers: y(y({
|
|
4950
4965
|
"Content-Type": "application/json"
|
|
@@ -4956,7 +4971,7 @@ class mo {
|
|
|
4956
4971
|
});
|
|
4957
4972
|
}
|
|
4958
4973
|
createPayment(e) {
|
|
4959
|
-
return
|
|
4974
|
+
return S(this, null, function* () {
|
|
4960
4975
|
return this.makeRequest("/payment/create", {
|
|
4961
4976
|
method: "POST",
|
|
4962
4977
|
body: JSON.stringify(e)
|
|
@@ -4964,7 +4979,7 @@ class mo {
|
|
|
4964
4979
|
});
|
|
4965
4980
|
}
|
|
4966
4981
|
getPaymentStatus(e, o) {
|
|
4967
|
-
return
|
|
4982
|
+
return S(this, null, function* () {
|
|
4968
4983
|
return this.makeRequest(`/payment/${e}?vendorId=${o}`, {
|
|
4969
4984
|
method: "GET"
|
|
4970
4985
|
});
|
|
@@ -4974,41 +4989,41 @@ class mo {
|
|
|
4974
4989
|
return !!this.config.endpoint;
|
|
4975
4990
|
}
|
|
4976
4991
|
}
|
|
4977
|
-
const
|
|
4992
|
+
const fe = Xe(
|
|
4978
4993
|
null
|
|
4979
4994
|
);
|
|
4980
|
-
|
|
4981
|
-
const
|
|
4995
|
+
fe.displayName = "W3PaymentsContext";
|
|
4996
|
+
const Co = ({
|
|
4982
4997
|
endpoint: n,
|
|
4983
4998
|
environment: e = "sandbox",
|
|
4984
4999
|
theme: o,
|
|
4985
5000
|
children: t
|
|
4986
5001
|
}) => {
|
|
4987
|
-
const { w3payments: r, httpClient: i, isInitialized: a, initError: l } =
|
|
5002
|
+
const { w3payments: r, httpClient: i, isInitialized: a, initError: l } = me(() => {
|
|
4988
5003
|
try {
|
|
4989
5004
|
console.debug("W3PaymentsProvider: Initializing clients...");
|
|
4990
|
-
const u =
|
|
5005
|
+
const u = he.createClient(e), U = new fo({ endpoint: n });
|
|
4991
5006
|
return console.debug(
|
|
4992
5007
|
"W3PaymentsProvider: Both clients initialized successfully"
|
|
4993
5008
|
), {
|
|
4994
5009
|
w3payments: u,
|
|
4995
|
-
httpClient:
|
|
5010
|
+
httpClient: U,
|
|
4996
5011
|
isInitialized: !0,
|
|
4997
5012
|
initError: null
|
|
4998
5013
|
};
|
|
4999
5014
|
} catch (u) {
|
|
5000
|
-
const
|
|
5015
|
+
const U = u instanceof Error ? u.message : "Failed to initialize W3Payments clients";
|
|
5001
5016
|
return console.error("W3PaymentsProvider initialization error:", u), {
|
|
5002
5017
|
w3payments: null,
|
|
5003
5018
|
httpClient: null,
|
|
5004
5019
|
isInitialized: !1,
|
|
5005
|
-
initError:
|
|
5020
|
+
initError: U
|
|
5006
5021
|
};
|
|
5007
5022
|
}
|
|
5008
5023
|
}, [n, e]);
|
|
5009
|
-
|
|
5010
|
-
o && document.querySelectorAll(".w3-widget").forEach((
|
|
5011
|
-
|
|
5024
|
+
Ve(() => {
|
|
5025
|
+
o && document.querySelectorAll(".w3-widget").forEach((U) => {
|
|
5026
|
+
qe(o, U);
|
|
5012
5027
|
});
|
|
5013
5028
|
}, [o]);
|
|
5014
5029
|
const d = {
|
|
@@ -5035,7 +5050,7 @@ const So = ({
|
|
|
5035
5050
|
/* @__PURE__ */ c.jsx("p", { style: { margin: "8px 0 0 0" }, children: l })
|
|
5036
5051
|
]
|
|
5037
5052
|
}
|
|
5038
|
-
) : a ? /* @__PURE__ */ c.jsx(
|
|
5053
|
+
) : a ? /* @__PURE__ */ c.jsx(fe.Provider, { value: d, children: t }) : /* @__PURE__ */ c.jsx(
|
|
5039
5054
|
"div",
|
|
5040
5055
|
{
|
|
5041
5056
|
className: "w3-loading-container",
|
|
@@ -5048,14 +5063,14 @@ const So = ({
|
|
|
5048
5063
|
children: "Initializing W3Payments..."
|
|
5049
5064
|
}
|
|
5050
5065
|
);
|
|
5051
|
-
},
|
|
5052
|
-
const n =
|
|
5066
|
+
}, vo = () => {
|
|
5067
|
+
const n = Ge(fe);
|
|
5053
5068
|
if (!n)
|
|
5054
5069
|
throw new Error(
|
|
5055
5070
|
"useW3Payments must be used within W3PaymentsProvider. Make sure your component is wrapped with <W3PaymentsProvider>."
|
|
5056
5071
|
);
|
|
5057
5072
|
return n;
|
|
5058
|
-
},
|
|
5073
|
+
}, yo = ({
|
|
5059
5074
|
title: n,
|
|
5060
5075
|
logo: e
|
|
5061
5076
|
}) => /* @__PURE__ */ c.jsx(
|
|
@@ -5081,21 +5096,25 @@ const So = ({
|
|
|
5081
5096
|
)
|
|
5082
5097
|
] })
|
|
5083
5098
|
}
|
|
5084
|
-
),
|
|
5099
|
+
), To = ({
|
|
5085
5100
|
title: n,
|
|
5086
5101
|
subtext: e,
|
|
5087
5102
|
amount: o,
|
|
5088
5103
|
currency: t,
|
|
5089
5104
|
editable: r = !0,
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
className: l = ""
|
|
5105
|
+
onAmountChange: i,
|
|
5106
|
+
className: a = ""
|
|
5093
5107
|
}) => {
|
|
5094
|
-
const [
|
|
5095
|
-
const
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5108
|
+
const [l, d] = ee(null), u = (U) => {
|
|
5109
|
+
const w = U.target.value;
|
|
5110
|
+
if (w && !$e(w, t)) {
|
|
5111
|
+
const C = Qe(w, t);
|
|
5112
|
+
i == null || i(C);
|
|
5113
|
+
return;
|
|
5114
|
+
}
|
|
5115
|
+
i == null || i(w);
|
|
5116
|
+
};
|
|
5117
|
+
return /* @__PURE__ */ c.jsxs("div", { className: `${a}`, children: [
|
|
5099
5118
|
n && /* @__PURE__ */ c.jsx(
|
|
5100
5119
|
"h3",
|
|
5101
5120
|
{
|
|
@@ -5121,7 +5140,7 @@ const So = ({
|
|
|
5121
5140
|
children: e
|
|
5122
5141
|
}
|
|
5123
5142
|
),
|
|
5124
|
-
/* @__PURE__ */ c.
|
|
5143
|
+
/* @__PURE__ */ c.jsx(
|
|
5125
5144
|
"div",
|
|
5126
5145
|
{
|
|
5127
5146
|
style: {
|
|
@@ -5129,86 +5148,73 @@ const So = ({
|
|
|
5129
5148
|
flexDirection: "column",
|
|
5130
5149
|
gap: "calc(var(--spacing) * 0.5)"
|
|
5131
5150
|
},
|
|
5132
|
-
children:
|
|
5133
|
-
|
|
5134
|
-
|
|
5135
|
-
{
|
|
5136
|
-
|
|
5137
|
-
|
|
5138
|
-
|
|
5139
|
-
|
|
5140
|
-
|
|
5141
|
-
|
|
5142
|
-
|
|
5143
|
-
|
|
5144
|
-
|
|
5145
|
-
|
|
5146
|
-
|
|
5147
|
-
|
|
5148
|
-
|
|
5149
|
-
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
|
|
5153
|
-
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
{
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
{
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
|
|
5191
|
-
|
|
5192
|
-
|
|
5193
|
-
|
|
5194
|
-
|
|
5195
|
-
),
|
|
5196
|
-
i && o && (typeof t == "string" ? t : t.code) !== "USD" && /* @__PURE__ */ c.jsx(
|
|
5197
|
-
"div",
|
|
5198
|
-
{
|
|
5199
|
-
style: {
|
|
5200
|
-
fontSize: "var(--font-size-sm)",
|
|
5201
|
-
color: "var(--text-secondary)",
|
|
5202
|
-
textAlign: "right"
|
|
5203
|
-
},
|
|
5204
|
-
children: M(o, i)
|
|
5205
|
-
}
|
|
5206
|
-
)
|
|
5207
|
-
]
|
|
5151
|
+
children: /* @__PURE__ */ c.jsxs(
|
|
5152
|
+
"div",
|
|
5153
|
+
{
|
|
5154
|
+
style: {
|
|
5155
|
+
position: "relative",
|
|
5156
|
+
display: "flex",
|
|
5157
|
+
alignItems: "center"
|
|
5158
|
+
},
|
|
5159
|
+
children: [
|
|
5160
|
+
/* @__PURE__ */ c.jsx(
|
|
5161
|
+
"input",
|
|
5162
|
+
{
|
|
5163
|
+
type: "text",
|
|
5164
|
+
inputMode: "decimal",
|
|
5165
|
+
style: {
|
|
5166
|
+
width: "100%",
|
|
5167
|
+
padding: "calc(var(--spacing) * 0.75) calc(var(--spacing) * 3.5) calc(var(--spacing) * 0.75) var(--spacing)",
|
|
5168
|
+
fontSize: "var(--font-size-base)",
|
|
5169
|
+
fontWeight: 500,
|
|
5170
|
+
border: `1px solid ${l === "amount" ? "var(--color-primary)" : "var(--color-border)"}`,
|
|
5171
|
+
borderRadius: "var(--border-radius)",
|
|
5172
|
+
backgroundColor: r ? "var(--color-background)" : "var(--color-border-light)",
|
|
5173
|
+
color: "var(--color-text)",
|
|
5174
|
+
outline: "none",
|
|
5175
|
+
transition: "all 0.2s",
|
|
5176
|
+
boxShadow: l === "amount" ? "0 0 0 2px var(--primary-alpha-20)" : "none",
|
|
5177
|
+
cursor: r ? "text" : "not-allowed"
|
|
5178
|
+
},
|
|
5179
|
+
value: o,
|
|
5180
|
+
onChange: u,
|
|
5181
|
+
onFocus: () => d("amount"),
|
|
5182
|
+
onBlur: () => d(null),
|
|
5183
|
+
disabled: !r,
|
|
5184
|
+
placeholder: _e(0, t.decimals),
|
|
5185
|
+
"aria-label": "Payment amount"
|
|
5186
|
+
}
|
|
5187
|
+
),
|
|
5188
|
+
/* @__PURE__ */ c.jsx(
|
|
5189
|
+
"div",
|
|
5190
|
+
{
|
|
5191
|
+
style: {
|
|
5192
|
+
position: "absolute",
|
|
5193
|
+
right: "var(--spacing)",
|
|
5194
|
+
top: "50%",
|
|
5195
|
+
transform: "translateY(-50%)",
|
|
5196
|
+
pointerEvents: "none"
|
|
5197
|
+
},
|
|
5198
|
+
children: /* @__PURE__ */ c.jsx(
|
|
5199
|
+
"span",
|
|
5200
|
+
{
|
|
5201
|
+
style: {
|
|
5202
|
+
fontSize: "var(--font-size-base)",
|
|
5203
|
+
fontWeight: 500,
|
|
5204
|
+
color: "var(--color-text-muted)"
|
|
5205
|
+
},
|
|
5206
|
+
children: typeof t == "string" ? t : t.code
|
|
5207
|
+
}
|
|
5208
|
+
)
|
|
5209
|
+
}
|
|
5210
|
+
)
|
|
5211
|
+
]
|
|
5212
|
+
}
|
|
5213
|
+
)
|
|
5208
5214
|
}
|
|
5209
5215
|
)
|
|
5210
5216
|
] });
|
|
5211
|
-
},
|
|
5217
|
+
}, Do = ({
|
|
5212
5218
|
children: n,
|
|
5213
5219
|
title: e = "Select Payment Method"
|
|
5214
5220
|
}) => /* @__PURE__ */ c.jsxs(
|
|
@@ -5232,19 +5238,19 @@ const So = ({
|
|
|
5232
5238
|
/* @__PURE__ */ c.jsx("div", { className: "space-y-0", children: n })
|
|
5233
5239
|
]
|
|
5234
5240
|
}
|
|
5235
|
-
),
|
|
5241
|
+
), de = ({
|
|
5236
5242
|
label: n,
|
|
5237
5243
|
description: e,
|
|
5238
5244
|
children: o,
|
|
5239
5245
|
showDisabled: t = !0
|
|
5240
5246
|
}) => {
|
|
5241
|
-
const r =
|
|
5247
|
+
const r = We.toArray(o).filter((i) => {
|
|
5242
5248
|
var a, l, d;
|
|
5243
|
-
return !t &&
|
|
5249
|
+
return !t && ae(i) && (d = (l = (a = i.props) == null ? void 0 : a.method) == null ? void 0 : l.enabled) != null ? d : !0;
|
|
5244
5250
|
}).sort((i, a) => {
|
|
5245
|
-
var u,
|
|
5246
|
-
if (!
|
|
5247
|
-
const l = (
|
|
5251
|
+
var u, U, w, C, E, x;
|
|
5252
|
+
if (!ae(i) || !ae(a)) return 0;
|
|
5253
|
+
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;
|
|
5248
5254
|
return l && !d ? -1 : !l && d ? 1 : 0;
|
|
5249
5255
|
});
|
|
5250
5256
|
return /* @__PURE__ */ c.jsxs(
|
|
@@ -5282,15 +5288,15 @@ const So = ({
|
|
|
5282
5288
|
]
|
|
5283
5289
|
}
|
|
5284
5290
|
);
|
|
5285
|
-
},
|
|
5291
|
+
}, pe = ({
|
|
5286
5292
|
data: n,
|
|
5287
5293
|
selected: e = !1,
|
|
5288
5294
|
onClick: o
|
|
5289
5295
|
}) => {
|
|
5290
5296
|
const t = n.enabled === !1, i = ((a) => {
|
|
5291
5297
|
const l = a.toLowerCase();
|
|
5292
|
-
let d =
|
|
5293
|
-
if (d || (d =
|
|
5298
|
+
let d = Me(a);
|
|
5299
|
+
if (d || (d = xe(l), d) || (d = Ne(l), d)) return d;
|
|
5294
5300
|
})(n.displayName);
|
|
5295
5301
|
return /* @__PURE__ */ c.jsxs("div", { className: "relative", children: [
|
|
5296
5302
|
/* @__PURE__ */ c.jsxs(
|
|
@@ -5324,7 +5330,7 @@ const So = ({
|
|
|
5324
5330
|
),
|
|
5325
5331
|
t && /* @__PURE__ */ c.jsx("div", { className: "absolute inset-0 bg-white/50 flex items-center justify-center pointer-events-none rounded-[var(--border-radius)]", children: /* @__PURE__ */ c.jsx("span", { className: "text-[0.5rem] font-semibold text-[var(--color-text-muted)] text-center", children: n.disabledMessage || "Not Available" }) })
|
|
5326
5332
|
] });
|
|
5327
|
-
},
|
|
5333
|
+
}, ko = ({
|
|
5328
5334
|
selectedMethod: n,
|
|
5329
5335
|
processingFee: e = 1.5,
|
|
5330
5336
|
// @TODO: Make this dynamic based on payment method
|
|
@@ -5335,8 +5341,8 @@ const So = ({
|
|
|
5335
5341
|
return null;
|
|
5336
5342
|
const r = ((i) => {
|
|
5337
5343
|
const a = i.toLowerCase();
|
|
5338
|
-
let l =
|
|
5339
|
-
if (l || (l =
|
|
5344
|
+
let l = Me(i);
|
|
5345
|
+
if (l || (l = xe(a), l) || (l = Ne(a), l)) return l;
|
|
5340
5346
|
})(n.displayName);
|
|
5341
5347
|
return /* @__PURE__ */ c.jsx(
|
|
5342
5348
|
"div",
|
|
@@ -5409,7 +5415,7 @@ const So = ({
|
|
|
5409
5415
|
] })
|
|
5410
5416
|
}
|
|
5411
5417
|
);
|
|
5412
|
-
},
|
|
5418
|
+
}, So = ({
|
|
5413
5419
|
amount: n,
|
|
5414
5420
|
currencySymbol: e = "$",
|
|
5415
5421
|
disabled: o = !1,
|
|
@@ -5494,7 +5500,7 @@ const So = ({
|
|
|
5494
5500
|
] })
|
|
5495
5501
|
}
|
|
5496
5502
|
);
|
|
5497
|
-
},
|
|
5503
|
+
}, Uo = ({
|
|
5498
5504
|
brandingText: n = "Payments",
|
|
5499
5505
|
showSecured: e = !0
|
|
5500
5506
|
}) => /* @__PURE__ */ c.jsx(
|
|
@@ -5581,68 +5587,69 @@ const So = ({
|
|
|
5581
5587
|
}
|
|
5582
5588
|
)
|
|
5583
5589
|
}
|
|
5584
|
-
),
|
|
5590
|
+
), Eo = ({
|
|
5585
5591
|
title: n = "W3 Payments",
|
|
5586
5592
|
logo: e,
|
|
5587
5593
|
userId: o,
|
|
5588
5594
|
transactionId: t,
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5595
|
+
amount: r = "",
|
|
5596
|
+
editable: i = !0,
|
|
5597
|
+
amountTitle: a = "Enter payment amount",
|
|
5598
|
+
currency: l = "USD",
|
|
5599
|
+
targetCurrency: d,
|
|
5600
|
+
targetNetwork: u,
|
|
5601
|
+
destinations: U,
|
|
5602
|
+
walletFilter: w,
|
|
5603
|
+
exchangeFilter: C,
|
|
5604
|
+
fiatFilter: E,
|
|
5605
|
+
onInitiate: x,
|
|
5606
|
+
onComplete: R,
|
|
5607
|
+
onError: T
|
|
5601
5608
|
}) => {
|
|
5602
|
-
var
|
|
5603
|
-
const { w3payments: I, httpClient:
|
|
5604
|
-
walletFilter:
|
|
5605
|
-
exchangeFilter:
|
|
5606
|
-
fiatFilter:
|
|
5607
|
-
targetCurrency:
|
|
5608
|
-
targetNetwork:
|
|
5609
|
+
var Y;
|
|
5610
|
+
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]), N = me(() => !G || !I ? [] : I.paymentMethodService.getDisplayOptions({
|
|
5611
|
+
walletFilter: w,
|
|
5612
|
+
exchangeFilter: C,
|
|
5613
|
+
fiatFilter: E,
|
|
5614
|
+
targetCurrency: d,
|
|
5615
|
+
targetNetwork: u
|
|
5609
5616
|
}), [
|
|
5610
|
-
|
|
5617
|
+
G,
|
|
5611
5618
|
I,
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
]),
|
|
5618
|
-
|
|
5619
|
-
},
|
|
5619
|
+
w,
|
|
5620
|
+
C,
|
|
5621
|
+
E,
|
|
5622
|
+
d,
|
|
5623
|
+
u
|
|
5624
|
+
]), Z = (m) => N.find((b) => b.id === m), z = () => !!(M && D && A && I && G), se = () => {
|
|
5625
|
+
K(""), L(void 0), B(!1);
|
|
5626
|
+
}, F = () => S(null, null, function* () {
|
|
5620
5627
|
var m;
|
|
5621
|
-
if (!(!
|
|
5622
|
-
|
|
5628
|
+
if (!(!z() || !I || !A)) {
|
|
5629
|
+
B(!0);
|
|
5623
5630
|
try {
|
|
5624
|
-
yield
|
|
5625
|
-
amount:
|
|
5626
|
-
currency:
|
|
5627
|
-
paymentMethodId:
|
|
5631
|
+
yield x == null ? void 0 : x(y({
|
|
5632
|
+
amount: M,
|
|
5633
|
+
currency: A.code,
|
|
5634
|
+
paymentMethodId: D
|
|
5628
5635
|
}, o && { userId: o })), console.log("Initiating payment with:", {
|
|
5629
|
-
amount:
|
|
5630
|
-
currency:
|
|
5631
|
-
paymentMethodId:
|
|
5636
|
+
amount: M,
|
|
5637
|
+
currency: A.code,
|
|
5638
|
+
paymentMethodId: D
|
|
5632
5639
|
});
|
|
5633
|
-
const b = yield
|
|
5640
|
+
const b = yield ne.createPayment({
|
|
5634
5641
|
id: t || `payment_${Date.now()}`,
|
|
5635
|
-
amount: parseFloat(
|
|
5636
|
-
currency:
|
|
5642
|
+
amount: parseFloat(M),
|
|
5643
|
+
currency: A.code,
|
|
5637
5644
|
customerId: o || "anonymous",
|
|
5638
|
-
destinations:
|
|
5645
|
+
destinations: U,
|
|
5639
5646
|
metadata: {
|
|
5640
|
-
paymentMethodId:
|
|
5647
|
+
paymentMethodId: D
|
|
5641
5648
|
}
|
|
5642
5649
|
});
|
|
5643
5650
|
if (console.log("Payment session created successfully:", b), I && b)
|
|
5644
5651
|
try {
|
|
5645
|
-
const
|
|
5652
|
+
const k = yield I.openCheckout({
|
|
5646
5653
|
id: b.id,
|
|
5647
5654
|
url: b.url,
|
|
5648
5655
|
expiresAt: b.expiresAt,
|
|
@@ -5651,62 +5658,62 @@ const So = ({
|
|
|
5651
5658
|
vendorId: b.selectedVendor
|
|
5652
5659
|
})
|
|
5653
5660
|
});
|
|
5654
|
-
if (console.log("Checkout result:",
|
|
5655
|
-
console.log("Payment cancelled by user"),
|
|
5661
|
+
if (console.log("Checkout result:", k), k.status === "cancelled") {
|
|
5662
|
+
console.log("Payment cancelled by user"), T == null || T({
|
|
5656
5663
|
message: "Payment cancelled by user",
|
|
5657
5664
|
transactionId: b.id,
|
|
5658
5665
|
userId: o || "anonymous",
|
|
5659
5666
|
code: "PAYMENT_CANCELLED"
|
|
5660
5667
|
});
|
|
5661
5668
|
return;
|
|
5662
|
-
} else if (
|
|
5663
|
-
|
|
5664
|
-
message: ((m =
|
|
5669
|
+
} else if (k.status === "failed") {
|
|
5670
|
+
T == null || T({
|
|
5671
|
+
message: ((m = k.data) == null ? void 0 : m.message) || "Payment failed",
|
|
5665
5672
|
transactionId: b.id,
|
|
5666
5673
|
userId: o || "anonymous",
|
|
5667
|
-
details:
|
|
5674
|
+
details: k.data
|
|
5668
5675
|
});
|
|
5669
5676
|
return;
|
|
5670
5677
|
} else
|
|
5671
|
-
|
|
5672
|
-
amount:
|
|
5673
|
-
currency:
|
|
5674
|
-
paymentMethodId:
|
|
5675
|
-
transactionId:
|
|
5678
|
+
R == null || R(P(y({
|
|
5679
|
+
amount: M,
|
|
5680
|
+
currency: A.code,
|
|
5681
|
+
paymentMethodId: D,
|
|
5682
|
+
transactionId: k.id,
|
|
5676
5683
|
vendorId: b.selectedVendor || "unknown",
|
|
5677
|
-
status:
|
|
5684
|
+
status: k.status
|
|
5678
5685
|
}, o && { userId: o }), {
|
|
5679
|
-
checkoutData:
|
|
5680
|
-
})),
|
|
5681
|
-
} catch (
|
|
5682
|
-
console.error("Checkout failed:",
|
|
5683
|
-
message: `Checkout failed: ${
|
|
5686
|
+
checkoutData: k.data
|
|
5687
|
+
})), se();
|
|
5688
|
+
} catch (k) {
|
|
5689
|
+
console.error("Checkout failed:", k), T == null || T({
|
|
5690
|
+
message: `Checkout failed: ${k instanceof Error ? k.message : "Unknown error"}`,
|
|
5684
5691
|
transactionId: b.id,
|
|
5685
5692
|
userId: o || "anonymous",
|
|
5686
|
-
details:
|
|
5693
|
+
details: k
|
|
5687
5694
|
});
|
|
5688
5695
|
}
|
|
5689
5696
|
else
|
|
5690
|
-
|
|
5691
|
-
amount:
|
|
5692
|
-
currency:
|
|
5693
|
-
paymentMethodId:
|
|
5697
|
+
R == null || R(y({
|
|
5698
|
+
amount: M,
|
|
5699
|
+
currency: A.code,
|
|
5700
|
+
paymentMethodId: D,
|
|
5694
5701
|
transactionId: b.id,
|
|
5695
5702
|
vendorId: b.selectedVendor || "unknown",
|
|
5696
5703
|
status: "pending"
|
|
5697
5704
|
}, o && { userId: o }));
|
|
5698
5705
|
} catch (b) {
|
|
5699
|
-
console.error("Payment failed:", b),
|
|
5706
|
+
console.error("Payment failed:", b), T == null || T(P(y(y({
|
|
5700
5707
|
message: b instanceof Error ? b.message : "Payment failed"
|
|
5701
5708
|
}, t && { transactionId: t }), o && { userId: o }), {
|
|
5702
5709
|
details: b
|
|
5703
5710
|
}));
|
|
5704
5711
|
} finally {
|
|
5705
|
-
|
|
5712
|
+
B(!1);
|
|
5706
5713
|
}
|
|
5707
5714
|
}
|
|
5708
5715
|
});
|
|
5709
|
-
return
|
|
5716
|
+
return G ? /* @__PURE__ */ c.jsxs(
|
|
5710
5717
|
"div",
|
|
5711
5718
|
{
|
|
5712
5719
|
className: `
|
|
@@ -5722,56 +5729,55 @@ const So = ({
|
|
|
5722
5729
|
`,
|
|
5723
5730
|
children: [
|
|
5724
5731
|
/* @__PURE__ */ c.jsxs("div", { className: "flex flex-col gap-0.5 flex-1 overflow-y-auto pb-1", children: [
|
|
5725
|
-
/* @__PURE__ */ c.jsx(
|
|
5726
|
-
|
|
5727
|
-
|
|
5732
|
+
/* @__PURE__ */ c.jsx(yo, y({ title: n }, e && { logo: e })),
|
|
5733
|
+
A && /* @__PURE__ */ c.jsx("div", { className: "px-[var(--spacing)]", children: /* @__PURE__ */ c.jsx(
|
|
5734
|
+
To,
|
|
5728
5735
|
{
|
|
5729
|
-
title:
|
|
5730
|
-
amount:
|
|
5731
|
-
currency:
|
|
5732
|
-
editable:
|
|
5733
|
-
|
|
5734
|
-
onAmountChange: _
|
|
5736
|
+
title: a,
|
|
5737
|
+
amount: M,
|
|
5738
|
+
currency: A,
|
|
5739
|
+
editable: i,
|
|
5740
|
+
onAmountChange: K
|
|
5735
5741
|
}
|
|
5736
5742
|
) }),
|
|
5737
5743
|
/* @__PURE__ */ c.jsxs(
|
|
5738
|
-
|
|
5739
|
-
P(y({},
|
|
5740
|
-
onMethodSelect:
|
|
5744
|
+
Do,
|
|
5745
|
+
P(y({}, D && { selectedMethodId: D }), {
|
|
5746
|
+
onMethodSelect: L,
|
|
5741
5747
|
children: [
|
|
5742
|
-
N.filter((m) => m.method === "wallet").length > 0 && /* @__PURE__ */ c.jsx(
|
|
5743
|
-
|
|
5748
|
+
N.filter((m) => m.method === "wallet").length > 0 && /* @__PURE__ */ c.jsx(de, { label: "Crypto Wallets", children: N.filter((m) => m.method === "wallet").map((m, b) => /* @__PURE__ */ c.jsx(
|
|
5749
|
+
pe,
|
|
5744
5750
|
{
|
|
5745
5751
|
data: {
|
|
5746
5752
|
id: m.id,
|
|
5747
5753
|
displayName: m.displayName
|
|
5748
5754
|
},
|
|
5749
|
-
selected:
|
|
5750
|
-
onClick: () =>
|
|
5755
|
+
selected: D === m.id,
|
|
5756
|
+
onClick: () => L(m.id)
|
|
5751
5757
|
},
|
|
5752
5758
|
b
|
|
5753
5759
|
)) }),
|
|
5754
|
-
N.filter((m) => m.method === "exchange").length > 0 && /* @__PURE__ */ c.jsx(
|
|
5755
|
-
|
|
5760
|
+
N.filter((m) => m.method === "exchange").length > 0 && /* @__PURE__ */ c.jsx(de, { label: "Exchanges", children: N.filter((m) => m.method === "exchange").map((m, b) => /* @__PURE__ */ c.jsx(
|
|
5761
|
+
pe,
|
|
5756
5762
|
{
|
|
5757
5763
|
data: {
|
|
5758
5764
|
id: m.id,
|
|
5759
5765
|
displayName: m.displayName
|
|
5760
5766
|
},
|
|
5761
|
-
selected:
|
|
5762
|
-
onClick: () =>
|
|
5767
|
+
selected: D === m.id,
|
|
5768
|
+
onClick: () => L(m.id)
|
|
5763
5769
|
},
|
|
5764
5770
|
b
|
|
5765
5771
|
)) }),
|
|
5766
|
-
N.filter((m) => m.method === "fiat").length > 0 && /* @__PURE__ */ c.jsx(
|
|
5767
|
-
|
|
5772
|
+
N.filter((m) => m.method === "fiat").length > 0 && /* @__PURE__ */ c.jsx(de, { label: "Traditional Payment", children: N.filter((m) => m.method === "fiat").map((m, b) => /* @__PURE__ */ c.jsx(
|
|
5773
|
+
pe,
|
|
5768
5774
|
{
|
|
5769
5775
|
data: {
|
|
5770
5776
|
id: m.id,
|
|
5771
5777
|
displayName: m.displayName
|
|
5772
5778
|
},
|
|
5773
|
-
selected:
|
|
5774
|
-
onClick: () =>
|
|
5779
|
+
selected: D === m.id,
|
|
5780
|
+
onClick: () => L(m.id)
|
|
5775
5781
|
},
|
|
5776
5782
|
b
|
|
5777
5783
|
)) })
|
|
@@ -5780,36 +5786,36 @@ const So = ({
|
|
|
5780
5786
|
)
|
|
5781
5787
|
] }),
|
|
5782
5788
|
/* @__PURE__ */ c.jsxs("div", { className: "bg-white border-t border-gray-100", children: [
|
|
5783
|
-
|
|
5784
|
-
|
|
5789
|
+
D && /* @__PURE__ */ c.jsx("div", { className: "px-[var(--spacing)] pt-[calc(var(--spacing)*0.75)]", children: /* @__PURE__ */ c.jsx(
|
|
5790
|
+
ko,
|
|
5785
5791
|
{
|
|
5786
5792
|
selectedMethod: {
|
|
5787
|
-
id:
|
|
5788
|
-
displayName: ((
|
|
5793
|
+
id: D,
|
|
5794
|
+
displayName: ((Y = Z(D)) == null ? void 0 : Y.displayName) || ""
|
|
5789
5795
|
}
|
|
5790
5796
|
}
|
|
5791
5797
|
) }),
|
|
5792
5798
|
/* @__PURE__ */ c.jsx("div", { className: "px-[var(--spacing)] py-[var(--spacing)]", children: /* @__PURE__ */ c.jsx(
|
|
5793
|
-
|
|
5799
|
+
So,
|
|
5794
5800
|
{
|
|
5795
|
-
amount:
|
|
5796
|
-
disabled: !
|
|
5797
|
-
loading:
|
|
5798
|
-
onClick:
|
|
5801
|
+
amount: M || "0.00",
|
|
5802
|
+
disabled: !z(),
|
|
5803
|
+
loading: te,
|
|
5804
|
+
onClick: F
|
|
5799
5805
|
}
|
|
5800
5806
|
) })
|
|
5801
5807
|
] }),
|
|
5802
|
-
/* @__PURE__ */ c.jsx(
|
|
5808
|
+
/* @__PURE__ */ c.jsx(Uo, {})
|
|
5803
5809
|
]
|
|
5804
5810
|
}
|
|
5805
5811
|
) : /* @__PURE__ */ c.jsx("div", { children: "Loading payment widget..." });
|
|
5806
|
-
},
|
|
5807
|
-
W3_PAYMENTS_REACT_VERSION:
|
|
5812
|
+
}, wo = "1.0.0", Mo = {
|
|
5813
|
+
W3_PAYMENTS_REACT_VERSION: wo
|
|
5808
5814
|
};
|
|
5809
5815
|
export {
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5816
|
+
Eo as W3PaymentWidget,
|
|
5817
|
+
Co as W3PaymentsProvider,
|
|
5818
|
+
wo as W3_PAYMENTS_REACT_VERSION,
|
|
5819
|
+
Mo as default,
|
|
5820
|
+
vo as useW3Payments
|
|
5815
5821
|
};
|