@movmo_app/payments 0.5.0 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs.js +10 -10
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +542 -520
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var Gr = Object.defineProperty;
|
|
2
2
|
var Hr = (r, t, n) => t in r ? Gr(r, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : r[t] = n;
|
|
3
3
|
var ir = (r, t, n) => Hr(r, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
-
import Fr, { useState as k, useRef as
|
|
5
|
-
var fr = { exports: {} },
|
|
4
|
+
import Fr, { useState as k, useRef as I, useEffect as A, useCallback as z, useMemo as Xe, useId as Jr } from "react";
|
|
5
|
+
var fr = { exports: {} }, Ge = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -14,19 +14,19 @@ var fr = { exports: {} }, qe = {};
|
|
|
14
14
|
*/
|
|
15
15
|
var jr;
|
|
16
16
|
function Zr() {
|
|
17
|
-
if (jr) return
|
|
17
|
+
if (jr) return Ge;
|
|
18
18
|
jr = 1;
|
|
19
|
-
var r = Fr, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,
|
|
20
|
-
function u(x, m,
|
|
19
|
+
var r = Fr, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, i = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function u(x, m, P) {
|
|
21
21
|
var y, b = {}, f = null, j = null;
|
|
22
|
-
|
|
23
|
-
for (y in m) s.call(m, y) && !
|
|
22
|
+
P !== void 0 && (f = "" + P), m.key !== void 0 && (f = "" + m.key), m.ref !== void 0 && (j = m.ref);
|
|
23
|
+
for (y in m) s.call(m, y) && !l.hasOwnProperty(y) && (b[y] = m[y]);
|
|
24
24
|
if (x && x.defaultProps) for (y in m = x.defaultProps, m) b[y] === void 0 && (b[y] = m[y]);
|
|
25
25
|
return { $$typeof: t, type: x, key: f, ref: j, props: b, _owner: i.current };
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return Ge.Fragment = n, Ge.jsx = u, Ge.jsxs = u, Ge;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var He = {};
|
|
30
30
|
/**
|
|
31
31
|
* @license React
|
|
32
32
|
* react-jsx-runtime.development.js
|
|
@@ -39,51 +39,51 @@ var Ge = {};
|
|
|
39
39
|
var Er;
|
|
40
40
|
function Xr() {
|
|
41
41
|
return Er || (Er = 1, process.env.NODE_ENV !== "production" && function() {
|
|
42
|
-
var r = Fr, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"),
|
|
42
|
+
var r = Fr, t = Symbol.for("react.element"), n = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), i = Symbol.for("react.strict_mode"), l = Symbol.for("react.profiler"), u = Symbol.for("react.provider"), x = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), P = Symbol.for("react.suspense"), y = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), f = Symbol.for("react.lazy"), j = Symbol.for("react.offscreen"), W = Symbol.iterator, ae = "@@iterator";
|
|
43
43
|
function _(e) {
|
|
44
44
|
if (e === null || typeof e != "object")
|
|
45
45
|
return null;
|
|
46
46
|
var o = W && e[W] || e[ae];
|
|
47
47
|
return typeof o == "function" ? o : null;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
49
|
+
var T = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
50
|
function w(e) {
|
|
51
51
|
{
|
|
52
|
-
for (var o = arguments.length,
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
for (var o = arguments.length, c = new Array(o > 1 ? o - 1 : 0), h = 1; h < o; h++)
|
|
53
|
+
c[h - 1] = arguments[h];
|
|
54
|
+
oe("error", e, c);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function oe(e, o, c) {
|
|
58
58
|
{
|
|
59
|
-
var h =
|
|
60
|
-
|
|
61
|
-
var O =
|
|
59
|
+
var h = T.ReactDebugCurrentFrame, F = h.getStackAddendum();
|
|
60
|
+
F !== "" && (o += "%s", c = c.concat([F]));
|
|
61
|
+
var O = c.map(function(C) {
|
|
62
62
|
return String(C);
|
|
63
63
|
});
|
|
64
64
|
O.unshift("Warning: " + o), Function.prototype.apply.call(console[e], console, O);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
var
|
|
67
|
+
var re = !1, fe = !1, ge = !1, H = !1, ie = !1, v;
|
|
68
68
|
v = Symbol.for("react.module.reference");
|
|
69
|
-
function
|
|
70
|
-
return !!(typeof e == "string" || typeof e == "function" || e === s || e ===
|
|
69
|
+
function le(e) {
|
|
70
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === l || ie || e === i || e === P || e === y || H || e === j || re || fe || ge || typeof e == "object" && e !== null && (e.$$typeof === f || e.$$typeof === b || e.$$typeof === u || e.$$typeof === x || e.$$typeof === m || // This needs to include all possible module reference object
|
|
71
71
|
// types supported by any Flight configuration anywhere since
|
|
72
72
|
// we don't know which Flight build this will end up being used
|
|
73
73
|
// with.
|
|
74
74
|
e.$$typeof === v || e.getModuleId !== void 0));
|
|
75
75
|
}
|
|
76
|
-
function Re(e, o,
|
|
76
|
+
function Re(e, o, c) {
|
|
77
77
|
var h = e.displayName;
|
|
78
78
|
if (h)
|
|
79
79
|
return h;
|
|
80
|
-
var
|
|
81
|
-
return
|
|
80
|
+
var F = o.displayName || o.name || "";
|
|
81
|
+
return F !== "" ? c + "(" + F + ")" : c;
|
|
82
82
|
}
|
|
83
83
|
function be(e) {
|
|
84
84
|
return e.displayName || "Context";
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function S(e) {
|
|
87
87
|
if (e == null)
|
|
88
88
|
return null;
|
|
89
89
|
if (typeof e.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
@@ -95,11 +95,11 @@ function Xr() {
|
|
|
95
95
|
return "Fragment";
|
|
96
96
|
case n:
|
|
97
97
|
return "Portal";
|
|
98
|
-
case
|
|
98
|
+
case l:
|
|
99
99
|
return "Profiler";
|
|
100
100
|
case i:
|
|
101
101
|
return "StrictMode";
|
|
102
|
-
case
|
|
102
|
+
case P:
|
|
103
103
|
return "Suspense";
|
|
104
104
|
case y:
|
|
105
105
|
return "SuspenseList";
|
|
@@ -110,17 +110,17 @@ function Xr() {
|
|
|
110
110
|
var o = e;
|
|
111
111
|
return be(o) + ".Consumer";
|
|
112
112
|
case u:
|
|
113
|
-
var
|
|
114
|
-
return be(
|
|
113
|
+
var c = e;
|
|
114
|
+
return be(c._context) + ".Provider";
|
|
115
115
|
case m:
|
|
116
116
|
return Re(e, e.render, "ForwardRef");
|
|
117
117
|
case b:
|
|
118
118
|
var h = e.displayName || null;
|
|
119
|
-
return h !== null ? h :
|
|
119
|
+
return h !== null ? h : S(e.type) || "Memo";
|
|
120
120
|
case f: {
|
|
121
|
-
var
|
|
121
|
+
var F = e, O = F._payload, C = F._init;
|
|
122
122
|
try {
|
|
123
|
-
return
|
|
123
|
+
return S(C(O));
|
|
124
124
|
} catch {
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
@@ -128,14 +128,14 @@ function Xr() {
|
|
|
128
128
|
}
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
|
-
var g = Object.assign, p = 0, N,
|
|
131
|
+
var g = Object.assign, p = 0, N, U, ee, pe, J, q, B;
|
|
132
132
|
function $() {
|
|
133
133
|
}
|
|
134
134
|
$.__reactDisabledLog = !0;
|
|
135
135
|
function Y() {
|
|
136
136
|
{
|
|
137
137
|
if (p === 0) {
|
|
138
|
-
N = console.log,
|
|
138
|
+
N = console.log, U = console.info, ee = console.warn, pe = console.error, J = console.group, q = console.groupCollapsed, B = console.groupEnd;
|
|
139
139
|
var e = {
|
|
140
140
|
configurable: !0,
|
|
141
141
|
enumerable: !0,
|
|
@@ -168,19 +168,19 @@ function Xr() {
|
|
|
168
168
|
value: N
|
|
169
169
|
}),
|
|
170
170
|
info: g({}, e, {
|
|
171
|
-
value:
|
|
171
|
+
value: U
|
|
172
172
|
}),
|
|
173
173
|
warn: g({}, e, {
|
|
174
|
-
value:
|
|
174
|
+
value: ee
|
|
175
175
|
}),
|
|
176
176
|
error: g({}, e, {
|
|
177
177
|
value: pe
|
|
178
178
|
}),
|
|
179
179
|
group: g({}, e, {
|
|
180
|
-
value:
|
|
180
|
+
value: J
|
|
181
181
|
}),
|
|
182
182
|
groupCollapsed: g({}, e, {
|
|
183
|
-
value:
|
|
183
|
+
value: q
|
|
184
184
|
}),
|
|
185
185
|
groupEnd: g({}, e, {
|
|
186
186
|
value: B
|
|
@@ -190,36 +190,36 @@ function Xr() {
|
|
|
190
190
|
p < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
var me =
|
|
194
|
-
function Ce(e, o,
|
|
193
|
+
var me = T.ReactCurrentDispatcher, te;
|
|
194
|
+
function Ce(e, o, c) {
|
|
195
195
|
{
|
|
196
|
-
if (
|
|
196
|
+
if (te === void 0)
|
|
197
197
|
try {
|
|
198
198
|
throw Error();
|
|
199
|
-
} catch (
|
|
200
|
-
var h =
|
|
201
|
-
|
|
199
|
+
} catch (F) {
|
|
200
|
+
var h = F.stack.trim().match(/\n( *(at )?)/);
|
|
201
|
+
te = h && h[1] || "";
|
|
202
202
|
}
|
|
203
203
|
return `
|
|
204
|
-
` +
|
|
204
|
+
` + te + e;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
var Pe = !1, ye;
|
|
208
208
|
{
|
|
209
|
-
var
|
|
210
|
-
ye = new
|
|
209
|
+
var ce = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
+
ye = new ce();
|
|
211
211
|
}
|
|
212
212
|
function we(e, o) {
|
|
213
213
|
if (!e || Pe)
|
|
214
214
|
return "";
|
|
215
215
|
{
|
|
216
|
-
var
|
|
217
|
-
if (
|
|
218
|
-
return
|
|
216
|
+
var c = ye.get(e);
|
|
217
|
+
if (c !== void 0)
|
|
218
|
+
return c;
|
|
219
219
|
}
|
|
220
220
|
var h;
|
|
221
221
|
Pe = !0;
|
|
222
|
-
var
|
|
222
|
+
var F = Error.prepareStackTrace;
|
|
223
223
|
Error.prepareStackTrace = void 0;
|
|
224
224
|
var O;
|
|
225
225
|
O = me.current, me.current = null, Y();
|
|
@@ -258,36 +258,36 @@ function Xr() {
|
|
|
258
258
|
} catch (ue) {
|
|
259
259
|
if (ue && h && typeof ue.stack == "string") {
|
|
260
260
|
for (var E = ue.stack.split(`
|
|
261
|
-
`),
|
|
262
|
-
`), L = E.length - 1,
|
|
263
|
-
|
|
264
|
-
for (; L >= 1 &&
|
|
265
|
-
if (E[L] !==
|
|
266
|
-
if (L !== 1 ||
|
|
261
|
+
`), se = h.stack.split(`
|
|
262
|
+
`), L = E.length - 1, K = se.length - 1; L >= 1 && K >= 0 && E[L] !== se[K]; )
|
|
263
|
+
K--;
|
|
264
|
+
for (; L >= 1 && K >= 0; L--, K--)
|
|
265
|
+
if (E[L] !== se[K]) {
|
|
266
|
+
if (L !== 1 || K !== 1)
|
|
267
267
|
do
|
|
268
|
-
if (L--,
|
|
268
|
+
if (L--, K--, K < 0 || E[L] !== se[K]) {
|
|
269
269
|
var xe = `
|
|
270
270
|
` + E[L].replace(" at new ", " at ");
|
|
271
271
|
return e.displayName && xe.includes("<anonymous>") && (xe = xe.replace("<anonymous>", e.displayName)), typeof e == "function" && ye.set(e, xe), xe;
|
|
272
272
|
}
|
|
273
|
-
while (L >= 1 &&
|
|
273
|
+
while (L >= 1 && K >= 0);
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
} finally {
|
|
278
|
-
Pe = !1, me.current = O, he(), Error.prepareStackTrace =
|
|
278
|
+
Pe = !1, me.current = O, he(), Error.prepareStackTrace = F;
|
|
279
279
|
}
|
|
280
|
-
var
|
|
280
|
+
var Me = e ? e.displayName || e.name : "", We = Me ? Ce(Me) : "";
|
|
281
281
|
return typeof e == "function" && ye.set(e, We), We;
|
|
282
282
|
}
|
|
283
|
-
function je(e, o,
|
|
283
|
+
function je(e, o, c) {
|
|
284
284
|
return we(e, !1);
|
|
285
285
|
}
|
|
286
286
|
function ke(e) {
|
|
287
287
|
var o = e.prototype;
|
|
288
288
|
return !!(o && o.isReactComponent);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function Z(e, o, c) {
|
|
291
291
|
if (e == null)
|
|
292
292
|
return "";
|
|
293
293
|
if (typeof e == "function")
|
|
@@ -295,7 +295,7 @@ function Xr() {
|
|
|
295
295
|
if (typeof e == "string")
|
|
296
296
|
return Ce(e);
|
|
297
297
|
switch (e) {
|
|
298
|
-
case
|
|
298
|
+
case P:
|
|
299
299
|
return Ce("Suspense");
|
|
300
300
|
case y:
|
|
301
301
|
return Ce("SuspenseList");
|
|
@@ -305,26 +305,26 @@ function Xr() {
|
|
|
305
305
|
case m:
|
|
306
306
|
return je(e.render);
|
|
307
307
|
case b:
|
|
308
|
-
return
|
|
308
|
+
return Z(e.type, o, c);
|
|
309
309
|
case f: {
|
|
310
|
-
var h = e,
|
|
310
|
+
var h = e, F = h._payload, O = h._init;
|
|
311
311
|
try {
|
|
312
|
-
return
|
|
312
|
+
return Z(O(F), o, c);
|
|
313
313
|
} catch {
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return "";
|
|
318
318
|
}
|
|
319
|
-
var Ee = Object.prototype.hasOwnProperty, Te = {}, ve =
|
|
319
|
+
var Ee = Object.prototype.hasOwnProperty, Te = {}, ve = T.ReactDebugCurrentFrame;
|
|
320
320
|
function _e(e) {
|
|
321
321
|
if (e) {
|
|
322
|
-
var o = e._owner,
|
|
323
|
-
ve.setExtraStackFrame(
|
|
322
|
+
var o = e._owner, c = Z(e.type, e._source, o ? o.type : null);
|
|
323
|
+
ve.setExtraStackFrame(c);
|
|
324
324
|
} else
|
|
325
325
|
ve.setExtraStackFrame(null);
|
|
326
326
|
}
|
|
327
|
-
function R(e, o,
|
|
327
|
+
function R(e, o, c, h, F) {
|
|
328
328
|
{
|
|
329
329
|
var O = Function.call.bind(Ee);
|
|
330
330
|
for (var C in e)
|
|
@@ -332,48 +332,48 @@ function Xr() {
|
|
|
332
332
|
var E = void 0;
|
|
333
333
|
try {
|
|
334
334
|
if (typeof e[C] != "function") {
|
|
335
|
-
var
|
|
336
|
-
throw
|
|
335
|
+
var se = Error((h || "React class") + ": " + c + " type `" + C + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[C] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
336
|
+
throw se.name = "Invariant Violation", se;
|
|
337
337
|
}
|
|
338
|
-
E = e[C](o, C, h,
|
|
338
|
+
E = e[C](o, C, h, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
339
|
} catch (L) {
|
|
340
340
|
E = L;
|
|
341
341
|
}
|
|
342
|
-
E && !(E instanceof Error) && (_e(
|
|
342
|
+
E && !(E instanceof Error) && (_e(F), w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", h || "React class", c, C, typeof E), _e(null)), E instanceof Error && !(E.message in Te) && (Te[E.message] = !0, _e(F), w("Failed %s type: %s", c, E.message), _e(null));
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
|
-
var
|
|
347
|
-
function
|
|
348
|
-
return
|
|
346
|
+
var D = Array.isArray;
|
|
347
|
+
function G(e) {
|
|
348
|
+
return D(e);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function de(e) {
|
|
351
351
|
{
|
|
352
|
-
var o = typeof Symbol == "function" && Symbol.toStringTag,
|
|
353
|
-
return
|
|
352
|
+
var o = typeof Symbol == "function" && Symbol.toStringTag, c = o && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
353
|
+
return c;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function Qe(e) {
|
|
357
357
|
try {
|
|
358
|
-
return
|
|
358
|
+
return er(e), !1;
|
|
359
359
|
} catch {
|
|
360
360
|
return !0;
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function er(e) {
|
|
364
364
|
return "" + e;
|
|
365
365
|
}
|
|
366
366
|
function Oe(e) {
|
|
367
|
-
if (
|
|
368
|
-
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
367
|
+
if (Qe(e))
|
|
368
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", de(e)), er(e);
|
|
369
369
|
}
|
|
370
|
-
var
|
|
370
|
+
var Ye = T.ReactCurrentOwner, rr = {
|
|
371
371
|
key: !0,
|
|
372
372
|
ref: !0,
|
|
373
373
|
__self: !0,
|
|
374
374
|
__source: !0
|
|
375
|
-
},
|
|
376
|
-
function
|
|
375
|
+
}, Ve, Fe;
|
|
376
|
+
function Ke(e) {
|
|
377
377
|
if (Ee.call(e, "ref")) {
|
|
378
378
|
var o = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
379
|
if (o && o.isReactWarning)
|
|
@@ -381,7 +381,7 @@ function Xr() {
|
|
|
381
381
|
}
|
|
382
382
|
return e.ref !== void 0;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
384
|
+
function qe(e) {
|
|
385
385
|
if (Ee.call(e, "key")) {
|
|
386
386
|
var o = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
387
|
if (o && o.isReactWarning)
|
|
@@ -389,39 +389,39 @@ function Xr() {
|
|
|
389
389
|
}
|
|
390
390
|
return e.key !== void 0;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
393
|
-
typeof e.ref == "string" &&
|
|
392
|
+
function $e(e, o) {
|
|
393
|
+
typeof e.ref == "string" && Ye.current;
|
|
394
394
|
}
|
|
395
395
|
function nr(e, o) {
|
|
396
396
|
{
|
|
397
|
-
var
|
|
398
|
-
|
|
397
|
+
var c = function() {
|
|
398
|
+
Ve || (Ve = !0, w("%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://reactjs.org/link/special-props)", o));
|
|
399
399
|
};
|
|
400
|
-
|
|
401
|
-
get:
|
|
400
|
+
c.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
401
|
+
get: c,
|
|
402
402
|
configurable: !0
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function sr(e, o) {
|
|
407
407
|
{
|
|
408
|
-
var
|
|
408
|
+
var c = function() {
|
|
409
409
|
Fe || (Fe = !0, w("%s: `ref` 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://reactjs.org/link/special-props)", o));
|
|
410
410
|
};
|
|
411
|
-
|
|
412
|
-
get:
|
|
411
|
+
c.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
412
|
+
get: c,
|
|
413
413
|
configurable: !0
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
var
|
|
417
|
+
var d = function(e, o, c, h, F, O, C) {
|
|
418
418
|
var E = {
|
|
419
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
420
420
|
$$typeof: t,
|
|
421
421
|
// Built-in properties that belong on the element
|
|
422
422
|
type: e,
|
|
423
423
|
key: o,
|
|
424
|
-
ref:
|
|
424
|
+
ref: c,
|
|
425
425
|
props: C,
|
|
426
426
|
// Record the component responsible for creating this element.
|
|
427
427
|
_owner: O
|
|
@@ -440,44 +440,44 @@ function Xr() {
|
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
|
-
value:
|
|
443
|
+
value: F
|
|
444
444
|
}), Object.freeze && (Object.freeze(E.props), Object.freeze(E)), E;
|
|
445
445
|
};
|
|
446
|
-
function X(e, o,
|
|
446
|
+
function X(e, o, c, h, F) {
|
|
447
447
|
{
|
|
448
|
-
var O, C = {}, E = null,
|
|
449
|
-
|
|
448
|
+
var O, C = {}, E = null, se = null;
|
|
449
|
+
c !== void 0 && (Oe(c), E = "" + c), qe(o) && (Oe(o.key), E = "" + o.key), Ke(o) && (se = o.ref, $e(o, F));
|
|
450
450
|
for (O in o)
|
|
451
|
-
Ee.call(o, O) && !
|
|
451
|
+
Ee.call(o, O) && !rr.hasOwnProperty(O) && (C[O] = o[O]);
|
|
452
452
|
if (e && e.defaultProps) {
|
|
453
453
|
var L = e.defaultProps;
|
|
454
454
|
for (O in L)
|
|
455
455
|
C[O] === void 0 && (C[O] = L[O]);
|
|
456
456
|
}
|
|
457
|
-
if (E ||
|
|
458
|
-
var
|
|
459
|
-
E && nr(C,
|
|
457
|
+
if (E || se) {
|
|
458
|
+
var K = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
459
|
+
E && nr(C, K), se && sr(C, K);
|
|
460
460
|
}
|
|
461
|
-
return
|
|
461
|
+
return d(e, E, se, F, h, Ye.current, C);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
var
|
|
465
|
-
function
|
|
464
|
+
var V = T.ReactCurrentOwner, M = T.ReactDebugCurrentFrame;
|
|
465
|
+
function ne(e) {
|
|
466
466
|
if (e) {
|
|
467
|
-
var o = e._owner,
|
|
468
|
-
|
|
467
|
+
var o = e._owner, c = Z(e.type, e._source, o ? o.type : null);
|
|
468
|
+
M.setExtraStackFrame(c);
|
|
469
469
|
} else
|
|
470
|
-
|
|
470
|
+
M.setExtraStackFrame(null);
|
|
471
471
|
}
|
|
472
|
-
var
|
|
473
|
-
|
|
474
|
-
function
|
|
472
|
+
var Ne;
|
|
473
|
+
Ne = !1;
|
|
474
|
+
function De(e) {
|
|
475
475
|
return typeof e == "object" && e !== null && e.$$typeof === t;
|
|
476
476
|
}
|
|
477
477
|
function yr() {
|
|
478
478
|
{
|
|
479
|
-
if (
|
|
480
|
-
var e =
|
|
479
|
+
if (V.current) {
|
|
480
|
+
var e = S(V.current.type);
|
|
481
481
|
if (e)
|
|
482
482
|
return `
|
|
483
483
|
|
|
@@ -490,14 +490,14 @@ Check the render method of \`` + e + "`.";
|
|
|
490
490
|
return "";
|
|
491
491
|
}
|
|
492
492
|
var vr = {};
|
|
493
|
-
function
|
|
493
|
+
function Ur(e) {
|
|
494
494
|
{
|
|
495
495
|
var o = yr();
|
|
496
496
|
if (!o) {
|
|
497
|
-
var
|
|
498
|
-
|
|
497
|
+
var c = typeof e == "string" ? e : e.displayName || e.name;
|
|
498
|
+
c && (o = `
|
|
499
499
|
|
|
500
|
-
Check the top-level render call using <` +
|
|
500
|
+
Check the top-level render call using <` + c + ">.");
|
|
501
501
|
}
|
|
502
502
|
return o;
|
|
503
503
|
}
|
|
@@ -507,92 +507,92 @@ Check the top-level render call using <` + l + ">.");
|
|
|
507
507
|
if (!e._store || e._store.validated || e.key != null)
|
|
508
508
|
return;
|
|
509
509
|
e._store.validated = !0;
|
|
510
|
-
var
|
|
511
|
-
if (vr[
|
|
510
|
+
var c = Ur(o);
|
|
511
|
+
if (vr[c])
|
|
512
512
|
return;
|
|
513
|
-
vr[
|
|
513
|
+
vr[c] = !0;
|
|
514
514
|
var h = "";
|
|
515
|
-
e && e._owner && e._owner !==
|
|
515
|
+
e && e._owner && e._owner !== V.current && (h = " It was passed a child from " + S(e._owner.type) + "."), ne(e), w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', c, h), ne(null);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
function gr(e, o) {
|
|
519
519
|
{
|
|
520
520
|
if (typeof e != "object")
|
|
521
521
|
return;
|
|
522
|
-
if (
|
|
523
|
-
for (var
|
|
524
|
-
var h = e[
|
|
525
|
-
|
|
522
|
+
if (G(e))
|
|
523
|
+
for (var c = 0; c < e.length; c++) {
|
|
524
|
+
var h = e[c];
|
|
525
|
+
De(h) && xr(h, o);
|
|
526
526
|
}
|
|
527
|
-
else if (
|
|
527
|
+
else if (De(e))
|
|
528
528
|
e._store && (e._store.validated = !0);
|
|
529
529
|
else if (e) {
|
|
530
|
-
var
|
|
531
|
-
if (typeof
|
|
532
|
-
for (var O =
|
|
533
|
-
|
|
530
|
+
var F = _(e);
|
|
531
|
+
if (typeof F == "function" && F !== e.entries)
|
|
532
|
+
for (var O = F.call(e), C; !(C = O.next()).done; )
|
|
533
|
+
De(C.value) && xr(C.value, o);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
function
|
|
537
|
+
function Ir(e) {
|
|
538
538
|
{
|
|
539
539
|
var o = e.type;
|
|
540
540
|
if (o == null || typeof o == "string")
|
|
541
541
|
return;
|
|
542
|
-
var
|
|
542
|
+
var c;
|
|
543
543
|
if (typeof o == "function")
|
|
544
|
-
|
|
544
|
+
c = o.propTypes;
|
|
545
545
|
else if (typeof o == "object" && (o.$$typeof === m || // Note: Memo only checks outer props here.
|
|
546
546
|
// Inner props are checked in the reconciler.
|
|
547
547
|
o.$$typeof === b))
|
|
548
|
-
|
|
548
|
+
c = o.propTypes;
|
|
549
549
|
else
|
|
550
550
|
return;
|
|
551
|
-
if (
|
|
552
|
-
var h =
|
|
553
|
-
R(
|
|
554
|
-
} else if (o.PropTypes !== void 0 &&
|
|
555
|
-
|
|
556
|
-
var
|
|
557
|
-
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
551
|
+
if (c) {
|
|
552
|
+
var h = S(o);
|
|
553
|
+
R(c, e.props, "prop", h, e);
|
|
554
|
+
} else if (o.PropTypes !== void 0 && !Ne) {
|
|
555
|
+
Ne = !0;
|
|
556
|
+
var F = S(o);
|
|
557
|
+
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", F || "Unknown");
|
|
558
558
|
}
|
|
559
559
|
typeof o.getDefaultProps == "function" && !o.getDefaultProps.isReactClassApproved && w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
562
|
function Lr(e) {
|
|
563
563
|
{
|
|
564
|
-
for (var o = Object.keys(e.props),
|
|
565
|
-
var h = o[
|
|
564
|
+
for (var o = Object.keys(e.props), c = 0; c < o.length; c++) {
|
|
565
|
+
var h = o[c];
|
|
566
566
|
if (h !== "children" && h !== "key") {
|
|
567
|
-
|
|
567
|
+
ne(e), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), ne(null);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
e.ref !== null && (
|
|
571
|
+
e.ref !== null && (ne(e), w("Invalid attribute `ref` supplied to `React.Fragment`."), ne(null));
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
var br = {};
|
|
575
|
-
function wr(e, o,
|
|
575
|
+
function wr(e, o, c, h, F, O) {
|
|
576
576
|
{
|
|
577
|
-
var C =
|
|
577
|
+
var C = le(e);
|
|
578
578
|
if (!C) {
|
|
579
579
|
var E = "";
|
|
580
580
|
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (E += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
581
|
-
var
|
|
582
|
-
|
|
581
|
+
var se = Ar();
|
|
582
|
+
se ? E += se : E += yr();
|
|
583
583
|
var L;
|
|
584
|
-
e === null ? L = "null" :
|
|
584
|
+
e === null ? L = "null" : G(e) ? L = "array" : e !== void 0 && e.$$typeof === t ? (L = "<" + (S(e.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : L = typeof e, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", L, E);
|
|
585
585
|
}
|
|
586
|
-
var
|
|
587
|
-
if (
|
|
588
|
-
return
|
|
586
|
+
var K = X(e, o, c, F, O);
|
|
587
|
+
if (K == null)
|
|
588
|
+
return K;
|
|
589
589
|
if (C) {
|
|
590
590
|
var xe = o.children;
|
|
591
591
|
if (xe !== void 0)
|
|
592
592
|
if (h)
|
|
593
|
-
if (
|
|
594
|
-
for (var
|
|
595
|
-
gr(xe[
|
|
593
|
+
if (G(xe)) {
|
|
594
|
+
for (var Me = 0; Me < xe.length; Me++)
|
|
595
|
+
gr(xe[Me], e);
|
|
596
596
|
Object.freeze && Object.freeze(xe);
|
|
597
597
|
} else
|
|
598
598
|
w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
@@ -600,7 +600,7 @@ Check the top-level render call using <` + l + ">.");
|
|
|
600
600
|
gr(xe, e);
|
|
601
601
|
}
|
|
602
602
|
if (Ee.call(o, "key")) {
|
|
603
|
-
var We =
|
|
603
|
+
var We = S(e), ue = Object.keys(o).filter(function(qr) {
|
|
604
604
|
return qr !== "key";
|
|
605
605
|
}), or = ue.length > 0 ? "{key: someKey, " + ue.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
606
|
if (!br[We + or]) {
|
|
@@ -613,18 +613,18 @@ React keys must be passed directly to JSX without using spread:
|
|
|
613
613
|
<%s key={someKey} {...props} />`, or, We, Kr, We), br[We + or] = !0;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
return e === s ? Lr(
|
|
616
|
+
return e === s ? Lr(K) : Ir(K), K;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function zr(e, o,
|
|
620
|
-
return wr(e, o,
|
|
619
|
+
function zr(e, o, c) {
|
|
620
|
+
return wr(e, o, c, !0);
|
|
621
621
|
}
|
|
622
|
-
function Br(e, o,
|
|
623
|
-
return wr(e, o,
|
|
622
|
+
function Br(e, o, c) {
|
|
623
|
+
return wr(e, o, c, !1);
|
|
624
624
|
}
|
|
625
625
|
var Yr = Br, Vr = zr;
|
|
626
|
-
|
|
627
|
-
}()),
|
|
626
|
+
He.Fragment = s, He.jsx = Yr, He.jsxs = Vr;
|
|
627
|
+
}()), He;
|
|
628
628
|
}
|
|
629
629
|
process.env.NODE_ENV === "production" ? fr.exports = Zr() : fr.exports = Xr();
|
|
630
630
|
var a = fr.exports;
|
|
@@ -637,23 +637,23 @@ function Wr(r) {
|
|
|
637
637
|
} else for (n in r) r[n] && (s && (s += " "), s += n);
|
|
638
638
|
return s;
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function Q() {
|
|
641
641
|
for (var r, t, n = 0, s = "", i = arguments.length; n < i; n++) (r = arguments[n]) && (t = Wr(r)) && (s && (s += " "), s += t);
|
|
642
642
|
return s;
|
|
643
643
|
}
|
|
644
644
|
const Qr = "https://core.spreedly.com/iframe/iframe-v1.min.js", et = "https://cdn.e2e.movmo.io";
|
|
645
|
-
let
|
|
645
|
+
let Ae = {};
|
|
646
646
|
const At = (r) => {
|
|
647
|
-
|
|
647
|
+
Ae = { ...Ae, ...r };
|
|
648
648
|
}, lr = (r) => {
|
|
649
649
|
var n;
|
|
650
650
|
const t = globalThis.process;
|
|
651
651
|
return (n = t == null ? void 0 : t.env) == null ? void 0 : n[r];
|
|
652
|
-
},
|
|
653
|
-
baseUrl:
|
|
654
|
-
spreedlyScriptUrl:
|
|
655
|
-
iconCdnBaseUrl:
|
|
656
|
-
fetch:
|
|
652
|
+
}, Be = () => ({
|
|
653
|
+
baseUrl: Ae.baseUrl ?? lr("REACT_APP_MOVMO_API_URL") ?? "",
|
|
654
|
+
spreedlyScriptUrl: Ae.spreedlyScriptUrl ?? lr("REACT_APP_SPREEDLY_SCRIPT_URL") ?? Qr,
|
|
655
|
+
iconCdnBaseUrl: Ae.iconCdnBaseUrl ?? lr("REACT_APP_MOVMO_ICON_CDN_URL") ?? et,
|
|
656
|
+
fetch: Ae.fetch ?? (typeof globalThis < "u" && typeof globalThis.fetch == "function" ? globalThis.fetch.bind(globalThis) : (() => {
|
|
657
657
|
throw new Error("@movmo_app/payments: no fetch available");
|
|
658
658
|
})())
|
|
659
659
|
}), pr = (r) => ({
|
|
@@ -666,114 +666,115 @@ const At = (r) => {
|
|
|
666
666
|
vault: r.vault,
|
|
667
667
|
cardholderName: r.cardholderName,
|
|
668
668
|
zip: r.zip
|
|
669
|
-
}),
|
|
669
|
+
}), Ue = {
|
|
670
670
|
Accept: "application/json",
|
|
671
671
|
"Content-Type": "application/json"
|
|
672
672
|
}, Ie = (r) => {
|
|
673
|
-
const { baseUrl: t } =
|
|
673
|
+
const { baseUrl: t } = Be();
|
|
674
674
|
if (!t)
|
|
675
675
|
throw new Error(
|
|
676
676
|
"@movmo_app/payments: baseUrl is not configured. Call setPaymentsConfig({ baseUrl }) at app boot, or set REACT_APP_MOVMO_API_URL."
|
|
677
677
|
);
|
|
678
678
|
return `${t}${r}`;
|
|
679
|
-
},
|
|
680
|
-
const { fetch: n } =
|
|
679
|
+
}, Le = (r, t) => {
|
|
680
|
+
const { fetch: n } = Be();
|
|
681
681
|
return n(r, t);
|
|
682
|
-
},
|
|
682
|
+
}, ze = async (r, t) => {
|
|
683
683
|
try {
|
|
684
684
|
return (await r.json()).message || t;
|
|
685
685
|
} catch {
|
|
686
686
|
return t;
|
|
687
687
|
}
|
|
688
688
|
};
|
|
689
|
-
let
|
|
689
|
+
let Je = null;
|
|
690
690
|
const hr = () => {
|
|
691
|
-
if (
|
|
691
|
+
if (Je) return Je;
|
|
692
692
|
const r = (async () => {
|
|
693
|
-
const t = await
|
|
693
|
+
const t = await Le(Ie("/v1/payments/tokenization-session"), {
|
|
694
694
|
method: "GET",
|
|
695
|
-
headers:
|
|
695
|
+
headers: Ue,
|
|
696
696
|
credentials: "include"
|
|
697
697
|
});
|
|
698
698
|
if (!t.ok)
|
|
699
|
-
throw new Error(await
|
|
699
|
+
throw new Error(await ze(t, `Failed to fetch tokenization session (${t.status})`));
|
|
700
700
|
return await t.json();
|
|
701
701
|
})();
|
|
702
|
-
return
|
|
703
|
-
|
|
702
|
+
return Je = r, r.finally(() => {
|
|
703
|
+
Je === r && (Je = null);
|
|
704
704
|
}).catch(() => {
|
|
705
705
|
}), r;
|
|
706
706
|
}, rt = (r) => typeof r.brand == "string" && typeof r.last4 == "string" && typeof r.expMonth == "number" && typeof r.expYear == "number", tt = async (r, t, n) => {
|
|
707
|
-
const s = await
|
|
707
|
+
const s = await Le(
|
|
708
708
|
Ie(`/v1/users/${encodeURIComponent(r)}/payment-methods/from-token`),
|
|
709
709
|
{
|
|
710
710
|
method: "POST",
|
|
711
|
-
headers:
|
|
711
|
+
headers: Ue,
|
|
712
712
|
credentials: "include",
|
|
713
713
|
body: JSON.stringify({ tokenizedPaymentMethodId: t, isDefault: n })
|
|
714
714
|
}
|
|
715
715
|
);
|
|
716
716
|
if (!s.ok)
|
|
717
|
-
throw new Error(await
|
|
717
|
+
throw new Error(await ze(s, `Failed to save payment method (${s.status})`));
|
|
718
718
|
const i = await s.json();
|
|
719
719
|
if (rt(i))
|
|
720
720
|
return pr(i);
|
|
721
|
-
const
|
|
721
|
+
const l = await Le(
|
|
722
722
|
Ie(
|
|
723
723
|
`/v1/users/${encodeURIComponent(r)}/payment-methods/${encodeURIComponent(i.id)}`
|
|
724
724
|
),
|
|
725
725
|
{
|
|
726
726
|
method: "GET",
|
|
727
|
-
headers:
|
|
727
|
+
headers: Ue,
|
|
728
728
|
credentials: "include"
|
|
729
729
|
}
|
|
730
730
|
);
|
|
731
|
-
if (!
|
|
731
|
+
if (!l.ok)
|
|
732
732
|
throw new Error(
|
|
733
|
-
await
|
|
733
|
+
await ze(l, `Failed to fetch saved payment method (${l.status})`)
|
|
734
734
|
);
|
|
735
|
-
const u = await
|
|
735
|
+
const u = await l.json();
|
|
736
736
|
return pr(u);
|
|
737
737
|
}, at = async (r, t) => {
|
|
738
|
-
|
|
738
|
+
if (!r) return [];
|
|
739
|
+
const n = await Le(
|
|
739
740
|
Ie(`/v1/users/${encodeURIComponent(r)}/payment-methods`),
|
|
740
741
|
{
|
|
741
742
|
method: "GET",
|
|
742
|
-
headers:
|
|
743
|
+
headers: Ue,
|
|
743
744
|
credentials: "include",
|
|
744
745
|
signal: t
|
|
745
746
|
}
|
|
746
747
|
);
|
|
747
748
|
if (!n.ok)
|
|
748
|
-
throw new Error(await
|
|
749
|
+
throw new Error(await ze(n, `Failed to fetch payment methods (${n.status})`));
|
|
749
750
|
return (await n.json() ?? []).map(pr);
|
|
750
751
|
}, nt = async (r, t) => {
|
|
751
|
-
const n = await
|
|
752
|
+
const n = await Le(
|
|
752
753
|
Ie(
|
|
753
754
|
`/v1/users/${encodeURIComponent(r)}/payment-methods/${encodeURIComponent(t)}`
|
|
754
755
|
),
|
|
755
756
|
{
|
|
756
757
|
method: "DELETE",
|
|
757
|
-
headers:
|
|
758
|
+
headers: Ue,
|
|
758
759
|
credentials: "include"
|
|
759
760
|
}
|
|
760
761
|
);
|
|
761
762
|
if (!n.ok)
|
|
762
|
-
throw new Error(await
|
|
763
|
+
throw new Error(await ze(n, `Failed to delete payment method (${n.status})`));
|
|
763
764
|
}, Or = async (r, t, n) => {
|
|
764
|
-
const s = await
|
|
765
|
+
const s = await Le(
|
|
765
766
|
Ie(
|
|
766
767
|
`/v1/users/${encodeURIComponent(r)}/payment-methods/${encodeURIComponent(t)}`
|
|
767
768
|
),
|
|
768
769
|
{
|
|
769
770
|
method: "PUT",
|
|
770
|
-
headers:
|
|
771
|
+
headers: Ue,
|
|
771
772
|
credentials: "include",
|
|
772
773
|
body: JSON.stringify(n)
|
|
773
774
|
}
|
|
774
775
|
);
|
|
775
776
|
if (!s.ok)
|
|
776
|
-
throw new Error(await
|
|
777
|
+
throw new Error(await ze(s, `Failed to update payment method (${s.status})`));
|
|
777
778
|
}, st = {
|
|
778
779
|
visa: "visa",
|
|
779
780
|
master: "mastercard",
|
|
@@ -786,7 +787,7 @@ const hr = () => {
|
|
|
786
787
|
className: t,
|
|
787
788
|
width: n = 46
|
|
788
789
|
}) => {
|
|
789
|
-
const s = r ? st[r.toLowerCase()] ?? "credit-card" : "credit-card", i = Math.max(n, ot),
|
|
790
|
+
const s = r ? st[r.toLowerCase()] ?? "credit-card" : "credit-card", i = Math.max(n, ot), l = Math.round(i * 24 / 34), { iconCdnBaseUrl: u } = Be();
|
|
790
791
|
return /* @__PURE__ */ a.jsx(
|
|
791
792
|
"img",
|
|
792
793
|
{
|
|
@@ -795,21 +796,21 @@ const hr = () => {
|
|
|
795
796
|
"data-testid": `card-brand-${r.toLowerCase()}`,
|
|
796
797
|
className: t,
|
|
797
798
|
width: i,
|
|
798
|
-
height:
|
|
799
|
+
height: l,
|
|
799
800
|
loading: "lazy"
|
|
800
801
|
}
|
|
801
802
|
);
|
|
802
803
|
};
|
|
803
|
-
let
|
|
804
|
+
let Ze = null;
|
|
804
805
|
const it = () => {
|
|
805
806
|
if (typeof window > "u")
|
|
806
807
|
return Promise.reject(new Error("Spreedly can only be loaded in a browser environment."));
|
|
807
808
|
if (window.Spreedly)
|
|
808
809
|
return Promise.resolve(window.Spreedly);
|
|
809
|
-
if (
|
|
810
|
-
return
|
|
811
|
-
const { spreedlyScriptUrl: r } =
|
|
812
|
-
return
|
|
810
|
+
if (Ze)
|
|
811
|
+
return Ze;
|
|
812
|
+
const { spreedlyScriptUrl: r } = Be();
|
|
813
|
+
return Ze = new Promise((t, n) => {
|
|
813
814
|
const s = document.querySelector(
|
|
814
815
|
`script[src="${r}"]`
|
|
815
816
|
), i = () => {
|
|
@@ -829,15 +830,15 @@ const it = () => {
|
|
|
829
830
|
);
|
|
830
831
|
return;
|
|
831
832
|
}
|
|
832
|
-
const
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
}, document.head.appendChild(
|
|
833
|
+
const l = document.createElement("script");
|
|
834
|
+
l.src = r, l.async = !0, l.onload = i, l.onerror = () => {
|
|
835
|
+
l.remove(), n(new Error("Failed to load Spreedly iframe script."));
|
|
836
|
+
}, document.head.appendChild(l);
|
|
836
837
|
}).catch((t) => {
|
|
837
|
-
throw
|
|
838
|
-
}),
|
|
838
|
+
throw Ze = null, t;
|
|
839
|
+
}), Ze;
|
|
839
840
|
};
|
|
840
|
-
class
|
|
841
|
+
class tr extends Error {
|
|
841
842
|
constructor(n, s) {
|
|
842
843
|
super(s instanceof Error ? s.message : "Failed to initialize card form.");
|
|
843
844
|
ir(this, "source");
|
|
@@ -860,38 +861,38 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
860
861
|
cvvEl: n = ct,
|
|
861
862
|
onCardTokenized: s,
|
|
862
863
|
onFieldErrors: i,
|
|
863
|
-
onValidityChange:
|
|
864
|
+
onValidityChange: l,
|
|
864
865
|
onBrandChange: u
|
|
865
|
-
} = r, [x, m] = k("idle"), [
|
|
866
|
+
} = r, [x, m] = k("idle"), [P, y] = k(null), [b, f] = k(null), [j, W] = k(null), [ae, _] = k({ number: !1, cvv: !1 }), [T, w] = k(null), [oe, re] = k({ number: !1, cvv: !1 }), fe = I(null), ge = I(s), H = I(i), ie = I(l), v = I(u);
|
|
866
867
|
A(() => {
|
|
867
868
|
ge.current = s;
|
|
868
869
|
}, [s]), A(() => {
|
|
869
|
-
|
|
870
|
+
H.current = i;
|
|
870
871
|
}, [i]), A(() => {
|
|
871
|
-
|
|
872
|
-
}, [
|
|
872
|
+
ie.current = l;
|
|
873
|
+
}, [l]), A(() => {
|
|
873
874
|
v.current = u;
|
|
874
875
|
}, [u]);
|
|
875
|
-
const
|
|
876
|
+
const le = I({ number: !1, cvv: !1 });
|
|
876
877
|
A(() => {
|
|
877
|
-
let
|
|
878
|
-
return m("loading"), y(null), f(null), W(null), _({ number: !1, cvv: !1 }), w(null),
|
|
878
|
+
let S = !1;
|
|
879
|
+
return m("loading"), y(null), f(null), W(null), _({ number: !1, cvv: !1 }), w(null), le.current = { number: !1, cvv: !1 }, (async () => {
|
|
879
880
|
try {
|
|
880
881
|
const [g, p] = await Promise.all([
|
|
881
882
|
hr().catch((N) => {
|
|
882
|
-
throw new
|
|
883
|
+
throw new tr("tokenization-session", N);
|
|
883
884
|
}),
|
|
884
885
|
it().catch((N) => {
|
|
885
|
-
throw new
|
|
886
|
+
throw new tr("spreedly-script", N);
|
|
886
887
|
})
|
|
887
888
|
]);
|
|
888
|
-
if (
|
|
889
|
+
if (S) return;
|
|
889
890
|
fe.current = p, p.on("ready", () => {
|
|
890
|
-
var N,
|
|
891
|
-
if (!
|
|
891
|
+
var N, U, ee, pe, J, q;
|
|
892
|
+
if (!S) {
|
|
892
893
|
m("ready");
|
|
893
894
|
try {
|
|
894
|
-
(N = p.setFieldType) == null || N.call(p, "number", "tel"), (
|
|
895
|
+
(N = p.setFieldType) == null || N.call(p, "number", "tel"), (U = p.setFieldType) == null || U.call(p, "cvv", "tel");
|
|
895
896
|
} catch (B) {
|
|
896
897
|
console.warn("@movmo_app/payments: setFieldType failed", B);
|
|
897
898
|
}
|
|
@@ -903,55 +904,55 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
903
904
|
console.warn("@movmo_app/payments: setNumberFormat failed", B);
|
|
904
905
|
}
|
|
905
906
|
try {
|
|
906
|
-
(
|
|
907
|
+
(ee = p.setPlaceholder) == null || ee.call(p, "number", "Card number"), (pe = p.setPlaceholder) == null || pe.call(p, "cvv", "CVV");
|
|
907
908
|
const B = 'box-sizing: border-box;width: 100%;height: 100%;margin: 0;padding: 0;border: 0;background: transparent;outline: none;font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;font-size: 14px;font-weight: 400;line-height: 20px;color: rgb(28 25 23);letter-spacing: 0;vertical-align: middle;';
|
|
908
|
-
(
|
|
909
|
+
(J = p.setStyle) == null || J.call(p, "number", B), (q = p.setStyle) == null || q.call(p, "cvv", B);
|
|
909
910
|
} catch (B) {
|
|
910
911
|
console.warn("@movmo_app/payments: setPlaceholder/setStyle failed", B);
|
|
911
912
|
}
|
|
912
913
|
}
|
|
913
914
|
}), p.on("paymentMethod", (N) => {
|
|
914
|
-
var
|
|
915
|
-
(
|
|
915
|
+
var U;
|
|
916
|
+
(U = ge.current) == null || U.call(ge, N);
|
|
916
917
|
}), p.on("errors", (N) => {
|
|
917
|
-
var
|
|
918
|
-
(
|
|
919
|
-
}), p.on("fieldEvent", (N,
|
|
918
|
+
var U;
|
|
919
|
+
(U = H.current) == null || U.call(H, N);
|
|
920
|
+
}), p.on("fieldEvent", (N, U, ee, pe) => {
|
|
920
921
|
var B;
|
|
921
|
-
if (
|
|
922
|
-
if (
|
|
923
|
-
|
|
922
|
+
if (S) return;
|
|
923
|
+
if (U === "focus") {
|
|
924
|
+
re(($) => $[N] ? $ : { ...$, [N]: !0 });
|
|
924
925
|
return;
|
|
925
926
|
}
|
|
926
|
-
if (
|
|
927
|
-
|
|
927
|
+
if (U === "blur") {
|
|
928
|
+
re(($) => $[N] ? { ...$, [N]: !1 } : $);
|
|
928
929
|
return;
|
|
929
930
|
}
|
|
930
|
-
if (
|
|
931
|
-
const
|
|
931
|
+
if (U !== "input") return;
|
|
932
|
+
const J = pe ?? {};
|
|
932
933
|
if (N === "number") {
|
|
933
|
-
if (
|
|
934
|
+
if (J.numberLength === 0)
|
|
934
935
|
w(($) => {
|
|
935
936
|
var Y;
|
|
936
937
|
return $ !== null && ((Y = v.current) == null || Y.call(v, null)), null;
|
|
937
938
|
});
|
|
938
|
-
else if (
|
|
939
|
-
const $ =
|
|
939
|
+
else if (J.cardType !== void 0) {
|
|
940
|
+
const $ = J.cardType || null;
|
|
940
941
|
w((Y) => {
|
|
941
942
|
var he;
|
|
942
943
|
return Y !== $ && ((he = v.current) == null || he.call(v, $)), $;
|
|
943
944
|
});
|
|
944
945
|
}
|
|
945
946
|
}
|
|
946
|
-
const
|
|
947
|
-
if (typeof
|
|
948
|
-
const $ =
|
|
949
|
-
(Y.number !== $.number || Y.cvv !== $.cvv) && (
|
|
947
|
+
const q = N === "number" ? typeof J.validNumber == "boolean" ? J.validNumber : void 0 : typeof J.validCvv == "boolean" ? J.validCvv : void 0;
|
|
948
|
+
if (typeof q == "boolean") {
|
|
949
|
+
const $ = le.current, Y = N === "number" ? { ...$, number: q } : { ...$, cvv: q };
|
|
950
|
+
(Y.number !== $.number || Y.cvv !== $.cvv) && (le.current = Y, _(Y), (B = ie.current) == null || B.call(ie, Y));
|
|
950
951
|
}
|
|
951
952
|
}), p.on("consoleError", (N) => {
|
|
952
|
-
var
|
|
953
|
-
const
|
|
954
|
-
(
|
|
953
|
+
var ee;
|
|
954
|
+
const U = N instanceof Error ? N.message : "An unexpected error occurred while securing your card.";
|
|
955
|
+
(ee = H.current) == null || ee.call(H, [{ message: U }]);
|
|
955
956
|
}), p.init(g.environmentKey, {
|
|
956
957
|
numberEl: t,
|
|
957
958
|
cvvEl: n,
|
|
@@ -961,13 +962,13 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
961
962
|
signature: g.signature
|
|
962
963
|
});
|
|
963
964
|
} catch (g) {
|
|
964
|
-
if (
|
|
965
|
+
if (S) return;
|
|
965
966
|
const p = g instanceof Error ? g.message : "Failed to initialize card form.";
|
|
966
|
-
y(p), f(g instanceof
|
|
967
|
+
y(p), f(g instanceof tr ? g.source : "spreedly-script"), W(g instanceof tr ? g.cause : g), m("error");
|
|
967
968
|
}
|
|
968
969
|
})(), () => {
|
|
969
970
|
var g, p;
|
|
970
|
-
|
|
971
|
+
S = !0;
|
|
971
972
|
try {
|
|
972
973
|
(p = (g = fe.current) == null ? void 0 : g.removeHandlers) == null || p.call(g);
|
|
973
974
|
} catch (N) {
|
|
@@ -976,14 +977,14 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
976
977
|
fe.current = null;
|
|
977
978
|
};
|
|
978
979
|
}, [t, n]);
|
|
979
|
-
const Re = z((
|
|
980
|
+
const Re = z((S) => {
|
|
980
981
|
var g;
|
|
981
|
-
(g = fe.current) == null || g.tokenizeCreditCard(dt(
|
|
982
|
-
}, []), be = z((
|
|
982
|
+
(g = fe.current) == null || g.tokenizeCreditCard(dt(S));
|
|
983
|
+
}, []), be = z((S) => {
|
|
983
984
|
var g, p;
|
|
984
|
-
(p = (g = fe.current) == null ? void 0 : g.transferFocus) == null || p.call(g,
|
|
985
|
+
(p = (g = fe.current) == null ? void 0 : g.transferFocus) == null || p.call(g, S);
|
|
985
986
|
}, []);
|
|
986
|
-
return { status: x, error:
|
|
987
|
+
return { status: x, error: P, errorSource: b, errorCause: j, tokenize: Re, validity: ae, brand: T, focused: oe, focusField: be };
|
|
987
988
|
}, cr = "h-11 w-full rounded-md border border-grayWarm-300 bg-white px-3 py-2 text-sm text-grayWarm-900 placeholder:text-grayWarm-400 outline-none focus:border-grayWarm-950 focus:shadow-[0_0_0_1px_#1c1917]", _r = "flex h-11 w-full items-center gap-2 rounded-md border bg-white px-3 py-2 transition-shadow", Nr = "border-grayWarm-950 shadow-[0_0_0_1px_#1c1917]", Cr = "border-grayWarm-300", mt = (r) => {
|
|
988
989
|
const t = r.trim();
|
|
989
990
|
if (!t) return { firstName: "", lastName: "" };
|
|
@@ -1005,8 +1006,8 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1005
1006
|
if (!t || !n) return !1;
|
|
1006
1007
|
const s = parseInt(t, 10), i = parseInt(n, 10);
|
|
1007
1008
|
if (isNaN(s) || s < 1 || s > 12) return !1;
|
|
1008
|
-
const
|
|
1009
|
-
return !(i <
|
|
1009
|
+
const l = /* @__PURE__ */ new Date();
|
|
1010
|
+
return !(i < l.getFullYear() || i > l.getFullYear() + 20 || i === l.getFullYear() && s < l.getMonth() + 1);
|
|
1010
1011
|
}, ur = (r) => /^\d{5}(-\d{4})?$/.test(r.trim()), pt = (r) => {
|
|
1011
1012
|
const t = r.replace(/[^\d]/g, "").slice(0, 9);
|
|
1012
1013
|
return t.length <= 5 ? t : `${t.slice(0, 5)}-${t.slice(5)}`;
|
|
@@ -1016,99 +1017,99 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1016
1017
|
onError: n,
|
|
1017
1018
|
onErrorDetail: s,
|
|
1018
1019
|
isDefault: i = !1,
|
|
1019
|
-
className:
|
|
1020
|
+
className: l,
|
|
1020
1021
|
defaultCardholderName: u,
|
|
1021
1022
|
defaultCardholderFirstName: x = "",
|
|
1022
1023
|
defaultCardholderLastName: m = "",
|
|
1023
|
-
autoSave:
|
|
1024
|
+
autoSave: P = !1,
|
|
1024
1025
|
formId: y = "movmo-card-form",
|
|
1025
1026
|
hideInternalSaveButton: b = !1,
|
|
1026
1027
|
onCanSubmitChange: f,
|
|
1027
1028
|
onSavingChange: j,
|
|
1028
1029
|
autoFocus: W
|
|
1029
1030
|
}) => {
|
|
1030
|
-
const ae = u ?? [x, m].filter(Boolean).join(" "), [_,
|
|
1031
|
+
const ae = u ?? [x, m].filter(Boolean).join(" "), [_, T] = k(ae), [w, oe] = k(""), [re, fe] = k(""), [ge, H] = k("idle"), ie = I(!1), v = I(s);
|
|
1031
1032
|
A(() => {
|
|
1032
1033
|
v.current = s;
|
|
1033
1034
|
}, [s]);
|
|
1034
|
-
const
|
|
1035
|
+
const le = z(
|
|
1035
1036
|
async (R) => {
|
|
1036
|
-
var
|
|
1037
|
-
|
|
1037
|
+
var D;
|
|
1038
|
+
H("saving");
|
|
1038
1039
|
try {
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
} catch (
|
|
1042
|
-
const
|
|
1043
|
-
|
|
1040
|
+
const G = await tt(r, R, i);
|
|
1041
|
+
H("ready"), t(G);
|
|
1042
|
+
} catch (G) {
|
|
1043
|
+
const de = G instanceof Error ? G.message : "Failed to save payment method.";
|
|
1044
|
+
H("ready"), ie.current = !1, n(de), (D = v.current) == null || D.call(v, { source: "save-from-token", message: de, cause: G });
|
|
1044
1045
|
}
|
|
1045
1046
|
},
|
|
1046
1047
|
[r, i, t, n]
|
|
1047
1048
|
), Re = z(
|
|
1048
1049
|
(R) => {
|
|
1049
|
-
var
|
|
1050
|
-
const
|
|
1051
|
-
|
|
1050
|
+
var G;
|
|
1051
|
+
const D = R.map((de) => de.message).filter(Boolean).join("; ") || "Card validation failed.";
|
|
1052
|
+
H((de) => de === "tokenizing" ? "ready" : de), ie.current = !1, n(D), (G = v.current) == null || G.call(v, { source: "card-tokenize", message: D });
|
|
1052
1053
|
},
|
|
1053
1054
|
[n]
|
|
1054
|
-
), be =
|
|
1055
|
+
), be = Xe(
|
|
1055
1056
|
() => ({
|
|
1056
|
-
onCardTokenized:
|
|
1057
|
+
onCardTokenized: le,
|
|
1057
1058
|
onFieldErrors: Re
|
|
1058
1059
|
}),
|
|
1059
|
-
[
|
|
1060
|
+
[le, Re]
|
|
1060
1061
|
), {
|
|
1061
|
-
status:
|
|
1062
|
+
status: S,
|
|
1062
1063
|
error: g,
|
|
1063
1064
|
errorSource: p,
|
|
1064
1065
|
errorCause: N,
|
|
1065
|
-
tokenize:
|
|
1066
|
-
validity:
|
|
1066
|
+
tokenize: U,
|
|
1067
|
+
validity: ee,
|
|
1067
1068
|
brand: pe,
|
|
1068
|
-
focused:
|
|
1069
|
-
focusField:
|
|
1070
|
-
} = ut(be), B =
|
|
1069
|
+
focused: J,
|
|
1070
|
+
focusField: q
|
|
1071
|
+
} = ut(be), B = I(!1);
|
|
1071
1072
|
A(() => {
|
|
1072
|
-
!W ||
|
|
1073
|
-
}, [W,
|
|
1074
|
-
const $ = _.trim().split(/\s+/).length >= 2, Y = dr(w), he = ur(
|
|
1073
|
+
!W || S !== "ready" || B.current || (B.current = !0, q(W));
|
|
1074
|
+
}, [W, S, q]);
|
|
1075
|
+
const $ = _.trim().split(/\s+/).length >= 2, Y = dr(w), he = ur(re), me = I(!1), te = I(!1), Ce = I(!1), Pe = I(null), ye = I(null);
|
|
1075
1076
|
A(() => {
|
|
1076
1077
|
var R;
|
|
1077
|
-
|
|
1078
|
-
}, [
|
|
1079
|
-
const
|
|
1078
|
+
ee.cvv ? te.current || (te.current = !0, (R = Pe.current) == null || R.focus()) : te.current = !1;
|
|
1079
|
+
}, [ee.cvv]);
|
|
1080
|
+
const ce = !$ || !Y || !he || !ee.number || !ee.cvv, we = ge === "tokenizing" || ge === "saving", je = S === "ready" && !we && !ce, ke = I(f);
|
|
1080
1081
|
A(() => {
|
|
1081
1082
|
ke.current = f;
|
|
1082
1083
|
}, [f]), A(() => {
|
|
1083
1084
|
var R;
|
|
1084
1085
|
(R = ke.current) == null || R.call(ke, je);
|
|
1085
1086
|
}, [je]);
|
|
1086
|
-
const
|
|
1087
|
+
const Z = I(j);
|
|
1087
1088
|
A(() => {
|
|
1088
|
-
|
|
1089
|
+
Z.current = j;
|
|
1089
1090
|
}, [j]), A(() => {
|
|
1090
1091
|
var R;
|
|
1091
|
-
(R =
|
|
1092
|
+
(R = Z.current) == null || R.call(Z, we);
|
|
1092
1093
|
}, [we]);
|
|
1093
1094
|
const Ee = z(() => {
|
|
1094
|
-
const { firstName: R, lastName:
|
|
1095
|
-
|
|
1096
|
-
}, [_, w,
|
|
1095
|
+
const { firstName: R, lastName: D } = mt(_), { month: G, year: de } = $r(w);
|
|
1096
|
+
H("tokenizing"), U({ firstName: R, lastName: D, month: G, year: de, zip: re.trim() });
|
|
1097
|
+
}, [_, w, re, U]);
|
|
1097
1098
|
A(() => {
|
|
1098
|
-
if (!
|
|
1099
|
+
if (!P || !je || ie.current) return;
|
|
1099
1100
|
const R = setTimeout(() => {
|
|
1100
|
-
|
|
1101
|
+
ie.current = !0, Ee();
|
|
1101
1102
|
}, 1200);
|
|
1102
1103
|
return () => clearTimeout(R);
|
|
1103
|
-
}, [
|
|
1104
|
+
}, [P, je, Ee]);
|
|
1104
1105
|
const Te = (R) => {
|
|
1105
1106
|
R.preventDefault(), je && Ee();
|
|
1106
|
-
}, ve =
|
|
1107
|
+
}, ve = S !== "ready" || we, _e = I(n);
|
|
1107
1108
|
return A(() => {
|
|
1108
1109
|
_e.current = n;
|
|
1109
1110
|
}, [n]), A(() => {
|
|
1110
|
-
var R,
|
|
1111
|
-
g && ((R = _e.current) == null || R.call(_e, g), (
|
|
1111
|
+
var R, D;
|
|
1112
|
+
g && ((R = _e.current) == null || R.call(_e, g), (D = v.current) == null || D.call(v, {
|
|
1112
1113
|
source: p ?? "spreedly-script",
|
|
1113
1114
|
message: g,
|
|
1114
1115
|
cause: N
|
|
@@ -1118,7 +1119,7 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1118
1119
|
{
|
|
1119
1120
|
id: y,
|
|
1120
1121
|
onSubmit: Te,
|
|
1121
|
-
className:
|
|
1122
|
+
className: Q("flex w-full flex-col gap-3", l),
|
|
1122
1123
|
"data-testid": "movmo-card-form",
|
|
1123
1124
|
children: [
|
|
1124
1125
|
/* @__PURE__ */ a.jsxs("div", { children: [
|
|
@@ -1126,9 +1127,9 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1126
1127
|
/* @__PURE__ */ a.jsxs(
|
|
1127
1128
|
"div",
|
|
1128
1129
|
{
|
|
1129
|
-
className:
|
|
1130
|
+
className: Q(
|
|
1130
1131
|
_r,
|
|
1131
|
-
|
|
1132
|
+
J.number ? Nr : Cr
|
|
1132
1133
|
),
|
|
1133
1134
|
children: [
|
|
1134
1135
|
/* @__PURE__ */ a.jsx(Se, { brand: pe ?? "", width: 32, className: "flex-shrink-0" }),
|
|
@@ -1138,12 +1139,12 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1138
1139
|
{
|
|
1139
1140
|
id: "movmo-card-number",
|
|
1140
1141
|
"aria-labelledby": "movmo-card-number-label",
|
|
1141
|
-
"aria-busy":
|
|
1142
|
+
"aria-busy": S !== "ready",
|
|
1142
1143
|
className: "absolute inset-0",
|
|
1143
1144
|
"data-testid": "movmo-card-number-mount"
|
|
1144
1145
|
}
|
|
1145
1146
|
),
|
|
1146
|
-
|
|
1147
|
+
S !== "ready" ? /* @__PURE__ */ a.jsx(
|
|
1147
1148
|
"div",
|
|
1148
1149
|
{
|
|
1149
1150
|
"aria-hidden": "true",
|
|
@@ -1168,10 +1169,10 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1168
1169
|
placeholder: "MM / YY",
|
|
1169
1170
|
value: w,
|
|
1170
1171
|
onChange: (R) => {
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1172
|
+
const D = ft(R.target.value);
|
|
1173
|
+
oe(D), dr(D) && !me.current ? (me.current = !0, q("cvv")) : dr(D) || (me.current = !1);
|
|
1173
1174
|
},
|
|
1174
|
-
className:
|
|
1175
|
+
className: Q(cr, w && !Y && "border-error-500"),
|
|
1175
1176
|
disabled: ve,
|
|
1176
1177
|
required: !0,
|
|
1177
1178
|
"data-testid": "movmo-card-expiry-input"
|
|
@@ -1183,9 +1184,9 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1183
1184
|
/* @__PURE__ */ a.jsxs(
|
|
1184
1185
|
"div",
|
|
1185
1186
|
{
|
|
1186
|
-
className:
|
|
1187
|
+
className: Q(
|
|
1187
1188
|
_r,
|
|
1188
|
-
|
|
1189
|
+
J.cvv ? Nr : Cr
|
|
1189
1190
|
),
|
|
1190
1191
|
children: [
|
|
1191
1192
|
/* @__PURE__ */ a.jsxs("div", { className: "relative h-full flex-1", children: [
|
|
@@ -1194,12 +1195,12 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1194
1195
|
{
|
|
1195
1196
|
id: "movmo-card-cvv",
|
|
1196
1197
|
"aria-labelledby": "movmo-card-cvv-label",
|
|
1197
|
-
"aria-busy":
|
|
1198
|
+
"aria-busy": S !== "ready",
|
|
1198
1199
|
className: "absolute inset-0",
|
|
1199
1200
|
"data-testid": "movmo-card-cvv-mount"
|
|
1200
1201
|
}
|
|
1201
1202
|
),
|
|
1202
|
-
|
|
1203
|
+
S !== "ready" ? /* @__PURE__ */ a.jsx(
|
|
1203
1204
|
"div",
|
|
1204
1205
|
{
|
|
1205
1206
|
"aria-hidden": "true",
|
|
@@ -1234,13 +1235,13 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1234
1235
|
inputMode: "numeric",
|
|
1235
1236
|
autoComplete: "postal-code",
|
|
1236
1237
|
placeholder: "ZIP code",
|
|
1237
|
-
value:
|
|
1238
|
+
value: re,
|
|
1238
1239
|
onChange: (R) => {
|
|
1239
|
-
var
|
|
1240
|
-
const
|
|
1241
|
-
fe(
|
|
1240
|
+
var G;
|
|
1241
|
+
const D = pt(R.target.value);
|
|
1242
|
+
fe(D), ur(D) && !Ce.current ? (Ce.current = !0, (G = ye.current) == null || G.focus()) : ur(D) || (Ce.current = !1);
|
|
1242
1243
|
},
|
|
1243
|
-
className:
|
|
1244
|
+
className: Q(cr, re && !he && "border-error-500"),
|
|
1244
1245
|
disabled: ve,
|
|
1245
1246
|
required: !0,
|
|
1246
1247
|
"data-testid": "movmo-card-zip-input"
|
|
@@ -1259,7 +1260,7 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1259
1260
|
autoComplete: "cc-name",
|
|
1260
1261
|
placeholder: "Cardholder name",
|
|
1261
1262
|
value: _,
|
|
1262
|
-
onChange: (R) =>
|
|
1263
|
+
onChange: (R) => T(R.target.value),
|
|
1263
1264
|
className: cr,
|
|
1264
1265
|
disabled: ve,
|
|
1265
1266
|
required: !0,
|
|
@@ -1267,19 +1268,19 @@ const lt = "movmo-card-number", ct = "movmo-card-cvv", dt = (r) => ({
|
|
|
1267
1268
|
}
|
|
1268
1269
|
)
|
|
1269
1270
|
] }),
|
|
1270
|
-
!
|
|
1271
|
+
!P && !b ? /* @__PURE__ */ a.jsx(
|
|
1271
1272
|
"button",
|
|
1272
1273
|
{
|
|
1273
1274
|
type: "submit",
|
|
1274
1275
|
disabled: !je,
|
|
1275
|
-
className:
|
|
1276
|
+
className: Q(
|
|
1276
1277
|
"inline-flex h-11 items-center justify-center rounded-md bg-brand-500 px-4 text-sm font-semibold text-white transition-colors hover:bg-brand-600",
|
|
1277
1278
|
"disabled:cursor-not-allowed disabled:bg-grayWarm-300 disabled:text-grayWarm-500"
|
|
1278
1279
|
),
|
|
1279
1280
|
"data-testid": "movmo-card-save",
|
|
1280
|
-
children: we ? "Saving…" :
|
|
1281
|
+
children: we ? "Saving…" : S === "loading" ? "Loading…" : "Save card"
|
|
1281
1282
|
}
|
|
1282
|
-
) : we &&
|
|
1283
|
+
) : we && P ? (
|
|
1283
1284
|
// In autoSave mode (empty-state inline form, no Save button at all),
|
|
1284
1285
|
// surface the in-flight state as inline text. The modal flow uses a
|
|
1285
1286
|
// spinner inside the modal-footer Save button instead — see
|
|
@@ -1335,19 +1336,22 @@ const ht = (r) => {
|
|
|
1335
1336
|
try {
|
|
1336
1337
|
await Or(r, u, x), n("idle");
|
|
1337
1338
|
} catch (m) {
|
|
1338
|
-
const
|
|
1339
|
-
throw i(
|
|
1339
|
+
const P = m instanceof Error ? m.message : "Failed to update payment method.";
|
|
1340
|
+
throw i(P), n("error"), m;
|
|
1340
1341
|
}
|
|
1341
1342
|
},
|
|
1342
1343
|
[r]
|
|
1343
1344
|
), status: t, error: s };
|
|
1344
1345
|
}, xt = (r) => {
|
|
1345
|
-
const [t, n] = k([]), [s, i] = k("idle"), [
|
|
1346
|
+
const [t, n] = k([]), [s, i] = k("idle"), [l, u] = k(null), [x, m] = k(0), P = I(null);
|
|
1346
1347
|
A(() => {
|
|
1347
1348
|
var f;
|
|
1348
|
-
(f =
|
|
1349
|
+
if ((f = P.current) == null || f.abort(), !r) {
|
|
1350
|
+
P.current = null, n([]), u(null), i("ready");
|
|
1351
|
+
return;
|
|
1352
|
+
}
|
|
1349
1353
|
const b = new AbortController();
|
|
1350
|
-
return
|
|
1354
|
+
return P.current = b, i("loading"), u(null), at(r, b.signal).then((j) => {
|
|
1351
1355
|
b.signal.aborted || (n(j), i("ready"));
|
|
1352
1356
|
}).catch((j) => {
|
|
1353
1357
|
if (b.signal.aborted || j instanceof DOMException && j.name === "AbortError") return;
|
|
@@ -1360,18 +1364,18 @@ const ht = (r) => {
|
|
|
1360
1364
|
const y = z(() => {
|
|
1361
1365
|
m((b) => b + 1);
|
|
1362
1366
|
}, []);
|
|
1363
|
-
return { items: t, status: s, error:
|
|
1367
|
+
return { items: t, status: s, error: l, refetch: y };
|
|
1364
1368
|
}, Mr = ({
|
|
1365
1369
|
open: r,
|
|
1366
1370
|
onClose: t,
|
|
1367
1371
|
title: n,
|
|
1368
1372
|
titleId: s,
|
|
1369
1373
|
formId: i,
|
|
1370
|
-
saveDisabled:
|
|
1374
|
+
saveDisabled: l,
|
|
1371
1375
|
saveLabel: u = "Save",
|
|
1372
1376
|
isSaving: x = !1,
|
|
1373
1377
|
testIdPrefix: m = "payment-method",
|
|
1374
|
-
children:
|
|
1378
|
+
children: P
|
|
1375
1379
|
}) => (A(() => {
|
|
1376
1380
|
if (!r) return;
|
|
1377
1381
|
const y = (b) => {
|
|
@@ -1420,7 +1424,7 @@ const ht = (r) => {
|
|
|
1420
1424
|
/* @__PURE__ */ a.jsx("h2", { id: s, className: "flex-1 text-center text-base font-semibold text-grayWarm-900", children: n }),
|
|
1421
1425
|
/* @__PURE__ */ a.jsx("span", { "aria-hidden": "true", className: "h-9 w-9 flex-shrink-0" })
|
|
1422
1426
|
] }),
|
|
1423
|
-
/* @__PURE__ */ a.jsx("div", { className: "flex-1 overflow-y-auto p-4", children:
|
|
1427
|
+
/* @__PURE__ */ a.jsx("div", { className: "flex-1 overflow-y-auto p-4", children: P }),
|
|
1424
1428
|
/* @__PURE__ */ a.jsxs("div", { className: "flex gap-3 border-t border-grayWarm-200 p-4", children: [
|
|
1425
1429
|
/* @__PURE__ */ a.jsx(
|
|
1426
1430
|
"button",
|
|
@@ -1437,10 +1441,10 @@ const ht = (r) => {
|
|
|
1437
1441
|
{
|
|
1438
1442
|
type: "submit",
|
|
1439
1443
|
form: i,
|
|
1440
|
-
disabled: x ? !1 :
|
|
1441
|
-
"aria-disabled": x ||
|
|
1444
|
+
disabled: x ? !1 : l,
|
|
1445
|
+
"aria-disabled": x || l,
|
|
1442
1446
|
"aria-busy": x,
|
|
1443
|
-
className:
|
|
1447
|
+
className: Q(
|
|
1444
1448
|
"inline-flex h-11 flex-1 items-center justify-center rounded-lg bg-brand-500 px-4 text-sm font-semibold text-white transition-colors",
|
|
1445
1449
|
x ? "cursor-not-allowed opacity-90 pointer-events-none" : "hover:bg-brand-600 disabled:cursor-not-allowed disabled:bg-grayWarm-300 disabled:text-grayWarm-500"
|
|
1446
1450
|
),
|
|
@@ -1490,7 +1494,7 @@ const ht = (r) => {
|
|
|
1490
1494
|
formId: n,
|
|
1491
1495
|
saveDisabled: s,
|
|
1492
1496
|
saveLabel: i = "Save",
|
|
1493
|
-
isSaving:
|
|
1497
|
+
isSaving: l = !1,
|
|
1494
1498
|
children: u
|
|
1495
1499
|
}) => /* @__PURE__ */ a.jsx(
|
|
1496
1500
|
Mr,
|
|
@@ -1502,7 +1506,7 @@ const ht = (r) => {
|
|
|
1502
1506
|
formId: n,
|
|
1503
1507
|
saveDisabled: s,
|
|
1504
1508
|
saveLabel: i,
|
|
1505
|
-
isSaving:
|
|
1509
|
+
isSaving: l,
|
|
1506
1510
|
testIdPrefix: "add-payment-method",
|
|
1507
1511
|
children: u
|
|
1508
1512
|
}
|
|
@@ -1516,16 +1520,16 @@ const ht = (r) => {
|
|
|
1516
1520
|
onClose: n,
|
|
1517
1521
|
onSave: s,
|
|
1518
1522
|
isSaving: i = !1,
|
|
1519
|
-
error:
|
|
1523
|
+
error: l = null
|
|
1520
1524
|
}) => {
|
|
1521
|
-
const u = Jr(), [x, m] = k(""), [
|
|
1525
|
+
const u = Jr(), [x, m] = k(""), [P, y] = k("");
|
|
1522
1526
|
if (A(() => {
|
|
1523
1527
|
r && t && (m(t.cardholderName ?? ""), y(t.zip ?? ""));
|
|
1524
1528
|
}, [r, t]), !t) return null;
|
|
1525
|
-
const b = x.trim(), f =
|
|
1526
|
-
if (
|
|
1527
|
-
const
|
|
1528
|
-
j && (
|
|
1529
|
+
const b = x.trim(), f = P.trim(), j = b !== (t.cardholderName ?? "").trim(), W = f !== (t.zip ?? "").trim(), ae = j || W, _ = (!j || b.length > 0) && (!W || /^[A-Za-z0-9 -]{3,20}$/.test(f)), T = !ae || !_, w = (oe) => {
|
|
1530
|
+
if (oe.preventDefault(), T || i) return;
|
|
1531
|
+
const re = {};
|
|
1532
|
+
j && (re.cardholderName = b), W && (re.zip = f), s(re).catch(() => {
|
|
1529
1533
|
});
|
|
1530
1534
|
};
|
|
1531
1535
|
return /* @__PURE__ */ a.jsxs(
|
|
@@ -1536,7 +1540,7 @@ const ht = (r) => {
|
|
|
1536
1540
|
title: "Edit payment method",
|
|
1537
1541
|
titleId: "movmo-edit-payment-title",
|
|
1538
1542
|
formId: u,
|
|
1539
|
-
saveDisabled:
|
|
1543
|
+
saveDisabled: T,
|
|
1540
1544
|
isSaving: i,
|
|
1541
1545
|
testIdPrefix: "edit-payment-method",
|
|
1542
1546
|
children: [
|
|
@@ -1570,7 +1574,7 @@ const ht = (r) => {
|
|
|
1570
1574
|
type: "text",
|
|
1571
1575
|
autoComplete: "cc-name",
|
|
1572
1576
|
value: x,
|
|
1573
|
-
onChange: (
|
|
1577
|
+
onChange: (oe) => m(oe.target.value),
|
|
1574
1578
|
disabled: i,
|
|
1575
1579
|
maxLength: 255,
|
|
1576
1580
|
"data-testid": "edit-payment-method-cardholder",
|
|
@@ -1586,8 +1590,8 @@ const ht = (r) => {
|
|
|
1586
1590
|
type: "text",
|
|
1587
1591
|
inputMode: "numeric",
|
|
1588
1592
|
autoComplete: "postal-code",
|
|
1589
|
-
value:
|
|
1590
|
-
onChange: (
|
|
1593
|
+
value: P,
|
|
1594
|
+
onChange: (oe) => y(oe.target.value),
|
|
1591
1595
|
disabled: i,
|
|
1592
1596
|
maxLength: 20,
|
|
1593
1597
|
"data-testid": "edit-payment-method-zip",
|
|
@@ -1595,13 +1599,13 @@ const ht = (r) => {
|
|
|
1595
1599
|
}
|
|
1596
1600
|
)
|
|
1597
1601
|
] }),
|
|
1598
|
-
|
|
1602
|
+
l ? /* @__PURE__ */ a.jsx(
|
|
1599
1603
|
"p",
|
|
1600
1604
|
{
|
|
1601
1605
|
role: "alert",
|
|
1602
1606
|
className: "text-sm text-error-700",
|
|
1603
1607
|
"data-testid": "edit-payment-method-error",
|
|
1604
|
-
children:
|
|
1608
|
+
children: l
|
|
1605
1609
|
}
|
|
1606
1610
|
) : null
|
|
1607
1611
|
] })
|
|
@@ -1621,12 +1625,12 @@ const ht = (r) => {
|
|
|
1621
1625
|
}) => /* @__PURE__ */ a.jsxs(
|
|
1622
1626
|
"div",
|
|
1623
1627
|
{
|
|
1624
|
-
className:
|
|
1628
|
+
className: Q("flex items-center gap-3", n && "cursor-pointer", i),
|
|
1625
1629
|
onClick: n,
|
|
1626
1630
|
role: n ? "button" : void 0,
|
|
1627
1631
|
tabIndex: n ? 0 : void 0,
|
|
1628
|
-
onKeyDown: n ? (
|
|
1629
|
-
(
|
|
1632
|
+
onKeyDown: n ? (l) => {
|
|
1633
|
+
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), n());
|
|
1630
1634
|
} : void 0,
|
|
1631
1635
|
"data-testid": `payment-method-preview-${r.id}`,
|
|
1632
1636
|
children: [
|
|
@@ -1645,19 +1649,19 @@ const ht = (r) => {
|
|
|
1645
1649
|
selected: n,
|
|
1646
1650
|
onSelect: s,
|
|
1647
1651
|
onSetDefault: i,
|
|
1648
|
-
onRemove:
|
|
1652
|
+
onRemove: l,
|
|
1649
1653
|
onEdit: u,
|
|
1650
1654
|
disabled: x,
|
|
1651
1655
|
showDefaultBadge: m,
|
|
1652
|
-
hideSetDefaultMenuItem:
|
|
1656
|
+
hideSetDefaultMenuItem: P,
|
|
1653
1657
|
cardLabelFormat: y = "branded"
|
|
1654
1658
|
}) => {
|
|
1655
|
-
const [b, f] = k(!1), j =
|
|
1659
|
+
const [b, f] = k(!1), j = I(null), W = Nt(r.expMonth, r.expYear);
|
|
1656
1660
|
A(() => {
|
|
1657
1661
|
if (!b) return;
|
|
1658
|
-
const _ = (
|
|
1662
|
+
const _ = (T) => {
|
|
1659
1663
|
var w;
|
|
1660
|
-
(w = j.current) != null && w.contains(
|
|
1664
|
+
(w = j.current) != null && w.contains(T.target) || f(!1);
|
|
1661
1665
|
};
|
|
1662
1666
|
return document.addEventListener("mousedown", _), () => document.removeEventListener("mousedown", _);
|
|
1663
1667
|
}, [b]);
|
|
@@ -1667,7 +1671,7 @@ const ht = (r) => {
|
|
|
1667
1671
|
return /* @__PURE__ */ a.jsxs(
|
|
1668
1672
|
"div",
|
|
1669
1673
|
{
|
|
1670
|
-
className:
|
|
1674
|
+
className: Q(
|
|
1671
1675
|
// items-start + per-element mt offsets so the radio, brand icon, and
|
|
1672
1676
|
// label all read as one horizontal line, with the Exp text directly
|
|
1673
1677
|
// below the label in the same column. Matches main's flights-ui +
|
|
@@ -1714,7 +1718,7 @@ const ht = (r) => {
|
|
|
1714
1718
|
}
|
|
1715
1719
|
) : null
|
|
1716
1720
|
] }),
|
|
1717
|
-
/* @__PURE__ */ a.jsxs("div", { className:
|
|
1721
|
+
/* @__PURE__ */ a.jsxs("div", { className: Q("text-base", W ? "text-grayWarm-400" : "text-grayWarm-600"), children: [
|
|
1718
1722
|
"Exp. ",
|
|
1719
1723
|
Ct(r.expMonth, r.expYear)
|
|
1720
1724
|
] })
|
|
@@ -1730,7 +1734,7 @@ const ht = (r) => {
|
|
|
1730
1734
|
className: "rounded-lg p-2 text-grayWarm-600 transition-colors hover:bg-grayWarm-100 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1731
1735
|
disabled: x,
|
|
1732
1736
|
onClick: (_) => {
|
|
1733
|
-
_.stopPropagation(), f((
|
|
1737
|
+
_.stopPropagation(), f((T) => !T);
|
|
1734
1738
|
},
|
|
1735
1739
|
"data-testid": `menu-trigger-${r.id}`,
|
|
1736
1740
|
children: /* @__PURE__ */ a.jsx("svg", { viewBox: "0 0 24 24", width: "20", height: "20", fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ a.jsx("path", { d: "M12 8c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm0 2c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2zm0 6c-1.1 0-2 .9-2 2s.9 2 2 2 2-.9 2-2-.9-2-2-2z" }) })
|
|
@@ -1740,7 +1744,7 @@ const ht = (r) => {
|
|
|
1740
1744
|
"div",
|
|
1741
1745
|
{
|
|
1742
1746
|
role: "menu",
|
|
1743
|
-
className:
|
|
1747
|
+
className: Q(
|
|
1744
1748
|
"absolute z-10 whitespace-nowrap rounded-lg border border-grayWarm-200 bg-white py-1 shadow-lg",
|
|
1745
1749
|
// selectable mode (flights-ui): the row has a thick border that a
|
|
1746
1750
|
// top-aligned dropdown would crash through. Float the menu ABOVE
|
|
@@ -1765,7 +1769,7 @@ const ht = (r) => {
|
|
|
1765
1769
|
}
|
|
1766
1770
|
)
|
|
1767
1771
|
) : null,
|
|
1768
|
-
!r.isDefault && !
|
|
1772
|
+
!r.isDefault && !P ? /* @__PURE__ */ a.jsx(
|
|
1769
1773
|
"button",
|
|
1770
1774
|
{
|
|
1771
1775
|
type: "button",
|
|
@@ -1798,7 +1802,7 @@ const ht = (r) => {
|
|
|
1798
1802
|
role: "menuitem",
|
|
1799
1803
|
className: "block w-full px-4 py-1 text-left text-md font-semibold text-error-700 hover:text-error-500",
|
|
1800
1804
|
onClick: () => {
|
|
1801
|
-
f(!1),
|
|
1805
|
+
f(!1), l(r);
|
|
1802
1806
|
},
|
|
1803
1807
|
"data-testid": `menu-remove-${r.id}`,
|
|
1804
1808
|
children: "Delete"
|
|
@@ -1811,7 +1815,7 @@ const ht = (r) => {
|
|
|
1811
1815
|
]
|
|
1812
1816
|
}
|
|
1813
1817
|
);
|
|
1814
|
-
}, Rt = (r) => `${
|
|
1818
|
+
}, Rt = (r) => `${Be().iconCdnBaseUrl}/website/assets/icons/payments/${r}.svg`, mr = ({ slug: r, alt: t }) => /* @__PURE__ */ a.jsx(
|
|
1815
1819
|
"img",
|
|
1816
1820
|
{
|
|
1817
1821
|
src: Rt(r),
|
|
@@ -1820,10 +1824,11 @@ const ht = (r) => {
|
|
|
1820
1824
|
loading: "lazy",
|
|
1821
1825
|
style: { height: 20, width: "auto" }
|
|
1822
1826
|
}
|
|
1823
|
-
),
|
|
1827
|
+
), ar = ({
|
|
1824
1828
|
type: r,
|
|
1825
1829
|
label: t,
|
|
1826
|
-
iconNode: n
|
|
1830
|
+
iconNode: n,
|
|
1831
|
+
disabled: s = !1
|
|
1827
1832
|
}) => (
|
|
1828
1833
|
// Alt payment types are visible + clickable but don't yet do anything —
|
|
1829
1834
|
// the click is intentionally a no-op so the row looks identical to the
|
|
@@ -1840,9 +1845,13 @@ const ht = (r) => {
|
|
|
1840
1845
|
type: "radio",
|
|
1841
1846
|
name: "movmo-payment-type",
|
|
1842
1847
|
value: r,
|
|
1848
|
+
disabled: s,
|
|
1843
1849
|
onChange: () => {
|
|
1844
1850
|
},
|
|
1845
|
-
className:
|
|
1851
|
+
className: Q(
|
|
1852
|
+
"h-4 w-4 accent-grayWarm-900",
|
|
1853
|
+
s ? "cursor-not-allowed" : "cursor-pointer"
|
|
1854
|
+
),
|
|
1846
1855
|
"aria-label": t
|
|
1847
1856
|
}
|
|
1848
1857
|
),
|
|
@@ -1857,16 +1866,17 @@ const ht = (r) => {
|
|
|
1857
1866
|
selected: r,
|
|
1858
1867
|
onSelect: t,
|
|
1859
1868
|
creditCardBody: n,
|
|
1860
|
-
|
|
1869
|
+
disabled: s = !1,
|
|
1870
|
+
className: i
|
|
1861
1871
|
}) => {
|
|
1862
|
-
const
|
|
1863
|
-
return /* @__PURE__ */ a.jsxs("div", { className:
|
|
1872
|
+
const l = r === "credit_card";
|
|
1873
|
+
return /* @__PURE__ */ a.jsxs("div", { className: Q("flex w-full flex-col gap-3", i), children: [
|
|
1864
1874
|
/* @__PURE__ */ a.jsxs(
|
|
1865
1875
|
"label",
|
|
1866
1876
|
{
|
|
1867
|
-
className:
|
|
1877
|
+
className: Q(
|
|
1868
1878
|
"flex cursor-pointer flex-col gap-3 rounded-lg border px-4 py-3 transition-colors",
|
|
1869
|
-
|
|
1879
|
+
l ? "border-grayWarm-900 shadow-[0_0_0_1px_#1c1917]" : "border-grayWarm-200"
|
|
1870
1880
|
),
|
|
1871
1881
|
"data-testid": "payment-type-credit_card",
|
|
1872
1882
|
children: [
|
|
@@ -1877,9 +1887,15 @@ const ht = (r) => {
|
|
|
1877
1887
|
type: "radio",
|
|
1878
1888
|
name: "movmo-payment-type",
|
|
1879
1889
|
value: "credit_card",
|
|
1880
|
-
checked:
|
|
1881
|
-
|
|
1882
|
-
|
|
1890
|
+
checked: l,
|
|
1891
|
+
disabled: s,
|
|
1892
|
+
onChange: () => {
|
|
1893
|
+
s || t("credit_card");
|
|
1894
|
+
},
|
|
1895
|
+
className: Q(
|
|
1896
|
+
"h-4 w-4 accent-grayWarm-900",
|
|
1897
|
+
s ? "cursor-not-allowed" : "cursor-pointer"
|
|
1898
|
+
),
|
|
1883
1899
|
"aria-label": "Credit card"
|
|
1884
1900
|
}
|
|
1885
1901
|
),
|
|
@@ -1891,11 +1907,11 @@ const ht = (r) => {
|
|
|
1891
1907
|
/* @__PURE__ */ a.jsx(Se, { brand: "discover", width: 28 })
|
|
1892
1908
|
] })
|
|
1893
1909
|
] }),
|
|
1894
|
-
|
|
1910
|
+
l ? /* @__PURE__ */ a.jsx("div", { "data-testid": "payment-type-credit_card-body", children: n }) : null
|
|
1895
1911
|
]
|
|
1896
1912
|
}
|
|
1897
1913
|
),
|
|
1898
|
-
|
|
1914
|
+
l ? /* @__PURE__ */ a.jsx(
|
|
1899
1915
|
"p",
|
|
1900
1916
|
{
|
|
1901
1917
|
className: "mt-2 text-sm font-semibold text-grayWarm-900",
|
|
@@ -1904,35 +1920,39 @@ const ht = (r) => {
|
|
|
1904
1920
|
}
|
|
1905
1921
|
) : null,
|
|
1906
1922
|
/* @__PURE__ */ a.jsx(
|
|
1907
|
-
|
|
1923
|
+
ar,
|
|
1908
1924
|
{
|
|
1909
1925
|
type: "paypal",
|
|
1910
1926
|
label: "PayPal",
|
|
1911
|
-
iconNode: /* @__PURE__ */ a.jsx(mr, { slug: "paypal", alt: "PayPal" })
|
|
1927
|
+
iconNode: /* @__PURE__ */ a.jsx(mr, { slug: "paypal", alt: "PayPal" }),
|
|
1928
|
+
disabled: s
|
|
1912
1929
|
}
|
|
1913
1930
|
),
|
|
1914
1931
|
/* @__PURE__ */ a.jsx(
|
|
1915
|
-
|
|
1932
|
+
ar,
|
|
1916
1933
|
{
|
|
1917
1934
|
type: "googlepay",
|
|
1918
1935
|
label: "GooglePay",
|
|
1919
|
-
iconNode: /* @__PURE__ */ a.jsx(mr, { slug: "google-pay", alt: "GooglePay" })
|
|
1936
|
+
iconNode: /* @__PURE__ */ a.jsx(mr, { slug: "google-pay", alt: "GooglePay" }),
|
|
1937
|
+
disabled: s
|
|
1920
1938
|
}
|
|
1921
1939
|
),
|
|
1922
1940
|
/* @__PURE__ */ a.jsx(
|
|
1923
|
-
|
|
1941
|
+
ar,
|
|
1924
1942
|
{
|
|
1925
1943
|
type: "klarna",
|
|
1926
1944
|
label: "Klarna",
|
|
1927
|
-
iconNode: /* @__PURE__ */ a.jsx(mr, { slug: "klarna", alt: "Klarna" })
|
|
1945
|
+
iconNode: /* @__PURE__ */ a.jsx(mr, { slug: "klarna", alt: "Klarna" }),
|
|
1946
|
+
disabled: s
|
|
1928
1947
|
}
|
|
1929
1948
|
),
|
|
1930
1949
|
/* @__PURE__ */ a.jsx(
|
|
1931
|
-
|
|
1950
|
+
ar,
|
|
1932
1951
|
{
|
|
1933
1952
|
type: "ach",
|
|
1934
1953
|
label: "Bank account (ACH)",
|
|
1935
|
-
iconNode: /* @__PURE__ */ a.jsx("span", { className: "text-xs font-medium text-grayWarm-500", children: "Direct debit" })
|
|
1954
|
+
iconNode: /* @__PURE__ */ a.jsx("span", { className: "text-xs font-medium text-grayWarm-500", children: "Direct debit" }),
|
|
1955
|
+
disabled: s
|
|
1936
1956
|
}
|
|
1937
1957
|
)
|
|
1938
1958
|
] });
|
|
@@ -1961,185 +1981,187 @@ const ht = (r) => {
|
|
|
1961
1981
|
defaultCardholderFirstName: n,
|
|
1962
1982
|
defaultCardholderLastName: s,
|
|
1963
1983
|
selectedId: i,
|
|
1964
|
-
onSelect:
|
|
1984
|
+
onSelect: l,
|
|
1965
1985
|
onChange: u,
|
|
1966
1986
|
onError: x,
|
|
1967
1987
|
paymentTypeSelector: m = !0,
|
|
1968
|
-
autoSaveFirstCard:
|
|
1988
|
+
autoSaveFirstCard: P = !0,
|
|
1969
1989
|
selectionSetsDefault: y = !1,
|
|
1970
1990
|
showDefaultBadge: b = !0,
|
|
1971
1991
|
collapsible: f = !1,
|
|
1972
1992
|
cardLabelFormat: j = "branded",
|
|
1973
1993
|
className: W
|
|
1974
1994
|
}) => {
|
|
1975
|
-
const { items: ae, status: _, error:
|
|
1995
|
+
const { items: ae, status: _, error: T, refetch: w } = xt(r), { deletePaymentMethod: oe, status: re } = ht(r), { setDefault: fe, status: ge } = yt(r), { updatePaymentMethod: H, status: ie } = vt(r), [v, le] = k([]), [Re, be] = k(null), [S, g] = k(!1), [p, N] = k(null), [U, ee] = k(!1), [pe, J] = k(!1), [q, B] = k(null), [$, Y] = k(null), [he, me] = k(null), [te, Ce] = k(!1), Pe = I(!1), ye = I(x);
|
|
1976
1996
|
A(() => {
|
|
1977
1997
|
ye.current = x;
|
|
1978
1998
|
}, [x]);
|
|
1979
|
-
const
|
|
1980
|
-
var
|
|
1981
|
-
(
|
|
1999
|
+
const ce = z((d) => {
|
|
2000
|
+
var X;
|
|
2001
|
+
(X = ye.current) == null || X.call(ye, d);
|
|
1982
2002
|
}, []), we = z(() => {
|
|
1983
2003
|
g(!1), N(null), me(null);
|
|
1984
2004
|
}, []), je = t ?? ([n, s].filter(Boolean).join(" ") || void 0);
|
|
1985
2005
|
A(() => {
|
|
1986
|
-
_ === "ready" &&
|
|
2006
|
+
_ === "ready" && le(Tr(ae));
|
|
1987
2007
|
}, [ae, _]);
|
|
1988
|
-
const ke =
|
|
2008
|
+
const ke = I(null);
|
|
1989
2009
|
A(() => {
|
|
1990
|
-
if (_ === "error" &&
|
|
1991
|
-
if (ke.current ===
|
|
1992
|
-
ke.current =
|
|
2010
|
+
if (_ === "error" && T) {
|
|
2011
|
+
if (ke.current === T) return;
|
|
2012
|
+
ke.current = T, ce({ source: "list", message: T });
|
|
1993
2013
|
} else _ !== "error" && (ke.current = null);
|
|
1994
|
-
}, [_,
|
|
1995
|
-
if (!
|
|
2014
|
+
}, [_, T, ce]), A(() => {
|
|
2015
|
+
if (!l || Pe.current || _ !== "ready" || v.length === 0 || i) return;
|
|
1996
2016
|
Pe.current = !0;
|
|
1997
|
-
const d = v.find((
|
|
1998
|
-
|
|
1999
|
-
}, [
|
|
2000
|
-
const
|
|
2017
|
+
const d = v.find((X) => X.isDefault) ?? v[0];
|
|
2018
|
+
l(d);
|
|
2019
|
+
}, [l, _, v, i]);
|
|
2020
|
+
const Z = z(
|
|
2001
2021
|
(d) => {
|
|
2002
|
-
|
|
2003
|
-
const
|
|
2004
|
-
return queueMicrotask(() => u == null ? void 0 : u(
|
|
2022
|
+
le((X) => {
|
|
2023
|
+
const V = typeof d == "function" ? d(X) : d, M = Tr(V);
|
|
2024
|
+
return queueMicrotask(() => u == null ? void 0 : u(M)), M;
|
|
2005
2025
|
});
|
|
2006
2026
|
},
|
|
2007
2027
|
[u]
|
|
2008
|
-
), Ee =
|
|
2028
|
+
), Ee = re === "pending" || ge === "pending" || ie === "pending", Te = z(
|
|
2009
2029
|
async (d) => {
|
|
2010
|
-
const
|
|
2011
|
-
be(null),
|
|
2030
|
+
const X = v;
|
|
2031
|
+
be(null), Z((V) => V.map((M) => ({ ...M, isDefault: M.id === d.id })));
|
|
2012
2032
|
try {
|
|
2013
2033
|
await fe(d.id), w();
|
|
2014
|
-
} catch (
|
|
2015
|
-
|
|
2016
|
-
const
|
|
2017
|
-
be(
|
|
2034
|
+
} catch (V) {
|
|
2035
|
+
le(X), u == null || u(X);
|
|
2036
|
+
const M = V instanceof Error ? V.message : "Failed to set default payment method.";
|
|
2037
|
+
be(M), ce({ source: "set-default", message: M, cause: V });
|
|
2018
2038
|
}
|
|
2019
2039
|
},
|
|
2020
|
-
[v,
|
|
2040
|
+
[v, Z, fe, w, u, ce]
|
|
2021
2041
|
), ve = z(
|
|
2022
2042
|
(d) => {
|
|
2023
|
-
|
|
2043
|
+
l == null || l(d), y && (d.isDefault || Te(d));
|
|
2024
2044
|
},
|
|
2025
|
-
[
|
|
2045
|
+
[l, y, Te]
|
|
2026
2046
|
), _e = z(
|
|
2027
2047
|
async (d) => {
|
|
2028
|
-
const
|
|
2048
|
+
const X = v;
|
|
2029
2049
|
be(null);
|
|
2030
|
-
const
|
|
2031
|
-
|
|
2032
|
-
const
|
|
2033
|
-
|
|
2034
|
-
const
|
|
2050
|
+
const V = v.filter((Ne) => Ne.id !== d.id);
|
|
2051
|
+
Z(() => V);
|
|
2052
|
+
const M = d.id === i && l ? V.find((Ne) => Ne.isDefault) ?? V[0] ?? null : null;
|
|
2053
|
+
M && ve(M);
|
|
2054
|
+
const ne = !!M && y && M !== null && !M.isDefault;
|
|
2035
2055
|
try {
|
|
2036
|
-
await
|
|
2037
|
-
} catch (
|
|
2038
|
-
|
|
2039
|
-
const
|
|
2040
|
-
be(
|
|
2056
|
+
await oe(d.id), ne || w();
|
|
2057
|
+
} catch (Ne) {
|
|
2058
|
+
le(X), u == null || u(X);
|
|
2059
|
+
const De = Ne instanceof Error ? Ne.message : "Failed to delete payment method.";
|
|
2060
|
+
be(De), ce({ source: "delete", message: De, cause: Ne });
|
|
2041
2061
|
}
|
|
2042
2062
|
},
|
|
2043
2063
|
[
|
|
2044
2064
|
v,
|
|
2045
|
-
|
|
2046
|
-
|
|
2065
|
+
Z,
|
|
2066
|
+
oe,
|
|
2047
2067
|
w,
|
|
2048
2068
|
u,
|
|
2049
2069
|
i,
|
|
2050
|
-
|
|
2070
|
+
l,
|
|
2051
2071
|
ve,
|
|
2052
2072
|
y,
|
|
2053
|
-
|
|
2073
|
+
ce
|
|
2054
2074
|
]
|
|
2055
2075
|
), R = z((d) => {
|
|
2056
2076
|
Y(null), B(d);
|
|
2057
|
-
}, []),
|
|
2077
|
+
}, []), D = z(() => {
|
|
2058
2078
|
B(null), Y(null);
|
|
2059
|
-
}, []),
|
|
2079
|
+
}, []), G = z(
|
|
2060
2080
|
async (d) => {
|
|
2061
|
-
if (!
|
|
2062
|
-
const
|
|
2063
|
-
Y(null),
|
|
2064
|
-
(
|
|
2065
|
-
(
|
|
2066
|
-
...
|
|
2081
|
+
if (!q) return;
|
|
2082
|
+
const X = q, V = v;
|
|
2083
|
+
Y(null), Z(
|
|
2084
|
+
(M) => M.map(
|
|
2085
|
+
(ne) => ne.id === X.id ? {
|
|
2086
|
+
...ne,
|
|
2067
2087
|
...d.cardholderName !== void 0 ? { cardholderName: d.cardholderName } : {},
|
|
2068
2088
|
...d.zip !== void 0 ? { zip: d.zip } : {}
|
|
2069
|
-
} :
|
|
2089
|
+
} : ne
|
|
2070
2090
|
)
|
|
2071
2091
|
);
|
|
2072
2092
|
try {
|
|
2073
|
-
await
|
|
2074
|
-
} catch (
|
|
2075
|
-
|
|
2076
|
-
const
|
|
2077
|
-
Y(
|
|
2093
|
+
await H(X.id, d), D(), w();
|
|
2094
|
+
} catch (M) {
|
|
2095
|
+
le(V), u == null || u(V);
|
|
2096
|
+
const ne = Pt(M);
|
|
2097
|
+
Y(ne), ce({ source: "update", message: ne, cause: M });
|
|
2078
2098
|
}
|
|
2079
2099
|
},
|
|
2080
2100
|
[
|
|
2081
|
-
|
|
2101
|
+
q,
|
|
2082
2102
|
v,
|
|
2083
|
-
|
|
2084
|
-
|
|
2103
|
+
Z,
|
|
2104
|
+
H,
|
|
2085
2105
|
w,
|
|
2086
2106
|
u,
|
|
2087
|
-
|
|
2088
|
-
|
|
2107
|
+
D,
|
|
2108
|
+
ce
|
|
2089
2109
|
]
|
|
2090
|
-
),
|
|
2110
|
+
), de = z(
|
|
2091
2111
|
(d) => {
|
|
2092
|
-
N(null), g(!1), me(null),
|
|
2112
|
+
N(null), g(!1), me(null), Z((V) => [d, ...V.filter((M) => M.id !== d.id)]), ve(d), !!l && y && !d.isDefault || w();
|
|
2093
2113
|
},
|
|
2094
|
-
[
|
|
2095
|
-
),
|
|
2114
|
+
[Z, w, ve, l, y]
|
|
2115
|
+
), Qe = z((d) => {
|
|
2096
2116
|
N(d);
|
|
2097
|
-
}, []),
|
|
2117
|
+
}, []), er = _ === "ready" && v.length === 0, Oe = typeof l == "function", Ye = !Oe && !f, rr = v.length === 0, Ve = P && v.length === 0, Fe = z(
|
|
2098
2118
|
(d) => /* @__PURE__ */ a.jsx(
|
|
2099
2119
|
Dr,
|
|
2100
2120
|
{
|
|
2101
2121
|
userId: r,
|
|
2102
|
-
isDefault:
|
|
2122
|
+
isDefault: rr,
|
|
2103
2123
|
defaultCardholderName: je,
|
|
2104
|
-
autoSave: !d &&
|
|
2124
|
+
autoSave: !d && Ve,
|
|
2105
2125
|
hideInternalSaveButton: d,
|
|
2106
2126
|
formId: d ? Pr : void 0,
|
|
2107
|
-
onCanSubmitChange: d ?
|
|
2108
|
-
onSavingChange: d ?
|
|
2127
|
+
onCanSubmitChange: d ? ee : void 0,
|
|
2128
|
+
onSavingChange: d ? J : void 0,
|
|
2109
2129
|
autoFocus: d ? "number" : void 0,
|
|
2110
|
-
onSuccess:
|
|
2111
|
-
onError:
|
|
2112
|
-
onErrorDetail:
|
|
2130
|
+
onSuccess: de,
|
|
2131
|
+
onError: Qe,
|
|
2132
|
+
onErrorDetail: ce
|
|
2113
2133
|
}
|
|
2114
2134
|
),
|
|
2115
2135
|
[
|
|
2116
2136
|
r,
|
|
2117
|
-
|
|
2137
|
+
rr,
|
|
2118
2138
|
je,
|
|
2119
|
-
|
|
2120
|
-
|
|
2121
|
-
|
|
2122
|
-
|
|
2139
|
+
Ve,
|
|
2140
|
+
de,
|
|
2141
|
+
Qe,
|
|
2142
|
+
ce
|
|
2123
2143
|
]
|
|
2124
|
-
),
|
|
2144
|
+
), Ke = Xe(() => Fe(!1), [Fe]), qe = Xe(() => Fe(!0), [Fe]), $e = !r, nr = Xe(() => m ? /* @__PURE__ */ a.jsx(
|
|
2125
2145
|
Rr,
|
|
2126
2146
|
{
|
|
2127
2147
|
selected: he,
|
|
2128
2148
|
onSelect: (d) => me(d),
|
|
2129
|
-
creditCardBody:
|
|
2149
|
+
creditCardBody: Ke,
|
|
2150
|
+
disabled: $e
|
|
2130
2151
|
}
|
|
2131
|
-
) :
|
|
2152
|
+
) : Ke, [m, he, Ke, $e]), sr = Xe(() => m ? /* @__PURE__ */ a.jsx(
|
|
2132
2153
|
Rr,
|
|
2133
2154
|
{
|
|
2134
2155
|
selected: he,
|
|
2135
2156
|
onSelect: (d) => me(d),
|
|
2136
|
-
creditCardBody:
|
|
2157
|
+
creditCardBody: qe,
|
|
2158
|
+
disabled: $e
|
|
2137
2159
|
}
|
|
2138
|
-
) :
|
|
2160
|
+
) : qe, [m, he, qe, $e]);
|
|
2139
2161
|
return /* @__PURE__ */ a.jsxs(
|
|
2140
2162
|
"div",
|
|
2141
2163
|
{
|
|
2142
|
-
className:
|
|
2164
|
+
className: Q("flex w-full flex-col gap-4", W),
|
|
2143
2165
|
"data-testid": "payment-methods-manager",
|
|
2144
2166
|
children: [
|
|
2145
2167
|
_ === "loading" && v.length === 0 ? (
|
|
@@ -2150,10 +2172,10 @@ const ht = (r) => {
|
|
|
2150
2172
|
/* @__PURE__ */ a.jsxs(
|
|
2151
2173
|
"div",
|
|
2152
2174
|
{
|
|
2153
|
-
className:
|
|
2175
|
+
className: Q(
|
|
2154
2176
|
// Match the real-list shell so layout doesn't reflow when data
|
|
2155
2177
|
// arrives. In selection mode the outer card is suppressed too.
|
|
2156
|
-
|
|
2178
|
+
Ye ? "flex flex-col divide-y divide-grayWarm-200 rounded-xl border border-grayWarm-200 px-4 md:px-6" : "flex flex-col gap-2"
|
|
2157
2179
|
),
|
|
2158
2180
|
"data-testid": "payment-methods-loading",
|
|
2159
2181
|
children: [
|
|
@@ -2171,7 +2193,7 @@ const ht = (r) => {
|
|
|
2171
2193
|
className: "flex items-center justify-between gap-3 rounded-md bg-error-50 p-3 text-sm text-error-700",
|
|
2172
2194
|
"data-testid": "payment-methods-list-error",
|
|
2173
2195
|
children: [
|
|
2174
|
-
/* @__PURE__ */ a.jsx("span", { children:
|
|
2196
|
+
/* @__PURE__ */ a.jsx("span", { children: T ?? "Failed to load payment methods." }),
|
|
2175
2197
|
/* @__PURE__ */ a.jsx(
|
|
2176
2198
|
"button",
|
|
2177
2199
|
{
|
|
@@ -2198,9 +2220,9 @@ const ht = (r) => {
|
|
|
2198
2220
|
"div",
|
|
2199
2221
|
{
|
|
2200
2222
|
className: "flex items-center justify-between",
|
|
2201
|
-
"data-testid":
|
|
2223
|
+
"data-testid": te ? "payment-methods-drawer-header" : "payment-methods-collapsed-preview",
|
|
2202
2224
|
children: [
|
|
2203
|
-
|
|
2225
|
+
te ? /* @__PURE__ */ a.jsx("h3", { className: "text-md font-semibold text-grayWarm-950", children: "Payment methods" }) : /* @__PURE__ */ a.jsx(
|
|
2204
2226
|
_t,
|
|
2205
2227
|
{
|
|
2206
2228
|
method: v.find((d) => d.id === i) ?? v.find((d) => d.isDefault) ?? v[0],
|
|
@@ -2212,15 +2234,15 @@ const ht = (r) => {
|
|
|
2212
2234
|
"button",
|
|
2213
2235
|
{
|
|
2214
2236
|
type: "button",
|
|
2215
|
-
"aria-label":
|
|
2216
|
-
"aria-expanded":
|
|
2237
|
+
"aria-label": te ? "Collapse payment methods" : "Expand payment methods",
|
|
2238
|
+
"aria-expanded": te,
|
|
2217
2239
|
className: "bg-grayWarm-100 p-2 rounded-lg hover:bg-grayWarm-200 transition-colors",
|
|
2218
2240
|
onClick: () => Ce((d) => !d),
|
|
2219
|
-
"data-testid":
|
|
2241
|
+
"data-testid": te ? "payment-methods-drawer-close" : "payment-methods-drawer-open",
|
|
2220
2242
|
children: /* @__PURE__ */ a.jsx(
|
|
2221
2243
|
"img",
|
|
2222
2244
|
{
|
|
2223
|
-
src: `${
|
|
2245
|
+
src: `${Be().iconCdnBaseUrl}/website/assets/icons/chevron-${te ? "up" : "down"}-double.svg`,
|
|
2224
2246
|
alt: "",
|
|
2225
2247
|
className: "w-5 h-5"
|
|
2226
2248
|
}
|
|
@@ -2230,16 +2252,16 @@ const ht = (r) => {
|
|
|
2230
2252
|
]
|
|
2231
2253
|
}
|
|
2232
2254
|
) }) : null,
|
|
2233
|
-
v.length > 0 && (!f ||
|
|
2255
|
+
v.length > 0 && (!f || te) ? /* @__PURE__ */ a.jsx(
|
|
2234
2256
|
"div",
|
|
2235
2257
|
{
|
|
2236
|
-
className:
|
|
2258
|
+
className: Q(
|
|
2237
2259
|
"flex flex-col",
|
|
2238
2260
|
// accounts-ui (non-selectable, non-collapsible): rounded outer card
|
|
2239
2261
|
// with divide-y separators between rows.
|
|
2240
2262
|
// flights-ui (selectable or collapsible): bare space-y-3 gap between
|
|
2241
2263
|
// per-row bordered tiles; no outer card chrome.
|
|
2242
|
-
|
|
2264
|
+
Ye ? "rounded-xl border border-grayWarm-200 px-4 md:px-6 divide-y divide-grayWarm-200" : "space-y-3"
|
|
2243
2265
|
),
|
|
2244
2266
|
children: v.map((d) => /* @__PURE__ */ a.jsx(
|
|
2245
2267
|
kt,
|
|
@@ -2260,10 +2282,10 @@ const ht = (r) => {
|
|
|
2260
2282
|
))
|
|
2261
2283
|
}
|
|
2262
2284
|
) : null,
|
|
2263
|
-
|
|
2285
|
+
er ? (
|
|
2264
2286
|
// Empty state: render the add-card body inline (per Figma 1536-21454).
|
|
2265
|
-
/* @__PURE__ */ a.jsx("div", { "data-testid": "payment-methods-empty", children:
|
|
2266
|
-
) : v.length > 0 && (!f ||
|
|
2287
|
+
/* @__PURE__ */ a.jsx("div", { "data-testid": "payment-methods-empty", children: nr })
|
|
2288
|
+
) : v.length > 0 && (!f || te) ? (
|
|
2267
2289
|
// Keep the Add button visible during silent refetches (status flips
|
|
2268
2290
|
// back to 'loading' transiently after set-default / delete).
|
|
2269
2291
|
// In collapsible mode only show the Add button when the drawer is open.
|
|
@@ -2272,7 +2294,7 @@ const ht = (r) => {
|
|
|
2272
2294
|
{
|
|
2273
2295
|
type: "button",
|
|
2274
2296
|
onClick: () => {
|
|
2275
|
-
N(null), me(null),
|
|
2297
|
+
N(null), me(null), ee(!1), g(!0);
|
|
2276
2298
|
},
|
|
2277
2299
|
onMouseEnter: () => {
|
|
2278
2300
|
hr().catch(() => {
|
|
@@ -2291,13 +2313,13 @@ const ht = (r) => {
|
|
|
2291
2313
|
/* @__PURE__ */ a.jsxs(
|
|
2292
2314
|
gt,
|
|
2293
2315
|
{
|
|
2294
|
-
open:
|
|
2316
|
+
open: S,
|
|
2295
2317
|
onClose: we,
|
|
2296
2318
|
formId: Pr,
|
|
2297
|
-
saveDisabled: !
|
|
2319
|
+
saveDisabled: !U,
|
|
2298
2320
|
isSaving: pe,
|
|
2299
2321
|
children: [
|
|
2300
|
-
|
|
2322
|
+
sr,
|
|
2301
2323
|
p ? (
|
|
2302
2324
|
// Single source of truth for save-time errors (API failures + hook
|
|
2303
2325
|
// init failures forwarded from MovmoCardForm.onError). MovmoCardForm
|
|
@@ -2322,11 +2344,11 @@ const ht = (r) => {
|
|
|
2322
2344
|
/* @__PURE__ */ a.jsx(
|
|
2323
2345
|
jt,
|
|
2324
2346
|
{
|
|
2325
|
-
open:
|
|
2326
|
-
method:
|
|
2327
|
-
onClose:
|
|
2328
|
-
onSave:
|
|
2329
|
-
isSaving:
|
|
2347
|
+
open: q !== null,
|
|
2348
|
+
method: q,
|
|
2349
|
+
onClose: D,
|
|
2350
|
+
onSave: G,
|
|
2351
|
+
isSaving: ie === "pending",
|
|
2330
2352
|
error: $
|
|
2331
2353
|
}
|
|
2332
2354
|
)
|
|
@@ -2348,18 +2370,18 @@ const St = "/v1/auth/", Ft = "movmo_csrf_token", Wt = (r) => {
|
|
|
2348
2370
|
if (typeof globalThis < "u" && typeof globalThis.fetch == "function")
|
|
2349
2371
|
return globalThis.fetch.bind(globalThis);
|
|
2350
2372
|
throw new Error("@movmo_app/payments: no global fetch available in this environment");
|
|
2351
|
-
},
|
|
2373
|
+
}, Ut = (r) => {
|
|
2352
2374
|
const {
|
|
2353
2375
|
refreshSession: t,
|
|
2354
2376
|
onRefreshFailed: n,
|
|
2355
2377
|
csrfCookieName: s = Ft,
|
|
2356
2378
|
extraHeaders: i,
|
|
2357
|
-
authPathFragment:
|
|
2379
|
+
authPathFragment: l = St,
|
|
2358
2380
|
baseFetch: u = $t(),
|
|
2359
2381
|
readCookie: x = Wt
|
|
2360
2382
|
} = r;
|
|
2361
2383
|
let m = null;
|
|
2362
|
-
const
|
|
2384
|
+
const P = () => {
|
|
2363
2385
|
if (m) return m;
|
|
2364
2386
|
const b = (async () => {
|
|
2365
2387
|
await t();
|
|
@@ -2372,8 +2394,8 @@ const St = "/v1/auth/", Ft = "movmo_csrf_token", Wt = (r) => {
|
|
|
2372
2394
|
const j = new Headers(f == null ? void 0 : f.headers), W = x(s);
|
|
2373
2395
|
if (W && !j.has("X-CSRF-Token") && j.set("X-CSRF-Token", W), i) {
|
|
2374
2396
|
const ae = i(b, f);
|
|
2375
|
-
for (const [_,
|
|
2376
|
-
j.has(_) || j.set(_,
|
|
2397
|
+
for (const [_, T] of Object.entries(ae))
|
|
2398
|
+
j.has(_) || j.set(_, T);
|
|
2377
2399
|
}
|
|
2378
2400
|
return {
|
|
2379
2401
|
...f,
|
|
@@ -2383,13 +2405,13 @@ const St = "/v1/auth/", Ft = "movmo_csrf_token", Wt = (r) => {
|
|
|
2383
2405
|
};
|
|
2384
2406
|
return async function(f, j) {
|
|
2385
2407
|
const W = await u(f, y(f, j));
|
|
2386
|
-
if (Ot(f).includes(
|
|
2408
|
+
if (Ot(f).includes(l) || W.status !== 401 && W.status !== 403)
|
|
2387
2409
|
return W;
|
|
2388
2410
|
try {
|
|
2389
|
-
await
|
|
2390
|
-
} catch (
|
|
2411
|
+
await P();
|
|
2412
|
+
} catch (T) {
|
|
2391
2413
|
try {
|
|
2392
|
-
n(
|
|
2414
|
+
n(T);
|
|
2393
2415
|
} catch (w) {
|
|
2394
2416
|
console.error(
|
|
2395
2417
|
"@movmo_app/payments: onRefreshFailed callback threw — auth retry path is misconfigured",
|
|
@@ -2400,10 +2422,10 @@ const St = "/v1/auth/", Ft = "movmo_csrf_token", Wt = (r) => {
|
|
|
2400
2422
|
}
|
|
2401
2423
|
try {
|
|
2402
2424
|
return await u(f, y(f, j));
|
|
2403
|
-
} catch (
|
|
2425
|
+
} catch (T) {
|
|
2404
2426
|
return console.error(
|
|
2405
2427
|
"@movmo_app/payments: retry after token refresh failed — returning original response",
|
|
2406
|
-
|
|
2428
|
+
T
|
|
2407
2429
|
), W;
|
|
2408
2430
|
}
|
|
2409
2431
|
};
|
|
@@ -2412,8 +2434,8 @@ export {
|
|
|
2412
2434
|
Dr as MovmoCardForm,
|
|
2413
2435
|
_t as PaymentMethodPreview,
|
|
2414
2436
|
Tt as PaymentMethodsManager,
|
|
2415
|
-
|
|
2416
|
-
|
|
2437
|
+
Ut as createMovmoAuthFetch,
|
|
2438
|
+
Be as getPaymentsConfig,
|
|
2417
2439
|
At as setPaymentsConfig,
|
|
2418
2440
|
ht as useDeletePaymentMethod,
|
|
2419
2441
|
ut as useMovmoCardFields,
|