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