@movmo_app/payments 0.7.0 → 0.8.0
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.d.ts +30 -35
- package/dist/index.es.js +1179 -1114
- package/dist/index.es.js.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import
|
|
5
|
-
var
|
|
1
|
+
var et = Object.defineProperty;
|
|
2
|
+
var rt = (e, t, n) => t in e ? et(e, t, { enumerable: !0, configurable: !0, writable: !0, value: n }) : e[t] = n;
|
|
3
|
+
var Je = (e, t, n) => rt(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
|
+
import Ir, { useState as R, useRef as U, useEffect as O, useCallback as D, useMemo as Be, useId as tt } from "react";
|
|
5
|
+
var wr = { exports: {} }, nr = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -12,21 +12,21 @@ var br = { exports: {} }, ar = {};
|
|
|
12
12
|
* This source code is licensed under the MIT license found in the
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
|
-
var
|
|
16
|
-
function
|
|
17
|
-
if (
|
|
18
|
-
|
|
19
|
-
var
|
|
20
|
-
function u(
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
for (
|
|
24
|
-
if (
|
|
25
|
-
return { $$typeof: t, type:
|
|
15
|
+
var Rr;
|
|
16
|
+
function at() {
|
|
17
|
+
if (Rr) return nr;
|
|
18
|
+
Rr = 1;
|
|
19
|
+
var e = Ir, t = Symbol.for("react.element"), n = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, i = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, l = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function u(y, p, E) {
|
|
21
|
+
var j, b = {}, _ = null, x = null;
|
|
22
|
+
E !== void 0 && (_ = "" + E), p.key !== void 0 && (_ = "" + p.key), p.ref !== void 0 && (x = p.ref);
|
|
23
|
+
for (j in p) s.call(p, j) && !l.hasOwnProperty(j) && (b[j] = p[j]);
|
|
24
|
+
if (y && y.defaultProps) for (j in p = y.defaultProps, p) b[j] === void 0 && (b[j] = p[j]);
|
|
25
|
+
return { $$typeof: t, type: y, key: _, ref: x, props: b, _owner: i.current };
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return nr.Fragment = n, nr.jsx = u, nr.jsxs = u, nr;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var sr = {};
|
|
30
30
|
/**
|
|
31
31
|
* @license React
|
|
32
32
|
* react-jsx-runtime.development.js
|
|
@@ -37,60 +37,60 @@ var nr = {};
|
|
|
37
37
|
* LICENSE file in the root directory of this source tree.
|
|
38
38
|
*/
|
|
39
39
|
var kr;
|
|
40
|
-
function
|
|
40
|
+
function nt() {
|
|
41
41
|
return kr || (kr = 1, process.env.NODE_ENV !== "production" && function() {
|
|
42
|
-
var
|
|
43
|
-
function
|
|
44
|
-
if (
|
|
42
|
+
var e = Ir, 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"), y = Symbol.for("react.context"), p = Symbol.for("react.forward_ref"), E = Symbol.for("react.suspense"), j = Symbol.for("react.suspense_list"), b = Symbol.for("react.memo"), _ = Symbol.for("react.lazy"), x = Symbol.for("react.offscreen"), P = Symbol.iterator, $ = "@@iterator";
|
|
43
|
+
function B(r) {
|
|
44
|
+
if (r === null || typeof r != "object")
|
|
45
45
|
return null;
|
|
46
|
-
var o =
|
|
46
|
+
var o = P && r[P] || r[$];
|
|
47
47
|
return typeof o == "function" ? o : null;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
function
|
|
49
|
+
var C = e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
|
+
function w(r) {
|
|
51
51
|
{
|
|
52
|
-
for (var o = arguments.length, c = new Array(o > 1 ? o - 1 : 0),
|
|
53
|
-
c[
|
|
54
|
-
|
|
52
|
+
for (var o = arguments.length, c = new Array(o > 1 ? o - 1 : 0), v = 1; v < o; v++)
|
|
53
|
+
c[v - 1] = arguments[v];
|
|
54
|
+
W("error", r, c);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function W(r, o, c) {
|
|
58
58
|
{
|
|
59
|
-
var
|
|
59
|
+
var v = C.ReactDebugCurrentFrame, F = v.getStackAddendum();
|
|
60
60
|
F !== "" && (o += "%s", c = c.concat([F]));
|
|
61
|
-
var
|
|
61
|
+
var A = c.map(function(k) {
|
|
62
62
|
return String(k);
|
|
63
63
|
});
|
|
64
|
-
|
|
64
|
+
A.unshift("Warning: " + o), Function.prototype.apply.call(console[r], console, A);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
var ve = !1, fe = !1,
|
|
68
|
-
|
|
69
|
-
function
|
|
70
|
-
return !!(typeof
|
|
67
|
+
var ve = !1, fe = !1, _e = !1, pe = !1, le = !1, te;
|
|
68
|
+
te = Symbol.for("react.module.reference");
|
|
69
|
+
function g(r) {
|
|
70
|
+
return !!(typeof r == "string" || typeof r == "function" || r === s || r === l || le || r === i || r === E || r === j || pe || r === x || ve || fe || _e || typeof r == "object" && r !== null && (r.$$typeof === _ || r.$$typeof === b || r.$$typeof === u || r.$$typeof === y || r.$$typeof === p || // 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
|
+
r.$$typeof === te || r.getModuleId !== void 0));
|
|
75
75
|
}
|
|
76
|
-
function ge(
|
|
77
|
-
var
|
|
78
|
-
if (
|
|
79
|
-
return
|
|
76
|
+
function ge(r, o, c) {
|
|
77
|
+
var v = r.displayName;
|
|
78
|
+
if (v)
|
|
79
|
+
return v;
|
|
80
80
|
var F = o.displayName || o.name || "";
|
|
81
81
|
return F !== "" ? c + "(" + F + ")" : c;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
return
|
|
83
|
+
function Re(r) {
|
|
84
|
+
return r.displayName || "Context";
|
|
85
85
|
}
|
|
86
|
-
function
|
|
87
|
-
if (
|
|
86
|
+
function Y(r) {
|
|
87
|
+
if (r == null)
|
|
88
88
|
return null;
|
|
89
|
-
if (typeof
|
|
90
|
-
return
|
|
91
|
-
if (typeof
|
|
92
|
-
return
|
|
93
|
-
switch (
|
|
89
|
+
if (typeof r.tag == "number" && w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof r == "function")
|
|
90
|
+
return r.displayName || r.name || null;
|
|
91
|
+
if (typeof r == "string")
|
|
92
|
+
return r;
|
|
93
|
+
switch (r) {
|
|
94
94
|
case s:
|
|
95
95
|
return "Fragment";
|
|
96
96
|
case n:
|
|
@@ -99,28 +99,28 @@ function tt() {
|
|
|
99
99
|
return "Profiler";
|
|
100
100
|
case i:
|
|
101
101
|
return "StrictMode";
|
|
102
|
-
case
|
|
102
|
+
case E:
|
|
103
103
|
return "Suspense";
|
|
104
|
-
case
|
|
104
|
+
case j:
|
|
105
105
|
return "SuspenseList";
|
|
106
106
|
}
|
|
107
|
-
if (typeof
|
|
108
|
-
switch (
|
|
109
|
-
case
|
|
110
|
-
var o =
|
|
111
|
-
return
|
|
107
|
+
if (typeof r == "object")
|
|
108
|
+
switch (r.$$typeof) {
|
|
109
|
+
case y:
|
|
110
|
+
var o = r;
|
|
111
|
+
return Re(o) + ".Consumer";
|
|
112
112
|
case u:
|
|
113
|
-
var c =
|
|
114
|
-
return
|
|
115
|
-
case
|
|
116
|
-
return ge(
|
|
117
|
-
case
|
|
118
|
-
var
|
|
119
|
-
return
|
|
120
|
-
case
|
|
121
|
-
var F =
|
|
113
|
+
var c = r;
|
|
114
|
+
return Re(c._context) + ".Provider";
|
|
115
|
+
case p:
|
|
116
|
+
return ge(r, r.render, "ForwardRef");
|
|
117
|
+
case b:
|
|
118
|
+
var v = r.displayName || null;
|
|
119
|
+
return v !== null ? v : Y(r.type) || "Memo";
|
|
120
|
+
case _: {
|
|
121
|
+
var F = r, A = F._payload, k = F._init;
|
|
122
122
|
try {
|
|
123
|
-
return
|
|
123
|
+
return Y(k(A));
|
|
124
124
|
} catch {
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
@@ -128,101 +128,101 @@ function tt() {
|
|
|
128
128
|
}
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
|
-
var
|
|
132
|
-
function
|
|
131
|
+
var f = Object.assign, h = 0, S, M, se, oe, J, Z, G;
|
|
132
|
+
function T() {
|
|
133
133
|
}
|
|
134
|
-
|
|
135
|
-
function
|
|
134
|
+
T.__reactDisabledLog = !0;
|
|
135
|
+
function X() {
|
|
136
136
|
{
|
|
137
|
-
if (
|
|
138
|
-
|
|
139
|
-
var
|
|
137
|
+
if (h === 0) {
|
|
138
|
+
S = console.log, M = console.info, se = console.warn, oe = console.error, J = console.group, Z = console.groupCollapsed, G = console.groupEnd;
|
|
139
|
+
var r = {
|
|
140
140
|
configurable: !0,
|
|
141
141
|
enumerable: !0,
|
|
142
|
-
value:
|
|
142
|
+
value: T,
|
|
143
143
|
writable: !0
|
|
144
144
|
};
|
|
145
145
|
Object.defineProperties(console, {
|
|
146
|
-
info:
|
|
147
|
-
log:
|
|
148
|
-
warn:
|
|
149
|
-
error:
|
|
150
|
-
group:
|
|
151
|
-
groupCollapsed:
|
|
152
|
-
groupEnd:
|
|
146
|
+
info: r,
|
|
147
|
+
log: r,
|
|
148
|
+
warn: r,
|
|
149
|
+
error: r,
|
|
150
|
+
group: r,
|
|
151
|
+
groupCollapsed: r,
|
|
152
|
+
groupEnd: r
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
h++;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
|
-
function
|
|
158
|
+
function ke() {
|
|
159
159
|
{
|
|
160
|
-
if (
|
|
161
|
-
var
|
|
160
|
+
if (h--, h === 0) {
|
|
161
|
+
var r = {
|
|
162
162
|
configurable: !0,
|
|
163
163
|
enumerable: !0,
|
|
164
164
|
writable: !0
|
|
165
165
|
};
|
|
166
166
|
Object.defineProperties(console, {
|
|
167
|
-
log:
|
|
168
|
-
value:
|
|
167
|
+
log: f({}, r, {
|
|
168
|
+
value: S
|
|
169
169
|
}),
|
|
170
|
-
info:
|
|
171
|
-
value:
|
|
170
|
+
info: f({}, r, {
|
|
171
|
+
value: M
|
|
172
172
|
}),
|
|
173
|
-
warn:
|
|
174
|
-
value:
|
|
173
|
+
warn: f({}, r, {
|
|
174
|
+
value: se
|
|
175
175
|
}),
|
|
176
|
-
error:
|
|
176
|
+
error: f({}, r, {
|
|
177
177
|
value: oe
|
|
178
178
|
}),
|
|
179
|
-
group:
|
|
180
|
-
value: q
|
|
181
|
-
}),
|
|
182
|
-
groupCollapsed: p({}, e, {
|
|
179
|
+
group: f({}, r, {
|
|
183
180
|
value: J
|
|
184
181
|
}),
|
|
185
|
-
|
|
182
|
+
groupCollapsed: f({}, r, {
|
|
183
|
+
value: Z
|
|
184
|
+
}),
|
|
185
|
+
groupEnd: f({}, r, {
|
|
186
186
|
value: G
|
|
187
187
|
})
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
h < 0 && w("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
var be =
|
|
194
|
-
function
|
|
193
|
+
var be = C.ReactCurrentDispatcher, Q;
|
|
194
|
+
function Ne(r, o, c) {
|
|
195
195
|
{
|
|
196
|
-
if (
|
|
196
|
+
if (Q === void 0)
|
|
197
197
|
try {
|
|
198
198
|
throw Error();
|
|
199
199
|
} catch (F) {
|
|
200
|
-
var
|
|
201
|
-
|
|
200
|
+
var v = F.stack.trim().match(/\n( *(at )?)/);
|
|
201
|
+
Q = v && v[1] || "";
|
|
202
202
|
}
|
|
203
203
|
return `
|
|
204
|
-
` +
|
|
204
|
+
` + Q + r;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
var
|
|
207
|
+
var ee = !1, We;
|
|
208
208
|
{
|
|
209
|
-
var
|
|
210
|
-
We = new
|
|
209
|
+
var Se = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
+
We = new Se();
|
|
211
211
|
}
|
|
212
|
-
function
|
|
213
|
-
if (!
|
|
212
|
+
function ce(r, o) {
|
|
213
|
+
if (!r || ee)
|
|
214
214
|
return "";
|
|
215
215
|
{
|
|
216
|
-
var c = We.get(
|
|
216
|
+
var c = We.get(r);
|
|
217
217
|
if (c !== void 0)
|
|
218
218
|
return c;
|
|
219
219
|
}
|
|
220
|
-
var
|
|
221
|
-
|
|
220
|
+
var v;
|
|
221
|
+
ee = !0;
|
|
222
222
|
var F = Error.prepareStackTrace;
|
|
223
223
|
Error.prepareStackTrace = void 0;
|
|
224
|
-
var
|
|
225
|
-
|
|
224
|
+
var A;
|
|
225
|
+
A = be.current, be.current = null, X();
|
|
226
226
|
try {
|
|
227
227
|
if (o) {
|
|
228
228
|
var k = function() {
|
|
@@ -236,265 +236,265 @@ function tt() {
|
|
|
236
236
|
try {
|
|
237
237
|
Reflect.construct(k, []);
|
|
238
238
|
} catch (ye) {
|
|
239
|
-
|
|
239
|
+
v = ye;
|
|
240
240
|
}
|
|
241
|
-
Reflect.construct(
|
|
241
|
+
Reflect.construct(r, [], k);
|
|
242
242
|
} else {
|
|
243
243
|
try {
|
|
244
244
|
k.call();
|
|
245
245
|
} catch (ye) {
|
|
246
|
-
|
|
246
|
+
v = ye;
|
|
247
247
|
}
|
|
248
|
-
|
|
248
|
+
r.call(k.prototype);
|
|
249
249
|
}
|
|
250
250
|
} else {
|
|
251
251
|
try {
|
|
252
252
|
throw Error();
|
|
253
253
|
} catch (ye) {
|
|
254
|
-
|
|
254
|
+
v = ye;
|
|
255
255
|
}
|
|
256
|
-
|
|
256
|
+
r();
|
|
257
257
|
}
|
|
258
258
|
} catch (ye) {
|
|
259
|
-
if (ye &&
|
|
260
|
-
for (var
|
|
261
|
-
`), me =
|
|
262
|
-
`),
|
|
259
|
+
if (ye && v && typeof ye.stack == "string") {
|
|
260
|
+
for (var N = ye.stack.split(`
|
|
261
|
+
`), me = v.stack.split(`
|
|
262
|
+
`), q = N.length - 1, K = me.length - 1; q >= 1 && K >= 0 && N[q] !== me[K]; )
|
|
263
263
|
K--;
|
|
264
|
-
for (;
|
|
265
|
-
if (
|
|
266
|
-
if (
|
|
264
|
+
for (; q >= 1 && K >= 0; q--, K--)
|
|
265
|
+
if (N[q] !== me[K]) {
|
|
266
|
+
if (q !== 1 || K !== 1)
|
|
267
267
|
do
|
|
268
|
-
if (
|
|
268
|
+
if (q--, K--, K < 0 || N[q] !== me[K]) {
|
|
269
269
|
var je = `
|
|
270
|
-
` +
|
|
271
|
-
return
|
|
270
|
+
` + N[q].replace(" at new ", " at ");
|
|
271
|
+
return r.displayName && je.includes("<anonymous>") && (je = je.replace("<anonymous>", r.displayName)), typeof r == "function" && We.set(r, je), je;
|
|
272
272
|
}
|
|
273
|
-
while (
|
|
273
|
+
while (q >= 1 && K >= 0);
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
} finally {
|
|
278
|
-
|
|
278
|
+
ee = !1, be.current = A, ke(), Error.prepareStackTrace = F;
|
|
279
279
|
}
|
|
280
|
-
var
|
|
281
|
-
return typeof
|
|
280
|
+
var Ke = r ? r.displayName || r.name : "", qe = Ke ? Ne(Ke) : "";
|
|
281
|
+
return typeof r == "function" && We.set(r, qe), qe;
|
|
282
282
|
}
|
|
283
|
-
function
|
|
284
|
-
return
|
|
283
|
+
function ae(r, o, c) {
|
|
284
|
+
return ce(r, !1);
|
|
285
285
|
}
|
|
286
|
-
function Oe(
|
|
287
|
-
var o =
|
|
286
|
+
function Oe(r) {
|
|
287
|
+
var o = r.prototype;
|
|
288
288
|
return !!(o && o.isReactComponent);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
if (
|
|
290
|
+
function z(r, o, c) {
|
|
291
|
+
if (r == null)
|
|
292
292
|
return "";
|
|
293
|
-
if (typeof
|
|
294
|
-
return
|
|
295
|
-
if (typeof
|
|
296
|
-
return
|
|
297
|
-
switch (
|
|
298
|
-
case
|
|
299
|
-
return
|
|
300
|
-
case
|
|
301
|
-
return
|
|
293
|
+
if (typeof r == "function")
|
|
294
|
+
return ce(r, Oe(r));
|
|
295
|
+
if (typeof r == "string")
|
|
296
|
+
return Ne(r);
|
|
297
|
+
switch (r) {
|
|
298
|
+
case E:
|
|
299
|
+
return Ne("Suspense");
|
|
300
|
+
case j:
|
|
301
|
+
return Ne("SuspenseList");
|
|
302
302
|
}
|
|
303
|
-
if (typeof
|
|
304
|
-
switch (
|
|
305
|
-
case
|
|
306
|
-
return
|
|
307
|
-
case
|
|
308
|
-
return
|
|
309
|
-
case
|
|
310
|
-
var
|
|
303
|
+
if (typeof r == "object")
|
|
304
|
+
switch (r.$$typeof) {
|
|
305
|
+
case p:
|
|
306
|
+
return ae(r.render);
|
|
307
|
+
case b:
|
|
308
|
+
return z(r.type, o, c);
|
|
309
|
+
case _: {
|
|
310
|
+
var v = r, F = v._payload, A = v._init;
|
|
311
311
|
try {
|
|
312
|
-
return
|
|
312
|
+
return z(A(F), o, c);
|
|
313
313
|
} catch {
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return "";
|
|
318
318
|
}
|
|
319
|
-
var
|
|
320
|
-
function
|
|
321
|
-
if (
|
|
322
|
-
var o =
|
|
323
|
-
|
|
319
|
+
var de = Object.prototype.hasOwnProperty, Pe = {}, ne = C.ReactDebugCurrentFrame;
|
|
320
|
+
function Ce(r) {
|
|
321
|
+
if (r) {
|
|
322
|
+
var o = r._owner, c = z(r.type, r._source, o ? o.type : null);
|
|
323
|
+
ne.setExtraStackFrame(c);
|
|
324
324
|
} else
|
|
325
|
-
|
|
325
|
+
ne.setExtraStackFrame(null);
|
|
326
326
|
}
|
|
327
|
-
function Ae(
|
|
327
|
+
function Ae(r, o, c, v, F) {
|
|
328
328
|
{
|
|
329
|
-
var
|
|
330
|
-
for (var k in
|
|
331
|
-
if (
|
|
332
|
-
var
|
|
329
|
+
var A = Function.call.bind(de);
|
|
330
|
+
for (var k in r)
|
|
331
|
+
if (A(r, k)) {
|
|
332
|
+
var N = void 0;
|
|
333
333
|
try {
|
|
334
|
-
if (typeof
|
|
335
|
-
var me = Error((
|
|
334
|
+
if (typeof r[k] != "function") {
|
|
335
|
+
var me = Error((v || "React class") + ": " + c + " type `" + k + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof r[k] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
336
336
|
throw me.name = "Invariant Violation", me;
|
|
337
337
|
}
|
|
338
|
-
|
|
339
|
-
} catch (
|
|
340
|
-
|
|
338
|
+
N = r[k](o, k, v, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
|
+
} catch (q) {
|
|
340
|
+
N = q;
|
|
341
341
|
}
|
|
342
|
-
|
|
342
|
+
N && !(N instanceof Error) && (Ce(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).", v || "React class", c, k, typeof N), Ce(null)), N instanceof Error && !(N.message in Pe) && (Pe[N.message] = !0, Ce(F), w("Failed %s type: %s", c, N.message), Ce(null));
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
var xe = Array.isArray;
|
|
347
|
-
function Ve(
|
|
348
|
-
return xe(
|
|
347
|
+
function Ve(r) {
|
|
348
|
+
return xe(r);
|
|
349
349
|
}
|
|
350
|
-
function we(
|
|
350
|
+
function we(r) {
|
|
351
351
|
{
|
|
352
|
-
var o = typeof Symbol == "function" && Symbol.toStringTag, c = o &&
|
|
352
|
+
var o = typeof Symbol == "function" && Symbol.toStringTag, c = o && r[Symbol.toStringTag] || r.constructor.name || "Object";
|
|
353
353
|
return c;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function ue(r) {
|
|
357
357
|
try {
|
|
358
|
-
return De(
|
|
358
|
+
return De(r), !1;
|
|
359
359
|
} catch {
|
|
360
360
|
return !0;
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
function De(
|
|
364
|
-
return "" +
|
|
363
|
+
function De(r) {
|
|
364
|
+
return "" + r;
|
|
365
365
|
}
|
|
366
|
-
function $e(
|
|
367
|
-
if (
|
|
368
|
-
return
|
|
366
|
+
function $e(r) {
|
|
367
|
+
if (ue(r))
|
|
368
|
+
return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", we(r)), De(r);
|
|
369
369
|
}
|
|
370
|
-
var
|
|
370
|
+
var Ie = C.ReactCurrentOwner, He = {
|
|
371
371
|
key: !0,
|
|
372
372
|
ref: !0,
|
|
373
373
|
__self: !0,
|
|
374
374
|
__source: !0
|
|
375
|
-
},
|
|
376
|
-
function
|
|
377
|
-
if (
|
|
378
|
-
var o = Object.getOwnPropertyDescriptor(
|
|
375
|
+
}, Ue, Te;
|
|
376
|
+
function m(r) {
|
|
377
|
+
if (de.call(r, "ref")) {
|
|
378
|
+
var o = Object.getOwnPropertyDescriptor(r, "ref").get;
|
|
379
379
|
if (o && o.isReactWarning)
|
|
380
380
|
return !1;
|
|
381
381
|
}
|
|
382
|
-
return
|
|
382
|
+
return r.ref !== void 0;
|
|
383
383
|
}
|
|
384
|
-
function
|
|
385
|
-
if (
|
|
386
|
-
var o = Object.getOwnPropertyDescriptor(
|
|
384
|
+
function I(r) {
|
|
385
|
+
if (de.call(r, "key")) {
|
|
386
|
+
var o = Object.getOwnPropertyDescriptor(r, "key").get;
|
|
387
387
|
if (o && o.isReactWarning)
|
|
388
388
|
return !1;
|
|
389
389
|
}
|
|
390
|
-
return
|
|
390
|
+
return r.key !== void 0;
|
|
391
391
|
}
|
|
392
|
-
function he(
|
|
393
|
-
typeof
|
|
392
|
+
function he(r, o) {
|
|
393
|
+
typeof r.ref == "string" && Ie.current;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function ie(r, o) {
|
|
396
396
|
{
|
|
397
397
|
var c = function() {
|
|
398
|
-
|
|
398
|
+
Ue || (Ue = !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
|
-
c.isReactWarning = !0, Object.defineProperty(
|
|
400
|
+
c.isReactWarning = !0, Object.defineProperty(r, "key", {
|
|
401
401
|
get: c,
|
|
402
402
|
configurable: !0
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
|
-
function
|
|
406
|
+
function cr(r, o) {
|
|
407
407
|
{
|
|
408
408
|
var c = function() {
|
|
409
|
-
|
|
409
|
+
Te || (Te = !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
|
-
c.isReactWarning = !0, Object.defineProperty(
|
|
411
|
+
c.isReactWarning = !0, Object.defineProperty(r, "ref", {
|
|
412
412
|
get: c,
|
|
413
413
|
configurable: !0
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
var
|
|
418
|
-
var
|
|
417
|
+
var dr = function(r, o, c, v, F, A, k) {
|
|
418
|
+
var N = {
|
|
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
|
-
type:
|
|
422
|
+
type: r,
|
|
423
423
|
key: o,
|
|
424
424
|
ref: c,
|
|
425
425
|
props: k,
|
|
426
426
|
// Record the component responsible for creating this element.
|
|
427
|
-
_owner:
|
|
427
|
+
_owner: A
|
|
428
428
|
};
|
|
429
|
-
return
|
|
429
|
+
return N._store = {}, Object.defineProperty(N._store, "validated", {
|
|
430
430
|
configurable: !1,
|
|
431
431
|
enumerable: !1,
|
|
432
432
|
writable: !0,
|
|
433
433
|
value: !1
|
|
434
|
-
}), Object.defineProperty(
|
|
434
|
+
}), Object.defineProperty(N, "_self", {
|
|
435
435
|
configurable: !1,
|
|
436
436
|
enumerable: !1,
|
|
437
437
|
writable: !1,
|
|
438
|
-
value:
|
|
439
|
-
}), Object.defineProperty(
|
|
438
|
+
value: v
|
|
439
|
+
}), Object.defineProperty(N, "_source", {
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
443
|
value: F
|
|
444
|
-
}), Object.freeze && (Object.freeze(
|
|
444
|
+
}), Object.freeze && (Object.freeze(N.props), Object.freeze(N)), N;
|
|
445
445
|
};
|
|
446
|
-
function
|
|
446
|
+
function ur(r, o, c, v, F) {
|
|
447
447
|
{
|
|
448
|
-
var
|
|
449
|
-
c !== void 0 && ($e(c),
|
|
450
|
-
for (
|
|
451
|
-
|
|
452
|
-
if (
|
|
453
|
-
var
|
|
454
|
-
for (
|
|
455
|
-
k[
|
|
448
|
+
var A, k = {}, N = null, me = null;
|
|
449
|
+
c !== void 0 && ($e(c), N = "" + c), I(o) && ($e(o.key), N = "" + o.key), m(o) && (me = o.ref, he(o, F));
|
|
450
|
+
for (A in o)
|
|
451
|
+
de.call(o, A) && !He.hasOwnProperty(A) && (k[A] = o[A]);
|
|
452
|
+
if (r && r.defaultProps) {
|
|
453
|
+
var q = r.defaultProps;
|
|
454
|
+
for (A in q)
|
|
455
|
+
k[A] === void 0 && (k[A] = q[A]);
|
|
456
456
|
}
|
|
457
|
-
if (
|
|
458
|
-
var K = typeof
|
|
459
|
-
|
|
457
|
+
if (N || me) {
|
|
458
|
+
var K = typeof r == "function" ? r.displayName || r.name || "Unknown" : r;
|
|
459
|
+
N && ie(k, K), me && cr(k, K);
|
|
460
460
|
}
|
|
461
|
-
return
|
|
461
|
+
return dr(r, N, me, F, v, Ie.current, k);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
var
|
|
465
|
-
function Fe(
|
|
466
|
-
if (
|
|
467
|
-
var o =
|
|
468
|
-
|
|
464
|
+
var ze = C.ReactCurrentOwner, Ge = C.ReactDebugCurrentFrame;
|
|
465
|
+
function Fe(r) {
|
|
466
|
+
if (r) {
|
|
467
|
+
var o = r._owner, c = z(r.type, r._source, o ? o.type : null);
|
|
468
|
+
Ge.setExtraStackFrame(c);
|
|
469
469
|
} else
|
|
470
|
-
|
|
470
|
+
Ge.setExtraStackFrame(null);
|
|
471
471
|
}
|
|
472
472
|
var Le;
|
|
473
473
|
Le = !1;
|
|
474
|
-
function
|
|
475
|
-
return typeof
|
|
474
|
+
function ar(r) {
|
|
475
|
+
return typeof r == "object" && r !== null && r.$$typeof === t;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function mr() {
|
|
478
478
|
{
|
|
479
|
-
if (
|
|
480
|
-
var
|
|
481
|
-
if (
|
|
479
|
+
if (ze.current) {
|
|
480
|
+
var r = Y(ze.current.type);
|
|
481
|
+
if (r)
|
|
482
482
|
return `
|
|
483
483
|
|
|
484
|
-
Check the render method of \`` +
|
|
484
|
+
Check the render method of \`` + r + "`.";
|
|
485
485
|
}
|
|
486
486
|
return "";
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
function d(
|
|
489
|
+
function d(r) {
|
|
490
490
|
return "";
|
|
491
491
|
}
|
|
492
|
-
var
|
|
493
|
-
function
|
|
492
|
+
var H = {};
|
|
493
|
+
function V(r) {
|
|
494
494
|
{
|
|
495
|
-
var o =
|
|
495
|
+
var o = mr();
|
|
496
496
|
if (!o) {
|
|
497
|
-
var c = typeof
|
|
497
|
+
var c = typeof r == "string" ? r : r.displayName || r.name;
|
|
498
498
|
c && (o = `
|
|
499
499
|
|
|
500
500
|
Check the top-level render call using <` + c + ">.");
|
|
@@ -502,298 +502,342 @@ Check the top-level render call using <` + c + ">.");
|
|
|
502
502
|
return o;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
function L(
|
|
505
|
+
function L(r, o) {
|
|
506
506
|
{
|
|
507
|
-
if (!
|
|
507
|
+
if (!r._store || r._store.validated || r.key != null)
|
|
508
508
|
return;
|
|
509
|
-
|
|
510
|
-
var c =
|
|
511
|
-
if (
|
|
509
|
+
r._store.validated = !0;
|
|
510
|
+
var c = V(o);
|
|
511
|
+
if (H[c])
|
|
512
512
|
return;
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
|
|
513
|
+
H[c] = !0;
|
|
514
|
+
var v = "";
|
|
515
|
+
r && r._owner && r._owner !== ze.current && (v = " It was passed a child from " + Y(r._owner.type) + "."), Fe(r), 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, v), Fe(null);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Ee(r, o) {
|
|
519
519
|
{
|
|
520
|
-
if (typeof
|
|
520
|
+
if (typeof r != "object")
|
|
521
521
|
return;
|
|
522
|
-
if (Ve(
|
|
523
|
-
for (var c = 0; c <
|
|
524
|
-
var
|
|
525
|
-
|
|
522
|
+
if (Ve(r))
|
|
523
|
+
for (var c = 0; c < r.length; c++) {
|
|
524
|
+
var v = r[c];
|
|
525
|
+
ar(v) && L(v, o);
|
|
526
526
|
}
|
|
527
|
-
else if (
|
|
528
|
-
|
|
529
|
-
else if (
|
|
530
|
-
var F =
|
|
531
|
-
if (typeof F == "function" && F !==
|
|
532
|
-
for (var
|
|
533
|
-
|
|
527
|
+
else if (ar(r))
|
|
528
|
+
r._store && (r._store.validated = !0);
|
|
529
|
+
else if (r) {
|
|
530
|
+
var F = B(r);
|
|
531
|
+
if (typeof F == "function" && F !== r.entries)
|
|
532
|
+
for (var A = F.call(r), k; !(k = A.next()).done; )
|
|
533
|
+
ar(k.value) && L(k.value, o);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
537
|
-
function Me(
|
|
537
|
+
function Me(r) {
|
|
538
538
|
{
|
|
539
|
-
var o =
|
|
539
|
+
var o = r.type;
|
|
540
540
|
if (o == null || typeof o == "string")
|
|
541
541
|
return;
|
|
542
542
|
var c;
|
|
543
543
|
if (typeof o == "function")
|
|
544
544
|
c = o.propTypes;
|
|
545
|
-
else if (typeof o == "object" && (o.$$typeof ===
|
|
545
|
+
else if (typeof o == "object" && (o.$$typeof === p || // Note: Memo only checks outer props here.
|
|
546
546
|
// Inner props are checked in the reconciler.
|
|
547
|
-
o.$$typeof ===
|
|
547
|
+
o.$$typeof === b))
|
|
548
548
|
c = o.propTypes;
|
|
549
549
|
else
|
|
550
550
|
return;
|
|
551
551
|
if (c) {
|
|
552
|
-
var
|
|
553
|
-
Ae(c,
|
|
552
|
+
var v = Y(o);
|
|
553
|
+
Ae(c, r.props, "prop", v, r);
|
|
554
554
|
} else if (o.PropTypes !== void 0 && !Le) {
|
|
555
555
|
Le = !0;
|
|
556
|
-
var F =
|
|
557
|
-
|
|
556
|
+
var F = Y(o);
|
|
557
|
+
w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", F || "Unknown");
|
|
558
558
|
}
|
|
559
|
-
typeof o.getDefaultProps == "function" && !o.getDefaultProps.isReactClassApproved &&
|
|
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
|
-
function
|
|
562
|
+
function fr(r) {
|
|
563
563
|
{
|
|
564
|
-
for (var o = Object.keys(
|
|
565
|
-
var
|
|
566
|
-
if (
|
|
567
|
-
Fe(
|
|
564
|
+
for (var o = Object.keys(r.props), c = 0; c < o.length; c++) {
|
|
565
|
+
var v = o[c];
|
|
566
|
+
if (v !== "children" && v !== "key") {
|
|
567
|
+
Fe(r), w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", v), Fe(null);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
|
|
571
|
+
r.ref !== null && (Fe(r), w("Invalid attribute `ref` supplied to `React.Fragment`."), Fe(null));
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
|
-
var
|
|
575
|
-
function
|
|
574
|
+
var Nr = {};
|
|
575
|
+
function Cr(r, o, c, v, F, A) {
|
|
576
576
|
{
|
|
577
|
-
var k =
|
|
577
|
+
var k = g(r);
|
|
578
578
|
if (!k) {
|
|
579
|
-
var
|
|
580
|
-
(
|
|
579
|
+
var N = "";
|
|
580
|
+
(r === void 0 || typeof r == "object" && r !== null && Object.keys(r).length === 0) && (N += " 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
581
|
var me = d();
|
|
582
|
-
me ?
|
|
583
|
-
var
|
|
584
|
-
|
|
582
|
+
me ? N += me : N += mr();
|
|
583
|
+
var q;
|
|
584
|
+
r === null ? q = "null" : Ve(r) ? q = "array" : r !== void 0 && r.$$typeof === t ? (q = "<" + (Y(r.type) || "Unknown") + " />", N = " Did you accidentally export a JSX literal instead of a component?") : q = typeof r, w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", q, N);
|
|
585
585
|
}
|
|
586
|
-
var K =
|
|
586
|
+
var K = ur(r, o, c, F, A);
|
|
587
587
|
if (K == null)
|
|
588
588
|
return K;
|
|
589
589
|
if (k) {
|
|
590
590
|
var je = o.children;
|
|
591
591
|
if (je !== void 0)
|
|
592
|
-
if (
|
|
592
|
+
if (v)
|
|
593
593
|
if (Ve(je)) {
|
|
594
|
-
for (var
|
|
595
|
-
|
|
594
|
+
for (var Ke = 0; Ke < je.length; Ke++)
|
|
595
|
+
Ee(je[Ke], r);
|
|
596
596
|
Object.freeze && Object.freeze(je);
|
|
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.");
|
|
599
599
|
else
|
|
600
|
-
|
|
600
|
+
Ee(je, r);
|
|
601
601
|
}
|
|
602
|
-
if (
|
|
603
|
-
var
|
|
604
|
-
return
|
|
605
|
-
}),
|
|
606
|
-
if (!
|
|
607
|
-
var
|
|
608
|
-
|
|
602
|
+
if (de.call(o, "key")) {
|
|
603
|
+
var qe = Y(r), ye = Object.keys(o).filter(function(Qr) {
|
|
604
|
+
return Qr !== "key";
|
|
605
|
+
}), yr = ye.length > 0 ? "{key: someKey, " + ye.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
|
+
if (!Nr[qe + yr]) {
|
|
607
|
+
var Xr = ye.length > 0 ? "{" + ye.join(": ..., ") + ": ...}" : "{}";
|
|
608
|
+
w(`A props object containing a "key" prop is being spread into JSX:
|
|
609
609
|
let props = %s;
|
|
610
610
|
<%s {...props} />
|
|
611
611
|
React keys must be passed directly to JSX without using spread:
|
|
612
612
|
let props = %s;
|
|
613
|
-
<%s key={someKey} {...props} />`,
|
|
613
|
+
<%s key={someKey} {...props} />`, yr, qe, Xr, qe), Nr[qe + yr] = !0;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
return
|
|
616
|
+
return r === s ? fr(K) : Me(K), K;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function
|
|
620
|
-
return
|
|
619
|
+
function Gr(r, o, c) {
|
|
620
|
+
return Cr(r, o, c, !0);
|
|
621
621
|
}
|
|
622
|
-
function
|
|
623
|
-
return
|
|
622
|
+
function Kr(r, o, c) {
|
|
623
|
+
return Cr(r, o, c, !1);
|
|
624
624
|
}
|
|
625
|
-
var
|
|
626
|
-
|
|
627
|
-
}()),
|
|
625
|
+
var Jr = Kr, Zr = Gr;
|
|
626
|
+
sr.Fragment = s, sr.jsx = Jr, sr.jsxs = Zr;
|
|
627
|
+
}()), sr;
|
|
628
628
|
}
|
|
629
|
-
process.env.NODE_ENV === "production" ?
|
|
630
|
-
var a =
|
|
631
|
-
function
|
|
629
|
+
process.env.NODE_ENV === "production" ? wr.exports = at() : wr.exports = nt();
|
|
630
|
+
var a = wr.exports;
|
|
631
|
+
function Ur(e) {
|
|
632
632
|
var t, n, s = "";
|
|
633
|
-
if (typeof
|
|
634
|
-
else if (typeof
|
|
635
|
-
var i =
|
|
636
|
-
for (t = 0; t < i; t++)
|
|
637
|
-
} else for (n in
|
|
633
|
+
if (typeof e == "string" || typeof e == "number") s += e;
|
|
634
|
+
else if (typeof e == "object") if (Array.isArray(e)) {
|
|
635
|
+
var i = e.length;
|
|
636
|
+
for (t = 0; t < i; t++) e[t] && (n = Ur(e[t])) && (s && (s += " "), s += n);
|
|
637
|
+
} else for (n in e) e[n] && (s && (s += " "), s += n);
|
|
638
638
|
return s;
|
|
639
639
|
}
|
|
640
|
-
function
|
|
641
|
-
for (var
|
|
640
|
+
function re() {
|
|
641
|
+
for (var e, t, n = 0, s = "", i = arguments.length; n < i; n++) (e = arguments[n]) && (t = Ur(e)) && (s && (s += " "), s += t);
|
|
642
642
|
return s;
|
|
643
643
|
}
|
|
644
|
-
const
|
|
645
|
-
let
|
|
646
|
-
const
|
|
647
|
-
|
|
648
|
-
},
|
|
644
|
+
const st = "https://core.spreedly.com/iframe/iframe-v1.min.js", ot = "https://cdn.e2e.movmo.io";
|
|
645
|
+
let Ze = {};
|
|
646
|
+
const Zt = (e) => {
|
|
647
|
+
Ze = { ...Ze, ...e };
|
|
648
|
+
}, vr = (e) => {
|
|
649
649
|
var n;
|
|
650
650
|
const t = globalThis.process;
|
|
651
|
-
return (n = t == null ? void 0 : t.env) == null ? void 0 : n[
|
|
652
|
-
},
|
|
653
|
-
baseUrl:
|
|
654
|
-
spreedlyScriptUrl:
|
|
655
|
-
iconCdnBaseUrl:
|
|
656
|
-
fetch:
|
|
651
|
+
return (n = t == null ? void 0 : t.env) == null ? void 0 : n[e];
|
|
652
|
+
}, tr = () => ({
|
|
653
|
+
baseUrl: Ze.baseUrl ?? vr("REACT_APP_MOVMO_API_URL") ?? "",
|
|
654
|
+
spreedlyScriptUrl: Ze.spreedlyScriptUrl ?? vr("REACT_APP_SPREEDLY_SCRIPT_URL") ?? st,
|
|
655
|
+
iconCdnBaseUrl: Ze.iconCdnBaseUrl ?? vr("REACT_APP_MOVMO_ICON_CDN_URL") ?? ot,
|
|
656
|
+
fetch: Ze.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
|
-
}),
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
659
|
+
}), it = "recovery_cooldown", lt = (e, t) => {
|
|
660
|
+
if (!e) return "";
|
|
661
|
+
const n = new Date(e);
|
|
662
|
+
if (Number.isNaN(n.getTime())) return "";
|
|
663
|
+
try {
|
|
664
|
+
return new Intl.DateTimeFormat("en-US", {
|
|
665
|
+
month: "short",
|
|
666
|
+
day: "numeric",
|
|
667
|
+
year: "numeric",
|
|
668
|
+
hour: "numeric",
|
|
669
|
+
minute: "2-digit",
|
|
670
|
+
timeZone: t
|
|
671
|
+
}).format(n);
|
|
672
|
+
} catch {
|
|
673
|
+
return "";
|
|
674
|
+
}
|
|
675
|
+
}, ct = (e) => {
|
|
676
|
+
const t = lt(e ?? "");
|
|
677
|
+
return t ? `Account recovery is in progress. You can change payment methods after ${t}.` : "Account recovery is in progress. You can change payment methods once it ends.";
|
|
678
|
+
}, Er = (e) => ({
|
|
679
|
+
id: e.id,
|
|
680
|
+
last4: e.last4,
|
|
681
|
+
brand: e.brand,
|
|
682
|
+
expMonth: e.expMonth,
|
|
683
|
+
expYear: e.expYear,
|
|
684
|
+
isDefault: e.isDefault,
|
|
685
|
+
vault: e.vault,
|
|
686
|
+
cardholderName: e.cardholderName,
|
|
687
|
+
zip: e.zip
|
|
688
|
+
}), Xe = {
|
|
670
689
|
Accept: "application/json",
|
|
671
690
|
"Content-Type": "application/json"
|
|
672
|
-
},
|
|
673
|
-
const { baseUrl: t } =
|
|
691
|
+
}, Qe = (e) => {
|
|
692
|
+
const { baseUrl: t } = tr();
|
|
674
693
|
if (!t)
|
|
675
694
|
throw new Error(
|
|
676
695
|
"@movmo_app/payments: baseUrl is not configured. Call setPaymentsConfig({ baseUrl }) at app boot, or set REACT_APP_MOVMO_API_URL."
|
|
677
696
|
);
|
|
678
|
-
return `${t}${
|
|
679
|
-
},
|
|
680
|
-
const { fetch: n } =
|
|
681
|
-
return n(
|
|
682
|
-
}
|
|
697
|
+
return `${t}${e}`;
|
|
698
|
+
}, er = (e, t) => {
|
|
699
|
+
const { fetch: n } = tr();
|
|
700
|
+
return n(e, t);
|
|
701
|
+
};
|
|
702
|
+
class zr extends Error {
|
|
703
|
+
constructor(n, s) {
|
|
704
|
+
super(n);
|
|
705
|
+
Je(this, "status");
|
|
706
|
+
Je(this, "code");
|
|
707
|
+
Je(this, "until");
|
|
708
|
+
this.name = "PaymentsApiError", this.status = s.status, this.code = s.code, this.until = s.until;
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
const dt = async (e) => {
|
|
683
712
|
try {
|
|
684
|
-
|
|
713
|
+
const t = await e.json();
|
|
714
|
+
if (typeof t != "object" || t === null) return {};
|
|
715
|
+
const { message: n, code: s, until: i } = t;
|
|
716
|
+
return {
|
|
717
|
+
message: typeof n == "string" ? n : void 0,
|
|
718
|
+
code: typeof s == "string" ? s : void 0,
|
|
719
|
+
until: typeof i == "string" ? i : void 0
|
|
720
|
+
};
|
|
685
721
|
} catch {
|
|
686
|
-
return
|
|
722
|
+
return {};
|
|
687
723
|
}
|
|
724
|
+
}, rr = async (e, t) => {
|
|
725
|
+
const { message: n, code: s, until: i } = await dt(e), l = s === it ? ct(i) : n || t;
|
|
726
|
+
return new zr(l, { status: e.status, code: s, until: i });
|
|
688
727
|
};
|
|
689
|
-
let
|
|
728
|
+
let or = null;
|
|
690
729
|
const jr = () => {
|
|
691
|
-
if (
|
|
692
|
-
const
|
|
693
|
-
const t = await Qe(
|
|
730
|
+
if (or) return or;
|
|
731
|
+
const e = (async () => {
|
|
732
|
+
const t = await er(Qe("/v1/payments/tokenization-session"), {
|
|
694
733
|
method: "GET",
|
|
695
|
-
headers:
|
|
734
|
+
headers: Xe,
|
|
696
735
|
credentials: "include"
|
|
697
736
|
});
|
|
698
737
|
if (!t.ok)
|
|
699
|
-
throw
|
|
738
|
+
throw await rr(t, `Failed to fetch tokenization session (${t.status})`);
|
|
700
739
|
return await t.json();
|
|
701
740
|
})();
|
|
702
|
-
return
|
|
703
|
-
|
|
741
|
+
return or = e, e.finally(() => {
|
|
742
|
+
or === e && (or = null);
|
|
704
743
|
}).catch(() => {
|
|
705
|
-
}),
|
|
706
|
-
},
|
|
707
|
-
const s = await
|
|
708
|
-
|
|
744
|
+
}), e;
|
|
745
|
+
}, ut = (e) => typeof e.brand == "string" && typeof e.last4 == "string" && typeof e.expMonth == "number" && typeof e.expYear == "number", mt = async (e, t, n) => {
|
|
746
|
+
const s = await er(
|
|
747
|
+
Qe(`/v1/users/${encodeURIComponent(e)}/payment-methods/from-token`),
|
|
709
748
|
{
|
|
710
749
|
method: "POST",
|
|
711
|
-
headers:
|
|
750
|
+
headers: Xe,
|
|
712
751
|
credentials: "include",
|
|
713
752
|
body: JSON.stringify({ tokenizedPaymentMethodId: t, isDefault: n })
|
|
714
753
|
}
|
|
715
754
|
);
|
|
716
755
|
if (!s.ok)
|
|
717
|
-
throw
|
|
756
|
+
throw await rr(s, `Failed to save payment method (${s.status})`);
|
|
718
757
|
const i = await s.json();
|
|
719
|
-
if (
|
|
720
|
-
return
|
|
721
|
-
const l = await
|
|
722
|
-
|
|
723
|
-
`/v1/users/${encodeURIComponent(
|
|
758
|
+
if (ut(i))
|
|
759
|
+
return Er(i);
|
|
760
|
+
const l = await er(
|
|
761
|
+
Qe(
|
|
762
|
+
`/v1/users/${encodeURIComponent(e)}/payment-methods/${encodeURIComponent(i.id)}`
|
|
724
763
|
),
|
|
725
764
|
{
|
|
726
765
|
method: "GET",
|
|
727
|
-
headers:
|
|
766
|
+
headers: Xe,
|
|
728
767
|
credentials: "include"
|
|
729
768
|
}
|
|
730
769
|
);
|
|
731
770
|
if (!l.ok)
|
|
732
|
-
throw
|
|
733
|
-
await er(l, `Failed to fetch saved payment method (${l.status})`)
|
|
734
|
-
);
|
|
771
|
+
throw await rr(l, `Failed to fetch saved payment method (${l.status})`);
|
|
735
772
|
const u = await l.json();
|
|
736
|
-
return
|
|
737
|
-
},
|
|
738
|
-
if (!
|
|
739
|
-
const n = await
|
|
740
|
-
|
|
773
|
+
return Er(u);
|
|
774
|
+
}, ft = async (e, t) => {
|
|
775
|
+
if (!e) return [];
|
|
776
|
+
const n = await er(
|
|
777
|
+
Qe(`/v1/users/${encodeURIComponent(e)}/payment-methods`),
|
|
741
778
|
{
|
|
742
779
|
method: "GET",
|
|
743
|
-
headers:
|
|
780
|
+
headers: Xe,
|
|
744
781
|
credentials: "include",
|
|
745
782
|
signal: t
|
|
746
783
|
}
|
|
747
784
|
);
|
|
748
785
|
if (!n.ok)
|
|
749
|
-
throw
|
|
750
|
-
return (await n.json() ?? []).map(
|
|
751
|
-
},
|
|
752
|
-
const n = await
|
|
753
|
-
|
|
754
|
-
`/v1/users/${encodeURIComponent(
|
|
786
|
+
throw await rr(n, `Failed to fetch payment methods (${n.status})`);
|
|
787
|
+
return (await n.json() ?? []).map(Er);
|
|
788
|
+
}, pt = async (e, t) => {
|
|
789
|
+
const n = await er(
|
|
790
|
+
Qe(
|
|
791
|
+
`/v1/users/${encodeURIComponent(e)}/payment-methods/${encodeURIComponent(t)}`
|
|
755
792
|
),
|
|
756
793
|
{
|
|
757
794
|
method: "DELETE",
|
|
758
|
-
headers:
|
|
795
|
+
headers: Xe,
|
|
759
796
|
credentials: "include"
|
|
760
797
|
}
|
|
761
798
|
);
|
|
762
799
|
if (!n.ok)
|
|
763
|
-
throw
|
|
764
|
-
},
|
|
765
|
-
const s = await
|
|
766
|
-
|
|
767
|
-
`/v1/users/${encodeURIComponent(
|
|
800
|
+
throw await rr(n, `Failed to delete payment method (${n.status})`);
|
|
801
|
+
}, Lr = async (e, t, n) => {
|
|
802
|
+
const s = await er(
|
|
803
|
+
Qe(
|
|
804
|
+
`/v1/users/${encodeURIComponent(e)}/payment-methods/${encodeURIComponent(t)}`
|
|
768
805
|
),
|
|
769
806
|
{
|
|
770
807
|
method: "PUT",
|
|
771
|
-
headers:
|
|
808
|
+
headers: Xe,
|
|
772
809
|
credentials: "include",
|
|
773
810
|
body: JSON.stringify(n)
|
|
774
811
|
}
|
|
775
812
|
);
|
|
776
813
|
if (!s.ok)
|
|
777
|
-
throw
|
|
778
|
-
},
|
|
814
|
+
throw await rr(s, `Failed to update payment method (${s.status})`);
|
|
815
|
+
}, lr = (e, t, n) => t instanceof zr ? {
|
|
816
|
+
source: e,
|
|
817
|
+
message: t.message,
|
|
818
|
+
cause: t,
|
|
819
|
+
status: t.status,
|
|
820
|
+
...t.code !== void 0 ? { code: t.code } : {},
|
|
821
|
+
...t.until !== void 0 ? { until: t.until } : {}
|
|
822
|
+
} : { source: e, message: t instanceof Error ? t.message : n, cause: t }, ht = {
|
|
779
823
|
visa: "visa",
|
|
780
824
|
master: "mastercard",
|
|
781
825
|
mastercard: "mastercard",
|
|
782
826
|
american_express: "amex",
|
|
783
827
|
amex: "amex",
|
|
784
828
|
discover: "discover"
|
|
785
|
-
},
|
|
786
|
-
brand:
|
|
829
|
+
}, yt = 28, Ye = ({
|
|
830
|
+
brand: e,
|
|
787
831
|
className: t,
|
|
788
832
|
width: n = 46
|
|
789
833
|
}) => {
|
|
790
|
-
const s =
|
|
834
|
+
const s = e ? ht[e.toLowerCase()] ?? "credit-card" : "credit-card", i = Math.max(n, yt), l = Math.round(i * 24 / 34), { iconCdnBaseUrl: u } = tr();
|
|
791
835
|
return /* @__PURE__ */ a.jsx(
|
|
792
836
|
"img",
|
|
793
837
|
{
|
|
794
838
|
src: `${u}/website/assets/icons/payments/${s}.svg`,
|
|
795
839
|
alt: s === "credit-card" ? "card" : `${s} card`,
|
|
796
|
-
"data-testid": `card-brand-${
|
|
840
|
+
"data-testid": `card-brand-${e.toLowerCase()}`,
|
|
797
841
|
className: t,
|
|
798
842
|
width: i,
|
|
799
843
|
height: l,
|
|
@@ -801,18 +845,18 @@ const jr = () => {
|
|
|
801
845
|
}
|
|
802
846
|
);
|
|
803
847
|
};
|
|
804
|
-
let
|
|
805
|
-
const
|
|
848
|
+
let ir = null;
|
|
849
|
+
const vt = () => {
|
|
806
850
|
if (typeof window > "u")
|
|
807
851
|
return Promise.reject(new Error("Spreedly can only be loaded in a browser environment."));
|
|
808
852
|
if (window.Spreedly)
|
|
809
853
|
return Promise.resolve(window.Spreedly);
|
|
810
|
-
if (
|
|
811
|
-
return
|
|
812
|
-
const { spreedlyScriptUrl:
|
|
813
|
-
return
|
|
854
|
+
if (ir)
|
|
855
|
+
return ir;
|
|
856
|
+
const { spreedlyScriptUrl: e } = tr();
|
|
857
|
+
return ir = new Promise((t, n) => {
|
|
814
858
|
const s = document.querySelector(
|
|
815
|
-
`script[src="${
|
|
859
|
+
`script[src="${e}"]`
|
|
816
860
|
), i = () => {
|
|
817
861
|
window.Spreedly ? t(window.Spreedly) : n(new Error("Spreedly script loaded but window.Spreedly is undefined."));
|
|
818
862
|
};
|
|
@@ -831,346 +875,348 @@ const ut = () => {
|
|
|
831
875
|
return;
|
|
832
876
|
}
|
|
833
877
|
const l = document.createElement("script");
|
|
834
|
-
l.src =
|
|
878
|
+
l.src = e, l.async = !0, l.onload = i, l.onerror = () => {
|
|
835
879
|
l.remove(), n(new Error("Failed to load Spreedly iframe script."));
|
|
836
880
|
}, document.head.appendChild(l);
|
|
837
881
|
}).catch((t) => {
|
|
838
|
-
throw
|
|
839
|
-
}),
|
|
882
|
+
throw ir = null, t;
|
|
883
|
+
}), ir;
|
|
840
884
|
};
|
|
841
|
-
class
|
|
885
|
+
class pr extends Error {
|
|
842
886
|
constructor(n, s) {
|
|
843
887
|
super(s instanceof Error ? s.message : "Failed to initialize card form.");
|
|
844
|
-
|
|
888
|
+
Je(this, "source");
|
|
845
889
|
// Re-declared (vs. relying on the lib's ES2022 `Error.cause`) so the field is
|
|
846
890
|
// always present on the type regardless of the consuming app's tsconfig `lib`.
|
|
847
|
-
|
|
891
|
+
Je(this, "cause");
|
|
848
892
|
this.name = "InitError", this.source = n, this.cause = s;
|
|
849
893
|
}
|
|
850
894
|
}
|
|
851
|
-
const
|
|
852
|
-
first_name:
|
|
853
|
-
last_name:
|
|
854
|
-
month:
|
|
855
|
-
year:
|
|
856
|
-
...
|
|
857
|
-
...
|
|
858
|
-
}),
|
|
895
|
+
const xt = "movmo-card-number", gt = "movmo-card-cvv", bt = (e) => ({
|
|
896
|
+
first_name: e.firstName,
|
|
897
|
+
last_name: e.lastName,
|
|
898
|
+
month: e.month,
|
|
899
|
+
year: e.year,
|
|
900
|
+
...e.email ? { email: e.email } : {},
|
|
901
|
+
...e.zip ? { zip: e.zip } : {}
|
|
902
|
+
}), wt = (e = {}) => {
|
|
859
903
|
const {
|
|
860
|
-
numberEl: t =
|
|
861
|
-
cvvEl: n =
|
|
904
|
+
numberEl: t = xt,
|
|
905
|
+
cvvEl: n = gt,
|
|
862
906
|
onCardTokenized: s,
|
|
863
907
|
onFieldErrors: i,
|
|
864
908
|
onValidityChange: l,
|
|
865
909
|
onBrandChange: u
|
|
866
|
-
} =
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
}, [s]),
|
|
910
|
+
} = e, [y, p] = R("idle"), [E, j] = R(null), [b, _] = R(null), [x, P] = R(null), [$, B] = R({ number: !1, cvv: !1 }), [C, w] = R(null), [W, ve] = R({ number: !1, cvv: !1 }), fe = U(null), _e = U(s), pe = U(i), le = U(l), te = U(u);
|
|
911
|
+
O(() => {
|
|
912
|
+
_e.current = s;
|
|
913
|
+
}, [s]), O(() => {
|
|
870
914
|
pe.current = i;
|
|
871
|
-
}, [i]),
|
|
872
|
-
|
|
873
|
-
}, [l]),
|
|
874
|
-
|
|
915
|
+
}, [i]), O(() => {
|
|
916
|
+
le.current = l;
|
|
917
|
+
}, [l]), O(() => {
|
|
918
|
+
te.current = u;
|
|
875
919
|
}, [u]);
|
|
876
|
-
const
|
|
877
|
-
|
|
878
|
-
let
|
|
879
|
-
return
|
|
920
|
+
const g = U({ number: !1, cvv: !1 });
|
|
921
|
+
O(() => {
|
|
922
|
+
let Y = !1;
|
|
923
|
+
return p("loading"), j(null), _(null), P(null), B({ number: !1, cvv: !1 }), w(null), g.current = { number: !1, cvv: !1 }, (async () => {
|
|
880
924
|
try {
|
|
881
|
-
const [
|
|
882
|
-
jr().catch((
|
|
883
|
-
throw new
|
|
925
|
+
const [f, h] = await Promise.all([
|
|
926
|
+
jr().catch((S) => {
|
|
927
|
+
throw new pr("tokenization-session", S);
|
|
884
928
|
}),
|
|
885
|
-
|
|
886
|
-
throw new
|
|
929
|
+
vt().catch((S) => {
|
|
930
|
+
throw new pr("spreedly-script", S);
|
|
887
931
|
})
|
|
888
932
|
]);
|
|
889
|
-
if (
|
|
890
|
-
fe.current =
|
|
891
|
-
var
|
|
892
|
-
if (!
|
|
893
|
-
|
|
933
|
+
if (Y) return;
|
|
934
|
+
fe.current = h, h.on("ready", () => {
|
|
935
|
+
var S, M, se, oe, J, Z;
|
|
936
|
+
if (!Y) {
|
|
937
|
+
p("ready");
|
|
894
938
|
try {
|
|
895
|
-
(
|
|
939
|
+
(S = h.setFieldType) == null || S.call(h, "number", "tel"), (M = h.setFieldType) == null || M.call(h, "cvv", "tel");
|
|
896
940
|
} catch (G) {
|
|
897
941
|
console.warn("@movmo_app/payments: setFieldType failed", G);
|
|
898
942
|
}
|
|
899
943
|
try {
|
|
900
|
-
typeof
|
|
944
|
+
typeof h.setNumberFormat == "function" ? h.setNumberFormat("prettyFormat") : console.warn(
|
|
901
945
|
"@movmo_app/payments: Spreedly.setNumberFormat is missing — card-number digits will not be space-grouped."
|
|
902
946
|
);
|
|
903
947
|
} catch (G) {
|
|
904
948
|
console.warn("@movmo_app/payments: setNumberFormat failed", G);
|
|
905
949
|
}
|
|
906
950
|
try {
|
|
907
|
-
(
|
|
951
|
+
(se = h.setPlaceholder) == null || se.call(h, "number", "Card number"), (oe = h.setPlaceholder) == null || oe.call(h, "cvv", "CVV");
|
|
908
952
|
const G = '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;';
|
|
909
|
-
(
|
|
953
|
+
(J = h.setStyle) == null || J.call(h, "number", G), (Z = h.setStyle) == null || Z.call(h, "cvv", G);
|
|
910
954
|
} catch (G) {
|
|
911
955
|
console.warn("@movmo_app/payments: setPlaceholder/setStyle failed", G);
|
|
912
956
|
}
|
|
913
957
|
}
|
|
914
|
-
}),
|
|
915
|
-
var
|
|
916
|
-
(
|
|
917
|
-
}),
|
|
918
|
-
var
|
|
919
|
-
(
|
|
920
|
-
}),
|
|
958
|
+
}), h.on("paymentMethod", (S) => {
|
|
959
|
+
var M;
|
|
960
|
+
(M = _e.current) == null || M.call(_e, S);
|
|
961
|
+
}), h.on("errors", (S) => {
|
|
962
|
+
var M;
|
|
963
|
+
(M = pe.current) == null || M.call(pe, S);
|
|
964
|
+
}), h.on("fieldEvent", (S, M, se, oe) => {
|
|
921
965
|
var G;
|
|
922
|
-
if (
|
|
923
|
-
if (
|
|
924
|
-
ve((
|
|
966
|
+
if (Y) return;
|
|
967
|
+
if (M === "focus") {
|
|
968
|
+
ve((T) => T[S] ? T : { ...T, [S]: !0 });
|
|
925
969
|
return;
|
|
926
970
|
}
|
|
927
|
-
if (
|
|
928
|
-
ve((
|
|
971
|
+
if (M === "blur") {
|
|
972
|
+
ve((T) => T[S] ? { ...T, [S]: !1 } : T);
|
|
929
973
|
return;
|
|
930
974
|
}
|
|
931
|
-
if (
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
if (
|
|
935
|
-
|
|
936
|
-
var
|
|
937
|
-
return
|
|
975
|
+
if (M !== "input") return;
|
|
976
|
+
const J = oe ?? {};
|
|
977
|
+
if (S === "number") {
|
|
978
|
+
if (J.numberLength === 0)
|
|
979
|
+
w((T) => {
|
|
980
|
+
var X;
|
|
981
|
+
return T !== null && ((X = te.current) == null || X.call(te, null)), null;
|
|
938
982
|
});
|
|
939
|
-
else if (
|
|
940
|
-
const
|
|
941
|
-
|
|
942
|
-
var
|
|
943
|
-
return
|
|
983
|
+
else if (J.cardType !== void 0) {
|
|
984
|
+
const T = J.cardType || null;
|
|
985
|
+
w((X) => {
|
|
986
|
+
var ke;
|
|
987
|
+
return X !== T && ((ke = te.current) == null || ke.call(te, T)), T;
|
|
944
988
|
});
|
|
945
989
|
}
|
|
946
990
|
}
|
|
947
|
-
const
|
|
948
|
-
if (typeof
|
|
949
|
-
const
|
|
950
|
-
(
|
|
991
|
+
const Z = S === "number" ? typeof J.validNumber == "boolean" ? J.validNumber : void 0 : typeof J.validCvv == "boolean" ? J.validCvv : void 0;
|
|
992
|
+
if (typeof Z == "boolean") {
|
|
993
|
+
const T = g.current, X = S === "number" ? { ...T, number: Z } : { ...T, cvv: Z };
|
|
994
|
+
(X.number !== T.number || X.cvv !== T.cvv) && (g.current = X, B(X), (G = le.current) == null || G.call(le, X));
|
|
951
995
|
}
|
|
952
|
-
}),
|
|
953
|
-
var
|
|
954
|
-
const
|
|
955
|
-
(
|
|
956
|
-
}),
|
|
996
|
+
}), h.on("consoleError", (S) => {
|
|
997
|
+
var se;
|
|
998
|
+
const M = S instanceof Error ? S.message : "An unexpected error occurred while securing your card.";
|
|
999
|
+
(se = pe.current) == null || se.call(pe, [{ message: M }]);
|
|
1000
|
+
}), h.init(f.environmentKey, {
|
|
957
1001
|
numberEl: t,
|
|
958
1002
|
cvvEl: n,
|
|
959
|
-
nonce:
|
|
960
|
-
timestamp: String(
|
|
961
|
-
certificateToken:
|
|
962
|
-
signature:
|
|
1003
|
+
nonce: f.nonce,
|
|
1004
|
+
timestamp: String(f.timestamp),
|
|
1005
|
+
certificateToken: f.certificateToken,
|
|
1006
|
+
signature: f.signature
|
|
963
1007
|
});
|
|
964
|
-
} catch (
|
|
965
|
-
if (
|
|
966
|
-
const
|
|
967
|
-
|
|
1008
|
+
} catch (f) {
|
|
1009
|
+
if (Y) return;
|
|
1010
|
+
const h = f instanceof Error ? f.message : "Failed to initialize card form.";
|
|
1011
|
+
j(h), _(f instanceof pr ? f.source : "spreedly-script"), P(f instanceof pr ? f.cause : f), p("error");
|
|
968
1012
|
}
|
|
969
1013
|
})(), () => {
|
|
970
|
-
var
|
|
971
|
-
|
|
1014
|
+
var f, h;
|
|
1015
|
+
Y = !0;
|
|
972
1016
|
try {
|
|
973
|
-
(
|
|
974
|
-
} catch (
|
|
975
|
-
console.warn("@movmo_app/payments: removeHandlers failed during cleanup",
|
|
1017
|
+
(h = (f = fe.current) == null ? void 0 : f.removeHandlers) == null || h.call(f);
|
|
1018
|
+
} catch (S) {
|
|
1019
|
+
console.warn("@movmo_app/payments: removeHandlers failed during cleanup", S);
|
|
976
1020
|
}
|
|
977
1021
|
fe.current = null;
|
|
978
1022
|
};
|
|
979
1023
|
}, [t, n]);
|
|
980
|
-
const ge =
|
|
981
|
-
var
|
|
982
|
-
(
|
|
983
|
-
}, []),
|
|
984
|
-
var
|
|
985
|
-
(
|
|
1024
|
+
const ge = D((Y) => {
|
|
1025
|
+
var f;
|
|
1026
|
+
(f = fe.current) == null || f.tokenizeCreditCard(bt(Y));
|
|
1027
|
+
}, []), Re = D((Y) => {
|
|
1028
|
+
var f, h;
|
|
1029
|
+
(h = (f = fe.current) == null ? void 0 : f.transferFocus) == null || h.call(f, Y);
|
|
986
1030
|
}, []);
|
|
987
|
-
return { status:
|
|
988
|
-
},
|
|
1031
|
+
return { status: y, error: E, errorSource: b, errorCause: x, tokenize: ge, validity: $, brand: C, focused: W, focusField: Re };
|
|
1032
|
+
}, _r = {
|
|
989
1033
|
number: "Enter your card number",
|
|
990
1034
|
expiry: "Enter a valid expiry date",
|
|
991
1035
|
cvv: "Enter the security code",
|
|
992
1036
|
zip: "Enter your postal code",
|
|
993
1037
|
name: "Enter first and last name as printed on the card"
|
|
994
|
-
},
|
|
995
|
-
const t =
|
|
1038
|
+
}, Et = "Your card saves automatically once all fields are complete.", Br = (e) => /^[A-Za-z0-9][A-Za-z0-9 -]{1,8}[A-Za-z0-9]$/.test(e.trim()), Yr = (e) => {
|
|
1039
|
+
const t = e.replace(/[^A-Za-z0-9 -]/g, "").slice(0, 10);
|
|
996
1040
|
if (!/^[\d-]*$/.test(t)) return t;
|
|
997
1041
|
const n = t.replace(/-+/g, "-").replace(/^-/, "");
|
|
998
1042
|
return n.includes("-") ? n : n.length === 9 ? `${n.slice(0, 5)}-${n.slice(5)}` : n;
|
|
999
|
-
},
|
|
1000
|
-
hookStatus:
|
|
1043
|
+
}, jt = ({
|
|
1044
|
+
hookStatus: e,
|
|
1001
1045
|
validity: t,
|
|
1002
1046
|
nameValid: n,
|
|
1003
1047
|
expiryValid: s,
|
|
1004
1048
|
zipValid: i
|
|
1005
1049
|
}) => {
|
|
1006
|
-
const l =
|
|
1007
|
-
return l && !t.number &&
|
|
1008
|
-
},
|
|
1050
|
+
const l = e === "ready", u = [], y = (p) => u.push({ field: p, message: _r[p] });
|
|
1051
|
+
return l && !t.number && y("number"), s || y("expiry"), l && !t.cvv && y("cvv"), i || y("zip"), n || y("name"), u;
|
|
1052
|
+
}, xr = "h-11 w-full rounded-md border 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]", Sr = "flex h-11 w-full items-center gap-2 rounded-md border bg-white px-3 py-2 transition-shadow", Pr = "border-grayWarm-950 shadow-[0_0_0_1px_#1c1917]", Tr = "border-grayWarm-300", Fr = "border-error-500", _t = {
|
|
1009
1053
|
number: !1,
|
|
1010
1054
|
expiry: !1,
|
|
1011
1055
|
cvv: !1,
|
|
1012
1056
|
zip: !1,
|
|
1013
1057
|
name: !1
|
|
1014
|
-
},
|
|
1015
|
-
const t =
|
|
1058
|
+
}, Nt = (e) => {
|
|
1059
|
+
const t = e.trim();
|
|
1016
1060
|
if (!t) return { firstName: "", lastName: "" };
|
|
1017
1061
|
const n = t.lastIndexOf(" ");
|
|
1018
1062
|
return n === -1 ? { firstName: t, lastName: "" } : {
|
|
1019
1063
|
firstName: t.slice(0, n).trim(),
|
|
1020
1064
|
lastName: t.slice(n + 1).trim()
|
|
1021
1065
|
};
|
|
1022
|
-
},
|
|
1023
|
-
const t =
|
|
1066
|
+
}, Vr = (e) => {
|
|
1067
|
+
const t = e.replace(/\D/g, "");
|
|
1024
1068
|
if (t.length < 4) return { month: "", year: "" };
|
|
1025
1069
|
const n = t.slice(0, 2), s = t.slice(2), i = s.length === 2 ? `20${s}` : s.slice(0, 4);
|
|
1026
1070
|
return { month: n, year: i };
|
|
1027
|
-
},
|
|
1028
|
-
const t =
|
|
1071
|
+
}, Ct = (e) => {
|
|
1072
|
+
const t = e.replace(/\D/g, "").slice(0, 4);
|
|
1029
1073
|
return t.length <= 2 ? t : `${t.slice(0, 2)} / ${t.slice(2)}`;
|
|
1030
|
-
},
|
|
1031
|
-
const { month: t, year: n } =
|
|
1074
|
+
}, gr = (e) => {
|
|
1075
|
+
const { month: t, year: n } = Vr(e);
|
|
1032
1076
|
if (!t || !n) return !1;
|
|
1033
1077
|
const s = parseInt(t, 10), i = parseInt(n, 10);
|
|
1034
1078
|
if (isNaN(s) || s < 1 || s > 12) return !1;
|
|
1035
1079
|
const l = /* @__PURE__ */ new Date();
|
|
1036
1080
|
return !(i < l.getFullYear() || i > l.getFullYear() + 20 || i === l.getFullYear() && s < l.getMonth() + 1);
|
|
1037
|
-
},
|
|
1038
|
-
userId:
|
|
1081
|
+
}, Hr = ({
|
|
1082
|
+
userId: e,
|
|
1039
1083
|
onSuccess: t,
|
|
1040
1084
|
onError: n,
|
|
1041
1085
|
onErrorDetail: s,
|
|
1042
1086
|
isDefault: i = !1,
|
|
1043
1087
|
className: l,
|
|
1044
1088
|
defaultCardholderName: u,
|
|
1045
|
-
defaultCardholderFirstName:
|
|
1046
|
-
defaultCardholderLastName:
|
|
1047
|
-
autoSave:
|
|
1048
|
-
formId:
|
|
1049
|
-
hideInternalSaveButton:
|
|
1050
|
-
onCanSubmitChange:
|
|
1051
|
-
onSavingChange:
|
|
1052
|
-
autoFocus:
|
|
1053
|
-
onValidationChange:
|
|
1089
|
+
defaultCardholderFirstName: y = "",
|
|
1090
|
+
defaultCardholderLastName: p = "",
|
|
1091
|
+
autoSave: E = !1,
|
|
1092
|
+
formId: j = "movmo-card-form",
|
|
1093
|
+
hideInternalSaveButton: b = !1,
|
|
1094
|
+
onCanSubmitChange: _,
|
|
1095
|
+
onSavingChange: x,
|
|
1096
|
+
autoFocus: P,
|
|
1097
|
+
onValidationChange: $
|
|
1054
1098
|
}) => {
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
|
|
1099
|
+
const B = u ?? [y, p].filter(Boolean).join(" "), [C, w] = R(B), [W, ve] = R(""), [fe, _e] = R(""), [pe, le] = R("idle"), te = U(!1), g = U(s);
|
|
1100
|
+
O(() => {
|
|
1101
|
+
g.current = s;
|
|
1058
1102
|
}, [s]);
|
|
1059
|
-
const ge =
|
|
1060
|
-
async (
|
|
1061
|
-
var
|
|
1062
|
-
|
|
1103
|
+
const ge = D(
|
|
1104
|
+
async (m) => {
|
|
1105
|
+
var I;
|
|
1106
|
+
le("saving");
|
|
1063
1107
|
try {
|
|
1064
|
-
const he = await
|
|
1065
|
-
|
|
1108
|
+
const he = await mt(e, m, i);
|
|
1109
|
+
le("ready"), t(he);
|
|
1066
1110
|
} catch (he) {
|
|
1067
|
-
const
|
|
1068
|
-
|
|
1111
|
+
const ie = he instanceof Error ? he.message : "Failed to save payment method.";
|
|
1112
|
+
le("ready"), te.current = !1, n(ie), (I = g.current) == null || I.call(g, {
|
|
1113
|
+
...lr("save-from-token", he, ie),
|
|
1114
|
+
message: ie
|
|
1115
|
+
});
|
|
1069
1116
|
}
|
|
1070
1117
|
},
|
|
1071
|
-
[
|
|
1072
|
-
),
|
|
1073
|
-
(
|
|
1118
|
+
[e, i, t, n]
|
|
1119
|
+
), Re = D(
|
|
1120
|
+
(m) => {
|
|
1074
1121
|
var he;
|
|
1075
|
-
const
|
|
1076
|
-
|
|
1122
|
+
const I = m.map((ie) => ie.message).filter(Boolean).join("; ") || "Card validation failed.";
|
|
1123
|
+
le((ie) => ie === "tokenizing" ? "ready" : ie), te.current = !1, n(I), (he = g.current) == null || he.call(g, { source: "card-tokenize", message: I });
|
|
1077
1124
|
},
|
|
1078
1125
|
[n]
|
|
1079
|
-
),
|
|
1126
|
+
), Y = Be(
|
|
1080
1127
|
() => ({
|
|
1081
1128
|
onCardTokenized: ge,
|
|
1082
|
-
onFieldErrors:
|
|
1129
|
+
onFieldErrors: Re
|
|
1083
1130
|
}),
|
|
1084
|
-
[ge,
|
|
1131
|
+
[ge, Re]
|
|
1085
1132
|
), {
|
|
1086
|
-
status:
|
|
1087
|
-
error:
|
|
1088
|
-
errorSource:
|
|
1089
|
-
errorCause:
|
|
1090
|
-
tokenize:
|
|
1133
|
+
status: f,
|
|
1134
|
+
error: h,
|
|
1135
|
+
errorSource: S,
|
|
1136
|
+
errorCause: M,
|
|
1137
|
+
tokenize: se,
|
|
1091
1138
|
validity: oe,
|
|
1092
|
-
brand:
|
|
1093
|
-
focused:
|
|
1139
|
+
brand: J,
|
|
1140
|
+
focused: Z,
|
|
1094
1141
|
focusField: G
|
|
1095
|
-
} =
|
|
1096
|
-
|
|
1097
|
-
!
|
|
1098
|
-
}, [
|
|
1099
|
-
const
|
|
1100
|
-
(
|
|
1142
|
+
} = wt(Y), T = U(!1);
|
|
1143
|
+
O(() => {
|
|
1144
|
+
!P || f !== "ready" || T.current || (T.current = !0, G(P));
|
|
1145
|
+
}, [P, f, G]);
|
|
1146
|
+
const X = C.trim().split(/\s+/).length >= 2, ke = gr(W), be = Br(fe), [Q, Ne] = R(_t), ee = D(
|
|
1147
|
+
(m) => Ne((I) => I[m] ? I : { ...I, [m]: !0 }),
|
|
1101
1148
|
[]
|
|
1102
|
-
), We =
|
|
1103
|
-
|
|
1104
|
-
const
|
|
1105
|
-
We.current =
|
|
1106
|
-
}, [
|
|
1107
|
-
const
|
|
1108
|
-
() =>
|
|
1109
|
-
[
|
|
1110
|
-
),
|
|
1111
|
-
() =>
|
|
1112
|
-
[
|
|
1113
|
-
),
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
}, [
|
|
1117
|
-
var
|
|
1118
|
-
(
|
|
1119
|
-
valid:
|
|
1120
|
-
missing:
|
|
1149
|
+
), We = U(Z);
|
|
1150
|
+
O(() => {
|
|
1151
|
+
const m = We.current;
|
|
1152
|
+
We.current = Z, m.number && !Z.number && ee("number"), m.cvv && !Z.cvv && ee("cvv");
|
|
1153
|
+
}, [Z, ee]);
|
|
1154
|
+
const Se = Be(
|
|
1155
|
+
() => jt({ hookStatus: f, validity: oe, nameValid: X, expiryValid: ke, zipValid: be }),
|
|
1156
|
+
[f, oe, X, ke, be]
|
|
1157
|
+
), ce = (m) => Se.some((I) => I.field === m), ae = Be(() => Se.map((m) => m.field), [Se]), Oe = Be(
|
|
1158
|
+
() => ae.filter((m) => Q[m]),
|
|
1159
|
+
[ae, Q]
|
|
1160
|
+
), z = U($);
|
|
1161
|
+
O(() => {
|
|
1162
|
+
z.current = $;
|
|
1163
|
+
}, [$]), O(() => {
|
|
1164
|
+
var m;
|
|
1165
|
+
(m = z.current) == null || m.call(z, {
|
|
1166
|
+
valid: ae.length === 0,
|
|
1167
|
+
missing: ae,
|
|
1121
1168
|
touchedInvalid: Oe
|
|
1122
1169
|
});
|
|
1123
|
-
}, [
|
|
1124
|
-
const
|
|
1125
|
-
(
|
|
1126
|
-
),
|
|
1127
|
-
|
|
1128
|
-
var
|
|
1129
|
-
oe.cvv ? Ae.current || (Ae.current = !0, (
|
|
1170
|
+
}, [ae, Oe]);
|
|
1171
|
+
const de = Q.number && ce("number"), Pe = Q.name && ce("name"), ne = Se.find(
|
|
1172
|
+
(m) => (m.field === "expiry" || m.field === "cvv" || m.field === "zip") && Q[m.field]
|
|
1173
|
+
), Ce = U(!1), Ae = U(!1), xe = U(null);
|
|
1174
|
+
O(() => {
|
|
1175
|
+
var m;
|
|
1176
|
+
oe.cvv ? Ae.current || (Ae.current = !0, (m = xe.current) == null || m.focus()) : Ae.current = !1;
|
|
1130
1177
|
}, [oe.cvv]);
|
|
1131
|
-
const Ve = !
|
|
1132
|
-
|
|
1133
|
-
De.current =
|
|
1134
|
-
}, [
|
|
1135
|
-
var
|
|
1136
|
-
(
|
|
1137
|
-
}, [
|
|
1138
|
-
const $e =
|
|
1139
|
-
|
|
1140
|
-
$e.current =
|
|
1141
|
-
}, [
|
|
1142
|
-
var
|
|
1143
|
-
(
|
|
1178
|
+
const Ve = !X || !ke || !be || !oe.number || !oe.cvv, we = pe === "tokenizing" || pe === "saving", ue = f === "ready" && !we && !Ve, De = U(_);
|
|
1179
|
+
O(() => {
|
|
1180
|
+
De.current = _;
|
|
1181
|
+
}, [_]), O(() => {
|
|
1182
|
+
var m;
|
|
1183
|
+
(m = De.current) == null || m.call(De, ue);
|
|
1184
|
+
}, [ue]);
|
|
1185
|
+
const $e = U(x);
|
|
1186
|
+
O(() => {
|
|
1187
|
+
$e.current = x;
|
|
1188
|
+
}, [x]), O(() => {
|
|
1189
|
+
var m;
|
|
1190
|
+
(m = $e.current) == null || m.call($e, we);
|
|
1144
1191
|
}, [we]);
|
|
1145
|
-
const
|
|
1146
|
-
const { firstName:
|
|
1147
|
-
|
|
1148
|
-
}, [
|
|
1149
|
-
|
|
1150
|
-
if (!
|
|
1151
|
-
const
|
|
1152
|
-
|
|
1192
|
+
const Ie = D(() => {
|
|
1193
|
+
const { firstName: m, lastName: I } = Nt(C), { month: he, year: ie } = Vr(W);
|
|
1194
|
+
le("tokenizing"), se({ firstName: m, lastName: I, month: he, year: ie, zip: fe.trim() });
|
|
1195
|
+
}, [C, W, fe, se]);
|
|
1196
|
+
O(() => {
|
|
1197
|
+
if (!E || !ue || te.current) return;
|
|
1198
|
+
const m = setTimeout(() => {
|
|
1199
|
+
te.current = !0, Ie();
|
|
1153
1200
|
}, 1200);
|
|
1154
|
-
return () => clearTimeout(
|
|
1155
|
-
}, [
|
|
1156
|
-
const He = (
|
|
1157
|
-
|
|
1158
|
-
},
|
|
1159
|
-
return
|
|
1160
|
-
|
|
1161
|
-
}, [n]),
|
|
1162
|
-
var
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
message:
|
|
1166
|
-
cause: D
|
|
1201
|
+
return () => clearTimeout(m);
|
|
1202
|
+
}, [E, ue, Ie]);
|
|
1203
|
+
const He = (m) => {
|
|
1204
|
+
m.preventDefault(), ue && Ie();
|
|
1205
|
+
}, Ue = f !== "ready" || we, Te = U(n);
|
|
1206
|
+
return O(() => {
|
|
1207
|
+
Te.current = n;
|
|
1208
|
+
}, [n]), O(() => {
|
|
1209
|
+
var m, I;
|
|
1210
|
+
h && ((m = Te.current) == null || m.call(Te, h), (I = g.current) == null || I.call(g, {
|
|
1211
|
+
...lr(S ?? "spreedly-script", M, h),
|
|
1212
|
+
message: h
|
|
1167
1213
|
}));
|
|
1168
|
-
}, [
|
|
1214
|
+
}, [h, S, M]), /* @__PURE__ */ a.jsxs(
|
|
1169
1215
|
"form",
|
|
1170
1216
|
{
|
|
1171
|
-
id:
|
|
1217
|
+
id: j,
|
|
1172
1218
|
onSubmit: He,
|
|
1173
|
-
className:
|
|
1219
|
+
className: re("flex w-full flex-col gap-3", l),
|
|
1174
1220
|
"data-testid": "movmo-card-form",
|
|
1175
1221
|
children: [
|
|
1176
1222
|
/* @__PURE__ */ a.jsxs("div", { children: [
|
|
@@ -1178,26 +1224,26 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1178
1224
|
/* @__PURE__ */ a.jsxs(
|
|
1179
1225
|
"div",
|
|
1180
1226
|
{
|
|
1181
|
-
className:
|
|
1182
|
-
|
|
1183
|
-
|
|
1227
|
+
className: re(
|
|
1228
|
+
Sr,
|
|
1229
|
+
Z.number ? Pr : de ? Fr : Tr
|
|
1184
1230
|
),
|
|
1185
1231
|
"data-testid": "movmo-card-number-shell",
|
|
1186
1232
|
children: [
|
|
1187
|
-
/* @__PURE__ */ a.jsx(Ye, { brand:
|
|
1233
|
+
/* @__PURE__ */ a.jsx(Ye, { brand: J ?? "", width: 32, className: "flex-shrink-0" }),
|
|
1188
1234
|
/* @__PURE__ */ a.jsxs("div", { className: "relative h-full flex-1", children: [
|
|
1189
1235
|
/* @__PURE__ */ a.jsx(
|
|
1190
1236
|
"div",
|
|
1191
1237
|
{
|
|
1192
1238
|
id: "movmo-card-number",
|
|
1193
1239
|
"aria-labelledby": "movmo-card-number-label",
|
|
1194
|
-
"aria-busy":
|
|
1195
|
-
"aria-describedby":
|
|
1240
|
+
"aria-busy": f !== "ready",
|
|
1241
|
+
"aria-describedby": de ? "movmo-card-number-error" : void 0,
|
|
1196
1242
|
className: "absolute inset-0",
|
|
1197
1243
|
"data-testid": "movmo-card-number-mount"
|
|
1198
1244
|
}
|
|
1199
1245
|
),
|
|
1200
|
-
|
|
1246
|
+
f !== "ready" ? /* @__PURE__ */ a.jsx(
|
|
1201
1247
|
"div",
|
|
1202
1248
|
{
|
|
1203
1249
|
"aria-hidden": "true",
|
|
@@ -1208,13 +1254,13 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1208
1254
|
]
|
|
1209
1255
|
}
|
|
1210
1256
|
),
|
|
1211
|
-
|
|
1257
|
+
de && /* @__PURE__ */ a.jsx(
|
|
1212
1258
|
"p",
|
|
1213
1259
|
{
|
|
1214
1260
|
id: "movmo-card-number-error",
|
|
1215
1261
|
className: "mt-1 text-xs text-error-700",
|
|
1216
1262
|
"data-testid": "movmo-card-number-error",
|
|
1217
|
-
children:
|
|
1263
|
+
children: _r.number
|
|
1218
1264
|
}
|
|
1219
1265
|
)
|
|
1220
1266
|
] }),
|
|
@@ -1230,19 +1276,19 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1230
1276
|
inputMode: "numeric",
|
|
1231
1277
|
autoComplete: "cc-exp",
|
|
1232
1278
|
placeholder: "MM / YY",
|
|
1233
|
-
value:
|
|
1234
|
-
onChange: (
|
|
1235
|
-
const
|
|
1236
|
-
ve(
|
|
1279
|
+
value: W,
|
|
1280
|
+
onChange: (m) => {
|
|
1281
|
+
const I = Ct(m.target.value);
|
|
1282
|
+
ve(I), gr(I) && !Ce.current ? (Ce.current = !0, G("cvv")) : gr(I) || (Ce.current = !1);
|
|
1237
1283
|
},
|
|
1238
|
-
onBlur: () =>
|
|
1239
|
-
"aria-invalid":
|
|
1240
|
-
"aria-describedby": (
|
|
1241
|
-
className:
|
|
1242
|
-
|
|
1243
|
-
|
|
1284
|
+
onBlur: () => ee("expiry"),
|
|
1285
|
+
"aria-invalid": Q.expiry && ce("expiry"),
|
|
1286
|
+
"aria-describedby": (ne == null ? void 0 : ne.field) === "expiry" ? "movmo-card-row-error" : void 0,
|
|
1287
|
+
className: re(
|
|
1288
|
+
xr,
|
|
1289
|
+
Q.expiry && ce("expiry") ? "border-error-500" : "border-grayWarm-300"
|
|
1244
1290
|
),
|
|
1245
|
-
disabled:
|
|
1291
|
+
disabled: Ue,
|
|
1246
1292
|
required: !0,
|
|
1247
1293
|
"data-testid": "movmo-card-expiry-input"
|
|
1248
1294
|
}
|
|
@@ -1253,9 +1299,9 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1253
1299
|
/* @__PURE__ */ a.jsxs(
|
|
1254
1300
|
"div",
|
|
1255
1301
|
{
|
|
1256
|
-
className:
|
|
1257
|
-
|
|
1258
|
-
|
|
1302
|
+
className: re(
|
|
1303
|
+
Sr,
|
|
1304
|
+
Z.cvv ? Pr : Q.cvv && ce("cvv") ? Fr : Tr
|
|
1259
1305
|
),
|
|
1260
1306
|
"data-testid": "movmo-card-cvv-shell",
|
|
1261
1307
|
children: [
|
|
@@ -1265,13 +1311,13 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1265
1311
|
{
|
|
1266
1312
|
id: "movmo-card-cvv",
|
|
1267
1313
|
"aria-labelledby": "movmo-card-cvv-label",
|
|
1268
|
-
"aria-busy":
|
|
1269
|
-
"aria-describedby": (
|
|
1314
|
+
"aria-busy": f !== "ready",
|
|
1315
|
+
"aria-describedby": (ne == null ? void 0 : ne.field) === "cvv" ? "movmo-card-row-error" : void 0,
|
|
1270
1316
|
className: "absolute inset-0",
|
|
1271
1317
|
"data-testid": "movmo-card-cvv-mount"
|
|
1272
1318
|
}
|
|
1273
1319
|
),
|
|
1274
|
-
|
|
1320
|
+
f !== "ready" ? /* @__PURE__ */ a.jsx(
|
|
1275
1321
|
"div",
|
|
1276
1322
|
{
|
|
1277
1323
|
"aria-hidden": "true",
|
|
@@ -1286,7 +1332,7 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1286
1332
|
"aria-label": "CVV help",
|
|
1287
1333
|
tabIndex: -1,
|
|
1288
1334
|
className: "flex h-5 w-5 flex-shrink-0 items-center justify-center rounded-full border border-grayWarm-300 text-xs text-grayWarm-500",
|
|
1289
|
-
title:
|
|
1335
|
+
title: J === "american_express" ? "The 4 numbers on the front of your card." : "The 3 numbers on the back of your card.",
|
|
1290
1336
|
"data-testid": "movmo-cvv-help",
|
|
1291
1337
|
children: "?"
|
|
1292
1338
|
}
|
|
@@ -1306,30 +1352,30 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1306
1352
|
autoComplete: "postal-code",
|
|
1307
1353
|
placeholder: "Postal code",
|
|
1308
1354
|
value: fe,
|
|
1309
|
-
onChange: (
|
|
1310
|
-
|
|
1355
|
+
onChange: (m) => {
|
|
1356
|
+
_e(Yr(m.target.value));
|
|
1311
1357
|
},
|
|
1312
|
-
onBlur: () =>
|
|
1313
|
-
"aria-invalid":
|
|
1314
|
-
"aria-describedby": (
|
|
1315
|
-
className:
|
|
1316
|
-
|
|
1317
|
-
|
|
1358
|
+
onBlur: () => ee("zip"),
|
|
1359
|
+
"aria-invalid": Q.zip && ce("zip"),
|
|
1360
|
+
"aria-describedby": (ne == null ? void 0 : ne.field) === "zip" ? "movmo-card-row-error" : void 0,
|
|
1361
|
+
className: re(
|
|
1362
|
+
xr,
|
|
1363
|
+
Q.zip && ce("zip") ? "border-error-500" : "border-grayWarm-300"
|
|
1318
1364
|
),
|
|
1319
|
-
disabled:
|
|
1365
|
+
disabled: Ue,
|
|
1320
1366
|
required: !0,
|
|
1321
1367
|
"data-testid": "movmo-card-zip-input"
|
|
1322
1368
|
}
|
|
1323
1369
|
)
|
|
1324
1370
|
] })
|
|
1325
1371
|
] }),
|
|
1326
|
-
|
|
1372
|
+
ne && /* @__PURE__ */ a.jsx(
|
|
1327
1373
|
"p",
|
|
1328
1374
|
{
|
|
1329
1375
|
id: "movmo-card-row-error",
|
|
1330
1376
|
className: "mt-1 text-xs text-error-700",
|
|
1331
1377
|
"data-testid": "movmo-card-row-error",
|
|
1332
|
-
children:
|
|
1378
|
+
children: ne.message
|
|
1333
1379
|
}
|
|
1334
1380
|
)
|
|
1335
1381
|
] }),
|
|
@@ -1342,43 +1388,43 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1342
1388
|
type: "text",
|
|
1343
1389
|
autoComplete: "cc-name",
|
|
1344
1390
|
placeholder: "Cardholder name",
|
|
1345
|
-
value:
|
|
1346
|
-
onChange: (
|
|
1347
|
-
onBlur: () =>
|
|
1348
|
-
"aria-invalid":
|
|
1349
|
-
"aria-describedby":
|
|
1350
|
-
className:
|
|
1351
|
-
|
|
1352
|
-
|
|
1391
|
+
value: C,
|
|
1392
|
+
onChange: (m) => w(m.target.value),
|
|
1393
|
+
onBlur: () => ee("name"),
|
|
1394
|
+
"aria-invalid": Pe,
|
|
1395
|
+
"aria-describedby": Pe ? "movmo-card-name-error" : void 0,
|
|
1396
|
+
className: re(
|
|
1397
|
+
xr,
|
|
1398
|
+
Pe ? "border-error-500" : "border-grayWarm-300"
|
|
1353
1399
|
),
|
|
1354
|
-
disabled:
|
|
1400
|
+
disabled: Ue,
|
|
1355
1401
|
required: !0,
|
|
1356
1402
|
"data-testid": "movmo-card-cardholder-name-input"
|
|
1357
1403
|
}
|
|
1358
1404
|
),
|
|
1359
|
-
|
|
1405
|
+
Pe && /* @__PURE__ */ a.jsx(
|
|
1360
1406
|
"p",
|
|
1361
1407
|
{
|
|
1362
1408
|
id: "movmo-card-name-error",
|
|
1363
1409
|
className: "mt-1 text-xs text-error-700",
|
|
1364
1410
|
"data-testid": "movmo-card-name-error",
|
|
1365
|
-
children:
|
|
1411
|
+
children: _r.name
|
|
1366
1412
|
}
|
|
1367
1413
|
)
|
|
1368
1414
|
] }),
|
|
1369
|
-
!
|
|
1415
|
+
!E && !b ? /* @__PURE__ */ a.jsx(
|
|
1370
1416
|
"button",
|
|
1371
1417
|
{
|
|
1372
1418
|
type: "submit",
|
|
1373
|
-
disabled: !
|
|
1374
|
-
className:
|
|
1419
|
+
disabled: !ue,
|
|
1420
|
+
className: re(
|
|
1375
1421
|
"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",
|
|
1376
1422
|
"disabled:cursor-not-allowed disabled:bg-grayWarm-300 disabled:text-grayWarm-500"
|
|
1377
1423
|
),
|
|
1378
1424
|
"data-testid": "movmo-card-save",
|
|
1379
|
-
children: we ? "Saving…" :
|
|
1425
|
+
children: we ? "Saving…" : f === "loading" ? "Loading…" : "Save card"
|
|
1380
1426
|
}
|
|
1381
|
-
) :
|
|
1427
|
+
) : E ? (
|
|
1382
1428
|
// In autoSave mode (empty-state inline form, no Save button at all),
|
|
1383
1429
|
// this single live region carries whatever the traveler needs to
|
|
1384
1430
|
// know: the in-flight state, or — while fields are still
|
|
@@ -1386,112 +1432,112 @@ const mt = "movmo-card-number", ft = "movmo-card-cvv", pt = (r) => ({
|
|
|
1386
1432
|
// them what the form is waiting for. The modal flow uses a spinner
|
|
1387
1433
|
// inside the modal-footer Save button instead — see
|
|
1388
1434
|
// AddPaymentMethodModal.isSaving.
|
|
1389
|
-
/* @__PURE__ */ a.jsx("div", { className: "text-center", "aria-live": "polite", "data-testid": "movmo-card-autosave-status", children: we ? /* @__PURE__ */ a.jsx("p", { className: "text-sm text-grayWarm-500", "data-testid": "movmo-card-autosaving", children: "Saving card…" }) :
|
|
1435
|
+
/* @__PURE__ */ a.jsx("div", { className: "text-center", "aria-live": "polite", "data-testid": "movmo-card-autosave-status", children: we ? /* @__PURE__ */ a.jsx("p", { className: "text-sm text-grayWarm-500", "data-testid": "movmo-card-autosaving", children: "Saving card…" }) : Se.length > 0 ? /* @__PURE__ */ a.jsx("p", { className: "text-xs text-grayWarm-600", "data-testid": "movmo-card-autosave-hint", children: Et }) : null })
|
|
1390
1436
|
) : null
|
|
1391
1437
|
]
|
|
1392
1438
|
}
|
|
1393
1439
|
);
|
|
1394
1440
|
};
|
|
1395
|
-
|
|
1396
|
-
const
|
|
1397
|
-
const [t, n] =
|
|
1398
|
-
return { deletePaymentMethod:
|
|
1441
|
+
Hr.displayName = "MovmoCardForm";
|
|
1442
|
+
const Rt = (e) => {
|
|
1443
|
+
const [t, n] = R("idle"), [s, i] = R(null);
|
|
1444
|
+
return { deletePaymentMethod: D(
|
|
1399
1445
|
async (u) => {
|
|
1400
1446
|
n("pending"), i(null);
|
|
1401
1447
|
try {
|
|
1402
|
-
await
|
|
1403
|
-
} catch (
|
|
1404
|
-
const
|
|
1405
|
-
throw i(
|
|
1448
|
+
await pt(e, u), n("idle");
|
|
1449
|
+
} catch (y) {
|
|
1450
|
+
const p = y instanceof Error ? y.message : "Failed to delete payment method.";
|
|
1451
|
+
throw i(p), n("error"), y;
|
|
1406
1452
|
}
|
|
1407
1453
|
},
|
|
1408
|
-
[
|
|
1454
|
+
[e]
|
|
1409
1455
|
), status: t, error: s };
|
|
1410
|
-
},
|
|
1411
|
-
const [t, n] =
|
|
1412
|
-
return { setDefault:
|
|
1456
|
+
}, kt = (e) => {
|
|
1457
|
+
const [t, n] = R("idle"), [s, i] = R(null);
|
|
1458
|
+
return { setDefault: D(
|
|
1413
1459
|
async (u) => {
|
|
1414
1460
|
n("pending"), i(null);
|
|
1415
1461
|
try {
|
|
1416
|
-
await
|
|
1417
|
-
} catch (
|
|
1418
|
-
const
|
|
1419
|
-
throw i(
|
|
1462
|
+
await Lr(e, u, { isDefault: !0 }), n("idle");
|
|
1463
|
+
} catch (y) {
|
|
1464
|
+
const p = y instanceof Error ? y.message : "Failed to set default payment method.";
|
|
1465
|
+
throw i(p), n("error"), y;
|
|
1420
1466
|
}
|
|
1421
1467
|
},
|
|
1422
|
-
[
|
|
1468
|
+
[e]
|
|
1423
1469
|
), status: t, error: s };
|
|
1424
|
-
},
|
|
1425
|
-
const [t, n] =
|
|
1426
|
-
return { updatePaymentMethod:
|
|
1427
|
-
async (u,
|
|
1470
|
+
}, St = (e) => {
|
|
1471
|
+
const [t, n] = R("idle"), [s, i] = R(null);
|
|
1472
|
+
return { updatePaymentMethod: D(
|
|
1473
|
+
async (u, y) => {
|
|
1428
1474
|
n("pending"), i(null);
|
|
1429
1475
|
try {
|
|
1430
|
-
await
|
|
1431
|
-
} catch (
|
|
1432
|
-
const
|
|
1433
|
-
throw i(
|
|
1476
|
+
await Lr(e, u, y), n("idle");
|
|
1477
|
+
} catch (p) {
|
|
1478
|
+
const E = p instanceof Error ? p.message : "Failed to update payment method.";
|
|
1479
|
+
throw i(E), n("error"), p;
|
|
1434
1480
|
}
|
|
1435
1481
|
},
|
|
1436
|
-
[
|
|
1482
|
+
[e]
|
|
1437
1483
|
), status: t, error: s };
|
|
1438
|
-
},
|
|
1439
|
-
const [t, n] =
|
|
1440
|
-
|
|
1441
|
-
var
|
|
1442
|
-
if ((
|
|
1443
|
-
|
|
1484
|
+
}, Pt = (e) => {
|
|
1485
|
+
const [t, n] = R([]), [s, i] = R("idle"), [l, u] = R(null), [y, p] = R(0), E = U(null);
|
|
1486
|
+
O(() => {
|
|
1487
|
+
var _;
|
|
1488
|
+
if ((_ = E.current) == null || _.abort(), !e) {
|
|
1489
|
+
E.current = null, n([]), u(null), i("ready");
|
|
1444
1490
|
return;
|
|
1445
1491
|
}
|
|
1446
|
-
const
|
|
1447
|
-
return
|
|
1448
|
-
|
|
1449
|
-
}).catch((
|
|
1450
|
-
if (
|
|
1451
|
-
const
|
|
1452
|
-
u(
|
|
1492
|
+
const b = new AbortController();
|
|
1493
|
+
return E.current = b, i("loading"), u(null), ft(e, b.signal).then((x) => {
|
|
1494
|
+
b.signal.aborted || (n(x), i("ready"));
|
|
1495
|
+
}).catch((x) => {
|
|
1496
|
+
if (b.signal.aborted || x instanceof DOMException && x.name === "AbortError") return;
|
|
1497
|
+
const P = x instanceof Error ? x.message : "Failed to fetch payment methods.";
|
|
1498
|
+
u(P), i("error");
|
|
1453
1499
|
}), () => {
|
|
1454
|
-
|
|
1500
|
+
b.abort();
|
|
1455
1501
|
};
|
|
1456
|
-
}, [
|
|
1457
|
-
const
|
|
1458
|
-
|
|
1502
|
+
}, [e, y]);
|
|
1503
|
+
const j = D(() => {
|
|
1504
|
+
p((b) => b + 1);
|
|
1459
1505
|
}, []);
|
|
1460
|
-
return { items: t, status: s, error: l, refetch:
|
|
1461
|
-
},
|
|
1462
|
-
open:
|
|
1506
|
+
return { items: t, status: s, error: l, refetch: j };
|
|
1507
|
+
}, qr = ({
|
|
1508
|
+
open: e,
|
|
1463
1509
|
onClose: t,
|
|
1464
1510
|
title: n,
|
|
1465
1511
|
titleId: s,
|
|
1466
1512
|
formId: i,
|
|
1467
1513
|
saveDisabled: l,
|
|
1468
1514
|
saveLabel: u = "Save",
|
|
1469
|
-
isSaving:
|
|
1470
|
-
testIdPrefix:
|
|
1471
|
-
children:
|
|
1472
|
-
}) => (
|
|
1473
|
-
if (!
|
|
1474
|
-
const
|
|
1475
|
-
|
|
1515
|
+
isSaving: y = !1,
|
|
1516
|
+
testIdPrefix: p = "payment-method",
|
|
1517
|
+
children: E
|
|
1518
|
+
}) => (O(() => {
|
|
1519
|
+
if (!e) return;
|
|
1520
|
+
const j = (b) => {
|
|
1521
|
+
b.key === "Escape" && t();
|
|
1476
1522
|
};
|
|
1477
|
-
return document.addEventListener("keydown",
|
|
1478
|
-
}, [
|
|
1479
|
-
if (!
|
|
1480
|
-
const
|
|
1523
|
+
return document.addEventListener("keydown", j), () => document.removeEventListener("keydown", j);
|
|
1524
|
+
}, [e, t]), O(() => {
|
|
1525
|
+
if (!e) return;
|
|
1526
|
+
const j = document.body.style.overflow;
|
|
1481
1527
|
return document.body.style.overflow = "hidden", () => {
|
|
1482
|
-
document.body.style.overflow =
|
|
1528
|
+
document.body.style.overflow = j;
|
|
1483
1529
|
};
|
|
1484
|
-
}, [
|
|
1530
|
+
}, [e]), e ? /* @__PURE__ */ a.jsx(
|
|
1485
1531
|
"div",
|
|
1486
1532
|
{
|
|
1487
1533
|
role: "dialog",
|
|
1488
1534
|
"aria-modal": "true",
|
|
1489
1535
|
"aria-labelledby": s,
|
|
1490
1536
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",
|
|
1491
|
-
onClick: (
|
|
1492
|
-
|
|
1537
|
+
onClick: (j) => {
|
|
1538
|
+
j.target === j.currentTarget && t();
|
|
1493
1539
|
},
|
|
1494
|
-
"data-testid": `${
|
|
1540
|
+
"data-testid": `${p}-modal`,
|
|
1495
1541
|
children: /* @__PURE__ */ a.jsxs("div", { className: "flex max-h-full w-full max-w-md flex-col rounded-xl bg-white shadow-2xl", children: [
|
|
1496
1542
|
/* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-3 border-b border-grayWarm-200 px-4 py-3", children: [
|
|
1497
1543
|
/* @__PURE__ */ a.jsx(
|
|
@@ -1501,7 +1547,7 @@ const wt = (r) => {
|
|
|
1501
1547
|
onClick: t,
|
|
1502
1548
|
"aria-label": `Close ${n.toLowerCase()} dialog`,
|
|
1503
1549
|
className: "flex h-9 w-9 flex-shrink-0 items-center justify-center rounded-lg bg-grayWarm-100 p-2 text-grayWarm-950 transition-colors hover:bg-grayWarm-200",
|
|
1504
|
-
"data-testid": `${
|
|
1550
|
+
"data-testid": `${p}-close`,
|
|
1505
1551
|
children: /* @__PURE__ */ a.jsx("svg", { viewBox: "0 0 20 20", width: "20", height: "20", "aria-hidden": "true", children: /* @__PURE__ */ a.jsx(
|
|
1506
1552
|
"path",
|
|
1507
1553
|
{
|
|
@@ -1517,7 +1563,7 @@ const wt = (r) => {
|
|
|
1517
1563
|
/* @__PURE__ */ a.jsx("h2", { id: s, className: "flex-1 text-center text-base font-semibold text-grayWarm-900", children: n }),
|
|
1518
1564
|
/* @__PURE__ */ a.jsx("span", { "aria-hidden": "true", className: "h-9 w-9 flex-shrink-0" })
|
|
1519
1565
|
] }),
|
|
1520
|
-
/* @__PURE__ */ a.jsx("div", { className: "flex-1 overflow-y-auto p-4", children:
|
|
1566
|
+
/* @__PURE__ */ a.jsx("div", { className: "flex-1 overflow-y-auto p-4", children: E }),
|
|
1521
1567
|
/* @__PURE__ */ a.jsxs("div", { className: "flex gap-3 border-t border-grayWarm-200 p-4", children: [
|
|
1522
1568
|
/* @__PURE__ */ a.jsx(
|
|
1523
1569
|
"button",
|
|
@@ -1525,7 +1571,7 @@ const wt = (r) => {
|
|
|
1525
1571
|
type: "button",
|
|
1526
1572
|
onClick: t,
|
|
1527
1573
|
className: "inline-flex h-11 flex-1 items-center justify-center rounded-lg border border-grayWarm-300 px-4 text-sm font-semibold text-grayWarm-900 transition-colors hover:border-grayWarm-900 hover:shadow-[0_0_0_1px_#1c1917]",
|
|
1528
|
-
"data-testid": `${
|
|
1574
|
+
"data-testid": `${p}-cancel`,
|
|
1529
1575
|
children: "Cancel"
|
|
1530
1576
|
}
|
|
1531
1577
|
),
|
|
@@ -1534,15 +1580,15 @@ const wt = (r) => {
|
|
|
1534
1580
|
{
|
|
1535
1581
|
type: "submit",
|
|
1536
1582
|
form: i,
|
|
1537
|
-
disabled:
|
|
1538
|
-
"aria-disabled":
|
|
1539
|
-
"aria-busy":
|
|
1540
|
-
className:
|
|
1583
|
+
disabled: y ? !1 : l,
|
|
1584
|
+
"aria-disabled": y || l,
|
|
1585
|
+
"aria-busy": y,
|
|
1586
|
+
className: re(
|
|
1541
1587
|
"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",
|
|
1542
|
-
|
|
1588
|
+
y ? "cursor-not-allowed opacity-90 pointer-events-none" : "hover:bg-brand-600 disabled:cursor-not-allowed disabled:bg-grayWarm-300 disabled:text-grayWarm-500"
|
|
1543
1589
|
),
|
|
1544
|
-
"data-testid": `${
|
|
1545
|
-
children:
|
|
1590
|
+
"data-testid": `${p}-save`,
|
|
1591
|
+
children: y ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
1546
1592
|
/* @__PURE__ */ a.jsxs(
|
|
1547
1593
|
"svg",
|
|
1548
1594
|
{
|
|
@@ -1581,8 +1627,8 @@ const wt = (r) => {
|
|
|
1581
1627
|
] })
|
|
1582
1628
|
] })
|
|
1583
1629
|
}
|
|
1584
|
-
) : null),
|
|
1585
|
-
open:
|
|
1630
|
+
) : null), Tt = ({
|
|
1631
|
+
open: e,
|
|
1586
1632
|
onClose: t,
|
|
1587
1633
|
formId: n,
|
|
1588
1634
|
saveDisabled: s,
|
|
@@ -1590,9 +1636,9 @@ const wt = (r) => {
|
|
|
1590
1636
|
isSaving: l = !1,
|
|
1591
1637
|
children: u
|
|
1592
1638
|
}) => /* @__PURE__ */ a.jsx(
|
|
1593
|
-
|
|
1639
|
+
qr,
|
|
1594
1640
|
{
|
|
1595
|
-
open:
|
|
1641
|
+
open: e,
|
|
1596
1642
|
onClose: t,
|
|
1597
1643
|
title: "Add payment method",
|
|
1598
1644
|
titleId: "movmo-add-payment-title",
|
|
@@ -1603,37 +1649,37 @@ const wt = (r) => {
|
|
|
1603
1649
|
testIdPrefix: "add-payment-method",
|
|
1604
1650
|
children: u
|
|
1605
1651
|
}
|
|
1606
|
-
),
|
|
1607
|
-
if (!
|
|
1608
|
-
const t =
|
|
1652
|
+
), Ft = (e, t) => `${String(e).padStart(2, "0")}/${t}`, Wt = (e) => {
|
|
1653
|
+
if (!e) return "Card";
|
|
1654
|
+
const t = e.toLowerCase();
|
|
1609
1655
|
return t === "amex" ? "Amex" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
1610
|
-
},
|
|
1611
|
-
open:
|
|
1656
|
+
}, Ot = ({
|
|
1657
|
+
open: e,
|
|
1612
1658
|
method: t,
|
|
1613
1659
|
onClose: n,
|
|
1614
1660
|
onSave: s,
|
|
1615
1661
|
isSaving: i = !1,
|
|
1616
1662
|
error: l = null
|
|
1617
1663
|
}) => {
|
|
1618
|
-
const u =
|
|
1619
|
-
if (
|
|
1620
|
-
|
|
1621
|
-
}, [
|
|
1622
|
-
const
|
|
1623
|
-
if (
|
|
1664
|
+
const u = tt(), [y, p] = R(""), [E, j] = R("");
|
|
1665
|
+
if (O(() => {
|
|
1666
|
+
e && t && (p(t.cardholderName ?? ""), j(t.zip ?? ""));
|
|
1667
|
+
}, [e, t]), !t) return null;
|
|
1668
|
+
const b = y.trim(), _ = E.trim(), x = b !== (t.cardholderName ?? "").trim(), P = _ !== (t.zip ?? "").trim(), $ = x || P, B = (!x || b.length > 0) && (!P || Br(_)), C = !$ || !B, w = (W) => {
|
|
1669
|
+
if (W.preventDefault(), C || i) return;
|
|
1624
1670
|
const ve = {};
|
|
1625
|
-
|
|
1671
|
+
x && (ve.cardholderName = b), P && (ve.zip = _), s(ve).catch(() => {
|
|
1626
1672
|
});
|
|
1627
1673
|
};
|
|
1628
1674
|
return /* @__PURE__ */ a.jsxs(
|
|
1629
|
-
|
|
1675
|
+
qr,
|
|
1630
1676
|
{
|
|
1631
|
-
open:
|
|
1677
|
+
open: e,
|
|
1632
1678
|
onClose: n,
|
|
1633
1679
|
title: "Edit payment method",
|
|
1634
1680
|
titleId: "movmo-edit-payment-title",
|
|
1635
1681
|
formId: u,
|
|
1636
|
-
saveDisabled:
|
|
1682
|
+
saveDisabled: C,
|
|
1637
1683
|
isSaving: i,
|
|
1638
1684
|
testIdPrefix: "edit-payment-method",
|
|
1639
1685
|
children: [
|
|
@@ -1646,19 +1692,19 @@ const wt = (r) => {
|
|
|
1646
1692
|
/* @__PURE__ */ a.jsx(Ye, { brand: t.brand, className: "flex-shrink-0" }),
|
|
1647
1693
|
/* @__PURE__ */ a.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1648
1694
|
/* @__PURE__ */ a.jsxs("div", { className: "text-lg font-semibold text-grayWarm-950", children: [
|
|
1649
|
-
|
|
1695
|
+
Wt(t.brand),
|
|
1650
1696
|
" •••• ",
|
|
1651
1697
|
t.last4
|
|
1652
1698
|
] }),
|
|
1653
1699
|
/* @__PURE__ */ a.jsxs("div", { className: "text-sm text-grayWarm-600", children: [
|
|
1654
1700
|
"Exp. ",
|
|
1655
|
-
|
|
1701
|
+
Ft(t.expMonth, t.expYear)
|
|
1656
1702
|
] })
|
|
1657
1703
|
] })
|
|
1658
1704
|
]
|
|
1659
1705
|
}
|
|
1660
1706
|
),
|
|
1661
|
-
/* @__PURE__ */ a.jsxs("form", { id: u, onSubmit:
|
|
1707
|
+
/* @__PURE__ */ a.jsxs("form", { id: u, onSubmit: w, className: "flex flex-col gap-4", noValidate: !0, children: [
|
|
1662
1708
|
/* @__PURE__ */ a.jsxs("label", { className: "flex flex-col gap-1.5 text-sm font-medium text-grayWarm-700", children: [
|
|
1663
1709
|
"Cardholder name",
|
|
1664
1710
|
/* @__PURE__ */ a.jsx(
|
|
@@ -1666,8 +1712,8 @@ const wt = (r) => {
|
|
|
1666
1712
|
{
|
|
1667
1713
|
type: "text",
|
|
1668
1714
|
autoComplete: "cc-name",
|
|
1669
|
-
value:
|
|
1670
|
-
onChange: (
|
|
1715
|
+
value: y,
|
|
1716
|
+
onChange: (W) => p(W.target.value),
|
|
1671
1717
|
disabled: i,
|
|
1672
1718
|
maxLength: 255,
|
|
1673
1719
|
"data-testid": "edit-payment-method-cardholder",
|
|
@@ -1682,8 +1728,8 @@ const wt = (r) => {
|
|
|
1682
1728
|
{
|
|
1683
1729
|
type: "text",
|
|
1684
1730
|
autoComplete: "postal-code",
|
|
1685
|
-
value:
|
|
1686
|
-
onChange: (
|
|
1731
|
+
value: E,
|
|
1732
|
+
onChange: (W) => j(Yr(W.target.value)),
|
|
1687
1733
|
disabled: i,
|
|
1688
1734
|
"data-testid": "edit-payment-method-zip",
|
|
1689
1735
|
className: "h-11 rounded-lg border border-grayWarm-300 px-3 text-base font-normal text-grayWarm-950 focus:border-grayWarm-950 focus:outline-none focus:ring-1 focus:ring-grayWarm-950"
|
|
@@ -1703,12 +1749,12 @@ const wt = (r) => {
|
|
|
1703
1749
|
]
|
|
1704
1750
|
}
|
|
1705
1751
|
);
|
|
1706
|
-
},
|
|
1707
|
-
if (!
|
|
1708
|
-
const t =
|
|
1752
|
+
}, At = (e) => {
|
|
1753
|
+
if (!e) return "Card";
|
|
1754
|
+
const t = e.toLowerCase();
|
|
1709
1755
|
return t === "amex" ? "Amex" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
1710
|
-
},
|
|
1711
|
-
method:
|
|
1756
|
+
}, Dt = ({
|
|
1757
|
+
method: e,
|
|
1712
1758
|
trailing: t,
|
|
1713
1759
|
onClick: n,
|
|
1714
1760
|
cardLabelFormat: s = "branded",
|
|
@@ -1716,64 +1762,64 @@ const wt = (r) => {
|
|
|
1716
1762
|
}) => /* @__PURE__ */ a.jsxs(
|
|
1717
1763
|
"div",
|
|
1718
1764
|
{
|
|
1719
|
-
className:
|
|
1765
|
+
className: re("flex items-center gap-3", n && "cursor-pointer", i),
|
|
1720
1766
|
onClick: n,
|
|
1721
1767
|
role: n ? "button" : void 0,
|
|
1722
1768
|
tabIndex: n ? 0 : void 0,
|
|
1723
1769
|
onKeyDown: n ? (l) => {
|
|
1724
1770
|
(l.key === "Enter" || l.key === " ") && (l.preventDefault(), n());
|
|
1725
1771
|
} : void 0,
|
|
1726
|
-
"data-testid": `payment-method-preview-${
|
|
1772
|
+
"data-testid": `payment-method-preview-${e.id}`,
|
|
1727
1773
|
children: [
|
|
1728
|
-
/* @__PURE__ */ a.jsx(Ye, { brand:
|
|
1729
|
-
/* @__PURE__ */ a.jsx("span", { className: "flex-1 text-lg font-semibold text-grayWarm-950", children: s === "masked" ? `•••• ${
|
|
1774
|
+
/* @__PURE__ */ a.jsx(Ye, { brand: e.brand, width: 34, className: "flex-shrink-0" }),
|
|
1775
|
+
/* @__PURE__ */ a.jsx("span", { className: "flex-1 text-lg font-semibold text-grayWarm-950", children: s === "masked" ? `•••• ${e.last4}` : `${At(e.brand)} ${e.last4}` }),
|
|
1730
1776
|
t
|
|
1731
1777
|
]
|
|
1732
1778
|
}
|
|
1733
|
-
),
|
|
1734
|
-
if (!
|
|
1735
|
-
const t =
|
|
1779
|
+
), $t = (e, t, n = /* @__PURE__ */ new Date()) => t < n.getFullYear() || t === n.getFullYear() && e < n.getMonth() + 1, Wr = (e) => {
|
|
1780
|
+
if (!e) return "Card";
|
|
1781
|
+
const t = e.toLowerCase();
|
|
1736
1782
|
return t === "amex" ? "Amex" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
1737
|
-
},
|
|
1738
|
-
method:
|
|
1783
|
+
}, Mt = (e, t) => `${String(e).padStart(2, "0")}/${t}`, It = ({
|
|
1784
|
+
method: e,
|
|
1739
1785
|
selectable: t,
|
|
1740
1786
|
selected: n,
|
|
1741
1787
|
onSelect: s,
|
|
1742
1788
|
onSetDefault: i,
|
|
1743
1789
|
onRemove: l,
|
|
1744
1790
|
onEdit: u,
|
|
1745
|
-
disabled:
|
|
1746
|
-
showDefaultBadge:
|
|
1747
|
-
hideSetDefaultMenuItem:
|
|
1748
|
-
cardLabelFormat:
|
|
1791
|
+
disabled: y,
|
|
1792
|
+
showDefaultBadge: p,
|
|
1793
|
+
hideSetDefaultMenuItem: E,
|
|
1794
|
+
cardLabelFormat: j = "branded"
|
|
1749
1795
|
}) => {
|
|
1750
|
-
const [
|
|
1751
|
-
|
|
1752
|
-
if (!
|
|
1753
|
-
const
|
|
1754
|
-
var
|
|
1755
|
-
(
|
|
1796
|
+
const [b, _] = R(!1), x = U(null), P = $t(e.expMonth, e.expYear);
|
|
1797
|
+
O(() => {
|
|
1798
|
+
if (!b) return;
|
|
1799
|
+
const B = (C) => {
|
|
1800
|
+
var w;
|
|
1801
|
+
(w = x.current) != null && w.contains(C.target) || _(!1);
|
|
1756
1802
|
};
|
|
1757
|
-
return document.addEventListener("mousedown",
|
|
1758
|
-
}, [
|
|
1759
|
-
const
|
|
1760
|
-
t && s && !
|
|
1803
|
+
return document.addEventListener("mousedown", B), () => document.removeEventListener("mousedown", B);
|
|
1804
|
+
}, [b]);
|
|
1805
|
+
const $ = () => {
|
|
1806
|
+
t && s && !y && s(e);
|
|
1761
1807
|
};
|
|
1762
1808
|
return /* @__PURE__ */ a.jsxs(
|
|
1763
1809
|
"div",
|
|
1764
1810
|
{
|
|
1765
|
-
className:
|
|
1811
|
+
className: re(
|
|
1766
1812
|
// items-start + per-element mt offsets so the radio, brand icon, and
|
|
1767
1813
|
// label all read as one horizontal line, with the Exp text directly
|
|
1768
1814
|
// below the label in the same column. Matches main's flights-ui +
|
|
1769
1815
|
// accounts-ui row layout (both use items-start).
|
|
1770
1816
|
"flex items-start gap-3 transition-colors",
|
|
1771
1817
|
t ? "rounded-lg border px-3 py-3" : "py-4",
|
|
1772
|
-
t && !
|
|
1818
|
+
t && !y && "cursor-pointer",
|
|
1773
1819
|
t && (n ? "border-grayWarm-950 shadow-[0_0_0_1px_#1c1917]" : "border-grayWarm-200 hover:border-grayWarm-300")
|
|
1774
1820
|
),
|
|
1775
|
-
onClick:
|
|
1776
|
-
"data-testid": `payment-method-row-${
|
|
1821
|
+
onClick: $,
|
|
1822
|
+
"data-testid": `payment-method-row-${e.id}`,
|
|
1777
1823
|
children: [
|
|
1778
1824
|
t ? /* @__PURE__ */ a.jsx(
|
|
1779
1825
|
"input",
|
|
@@ -1781,61 +1827,61 @@ const wt = (r) => {
|
|
|
1781
1827
|
type: "radio",
|
|
1782
1828
|
name: "movmo-payment-method",
|
|
1783
1829
|
checked: n,
|
|
1784
|
-
onChange: () => s == null ? void 0 : s(
|
|
1785
|
-
onClick: (
|
|
1786
|
-
"aria-label": `Select ${
|
|
1830
|
+
onChange: () => s == null ? void 0 : s(e),
|
|
1831
|
+
onClick: (B) => B.stopPropagation(),
|
|
1832
|
+
"aria-label": `Select ${Wr(e.brand)} ending ${e.last4}`,
|
|
1787
1833
|
className: "mr-1 h-4 w-4 mt-2 cursor-pointer appearance-none rounded-full border-2 border-grayWarm-300 checked:border-[5px] checked:border-grayWarm-950 bg-white checked:bg-white focus:ring-0 focus:ring-offset-0",
|
|
1788
|
-
disabled:
|
|
1834
|
+
disabled: y
|
|
1789
1835
|
}
|
|
1790
1836
|
) : null,
|
|
1791
|
-
/* @__PURE__ */ a.jsx(Ye, { brand:
|
|
1837
|
+
/* @__PURE__ */ a.jsx(Ye, { brand: e.brand, className: "flex-shrink-0" }),
|
|
1792
1838
|
/* @__PURE__ */ a.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1793
1839
|
/* @__PURE__ */ a.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1794
|
-
/* @__PURE__ */ a.jsx("span", { className: "text-lg font-semibold text-grayWarm-950", children:
|
|
1795
|
-
|
|
1840
|
+
/* @__PURE__ */ a.jsx("span", { className: "text-lg font-semibold text-grayWarm-950", children: j === "masked" ? `•••• ${e.last4}` : `${Wr(e.brand)} ${e.last4}` }),
|
|
1841
|
+
p && e.isDefault ? /* @__PURE__ */ a.jsx(
|
|
1796
1842
|
"span",
|
|
1797
1843
|
{
|
|
1798
1844
|
className: "inline-flex items-center rounded-full bg-success-50 px-2 py-0.5 text-xs font-semibold text-success-700",
|
|
1799
|
-
"data-testid": `badge-default-${
|
|
1845
|
+
"data-testid": `badge-default-${e.id}`,
|
|
1800
1846
|
children: "Default"
|
|
1801
1847
|
}
|
|
1802
1848
|
) : null,
|
|
1803
|
-
|
|
1849
|
+
P ? /* @__PURE__ */ a.jsx(
|
|
1804
1850
|
"span",
|
|
1805
1851
|
{
|
|
1806
1852
|
className: "inline-flex items-center rounded-full bg-error-50 px-2 py-0.5 text-xs font-semibold text-error-700",
|
|
1807
|
-
"data-testid": `badge-expired-${
|
|
1853
|
+
"data-testid": `badge-expired-${e.id}`,
|
|
1808
1854
|
children: "Expired"
|
|
1809
1855
|
}
|
|
1810
1856
|
) : null
|
|
1811
1857
|
] }),
|
|
1812
|
-
/* @__PURE__ */ a.jsxs("div", { className:
|
|
1858
|
+
/* @__PURE__ */ a.jsxs("div", { className: re("text-base", P ? "text-grayWarm-400" : "text-grayWarm-600"), children: [
|
|
1813
1859
|
"Exp. ",
|
|
1814
|
-
|
|
1860
|
+
Mt(e.expMonth, e.expYear)
|
|
1815
1861
|
] })
|
|
1816
1862
|
] }),
|
|
1817
|
-
/* @__PURE__ */ a.jsxs("div", { className: "relative flex-shrink-0", ref:
|
|
1863
|
+
/* @__PURE__ */ a.jsxs("div", { className: "relative flex-shrink-0", ref: x, children: [
|
|
1818
1864
|
/* @__PURE__ */ a.jsx(
|
|
1819
1865
|
"button",
|
|
1820
1866
|
{
|
|
1821
1867
|
type: "button",
|
|
1822
|
-
"aria-label": `Open actions for card ending ${
|
|
1868
|
+
"aria-label": `Open actions for card ending ${e.last4}`,
|
|
1823
1869
|
"aria-haspopup": "menu",
|
|
1824
|
-
"aria-expanded":
|
|
1870
|
+
"aria-expanded": b,
|
|
1825
1871
|
className: "rounded-lg p-2 text-grayWarm-600 transition-colors hover:bg-grayWarm-100 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1826
|
-
disabled:
|
|
1827
|
-
onClick: (
|
|
1828
|
-
|
|
1872
|
+
disabled: y,
|
|
1873
|
+
onClick: (B) => {
|
|
1874
|
+
B.stopPropagation(), _((C) => !C);
|
|
1829
1875
|
},
|
|
1830
|
-
"data-testid": `menu-trigger-${
|
|
1876
|
+
"data-testid": `menu-trigger-${e.id}`,
|
|
1831
1877
|
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" }) })
|
|
1832
1878
|
}
|
|
1833
1879
|
),
|
|
1834
|
-
|
|
1880
|
+
b ? /* @__PURE__ */ a.jsxs(
|
|
1835
1881
|
"div",
|
|
1836
1882
|
{
|
|
1837
1883
|
role: "menu",
|
|
1838
|
-
className:
|
|
1884
|
+
className: re(
|
|
1839
1885
|
"absolute z-10 whitespace-nowrap rounded-lg border border-grayWarm-200 bg-white py-1 shadow-lg",
|
|
1840
1886
|
// selectable mode (flights-ui): the row has a thick border that a
|
|
1841
1887
|
// top-aligned dropdown would crash through. Float the menu ABOVE
|
|
@@ -1845,8 +1891,8 @@ const wt = (r) => {
|
|
|
1845
1891
|
// overlap; keep the menu below + right-aligned.
|
|
1846
1892
|
t ? "bottom-full left-1/2 mb-2 -translate-x-1/2" : "right-0 top-full mt-1"
|
|
1847
1893
|
),
|
|
1848
|
-
onClick: (
|
|
1849
|
-
"data-testid": `menu-${
|
|
1894
|
+
onClick: (B) => B.stopPropagation(),
|
|
1895
|
+
"data-testid": `menu-${e.id}`,
|
|
1850
1896
|
children: [
|
|
1851
1897
|
t ? (
|
|
1852
1898
|
// Tail: 8px square rotated 45° so its bottom-right corner
|
|
@@ -1860,29 +1906,29 @@ const wt = (r) => {
|
|
|
1860
1906
|
}
|
|
1861
1907
|
)
|
|
1862
1908
|
) : null,
|
|
1863
|
-
!
|
|
1909
|
+
!e.isDefault && !E ? /* @__PURE__ */ a.jsx(
|
|
1864
1910
|
"button",
|
|
1865
1911
|
{
|
|
1866
1912
|
type: "button",
|
|
1867
1913
|
role: "menuitem",
|
|
1868
1914
|
className: "block w-full px-4 py-1 text-left text-md font-semibold text-grayWarm-950 hover:text-grayWarm-700",
|
|
1869
1915
|
onClick: () => {
|
|
1870
|
-
|
|
1916
|
+
_(!1), i(e);
|
|
1871
1917
|
},
|
|
1872
|
-
"data-testid": `menu-set-default-${
|
|
1918
|
+
"data-testid": `menu-set-default-${e.id}`,
|
|
1873
1919
|
children: "Set as default"
|
|
1874
1920
|
}
|
|
1875
1921
|
) : null,
|
|
1876
|
-
u &&
|
|
1922
|
+
u && e.vault === "spreedly" ? /* @__PURE__ */ a.jsx(
|
|
1877
1923
|
"button",
|
|
1878
1924
|
{
|
|
1879
1925
|
type: "button",
|
|
1880
1926
|
role: "menuitem",
|
|
1881
1927
|
className: "block w-full px-4 py-1 text-left text-md font-semibold text-grayWarm-950 hover:text-grayWarm-700",
|
|
1882
1928
|
onClick: () => {
|
|
1883
|
-
|
|
1929
|
+
_(!1), u(e);
|
|
1884
1930
|
},
|
|
1885
|
-
"data-testid": `menu-edit-${
|
|
1931
|
+
"data-testid": `menu-edit-${e.id}`,
|
|
1886
1932
|
children: "Edit"
|
|
1887
1933
|
}
|
|
1888
1934
|
) : null,
|
|
@@ -1893,9 +1939,9 @@ const wt = (r) => {
|
|
|
1893
1939
|
role: "menuitem",
|
|
1894
1940
|
className: "block w-full px-4 py-1 text-left text-md font-semibold text-error-700 hover:text-error-500",
|
|
1895
1941
|
onClick: () => {
|
|
1896
|
-
|
|
1942
|
+
_(!1), l(e);
|
|
1897
1943
|
},
|
|
1898
|
-
"data-testid": `menu-remove-${
|
|
1944
|
+
"data-testid": `menu-remove-${e.id}`,
|
|
1899
1945
|
children: "Delete"
|
|
1900
1946
|
}
|
|
1901
1947
|
)
|
|
@@ -1906,17 +1952,17 @@ const wt = (r) => {
|
|
|
1906
1952
|
]
|
|
1907
1953
|
}
|
|
1908
1954
|
);
|
|
1909
|
-
},
|
|
1955
|
+
}, Ut = (e) => `${tr().iconCdnBaseUrl}/website/assets/icons/payments/${e}.svg`, br = ({ slug: e, alt: t }) => /* @__PURE__ */ a.jsx(
|
|
1910
1956
|
"img",
|
|
1911
1957
|
{
|
|
1912
|
-
src:
|
|
1958
|
+
src: Ut(e),
|
|
1913
1959
|
alt: t,
|
|
1914
1960
|
height: 20,
|
|
1915
1961
|
loading: "lazy",
|
|
1916
1962
|
style: { height: 20, width: "auto" }
|
|
1917
1963
|
}
|
|
1918
|
-
),
|
|
1919
|
-
type:
|
|
1964
|
+
), hr = ({
|
|
1965
|
+
type: e,
|
|
1920
1966
|
label: t,
|
|
1921
1967
|
iconNode: n,
|
|
1922
1968
|
disabled: s = !1
|
|
@@ -1928,18 +1974,18 @@ const wt = (r) => {
|
|
|
1928
1974
|
"label",
|
|
1929
1975
|
{
|
|
1930
1976
|
className: "flex cursor-pointer items-center gap-3 rounded-lg border border-grayWarm-200 px-4 py-3 transition-colors hover:border-grayWarm-300",
|
|
1931
|
-
"data-testid": `payment-type-${
|
|
1977
|
+
"data-testid": `payment-type-${e}`,
|
|
1932
1978
|
children: [
|
|
1933
1979
|
/* @__PURE__ */ a.jsx(
|
|
1934
1980
|
"input",
|
|
1935
1981
|
{
|
|
1936
1982
|
type: "radio",
|
|
1937
1983
|
name: "movmo-payment-type",
|
|
1938
|
-
value:
|
|
1984
|
+
value: e,
|
|
1939
1985
|
disabled: s,
|
|
1940
1986
|
onChange: () => {
|
|
1941
1987
|
},
|
|
1942
|
-
className:
|
|
1988
|
+
className: re(
|
|
1943
1989
|
"h-4 w-4 accent-grayWarm-900",
|
|
1944
1990
|
s ? "cursor-not-allowed" : "cursor-pointer"
|
|
1945
1991
|
),
|
|
@@ -1953,19 +1999,19 @@ const wt = (r) => {
|
|
|
1953
1999
|
]
|
|
1954
2000
|
}
|
|
1955
2001
|
)
|
|
1956
|
-
),
|
|
1957
|
-
selected:
|
|
2002
|
+
), Or = ({
|
|
2003
|
+
selected: e,
|
|
1958
2004
|
onSelect: t,
|
|
1959
2005
|
creditCardBody: n,
|
|
1960
2006
|
disabled: s = !1,
|
|
1961
2007
|
className: i
|
|
1962
2008
|
}) => {
|
|
1963
|
-
const l =
|
|
1964
|
-
return /* @__PURE__ */ a.jsxs("div", { className:
|
|
2009
|
+
const l = e === "credit_card";
|
|
2010
|
+
return /* @__PURE__ */ a.jsxs("div", { className: re("flex w-full flex-col gap-3", i), children: [
|
|
1965
2011
|
/* @__PURE__ */ a.jsxs(
|
|
1966
2012
|
"label",
|
|
1967
2013
|
{
|
|
1968
|
-
className:
|
|
2014
|
+
className: re(
|
|
1969
2015
|
"flex cursor-pointer flex-col gap-3 rounded-lg border px-4 py-3 transition-colors",
|
|
1970
2016
|
l ? "border-grayWarm-900 shadow-[0_0_0_1px_#1c1917]" : "border-grayWarm-200"
|
|
1971
2017
|
),
|
|
@@ -1983,7 +2029,7 @@ const wt = (r) => {
|
|
|
1983
2029
|
onChange: () => {
|
|
1984
2030
|
s || t("credit_card");
|
|
1985
2031
|
},
|
|
1986
|
-
className:
|
|
2032
|
+
className: re(
|
|
1987
2033
|
"h-4 w-4 accent-grayWarm-900",
|
|
1988
2034
|
s ? "cursor-not-allowed" : "cursor-pointer"
|
|
1989
2035
|
),
|
|
@@ -2011,34 +2057,34 @@ const wt = (r) => {
|
|
|
2011
2057
|
}
|
|
2012
2058
|
) : null,
|
|
2013
2059
|
/* @__PURE__ */ a.jsx(
|
|
2014
|
-
|
|
2060
|
+
hr,
|
|
2015
2061
|
{
|
|
2016
2062
|
type: "paypal",
|
|
2017
2063
|
label: "PayPal",
|
|
2018
|
-
iconNode: /* @__PURE__ */ a.jsx(
|
|
2064
|
+
iconNode: /* @__PURE__ */ a.jsx(br, { slug: "paypal", alt: "PayPal" }),
|
|
2019
2065
|
disabled: s
|
|
2020
2066
|
}
|
|
2021
2067
|
),
|
|
2022
2068
|
/* @__PURE__ */ a.jsx(
|
|
2023
|
-
|
|
2069
|
+
hr,
|
|
2024
2070
|
{
|
|
2025
2071
|
type: "googlepay",
|
|
2026
2072
|
label: "GooglePay",
|
|
2027
|
-
iconNode: /* @__PURE__ */ a.jsx(
|
|
2073
|
+
iconNode: /* @__PURE__ */ a.jsx(br, { slug: "google-pay", alt: "GooglePay" }),
|
|
2028
2074
|
disabled: s
|
|
2029
2075
|
}
|
|
2030
2076
|
),
|
|
2031
2077
|
/* @__PURE__ */ a.jsx(
|
|
2032
|
-
|
|
2078
|
+
hr,
|
|
2033
2079
|
{
|
|
2034
2080
|
type: "klarna",
|
|
2035
2081
|
label: "Klarna",
|
|
2036
|
-
iconNode: /* @__PURE__ */ a.jsx(
|
|
2082
|
+
iconNode: /* @__PURE__ */ a.jsx(br, { slug: "klarna", alt: "Klarna" }),
|
|
2037
2083
|
disabled: s
|
|
2038
2084
|
}
|
|
2039
2085
|
),
|
|
2040
2086
|
/* @__PURE__ */ a.jsx(
|
|
2041
|
-
|
|
2087
|
+
hr,
|
|
2042
2088
|
{
|
|
2043
2089
|
type: "ach",
|
|
2044
2090
|
label: "Bank account (ACH)",
|
|
@@ -2047,260 +2093,266 @@ const wt = (r) => {
|
|
|
2047
2093
|
}
|
|
2048
2094
|
)
|
|
2049
2095
|
] });
|
|
2050
|
-
},
|
|
2051
|
-
console.error("@movmo_app/payments: failed to update payment method",
|
|
2052
|
-
const t =
|
|
2096
|
+
}, Ar = "movmo-add-payment-form", zt = (e) => {
|
|
2097
|
+
console.error("@movmo_app/payments: failed to update payment method", e);
|
|
2098
|
+
const t = e instanceof Error ? e.message.trim() : "";
|
|
2053
2099
|
return /spreedly-backed cards/i.test(t) ? "This card's details can't be edited." : t || "Failed to update payment method.";
|
|
2054
|
-
},
|
|
2055
|
-
const t =
|
|
2100
|
+
}, Dr = (e) => {
|
|
2101
|
+
const t = e.filter((s) => s.isDefault), n = e.filter((s) => !s.isDefault);
|
|
2056
2102
|
return [...t, ...n];
|
|
2057
|
-
},
|
|
2103
|
+
}, $r = ({ message: e, testId: t }) => /* @__PURE__ */ a.jsx(
|
|
2058
2104
|
"p",
|
|
2059
2105
|
{
|
|
2060
2106
|
role: "alert",
|
|
2061
2107
|
"aria-live": "polite",
|
|
2062
2108
|
className: "mt-3 rounded-md bg-error-50 px-3 py-2 text-sm text-error-700",
|
|
2063
2109
|
"data-testid": t,
|
|
2064
|
-
children:
|
|
2110
|
+
children: e
|
|
2065
2111
|
}
|
|
2066
|
-
),
|
|
2112
|
+
), Mr = ({ withDefaultBadge: e = !1 }) => /* @__PURE__ */ a.jsxs("div", { className: "flex items-start justify-between py-4", "data-testid": "payment-method-skeleton", children: [
|
|
2067
2113
|
/* @__PURE__ */ a.jsxs("div", { className: "flex items-start gap-3", children: [
|
|
2068
2114
|
/* @__PURE__ */ a.jsx("div", { className: "h-8 w-[46px] flex-shrink-0 animate-pulse rounded bg-grayWarm-200" }),
|
|
2069
2115
|
/* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
|
|
2070
2116
|
/* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
2071
2117
|
/* @__PURE__ */ a.jsx("div", { className: "h-5 w-[120px] animate-pulse rounded bg-grayWarm-200" }),
|
|
2072
|
-
|
|
2118
|
+
e ? /* @__PURE__ */ a.jsx("div", { className: "h-5 w-[56px] animate-pulse rounded-full bg-grayWarm-200" }) : null
|
|
2073
2119
|
] }),
|
|
2074
2120
|
/* @__PURE__ */ a.jsx("div", { className: "h-4 w-[100px] animate-pulse rounded bg-grayWarm-200" })
|
|
2075
2121
|
] })
|
|
2076
2122
|
] }),
|
|
2077
2123
|
/* @__PURE__ */ a.jsx("div", { className: "h-5 w-5 flex-shrink-0 animate-pulse rounded-full bg-grayWarm-200" })
|
|
2078
|
-
] }),
|
|
2079
|
-
userId:
|
|
2124
|
+
] }), Lt = ({
|
|
2125
|
+
userId: e,
|
|
2080
2126
|
defaultCardholderName: t,
|
|
2081
2127
|
defaultCardholderFirstName: n,
|
|
2082
2128
|
defaultCardholderLastName: s,
|
|
2083
2129
|
selectedId: i,
|
|
2084
2130
|
onSelect: l,
|
|
2085
2131
|
onChange: u,
|
|
2086
|
-
onError:
|
|
2087
|
-
onEvent:
|
|
2088
|
-
paymentTypeSelector:
|
|
2089
|
-
autoSaveFirstCard:
|
|
2090
|
-
selectionSetsDefault:
|
|
2091
|
-
showDefaultBadge:
|
|
2092
|
-
collapsible:
|
|
2093
|
-
cardLabelFormat:
|
|
2094
|
-
className:
|
|
2132
|
+
onError: y,
|
|
2133
|
+
onEvent: p,
|
|
2134
|
+
paymentTypeSelector: E = !0,
|
|
2135
|
+
autoSaveFirstCard: j = !0,
|
|
2136
|
+
selectionSetsDefault: b = !1,
|
|
2137
|
+
showDefaultBadge: _ = !0,
|
|
2138
|
+
collapsible: x = !1,
|
|
2139
|
+
cardLabelFormat: P = "branded",
|
|
2140
|
+
className: $
|
|
2095
2141
|
}) => {
|
|
2096
|
-
const { items:
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
}, [
|
|
2100
|
-
const [
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
}, [
|
|
2104
|
-
const
|
|
2142
|
+
const { items: B, status: C, error: w, refetch: W } = Pt(e), { deletePaymentMethod: ve, status: fe } = Rt(e), { setDefault: _e, status: pe } = kt(e), { updatePaymentMethod: le, status: te } = St(e), [g, ge] = R([]), Re = U(g);
|
|
2143
|
+
O(() => {
|
|
2144
|
+
Re.current = g;
|
|
2145
|
+
}, [g]);
|
|
2146
|
+
const [Y, f] = R(null), [h, S] = R(!1), [M, se] = R(null), [oe, J] = R(!1), [Z, G] = R(!1), [T, X] = R(null), [ke, be] = R(null), [Q, Ne] = R(null), [ee, We] = R(!1), Se = U(!1), ce = U(y);
|
|
2147
|
+
O(() => {
|
|
2148
|
+
ce.current = y;
|
|
2149
|
+
}, [y]);
|
|
2150
|
+
const ae = D((d) => {
|
|
2151
|
+
var H;
|
|
2152
|
+
(H = ce.current) == null || H.call(ce, d);
|
|
2153
|
+
}, []), Oe = U(p);
|
|
2154
|
+
O(() => {
|
|
2155
|
+
Oe.current = p;
|
|
2156
|
+
}, [p]);
|
|
2157
|
+
const z = D((d, H) => {
|
|
2105
2158
|
var V;
|
|
2106
|
-
(V =
|
|
2107
|
-
}, []),
|
|
2108
|
-
W(() => {
|
|
2109
|
-
Oe.current = m;
|
|
2110
|
-
}, [m]);
|
|
2111
|
-
const U = A((d, V) => {
|
|
2112
|
-
var Y;
|
|
2113
|
-
(Y = Oe.current) == null || Y.call(Oe, d, V);
|
|
2114
|
-
}, []), ce = M(!1), Te = A(
|
|
2159
|
+
(V = Oe.current) == null || V.call(Oe, d, H);
|
|
2160
|
+
}, []), de = U(!1), Pe = D(
|
|
2115
2161
|
(d) => {
|
|
2116
2162
|
if (d.touchedInvalid.length === 0) {
|
|
2117
|
-
|
|
2163
|
+
de.current = !1;
|
|
2118
2164
|
return;
|
|
2119
2165
|
}
|
|
2120
|
-
|
|
2166
|
+
de.current || (de.current = !0, z("validation_error", {
|
|
2121
2167
|
field_count: d.touchedInvalid.length,
|
|
2122
2168
|
fields: d.touchedInvalid
|
|
2123
2169
|
}));
|
|
2124
2170
|
},
|
|
2125
|
-
[
|
|
2126
|
-
),
|
|
2127
|
-
|
|
2128
|
-
}, []),
|
|
2129
|
-
|
|
2130
|
-
|
|
2131
|
-
}, [
|
|
2132
|
-
const Ae =
|
|
2133
|
-
|
|
2134
|
-
if (
|
|
2135
|
-
if (Ae.current ===
|
|
2136
|
-
Ae.current =
|
|
2137
|
-
} else
|
|
2138
|
-
}, [
|
|
2139
|
-
if (!l ||
|
|
2140
|
-
|
|
2141
|
-
const d =
|
|
2171
|
+
[z]
|
|
2172
|
+
), ne = D(() => {
|
|
2173
|
+
S(!1), se(null), Ne(null), de.current = !1;
|
|
2174
|
+
}, []), Ce = t ?? ([n, s].filter(Boolean).join(" ") || void 0);
|
|
2175
|
+
O(() => {
|
|
2176
|
+
C === "ready" && ge(Dr(B));
|
|
2177
|
+
}, [B, C]);
|
|
2178
|
+
const Ae = U(null);
|
|
2179
|
+
O(() => {
|
|
2180
|
+
if (C === "error" && w) {
|
|
2181
|
+
if (Ae.current === w) return;
|
|
2182
|
+
Ae.current = w, ae({ source: "list", message: w });
|
|
2183
|
+
} else C !== "error" && (Ae.current = null);
|
|
2184
|
+
}, [C, w, ae]), O(() => {
|
|
2185
|
+
if (!l || Se.current || C !== "ready" || g.length === 0 || i) return;
|
|
2186
|
+
Se.current = !0, z("autoselected", { had_saved_methods: !0 });
|
|
2187
|
+
const d = g.find((H) => H.isDefault) ?? g[0];
|
|
2142
2188
|
l(d);
|
|
2143
|
-
}, [l,
|
|
2144
|
-
const xe =
|
|
2189
|
+
}, [l, C, g, i, z]);
|
|
2190
|
+
const xe = D(
|
|
2145
2191
|
(d) => {
|
|
2146
|
-
ge((
|
|
2147
|
-
const
|
|
2192
|
+
ge((H) => {
|
|
2193
|
+
const V = typeof d == "function" ? d(H) : d, L = Dr(V);
|
|
2148
2194
|
return queueMicrotask(() => u == null ? void 0 : u(L)), L;
|
|
2149
2195
|
});
|
|
2150
2196
|
},
|
|
2151
2197
|
[u]
|
|
2152
|
-
), Ve = fe === "pending" || pe === "pending" ||
|
|
2198
|
+
), Ve = fe === "pending" || pe === "pending" || te === "pending", we = D(
|
|
2153
2199
|
async (d) => {
|
|
2154
|
-
const
|
|
2155
|
-
|
|
2200
|
+
const H = g;
|
|
2201
|
+
f(null), xe((V) => V.map((L) => ({ ...L, isDefault: L.id === d.id })));
|
|
2156
2202
|
try {
|
|
2157
|
-
await
|
|
2158
|
-
} catch (
|
|
2159
|
-
ge(
|
|
2160
|
-
const L =
|
|
2161
|
-
|
|
2203
|
+
await _e(d.id), W(), z("set_default");
|
|
2204
|
+
} catch (V) {
|
|
2205
|
+
ge(H), u == null || u(H);
|
|
2206
|
+
const L = V instanceof Error ? V.message : "Failed to set default payment method.";
|
|
2207
|
+
f(L), ae({
|
|
2208
|
+
...lr("set-default", V, "Failed to set default payment method."),
|
|
2209
|
+
message: L
|
|
2210
|
+
});
|
|
2162
2211
|
}
|
|
2163
2212
|
},
|
|
2164
|
-
[
|
|
2165
|
-
),
|
|
2213
|
+
[g, xe, _e, W, u, ae, z]
|
|
2214
|
+
), ue = D(
|
|
2166
2215
|
(d) => {
|
|
2167
|
-
l == null || l(d),
|
|
2216
|
+
l == null || l(d), b && (d.isDefault || we(d));
|
|
2168
2217
|
},
|
|
2169
|
-
[l,
|
|
2170
|
-
), De =
|
|
2218
|
+
[l, b, we]
|
|
2219
|
+
), De = D(
|
|
2171
2220
|
(d) => {
|
|
2172
|
-
|
|
2221
|
+
z("selected", { method_count: g.length }), ue(d);
|
|
2173
2222
|
},
|
|
2174
|
-
[
|
|
2175
|
-
), $e =
|
|
2223
|
+
[z, g, ue]
|
|
2224
|
+
), $e = D(
|
|
2176
2225
|
async (d) => {
|
|
2177
|
-
const
|
|
2178
|
-
|
|
2179
|
-
const
|
|
2180
|
-
xe(() =>
|
|
2181
|
-
const L = d.id === i && l ?
|
|
2182
|
-
L &&
|
|
2183
|
-
const
|
|
2226
|
+
const H = g;
|
|
2227
|
+
f(null);
|
|
2228
|
+
const V = g.filter((Me) => Me.id !== d.id);
|
|
2229
|
+
xe(() => V);
|
|
2230
|
+
const L = d.id === i && l ? V.find((Me) => Me.isDefault) ?? V[0] ?? null : null;
|
|
2231
|
+
L && ue(L);
|
|
2232
|
+
const Ee = !!L && b && L !== null && !L.isDefault;
|
|
2184
2233
|
try {
|
|
2185
|
-
await ve(d.id),
|
|
2234
|
+
await ve(d.id), Ee || W(), z("deleted", { remaining_count: V.length });
|
|
2186
2235
|
} catch (Me) {
|
|
2187
|
-
ge(
|
|
2188
|
-
const
|
|
2189
|
-
|
|
2236
|
+
ge(H), u == null || u(H);
|
|
2237
|
+
const fr = Me instanceof Error ? Me.message : "Failed to delete payment method.";
|
|
2238
|
+
f(fr), ae({
|
|
2239
|
+
...lr("delete", Me, "Failed to delete payment method."),
|
|
2240
|
+
message: fr
|
|
2241
|
+
});
|
|
2190
2242
|
}
|
|
2191
2243
|
},
|
|
2192
2244
|
[
|
|
2193
|
-
|
|
2245
|
+
g,
|
|
2194
2246
|
xe,
|
|
2195
2247
|
ve,
|
|
2196
|
-
|
|
2248
|
+
W,
|
|
2197
2249
|
u,
|
|
2198
2250
|
i,
|
|
2199
2251
|
l,
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2203
|
-
|
|
2252
|
+
ue,
|
|
2253
|
+
b,
|
|
2254
|
+
ae,
|
|
2255
|
+
z
|
|
2204
2256
|
]
|
|
2205
|
-
),
|
|
2206
|
-
be(null),
|
|
2207
|
-
}, []), He =
|
|
2208
|
-
|
|
2209
|
-
}, []),
|
|
2257
|
+
), Ie = D((d) => {
|
|
2258
|
+
be(null), X(d);
|
|
2259
|
+
}, []), He = D(() => {
|
|
2260
|
+
X(null), be(null);
|
|
2261
|
+
}, []), Ue = D(
|
|
2210
2262
|
async (d) => {
|
|
2211
|
-
if (!
|
|
2212
|
-
const
|
|
2263
|
+
if (!T) return;
|
|
2264
|
+
const H = T, V = g;
|
|
2213
2265
|
be(null), xe(
|
|
2214
2266
|
(L) => L.map(
|
|
2215
|
-
(
|
|
2216
|
-
...
|
|
2267
|
+
(Ee) => Ee.id === H.id ? {
|
|
2268
|
+
...Ee,
|
|
2217
2269
|
...d.cardholderName !== void 0 ? { cardholderName: d.cardholderName } : {},
|
|
2218
2270
|
...d.zip !== void 0 ? { zip: d.zip } : {}
|
|
2219
|
-
} :
|
|
2271
|
+
} : Ee
|
|
2220
2272
|
)
|
|
2221
2273
|
);
|
|
2222
2274
|
try {
|
|
2223
|
-
await
|
|
2275
|
+
await le(H.id, d), He(), W(), z("edited", { fields: Object.keys(d) });
|
|
2224
2276
|
} catch (L) {
|
|
2225
|
-
ge(
|
|
2226
|
-
const
|
|
2227
|
-
be(
|
|
2277
|
+
ge(V), u == null || u(V);
|
|
2278
|
+
const Ee = zt(L);
|
|
2279
|
+
be(Ee), ae({ ...lr("update", L, Ee), message: Ee });
|
|
2228
2280
|
}
|
|
2229
2281
|
},
|
|
2230
2282
|
[
|
|
2231
|
-
|
|
2232
|
-
|
|
2283
|
+
T,
|
|
2284
|
+
g,
|
|
2233
2285
|
xe,
|
|
2234
|
-
|
|
2235
|
-
|
|
2286
|
+
le,
|
|
2287
|
+
W,
|
|
2236
2288
|
u,
|
|
2237
2289
|
He,
|
|
2238
|
-
|
|
2239
|
-
|
|
2290
|
+
ae,
|
|
2291
|
+
z
|
|
2240
2292
|
]
|
|
2241
|
-
),
|
|
2293
|
+
), Te = D(
|
|
2242
2294
|
(d) => {
|
|
2243
|
-
|
|
2295
|
+
ne(), xe((V) => [d, ...V.filter((L) => L.id !== d.id)]), ue(d), !!l && b && !d.isDefault || W(), z("added", { method_count: Re.current.length + 1 });
|
|
2244
2296
|
},
|
|
2245
|
-
[
|
|
2246
|
-
),
|
|
2247
|
-
|
|
2248
|
-
}, []),
|
|
2249
|
-
G(d), d &&
|
|
2250
|
-
}, []), he =
|
|
2297
|
+
[ne, xe, W, ue, l, b, z]
|
|
2298
|
+
), m = D((d) => {
|
|
2299
|
+
se(d);
|
|
2300
|
+
}, []), I = D((d) => {
|
|
2301
|
+
G(d), d && se(null);
|
|
2302
|
+
}, []), he = C === "ready" && g.length === 0, ie = typeof l == "function", cr = !ie && !x, dr = g.length === 0, ur = j && g.length === 0, ze = D(
|
|
2251
2303
|
(d) => /* @__PURE__ */ a.jsx(
|
|
2252
|
-
|
|
2304
|
+
Hr,
|
|
2253
2305
|
{
|
|
2254
|
-
userId:
|
|
2255
|
-
isDefault:
|
|
2256
|
-
defaultCardholderName:
|
|
2257
|
-
autoSave: !d &&
|
|
2306
|
+
userId: e,
|
|
2307
|
+
isDefault: dr,
|
|
2308
|
+
defaultCardholderName: Ce,
|
|
2309
|
+
autoSave: !d && ur,
|
|
2258
2310
|
hideInternalSaveButton: d,
|
|
2259
|
-
formId: d ?
|
|
2260
|
-
onCanSubmitChange: d ?
|
|
2261
|
-
onSavingChange:
|
|
2311
|
+
formId: d ? Ar : void 0,
|
|
2312
|
+
onCanSubmitChange: d ? J : void 0,
|
|
2313
|
+
onSavingChange: I,
|
|
2262
2314
|
autoFocus: d ? "number" : void 0,
|
|
2263
|
-
onSuccess:
|
|
2264
|
-
onError:
|
|
2265
|
-
onErrorDetail:
|
|
2266
|
-
onValidationChange:
|
|
2315
|
+
onSuccess: Te,
|
|
2316
|
+
onError: m,
|
|
2317
|
+
onErrorDetail: ae,
|
|
2318
|
+
onValidationChange: Pe
|
|
2267
2319
|
}
|
|
2268
2320
|
),
|
|
2269
2321
|
[
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2322
|
+
e,
|
|
2323
|
+
dr,
|
|
2324
|
+
Ce,
|
|
2325
|
+
ur,
|
|
2326
|
+
Te,
|
|
2327
|
+
m,
|
|
2328
|
+
I,
|
|
2329
|
+
ae,
|
|
2330
|
+
Pe
|
|
2279
2331
|
]
|
|
2280
|
-
),
|
|
2281
|
-
|
|
2332
|
+
), Ge = Be(() => ze(!1), [ze]), Fe = Be(() => ze(!0), [ze]), Le = !e, ar = Be(() => E ? /* @__PURE__ */ a.jsx(
|
|
2333
|
+
Or,
|
|
2282
2334
|
{
|
|
2283
|
-
selected:
|
|
2284
|
-
onSelect: (d) =>
|
|
2285
|
-
creditCardBody:
|
|
2335
|
+
selected: Q,
|
|
2336
|
+
onSelect: (d) => Ne(d),
|
|
2337
|
+
creditCardBody: Ge,
|
|
2286
2338
|
disabled: Le
|
|
2287
2339
|
}
|
|
2288
|
-
) :
|
|
2289
|
-
|
|
2340
|
+
) : Ge, [E, Q, Ge, Le]), mr = Be(() => E ? /* @__PURE__ */ a.jsx(
|
|
2341
|
+
Or,
|
|
2290
2342
|
{
|
|
2291
|
-
selected:
|
|
2292
|
-
onSelect: (d) =>
|
|
2343
|
+
selected: Q,
|
|
2344
|
+
onSelect: (d) => Ne(d),
|
|
2293
2345
|
creditCardBody: Fe,
|
|
2294
2346
|
disabled: Le
|
|
2295
2347
|
}
|
|
2296
|
-
) : Fe, [
|
|
2348
|
+
) : Fe, [E, Q, Fe, Le]);
|
|
2297
2349
|
return /* @__PURE__ */ a.jsxs(
|
|
2298
2350
|
"div",
|
|
2299
2351
|
{
|
|
2300
|
-
className:
|
|
2352
|
+
className: re("flex w-full flex-col gap-4", $),
|
|
2301
2353
|
"data-testid": "payment-methods-manager",
|
|
2302
2354
|
children: [
|
|
2303
|
-
|
|
2355
|
+
C === "loading" && g.length === 0 ? (
|
|
2304
2356
|
// Only show the skeleton on first load — during a silent refetch
|
|
2305
2357
|
// (e.g. after set-default or delete optimistic mutations), the user
|
|
2306
2358
|
// already sees the correct optimistic list and a skeleton flash
|
|
@@ -2308,20 +2360,20 @@ const wt = (r) => {
|
|
|
2308
2360
|
/* @__PURE__ */ a.jsxs(
|
|
2309
2361
|
"div",
|
|
2310
2362
|
{
|
|
2311
|
-
className:
|
|
2363
|
+
className: re(
|
|
2312
2364
|
// Match the real-list shell so layout doesn't reflow when data
|
|
2313
2365
|
// arrives. In selection mode the outer card is suppressed too.
|
|
2314
|
-
|
|
2366
|
+
cr ? "flex flex-col divide-y divide-grayWarm-200 rounded-xl border border-grayWarm-200 px-4 md:px-6" : "flex flex-col gap-2"
|
|
2315
2367
|
),
|
|
2316
2368
|
"data-testid": "payment-methods-loading",
|
|
2317
2369
|
children: [
|
|
2318
|
-
/* @__PURE__ */ a.jsx(
|
|
2319
|
-
/* @__PURE__ */ a.jsx(
|
|
2370
|
+
/* @__PURE__ */ a.jsx(Mr, { withDefaultBadge: !0 }),
|
|
2371
|
+
/* @__PURE__ */ a.jsx(Mr, {})
|
|
2320
2372
|
]
|
|
2321
2373
|
}
|
|
2322
2374
|
)
|
|
2323
2375
|
) : null,
|
|
2324
|
-
|
|
2376
|
+
C === "error" ? /* @__PURE__ */ a.jsxs(
|
|
2325
2377
|
"div",
|
|
2326
2378
|
{
|
|
2327
2379
|
role: "alert",
|
|
@@ -2329,12 +2381,12 @@ const wt = (r) => {
|
|
|
2329
2381
|
className: "flex items-center justify-between gap-3 rounded-md bg-error-50 p-3 text-sm text-error-700",
|
|
2330
2382
|
"data-testid": "payment-methods-list-error",
|
|
2331
2383
|
children: [
|
|
2332
|
-
/* @__PURE__ */ a.jsx("span", { children:
|
|
2384
|
+
/* @__PURE__ */ a.jsx("span", { children: w ?? "Failed to load payment methods." }),
|
|
2333
2385
|
/* @__PURE__ */ a.jsx(
|
|
2334
2386
|
"button",
|
|
2335
2387
|
{
|
|
2336
2388
|
type: "button",
|
|
2337
|
-
onClick:
|
|
2389
|
+
onClick: W,
|
|
2338
2390
|
className: "rounded-md border border-error-700 px-3 py-1 text-xs font-semibold text-error-700 hover:bg-error-50",
|
|
2339
2391
|
children: "Retry"
|
|
2340
2392
|
}
|
|
@@ -2342,27 +2394,27 @@ const wt = (r) => {
|
|
|
2342
2394
|
]
|
|
2343
2395
|
}
|
|
2344
2396
|
) : null,
|
|
2345
|
-
|
|
2397
|
+
Y ? /* @__PURE__ */ a.jsx(
|
|
2346
2398
|
"div",
|
|
2347
2399
|
{
|
|
2348
2400
|
role: "alert",
|
|
2349
2401
|
"aria-live": "polite",
|
|
2350
2402
|
className: "rounded-md bg-error-50 p-3 text-sm text-error-700",
|
|
2351
2403
|
"data-testid": "payment-methods-mutation-error",
|
|
2352
|
-
children:
|
|
2404
|
+
children: Y
|
|
2353
2405
|
}
|
|
2354
2406
|
) : null,
|
|
2355
|
-
|
|
2407
|
+
x && g.length > 0 ? /* @__PURE__ */ a.jsx("div", { className: "border-t border-grayWarm-200 pt-4", children: /* @__PURE__ */ a.jsxs(
|
|
2356
2408
|
"div",
|
|
2357
2409
|
{
|
|
2358
2410
|
className: "flex items-center justify-between",
|
|
2359
|
-
"data-testid":
|
|
2411
|
+
"data-testid": ee ? "payment-methods-drawer-header" : "payment-methods-collapsed-preview",
|
|
2360
2412
|
children: [
|
|
2361
|
-
|
|
2362
|
-
|
|
2413
|
+
ee ? /* @__PURE__ */ a.jsx("h3", { className: "text-md font-semibold text-grayWarm-950", children: "Payment methods" }) : /* @__PURE__ */ a.jsx(
|
|
2414
|
+
Dt,
|
|
2363
2415
|
{
|
|
2364
|
-
method:
|
|
2365
|
-
cardLabelFormat:
|
|
2416
|
+
method: g.find((d) => d.id === i) ?? g.find((d) => d.isDefault) ?? g[0],
|
|
2417
|
+
cardLabelFormat: P,
|
|
2366
2418
|
className: "flex-1"
|
|
2367
2419
|
}
|
|
2368
2420
|
),
|
|
@@ -2370,15 +2422,15 @@ const wt = (r) => {
|
|
|
2370
2422
|
"button",
|
|
2371
2423
|
{
|
|
2372
2424
|
type: "button",
|
|
2373
|
-
"aria-label":
|
|
2374
|
-
"aria-expanded":
|
|
2425
|
+
"aria-label": ee ? "Collapse payment methods" : "Expand payment methods",
|
|
2426
|
+
"aria-expanded": ee,
|
|
2375
2427
|
className: "bg-grayWarm-100 p-2 rounded-lg hover:bg-grayWarm-200 transition-colors",
|
|
2376
2428
|
onClick: () => We((d) => !d),
|
|
2377
|
-
"data-testid":
|
|
2429
|
+
"data-testid": ee ? "payment-methods-drawer-close" : "payment-methods-drawer-open",
|
|
2378
2430
|
children: /* @__PURE__ */ a.jsx(
|
|
2379
2431
|
"img",
|
|
2380
2432
|
{
|
|
2381
|
-
src: `${
|
|
2433
|
+
src: `${tr().iconCdnBaseUrl}/website/assets/icons/chevron-${ee ? "up" : "down"}-double.svg`,
|
|
2382
2434
|
alt: "",
|
|
2383
2435
|
className: "w-5 h-5"
|
|
2384
2436
|
}
|
|
@@ -2388,31 +2440,31 @@ const wt = (r) => {
|
|
|
2388
2440
|
]
|
|
2389
2441
|
}
|
|
2390
2442
|
) }) : null,
|
|
2391
|
-
|
|
2443
|
+
g.length > 0 && (!x || ee) ? /* @__PURE__ */ a.jsx(
|
|
2392
2444
|
"div",
|
|
2393
2445
|
{
|
|
2394
|
-
className:
|
|
2446
|
+
className: re(
|
|
2395
2447
|
"flex flex-col",
|
|
2396
2448
|
// accounts-ui (non-selectable, non-collapsible): rounded outer card
|
|
2397
2449
|
// with divide-y separators between rows.
|
|
2398
2450
|
// flights-ui (selectable or collapsible): bare space-y-3 gap between
|
|
2399
2451
|
// per-row bordered tiles; no outer card chrome.
|
|
2400
|
-
|
|
2452
|
+
cr ? "rounded-xl border border-grayWarm-200 px-4 md:px-6 divide-y divide-grayWarm-200" : "space-y-3"
|
|
2401
2453
|
),
|
|
2402
|
-
children:
|
|
2403
|
-
|
|
2454
|
+
children: g.map((d) => /* @__PURE__ */ a.jsx(
|
|
2455
|
+
It,
|
|
2404
2456
|
{
|
|
2405
2457
|
method: d,
|
|
2406
|
-
selectable:
|
|
2407
|
-
selected:
|
|
2458
|
+
selectable: ie,
|
|
2459
|
+
selected: ie && d.id === i,
|
|
2408
2460
|
onSelect: De,
|
|
2409
2461
|
onSetDefault: we,
|
|
2410
2462
|
onRemove: $e,
|
|
2411
|
-
onEdit:
|
|
2463
|
+
onEdit: Ie,
|
|
2412
2464
|
disabled: Ve,
|
|
2413
|
-
showDefaultBadge:
|
|
2414
|
-
hideSetDefaultMenuItem:
|
|
2415
|
-
cardLabelFormat:
|
|
2465
|
+
showDefaultBadge: _,
|
|
2466
|
+
hideSetDefaultMenuItem: b,
|
|
2467
|
+
cardLabelFormat: P
|
|
2416
2468
|
},
|
|
2417
2469
|
d.id
|
|
2418
2470
|
))
|
|
@@ -2421,10 +2473,10 @@ const wt = (r) => {
|
|
|
2421
2473
|
he ? (
|
|
2422
2474
|
// Empty state: render the add-card body inline (per Figma 1536-21454).
|
|
2423
2475
|
/* @__PURE__ */ a.jsxs("div", { "data-testid": "payment-methods-empty", children: [
|
|
2424
|
-
|
|
2425
|
-
|
|
2476
|
+
ar,
|
|
2477
|
+
M && !h ? /* @__PURE__ */ a.jsx($r, { message: M, testId: "payment-methods-inline-error" }) : null
|
|
2426
2478
|
] })
|
|
2427
|
-
) :
|
|
2479
|
+
) : g.length > 0 && (!x || ee) ? (
|
|
2428
2480
|
// Keep the Add button visible during silent refetches (status flips
|
|
2429
2481
|
// back to 'loading' transiently after set-default / delete).
|
|
2430
2482
|
// In collapsible mode only show the Add button when the drawer is open.
|
|
@@ -2433,7 +2485,7 @@ const wt = (r) => {
|
|
|
2433
2485
|
{
|
|
2434
2486
|
type: "button",
|
|
2435
2487
|
onClick: () => {
|
|
2436
|
-
|
|
2488
|
+
se(null), Ne(null), J(!1), S(!0), de.current = !1;
|
|
2437
2489
|
},
|
|
2438
2490
|
onMouseEnter: () => {
|
|
2439
2491
|
jr().catch(() => {
|
|
@@ -2450,119 +2502,132 @@ const wt = (r) => {
|
|
|
2450
2502
|
)
|
|
2451
2503
|
) : null,
|
|
2452
2504
|
/* @__PURE__ */ a.jsxs(
|
|
2453
|
-
|
|
2505
|
+
Tt,
|
|
2454
2506
|
{
|
|
2455
|
-
open:
|
|
2456
|
-
onClose:
|
|
2457
|
-
formId:
|
|
2507
|
+
open: h,
|
|
2508
|
+
onClose: ne,
|
|
2509
|
+
formId: Ar,
|
|
2458
2510
|
saveDisabled: !oe,
|
|
2459
|
-
isSaving:
|
|
2511
|
+
isSaving: Z,
|
|
2460
2512
|
children: [
|
|
2461
|
-
|
|
2462
|
-
|
|
2513
|
+
mr,
|
|
2514
|
+
M ? /* @__PURE__ */ a.jsx($r, { message: M, testId: "payment-methods-modal-error" }) : null
|
|
2463
2515
|
]
|
|
2464
2516
|
}
|
|
2465
2517
|
),
|
|
2466
2518
|
/* @__PURE__ */ a.jsx(
|
|
2467
|
-
|
|
2519
|
+
Ot,
|
|
2468
2520
|
{
|
|
2469
|
-
open:
|
|
2470
|
-
method:
|
|
2521
|
+
open: T !== null,
|
|
2522
|
+
method: T,
|
|
2471
2523
|
onClose: He,
|
|
2472
|
-
onSave:
|
|
2473
|
-
isSaving:
|
|
2474
|
-
error:
|
|
2524
|
+
onSave: Ue,
|
|
2525
|
+
isSaving: te === "pending",
|
|
2526
|
+
error: ke
|
|
2475
2527
|
}
|
|
2476
2528
|
)
|
|
2477
2529
|
]
|
|
2478
2530
|
}
|
|
2479
2531
|
);
|
|
2480
2532
|
};
|
|
2481
|
-
|
|
2482
|
-
const
|
|
2533
|
+
Lt.displayName = "PaymentMethodsManager";
|
|
2534
|
+
const Bt = "/v1/auth/", Yt = "movmo_csrf_token", Vt = /* @__PURE__ */ new Set([
|
|
2535
|
+
"reauth_required",
|
|
2536
|
+
"movmo_session_required",
|
|
2537
|
+
"first_party_only",
|
|
2538
|
+
"recovery_cooldown"
|
|
2539
|
+
]), Ht = (e) => {
|
|
2483
2540
|
if (typeof document > "u") return null;
|
|
2484
2541
|
const t = document.cookie ? document.cookie.split(";") : [];
|
|
2485
2542
|
for (const n of t) {
|
|
2486
2543
|
const s = n.trim();
|
|
2487
|
-
if (s.startsWith(
|
|
2488
|
-
return decodeURIComponent(s.substring(
|
|
2544
|
+
if (s.startsWith(e + "="))
|
|
2545
|
+
return decodeURIComponent(s.substring(e.length + 1));
|
|
2489
2546
|
}
|
|
2490
2547
|
return null;
|
|
2491
|
-
},
|
|
2548
|
+
}, qt = (e) => typeof e == "string" ? e : e instanceof URL ? e.href : e.url, Gt = () => {
|
|
2492
2549
|
if (typeof globalThis < "u" && typeof globalThis.fetch == "function")
|
|
2493
2550
|
return globalThis.fetch.bind(globalThis);
|
|
2494
2551
|
throw new Error("@movmo_app/payments: no global fetch available in this environment");
|
|
2495
|
-
},
|
|
2552
|
+
}, Xt = (e) => {
|
|
2496
2553
|
const {
|
|
2497
2554
|
refreshSession: t,
|
|
2498
2555
|
onRefreshFailed: n,
|
|
2499
|
-
csrfCookieName: s =
|
|
2556
|
+
csrfCookieName: s = Yt,
|
|
2500
2557
|
extraHeaders: i,
|
|
2501
|
-
authPathFragment: l =
|
|
2502
|
-
baseFetch: u =
|
|
2503
|
-
readCookie:
|
|
2504
|
-
} =
|
|
2505
|
-
let
|
|
2506
|
-
const
|
|
2507
|
-
if (
|
|
2508
|
-
const
|
|
2558
|
+
authPathFragment: l = Bt,
|
|
2559
|
+
baseFetch: u = Gt(),
|
|
2560
|
+
readCookie: y = Ht
|
|
2561
|
+
} = e, p = new Set(e.noRefreshCodes ?? Vt);
|
|
2562
|
+
let E = null;
|
|
2563
|
+
const j = () => {
|
|
2564
|
+
if (E) return E;
|
|
2565
|
+
const _ = (async () => {
|
|
2509
2566
|
await t();
|
|
2510
2567
|
})();
|
|
2511
|
-
return
|
|
2512
|
-
|
|
2568
|
+
return E = _, _.finally(() => {
|
|
2569
|
+
E === _ && (E = null);
|
|
2513
2570
|
}).catch(() => {
|
|
2514
|
-
}),
|
|
2515
|
-
},
|
|
2516
|
-
const
|
|
2517
|
-
if (
|
|
2518
|
-
const
|
|
2519
|
-
for (const [
|
|
2520
|
-
|
|
2571
|
+
}), _;
|
|
2572
|
+
}, b = (_, x) => {
|
|
2573
|
+
const P = new Headers(x == null ? void 0 : x.headers), $ = y(s);
|
|
2574
|
+
if ($ && !P.has("X-CSRF-Token") && P.set("X-CSRF-Token", $), i) {
|
|
2575
|
+
const B = i(_, x);
|
|
2576
|
+
for (const [C, w] of Object.entries(B))
|
|
2577
|
+
P.has(C) || P.set(C, w);
|
|
2521
2578
|
}
|
|
2522
2579
|
return {
|
|
2523
|
-
...
|
|
2524
|
-
headers:
|
|
2525
|
-
credentials: (
|
|
2580
|
+
...x,
|
|
2581
|
+
headers: P,
|
|
2582
|
+
credentials: (x == null ? void 0 : x.credentials) ?? "include"
|
|
2526
2583
|
};
|
|
2527
2584
|
};
|
|
2528
|
-
return async function(
|
|
2529
|
-
const
|
|
2530
|
-
if (
|
|
2531
|
-
return
|
|
2585
|
+
return async function(x, P) {
|
|
2586
|
+
const $ = await u(x, b(x, P));
|
|
2587
|
+
if (qt(x).includes(l) || $.status !== 401 && $.status !== 403)
|
|
2588
|
+
return $;
|
|
2589
|
+
if ($.status === 403)
|
|
2590
|
+
try {
|
|
2591
|
+
const w = await $.clone().json(), W = w == null ? void 0 : w.code;
|
|
2592
|
+
if (typeof W == "string" && p.has(W)) return $;
|
|
2593
|
+
} catch {
|
|
2594
|
+
}
|
|
2532
2595
|
try {
|
|
2533
|
-
await
|
|
2534
|
-
} catch (
|
|
2596
|
+
await j();
|
|
2597
|
+
} catch (w) {
|
|
2535
2598
|
try {
|
|
2536
|
-
n(
|
|
2537
|
-
} catch (
|
|
2599
|
+
n(w);
|
|
2600
|
+
} catch (W) {
|
|
2538
2601
|
console.error(
|
|
2539
2602
|
"@movmo_app/payments: onRefreshFailed callback threw — auth retry path is misconfigured",
|
|
2540
|
-
|
|
2603
|
+
W
|
|
2541
2604
|
);
|
|
2542
2605
|
}
|
|
2543
|
-
return
|
|
2606
|
+
return $;
|
|
2544
2607
|
}
|
|
2545
2608
|
try {
|
|
2546
|
-
return await u(
|
|
2547
|
-
} catch (
|
|
2609
|
+
return await u(x, b(x, P));
|
|
2610
|
+
} catch (w) {
|
|
2548
2611
|
return console.error(
|
|
2549
2612
|
"@movmo_app/payments: retry after token refresh failed — returning original response",
|
|
2550
|
-
|
|
2551
|
-
),
|
|
2613
|
+
w
|
|
2614
|
+
), $;
|
|
2552
2615
|
}
|
|
2553
2616
|
};
|
|
2554
2617
|
};
|
|
2555
2618
|
export {
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
Dt as
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2619
|
+
Vt as DEFAULT_NO_REFRESH_CODES,
|
|
2620
|
+
Hr as MovmoCardForm,
|
|
2621
|
+
Dt as PaymentMethodPreview,
|
|
2622
|
+
Lt as PaymentMethodsManager,
|
|
2623
|
+
zr as PaymentsApiError,
|
|
2624
|
+
Xt as createMovmoAuthFetch,
|
|
2625
|
+
tr as getPaymentsConfig,
|
|
2626
|
+
Zt as setPaymentsConfig,
|
|
2627
|
+
Rt as useDeletePaymentMethod,
|
|
2628
|
+
wt as useMovmoCardFields,
|
|
2629
|
+
kt as useSetDefaultPaymentMethod,
|
|
2630
|
+
St as useUpdatePaymentMethod,
|
|
2631
|
+
Pt as useUserPaymentMethods
|
|
2567
2632
|
};
|
|
2568
2633
|
//# sourceMappingURL=index.es.js.map
|