@w3payments/react 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +478 -461
- package/package.json +1 -1
- 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 We, useState as ee, Children as Ge, 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 W:
|
|
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 w(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
|
+
U(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 U(v);
|
|
210
|
+
if (z.call(p, "key")) {
|
|
211
211
|
v = n(s);
|
|
212
|
-
var
|
|
213
|
-
return
|
|
212
|
+
var G = Object.keys(p).filter(function(Pe) {
|
|
213
|
+
return Pe !== "key";
|
|
214
214
|
});
|
|
215
|
-
f = 0 <
|
|
215
|
+
f = 0 < G.length ? "{key: someKey, " + G.join(": ..., ") + ": ...}" : "{key: someKey}", ve[v + f] || (G = 0 < G.length ? "{" + G.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} />
|
|
@@ -221,14 +221,14 @@ React keys must be passed directly to JSX without using spread:
|
|
|
221
221
|
<%s key={someKey} {...props} />`,
|
|
222
222
|
f,
|
|
223
223
|
v,
|
|
224
|
-
|
|
224
|
+
G,
|
|
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 M(s) {
|
|
246
|
-
U(s) ? s._store && (s._store.validated = 1) : typeof s == "object" && s !== null && s.$$typeof === E && (s._payload.status === "fulfilled" ? U(s._payload.value) && s._payload.value._store && (s._payload.value._store.validated = 1) : s._store && (s._store.validated = 1));
|
|
247
|
-
}
|
|
248
245
|
function U(s) {
|
|
249
|
-
|
|
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
|
+
}
|
|
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"), W = 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 w(
|
|
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 w(
|
|
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
|
|
@@ -519,9 +519,9 @@ const B = class B {
|
|
|
519
519
|
this.paymentMethods.clear();
|
|
520
520
|
}
|
|
521
521
|
};
|
|
522
|
-
g(
|
|
523
|
-
let
|
|
524
|
-
const
|
|
522
|
+
g(H, "instance");
|
|
523
|
+
let be = H;
|
|
524
|
+
const Se = be.getInstance(), X = class X {
|
|
525
525
|
constructor() {
|
|
526
526
|
g(this, "currencies", /* @__PURE__ */ new Map());
|
|
527
527
|
g(this, "supportedCurrencies", {
|
|
@@ -530,7 +530,7 @@ const ke = pe.getInstance(), j = class j {
|
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
532
|
static getInstance() {
|
|
533
|
-
return
|
|
533
|
+
return X.instance || (X.instance = new X()), X.instance;
|
|
534
534
|
}
|
|
535
535
|
/**
|
|
536
536
|
* Register a new currency
|
|
@@ -633,14 +633,14 @@ const ke = pe.getInstance(), j = class j {
|
|
|
633
633
|
this.currencies.clear(), this.supportedCurrencies.sandbox.clear(), this.supportedCurrencies.production.clear();
|
|
634
634
|
}
|
|
635
635
|
};
|
|
636
|
-
g(
|
|
637
|
-
let
|
|
638
|
-
const
|
|
636
|
+
g(X, "instance");
|
|
637
|
+
let ge = X;
|
|
638
|
+
const we = ge.getInstance(), V = class V {
|
|
639
639
|
constructor() {
|
|
640
640
|
g(this, "networks", /* @__PURE__ */ new Map());
|
|
641
641
|
}
|
|
642
642
|
static getInstance() {
|
|
643
|
-
return
|
|
643
|
+
return V.instance || (V.instance = new V()), V.instance;
|
|
644
644
|
}
|
|
645
645
|
/**
|
|
646
646
|
* Register a new network
|
|
@@ -691,9 +691,96 @@ const Se = me.getInstance(), H = class H {
|
|
|
691
691
|
this.networks.clear();
|
|
692
692
|
}
|
|
693
693
|
};
|
|
694
|
-
g(
|
|
695
|
-
let
|
|
696
|
-
const
|
|
694
|
+
g(V, "instance");
|
|
695
|
+
let ue = V;
|
|
696
|
+
const Ue = ue.getInstance(), le = /* @__PURE__ */ new Map();
|
|
697
|
+
function Ye(n, e = !1) {
|
|
698
|
+
const o = `${n}-${e}`;
|
|
699
|
+
return le.has(o) || le.set(
|
|
700
|
+
o,
|
|
701
|
+
new Intl.NumberFormat("en-US", {
|
|
702
|
+
minimumFractionDigits: n,
|
|
703
|
+
maximumFractionDigits: n,
|
|
704
|
+
useGrouping: e
|
|
705
|
+
})
|
|
706
|
+
), le.get(o);
|
|
707
|
+
}
|
|
708
|
+
function _e(n, e) {
|
|
709
|
+
const o = n;
|
|
710
|
+
return isNaN(o) ? "" : Ye(e, !1).format(o);
|
|
711
|
+
}
|
|
712
|
+
function $e(n, e) {
|
|
713
|
+
const o = n.split(".");
|
|
714
|
+
return o.length <= 1 ? !0 : o[1].length <= e.decimals;
|
|
715
|
+
}
|
|
716
|
+
function Qe(n, e) {
|
|
717
|
+
const o = n.split(".");
|
|
718
|
+
if (o.length <= 1) return n;
|
|
719
|
+
const t = o[1].substring(0, e.decimals);
|
|
720
|
+
return t.length > 0 ? `${o[0]}.${t}` : o[0];
|
|
721
|
+
}
|
|
722
|
+
function Ee(n) {
|
|
723
|
+
return n.replace(/[A-Z]/g, (e) => `-${e.toLowerCase()}`);
|
|
724
|
+
}
|
|
725
|
+
function Ke() {
|
|
726
|
+
return {
|
|
727
|
+
colorPrimary: "#6366f1",
|
|
728
|
+
colorPrimaryHover: "#4f46e5",
|
|
729
|
+
colorPrimaryLight: "#e0e7ff",
|
|
730
|
+
colorBackground: "#ffffff",
|
|
731
|
+
colorText: "#1f2937",
|
|
732
|
+
colorTextMuted: "#6b7280",
|
|
733
|
+
colorBorder: "#e5e7eb",
|
|
734
|
+
colorBorderLight: "#f3f4f6",
|
|
735
|
+
colorDanger: "#ef4444",
|
|
736
|
+
colorSuccess: "#10b981",
|
|
737
|
+
fontFamily: "system-ui, -apple-system, sans-serif",
|
|
738
|
+
fontSize: "1rem",
|
|
739
|
+
borderRadius: "0.5rem",
|
|
740
|
+
spacing: "1rem"
|
|
741
|
+
};
|
|
742
|
+
}
|
|
743
|
+
function Je(n) {
|
|
744
|
+
const e = Ke();
|
|
745
|
+
switch (n) {
|
|
746
|
+
case "dark":
|
|
747
|
+
return P(y({}, e), {
|
|
748
|
+
colorPrimary: "#6366f1",
|
|
749
|
+
colorPrimaryHover: "#7c3aed",
|
|
750
|
+
colorPrimaryLight: "#1e1b4b",
|
|
751
|
+
colorBackground: "#111827",
|
|
752
|
+
colorText: "#f9fafb",
|
|
753
|
+
colorTextMuted: "#9ca3af",
|
|
754
|
+
colorBorder: "#374151",
|
|
755
|
+
colorBorderLight: "#4b5563"
|
|
756
|
+
});
|
|
757
|
+
case "light":
|
|
758
|
+
default:
|
|
759
|
+
return e;
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
function qe(n, e) {
|
|
763
|
+
var i;
|
|
764
|
+
const o = typeof n == "string" ? { theme: n } : n, t = Je((i = o.theme) != null ? i : "light"), r = y(y({}, t), o.variables);
|
|
765
|
+
Object.entries(r).forEach(([a, l]) => {
|
|
766
|
+
if (l !== void 0) {
|
|
767
|
+
const d = `--${Ee(a)}`;
|
|
768
|
+
e.style.setProperty(d, l);
|
|
769
|
+
}
|
|
770
|
+
}), o.theme && e.setAttribute("data-theme", o.theme), o.rules && eo(o.rules);
|
|
771
|
+
}
|
|
772
|
+
function eo(n) {
|
|
773
|
+
const e = "w3-theme-rules";
|
|
774
|
+
let o = document.getElementById(e);
|
|
775
|
+
o || (o = document.createElement("style"), o.id = e, document.head.appendChild(o));
|
|
776
|
+
const t = Object.entries(n).map(([r, i]) => {
|
|
777
|
+
const a = Object.entries(i).map(([l, d]) => `${Ee(l)}: ${d};`).join(" ");
|
|
778
|
+
return `.w3-widget ${r} { ${a} }`;
|
|
779
|
+
}).join(`
|
|
780
|
+
`);
|
|
781
|
+
o.textContent = t;
|
|
782
|
+
}
|
|
783
|
+
const oo = {
|
|
697
784
|
USD: {
|
|
698
785
|
code: "USD",
|
|
699
786
|
name: "US Dollar",
|
|
@@ -723,7 +810,7 @@ const we = be.getInstance(), Fe = {
|
|
|
723
810
|
isStablecoin: !1,
|
|
724
811
|
iconUrl: "https://cdn.jsdelivr.net/gh/atomiclabs/cryptocurrency-icons@1a63530be6e374711a8554f31b17e4cb92c25fa5/svg/icon/eth.svg"
|
|
725
812
|
}
|
|
726
|
-
},
|
|
813
|
+
}, no = {
|
|
727
814
|
bitcoin: {
|
|
728
815
|
id: "bitcoin",
|
|
729
816
|
name: "Bitcoin",
|
|
@@ -735,7 +822,7 @@ const we = be.getInstance(), Fe = {
|
|
|
735
822
|
symbol: "ETH",
|
|
736
823
|
chainId: 1
|
|
737
824
|
}
|
|
738
|
-
},
|
|
825
|
+
}, to = {
|
|
739
826
|
// Major Cryptocurrencies
|
|
740
827
|
BTC: "https://cryptologos.cc/logos/bitcoin-btc-logo.svg",
|
|
741
828
|
ETH: "https://cryptologos.cc/logos/ethereum-eth-logo.svg",
|
|
@@ -760,10 +847,10 @@ const we = be.getInstance(), Fe = {
|
|
|
760
847
|
ADA: "https://cryptologos.cc/logos/cardano-ada-logo.svg",
|
|
761
848
|
DOT: "https://cryptologos.cc/logos/polkadot-new-dot-logo.svg"
|
|
762
849
|
};
|
|
763
|
-
function
|
|
764
|
-
return
|
|
850
|
+
function Me(n) {
|
|
851
|
+
return to[n.toUpperCase()];
|
|
765
852
|
}
|
|
766
|
-
const
|
|
853
|
+
const so = {
|
|
767
854
|
// Major Exchanges
|
|
768
855
|
coinbase: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIGZpbGw9IiMwMDUyRkYiLz4KPHJlY3QgeD0iOSIgeT0iOSIgd2lkdGg9IjYiIGhlaWdodD0iNiIgcng9IjEiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
|
|
769
856
|
kraken: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGNpcmNsZSBjeD0iMTIiIGN5PSIxMiIgcj0iMTAiIGZpbGw9IiM1NzQxOUEiLz4KPHBhdGggZD0iTTggN0wxNiA5VjE3TDggMTVWN1oiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==",
|
|
@@ -779,10 +866,10 @@ const $e = {
|
|
|
779
866
|
"coinbase-pro": "https://assets.coincap.io/assets/icons/256/coinbase.png",
|
|
780
867
|
"binance-us": "https://assets.coincap.io/assets/icons/256/binance.png"
|
|
781
868
|
};
|
|
782
|
-
function
|
|
783
|
-
return
|
|
869
|
+
function xe(n) {
|
|
870
|
+
return so[n.toLowerCase()];
|
|
784
871
|
}
|
|
785
|
-
const
|
|
872
|
+
const co = {
|
|
786
873
|
// Bank Transfer Methods
|
|
787
874
|
ach: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMgN1YxN0gyMVY3SDNaTTQgOEgyMFYxNkg0VjhaTTYgMTBWMTRIOVYxMEg2Wk0xMCAxMFYxMUgxOFYxMEgxMFpNMTAgMTJWMTNIMTVWMTJIMTBaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
|
|
788
875
|
wire: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDJMMTMuMDkgOC4yNkwyMCA5TDEzLjA5IDE1Ljc0TDEyIDIyTDEwLjkxIDE1Ljc0TDQgOUwxMC45MSA4LjI2TDEyIDJaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
|
|
@@ -798,10 +885,10 @@ const Qe = {
|
|
|
798
885
|
bank: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTMgN1YxN0gyMVY3SDNaTTQgOEgyMFYxNkg0VjhaTTYgMTBWMTRIOVYxMEg2Wk0xMCAxMFYxMUgxOFYxMEgxMFpNMTAgMTJWMTNIMTVWMTJIMTBaIiBmaWxsPSJjdXJyZW50Q29sb3IiLz4KPC9zdmc+",
|
|
799
886
|
other: "data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0iTTEyIDhDMTMuMSA4IDE0IDcuMSAxNCA2UzEzLjEgNCAxMiA0IDEwIDQuOSAxMCA2UzEwLjkgOCAxMiA4Wk0xMiAxMEMxMC45IDEwIDEwIDEwLjkgMTAgMTJTMTAuOSAxNCAxMiAxNFMxNCAxMy4xIDE0IDEyUzEzLjEgMTAgMTIgMTBaTTEyIDE2QzEwLjkgMTYgMTAgMTYuOSAxMCAxOFMxMC45IDIwIDEyIDIwUzE0IDE5LjEgMTQgMThTMTMuMSAxNiAxMiAxNloiIGZpbGw9ImN1cnJlbnRDb2xvciIvPgo8L3N2Zz4K"
|
|
800
887
|
};
|
|
801
|
-
function
|
|
802
|
-
return
|
|
888
|
+
function Ne(n) {
|
|
889
|
+
return co[n.toLowerCase()];
|
|
803
890
|
}
|
|
804
|
-
var
|
|
891
|
+
var io = {
|
|
805
892
|
content: {
|
|
806
893
|
integrations: [
|
|
807
894
|
{
|
|
@@ -2941,7 +3028,7 @@ var Ke = {
|
|
|
2941
3028
|
message: "",
|
|
2942
3029
|
errorHash: "41f47591",
|
|
2943
3030
|
errorType: ""
|
|
2944
|
-
},
|
|
3031
|
+
}, ro = {
|
|
2945
3032
|
content: {
|
|
2946
3033
|
networks: [
|
|
2947
3034
|
{
|
|
@@ -4205,7 +4292,7 @@ var Ke = {
|
|
|
4205
4292
|
message: "",
|
|
4206
4293
|
errorHash: "41f47591",
|
|
4207
4294
|
errorType: ""
|
|
4208
|
-
},
|
|
4295
|
+
}, ao = {
|
|
4209
4296
|
krakenDirect: "kraken",
|
|
4210
4297
|
coinbase: "coinbase",
|
|
4211
4298
|
binanceConnect: "binance",
|
|
@@ -4219,10 +4306,10 @@ var Ke = {
|
|
|
4219
4306
|
robinhood: "robinhood",
|
|
4220
4307
|
uphold: "uphold"
|
|
4221
4308
|
};
|
|
4222
|
-
function
|
|
4223
|
-
return
|
|
4309
|
+
function lo(n) {
|
|
4310
|
+
return ao[n] || null;
|
|
4224
4311
|
}
|
|
4225
|
-
var
|
|
4312
|
+
var po = {
|
|
4226
4313
|
Ethereum: "ethereum",
|
|
4227
4314
|
Bitcoin: "bitcoin",
|
|
4228
4315
|
Solana: "solana",
|
|
@@ -4240,10 +4327,10 @@ var oo = {
|
|
|
4240
4327
|
Injective: "injective",
|
|
4241
4328
|
Moonbeam: "moonbeam"
|
|
4242
4329
|
};
|
|
4243
|
-
function
|
|
4244
|
-
return
|
|
4330
|
+
function Ie(n) {
|
|
4331
|
+
return po[n] || n.toLowerCase();
|
|
4245
4332
|
}
|
|
4246
|
-
var
|
|
4333
|
+
var mo = {
|
|
4247
4334
|
// Most currencies are already normalized, but add special cases here
|
|
4248
4335
|
WETH: "ETH",
|
|
4249
4336
|
// Wrapped ETH maps to ETH
|
|
@@ -4252,9 +4339,9 @@ var no = {
|
|
|
4252
4339
|
// Add other wrapped/special tokens as needed
|
|
4253
4340
|
};
|
|
4254
4341
|
function Ae(n) {
|
|
4255
|
-
return
|
|
4342
|
+
return mo[n] || n;
|
|
4256
4343
|
}
|
|
4257
|
-
var
|
|
4344
|
+
var bo = class {
|
|
4258
4345
|
constructor(n = "sandbox") {
|
|
4259
4346
|
g(this, "id", "meshpay");
|
|
4260
4347
|
g(this, "name", "MeshPay");
|
|
@@ -4264,7 +4351,7 @@ var to = class {
|
|
|
4264
4351
|
this.environment = n;
|
|
4265
4352
|
}
|
|
4266
4353
|
initialize(n) {
|
|
4267
|
-
return
|
|
4354
|
+
return S(this, null, function* () {
|
|
4268
4355
|
const e = n[this.id];
|
|
4269
4356
|
if (!(e != null && e.clientId) || !(e != null && e.clientSecret))
|
|
4270
4357
|
throw new Error(
|
|
@@ -4289,7 +4376,7 @@ var to = class {
|
|
|
4289
4376
|
mapExchanges() {
|
|
4290
4377
|
const n = this.getIntegrationsData().content.integrations, e = [];
|
|
4291
4378
|
return n.forEach((o) => {
|
|
4292
|
-
const t =
|
|
4379
|
+
const t = lo(o.type);
|
|
4293
4380
|
if (!t) {
|
|
4294
4381
|
console.warn(
|
|
4295
4382
|
`Skipping unknown MeshPay integration type: ${o.type}`
|
|
@@ -4297,7 +4384,7 @@ var to = class {
|
|
|
4297
4384
|
return;
|
|
4298
4385
|
}
|
|
4299
4386
|
o.networks.forEach((r) => {
|
|
4300
|
-
const i =
|
|
4387
|
+
const i = Ie(r.name);
|
|
4301
4388
|
r.supportedTokens.forEach((a) => {
|
|
4302
4389
|
const l = Ae(a);
|
|
4303
4390
|
e.push({
|
|
@@ -4328,7 +4415,7 @@ var to = class {
|
|
|
4328
4415
|
mapWallets() {
|
|
4329
4416
|
const n = this.getNetworksData().content.networks, e = [];
|
|
4330
4417
|
return n.forEach((o) => {
|
|
4331
|
-
const t =
|
|
4418
|
+
const t = Ie(o.name);
|
|
4332
4419
|
o.supportedTokens.forEach((r) => {
|
|
4333
4420
|
const i = Ae(r);
|
|
4334
4421
|
e.push({
|
|
@@ -4357,16 +4444,16 @@ var to = class {
|
|
|
4357
4444
|
}
|
|
4358
4445
|
getIntegrationsData() {
|
|
4359
4446
|
if (this.environment === "sandbox")
|
|
4360
|
-
return
|
|
4447
|
+
return io;
|
|
4361
4448
|
throw new Error("Production integrations data loading not implemented");
|
|
4362
4449
|
}
|
|
4363
4450
|
getNetworksData() {
|
|
4364
4451
|
if (this.environment === "sandbox")
|
|
4365
|
-
return
|
|
4452
|
+
return ro;
|
|
4366
4453
|
throw new Error("Production networks data loading not implemented");
|
|
4367
4454
|
}
|
|
4368
4455
|
createCheckoutSession(n) {
|
|
4369
|
-
return
|
|
4456
|
+
return S(this, null, function* () {
|
|
4370
4457
|
if (!this.initialized)
|
|
4371
4458
|
throw new Error("MeshPay adapter not initialized");
|
|
4372
4459
|
try {
|
|
@@ -4409,7 +4496,7 @@ var to = class {
|
|
|
4409
4496
|
return o.id;
|
|
4410
4497
|
}
|
|
4411
4498
|
generateLinkToken(n) {
|
|
4412
|
-
return
|
|
4499
|
+
return S(this, null, function* () {
|
|
4413
4500
|
if (!this.config)
|
|
4414
4501
|
throw new Error("Adapter not initialized");
|
|
4415
4502
|
const e = {
|
|
@@ -4457,7 +4544,7 @@ var to = class {
|
|
|
4457
4544
|
* Open MeshPay checkout using their Web Link SDK
|
|
4458
4545
|
*/
|
|
4459
4546
|
openCheckout(n) {
|
|
4460
|
-
return
|
|
4547
|
+
return S(this, null, function* () {
|
|
4461
4548
|
if (!n.metadata || !n.metadata.linkToken)
|
|
4462
4549
|
throw new Error("Missing linkToken in checkout session metadata");
|
|
4463
4550
|
if (!n.metadata.clientId)
|
|
@@ -4505,19 +4592,19 @@ var to = class {
|
|
|
4505
4592
|
});
|
|
4506
4593
|
}
|
|
4507
4594
|
getPaymentStatus(n) {
|
|
4508
|
-
return
|
|
4595
|
+
return S(this, null, function* () {
|
|
4509
4596
|
throw new Error(
|
|
4510
4597
|
"getPaymentStatus not implemented - MeshPay uses webhooks for status updates"
|
|
4511
4598
|
);
|
|
4512
4599
|
});
|
|
4513
4600
|
}
|
|
4514
4601
|
};
|
|
4515
|
-
class
|
|
4602
|
+
class oe extends Error {
|
|
4516
4603
|
constructor(o, t = "PAYMENT_ERROR", r) {
|
|
4517
4604
|
super(o);
|
|
4518
4605
|
g(this, "code");
|
|
4519
4606
|
g(this, "context");
|
|
4520
|
-
this.name = "PaymentError", this.code = t, this.context = r, Error.captureStackTrace && Error.captureStackTrace(this,
|
|
4607
|
+
this.name = "PaymentError", this.code = t, this.context = r, Error.captureStackTrace && Error.captureStackTrace(this, oe);
|
|
4521
4608
|
}
|
|
4522
4609
|
toJSON() {
|
|
4523
4610
|
return {
|
|
@@ -4529,23 +4616,23 @@ class q extends Error {
|
|
|
4529
4616
|
};
|
|
4530
4617
|
}
|
|
4531
4618
|
}
|
|
4532
|
-
class
|
|
4619
|
+
class O extends oe {
|
|
4533
4620
|
constructor(e, o) {
|
|
4534
4621
|
super(e, "PAYMENT_VALIDATION_ERROR", o), this.name = "PaymentValidationError";
|
|
4535
4622
|
}
|
|
4536
4623
|
}
|
|
4537
|
-
class
|
|
4624
|
+
class j extends oe {
|
|
4538
4625
|
constructor(e, o) {
|
|
4539
4626
|
super(e, "PAYMENT_EXECUTION_ERROR", o), this.name = "PaymentExecutionError";
|
|
4540
4627
|
}
|
|
4541
4628
|
}
|
|
4542
|
-
class
|
|
4629
|
+
class Q extends Error {
|
|
4543
4630
|
constructor(o, t = "ADAPTER_ERROR", r, i) {
|
|
4544
4631
|
super(o);
|
|
4545
4632
|
g(this, "code");
|
|
4546
4633
|
g(this, "vendorId");
|
|
4547
4634
|
g(this, "context");
|
|
4548
|
-
this.name = "AdapterError", this.code = t, this.vendorId = r, this.context = i, Error.captureStackTrace && Error.captureStackTrace(this,
|
|
4635
|
+
this.name = "AdapterError", this.code = t, this.vendorId = r, this.context = i, Error.captureStackTrace && Error.captureStackTrace(this, Q);
|
|
4549
4636
|
}
|
|
4550
4637
|
toJSON() {
|
|
4551
4638
|
return {
|
|
@@ -4558,7 +4645,7 @@ class Y extends Error {
|
|
|
4558
4645
|
};
|
|
4559
4646
|
}
|
|
4560
4647
|
}
|
|
4561
|
-
class
|
|
4648
|
+
class go extends Q {
|
|
4562
4649
|
constructor(e, o) {
|
|
4563
4650
|
super(
|
|
4564
4651
|
`Payment adapter for vendor "${e}" not found`,
|
|
@@ -4568,7 +4655,7 @@ class so extends Y {
|
|
|
4568
4655
|
), this.name = "AdapterNotFoundError";
|
|
4569
4656
|
}
|
|
4570
4657
|
}
|
|
4571
|
-
class
|
|
4658
|
+
class uo extends Q {
|
|
4572
4659
|
constructor(e, o, t) {
|
|
4573
4660
|
super(
|
|
4574
4661
|
`Failed to initialize adapter for vendor "${e}": ${o}`,
|
|
@@ -4578,7 +4665,7 @@ class co extends Y {
|
|
|
4578
4665
|
), this.name = "AdapterInitializationError";
|
|
4579
4666
|
}
|
|
4580
4667
|
}
|
|
4581
|
-
class
|
|
4668
|
+
class ho extends Q {
|
|
4582
4669
|
constructor(e, o, t) {
|
|
4583
4670
|
super(
|
|
4584
4671
|
`Configuration error for adapter "${e}": ${o}`,
|
|
@@ -4588,7 +4675,7 @@ class io extends Y {
|
|
|
4588
4675
|
), this.name = "AdapterConfigurationError";
|
|
4589
4676
|
}
|
|
4590
4677
|
}
|
|
4591
|
-
class
|
|
4678
|
+
class Ce {
|
|
4592
4679
|
constructor() {
|
|
4593
4680
|
g(this, "adapters", /* @__PURE__ */ new Map());
|
|
4594
4681
|
g(this, "initialized", !1);
|
|
@@ -4598,7 +4685,7 @@ class Ie {
|
|
|
4598
4685
|
*/
|
|
4599
4686
|
register(e) {
|
|
4600
4687
|
if (this.adapters.has(e.id))
|
|
4601
|
-
throw new
|
|
4688
|
+
throw new ho(
|
|
4602
4689
|
e.id,
|
|
4603
4690
|
"Adapter already registered"
|
|
4604
4691
|
);
|
|
@@ -4610,7 +4697,7 @@ class Ie {
|
|
|
4610
4697
|
get(e) {
|
|
4611
4698
|
const o = this.adapters.get(e);
|
|
4612
4699
|
if (!o)
|
|
4613
|
-
throw new
|
|
4700
|
+
throw new go(e);
|
|
4614
4701
|
return o;
|
|
4615
4702
|
}
|
|
4616
4703
|
/**
|
|
@@ -4635,15 +4722,15 @@ class Ie {
|
|
|
4635
4722
|
* Initialize all registered adapters
|
|
4636
4723
|
*/
|
|
4637
4724
|
initialize(e) {
|
|
4638
|
-
return
|
|
4725
|
+
return S(this, null, function* () {
|
|
4639
4726
|
if (this.initialized)
|
|
4640
4727
|
return;
|
|
4641
4728
|
const o = Array.from(this.adapters.entries()).map(
|
|
4642
|
-
(i) =>
|
|
4729
|
+
(i) => S(this, [i], function* ([t, r]) {
|
|
4643
4730
|
try {
|
|
4644
4731
|
yield r.initialize(e);
|
|
4645
4732
|
} catch (a) {
|
|
4646
|
-
throw new
|
|
4733
|
+
throw new uo(
|
|
4647
4734
|
t,
|
|
4648
4735
|
a instanceof Error ? a.message : "Unknown error",
|
|
4649
4736
|
{ originalError: a }
|
|
@@ -4674,12 +4761,12 @@ class Ie {
|
|
|
4674
4761
|
return o && this.adapters.size === 0 && (this.initialized = !1), o;
|
|
4675
4762
|
}
|
|
4676
4763
|
}
|
|
4677
|
-
class
|
|
4764
|
+
class he {
|
|
4678
4765
|
constructor(e) {
|
|
4679
4766
|
g(this, "registry");
|
|
4680
|
-
g(this, "currencyService",
|
|
4681
|
-
g(this, "networkService",
|
|
4682
|
-
g(this, "paymentMethodService",
|
|
4767
|
+
g(this, "currencyService", we);
|
|
4768
|
+
g(this, "networkService", Ue);
|
|
4769
|
+
g(this, "paymentMethodService", Se);
|
|
4683
4770
|
g(this, "options");
|
|
4684
4771
|
g(this, "clientMode", !1);
|
|
4685
4772
|
/**
|
|
@@ -4690,20 +4777,20 @@ class ge {
|
|
|
4690
4777
|
* Create a payment intent and checkout session
|
|
4691
4778
|
* Automatically selects the best vendor
|
|
4692
4779
|
*/
|
|
4693
|
-
create: (e) =>
|
|
4780
|
+
create: (e) => S(this, null, function* () {
|
|
4694
4781
|
var r;
|
|
4695
4782
|
if (!this.isInitialized())
|
|
4696
|
-
throw new
|
|
4783
|
+
throw new j("W3Payments client not initialized");
|
|
4697
4784
|
if (!e.amount || e.amount <= 0)
|
|
4698
|
-
throw new
|
|
4785
|
+
throw new O("Amount must be greater than 0");
|
|
4699
4786
|
if (!e.currency)
|
|
4700
|
-
throw new
|
|
4787
|
+
throw new O("Currency is required");
|
|
4701
4788
|
if (!e.id)
|
|
4702
|
-
throw new
|
|
4789
|
+
throw new O("Payment ID is required");
|
|
4703
4790
|
if (!e.customerId)
|
|
4704
|
-
throw new
|
|
4791
|
+
throw new O("Customer ID is required");
|
|
4705
4792
|
if (!e.destinations || e.destinations.length === 0)
|
|
4706
|
-
throw new
|
|
4793
|
+
throw new O(
|
|
4707
4794
|
"At least one destination is required"
|
|
4708
4795
|
);
|
|
4709
4796
|
const o = this.selectBestVendor(e), t = {
|
|
@@ -4724,7 +4811,7 @@ class ge {
|
|
|
4724
4811
|
selectedVendor: ((r = a.metadata) == null ? void 0 : r.selectedVendor) || o
|
|
4725
4812
|
});
|
|
4726
4813
|
} catch (i) {
|
|
4727
|
-
throw new
|
|
4814
|
+
throw new j(
|
|
4728
4815
|
`Payment creation failed: ${i instanceof Error ? i.message : "Unknown error"}`,
|
|
4729
4816
|
{ intent: t, selectedVendor: o, originalError: i }
|
|
4730
4817
|
);
|
|
@@ -4733,32 +4820,32 @@ class ge {
|
|
|
4733
4820
|
/**
|
|
4734
4821
|
* Get payment status
|
|
4735
4822
|
*/
|
|
4736
|
-
retrieve: (e, o) =>
|
|
4823
|
+
retrieve: (e, o) => S(this, null, function* () {
|
|
4737
4824
|
if (!this.isInitialized())
|
|
4738
|
-
throw new
|
|
4825
|
+
throw new j("W3Payments client not initialized");
|
|
4739
4826
|
if (!e)
|
|
4740
|
-
throw new
|
|
4827
|
+
throw new O("Session ID is required");
|
|
4741
4828
|
if (!o)
|
|
4742
|
-
throw new
|
|
4829
|
+
throw new O("Vendor ID is required");
|
|
4743
4830
|
try {
|
|
4744
4831
|
return yield this.registry.get(o).getPaymentStatus(e);
|
|
4745
4832
|
} catch (t) {
|
|
4746
|
-
throw new
|
|
4833
|
+
throw new j(
|
|
4747
4834
|
`Payment status retrieval failed: ${t instanceof Error ? t.message : "Unknown error"}`,
|
|
4748
4835
|
{ sessionId: e, vendorId: o, originalError: t }
|
|
4749
4836
|
);
|
|
4750
4837
|
}
|
|
4751
4838
|
})
|
|
4752
4839
|
});
|
|
4753
|
-
this.options = e, this.registry = new
|
|
4840
|
+
this.options = e, this.registry = new Ce(), this.configureCurrencies(), this.configureNetworks(), this.registerAdapters();
|
|
4754
4841
|
}
|
|
4755
4842
|
/**
|
|
4756
4843
|
* Create a client-only instance for data access (no vendor secrets needed)
|
|
4757
4844
|
* Only initializes currencies, networks, and registers adapters without API initialization
|
|
4758
4845
|
*/
|
|
4759
4846
|
static createClient(e = "sandbox") {
|
|
4760
|
-
const o = Object.create(
|
|
4761
|
-
return o.currencyService =
|
|
4847
|
+
const o = Object.create(he.prototype);
|
|
4848
|
+
return o.currencyService = we, o.networkService = Ue, o.paymentMethodService = Se, o.registry = new Ce(), o.clientMode = !0, o.options = {
|
|
4762
4849
|
config: {
|
|
4763
4850
|
environment: e
|
|
4764
4851
|
}
|
|
@@ -4768,13 +4855,13 @@ class ge {
|
|
|
4768
4855
|
* Configure currencies from CURRENCIES data
|
|
4769
4856
|
*/
|
|
4770
4857
|
configureCurrencies() {
|
|
4771
|
-
this.currencyService.registerMany(Object.values(
|
|
4858
|
+
this.currencyService.registerMany(Object.values(oo));
|
|
4772
4859
|
}
|
|
4773
4860
|
/**
|
|
4774
4861
|
* Configure networks from NETWORKS data
|
|
4775
4862
|
*/
|
|
4776
4863
|
configureNetworks() {
|
|
4777
|
-
this.networkService.registerMany(Object.values(
|
|
4864
|
+
this.networkService.registerMany(Object.values(no));
|
|
4778
4865
|
}
|
|
4779
4866
|
/**
|
|
4780
4867
|
* Register all available adapters
|
|
@@ -4782,13 +4869,13 @@ class ge {
|
|
|
4782
4869
|
*/
|
|
4783
4870
|
registerAdapters() {
|
|
4784
4871
|
const e = this.options.config.environment || "sandbox";
|
|
4785
|
-
this.registry.register(new
|
|
4872
|
+
this.registry.register(new bo(e));
|
|
4786
4873
|
}
|
|
4787
4874
|
/**
|
|
4788
4875
|
* Initialize the W3Payments client and all adapters
|
|
4789
4876
|
*/
|
|
4790
4877
|
initialize() {
|
|
4791
|
-
return
|
|
4878
|
+
return S(this, null, function* () {
|
|
4792
4879
|
const e = P(y({}, this.options.config), {
|
|
4793
4880
|
environment: this.options.environment || this.options.config.environment
|
|
4794
4881
|
});
|
|
@@ -4844,22 +4931,22 @@ class ge {
|
|
|
4844
4931
|
* Uses the complete CheckoutSession returned from payment creation
|
|
4845
4932
|
*/
|
|
4846
4933
|
openCheckout(e) {
|
|
4847
|
-
return
|
|
4934
|
+
return S(this, null, function* () {
|
|
4848
4935
|
var t, r;
|
|
4849
4936
|
const o = ((t = e.metadata) == null ? void 0 : t.selectedVendor) || ((r = e.metadata) == null ? void 0 : r.vendorId);
|
|
4850
4937
|
if (!o)
|
|
4851
|
-
throw new
|
|
4938
|
+
throw new O(
|
|
4852
4939
|
"Vendor ID not found in session metadata"
|
|
4853
4940
|
);
|
|
4854
4941
|
try {
|
|
4855
4942
|
const i = this.registry.get(o);
|
|
4856
4943
|
if (!i.openCheckout)
|
|
4857
|
-
throw new
|
|
4944
|
+
throw new j(
|
|
4858
4945
|
`Vendor ${o} does not support client-side checkout opening`
|
|
4859
4946
|
);
|
|
4860
4947
|
return yield i.openCheckout(e);
|
|
4861
4948
|
} catch (i) {
|
|
4862
|
-
throw new
|
|
4949
|
+
throw new j(
|
|
4863
4950
|
`Checkout opening failed: ${i instanceof Error ? i.message : "Unknown error"}`,
|
|
4864
4951
|
{ sessionId: e.id, vendorId: o, originalError: i }
|
|
4865
4952
|
);
|
|
@@ -4873,78 +4960,17 @@ class ge {
|
|
|
4873
4960
|
selectBestVendor(e) {
|
|
4874
4961
|
const o = this.getAvailableVendors();
|
|
4875
4962
|
if (o.length === 0)
|
|
4876
|
-
throw new
|
|
4963
|
+
throw new j("No payment vendors available");
|
|
4877
4964
|
return e.preferredVendor && this.hasVendor(e.preferredVendor) ? e.preferredVendor : o[0];
|
|
4878
4965
|
}
|
|
4879
4966
|
}
|
|
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 {
|
|
4967
|
+
class fo {
|
|
4942
4968
|
constructor(e) {
|
|
4943
4969
|
g(this, "config");
|
|
4944
4970
|
this.config = e;
|
|
4945
4971
|
}
|
|
4946
4972
|
makeRequest(t) {
|
|
4947
|
-
return
|
|
4973
|
+
return S(this, arguments, function* (e, o = {}) {
|
|
4948
4974
|
const r = yield globalThis.fetch(`${this.config.endpoint}${e}`, y({
|
|
4949
4975
|
headers: y(y({
|
|
4950
4976
|
"Content-Type": "application/json"
|
|
@@ -4956,7 +4982,7 @@ class mo {
|
|
|
4956
4982
|
});
|
|
4957
4983
|
}
|
|
4958
4984
|
createPayment(e) {
|
|
4959
|
-
return
|
|
4985
|
+
return S(this, null, function* () {
|
|
4960
4986
|
return this.makeRequest("/payment/create", {
|
|
4961
4987
|
method: "POST",
|
|
4962
4988
|
body: JSON.stringify(e)
|
|
@@ -4964,7 +4990,7 @@ class mo {
|
|
|
4964
4990
|
});
|
|
4965
4991
|
}
|
|
4966
4992
|
getPaymentStatus(e, o) {
|
|
4967
|
-
return
|
|
4993
|
+
return S(this, null, function* () {
|
|
4968
4994
|
return this.makeRequest(`/payment/${e}?vendorId=${o}`, {
|
|
4969
4995
|
method: "GET"
|
|
4970
4996
|
});
|
|
@@ -4974,41 +5000,41 @@ class mo {
|
|
|
4974
5000
|
return !!this.config.endpoint;
|
|
4975
5001
|
}
|
|
4976
5002
|
}
|
|
4977
|
-
const
|
|
5003
|
+
const fe = Xe(
|
|
4978
5004
|
null
|
|
4979
5005
|
);
|
|
4980
|
-
|
|
4981
|
-
const
|
|
5006
|
+
fe.displayName = "W3PaymentsContext";
|
|
5007
|
+
const Co = ({
|
|
4982
5008
|
endpoint: n,
|
|
4983
5009
|
environment: e = "sandbox",
|
|
4984
5010
|
theme: o,
|
|
4985
5011
|
children: t
|
|
4986
5012
|
}) => {
|
|
4987
|
-
const { w3payments: r, httpClient: i, isInitialized: a, initError: l } =
|
|
5013
|
+
const { w3payments: r, httpClient: i, isInitialized: a, initError: l } = me(() => {
|
|
4988
5014
|
try {
|
|
4989
5015
|
console.debug("W3PaymentsProvider: Initializing clients...");
|
|
4990
|
-
const u =
|
|
5016
|
+
const u = he.createClient(e), w = new fo({ endpoint: n });
|
|
4991
5017
|
return console.debug(
|
|
4992
5018
|
"W3PaymentsProvider: Both clients initialized successfully"
|
|
4993
5019
|
), {
|
|
4994
5020
|
w3payments: u,
|
|
4995
|
-
httpClient:
|
|
5021
|
+
httpClient: w,
|
|
4996
5022
|
isInitialized: !0,
|
|
4997
5023
|
initError: null
|
|
4998
5024
|
};
|
|
4999
5025
|
} catch (u) {
|
|
5000
|
-
const
|
|
5026
|
+
const w = u instanceof Error ? u.message : "Failed to initialize W3Payments clients";
|
|
5001
5027
|
return console.error("W3PaymentsProvider initialization error:", u), {
|
|
5002
5028
|
w3payments: null,
|
|
5003
5029
|
httpClient: null,
|
|
5004
5030
|
isInitialized: !1,
|
|
5005
|
-
initError:
|
|
5031
|
+
initError: w
|
|
5006
5032
|
};
|
|
5007
5033
|
}
|
|
5008
5034
|
}, [n, e]);
|
|
5009
|
-
|
|
5010
|
-
o && document.querySelectorAll(".w3-widget").forEach((
|
|
5011
|
-
|
|
5035
|
+
Ve(() => {
|
|
5036
|
+
o && document.querySelectorAll(".w3-widget").forEach((w) => {
|
|
5037
|
+
qe(o, w);
|
|
5012
5038
|
});
|
|
5013
5039
|
}, [o]);
|
|
5014
5040
|
const d = {
|
|
@@ -5035,7 +5061,7 @@ const So = ({
|
|
|
5035
5061
|
/* @__PURE__ */ c.jsx("p", { style: { margin: "8px 0 0 0" }, children: l })
|
|
5036
5062
|
]
|
|
5037
5063
|
}
|
|
5038
|
-
) : a ? /* @__PURE__ */ c.jsx(
|
|
5064
|
+
) : a ? /* @__PURE__ */ c.jsx(fe.Provider, { value: d, children: t }) : /* @__PURE__ */ c.jsx(
|
|
5039
5065
|
"div",
|
|
5040
5066
|
{
|
|
5041
5067
|
className: "w3-loading-container",
|
|
@@ -5048,14 +5074,14 @@ const So = ({
|
|
|
5048
5074
|
children: "Initializing W3Payments..."
|
|
5049
5075
|
}
|
|
5050
5076
|
);
|
|
5051
|
-
},
|
|
5052
|
-
const n =
|
|
5077
|
+
}, vo = () => {
|
|
5078
|
+
const n = We(fe);
|
|
5053
5079
|
if (!n)
|
|
5054
5080
|
throw new Error(
|
|
5055
5081
|
"useW3Payments must be used within W3PaymentsProvider. Make sure your component is wrapped with <W3PaymentsProvider>."
|
|
5056
5082
|
);
|
|
5057
5083
|
return n;
|
|
5058
|
-
},
|
|
5084
|
+
}, yo = ({
|
|
5059
5085
|
title: n,
|
|
5060
5086
|
logo: e
|
|
5061
5087
|
}) => /* @__PURE__ */ c.jsx(
|
|
@@ -5081,21 +5107,25 @@ const So = ({
|
|
|
5081
5107
|
)
|
|
5082
5108
|
] })
|
|
5083
5109
|
}
|
|
5084
|
-
),
|
|
5110
|
+
), To = ({
|
|
5085
5111
|
title: n,
|
|
5086
5112
|
subtext: e,
|
|
5087
5113
|
amount: o,
|
|
5088
5114
|
currency: t,
|
|
5089
5115
|
editable: r = !0,
|
|
5090
|
-
|
|
5091
|
-
|
|
5092
|
-
className: l = ""
|
|
5116
|
+
onAmountChange: i,
|
|
5117
|
+
className: a = ""
|
|
5093
5118
|
}) => {
|
|
5094
|
-
const [
|
|
5095
|
-
const
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5119
|
+
const [l, d] = ee(null), u = (w) => {
|
|
5120
|
+
const U = w.target.value;
|
|
5121
|
+
if (U && !$e(U, t)) {
|
|
5122
|
+
const C = Qe(U, t);
|
|
5123
|
+
i == null || i(C);
|
|
5124
|
+
return;
|
|
5125
|
+
}
|
|
5126
|
+
i == null || i(U);
|
|
5127
|
+
};
|
|
5128
|
+
return /* @__PURE__ */ c.jsxs("div", { className: `${a}`, children: [
|
|
5099
5129
|
n && /* @__PURE__ */ c.jsx(
|
|
5100
5130
|
"h3",
|
|
5101
5131
|
{
|
|
@@ -5121,7 +5151,7 @@ const So = ({
|
|
|
5121
5151
|
children: e
|
|
5122
5152
|
}
|
|
5123
5153
|
),
|
|
5124
|
-
/* @__PURE__ */ c.
|
|
5154
|
+
/* @__PURE__ */ c.jsx(
|
|
5125
5155
|
"div",
|
|
5126
5156
|
{
|
|
5127
5157
|
style: {
|
|
@@ -5129,86 +5159,73 @@ const So = ({
|
|
|
5129
5159
|
flexDirection: "column",
|
|
5130
5160
|
gap: "calc(var(--spacing) * 0.5)"
|
|
5131
5161
|
},
|
|
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
|
-
]
|
|
5162
|
+
children: /* @__PURE__ */ c.jsxs(
|
|
5163
|
+
"div",
|
|
5164
|
+
{
|
|
5165
|
+
style: {
|
|
5166
|
+
position: "relative",
|
|
5167
|
+
display: "flex",
|
|
5168
|
+
alignItems: "center"
|
|
5169
|
+
},
|
|
5170
|
+
children: [
|
|
5171
|
+
/* @__PURE__ */ c.jsx(
|
|
5172
|
+
"input",
|
|
5173
|
+
{
|
|
5174
|
+
type: "text",
|
|
5175
|
+
inputMode: "decimal",
|
|
5176
|
+
style: {
|
|
5177
|
+
width: "100%",
|
|
5178
|
+
padding: "calc(var(--spacing) * 0.75) calc(var(--spacing) * 3.5) calc(var(--spacing) * 0.75) var(--spacing)",
|
|
5179
|
+
fontSize: "var(--font-size-base)",
|
|
5180
|
+
fontWeight: 500,
|
|
5181
|
+
border: `1px solid ${l === "amount" ? "var(--color-primary)" : "var(--color-border)"}`,
|
|
5182
|
+
borderRadius: "var(--border-radius)",
|
|
5183
|
+
backgroundColor: r ? "var(--color-background)" : "var(--color-border-light)",
|
|
5184
|
+
color: "var(--color-text)",
|
|
5185
|
+
outline: "none",
|
|
5186
|
+
transition: "all 0.2s",
|
|
5187
|
+
boxShadow: l === "amount" ? "0 0 0 2px var(--primary-alpha-20)" : "none",
|
|
5188
|
+
cursor: r ? "text" : "not-allowed"
|
|
5189
|
+
},
|
|
5190
|
+
value: o,
|
|
5191
|
+
onChange: u,
|
|
5192
|
+
onFocus: () => d("amount"),
|
|
5193
|
+
onBlur: () => d(null),
|
|
5194
|
+
disabled: !r,
|
|
5195
|
+
placeholder: _e(0, t.decimals),
|
|
5196
|
+
"aria-label": "Payment amount"
|
|
5197
|
+
}
|
|
5198
|
+
),
|
|
5199
|
+
/* @__PURE__ */ c.jsx(
|
|
5200
|
+
"div",
|
|
5201
|
+
{
|
|
5202
|
+
style: {
|
|
5203
|
+
position: "absolute",
|
|
5204
|
+
right: "var(--spacing)",
|
|
5205
|
+
top: "50%",
|
|
5206
|
+
transform: "translateY(-50%)",
|
|
5207
|
+
pointerEvents: "none"
|
|
5208
|
+
},
|
|
5209
|
+
children: /* @__PURE__ */ c.jsx(
|
|
5210
|
+
"span",
|
|
5211
|
+
{
|
|
5212
|
+
style: {
|
|
5213
|
+
fontSize: "var(--font-size-base)",
|
|
5214
|
+
fontWeight: 500,
|
|
5215
|
+
color: "var(--color-text-muted)"
|
|
5216
|
+
},
|
|
5217
|
+
children: typeof t == "string" ? t : t.code
|
|
5218
|
+
}
|
|
5219
|
+
)
|
|
5220
|
+
}
|
|
5221
|
+
)
|
|
5222
|
+
]
|
|
5223
|
+
}
|
|
5224
|
+
)
|
|
5208
5225
|
}
|
|
5209
5226
|
)
|
|
5210
5227
|
] });
|
|
5211
|
-
},
|
|
5228
|
+
}, Do = ({
|
|
5212
5229
|
children: n,
|
|
5213
5230
|
title: e = "Select Payment Method"
|
|
5214
5231
|
}) => /* @__PURE__ */ c.jsxs(
|
|
@@ -5232,7 +5249,7 @@ const So = ({
|
|
|
5232
5249
|
/* @__PURE__ */ c.jsx("div", { className: "space-y-0", children: n })
|
|
5233
5250
|
]
|
|
5234
5251
|
}
|
|
5235
|
-
),
|
|
5252
|
+
), de = ({
|
|
5236
5253
|
label: n,
|
|
5237
5254
|
description: e,
|
|
5238
5255
|
children: o,
|
|
@@ -5240,11 +5257,11 @@ const So = ({
|
|
|
5240
5257
|
}) => {
|
|
5241
5258
|
const r = Ge.toArray(o).filter((i) => {
|
|
5242
5259
|
var a, l, d;
|
|
5243
|
-
return !t &&
|
|
5260
|
+
return !t && ae(i) && (d = (l = (a = i.props) == null ? void 0 : a.method) == null ? void 0 : l.enabled) != null ? d : !0;
|
|
5244
5261
|
}).sort((i, a) => {
|
|
5245
|
-
var u,
|
|
5246
|
-
if (!
|
|
5247
|
-
const l = (
|
|
5262
|
+
var u, w, U, C, E, x;
|
|
5263
|
+
if (!ae(i) || !ae(a)) return 0;
|
|
5264
|
+
const l = (U = (w = (u = i.props) == null ? void 0 : u.method) == null ? void 0 : w.enabled) != null ? U : !0, d = (x = (E = (C = a.props) == null ? void 0 : C.method) == null ? void 0 : E.enabled) != null ? x : !0;
|
|
5248
5265
|
return l && !d ? -1 : !l && d ? 1 : 0;
|
|
5249
5266
|
});
|
|
5250
5267
|
return /* @__PURE__ */ c.jsxs(
|
|
@@ -5282,15 +5299,15 @@ const So = ({
|
|
|
5282
5299
|
]
|
|
5283
5300
|
}
|
|
5284
5301
|
);
|
|
5285
|
-
},
|
|
5302
|
+
}, pe = ({
|
|
5286
5303
|
data: n,
|
|
5287
5304
|
selected: e = !1,
|
|
5288
5305
|
onClick: o
|
|
5289
5306
|
}) => {
|
|
5290
5307
|
const t = n.enabled === !1, i = ((a) => {
|
|
5291
5308
|
const l = a.toLowerCase();
|
|
5292
|
-
let d =
|
|
5293
|
-
if (d || (d =
|
|
5309
|
+
let d = Me(a);
|
|
5310
|
+
if (d || (d = xe(l), d) || (d = Ne(l), d)) return d;
|
|
5294
5311
|
})(n.displayName);
|
|
5295
5312
|
return /* @__PURE__ */ c.jsxs("div", { className: "relative", children: [
|
|
5296
5313
|
/* @__PURE__ */ c.jsxs(
|
|
@@ -5324,7 +5341,7 @@ const So = ({
|
|
|
5324
5341
|
),
|
|
5325
5342
|
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
5343
|
] });
|
|
5327
|
-
},
|
|
5344
|
+
}, ko = ({
|
|
5328
5345
|
selectedMethod: n,
|
|
5329
5346
|
processingFee: e = 1.5,
|
|
5330
5347
|
// @TODO: Make this dynamic based on payment method
|
|
@@ -5335,8 +5352,8 @@ const So = ({
|
|
|
5335
5352
|
return null;
|
|
5336
5353
|
const r = ((i) => {
|
|
5337
5354
|
const a = i.toLowerCase();
|
|
5338
|
-
let l =
|
|
5339
|
-
if (l || (l =
|
|
5355
|
+
let l = Me(i);
|
|
5356
|
+
if (l || (l = xe(a), l) || (l = Ne(a), l)) return l;
|
|
5340
5357
|
})(n.displayName);
|
|
5341
5358
|
return /* @__PURE__ */ c.jsx(
|
|
5342
5359
|
"div",
|
|
@@ -5409,7 +5426,7 @@ const So = ({
|
|
|
5409
5426
|
] })
|
|
5410
5427
|
}
|
|
5411
5428
|
);
|
|
5412
|
-
},
|
|
5429
|
+
}, So = ({
|
|
5413
5430
|
amount: n,
|
|
5414
5431
|
currencySymbol: e = "$",
|
|
5415
5432
|
disabled: o = !1,
|
|
@@ -5494,7 +5511,7 @@ const So = ({
|
|
|
5494
5511
|
] })
|
|
5495
5512
|
}
|
|
5496
5513
|
);
|
|
5497
|
-
},
|
|
5514
|
+
}, wo = ({
|
|
5498
5515
|
brandingText: n = "Payments",
|
|
5499
5516
|
showSecured: e = !0
|
|
5500
5517
|
}) => /* @__PURE__ */ c.jsx(
|
|
@@ -5581,68 +5598,69 @@ const So = ({
|
|
|
5581
5598
|
}
|
|
5582
5599
|
)
|
|
5583
5600
|
}
|
|
5584
|
-
),
|
|
5601
|
+
), Eo = ({
|
|
5585
5602
|
title: n = "W3 Payments",
|
|
5586
5603
|
logo: e,
|
|
5587
5604
|
userId: o,
|
|
5588
5605
|
transactionId: t,
|
|
5589
|
-
|
|
5590
|
-
|
|
5591
|
-
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
|
|
5596
|
-
|
|
5597
|
-
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5606
|
+
amount: r = "",
|
|
5607
|
+
editable: i = !0,
|
|
5608
|
+
amountTitle: a = "Enter payment amount",
|
|
5609
|
+
currency: l = "USD",
|
|
5610
|
+
targetCurrency: d,
|
|
5611
|
+
targetNetwork: u,
|
|
5612
|
+
destinations: w,
|
|
5613
|
+
walletFilter: U,
|
|
5614
|
+
exchangeFilter: C,
|
|
5615
|
+
fiatFilter: E,
|
|
5616
|
+
onInitiate: x,
|
|
5617
|
+
onComplete: R,
|
|
5618
|
+
onError: T
|
|
5601
5619
|
}) => {
|
|
5602
|
-
var
|
|
5603
|
-
const { w3payments: I, httpClient:
|
|
5604
|
-
walletFilter:
|
|
5605
|
-
exchangeFilter:
|
|
5606
|
-
fiatFilter:
|
|
5607
|
-
targetCurrency:
|
|
5608
|
-
targetNetwork:
|
|
5620
|
+
var Y;
|
|
5621
|
+
const { w3payments: I, httpClient: ne, isInitialized: W } = vo(), [M, K] = ee(r), [D, L] = ee(), [te, B] = ee(!1), A = me(() => I ? I.getCurrency(l) : null, [I, l]), N = me(() => !W || !I ? [] : I.paymentMethodService.getDisplayOptions({
|
|
5622
|
+
walletFilter: U,
|
|
5623
|
+
exchangeFilter: C,
|
|
5624
|
+
fiatFilter: E,
|
|
5625
|
+
targetCurrency: d,
|
|
5626
|
+
targetNetwork: u
|
|
5609
5627
|
}), [
|
|
5610
|
-
|
|
5628
|
+
W,
|
|
5611
5629
|
I,
|
|
5612
|
-
T,
|
|
5613
|
-
M,
|
|
5614
5630
|
U,
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
|
|
5618
|
-
|
|
5619
|
-
|
|
5631
|
+
C,
|
|
5632
|
+
E,
|
|
5633
|
+
d,
|
|
5634
|
+
u
|
|
5635
|
+
]), Z = (m) => N.find((b) => b.id === m), z = () => !!(M && D && A && I && W), se = () => {
|
|
5636
|
+
K(""), L(void 0), B(!1);
|
|
5637
|
+
}, F = () => S(null, null, function* () {
|
|
5620
5638
|
var m;
|
|
5621
|
-
if (!(!
|
|
5622
|
-
|
|
5639
|
+
if (!(!z() || !I || !A)) {
|
|
5640
|
+
B(!0);
|
|
5623
5641
|
try {
|
|
5624
|
-
yield
|
|
5625
|
-
amount:
|
|
5626
|
-
currency:
|
|
5627
|
-
paymentMethodId:
|
|
5642
|
+
yield x == null ? void 0 : x(y({
|
|
5643
|
+
amount: M,
|
|
5644
|
+
currency: A.code,
|
|
5645
|
+
paymentMethodId: D
|
|
5628
5646
|
}, o && { userId: o })), console.log("Initiating payment with:", {
|
|
5629
|
-
amount:
|
|
5630
|
-
currency:
|
|
5631
|
-
paymentMethodId:
|
|
5647
|
+
amount: M,
|
|
5648
|
+
currency: A.code,
|
|
5649
|
+
paymentMethodId: D
|
|
5632
5650
|
});
|
|
5633
|
-
const b = yield
|
|
5651
|
+
const b = yield ne.createPayment({
|
|
5634
5652
|
id: t || `payment_${Date.now()}`,
|
|
5635
|
-
amount: parseFloat(
|
|
5636
|
-
currency:
|
|
5653
|
+
amount: parseFloat(M),
|
|
5654
|
+
currency: A.code,
|
|
5637
5655
|
customerId: o || "anonymous",
|
|
5638
|
-
destinations:
|
|
5656
|
+
destinations: w,
|
|
5639
5657
|
metadata: {
|
|
5640
|
-
paymentMethodId:
|
|
5658
|
+
paymentMethodId: D
|
|
5641
5659
|
}
|
|
5642
5660
|
});
|
|
5643
5661
|
if (console.log("Payment session created successfully:", b), I && b)
|
|
5644
5662
|
try {
|
|
5645
|
-
const
|
|
5663
|
+
const k = yield I.openCheckout({
|
|
5646
5664
|
id: b.id,
|
|
5647
5665
|
url: b.url,
|
|
5648
5666
|
expiresAt: b.expiresAt,
|
|
@@ -5651,62 +5669,62 @@ const So = ({
|
|
|
5651
5669
|
vendorId: b.selectedVendor
|
|
5652
5670
|
})
|
|
5653
5671
|
});
|
|
5654
|
-
if (console.log("Checkout result:",
|
|
5655
|
-
console.log("Payment cancelled by user"),
|
|
5672
|
+
if (console.log("Checkout result:", k), k.status === "cancelled") {
|
|
5673
|
+
console.log("Payment cancelled by user"), T == null || T({
|
|
5656
5674
|
message: "Payment cancelled by user",
|
|
5657
5675
|
transactionId: b.id,
|
|
5658
5676
|
userId: o || "anonymous",
|
|
5659
5677
|
code: "PAYMENT_CANCELLED"
|
|
5660
5678
|
});
|
|
5661
5679
|
return;
|
|
5662
|
-
} else if (
|
|
5663
|
-
|
|
5664
|
-
message: ((m =
|
|
5680
|
+
} else if (k.status === "failed") {
|
|
5681
|
+
T == null || T({
|
|
5682
|
+
message: ((m = k.data) == null ? void 0 : m.message) || "Payment failed",
|
|
5665
5683
|
transactionId: b.id,
|
|
5666
5684
|
userId: o || "anonymous",
|
|
5667
|
-
details:
|
|
5685
|
+
details: k.data
|
|
5668
5686
|
});
|
|
5669
5687
|
return;
|
|
5670
5688
|
} else
|
|
5671
|
-
|
|
5672
|
-
amount:
|
|
5673
|
-
currency:
|
|
5674
|
-
paymentMethodId:
|
|
5675
|
-
transactionId:
|
|
5689
|
+
R == null || R(P(y({
|
|
5690
|
+
amount: M,
|
|
5691
|
+
currency: A.code,
|
|
5692
|
+
paymentMethodId: D,
|
|
5693
|
+
transactionId: k.id,
|
|
5676
5694
|
vendorId: b.selectedVendor || "unknown",
|
|
5677
|
-
status:
|
|
5695
|
+
status: k.status
|
|
5678
5696
|
}, o && { userId: o }), {
|
|
5679
|
-
checkoutData:
|
|
5680
|
-
})),
|
|
5681
|
-
} catch (
|
|
5682
|
-
console.error("Checkout failed:",
|
|
5683
|
-
message: `Checkout failed: ${
|
|
5697
|
+
checkoutData: k.data
|
|
5698
|
+
})), se();
|
|
5699
|
+
} catch (k) {
|
|
5700
|
+
console.error("Checkout failed:", k), T == null || T({
|
|
5701
|
+
message: `Checkout failed: ${k instanceof Error ? k.message : "Unknown error"}`,
|
|
5684
5702
|
transactionId: b.id,
|
|
5685
5703
|
userId: o || "anonymous",
|
|
5686
|
-
details:
|
|
5704
|
+
details: k
|
|
5687
5705
|
});
|
|
5688
5706
|
}
|
|
5689
5707
|
else
|
|
5690
|
-
|
|
5691
|
-
amount:
|
|
5692
|
-
currency:
|
|
5693
|
-
paymentMethodId:
|
|
5708
|
+
R == null || R(y({
|
|
5709
|
+
amount: M,
|
|
5710
|
+
currency: A.code,
|
|
5711
|
+
paymentMethodId: D,
|
|
5694
5712
|
transactionId: b.id,
|
|
5695
5713
|
vendorId: b.selectedVendor || "unknown",
|
|
5696
5714
|
status: "pending"
|
|
5697
5715
|
}, o && { userId: o }));
|
|
5698
5716
|
} catch (b) {
|
|
5699
|
-
console.error("Payment failed:", b),
|
|
5717
|
+
console.error("Payment failed:", b), T == null || T(P(y(y({
|
|
5700
5718
|
message: b instanceof Error ? b.message : "Payment failed"
|
|
5701
5719
|
}, t && { transactionId: t }), o && { userId: o }), {
|
|
5702
5720
|
details: b
|
|
5703
5721
|
}));
|
|
5704
5722
|
} finally {
|
|
5705
|
-
|
|
5723
|
+
B(!1);
|
|
5706
5724
|
}
|
|
5707
5725
|
}
|
|
5708
5726
|
});
|
|
5709
|
-
return
|
|
5727
|
+
return W ? /* @__PURE__ */ c.jsxs(
|
|
5710
5728
|
"div",
|
|
5711
5729
|
{
|
|
5712
5730
|
className: `
|
|
@@ -5722,56 +5740,55 @@ const So = ({
|
|
|
5722
5740
|
`,
|
|
5723
5741
|
children: [
|
|
5724
5742
|
/* @__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
|
-
|
|
5743
|
+
/* @__PURE__ */ c.jsx(yo, y({ title: n }, e && { logo: e })),
|
|
5744
|
+
A && /* @__PURE__ */ c.jsx("div", { className: "px-[var(--spacing)]", children: /* @__PURE__ */ c.jsx(
|
|
5745
|
+
To,
|
|
5728
5746
|
{
|
|
5729
|
-
title:
|
|
5730
|
-
amount:
|
|
5731
|
-
currency:
|
|
5732
|
-
editable:
|
|
5733
|
-
|
|
5734
|
-
onAmountChange: _
|
|
5747
|
+
title: a,
|
|
5748
|
+
amount: M,
|
|
5749
|
+
currency: A,
|
|
5750
|
+
editable: i,
|
|
5751
|
+
onAmountChange: K
|
|
5735
5752
|
}
|
|
5736
5753
|
) }),
|
|
5737
5754
|
/* @__PURE__ */ c.jsxs(
|
|
5738
|
-
|
|
5739
|
-
P(y({},
|
|
5740
|
-
onMethodSelect:
|
|
5755
|
+
Do,
|
|
5756
|
+
P(y({}, D && { selectedMethodId: D }), {
|
|
5757
|
+
onMethodSelect: L,
|
|
5741
5758
|
children: [
|
|
5742
|
-
N.filter((m) => m.method === "wallet").length > 0 && /* @__PURE__ */ c.jsx(
|
|
5743
|
-
|
|
5759
|
+
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(
|
|
5760
|
+
pe,
|
|
5744
5761
|
{
|
|
5745
5762
|
data: {
|
|
5746
5763
|
id: m.id,
|
|
5747
5764
|
displayName: m.displayName
|
|
5748
5765
|
},
|
|
5749
|
-
selected:
|
|
5750
|
-
onClick: () =>
|
|
5766
|
+
selected: D === m.id,
|
|
5767
|
+
onClick: () => L(m.id)
|
|
5751
5768
|
},
|
|
5752
5769
|
b
|
|
5753
5770
|
)) }),
|
|
5754
|
-
N.filter((m) => m.method === "exchange").length > 0 && /* @__PURE__ */ c.jsx(
|
|
5755
|
-
|
|
5771
|
+
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(
|
|
5772
|
+
pe,
|
|
5756
5773
|
{
|
|
5757
5774
|
data: {
|
|
5758
5775
|
id: m.id,
|
|
5759
5776
|
displayName: m.displayName
|
|
5760
5777
|
},
|
|
5761
|
-
selected:
|
|
5762
|
-
onClick: () =>
|
|
5778
|
+
selected: D === m.id,
|
|
5779
|
+
onClick: () => L(m.id)
|
|
5763
5780
|
},
|
|
5764
5781
|
b
|
|
5765
5782
|
)) }),
|
|
5766
|
-
N.filter((m) => m.method === "fiat").length > 0 && /* @__PURE__ */ c.jsx(
|
|
5767
|
-
|
|
5783
|
+
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(
|
|
5784
|
+
pe,
|
|
5768
5785
|
{
|
|
5769
5786
|
data: {
|
|
5770
5787
|
id: m.id,
|
|
5771
5788
|
displayName: m.displayName
|
|
5772
5789
|
},
|
|
5773
|
-
selected:
|
|
5774
|
-
onClick: () =>
|
|
5790
|
+
selected: D === m.id,
|
|
5791
|
+
onClick: () => L(m.id)
|
|
5775
5792
|
},
|
|
5776
5793
|
b
|
|
5777
5794
|
)) })
|
|
@@ -5780,36 +5797,36 @@ const So = ({
|
|
|
5780
5797
|
)
|
|
5781
5798
|
] }),
|
|
5782
5799
|
/* @__PURE__ */ c.jsxs("div", { className: "bg-white border-t border-gray-100", children: [
|
|
5783
|
-
|
|
5784
|
-
|
|
5800
|
+
D && /* @__PURE__ */ c.jsx("div", { className: "px-[var(--spacing)] pt-[calc(var(--spacing)*0.75)]", children: /* @__PURE__ */ c.jsx(
|
|
5801
|
+
ko,
|
|
5785
5802
|
{
|
|
5786
5803
|
selectedMethod: {
|
|
5787
|
-
id:
|
|
5788
|
-
displayName: ((
|
|
5804
|
+
id: D,
|
|
5805
|
+
displayName: ((Y = Z(D)) == null ? void 0 : Y.displayName) || ""
|
|
5789
5806
|
}
|
|
5790
5807
|
}
|
|
5791
5808
|
) }),
|
|
5792
5809
|
/* @__PURE__ */ c.jsx("div", { className: "px-[var(--spacing)] py-[var(--spacing)]", children: /* @__PURE__ */ c.jsx(
|
|
5793
|
-
|
|
5810
|
+
So,
|
|
5794
5811
|
{
|
|
5795
|
-
amount:
|
|
5796
|
-
disabled: !
|
|
5797
|
-
loading:
|
|
5798
|
-
onClick:
|
|
5812
|
+
amount: M || "0.00",
|
|
5813
|
+
disabled: !z(),
|
|
5814
|
+
loading: te,
|
|
5815
|
+
onClick: F
|
|
5799
5816
|
}
|
|
5800
5817
|
) })
|
|
5801
5818
|
] }),
|
|
5802
|
-
/* @__PURE__ */ c.jsx(
|
|
5819
|
+
/* @__PURE__ */ c.jsx(wo, {})
|
|
5803
5820
|
]
|
|
5804
5821
|
}
|
|
5805
5822
|
) : /* @__PURE__ */ c.jsx("div", { children: "Loading payment widget..." });
|
|
5806
|
-
},
|
|
5807
|
-
W3_PAYMENTS_REACT_VERSION:
|
|
5823
|
+
}, Uo = "1.0.0", Mo = {
|
|
5824
|
+
W3_PAYMENTS_REACT_VERSION: Uo
|
|
5808
5825
|
};
|
|
5809
5826
|
export {
|
|
5810
|
-
|
|
5811
|
-
|
|
5812
|
-
|
|
5813
|
-
|
|
5814
|
-
|
|
5827
|
+
Eo as W3PaymentWidget,
|
|
5828
|
+
Co as W3PaymentsProvider,
|
|
5829
|
+
Uo as W3_PAYMENTS_REACT_VERSION,
|
|
5830
|
+
Mo as default,
|
|
5831
|
+
vo as useW3Payments
|
|
5815
5832
|
};
|