@movmo_app/payments 0.5.1 → 0.7.0

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