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