@movmo_app/payments 0.2.1 → 0.4.0

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