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