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