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