@getopenpay/openpay-js-react 0.1.6-alpha.720e7c5 → 0.1.7-alpha.19e8830

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.js CHANGED
@@ -1,4 +1,4 @@
1
- import rn, { createContext as on, useContext as sn, useRef as re, useCallback as Y, useEffect as q, useState as w, useMemo as Q } from "react";
1
+ import rn, { createContext as on, useContext as sn, useRef as re, useCallback as Z, useEffect as q, useState as w, useMemo as Q } from "react";
2
2
  import { jsx as V } from "react/jsx-runtime";
3
3
  import { z as n } from "zod";
4
4
  import { v4 as st } from "uuid";
@@ -62,9 +62,9 @@ ${e.map((r) => `- ${r.path.join("/")}: ${r.message}`).join(`
62
62
  } catch {
63
63
  return;
64
64
  }
65
- }, P = n.string().trim().min(1, { message: "Cannot be blank" }), S = n.string().trim().optional(), de = (e) => n.nullable(e.optional());
66
- var F = /* @__PURE__ */ ((e) => (e.FIRST_NAME = "firstName", e.LAST_NAME = "lastName", e.EMAIL = "email", e.ZIP_CODE = "zipCode", e.CITY = "city", e.STATE = "state", e.COUNTRY = "country", e.ADDRESS = "address", e.PHONE = "phone", e.PROMOTION_CODE = "promotionCode", e))(F || {});
67
- const ct = n.nativeEnum(F);
65
+ }, O = n.string().trim().min(1, { message: "Cannot be blank" }), v = n.string().trim().optional(), de = (e) => n.nullable(e.optional());
66
+ var C = /* @__PURE__ */ ((e) => (e.FIRST_NAME = "firstName", e.LAST_NAME = "lastName", e.EMAIL = "email", e.ZIP_CODE = "zipCode", e.CITY = "city", e.STATE = "state", e.COUNTRY = "country", e.ADDRESS = "address", e.PHONE = "phone", e.PROMOTION_CODE = "promotionCode", e))(C || {});
67
+ const ct = n.nativeEnum(C);
68
68
  var lt = /* @__PURE__ */ ((e) => (e.CARD_NUMBER = "cardNumber", e.CARD_EXPIRY = "cardExpiry", e.CARD_CVC = "cardCvc", e))(lt || {});
69
69
  const ut = n.nativeEnum(lt), dt = n.union([ct, ut]);
70
70
  var mt = /* @__PURE__ */ ((e) => (e.CARD = "card", e.CARD_NUMBER = "card-number", e.CARD_EXPIRY = "card-expiry", e.CARD_CVC = "card-cvc", e))(mt || {});
@@ -76,20 +76,20 @@ const gn = n.nativeEnum(mt), ye = n.object({
76
76
  id: n.string()
77
77
  });
78
78
  n.object({
79
- cardNumber: S,
80
- expiry: S,
81
- cvc: S
79
+ cardNumber: v,
80
+ expiry: v,
81
+ cvc: v
82
82
  });
83
83
  n.object({
84
- backgroundColor: S,
85
- color: S,
86
- fontFamily: S,
87
- fontSize: S,
88
- fontWeight: S,
89
- margin: S,
90
- padding: S,
91
- letterSpacing: S,
92
- lineHeight: S
84
+ backgroundColor: v,
85
+ color: v,
86
+ fontFamily: v,
87
+ fontSize: v,
88
+ fontWeight: v,
89
+ margin: v,
90
+ padding: v,
91
+ letterSpacing: v,
92
+ lineHeight: v
93
93
  });
94
94
  const f = n.enum([
95
95
  // Element -> Form
@@ -116,51 +116,51 @@ const f = n.enum([
116
116
  type: Cn,
117
117
  elementType: ut,
118
118
  errors: n.array(n.string()).optional()
119
- }), vn = f.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), Sn = n.object({
120
- type: vn,
121
- message: P,
119
+ }), Sn = f.extract(["LOAD_ERROR", "TOKENIZE_ERROR", "CHECKOUT_ERROR"]), Pn = n.object({
120
+ type: Sn,
121
+ message: O,
122
122
  headers: n.record(n.string(), n.string()).optional()
123
- }), Pn = f.extract(["VALIDATION_ERROR"]), On = n.object({
124
- type: Pn,
123
+ }), vn = f.extract(["VALIDATION_ERROR"]), On = n.object({
124
+ type: vn,
125
125
  elementType: dt,
126
126
  errors: n.array(n.string())
127
127
  }), Rn = n.object({
128
128
  type: n.literal(f.enum.LAYOUT),
129
- height: P
129
+ height: O
130
130
  }), kn = n.object({
131
131
  type: n.literal(f.enum.LOADED),
132
- sessionId: P,
132
+ sessionId: O,
133
133
  totalAmountAtoms: n.number(),
134
- currency: S,
134
+ currency: v,
135
135
  checkoutPaymentMethods: n.array(ye)
136
136
  }), Tn = n.object({
137
137
  type: n.literal(f.enum.PAYMENT_FLOW_STARTED),
138
138
  nextActionMetadata: n.record(n.string(), n.any()),
139
139
  paymentFlowMetadata: n.any().optional(),
140
140
  startPFMetadata: n.optional(n.record(n.string(), n.any()))
141
- }), In = n.object({
141
+ }), An = n.object({
142
142
  type: n.literal(f.enum.SETUP_PAYMENT_METHOD_SUCCESS),
143
143
  paymentMethodId: n.string()
144
144
  }), oe = n.object({
145
- firstName: P,
146
- lastName: P,
147
- email: P,
148
- zipCode: P,
149
- country: P,
150
- promotionCode: S
151
- }), An = n.object({
152
- email: P,
153
- zipCode: P,
154
- country: P,
155
- promotionCode: S
145
+ firstName: O,
146
+ lastName: O,
147
+ email: O,
148
+ zipCode: O,
149
+ country: O,
150
+ promotionCode: v
151
+ }), In = n.object({
152
+ email: O,
153
+ zipCode: O,
154
+ country: O,
155
+ promotionCode: v
156
156
  }), jn = f.extract(["TOKENIZE", "CHECKOUT", "START_PAYMENT_FLOW"]), ft = n.object({
157
157
  type: jn,
158
- sessionId: P,
158
+ sessionId: O,
159
159
  checkoutPaymentMethod: ye,
160
160
  paymentFlowMetadata: n.any().optional(),
161
161
  doNotUseLegacyCCFlow: n.boolean().optional(),
162
- existingCCPMId: S
163
- }).extend(oe.shape), Dn = n.object({
162
+ existingCCPMId: v
163
+ }).extend(oe.shape), Mn = n.object({
164
164
  type: n.literal(f.enum.TOKENIZE_SUCCESS),
165
165
  isReadyForCheckout: n.boolean()
166
166
  }), Fn = n.object({
@@ -168,27 +168,27 @@ const f = n.enum([
168
168
  invoiceUrls: n.array(n.string()),
169
169
  subscriptionIds: n.array(n.string()),
170
170
  customerId: n.string()
171
- }), Mn = n.discriminatedUnion("type", [
171
+ }), Dn = n.discriminatedUnion("type", [
172
172
  En,
173
173
  bn,
174
- Sn,
174
+ Pn,
175
175
  On,
176
176
  Rn,
177
177
  kn,
178
178
  ft,
179
- Dn,
179
+ Mn,
180
180
  Fn,
181
181
  Tn,
182
- In
183
- ]), xn = n.object({
184
- payload: Mn,
185
- nonce: P,
186
- formId: P,
187
- elementId: P
182
+ An
183
+ ]), Nn = n.object({
184
+ payload: Dn,
185
+ nonce: O,
186
+ formId: O,
187
+ elementId: O
188
188
  });
189
189
  n.object({
190
190
  amountAtom: n.number(),
191
- currency: P
191
+ currency: O
192
192
  });
193
193
  n.object({
194
194
  secure_token: n.string(),
@@ -198,22 +198,22 @@ n.object({
198
198
  secure_token: n.string(),
199
199
  existing_cc_pm_id: de(n.string())
200
200
  });
201
- const Nn = n.object({
201
+ const xn = n.object({
202
202
  payment_methods: n.array(hn)
203
- }), $n = n.object({
203
+ }), Ln = n.object({
204
204
  elementType: n.string(),
205
205
  errors: n.array(n.string())
206
206
  });
207
207
  n.object({
208
208
  session_id: n.string()
209
209
  });
210
- const Ln = n.object({
210
+ const $n = n.object({
211
211
  success: n.literal(!1),
212
212
  error_type: n.literal("validation_error"),
213
- errors: n.array($n)
213
+ errors: n.array(Ln)
214
214
  }), Un = n.discriminatedUnion("success", [
215
215
  n.object({ success: n.literal(!0) }),
216
- Ln
216
+ $n
217
217
  ]);
218
218
  n.object({
219
219
  session_id: n.string(),
@@ -263,8 +263,8 @@ const qn = n.object({
263
263
  brl: "brl"
264
264
  }, _e = async (e) => {
265
265
  for (let r = 0; r < 10; r++)
266
- We() || await _t(500);
267
- if (!We())
266
+ Be() || await _t(500);
267
+ if (!Be())
268
268
  throw new Error("Stripe JS not found.");
269
269
  return new Stripe(e);
270
270
  }, Kn = async (e, t, r, o, s) => {
@@ -284,7 +284,7 @@ const qn = n.object({
284
284
  });
285
285
  }, _t = (e) => new Promise((t) => {
286
286
  setTimeout(t, e);
287
- }), We = () => "Stripe" in window, Zn = async (e) => new Promise((t, r) => {
287
+ }), Be = () => "Stripe" in window, Yn = async (e) => new Promise((t, r) => {
288
288
  try {
289
289
  e.on("paymentmethod", async (o) => {
290
290
  t(o);
@@ -294,7 +294,7 @@ const qn = n.object({
294
294
  } catch (o) {
295
295
  r(o);
296
296
  }
297
- }), Yn = async (e, t) => {
297
+ }), Zn = async (e, t) => {
298
298
  const r = e.nextActionMetadata;
299
299
  if (!e.paymentFlowMetadata || !e.paymentFlowMetadata.stripePmId)
300
300
  throw new Error(`Invalid payment flow metadata format: ${JSON.stringify(e.paymentFlowMetadata)}`);
@@ -316,8 +316,8 @@ const qn = n.object({
316
316
  });
317
317
  if (o.error)
318
318
  throw t.complete("fail"), new Error(`Payment failed: ${o.error.message ?? "unknown"}`);
319
- t.complete("success");
320
- }, Bn = async (e) => {
319
+ return t.complete("success"), o;
320
+ }, Wn = async (e) => {
321
321
  const t = yt.parse(e.nextActionMetadata);
322
322
  await gt(t);
323
323
  }, gt = async (e) => {
@@ -328,30 +328,30 @@ const qn = n.object({
328
328
  if (o !== "succeeded") throw o === "canceled" ? new Error("Payment cancelled, please click Submit again to pay") : new Error(
329
329
  `${((i = r.error) == null ? void 0 : i.message) ?? ((c = (a = r.setupIntent) == null ? void 0 : a.last_setup_error) == null ? void 0 : c.message) ?? "Payment failed, please click submit again to pay."}`
330
330
  );
331
- }, Wn = (e) => JSON.stringify(e), De = (e, t) => Array.from(e.querySelectorAll("[data-opid]") ?? []).reduce((s, i) => {
331
+ }, Bn = (e) => JSON.stringify(e), Me = (e, t) => Array.from(e.querySelectorAll("[data-opid]") ?? []).reduce((s, i) => {
332
332
  const a = i.getAttribute("data-opid");
333
333
  return a ? { ...s, [a]: i.value } : s;
334
334
  }, t ?? {}), Gn = (e, t, r, o, s, i, a) => {
335
- const c = De(r, {
335
+ const c = Me(r, {
336
336
  type: e,
337
337
  sessionId: t,
338
338
  checkoutPaymentMethod: s,
339
339
  paymentFlowMetadata: a,
340
340
  doNotUseLegacyCCFlow: i
341
341
  });
342
- (s.provider === "apple_pay" || s.provider === "google_pay" || s.provider === "stripe_link") && (c[F.ZIP_CODE] || (c[F.ZIP_CODE] = "00000"));
343
- const d = ft.safeParse(c);
344
- if (d.success)
345
- return d.data;
342
+ (s.provider === "apple_pay" || s.provider === "google_pay" || s.provider === "stripe_link") && (c[C.ZIP_CODE] || (c[C.ZIP_CODE] = "00000"));
343
+ const l = ft.safeParse(c);
344
+ if (l.success)
345
+ return l.data;
346
346
  {
347
- const l = d.error.format(), m = pt(l);
347
+ const d = l.error.format(), m = pt(d);
348
348
  for (const [E, g] of Object.entries(m))
349
349
  o(E, g, E);
350
350
  return null;
351
351
  }
352
352
  }, Qn = (e) => {
353
353
  try {
354
- return xn.parse(e);
354
+ return Nn.parse(e);
355
355
  } catch (t) {
356
356
  throw t;
357
357
  }
@@ -383,7 +383,7 @@ async function tr(e) {
383
383
  throw new Error("Got invalid CDE connection object");
384
384
  return r;
385
385
  }
386
- const C = (e) => n.nullable(e.optional());
386
+ const b = (e) => n.nullable(e.optional());
387
387
  n.string().trim().min(1, { message: "Cannot be blank" });
388
388
  const nr = n.object({
389
389
  cde_response_type: n.literal("error"),
@@ -393,36 +393,36 @@ const nr = n.object({
393
393
  n.enum(["usd", "brl"]);
394
394
  const ht = n.object({
395
395
  name: n.string(),
396
- amount_atom_off: C(n.number()),
397
- percent_off: C(n.number()),
398
- currency: C(n.string()),
396
+ amount_atom_off: b(n.number()),
397
+ percent_off: b(n.number()),
398
+ currency: b(n.string()),
399
399
  duration: n.string(),
400
- duration_in_months: C(n.number())
400
+ duration_in_months: b(n.number())
401
401
  }), wt = n.object({
402
402
  amount_subtotal_atom: n.number().int(),
403
403
  amount_total_atom: n.number().int(),
404
404
  currency: n.string(),
405
- description: C(n.string()),
405
+ description: b(n.string()),
406
406
  price_id: n.string(),
407
- billing_interval: C(n.string()),
408
- billing_interval_count: C(n.number().int()),
407
+ billing_interval: b(n.string()),
408
+ billing_interval_count: b(n.number().int()),
409
409
  quantity: n.number().int()
410
410
  }), rr = n.record(n.string(), n.any()), or = n.object({
411
411
  name: n.string(),
412
- settings: C(rr)
412
+ settings: b(rr)
413
413
  }), ge = n.object({
414
414
  provider: n.string(),
415
- processor_name: C(n.string()),
416
- metadata: C(n.record(n.string(), n.any()))
415
+ processor_name: b(n.string()),
416
+ metadata: b(n.record(n.string(), n.any()))
417
417
  }), sr = n.object({
418
418
  quantity: n.number()
419
419
  }), ir = n.object({
420
- id: C(n.string()),
421
- billing_interval: C(n.string()),
422
- billing_interval_count: C(n.number().int()),
420
+ id: b(n.string()),
421
+ billing_interval: b(n.string()),
422
+ billing_interval_count: b(n.number().int()),
423
423
  subscription_items: n.array(sr),
424
- trial_start: C(n.string()),
425
- trial_end: C(n.string())
424
+ trial_start: b(n.string()),
425
+ trial_end: b(n.string())
426
426
  }), Et = n.object({
427
427
  amount_atom: n.number()
428
428
  }), ar = n.object({
@@ -436,7 +436,7 @@ const ht = n.object({
436
436
  }), lr = n.object({
437
437
  currency: n.string(),
438
438
  discounts: n.array(cr),
439
- hosted_invoice_url: C(n.string()),
439
+ hosted_invoice_url: b(n.string()),
440
440
  lines: n.array(ar),
441
441
  remaining_amount_atom: n.number(),
442
442
  tax_amount_atom: n.number(),
@@ -447,17 +447,17 @@ const ht = n.object({
447
447
  invoices: n.array(lr)
448
448
  }), Ct = n.object({
449
449
  preview: Ge,
450
- preview_post_trial: C(Ge),
450
+ preview_post_trial: b(Ge),
451
451
  coupons: n.array(ht)
452
452
  }), Qe = n.object({
453
453
  status: n.literal("open"),
454
454
  token: n.string(),
455
- email: C(n.string()),
455
+ email: b(n.string()),
456
456
  line_items: n.array(wt),
457
457
  amount_subtotal_atom: n.number().int(),
458
458
  amount_total_atom: n.number().int(),
459
459
  brand: or,
460
- subs_preview: C(Ct),
460
+ subs_preview: b(Ct),
461
461
  // Null in setup mode
462
462
  methods_available: n.array(ge)
463
463
  }), bt = n.discriminatedUnion("mode", [
@@ -481,7 +481,7 @@ n.object({
481
481
  primary_color: n.string(),
482
482
  secondary_color: n.string()
483
483
  });
484
- const vt = n.object({
484
+ const St = n.object({
485
485
  invoice_urls: n.array(n.string()),
486
486
  subscription_ids: n.array(n.string()),
487
487
  customer_id: n.string()
@@ -518,7 +518,7 @@ const pr = n.object({
518
518
  required_user_actions: n.array(n.record(n.string(), n.any()))
519
519
  });
520
520
  n.object({
521
- fields: An,
521
+ fields: In,
522
522
  checkoutPaymentMethod: ge
523
523
  });
524
524
  n.object({
@@ -572,7 +572,7 @@ var wr = /* @__PURE__ */ function() {
572
572
  }
573
573
  return t;
574
574
  }(Error);
575
- class St extends Er {
575
+ class Pt extends Er {
576
576
  constructor(t) {
577
577
  const r = `[cde-client] Error querying CDE: ${t.message}`;
578
578
  super(r), this.response = t;
@@ -581,16 +581,16 @@ class St extends Er {
581
581
  return this.response.message;
582
582
  }
583
583
  }
584
- const N = async (e, t, r) => {
584
+ const x = async (e, t, r) => {
585
585
  const o = await e.send(t);
586
586
  if (br(o))
587
- throw new St(o);
587
+ throw new Pt(o);
588
588
  if (!Cr(o, r)) {
589
589
  const s = r.safeParse(o);
590
590
  throw s.success ? new Error("Invalid state") : s.error;
591
591
  }
592
592
  return o;
593
- }, Cr = (e, t) => t.safeParse(e).success, br = (e) => nr.safeParse(e).success, vr = async (e, t) => await N(e, { type: "get_checkout_preview", payload: t }, Ct), se = async (e) => await N(e, { type: "get_prefill", payload: {} }, bt), Sr = async (e, t) => await N(e, { type: "start_payment_flow_for_cc", payload: t }, yr), Pr = async (e, t) => await N(e, { type: "start_payment_flow_for_pr", payload: t }, pr), Ne = async (e, t) => await N(e, { type: "confirm_payment_flow", payload: t }, Nn), Or = async (e, t, r) => {
593
+ }, Cr = (e, t) => t.safeParse(e).success, br = (e) => nr.safeParse(e).success, Sr = async (e, t) => await x(e, { type: "get_checkout_preview", payload: t }, Ct), se = async (e) => await x(e, { type: "get_prefill", payload: {} }, bt), Pr = async (e, t) => await x(e, { type: "start_payment_flow_for_cc", payload: t }, yr), vr = async (e, t) => await x(e, { type: "start_payment_flow_for_pr", payload: t }, pr), xe = async (e, t) => await x(e, { type: "confirm_payment_flow", payload: t }, xn), Or = async (e, t, r) => {
594
594
  const o = Date.now();
595
595
  for (r = r ?? 5e3; Date.now() - o < r; ) {
596
596
  const s = e.querySelector(`input[data-opid=${t}]`);
@@ -603,7 +603,7 @@ const N = async (e, t, r) => {
603
603
  }
604
604
  return null;
605
605
  }, Rr = async (e, t, r) => {
606
- const o = await vr(e, {
606
+ const o = await Sr(e, {
607
607
  secure_token: t,
608
608
  promotion_code: r
609
609
  }), s = new Set(o.preview.invoices.map((c) => c.currency));
@@ -614,7 +614,7 @@ const N = async (e, t, r) => {
614
614
  currency: i,
615
615
  amountAtom: a
616
616
  };
617
- }, Pt = async (e, t, r, o) => {
617
+ }, vt = async (e, t, r, o) => {
618
618
  if (r)
619
619
  return { amountAtom: 0, currency: "usd" };
620
620
  {
@@ -627,16 +627,16 @@ const N = async (e, t, r) => {
627
627
  throw new Error("No CDE connections found");
628
628
  return await Promise.all(
629
629
  Array.from(e.values()).map(
630
- (o) => N(o, { type: "tokenize_card", payload: t }, Un)
630
+ (o) => x(o, { type: "tokenize_card", payload: t }, Un)
631
631
  )
632
632
  );
633
633
  }, Xe = async (e, t) => {
634
634
  try {
635
- return await N(e, { type: "checkout_card_elements", payload: t }, vt);
635
+ return await x(e, { type: "checkout_card_elements", payload: t }, St);
636
636
  } catch (r) {
637
637
  throw r;
638
638
  }
639
- }, Tr = async (e, t) => await N(e, { type: "setup_payment_method", payload: t }, mr), Ir = async (e, t) => await N(e, { type: "checkout", payload: t }, vt), Ot = 1e3, Ar = async (e, t) => {
639
+ }, Tr = async (e, t) => await x(e, { type: "setup_payment_method", payload: t }, mr), Ar = async (e, t) => await x(e, { type: "checkout", payload: t }, St), Ot = 1e3, Ir = async (e, t) => {
640
640
  const o = await it({
641
641
  iframe: e,
642
642
  debug: !0,
@@ -644,7 +644,7 @@ const N = async (e, t, r) => {
644
644
  childOrigin: "*"
645
645
  // TODO: use with proper childOrigin
646
646
  }).promise;
647
- return (await N(o, { type: "ping-3ds-status" }, qn)).status;
647
+ return (await x(o, { type: "ping-3ds-status" }, qn)).status;
648
648
  }, jr = (e) => {
649
649
  if (typeof e != "string") return !1;
650
650
  try {
@@ -652,11 +652,11 @@ const N = async (e, t, r) => {
652
652
  } catch {
653
653
  return !1;
654
654
  }
655
- }, Dr = "@keyframes fadeIn{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}.overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483648!important;display:flex;justify-content:center;align-items:center;background-color:#00000080}.container{max-width:500px;max-height:600px;width:100%;height:100%;background-color:#fff;position:relative;animation:fadeIn .3s ease-out}.frame{max-width:500px;max-height:600px;width:100%;height:100%;border:none}.cancel-button{position:absolute;background:transparent;border:none;font-size:1rem;color:#fff;cursor:pointer;top:-1.5rem;padding:0;right:0}", Fr = (e) => {
655
+ }, Mr = "@keyframes fadeIn{0%{opacity:0;transform:scale(.9)}to{opacity:1;transform:scale(1)}}.overlay{position:fixed;top:0;left:0;width:100%;height:100%;z-index:2147483648!important;display:flex;justify-content:center;align-items:center;background-color:#00000080}.container{max-width:500px;max-height:600px;width:100%;height:100%;background-color:#fff;position:relative;animation:fadeIn .3s ease-out}.frame{max-width:500px;max-height:600px;width:100%;height:100%;border:none}.cancel-button{position:absolute;background:transparent;border:none;font-size:1rem;color:#fff;cursor:pointer;top:-1.5rem;padding:0;right:0}", Fr = (e) => {
656
656
  const t = document.createElement("template");
657
657
  t.innerHTML = `
658
658
  <style>
659
- ${Dr}
659
+ ${Mr}
660
660
  </style>
661
661
  <div class="overlay">
662
662
  <div class="container">
@@ -670,10 +670,10 @@ const N = async (e, t, r) => {
670
670
  const s = o.querySelector("#three-ds-iframe"), i = o.querySelector(".cancel-button");
671
671
  return document.body.appendChild(r), { host: r, iframe: s, cancelButton: i };
672
672
  };
673
- function Mr(e, t, r) {
673
+ function Dr(e, t, r) {
674
674
  const o = async () => {
675
675
  try {
676
- const i = await Ar(e, r);
676
+ const i = await Ir(e, r);
677
677
  i && (clearInterval(s), t(i));
678
678
  } catch {
679
679
  }
@@ -682,7 +682,7 @@ function Mr(e, t, r) {
682
682
  const s = setInterval(o, Ot);
683
683
  return s;
684
684
  }
685
- function xr({
685
+ function Nr({
686
686
  elements: e,
687
687
  pollingInterval: t,
688
688
  resolve: r
@@ -694,7 +694,7 @@ function xr({
694
694
  e.cancelButton.removeEventListener("click", o);
695
695
  };
696
696
  }
697
- async function Nr({
697
+ async function xr({
698
698
  url: e,
699
699
  baseUrl: t
700
700
  }) {
@@ -704,7 +704,7 @@ async function Nr({
704
704
  setTimeout(() => {
705
705
  r.host.remove();
706
706
  }, 1e3), o(c), a == null || a();
707
- }, i = Mr(r.iframe, s, new URL(t).origin), a = xr({
707
+ }, i = Dr(r.iframe, s, new URL(t).origin), a = Nr({
708
708
  elements: r,
709
709
  pollingInterval: i,
710
710
  resolve: o
@@ -728,7 +728,7 @@ const Rt = (e) => async (t) => {
728
728
  } catch (r) {
729
729
  throw t.flowCallbacks.onCheckoutError(pe(r)), r;
730
730
  }
731
- }, $r = (e) => async (t) => {
731
+ }, Lr = (e) => async (t) => {
732
732
  try {
733
733
  return await e(t);
734
734
  } catch (r) {
@@ -747,7 +747,7 @@ const Rt = (e) => async (t) => {
747
747
  log__: t,
748
748
  err__: r
749
749
  };
750
- }, { log__: Lr, err__: kt } = J("common-cc"), Tt = (e, t) => {
750
+ }, { log__: $r, err__: kt } = J("common-cc"), Tt = (e, t) => {
751
751
  const r = oe.safeParse(e);
752
752
  if (!r.success) {
753
753
  const o = r.error.format(), s = pt(o);
@@ -767,64 +767,64 @@ const Rt = (e) => async (t) => {
767
767
  const i = s.data;
768
768
  t(i, o.errors);
769
769
  }
770
- }), Lr(`Error tokenizing card: got validation errors: ${JSON.stringify(r.errors)}`), new Error("Got validation errors while tokenizing card");
771
- }, { err__: Ie } = J("commmon"), It = (e) => {
770
+ }), $r(`Error tokenizing card: got validation errors: ${JSON.stringify(r.errors)}`), new Error("Got validation errors while tokenizing card");
771
+ }, { err__: Ae } = J("commmon"), At = (e) => {
772
772
  if (e.payment_methods.length !== 1)
773
773
  throw new Error(`Expected exactly one payment method, got ${e.payment_methods.length}`);
774
774
  return { payment_method_id: e.payment_methods[0].id };
775
775
  }, qr = (e, t) => {
776
776
  const r = e.find((o) => t.safeParse(o).success);
777
777
  if (!r)
778
- throw Ie(`No CPMs found for model ${t}`), Ie(e), Ie("zodModel"), new Error(`No CPMs found for model ${t}`);
778
+ throw Ae(`No CPMs found for model ${t}`), Ae(e), Ae("zodModel"), new Error(`No CPMs found for model ${t}`);
779
779
  return t.parse(r);
780
- }, { log__: v, err__: et } = J("common-cc"), { log__: tt } = J("stripe-cc"), zr = Rt(
780
+ }, { log__: P, err__: et } = J("common-cc"), { log__: tt } = J("stripe-cc"), zr = Rt(
781
781
  async ({ context: e, checkoutPaymentMethod: t, nonCdeFormInputs: r, flowCallbacks: o }) => {
782
- var l;
783
- v("├ Running common CC flow...", { checkoutPaymentMethod: t });
782
+ var d;
783
+ P("├ Running common CC flow...", { checkoutPaymentMethod: t });
784
784
  const s = Array.from(e.cdeConnections.values())[0], i = await se(s);
785
- v(`├ Validating non-CDE form fields [Mode: ${i.mode}]`);
785
+ P(`├ Validating non-CDE form fields [Mode: ${i.mode}]`);
786
786
  const a = Tt(r, o.onValidationError);
787
- v(`├ Tokenizing card info in CDE [Session: ${e.elementsSessionId}]`);
787
+ P(`├ Tokenizing card info in CDE [Session: ${e.elementsSessionId}]`);
788
788
  const c = await kr(e.cdeConnections, {
789
789
  session_id: e.elementsSessionId
790
790
  });
791
791
  Ur(c, o.onValidationError);
792
- const d = {
792
+ const l = {
793
793
  session_id: e.elementsSessionId,
794
794
  checkout_payment_method: t,
795
795
  non_cde_form_fields: a
796
796
  };
797
797
  try {
798
798
  if (i.mode === "setup") {
799
- v(`├ Setting up payment method in CDE [Token: ${i.token}]`);
800
- const m = await Tr(s, d);
801
- return v(`╰ Setup completed successfully [PM ID: ${m.payment_method_id}]`), { mode: "setup", result: m };
799
+ P(`├ Setting up payment method in CDE [Token: ${i.token}]`);
800
+ const m = await Tr(s, l);
801
+ return P(`╰ Setup completed successfully [PM ID: ${m.payment_method_id}]`), { mode: "setup", result: m };
802
802
  } else {
803
- v(`├ Initial checkout flow. Checking out card info in CDE [Session: ${e.elementsSessionId}]`);
804
- const m = await Xe(s, d);
805
- return v("╰ Checkout completed successfully."), { mode: "checkout", result: m };
803
+ P(`├ Initial checkout flow. Checking out card info in CDE [Session: ${e.elementsSessionId}]`);
804
+ const m = await Xe(s, l);
805
+ return P("╰ Checkout completed successfully."), { mode: "checkout", result: m };
806
806
  }
807
807
  } catch (m) {
808
- if (m instanceof St && m.originalErrorMessage === "3DS_REQUIRED") {
809
- v("├ Card requires 3DS, starting non-legacy payment flow");
810
- const E = ((l = m.response.headers) == null ? void 0 : l["op-should-use-new-flow"]) === "true", g = await Sr(s, d);
811
- if (v(`├ op-should-use-new-flow: ${E}`), v("├ Payment flow result:", g), E ? await Kr(g, e.baseUrl) : await Zr(g), i.mode === "setup") {
812
- v(`├ Confirming payment flow [cc_pm_id: ${g.cc_pm_id}]`);
813
- const _ = await Ne(s, {
808
+ if (m instanceof Pt && m.originalErrorMessage === "3DS_REQUIRED") {
809
+ P("├ Card requires 3DS, starting non-legacy payment flow");
810
+ const E = ((d = m.response.headers) == null ? void 0 : d["op-should-use-new-flow"]) === "true", g = await Pr(s, l);
811
+ if (P(`├ op-should-use-new-flow: ${E}`), P("├ Payment flow result:", g), E ? await Kr(g, e.baseUrl) : await Yr(g), i.mode === "setup") {
812
+ P(`├ Confirming payment flow [cc_pm_id: ${g.cc_pm_id}]`);
813
+ const _ = await xe(s, {
814
814
  secure_token: i.token,
815
815
  existing_cc_pm_id: g.cc_pm_id
816
816
  });
817
- v("├ Confirm payment flow result received Result:", _);
818
- const h = It(_);
819
- return v(`╰ Setup completed successfully [PM ID: ${h.payment_method_id}]`), { mode: "setup", result: h };
817
+ P("├ Confirm payment flow result received Result:", _);
818
+ const h = At(_);
819
+ return P(`╰ Setup completed successfully [PM ID: ${h.payment_method_id}]`), { mode: "setup", result: h };
820
820
  } else {
821
- v(`├ Checking out after 3DS flow [Flow: ${E ? "new" : "legacy"}]`);
821
+ P(`├ Checking out after 3DS flow [Flow: ${E ? "new" : "legacy"}]`);
822
822
  const _ = await Xe(s, {
823
- ...d,
823
+ ...l,
824
824
  existing_cc_pm_id: g.cc_pm_id,
825
825
  do_not_use_legacy_cc_flow: !E
826
826
  });
827
- return v("╰ Checkout completed successfully."), { mode: "checkout", result: _ };
827
+ return P("╰ Checkout completed successfully."), { mode: "checkout", result: _ };
828
828
  }
829
829
  }
830
830
  throw et("╰ Error checking out card info in CDE"), et(m), m;
@@ -842,29 +842,29 @@ const Rt = (e) => async (t) => {
842
842
  return zn.parse(t);
843
843
  }, Kr = async (e, t) => {
844
844
  const r = Vr(e);
845
- v(`├ Using common 3DS flow [URL: ${r.redirect_url}]`);
846
- const o = await Nr({ url: r.redirect_url, baseUrl: t });
847
- if (v(`╰ 3DS verification completed [Status: ${o}]`), o === me.CANCELLED)
845
+ P(`├ Using common 3DS flow [URL: ${r.redirect_url}]`);
846
+ const o = await xr({ url: r.redirect_url, baseUrl: t });
847
+ if (P(`╰ 3DS verification completed [Status: ${o}]`), o === me.CANCELLED)
848
848
  throw new Error("3DS verification cancelled");
849
849
  if (o === me.FAILURE)
850
850
  throw new Error("3DS verification failed");
851
- }, Zr = async (e) => {
851
+ }, Yr = async (e) => {
852
852
  const t = Hr(e);
853
853
  tt(`├ Using stripe 3DS flow [Client Secret: ${t.client_secret.substring(0, 8)}...]`), await gt(t), tt("╰ Stripe 3DS flow completed successfully");
854
- }, { log__: T, err__: Yr } = J("stripe-pr"), Jr = n.object({
854
+ }, { log__: T, err__: Zr } = J("stripe-pr"), Jr = n.object({
855
855
  provider: n.union([n.literal("apple_pay"), n.literal("google_pay")]),
856
856
  processor_name: n.literal("stripe"),
857
857
  metadata: n.object({
858
858
  stripe_pk: n.string()
859
859
  })
860
- }), Br = $r(
860
+ }), Wr = Lr(
861
861
  async ({ context: e }) => {
862
862
  T("Checking if there are any CPMs for Stripe PR...");
863
863
  const t = qr(e.checkoutPaymentMethods, Jr);
864
864
  T("Initializing Stripe PR flow...");
865
865
  const r = Array.from(e.cdeConnections.values())[0], o = await se(r), s = o.mode === "setup";
866
866
  T("Getting initial preview amount");
867
- const i = await Pt(r, o.token, s, void 0), a = await Kn(
867
+ const i = await vt(r, o.token, s, void 0), a = await Kn(
868
868
  t.metadata.stripe_pk,
869
869
  i.amountAtom,
870
870
  i.currency,
@@ -872,7 +872,7 @@ const Rt = (e) => async (t) => {
872
872
  );
873
873
  T("Checking if can make payment");
874
874
  const c = await a.canMakePayment();
875
- return c === null ? (Yr("canMakePayment returned null"), { isAvailable: !1, reason: "canMakePayment returned null" }) : (T("Stripe PR flow initialized successfully. Can make payment", c), {
875
+ return c === null ? (Zr("canMakePayment returned null"), { isAvailable: !1, reason: "canMakePayment returned null" }) : (T("Stripe PR flow initialized successfully. Can make payment", c), {
876
876
  isAvailable: !0,
877
877
  pr: a,
878
878
  availableProviders: {
@@ -881,7 +881,7 @@ const Rt = (e) => async (t) => {
881
881
  }
882
882
  });
883
883
  }
884
- ), Wr = Rt(
884
+ ), Br = Rt(
885
885
  async ({
886
886
  context: e,
887
887
  checkoutPaymentMethod: t,
@@ -893,27 +893,27 @@ const Rt = (e) => async (t) => {
893
893
  if (T("Running Stripe PR flow..."), s.provider !== t.provider)
894
894
  throw new Error(`Provider mismatch. Expected ${s.provider}, got ${t.provider}`);
895
895
  const a = Array.from(e.cdeConnections.values())[0], c = i.pr;
896
- T("Validating non-CDE form fields");
897
- const d = Gr(r), l = Tt(d, o.onValidationError);
898
896
  if (s != null && s.overridePaymentRequest) {
899
897
  const h = s.overridePaymentRequest;
900
898
  T("Overriding PR amount with", h), Qr(c, h.amount, h.pending);
901
899
  }
902
900
  T("Showing PR dialog..."), c.show();
903
- const m = await Zn(c);
901
+ const l = await Yn(c);
902
+ T("Stripe PM added event:", l), T("Merging PM fields with form fields...");
903
+ const d = Gr(r, l), m = Tt(d, o.onValidationError);
904
904
  T("PR dialog finished. Starting payment flow...");
905
- const E = await Pr(a, {
906
- fields: l,
905
+ const E = await vr(a, {
906
+ fields: m,
907
907
  checkoutPaymentMethod: t
908
908
  }), g = Xr(E);
909
- T("Confirming PR with Stripe..."), await Jn(g, m);
909
+ T("Confirming PR with Stripe..."), await Jn(g, l);
910
910
  const _ = await se(a);
911
911
  if (_.mode === "setup") {
912
912
  T("Confirming payment flow for setup...");
913
- const h = await Ne(a, {
913
+ const h = await xe(a, {
914
914
  secure_token: _.token
915
915
  });
916
- return { mode: "setup", result: It(h) };
916
+ return { mode: "setup", result: At(h) };
917
917
  } else {
918
918
  T("Performing checkout...");
919
919
  const h = {
@@ -921,21 +921,22 @@ const Rt = (e) => async (t) => {
921
921
  payment_input: {
922
922
  provider_type: t.provider
923
923
  },
924
- customer_email: l[F.EMAIL],
925
- customer_zip_code: l[F.ZIP_CODE],
926
- customer_country: l[F.COUNTRY],
927
- promotion_code: l[F.PROMOTION_CODE],
924
+ customer_email: m[C.EMAIL],
925
+ customer_zip_code: m[C.ZIP_CODE],
926
+ customer_country: m[C.COUNTRY],
927
+ promotion_code: m[C.PROMOTION_CODE],
928
928
  line_items: _.line_items,
929
929
  total_amount_atom: _.amount_total_atom,
930
930
  cancel_at_end: !1,
931
931
  checkout_payment_method: t
932
932
  };
933
- return { mode: "checkout", result: await Ir(a, h) };
933
+ return { mode: "checkout", result: await Ar(a, h) };
934
934
  }
935
935
  }
936
- ), Gr = (e) => {
937
- const t = { ...e };
938
- return t[F.ZIP_CODE] || (T("Overriding empty zip code (only for google pay and apple pay)"), t[F.ZIP_CODE] = "00000"), t;
936
+ ), Gr = (e, t) => {
937
+ var a, c, l, d;
938
+ const r = { ...e }, [o, ...s] = ((c = (a = t.payerName) == null ? void 0 : a.trim()) == null ? void 0 : c.split(/\s+/)) ?? [], i = s.join(" ") || void 0;
939
+ return r[C.FIRST_NAME] = r[C.FIRST_NAME] || o || "_OP_UNKNOWN", r[C.LAST_NAME] = r[C.LAST_NAME] || i || "_OP_UNKNOWN", r[C.EMAIL] = r[C.EMAIL] || t.payerEmail || "op_unfilled@getopenpay.com", r[C.ZIP_CODE] = r[C.ZIP_CODE] || ((l = t.shippingAddress) == null ? void 0 : l.postalCode) || "00000", r[C.COUNTRY] = r[C.COUNTRY] || ((d = t.shippingAddress) == null ? void 0 : d.country) || "US", T("Final form inputs:", r), r;
939
940
  }, Qr = (e, t, r) => {
940
941
  e.update({
941
942
  total: {
@@ -964,13 +965,13 @@ Details: got ${e.required_user_actions.length} required user actions`);
964
965
  run: zr
965
966
  },
966
967
  stripePR: {
967
- init: Br,
968
- run: Wr
968
+ init: Wr,
969
+ run: Br
969
970
  }
970
971
  // 👉 Add more flows here
971
972
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
972
973
  };
973
- function At(e) {
974
+ function It(e) {
974
975
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
975
976
  }
976
977
  var he = {};
@@ -978,7 +979,7 @@ Object.defineProperty(he, "__esModule", {
978
979
  value: !0
979
980
  });
980
981
  he.Observable = void 0;
981
- const jt = (e) => !!Symbol[e], $e = (e) => jt(e) ? Symbol[e] : "@@" + e, eo = $e("iterator"), Me = $e("observable"), Dt = $e("species");
982
+ const jt = (e) => !!Symbol[e], Le = (e) => jt(e) ? Symbol[e] : "@@" + e, eo = Le("iterator"), De = Le("observable"), Mt = Le("species");
982
983
  function fe(e, t) {
983
984
  let r = e[t];
984
985
  if (r != null) {
@@ -988,7 +989,7 @@ function fe(e, t) {
988
989
  }
989
990
  function ne(e) {
990
991
  let t = e.constructor;
991
- return t !== void 0 && (t = t[Dt], t === null && (t = void 0)), t !== void 0 ? t : we;
992
+ return t !== void 0 && (t = t[Mt], t === null && (t = void 0)), t !== void 0 ? t : we;
992
993
  }
993
994
  function to(e) {
994
995
  return e instanceof we;
@@ -1021,18 +1022,18 @@ function Ft(e) {
1021
1022
  X(r);
1022
1023
  }
1023
1024
  }
1024
- function xe(e) {
1025
+ function Ne(e) {
1025
1026
  e._observer = void 0, e._queue = void 0, e._state = "closed";
1026
1027
  }
1027
1028
  function no(e) {
1028
1029
  let t = e._queue;
1029
1030
  if (t) {
1030
1031
  e._queue = void 0, e._state = "ready";
1031
- for (let r = 0; r < t.length && (Mt(e, t[r].type, t[r].value), e._state !== "closed"); ++r)
1032
+ for (let r = 0; r < t.length && (Dt(e, t[r].type, t[r].value), e._state !== "closed"); ++r)
1032
1033
  ;
1033
1034
  }
1034
1035
  }
1035
- function Mt(e, t, r) {
1036
+ function Dt(e, t, r) {
1036
1037
  e._state = "running";
1037
1038
  let o = e._observer;
1038
1039
  try {
@@ -1042,11 +1043,11 @@ function Mt(e, t, r) {
1042
1043
  s && s.call(o, r);
1043
1044
  break;
1044
1045
  case "error":
1045
- if (xe(e), s) s.call(o, r);
1046
+ if (Ne(e), s) s.call(o, r);
1046
1047
  else throw r;
1047
1048
  break;
1048
1049
  case "complete":
1049
- xe(e), s && s.call(o);
1050
+ Ne(e), s && s.call(o);
1050
1051
  break;
1051
1052
  }
1052
1053
  } catch (s) {
@@ -1054,7 +1055,7 @@ function Mt(e, t, r) {
1054
1055
  }
1055
1056
  e._state === "closed" ? Ft(e) : e._state === "running" && (e._state = "ready");
1056
1057
  }
1057
- function Ae(e, t, r) {
1058
+ function Ie(e, t, r) {
1058
1059
  if (e._state !== "closed") {
1059
1060
  if (e._state === "buffering") {
1060
1061
  e._queue.push({
@@ -1070,7 +1071,7 @@ function Ae(e, t, r) {
1070
1071
  }], le(() => no(e));
1071
1072
  return;
1072
1073
  }
1073
- Mt(e, t, r);
1074
+ Dt(e, t, r);
1074
1075
  }
1075
1076
  }
1076
1077
  class ro {
@@ -1081,13 +1082,13 @@ class ro {
1081
1082
  return o._state === "closed";
1082
1083
  },
1083
1084
  next(i) {
1084
- Ae(o, "next", i);
1085
+ Ie(o, "next", i);
1085
1086
  },
1086
1087
  error(i) {
1087
- Ae(o, "error", i);
1088
+ Ie(o, "error", i);
1088
1089
  },
1089
1090
  complete() {
1090
- Ae(o, "complete");
1091
+ Ie(o, "complete");
1091
1092
  }
1092
1093
  };
1093
1094
  try {
@@ -1101,7 +1102,7 @@ class ro {
1101
1102
  return this._state === "closed";
1102
1103
  }
1103
1104
  unsubscribe() {
1104
- this._state !== "closed" && (xe(this), Ft(this));
1105
+ this._state !== "closed" && (Ne(this), Ft(this));
1105
1106
  }
1106
1107
  }
1107
1108
  let we = class ue {
@@ -1183,19 +1184,19 @@ let we = class ue {
1183
1184
  if (typeof t != "function") throw new TypeError(t + " is not a function");
1184
1185
  let r = ne(this), o = arguments.length > 1, s = !1, a = arguments[1];
1185
1186
  return new r((c) => this.subscribe({
1186
- next(d) {
1187
- let l = !s;
1188
- if (s = !0, !l || o)
1187
+ next(l) {
1188
+ let d = !s;
1189
+ if (s = !0, !d || o)
1189
1190
  try {
1190
- a = t(a, d);
1191
+ a = t(a, l);
1191
1192
  } catch (m) {
1192
1193
  return c.error(m);
1193
1194
  }
1194
1195
  else
1195
- a = d;
1196
+ a = l;
1196
1197
  },
1197
- error(d) {
1198
- c.error(d);
1198
+ error(l) {
1199
+ c.error(l);
1199
1200
  },
1200
1201
  complete() {
1201
1202
  if (!s && !o) return c.error(new TypeError("Cannot reduce an empty sequence"));
@@ -1213,11 +1214,11 @@ let we = class ue {
1213
1214
  let s, i = 0;
1214
1215
  function a(c) {
1215
1216
  s = c.subscribe({
1216
- next(d) {
1217
- o.next(d);
1217
+ next(l) {
1218
+ o.next(l);
1218
1219
  },
1219
- error(d) {
1220
- o.error(d);
1220
+ error(l) {
1221
+ o.error(l);
1221
1222
  },
1222
1223
  complete() {
1223
1224
  i === t.length ? (s = void 0, o.complete()) : a(r.from(t[i++]));
@@ -1238,22 +1239,22 @@ let we = class ue {
1238
1239
  if (t)
1239
1240
  try {
1240
1241
  c = t(c);
1241
- } catch (l) {
1242
- return o.error(l);
1242
+ } catch (d) {
1243
+ return o.error(d);
1243
1244
  }
1244
- let d = r.from(c).subscribe({
1245
- next(l) {
1246
- o.next(l);
1245
+ let l = r.from(c).subscribe({
1246
+ next(d) {
1247
+ o.next(d);
1247
1248
  },
1248
- error(l) {
1249
- o.error(l);
1249
+ error(d) {
1250
+ o.error(d);
1250
1251
  },
1251
1252
  complete() {
1252
- let l = s.indexOf(d);
1253
- l >= 0 && s.splice(l, 1), a();
1253
+ let d = s.indexOf(l);
1254
+ d >= 0 && s.splice(d, 1), a();
1254
1255
  }
1255
1256
  });
1256
- s.push(d);
1257
+ s.push(l);
1257
1258
  },
1258
1259
  error(c) {
1259
1260
  o.error(c);
@@ -1270,13 +1271,13 @@ let we = class ue {
1270
1271
  };
1271
1272
  });
1272
1273
  }
1273
- [Me]() {
1274
+ [De]() {
1274
1275
  return this;
1275
1276
  }
1276
1277
  static from(t) {
1277
1278
  let r = typeof this == "function" ? this : ue;
1278
1279
  if (t == null) throw new TypeError(t + " is not an object");
1279
- let o = fe(t, Me);
1280
+ let o = fe(t, De);
1280
1281
  if (o) {
1281
1282
  let s = o.call(t);
1282
1283
  if (Object(s) !== s) throw new TypeError(s + " is not an object");
@@ -1316,20 +1317,20 @@ let we = class ue {
1316
1317
  });
1317
1318
  });
1318
1319
  }
1319
- static get [Dt]() {
1320
+ static get [Mt]() {
1320
1321
  return this;
1321
1322
  }
1322
1323
  };
1323
1324
  he.Observable = we;
1324
1325
  Object.defineProperty(we, Symbol("extensions"), {
1325
1326
  value: {
1326
- symbol: Me,
1327
+ symbol: De,
1327
1328
  hostReportError: X
1328
1329
  },
1329
1330
  configurable: !0
1330
1331
  });
1331
1332
  var oo = he.Observable;
1332
- const so = /* @__PURE__ */ At(oo), { log__: io, err__: ao } = J("init-flows"), co = (e) => ({
1333
+ const so = /* @__PURE__ */ It(oo), { log__: io, err__: ao } = J("init-flows"), co = (e) => ({
1333
1334
  // Stripe PR
1334
1335
  stripePR: lo("stripePR", Fe.stripePR.init({ context: e }))
1335
1336
  // 👉 Add initialization flows here
@@ -1361,8 +1362,8 @@ ${JSON.stringify(o)}`), o;
1361
1362
  startFlow: async () => {
1362
1363
  }
1363
1364
  };
1364
- var Le = { exports: {} }, uo = rn;
1365
- function xt(e, t, r) {
1365
+ var $e = { exports: {} }, uo = rn;
1366
+ function Nt(e, t, r) {
1366
1367
  var o = typeof t == "function";
1367
1368
  uo.useEffect(function() {
1368
1369
  var s, i = !0, a = e(function() {
@@ -1375,16 +1376,16 @@ function xt(e, t, r) {
1375
1376
  };
1376
1377
  }, o ? r : t);
1377
1378
  }
1378
- Le.exports = xt;
1379
- Le.exports.useAsyncEffect = xt;
1380
- var mo = Le.exports;
1381
- const ot = /* @__PURE__ */ At(mo);
1379
+ $e.exports = Nt;
1380
+ $e.exports.useAsyncEffect = Nt;
1381
+ var mo = $e.exports;
1382
+ const ot = /* @__PURE__ */ It(mo);
1382
1383
  function fo(e, t = 0) {
1383
- const r = re(!1), o = re(), s = re(e), i = Y(() => r.current, []), a = Y(() => {
1384
+ const r = re(!1), o = re(), s = re(e), i = Z(() => r.current, []), a = Z(() => {
1384
1385
  r.current = !1, o.current && clearTimeout(o.current), o.current = setTimeout(() => {
1385
1386
  r.current = !0, s.current();
1386
1387
  }, t);
1387
- }, [t]), c = Y(() => {
1388
+ }, [t]), c = Z(() => {
1388
1389
  r.current = null, o.current && clearTimeout(o.current);
1389
1390
  }, []);
1390
1391
  return q(() => {
@@ -1396,11 +1397,11 @@ function po(e, t = 0, r = []) {
1396
1397
  return q(i, r), [o, s];
1397
1398
  }
1398
1399
  const yo = (e, t, r, o) => {
1399
- const [s, i] = w(""), [a, c] = w(""), [d, l] = w(null), [m, E] = w(!1), [g, _] = w(null);
1400
+ const [s, i] = w(""), [a, c] = w(""), [l, d] = w(null), [m, E] = w(!1), [g, _] = w(null);
1400
1401
  return ot(async () => {
1401
1402
  if (!o || !e)
1402
1403
  return;
1403
- const h = await Or(o, F.PROMOTION_CODE);
1404
+ const h = await Or(o, C.PROMOTION_CODE);
1404
1405
  h == null || h.addEventListener("input", () => {
1405
1406
  E(!0), _(null), i(h.value);
1406
1407
  });
@@ -1415,8 +1416,8 @@ const yo = (e, t, r, o) => {
1415
1416
  try {
1416
1417
  if (!t || !r || !e)
1417
1418
  return;
1418
- const $ = (await se(t)).mode === "setup", Ce = await Pt(t, r, $, a);
1419
- h() && (_(null), l(Ce));
1419
+ const L = (await se(t)).mode === "setup", Ce = await vt(t, r, L, a);
1420
+ h() && (_(null), d(Ce));
1420
1421
  } catch (I) {
1421
1422
  h() && _(pe(I));
1422
1423
  } finally {
@@ -1425,11 +1426,11 @@ const yo = (e, t, r, o) => {
1425
1426
  },
1426
1427
  [!t, !r, a, e]
1427
1428
  ), {
1428
- amount: d,
1429
+ amount: l,
1429
1430
  isLoading: m,
1430
1431
  error: g
1431
1432
  };
1432
- }, Nt = (e = {}) => {
1433
+ }, xt = (e = {}) => {
1433
1434
  const [t, r] = w(e), o = Q(
1434
1435
  () => ({
1435
1436
  set: (i, a) => {
@@ -1443,8 +1444,8 @@ const yo = (e, t, r, o) => {
1443
1444
  },
1444
1445
  remove: (i) => {
1445
1446
  r((a) => {
1446
- const { [i]: c, ...d } = a;
1447
- return d;
1447
+ const { [i]: c, ...l } = a;
1448
+ return l;
1448
1449
  });
1449
1450
  },
1450
1451
  reset: () => r(e)
@@ -1452,12 +1453,12 @@ const yo = (e, t, r, o) => {
1452
1453
  // eslint-disable-next-line react-hooks/exhaustive-deps
1453
1454
  [r]
1454
1455
  ), s = {
1455
- get: Y((i) => t[i], [t]),
1456
+ get: Z((i) => t[i], [t]),
1456
1457
  ...o
1457
1458
  };
1458
1459
  return [t, s];
1459
1460
  }, _o = () => {
1460
- const [e, t] = Nt({
1461
+ const [e, t] = xt({
1461
1462
  card: void 0,
1462
1463
  "card-cvc": void 0,
1463
1464
  "card-expiry": void 0,
@@ -1477,7 +1478,7 @@ const yo = (e, t, r, o) => {
1477
1478
  `Invalid element id: ${e}, it needs to be in the format "ojs-{elementType}-element" (e.g. "ojs-card-number-element")`
1478
1479
  );
1479
1480
  return r.data;
1480
- }, So = (e) => {
1481
+ }, Po = (e) => {
1481
1482
  const {
1482
1483
  children: t,
1483
1484
  checkoutSecureToken: r,
@@ -1486,134 +1487,134 @@ const yo = (e, t, r, o) => {
1486
1487
  onBlur: i,
1487
1488
  onChange: a,
1488
1489
  onLoad: c,
1489
- onLoadError: d,
1490
- onValidationError: l,
1490
+ onLoadError: l,
1491
+ onValidationError: d,
1491
1492
  onCheckoutStarted: m,
1492
1493
  onCheckoutSuccess: E,
1493
1494
  onCheckoutError: g,
1494
1495
  onSetupPaymentMethodSuccess: _,
1495
1496
  baseUrl: h,
1496
1497
  enableDynamicPreviews: I
1497
- } = e, $ = h ?? cn, [Ce, $t] = w(void 0), [Ue, Lt] = w([]), [Ut, qt] = w("1px"), [be, zt] = w(!1), [M, ve] = w(void 0), [qe, K] = w(!1), [Z, Ht] = w([]), [ee, Vt] = w({}), [ze, ie] = w(0), [He, z] = w(!1), [L, Kt] = w(void 0), [Ve, Zt] = w(void 0), [Ke, Yt] = w(void 0), [U, Jt] = w(void 0), [Se] = w(void 0), B = Q(() => `opjs-form-${st()}`, []), A = re(null), { cdeConns: Ze, anyCdeConn: W, connectToCdeIframe: Bt } = _o(), [Wt, Gt] = w(null), [Ye, G] = Nt({
1498
+ } = e, L = h ?? cn, [Ce, Lt] = w(void 0), [Ue, $t] = w([]), [Ut, qt] = w("1px"), [be, zt] = w(!1), [D, Se] = w(void 0), [qe, K] = w(!1), [Y, Ht] = w([]), [ee, Vt] = w({}), [ze, ie] = w(0), [He, z] = w(!1), [$, Kt] = w(void 0), [Ve, Yt] = w(void 0), [Ke, Zt] = w(void 0), [U, Jt] = w(void 0), [Pe] = w(void 0), W = Q(() => `opjs-form-${st()}`, []), j = re(null), { cdeConns: Ye, anyCdeConn: B, connectToCdeIframe: Wt } = _o(), [Bt, Gt] = w(null), [Ze, G] = xt({
1498
1499
  apple_pay: ce,
1499
1500
  google_pay: ce
1500
1501
  });
1501
1502
  q(() => {
1502
- const u = { version: "0.1.6", release_version: "0.1.6-alpha.720e7c5" };
1503
+ const u = { version: "0.1.7", release_version: "0.1.7-alpha.19e8830" };
1503
1504
  window.ojs_version = u;
1504
1505
  }, []);
1505
1506
  const Qt = yo(
1506
1507
  I ?? !1,
1507
- W,
1508
+ B,
1508
1509
  r,
1509
- A.current
1510
- ), Pe = Y(
1510
+ j.current
1511
+ ), ve = Z(
1511
1512
  (u) => {
1512
- if (u.origin !== $ || !u.source) return;
1513
- const j = u.source;
1513
+ if (u.origin !== L || !u.source) return;
1514
+ const M = u.source;
1514
1515
  if (!jr(u.data))
1515
1516
  return;
1516
- const k = JSON.parse(u.data), p = Qn(k), H = p.elementId;
1517
- if (p.formId !== B || !H || p.nonce in Ue)
1517
+ const A = JSON.parse(u.data), p = Qn(A), H = p.elementId;
1518
+ if (p.formId !== W || !H || p.nonce in Ue)
1518
1519
  return;
1519
- Lt((R) => [...R, p.nonce]);
1520
- const y = p.payload, O = y.type;
1521
- if (O === f.enum.LAYOUT) {
1522
- const R = y.height ? `${y.height}px` : "100%";
1523
- qt(R);
1524
- } else if (O === f.enum.FOCUS && s)
1520
+ $t((k) => [...k, p.nonce]);
1521
+ const y = p.payload, R = y.type;
1522
+ if (R === f.enum.LAYOUT) {
1523
+ const k = y.height ? `${y.height}px` : "100%";
1524
+ qt(k);
1525
+ } else if (R === f.enum.FOCUS && s)
1525
1526
  s(p.elementId);
1526
- else if (O === f.enum.BLUR && i)
1527
+ else if (R === f.enum.BLUR && i)
1527
1528
  i(p.elementId);
1528
- else if (O === f.enum.CHANGE && a)
1529
+ else if (R === f.enum.CHANGE && a)
1529
1530
  a(p.elementId);
1530
- else if (O === f.enum.LOADED) {
1531
- const R = Z.find((b) => b.contentWindow === j);
1532
- if (K(!1), !R)
1531
+ else if (R === f.enum.LOADED) {
1532
+ const k = Y.find((S) => S.contentWindow === M);
1533
+ if (K(!1), !k)
1533
1534
  return;
1534
- Vt((b) => ({ ...b, [H]: j })), Yt(y.totalAmountAtoms), Zt(y.currency), Jt(y.checkoutPaymentMethods), L || Kt(y.sessionId);
1535
- } else if (O === f.enum.TOKENIZE_STARTED)
1535
+ Vt((S) => ({ ...S, [H]: M })), Zt(y.totalAmountAtoms), Yt(y.currency), Jt(y.checkoutPaymentMethods), $ || Kt(y.sessionId);
1536
+ } else if (R === f.enum.TOKENIZE_STARTED)
1536
1537
  K(!0);
1537
- else if (O === f.enum.CHECKOUT_STARTED)
1538
+ else if (R === f.enum.CHECKOUT_STARTED)
1538
1539
  m && m();
1539
- else if (O === f.enum.PAYMENT_FLOW_STARTED) {
1540
- if (!M)
1540
+ else if (R === f.enum.PAYMENT_FLOW_STARTED) {
1541
+ if (!D)
1541
1542
  throw new Error("extraData not populated");
1542
- if (!W)
1543
+ if (!B)
1543
1544
  throw new Error("Not connected to CDE");
1544
1545
  (async () => {
1545
- const b = y.nextActionMetadata.type;
1546
- if (b !== void 0) if (b === "stripe_3ds")
1547
- await Bn(y);
1548
- else if (b === "stripe_payment_request") {
1549
- if (!Se)
1546
+ const S = y.nextActionMetadata.type;
1547
+ if (S !== void 0) if (S === "stripe_3ds")
1548
+ await Wn(y);
1549
+ else if (S === "stripe_payment_request") {
1550
+ if (!Pe)
1550
1551
  throw new Error("Stripe PM not set");
1551
- await Yn(y, Se);
1552
+ await Zn(y, Pe);
1552
1553
  } else
1553
- throw new Error(`Unknown next action type: ${b}`);
1554
- const D = await se(W);
1555
- if (D.mode === "setup") {
1556
- const { payment_methods: x } = await Ne(W, {
1557
- secure_token: D.token,
1558
- existing_cc_pm_id: M.existingCCPMId
1554
+ throw new Error(`Unknown next action type: ${S}`);
1555
+ const F = await se(B);
1556
+ if (F.mode === "setup") {
1557
+ const { payment_methods: N } = await xe(B, {
1558
+ secure_token: F.token,
1559
+ existing_cc_pm_id: D.existingCCPMId
1559
1560
  });
1560
- if (x.length !== 1)
1561
- throw new Error(`Expected exactly one payment method, got ${x.length}`);
1562
- return K(!1), ie(0), z(!1), _ && _(x[0].id), {
1561
+ if (N.length !== 1)
1562
+ throw new Error(`Expected exactly one payment method, got ${N.length}`);
1563
+ return K(!1), ie(0), z(!1), _ && _(N[0].id), {
1563
1564
  proceedToCheckout: !1
1564
1565
  };
1565
1566
  } else
1566
1567
  return {
1567
1568
  proceedToCheckout: !0
1568
1569
  };
1569
- })().then(({ proceedToCheckout: b }) => {
1570
- var x;
1571
- if (!b)
1570
+ })().then(({ proceedToCheckout: S }) => {
1571
+ var N;
1572
+ if (!S)
1572
1573
  return;
1573
- let D;
1574
- if (M.checkoutPaymentMethod.provider === "credit_card" && (D = (x = y.startPFMetadata) == null ? void 0 : x.cc_pm_id, !D))
1574
+ let F;
1575
+ if (D.checkoutPaymentMethod.provider === "credit_card" && (F = (N = y.startPFMetadata) == null ? void 0 : N.cc_pm_id, !F))
1575
1576
  throw new Error("CC PM ID not found");
1576
1577
  Te(
1577
- j,
1578
- B,
1578
+ M,
1579
+ W,
1579
1580
  H,
1580
- { ...M, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: D },
1581
- $
1582
- ), z(!0), ve(void 0), m && m();
1583
- }).catch((b) => {
1584
- const D = pe(b);
1585
- K(!1), z(!1), g && g(D);
1581
+ { ...D, type: "CHECKOUT", doNotUseLegacyCCFlow: !0, existingCCPMId: F },
1582
+ L
1583
+ ), z(!0), Se(void 0), m && m();
1584
+ }).catch((S) => {
1585
+ const F = pe(S);
1586
+ K(!1), z(!1), g && g(F);
1586
1587
  });
1587
- } else if (O === f.enum.TOKENIZE_SUCCESS && M) {
1588
- const R = ze + 1, b = R === Object.keys(ee).length;
1589
- !He && (b || y.isReadyForCheckout) ? (Te(j, B, H, M, $), z(!0), ve(void 0)) : ie(R);
1590
- } else if (O === f.enum.CHECKOUT_SUCCESS)
1588
+ } else if (R === f.enum.TOKENIZE_SUCCESS && D) {
1589
+ const k = ze + 1, S = k === Object.keys(ee).length;
1590
+ !He && (S || y.isReadyForCheckout) ? (Te(M, W, H, D, L), z(!0), Se(void 0)) : ie(k);
1591
+ } else if (R === f.enum.CHECKOUT_SUCCESS)
1591
1592
  K(!1), ie(0), z(!1), E && E(y.invoiceUrls, y.subscriptionIds, y.customerId);
1592
- else if (O === f.enum.SETUP_PAYMENT_METHOD_SUCCESS)
1593
+ else if (R === f.enum.SETUP_PAYMENT_METHOD_SUCCESS)
1593
1594
  K(!1), ie(0), z(!1), _ && _(y.paymentMethodId);
1594
- else if (O === f.enum.LOAD_ERROR)
1595
- d && d(y.message);
1596
- else if (O === f.enum.VALIDATION_ERROR) {
1597
- const R = M == null ? void 0 : M.checkoutPaymentMethod.provider;
1598
- (R === "credit_card" || R === void 0) && l && l(y.elementType, y.errors, H);
1599
- } else if (O === f.enum.TOKENIZE_ERROR || O === f.enum.CHECKOUT_ERROR)
1595
+ else if (R === f.enum.LOAD_ERROR)
1596
+ l && l(y.message);
1597
+ else if (R === f.enum.VALIDATION_ERROR) {
1598
+ const k = D == null ? void 0 : D.checkoutPaymentMethod.provider;
1599
+ (k === "credit_card" || k === void 0) && d && d(y.elementType, y.errors, H);
1600
+ } else if (R === f.enum.TOKENIZE_ERROR || R === f.enum.CHECKOUT_ERROR)
1600
1601
  if (y.message === "3DS_REQUIRED") {
1601
- const R = U == null ? void 0 : U.find((b) => b.provider === "credit_card");
1602
- if (!L || !A.current || !l || !R) return;
1603
- for (const [b, D] of Object.entries(ee)) {
1604
- if (!D) continue;
1605
- const x = Gn(
1602
+ const k = U == null ? void 0 : U.find((S) => S.provider === "credit_card");
1603
+ if (!$ || !j.current || !d || !k) return;
1604
+ for (const [S, F] of Object.entries(ee)) {
1605
+ if (!F) continue;
1606
+ const N = Gn(
1606
1607
  f.enum.START_PAYMENT_FLOW,
1607
- L,
1608
- A.current,
1609
- l,
1608
+ $,
1609
+ j.current,
1610
+ d,
1610
1611
  // Only stripe supports frontend 3DS right now,
1611
1612
  // so we pass processor_name: 'stripe' to tell delegator to only use stripe
1612
- { ...R, processor_name: "stripe" },
1613
+ { ...k, processor_name: "stripe" },
1613
1614
  !1
1614
1615
  );
1615
- if (x) {
1616
- z(!0), ve(x), Te(D, B, b, x, $);
1616
+ if (N) {
1617
+ z(!0), Se(N), Te(F, W, S, N, L);
1617
1618
  break;
1618
1619
  }
1619
1620
  }
@@ -1621,27 +1622,27 @@ const yo = (e, t, r, o) => {
1621
1622
  K(!1), z(!1), g && g(y.message);
1622
1623
  },
1623
1624
  [
1624
- B,
1625
- L,
1625
+ W,
1626
+ $,
1626
1627
  Ue,
1627
- M,
1628
- Z,
1628
+ D,
1629
+ Y,
1629
1630
  ee,
1630
1631
  ze,
1631
1632
  He,
1632
1633
  i,
1633
1634
  a,
1634
1635
  s,
1635
- d,
1636
+ l,
1636
1637
  m,
1637
1638
  E,
1638
1639
  _,
1639
1640
  g,
1640
- l,
1641
- $,
1642
- Se,
1641
+ d,
1642
+ L,
1643
+ Pe,
1643
1644
  U,
1644
- W
1645
+ B
1645
1646
  ]
1646
1647
  ), Je = Q(() => {
1647
1648
  const u = () => {
@@ -1651,100 +1652,100 @@ const yo = (e, t, r, o) => {
1651
1652
  onCheckoutStarted: te("onCheckoutStarted", m ?? u),
1652
1653
  onCheckoutSuccess: te("onCheckoutSuccess", E ?? u),
1653
1654
  onSetupPaymentMethodSuccess: te("onSetupPaymentMethodSuccess", _ ?? u),
1654
- onValidationError: te("onValidationError", l ?? u)
1655
+ onValidationError: te("onValidationError", d ?? u)
1655
1656
  };
1656
- }, [g, m, E, _, l]), Oe = () => {
1657
- if (!A.current || !L || !U) return null;
1657
+ }, [g, m, E, _, d]), Oe = () => {
1658
+ if (!j.current || !$ || !U) return null;
1658
1659
  const u = /* @__PURE__ */ new Map();
1659
- return Object.entries(Ze).forEach(([k, p]) => {
1660
- p && u.set(k, p);
1660
+ return Object.entries(Ye).forEach(([A, p]) => {
1661
+ p && u.set(A, p);
1661
1662
  }), u.size === 0 ? null : {
1662
- formDiv: A.current,
1663
- elementsSessionId: L,
1663
+ formDiv: j.current,
1664
+ elementsSessionId: $,
1664
1665
  checkoutPaymentMethods: U,
1665
1666
  cdeConnections: u,
1666
- baseUrl: new URL($).origin
1667
+ baseUrl: new URL(L).origin
1667
1668
  };
1668
- }, Be = (u, j, k) => {
1669
+ }, We = (u, M, A) => {
1669
1670
  const p = Oe();
1670
- if (!(!p || !A.current))
1671
+ if (!(!p || !j.current))
1671
1672
  return Fe.stripePR.run({
1672
1673
  context: p,
1673
1674
  checkoutPaymentMethod: nt(p.checkoutPaymentMethods, u),
1674
- nonCdeFormInputs: De(A.current),
1675
+ nonCdeFormInputs: Me(j.current),
1675
1676
  flowCallbacks: Je,
1676
- customParams: { provider: u, overridePaymentRequest: k == null ? void 0 : k.overridePaymentRequest },
1677
- initResult: j
1677
+ customParams: { provider: u, overridePaymentRequest: A == null ? void 0 : A.overridePaymentRequest },
1678
+ initResult: M
1678
1679
  });
1679
1680
  };
1680
1681
  q(() => {
1681
- if (Wt !== null) return;
1682
+ if (Bt !== null) return;
1682
1683
  const u = Oe();
1683
1684
  if (!u) return;
1684
- const j = co(u);
1685
- Gt(j), j.stripePR.subscribe((k) => {
1686
- if (k.status === "loading")
1685
+ const M = co(u);
1686
+ Gt(M), M.stripePR.subscribe((A) => {
1687
+ if (A.status === "loading")
1687
1688
  G.set("apple_pay", ce), G.set("google_pay", ce);
1688
- else if (k.status === "error")
1689
+ else if (A.status === "error")
1689
1690
  G.set("apple_pay", rt), G.set("google_pay", rt);
1690
- else if (k.status === "loaded") {
1691
- const p = k.result, H = p.isAvailable && p.availableProviders.applePay, ke = p.isAvailable && p.availableProviders.googlePay;
1691
+ else if (A.status === "loaded") {
1692
+ const p = A.result, H = p.isAvailable && p.availableProviders.applePay, ke = p.isAvailable && p.availableProviders.googlePay;
1692
1693
  G.set("apple_pay", {
1693
1694
  isLoading: !1,
1694
1695
  isAvailable: H,
1695
- startFlow: async (y) => H ? Be("apple_pay", p, y) : void 0
1696
+ startFlow: async (y) => H ? We("apple_pay", p, y) : void 0
1696
1697
  }), G.set("google_pay", {
1697
1698
  isLoading: !1,
1698
1699
  isAvailable: ke,
1699
- startFlow: async (y) => ke ? Be("google_pay", p, y) : void 0
1700
+ startFlow: async (y) => ke ? We("google_pay", p, y) : void 0
1700
1701
  });
1701
1702
  }
1702
1703
  });
1703
- }, [A.current, L, U, Object.keys(Ze).length]);
1704
+ }, [j.current, $, U, Object.keys(Ye).length]);
1704
1705
  const Xt = () => {
1705
1706
  const u = Oe();
1706
- !A.current || !L || !W || !U || !u || Fe.commonCC.run({
1707
+ !j.current || !$ || !B || !U || !u || Fe.commonCC.run({
1707
1708
  context: u,
1708
1709
  checkoutPaymentMethod: nt(U, "credit_card"),
1709
- nonCdeFormInputs: De(A.current),
1710
+ nonCdeFormInputs: Me(j.current),
1710
1711
  flowCallbacks: Je,
1711
1712
  customParams: void 0,
1712
1713
  // This flow requires no custom params
1713
1714
  initResult: void 0
1714
1715
  // This flow requires no initialization
1715
1716
  });
1716
- }, Re = Y(
1717
+ }, Re = Z(
1717
1718
  (u) => {
1718
1719
  qe && u.preventDefault();
1719
1720
  },
1720
1721
  [qe]
1721
1722
  );
1722
1723
  q(() => {
1723
- if (be || !A.current) return;
1724
- Z.length > 0 && Z.length === Object.keys(ee).length && (zt(!0), c && c(Ke, Ve));
1725
- }, [Z, ee, be, c, Ke, Ve]), q(() => ($t(window.location.origin), window.addEventListener("message", Pe), window.addEventListener("beforeunload", Re), () => {
1726
- window.removeEventListener("beforeunload", Re), window.removeEventListener("message", Pe);
1727
- }), [L, Pe, Re]);
1728
- const en = Y(
1724
+ if (be || !j.current) return;
1725
+ Y.length > 0 && Y.length === Object.keys(ee).length && (zt(!0), c && c(Ke, Ve));
1726
+ }, [Y, ee, be, c, Ke, Ve]), q(() => (Lt(window.location.origin), window.addEventListener("message", ve), window.addEventListener("beforeunload", Re), () => {
1727
+ window.removeEventListener("beforeunload", Re), window.removeEventListener("message", ve);
1728
+ }), [$, ve, Re]);
1729
+ const en = Z(
1729
1730
  async (u) => {
1730
- if (Z.find((p) => p.contentWindow === u.contentWindow)) return;
1731
+ if (Y.find((p) => p.contentWindow === u.contentWindow)) return;
1731
1732
  Ht((p) => [...p, u]);
1732
- const k = go(u.id);
1733
- await Bt(k, u);
1733
+ const A = go(u.id);
1734
+ await Wt(A, u);
1734
1735
  },
1735
1736
  // eslint-disable-next-line react-hooks/exhaustive-deps
1736
- [Z]
1737
+ [Y]
1737
1738
  ), tn = {
1738
- formId: B,
1739
+ formId: W,
1739
1740
  formHeight: Ut,
1740
1741
  referer: Ce,
1741
1742
  checkoutSecureToken: r,
1742
1743
  registerIframe: en,
1743
- baseUrl: $
1744
+ baseUrl: L
1744
1745
  }, nn = {
1745
1746
  submit: Xt,
1746
- applePay: Ye.apple_pay,
1747
- googlePay: Ye.google_pay,
1747
+ applePay: Ze.apple_pay,
1748
+ googlePay: Ze.google_pay,
1748
1749
  // stripeLink: {
1749
1750
  // TODO: uncomment if we need stripe elements later.
1750
1751
  // Better if we can make stripe link work in prod without elements.
@@ -1755,9 +1756,9 @@ const yo = (e, t, r, o) => {
1755
1756
  loaded: be,
1756
1757
  preview: Qt
1757
1758
  };
1758
- return /* @__PURE__ */ V(at.Provider, { value: tn, children: /* @__PURE__ */ V("div", { className: o, ref: A, children: t(nn) }) });
1759
+ return /* @__PURE__ */ V(at.Provider, { value: tn, children: /* @__PURE__ */ V("div", { className: o, ref: j, children: t(nn) }) });
1759
1760
  }, Ee = (e) => {
1760
- const { subPath: t, styles: r } = e, { formId: o, referer: s, formHeight: i, checkoutSecureToken: a, registerIframe: c, baseUrl: d } = an(), [l, m] = w(!1), E = re(null), g = Q(() => r ? Wn(r) : "", [r]), _ = Q(() => ({
1761
+ const { subPath: t, styles: r } = e, { formId: o, referer: s, formHeight: i, checkoutSecureToken: a, registerIframe: c, baseUrl: l } = an(), [d, m] = w(!1), E = re(null), g = Q(() => r ? Bn(r) : "", [r]), _ = Q(() => ({
1761
1762
  border: "none",
1762
1763
  width: "100%",
1763
1764
  height: i
@@ -1767,25 +1768,25 @@ const yo = (e, t, r, o) => {
1767
1768
  return I.append("referer", s), I.append("styles", g), I.append("formId", o), I.append("secureToken", a), I.toString();
1768
1769
  }, [g, o, s, a]);
1769
1770
  return q(() => m(!0), []), q(() => {
1770
- !E.current || !l || c(E.current);
1771
- }, [l]), a ? /* @__PURE__ */ V(
1771
+ !E.current || !d || c(E.current);
1772
+ }, [d]), a ? /* @__PURE__ */ V(
1772
1773
  "iframe",
1773
1774
  {
1774
1775
  id: `ojs-${t}-element`,
1775
1776
  name: `${t}-element`,
1776
1777
  className: "ojs-iframe",
1777
- src: `${d}/app/v1/${t}-element/?${h}`,
1778
+ src: `${l}/app/v1/${t}-element/?${h}`,
1778
1779
  style: _,
1779
1780
  ref: E
1780
1781
  }
1781
1782
  ) : /* @__PURE__ */ V("div", {});
1782
- }, Po = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card-cvc" }), Oo = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card" }), Ro = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card-expiry" }), ko = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card-number" });
1783
+ }, vo = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card-cvc" }), Oo = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card" }), Ro = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card-expiry" }), ko = ({ styles: e }) => /* @__PURE__ */ V(Ee, { styles: e, subPath: "card-number" });
1783
1784
  export {
1784
- Po as CardCvcElement,
1785
+ vo as CardCvcElement,
1785
1786
  Oo as CardElement,
1786
1787
  Ro as CardExpiryElement,
1787
1788
  ko as CardNumberElement,
1788
- So as ElementsForm,
1789
- F as FieldName,
1789
+ Po as ElementsForm,
1790
+ C as FieldName,
1790
1791
  an as useOpenPayElements
1791
1792
  };