@movmo_app/payments 0.6.0 → 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 mr = (r, t, n) => Hr(r, typeof t != "symbol" ? t + "" : t, n);
4
- import Or, { useState as C, useRef as I, useEffect as D, useCallback as Y, useMemo as Qe, useId as Jr } from "react";
5
- var xr = { exports: {} }, He = {};
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 xr = { exports: {} }, He = {};
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 _r;
16
- function Zr() {
17
- if (_r) return He;
18
- _r = 1;
19
- var r = Or, 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, k) {
21
- var b, f = {}, y = null, w = null;
22
- k !== void 0 && (y = "" + k), m.key !== void 0 && (y = "" + m.key), m.ref !== void 0 && (w = m.ref);
23
- for (b in m) s.call(m, b) && !l.hasOwnProperty(b) && (f[b] = m[b]);
24
- if (x && x.defaultProps) for (b in m = x.defaultProps, m) f[b] === void 0 && (f[b] = m[b]);
25
- return { $$typeof: t, type: x, key: y, ref: w, props: f, _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 He.Fragment = n, He.jsx = u, He.jsxs = u, He;
27
+ return ar.Fragment = n, ar.jsx = u, ar.jsxs = u, ar;
28
28
  }
29
- var Je = {};
29
+ var nr = {};
30
30
  /**
31
31
  * @license React
32
32
  * react-jsx-runtime.development.js
@@ -36,57 +36,57 @@ var Je = {};
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 Nr;
40
- function Xr() {
41
- return Nr || (Nr = 1, process.env.NODE_ENV !== "production" && function() {
42
- var r = Or, 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"), k = Symbol.for("react.suspense"), b = Symbol.for("react.suspense_list"), f = Symbol.for("react.memo"), y = Symbol.for("react.lazy"), w = Symbol.for("react.offscreen"), S = Symbol.iterator, le = "@@iterator";
43
- function O(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 = S && e[S] || e[le];
46
+ var o = T && e[T] || e[se];
47
47
  return typeof o == "function" ? o : null;
48
48
  }
49
- var _ = r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
50
- function g(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
- q("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 q(e, o, c) {
57
+ function I(e, o, c) {
58
58
  {
59
- var h = _.ReactDebugCurrentFrame, F = h.getStackAddendum();
59
+ var x = E.ReactDebugCurrentFrame, F = x.getStackAddendum();
60
60
  F !== "" && (o += "%s", c = c.concat([F]));
61
- var $ = c.map(function(N) {
62
- return String(N);
61
+ var O = c.map(function(k) {
62
+ return String(k);
63
63
  });
64
- $.unshift("Warning: " + o), Function.prototype.apply.call(console[e], console, $);
64
+ O.unshift("Warning: " + o), Function.prototype.apply.call(console[e], console, O);
65
65
  }
66
66
  }
67
- var ae = !1, be = !1, pe = !1, ne = !1, ce = !1, M;
68
- M = Symbol.for("react.module.reference");
69
- function j(e) {
70
- return !!(typeof e == "string" || typeof e == "function" || e === s || e === l || ce || e === i || e === k || e === b || ne || e === w || ae || be || pe || typeof e == "object" && e !== null && (e.$$typeof === y || e.$$typeof === f || 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 === M || e.getModuleId !== void 0));
74
+ e.$$typeof === re || e.getModuleId !== void 0));
75
75
  }
76
- function he(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 Ne(e) {
83
+ function ke(e) {
84
84
  return e.displayName || "Context";
85
85
  }
86
- function P(e) {
86
+ function B(e) {
87
87
  if (e == null)
88
88
  return null;
89
- if (typeof e.tag == "number" && g("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 k:
102
+ case R:
103
103
  return "Suspense";
104
- case b:
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 Ne(o) + ".Consumer";
111
+ return ke(o) + ".Consumer";
112
112
  case u:
113
113
  var c = e;
114
- return Ne(c._context) + ".Provider";
114
+ return ke(c._context) + ".Provider";
115
115
  case m:
116
- return he(e, e.render, "ForwardRef");
117
- case f:
118
- var h = e.displayName || null;
119
- return h !== null ? h : P(e.type) || "Memo";
120
- case y: {
121
- var F = e, $ = F._payload, N = 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 P(N($));
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 v = Object.assign, p = 0, R, L, J, ye, Z, se, X;
132
- function W() {
131
+ var p = Object.assign, y = 0, P, D, ne, oe, q, J, G;
132
+ function S() {
133
133
  }
134
- W.__reactDisabledLog = !0;
135
- function ee() {
134
+ S.__reactDisabledLog = !0;
135
+ function Z() {
136
136
  {
137
- if (p === 0) {
138
- R = console.log, L = console.info, J = console.warn, ye = console.error, Z = console.group, se = console.groupCollapsed, X = 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: W,
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 Ce() {
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: v({}, e, {
168
- value: R
167
+ log: p({}, e, {
168
+ value: P
169
169
  }),
170
- info: v({}, e, {
171
- value: L
170
+ info: p({}, e, {
171
+ value: D
172
172
  }),
173
- warn: v({}, e, {
174
- value: J
173
+ warn: p({}, e, {
174
+ value: ne
175
175
  }),
176
- error: v({}, e, {
177
- value: ye
176
+ error: p({}, e, {
177
+ value: oe
178
178
  }),
179
- group: v({}, e, {
180
- value: Z
179
+ group: p({}, e, {
180
+ value: q
181
181
  }),
182
- groupCollapsed: v({}, e, {
183
- value: se
182
+ groupCollapsed: p({}, e, {
183
+ value: J
184
184
  }),
185
- groupEnd: v({}, e, {
186
- value: X
185
+ groupEnd: p({}, e, {
186
+ value: G
187
187
  })
188
188
  });
189
189
  }
190
- p < 0 && g("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 ve = _.ReactCurrentDispatcher, xe;
194
- function de(e, o, c) {
193
+ var be = E.ReactCurrentDispatcher, X;
194
+ function _e(e, o, c) {
195
195
  {
196
- if (xe === 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
- xe = h && h[1] || "";
200
+ var x = F.stack.trim().match(/\n( *(at )?)/);
201
+ X = x && x[1] || "";
202
202
  }
203
203
  return `
204
- ` + xe + e;
204
+ ` + X + e;
205
205
  }
206
206
  }
207
- var oe = !1, ke;
207
+ var Q = !1, We;
208
208
  {
209
- var Oe = typeof WeakMap == "function" ? WeakMap : Map;
210
- ke = new Oe();
209
+ var Pe = typeof WeakMap == "function" ? WeakMap : Map;
210
+ We = new Pe();
211
211
  }
212
- function ue(e, o) {
213
- if (!e || oe)
212
+ function le(e, o) {
213
+ if (!e || Q)
214
214
  return "";
215
215
  {
216
- var c = ke.get(e);
216
+ var c = We.get(e);
217
217
  if (c !== void 0)
218
218
  return c;
219
219
  }
220
- var h;
221
- oe = !0;
220
+ var x;
221
+ Q = !0;
222
222
  var F = Error.prepareStackTrace;
223
223
  Error.prepareStackTrace = void 0;
224
- var $;
225
- $ = ve.current, ve.current = null, ee();
224
+ var O;
225
+ O = be.current, be.current = null, Z();
226
226
  try {
227
227
  if (o) {
228
- var N = function() {
228
+ var k = function() {
229
229
  throw Error();
230
230
  };
231
- if (Object.defineProperty(N.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(N, []);
238
- } catch (me) {
239
- h = me;
237
+ Reflect.construct(k, []);
238
+ } catch (ye) {
239
+ x = ye;
240
240
  }
241
- Reflect.construct(e, [], N);
241
+ Reflect.construct(e, [], k);
242
242
  } else {
243
243
  try {
244
- N.call();
245
- } catch (me) {
246
- h = me;
244
+ k.call();
245
+ } catch (ye) {
246
+ x = ye;
247
247
  }
248
- e.call(N.prototype);
248
+ e.call(k.prototype);
249
249
  }
250
250
  } else {
251
251
  try {
252
252
  throw Error();
253
- } catch (me) {
254
- h = me;
253
+ } catch (ye) {
254
+ x = ye;
255
255
  }
256
256
  e();
257
257
  }
258
- } catch (me) {
259
- if (me && h && typeof me.stack == "string") {
260
- for (var E = me.stack.split(`
261
- `), ie = h.stack.split(`
262
- `), G = E.length - 1, H = ie.length - 1; G >= 1 && H >= 0 && E[G] !== ie[H]; )
263
- H--;
264
- for (; G >= 1 && H >= 0; G--, H--)
265
- if (E[G] !== ie[H]) {
266
- if (G !== 1 || H !== 1)
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
+ K--;
264
+ for (; H >= 1 && K >= 0; H--, K--)
265
+ if (_[H] !== me[K]) {
266
+ if (H !== 1 || K !== 1)
267
267
  do
268
- if (G--, H--, H < 0 || E[G] !== ie[H]) {
269
- var ge = `
270
- ` + E[G].replace(" at new ", " at ");
271
- return e.displayName && ge.includes("<anonymous>") && (ge = ge.replace("<anonymous>", e.displayName)), typeof e == "function" && ke.set(e, ge), ge;
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 (G >= 1 && H >= 0);
273
+ while (H >= 1 && K >= 0);
274
274
  break;
275
275
  }
276
276
  }
277
277
  } finally {
278
- oe = !1, ve.current = $, Ce(), 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 ? de(Me) : "";
281
- return typeof e == "function" && ke.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 Q(e, o, c) {
284
- return ue(e, !1);
283
+ function te(e, o, c) {
284
+ return le(e, !1);
285
285
  }
286
- function we(e) {
286
+ function Oe(e) {
287
287
  var o = e.prototype;
288
288
  return !!(o && o.isReactComponent);
289
289
  }
290
- function V(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 ue(e, we(e));
294
+ return le(e, Oe(e));
295
295
  if (typeof e == "string")
296
- return de(e);
296
+ return _e(e);
297
297
  switch (e) {
298
- case k:
299
- return de("Suspense");
300
- case b:
301
- return de("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 Q(e.render);
307
- case f:
308
- return V(e.type, o, c);
309
- case y: {
310
- var h = e, F = h._payload, $ = 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 V($(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 je = Object.prototype.hasOwnProperty, Fe = {}, _e = _.ReactDebugCurrentFrame;
320
- function re(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 = V(e.type, e._source, o ? o.type : null);
323
- _e.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
- _e.setExtraStackFrame(null);
325
+ ae.setExtraStackFrame(null);
326
326
  }
327
- function T(e, o, c, h, F) {
327
+ function Ae(e, o, c, x, F) {
328
328
  {
329
- var $ = Function.call.bind(je);
330
- for (var N in e)
331
- if ($(e, N)) {
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[N] != "function") {
335
- var ie = Error((h || "React class") + ": " + c + " type `" + N + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[N] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
336
- throw ie.name = "Invariant Violation", ie;
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[N](o, N, h, c, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
339
- } catch (G) {
340
- E = G;
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) && (re(F), g("%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, N, typeof E), re(null)), E instanceof Error && !(E.message in Fe) && (Fe[E.message] = !0, re(F), g("Failed %s type: %s", c, E.message), re(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 A = Array.isArray;
347
- function U(e) {
348
- return A(e);
346
+ var xe = Array.isArray;
347
+ function Ve(e) {
348
+ return xe(e);
349
349
  }
350
- function fe(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 dr(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
366
  function $e(e) {
367
- if (dr(e))
368
- return g("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", fe(e)), er(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 rr = _.ReactCurrentOwner, tr = {
370
+ var ze = E.ReactCurrentOwner, He = {
371
371
  key: !0,
372
372
  ref: !0,
373
373
  __self: !0,
374
374
  __source: !0
375
- }, Ye, ar;
376
- function Ve(e) {
377
- if (je.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 nr(e) {
385
- if (je.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 sr(e, o) {
393
- typeof e.ref == "string" && rr.current;
392
+ function he(e, o) {
393
+ typeof e.ref == "string" && ze.current;
394
394
  }
395
- function or(e, o) {
395
+ function ue(e, o) {
396
396
  {
397
397
  var c = function() {
398
- Ye || (Ye = !0, g("%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 De(e, o) {
406
+ function ir(e, o) {
407
407
  {
408
408
  var c = function() {
409
- ar || (ar = !0, g("%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 Ke = function(e, o, c, h, F, $, N) {
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: N,
425
+ props: k,
426
426
  // Record the component responsible for creating this element.
427
- _owner: $
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 qe(e, o, c, h, F) {
446
+ function cr(e, o, c, x, F) {
447
447
  {
448
- var $, N = {}, E = null, ie = null;
449
- c !== void 0 && ($e(c), E = "" + c), nr(o) && ($e(o.key), E = "" + o.key), Ve(o) && (ie = o.ref, sr(o, F));
450
- for ($ in o)
451
- je.call(o, $) && !tr.hasOwnProperty($) && (N[$] = o[$]);
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
+ for (O in o)
451
+ ce.call(o, O) && !He.hasOwnProperty(O) && (k[O] = o[O]);
452
452
  if (e && e.defaultProps) {
453
- var G = e.defaultProps;
454
- for ($ in G)
455
- N[$] === void 0 && (N[$] = G[$]);
453
+ var H = e.defaultProps;
454
+ for (O in H)
455
+ k[O] === void 0 && (k[O] = H[O]);
456
456
  }
457
- if (E || ie) {
458
- var H = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
- E && or(N, H), ie && De(N, H);
457
+ if (_ || me) {
458
+ var K = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
459
+ _ && ue(k, K), me && ir(k, K);
460
460
  }
461
- return Ke(e, E, ie, F, h, rr.current, N);
461
+ return lr(e, _, me, F, x, ze.current, k);
462
462
  }
463
463
  }
464
- var Pe = _.ReactCurrentOwner, ir = _.ReactDebugCurrentFrame;
465
- function Te(e) {
464
+ var Ue = E.ReactCurrentOwner, Ke = E.ReactDebugCurrentFrame;
465
+ function Fe(e) {
466
466
  if (e) {
467
- var o = e._owner, c = V(e.type, e._source, o ? o.type : null);
468
- ir.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
- ir.setExtraStackFrame(null);
470
+ Ke.setExtraStackFrame(null);
471
471
  }
472
- var d;
473
- d = !1;
474
- function K(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 z() {
477
+ function dr() {
478
478
  {
479
- if (Pe.current) {
480
- var e = P(Pe.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 B(e) {
489
+ function d(e) {
490
490
  return "";
491
491
  }
492
- var Ee = {};
493
- function Re(e) {
492
+ var V = {};
493
+ function Y(e) {
494
494
  {
495
- var o = z();
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 Ge(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 = Re(o);
511
- if (Ee[c])
510
+ var c = Y(o);
511
+ if (V[c])
512
512
  return;
513
- Ee[c] = !0;
514
- var h = "";
515
- e && e._owner && e._owner !== Pe.current && (h = " It was passed a child from " + P(e._owner.type) + "."), Te(e), g('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), Te(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 wr(e, o) {
518
+ function Ce(e, o) {
519
519
  {
520
520
  if (typeof e != "object")
521
521
  return;
522
- if (U(e))
522
+ if (Ve(e))
523
523
  for (var c = 0; c < e.length; c++) {
524
- var h = e[c];
525
- K(h) && Ge(h, o);
524
+ var x = e[c];
525
+ tr(x) && L(x, o);
526
526
  }
527
- else if (K(e))
527
+ else if (tr(e))
528
528
  e._store && (e._store.validated = !0);
529
529
  else if (e) {
530
- var F = O(e);
530
+ var F = z(e);
531
531
  if (typeof F == "function" && F !== e.entries)
532
- for (var $ = F.call(e), N; !(N = $.next()).done; )
533
- K(N.value) && Ge(N.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 === f))
547
+ o.$$typeof === v))
548
548
  c = o.propTypes;
549
549
  else
550
550
  return;
551
551
  if (c) {
552
- var h = P(o);
553
- T(c, e.props, "prop", h, e);
554
- } else if (o.PropTypes !== void 0 && !d) {
555
- d = !0;
556
- var F = P(o);
557
- g("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 && g("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
- Te(e), g("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", h), Te(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 && (Te(e), g("Invalid attribute `ref` supplied to `React.Fragment`."), Te(null));
571
+ e.ref !== null && (Fe(e), N("Invalid attribute `ref` supplied to `React.Fragment`."), Fe(null));
572
572
  }
573
573
  }
574
- var jr = {};
575
- function Er(e, o, c, h, F, $) {
574
+ var _r = {};
575
+ function Nr(e, o, c, x, F, O) {
576
576
  {
577
- var N = j(e);
578
- if (!N) {
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 ie = B();
582
- ie ? E += ie : E += z();
583
- var G;
584
- e === null ? G = "null" : U(e) ? G = "array" : e !== void 0 && e.$$typeof === t ? (G = "<" + (P(e.type) || "Unknown") + " />", E = " Did you accidentally export a JSX literal instead of a component?") : G = typeof e, g("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", G, 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 H = qe(e, o, c, F, $);
587
- if (H == null)
588
- return H;
589
- if (N) {
590
- var ge = o.children;
591
- if (ge !== void 0)
592
- if (h)
593
- if (U(ge)) {
594
- for (var Me = 0; Me < ge.length; Me++)
595
- wr(ge[Me], e);
596
- Object.freeze && Object.freeze(ge);
586
+ var K = cr(e, o, c, F, O);
587
+ if (K == null)
588
+ return K;
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
- g("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
- wr(ge, e);
600
+ Ce(je, e);
601
601
  }
602
- if (je.call(o, "key")) {
603
- var We = P(e), me = Object.keys(o).filter(function(qr) {
604
- return qr !== "key";
605
- }), ur = me.length > 0 ? "{key: someKey, " + me.join(": ..., ") + ": ...}" : "{key: someKey}";
606
- if (!jr[We + ur]) {
607
- var Kr = me.length > 0 ? "{" + me.join(": ..., ") + ": ...}" : "{}";
608
- g(`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} />`, ur, We, Kr, We), jr[We + ur] = !0;
613
+ <%s key={someKey} {...props} />`, pr, Ge, Jr, Ge), _r[Ge + pr] = !0;
614
614
  }
615
615
  }
616
- return e === s ? Lr(H) : Ir(H), H;
616
+ return e === s ? ur(K) : Me(K), K;
617
617
  }
618
618
  }
619
- function zr(e, o, c) {
620
- return Er(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 Er(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
- Je.Fragment = s, Je.jsx = Yr, Je.jsxs = Vr;
627
- }()), Je;
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" ? xr.exports = Zr() : xr.exports = Xr();
630
- var a = xr.exports;
631
- function $r(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 = $r(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 te() {
641
- for (var r, t, n = 0, s = "", i = arguments.length; n < i; n++) (r = arguments[n]) && (t = $r(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
- }, fr = (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 ?? fr("REACT_APP_MOVMO_API_URL") ?? "",
654
- spreedlyScriptUrl: Ae.spreedlyScriptUrl ?? fr("REACT_APP_SPREEDLY_SCRIPT_URL") ?? Qr,
655
- iconCdnBaseUrl: Ae.iconCdnBaseUrl ?? fr("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
- }), gr = (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 Ze = null;
690
- const br = () => {
691
- if (Ze) return Ze;
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 Ze = r, r.finally(() => {
703
- Ze === r && (Ze = 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 gr(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 gr(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(gr);
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
- }, Dr = 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 br = () => {
801
801
  }
802
802
  );
803
803
  };
804
- let Xe = 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 (Xe)
811
- return Xe;
812
- const { spreedlyScriptUrl: r } = Be();
813
- return Xe = 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 Xe = null, t;
839
- }), Xe;
838
+ throw or = null, t;
839
+ }), or;
840
840
  };
841
- class lr 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
- mr(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
- mr(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] = C("idle"), [k, b] = C(null), [f, y] = C(null), [w, S] = C(null), [le, O] = C({ number: !1, cvv: !1 }), [_, g] = C(null), [q, ae] = C({ number: !1, cvv: !1 }), be = I(null), pe = I(s), ne = I(i), ce = I(l), M = I(u);
867
- D(() => {
868
- pe.current = s;
869
- }, [s]), D(() => {
870
- ne.current = i;
871
- }, [i]), D(() => {
872
- ce.current = l;
873
- }, [l]), D(() => {
874
- M.current = u;
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
+ ie.current = l;
873
+ }, [l]), W(() => {
874
+ re.current = u;
875
875
  }, [u]);
876
- const j = I({ number: !1, cvv: !1 });
877
- D(() => {
878
- let P = !1;
879
- return m("loading"), b(null), y(null), S(null), O({ number: !1, cvv: !1 }), g(null), j.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 [v, p] = await Promise.all([
882
- br().catch((R) => {
883
- throw new lr("tokenization-session", R);
881
+ const [p, y] = await Promise.all([
882
+ jr().catch((P) => {
883
+ throw new mr("tokenization-session", P);
884
884
  }),
885
- it().catch((R) => {
886
- throw new lr("spreedly-script", R);
885
+ ut().catch((P) => {
886
+ throw new mr("spreedly-script", P);
887
887
  })
888
888
  ]);
889
- if (P) return;
890
- be.current = p, p.on("ready", () => {
891
- var R, L, J, ye, Z, se;
892
- if (!P) {
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
- (R = p.setFieldType) == null || R.call(p, "number", "tel"), (L = p.setFieldType) == null || L.call(p, "cvv", "tel");
896
- } catch (X) {
897
- console.warn("@movmo_app/payments: setFieldType failed", X);
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 (X) {
904
- console.warn("@movmo_app/payments: setNumberFormat failed", X);
903
+ } catch (G) {
904
+ console.warn("@movmo_app/payments: setNumberFormat failed", G);
905
905
  }
906
906
  try {
907
- (J = p.setPlaceholder) == null || J.call(p, "number", "Card number"), (ye = p.setPlaceholder) == null || ye.call(p, "cvv", "CVV");
908
- const X = '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
- (Z = p.setStyle) == null || Z.call(p, "number", X), (se = p.setStyle) == null || se.call(p, "cvv", X);
910
- } catch (X) {
911
- console.warn("@movmo_app/payments: setPlaceholder/setStyle failed", X);
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", (R) => {
915
- var L;
916
- (L = pe.current) == null || L.call(pe, R);
917
- }), p.on("errors", (R) => {
918
- var L;
919
- (L = ne.current) == null || L.call(ne, R);
920
- }), p.on("fieldEvent", (R, L, J, ye) => {
921
- var X;
922
- if (P) return;
923
- if (L === "focus") {
924
- ae((W) => W[R] ? W : { ...W, [R]: !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 (L === "blur") {
928
- ae((W) => W[R] ? { ...W, [R]: !1 } : W);
927
+ if (D === "blur") {
928
+ ve((S) => S[P] ? { ...S, [P]: !1 } : S);
929
929
  return;
930
930
  }
931
- if (L !== "input") return;
932
- const Z = ye ?? {};
933
- if (R === "number") {
934
- if (Z.numberLength === 0)
935
- g((W) => {
936
- var ee;
937
- return W !== null && ((ee = M.current) == null || ee.call(M, 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 (Z.cardType !== void 0) {
940
- const W = Z.cardType || null;
941
- g((ee) => {
942
- var Ce;
943
- return ee !== W && ((Ce = M.current) == null || Ce.call(M, W)), W;
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 se = R === "number" ? typeof Z.validNumber == "boolean" ? Z.validNumber : void 0 : typeof Z.validCvv == "boolean" ? Z.validCvv : void 0;
948
- if (typeof se == "boolean") {
949
- const W = j.current, ee = R === "number" ? { ...W, number: se } : { ...W, cvv: se };
950
- (ee.number !== W.number || ee.cvv !== W.cvv) && (j.current = ee, O(ee), (X = ce.current) == null || X.call(ce, ee));
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", (R) => {
953
- var J;
954
- const L = R instanceof Error ? R.message : "An unexpected error occurred while securing your card.";
955
- (J = ne.current) == null || J.call(ne, [{ message: L }]);
956
- }), p.init(v.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: v.nonce,
960
- timestamp: String(v.timestamp),
961
- certificateToken: v.certificateToken,
962
- signature: v.signature
959
+ nonce: p.nonce,
960
+ timestamp: String(p.timestamp),
961
+ certificateToken: p.certificateToken,
962
+ signature: p.signature
963
963
  });
964
- } catch (v) {
965
- if (P) return;
966
- const p = v instanceof Error ? v.message : "Failed to initialize card form.";
967
- b(p), y(v instanceof lr ? v.source : "spreedly-script"), S(v instanceof lr ? v.cause : v), 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 v, p;
971
- P = !0;
970
+ var p, y;
971
+ B = !0;
972
972
  try {
973
- (p = (v = be.current) == null ? void 0 : v.removeHandlers) == null || p.call(v);
974
- } catch (R) {
975
- console.warn("@movmo_app/payments: removeHandlers failed during cleanup", R);
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
- be.current = null;
977
+ fe.current = null;
978
978
  };
979
979
  }, [t, n]);
980
- const he = Y((P) => {
981
- var v;
982
- (v = be.current) == null || v.tokenizeCreditCard(dt(P));
983
- }, []), Ne = Y((P) => {
984
- var v, p;
985
- (p = (v = be.current) == null ? void 0 : v.transferFocus) == null || p.call(v, P);
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: k, errorSource: f, errorCause: w, tokenize: he, validity: le, brand: _, focused: q, focusField: Ne };
988
- }, pr = "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]", Cr = "flex h-11 w-full items-center gap-2 rounded-md border bg-white px-3 py-2 transition-shadow", kr = "border-grayWarm-950 shadow-[0_0_0_1px_#1c1917]", Rr = "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
- }, Mr = (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
- }, hr = (r) => {
1005
- const { month: t, year: n } = Mr(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
- }, yr = (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
- }, Ar = ({
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: k = !1,
1025
- formId: b = "movmo-card-form",
1026
- hideInternalSaveButton: f = !1,
1027
- onCanSubmitChange: y,
1028
- onSavingChange: w,
1029
- autoFocus: S
1047
+ autoSave: R = !1,
1048
+ formId: w = "movmo-card-form",
1049
+ hideInternalSaveButton: v = !1,
1050
+ onCanSubmitChange: g,
1051
+ onSavingChange: j,
1052
+ autoFocus: T,
1053
+ onValidationChange: se
1030
1054
  }) => {
1031
- const le = u ?? [x, m].filter(Boolean).join(" "), [O, _] = C(le), [g, q] = C(""), [ae, be] = C(""), [pe, ne] = C("idle"), ce = I(!1), M = I(s);
1032
- D(() => {
1033
- M.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 j = Y(
1036
- async (T) => {
1037
- var A;
1038
- ne("saving");
1059
+ const ge = A(
1060
+ async (f) => {
1061
+ var $;
1062
+ ie("saving");
1039
1063
  try {
1040
- const U = await tt(r, T, i);
1041
- ne("ready"), t(U);
1042
- } catch (U) {
1043
- const fe = U instanceof Error ? U.message : "Failed to save payment method.";
1044
- ne("ready"), ce.current = !1, n(fe), (A = M.current) == null || A.call(M, { source: "save-from-token", message: fe, cause: U });
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
- ), he = Y(
1049
- (T) => {
1050
- var U;
1051
- const A = T.map((fe) => fe.message).filter(Boolean).join("; ") || "Card validation failed.";
1052
- ne((fe) => fe === "tokenizing" ? "ready" : fe), ce.current = !1, n(A), (U = M.current) == null || U.call(M, { source: "card-tokenize", message: A });
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
- ), Ne = Qe(
1079
+ ), B = Be(
1056
1080
  () => ({
1057
- onCardTokenized: j,
1058
- onFieldErrors: he
1081
+ onCardTokenized: ge,
1082
+ onFieldErrors: ke
1059
1083
  }),
1060
- [j, he]
1084
+ [ge, ke]
1061
1085
  ), {
1062
- status: P,
1063
- error: v,
1064
- errorSource: p,
1065
- errorCause: R,
1066
- tokenize: L,
1067
- validity: J,
1068
- brand: ye,
1069
- focused: Z,
1070
- focusField: se
1071
- } = ut(Ne), X = I(!1);
1072
- D(() => {
1073
- !S || P !== "ready" || X.current || (X.current = !0, se(S));
1074
- }, [S, P, se]);
1075
- const W = O.trim().split(/\s+/).length >= 2, ee = hr(g), Ce = yr(ae), ve = I(!1), xe = I(!1), de = I(!1), oe = I(null), ke = I(null);
1076
- D(() => {
1077
- var T;
1078
- J.cvv ? xe.current || (xe.current = !0, (T = oe.current) == null || T.focus()) : xe.current = !1;
1079
- }, [J.cvv]);
1080
- const Oe = !W || !ee || !Ce || !J.number || !J.cvv, ue = pe === "tokenizing" || pe === "saving", Q = P === "ready" && !ue && !Oe, we = I(y);
1081
- D(() => {
1082
- we.current = y;
1083
- }, [y]), D(() => {
1084
- var T;
1085
- (T = we.current) == null || T.call(we, Q);
1086
- }, [Q]);
1087
- const V = I(w);
1088
- D(() => {
1089
- V.current = w;
1090
- }, [w]), D(() => {
1091
- var T;
1092
- (T = V.current) == null || T.call(V, ue);
1093
- }, [ue]);
1094
- const je = Y(() => {
1095
- const { firstName: T, lastName: A } = mt(O), { month: U, year: fe } = Mr(g);
1096
- ne("tokenizing"), L({ firstName: T, lastName: A, month: U, year: fe, zip: ae.trim() });
1097
- }, [O, g, ae, L]);
1098
- D(() => {
1099
- if (!k || !Q || ce.current) return;
1100
- const T = setTimeout(() => {
1101
- ce.current = !0, je();
1086
+ status: p,
1087
+ error: y,
1088
+ errorSource: P,
1089
+ errorCause: D,
1090
+ tokenize: ne,
1091
+ validity: oe,
1092
+ brand: q,
1093
+ focused: J,
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);
1144
+ }, [we]);
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(T);
1104
- }, [k, Q, je]);
1105
- const Fe = (T) => {
1106
- T.preventDefault(), Q && je();
1107
- }, _e = P !== "ready" || ue, re = I(n);
1108
- return D(() => {
1109
- re.current = n;
1110
- }, [n]), D(() => {
1111
- var T, A;
1112
- v && ((T = re.current) == null || T.call(re, v), (A = M.current) == null || A.call(M, {
1113
- source: p ?? "spreedly-script",
1114
- message: v,
1115
- cause: R
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
- }, [v, p, R]), /* @__PURE__ */ a.jsxs(
1168
+ }, [y, P, D]), /* @__PURE__ */ a.jsxs(
1118
1169
  "form",
1119
1170
  {
1120
- id: b,
1121
- onSubmit: Fe,
1122
- className: te("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: te(
1131
- Cr,
1132
- Z.number ? kr : Rr
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: ye ?? "", 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": P !== "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
- P !== "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: g,
1171
- onChange: (T) => {
1172
- const A = ft(T.target.value);
1173
- q(A), hr(A) && !ve.current ? (ve.current = !0, se("cvv")) : hr(A) || (ve.current = !1);
1174
- },
1175
- className: te(pr, g && !ee && "border-error-500"),
1176
- disabled: _e,
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: te(
1188
- Cr,
1189
- Z.cvv ? kr : Rr
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",
1283
+ "button",
1195
1284
  {
1196
- id: "movmo-card-cvv",
1197
- "aria-labelledby": "movmo-card-cvv-label",
1198
- "aria-busy": P !== "ready",
1199
- className: "absolute inset-0",
1200
- "data-testid": "movmo-card-cvv-mount"
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: "?"
1201
1292
  }
1202
- ),
1203
- P !== "ready" ? /* @__PURE__ */ a.jsx(
1204
- "div",
1205
- {
1206
- "aria-hidden": "true",
1207
- className: "pointer-events-none absolute inset-y-2 left-0 right-2 animate-pulse rounded bg-grayWarm-200"
1208
- }
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: ye === "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: oe,
1234
- type: "text",
1235
- inputMode: "numeric",
1236
- autoComplete: "postal-code",
1237
- placeholder: "ZIP code",
1238
- value: ae,
1239
- onChange: (T) => {
1240
- var U;
1241
- const A = pt(T.target.value);
1242
- be(A), yr(A) && !de.current ? (de.current = !0, (U = ke.current) == null || U.focus()) : yr(A) || (de.current = !1);
1243
- },
1244
- className: te(pr, ae && !Ce && "border-error-500"),
1245
- disabled: _e,
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: ke,
1259
1342
  type: "text",
1260
1343
  autoComplete: "cc-name",
1261
1344
  placeholder: "Cardholder name",
1262
- value: O,
1263
- onChange: (T) => _(T.target.value),
1264
- className: pr,
1265
- disabled: _e,
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
- !k && !f ? /* @__PURE__ */ a.jsx(
1369
+ !R && !v ? /* @__PURE__ */ a.jsx(
1272
1370
  "button",
1273
1371
  {
1274
1372
  type: "submit",
1275
- disabled: !Q,
1276
- className: te(
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: ue ? "Saving…" : P === "loading" ? "Loading…" : "Save card"
1379
+ children: we ? "Saving…" : p === "loading" ? "Loading…" : "Save card"
1282
1380
  }
1283
- ) : ue && k ? (
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
- Ar.displayName = "MovmoCardForm";
1303
- const ht = (r) => {
1395
+ Yr.displayName = "MovmoCardForm";
1396
+ const wt = (r) => {
1304
1397
  const [t, n] = C("idle"), [s, i] = C(null);
1305
- return { deletePaymentMethod: Y(
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) => {
1410
+ }, jt = (r) => {
1318
1411
  const [t, n] = C("idle"), [s, i] = C(null);
1319
- return { setDefault: Y(
1412
+ return { setDefault: A(
1320
1413
  async (u) => {
1321
1414
  n("pending"), i(null);
1322
1415
  try {
1323
- await Dr(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) => {
1424
+ }, Et = (r) => {
1332
1425
  const [t, n] = C("idle"), [s, i] = C(null);
1333
- return { updatePaymentMethod: Y(
1334
- async (u, x) => {
1426
+ return { updatePaymentMethod: A(
1427
+ async (u, h) => {
1335
1428
  n("pending"), i(null);
1336
1429
  try {
1337
- await Dr(r, u, x), n("idle");
1430
+ await Ir(r, u, h), n("idle");
1338
1431
  } catch (m) {
1339
- const k = m instanceof Error ? m.message : "Failed to update payment method.";
1340
- throw i(k), 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] = C([]), [s, i] = C("idle"), [l, u] = C(null), [x, m] = C(0), k = I(null);
1347
- D(() => {
1348
- var y;
1349
- if ((y = k.current) == null || y.abort(), !r) {
1350
- k.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 f = new AbortController();
1354
- return k.current = f, i("loading"), u(null), at(r, f.signal).then((w) => {
1355
- f.signal.aborted || (n(w), i("ready"));
1356
- }).catch((w) => {
1357
- if (f.signal.aborted || w instanceof DOMException && w.name === "AbortError") return;
1358
- const S = w instanceof Error ? w.message : "Failed to fetch payment methods.";
1359
- u(S), i("error");
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"));
1449
+ }).catch((j) => {
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
- f.abort();
1454
+ v.abort();
1362
1455
  };
1363
- }, [r, x]);
1364
- const b = Y(() => {
1365
- m((f) => f + 1);
1456
+ }, [r, h]);
1457
+ const w = A(() => {
1458
+ m((v) => v + 1);
1366
1459
  }, []);
1367
- return { items: t, status: s, error: l, refetch: b };
1368
- }, Ur = ({
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: k
1379
- }) => (D(() => {
1471
+ children: R
1472
+ }) => (W(() => {
1380
1473
  if (!r) return;
1381
- const b = (f) => {
1382
- f.key === "Escape" && t();
1474
+ const w = (v) => {
1475
+ v.key === "Escape" && t();
1383
1476
  };
1384
- return document.addEventListener("keydown", b), () => document.removeEventListener("keydown", b);
1385
- }, [r, t]), D(() => {
1477
+ return document.addEventListener("keydown", w), () => document.removeEventListener("keydown", w);
1478
+ }, [r, t]), W(() => {
1386
1479
  if (!r) return;
1387
- const b = document.body.style.overflow;
1480
+ const w = document.body.style.overflow;
1388
1481
  return document.body.style.overflow = "hidden", () => {
1389
- document.body.style.overflow = b;
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: (b) => {
1399
- b.target === b.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: k }),
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: te(
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
- Ur,
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] = C(""), [k, b] = C("");
1526
- if (D(() => {
1527
- r && t && (m(t.cardholderName ?? ""), b(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 f = x.trim(), y = k.trim(), w = f !== (t.cardholderName ?? "").trim(), S = y !== (t.zip ?? "").trim(), le = w || S, O = (!w || f.length > 0) && (!S || /^[A-Za-z0-9 -]{3,20}$/.test(y)), _ = !le || !O, g = (q) => {
1530
- if (q.preventDefault(), _ || i) return;
1531
- const ae = {};
1532
- w && (ae.cardholderName = f), S && (ae.zip = y), s(ae).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
- Ur,
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: _,
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: g, 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: (q) => m(q.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: k,
1594
- onChange: (q) => b(q.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: te("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, Pr = (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: k,
1657
- cardLabelFormat: b = "branded"
1747
+ hideSetDefaultMenuItem: R,
1748
+ cardLabelFormat: w = "branded"
1658
1749
  }) => {
1659
- const [f, y] = C(!1), w = I(null), S = Nt(r.expMonth, r.expYear);
1660
- D(() => {
1661
- if (!f) return;
1662
- const O = (_) => {
1663
- var g;
1664
- (g = w.current) != null && g.contains(_.target) || y(!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", O), () => document.removeEventListener("mousedown", O);
1667
- }, [f]);
1668
- const le = () => {
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: te(
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: le,
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: (O) => O.stopPropagation(),
1695
- "aria-label": `Select ${Pr(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: b === "masked" ? `•••• ${r.last4}` : `${Pr(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
- S ? /* @__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,33 +1809,33 @@ const ht = (r) => {
1718
1809
  }
1719
1810
  ) : null
1720
1811
  ] }),
1721
- /* @__PURE__ */ a.jsxs("div", { className: te("text-base", S ? "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
- /* @__PURE__ */ a.jsxs("div", { className: "relative flex-shrink-0", ref: w, children: [
1817
+ /* @__PURE__ */ a.jsxs("div", { className: "relative flex-shrink-0", ref: j, children: [
1727
1818
  /* @__PURE__ */ a.jsx(
1728
1819
  "button",
1729
1820
  {
1730
1821
  type: "button",
1731
1822
  "aria-label": `Open actions for card ending ${r.last4}`,
1732
1823
  "aria-haspopup": "menu",
1733
- "aria-expanded": f,
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: (O) => {
1737
- O.stopPropagation(), y((_) => !_);
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
- f ? /* @__PURE__ */ a.jsxs(
1834
+ v ? /* @__PURE__ */ a.jsxs(
1744
1835
  "div",
1745
1836
  {
1746
1837
  role: "menu",
1747
- className: te(
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: (O) => O.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 && !k ? /* @__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
- y(!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
- y(!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
- y(!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`, vr = ({ 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
- ), cr = ({
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: te(
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
- ), Tr = ({
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: te("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: te(
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: te(
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
- cr,
2014
+ fr,
1924
2015
  {
1925
2016
  type: "paypal",
1926
2017
  label: "PayPal",
1927
- iconNode: /* @__PURE__ */ a.jsx(vr, { 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
- cr,
2023
+ fr,
1933
2024
  {
1934
2025
  type: "googlepay",
1935
2026
  label: "GooglePay",
1936
- iconNode: /* @__PURE__ */ a.jsx(vr, { 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
- cr,
2032
+ fr,
1942
2033
  {
1943
2034
  type: "klarna",
1944
2035
  label: "Klarna",
1945
- iconNode: /* @__PURE__ */ a.jsx(vr, { 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
- cr,
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
- }, Sr = "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
- }, Fr = (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
- }, Wr = ({ 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,207 +2083,224 @@ const ht = (r) => {
1983
2083
  selectedId: i,
1984
2084
  onSelect: l,
1985
2085
  onChange: u,
1986
- onError: x,
2086
+ onError: h,
1987
2087
  onEvent: m,
1988
- paymentTypeSelector: k = !0,
1989
- autoSaveFirstCard: b = !0,
1990
- selectionSetsDefault: f = !1,
1991
- showDefaultBadge: y = !0,
1992
- collapsible: w = !1,
1993
- cardLabelFormat: S = "branded",
1994
- className: le
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
1995
2095
  }) => {
1996
- const { items: O, status: _, error: g, refetch: q } = xt(r), { deletePaymentMethod: ae, status: be } = ht(r), { setDefault: pe, status: ne } = yt(r), { updatePaymentMethod: ce, status: M } = vt(r), [j, he] = C([]), Ne = I(j);
1997
- D(() => {
1998
- Ne.current = j;
1999
- }, [j]);
2000
- const [P, v] = C(null), [p, R] = C(!1), [L, J] = C(null), [ye, Z] = C(!1), [se, X] = C(!1), [W, ee] = C(null), [Ce, ve] = C(null), [xe, de] = C(null), [oe, ke] = C(!1), Oe = I(!1), ue = I(x);
2001
- D(() => {
2002
- ue.current = x;
2003
- }, [x]);
2004
- const Q = Y((d) => {
2005
- var K;
2006
- (K = ue.current) == null || K.call(ue, d);
2007
- }, []), we = I(m);
2008
- D(() => {
2009
- we.current = m;
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;
2010
2110
  }, [m]);
2011
- const V = Y((d, K) => {
2012
- var z;
2013
- (z = we.current) == null || z.call(we, d, K);
2014
- }, []), je = Y(() => {
2015
- R(!1), J(null), de(null);
2016
- }, []), Fe = t ?? ([n, s].filter(Boolean).join(" ") || void 0);
2017
- D(() => {
2018
- _ === "ready" && he(Fr(O));
2019
- }, [O, _]);
2020
- const _e = I(null);
2021
- D(() => {
2022
- if (_ === "error" && g) {
2023
- if (_e.current === g) return;
2024
- _e.current = g, Q({ source: "list", message: g });
2025
- } else _ !== "error" && (_e.current = null);
2026
- }, [_, g, Q]), D(() => {
2027
- if (!l || Oe.current || _ !== "ready" || j.length === 0 || i) return;
2028
- Oe.current = !0, V("autoselected", { had_saved_methods: !0 });
2029
- const d = j.find((K) => K.isDefault) ?? j[0];
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];
2030
2142
  l(d);
2031
- }, [l, _, j, i, V]);
2032
- const re = Y(
2143
+ }, [l, E, b, i, U]);
2144
+ const xe = A(
2033
2145
  (d) => {
2034
- he((K) => {
2035
- const z = typeof d == "function" ? d(K) : d, B = Fr(z);
2036
- return queueMicrotask(() => u == null ? void 0 : u(B)), B;
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;
2037
2149
  });
2038
2150
  },
2039
2151
  [u]
2040
- ), T = be === "pending" || ne === "pending" || M === "pending", A = Y(
2152
+ ), Ve = fe === "pending" || pe === "pending" || re === "pending", we = A(
2041
2153
  async (d) => {
2042
- const K = j;
2043
- v(null), re((z) => z.map((B) => ({ ...B, isDefault: B.id === d.id })));
2154
+ const V = b;
2155
+ p(null), xe((Y) => Y.map((L) => ({ ...L, isDefault: L.id === d.id })));
2044
2156
  try {
2045
- await pe(d.id), q(), V("set_default");
2046
- } catch (z) {
2047
- he(K), u == null || u(K);
2048
- const B = z instanceof Error ? z.message : "Failed to set default payment method.";
2049
- v(B), Q({ source: "set-default", message: B, cause: z });
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 });
2050
2162
  }
2051
2163
  },
2052
- [j, re, pe, q, u, Q, V]
2053
- ), U = Y(
2164
+ [b, xe, Ee, I, u, te, U]
2165
+ ), de = A(
2054
2166
  (d) => {
2055
- l == null || l(d), f && (d.isDefault || A(d));
2167
+ l == null || l(d), v && (d.isDefault || we(d));
2056
2168
  },
2057
- [l, f, A]
2058
- ), fe = Y(
2169
+ [l, v, we]
2170
+ ), De = A(
2059
2171
  (d) => {
2060
- V("selected", { method_count: j.length }), U(d);
2172
+ U("selected", { method_count: b.length }), de(d);
2061
2173
  },
2062
- [V, j, U]
2063
- ), dr = Y(
2174
+ [U, b, de]
2175
+ ), $e = A(
2064
2176
  async (d) => {
2065
- const K = j;
2066
- v(null);
2067
- const z = j.filter((Re) => Re.id !== d.id);
2068
- re(() => z);
2069
- const B = d.id === i && l ? z.find((Re) => Re.isDefault) ?? z[0] ?? null : null;
2070
- B && U(B);
2071
- const Ee = !!B && f && B !== null && !B.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;
2072
2184
  try {
2073
- await ae(d.id), Ee || q(), V("deleted", { remaining_count: z.length });
2074
- } catch (Re) {
2075
- he(K), u == null || u(K);
2076
- const Ge = Re instanceof Error ? Re.message : "Failed to delete payment method.";
2077
- v(Ge), Q({ source: "delete", message: Ge, cause: Re });
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 });
2078
2190
  }
2079
2191
  },
2080
2192
  [
2081
- j,
2082
- re,
2083
- ae,
2084
- q,
2193
+ b,
2194
+ xe,
2195
+ ve,
2196
+ I,
2085
2197
  u,
2086
2198
  i,
2087
2199
  l,
2088
- U,
2089
- f,
2090
- Q,
2091
- V
2200
+ de,
2201
+ v,
2202
+ te,
2203
+ U
2092
2204
  ]
2093
- ), er = Y((d) => {
2094
- ve(null), ee(d);
2095
- }, []), $e = Y(() => {
2096
- ee(null), ve(null);
2097
- }, []), rr = Y(
2205
+ ), ze = A((d) => {
2206
+ be(null), Z(d);
2207
+ }, []), He = A(() => {
2208
+ Z(null), be(null);
2209
+ }, []), Ie = A(
2098
2210
  async (d) => {
2099
- if (!W) return;
2100
- const K = W, z = j;
2101
- ve(null), re(
2102
- (B) => B.map(
2103
- (Ee) => Ee.id === K.id ? {
2104
- ...Ee,
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,
2105
2217
  ...d.cardholderName !== void 0 ? { cardholderName: d.cardholderName } : {},
2106
2218
  ...d.zip !== void 0 ? { zip: d.zip } : {}
2107
- } : Ee
2219
+ } : Ce
2108
2220
  )
2109
2221
  );
2110
2222
  try {
2111
- await ce(K.id, d), $e(), q(), V("edited", { fields: Object.keys(d) });
2112
- } catch (B) {
2113
- he(z), u == null || u(z);
2114
- const Ee = Pt(B);
2115
- ve(Ee), Q({ source: "update", message: Ee, cause: B });
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 });
2116
2228
  }
2117
2229
  },
2118
2230
  [
2119
- W,
2120
- j,
2121
- re,
2122
- ce,
2123
- q,
2231
+ S,
2232
+ b,
2233
+ xe,
2234
+ ie,
2235
+ I,
2124
2236
  u,
2125
- $e,
2126
- Q,
2127
- V
2237
+ He,
2238
+ te,
2239
+ U
2128
2240
  ]
2129
- ), tr = Y(
2241
+ ), Se = A(
2130
2242
  (d) => {
2131
- J(null), R(!1), de(null), re((z) => [d, ...z.filter((B) => B.id !== d.id)]), U(d), !!l && f && !d.isDefault || q(), V("added", { method_count: Ne.current.length + 1 });
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 });
2132
2244
  },
2133
- [re, q, U, l, f, V]
2134
- ), Ye = Y((d) => {
2135
- J(d);
2136
- }, []), ar = _ === "ready" && j.length === 0, Ve = typeof l == "function", nr = !Ve && !w, sr = j.length === 0, or = b && j.length === 0, De = Y(
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(
2137
2251
  (d) => /* @__PURE__ */ a.jsx(
2138
- Ar,
2252
+ Yr,
2139
2253
  {
2140
2254
  userId: r,
2141
- isDefault: sr,
2142
- defaultCardholderName: Fe,
2143
- autoSave: !d && or,
2255
+ isDefault: lr,
2256
+ defaultCardholderName: Ne,
2257
+ autoSave: !d && cr,
2144
2258
  hideInternalSaveButton: d,
2145
- formId: d ? Sr : void 0,
2146
- onCanSubmitChange: d ? Z : void 0,
2147
- onSavingChange: d ? X : void 0,
2259
+ formId: d ? Or : void 0,
2260
+ onCanSubmitChange: d ? q : void 0,
2261
+ onSavingChange: $,
2148
2262
  autoFocus: d ? "number" : void 0,
2149
- onSuccess: tr,
2150
- onError: Ye,
2151
- onErrorDetail: Q
2263
+ onSuccess: Se,
2264
+ onError: f,
2265
+ onErrorDetail: te,
2266
+ onValidationChange: Te
2152
2267
  }
2153
2268
  ),
2154
2269
  [
2155
2270
  r,
2156
- sr,
2157
- Fe,
2158
- or,
2159
- tr,
2160
- Ye,
2161
- Q
2271
+ lr,
2272
+ Ne,
2273
+ cr,
2274
+ Se,
2275
+ f,
2276
+ $,
2277
+ te,
2278
+ Te
2162
2279
  ]
2163
- ), Ke = Qe(() => De(!1), [De]), qe = Qe(() => De(!0), [De]), Pe = !r, ir = Qe(() => k ? /* @__PURE__ */ a.jsx(
2164
- Tr,
2280
+ ), Ke = Be(() => Ue(!1), [Ue]), Fe = Be(() => Ue(!0), [Ue]), Le = !r, tr = Be(() => R ? /* @__PURE__ */ a.jsx(
2281
+ Wr,
2165
2282
  {
2166
- selected: xe,
2167
- onSelect: (d) => de(d),
2283
+ selected: X,
2284
+ onSelect: (d) => _e(d),
2168
2285
  creditCardBody: Ke,
2169
- disabled: Pe
2286
+ disabled: Le
2170
2287
  }
2171
- ) : Ke, [k, xe, Ke, Pe]), Te = Qe(() => k ? /* @__PURE__ */ a.jsx(
2172
- Tr,
2288
+ ) : Ke, [R, X, Ke, Le]), dr = Be(() => R ? /* @__PURE__ */ a.jsx(
2289
+ Wr,
2173
2290
  {
2174
- selected: xe,
2175
- onSelect: (d) => de(d),
2176
- creditCardBody: qe,
2177
- disabled: Pe
2291
+ selected: X,
2292
+ onSelect: (d) => _e(d),
2293
+ creditCardBody: Fe,
2294
+ disabled: Le
2178
2295
  }
2179
- ) : qe, [k, xe, qe, Pe]);
2296
+ ) : Fe, [R, X, Fe, Le]);
2180
2297
  return /* @__PURE__ */ a.jsxs(
2181
2298
  "div",
2182
2299
  {
2183
- className: te("flex w-full flex-col gap-4", le),
2300
+ className: ee("flex w-full flex-col gap-4", se),
2184
2301
  "data-testid": "payment-methods-manager",
2185
2302
  children: [
2186
- _ === "loading" && j.length === 0 ? (
2303
+ E === "loading" && b.length === 0 ? (
2187
2304
  // Only show the skeleton on first load — during a silent refetch
2188
2305
  // (e.g. after set-default or delete optimistic mutations), the user
2189
2306
  // already sees the correct optimistic list and a skeleton flash
@@ -2191,20 +2308,20 @@ const ht = (r) => {
2191
2308
  /* @__PURE__ */ a.jsxs(
2192
2309
  "div",
2193
2310
  {
2194
- className: te(
2311
+ className: ee(
2195
2312
  // Match the real-list shell so layout doesn't reflow when data
2196
2313
  // arrives. In selection mode the outer card is suppressed too.
2197
- nr ? "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"
2198
2315
  ),
2199
2316
  "data-testid": "payment-methods-loading",
2200
2317
  children: [
2201
- /* @__PURE__ */ a.jsx(Wr, { withDefaultBadge: !0 }),
2202
- /* @__PURE__ */ a.jsx(Wr, {})
2318
+ /* @__PURE__ */ a.jsx($r, { withDefaultBadge: !0 }),
2319
+ /* @__PURE__ */ a.jsx($r, {})
2203
2320
  ]
2204
2321
  }
2205
2322
  )
2206
2323
  ) : null,
2207
- _ === "error" ? /* @__PURE__ */ a.jsxs(
2324
+ E === "error" ? /* @__PURE__ */ a.jsxs(
2208
2325
  "div",
2209
2326
  {
2210
2327
  role: "alert",
@@ -2212,12 +2329,12 @@ const ht = (r) => {
2212
2329
  className: "flex items-center justify-between gap-3 rounded-md bg-error-50 p-3 text-sm text-error-700",
2213
2330
  "data-testid": "payment-methods-list-error",
2214
2331
  children: [
2215
- /* @__PURE__ */ a.jsx("span", { children: g ?? "Failed to load payment methods." }),
2332
+ /* @__PURE__ */ a.jsx("span", { children: N ?? "Failed to load payment methods." }),
2216
2333
  /* @__PURE__ */ a.jsx(
2217
2334
  "button",
2218
2335
  {
2219
2336
  type: "button",
2220
- onClick: q,
2337
+ onClick: I,
2221
2338
  className: "rounded-md border border-error-700 px-3 py-1 text-xs font-semibold text-error-700 hover:bg-error-50",
2222
2339
  children: "Retry"
2223
2340
  }
@@ -2225,27 +2342,27 @@ const ht = (r) => {
2225
2342
  ]
2226
2343
  }
2227
2344
  ) : null,
2228
- P ? /* @__PURE__ */ a.jsx(
2345
+ B ? /* @__PURE__ */ a.jsx(
2229
2346
  "div",
2230
2347
  {
2231
2348
  role: "alert",
2232
2349
  "aria-live": "polite",
2233
2350
  className: "rounded-md bg-error-50 p-3 text-sm text-error-700",
2234
2351
  "data-testid": "payment-methods-mutation-error",
2235
- children: P
2352
+ children: B
2236
2353
  }
2237
2354
  ) : null,
2238
- w && j.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(
2239
2356
  "div",
2240
2357
  {
2241
2358
  className: "flex items-center justify-between",
2242
- "data-testid": oe ? "payment-methods-drawer-header" : "payment-methods-collapsed-preview",
2359
+ "data-testid": Q ? "payment-methods-drawer-header" : "payment-methods-collapsed-preview",
2243
2360
  children: [
2244
- oe ? /* @__PURE__ */ a.jsx("h3", { className: "text-md font-semibold text-grayWarm-950", children: "Payment methods" }) : /* @__PURE__ */ a.jsx(
2245
- _t,
2361
+ Q ? /* @__PURE__ */ a.jsx("h3", { className: "text-md font-semibold text-grayWarm-950", children: "Payment methods" }) : /* @__PURE__ */ a.jsx(
2362
+ Tt,
2246
2363
  {
2247
- method: j.find((d) => d.id === i) ?? j.find((d) => d.isDefault) ?? j[0],
2248
- cardLabelFormat: S,
2364
+ method: b.find((d) => d.id === i) ?? b.find((d) => d.isDefault) ?? b[0],
2365
+ cardLabelFormat: T,
2249
2366
  className: "flex-1"
2250
2367
  }
2251
2368
  ),
@@ -2253,15 +2370,15 @@ const ht = (r) => {
2253
2370
  "button",
2254
2371
  {
2255
2372
  type: "button",
2256
- "aria-label": oe ? "Collapse payment methods" : "Expand payment methods",
2257
- "aria-expanded": oe,
2373
+ "aria-label": Q ? "Collapse payment methods" : "Expand payment methods",
2374
+ "aria-expanded": Q,
2258
2375
  className: "bg-grayWarm-100 p-2 rounded-lg hover:bg-grayWarm-200 transition-colors",
2259
- onClick: () => ke((d) => !d),
2260
- "data-testid": oe ? "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",
2261
2378
  children: /* @__PURE__ */ a.jsx(
2262
2379
  "img",
2263
2380
  {
2264
- src: `${Be().iconCdnBaseUrl}/website/assets/icons/chevron-${oe ? "up" : "down"}-double.svg`,
2381
+ src: `${rr().iconCdnBaseUrl}/website/assets/icons/chevron-${Q ? "up" : "down"}-double.svg`,
2265
2382
  alt: "",
2266
2383
  className: "w-5 h-5"
2267
2384
  }
@@ -2271,40 +2388,43 @@ const ht = (r) => {
2271
2388
  ]
2272
2389
  }
2273
2390
  ) }) : null,
2274
- j.length > 0 && (!w || oe) ? /* @__PURE__ */ a.jsx(
2391
+ b.length > 0 && (!j || Q) ? /* @__PURE__ */ a.jsx(
2275
2392
  "div",
2276
2393
  {
2277
- className: te(
2394
+ className: ee(
2278
2395
  "flex flex-col",
2279
2396
  // accounts-ui (non-selectable, non-collapsible): rounded outer card
2280
2397
  // with divide-y separators between rows.
2281
2398
  // flights-ui (selectable or collapsible): bare space-y-3 gap between
2282
2399
  // per-row bordered tiles; no outer card chrome.
2283
- nr ? "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"
2284
2401
  ),
2285
- children: j.map((d) => /* @__PURE__ */ a.jsx(
2286
- kt,
2402
+ children: b.map((d) => /* @__PURE__ */ a.jsx(
2403
+ Wt,
2287
2404
  {
2288
2405
  method: d,
2289
- selectable: Ve,
2290
- selected: Ve && d.id === i,
2291
- onSelect: fe,
2292
- onSetDefault: A,
2293
- onRemove: dr,
2294
- onEdit: er,
2295
- disabled: T,
2296
- showDefaultBadge: y,
2297
- hideSetDefaultMenuItem: f,
2298
- cardLabelFormat: S
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
2299
2416
  },
2300
2417
  d.id
2301
2418
  ))
2302
2419
  }
2303
2420
  ) : null,
2304
- ar ? (
2421
+ he ? (
2305
2422
  // Empty state: render the add-card body inline (per Figma 1536-21454).
2306
- /* @__PURE__ */ a.jsx("div", { "data-testid": "payment-methods-empty", children: ir })
2307
- ) : j.length > 0 && (!w || oe) ? (
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) ? (
2308
2428
  // Keep the Add button visible during silent refetches (status flips
2309
2429
  // back to 'loading' transiently after set-default / delete).
2310
2430
  // In collapsible mode only show the Add button when the drawer is open.
@@ -2313,14 +2433,14 @@ const ht = (r) => {
2313
2433
  {
2314
2434
  type: "button",
2315
2435
  onClick: () => {
2316
- J(null), de(null), Z(!1), R(!0);
2436
+ ne(null), _e(null), q(!1), P(!0), ce.current = !1;
2317
2437
  },
2318
2438
  onMouseEnter: () => {
2319
- br().catch(() => {
2439
+ jr().catch(() => {
2320
2440
  });
2321
2441
  },
2322
2442
  onFocus: () => {
2323
- br().catch(() => {
2443
+ jr().catch(() => {
2324
2444
  });
2325
2445
  },
2326
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",
@@ -2330,53 +2450,36 @@ const ht = (r) => {
2330
2450
  )
2331
2451
  ) : null,
2332
2452
  /* @__PURE__ */ a.jsxs(
2333
- gt,
2453
+ Nt,
2334
2454
  {
2335
- open: p,
2336
- onClose: je,
2337
- formId: Sr,
2338
- saveDisabled: !ye,
2339
- isSaving: se,
2455
+ open: y,
2456
+ onClose: ae,
2457
+ formId: Or,
2458
+ saveDisabled: !oe,
2459
+ isSaving: J,
2340
2460
  children: [
2341
- Te,
2342
- L ? (
2343
- // Single source of truth for save-time errors (API failures + hook
2344
- // init failures forwarded from MovmoCardForm.onError). MovmoCardForm
2345
- // intentionally does NOT render its own banner — two role="alert"
2346
- // nodes on the same string is a WCAG 4.1.3 violation (announced
2347
- // twice). aria-live="polite" so SR users hear new errors but the
2348
- // announcement doesn't interrupt their current input.
2349
- /* @__PURE__ */ a.jsx(
2350
- "p",
2351
- {
2352
- role: "alert",
2353
- "aria-live": "polite",
2354
- className: "mt-3 rounded-md bg-error-50 px-3 py-2 text-sm text-error-700",
2355
- "data-testid": "payment-methods-modal-error",
2356
- children: L
2357
- }
2358
- )
2359
- ) : null
2461
+ dr,
2462
+ D ? /* @__PURE__ */ a.jsx(Dr, { message: D, testId: "payment-methods-modal-error" }) : null
2360
2463
  ]
2361
2464
  }
2362
2465
  ),
2363
2466
  /* @__PURE__ */ a.jsx(
2364
- jt,
2467
+ Rt,
2365
2468
  {
2366
- open: W !== null,
2367
- method: W,
2368
- onClose: $e,
2369
- onSave: rr,
2370
- isSaving: M === "pending",
2371
- error: Ce
2469
+ open: S !== null,
2470
+ method: S,
2471
+ onClose: He,
2472
+ onSave: Ie,
2473
+ isSaving: re === "pending",
2474
+ error: Re
2372
2475
  }
2373
2476
  )
2374
2477
  ]
2375
2478
  }
2376
2479
  );
2377
2480
  };
2378
- Tt.displayName = "PaymentMethodsManager";
2379
- 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) => {
2380
2483
  if (typeof document > "u") return null;
2381
2484
  const t = document.cookie ? document.cookie.split(";") : [];
2382
2485
  for (const n of t) {
@@ -2385,81 +2488,81 @@ const St = "/v1/auth/", Ft = "movmo_csrf_token", Wt = (r) => {
2385
2488
  return decodeURIComponent(s.substring(r.length + 1));
2386
2489
  }
2387
2490
  return null;
2388
- }, 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 = () => {
2389
2492
  if (typeof globalThis < "u" && typeof globalThis.fetch == "function")
2390
2493
  return globalThis.fetch.bind(globalThis);
2391
2494
  throw new Error("@movmo_app/payments: no global fetch available in this environment");
2392
- }, Ut = (r) => {
2495
+ }, Vt = (r) => {
2393
2496
  const {
2394
2497
  refreshSession: t,
2395
2498
  onRefreshFailed: n,
2396
- csrfCookieName: s = Ft,
2499
+ csrfCookieName: s = Mt,
2397
2500
  extraHeaders: i,
2398
- authPathFragment: l = St,
2399
- baseFetch: u = $t(),
2400
- readCookie: x = Wt
2501
+ authPathFragment: l = $t,
2502
+ baseFetch: u = Ut(),
2503
+ readCookie: h = zt
2401
2504
  } = r;
2402
2505
  let m = null;
2403
- const k = () => {
2506
+ const R = () => {
2404
2507
  if (m) return m;
2405
- const f = (async () => {
2508
+ const v = (async () => {
2406
2509
  await t();
2407
2510
  })();
2408
- return m = f, f.finally(() => {
2409
- m === f && (m = null);
2511
+ return m = v, v.finally(() => {
2512
+ m === v && (m = null);
2410
2513
  }).catch(() => {
2411
- }), f;
2412
- }, b = (f, y) => {
2413
- const w = new Headers(y == null ? void 0 : y.headers), S = x(s);
2414
- if (S && !w.has("X-CSRF-Token") && w.set("X-CSRF-Token", S), i) {
2415
- const le = i(f, y);
2416
- for (const [O, _] of Object.entries(le))
2417
- w.has(O) || w.set(O, _);
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);
2418
2521
  }
2419
2522
  return {
2420
- ...y,
2421
- headers: w,
2422
- credentials: (y == null ? void 0 : y.credentials) ?? "include"
2523
+ ...g,
2524
+ headers: j,
2525
+ credentials: (g == null ? void 0 : g.credentials) ?? "include"
2423
2526
  };
2424
2527
  };
2425
- return async function(y, w) {
2426
- const S = await u(y, b(y, w));
2427
- if (Ot(y).includes(l) || S.status !== 401 && S.status !== 403)
2428
- return S;
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;
2429
2532
  try {
2430
- await k();
2431
- } catch (_) {
2533
+ await R();
2534
+ } catch (E) {
2432
2535
  try {
2433
- n(_);
2434
- } catch (g) {
2536
+ n(E);
2537
+ } catch (N) {
2435
2538
  console.error(
2436
2539
  "@movmo_app/payments: onRefreshFailed callback threw — auth retry path is misconfigured",
2437
- g
2540
+ N
2438
2541
  );
2439
2542
  }
2440
- return S;
2543
+ return T;
2441
2544
  }
2442
2545
  try {
2443
- return await u(y, b(y, w));
2444
- } catch (_) {
2546
+ return await u(g, w(g, j));
2547
+ } catch (E) {
2445
2548
  return console.error(
2446
2549
  "@movmo_app/payments: retry after token refresh failed — returning original response",
2447
- _
2448
- ), S;
2550
+ E
2551
+ ), T;
2449
2552
  }
2450
2553
  };
2451
2554
  };
2452
2555
  export {
2453
- Ar as MovmoCardForm,
2454
- _t as PaymentMethodPreview,
2455
- Tt as PaymentMethodsManager,
2456
- Ut as createMovmoAuthFetch,
2457
- Be as getPaymentsConfig,
2458
- At as setPaymentsConfig,
2459
- ht as useDeletePaymentMethod,
2460
- ut as useMovmoCardFields,
2461
- yt as useSetDefaultPaymentMethod,
2462
- vt as useUpdatePaymentMethod,
2463
- 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
2464
2567
  };
2465
2568
  //# sourceMappingURL=index.es.js.map