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