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