@movmo_app/payments 0.4.0 → 0.5.0

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