@movmo_app/payments 0.3.0 → 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 +53 -0
- package/dist/index.es.js +1126 -950
- 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: {} }, Ae = {};
|
|
|
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,57 +33,57 @@ var $e = {};
|
|
|
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 s =
|
|
43
|
+
var s = P && e[P] || e[D];
|
|
44
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 s = arguments.length,
|
|
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 F =
|
|
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;
|
|
@@ -94,30 +94,30 @@ function Vr() {
|
|
|
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
|
|
106
|
+
case v:
|
|
107
107
|
var s = e;
|
|
108
|
-
return
|
|
108
|
+
return W(s) + ".Consumer";
|
|
109
|
+
case d:
|
|
110
|
+
var l = e;
|
|
111
|
+
return W(l._context) + ".Provider";
|
|
109
112
|
case m:
|
|
110
|
-
|
|
111
|
-
return S(i._context) + ".Provider";
|
|
113
|
+
return f(e, e.render, "ForwardRef");
|
|
112
114
|
case p:
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
case v: {
|
|
118
|
-
var C = e, F = C._payload, w = C._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
221
|
var F;
|
|
222
|
-
F =
|
|
222
|
+
F = te.current, te.current = null, xe();
|
|
223
223
|
try {
|
|
224
224
|
if (s) {
|
|
225
|
-
var
|
|
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
|
|
283
|
+
function ye(e) {
|
|
284
284
|
var s = e.prototype;
|
|
285
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 m:
|
|
303
|
+
return Ce(e.render);
|
|
302
304
|
case p:
|
|
303
|
-
return
|
|
304
|
-
case
|
|
305
|
-
|
|
306
|
-
case v: {
|
|
307
|
-
var f = e, C = f._payload, F = f._init;
|
|
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 s = e._owner,
|
|
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 F = Function.call.bind(
|
|
327
|
-
for (var
|
|
328
|
-
if (F(e,
|
|
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 s = typeof Symbol == "function" && Symbol.toStringTag,
|
|
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 (
|
|
372
|
+
}, Je, Ze;
|
|
373
|
+
function u(e) {
|
|
374
|
+
if (j.call(e, "ref")) {
|
|
375
375
|
var s = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
376
376
|
if (s && s.isReactWarning)
|
|
377
377
|
return !1;
|
|
378
378
|
}
|
|
379
379
|
return e.ref !== void 0;
|
|
380
380
|
}
|
|
381
|
-
function
|
|
382
|
-
if (
|
|
381
|
+
function ne(e) {
|
|
382
|
+
if (j.call(e, "key")) {
|
|
383
383
|
var s = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
384
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
420
|
key: s,
|
|
421
|
-
ref:
|
|
422
|
-
props:
|
|
421
|
+
ref: l,
|
|
422
|
+
props: E,
|
|
423
423
|
// Record the component responsible for creating this element.
|
|
424
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 F,
|
|
446
|
-
|
|
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
447
|
for (F in s)
|
|
448
|
-
|
|
448
|
+
j.call(s, F) && !Le.hasOwnProperty(F) && (E[F] = s[F]);
|
|
449
449
|
if (e && e.defaultProps) {
|
|
450
|
-
var
|
|
451
|
-
for (F in
|
|
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 s = e._owner,
|
|
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,51 +483,51 @@ 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 s =
|
|
492
|
+
var s = pr();
|
|
493
493
|
if (!s) {
|
|
494
|
-
var
|
|
495
|
-
|
|
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
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 F =
|
|
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
|
}
|
|
@@ -536,284 +536,288 @@ Check the top-level render call using <` + i + ">.");
|
|
|
536
536
|
var s = e.type;
|
|
537
537
|
if (s == null || typeof s == "string")
|
|
538
538
|
return;
|
|
539
|
-
var
|
|
539
|
+
var l;
|
|
540
540
|
if (typeof s == "function")
|
|
541
|
-
|
|
542
|
-
else if (typeof s == "object" && (s.$$typeof ===
|
|
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
|
-
s.$$typeof ===
|
|
545
|
-
|
|
544
|
+
s.$$typeof === p))
|
|
545
|
+
l = s.propTypes;
|
|
546
546
|
else
|
|
547
547
|
return;
|
|
548
|
-
if (
|
|
549
|
-
var
|
|
550
|
-
|
|
551
|
-
} else if (s.PropTypes !== void 0 && !
|
|
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 s.getDefaultProps == "function" && !s.getDefaultProps.isReactClassApproved &&
|
|
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 s = Object.keys(e.props),
|
|
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
|
|
626
|
+
process.env.NODE_ENV === "production" ? dr.exports = qr() : dr.exports = Gr();
|
|
627
|
+
var a = dr.exports;
|
|
628
|
+
function Sr(r) {
|
|
629
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 <
|
|
632
|
+
var i = r.length;
|
|
633
|
+
for (t = 0; t < i; t++) r[t] && (n = Sr(r[t])) && (o && (o += " "), o += n);
|
|
634
634
|
} else for (n in r) r[n] && (o && (o += " "), o += n);
|
|
635
635
|
return o;
|
|
636
636
|
}
|
|
637
637
|
function Q() {
|
|
638
|
-
for (var r, t, n = 0, o = "",
|
|
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
|
-
},
|
|
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
646
|
var n;
|
|
647
647
|
const t = globalThis.process;
|
|
648
648
|
return (n = t == null ? void 0 : t.env) == null ? void 0 : n[r];
|
|
649
|
-
},
|
|
650
|
-
baseUrl:
|
|
651
|
-
spreedlyScriptUrl:
|
|
652
|
-
iconCdnBaseUrl:
|
|
653
|
-
fetch:
|
|
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: n } =
|
|
676
|
+
}, Me = (r, t) => {
|
|
677
|
+
const { fetch: n } = Ue();
|
|
675
678
|
return n(r, t);
|
|
676
|
-
},
|
|
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 De(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
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 n = await
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
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
|
+
);
|
|
740
744
|
if (!n.ok)
|
|
741
|
-
throw new Error(await
|
|
742
|
-
return (await n.json() ?? []).map(
|
|
743
|
-
},
|
|
744
|
-
const n = await
|
|
745
|
-
|
|
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(
|
|
746
750
|
`/v1/users/${encodeURIComponent(r)}/payment-methods/${encodeURIComponent(t)}`
|
|
747
751
|
),
|
|
748
752
|
{
|
|
749
753
|
method: "DELETE",
|
|
750
|
-
headers:
|
|
754
|
+
headers: De,
|
|
751
755
|
credentials: "include"
|
|
752
756
|
}
|
|
753
757
|
);
|
|
754
758
|
if (!n.ok)
|
|
755
|
-
throw new Error(await
|
|
756
|
-
},
|
|
757
|
-
const o = await
|
|
758
|
-
|
|
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(
|
|
759
763
|
`/v1/users/${encodeURIComponent(r)}/payment-methods/${encodeURIComponent(t)}`
|
|
760
764
|
),
|
|
761
765
|
{
|
|
762
766
|
method: "PUT",
|
|
763
|
-
headers:
|
|
767
|
+
headers: De,
|
|
764
768
|
credentials: "include",
|
|
765
769
|
body: JSON.stringify(n)
|
|
766
770
|
}
|
|
767
771
|
);
|
|
768
772
|
if (!o.ok)
|
|
769
|
-
throw new Error(await
|
|
770
|
-
},
|
|
773
|
+
throw new Error(await Ae(o, `Failed to update payment method (${o.status})`));
|
|
774
|
+
}, rt = {
|
|
771
775
|
visa: "visa",
|
|
772
776
|
master: "mastercard",
|
|
773
777
|
mastercard: "mastercard",
|
|
774
778
|
american_express: "amex",
|
|
775
779
|
amex: "amex",
|
|
776
780
|
discover: "discover"
|
|
777
|
-
},
|
|
781
|
+
}, tt = 28, _e = ({
|
|
778
782
|
brand: r,
|
|
779
783
|
className: t,
|
|
780
784
|
width: n = 46
|
|
781
785
|
}) => {
|
|
782
|
-
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();
|
|
783
787
|
return /* @__PURE__ */ a.jsx(
|
|
784
788
|
"img",
|
|
785
789
|
{
|
|
786
|
-
src: `${
|
|
790
|
+
src: `${d}/website/assets/icons/payments/${o}.svg`,
|
|
787
791
|
alt: o === "credit-card" ? "card" : `${o} card`,
|
|
788
792
|
"data-testid": `card-brand-${r.toLowerCase()}`,
|
|
789
793
|
className: t,
|
|
790
|
-
width:
|
|
794
|
+
width: i,
|
|
791
795
|
height: c,
|
|
792
796
|
loading: "lazy"
|
|
793
797
|
}
|
|
794
798
|
);
|
|
795
799
|
};
|
|
796
|
-
let
|
|
797
|
-
const
|
|
800
|
+
let Ve = null;
|
|
801
|
+
const at = () => {
|
|
798
802
|
if (typeof window > "u")
|
|
799
803
|
return Promise.reject(new Error("Spreedly can only be loaded in a browser environment."));
|
|
800
804
|
if (window.Spreedly)
|
|
801
805
|
return Promise.resolve(window.Spreedly);
|
|
802
|
-
if (
|
|
803
|
-
return
|
|
804
|
-
const { spreedlyScriptUrl: r } =
|
|
805
|
-
return
|
|
806
|
+
if (Ve)
|
|
807
|
+
return Ve;
|
|
808
|
+
const { spreedlyScriptUrl: r } = Ue();
|
|
809
|
+
return Ve = new Promise((t, n) => {
|
|
806
810
|
const o = document.querySelector(
|
|
807
811
|
`script[src="${r}"]`
|
|
808
|
-
),
|
|
812
|
+
), i = () => {
|
|
809
813
|
window.Spreedly ? t(window.Spreedly) : n(new Error("Spreedly script loaded but window.Spreedly is undefined."));
|
|
810
814
|
};
|
|
811
815
|
if (o) {
|
|
812
816
|
if (window.Spreedly) {
|
|
813
|
-
|
|
817
|
+
i();
|
|
814
818
|
return;
|
|
815
819
|
}
|
|
816
|
-
o.addEventListener("load",
|
|
820
|
+
o.addEventListener("load", i, { once: !0 }), o.addEventListener(
|
|
817
821
|
"error",
|
|
818
822
|
() => {
|
|
819
823
|
o.remove(), n(new Error("Failed to load Spreedly iframe script."));
|
|
@@ -823,143 +827,143 @@ const rt = () => {
|
|
|
823
827
|
return;
|
|
824
828
|
}
|
|
825
829
|
const c = document.createElement("script");
|
|
826
|
-
c.src = r, c.async = !0, c.onload =
|
|
830
|
+
c.src = r, c.async = !0, c.onload = i, c.onerror = () => {
|
|
827
831
|
c.remove(), n(new Error("Failed to load Spreedly iframe script."));
|
|
828
832
|
}, document.head.appendChild(c);
|
|
829
833
|
}).catch((t) => {
|
|
830
|
-
throw
|
|
831
|
-
}),
|
|
832
|
-
},
|
|
834
|
+
throw Ve = null, t;
|
|
835
|
+
}), Ve;
|
|
836
|
+
}, nt = "movmo-card-number", st = "movmo-card-cvv", ot = (r) => ({
|
|
833
837
|
first_name: r.firstName,
|
|
834
838
|
last_name: r.lastName,
|
|
835
839
|
month: r.month,
|
|
836
840
|
year: r.year,
|
|
837
841
|
...r.email ? { email: r.email } : {},
|
|
838
842
|
...r.zip ? { zip: r.zip } : {}
|
|
839
|
-
}),
|
|
843
|
+
}), it = (r = {}) => {
|
|
840
844
|
const {
|
|
841
|
-
numberEl: t =
|
|
842
|
-
cvvEl: n =
|
|
845
|
+
numberEl: t = nt,
|
|
846
|
+
cvvEl: n = st,
|
|
843
847
|
onCardTokenized: o,
|
|
844
|
-
onFieldErrors:
|
|
848
|
+
onFieldErrors: i,
|
|
845
849
|
onValidityChange: c,
|
|
846
|
-
onBrandChange:
|
|
847
|
-
} = r, [
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
}, [o]),
|
|
851
|
-
|
|
852
|
-
}, [
|
|
853
|
-
|
|
854
|
-
}, [c]),
|
|
855
|
-
|
|
856
|
-
}, [
|
|
857
|
-
const
|
|
858
|
-
|
|
859
|
-
let
|
|
860
|
-
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 () => {
|
|
861
865
|
try {
|
|
862
|
-
const [
|
|
863
|
-
|
|
864
|
-
|
|
866
|
+
const [S, f] = await Promise.all([
|
|
867
|
+
mr(),
|
|
868
|
+
at()
|
|
865
869
|
]);
|
|
866
|
-
if (
|
|
867
|
-
|
|
868
|
-
var
|
|
869
|
-
if (!
|
|
870
|
-
|
|
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");
|
|
871
875
|
try {
|
|
872
|
-
(
|
|
876
|
+
(W = f.setFieldType) == null || W.call(f, "number", "tel"), (R = f.setFieldType) == null || R.call(f, "cvv", "tel");
|
|
873
877
|
} catch {
|
|
874
878
|
}
|
|
875
879
|
try {
|
|
876
|
-
typeof
|
|
880
|
+
typeof f.setNumberFormat == "function" ? f.setNumberFormat("prettyFormat") : console.warn(
|
|
877
881
|
"@movmo_app/payments: Spreedly.setNumberFormat is missing — card-number digits will not be space-grouped."
|
|
878
882
|
);
|
|
879
|
-
} catch (
|
|
880
|
-
console.warn("@movmo_app/payments: setNumberFormat failed",
|
|
883
|
+
} catch (re) {
|
|
884
|
+
console.warn("@movmo_app/payments: setNumberFormat failed", re);
|
|
881
885
|
}
|
|
882
886
|
try {
|
|
883
|
-
(
|
|
884
|
-
const
|
|
885
|
-
(
|
|
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);
|
|
886
890
|
} catch {
|
|
887
891
|
}
|
|
888
892
|
}
|
|
889
|
-
}),
|
|
890
|
-
var
|
|
891
|
-
(
|
|
892
|
-
}),
|
|
893
|
-
var
|
|
894
|
-
(
|
|
895
|
-
}),
|
|
896
|
-
var
|
|
897
|
-
if (
|
|
898
|
-
if (
|
|
899
|
-
|
|
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 });
|
|
900
904
|
return;
|
|
901
905
|
}
|
|
902
|
-
if (
|
|
903
|
-
|
|
906
|
+
if (R === "blur") {
|
|
907
|
+
$((O) => O[W] ? { ...O, [W]: !1 } : O);
|
|
904
908
|
return;
|
|
905
909
|
}
|
|
906
|
-
if (
|
|
907
|
-
const
|
|
908
|
-
if (
|
|
909
|
-
if (
|
|
910
|
-
|
|
911
|
-
var
|
|
912
|
-
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;
|
|
913
917
|
});
|
|
914
|
-
else if (
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
var
|
|
918
|
-
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;
|
|
919
923
|
});
|
|
920
924
|
}
|
|
921
925
|
}
|
|
922
|
-
const
|
|
923
|
-
if (typeof
|
|
924
|
-
const
|
|
925
|
-
(
|
|
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));
|
|
926
930
|
}
|
|
927
|
-
}),
|
|
928
|
-
var
|
|
929
|
-
const
|
|
930
|
-
(
|
|
931
|
-
}),
|
|
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, {
|
|
932
936
|
numberEl: t,
|
|
933
937
|
cvvEl: n,
|
|
934
|
-
nonce:
|
|
935
|
-
timestamp: String(
|
|
936
|
-
certificateToken:
|
|
937
|
-
signature:
|
|
938
|
+
nonce: S.nonce,
|
|
939
|
+
timestamp: String(S.timestamp),
|
|
940
|
+
certificateToken: S.certificateToken,
|
|
941
|
+
signature: S.signature
|
|
938
942
|
});
|
|
939
|
-
} catch (
|
|
940
|
-
if (
|
|
941
|
-
const
|
|
942
|
-
|
|
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");
|
|
943
947
|
}
|
|
944
948
|
})(), () => {
|
|
945
|
-
var
|
|
946
|
-
|
|
949
|
+
var S, f;
|
|
950
|
+
L = !0;
|
|
947
951
|
try {
|
|
948
|
-
(
|
|
952
|
+
(f = (S = x.current) == null ? void 0 : S.removeHandlers) == null || f.call(S);
|
|
949
953
|
} catch {
|
|
950
954
|
}
|
|
951
|
-
|
|
955
|
+
x.current = null;
|
|
952
956
|
};
|
|
953
957
|
}, [t, n]);
|
|
954
|
-
const
|
|
955
|
-
var
|
|
956
|
-
(
|
|
957
|
-
}, []),
|
|
958
|
-
var
|
|
959
|
-
(
|
|
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);
|
|
960
964
|
}, []);
|
|
961
|
-
return { status:
|
|
962
|
-
},
|
|
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) => {
|
|
963
967
|
const t = r.trim();
|
|
964
968
|
if (!t) return { firstName: "", lastName: "" };
|
|
965
969
|
const n = t.lastIndexOf(" ");
|
|
@@ -967,120 +971,120 @@ const rt = () => {
|
|
|
967
971
|
firstName: t.slice(0, n).trim(),
|
|
968
972
|
lastName: t.slice(n + 1).trim()
|
|
969
973
|
};
|
|
970
|
-
},
|
|
974
|
+
}, Wr = (r) => {
|
|
971
975
|
const t = r.replace(/\D/g, "");
|
|
972
976
|
if (t.length < 4) return { month: "", year: "" };
|
|
973
|
-
const n = t.slice(0, 2), o = t.slice(2),
|
|
974
|
-
return { month: n, year:
|
|
975
|
-
},
|
|
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) => {
|
|
976
980
|
const t = r.replace(/\D/g, "").slice(0, 4);
|
|
977
981
|
return t.length <= 2 ? t : `${t.slice(0, 2)} / ${t.slice(2)}`;
|
|
978
|
-
},
|
|
979
|
-
const { month: t, year: n } =
|
|
982
|
+
}, ir = (r) => {
|
|
983
|
+
const { month: t, year: n } = Wr(r);
|
|
980
984
|
if (!t || !n) return !1;
|
|
981
|
-
const o = parseInt(t, 10),
|
|
985
|
+
const o = parseInt(t, 10), i = parseInt(n, 10);
|
|
982
986
|
if (isNaN(o) || o < 1 || o > 12) return !1;
|
|
983
987
|
const c = /* @__PURE__ */ new Date();
|
|
984
|
-
return !(
|
|
985
|
-
},
|
|
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) => {
|
|
986
990
|
const t = r.replace(/[^\d]/g, "").slice(0, 9);
|
|
987
991
|
return t.length <= 5 ? t : `${t.slice(0, 5)}-${t.slice(5)}`;
|
|
988
|
-
},
|
|
992
|
+
}, Or = ({
|
|
989
993
|
userId: r,
|
|
990
994
|
onSuccess: t,
|
|
991
995
|
onError: n,
|
|
992
996
|
isDefault: o = !1,
|
|
993
|
-
className:
|
|
997
|
+
className: i,
|
|
994
998
|
defaultCardholderName: c,
|
|
995
|
-
defaultCardholderFirstName:
|
|
996
|
-
defaultCardholderLastName:
|
|
997
|
-
autoSave:
|
|
998
|
-
formId:
|
|
999
|
-
hideInternalSaveButton:
|
|
1000
|
-
onCanSubmitChange:
|
|
1001
|
-
onSavingChange:
|
|
1002
|
-
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
|
|
1003
1007
|
}) => {
|
|
1004
|
-
const
|
|
1005
|
-
async (
|
|
1006
|
-
|
|
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");
|
|
1007
1011
|
try {
|
|
1008
|
-
const
|
|
1009
|
-
|
|
1010
|
-
} catch (
|
|
1011
|
-
const
|
|
1012
|
-
|
|
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);
|
|
1013
1017
|
}
|
|
1014
1018
|
},
|
|
1015
1019
|
[r, o, t, n]
|
|
1016
|
-
),
|
|
1017
|
-
(
|
|
1018
|
-
const
|
|
1019
|
-
|
|
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);
|
|
1020
1024
|
},
|
|
1021
1025
|
[n]
|
|
1022
|
-
),
|
|
1026
|
+
), S = Ke(
|
|
1023
1027
|
() => ({
|
|
1024
|
-
onCardTokenized:
|
|
1025
|
-
onFieldErrors:
|
|
1028
|
+
onCardTokenized: T,
|
|
1029
|
+
onFieldErrors: L
|
|
1026
1030
|
}),
|
|
1027
|
-
[
|
|
1031
|
+
[T, L]
|
|
1028
1032
|
), {
|
|
1029
|
-
status:
|
|
1030
|
-
error:
|
|
1031
|
-
tokenize:
|
|
1032
|
-
validity:
|
|
1033
|
-
brand:
|
|
1034
|
-
focused:
|
|
1035
|
-
focusField:
|
|
1036
|
-
} =
|
|
1037
|
-
|
|
1038
|
-
!
|
|
1039
|
-
}, [
|
|
1040
|
-
const
|
|
1041
|
-
|
|
1042
|
-
var
|
|
1043
|
-
|
|
1044
|
-
}, [
|
|
1045
|
-
const
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
}, [
|
|
1049
|
-
var
|
|
1050
|
-
(
|
|
1051
|
-
}, [
|
|
1052
|
-
const
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
}, [
|
|
1056
|
-
var
|
|
1057
|
-
(
|
|
1058
|
-
}, [
|
|
1059
|
-
const
|
|
1060
|
-
const { firstName:
|
|
1061
|
-
|
|
1062
|
-
}, [
|
|
1063
|
-
|
|
1064
|
-
if (!
|
|
1065
|
-
const
|
|
1066
|
-
|
|
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();
|
|
1067
1071
|
}, 1200);
|
|
1068
|
-
return () => clearTimeout(
|
|
1069
|
-
}, [
|
|
1070
|
-
const
|
|
1071
|
-
|
|
1072
|
-
},
|
|
1073
|
-
return
|
|
1074
|
-
|
|
1075
|
-
}, [n]),
|
|
1076
|
-
var
|
|
1077
|
-
|
|
1078
|
-
}, [
|
|
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(
|
|
1079
1083
|
"form",
|
|
1080
1084
|
{
|
|
1081
|
-
id:
|
|
1082
|
-
onSubmit:
|
|
1083
|
-
className: Q("flex w-full flex-col gap-3",
|
|
1085
|
+
id: _,
|
|
1086
|
+
onSubmit: Ce,
|
|
1087
|
+
className: Q("flex w-full flex-col gap-3", i),
|
|
1084
1088
|
"data-testid": "movmo-card-form",
|
|
1085
1089
|
children: [
|
|
1086
1090
|
/* @__PURE__ */ a.jsxs("div", { children: [
|
|
@@ -1089,23 +1093,23 @@ const rt = () => {
|
|
|
1089
1093
|
"div",
|
|
1090
1094
|
{
|
|
1091
1095
|
className: Q(
|
|
1092
|
-
|
|
1093
|
-
|
|
1096
|
+
jr,
|
|
1097
|
+
H.number ? Er : _r
|
|
1094
1098
|
),
|
|
1095
1099
|
children: [
|
|
1096
|
-
/* @__PURE__ */ a.jsx(
|
|
1100
|
+
/* @__PURE__ */ a.jsx(_e, { brand: G ?? "", width: 32, className: "flex-shrink-0" }),
|
|
1097
1101
|
/* @__PURE__ */ a.jsxs("div", { className: "relative h-full flex-1", children: [
|
|
1098
1102
|
/* @__PURE__ */ a.jsx(
|
|
1099
1103
|
"div",
|
|
1100
1104
|
{
|
|
1101
1105
|
id: "movmo-card-number",
|
|
1102
1106
|
"aria-labelledby": "movmo-card-number-label",
|
|
1103
|
-
"aria-busy":
|
|
1107
|
+
"aria-busy": f !== "ready",
|
|
1104
1108
|
className: "absolute inset-0",
|
|
1105
1109
|
"data-testid": "movmo-card-number-mount"
|
|
1106
1110
|
}
|
|
1107
1111
|
),
|
|
1108
|
-
|
|
1112
|
+
f !== "ready" ? /* @__PURE__ */ a.jsx(
|
|
1109
1113
|
"div",
|
|
1110
1114
|
{
|
|
1111
1115
|
"aria-hidden": "true",
|
|
@@ -1128,13 +1132,13 @@ const rt = () => {
|
|
|
1128
1132
|
inputMode: "numeric",
|
|
1129
1133
|
autoComplete: "cc-exp",
|
|
1130
1134
|
placeholder: "MM / YY",
|
|
1131
|
-
value:
|
|
1132
|
-
onChange: (
|
|
1133
|
-
const
|
|
1134
|
-
|
|
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);
|
|
1135
1139
|
},
|
|
1136
|
-
className: Q(
|
|
1137
|
-
disabled:
|
|
1140
|
+
className: Q(or, x && !I && "border-error-500"),
|
|
1141
|
+
disabled: ye,
|
|
1138
1142
|
required: !0,
|
|
1139
1143
|
"data-testid": "movmo-card-expiry-input"
|
|
1140
1144
|
}
|
|
@@ -1146,8 +1150,8 @@ const rt = () => {
|
|
|
1146
1150
|
"div",
|
|
1147
1151
|
{
|
|
1148
1152
|
className: Q(
|
|
1149
|
-
|
|
1150
|
-
|
|
1153
|
+
jr,
|
|
1154
|
+
H.cvv ? Er : _r
|
|
1151
1155
|
),
|
|
1152
1156
|
children: [
|
|
1153
1157
|
/* @__PURE__ */ a.jsxs("div", { className: "relative h-full flex-1", children: [
|
|
@@ -1156,12 +1160,12 @@ const rt = () => {
|
|
|
1156
1160
|
{
|
|
1157
1161
|
id: "movmo-card-cvv",
|
|
1158
1162
|
"aria-labelledby": "movmo-card-cvv-label",
|
|
1159
|
-
"aria-busy":
|
|
1163
|
+
"aria-busy": f !== "ready",
|
|
1160
1164
|
className: "absolute inset-0",
|
|
1161
1165
|
"data-testid": "movmo-card-cvv-mount"
|
|
1162
1166
|
}
|
|
1163
1167
|
),
|
|
1164
|
-
|
|
1168
|
+
f !== "ready" ? /* @__PURE__ */ a.jsx(
|
|
1165
1169
|
"div",
|
|
1166
1170
|
{
|
|
1167
1171
|
"aria-hidden": "true",
|
|
@@ -1176,7 +1180,7 @@ const rt = () => {
|
|
|
1176
1180
|
"aria-label": "CVV help",
|
|
1177
1181
|
tabIndex: -1,
|
|
1178
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",
|
|
1179
|
-
title:
|
|
1183
|
+
title: G === "american_express" ? "The 4 numbers on the front of your card." : "The 3 numbers on the back of your card.",
|
|
1180
1184
|
"data-testid": "movmo-cvv-help",
|
|
1181
1185
|
children: "?"
|
|
1182
1186
|
}
|
|
@@ -1191,19 +1195,19 @@ const rt = () => {
|
|
|
1191
1195
|
"input",
|
|
1192
1196
|
{
|
|
1193
1197
|
id: "movmo-card-zip",
|
|
1194
|
-
ref:
|
|
1198
|
+
ref: ge,
|
|
1195
1199
|
type: "text",
|
|
1196
1200
|
inputMode: "numeric",
|
|
1197
1201
|
autoComplete: "postal-code",
|
|
1198
1202
|
placeholder: "ZIP code",
|
|
1199
|
-
value:
|
|
1200
|
-
onChange: (
|
|
1201
|
-
var
|
|
1202
|
-
const
|
|
1203
|
-
|
|
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);
|
|
1204
1208
|
},
|
|
1205
|
-
className: Q(
|
|
1206
|
-
disabled:
|
|
1209
|
+
className: Q(or, M && !pe && "border-error-500"),
|
|
1210
|
+
disabled: ye,
|
|
1207
1211
|
required: !0,
|
|
1208
1212
|
"data-testid": "movmo-card-zip-input"
|
|
1209
1213
|
}
|
|
@@ -1216,32 +1220,32 @@ const rt = () => {
|
|
|
1216
1220
|
"input",
|
|
1217
1221
|
{
|
|
1218
1222
|
id: "movmo-card-cardholder-name",
|
|
1219
|
-
ref:
|
|
1223
|
+
ref: te,
|
|
1220
1224
|
type: "text",
|
|
1221
1225
|
autoComplete: "cc-name",
|
|
1222
1226
|
placeholder: "Cardholder name",
|
|
1223
|
-
value:
|
|
1224
|
-
onChange: (
|
|
1225
|
-
className:
|
|
1226
|
-
disabled:
|
|
1227
|
+
value: D,
|
|
1228
|
+
onChange: (j) => $(j.target.value),
|
|
1229
|
+
className: or,
|
|
1230
|
+
disabled: ye,
|
|
1227
1231
|
required: !0,
|
|
1228
1232
|
"data-testid": "movmo-card-cardholder-name-input"
|
|
1229
1233
|
}
|
|
1230
1234
|
)
|
|
1231
1235
|
] }),
|
|
1232
|
-
!
|
|
1236
|
+
!m && !g ? /* @__PURE__ */ a.jsx(
|
|
1233
1237
|
"button",
|
|
1234
1238
|
{
|
|
1235
1239
|
type: "submit",
|
|
1236
|
-
disabled: !
|
|
1240
|
+
disabled: !de,
|
|
1237
1241
|
className: Q(
|
|
1238
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",
|
|
1239
1243
|
"disabled:cursor-not-allowed disabled:bg-grayWarm-300 disabled:text-grayWarm-500"
|
|
1240
1244
|
),
|
|
1241
1245
|
"data-testid": "movmo-card-save",
|
|
1242
|
-
children:
|
|
1246
|
+
children: le ? "Saving…" : f === "loading" ? "Loading…" : "Save card"
|
|
1243
1247
|
}
|
|
1244
|
-
) :
|
|
1248
|
+
) : le && m ? (
|
|
1245
1249
|
// In autoSave mode (empty-state inline form, no Save button at all),
|
|
1246
1250
|
// surface the in-flight state as inline text. The modal flow uses a
|
|
1247
1251
|
// spinner inside the modal-footer Save button instead — see
|
|
@@ -1260,86 +1264,103 @@ const rt = () => {
|
|
|
1260
1264
|
}
|
|
1261
1265
|
);
|
|
1262
1266
|
};
|
|
1263
|
-
|
|
1264
|
-
const
|
|
1265
|
-
const [t, n] =
|
|
1266
|
-
return { deletePaymentMethod:
|
|
1267
|
-
async (
|
|
1268
|
-
n("pending"),
|
|
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);
|
|
1269
1287
|
try {
|
|
1270
|
-
await
|
|
1271
|
-
} catch (
|
|
1272
|
-
const
|
|
1273
|
-
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;
|
|
1274
1292
|
}
|
|
1275
1293
|
},
|
|
1276
1294
|
[r]
|
|
1277
1295
|
), status: t, error: o };
|
|
1278
|
-
},
|
|
1279
|
-
const [t, n] =
|
|
1280
|
-
return {
|
|
1281
|
-
async (
|
|
1282
|
-
n("pending"),
|
|
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);
|
|
1283
1301
|
try {
|
|
1284
|
-
await
|
|
1285
|
-
} catch (
|
|
1286
|
-
const
|
|
1287
|
-
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;
|
|
1288
1306
|
}
|
|
1289
1307
|
},
|
|
1290
1308
|
[r]
|
|
1291
1309
|
), status: t, error: o };
|
|
1292
|
-
},
|
|
1293
|
-
const [t, n] =
|
|
1294
|
-
|
|
1295
|
-
var
|
|
1296
|
-
(
|
|
1297
|
-
const
|
|
1298
|
-
return
|
|
1299
|
-
|
|
1300
|
-
}).catch((
|
|
1301
|
-
if (
|
|
1302
|
-
const
|
|
1303
|
-
|
|
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");
|
|
1304
1322
|
}), () => {
|
|
1305
|
-
|
|
1323
|
+
p.abort();
|
|
1306
1324
|
};
|
|
1307
|
-
}, [r,
|
|
1308
|
-
const
|
|
1309
|
-
|
|
1325
|
+
}, [r, v]);
|
|
1326
|
+
const g = K(() => {
|
|
1327
|
+
m((p) => p + 1);
|
|
1310
1328
|
}, []);
|
|
1311
|
-
return { items: t, status: o, error: c, refetch:
|
|
1312
|
-
},
|
|
1329
|
+
return { items: t, status: o, error: c, refetch: g };
|
|
1330
|
+
}, Dr = ({
|
|
1313
1331
|
open: r,
|
|
1314
1332
|
onClose: t,
|
|
1315
|
-
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
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(() => {
|
|
1321
1342
|
if (!r) return;
|
|
1322
|
-
const
|
|
1343
|
+
const g = (p) => {
|
|
1323
1344
|
p.key === "Escape" && t();
|
|
1324
1345
|
};
|
|
1325
|
-
return document.addEventListener("keydown",
|
|
1326
|
-
}, [r, t]),
|
|
1346
|
+
return document.addEventListener("keydown", g), () => document.removeEventListener("keydown", g);
|
|
1347
|
+
}, [r, t]), Y(() => {
|
|
1327
1348
|
if (!r) return;
|
|
1328
|
-
const
|
|
1349
|
+
const g = document.body.style.overflow;
|
|
1329
1350
|
return document.body.style.overflow = "hidden", () => {
|
|
1330
|
-
document.body.style.overflow =
|
|
1351
|
+
document.body.style.overflow = g;
|
|
1331
1352
|
};
|
|
1332
1353
|
}, [r]), r ? /* @__PURE__ */ a.jsx(
|
|
1333
1354
|
"div",
|
|
1334
1355
|
{
|
|
1335
1356
|
role: "dialog",
|
|
1336
1357
|
"aria-modal": "true",
|
|
1337
|
-
"aria-labelledby":
|
|
1358
|
+
"aria-labelledby": o,
|
|
1338
1359
|
className: "fixed inset-0 z-50 flex items-center justify-center bg-black/40 p-4",
|
|
1339
|
-
onClick: (
|
|
1340
|
-
|
|
1360
|
+
onClick: (g) => {
|
|
1361
|
+
g.target === g.currentTarget && t();
|
|
1341
1362
|
},
|
|
1342
|
-
"data-testid":
|
|
1363
|
+
"data-testid": `${m}-modal`,
|
|
1343
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: [
|
|
1344
1365
|
/* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-3 border-b border-grayWarm-200 px-4 py-3", children: [
|
|
1345
1366
|
/* @__PURE__ */ a.jsx(
|
|
@@ -1347,9 +1368,9 @@ const ct = (r) => {
|
|
|
1347
1368
|
{
|
|
1348
1369
|
type: "button",
|
|
1349
1370
|
onClick: t,
|
|
1350
|
-
"aria-label":
|
|
1371
|
+
"aria-label": `Close ${n.toLowerCase()} dialog`,
|
|
1351
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",
|
|
1352
|
-
"data-testid":
|
|
1373
|
+
"data-testid": `${m}-close`,
|
|
1353
1374
|
children: /* @__PURE__ */ a.jsx("svg", { viewBox: "0 0 20 20", width: "20", height: "20", "aria-hidden": "true", children: /* @__PURE__ */ a.jsx(
|
|
1354
1375
|
"path",
|
|
1355
1376
|
{
|
|
@@ -1362,17 +1383,10 @@ const ct = (r) => {
|
|
|
1362
1383
|
) })
|
|
1363
1384
|
}
|
|
1364
1385
|
),
|
|
1365
|
-
/* @__PURE__ */ a.jsx(
|
|
1366
|
-
"h2",
|
|
1367
|
-
{
|
|
1368
|
-
id: "movmo-add-payment-title",
|
|
1369
|
-
className: "flex-1 text-center text-base font-semibold text-grayWarm-900",
|
|
1370
|
-
children: "Add payment method"
|
|
1371
|
-
}
|
|
1372
|
-
),
|
|
1386
|
+
/* @__PURE__ */ a.jsx("h2", { id: o, className: "flex-1 text-center text-base font-semibold text-grayWarm-900", children: n }),
|
|
1373
1387
|
/* @__PURE__ */ a.jsx("span", { "aria-hidden": "true", className: "h-9 w-9 flex-shrink-0" })
|
|
1374
1388
|
] }),
|
|
1375
|
-
/* @__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: _ }),
|
|
1376
1390
|
/* @__PURE__ */ a.jsxs("div", { className: "flex gap-3 border-t border-grayWarm-200 p-4", children: [
|
|
1377
1391
|
/* @__PURE__ */ a.jsx(
|
|
1378
1392
|
"button",
|
|
@@ -1380,7 +1394,7 @@ const ct = (r) => {
|
|
|
1380
1394
|
type: "button",
|
|
1381
1395
|
onClick: t,
|
|
1382
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]",
|
|
1383
|
-
"data-testid":
|
|
1397
|
+
"data-testid": `${m}-cancel`,
|
|
1384
1398
|
children: "Cancel"
|
|
1385
1399
|
}
|
|
1386
1400
|
),
|
|
@@ -1388,16 +1402,16 @@ const ct = (r) => {
|
|
|
1388
1402
|
"button",
|
|
1389
1403
|
{
|
|
1390
1404
|
type: "submit",
|
|
1391
|
-
form:
|
|
1392
|
-
disabled:
|
|
1393
|
-
"aria-disabled":
|
|
1394
|
-
"aria-busy":
|
|
1405
|
+
form: i,
|
|
1406
|
+
disabled: v ? !1 : c,
|
|
1407
|
+
"aria-disabled": v || c,
|
|
1408
|
+
"aria-busy": v,
|
|
1395
1409
|
className: Q(
|
|
1396
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",
|
|
1397
|
-
|
|
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"
|
|
1398
1412
|
),
|
|
1399
|
-
"data-testid":
|
|
1400
|
-
children:
|
|
1413
|
+
"data-testid": `${m}-save`,
|
|
1414
|
+
children: v ? /* @__PURE__ */ a.jsxs(a.Fragment, { children: [
|
|
1401
1415
|
/* @__PURE__ */ a.jsxs(
|
|
1402
1416
|
"svg",
|
|
1403
1417
|
{
|
|
@@ -1429,27 +1443,151 @@ const ct = (r) => {
|
|
|
1429
1443
|
]
|
|
1430
1444
|
}
|
|
1431
1445
|
),
|
|
1432
|
-
/* @__PURE__ */ a.jsx("span", { className: "sr-only", children: "Saving
|
|
1433
|
-
] }) :
|
|
1446
|
+
/* @__PURE__ */ a.jsx("span", { className: "sr-only", children: "Saving" })
|
|
1447
|
+
] }) : d
|
|
1434
1448
|
}
|
|
1435
1449
|
)
|
|
1436
1450
|
] })
|
|
1437
1451
|
] })
|
|
1438
1452
|
}
|
|
1439
|
-
) : 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) => {
|
|
1440
1476
|
if (!r) return "Card";
|
|
1441
1477
|
const t = r.toLowerCase();
|
|
1442
1478
|
return t === "amex" ? "Amex" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
1443
|
-
},
|
|
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) => {
|
|
1578
|
+
if (!r) return "Card";
|
|
1579
|
+
const t = r.toLowerCase();
|
|
1580
|
+
return t === "amex" ? "Amex" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
1581
|
+
}, bt = ({
|
|
1444
1582
|
method: r,
|
|
1445
1583
|
trailing: t,
|
|
1446
1584
|
onClick: n,
|
|
1447
1585
|
cardLabelFormat: o = "branded",
|
|
1448
|
-
className:
|
|
1586
|
+
className: i
|
|
1449
1587
|
}) => /* @__PURE__ */ a.jsxs(
|
|
1450
1588
|
"div",
|
|
1451
1589
|
{
|
|
1452
|
-
className: Q("flex items-center gap-3", n && "cursor-pointer",
|
|
1590
|
+
className: Q("flex items-center gap-3", n && "cursor-pointer", i),
|
|
1453
1591
|
onClick: n,
|
|
1454
1592
|
role: n ? "button" : void 0,
|
|
1455
1593
|
tabIndex: n ? 0 : void 0,
|
|
@@ -1458,38 +1596,39 @@ const ct = (r) => {
|
|
|
1458
1596
|
} : void 0,
|
|
1459
1597
|
"data-testid": `payment-method-preview-${r.id}`,
|
|
1460
1598
|
children: [
|
|
1461
|
-
/* @__PURE__ */ a.jsx(
|
|
1462
|
-
/* @__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}` }),
|
|
1463
1601
|
t
|
|
1464
1602
|
]
|
|
1465
1603
|
}
|
|
1466
|
-
),
|
|
1604
|
+
), wt = (r, t, n = /* @__PURE__ */ new Date()) => t < n.getFullYear() || t === n.getFullYear() && r < n.getMonth() + 1, Nr = (r) => {
|
|
1467
1605
|
if (!r) return "Card";
|
|
1468
1606
|
const t = r.toLowerCase();
|
|
1469
1607
|
return t === "amex" ? "Amex" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
1470
|
-
},
|
|
1608
|
+
}, jt = (r, t) => `${String(r).padStart(2, "0")}/${t}`, Et = ({
|
|
1471
1609
|
method: r,
|
|
1472
1610
|
selectable: t,
|
|
1473
1611
|
selected: n,
|
|
1474
1612
|
onSelect: o,
|
|
1475
|
-
onSetDefault:
|
|
1613
|
+
onSetDefault: i,
|
|
1476
1614
|
onRemove: c,
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1615
|
+
onEdit: d,
|
|
1616
|
+
disabled: v,
|
|
1617
|
+
showDefaultBadge: m,
|
|
1618
|
+
hideSetDefaultMenuItem: _,
|
|
1619
|
+
cardLabelFormat: g = "branded"
|
|
1481
1620
|
}) => {
|
|
1482
|
-
const [
|
|
1483
|
-
|
|
1484
|
-
if (!
|
|
1485
|
-
const
|
|
1486
|
-
var
|
|
1487
|
-
(
|
|
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);
|
|
1488
1627
|
};
|
|
1489
|
-
return document.addEventListener("mousedown",
|
|
1490
|
-
}, [
|
|
1491
|
-
const
|
|
1492
|
-
t && o && !
|
|
1628
|
+
return document.addEventListener("mousedown", $), () => document.removeEventListener("mousedown", $);
|
|
1629
|
+
}, [p]);
|
|
1630
|
+
const D = () => {
|
|
1631
|
+
t && o && !v && o(r);
|
|
1493
1632
|
};
|
|
1494
1633
|
return /* @__PURE__ */ a.jsxs(
|
|
1495
1634
|
"div",
|
|
@@ -1501,10 +1640,10 @@ const ct = (r) => {
|
|
|
1501
1640
|
// accounts-ui row layout (both use items-start).
|
|
1502
1641
|
"flex items-start gap-3 transition-colors",
|
|
1503
1642
|
t ? "rounded-lg border px-3 py-3" : "py-4",
|
|
1504
|
-
t && !
|
|
1643
|
+
t && !v && "cursor-pointer",
|
|
1505
1644
|
t && (n ? "border-grayWarm-950 shadow-[0_0_0_1px_#1c1917]" : "border-grayWarm-200 hover:border-grayWarm-300")
|
|
1506
1645
|
),
|
|
1507
|
-
onClick:
|
|
1646
|
+
onClick: D,
|
|
1508
1647
|
"data-testid": `payment-method-row-${r.id}`,
|
|
1509
1648
|
children: [
|
|
1510
1649
|
t ? /* @__PURE__ */ a.jsx(
|
|
@@ -1514,17 +1653,17 @@ const ct = (r) => {
|
|
|
1514
1653
|
name: "movmo-payment-method",
|
|
1515
1654
|
checked: n,
|
|
1516
1655
|
onChange: () => o == null ? void 0 : o(r),
|
|
1517
|
-
onClick: (
|
|
1518
|
-
"aria-label": `Select ${
|
|
1656
|
+
onClick: ($) => $.stopPropagation(),
|
|
1657
|
+
"aria-label": `Select ${Nr(r.brand)} ending ${r.last4}`,
|
|
1519
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",
|
|
1520
|
-
disabled:
|
|
1659
|
+
disabled: v
|
|
1521
1660
|
}
|
|
1522
1661
|
) : null,
|
|
1523
|
-
/* @__PURE__ */ a.jsx(
|
|
1662
|
+
/* @__PURE__ */ a.jsx(_e, { brand: r.brand, className: "flex-shrink-0" }),
|
|
1524
1663
|
/* @__PURE__ */ a.jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
1525
1664
|
/* @__PURE__ */ a.jsxs("div", { className: "flex flex-wrap items-center gap-2", children: [
|
|
1526
|
-
/* @__PURE__ */ a.jsx("span", { className: "text-lg font-semibold text-grayWarm-950", children:
|
|
1527
|
-
|
|
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(
|
|
1528
1667
|
"span",
|
|
1529
1668
|
{
|
|
1530
1669
|
className: "inline-flex items-center rounded-full bg-success-50 px-2 py-0.5 text-xs font-semibold text-success-700",
|
|
@@ -1532,7 +1671,7 @@ const ct = (r) => {
|
|
|
1532
1671
|
children: "Default"
|
|
1533
1672
|
}
|
|
1534
1673
|
) : null,
|
|
1535
|
-
|
|
1674
|
+
P ? /* @__PURE__ */ a.jsx(
|
|
1536
1675
|
"span",
|
|
1537
1676
|
{
|
|
1538
1677
|
className: "inline-flex items-center rounded-full bg-error-50 px-2 py-0.5 text-xs font-semibold text-error-700",
|
|
@@ -1541,39 +1680,29 @@ const ct = (r) => {
|
|
|
1541
1680
|
}
|
|
1542
1681
|
) : null
|
|
1543
1682
|
] }),
|
|
1544
|
-
/* @__PURE__ */ a.jsxs("div", { className: Q("text-base",
|
|
1683
|
+
/* @__PURE__ */ a.jsxs("div", { className: Q("text-base", P ? "text-grayWarm-400" : "text-grayWarm-600"), children: [
|
|
1545
1684
|
"Exp. ",
|
|
1546
|
-
|
|
1685
|
+
jt(r.expMonth, r.expYear)
|
|
1547
1686
|
] })
|
|
1548
1687
|
] }),
|
|
1549
|
-
/* @__PURE__ */ a.jsxs("div", { className: "relative flex-shrink-0", ref:
|
|
1688
|
+
/* @__PURE__ */ a.jsxs("div", { className: "relative flex-shrink-0", ref: w, children: [
|
|
1550
1689
|
/* @__PURE__ */ a.jsx(
|
|
1551
1690
|
"button",
|
|
1552
1691
|
{
|
|
1553
1692
|
type: "button",
|
|
1554
1693
|
"aria-label": `Open actions for card ending ${r.last4}`,
|
|
1555
1694
|
"aria-haspopup": "menu",
|
|
1556
|
-
"aria-expanded":
|
|
1695
|
+
"aria-expanded": p,
|
|
1557
1696
|
className: "rounded-lg p-2 text-grayWarm-600 transition-colors hover:bg-grayWarm-100 disabled:cursor-not-allowed disabled:opacity-50",
|
|
1558
|
-
disabled:
|
|
1559
|
-
onClick: (
|
|
1560
|
-
|
|
1697
|
+
disabled: v,
|
|
1698
|
+
onClick: ($) => {
|
|
1699
|
+
$.stopPropagation(), y((x) => !x);
|
|
1561
1700
|
},
|
|
1562
1701
|
"data-testid": `menu-trigger-${r.id}`,
|
|
1563
|
-
children: /* @__PURE__ */ a.jsx(
|
|
1564
|
-
"svg",
|
|
1565
|
-
{
|
|
1566
|
-
viewBox: "0 0 24 24",
|
|
1567
|
-
width: "20",
|
|
1568
|
-
height: "20",
|
|
1569
|
-
fill: "currentColor",
|
|
1570
|
-
"aria-hidden": "true",
|
|
1571
|
-
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" })
|
|
1572
|
-
}
|
|
1573
|
-
)
|
|
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" }) })
|
|
1574
1703
|
}
|
|
1575
1704
|
),
|
|
1576
|
-
|
|
1705
|
+
p ? /* @__PURE__ */ a.jsxs(
|
|
1577
1706
|
"div",
|
|
1578
1707
|
{
|
|
1579
1708
|
role: "menu",
|
|
@@ -1587,7 +1716,7 @@ const ct = (r) => {
|
|
|
1587
1716
|
// overlap; keep the menu below + right-aligned.
|
|
1588
1717
|
t ? "bottom-full left-1/2 mb-2 -translate-x-1/2" : "right-0 top-full mt-1"
|
|
1589
1718
|
),
|
|
1590
|
-
onClick: (
|
|
1719
|
+
onClick: ($) => $.stopPropagation(),
|
|
1591
1720
|
"data-testid": `menu-${r.id}`,
|
|
1592
1721
|
children: [
|
|
1593
1722
|
t ? (
|
|
@@ -1602,19 +1731,32 @@ const ct = (r) => {
|
|
|
1602
1731
|
}
|
|
1603
1732
|
)
|
|
1604
1733
|
) : null,
|
|
1605
|
-
!r.isDefault && !
|
|
1734
|
+
!r.isDefault && !_ ? /* @__PURE__ */ a.jsx(
|
|
1606
1735
|
"button",
|
|
1607
1736
|
{
|
|
1608
1737
|
type: "button",
|
|
1609
1738
|
role: "menuitem",
|
|
1610
1739
|
className: "block w-full px-4 py-1 text-left text-md font-semibold text-grayWarm-950 hover:text-grayWarm-700",
|
|
1611
1740
|
onClick: () => {
|
|
1612
|
-
|
|
1741
|
+
y(!1), i(r);
|
|
1613
1742
|
},
|
|
1614
1743
|
"data-testid": `menu-set-default-${r.id}`,
|
|
1615
1744
|
children: "Set as default"
|
|
1616
1745
|
}
|
|
1617
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,
|
|
1618
1760
|
/* @__PURE__ */ a.jsx(
|
|
1619
1761
|
"button",
|
|
1620
1762
|
{
|
|
@@ -1622,7 +1764,7 @@ const ct = (r) => {
|
|
|
1622
1764
|
role: "menuitem",
|
|
1623
1765
|
className: "block w-full px-4 py-1 text-left text-md font-semibold text-error-700 hover:text-error-500",
|
|
1624
1766
|
onClick: () => {
|
|
1625
|
-
|
|
1767
|
+
y(!1), c(r);
|
|
1626
1768
|
},
|
|
1627
1769
|
"data-testid": `menu-remove-${r.id}`,
|
|
1628
1770
|
children: "Delete"
|
|
@@ -1635,16 +1777,16 @@ const ct = (r) => {
|
|
|
1635
1777
|
]
|
|
1636
1778
|
}
|
|
1637
1779
|
);
|
|
1638
|
-
},
|
|
1780
|
+
}, _t = (r) => `${Ue().iconCdnBaseUrl}/website/assets/icons/payments/${r}.svg`, cr = ({ slug: r, alt: t }) => /* @__PURE__ */ a.jsx(
|
|
1639
1781
|
"img",
|
|
1640
1782
|
{
|
|
1641
|
-
src:
|
|
1783
|
+
src: _t(r),
|
|
1642
1784
|
alt: t,
|
|
1643
1785
|
height: 20,
|
|
1644
1786
|
loading: "lazy",
|
|
1645
1787
|
style: { height: 20, width: "auto" }
|
|
1646
1788
|
}
|
|
1647
|
-
),
|
|
1789
|
+
), Xe = ({
|
|
1648
1790
|
type: r,
|
|
1649
1791
|
label: t,
|
|
1650
1792
|
iconNode: n
|
|
@@ -1677,20 +1819,20 @@ const ct = (r) => {
|
|
|
1677
1819
|
]
|
|
1678
1820
|
}
|
|
1679
1821
|
)
|
|
1680
|
-
),
|
|
1822
|
+
), Cr = ({
|
|
1681
1823
|
selected: r,
|
|
1682
1824
|
onSelect: t,
|
|
1683
1825
|
creditCardBody: n,
|
|
1684
1826
|
className: o
|
|
1685
1827
|
}) => {
|
|
1686
|
-
const
|
|
1828
|
+
const i = r === "credit_card";
|
|
1687
1829
|
return /* @__PURE__ */ a.jsxs("div", { className: Q("flex w-full flex-col gap-3", o), children: [
|
|
1688
1830
|
/* @__PURE__ */ a.jsxs(
|
|
1689
1831
|
"label",
|
|
1690
1832
|
{
|
|
1691
1833
|
className: Q(
|
|
1692
1834
|
"flex cursor-pointer flex-col gap-3 rounded-lg border px-4 py-3 transition-colors",
|
|
1693
|
-
|
|
1835
|
+
i ? "border-grayWarm-900 shadow-[0_0_0_1px_#1c1917]" : "border-grayWarm-200"
|
|
1694
1836
|
),
|
|
1695
1837
|
"data-testid": "payment-type-credit_card",
|
|
1696
1838
|
children: [
|
|
@@ -1701,7 +1843,7 @@ const ct = (r) => {
|
|
|
1701
1843
|
type: "radio",
|
|
1702
1844
|
name: "movmo-payment-type",
|
|
1703
1845
|
value: "credit_card",
|
|
1704
|
-
checked:
|
|
1846
|
+
checked: i,
|
|
1705
1847
|
onChange: () => t("credit_card"),
|
|
1706
1848
|
className: "h-4 w-4 cursor-pointer accent-grayWarm-900",
|
|
1707
1849
|
"aria-label": "Credit card"
|
|
@@ -1709,17 +1851,17 @@ const ct = (r) => {
|
|
|
1709
1851
|
),
|
|
1710
1852
|
/* @__PURE__ */ a.jsx("span", { className: "flex-1 text-sm font-semibold text-grayWarm-900", children: "Credit card" }),
|
|
1711
1853
|
/* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-1.5", children: [
|
|
1712
|
-
/* @__PURE__ */ a.jsx(
|
|
1713
|
-
/* @__PURE__ */ a.jsx(
|
|
1714
|
-
/* @__PURE__ */ a.jsx(
|
|
1715
|
-
/* @__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 })
|
|
1716
1858
|
] })
|
|
1717
1859
|
] }),
|
|
1718
|
-
|
|
1860
|
+
i ? /* @__PURE__ */ a.jsx("div", { "data-testid": "payment-type-credit_card-body", children: n }) : null
|
|
1719
1861
|
]
|
|
1720
1862
|
}
|
|
1721
1863
|
),
|
|
1722
|
-
|
|
1864
|
+
i ? /* @__PURE__ */ a.jsx(
|
|
1723
1865
|
"p",
|
|
1724
1866
|
{
|
|
1725
1867
|
className: "mt-2 text-sm font-semibold text-grayWarm-900",
|
|
@@ -1728,31 +1870,31 @@ const ct = (r) => {
|
|
|
1728
1870
|
}
|
|
1729
1871
|
) : null,
|
|
1730
1872
|
/* @__PURE__ */ a.jsx(
|
|
1731
|
-
|
|
1873
|
+
Xe,
|
|
1732
1874
|
{
|
|
1733
1875
|
type: "paypal",
|
|
1734
1876
|
label: "PayPal",
|
|
1735
|
-
iconNode: /* @__PURE__ */ a.jsx(
|
|
1877
|
+
iconNode: /* @__PURE__ */ a.jsx(cr, { slug: "paypal", alt: "PayPal" })
|
|
1736
1878
|
}
|
|
1737
1879
|
),
|
|
1738
1880
|
/* @__PURE__ */ a.jsx(
|
|
1739
|
-
|
|
1881
|
+
Xe,
|
|
1740
1882
|
{
|
|
1741
1883
|
type: "googlepay",
|
|
1742
1884
|
label: "GooglePay",
|
|
1743
|
-
iconNode: /* @__PURE__ */ a.jsx(
|
|
1885
|
+
iconNode: /* @__PURE__ */ a.jsx(cr, { slug: "google-pay", alt: "GooglePay" })
|
|
1744
1886
|
}
|
|
1745
1887
|
),
|
|
1746
1888
|
/* @__PURE__ */ a.jsx(
|
|
1747
|
-
|
|
1889
|
+
Xe,
|
|
1748
1890
|
{
|
|
1749
1891
|
type: "klarna",
|
|
1750
1892
|
label: "Klarna",
|
|
1751
|
-
iconNode: /* @__PURE__ */ a.jsx(
|
|
1893
|
+
iconNode: /* @__PURE__ */ a.jsx(cr, { slug: "klarna", alt: "Klarna" })
|
|
1752
1894
|
}
|
|
1753
1895
|
),
|
|
1754
1896
|
/* @__PURE__ */ a.jsx(
|
|
1755
|
-
|
|
1897
|
+
Xe,
|
|
1756
1898
|
{
|
|
1757
1899
|
type: "ach",
|
|
1758
1900
|
label: "Bank account (ACH)",
|
|
@@ -1760,156 +1902,177 @@ const ct = (r) => {
|
|
|
1760
1902
|
}
|
|
1761
1903
|
)
|
|
1762
1904
|
] });
|
|
1763
|
-
},
|
|
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) => {
|
|
1764
1910
|
const t = r.filter((o) => o.isDefault), n = r.filter((o) => !o.isDefault);
|
|
1765
1911
|
return [...t, ...n];
|
|
1766
|
-
},
|
|
1767
|
-
"div",
|
|
1768
|
-
|
|
1769
|
-
className: "
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
/* @__PURE__ */ a.jsx("div", { className: "h-8 w-[46px] flex-shrink-0 animate-pulse rounded bg-grayWarm-200" }),
|
|
1774
|
-
/* @__PURE__ */ a.jsxs("div", { className: "space-y-2", children: [
|
|
1775
|
-
/* @__PURE__ */ a.jsxs("div", { className: "flex items-center gap-2", children: [
|
|
1776
|
-
/* @__PURE__ */ a.jsx("div", { className: "h-5 w-[120px] animate-pulse rounded bg-grayWarm-200" }),
|
|
1777
|
-
r ? /* @__PURE__ */ a.jsx("div", { className: "h-5 w-[56px] animate-pulse rounded-full bg-grayWarm-200" }) : null
|
|
1778
|
-
] }),
|
|
1779
|
-
/* @__PURE__ */ a.jsx("div", { className: "h-4 w-[100px] animate-pulse rounded bg-grayWarm-200" })
|
|
1780
|
-
] })
|
|
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
|
|
1781
1919
|
] }),
|
|
1782
|
-
/* @__PURE__ */ a.jsx("div", { className: "h-
|
|
1783
|
-
]
|
|
1784
|
-
}
|
|
1785
|
-
|
|
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 = ({
|
|
1786
1925
|
userId: r,
|
|
1787
1926
|
defaultCardholderName: t,
|
|
1788
1927
|
defaultCardholderFirstName: n,
|
|
1789
1928
|
defaultCardholderLastName: o,
|
|
1790
|
-
selectedId:
|
|
1929
|
+
selectedId: i,
|
|
1791
1930
|
onSelect: c,
|
|
1792
|
-
onChange:
|
|
1793
|
-
paymentTypeSelector:
|
|
1794
|
-
autoSaveFirstCard:
|
|
1795
|
-
selectionSetsDefault:
|
|
1796
|
-
showDefaultBadge:
|
|
1797
|
-
collapsible:
|
|
1798
|
-
cardLabelFormat:
|
|
1799
|
-
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
|
|
1800
1939
|
}) => {
|
|
1801
|
-
const { items:
|
|
1802
|
-
|
|
1803
|
-
}, []),
|
|
1804
|
-
|
|
1805
|
-
|
|
1806
|
-
}, [
|
|
1807
|
-
if (!c ||
|
|
1808
|
-
|
|
1809
|
-
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];
|
|
1810
1949
|
c(u);
|
|
1811
|
-
}, [c,
|
|
1812
|
-
const
|
|
1950
|
+
}, [c, D, T, i]);
|
|
1951
|
+
const ae = K(
|
|
1813
1952
|
(u) => {
|
|
1814
|
-
|
|
1815
|
-
const
|
|
1816
|
-
return queueMicrotask(() =>
|
|
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;
|
|
1817
1956
|
});
|
|
1818
1957
|
},
|
|
1819
|
-
[
|
|
1820
|
-
), je =
|
|
1958
|
+
[d]
|
|
1959
|
+
), je = M === "pending" || oe === "pending" || fe === "pending", Ce = K(
|
|
1821
1960
|
async (u) => {
|
|
1822
|
-
const
|
|
1823
|
-
|
|
1961
|
+
const ne = T;
|
|
1962
|
+
f(null), ae((J) => J.map((z) => ({ ...z, isDefault: z.id === u.id })));
|
|
1824
1963
|
try {
|
|
1825
|
-
await
|
|
1826
|
-
} catch (
|
|
1827
|
-
|
|
1828
|
-
const
|
|
1829
|
-
|
|
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);
|
|
1830
1969
|
}
|
|
1831
1970
|
},
|
|
1832
|
-
[
|
|
1833
|
-
),
|
|
1971
|
+
[T, ae, ee, x, d]
|
|
1972
|
+
), ye = K(
|
|
1834
1973
|
(u) => {
|
|
1835
|
-
c == null || c(u),
|
|
1974
|
+
c == null || c(u), _ && (u.isDefault || Ce(u));
|
|
1836
1975
|
},
|
|
1837
|
-
[c,
|
|
1838
|
-
),
|
|
1976
|
+
[c, _, Ce]
|
|
1977
|
+
), ve = K(
|
|
1839
1978
|
async (u) => {
|
|
1840
|
-
const
|
|
1841
|
-
|
|
1842
|
-
const
|
|
1843
|
-
|
|
1844
|
-
const
|
|
1845
|
-
|
|
1846
|
-
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;
|
|
1847
1986
|
try {
|
|
1848
|
-
await
|
|
1849
|
-
} catch (
|
|
1850
|
-
|
|
1851
|
-
const
|
|
1852
|
-
|
|
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);
|
|
1853
1992
|
}
|
|
1854
1993
|
},
|
|
1855
1994
|
[
|
|
1856
|
-
|
|
1857
|
-
|
|
1858
|
-
|
|
1859
|
-
|
|
1860
|
-
|
|
1861
|
-
|
|
1995
|
+
T,
|
|
1996
|
+
ae,
|
|
1997
|
+
N,
|
|
1998
|
+
x,
|
|
1999
|
+
d,
|
|
2000
|
+
i,
|
|
1862
2001
|
c,
|
|
1863
|
-
|
|
1864
|
-
|
|
2002
|
+
ye,
|
|
2003
|
+
_
|
|
1865
2004
|
]
|
|
1866
|
-
),
|
|
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(
|
|
1867
2030
|
(u) => {
|
|
1868
|
-
|
|
2031
|
+
G(null), R(!1), ge(null), ae((J) => [u, ...J.filter((z) => z.id !== u.id)]), ye(u), !!c && _ && !u.isDefault || x();
|
|
1869
2032
|
},
|
|
1870
|
-
[
|
|
1871
|
-
),
|
|
1872
|
-
|
|
1873
|
-
}, []),
|
|
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(
|
|
1874
2037
|
(u) => /* @__PURE__ */ a.jsx(
|
|
1875
|
-
|
|
2038
|
+
Or,
|
|
1876
2039
|
{
|
|
1877
2040
|
userId: r,
|
|
1878
|
-
isDefault:
|
|
1879
|
-
defaultCardholderName:
|
|
1880
|
-
autoSave: !u &&
|
|
2041
|
+
isDefault: He,
|
|
2042
|
+
defaultCardholderName: ue,
|
|
2043
|
+
autoSave: !u && Ie,
|
|
1881
2044
|
hideInternalSaveButton: u,
|
|
1882
|
-
formId: u ?
|
|
1883
|
-
onCanSubmitChange: u ?
|
|
1884
|
-
onSavingChange: u ?
|
|
2045
|
+
formId: u ? Rr : void 0,
|
|
2046
|
+
onCanSubmitChange: u ? Z : void 0,
|
|
2047
|
+
onSavingChange: u ? O : void 0,
|
|
1885
2048
|
autoFocus: u ? "number" : void 0,
|
|
1886
|
-
onSuccess:
|
|
1887
|
-
onError:
|
|
2049
|
+
onSuccess: be,
|
|
2050
|
+
onError: qe
|
|
1888
2051
|
}
|
|
1889
2052
|
),
|
|
1890
|
-
[r,
|
|
1891
|
-
),
|
|
1892
|
-
|
|
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,
|
|
1893
2056
|
{
|
|
1894
|
-
selected:
|
|
1895
|
-
onSelect: (u) =>
|
|
1896
|
-
creditCardBody:
|
|
2057
|
+
selected: xe,
|
|
2058
|
+
onSelect: (u) => ge(u),
|
|
2059
|
+
creditCardBody: Se
|
|
1897
2060
|
}
|
|
1898
|
-
) :
|
|
1899
|
-
|
|
2061
|
+
) : Se, [v, xe, Se]), Ze = Ke(() => v ? /* @__PURE__ */ a.jsx(
|
|
2062
|
+
Cr,
|
|
1900
2063
|
{
|
|
1901
|
-
selected:
|
|
1902
|
-
onSelect: (u) =>
|
|
1903
|
-
creditCardBody:
|
|
2064
|
+
selected: xe,
|
|
2065
|
+
onSelect: (u) => ge(u),
|
|
2066
|
+
creditCardBody: Le
|
|
1904
2067
|
}
|
|
1905
|
-
) :
|
|
2068
|
+
) : Le, [v, xe, Le]);
|
|
1906
2069
|
return /* @__PURE__ */ a.jsxs(
|
|
1907
2070
|
"div",
|
|
1908
2071
|
{
|
|
1909
|
-
className: Q("flex w-full flex-col gap-4",
|
|
2072
|
+
className: Q("flex w-full flex-col gap-4", w),
|
|
1910
2073
|
"data-testid": "payment-methods-manager",
|
|
1911
2074
|
children: [
|
|
1912
|
-
|
|
2075
|
+
D === "loading" && T.length === 0 ? (
|
|
1913
2076
|
// Only show the skeleton on first load — during a silent refetch
|
|
1914
2077
|
// (e.g. after set-default or delete optimistic mutations), the user
|
|
1915
2078
|
// already sees the correct optimistic list and a skeleton flash
|
|
@@ -1920,17 +2083,17 @@ const ct = (r) => {
|
|
|
1920
2083
|
className: Q(
|
|
1921
2084
|
// Match the real-list shell so layout doesn't reflow when data
|
|
1922
2085
|
// arrives. In selection mode the outer card is suppressed too.
|
|
1923
|
-
|
|
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"
|
|
1924
2087
|
),
|
|
1925
2088
|
"data-testid": "payment-methods-loading",
|
|
1926
2089
|
children: [
|
|
1927
|
-
/* @__PURE__ */ a.jsx(
|
|
1928
|
-
/* @__PURE__ */ a.jsx(
|
|
2090
|
+
/* @__PURE__ */ a.jsx(Pr, { withDefaultBadge: !0 }),
|
|
2091
|
+
/* @__PURE__ */ a.jsx(Pr, {})
|
|
1929
2092
|
]
|
|
1930
2093
|
}
|
|
1931
2094
|
)
|
|
1932
2095
|
) : null,
|
|
1933
|
-
|
|
2096
|
+
D === "error" ? /* @__PURE__ */ a.jsxs(
|
|
1934
2097
|
"div",
|
|
1935
2098
|
{
|
|
1936
2099
|
role: "alert",
|
|
@@ -1938,12 +2101,12 @@ const ct = (r) => {
|
|
|
1938
2101
|
className: "flex items-center justify-between gap-3 rounded-md bg-error-50 p-3 text-sm text-error-700",
|
|
1939
2102
|
"data-testid": "payment-methods-list-error",
|
|
1940
2103
|
children: [
|
|
1941
|
-
/* @__PURE__ */ a.jsx("span", { children:
|
|
2104
|
+
/* @__PURE__ */ a.jsx("span", { children: $ ?? "Failed to load payment methods." }),
|
|
1942
2105
|
/* @__PURE__ */ a.jsx(
|
|
1943
2106
|
"button",
|
|
1944
2107
|
{
|
|
1945
2108
|
type: "button",
|
|
1946
|
-
onClick:
|
|
2109
|
+
onClick: x,
|
|
1947
2110
|
className: "rounded-md border border-error-700 px-3 py-1 text-xs font-semibold text-error-700 hover:bg-error-50",
|
|
1948
2111
|
children: "Retry"
|
|
1949
2112
|
}
|
|
@@ -1951,27 +2114,27 @@ const ct = (r) => {
|
|
|
1951
2114
|
]
|
|
1952
2115
|
}
|
|
1953
2116
|
) : null,
|
|
1954
|
-
|
|
2117
|
+
S ? /* @__PURE__ */ a.jsx(
|
|
1955
2118
|
"div",
|
|
1956
2119
|
{
|
|
1957
2120
|
role: "alert",
|
|
1958
2121
|
"aria-live": "polite",
|
|
1959
2122
|
className: "rounded-md bg-error-50 p-3 text-sm text-error-700",
|
|
1960
2123
|
"data-testid": "payment-methods-mutation-error",
|
|
1961
|
-
children:
|
|
2124
|
+
children: S
|
|
1962
2125
|
}
|
|
1963
2126
|
) : null,
|
|
1964
|
-
|
|
2127
|
+
p && T.length > 0 ? /* @__PURE__ */ a.jsx("div", { className: "border-t border-grayWarm-200 pt-4", children: /* @__PURE__ */ a.jsxs(
|
|
1965
2128
|
"div",
|
|
1966
2129
|
{
|
|
1967
2130
|
className: "flex items-center justify-between",
|
|
1968
|
-
"data-testid":
|
|
2131
|
+
"data-testid": te ? "payment-methods-drawer-header" : "payment-methods-collapsed-preview",
|
|
1969
2132
|
children: [
|
|
1970
|
-
|
|
1971
|
-
|
|
2133
|
+
te ? /* @__PURE__ */ a.jsx("h3", { className: "text-md font-semibold text-grayWarm-950", children: "Payment methods" }) : /* @__PURE__ */ a.jsx(
|
|
2134
|
+
bt,
|
|
1972
2135
|
{
|
|
1973
|
-
method:
|
|
1974
|
-
cardLabelFormat:
|
|
2136
|
+
method: T.find((u) => u.id === i) ?? T.find((u) => u.isDefault) ?? T[0],
|
|
2137
|
+
cardLabelFormat: y,
|
|
1975
2138
|
className: "flex-1"
|
|
1976
2139
|
}
|
|
1977
2140
|
),
|
|
@@ -1979,15 +2142,15 @@ const ct = (r) => {
|
|
|
1979
2142
|
"button",
|
|
1980
2143
|
{
|
|
1981
2144
|
type: "button",
|
|
1982
|
-
"aria-label":
|
|
1983
|
-
"aria-expanded":
|
|
2145
|
+
"aria-label": te ? "Collapse payment methods" : "Expand payment methods",
|
|
2146
|
+
"aria-expanded": te,
|
|
1984
2147
|
className: "bg-grayWarm-100 p-2 rounded-lg hover:bg-grayWarm-200 transition-colors",
|
|
1985
|
-
onClick: () =>
|
|
1986
|
-
"data-testid":
|
|
2148
|
+
onClick: () => Ne((u) => !u),
|
|
2149
|
+
"data-testid": te ? "payment-methods-drawer-close" : "payment-methods-drawer-open",
|
|
1987
2150
|
children: /* @__PURE__ */ a.jsx(
|
|
1988
2151
|
"img",
|
|
1989
2152
|
{
|
|
1990
|
-
src: `${
|
|
2153
|
+
src: `${Ue().iconCdnBaseUrl}/website/assets/icons/chevron-${te ? "up" : "down"}-double.svg`,
|
|
1991
2154
|
alt: "",
|
|
1992
2155
|
className: "w-5 h-5"
|
|
1993
2156
|
}
|
|
@@ -1997,7 +2160,7 @@ const ct = (r) => {
|
|
|
1997
2160
|
]
|
|
1998
2161
|
}
|
|
1999
2162
|
) }) : null,
|
|
2000
|
-
|
|
2163
|
+
T.length > 0 && (!p || te) ? /* @__PURE__ */ a.jsx(
|
|
2001
2164
|
"div",
|
|
2002
2165
|
{
|
|
2003
2166
|
className: Q(
|
|
@@ -2006,30 +2169,31 @@ const ct = (r) => {
|
|
|
2006
2169
|
// with divide-y separators between rows.
|
|
2007
2170
|
// flights-ui (selectable or collapsible): bare space-y-3 gap between
|
|
2008
2171
|
// per-row bordered tiles; no outer card chrome.
|
|
2009
|
-
|
|
2172
|
+
Ge ? "rounded-xl border border-grayWarm-200 px-4 md:px-6 divide-y divide-grayWarm-200" : "space-y-3"
|
|
2010
2173
|
),
|
|
2011
|
-
children:
|
|
2012
|
-
|
|
2174
|
+
children: T.map((u) => /* @__PURE__ */ a.jsx(
|
|
2175
|
+
Et,
|
|
2013
2176
|
{
|
|
2014
2177
|
method: u,
|
|
2015
2178
|
selectable: Re,
|
|
2016
|
-
selected: Re && u.id ===
|
|
2017
|
-
onSelect:
|
|
2018
|
-
onSetDefault:
|
|
2019
|
-
onRemove:
|
|
2179
|
+
selected: Re && u.id === i,
|
|
2180
|
+
onSelect: ye,
|
|
2181
|
+
onSetDefault: Ce,
|
|
2182
|
+
onRemove: ve,
|
|
2183
|
+
onEdit: j,
|
|
2020
2184
|
disabled: je,
|
|
2021
|
-
showDefaultBadge:
|
|
2022
|
-
hideSetDefaultMenuItem:
|
|
2023
|
-
cardLabelFormat:
|
|
2185
|
+
showDefaultBadge: g,
|
|
2186
|
+
hideSetDefaultMenuItem: _,
|
|
2187
|
+
cardLabelFormat: y
|
|
2024
2188
|
},
|
|
2025
2189
|
u.id
|
|
2026
2190
|
))
|
|
2027
2191
|
}
|
|
2028
2192
|
) : null,
|
|
2029
|
-
|
|
2193
|
+
Qe ? (
|
|
2030
2194
|
// Empty state: render the add-card body inline (per Figma 1536-21454).
|
|
2031
|
-
/* @__PURE__ */ a.jsx("div", { "data-testid": "payment-methods-empty", children:
|
|
2032
|
-
) :
|
|
2195
|
+
/* @__PURE__ */ a.jsx("div", { "data-testid": "payment-methods-empty", children: Je })
|
|
2196
|
+
) : T.length > 0 && (!p || te) ? (
|
|
2033
2197
|
// Keep the Add button visible during silent refetches (status flips
|
|
2034
2198
|
// back to 'loading' transiently after set-default / delete).
|
|
2035
2199
|
// In collapsible mode only show the Add button when the drawer is open.
|
|
@@ -2038,14 +2202,14 @@ const ct = (r) => {
|
|
|
2038
2202
|
{
|
|
2039
2203
|
type: "button",
|
|
2040
2204
|
onClick: () => {
|
|
2041
|
-
|
|
2205
|
+
G(null), ge(null), Z(!1), R(!0);
|
|
2042
2206
|
},
|
|
2043
2207
|
onMouseEnter: () => {
|
|
2044
|
-
|
|
2208
|
+
mr().catch(() => {
|
|
2045
2209
|
});
|
|
2046
2210
|
},
|
|
2047
2211
|
onFocus: () => {
|
|
2048
|
-
|
|
2212
|
+
mr().catch(() => {
|
|
2049
2213
|
});
|
|
2050
2214
|
},
|
|
2051
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",
|
|
@@ -2055,16 +2219,16 @@ const ct = (r) => {
|
|
|
2055
2219
|
)
|
|
2056
2220
|
) : null,
|
|
2057
2221
|
/* @__PURE__ */ a.jsxs(
|
|
2058
|
-
|
|
2222
|
+
ht,
|
|
2059
2223
|
{
|
|
2060
|
-
open:
|
|
2061
|
-
onClose:
|
|
2062
|
-
formId:
|
|
2063
|
-
saveDisabled: !
|
|
2064
|
-
isSaving:
|
|
2224
|
+
open: W,
|
|
2225
|
+
onClose: de,
|
|
2226
|
+
formId: Rr,
|
|
2227
|
+
saveDisabled: !H,
|
|
2228
|
+
isSaving: re,
|
|
2065
2229
|
children: [
|
|
2066
|
-
|
|
2067
|
-
|
|
2230
|
+
Ze,
|
|
2231
|
+
U ? (
|
|
2068
2232
|
// Single source of truth for save-time errors (API failures + hook
|
|
2069
2233
|
// init failures forwarded from MovmoCardForm.onError). MovmoCardForm
|
|
2070
2234
|
// intentionally does NOT render its own banner — two role="alert"
|
|
@@ -2078,19 +2242,30 @@ const ct = (r) => {
|
|
|
2078
2242
|
"aria-live": "polite",
|
|
2079
2243
|
className: "mt-3 rounded-md bg-error-50 px-3 py-2 text-sm text-error-700",
|
|
2080
2244
|
"data-testid": "payment-methods-modal-error",
|
|
2081
|
-
children:
|
|
2245
|
+
children: U
|
|
2082
2246
|
}
|
|
2083
2247
|
)
|
|
2084
2248
|
) : null
|
|
2085
2249
|
]
|
|
2086
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
|
+
}
|
|
2087
2262
|
)
|
|
2088
2263
|
]
|
|
2089
2264
|
}
|
|
2090
2265
|
);
|
|
2091
2266
|
};
|
|
2092
|
-
|
|
2093
|
-
const
|
|
2267
|
+
Ct.displayName = "PaymentMethodsManager";
|
|
2268
|
+
const Rt = "/v1/auth/", kt = "movmo_csrf_token", Pt = (r) => {
|
|
2094
2269
|
if (typeof document > "u") return null;
|
|
2095
2270
|
const t = document.cookie ? document.cookie.split(";") : [];
|
|
2096
2271
|
for (const n of t) {
|
|
@@ -2099,80 +2274,81 @@ const gt = "/v1/auth/", wt = "movmo_csrf_token", jt = (r) => {
|
|
|
2099
2274
|
return decodeURIComponent(o.substring(r.length + 1));
|
|
2100
2275
|
}
|
|
2101
2276
|
return null;
|
|
2102
|
-
},
|
|
2277
|
+
}, Tt = (r) => typeof r == "string" ? r : r instanceof URL ? r.href : r.url, St = () => {
|
|
2103
2278
|
if (typeof globalThis < "u" && typeof globalThis.fetch == "function")
|
|
2104
2279
|
return globalThis.fetch.bind(globalThis);
|
|
2105
2280
|
throw new Error("@movmo_app/payments: no global fetch available in this environment");
|
|
2106
|
-
},
|
|
2281
|
+
}, Ot = (r) => {
|
|
2107
2282
|
const {
|
|
2108
2283
|
refreshSession: t,
|
|
2109
2284
|
onRefreshFailed: n,
|
|
2110
|
-
csrfCookieName: o =
|
|
2111
|
-
extraHeaders:
|
|
2112
|
-
authPathFragment: c =
|
|
2113
|
-
baseFetch:
|
|
2114
|
-
readCookie:
|
|
2285
|
+
csrfCookieName: o = kt,
|
|
2286
|
+
extraHeaders: i,
|
|
2287
|
+
authPathFragment: c = Rt,
|
|
2288
|
+
baseFetch: d = St(),
|
|
2289
|
+
readCookie: v = Pt
|
|
2115
2290
|
} = r;
|
|
2116
|
-
let
|
|
2117
|
-
const
|
|
2118
|
-
if (
|
|
2119
|
-
const
|
|
2291
|
+
let m = null;
|
|
2292
|
+
const _ = () => {
|
|
2293
|
+
if (m) return m;
|
|
2294
|
+
const p = (async () => {
|
|
2120
2295
|
await t();
|
|
2121
2296
|
})();
|
|
2122
|
-
return
|
|
2123
|
-
|
|
2297
|
+
return m = p, p.finally(() => {
|
|
2298
|
+
m === p && (m = null);
|
|
2124
2299
|
}).catch(() => {
|
|
2125
|
-
}),
|
|
2126
|
-
},
|
|
2127
|
-
const
|
|
2128
|
-
if (
|
|
2129
|
-
const
|
|
2130
|
-
for (const [
|
|
2131
|
-
|
|
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);
|
|
2132
2307
|
}
|
|
2133
2308
|
return {
|
|
2134
|
-
...
|
|
2135
|
-
headers:
|
|
2136
|
-
credentials: (
|
|
2309
|
+
...y,
|
|
2310
|
+
headers: w,
|
|
2311
|
+
credentials: (y == null ? void 0 : y.credentials) ?? "include"
|
|
2137
2312
|
};
|
|
2138
2313
|
};
|
|
2139
|
-
return async function(
|
|
2140
|
-
const
|
|
2141
|
-
if (
|
|
2142
|
-
return
|
|
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;
|
|
2143
2318
|
try {
|
|
2144
|
-
await
|
|
2145
|
-
} catch (
|
|
2319
|
+
await _();
|
|
2320
|
+
} catch (x) {
|
|
2146
2321
|
try {
|
|
2147
|
-
n(
|
|
2148
|
-
} catch (
|
|
2322
|
+
n(x);
|
|
2323
|
+
} catch (N) {
|
|
2149
2324
|
console.error(
|
|
2150
2325
|
"@movmo_app/payments: onRefreshFailed callback threw — auth retry path is misconfigured",
|
|
2151
|
-
|
|
2326
|
+
N
|
|
2152
2327
|
);
|
|
2153
2328
|
}
|
|
2154
|
-
return
|
|
2329
|
+
return P;
|
|
2155
2330
|
}
|
|
2156
2331
|
try {
|
|
2157
|
-
return await
|
|
2158
|
-
} catch (
|
|
2332
|
+
return await d(y, g(y, w));
|
|
2333
|
+
} catch (x) {
|
|
2159
2334
|
return console.error(
|
|
2160
2335
|
"@movmo_app/payments: retry after token refresh failed — returning original response",
|
|
2161
|
-
|
|
2162
|
-
),
|
|
2336
|
+
x
|
|
2337
|
+
), P;
|
|
2163
2338
|
}
|
|
2164
2339
|
};
|
|
2165
2340
|
};
|
|
2166
2341
|
export {
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2171
|
-
|
|
2172
|
-
|
|
2173
|
-
|
|
2174
|
-
|
|
2175
|
-
|
|
2176
|
-
|
|
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
|
|
2177
2353
|
};
|
|
2178
2354
|
//# sourceMappingURL=index.es.js.map
|