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