@odus/checkout 0.30.0-beta.4 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- import { o as a, I as m, S as y, g as C, e as g, A as E, F as k, j as z, a as c, f as N, J as P, E as S, n as x, P as F, i as R, z as A, p as V, q as M, k as B } from "./shared.js";
2
- const l = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family, inherit);font-size:12px;font-weight:500;margin-top:4px;display:block;overflow:hidden;max-height:100px;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,margin .3s ease-in-out}.form-helper-text-hidden{max-height:0;opacity:0;margin-top:0;overflow:hidden}", h = ".input-wrapper{display:flex;flex-direction:column;width:100%;min-width:0;box-sizing:border-box;align-items:stretch}.input-wrapper *{box-sizing:border-box}.form-input{opacity:1;font-size:var(--odus-input-font-size, 16px);font-weight:var(--odus-input-font-weight, 400);letter-spacing:var(--odus-input-letter-spacing, .02em);transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px var(--odus-border-color, #e0e0e0),0 2px 4px #00000012,0 1px 1.5px #0000000d;background:var(--odus-color-background, #fff);padding:var(--odus-input-padding, 8px 12px);border:none;outline:none;line-height:var(--odus-input-line-height, 1.5);z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%}.form-input[name=cardNumber]{padding-right:100px}.form-input-error{color:#dc2727}.form-input::placeholder{color:var(--odus-input-placeholder-color, #717173);opacity:var(--odus-input-placeholder-opacity, .3)}.form-input:focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;position:relative;z-index:2}", u = ".input-label{font-family:var(--odus-font-family, inherit);font-size:var(--odus-label-font-size, 14px);font-weight:var(--odus-label-font-weight, 400);color:var(--odus-label-color, var(--odus-color-text, #1a1a1a));letter-spacing:var(--odus-label-letter-spacing, normal);line-height:var(--odus-label-line-height, 1.4);margin-bottom:var(--odus-label-margin-bottom, 6px)}", I = ":host{--odus-font-family: system-ui, sans-serif;--odus-font-size: 16px;--odus-color-error: #dc2727;--odus-color-text: #1a1a1a;--odus-color-background: #ffffff;--odus-border-color: #e0e0e0;--odus-border-radius: 6px;--odus-spacing-sm: 8px;--odus-spacing-md: 16px;--odus-spacing-lg: 24px;--odus-input-height: 44px;--odus-input-padding: 8px 12px;--odus-input-font-size: var(--odus-font-size);--odus-input-font-weight: 400;--odus-input-letter-spacing: .02em;--odus-input-line-height: 1.5;--odus-input-placeholder-color: #717173;--odus-input-placeholder-opacity: .3;--odus-input-focus-shadow: 0 0 0 1px rgba(50, 151, 211, .7), 0 1px 1px 0 rgba(0, 0, 0, .07), 0 0 0 4px rgba(50, 151, 211, .3);--odus-label-font-size: 14px;--odus-label-font-weight: 400;--odus-label-color: var(--odus-color-text);--odus-label-letter-spacing: normal;--odus-label-line-height: 1.4;--odus-label-margin-bottom: 6px;--odus-card-gap: 12px;--odus-button-height: 48px;--odus-button-border-radius: var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight, 400);letter-spacing:var(--odus-input-letter-spacing, .02em);transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px var(--odus-border-color, #e0e0e0),0 2px 4px #00000012,0 1px 1.5px #0000000d;background:var(--odus-color-background, #fff);padding:var(--odus-input-padding, 8px 12px);border:none;outline:none;line-height:var(--odus-input-line-height, 1.5);z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%}.form-input::placeholder{color:var(--odus-input-placeholder-color, #717173);opacity:var(--odus-input-placeholder-opacity, .3)}.form-input:focus{box-shadow:var( --odus-input-focus-shadow, 0 0 0 1px rgba(50, 151, 211, .7), 0 1px 1px 0 rgba(0, 0, 0, .07), 0 0 0 4px rgba(50, 151, 211, .3) );position:relative;z-index:2}.input-label{font-family:var(--odus-font-family, inherit)!important;font-size:var(--odus-label-font-size, 14px)!important;font-weight:var(--odus-label-font-weight, 400)!important;color:var(--odus-label-color, var(--odus-color-text, #1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing, normal)!important;line-height:var(--odus-label-line-height, 1.4)!important;margin-bottom:var(--odus-label-margin-bottom, 6px)!important}.form-helper-text{font-family:var(--odus-font-family, inherit)!important}";
3
- class d {
1
+ import { o as a, I as g, S as E, g as z, e as x, A as N, F as V, i as k, a as _, f as P, J as F, p as y, m as w, j as A, E as R, n as C, P as M, l as T, B as I, q as B, r as L, k as j } from "./shared.js";
2
+ const p = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family, inherit);font-size:12px;font-weight:500;margin-top:4px;display:block;overflow:hidden;max-height:100px;transition:max-height .3s ease-in-out,opacity .3s ease-in-out,margin .3s ease-in-out}.form-helper-text-hidden{max-height:0;opacity:0;margin-top:0;overflow:hidden}", f = ".input-wrapper{display:flex;flex-direction:column;width:100%;min-width:0;box-sizing:border-box;align-items:stretch}.input-wrapper *{box-sizing:border-box}.form-input{opacity:1;font-size:var(--odus-input-font-size, 16px);font-weight:var(--odus-input-font-weight, 400);letter-spacing:var(--odus-input-letter-spacing, .02em);transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px var(--odus-border-color, #e0e0e0),0 2px 4px #00000012,0 1px 1.5px #0000000d;background:var(--odus-color-background, #fff);padding:var(--odus-input-padding, 8px 12px);border:none;outline:none;line-height:var(--odus-input-line-height, 1.5);z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%}.form-input[name=cardNumber]{padding-right:100px}.form-input-error{color:#dc2727}.form-input::placeholder{color:var(--odus-input-placeholder-color, #717173);opacity:var(--odus-input-placeholder-opacity, .3)}.form-input:focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;position:relative;z-index:2}", m = ".input-label{font-family:var(--odus-font-family, inherit);font-size:var(--odus-label-font-size, 14px);font-weight:var(--odus-label-font-weight, 400);color:var(--odus-label-color, var(--odus-color-text, #1a1a1a));letter-spacing:var(--odus-label-letter-spacing, normal);line-height:var(--odus-label-line-height, 1.4);margin-bottom:var(--odus-label-margin-bottom, 6px)}", O = ":host{--odus-font-family: system-ui, sans-serif;--odus-font-size: 16px;--odus-color-error: #dc2727;--odus-color-text: #1a1a1a;--odus-color-background: #ffffff;--odus-border-color: #e0e0e0;--odus-border-radius: 6px;--odus-spacing-sm: 8px;--odus-spacing-md: 16px;--odus-spacing-lg: 24px;--odus-input-height: 44px;--odus-input-padding: 8px 12px;--odus-input-font-size: var(--odus-font-size);--odus-input-font-weight: 400;--odus-input-letter-spacing: .02em;--odus-input-line-height: 1.5;--odus-input-placeholder-color: #717173;--odus-input-placeholder-opacity: .3;--odus-input-focus-shadow: 0 0 0 1px rgba(50, 151, 211, .7), 0 1px 1px 0 rgba(0, 0, 0, .07), 0 0 0 4px rgba(50, 151, 211, .3);--odus-label-font-size: 14px;--odus-label-font-weight: 400;--odus-label-color: var(--odus-color-text);--odus-label-letter-spacing: normal;--odus-label-line-height: 1.4;--odus-label-margin-bottom: 6px;--odus-card-gap: 12px;--odus-button-height: 48px;--odus-button-border-radius: var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight, 400);letter-spacing:var(--odus-input-letter-spacing, .02em);transition:box-shadow .1s ease-in,border-radius .2s ease-in;box-shadow:0 0 0 1px var(--odus-border-color, #e0e0e0),0 2px 4px #00000012,0 1px 1.5px #0000000d;background:var(--odus-color-background, #fff);padding:var(--odus-input-padding, 8px 12px);border:none;outline:none;line-height:var(--odus-input-line-height, 1.5);z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%}.form-input::placeholder{color:var(--odus-input-placeholder-color, #717173);opacity:var(--odus-input-placeholder-opacity, .3)}.form-input:focus{box-shadow:var( --odus-input-focus-shadow, 0 0 0 1px rgba(50, 151, 211, .7), 0 1px 1px 0 rgba(0, 0, 0, .07), 0 0 0 4px rgba(50, 151, 211, .3) );position:relative;z-index:2}.input-label{font-family:var(--odus-font-family, inherit)!important;font-size:var(--odus-label-font-size, 14px)!important;font-weight:var(--odus-label-font-weight, 400)!important;color:var(--odus-label-color, var(--odus-color-text, #1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing, normal)!important;line-height:var(--odus-label-line-height, 1.4)!important;margin-bottom:var(--odus-label-margin-bottom, 6px)!important}.form-helper-text{font-family:var(--odus-font-family, inherit)!important}";
3
+ class u {
4
4
  shadowRoot = null;
5
5
  host = null;
6
6
  options = {};
@@ -56,15 +56,15 @@ class d {
56
56
  }
57
57
  emit(e, t) {
58
58
  const r = this.listeners.get(e) ?? [];
59
- for (const o of r)
60
- o(t);
59
+ for (const s of r)
60
+ s(t);
61
61
  this.options.callbacks?.[e]?.(t);
62
62
  }
63
63
  getCss() {
64
- return I;
64
+ return O;
65
65
  }
66
66
  }
67
- class L extends d {
67
+ class q extends u {
68
68
  _value = "";
69
69
  _error = null;
70
70
  _input = null;
@@ -72,7 +72,7 @@ class L extends d {
72
72
  if (!this.shadowRoot) return;
73
73
  this._input?.getElement().remove();
74
74
  const { t: e } = a();
75
- this._input = new m({
75
+ this._input = new g({
76
76
  name: "billingAddress.city",
77
77
  label: e("address.city"),
78
78
  error: !1,
@@ -88,7 +88,7 @@ class L extends d {
88
88
  }), this.shadowRoot.appendChild(this._input.getElement());
89
89
  }
90
90
  getCss() {
91
- return super.getCss() + [h, u, l].join(`
91
+ return super.getCss() + [f, m, p].join(`
92
92
  `) + `
93
93
  :host { display: block; }
94
94
  .form-input {
@@ -129,8 +129,8 @@ class L extends d {
129
129
  return this._error;
130
130
  }
131
131
  }
132
- const v = `.form-select{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 32px 8px 12px;border:none;outline:none;line-height:1.5;z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%;cursor:pointer;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none'%3E%3Cpath d='M2 3.5L5 6.5L8 3.5' stroke='%23717173' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center}.form-select-error{color:#dc2727}.form-select-placeholder{color:#d4d4d5}.form-select option[disabled]{color:#717173;opacity:.5}.form-select:focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;position:relative;z-index:2}`;
133
- class T extends d {
132
+ const S = `.form-select{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:var(--odus-input-padding, 8px 12px);border:none;outline:none;line-height:1.5;z-index:0;box-sizing:border-box;min-height:0;flex:1;width:100%;cursor:pointer;appearance:none;-webkit-appearance:none;-moz-appearance:none;background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 10 10' fill='none'%3E%3Cpath d='M2 3.5L5 6.5L8 3.5' stroke='%23717173' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");background-repeat:no-repeat;background-position:right 12px center;padding-right:32px}.form-select-error{color:#dc2727}.form-select-placeholder{color:#d4d4d5}.form-select option[disabled]{color:#717173;opacity:.5}.form-select:focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;position:relative;z-index:2}`;
133
+ class D extends u {
134
134
  _value = "";
135
135
  _error = null;
136
136
  _select = null;
@@ -142,13 +142,13 @@ class T extends d {
142
142
  if (!this.shadowRoot) return;
143
143
  this._select?.getElement().remove(), this.options.initialValue && !this._value && (this._value = String(this.options.initialValue));
144
144
  const { t: e, locale: t } = a();
145
- this._select = new y({
145
+ this._select = new E({
146
146
  name: "billingAddress.country",
147
147
  label: e("address.country"),
148
148
  error: !1,
149
149
  placeholder: e("address.chooseCountry"),
150
150
  value: this._value,
151
- options: C(this._allowedCountries, t),
151
+ options: z(this._allowedCountries, t),
152
152
  autocomplete: "country",
153
153
  onChange: (r) => {
154
154
  this._value = r.target.value, this._error = null, this.emit("change", this._value);
@@ -159,7 +159,7 @@ class T extends d {
159
159
  }), this.shadowRoot.appendChild(this._select.getElement());
160
160
  }
161
161
  getCss() {
162
- return super.getCss() + [u, l, v].join(`
162
+ return super.getCss() + [m, p, S].join(`
163
163
  `) + `
164
164
  :host { display: block; }
165
165
  .form-select {
@@ -200,7 +200,7 @@ class T extends d {
200
200
  return this._error;
201
201
  }
202
202
  }
203
- class j extends d {
203
+ class J extends u {
204
204
  _value = "";
205
205
  _error = null;
206
206
  _input = null;
@@ -208,7 +208,7 @@ class j extends d {
208
208
  if (!this.shadowRoot) return;
209
209
  this._input?.getElement().remove();
210
210
  const { t: e } = a();
211
- this._input = new m({
211
+ this._input = new g({
212
212
  name: "billingAddress.firstName",
213
213
  label: e("address.firstName"),
214
214
  error: !1,
@@ -224,7 +224,7 @@ class j extends d {
224
224
  }), this.shadowRoot.appendChild(this._input.getElement());
225
225
  }
226
226
  getCss() {
227
- return super.getCss() + [h, u, l].join(`
227
+ return super.getCss() + [f, m, p].join(`
228
228
  `) + `
229
229
  :host { display: block; }
230
230
  .form-input {
@@ -265,7 +265,7 @@ class j extends d {
265
265
  return this._error;
266
266
  }
267
267
  }
268
- class q extends d {
268
+ class K extends u {
269
269
  _value = "";
270
270
  _error = null;
271
271
  _input = null;
@@ -273,7 +273,7 @@ class q extends d {
273
273
  if (!this.shadowRoot) return;
274
274
  this._input?.getElement().remove();
275
275
  const { t: e } = a();
276
- this._input = new m({
276
+ this._input = new g({
277
277
  name: "billingAddress.lastName",
278
278
  label: e("address.lastName"),
279
279
  error: !1,
@@ -289,7 +289,7 @@ class q extends d {
289
289
  }), this.shadowRoot.appendChild(this._input.getElement());
290
290
  }
291
291
  getCss() {
292
- return super.getCss() + [h, u, l].join(`
292
+ return super.getCss() + [f, m, p].join(`
293
293
  `) + `
294
294
  :host { display: block; }
295
295
  .form-input {
@@ -330,8 +330,8 @@ class q extends d {
330
330
  return this._error;
331
331
  }
332
332
  }
333
- const b = /* @__PURE__ */ new Set(["US", "CA"]);
334
- class O extends d {
333
+ const v = /* @__PURE__ */ new Set(["US", "CA"]);
334
+ class Z extends u {
335
335
  _value = "";
336
336
  _country = "";
337
337
  _input = null;
@@ -339,17 +339,17 @@ class O extends d {
339
339
  setCountry(e) {
340
340
  const t = this._country;
341
341
  if (this._country = e, !this.shadowRoot) return;
342
- const r = b.has(t), o = b.has(e);
343
- if (r && o && t !== e) {
344
- const { t: s } = a(), i = e, p = s(i === "US" ? "address.chooseState" : "address.chooseProvince");
345
- this._select?.setOptions(g(i), p), this._value = "";
342
+ const r = v.has(t), s = v.has(e);
343
+ if (r && s && t !== e) {
344
+ const { t: o } = a(), i = e, n = o(i === "US" ? "address.chooseState" : "address.chooseProvince");
345
+ this._select?.setOptions(x(i), n), this._value = "";
346
346
  return;
347
347
  }
348
- r !== o && (this._value = "", this.render());
348
+ r !== s && (this._value = "", this.render());
349
349
  }
350
350
  render() {
351
351
  if (!this.shadowRoot) return;
352
- if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, b.has(this._country)) {
352
+ if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, v.has(this._country)) {
353
353
  const t = this._country;
354
354
  this._renderSelect(t);
355
355
  } else
@@ -357,7 +357,7 @@ class O extends d {
357
357
  }
358
358
  _renderInput() {
359
359
  const { t: e } = a();
360
- this._input = new m({
360
+ this._input = new g({
361
361
  name: "billingAddress.state",
362
362
  label: e("address.state"),
363
363
  error: !1,
@@ -372,24 +372,24 @@ class O extends d {
372
372
  }), this.shadowRoot.appendChild(this._input.getElement());
373
373
  }
374
374
  _renderSelect(e) {
375
- const { t } = a(), r = g(e), o = t(e === "US" ? "address.chooseState" : "address.chooseProvince");
376
- this._select = new y({
375
+ const { t } = a(), r = x(e), s = t(e === "US" ? "address.chooseState" : "address.chooseProvince");
376
+ this._select = new E({
377
377
  name: "billingAddress.state",
378
378
  label: t("address.state"),
379
379
  error: !1,
380
- placeholder: o,
380
+ placeholder: s,
381
381
  value: this._value,
382
382
  options: r,
383
383
  autocomplete: "address-level1",
384
- onChange: (s) => {
385
- this._value = s.target.value, this.emit("change", this._value);
384
+ onChange: (o) => {
385
+ this._value = o.target.value, this.emit("change", this._value);
386
386
  }
387
387
  }), this._select.addEventListener("blur", () => {
388
388
  this.emit("blur", this._value);
389
389
  }), this.shadowRoot.appendChild(this._select.getElement());
390
390
  }
391
391
  getCss() {
392
- return super.getCss() + [h, u, l, v].join(`
392
+ return super.getCss() + [f, m, p, S].join(`
393
393
  `) + `
394
394
  :host { display: block; }
395
395
  .form-input,
@@ -433,7 +433,7 @@ class O extends d {
433
433
  return null;
434
434
  }
435
435
  }
436
- class D extends d {
436
+ class G extends u {
437
437
  _value = "";
438
438
  _error = null;
439
439
  _input = null;
@@ -441,7 +441,7 @@ class D extends d {
441
441
  if (!this.shadowRoot) return;
442
442
  this._input?.getElement().remove();
443
443
  const { t: e } = a();
444
- this._input = new m({
444
+ this._input = new g({
445
445
  name: "billingAddress.street",
446
446
  label: e("address.street"),
447
447
  error: !1,
@@ -463,7 +463,7 @@ class D extends d {
463
463
  }), this.shadowRoot.appendChild(this._input.getElement());
464
464
  }
465
465
  getCss() {
466
- return super.getCss() + [h, u, l].join(`
466
+ return super.getCss() + [f, m, p].join(`
467
467
  `) + `
468
468
  :host { display: block; }
469
469
  .form-input {
@@ -504,7 +504,7 @@ class D extends d {
504
504
  return this._error;
505
505
  }
506
506
  }
507
- class Z extends d {
507
+ class U extends u {
508
508
  _value = "";
509
509
  _error = null;
510
510
  _input = null;
@@ -512,7 +512,7 @@ class Z extends d {
512
512
  if (!this.shadowRoot) return;
513
513
  this._input?.getElement().remove();
514
514
  const { t: e } = a();
515
- this._input = new m({
515
+ this._input = new g({
516
516
  name: "billingAddress.zipCode",
517
517
  label: e("address.zipCode"),
518
518
  error: !1,
@@ -528,7 +528,7 @@ class Z extends d {
528
528
  }), this.shadowRoot.appendChild(this._input.getElement());
529
529
  }
530
530
  getCss() {
531
- return super.getCss() + [h, u, l].join(`
531
+ return super.getCss() + [f, m, p].join(`
532
532
  `) + `
533
533
  :host { display: block; }
534
534
  .form-input {
@@ -569,7 +569,7 @@ class Z extends d {
569
569
  return this._error;
570
570
  }
571
571
  }
572
- const K = "apple-pay-button{-webkit-appearance:-apple-pay-button;-apple-pay-button-type:plain;-apple-pay-button-style:black;appearance:-apple-pay-button;height:40px;min-height:40px;border-radius:4px;cursor:pointer;display:inline-block;width:100%;box-sizing:border-box}apple-pay-button:hover{filter:brightness(.9)}", Q = {
572
+ const Q = "apple-pay-button{-webkit-appearance:-apple-pay-button;-apple-pay-button-type:plain;-apple-pay-button-style:black;appearance:-apple-pay-button;height:40px;min-height:40px;border-radius:4px;cursor:pointer;display:inline-block;width:100%;box-sizing:border-box}apple-pay-button:hover{filter:brightness(.9)}", W = {
573
573
  name: "odus-elements",
574
574
  styles: {
575
575
  fontSize: 14,
@@ -594,7 +594,7 @@ const K = "apple-pay-button{-webkit-appearance:-apple-pay-button;-apple-pay-butt
594
594
  },
595
595
  additionalPaymentMethods: {}
596
596
  };
597
- class U extends d {
597
+ class H extends u {
598
598
  _paymentContext = null;
599
599
  _applePayData = null;
600
600
  _authorized = !1;
@@ -609,29 +609,29 @@ class U extends d {
609
609
  paymentId: e,
610
610
  checkoutKey: t,
611
611
  environment: r,
612
- checkoutDetails: o,
613
- displayName: s,
612
+ checkoutDetails: s,
613
+ displayName: o,
614
614
  countries: i,
615
- requiredBillingContactFields: p,
616
- requiredShippingContactFields: _,
617
- onAuthorize: w
615
+ requiredBillingContactFields: n,
616
+ requiredShippingContactFields: l,
617
+ onAuthorize: h
618
618
  } = this._paymentContext;
619
- i?.length && o?.countryCode && !i.map((f) => f.toUpperCase()).includes(o.countryCode.toUpperCase()) || (this._button = new E({
620
- checkoutProfile: Q,
619
+ i?.length && s?.countryCode && !i.map((b) => b.toUpperCase()).includes(s.countryCode.toUpperCase()) || (this._button = new N({
620
+ checkoutProfile: W,
621
621
  paymentId: e,
622
622
  checkoutKey: t,
623
623
  environment: r,
624
- checkoutDetails: o,
625
- displayName: s,
626
- requiredBillingContactFields: p,
627
- requiredShippingContactFields: _,
628
- onSubmit: async ({ applePayData: f }) => {
629
- f && (this._applePayData = f, this._authorized = !0, this.emit("change", f), await w(f));
624
+ checkoutDetails: s,
625
+ displayName: o,
626
+ requiredBillingContactFields: n,
627
+ requiredShippingContactFields: l,
628
+ onSubmit: async ({ applePayData: b }) => {
629
+ b && (this._applePayData = b, this._authorized = !0, this.emit("change", b), await h(b));
630
630
  }
631
631
  }), this.shadowRoot.appendChild(this._button.getElement()));
632
632
  }
633
633
  getCss() {
634
- return super.getCss() + K + `
634
+ return super.getCss() + Q + `
635
635
  :host { display: block; }
636
636
  apple-pay-button {
637
637
  width: 100%;
@@ -650,7 +650,7 @@ class U extends d {
650
650
  return null;
651
651
  }
652
652
  }
653
- const G = '.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:18px;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:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:8px;pointer-events:none}.loading{position:relative}.loading:after{content:"";position:absolute;inset:0;height:100%;width:100%;background-color:#fff;border-radius:inherit}@media only screen and (min-width: 600px){.card-icon{width:20px}}.vgs-card-group iframe,.vgs-wrap iframe{width:100%;min-width:0;display:block}.fake-ph{position:absolute;inset:0;display:flex;align-items:center;padding:8px 12px;color:#717173;opacity:.3;font-size:var(--odus-input-font-size, 16px);font-weight:400;letter-spacing:.02em;line-height:1.5;font-family:var(--odus-font-family, inherit);background:#fff;pointer-events:none;user-select:none;white-space:nowrap;z-index:0}@keyframes vgs-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.vgs-field-skeleton{position:absolute;inset:0;background:linear-gradient(90deg,#f7f7f7 25%,#fdfdfd,#f7f7f7 75%);background-size:200% 100%;animation:vgs-shimmer 1.5s ease-in-out infinite;pointer-events:none;z-index:11;border-radius:inherit}', J = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpegirp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhECn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJEocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wtoAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJHDwIDAQAB", H = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gGPMwBRPuVyJReZGIkWH/+Bf5pnpDN1bSR2cLYLXVT8CaSnTw74qeboSnktgYCi1D9R3Bj2fYzTIwGGZb8KinLdxwbqZmHwrE9cFhCaHbG/E0PbqQGhXP2vbniZTT4M0i0Cbi7ES3Bw5zqNbIZZnX041QEpxLvIyWPKZCX+fBogNMhWfCF779aclChjHkwZMsufThVWE9xklWGxXiytx5aL4I5JPxq0I7cAkZGGs4aF/GxWwPaq7R3wPikJQ0YHnCMfcURzl2Hnw/inqyMy+JB6djTq2/BdzMAhWTh3cDWq9Xu+gEkb/QCd0n1yYIdKuDISlk/AfHdWe34IvzhVyQIDAQAB", W = {
653
+ const Y = '.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:18px;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:12px;top:50%;transform:translateY(-50%);display:flex;align-items:center;gap:8px;pointer-events:none}.loading{position:relative}.loading:after{content:"";position:absolute;inset:0;height:100%;width:100%;background-color:#fff;border-radius:inherit}@media only screen and (min-width: 600px){.card-icon{width:20px}}.vgs-card-group iframe,.vgs-wrap iframe{width:100%;min-width:0;display:block}.fake-ph{position:absolute;inset:0;display:flex;align-items:center;padding:8px 12px;color:#717173;opacity:.3;font-size:var(--odus-input-font-size, 16px);font-weight:400;letter-spacing:.02em;line-height:1.5;font-family:var(--odus-font-family, inherit);background:#fff;pointer-events:none;user-select:none;white-space:nowrap;z-index:0}@keyframes vgs-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.vgs-field-skeleton{position:absolute;inset:0;background:linear-gradient(90deg,#f7f7f7 25%,#fdfdfd,#f7f7f7 75%);background-size:200% 100%;animation:vgs-shimmer 1.5s ease-in-out infinite;pointer-events:none;z-index:11;border-radius:inherit}', $ = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpegirp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhECn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJEocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wtoAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJHDwIDAQAB", X = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gGPMwBRPuVyJReZGIkWH/+Bf5pnpDN1bSR2cLYLXVT8CaSnTw74qeboSnktgYCi1D9R3Bj2fYzTIwGGZb8KinLdxwbqZmHwrE9cFhCaHbG/E0PbqQGhXP2vbniZTT4M0i0Cbi7ES3Bw5zqNbIZZnX041QEpxLvIyWPKZCX+fBogNMhWfCF779aclChjHkwZMsufThVWE9xklWGxXiytx5aL4I5JPxq0I7cAkZGGs4aF/GxWwPaq7R3wPikJQ0YHnCMfcURzl2Hnw/inqyMy+JB6djTq2/BdzMAhWTh3cDWq9Xu+gEkb/QCd0n1yYIdKuDISlk/AfHdWe34IvzhVyQIDAQAB", c = {
654
654
  name: "odus-elements",
655
655
  styles: {
656
656
  fontSize: 14,
@@ -675,68 +675,347 @@ const G = '.card-element{position:relative;height:38.5px;transition:box-shadow .
675
675
  },
676
676
  additionalPaymentMethods: {}
677
677
  };
678
- class Y extends d {
678
+ class ee {
679
679
  _cardNumber = "";
680
680
  _cardExpiry = "";
681
681
  _cardCvv = "";
682
- _environment = "test";
683
682
  _section = null;
684
- _focusManager = new k();
683
+ _focusManager = new V();
685
684
  _touchedFields = /* @__PURE__ */ new Set();
686
685
  _focusHandlers = [];
687
- setEnvironment(e) {
688
- this._environment = e;
686
+ get section() {
687
+ return this._section;
689
688
  }
690
- render() {
691
- if (!this.shadowRoot) return;
689
+ renderSection(e, t, r) {
692
690
  this._section?.getElement().remove();
693
- const { t: e } = a();
694
- this._section = new z({
695
- checkoutProfile: W,
691
+ const { t: s } = a();
692
+ this._section = new k({
693
+ checkoutProfile: c,
696
694
  cardNumber: this._cardNumber,
697
695
  cardNumberTouched: !1,
698
696
  cardCvv: this._cardCvv,
699
697
  cardCvvTouched: !1,
700
698
  cardExpiry: this._cardExpiry,
701
699
  cardExpiryTouched: !1,
702
- translationFunc: e,
703
- onChange: (t) => {
704
- const r = t.target;
705
- if (r.name === "cardNumber")
706
- this._cardNumber = r.value;
707
- else if (r.name === "cardExpiry") {
708
- const o = N.cardExpiry(r.value);
709
- this._cardExpiry = o, this._section?.updateCardExpiry(o);
710
- } else r.name === "cardCvv" && (this._cardCvv = r.value);
711
- this._touchedFields.add(r.name), this._updateFocusManagerState(), this.emit("change", this.getValue());
700
+ translationFunc: s,
701
+ onChange: (o) => {
702
+ const i = o.target;
703
+ if (i.name === "cardNumber")
704
+ this._cardNumber = i.value;
705
+ else if (i.name === "cardExpiry") {
706
+ const n = P.cardExpiry(i.value);
707
+ this._cardExpiry = n, this._section?.updateCardExpiry(n);
708
+ } else i.name === "cardCvv" && (this._cardCvv = i.value);
709
+ this._touchedFields.add(i.name), this._updateFocusManagerState(), t(this.getValue());
712
710
  },
713
- onBlur: (t) => {
714
- const r = t.target, o = r.name ?? "cardExpiry", s = c();
715
- if (this._touchedFields.add(o), r.name === "cardNumber") {
716
- const i = s.cardNumber(this._cardNumber);
717
- this._section?.updateCardNumber(this._cardNumber, i, !0);
718
- } else if (r.name === "cardCvv") {
719
- const i = s.cardCvv(this._cardCvv, this._cardNumber);
720
- this._section?.updateCardCvv(this._cardCvv, i, !0);
711
+ onBlur: (o) => {
712
+ const i = o.target, n = i.name ?? "cardExpiry", l = _();
713
+ if (this._touchedFields.add(n), i.name === "cardNumber") {
714
+ const h = l.cardNumber(this._cardNumber);
715
+ this._section?.updateCardNumber(this._cardNumber, h, !0);
716
+ } else if (i.name === "cardCvv") {
717
+ const h = l.cardCvv(this._cardCvv, this._cardNumber);
718
+ this._section?.updateCardCvv(this._cardCvv, h, !0);
721
719
  } else {
722
- const i = s.cardExpiry(this._cardExpiry);
723
- this._section?.updateCardExpiry(this._cardExpiry, i, !0);
720
+ const h = l.cardExpiry(this._cardExpiry);
721
+ this._section?.updateCardExpiry(this._cardExpiry, h, !0);
724
722
  }
725
- this._updateFocusManagerState(), this.emit("blur", this.getValue());
723
+ this._updateFocusManagerState(), r(this.getValue());
724
+ }
725
+ }), e.appendChild(this._section.getElement()), this._registerFocusFields();
726
+ }
727
+ getValue() {
728
+ return {
729
+ number: this._cardNumber,
730
+ expiry: this._cardExpiry,
731
+ cvv: this._cardCvv
732
+ };
733
+ }
734
+ async getPayload(e) {
735
+ const t = e === "live" ? X : $, r = new F();
736
+ r.setPublicKey(t);
737
+ const s = this._cardNumber.replace(/\s+/g, ""), o = this._cardExpiry.replace(/\s+/g, "").split("/"), i = o[0] ?? "";
738
+ let n = o[1] ?? "";
739
+ return n.length === 2 && (n = `20${n}`), {
740
+ encryptedCardNumber: r.encrypt(s),
741
+ encryptedCvv: r.encrypt(this._cardCvv),
742
+ expMonth: i,
743
+ expYear: n
744
+ };
745
+ }
746
+ isValid() {
747
+ const e = _(), t = this._cardCvv.length >= 3;
748
+ return !e.cardNumber(this._cardNumber) && !e.cardExpiry(this._cardExpiry) && t;
749
+ }
750
+ getError() {
751
+ const e = _();
752
+ return e.cardNumber(this._cardNumber) ?? e.cardExpiry(this._cardExpiry) ?? null;
753
+ }
754
+ destroy() {
755
+ this._cleanupFocusHandlers(), this._section = null;
756
+ }
757
+ _registerFocusFields() {
758
+ if (this._cleanupFocusHandlers(), !this._section) return;
759
+ const e = this._section.getElement();
760
+ this._focusManager.registerField("cardNumber", {
761
+ focus: () => this._section?.focusField("cardNumber")
762
+ }), this._focusManager.registerField("cardExpiry", {
763
+ focus: () => this._section?.focusField("cardExpiry")
764
+ }), this._focusManager.registerField("cardCvv", {
765
+ focus: () => this._section?.focusField("cardCvv")
766
+ });
767
+ const t = ["cardNumber", "cardExpiry", "cardCvv"];
768
+ for (const r of t) {
769
+ const s = e.querySelector(`input[name="${r}"]`);
770
+ if (!s) continue;
771
+ const o = () => this._focusManager.handleFieldFocus(r);
772
+ s.addEventListener("focus", o), this._focusHandlers.push(
773
+ () => s.removeEventListener("focus", o)
774
+ );
775
+ }
776
+ }
777
+ _cleanupFocusHandlers() {
778
+ for (const e of this._focusHandlers)
779
+ e();
780
+ this._focusHandlers = [];
781
+ }
782
+ _updateFocusManagerState() {
783
+ const e = _(), t = {
784
+ cardNumber: this._cardNumber,
785
+ cardExpiry: this._cardExpiry,
786
+ cardCvv: this._cardCvv,
787
+ name: "",
788
+ email: ""
789
+ }, r = {}, s = e.cardNumber(this._cardNumber), o = e.cardExpiry(this._cardExpiry), i = e.cardCvv(this._cardCvv, this._cardNumber);
790
+ s && (r.cardNumber = s), o && (r.cardExpiry = o), i && (r.cardCvv = i);
791
+ const n = {};
792
+ for (const l of this._touchedFields)
793
+ n[l] = !0;
794
+ this._focusManager.handleStateUpdate(t, r, n);
795
+ }
796
+ }
797
+ class te {
798
+ _vgsService;
799
+ _vgsJwt;
800
+ _vgsState = {};
801
+ _vgsFieldsValid = !1;
802
+ _vgsReinitTimer = null;
803
+ _currentTheme = {};
804
+ _environment = "test";
805
+ _section = null;
806
+ constructor(e, t) {
807
+ this._vgsJwt = e, this._environment = t, this._vgsService = new y();
808
+ }
809
+ get section() {
810
+ return this._section;
811
+ }
812
+ renderSection(e, t) {
813
+ this._section?.getElement().remove();
814
+ const { t: r } = a();
815
+ this._section = new k({
816
+ checkoutProfile: c,
817
+ cardNumber: "",
818
+ cardNumberTouched: !1,
819
+ cardCvv: "",
820
+ cardCvvTouched: !1,
821
+ cardExpiry: "",
822
+ cardExpiryTouched: !1,
823
+ translationFunc: r,
824
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
825
+ onChange: () => {
826
+ },
827
+ // eslint-disable-next-line @typescript-eslint/no-empty-function
828
+ onBlur: () => {
829
+ },
830
+ vgsService: this._vgsService
831
+ }), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
832
+ }
833
+ _onChangeEmit = null;
834
+ initVgs() {
835
+ this._vgsService.init(this._environment).then((e) => {
836
+ this._vgsService.createForm(
837
+ e,
838
+ (t) => this._handleStateChange(t)
839
+ ), this._mountFields();
840
+ });
841
+ }
842
+ async getPayload() {
843
+ if (!this._vgsJwt)
844
+ throw new Error("VGS not initialized");
845
+ const e = await this._vgsService.createCard(this._vgsJwt);
846
+ return {
847
+ cardId: e.cardId,
848
+ expMonth: e.expMonth,
849
+ expYear: e.expYear,
850
+ name: e.name
851
+ };
852
+ }
853
+ isValid() {
854
+ return this._vgsFieldsValid;
855
+ }
856
+ getError() {
857
+ const { t: e } = a();
858
+ for (const [t, r] of Object.entries(this._vgsState)) {
859
+ if (!r?.isTouched || r.isFocused || r.isValid)
860
+ continue;
861
+ const s = r.errors?.[0];
862
+ if (!s) continue;
863
+ const o = w(t, s.code);
864
+ if (o) return e(o);
865
+ }
866
+ return null;
867
+ }
868
+ applyTheme(e) {
869
+ if (this._currentTheme = { ...this._currentTheme, ...e }, !this._section) return;
870
+ const t = this._buildProfileFromTheme(this._currentTheme), r = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
871
+ this._section.updateVgsWrapperStyles(
872
+ r,
873
+ t.styles.borderRadius
874
+ ), this._reinitWithTheme();
875
+ }
876
+ destroy() {
877
+ this._vgsReinitTimer && (clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = null), this._vgsService.destroy(), this._section = null;
878
+ }
879
+ _reinitWithTheme() {
880
+ this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
881
+ this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new y(), this.initVgs();
882
+ }, 300);
883
+ }
884
+ _buildProfileFromTheme(e) {
885
+ const t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? `${c.styles.fontSize}px`, r = e["--odus-font-family"] ?? c.styles.fontFamily, s = e["--odus-color-text"] ?? c.styles.textColor, o = e["--odus-border-radius"] ?? `${c.styles.borderRadius}px`;
886
+ return {
887
+ ...c,
888
+ styles: {
889
+ ...c.styles,
890
+ fontSize: parseInt(t, 10) || c.styles.fontSize,
891
+ fontFamily: r,
892
+ textColor: s,
893
+ borderRadius: parseInt(o, 10) || c.styles.borderRadius
894
+ }
895
+ };
896
+ }
897
+ async _mountFields() {
898
+ if (!this._section) return;
899
+ const e = Object.keys(this._currentTheme).length > 0 ? this._buildProfileFromTheme(this._currentTheme) : c, t = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
900
+ this._section.updateVgsWrapperStyles(
901
+ t,
902
+ e.styles.borderRadius
903
+ );
904
+ const r = this._section.getVgsContainerIds();
905
+ for (const n of Object.values(r)) {
906
+ if (!n) continue;
907
+ const l = document.getElementById(n);
908
+ l && l.querySelectorAll("iframe").forEach((h) => h.remove());
909
+ }
910
+ const s = await A(e.styles.fontFamily), o = this._section.buildVgsFieldCss(e, s, {
911
+ borderColor: t,
912
+ backgroundColor: this._currentTheme["--odus-color-background"],
913
+ placeholderColor: this._currentTheme["--odus-input-placeholder-color"],
914
+ placeholderOpacity: this._currentTheme["--odus-input-placeholder-opacity"],
915
+ padding: this._currentTheme["--odus-input-padding"]
916
+ }), { t: i } = a();
917
+ this._vgsService.mountCardFields(
918
+ {
919
+ cardNumber: r.cardNumber ? `#${r.cardNumber}` : void 0,
920
+ cardExpiry: r.cardExpiry ? `#${r.cardExpiry}` : void 0,
921
+ cardCvv: r.cardCvv ? `#${r.cardCvv}` : void 0
922
+ },
923
+ o,
924
+ {
925
+ cardNumber: "1234 5678 9012 3456",
926
+ cardExpiry: i("cardExpiry"),
927
+ cardCvv: "CVV",
928
+ cardholderName: i("cardholderName")
929
+ },
930
+ (n) => {
931
+ this._section?.updateVgsCardBrand(n);
726
932
  }
727
- }), this.shadowRoot.appendChild(this._section.getElement()), this._registerFocusFields();
933
+ ), this._vgsService.waitForFieldsReady().then(() => {
934
+ this._section?.hideFakePlaceholders();
935
+ });
936
+ }
937
+ _handleStateChange(e) {
938
+ this._vgsState = e, this._vgsFieldsValid = Object.values(e).every(
939
+ (s) => s?.isValid === !0
940
+ );
941
+ const { t } = a(), r = this._deriveFieldErrors(t);
942
+ this._section?.handleVgsStateChange(e, r), this._onChangeEmit?.();
943
+ }
944
+ _deriveFieldErrors(e) {
945
+ const t = {};
946
+ for (const [r, s] of Object.entries(this._vgsState)) {
947
+ if (!s?.isTouched || s.isFocused || s.isValid)
948
+ continue;
949
+ const o = s.errors?.[0];
950
+ if (!o) continue;
951
+ const i = w(r, o.code);
952
+ i && (t[r] = e(i));
953
+ }
954
+ return t;
955
+ }
956
+ }
957
+ class re extends u {
958
+ _environment = "test";
959
+ _isVgsMode = !1;
960
+ _mountContainer = null;
961
+ _nativeAdapter = new ee();
962
+ _vgsAdapter = null;
963
+ get isVgsMode() {
964
+ return this._isVgsMode;
965
+ }
966
+ setEnvironment(e) {
967
+ this._environment = e;
968
+ }
969
+ setVgsJwt(e) {
970
+ this._isVgsMode = !0, this._vgsAdapter = new te(e, this._environment), this.isMounted && this._mountContainer && (this.unmount(), this.mount(this._mountContainer));
971
+ }
972
+ mount(e) {
973
+ this.isMounted && this.unmount();
974
+ const t = typeof e == "string" ? document.querySelector(e) : e;
975
+ if (!t)
976
+ throw new Error(
977
+ `[CardElement] mount target not found: ${String(e)}`
978
+ );
979
+ if (this._mountContainer = e, this._isVgsMode) {
980
+ this.host = document.createElement("div");
981
+ const r = document.createElement("style");
982
+ r.textContent = this.getCss(), this.host.appendChild(r), t.appendChild(this.host), this.render(), this._vgsAdapter?.initVgs(), this.emit("ready");
983
+ } else
984
+ super.mount(e);
985
+ }
986
+ unmount() {
987
+ this._isVgsMode ? (this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null) : super.unmount();
988
+ }
989
+ render() {
990
+ if (this._isVgsMode) {
991
+ if (!this.host || !this._vgsAdapter) return;
992
+ this._vgsAdapter.renderSection(
993
+ this.host,
994
+ () => this.emit("change", this.getValue())
995
+ );
996
+ } else {
997
+ if (!this.shadowRoot) return;
998
+ this._nativeAdapter.renderSection(
999
+ this.shadowRoot,
1000
+ (e) => this.emit("change", e),
1001
+ (e) => this.emit("blur", e)
1002
+ );
1003
+ }
728
1004
  }
729
1005
  focus() {
730
- this._section?.focus();
1006
+ (this._isVgsMode ? this._vgsAdapter?.section : this._nativeAdapter.section)?.focus();
731
1007
  }
732
1008
  focusField(e) {
733
- this._section?.focusField(e);
1009
+ (this._isVgsMode ? this._vgsAdapter?.section : this._nativeAdapter.section)?.focusField(e);
734
1010
  }
735
1011
  destroy() {
736
- this._cleanupFocusHandlers(), super.destroy();
1012
+ this._nativeAdapter.destroy(), this._vgsAdapter?.destroy(), this._vgsAdapter = null, super.destroy();
1013
+ }
1014
+ setTheme(e) {
1015
+ super.setTheme(e), !(!this._isVgsMode || !this._vgsAdapter) && this._vgsAdapter.applyTheme(e);
737
1016
  }
738
1017
  getCss() {
739
- return super.getCss() + [h, u, l, G].join(`
1018
+ return super.getCss() + [f, m, p, Y].join(`
740
1019
  `) + `
741
1020
  :host { display: block; }
742
1021
  .card-grid {
@@ -780,73 +1059,24 @@ class Y extends d {
780
1059
  `;
781
1060
  }
782
1061
  getValue() {
783
- return {
784
- number: this._cardNumber,
785
- expiry: this._cardExpiry,
786
- cvv: this._cardCvv
787
- };
1062
+ return this._isVgsMode ? { number: "", expiry: "", cvv: "" } : this._nativeAdapter.getValue();
788
1063
  }
789
- getPayload() {
790
- const e = this._environment === "live" ? H : J, t = new P();
791
- t.setPublicKey(e);
792
- const r = this._cardNumber.replace(/\s+/g, ""), o = this._cardExpiry.replace(/\s+/g, "").split("/"), s = o[0] ?? "";
793
- let i = o[1] ?? "";
794
- return i.length === 2 && (i = `20${i}`), {
795
- encryptedCardNumber: t.encrypt(r),
796
- encryptedCvv: t.encrypt(this._cardCvv),
797
- expMonth: s,
798
- expYear: i
799
- };
1064
+ async getPayload() {
1065
+ if (this._isVgsMode) {
1066
+ if (!this._vgsAdapter)
1067
+ throw new Error("VGS not initialized");
1068
+ return this._vgsAdapter.getPayload();
1069
+ }
1070
+ return this._nativeAdapter.getPayload(this._environment);
800
1071
  }
801
1072
  getIsValid() {
802
- const e = c(), t = this._cardCvv.length >= 3;
803
- return !e.cardNumber(this._cardNumber) && !e.cardExpiry(this._cardExpiry) && t;
1073
+ return this._isVgsMode ? this._vgsAdapter?.isValid() ?? !1 : this._nativeAdapter.isValid();
804
1074
  }
805
1075
  getError() {
806
- const e = c();
807
- return e.cardNumber(this._cardNumber) ?? e.cardExpiry(this._cardExpiry) ?? null;
808
- }
809
- _registerFocusFields() {
810
- if (this._cleanupFocusHandlers(), !this._section) return;
811
- const e = this._section.getElement();
812
- this._focusManager.registerField("cardNumber", {
813
- focus: () => this._section?.focusField("cardNumber")
814
- }), this._focusManager.registerField("cardExpiry", {
815
- focus: () => this._section?.focusField("cardExpiry")
816
- }), this._focusManager.registerField("cardCvv", {
817
- focus: () => this._section?.focusField("cardCvv")
818
- });
819
- const t = ["cardNumber", "cardExpiry", "cardCvv"];
820
- for (const r of t) {
821
- const o = e.querySelector(`input[name="${r}"]`);
822
- if (!o) continue;
823
- const s = () => this._focusManager.handleFieldFocus(r);
824
- o.addEventListener("focus", s), this._focusHandlers.push(
825
- () => o.removeEventListener("focus", s)
826
- );
827
- }
828
- }
829
- _cleanupFocusHandlers() {
830
- for (const e of this._focusHandlers)
831
- e();
832
- this._focusHandlers = [];
833
- }
834
- _updateFocusManagerState() {
835
- const e = c(), t = {
836
- cardNumber: this._cardNumber,
837
- cardExpiry: this._cardExpiry,
838
- cardCvv: this._cardCvv,
839
- name: "",
840
- email: ""
841
- }, r = {}, o = e.cardNumber(this._cardNumber), s = e.cardExpiry(this._cardExpiry), i = e.cardCvv(this._cardCvv, this._cardNumber);
842
- o && (r.cardNumber = o), s && (r.cardExpiry = s), i && (r.cardCvv = i);
843
- const p = {};
844
- for (const _ of this._touchedFields)
845
- p[_] = !0;
846
- this._focusManager.handleStateUpdate(t, r, p);
1076
+ return this._isVgsMode ? this._vgsAdapter?.getError() ?? null : this._nativeAdapter.getError();
847
1077
  }
848
1078
  }
849
- class X extends d {
1079
+ class se extends u {
850
1080
  _value = "";
851
1081
  _error = null;
852
1082
  _input = null;
@@ -854,7 +1084,7 @@ class X extends d {
854
1084
  if (!this.shadowRoot) return;
855
1085
  this._input?.getElement().remove();
856
1086
  const { t: e } = a();
857
- this._input = new m({
1087
+ this._input = new g({
858
1088
  name: "billingAddress.cardholderName",
859
1089
  label: e("cardholderNameLabel"),
860
1090
  error: !1,
@@ -862,8 +1092,8 @@ class X extends d {
862
1092
  value: this._value,
863
1093
  autocomplete: "cc-name",
864
1094
  onChange: (t) => {
865
- const o = t.target.value, s = o.replace(/[^a-zA-Z\s\-'.]/g, "");
866
- o !== s && this._input?.setValue(s), this._value = s, this._error = null, this.emit("change", this._value);
1095
+ const s = t.target.value, o = s.replace(/[^a-zA-Z\s\-'.]/g, "");
1096
+ s !== o && this._input?.setValue(o), this._value = o, this._error = null, this.emit("change", this._value);
867
1097
  }
868
1098
  }), this._input.addEventListener("blur", () => {
869
1099
  const { t } = a();
@@ -871,7 +1101,7 @@ class X extends d {
871
1101
  }), this.shadowRoot.appendChild(this._input.getElement());
872
1102
  }
873
1103
  getCss() {
874
- return super.getCss() + [h, u, l].join(`
1104
+ return super.getCss() + [f, m, p].join(`
875
1105
  `) + `
876
1106
  :host { display: block; }
877
1107
  .form-input {
@@ -912,7 +1142,7 @@ class X extends d {
912
1142
  return this._error;
913
1143
  }
914
1144
  }
915
- const $ = {
1145
+ const oe = {
916
1146
  name: "odus-elements",
917
1147
  styles: {
918
1148
  fontSize: 14,
@@ -937,7 +1167,7 @@ const $ = {
937
1167
  },
938
1168
  additionalPaymentMethods: {}
939
1169
  };
940
- class ee extends d {
1170
+ class ie extends u {
941
1171
  _email = "";
942
1172
  _error = null;
943
1173
  _field = null;
@@ -945,23 +1175,23 @@ class ee extends d {
945
1175
  if (!this.shadowRoot) return;
946
1176
  this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
947
1177
  const { t: e } = a();
948
- this._field = new S({
1178
+ this._field = new R({
949
1179
  value: this._email,
950
1180
  error: !1,
951
- checkoutProfile: $,
1181
+ checkoutProfile: oe,
952
1182
  translationFunc: e,
953
1183
  onChange: (t) => {
954
1184
  const r = t.target;
955
1185
  this._email = r.value ?? this._field?.getValue() ?? "", this._error = null, this.emit("change", this._email);
956
1186
  },
957
1187
  onBlur: () => {
958
- const t = c();
1188
+ const t = _();
959
1189
  this._error = t.email(this._email) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._email);
960
1190
  }
961
1191
  }), this.shadowRoot.appendChild(this._field.getElement());
962
1192
  }
963
1193
  getCss() {
964
- return super.getCss() + [h, u, l].join(`
1194
+ return super.getCss() + [f, m, p].join(`
965
1195
  `) + `
966
1196
  :host { display: block; }
967
1197
  .form-input {
@@ -996,31 +1226,31 @@ class ee extends d {
996
1226
  return this._email;
997
1227
  }
998
1228
  getIsValid() {
999
- return !c().email(this._email);
1229
+ return !_().email(this._email);
1000
1230
  }
1001
1231
  getError() {
1002
1232
  return this._error;
1003
1233
  }
1004
1234
  }
1005
- const te = "@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-family:var(--odus-font-family, inherit);font-size:14px;color:#7f1d1d;line-height:1.5;word-break:break-word}";
1006
- class re extends d {
1235
+ const ae = "@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-family:var(--odus-font-family, inherit);font-size:14px;color:#7f1d1d;line-height:1.5;word-break:break-word}";
1236
+ class ne extends u {
1007
1237
  _alert = null;
1008
1238
  _message = null;
1009
1239
  render() {
1010
- this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new x({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
1240
+ this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new C({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
1011
1241
  }
1012
1242
  setError(e) {
1013
1243
  if (this._message = e, !this.shadowRoot) {
1014
1244
  this.emit("error", e);
1015
1245
  return;
1016
1246
  }
1017
- this._alert ? this._alert.setMessage(e) : (this._alert = new x({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
1247
+ this._alert ? this._alert.setMessage(e) : (this._alert = new C({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
1018
1248
  }
1019
1249
  clearError() {
1020
1250
  this._message = null, this._alert?.getElement().remove(), this._alert = null;
1021
1251
  }
1022
1252
  getCss() {
1023
- return super.getCss() + te + `
1253
+ return super.getCss() + ae + `
1024
1254
  :host { display: block; }
1025
1255
  .error-alert-icon,
1026
1256
  .error-alert-icon-container {
@@ -1041,7 +1271,7 @@ class re extends d {
1041
1271
  return this._message;
1042
1272
  }
1043
1273
  }
1044
- const oe = ".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}", se = {
1274
+ const de = ".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}", le = {
1045
1275
  name: "odus-elements",
1046
1276
  styles: {
1047
1277
  fontSize: 14,
@@ -1066,7 +1296,7 @@ const oe = ".paypal{background-color:#ffc439;color:#253b80;font-weight:700;paddi
1066
1296
  },
1067
1297
  additionalPaymentMethods: {}
1068
1298
  };
1069
- class ie extends d {
1299
+ class ue extends u {
1070
1300
  _paymentContext = null;
1071
1301
  _button = null;
1072
1302
  setPaymentContext(e) {
@@ -1075,8 +1305,8 @@ class ie extends d {
1075
1305
  render() {
1076
1306
  if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
1077
1307
  const { onAuthorize: e } = this._paymentContext;
1078
- this._button = new F({
1079
- checkoutProfile: se,
1308
+ this._button = new M({
1309
+ checkoutProfile: le,
1080
1310
  onSubmit: async () => {
1081
1311
  this._button?.setSubmitting(!0);
1082
1312
  try {
@@ -1088,7 +1318,7 @@ class ie extends d {
1088
1318
  }), this.shadowRoot.appendChild(this._button.getElement());
1089
1319
  }
1090
1320
  getCss() {
1091
- return super.getCss() + oe + `
1321
+ return super.getCss() + de + `
1092
1322
  :host { display: block; }
1093
1323
  .paypal {
1094
1324
  width: 100%;
@@ -1110,7 +1340,7 @@ class ie extends d {
1110
1340
  return null;
1111
1341
  }
1112
1342
  }
1113
- const ae = ".country-dial-code-dropdown{position:relative;display:inline-block}.country-dial-code-trigger{display:flex;align-items:center;gap:6px;padding:var(--odus-input-padding, 8px 12px);padding-right:8px;background:#fff;border:none;cursor:pointer;font-weight:400;letter-spacing:.02em;line-height:var(--odus-input-line-height, 1.5);transition:all .1s ease-in;white-space:nowrap;border-right:1px solid #e0e0e0;box-sizing:border-box}.country-dial-code-trigger:hover{background:#f5f5f5}.country-dial-code-trigger:focus{outline:none}.country-dial-code-trigger .country-flag{font-size:14px;line-height:1}.country-dial-code-trigger .country-chevron{color:#717173;flex-shrink:0;transition:transform .15s ease}.country-dial-code-trigger[aria-expanded=true] .country-chevron{transform:rotate(180deg)}.country-dial-code-panel{position:fixed;top:0;left:0;z-index:10000;width:280px;background:#fff;border-radius:8px;box-shadow:0 0 0 1px #0000000d,0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f;max-height:360px;display:flex;flex-direction:column;overflow:hidden}.country-dial-code-panel.hidden{display:none}.country-search-wrapper{padding:12px;border-bottom:1px solid #e0e0e0;flex-shrink:0}.country-search{width:100%;padding:6px 12px;border:1px solid #e0e0e0;border-radius:6px;font-size:inherit;font-family:inherit;outline:none;transition:all .1s ease-in;box-sizing:border-box}.country-search:focus{border-color:#3297d3b3;box-shadow:0 0 0 3px #3297d31a}.country-search::placeholder{color:#717173;opacity:.6}.countries-list{overflow-y:auto;flex:1;min-height:0}.countries-list::-webkit-scrollbar{width:8px}.countries-list::-webkit-scrollbar-track{background:#f5f5f5}.countries-list::-webkit-scrollbar-thumb{background:#d0d0d0;border-radius:4px}.countries-list::-webkit-scrollbar-thumb:hover{background:#b0b0b0}.country-group-header{padding:8px 16px 4px;font-size:12px;font-weight:600;color:#717173;text-transform:uppercase;letter-spacing:.05em;background:#fafafa;position:sticky;top:0;z-index:1}.country-item{display:flex;align-items:center;gap:12px;padding:10px 16px;width:100%;border:none;background:#fff;cursor:pointer;transition:background .1s ease;text-align:left;font-size:14px;font-family:inherit;color:inherit}.country-item:hover{background:#f5f5f5}.country-item.selected{background:#3297d314;color:#3297d3}.country-item:focus{outline:none;background:#f0f0f0}.country-item .country-flag{font-size:20px;line-height:1;flex-shrink:0}.country-item .country-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.country-item .country-dial-code{color:#717173;font-size:.95em;flex-shrink:0}.country-item.selected .country-dial-code{color:#3297d3cc}.no-results{padding:24px 16px;text-align:center;color:#717173;font-size:14px}.phone-number-field-wrapper{display:flex;width:100%}.phone-number-field-container{display:flex;align-items:center;width:100%;border-radius:inherit;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;position:relative}.phone-number-field-container.focused{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;z-index:2}.phone-number-field-container.error{box-shadow:0 0 0 1px #dc2727,0 2px 4px #dc27271a}.phone-number-field-container.error.focused{box-shadow:0 0 0 1px #dc2727,0 1px 1px #00000012,0 0 0 4px #dc272733}.phone-number-field-container .country-select-wrapper{flex-shrink:0;position:relative;display:flex;align-items:center;gap:4px;padding:var(--odus-input-padding, 8px 12px);padding-right:6px;background:transparent;border-top-left-radius:var(--phone-border-radius, 0px);border-bottom-left-radius:var(--phone-border-radius, 0px);white-space:nowrap}.phone-number-field-container .country-select-wrapper .country-flag{font-size:14px;line-height:1;pointer-events:none}.phone-number-field-container .country-select-wrapper .country-chevron{display:flex;align-items:center;color:#717173;flex-shrink:0;pointer-events:none}.phone-number-field-container .country-select-wrapper .country-select{position:absolute;inset:0;border:none;outline:none;background:transparent;cursor:pointer;opacity:0;width:100%;height:100%}.phone-number-field-container .phone-input-wrapper{flex:1;min-width:0}.phone-number-field-container .phone-input-wrapper .form-input{border:none;box-shadow:none;border-radius:0;border-top-right-radius:var(--phone-border-radius, 0px);border-bottom-right-radius:var(--phone-border-radius, 0px);padding:var(--odus-input-padding, 8px 2px)}.phone-number-field-container .phone-input-wrapper .form-input:focus{box-shadow:none;z-index:auto}", ne = {
1343
+ const he = ".country-dial-code-dropdown{position:relative;display:inline-block}.country-dial-code-trigger{display:flex;align-items:center;gap:6px;padding:var(--odus-input-padding, 8px 12px);padding-right:8px;background:#fff;border:none;cursor:pointer;font-weight:400;letter-spacing:.02em;line-height:var(--odus-input-line-height, 1.5);transition:all .1s ease-in;white-space:nowrap;border-right:1px solid #e0e0e0;box-sizing:border-box}.country-dial-code-trigger:hover{background:#f5f5f5}.country-dial-code-trigger:focus{outline:none}.country-dial-code-trigger .country-flag{font-size:14px;line-height:1}.country-dial-code-trigger .country-chevron{color:#717173;flex-shrink:0;transition:transform .15s ease}.country-dial-code-trigger[aria-expanded=true] .country-chevron{transform:rotate(180deg)}.country-dial-code-panel{position:fixed;top:0;left:0;z-index:10000;width:280px;background:#fff;border-radius:8px;box-shadow:0 0 0 1px #0000000d,0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f;max-height:360px;display:flex;flex-direction:column;overflow:hidden}.country-dial-code-panel.hidden{display:none}.country-search-wrapper{padding:12px;border-bottom:1px solid #e0e0e0;flex-shrink:0}.country-search{width:100%;padding:6px 12px;border:1px solid #e0e0e0;border-radius:6px;font-size:inherit;font-family:inherit;outline:none;transition:all .1s ease-in;box-sizing:border-box}.country-search:focus{border-color:#3297d3b3;box-shadow:0 0 0 3px #3297d31a}.country-search::placeholder{color:#717173;opacity:.6}.countries-list{overflow-y:auto;flex:1;min-height:0}.countries-list::-webkit-scrollbar{width:8px}.countries-list::-webkit-scrollbar-track{background:#f5f5f5}.countries-list::-webkit-scrollbar-thumb{background:#d0d0d0;border-radius:4px}.countries-list::-webkit-scrollbar-thumb:hover{background:#b0b0b0}.country-group-header{padding:8px 16px 4px;font-size:12px;font-weight:600;color:#717173;text-transform:uppercase;letter-spacing:.05em;background:#fafafa;position:sticky;top:0;z-index:1}.country-item{display:flex;align-items:center;gap:12px;padding:10px 16px;width:100%;border:none;background:#fff;cursor:pointer;transition:background .1s ease;text-align:left;font-size:14px;font-family:inherit;color:inherit}.country-item:hover{background:#f5f5f5}.country-item.selected{background:#3297d314;color:#3297d3}.country-item:focus{outline:none;background:#f0f0f0}.country-item .country-flag{font-size:20px;line-height:1;flex-shrink:0}.country-item .country-name{flex:1;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.country-item .country-dial-code{color:#717173;font-size:.95em;flex-shrink:0}.country-item.selected .country-dial-code{color:#3297d3cc}.no-results{padding:24px 16px;text-align:center;color:#717173;font-size:14px}.phone-number-field-wrapper{display:flex;width:100%}.phone-number-field-container{display:flex;align-items:center;width:100%;border-radius:inherit;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;position:relative}.phone-number-field-container.focused{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d;z-index:2}.phone-number-field-container.error{box-shadow:0 0 0 1px #dc2727,0 2px 4px #dc27271a}.phone-number-field-container.error.focused{box-shadow:0 0 0 1px #dc2727,0 1px 1px #00000012,0 0 0 4px #dc272733}.phone-number-field-container .country-select-wrapper{flex-shrink:0;position:relative;display:flex;align-items:center;gap:4px;padding:var(--odus-input-padding, 8px 12px);padding-right:6px;background:transparent;border-top-left-radius:var(--phone-border-radius, 0px);border-bottom-left-radius:var(--phone-border-radius, 0px);white-space:nowrap}.phone-number-field-container .country-select-wrapper .country-flag{font-size:14px;line-height:1;pointer-events:none}.phone-number-field-container .country-select-wrapper .country-chevron{display:flex;align-items:center;color:#717173;flex-shrink:0;pointer-events:none}.phone-number-field-container .country-select-wrapper .country-select{position:absolute;inset:0;border:none;outline:none;background:transparent;cursor:pointer;opacity:0;width:100%;height:100%}.phone-number-field-container .phone-input-wrapper{flex:1;min-width:0}.phone-number-field-container .phone-input-wrapper .form-input{border:none;box-shadow:none;border-radius:0;border-top-right-radius:var(--phone-border-radius, 0px);border-bottom-right-radius:var(--phone-border-radius, 0px);padding:var(--odus-input-padding, 8px 2px)}.phone-number-field-container .phone-input-wrapper .form-input:focus{box-shadow:none;z-index:auto}", ce = {
1114
1344
  name: "odus-elements",
1115
1345
  styles: {
1116
1346
  fontSize: 14,
@@ -1135,7 +1365,7 @@ const ae = ".country-dial-code-dropdown{position:relative;display:inline-block}.
1135
1365
  },
1136
1366
  additionalPaymentMethods: {}
1137
1367
  };
1138
- class de extends d {
1368
+ class pe extends u {
1139
1369
  _phone = "";
1140
1370
  _error = null;
1141
1371
  _field = null;
@@ -1144,28 +1374,28 @@ class de extends d {
1144
1374
  if (!this.shadowRoot) return;
1145
1375
  this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
1146
1376
  const e = ++this._renderGeneration;
1147
- R().then(({ PhoneNumberField: t }) => {
1377
+ T().then(({ PhoneNumberField: t }) => {
1148
1378
  if (!this.shadowRoot || this._renderGeneration !== e) return;
1149
- const { t: r, locale: o } = a();
1379
+ const { t: r, locale: s } = a();
1150
1380
  this._field = new t({
1151
1381
  value: this._phone,
1152
1382
  error: !1,
1153
- checkoutProfile: ne,
1383
+ checkoutProfile: ce,
1154
1384
  translationFunc: r,
1155
- locale: o,
1385
+ locale: s,
1156
1386
  onChange: () => {
1157
1387
  this._phone = this._field?.getValue() ?? "", this._error = null, this.emit("change", this._phone);
1158
1388
  },
1159
1389
  onBlur: () => {
1160
1390
  this._phone = this._field?.getValue() ?? "";
1161
- const s = c(), i = this._field?.getCountry();
1162
- this._error = s.phoneNumber(this._phone, i) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
1391
+ const o = _(), i = this._field?.getCountry();
1392
+ this._error = o.phoneNumber(this._phone, i) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
1163
1393
  }
1164
1394
  }), this.shadowRoot.appendChild(this._field.getElement());
1165
1395
  });
1166
1396
  }
1167
1397
  getCss() {
1168
- return super.getCss() + [h, u, l, ae].join(`
1398
+ return super.getCss() + [f, m, p, he].join(`
1169
1399
  `) + `
1170
1400
  :host { display: block; }
1171
1401
  .form-input,
@@ -1213,14 +1443,14 @@ class de extends d {
1213
1443
  return this._phone;
1214
1444
  }
1215
1445
  getIsValid() {
1216
- const e = c(), t = this._field?.getCountry();
1446
+ const e = _(), t = this._field?.getCountry();
1217
1447
  return !e.phoneNumber(this._phone, t);
1218
1448
  }
1219
1449
  getError() {
1220
1450
  return this._error;
1221
1451
  }
1222
1452
  }
1223
- class ue {
1453
+ class fe {
1224
1454
  _config;
1225
1455
  _apiService;
1226
1456
  _changeListeners = [];
@@ -1243,21 +1473,21 @@ class ue {
1243
1473
  _error;
1244
1474
  elements;
1245
1475
  constructor(e) {
1246
- this._config = e, this._callbacks = { ...e.callbacks }, e.locale && A.setLocale(e.locale), this._apiService = new V(
1476
+ this._config = e, this._callbacks = { ...e.callbacks }, e.locale && I.setLocale(e.locale), this._apiService = new B(
1247
1477
  e.apiKey,
1248
1478
  e.environment
1249
1479
  );
1250
1480
  const t = {};
1251
1481
  Object.defineProperty(t, "email", {
1252
- get: () => (this._email || (this._email = new ee(), this._trackElement(this._email)), this._email),
1482
+ get: () => (this._email || (this._email = new ie(), this._trackElement(this._email)), this._email),
1253
1483
  enumerable: !0
1254
1484
  }), Object.defineProperty(t, "phone", {
1255
- get: () => (this._phone || (this._phone = new de(), this._trackElement(this._phone)), this._phone),
1485
+ get: () => (this._phone || (this._phone = new pe(), this._trackElement(this._phone)), this._phone),
1256
1486
  enumerable: !0
1257
1487
  });
1258
1488
  const r = {};
1259
1489
  Object.defineProperty(r, "applePay", {
1260
- get: () => (this._applePay || (this._applePay = new U(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
1490
+ get: () => (this._applePay || (this._applePay = new H(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
1261
1491
  paymentId: this._paymentState.paymentId,
1262
1492
  checkoutKey: this._paymentState.checkoutKey,
1263
1493
  environment: this._config.environment,
@@ -1267,58 +1497,58 @@ class ue {
1267
1497
  })), this._applePay),
1268
1498
  enumerable: !0
1269
1499
  }), Object.defineProperty(r, "payPal", {
1270
- get: () => (this._paypal || (this._paypal = new ie(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
1500
+ get: () => (this._paypal || (this._paypal = new ue(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
1271
1501
  paymentId: this._paymentState.paymentId,
1272
1502
  checkoutKey: this._paymentState.checkoutKey,
1273
1503
  onAuthorize: () => this._executeAuthorization({ formData: null })
1274
1504
  })), this._paypal),
1275
1505
  enumerable: !0
1276
1506
  });
1277
- const o = {};
1278
- Object.defineProperty(o, "street", {
1279
- get: () => (this._addressStreet || (this._addressStreet = new D(), this._trackElement(this._addressStreet)), this._addressStreet),
1507
+ const s = {};
1508
+ Object.defineProperty(s, "street", {
1509
+ get: () => (this._addressStreet || (this._addressStreet = new G(), this._trackElement(this._addressStreet)), this._addressStreet),
1280
1510
  enumerable: !0
1281
- }), Object.defineProperty(o, "firstName", {
1282
- get: () => (this._addressFirstName || (this._addressFirstName = new j(), this._trackElement(this._addressFirstName)), this._addressFirstName),
1511
+ }), Object.defineProperty(s, "firstName", {
1512
+ get: () => (this._addressFirstName || (this._addressFirstName = new J(), this._trackElement(this._addressFirstName)), this._addressFirstName),
1283
1513
  enumerable: !0
1284
- }), Object.defineProperty(o, "lastName", {
1285
- get: () => (this._addressLastName || (this._addressLastName = new q(), this._trackElement(this._addressLastName)), this._addressLastName),
1514
+ }), Object.defineProperty(s, "lastName", {
1515
+ get: () => (this._addressLastName || (this._addressLastName = new K(), this._trackElement(this._addressLastName)), this._addressLastName),
1286
1516
  enumerable: !0
1287
- }), Object.defineProperty(o, "city", {
1288
- get: () => (this._addressCity || (this._addressCity = new L(), this._trackElement(this._addressCity)), this._addressCity),
1517
+ }), Object.defineProperty(s, "city", {
1518
+ get: () => (this._addressCity || (this._addressCity = new q(), this._trackElement(this._addressCity)), this._addressCity),
1289
1519
  enumerable: !0
1290
- }), Object.defineProperty(o, "state", {
1291
- get: () => (this._addressState || (this._addressState = new O(), this._trackElement(this._addressState)), this._addressState),
1520
+ }), Object.defineProperty(s, "state", {
1521
+ get: () => (this._addressState || (this._addressState = new Z(), this._trackElement(this._addressState)), this._addressState),
1292
1522
  enumerable: !0
1293
- }), Object.defineProperty(o, "zipCode", {
1294
- get: () => (this._addressZipCode || (this._addressZipCode = new Z(), this._trackElement(this._addressZipCode)), this._addressZipCode),
1523
+ }), Object.defineProperty(s, "zipCode", {
1524
+ get: () => (this._addressZipCode || (this._addressZipCode = new U(), this._trackElement(this._addressZipCode)), this._addressZipCode),
1295
1525
  enumerable: !0
1296
- }), Object.defineProperty(o, "country", {
1297
- get: () => (this._addressCountry || (this._addressCountry = new T(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (i) => {
1526
+ }), Object.defineProperty(s, "country", {
1527
+ get: () => (this._addressCountry || (this._addressCountry = new D(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (i) => {
1298
1528
  this._addressState?.setCountry(i);
1299
1529
  })), this._addressCountry),
1300
1530
  enumerable: !0
1301
1531
  });
1302
- const s = { contact: t, express: r };
1303
- Object.defineProperty(s, "card", {
1304
- get: () => (this._card || (this._card = new Y(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card)), this._card),
1532
+ const o = { contact: t, express: r };
1533
+ Object.defineProperty(o, "card", {
1534
+ get: () => (this._card || (this._card = new re(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._paymentState.vgsJwt && this._card.setVgsJwt(this._paymentState.vgsJwt)), this._card),
1305
1535
  enumerable: !0
1306
- }), Object.defineProperty(s, "cardholderName", {
1307
- get: () => (this._cardholderName || (this._cardholderName = new X(), this._trackElement(this._cardholderName)), this._cardholderName),
1536
+ }), Object.defineProperty(o, "cardholderName", {
1537
+ get: () => (this._cardholderName || (this._cardholderName = new se(), this._trackElement(this._cardholderName)), this._cardholderName),
1308
1538
  enumerable: !0
1309
- }), Object.defineProperty(s, "address", {
1310
- get: () => o,
1539
+ }), Object.defineProperty(o, "address", {
1540
+ get: () => s,
1311
1541
  enumerable: !0
1312
- }), Object.defineProperty(s, "error", {
1313
- get: () => (this._error || (this._error = new re(), this._trackElement(this._error)), this._error),
1542
+ }), Object.defineProperty(o, "error", {
1543
+ get: () => (this._error || (this._error = new ne(), this._trackElement(this._error)), this._error),
1314
1544
  enumerable: !0
1315
- }), this.elements = s;
1545
+ }), this.elements = o;
1316
1546
  }
1317
1547
  async associatePayment(e, t) {
1318
1548
  if (!e || !t)
1319
1549
  throw new Error("paymentId and checkoutKey are required");
1320
1550
  this._paymentState.paymentId = e, this._paymentState.checkoutKey = t;
1321
- const r = await M({
1551
+ const r = await L({
1322
1552
  id: e,
1323
1553
  checkoutKey: t,
1324
1554
  environment: this._config.environment
@@ -1327,13 +1557,13 @@ class ue {
1327
1557
  amount: r.amount,
1328
1558
  currency: r.currency,
1329
1559
  countryCode: r.countryCode
1330
- }, this._card?.setEnvironment(this._config.environment), this._applePay?.setPaymentContext({
1560
+ }, r.vgsJwt && (this._paymentState.vgsJwt = r.vgsJwt, this._card?.setVgsJwt(r.vgsJwt)), this._card?.setEnvironment(this._config.environment), this._applePay?.setPaymentContext({
1331
1561
  paymentId: e,
1332
1562
  checkoutKey: t,
1333
1563
  environment: this._config.environment,
1334
1564
  checkoutDetails: this._paymentState.checkoutDetails,
1335
1565
  ...this._config.additionalPaymentMethods?.applePay,
1336
- onAuthorize: (o) => this._executeAuthorization({ formData: null, applePayData: o })
1566
+ onAuthorize: (s) => this._executeAuthorization({ formData: null, applePayData: s })
1337
1567
  }), this._paypal?.setPaymentContext({
1338
1568
  paymentId: e,
1339
1569
  checkoutKey: t,
@@ -1344,12 +1574,10 @@ class ue {
1344
1574
  const e = {}, { t } = a();
1345
1575
  return this._card?.isMounted && !this._card.isValid && (e.card = this._card.error ?? "Card details are invalid"), this._email?.isMounted && !this._email.isValid && (e.email = this._email.error ?? t("validation.emailInvalid")), this._phone?.isMounted && !this._phone.isValid && (e.phone = this._phone.error ?? t("validation.phoneNumberInvalid")), this._addressStreet?.isMounted && !this._addressStreet.isValid && (e["address.street"] = this._addressStreet.error ?? t("validation.streetRequired")), this._addressCity?.isMounted && !this._addressCity.isValid && (e["address.city"] = this._addressCity.error ?? t("validation.cityRequired")), this._addressCountry?.isMounted && !this._addressCountry.isValid && (e["address.country"] = this._addressCountry.error ?? t("validation.countryRequired")), this._addressFirstName?.isMounted && !this._addressFirstName.isValid && (e["address.firstName"] = this._addressFirstName.error ?? t("validation.firstNameRequired")), this._addressLastName?.isMounted && !this._addressLastName.isValid && (e["address.lastName"] = this._addressLastName.error ?? t("validation.lastNameRequired")), this._cardholderName?.isMounted && !this._cardholderName.isValid && (e.cardholderName = this._cardholderName.error ?? t("validation.nameRequired")), this._addressState?.isMounted && !this._addressState.isValid && (e["address.state"] = this._addressState.error ?? t("validation.stateRequired")), this._addressZipCode?.isMounted && !this._addressZipCode.isValid && (e["address.zipCode"] = this._addressZipCode.error ?? t("validation.zipCodeRequired")), this._applePay?.isMounted && !this._applePay.isValid && (e.applePay = "Apple Pay authorization required"), this._paypal?.isMounted && !this._paypal.isValid && (e.paypal = "PayPal authorization required"), { valid: Object.keys(e).length === 0, errors: e };
1346
1576
  }
1347
- _getPayload() {
1577
+ async _getPayload() {
1348
1578
  if (this._applePay?.isMounted && this._applePay.isValid || this._paypal?.isMounted)
1349
1579
  return null;
1350
- const e = this._card?.isMounted ? this._card.value : null;
1351
- if (!e) return null;
1352
- const t = this._email?.isMounted ? this._email.value : "", r = this._phone?.isMounted ? this._phone.value : void 0, s = this._addressStreet?.isMounted || this._addressCity?.isMounted || this._addressCountry?.isMounted || this._addressFirstName?.isMounted || this._addressLastName?.isMounted || this._cardholderName?.isMounted || this._addressState?.isMounted || this._addressZipCode?.isMounted ? {
1580
+ const e = this._email?.isMounted ? this._email.value : "", t = this._phone?.isMounted ? this._phone.value : void 0, s = this._addressStreet?.isMounted || this._addressCity?.isMounted || this._addressCountry?.isMounted || this._addressFirstName?.isMounted || this._addressLastName?.isMounted || this._cardholderName?.isMounted || this._addressState?.isMounted || this._addressZipCode?.isMounted ? {
1353
1581
  street: this._addressStreet?.isMounted ? this._addressStreet.value : "",
1354
1582
  city: this._addressCity?.isMounted ? this._addressCity.value : "",
1355
1583
  country: this._addressCountry?.isMounted ? this._addressCountry.value : "",
@@ -1357,19 +1585,40 @@ class ue {
1357
1585
  lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
1358
1586
  state: this._addressState?.isMounted ? this._addressState.value : "",
1359
1587
  zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
1360
- } : void 0, i = this._cardholderName?.isMounted ? this._cardholderName.value : "", p = [
1588
+ } : void 0, o = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [
1361
1589
  s?.firstName ?? "",
1362
1590
  s?.lastName ?? ""
1363
- ].filter(Boolean);
1364
- return {
1365
- name: i || p.join(" "),
1366
- email: t,
1367
- phoneNumber: r || void 0,
1368
- cardNumber: e.number,
1369
- cardExpiry: e.expiry,
1370
- cardCvv: e.cvv,
1591
+ ].filter(Boolean), n = o || i.join(" ");
1592
+ if (this._card?.isMounted && this._card.isVgsMode)
1593
+ try {
1594
+ const h = await this._card.getPayload();
1595
+ return {
1596
+ name: n,
1597
+ email: e,
1598
+ phoneNumber: t || void 0,
1599
+ cardNumber: "",
1600
+ cardExpiry: "",
1601
+ cardCvv: "",
1602
+ billingAddress: s,
1603
+ vgsCardData: h
1604
+ };
1605
+ } catch {
1606
+ return this._handleAuthorizationError({
1607
+ message: "We couldn't securely process your card details. Please check your card information and try again.",
1608
+ status: 0,
1609
+ statusText: "Card Tokenization Failed"
1610
+ }), null;
1611
+ }
1612
+ const l = this._card?.isMounted ? this._card.value : null;
1613
+ return l ? {
1614
+ name: n,
1615
+ email: e,
1616
+ phoneNumber: t || void 0,
1617
+ cardNumber: l.number,
1618
+ cardExpiry: l.expiry,
1619
+ cardCvv: l.cvv,
1371
1620
  billingAddress: s
1372
- };
1621
+ } : null;
1373
1622
  }
1374
1623
  async authorize(e) {
1375
1624
  if (!this._paymentState.paymentId || !this._paymentState.checkoutKey)
@@ -1385,7 +1634,7 @@ class ue {
1385
1634
  await this._executeAuthorization({ formData: null });
1386
1635
  return;
1387
1636
  }
1388
- const t = this._getPayload();
1637
+ const t = await this._getPayload();
1389
1638
  await this._executeAuthorization({
1390
1639
  formData: t,
1391
1640
  applePayData: void 0,
@@ -1396,7 +1645,7 @@ class ue {
1396
1645
  const t = e["--odus-font-family"];
1397
1646
  if (t) {
1398
1647
  this._fontCleanup?.();
1399
- const { cleanup: r } = B({ fontFamily: t });
1648
+ const { cleanup: r } = j({ fontFamily: t });
1400
1649
  this._fontCleanup = r;
1401
1650
  }
1402
1651
  for (const r of this._allElements())
@@ -1449,17 +1698,19 @@ class ue {
1449
1698
  customCustomerData: r
1450
1699
  }) {
1451
1700
  try {
1452
- const o = await this._apiService.authorizePayment({
1701
+ const s = await this._apiService.authorizePayment({
1702
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1453
1703
  paymentId: this._paymentState.paymentId,
1704
+ // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
1454
1705
  checkoutKey: this._paymentState.checkoutKey,
1455
1706
  formData: e,
1456
1707
  returnUrl: this._config.returnUrl,
1457
1708
  applePayData: t,
1458
1709
  customCustomerData: r
1459
1710
  });
1460
- this._handlePaymentResponse(o);
1461
- } catch (o) {
1462
- this._handleAuthorizationError(o);
1711
+ this._handlePaymentResponse(s);
1712
+ } catch (s) {
1713
+ this._handleAuthorizationError(s);
1463
1714
  }
1464
1715
  }
1465
1716
  _handlePaymentResponse(e) {
@@ -1481,20 +1732,20 @@ class ue {
1481
1732
  }
1482
1733
  }
1483
1734
  export {
1484
- L as AddressCityElement,
1485
- T as AddressCountryElement,
1486
- j as AddressFirstNameElement,
1487
- q as AddressLastNameElement,
1488
- O as AddressStateElement,
1489
- D as AddressStreetElement,
1490
- Z as AddressZipCodeElement,
1491
- U as ApplePayElement,
1492
- d as BaseElement,
1493
- Y as CardElement,
1494
- X as CardholderElement,
1495
- ee as EmailElement,
1496
- re as ErrorElement,
1497
- ue as OdusElements,
1498
- ie as PayPalElement,
1499
- de as PhoneElement
1735
+ q as AddressCityElement,
1736
+ D as AddressCountryElement,
1737
+ J as AddressFirstNameElement,
1738
+ K as AddressLastNameElement,
1739
+ Z as AddressStateElement,
1740
+ G as AddressStreetElement,
1741
+ U as AddressZipCodeElement,
1742
+ H as ApplePayElement,
1743
+ u as BaseElement,
1744
+ re as CardElement,
1745
+ se as CardholderElement,
1746
+ ie as EmailElement,
1747
+ ne as ErrorElement,
1748
+ fe as OdusElements,
1749
+ ue as PayPalElement,
1750
+ pe as PhoneElement
1500
1751
  };