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