@odus/checkout 0.5.7 → 0.5.9

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.
@@ -10,17 +10,17 @@ class $ {
10
10
  endpoint: e,
11
11
  method: t = "POST",
12
12
  body: a,
13
- customHeaders: i = {}
13
+ customHeaders: r = {}
14
14
  }) {
15
- const r = {
15
+ const i = {
16
16
  Authorization: `Bearer ${this.apiKey}`,
17
17
  "Content-Type": "application/json",
18
- ...i
18
+ ...r
19
19
  };
20
20
  try {
21
21
  const n = await fetch(`${this.baseUrl}${e}`, {
22
22
  method: t,
23
- headers: r,
23
+ headers: i,
24
24
  body: a ? JSON.stringify(a) : void 0
25
25
  });
26
26
  if (!n.ok) {
@@ -52,17 +52,17 @@ class $ {
52
52
  paymentId: e,
53
53
  checkoutKey: t,
54
54
  formData: a,
55
- token: i,
56
- returnUrl: r
55
+ token: r,
56
+ returnUrl: i
57
57
  }) {
58
58
  let n = {};
59
- if (i && a) {
59
+ if (r && a) {
60
60
  const o = a.cardExpiry.replace(/\s+/g, "").split("/"), l = o[0], c = o[1];
61
61
  n = {
62
62
  paymentMethodData: {
63
63
  type: "card",
64
64
  card: {
65
- token: i,
65
+ token: r,
66
66
  expMonth: l,
67
67
  expYear: `20${c}`,
68
68
  cardholderName: a.name
@@ -73,7 +73,7 @@ class $ {
73
73
  name: a.name
74
74
  },
75
75
  context: {
76
- returnUrl: r,
76
+ returnUrl: i,
77
77
  browserInfo: this.browserInfo
78
78
  }
79
79
  };
@@ -83,7 +83,7 @@ class $ {
83
83
  type: "paypal"
84
84
  },
85
85
  context: {
86
- returnUrl: r,
86
+ returnUrl: i,
87
87
  browserInfo: this.browserInfo
88
88
  }
89
89
  };
@@ -101,16 +101,16 @@ const R = async ({
101
101
  apiKey: e,
102
102
  environment: t
103
103
  }) => {
104
- const a = k(t), i = await fetch(`${a}/checkout-profiles/${s}`, {
104
+ const a = k(t), r = await fetch(`${a}/checkout-profiles/${s}`, {
105
105
  method: "GET",
106
106
  headers: {
107
107
  "Content-Type": "application/json",
108
108
  Authorization: `Bearer ${e}`
109
109
  }
110
110
  });
111
- if (!i.ok)
112
- throw new Error(`HTTP error! Status: ${i.status}`);
113
- return await i.json();
111
+ if (!r.ok)
112
+ throw new Error(`HTTP error! Status: ${r.status}`);
113
+ return await r.json();
114
114
  };
115
115
  class V {
116
116
  events = /* @__PURE__ */ new Map();
@@ -133,7 +133,7 @@ class V {
133
133
  */
134
134
  publish(e, t) {
135
135
  const a = this.events.get(e);
136
- a && a.forEach((i) => i(t));
136
+ a && a.forEach((r) => r(t));
137
137
  }
138
138
  /**
139
139
  * Clear all event subscriptions
@@ -208,30 +208,30 @@ function H({
208
208
  checkoutProfile: void 0,
209
209
  isLoading: !0,
210
210
  error: null
211
- }), i = async () => {
211
+ }), r = async () => {
212
212
  try {
213
213
  a.setState({ isLoading: !0 });
214
- const r = await R({
214
+ const i = await R({
215
215
  apiKey: s,
216
216
  id: e,
217
217
  environment: t
218
218
  });
219
- r && a.setState({
220
- checkoutProfile: r,
219
+ i && a.setState({
220
+ checkoutProfile: i,
221
221
  isLoading: !1,
222
222
  error: null
223
223
  });
224
- } catch (r) {
224
+ } catch (i) {
225
225
  a.setState({
226
226
  error: "Failed to load checkout profile",
227
227
  isLoading: !1
228
- }), console.error(r);
228
+ }), console.error(i);
229
229
  }
230
230
  };
231
- return i(), {
231
+ return r(), {
232
232
  getState: a.getState.bind(a),
233
233
  subscribe: a.subscribe.bind(a),
234
- reload: i
234
+ reload: r
235
235
  };
236
236
  }
237
237
  const z = {
@@ -328,29 +328,29 @@ const z = {
328
328
  }, j = (s, e) => {
329
329
  if (s.length === 0) return e.length;
330
330
  if (e.length === 0) return s.length;
331
- const t = e.length + 1, a = s.length + 1, i = Array.from(
331
+ const t = e.length + 1, a = s.length + 1, r = Array.from(
332
332
  { length: t },
333
- (r, n) => Array.from({ length: a }, (o, l) => n === 0 ? l : l === 0 ? n : 0)
333
+ (i, n) => Array.from({ length: a }, (o, l) => n === 0 ? l : l === 0 ? n : 0)
334
334
  );
335
- for (let r = 1; r < t; r++)
335
+ for (let i = 1; i < t; i++)
336
336
  for (let n = 1; n < a; n++) {
337
- const o = s[n - 1] === e[r - 1] ? 0 : 1;
338
- i[r][n] = Math.min(
339
- i[r - 1][n] + 1,
337
+ const o = s[n - 1] === e[i - 1] ? 0 : 1;
338
+ r[i][n] = Math.min(
339
+ r[i - 1][n] + 1,
340
340
  // deletion
341
- i[r][n - 1] + 1,
341
+ r[i][n - 1] + 1,
342
342
  // insertion
343
- i[r - 1][n - 1] + o
343
+ r[i - 1][n - 1] + o
344
344
  // substitution
345
345
  );
346
346
  }
347
- return i[e.length][s.length];
347
+ return r[e.length][s.length];
348
348
  }, U = (s) => {
349
349
  let t = null, a = 3;
350
- const i = s.toLowerCase();
351
- for (const r of Object.keys(D)) {
352
- const n = j(i, r);
353
- n <= 2 && n < a && (a = n, t = r);
350
+ const r = s.toLowerCase();
351
+ for (const i of Object.keys(D)) {
352
+ const n = j(r, i);
353
+ n <= 2 && n < a && (a = n, t = i);
354
354
  }
355
355
  return t;
356
356
  }, _ = () => {
@@ -364,32 +364,32 @@ const z = {
364
364
  message: s("validation.emailInvalid"),
365
365
  suggestion: null
366
366
  };
367
- const i = t.indexOf("@");
368
- if (i === -1)
367
+ const r = t.indexOf("@");
368
+ if (r === -1)
369
369
  return {
370
370
  isValid: !1,
371
371
  message: s("validation.emailInvalid"),
372
372
  suggestion: null
373
373
  };
374
- const r = t.substring(0, i), n = t.substring(i + 1);
374
+ const i = t.substring(0, r), n = t.substring(r + 1);
375
375
  if (!n.includes(".")) {
376
376
  const l = K(n);
377
377
  if (l)
378
378
  return {
379
379
  isValid: !1,
380
380
  message: s("validation.emailSuggestion", {
381
- email: `${r}@${l}`
381
+ email: `${i}@${l}`
382
382
  }),
383
- suggestion: `${r}@${l}`
383
+ suggestion: `${i}@${l}`
384
384
  };
385
385
  for (const c of Object.keys(D))
386
386
  if (c.replace(/\./g, "") === n)
387
387
  return {
388
388
  isValid: !1,
389
389
  message: s("validation.emailSuggestion", {
390
- email: `${r}@${c}`
390
+ email: `${i}@${c}`
391
391
  }),
392
- suggestion: `${r}@${c}`
392
+ suggestion: `${i}@${c}`
393
393
  };
394
394
  }
395
395
  if (!a.test(t))
@@ -400,7 +400,7 @@ const z = {
400
400
  };
401
401
  const o = U(n);
402
402
  if (o && o !== n) {
403
- const l = `${r}@${o}`;
403
+ const l = `${i}@${o}`;
404
404
  return {
405
405
  isValid: !1,
406
406
  message: s("validation.emailSuggestion", { email: l }),
@@ -426,10 +426,10 @@ const z = {
426
426
  return s("validation.nameRequired");
427
427
  },
428
428
  cardExpiry: (t) => {
429
- const a = t.replace(/\s/g, ""), [i, r] = a.split("/").map((u) => u.trim());
430
- if (!i || !r || i.length !== 2 || r.length !== 2)
429
+ const a = t.replace(/\s/g, ""), [r, i] = a.split("/").map((u) => u.trim());
430
+ if (!r || !i || r.length !== 2 || i.length !== 2)
431
431
  return s("validation.cardExpiryFormat");
432
- const n = /* @__PURE__ */ new Date(), o = n.getFullYear() % 100, l = n.getMonth() + 1, c = parseInt(i, 10), d = parseInt(r, 10);
432
+ const n = /* @__PURE__ */ new Date(), o = n.getFullYear() % 100, l = n.getMonth() + 1, c = parseInt(r, 10), d = parseInt(i, 10);
433
433
  if (c < 1 || c > 12)
434
434
  return s("validation.cardExpiryFormat");
435
435
  if (d < o || d === o && c < l)
@@ -459,34 +459,34 @@ const z = {
459
459
  const u = t(d, l[d]);
460
460
  u && (c[d] = u);
461
461
  }), c;
462
- }, i = (l) => {
462
+ }, r = (l) => {
463
463
  const c = a(l);
464
464
  return Object.keys(c).length === 0;
465
- }, r = (l, c) => {
465
+ }, i = (l, c) => {
466
466
  const d = e.getState();
467
467
  let u = c;
468
468
  l in z && (u = z[l](c));
469
469
  const E = {
470
470
  ...d.formData,
471
471
  [l]: u
472
- }, g = { ...d.errors };
472
+ }, f = { ...d.errors };
473
473
  if (d.touched[l]) {
474
474
  const m = t(l, u);
475
- m ? g[l] = m : delete g[l];
475
+ m ? f[l] = m : delete f[l];
476
476
  }
477
477
  e.setState({
478
478
  formData: E,
479
- errors: g,
480
- isValid: i(E)
479
+ errors: f,
480
+ isValid: r(E)
481
481
  });
482
482
  }, n = (l, c) => {
483
483
  const d = e.getState(), u = {
484
484
  ...d.touched,
485
485
  [l]: !0
486
- }, E = t(l, c), g = { ...d.errors };
487
- E ? g[l] = E : delete g[l], e.setState({
486
+ }, E = t(l, c), f = { ...d.errors };
487
+ E ? f[l] = E : delete f[l], e.setState({
488
488
  touched: u,
489
- errors: g
489
+ errors: f
490
490
  });
491
491
  }, o = (l) => {
492
492
  const d = {
@@ -495,13 +495,13 @@ const z = {
495
495
  };
496
496
  e.setState({
497
497
  formData: d,
498
- isValid: i(d)
498
+ isValid: r(d)
499
499
  });
500
500
  };
501
501
  return {
502
502
  getFormState: e.getState.bind(e),
503
503
  subscribe: e.subscribe.bind(e),
504
- handleChange: r,
504
+ handleChange: i,
505
505
  handleBlur: n,
506
506
  setFormData: o,
507
507
  reset: e.resetState.bind(e)
@@ -511,7 +511,7 @@ const z = {
511
511
  apiKey: e,
512
512
  environment: t
513
513
  }) => {
514
- const a = k(t), i = await fetch(
514
+ const a = k(t), r = await fetch(
515
515
  `${a}/tokenization/generate-iframe-configuration`,
516
516
  {
517
517
  method: "POST",
@@ -522,9 +522,9 @@ const z = {
522
522
  body: JSON.stringify(s)
523
523
  }
524
524
  );
525
- if (!i.ok)
526
- throw new Error(`HTTP error! Status: ${i.status}`);
527
- return await i.json();
525
+ if (!r.ok)
526
+ throw new Error(`HTTP error! Status: ${r.status}`);
527
+ return await r.json();
528
528
  }, Z = 100, J = 2, W = 2e3, X = 5;
529
529
  function Q({
530
530
  apiKey: s,
@@ -532,9 +532,9 @@ function Q({
532
532
  checkoutProfile: e,
533
533
  inputStyles: t,
534
534
  setFormData: a,
535
- environment: i
535
+ environment: r
536
536
  }) {
537
- const r = L({
537
+ const i = L({
538
538
  iframeConfig: void 0,
539
539
  loadingIframe: !0,
540
540
  isCcValid: !1,
@@ -551,9 +551,9 @@ function Q({
551
551
  allowedOrigins: [globalThis.location.origin]
552
552
  },
553
553
  apiKey: s,
554
- environment: i
554
+ environment: r
555
555
  });
556
- m && (r.setState({
556
+ m && (i.setState({
557
557
  iframeConfig: {
558
558
  ...m,
559
559
  origin: globalThis.location.origin
@@ -563,17 +563,13 @@ function Q({
563
563
  console.error("Failed to generate iframe config:", m);
564
564
  }
565
565
  }, l = () => {
566
- const m = r.getState();
566
+ const m = i.getState();
567
567
  if (!m.iframeConfig || !e)
568
568
  return;
569
- const y = document.getElementById("card-element"), f = document.getElementById("card-cvv-element");
570
- if (!y || !f)
569
+ const y = document.getElementById("card-element"), v = document.getElementById("card-cvv-element");
570
+ if (!y || !v)
571
571
  throw new Error("Card elements not found in DOM");
572
- console.log("✅ TokenEx iframe initializing successfully:", {
573
- cardElementId: y.id,
574
- cvvElementId: f.id,
575
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
576
- }), n = new globalThis.TokenEx.Iframe("card-element", {
572
+ n = new globalThis.TokenEx.Iframe("card-element", {
577
573
  ...m.iframeConfig,
578
574
  placeholder: "1234 1234 1234 1234",
579
575
  cvvPlaceholder: "CVC",
@@ -598,7 +594,7 @@ function Q({
598
594
  }
599
595
  }
600
596
  }), n.on("load", () => {
601
- r.setState({ loadingIframe: !1 });
597
+ i.setState({ loadingIframe: !1 });
602
598
  }), n.on("autoCompleteValues", function(p) {
603
599
  const { nameOnCard: C, cardExp: b } = p;
604
600
  a({
@@ -607,22 +603,22 @@ function Q({
607
603
  });
608
604
  }), n.on("validate", function(p) {
609
605
  const { isValid: C, isCvvValid: b } = p;
610
- r.setState({
606
+ i.setState({
611
607
  isCcValid: C,
612
608
  isCvvValid: b
613
609
  });
614
610
  }), n.on("focus", function() {
615
- r.setState({ isFocused: !0 });
611
+ i.setState({ isFocused: !0 });
616
612
  }), n.on("blur", function() {
617
- r.setState({ isFocused: !1 });
613
+ i.setState({ isFocused: !1 });
618
614
  }), n.on("cvvFocus", function() {
619
- r.setState({ isCvvFocused: !0 });
615
+ i.setState({ isCvvFocused: !0 });
620
616
  }), n.on("cvvBlur", function() {
621
- r.setState({ isCvvFocused: !1 });
617
+ i.setState({ isCvvFocused: !1 });
622
618
  }), n.on(
623
619
  "cardTypeChange",
624
620
  function({ possibleCardType: p }) {
625
- r.setState({ possibleCardType: p });
621
+ i.setState({ possibleCardType: p });
626
622
  }
627
623
  ), n.load();
628
624
  }, c = () => {
@@ -631,7 +627,7 @@ function Q({
631
627
  console.warn(
632
628
  "Card elements not found in DOM, retrying iframe initialization..."
633
629
  );
634
- const f = () => {
630
+ const v = () => {
635
631
  if (m++, m > y) {
636
632
  console.error("Failed to find card elements after maximum retries");
637
633
  return;
@@ -645,22 +641,22 @@ function Q({
645
641
  if (C && b)
646
642
  try {
647
643
  l();
648
- } catch (v) {
649
- console.error("Failed to create TokenEx iframe:", v);
644
+ } catch (g) {
645
+ console.error("Failed to create TokenEx iframe:", g);
650
646
  }
651
- else m < y && f();
647
+ else m < y && v();
652
648
  }, p);
653
649
  };
654
- f();
650
+ v();
655
651
  }, d = () => {
656
- if (!r.getState().iframeConfig || !e)
652
+ if (!i.getState().iframeConfig || !e)
657
653
  return;
658
654
  if (!globalThis.TokenEx?.Iframe) {
659
655
  console.error("TokenEx script not loaded correctly");
660
656
  return;
661
657
  }
662
- const y = document.getElementById("card-element"), f = document.getElementById("card-cvv-element");
663
- if (!y || !f) {
658
+ const y = document.getElementById("card-element"), v = document.getElementById("card-cvv-element");
659
+ if (!y || !v) {
664
660
  c();
665
661
  return;
666
662
  }
@@ -673,25 +669,25 @@ function Q({
673
669
  s && await o();
674
670
  }, E = () => {
675
671
  n && (n.remove(), n = null);
676
- }, g = async (m) => {
672
+ }, f = async (m) => {
677
673
  n && (n.on("tokenize", async function(y) {
678
674
  await m(y);
679
675
  }), n.tokenize());
680
676
  };
681
677
  return {
682
- getState: r.getState.bind(r),
683
- subscribe: r.subscribe.bind(r),
684
- tokenize: g,
678
+ getState: i.getState.bind(i),
679
+ subscribe: i.subscribe.bind(i),
680
+ tokenize: f,
685
681
  cleanup: E,
686
682
  initialize: u
687
683
  };
688
684
  }
689
- const ee = "E-Mail", te = "Name des/der Karteninhaber/in", ae = "Kartendaten", ie = "Vollständiger Name", re = "MM / JJ", ne = "Das Fenster nicht schließen", se = { pay: "ZAHLEN", submit: "ABSENDEN", getPlan: "MEINEN PLAN ERHALTEN", donate: "spenden", book: "jetzt buchen", order: "jetzt bestellen" }, oe = { emailSuggestion: "Meinten Sie {{email}}?", emailInvalid: "Ihre E-Mail-Adresse ist nicht korrekt", cardExpiryInvalid: "Das Ablaufdatum Ihrer Karte liegt in der Vergangenheit", cardExpiryFormat: "Das Ablaufdatum Ihrer Karte ist unvollständig", cardSecurityFormat: "Der Sicherheitscode Ihrer Karte ist unvollständig", nameRequired: "Gib deinen Namen genau so ein, wie er auf deiner Karte steht", cardNumberInvalid: "Die Kartennummer ist unvollständig" }, le = {
685
+ const ee = "E-Mail", te = "Name des/der Karteninhaber/in", ae = "Kartendaten", re = "Vollständiger Name", ie = "MM / JJ", ne = "Das Fenster nicht schließen", se = { pay: "ZAHLEN", submit: "ABSENDEN", getPlan: "MEINEN PLAN ERHALTEN", donate: "spenden", book: "jetzt buchen", order: "jetzt bestellen" }, oe = { emailSuggestion: "Meinten Sie {{email}}?", emailInvalid: "Ihre E-Mail-Adresse ist nicht korrekt", cardExpiryInvalid: "Das Ablaufdatum Ihrer Karte liegt in der Vergangenheit", cardExpiryFormat: "Das Ablaufdatum Ihrer Karte ist unvollständig", cardSecurityFormat: "Der Sicherheitscode Ihrer Karte ist unvollständig", nameRequired: "Gib deinen Namen genau so ein, wie er auf deiner Karte steht", cardNumberInvalid: "Die Kartennummer ist unvollständig" }, le = {
690
686
  email: ee,
691
687
  cardholderNameLabel: te,
692
688
  cardInformation: ae,
693
- cardholderNamePlaceholder: ie,
694
- cardExpiry: re,
689
+ cardholderNamePlaceholder: re,
690
+ cardExpiry: ie,
695
691
  loading: ne,
696
692
  buttonTexts: se,
697
693
  validation: oe
@@ -740,12 +736,12 @@ const ee = "E-Mail", te = "Name des/der Karteninhaber/in", ae = "Kartendaten", i
740
736
  loading: Je,
741
737
  buttonTexts: We,
742
738
  validation: Xe
743
- }, et = "E-mail", tt = "Nome do titular do cartão", at = "Informações do cartão", it = "Nome completo no cartão", rt = "MM / AA", nt = "Por favor, não feche esta janela", st = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTER MEU PLANO", donate: "DOAR", book: "RESERVAR AGORA", order: "FAZER PEDIDO" }, ot = { emailSuggestion: "Você quis dizer {{email}}?", emailInvalid: "O seu endereço de e-mail não é válido", cardExpiryInvalid: "A data de validade do seu cartão está no passado", cardExpiryFormat: "A data de validade do seu cartão está incompleta", cardSecurityFormat: "O código de segurança do seu cartão está incompleto", nameRequired: "Por favor, insira o nome conforme aparece no cartão", cardNumberInvalid: "O número do seu cartão é inválido" }, lt = {
739
+ }, et = "E-mail", tt = "Nome do titular do cartão", at = "Informações do cartão", rt = "Nome completo no cartão", it = "MM / AA", nt = "Por favor, não feche esta janela", st = { pay: "PAGAR", submit: "ENVIAR", getPlan: "OBTER MEU PLANO", donate: "DOAR", book: "RESERVAR AGORA", order: "FAZER PEDIDO" }, ot = { emailSuggestion: "Você quis dizer {{email}}?", emailInvalid: "O seu endereço de e-mail não é válido", cardExpiryInvalid: "A data de validade do seu cartão está no passado", cardExpiryFormat: "A data de validade do seu cartão está incompleta", cardSecurityFormat: "O código de segurança do seu cartão está incompleto", nameRequired: "Por favor, insira o nome conforme aparece no cartão", cardNumberInvalid: "O número do seu cartão é inválido" }, lt = {
744
740
  email: et,
745
741
  cardholderNameLabel: tt,
746
742
  cardInformation: at,
747
- cardholderNamePlaceholder: it,
748
- cardExpiry: rt,
743
+ cardholderNamePlaceholder: rt,
744
+ cardExpiry: it,
749
745
  loading: nt,
750
746
  buttonTexts: st,
751
747
  validation: ot
@@ -792,18 +788,18 @@ class vt {
792
788
  }
793
789
  findNestedValue(e, t) {
794
790
  const a = t.split(".");
795
- let i = e;
796
- for (const r of a) {
797
- if (i == null || !Object.prototype.hasOwnProperty.call(i, r))
791
+ let r = e;
792
+ for (const i of a) {
793
+ if (r == null || !Object.prototype.hasOwnProperty.call(r, i))
798
794
  return;
799
- i = i[r];
795
+ r = r[i];
800
796
  }
801
- return typeof i == "string" ? i : void 0;
797
+ return typeof r == "string" ? r : void 0;
802
798
  }
803
799
  interpolate(e, t) {
804
- return e.replace(/{{(\w+)}}/g, (a, i) => {
805
- const r = t[i];
806
- return r === void 0 ? a : String(r);
800
+ return e.replace(/{{(\w+)}}/g, (a, r) => {
801
+ const i = t[r];
802
+ return i === void 0 ? a : String(i);
807
803
  });
808
804
  }
809
805
  }
@@ -823,18 +819,18 @@ function bt(s) {
823
819
  return A.includes(o) ? o : Et;
824
820
  })();
825
821
  e.setLocale(a);
826
- const i = L({
822
+ const r = L({
827
823
  locale: a,
828
824
  translationService: e
829
825
  });
830
826
  return {
831
- store: i,
832
- translate: (o, l) => i.getState().translationService.translate(o, l),
827
+ store: r,
828
+ translate: (o, l) => r.getState().translationService.translate(o, l),
833
829
  setLocale: (o) => {
834
- A.includes(o) && (i.getState().translationService.setLocale(o), i.setState({ locale: o }));
830
+ A.includes(o) && (r.getState().translationService.setLocale(o), r.setState({ locale: o }));
835
831
  },
836
- getLocale: () => i.getValue("locale"),
837
- subscribe: i.subscribe.bind(i)
832
+ getLocale: () => r.getValue("locale"),
833
+ subscribe: r.subscribe.bind(r)
838
834
  };
839
835
  }
840
836
  const Ct = bt(), I = () => {
@@ -852,22 +848,22 @@ const Ct = bt(), I = () => {
852
848
  } };
853
849
  const e = s.replace(/\s+/g, "+"), t = `https://fonts.googleapis.com/css2?family=${e}:wght@400;700&display=swap`, a = [...document.head.querySelectorAll("link")].filter(
854
850
  (o) => o.href.includes("fonts.googleapis.com/css2") && o.rel === "stylesheet"
855
- ), i = document.createElement("link");
856
- i.rel = "stylesheet", i.href = t;
857
- const r = a.find(
851
+ ), r = document.createElement("link");
852
+ r.rel = "stylesheet", r.href = t;
853
+ const i = a.find(
858
854
  (o) => o.href.includes(`family=${e}`)
859
855
  );
860
- if (r)
861
- r.href = t;
856
+ if (i)
857
+ i.href = t;
862
858
  else if (a.length > 0) {
863
859
  const o = a.at(
864
860
  -1
865
861
  );
866
- o?.nextSibling ? document.head.insertBefore(i, o.nextSibling) : document.head.appendChild(i);
862
+ o?.nextSibling ? document.head.insertBefore(r, o.nextSibling) : document.head.appendChild(r);
867
863
  } else
868
- document.head.appendChild(i);
864
+ document.head.appendChild(r);
869
865
  return { cleanup: () => {
870
- document.head.contains(i) && document.head.removeChild(i);
866
+ document.head.contains(r) && document.head.removeChild(r);
871
867
  } };
872
868
  }, xt = ({
873
869
  scriptSrc: s,
@@ -889,7 +885,7 @@ const Ct = bt(), I = () => {
889
885
  };
890
886
  const a = document.createElement("script");
891
887
  a.src = s, a.async = e;
892
- const i = new Promise((n, o) => {
888
+ const r = new Promise((n, o) => {
893
889
  a.onload = () => n(!0), a.onerror = () => {
894
890
  console.error(`Failed to load script: ${s}`), o(new Error(`Failed to load script: ${s}`));
895
891
  };
@@ -898,11 +894,11 @@ const Ct = bt(), I = () => {
898
894
  cleanup: () => {
899
895
  document.head.contains(a) && document.head.removeChild(a);
900
896
  },
901
- isLoaded: i
897
+ isLoaded: r
902
898
  };
903
899
  }, w = (s) => Object.entries(s).map(([e, t]) => {
904
- const a = e.replace(/([A-Z])/g, "-$1").toLowerCase(), i = typeof t == "number" ? `${t}px` : t;
905
- return `${a}: ${i}`;
900
+ const a = e.replace(/([A-Z])/g, "-$1").toLowerCase(), r = typeof t == "number" ? `${t}px` : t;
901
+ return `${a}: ${r}`;
906
902
  }).join("; ");
907
903
  function Ft(s) {
908
904
  if (!s)
@@ -937,22 +933,22 @@ function Ft(s) {
937
933
  fontFamily: `${s.styles.fontFamily}, sans-serif`
938
934
  }, a = {
939
935
  color: "#dc2727"
940
- }, i = {
941
- outline: 0
942
936
  }, r = {
937
+ outline: 0
938
+ }, i = {
943
939
  fontFamily: `${s.styles.fontFamily}, sans-serif`
944
940
  }, n = {
945
941
  base: w(e),
946
942
  error: w(a),
947
- focus: w(i),
943
+ focus: w(r),
948
944
  placeholder: w(t)
949
945
  };
950
946
  return {
951
- formContainerStyle: r,
947
+ formContainerStyle: i,
952
948
  baseStyles: e,
953
949
  placeholderStyles: t,
954
950
  errorStyles: a,
955
- focusStyles: i,
951
+ focusStyles: r,
956
952
  inputStyles: n
957
953
  };
958
954
  }
@@ -967,8 +963,8 @@ class h {
967
963
  * @param attributes Optional attributes to set on the element
968
964
  */
969
965
  constructor(e, t = [], a = {}) {
970
- this.element = document.createElement(e), t.length > 0 && this.addClass(...t), Object.entries(a).forEach(([i, r]) => {
971
- this.setAttribute(i, r);
966
+ this.element = document.createElement(e), t.length > 0 && this.addClass(...t), Object.entries(a).forEach(([r, i]) => {
967
+ this.setAttribute(r, i);
972
968
  });
973
969
  }
974
970
  /**
@@ -1070,26 +1066,26 @@ class S {
1070
1066
  * Create a button element
1071
1067
  */
1072
1068
  static createButton(e, t = [], a = {}) {
1073
- const i = new h("button", t, a);
1074
- return i.setText(e), i;
1069
+ const r = new h("button", t, a);
1070
+ return r.setText(e), r;
1075
1071
  }
1076
1072
  /**
1077
1073
  * Create an input element
1078
1074
  */
1079
1075
  static createInput(e, t = [], a = {}) {
1080
- const i = { type: e, ...a };
1081
- return new h("input", t, i);
1076
+ const r = { type: e, ...a };
1077
+ return new h("input", t, r);
1082
1078
  }
1083
1079
  /**
1084
1080
  * Create a text input
1085
1081
  */
1086
1082
  static createTextInput(e = "", t = [], a = {}) {
1087
- const i = {
1083
+ const r = {
1088
1084
  type: "text",
1089
1085
  placeholder: e,
1090
1086
  ...a
1091
1087
  };
1092
- return new h("input", t, i);
1088
+ return new h("input", t, r);
1093
1089
  }
1094
1090
  /**
1095
1091
  * Create a form element
@@ -1100,26 +1096,26 @@ class S {
1100
1096
  /**
1101
1097
  * Create a label element
1102
1098
  */
1103
- static createLabel(e, t = "", a = [], i = {}) {
1104
- const r = t ? { for: t, ...i } : i, n = new h("label", a, r);
1099
+ static createLabel(e, t = "", a = [], r = {}) {
1100
+ const i = t ? { for: t, ...r } : r, n = new h("label", a, i);
1105
1101
  return n.setText(e), n;
1106
1102
  }
1107
1103
  /**
1108
1104
  * Create a select element
1109
1105
  */
1110
1106
  static createSelect(e, t = [], a = {}) {
1111
- const i = new h("select", t, a);
1112
- return e.forEach((r) => {
1107
+ const r = new h("select", t, a);
1108
+ return e.forEach((i) => {
1113
1109
  const n = document.createElement("option");
1114
- n.value = r.value, n.textContent = r.text, r.selected && (n.selected = !0), i.getElement().appendChild(n);
1115
- }), i;
1110
+ n.value = i.value, n.textContent = i.text, i.selected && (n.selected = !0), r.getElement().appendChild(n);
1111
+ }), r;
1116
1112
  }
1117
1113
  /**
1118
1114
  * Create an image element
1119
1115
  */
1120
- static createImage(e, t = "", a = [], i = {}) {
1121
- const r = { src: e, alt: t, ...i };
1122
- return new h("img", a, r);
1116
+ static createImage(e, t = "", a = [], r = {}) {
1117
+ const i = { src: e, alt: t, ...r };
1118
+ return new h("img", a, i);
1123
1119
  }
1124
1120
  }
1125
1121
  class wt extends h {
@@ -1129,18 +1125,18 @@ class wt extends h {
1129
1125
  const t = S.createDiv(["error-alert"], {
1130
1126
  role: "alert",
1131
1127
  "aria-live": "polite"
1132
- }), a = S.createDiv(["error-alert-content"]), i = S.createDiv([
1128
+ }), a = S.createDiv(["error-alert-content"]), r = S.createDiv([
1133
1129
  "error-alert-icon-container"
1134
1130
  ]);
1135
- i.getElement().innerHTML = this.createAlertCircleSVG();
1136
- const r = S.createDiv([
1131
+ r.getElement().innerHTML = this.createAlertCircleSVG();
1132
+ const i = S.createDiv([
1137
1133
  "error-alert-text-container"
1138
1134
  ]), n = new h("h4", [
1139
1135
  "error-alert-title"
1140
1136
  ]);
1141
1137
  n.setText("Checkout Error"), this.messageComponent = new h("p", [
1142
1138
  "error-alert-message"
1143
- ]), this.messageComponent.setText(e.message || "Bad request"), r.appendChild(n), r.appendChild(this.messageComponent), a.appendChild(i), a.appendChild(r), t.appendChild(a), this.appendChild(t);
1139
+ ]), this.messageComponent.setText(e.message || "Bad request"), i.appendChild(n), i.appendChild(this.messageComponent), a.appendChild(r), a.appendChild(i), t.appendChild(a), this.appendChild(t);
1144
1140
  }
1145
1141
  createAlertCircleSVG() {
1146
1142
  return `
@@ -1246,8 +1242,8 @@ class Mt {
1246
1242
  const {
1247
1243
  value: t,
1248
1244
  onChange: a,
1249
- onBlur: i,
1250
- error: r,
1245
+ onBlur: r,
1246
+ error: i,
1251
1247
  errorMsg: n,
1252
1248
  checkoutProfile: o,
1253
1249
  translationFunc: l,
@@ -1256,7 +1252,7 @@ class Mt {
1256
1252
  this.input = new T({
1257
1253
  name: "name",
1258
1254
  label: l("cardholderNameLabel"),
1259
- error: r,
1255
+ error: i,
1260
1256
  errorMsg: n,
1261
1257
  styles: {
1262
1258
  color: o.styles.textColor,
@@ -1271,7 +1267,7 @@ class Mt {
1271
1267
  this.trim(), a(d);
1272
1268
  }
1273
1269
  }), this.input.addEventListener("blur", (d) => {
1274
- i(d);
1270
+ r(d);
1275
1271
  });
1276
1272
  }
1277
1273
  getValue() {
@@ -1337,18 +1333,18 @@ class At extends h {
1337
1333
  t.setAttribute("for", "cardNumber"), t.textContent = e.label, t.style.color = e.styles.color, t.style.fontSize = `${e.styles.fontSize}px`, t.style.display = "block", t.style.marginBottom = "6px", this.getElement().appendChild(t);
1338
1334
  const a = document.createElement("div");
1339
1335
  a.className = e.isLoading ? "loading" : "", a.style.borderRadius = `${e.styles.borderRadius}px ${e.styles.borderRadius}px 0px 0px`;
1340
- const i = document.createElement("div");
1341
- i.id = "card-element", i.className = `card-element ${e.isFocused ? "card-element-focus" : ""}`, i.style.zIndex = e.isFocused ? "2" : "0";
1342
1336
  const r = document.createElement("div");
1343
- if (r.className = "cards-position", e.cardType === "unknown")
1337
+ r.id = "card-element", r.className = `card-element ${e.isFocused ? "card-element-focus" : ""}`, r.style.zIndex = e.isFocused ? "2" : "0";
1338
+ const i = document.createElement("div");
1339
+ if (i.className = "cards-position", e.cardType === "unknown")
1344
1340
  F.forEach((n) => {
1345
- r.appendChild(this.createCardIcon(n));
1341
+ i.appendChild(this.createCardIcon(n));
1346
1342
  });
1347
1343
  else {
1348
1344
  const n = F.find((o) => o.type === e.cardType);
1349
- n && r.appendChild(this.createCardIcon(n));
1345
+ n && i.appendChild(this.createCardIcon(n));
1350
1346
  }
1351
- i.appendChild(r), a.appendChild(i), this.getElement().appendChild(a);
1347
+ r.appendChild(i), a.appendChild(r), this.getElement().appendChild(a);
1352
1348
  }
1353
1349
  createCardIcon(e) {
1354
1350
  const t = document.createElement("div");
@@ -1376,13 +1372,13 @@ class At extends h {
1376
1372
  const a = this.getElement().querySelector(".cards-position");
1377
1373
  if (a)
1378
1374
  if (a.innerHTML = "", this.cardType === "unknown")
1379
- F.forEach((i) => {
1380
- a.appendChild(this.createCardIcon(i));
1375
+ F.forEach((r) => {
1376
+ a.appendChild(this.createCardIcon(r));
1381
1377
  });
1382
1378
  else {
1383
- const i = F.find((r) => r.type === this.cardType);
1384
- i ? a.appendChild(this.createCardIcon(i)) : F.forEach((r) => {
1385
- a.appendChild(this.createCardIcon(r));
1379
+ const r = F.find((i) => i.type === this.cardType);
1380
+ r ? a.appendChild(this.createCardIcon(r)) : F.forEach((i) => {
1381
+ a.appendChild(this.createCardIcon(i));
1386
1382
  });
1387
1383
  }
1388
1384
  return this;
@@ -1398,8 +1394,8 @@ class Pt extends h {
1398
1394
  const {
1399
1395
  checkoutProfile: t,
1400
1396
  isLoading: a,
1401
- isFocused: i,
1402
- isCvvFocused: r,
1397
+ isFocused: r,
1398
+ isCvvFocused: i,
1403
1399
  isCcValid: n,
1404
1400
  isCvvValid: o,
1405
1401
  cardType: l,
@@ -1407,11 +1403,11 @@ class Pt extends h {
1407
1403
  cardExpiryError: d,
1408
1404
  cardExpiryTouched: u,
1409
1405
  onChange: E,
1410
- onBlur: g,
1406
+ onBlur: f,
1411
1407
  translationFunc: m,
1412
1408
  cardExpiryAutocomplete: y = "cc-exp"
1413
- } = e, f = document.createElement("div");
1414
- f.className = "card-grid", this.cardNumber = new At({
1409
+ } = e, v = document.createElement("div");
1410
+ this.cardNumber = new At({
1415
1411
  styles: {
1416
1412
  color: t.styles.textColor,
1417
1413
  fontSize: t.styles.fontSize,
@@ -1419,9 +1415,9 @@ class Pt extends h {
1419
1415
  },
1420
1416
  label: m("cardInformation"),
1421
1417
  isLoading: a,
1422
- isFocused: i,
1418
+ isFocused: r,
1423
1419
  cardType: l
1424
- }), f.appendChild(this.cardNumber.getElement());
1420
+ }), v.appendChild(this.cardNumber.getElement());
1425
1421
  const p = document.createElement("div");
1426
1422
  p.className = "card-details", this.cardExpiry = new T({
1427
1423
  name: "cardExpiry",
@@ -1430,8 +1426,8 @@ class Pt extends h {
1430
1426
  errorMsg: d,
1431
1427
  value: c,
1432
1428
  autocomplete: y,
1433
- onChange: (v) => {
1434
- this.trimCardExpiry(), E(v);
1429
+ onChange: (g) => {
1430
+ this.trimCardExpiry(), E(g);
1435
1431
  },
1436
1432
  styles: {
1437
1433
  color: t.styles.textColor,
@@ -1439,8 +1435,8 @@ class Pt extends h {
1439
1435
  fontSize: t.styles.fontSize,
1440
1436
  fontFamily: t.styles.fontFamily
1441
1437
  }
1442
- }), this.cardExpiry.addEventListener("blur", g), this.cardExpiry.addEventListener("keydown", (v) => {
1443
- const M = v;
1438
+ }), this.cardExpiry.addEventListener("blur", f), this.cardExpiry.addEventListener("keydown", (g) => {
1439
+ const M = g;
1444
1440
  ![
1445
1441
  "Backspace",
1446
1442
  "Delete",
@@ -1457,18 +1453,18 @@ class Pt extends h {
1457
1453
  borderRadius: typeof t.styles.borderRadius == "number" ? t.styles.borderRadius : 0
1458
1454
  },
1459
1455
  isLoading: a,
1460
- isFocused: r
1461
- }), b.appendChild(this.cardCvv.getElement()), p.appendChild(this.cardExpiry.getElement()), p.appendChild(b), f.appendChild(p), this.getElement().appendChild(f), i && !n) {
1462
- const v = new x({
1456
+ isFocused: i
1457
+ }), b.appendChild(this.cardCvv.getElement()), p.appendChild(this.cardExpiry.getElement()), p.appendChild(b), v.appendChild(p), this.getElement().appendChild(v), r && !n) {
1458
+ const g = new x({
1463
1459
  text: m("validation.cardNumberInvalid")
1464
1460
  });
1465
- this.validationMessages.set("cardNumber", v), this.appendChild(v);
1461
+ this.validationMessages.set("cardNumber", g), this.appendChild(g);
1466
1462
  }
1467
- if (r && !o) {
1468
- const v = new x({
1463
+ if (i && !o) {
1464
+ const g = new x({
1469
1465
  text: m("validation.cardSecurityFormat")
1470
1466
  });
1471
- this.validationMessages.set("cardCvv", v), this.appendChild(v);
1467
+ this.validationMessages.set("cardCvv", g), this.appendChild(g);
1472
1468
  }
1473
1469
  }
1474
1470
  updateCardType(e) {
@@ -1487,28 +1483,28 @@ class Pt extends h {
1487
1483
  updateCardNumberValidation(e, t, a) {
1488
1484
  if (this.cardNumber.setFocused(e), e && !t) {
1489
1485
  if (!this.validationMessages.has("cardNumber")) {
1490
- const i = new x({
1486
+ const r = new x({
1491
1487
  text: a("validation.cardNumberInvalid")
1492
1488
  });
1493
- this.validationMessages.set("cardNumber", i), this.appendChild(i);
1489
+ this.validationMessages.set("cardNumber", r), this.appendChild(r);
1494
1490
  }
1495
1491
  } else {
1496
- const i = this.validationMessages.get("cardNumber");
1497
- i && (i.getElement().remove(), this.validationMessages.delete("cardNumber"));
1492
+ const r = this.validationMessages.get("cardNumber");
1493
+ r && (r.getElement().remove(), this.validationMessages.delete("cardNumber"));
1498
1494
  }
1499
1495
  return this;
1500
1496
  }
1501
1497
  updateCardCvvValidation(e, t, a) {
1502
1498
  if (this.cardCvv.setFocused(e), e && !t) {
1503
1499
  if (!this.validationMessages.has("cardCvv")) {
1504
- const i = new x({
1500
+ const r = new x({
1505
1501
  text: a("validation.cardSecurityFormat")
1506
1502
  });
1507
- this.validationMessages.set("cardCvv", i), this.appendChild(i);
1503
+ this.validationMessages.set("cardCvv", r), this.appendChild(r);
1508
1504
  }
1509
1505
  } else {
1510
- const i = this.validationMessages.get("cardCvv");
1511
- i && (i.getElement().remove(), this.validationMessages.delete("cardCvv"));
1506
+ const r = this.validationMessages.get("cardCvv");
1507
+ r && (r.getElement().remove(), this.validationMessages.delete("cardCvv"));
1512
1508
  }
1513
1509
  return this;
1514
1510
  }
@@ -1522,8 +1518,8 @@ class Dt {
1522
1518
  const {
1523
1519
  value: t,
1524
1520
  onChange: a,
1525
- onBlur: i,
1526
- error: r,
1521
+ onBlur: r,
1522
+ error: i,
1527
1523
  errorMsg: n,
1528
1524
  checkoutProfile: o,
1529
1525
  translationFunc: l,
@@ -1532,7 +1528,7 @@ class Dt {
1532
1528
  this.input = new T({
1533
1529
  name: "email",
1534
1530
  label: l("email"),
1535
- error: r,
1531
+ error: i,
1536
1532
  errorMsg: n,
1537
1533
  styles: {
1538
1534
  color: o.styles.textColor,
@@ -1548,7 +1544,7 @@ class Dt {
1548
1544
  onChange: (d) => {
1549
1545
  this.trim(), a(d);
1550
1546
  }
1551
- }), this.input.addEventListener("blur", i);
1547
+ }), this.input.addEventListener("blur", r);
1552
1548
  }
1553
1549
  getValue() {
1554
1550
  return this.input.getValue();
@@ -1579,10 +1575,10 @@ class Rt extends h {
1579
1575
  super("div", ["paypal"]);
1580
1576
  const { formData: t, onSubmit: a } = e;
1581
1577
  this.formData = t, this.onSubmit = a, this.getElement().style.cursor = a ? "pointer" : "default", this.getElement().style.opacity = "1";
1582
- const i = document.createElement("div");
1583
- i.className = "paypal-icon-container";
1584
- const r = document.createElement("img");
1585
- r.src = $t, r.style.width = "69px", r.style.height = "22px", r.style.maxWidth = "100%", r.style.display = "block", r.style.height = "auto", i.appendChild(r), this.getElement().appendChild(i), a && this.getElement().addEventListener("click", () => this.handleSubmit());
1578
+ const r = document.createElement("div");
1579
+ r.className = "paypal-icon-container";
1580
+ const i = document.createElement("img");
1581
+ i.src = $t, i.style.width = "69px", i.style.height = "22px", i.style.maxWidth = "100%", i.style.display = "block", i.style.height = "auto", r.appendChild(i), this.getElement().appendChild(r), a && this.getElement().addEventListener("click", () => this.handleSubmit());
1586
1582
  }
1587
1583
  async handleSubmit() {
1588
1584
  if (!(!this.onSubmit || this.isSubmitting)) {
@@ -1606,26 +1602,26 @@ class Rt extends h {
1606
1602
  class Vt extends h {
1607
1603
  paymentMethods;
1608
1604
  constructor(e) {
1609
- const { checkoutProfile: t, formData: a, onPaypalSubmit: i } = e;
1605
+ const { checkoutProfile: t, formData: a, onPaypalSubmit: r } = e;
1610
1606
  if (super("div", ["payment-methods"]), this.paymentMethods = /* @__PURE__ */ new Map(), !t?.additionalPaymentMethods) {
1611
1607
  this.getElement().style.display = "none";
1612
1608
  return;
1613
1609
  }
1614
- const r = Object.entries(
1610
+ const i = Object.entries(
1615
1611
  t.additionalPaymentMethods
1616
1612
  ).filter(([, n]) => n.enabled).sort((n, o) => n[1].order - o[1].order);
1617
- if (r.length === 0) {
1613
+ if (i.length === 0) {
1618
1614
  this.getElement().style.display = "none";
1619
1615
  return;
1620
1616
  }
1621
- for (const [n] of r)
1617
+ for (const [n] of i)
1622
1618
  switch (n) {
1623
1619
  case "paypal": {
1624
- if (i) {
1620
+ if (r) {
1625
1621
  const o = new Rt({
1626
1622
  checkoutProfile: t,
1627
1623
  formData: a,
1628
- onSubmit: i
1624
+ onSubmit: r
1629
1625
  });
1630
1626
  this.paymentMethods.set("paypal", o), o.appendTo(this.getElement());
1631
1627
  }
@@ -1668,9 +1664,9 @@ class Ot extends h {
1668
1664
  class Ht {
1669
1665
  button;
1670
1666
  constructor(e) {
1671
- const { disabled: t, checkoutProfile: a, translationFunc: i } = e;
1667
+ const { disabled: t, checkoutProfile: a, translationFunc: r } = e;
1672
1668
  this.button = new Ot({
1673
- text: i(
1669
+ text: r(
1674
1670
  `buttonTexts.${a?.layout.actionButton.translationKey}`
1675
1671
  ),
1676
1672
  styles: {
@@ -1782,16 +1778,12 @@ class Ut extends h {
1782
1778
  );
1783
1779
  this.applyFormContainerStyles(a);
1784
1780
  try {
1785
- this.cardSection || (this.createCardSection(e.checkoutProfile), console.log("✅ Card element check before iframe initialization:", {
1786
- cardElementExists: !!document.getElementById("card-element"),
1787
- cvvElementExists: !!document.getElementById("card-cvv-element"),
1788
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
1789
- }));
1781
+ this.cardSection || this.createCardSection(e.checkoutProfile);
1790
1782
  } catch (n) {
1791
1783
  console.error("Failed to create card section:", n);
1792
1784
  }
1793
- const i = document.getElementById("card-element"), r = document.getElementById("card-cvv-element");
1794
- if (!i || !r) {
1785
+ const r = document.getElementById("card-element"), i = document.getElementById("card-cvv-element");
1786
+ if (!r || !i) {
1795
1787
  console.error(
1796
1788
  "Card elements not found, cannot initialize TokenEx iframe"
1797
1789
  );
@@ -1805,9 +1797,7 @@ class Ut extends h {
1805
1797
  this.formManager.setFormData(n);
1806
1798
  },
1807
1799
  environment: this.options.environment
1808
- }), this.iframeHook?.subscribe(this.handleIframeStateChange), await this.iframeHook?.initialize(), console.log("✅ TokenEx iframe initialized successfully:", {
1809
- timestamp: (/* @__PURE__ */ new Date()).toISOString()
1810
- });
1800
+ }), this.iframeHook?.subscribe(this.handleIframeStateChange), await this.iframeHook?.initialize();
1811
1801
  } catch (t) {
1812
1802
  throw console.error("Failed to initialize payment form:", t), t;
1813
1803
  }
@@ -1826,8 +1816,8 @@ class Ut extends h {
1826
1816
  createCardSection = (e) => {
1827
1817
  if (!this.cardSection)
1828
1818
  try {
1829
- const { formData: t, errors: a, touched: i } = this._getFormStateData();
1830
- let r = {
1819
+ const { formData: t, errors: a, touched: r } = this._getFormStateData();
1820
+ let i = {
1831
1821
  loadingIframe: !0,
1832
1822
  isFocused: !1,
1833
1823
  isCvvFocused: !1,
@@ -1835,17 +1825,17 @@ class Ut extends h {
1835
1825
  isCvvValid: !1,
1836
1826
  possibleCardType: "unknown"
1837
1827
  };
1838
- if (this.iframeHook && (r = this.iframeHook.getState()), this.cardSection = new Pt({
1828
+ if (this.iframeHook && (i = this.iframeHook.getState()), this.cardSection = new Pt({
1839
1829
  checkoutProfile: e,
1840
- isLoading: r.loadingIframe,
1841
- isFocused: r.isFocused,
1842
- isCvvFocused: r.isCvvFocused,
1843
- isCcValid: r.isCcValid,
1844
- isCvvValid: r.isCvvValid,
1845
- cardType: r.possibleCardType,
1830
+ isLoading: i.loadingIframe,
1831
+ isFocused: i.isFocused,
1832
+ isCvvFocused: i.isCvvFocused,
1833
+ isCcValid: i.isCcValid,
1834
+ isCvvValid: i.isCvvValid,
1835
+ cardType: i.possibleCardType,
1846
1836
  cardExpiry: t.cardExpiry,
1847
1837
  cardExpiryError: a.cardExpiry,
1848
- cardExpiryTouched: !!i.cardExpiry,
1838
+ cardExpiryTouched: !!r.cardExpiry,
1849
1839
  onChange: this.handleChange,
1850
1840
  onBlur: this.handleBlur,
1851
1841
  translationFunc: this.translation.t
@@ -1912,18 +1902,10 @@ class Ut extends h {
1912
1902
  }
1913
1903
  createPaymentMethods(e) {
1914
1904
  try {
1915
- if (!e?.additionalPaymentMethods) {
1916
- console.log(
1917
- "No additional payment methods configured, skipping component"
1918
- );
1919
- return;
1920
- }
1921
- if (Object.entries(
1905
+ if (!e?.additionalPaymentMethods || Object.entries(
1922
1906
  e.additionalPaymentMethods
1923
- ).filter(([, i]) => i.enabled).length === 0) {
1924
- console.log("No enabled payment methods found, skipping component");
1907
+ ).filter(([, r]) => r.enabled).length === 0)
1925
1908
  return;
1926
- }
1927
1909
  const { formData: a } = this._getFormStateData();
1928
1910
  this.paymentMethods = new Vt({
1929
1911
  checkoutProfile: e,
@@ -1938,12 +1920,12 @@ class Ut extends h {
1938
1920
  }
1939
1921
  createEmailField(e) {
1940
1922
  try {
1941
- const { formData: t, errors: a, touched: i } = this._getFormStateData();
1923
+ const { formData: t, errors: a, touched: r } = this._getFormStateData();
1942
1924
  this.emailField = new Dt({
1943
1925
  value: t.email,
1944
1926
  onChange: this.handleChange,
1945
1927
  onBlur: this.handleBlur,
1946
- error: !!(a.email && i.email),
1928
+ error: !!(a.email && r.email),
1947
1929
  errorMsg: a.email,
1948
1930
  checkoutProfile: e,
1949
1931
  translationFunc: this.translation.t
@@ -1954,12 +1936,12 @@ class Ut extends h {
1954
1936
  }
1955
1937
  createCardholderSection(e) {
1956
1938
  try {
1957
- const { formData: t, errors: a, touched: i } = this._getFormStateData();
1939
+ const { formData: t, errors: a, touched: r } = this._getFormStateData();
1958
1940
  this.cardholderSection = new Mt({
1959
1941
  value: t.name,
1960
1942
  onChange: this.handleChange,
1961
1943
  onBlur: this.handleBlur,
1962
- error: !!(a.name && i.name),
1944
+ error: !!(a.name && r.name),
1963
1945
  errorMsg: a.name,
1964
1946
  checkoutProfile: e,
1965
1947
  translationFunc: this.translation.t
@@ -1980,12 +1962,12 @@ class Ut extends h {
1980
1962
  }
1981
1963
  }
1982
1964
  handleChange = (e) => {
1983
- const t = e.target, { name: a, value: i } = t;
1984
- this.formManager.handleChange(a, i);
1965
+ const t = e.target, { name: a, value: r } = t;
1966
+ this.formManager.handleChange(a, r);
1985
1967
  };
1986
1968
  handleBlur = (e) => {
1987
- const t = e.target, { name: a, value: i } = t;
1988
- this.formManager.handleBlur(a, i);
1969
+ const t = e.target, { name: a, value: r } = t;
1970
+ this.formManager.handleBlur(a, r);
1989
1971
  };
1990
1972
  updateFormUI() {
1991
1973
  const e = this.formManager.getFormState();
@@ -2008,12 +1990,12 @@ class Ut extends h {
2008
1990
  isCvvValid: !1
2009
1991
  };
2010
1992
  this.iframeHook && (t = this.iframeHook.getState());
2011
- const a = Object.keys(e.errors).length > 0, i = (
1993
+ const a = Object.keys(e.errors).length > 0, r = (
2012
1994
  // Only require card validation if CardSection exists
2013
1995
  (!this.cardSection || t.isCcValid && t.isCvvValid) && !!e.formData.email && !!e.formData.name && // Only require card expiry if CardSection exists
2014
1996
  (!this.cardSection || !!e.formData.cardExpiry)
2015
1997
  );
2016
- return a || !i || this.isSubmitting;
1998
+ return a || !r || this.isSubmitting;
2017
1999
  }
2018
2000
  setLoadingState(e) {
2019
2001
  if (this.options.onLoadingStateChange) {
package/dist/index.css CHANGED
@@ -1 +1 @@
1
- .form-container{display:grid;gap:24px;padding:4px;position:relative;min-height:400px;max-width:100%;text-align:left}.form-container>*{font-family:inherit}.card-grid{display:grid}.card-details{display:grid;grid-template-columns:1fr 1fr}@keyframes slideIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.error-alert{background-color:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:16px;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f;animation:slideIn .3s ease-out}.error-alert-content{display:flex;align-items:flex-start;gap:12px}.error-alert-icon-container{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:32px;height:32px;background-color:#fee2e2;border-radius:50%;color:#dc2626}.error-alert-icon{color:#dc2626}.error-alert-text-container{flex:1;min-width:0}.error-alert-title{margin:0 0 4px;font-size:14px;font-weight:600;color:#991b1b;line-height:1.4}.error-alert-message{margin:0;font-size:14px;color:#7f1d1d;line-height:1.5;word-break:break-word}.blur-bg{position:absolute;inset:0;height:100%;width:100%;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:center;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(3.5px);z-index:9999}.loader{width:64px;height:64px;border:6px solid transparent;border-top:6px solid #4f81ff;border-right:6px solid #36d1dc;border-radius:50%;animation:spin 1s ease-in-out infinite,glow 1.5s ease-in-out infinite alternate;box-shadow:0 0 #4f81ff00}@keyframes spin{to{transform:rotate(360deg)}}@keyframes glow{0%{box-shadow:0 0 #4f81ff00}to{box-shadow:0 0 20px #4f81ff99}}.title{margin-top:20px;font-size:18px;color:#4f4f4f;animation:fadeIn 1s ease-in-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.input-wrapper{display:flex;flex-direction:column}.form-input{opacity:1;font-weight:400;letter-spacing:.02em;transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d;background:#fff;padding:8px 12px;border:none;outline:none;line-height:1.5;z-index:0;box-sizing:border-box}.form-input-error{color:#dc2727}.form-input::placeholder{color:#717173;opacity:.3}.form-input:focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;z-index:2}.form-helper-text{color:#dc2727;font-size:12px;font-weight:500;margin-top:4px}.input-label{margin-bottom:6px}.card-element{position:relative;height:38.5px;transition:box-shadow .1s ease-in;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d;padding:0;border:none;background:#fff;border-radius:inherit;box-sizing:border-box;flex:1 1 50%;min-width:0}.card-element iframe{width:100%;min-width:0}.card-element-focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}.card-icon{width:16px;transition:opacity .6s ease-in;opacity:1}.card-icon img{max-width:100%;display:block;height:auto}.cards-position{position:absolute;z-index:10;right:20px;top:8px;display:flex;align-items:center;gap:8px;pointer-events:none}.loading{position:relative}.loading:after{content:"";position:absolute;inset:0;height:100%;width:100%;backdrop-filter:blur(3px);border-radius:inherit}@media only screen and (min-width: 600px){.card-icon{width:20px}}.paypal{background-color:#ffc439;color:#253b80;font-weight:700;padding:8px 16px;box-shadow:0 2px 4px #0000001a;text-transform:none;cursor:pointer;border-radius:4px}.paypal:hover{background-color:#ffc439;filter:brightness(.95)}.paypal-icon-container{display:flex;align-items:center;justify-content:center}.paypal-icon-container img{width:69px;height:22px}.button{position:relative;display:inline-flex;align-items:center;justify-content:center;padding:8px 16px;font-size:14px;font-weight:500;line-height:1.5;text-align:center;cursor:pointer;transition:all .2s ease;font-weight:700;border:none;outline:none;white-space:nowrap;height:min-content;width:100%}.disabled{pointer-events:none}.valid{outline:none;overflow:hidden;transition:all .3s ease}.valid:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.4),transparent);transition:left .5s;animation:glowSlide 6s infinite}@keyframes glowSlide{0%{left:-100%}50%{left:100%}to{left:100%}}.valid:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.1) 25%,rgba(255,255,255,.3) 50%,rgba(255,255,255,.1) 75%,transparent 100%);transform:translate(-100%);animation:smoothGlow 7s infinite}@keyframes smoothGlow{0%{transform:translate(-100%)}to{transform:translate(100%)}}
1
+ .form-container{display:grid;gap:24px;padding:4px;position:relative;min-height:400px;max-width:100%;text-align:left}.form-container>*{font-family:inherit}.card-details{display:flex}@keyframes slideIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.error-alert{background-color:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:16px;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f;animation:slideIn .3s ease-out}.error-alert-content{display:flex;align-items:flex-start;gap:12px}.error-alert-icon-container{flex-shrink:0;display:flex;align-items:center;justify-content:center;width:32px;height:32px;background-color:#fee2e2;border-radius:50%;color:#dc2626}.error-alert-icon{color:#dc2626}.error-alert-text-container{flex:1;min-width:0}.error-alert-title{margin:0 0 4px;font-size:14px;font-weight:600;color:#991b1b;line-height:1.4}.error-alert-message{margin:0;font-size:14px;color:#7f1d1d;line-height:1.5;word-break:break-word}.blur-bg{position:absolute;inset:0;height:100%;width:100%;background:transparent;display:flex;flex-direction:column;align-items:center;justify-content:center;backdrop-filter:blur(2px);-webkit-backdrop-filter:blur(3.5px);z-index:9999}.loader{width:64px;height:64px;border:6px solid transparent;border-top:6px solid #4f81ff;border-right:6px solid #36d1dc;border-radius:50%;animation:spin 1s ease-in-out infinite,glow 1.5s ease-in-out infinite alternate;box-shadow:0 0 #4f81ff00}@keyframes spin{to{transform:rotate(360deg)}}@keyframes glow{0%{box-shadow:0 0 #4f81ff00}to{box-shadow:0 0 20px #4f81ff99}}.title{margin-top:20px;font-size:18px;color:#4f4f4f;animation:fadeIn 1s ease-in-out}@keyframes fadeIn{0%{opacity:0;transform:translateY(10px)}to{opacity:1;transform:translateY(0)}}.input-wrapper{display:flex;flex-direction:column;width:100%;min-width:0;flex-grow:1;flex-basis:0;box-sizing:border-box}.input-wrapper *{box-sizing:border-box}.form-input{opacity:1;font-weight:400;letter-spacing:.02em;transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d;background:#fff;padding:8px 12px;border:none;outline:none;line-height:1.5;z-index:0;box-sizing:border-box}.form-input-error{color:#dc2727}.form-input::placeholder{color:#717173;opacity:.3}.form-input:focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;z-index:2}.form-helper-text{color:#dc2727;font-size:12px;font-weight:500;margin-top:4px}.input-label{margin-bottom:6px}.card-element{position:relative;height:38.5px;transition:box-shadow .1s ease-in;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d;padding:0;border:none;background:#fff;border-radius:inherit;box-sizing:border-box}.card-element iframe{width:100%;min-width:0;display:block}.card-element-focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}.card-icon{width:16px;transition:opacity .6s ease-in;opacity:1}.card-icon img{max-width:100%;display:block;height:auto}.cards-position{position:absolute;z-index:10;right:20px;top:8px;display:flex;align-items:center;gap:8px;pointer-events:none}.loading{position:relative}.loading:after{content:"";position:absolute;inset:0;height:100%;width:100%;backdrop-filter:blur(3px);border-radius:inherit}@media only screen and (min-width: 600px){.card-icon{width:20px}}.paypal{background-color:#ffc439;color:#253b80;font-weight:700;padding:8px 16px;box-shadow:0 2px 4px #0000001a;text-transform:none;cursor:pointer;border-radius:4px}.paypal:hover{background-color:#ffc439;filter:brightness(.95)}.paypal-icon-container{display:flex;align-items:center;justify-content:center}.paypal-icon-container img{width:69px;height:22px}.button{position:relative;display:inline-flex;align-items:center;justify-content:center;padding:8px 16px;font-size:14px;font-weight:500;line-height:1.5;text-align:center;cursor:pointer;transition:all .2s ease;font-weight:700;border:none;outline:none;white-space:nowrap;height:min-content;width:100%}.disabled{pointer-events:none}.valid{outline:none;overflow:hidden;transition:all .3s ease}.valid:before{content:"";position:absolute;top:0;left:-100%;width:100%;height:100%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.4),transparent);transition:left .5s;animation:glowSlide 6s infinite}@keyframes glowSlide{0%{left:-100%}50%{left:100%}to{left:100%}}.valid:after{content:"";position:absolute;top:0;left:0;width:100%;height:100%;background:linear-gradient(90deg,transparent 0%,rgba(255,255,255,.1) 25%,rgba(255,255,255,.3) 50%,rgba(255,255,255,.1) 75%,transparent 100%);transform:translate(-100%);animation:smoothGlow 7s infinite}@keyframes smoothGlow{0%{transform:translate(-100%)}to{transform:translate(100%)}}
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odus/checkout",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "displayName": "Odus Checkout SDK",
5
5
  "keywords": [
6
6
  "odus",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odus/checkout",
3
- "version": "0.5.7",
3
+ "version": "0.5.9",
4
4
  "displayName": "Odus Checkout SDK",
5
5
  "keywords": [
6
6
  "odus",