@movmo_app/payments 0.4.0 → 0.5.1

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