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