@odus/checkout 1.12.0 → 1.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/getCheckoutDetails.query.d.ts.map +1 -1
- package/dist/checkout.es.js +210 -167
- package/dist/components/checkout/form/Form.d.ts +17 -0
- package/dist/components/checkout/form/Form.d.ts.map +1 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts +6 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
- package/dist/components/checkout/form/PaymentMethods.d.ts +2 -0
- package/dist/components/checkout/form/PaymentMethods.d.ts.map +1 -1
- package/dist/components/payment-methods/applePay/ApplePayButton.d.ts +5 -0
- package/dist/components/payment-methods/applePay/ApplePayButton.d.ts.map +1 -1
- package/dist/core/api/CheckoutAPI.service.d.ts.map +1 -1
- package/dist/core/vgs/VGSCollectService.d.ts +6 -0
- package/dist/core/vgs/VGSCollectService.d.ts.map +1 -1
- package/dist/core/vgs/vgsCsp.d.ts +17 -0
- package/dist/core/vgs/vgsCsp.d.ts.map +1 -0
- package/dist/elements/ApplePayElement.d.ts +3 -0
- package/dist/elements/ApplePayElement.d.ts.map +1 -1
- package/dist/elements/BaseElement.d.ts +15 -0
- package/dist/elements/BaseElement.d.ts.map +1 -1
- package/dist/elements/CardElement.d.ts +10 -3
- package/dist/elements/CardElement.d.ts.map +1 -1
- package/dist/elements/OdusElements.d.ts +9 -0
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements/card/VgsCardAdapter.d.ts +2 -0
- package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
- package/dist/elements.es.js +304 -248
- package/dist/phone.js +10 -14
- package/dist/services/checkout/Checkout.service.d.ts +2 -0
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/services/checkout/CheckoutForm.service.d.ts +3 -0
- package/dist/services/checkout/CheckoutForm.service.d.ts.map +1 -1
- package/dist/services/telemetry/CheckoutReadiness.service.d.ts +88 -0
- package/dist/services/telemetry/CheckoutReadiness.service.d.ts.map +1 -0
- package/dist/services/telemetry/Telemetry.service.d.ts +6 -0
- package/dist/services/telemetry/Telemetry.service.d.ts.map +1 -1
- package/dist/shared.js +1335 -1026
- package/dist/types/api/ApiError.type.d.ts +3 -0
- package/dist/types/api/ApiError.type.d.ts.map +1 -1
- package/dist/types/telemetry/TelemetryEvents.type.d.ts +189 -1
- package/dist/types/telemetry/TelemetryEvents.type.d.ts.map +1 -1
- package/dist/utils/helpers/failureCause.util.d.ts +24 -0
- package/dist/utils/helpers/failureCause.util.d.ts.map +1 -0
- package/dist/utils/helpers/stageFailure.util.d.ts +35 -0
- package/dist/utils/helpers/stageFailure.util.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/elements.es.js
CHANGED
|
@@ -1,21 +1,39 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as e, C as t, F as n, G as r, H as i, I as a, J as o, K as s, L as c, Q as l, R as u, S as ee, T as te, U as ne, W as re, X as d, Y as f, _t as p, a as ie, at as ae, c as oe, ct as m, d as h, dt as g, et as se, f as _, ft as v, g as ce, gt as le, ht as y, i as b, it as x, mt as S, n as ue, nt as C, o as de, ot as w, pt as T, q as fe, r as pe, s as me, t as E, tt as D, u as O, ut as k, v as he, w as A, x as ge, y as _e, z as j } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var
|
|
3
|
+
var M = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-index:3;position:relative}.form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inherit);font-size:12px;font-weight:500;line-height:var(--odus-helper-text-line-height,14px);background:var(--odus-color-background,#fff);pointer-events:none;transition:opacity .2s ease-in-out;display:block;position:absolute;top:2px;left:0;right:0}.form-helper-text-hidden{opacity:0;visibility:hidden}.form-helper-text-hint{color:var(--odus-color-muted,#6b7280);font-weight:400}", N = ".input-wrapper{box-sizing:border-box;flex-direction:column;align-items:stretch;width:100%;min-width:0;display:flex}.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);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input[name=cardNumber]{padding-right:100px}.form-input-error{box-shadow:0 0 0 1px var(--odus-color-error,#dc2727), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{z-index:2;position:relative;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}", P = ".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)}", ve = ":host{--odus-font-family:system-ui, sans-serif;--odus-font-size:16px;--odus-color-error:#dc2727;--odus-color-text:#1a1a1a;--odus-color-background:#fff;--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 #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d;--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);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.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 #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d);z-index:2;position:relative}.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}", F = (e) => typeof e == "string" ? e : e instanceof HTMLElement ? e.id ? `#${e.id}` : e.tagName.toLowerCase() : String(e), I = class {
|
|
4
4
|
shadowRoot = null;
|
|
5
5
|
host = null;
|
|
6
6
|
options = {};
|
|
7
7
|
_appliedTheme = {};
|
|
8
|
+
elementName = "BaseElement";
|
|
9
|
+
mountTarget = null;
|
|
10
|
+
_mountFailureListener = null;
|
|
8
11
|
listeners = /* @__PURE__ */ new Map();
|
|
9
12
|
get isMounted() {
|
|
10
13
|
return this.host !== null;
|
|
11
14
|
}
|
|
15
|
+
setMountFailureListener(e) {
|
|
16
|
+
this._mountFailureListener = e;
|
|
17
|
+
}
|
|
12
18
|
mount(e) {
|
|
13
19
|
this.isMounted && this.unmount();
|
|
14
|
-
let t =
|
|
15
|
-
|
|
20
|
+
let t = !1;
|
|
21
|
+
try {
|
|
22
|
+
let n = typeof e == "string" ? document.querySelector(e) : e;
|
|
23
|
+
if (!n) throw Error(`[${this.elementName}] mount target not found: ${String(e)}`);
|
|
24
|
+
t = !0, this.mountTarget = e, this.attach(n);
|
|
25
|
+
} catch (n) {
|
|
26
|
+
throw this.unmount(), C(g.CHECKOUT_MOUNT_FAILED, {
|
|
27
|
+
container_id: F(e),
|
|
28
|
+
error_message: n instanceof Error ? n.message : "Unknown error"
|
|
29
|
+
}), D(n instanceof Error ? n : /* @__PURE__ */ Error("Failed to mount element"), { container_id: F(e) }), this._mountFailureListener?.(t ? v.MOUNT_FAILED : v.CONTAINER_NOT_FOUND), n;
|
|
30
|
+
}
|
|
31
|
+
this.emit("ready");
|
|
32
|
+
}
|
|
33
|
+
attach(e) {
|
|
16
34
|
this.host = document.createElement("div"), this.shadowRoot = this.host.attachShadow({ mode: "open" });
|
|
17
|
-
let
|
|
18
|
-
|
|
35
|
+
let t = document.createElement("style");
|
|
36
|
+
t.textContent = this.getCss(), this.shadowRoot.appendChild(t), e.appendChild(this.host), this.reapplyTheme(), this.render();
|
|
19
37
|
}
|
|
20
38
|
unmount() {
|
|
21
39
|
this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null;
|
|
@@ -64,16 +82,16 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
64
82
|
this.options.callbacks?.[e]?.(t);
|
|
65
83
|
}
|
|
66
84
|
getCss() {
|
|
67
|
-
return
|
|
85
|
+
return ve;
|
|
68
86
|
}
|
|
69
|
-
},
|
|
87
|
+
}, L = class extends I {
|
|
70
88
|
_value = "";
|
|
71
89
|
_error = null;
|
|
72
90
|
_input = null;
|
|
73
91
|
render() {
|
|
74
92
|
if (!this.shadowRoot) return;
|
|
75
93
|
this._input?.getElement().remove();
|
|
76
|
-
let { t: e } =
|
|
94
|
+
let { t: e } = A();
|
|
77
95
|
this._input = new _({
|
|
78
96
|
name: "billingAddress.city",
|
|
79
97
|
label: this.options.label ?? e("address.townCity"),
|
|
@@ -85,15 +103,15 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
85
103
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
86
104
|
}
|
|
87
105
|
}), this._input.addEventListener("blur", () => {
|
|
88
|
-
let { t: e } =
|
|
106
|
+
let { t: e } = A();
|
|
89
107
|
this._error = this._value.trim() ? null : e("validation.townCityRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
90
108
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
91
109
|
}
|
|
92
110
|
getCss() {
|
|
93
111
|
return super.getCss() + [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
112
|
+
N,
|
|
113
|
+
P,
|
|
114
|
+
M
|
|
97
115
|
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
98
116
|
}
|
|
99
117
|
getValue() {
|
|
@@ -105,7 +123,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
105
123
|
getError() {
|
|
106
124
|
return this._error;
|
|
107
125
|
}
|
|
108
|
-
},
|
|
126
|
+
}, R = ".input-wrapper{box-sizing:border-box;flex-direction:column;align-items:stretch;width:100%;min-width:0;display:flex}.input-wrapper *{box-sizing:border-box}.form-select{opacity:1;letter-spacing:.02em;padding:var(--odus-input-padding,8px 12px);z-index:0;box-sizing:border-box;cursor:pointer;appearance:none;background:#fff 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\") right 12px center no-repeat;border:none;outline:none;flex:1;width:100%;min-height:0;padding-right:32px;font-weight:400;line-height:1.5;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}.form-select-error{box-shadow:0 0 0 1px var(--odus-color-error,#dc2727), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d}.form-select-placeholder{color:#d4d4d5}.form-select option[disabled]{color:#717173;opacity:.5}.form-select:focus{z-index:2;position:relative;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}", z = class extends I {
|
|
109
127
|
_value = "";
|
|
110
128
|
_error = null;
|
|
111
129
|
_select = null;
|
|
@@ -116,28 +134,28 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
116
134
|
render() {
|
|
117
135
|
if (!this.shadowRoot) return;
|
|
118
136
|
this._select?.getElement().remove(), this.options.initialValue && !this._value && (this._value = String(this.options.initialValue), this.emit("change", this._value));
|
|
119
|
-
let { t: e, locale: t } =
|
|
137
|
+
let { t: e, locale: t } = A();
|
|
120
138
|
this._select = new h({
|
|
121
139
|
name: "billingAddress.country",
|
|
122
140
|
label: this.options.label ?? e("address.chooseCountry"),
|
|
123
141
|
error: !1,
|
|
124
142
|
placeholder: this.options.placeholder ?? e("address.chooseCountry"),
|
|
125
143
|
value: this._value,
|
|
126
|
-
options:
|
|
144
|
+
options: ce(this._allowedCountries, t),
|
|
127
145
|
autocomplete: "country",
|
|
128
146
|
onChange: (e) => {
|
|
129
147
|
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
130
148
|
}
|
|
131
149
|
}), this._select.addEventListener("blur", () => {
|
|
132
|
-
let { t: e } =
|
|
150
|
+
let { t: e } = A();
|
|
133
151
|
this._error = this._value ? null : e("validation.countryRequired"), this._select?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
134
152
|
}), this.shadowRoot.appendChild(this._select.getElement());
|
|
135
153
|
}
|
|
136
154
|
getCss() {
|
|
137
155
|
return super.getCss() + [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
156
|
+
P,
|
|
157
|
+
M,
|
|
158
|
+
R
|
|
141
159
|
].join("\n") + "\n :host { display: block; }\n .form-select {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background-color: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-select:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-select-error {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
142
160
|
}
|
|
143
161
|
getValue() {
|
|
@@ -149,14 +167,14 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
149
167
|
getError() {
|
|
150
168
|
return this._error;
|
|
151
169
|
}
|
|
152
|
-
},
|
|
170
|
+
}, B = class extends I {
|
|
153
171
|
_value = "";
|
|
154
172
|
_error = null;
|
|
155
173
|
_input = null;
|
|
156
174
|
render() {
|
|
157
175
|
if (!this.shadowRoot) return;
|
|
158
176
|
this._input?.getElement().remove();
|
|
159
|
-
let { t: e } =
|
|
177
|
+
let { t: e } = A();
|
|
160
178
|
this._input = new _({
|
|
161
179
|
name: "billingAddress.firstName",
|
|
162
180
|
label: this.options.label ?? e("address.firstName"),
|
|
@@ -168,15 +186,15 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
168
186
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
169
187
|
}
|
|
170
188
|
}), this._input.addEventListener("blur", () => {
|
|
171
|
-
let { t: e } =
|
|
189
|
+
let { t: e } = A();
|
|
172
190
|
this._error = this._value.trim() ? null : e("validation.firstNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
173
191
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
174
192
|
}
|
|
175
193
|
getCss() {
|
|
176
194
|
return super.getCss() + [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
195
|
+
N,
|
|
196
|
+
P,
|
|
197
|
+
M
|
|
180
198
|
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
181
199
|
}
|
|
182
200
|
getValue() {
|
|
@@ -188,14 +206,14 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
188
206
|
getError() {
|
|
189
207
|
return this._error;
|
|
190
208
|
}
|
|
191
|
-
},
|
|
209
|
+
}, V = class extends I {
|
|
192
210
|
_value = "";
|
|
193
211
|
_error = null;
|
|
194
212
|
_input = null;
|
|
195
213
|
render() {
|
|
196
214
|
if (!this.shadowRoot) return;
|
|
197
215
|
this._input?.getElement().remove();
|
|
198
|
-
let { t: e } =
|
|
216
|
+
let { t: e } = A();
|
|
199
217
|
this._input = new _({
|
|
200
218
|
name: "billingAddress.lastName",
|
|
201
219
|
label: this.options.label ?? e("address.lastName"),
|
|
@@ -207,15 +225,15 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
207
225
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
208
226
|
}
|
|
209
227
|
}), this._input.addEventListener("blur", () => {
|
|
210
|
-
let { t: e } =
|
|
228
|
+
let { t: e } = A();
|
|
211
229
|
this._error = this._value.trim() ? null : e("validation.lastNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
212
230
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
213
231
|
}
|
|
214
232
|
getCss() {
|
|
215
233
|
return super.getCss() + [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
234
|
+
N,
|
|
235
|
+
P,
|
|
236
|
+
M
|
|
219
237
|
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
220
238
|
}
|
|
221
239
|
getValue() {
|
|
@@ -227,7 +245,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
227
245
|
getError() {
|
|
228
246
|
return this._error;
|
|
229
247
|
}
|
|
230
|
-
},
|
|
248
|
+
}, H = class extends I {
|
|
231
249
|
_value = "";
|
|
232
250
|
_country = "";
|
|
233
251
|
_input = null;
|
|
@@ -235,19 +253,19 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
235
253
|
setCountry(e) {
|
|
236
254
|
let t = this._country;
|
|
237
255
|
if (this._country = e, !this.shadowRoot) return;
|
|
238
|
-
let n =
|
|
256
|
+
let n = u(t), r = u(e);
|
|
239
257
|
if (n && r && t !== e) {
|
|
240
|
-
let { t } =
|
|
241
|
-
this._select?.setOptions(
|
|
258
|
+
let { t } = A(), n = j(e), r = t(c(n));
|
|
259
|
+
this._select?.setOptions(a(n), this.options.placeholder ?? r), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
242
260
|
return;
|
|
243
261
|
}
|
|
244
262
|
n !== r && (this._value = "", this.render(), this.emit("change", this._value));
|
|
245
263
|
}
|
|
246
264
|
render() {
|
|
247
|
-
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null,
|
|
265
|
+
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, u(this._country) ? this._renderSelect(j(this._country)) : this._renderInput());
|
|
248
266
|
}
|
|
249
267
|
_renderInput() {
|
|
250
|
-
let { t: e } =
|
|
268
|
+
let { t: e } = A();
|
|
251
269
|
this._input = new _({
|
|
252
270
|
name: "billingAddress.state",
|
|
253
271
|
label: this.options.label ?? e("address.state"),
|
|
@@ -264,7 +282,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
264
282
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
265
283
|
}
|
|
266
284
|
_renderSelect(e) {
|
|
267
|
-
let { t } =
|
|
285
|
+
let { t } = A(), n = a(e), r = t(c(e));
|
|
268
286
|
this._select = new h({
|
|
269
287
|
name: "billingAddress.state",
|
|
270
288
|
label: this.options.label ?? t("address.state"),
|
|
@@ -283,10 +301,10 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
283
301
|
}
|
|
284
302
|
getCss() {
|
|
285
303
|
return super.getCss() + [
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
304
|
+
N,
|
|
305
|
+
P,
|
|
306
|
+
M,
|
|
307
|
+
R
|
|
290
308
|
].join("\n") + "\n :host { display: block; }\n .form-input,\n .form-select {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background-color: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus,\n .form-select:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error,\n .form-select-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
291
309
|
}
|
|
292
310
|
getValue() {
|
|
@@ -297,17 +315,17 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
297
315
|
}
|
|
298
316
|
getError() {
|
|
299
317
|
if (this.getIsValid()) return null;
|
|
300
|
-
let { t: e } =
|
|
318
|
+
let { t: e } = A();
|
|
301
319
|
return e("validation.stateRequired");
|
|
302
320
|
}
|
|
303
|
-
},
|
|
321
|
+
}, U = class extends I {
|
|
304
322
|
_value = "";
|
|
305
323
|
_error = null;
|
|
306
324
|
_input = null;
|
|
307
325
|
render() {
|
|
308
326
|
if (!this.shadowRoot) return;
|
|
309
327
|
this._input?.getElement().remove();
|
|
310
|
-
let { t: e } =
|
|
328
|
+
let { t: e } = A();
|
|
311
329
|
this._input = new _({
|
|
312
330
|
name: "billingAddress.street",
|
|
313
331
|
label: this.options.label ?? e("address.addressLine1"),
|
|
@@ -324,15 +342,15 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
324
342
|
this.emit("change", this._value);
|
|
325
343
|
}
|
|
326
344
|
}), this._input.addEventListener("blur", () => {
|
|
327
|
-
let { t: e } =
|
|
345
|
+
let { t: e } = A();
|
|
328
346
|
this._error = this._value.trim() ? null : e("validation.addressLine1Required"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
329
347
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
330
348
|
}
|
|
331
349
|
getCss() {
|
|
332
350
|
return super.getCss() + [
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
351
|
+
N,
|
|
352
|
+
P,
|
|
353
|
+
M
|
|
336
354
|
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
337
355
|
}
|
|
338
356
|
getValue() {
|
|
@@ -344,14 +362,14 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
344
362
|
getError() {
|
|
345
363
|
return this._error;
|
|
346
364
|
}
|
|
347
|
-
},
|
|
365
|
+
}, W = class extends I {
|
|
348
366
|
_value = "";
|
|
349
367
|
_error = null;
|
|
350
368
|
_input = null;
|
|
351
369
|
render() {
|
|
352
370
|
if (!this.shadowRoot) return;
|
|
353
371
|
this._input?.getElement().remove();
|
|
354
|
-
let { t: e } =
|
|
372
|
+
let { t: e } = A();
|
|
355
373
|
this._input = new _({
|
|
356
374
|
name: "billingAddress.zipCode",
|
|
357
375
|
label: this.options.label ?? e("address.postalCode"),
|
|
@@ -363,15 +381,15 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
363
381
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
364
382
|
}
|
|
365
383
|
}), this._input.addEventListener("blur", () => {
|
|
366
|
-
let { t: e } =
|
|
384
|
+
let { t: e } = A();
|
|
367
385
|
this._error = this._value.trim() ? null : e("validation.postalCodeRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
368
386
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
369
387
|
}
|
|
370
388
|
getCss() {
|
|
371
389
|
return super.getCss() + [
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
390
|
+
N,
|
|
391
|
+
P,
|
|
392
|
+
M
|
|
375
393
|
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
376
394
|
}
|
|
377
395
|
getValue() {
|
|
@@ -383,7 +401,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
383
401
|
getError() {
|
|
384
402
|
return this._error;
|
|
385
403
|
}
|
|
386
|
-
},
|
|
404
|
+
}, ye = "apple-pay-button{appearance:-apple-pay-button;-apple-pay-button-type:plain;-apple-pay-button-style:black;cursor:pointer;box-sizing:border-box;border-radius:4px;width:100%;height:40px;min-height:40px;display:inline-block}apple-pay-button:hover{filter:brightness(.9)}", be = {
|
|
387
405
|
name: "odus-elements",
|
|
388
406
|
styles: {
|
|
389
407
|
fontSize: 14,
|
|
@@ -407,7 +425,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
407
425
|
}
|
|
408
426
|
},
|
|
409
427
|
additionalPaymentMethods: {}
|
|
410
|
-
},
|
|
428
|
+
}, G = class extends I {
|
|
411
429
|
_paymentContext = null;
|
|
412
430
|
_applePayData = null;
|
|
413
431
|
_authorized = !1;
|
|
@@ -425,17 +443,17 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
425
443
|
this._setAvailability(!1);
|
|
426
444
|
return;
|
|
427
445
|
}
|
|
428
|
-
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c } = this._paymentContext;
|
|
429
|
-
if (!
|
|
446
|
+
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c, onStartFailed: l } = this._paymentContext;
|
|
447
|
+
if (!ie(a, r?.countryCode)) {
|
|
430
448
|
this._setAvailability(!1);
|
|
431
449
|
return;
|
|
432
450
|
}
|
|
433
|
-
if (!
|
|
451
|
+
if (!b()) {
|
|
434
452
|
this._setAvailability(!1);
|
|
435
453
|
return;
|
|
436
454
|
}
|
|
437
|
-
this._button = new
|
|
438
|
-
checkoutProfile:
|
|
455
|
+
this._button = new pe({
|
|
456
|
+
checkoutProfile: be,
|
|
439
457
|
paymentId: e,
|
|
440
458
|
checkoutKey: t,
|
|
441
459
|
environment: n,
|
|
@@ -443,6 +461,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
443
461
|
displayName: i,
|
|
444
462
|
requiredBillingContactFields: o,
|
|
445
463
|
requiredShippingContactFields: s,
|
|
464
|
+
onStartFailed: l,
|
|
446
465
|
onSubmit: async ({ applePayData: e }) => {
|
|
447
466
|
if (!e) return !1;
|
|
448
467
|
this._applePayData = e, this._authorized = !0, this.emit("change", e);
|
|
@@ -455,7 +474,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
455
474
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
456
475
|
}
|
|
457
476
|
getCss() {
|
|
458
|
-
return super.getCss() +
|
|
477
|
+
return super.getCss() + ye + "\n :host { display: block; }\n apple-pay-button {\n width: 100%;\n height: var(--odus-button-height, 48px);\n border-radius: var(--odus-button-border-radius, 6px);\n }\n ";
|
|
459
478
|
}
|
|
460
479
|
getValue() {
|
|
461
480
|
return this._applePayData;
|
|
@@ -466,7 +485,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
466
485
|
getError() {
|
|
467
486
|
return null;
|
|
468
487
|
}
|
|
469
|
-
},
|
|
488
|
+
}, xe = ".card-icon{opacity:1;width:18px;transition:opacity .6s ease-in}.card-icon img{max-width:100%;height:auto;display:block}.cards-position{z-index:10;pointer-events:none;align-items:center;gap:8px;display:flex;position:absolute;top:50%;right:12px;transform:translateY(-50%)}.loading{position:relative}.loading:after{content:\"\";border-radius:inherit;background-color:#fff;width:100%;height:100%;position:absolute;inset:0}@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{color:#717173;opacity:.3;font-size:var(--odus-input-font-size,16px);letter-spacing:.02em;font-weight:400;line-height:1.5;font-family:var(--odus-font-family,inherit);pointer-events:none;-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:0;background:#fff;align-items:center;padding:8px 12px;display:flex;position:absolute;inset:0}@keyframes vgs-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.vgs-field-skeleton{pointer-events:none;z-index:11;border-radius:inherit;background:linear-gradient(90deg,#f7f7f7 25%,#fdfdfd 50%,#f7f7f7 75%) 0 0/200% 100%;animation:1.5s ease-in-out infinite vgs-shimmer;position:absolute;inset:0}.card-unavailable-message{color:var(--odus-color-error,#dc2727);background:color-mix(in srgb, var(--odus-color-error,#dc2727) 6%, transparent);box-shadow:0 0 0 1px var(--odus-color-error,#dc2727);box-sizing:border-box;padding:12px;line-height:1.4}.card-pending{width:100%;position:relative;overflow:hidden}", K = {
|
|
470
489
|
name: "odus-elements",
|
|
471
490
|
styles: {
|
|
472
491
|
fontSize: 14,
|
|
@@ -490,7 +509,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
490
509
|
}
|
|
491
510
|
},
|
|
492
511
|
additionalPaymentMethods: {}
|
|
493
|
-
},
|
|
512
|
+
}, q = {
|
|
494
513
|
"--odus-font-family": "system-ui, sans-serif",
|
|
495
514
|
"--odus-font-size": "16px",
|
|
496
515
|
"--odus-color-error": "#dc2727",
|
|
@@ -514,11 +533,11 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
514
533
|
"--odus-button-height": "48px",
|
|
515
534
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
516
535
|
}["--odus-font-size"];
|
|
517
|
-
function
|
|
536
|
+
function Se(e, t) {
|
|
518
537
|
let n = Object.keys(e);
|
|
519
538
|
return n.length === Object.keys(t).length && n.every((n) => e[n] === t[n]);
|
|
520
539
|
}
|
|
521
|
-
var
|
|
540
|
+
var Ce = class {
|
|
522
541
|
_vgsService;
|
|
523
542
|
_vgsJwt;
|
|
524
543
|
_vgsState = {};
|
|
@@ -530,17 +549,18 @@ var le = class {
|
|
|
530
549
|
_initGeneration = 0;
|
|
531
550
|
_onInitFailure = null;
|
|
532
551
|
_onFieldsNotReady = null;
|
|
533
|
-
|
|
534
|
-
|
|
552
|
+
_onFieldsReady = null;
|
|
553
|
+
constructor(e, t, n = {}) {
|
|
554
|
+
this._vgsJwt = e, this._environment = t, this._onInitFailure = n.onInitFailure ?? null, this._onFieldsNotReady = n.onFieldsNotReady ?? null, this._onFieldsReady = n.onFieldsReady ?? null, this._vgsService = new s();
|
|
535
555
|
}
|
|
536
556
|
get section() {
|
|
537
557
|
return this._section;
|
|
538
558
|
}
|
|
539
559
|
renderSection(e, t) {
|
|
540
560
|
this._section?.getElement().remove();
|
|
541
|
-
let { t: n } =
|
|
542
|
-
this._section = new
|
|
543
|
-
checkoutProfile:
|
|
561
|
+
let { t: n } = A();
|
|
562
|
+
this._section = new oe({
|
|
563
|
+
checkoutProfile: K,
|
|
544
564
|
translationFunc: n,
|
|
545
565
|
vgsService: this._vgsService
|
|
546
566
|
}), this._applySkeletonMetrics(), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
|
|
@@ -552,7 +572,7 @@ var le = class {
|
|
|
552
572
|
}
|
|
553
573
|
_onChangeEmit = null;
|
|
554
574
|
initVgs() {
|
|
555
|
-
let e = ++this._initGeneration, t = { ...this._currentTheme }, n =
|
|
575
|
+
let e = ++this._initGeneration, t = { ...this._currentTheme }, n = ge(this._buildProfileFromTheme(t).styles.fontFamily);
|
|
556
576
|
this._vgsService.init(this._environment).then((r) => {
|
|
557
577
|
e === this._initGeneration && (this._vgsService.createForm(r, (e) => this._handleStateChange(e)), this._mountFields(e, t, n).catch((t) => {
|
|
558
578
|
e === this._initGeneration && (console.error("Failed to mount VGS card fields:", t), this._onFieldsNotReady?.());
|
|
@@ -562,7 +582,7 @@ var le = class {
|
|
|
562
582
|
});
|
|
563
583
|
}
|
|
564
584
|
async getPayload() {
|
|
565
|
-
if (!this._vgsJwt) throw Error("VGS not initialized");
|
|
585
|
+
if (!this._vgsJwt) throw l(/* @__PURE__ */ Error("VGS not initialized"), p.NOT_INITIALIZED);
|
|
566
586
|
let e = await this._vgsService.createCard(this._vgsJwt);
|
|
567
587
|
return {
|
|
568
588
|
cardId: e.cardId,
|
|
@@ -575,12 +595,12 @@ var le = class {
|
|
|
575
595
|
return this._vgsFieldsValid;
|
|
576
596
|
}
|
|
577
597
|
getError() {
|
|
578
|
-
let { t: e } =
|
|
598
|
+
let { t: e } = A();
|
|
579
599
|
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
580
600
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
581
601
|
let r = n.errors?.[0];
|
|
582
602
|
if (!r) continue;
|
|
583
|
-
let i =
|
|
603
|
+
let i = O(t, r.code);
|
|
584
604
|
if (i) return e(i);
|
|
585
605
|
}
|
|
586
606
|
return null;
|
|
@@ -590,7 +610,7 @@ var le = class {
|
|
|
590
610
|
...this._currentTheme,
|
|
591
611
|
...e
|
|
592
612
|
};
|
|
593
|
-
|
|
613
|
+
Se(this._currentTheme, t) || (this._currentTheme = t, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme()));
|
|
594
614
|
}
|
|
595
615
|
resetTheme(e) {
|
|
596
616
|
let t = e.filter((e) => e in this._currentTheme);
|
|
@@ -600,23 +620,23 @@ var le = class {
|
|
|
600
620
|
}
|
|
601
621
|
}
|
|
602
622
|
destroy() {
|
|
603
|
-
this._vgsReinitTimer &&= (clearTimeout(this._vgsReinitTimer), null), this._initGeneration += 1, this._onInitFailure = null, this._onFieldsNotReady = null, this._vgsService.destroy(), this._section = null;
|
|
623
|
+
this._vgsReinitTimer &&= (clearTimeout(this._vgsReinitTimer), null), this._initGeneration += 1, this._onInitFailure = null, this._onFieldsNotReady = null, this._onFieldsReady = null, this._vgsService.destroy(), this._section = null;
|
|
604
624
|
}
|
|
605
625
|
_reinitWithTheme() {
|
|
606
626
|
this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
|
|
607
|
-
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new
|
|
627
|
+
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new s(), this._section?.setVgsService(this._vgsService), this.initVgs();
|
|
608
628
|
}, 300);
|
|
609
629
|
}
|
|
610
630
|
_buildProfileFromTheme(e) {
|
|
611
|
-
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ??
|
|
631
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? q, n = e["--odus-font-family"] ?? K.styles.fontFamily, r = e["--odus-color-text"] ?? K.styles.textColor, i = e["--odus-border-radius"] ?? `${K.styles.borderRadius}px`;
|
|
612
632
|
return {
|
|
613
|
-
...
|
|
633
|
+
...K,
|
|
614
634
|
styles: {
|
|
615
|
-
...
|
|
616
|
-
fontSize: parseInt(t, 10) || parseInt(
|
|
635
|
+
...K.styles,
|
|
636
|
+
fontSize: parseInt(t, 10) || parseInt(q, 10),
|
|
617
637
|
fontFamily: n,
|
|
618
638
|
textColor: r,
|
|
619
|
-
borderRadius: parseInt(i, 10) ||
|
|
639
|
+
borderRadius: parseInt(i, 10) || K.styles.borderRadius
|
|
620
640
|
}
|
|
621
641
|
};
|
|
622
642
|
}
|
|
@@ -638,7 +658,7 @@ var le = class {
|
|
|
638
658
|
placeholderColor: t["--odus-input-placeholder-color"],
|
|
639
659
|
placeholderOpacity: t["--odus-input-placeholder-opacity"],
|
|
640
660
|
padding: t["--odus-input-padding"]
|
|
641
|
-
}), { t: c } =
|
|
661
|
+
}), { t: c } = A();
|
|
642
662
|
this._vgsService.mountCardFields({
|
|
643
663
|
cardNumber: a.cardNumber ? `#${a.cardNumber}` : void 0,
|
|
644
664
|
cardExpiry: a.cardExpiry ? `#${a.cardExpiry}` : void 0,
|
|
@@ -651,14 +671,14 @@ var le = class {
|
|
|
651
671
|
}, (e) => {
|
|
652
672
|
this._section?.updateVgsCardBrand(e);
|
|
653
673
|
}), this._vgsService.waitForFieldsReady().then(() => {
|
|
654
|
-
this._section?.hideFakePlaceholders();
|
|
674
|
+
e === this._initGeneration && (this._section?.hideFakePlaceholders(), this._onFieldsReady?.());
|
|
655
675
|
}).catch((t) => {
|
|
656
676
|
e === this._initGeneration && (console.error("VGS card fields did not become ready:", t), this._onFieldsNotReady?.());
|
|
657
677
|
});
|
|
658
678
|
}
|
|
659
679
|
_handleStateChange(e) {
|
|
660
680
|
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
661
|
-
let { t } =
|
|
681
|
+
let { t } = A(), n = this._deriveFieldErrors(t);
|
|
662
682
|
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
663
683
|
}
|
|
664
684
|
_deriveFieldErrors(e) {
|
|
@@ -667,19 +687,20 @@ var le = class {
|
|
|
667
687
|
if (!r?.isTouched || r.isFocused || r.isValid) continue;
|
|
668
688
|
let i = r.errors?.[0];
|
|
669
689
|
if (!i) continue;
|
|
670
|
-
let a =
|
|
690
|
+
let a = O(n, i.code);
|
|
671
691
|
a && (t[n] = e(a));
|
|
672
692
|
}
|
|
673
693
|
return t;
|
|
674
694
|
}
|
|
675
|
-
},
|
|
695
|
+
}, we = "Card capture is unavailable: no tokenization session", J = class extends I {
|
|
696
|
+
elementName = "CardElement";
|
|
676
697
|
_environment = "test";
|
|
677
698
|
_captureState = "pending";
|
|
678
|
-
_mountContainer = null;
|
|
679
699
|
_vgsAdapter = null;
|
|
680
700
|
_vgsJwt = null;
|
|
681
701
|
_reportedUnavailable = !1;
|
|
682
|
-
_unavailableReason =
|
|
702
|
+
_unavailableReason = k.NO_TOKENIZATION_SESSION;
|
|
703
|
+
_loadOutcomeListener = null;
|
|
683
704
|
get isVgsMode() {
|
|
684
705
|
return this._captureState === "vgs";
|
|
685
706
|
}
|
|
@@ -689,38 +710,43 @@ var le = class {
|
|
|
689
710
|
setEnvironment(e) {
|
|
690
711
|
this._environment = e;
|
|
691
712
|
}
|
|
713
|
+
setLoadOutcomeListener(e) {
|
|
714
|
+
this._loadOutcomeListener = e;
|
|
715
|
+
}
|
|
692
716
|
setVgsJwt(e) {
|
|
693
717
|
if (this._vgsAdapter && this._vgsJwt === e) return;
|
|
694
718
|
this._captureState = "vgs", this._reportedUnavailable = !1, this._vgsJwt = e, this._vgsAdapter?.destroy();
|
|
695
|
-
let t = new
|
|
719
|
+
let t = new Ce(e, this._environment, {
|
|
696
720
|
onInitFailure: () => {
|
|
697
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
721
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(k.INIT_FAILED);
|
|
698
722
|
},
|
|
699
723
|
onFieldsNotReady: () => {
|
|
700
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
724
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(k.FIELDS_NOT_READY);
|
|
725
|
+
},
|
|
726
|
+
onFieldsReady: () => {
|
|
727
|
+
this._vgsAdapter === t && this.isMounted && this._loadOutcomeListener?.({ status: "ready" });
|
|
701
728
|
}
|
|
702
729
|
});
|
|
703
|
-
this._vgsAdapter = t, this.isMounted && this.
|
|
730
|
+
this._vgsAdapter = t, this.isMounted && this.mountTarget && (this.unmount(), this.mount(this.mountTarget));
|
|
704
731
|
}
|
|
705
|
-
markCaptureUnavailable(e =
|
|
732
|
+
markCaptureUnavailable(e = k.NO_TOKENIZATION_SESSION) {
|
|
706
733
|
if (this._captureState === "unavailable") return;
|
|
707
|
-
let t = this.
|
|
734
|
+
let t = this.mountTarget, n = this.isMounted && t !== null;
|
|
708
735
|
this.isMounted && this.unmount(), this._unavailableReason = e, this._captureState = "unavailable", this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, n && t && this.mount(t);
|
|
709
736
|
}
|
|
710
737
|
resetCardCapture() {
|
|
711
738
|
if (this._captureState === "unsupported") return;
|
|
712
|
-
let e = this.
|
|
739
|
+
let e = this.mountTarget, t = this.isMounted && e !== null;
|
|
713
740
|
this.isMounted && this.unmount(), this._captureState = "unsupported", this._reportedUnavailable = !1, this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, t && e && this.mount(e);
|
|
714
741
|
}
|
|
715
|
-
|
|
716
|
-
this.
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
} else super.mount(e);
|
|
742
|
+
attach(e) {
|
|
743
|
+
if (this._captureState !== "vgs") {
|
|
744
|
+
super.attach(e);
|
|
745
|
+
return;
|
|
746
|
+
}
|
|
747
|
+
this.host = document.createElement("div");
|
|
748
|
+
let t = document.createElement("style");
|
|
749
|
+
t.textContent = this.getCss(), this.host.appendChild(t), e.appendChild(this.host), this.reapplyTheme(), Object.keys(this._appliedTheme).length > 0 && this._vgsAdapter?.applyTheme(this._appliedTheme), this.render(), this._vgsAdapter?.initVgs();
|
|
724
750
|
}
|
|
725
751
|
unmount() {
|
|
726
752
|
this._captureState === "vgs" ? (this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null) : super.unmount();
|
|
@@ -749,19 +775,22 @@ var le = class {
|
|
|
749
775
|
this.clearBody();
|
|
750
776
|
let e = document.createElement("div");
|
|
751
777
|
e.className = "card-pending";
|
|
752
|
-
let t =
|
|
753
|
-
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${
|
|
778
|
+
let t = _e(he, K.styles.fontSize);
|
|
779
|
+
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${K.styles.borderRadius}px)`;
|
|
754
780
|
let n = document.createElement("div");
|
|
755
781
|
n.className = "vgs-field-skeleton", e.appendChild(n), this.shadowRoot.appendChild(e);
|
|
756
782
|
}
|
|
757
783
|
renderUnavailableNotice() {
|
|
758
784
|
if (!this.shadowRoot) return;
|
|
759
785
|
this.clearBody();
|
|
760
|
-
let { t: e } =
|
|
761
|
-
checkoutProfile:
|
|
786
|
+
let { t: e } = A(), t = new me({
|
|
787
|
+
checkoutProfile: K,
|
|
762
788
|
translationFunc: e
|
|
763
789
|
});
|
|
764
|
-
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0,
|
|
790
|
+
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0, C(g.CARD_CAPTURE_UNAVAILABLE, { reason: this._unavailableReason })), this._loadOutcomeListener?.({
|
|
791
|
+
status: "failed",
|
|
792
|
+
reason: this._unavailableReason
|
|
793
|
+
});
|
|
765
794
|
}
|
|
766
795
|
focus() {
|
|
767
796
|
this._vgsAdapter?.section?.focus();
|
|
@@ -770,7 +799,7 @@ var le = class {
|
|
|
770
799
|
this._vgsAdapter?.section?.focusField(e);
|
|
771
800
|
}
|
|
772
801
|
destroy() {
|
|
773
|
-
this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, this._captureState = "pending", this._reportedUnavailable = !1, super.destroy();
|
|
802
|
+
this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, this._captureState = "pending", this._reportedUnavailable = !1, this._loadOutcomeListener = null, super.destroy();
|
|
774
803
|
}
|
|
775
804
|
setTheme(e) {
|
|
776
805
|
super.setTheme(e), this._captureState === "vgs" && this._vgsAdapter && this._vgsAdapter.applyTheme(e);
|
|
@@ -780,10 +809,10 @@ var le = class {
|
|
|
780
809
|
}
|
|
781
810
|
getCss() {
|
|
782
811
|
return super.getCss() + [
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
812
|
+
N,
|
|
813
|
+
P,
|
|
814
|
+
M,
|
|
815
|
+
xe
|
|
787
816
|
].join("\n") + "\n :host { display: block; }\n .card-grid {\n display: flex;\n flex-direction: column;\n gap: var(--odus-card-gap, 12px);\n }\n .card-details {\n display: flex;\n gap: var(--odus-card-gap, 12px);\n }\n .form-input,\n .form-select {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus,\n .form-select:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error,\n .form-select-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
788
817
|
}
|
|
789
818
|
getValue() {
|
|
@@ -794,23 +823,23 @@ var le = class {
|
|
|
794
823
|
};
|
|
795
824
|
}
|
|
796
825
|
async getPayload() {
|
|
797
|
-
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(
|
|
826
|
+
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(we);
|
|
798
827
|
return this._vgsAdapter.getPayload();
|
|
799
828
|
}
|
|
800
829
|
getIsValid() {
|
|
801
830
|
return this._captureState === "unsupported" ? !0 : this._vgsAdapter?.isValid() ?? !1;
|
|
802
831
|
}
|
|
803
832
|
getError() {
|
|
804
|
-
return this._captureState === "unavailable" ?
|
|
833
|
+
return this._captureState === "unavailable" ? A().t("cardUnavailable") : this._vgsAdapter?.getError() ?? null;
|
|
805
834
|
}
|
|
806
|
-
}, Y = class extends
|
|
835
|
+
}, Y = class extends I {
|
|
807
836
|
_value = "";
|
|
808
837
|
_error = null;
|
|
809
838
|
_input = null;
|
|
810
839
|
render() {
|
|
811
840
|
if (!this.shadowRoot) return;
|
|
812
841
|
this._input?.getElement().remove();
|
|
813
|
-
let { t: e } =
|
|
842
|
+
let { t: e } = A();
|
|
814
843
|
this._input = new _({
|
|
815
844
|
name: "billingAddress.cardholderName",
|
|
816
845
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
@@ -823,15 +852,15 @@ var le = class {
|
|
|
823
852
|
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
824
853
|
}
|
|
825
854
|
}), this._input.addEventListener("blur", () => {
|
|
826
|
-
let { t: e } =
|
|
855
|
+
let { t: e } = A();
|
|
827
856
|
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
828
857
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
829
858
|
}
|
|
830
859
|
getCss() {
|
|
831
860
|
return super.getCss() + [
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
861
|
+
N,
|
|
862
|
+
P,
|
|
863
|
+
M
|
|
835
864
|
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
836
865
|
}
|
|
837
866
|
getValue() {
|
|
@@ -843,7 +872,7 @@ var le = class {
|
|
|
843
872
|
getError() {
|
|
844
873
|
return this._error;
|
|
845
874
|
}
|
|
846
|
-
},
|
|
875
|
+
}, Te = {
|
|
847
876
|
name: "odus-elements",
|
|
848
877
|
styles: {
|
|
849
878
|
fontSize: 14,
|
|
@@ -867,7 +896,7 @@ var le = class {
|
|
|
867
896
|
}
|
|
868
897
|
},
|
|
869
898
|
additionalPaymentMethods: {}
|
|
870
|
-
}, X = class extends
|
|
899
|
+
}, X = class extends I {
|
|
871
900
|
_email = "";
|
|
872
901
|
_error = null;
|
|
873
902
|
_suggestion = null;
|
|
@@ -875,11 +904,11 @@ var le = class {
|
|
|
875
904
|
render() {
|
|
876
905
|
if (!this.shadowRoot) return;
|
|
877
906
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
878
|
-
let { t: e } =
|
|
879
|
-
this._field = new
|
|
907
|
+
let { t: e } = A();
|
|
908
|
+
this._field = new de({
|
|
880
909
|
value: this._email,
|
|
881
910
|
error: !1,
|
|
882
|
-
checkoutProfile:
|
|
911
|
+
checkoutProfile: Te,
|
|
883
912
|
translationFunc: e,
|
|
884
913
|
label: this.options.label,
|
|
885
914
|
placeholder: this.options.placeholder,
|
|
@@ -888,23 +917,23 @@ var le = class {
|
|
|
888
917
|
this._email = t.value ?? this._field?.getValue() ?? "", this._error = null, this._suggestion = null, this._field?.setError(!1), this._field?.setSuggestion(null), this.emit("change", this._email);
|
|
889
918
|
},
|
|
890
919
|
onBlur: () => {
|
|
891
|
-
let e =
|
|
920
|
+
let e = n();
|
|
892
921
|
this._error = e.email(this._email) ?? null, this._suggestion = e.emailSuggestion(this._email) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this._field?.setSuggestion(this._suggestion), this.emit("blur", this._email);
|
|
893
922
|
}
|
|
894
923
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
895
924
|
}
|
|
896
925
|
getCss() {
|
|
897
926
|
return super.getCss() + [
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
927
|
+
N,
|
|
928
|
+
P,
|
|
929
|
+
M
|
|
901
930
|
].join("\n") + "\n :host { display: block; }\n .form-input {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-input:focus {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n .form-helper-text-hint {\n color: var(--odus-color-muted, #6b7280) !important;\n }\n ";
|
|
902
931
|
}
|
|
903
932
|
getValue() {
|
|
904
933
|
return this._email;
|
|
905
934
|
}
|
|
906
935
|
getIsValid() {
|
|
907
|
-
return !
|
|
936
|
+
return !n().email(this._email);
|
|
908
937
|
}
|
|
909
938
|
getError() {
|
|
910
939
|
return this._error;
|
|
@@ -912,24 +941,24 @@ var le = class {
|
|
|
912
941
|
get suggestion() {
|
|
913
942
|
return this._suggestion;
|
|
914
943
|
}
|
|
915
|
-
},
|
|
944
|
+
}, Ee = "@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;animation:.3s ease-out slideIn;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f}.error-alert-content{align-items:flex-start;gap:12px;display:flex}.error-alert-icon-container{color:#dc2626;background-color:#fee2e2;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;display:flex}.error-alert-icon{color:#dc2626}.error-alert-text-container{flex:1;min-width:0}.error-alert-title{color:#991b1b;margin:0 0 4px;font-size:14px;font-weight:600;line-height:1.4}.error-alert-message{font-family:var(--odus-font-family,inherit);color:#7f1d1d;word-break:break-word;margin:0;font-size:14px;line-height:1.5}", Z = class extends I {
|
|
916
945
|
_alert = null;
|
|
917
946
|
_message = null;
|
|
918
947
|
render() {
|
|
919
|
-
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new
|
|
948
|
+
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new E({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
920
949
|
}
|
|
921
950
|
setError(e) {
|
|
922
951
|
if (this._message = e, !this.shadowRoot) {
|
|
923
952
|
this.emit("error", e);
|
|
924
953
|
return;
|
|
925
954
|
}
|
|
926
|
-
this._alert ? this._alert.setMessage(e) : (this._alert = new
|
|
955
|
+
this._alert ? this._alert.setMessage(e) : (this._alert = new E({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
|
|
927
956
|
}
|
|
928
957
|
clearError() {
|
|
929
958
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
930
959
|
}
|
|
931
960
|
getCss() {
|
|
932
|
-
return super.getCss() +
|
|
961
|
+
return super.getCss() + Ee + "\n :host { display: block; }\n .error-alert-icon,\n .error-alert-icon-container {\n color: var(--odus-color-error, #e53e3e) !important;\n }\n .error-alert-message {\n color: var(--odus-color-text, #1a1a1a) !important;\n }\n ";
|
|
933
962
|
}
|
|
934
963
|
getValue() {
|
|
935
964
|
return null;
|
|
@@ -940,7 +969,7 @@ var le = class {
|
|
|
940
969
|
getError() {
|
|
941
970
|
return this._message;
|
|
942
971
|
}
|
|
943
|
-
},
|
|
972
|
+
}, De = ".paypal{color:#253b80;text-transform:none;cursor:pointer;background-color:#ffc439;border-radius:4px;padding:8px 16px;font-weight:700;box-shadow:0 2px 4px #0000001a}.paypal:hover{filter:brightness(.95);background-color:#ffc439}.paypal-icon-container{justify-content:center;align-items:center;display:flex}.paypal-icon-container img{width:69px;height:22px}", Oe = {
|
|
944
973
|
name: "odus-elements",
|
|
945
974
|
styles: {
|
|
946
975
|
fontSize: 14,
|
|
@@ -964,7 +993,7 @@ var le = class {
|
|
|
964
993
|
}
|
|
965
994
|
},
|
|
966
995
|
additionalPaymentMethods: {}
|
|
967
|
-
}, Q = class extends
|
|
996
|
+
}, Q = class extends I {
|
|
968
997
|
_paymentContext = null;
|
|
969
998
|
_button = null;
|
|
970
999
|
setPaymentContext(e) {
|
|
@@ -973,8 +1002,8 @@ var le = class {
|
|
|
973
1002
|
render() {
|
|
974
1003
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
975
1004
|
let { onAuthorize: e } = this._paymentContext;
|
|
976
|
-
this._button = new
|
|
977
|
-
checkoutProfile:
|
|
1005
|
+
this._button = new ue({
|
|
1006
|
+
checkoutProfile: Oe,
|
|
978
1007
|
onSubmit: async () => {
|
|
979
1008
|
this._button?.setSubmitting(!0);
|
|
980
1009
|
try {
|
|
@@ -986,7 +1015,7 @@ var le = class {
|
|
|
986
1015
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
987
1016
|
}
|
|
988
1017
|
getCss() {
|
|
989
|
-
return super.getCss() +
|
|
1018
|
+
return super.getCss() + De + "\n :host { display: block; }\n .paypal {\n width: 100%;\n box-sizing: border-box;\n border-radius: var(--odus-button-border-radius, 6px);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n ";
|
|
990
1019
|
}
|
|
991
1020
|
getValue() {
|
|
992
1021
|
return null;
|
|
@@ -997,7 +1026,7 @@ var le = class {
|
|
|
997
1026
|
getError() {
|
|
998
1027
|
return null;
|
|
999
1028
|
}
|
|
1000
|
-
},
|
|
1029
|
+
}, ke = ".country-dial-code-dropdown{display:inline-block;position:relative}.country-dial-code-trigger{padding:var(--odus-input-padding,8px 12px);cursor:pointer;letter-spacing:.02em;font-weight:400;line-height:var(--odus-input-line-height,1.5);white-space:nowrap;box-sizing:border-box;background:#fff;border:none;border-right:1px solid #e0e0e0;align-items:center;gap:6px;padding-right:8px;transition:all .1s ease-in;display:flex}.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}.country-dial-code-trigger[aria-expanded=true] .country-chevron{transform:rotate(180deg)}.country-dial-code-panel{z-index:10000;background:#fff;border-radius:8px;flex-direction:column;width:280px;max-height:360px;display:flex;position:fixed;top:0;left:0;overflow:hidden;box-shadow:0 0 0 1px #0000000d,0 4px 6px -1px #0000001a,0 2px 4px -1px #0000000f}.country-dial-code-panel.hidden{display:none}.country-search-wrapper{border-bottom:1px solid #e0e0e0;flex-shrink:0;padding:12px}.country-search{width:100%;font-size:inherit;box-sizing:border-box;border:1px solid #e0e0e0;border-radius:6px;outline:none;padding:6px 12px;font-family:inherit;transition:all .1s ease-in}.country-search:focus{border-color:#3297d3b3;box-shadow:0 0 0 3px #3297d31a}.country-search::placeholder{color:#717173;opacity:.6}.countries-list{flex:1;min-height:0;overflow-y:auto}.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{color:#717173;text-transform:uppercase;letter-spacing:.05em;z-index:1;background:#fafafa;padding:8px 16px 4px;font-size:12px;font-weight:600;position:sticky;top:0}.country-item{cursor:pointer;text-align:left;width:100%;color:inherit;background:#fff;border:none;align-items:center;gap:12px;padding:10px 16px;font-family:inherit;font-size:14px;transition:background .1s;display:flex}.country-item:hover{background:#f5f5f5}.country-item.selected{color:#3297d3;background:#3297d314}.country-item:focus{background:#f0f0f0;outline:none}.country-item .country-flag{flex-shrink:0;font-size:20px;line-height:1}.country-item .country-name{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}.country-item .country-dial-code{color:#717173;flex-shrink:0;font-size:.95em}.country-item.selected .country-dial-code{color:#3297d3cc}.no-results{text-align:center;color:#717173;padding:24px 16px;font-size:14px}.phone-number-field-wrapper{width:100%;display:flex}.phone-number-field-container{border-radius:inherit;background:#fff;align-items:center;width:100%;transition:box-shadow .1s ease-in,border-radius .2s ease-in;display:flex;position:relative;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d}.phone-number-field-container.focused{z-index:2;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}.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{padding:var(--odus-input-padding,8px 12px);border-top-left-radius:var(--phone-border-radius,0px);border-bottom-left-radius:var(--phone-border-radius,0px);white-space:nowrap;background:0 0;flex-shrink:0;align-items:center;gap:4px;padding-right:6px;display:flex;position:relative}.phone-number-field-container .country-select-wrapper .country-flag{pointer-events:none;font-size:14px;line-height:1}.phone-number-field-container .country-select-wrapper .country-chevron{color:#717173;pointer-events:none;flex-shrink:0;align-items:center;display:flex}.phone-number-field-container .country-select-wrapper .country-select{cursor:pointer;opacity:0;background:0 0;border:none;outline:none;width:100%;height:100%;position:absolute;inset:0}.phone-number-field-container .phone-input-wrapper{flex:1;min-width:0}.phone-number-field-container .phone-input-wrapper .form-input{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);border:none}.phone-number-field-container .phone-input-wrapper .form-input:focus{box-shadow:none;z-index:auto}", Ae = {
|
|
1001
1030
|
name: "odus-elements",
|
|
1002
1031
|
styles: {
|
|
1003
1032
|
fontSize: 14,
|
|
@@ -1021,7 +1050,7 @@ var le = class {
|
|
|
1021
1050
|
}
|
|
1022
1051
|
},
|
|
1023
1052
|
additionalPaymentMethods: {}
|
|
1024
|
-
}, $ = class extends
|
|
1053
|
+
}, $ = class extends I {
|
|
1025
1054
|
_phone = "";
|
|
1026
1055
|
_error = null;
|
|
1027
1056
|
_field = null;
|
|
@@ -1030,13 +1059,13 @@ var le = class {
|
|
|
1030
1059
|
if (!this.shadowRoot) return;
|
|
1031
1060
|
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1032
1061
|
let e = ++this._renderGeneration;
|
|
1033
|
-
|
|
1062
|
+
i().then(({ PhoneNumberField: t }) => {
|
|
1034
1063
|
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1035
|
-
let { t: r, locale: i } =
|
|
1036
|
-
this._field = new
|
|
1064
|
+
let { t: r, locale: i } = A();
|
|
1065
|
+
this._field = new t({
|
|
1037
1066
|
value: this._phone,
|
|
1038
1067
|
error: !1,
|
|
1039
|
-
checkoutProfile:
|
|
1068
|
+
checkoutProfile: Ae,
|
|
1040
1069
|
translationFunc: r,
|
|
1041
1070
|
locale: i,
|
|
1042
1071
|
label: this.options.label,
|
|
@@ -1047,8 +1076,8 @@ var le = class {
|
|
|
1047
1076
|
},
|
|
1048
1077
|
onBlur: () => {
|
|
1049
1078
|
this._phone = this._field?.getValue() ?? "";
|
|
1050
|
-
let e =
|
|
1051
|
-
this._error = e.phoneNumber(this._phone,
|
|
1079
|
+
let e = n(), t = this._field?.getCountry();
|
|
1080
|
+
this._error = e.phoneNumber(this._phone, t) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1052
1081
|
}
|
|
1053
1082
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
1054
1083
|
}).catch((t) => {
|
|
@@ -1057,23 +1086,23 @@ var le = class {
|
|
|
1057
1086
|
}
|
|
1058
1087
|
getCss() {
|
|
1059
1088
|
return super.getCss() + [
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1089
|
+
N,
|
|
1090
|
+
P,
|
|
1091
|
+
M,
|
|
1092
|
+
ke
|
|
1064
1093
|
].join("\n") + "\n :host { display: block; }\n .form-input,\n .country-select-wrapper {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n }\n .phone-number-field-container {\n min-height: calc(var(--odus-input-font-size, 16px) * 1.5 + 16px);\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n overflow: hidden;\n }\n .phone-number-field-container:focus-within {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n }\n .phone-number-field-container.error {\n box-shadow: 0 0 0 1px var(--odus-color-error, #dc2727) !important;\n }\n .form-input:focus {\n box-shadow: none !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
1065
1094
|
}
|
|
1066
1095
|
getValue() {
|
|
1067
1096
|
return this._phone;
|
|
1068
1097
|
}
|
|
1069
1098
|
getIsValid() {
|
|
1070
|
-
let e =
|
|
1071
|
-
return !e.phoneNumber(this._phone,
|
|
1099
|
+
let e = n(), t = this._field?.getCountry();
|
|
1100
|
+
return !e.phoneNumber(this._phone, t);
|
|
1072
1101
|
}
|
|
1073
1102
|
getError() {
|
|
1074
1103
|
return this._error;
|
|
1075
1104
|
}
|
|
1076
|
-
},
|
|
1105
|
+
}, je = "Payment failed", Me = "We couldn't securely process your card details. Please check your card information and try again.", Ne = "No payment details were entered. Please add your card and try again.", Pe = "This payment is no longer available. Please reload the page and try again.", Fe = class {
|
|
1077
1106
|
_config;
|
|
1078
1107
|
_apiService;
|
|
1079
1108
|
_changeListeners = [];
|
|
@@ -1083,6 +1112,7 @@ var le = class {
|
|
|
1083
1112
|
_fontCleanup;
|
|
1084
1113
|
_sessionId;
|
|
1085
1114
|
_mountedReported = !1;
|
|
1115
|
+
_readiness = new re();
|
|
1086
1116
|
_card;
|
|
1087
1117
|
_email;
|
|
1088
1118
|
_phone;
|
|
@@ -1098,12 +1128,12 @@ var le = class {
|
|
|
1098
1128
|
_paypal;
|
|
1099
1129
|
_error;
|
|
1100
1130
|
elements;
|
|
1101
|
-
constructor(
|
|
1102
|
-
this._config =
|
|
1103
|
-
environment:
|
|
1131
|
+
constructor(e) {
|
|
1132
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), r(), se({
|
|
1133
|
+
environment: e.environment,
|
|
1104
1134
|
sessionId: this._sessionId,
|
|
1105
1135
|
integration: "elements"
|
|
1106
|
-
}),
|
|
1136
|
+
}), C(g.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && te.setLocale(e.locale), this._apiService = new t(e.apiKey, e.environment);
|
|
1107
1137
|
let n = {};
|
|
1108
1138
|
Object.defineProperty(n, "email", {
|
|
1109
1139
|
get: () => (this._email || (this._email = new X(), this._trackElement(this._email)), this._email),
|
|
@@ -1112,9 +1142,9 @@ var le = class {
|
|
|
1112
1142
|
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone)), this._phone),
|
|
1113
1143
|
enumerable: !0
|
|
1114
1144
|
});
|
|
1115
|
-
let
|
|
1116
|
-
Object.defineProperty(
|
|
1117
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1145
|
+
let i = {};
|
|
1146
|
+
Object.defineProperty(i, "applePay", {
|
|
1147
|
+
get: () => (this._applePay || (this._applePay = new G(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1118
1148
|
paymentId: this._paymentState.paymentId,
|
|
1119
1149
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1120
1150
|
environment: this._config.environment,
|
|
@@ -1123,10 +1153,11 @@ var le = class {
|
|
|
1123
1153
|
onAuthorize: (e) => this._executeAuthorization({
|
|
1124
1154
|
formData: null,
|
|
1125
1155
|
applePayData: e
|
|
1126
|
-
})
|
|
1156
|
+
}),
|
|
1157
|
+
onStartFailed: this._onApplePayStartFailed
|
|
1127
1158
|
})), this._applePay),
|
|
1128
1159
|
enumerable: !0
|
|
1129
|
-
}), Object.defineProperty(
|
|
1160
|
+
}), Object.defineProperty(i, "payPal", {
|
|
1130
1161
|
get: () => (this._paypal || (this._paypal = new Q(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1131
1162
|
paymentId: this._paymentState.paymentId,
|
|
1132
1163
|
checkoutKey: this._paymentState.checkoutKey,
|
|
@@ -1136,43 +1167,45 @@ var le = class {
|
|
|
1136
1167
|
})), this._paypal),
|
|
1137
1168
|
enumerable: !0
|
|
1138
1169
|
});
|
|
1139
|
-
let
|
|
1140
|
-
Object.defineProperty(
|
|
1141
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1170
|
+
let a = {};
|
|
1171
|
+
Object.defineProperty(a, "street", {
|
|
1172
|
+
get: () => (this._addressStreet || (this._addressStreet = new U(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1142
1173
|
enumerable: !0
|
|
1143
|
-
}), Object.defineProperty(
|
|
1144
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1174
|
+
}), Object.defineProperty(a, "firstName", {
|
|
1175
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new B(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1145
1176
|
enumerable: !0
|
|
1146
|
-
}), Object.defineProperty(
|
|
1147
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1177
|
+
}), Object.defineProperty(a, "lastName", {
|
|
1178
|
+
get: () => (this._addressLastName || (this._addressLastName = new V(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1148
1179
|
enumerable: !0
|
|
1149
|
-
}), Object.defineProperty(
|
|
1150
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1180
|
+
}), Object.defineProperty(a, "city", {
|
|
1181
|
+
get: () => (this._addressCity || (this._addressCity = new L(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1151
1182
|
enumerable: !0
|
|
1152
|
-
}), Object.defineProperty(
|
|
1153
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1183
|
+
}), Object.defineProperty(a, "state", {
|
|
1184
|
+
get: () => (this._addressState || (this._addressState = new H(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1154
1185
|
enumerable: !0
|
|
1155
|
-
}), Object.defineProperty(
|
|
1156
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1186
|
+
}), Object.defineProperty(a, "zipCode", {
|
|
1187
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new W(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1157
1188
|
enumerable: !0
|
|
1158
|
-
}), Object.defineProperty(
|
|
1159
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1189
|
+
}), Object.defineProperty(a, "country", {
|
|
1190
|
+
get: () => (this._addressCountry || (this._addressCountry = new z(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1160
1191
|
this._addressState?.setCountry(e);
|
|
1161
1192
|
})), this._addressCountry),
|
|
1162
1193
|
enumerable: !0
|
|
1163
1194
|
});
|
|
1164
1195
|
let o = {
|
|
1165
1196
|
contact: n,
|
|
1166
|
-
express:
|
|
1197
|
+
express: i
|
|
1167
1198
|
};
|
|
1168
1199
|
Object.defineProperty(o, "card", {
|
|
1169
|
-
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this.
|
|
1200
|
+
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._card.setLoadOutcomeListener((e) => {
|
|
1201
|
+
this._readiness.markMounted(), this._readiness.settle(e);
|
|
1202
|
+
}), this._paymentState.vgsJwt ? this._card.setVgsJwt(this._paymentState.vgsJwt) : this._paymentState.cardCapture === "unavailable" ? this._card.markCaptureUnavailable() : this._paymentState.cardCapture === "unsupported" && this._card.resetCardCapture()), this._card),
|
|
1170
1203
|
enumerable: !0
|
|
1171
1204
|
}), Object.defineProperty(o, "cardholderName", {
|
|
1172
1205
|
get: () => (this._cardholderName || (this._cardholderName = new Y(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1173
1206
|
enumerable: !0
|
|
1174
1207
|
}), Object.defineProperty(o, "address", {
|
|
1175
|
-
get: () =>
|
|
1208
|
+
get: () => a,
|
|
1176
1209
|
enumerable: !0
|
|
1177
1210
|
}), Object.defineProperty(o, "error", {
|
|
1178
1211
|
get: () => (this._error || (this._error = new Z(), this._trackElement(this._error)), this._error),
|
|
@@ -1182,19 +1215,26 @@ var le = class {
|
|
|
1182
1215
|
async associatePayment(e, t) {
|
|
1183
1216
|
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1184
1217
|
let n = ++this._associationSequence;
|
|
1185
|
-
|
|
1218
|
+
this._readiness.start(e), fe(this._config.environment);
|
|
1186
1219
|
let r;
|
|
1187
1220
|
try {
|
|
1188
|
-
r = await
|
|
1221
|
+
r = await ae({
|
|
1189
1222
|
id: e,
|
|
1190
1223
|
checkoutKey: t,
|
|
1191
1224
|
environment: this._config.environment
|
|
1192
1225
|
});
|
|
1193
1226
|
} catch (t) {
|
|
1194
|
-
|
|
1227
|
+
if (n === this._associationSequence) {
|
|
1228
|
+
this._paymentState = {};
|
|
1229
|
+
let { ours: e, ...n } = f(t, y.CHECKOUT_DETAILS);
|
|
1230
|
+
e ? this._readiness.fail(n) : this._readiness.exclude(n);
|
|
1231
|
+
}
|
|
1232
|
+
throw C(g.PAYMENT_ASSOCIATION_FAILED, {
|
|
1195
1233
|
payment_id: e,
|
|
1196
|
-
error_message: t instanceof Error ? t.message : "Unknown error"
|
|
1197
|
-
|
|
1234
|
+
error_message: t instanceof Error ? t.message : "Unknown error",
|
|
1235
|
+
stage: y.CHECKOUT_DETAILS,
|
|
1236
|
+
...w(t)
|
|
1237
|
+
}), D(t instanceof Error ? t : Error("Failed to associate payment"), { payment_id: e }), t;
|
|
1198
1238
|
}
|
|
1199
1239
|
n === this._associationSequence && (this._paymentState = {
|
|
1200
1240
|
paymentId: e,
|
|
@@ -1204,7 +1244,7 @@ var le = class {
|
|
|
1204
1244
|
currency: r.currency,
|
|
1205
1245
|
countryCode: r.countryCode
|
|
1206
1246
|
}
|
|
1207
|
-
},
|
|
1247
|
+
}, this._readiness.markAssociated(), C(g.PAYMENT_ASSOCIATED, {
|
|
1208
1248
|
payment_id: e,
|
|
1209
1249
|
currency: r.currency,
|
|
1210
1250
|
country_code: r.countryCode
|
|
@@ -1217,24 +1257,25 @@ var le = class {
|
|
|
1217
1257
|
onAuthorize: (e) => this._executeAuthorization({
|
|
1218
1258
|
formData: null,
|
|
1219
1259
|
applePayData: e
|
|
1220
|
-
})
|
|
1260
|
+
}),
|
|
1261
|
+
onStartFailed: this._onApplePayStartFailed
|
|
1221
1262
|
}), this._paypal?.setPaymentContext({
|
|
1222
1263
|
paymentId: e,
|
|
1223
1264
|
checkoutKey: t,
|
|
1224
1265
|
onAuthorize: async () => {
|
|
1225
1266
|
await this._executeAuthorization({ formData: null });
|
|
1226
1267
|
}
|
|
1227
|
-
}));
|
|
1268
|
+
}), this._settleLoad());
|
|
1228
1269
|
}
|
|
1229
1270
|
validate() {
|
|
1230
|
-
let e = {}, { t } =
|
|
1271
|
+
let e = {}, { t } = A();
|
|
1231
1272
|
return this._card?.isMounted && !this._card.isValid && (e.card = this._card.error ?? t("validation.cardNumberInvalid")), 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.addressLine1Required")), this._addressCity?.isMounted && !this._addressCity.isValid && (e["address.city"] = this._addressCity.error ?? t("validation.townCityRequired")), 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.postalCodeRequired")), this._applePay?.isMounted && !this._applePay.isValid && (e.applePay = "Apple Pay authorization required"), this._paypal?.isMounted && !this._paypal.isValid && (e.paypal = "PayPal authorization required"), {
|
|
1232
1273
|
valid: Object.keys(e).length === 0,
|
|
1233
1274
|
errors: e
|
|
1234
1275
|
};
|
|
1235
1276
|
}
|
|
1236
1277
|
async _getPayload() {
|
|
1237
|
-
let
|
|
1278
|
+
let t = this._email?.isMounted ? this._email.value : "", n = this._phone?.isMounted ? this._phone.value : void 0, r = this._addressStreet?.isMounted || this._addressCity?.isMounted || this._addressCountry?.isMounted || this._addressFirstName?.isMounted || this._addressLastName?.isMounted || this._cardholderName?.isMounted || this._addressState?.isMounted || this._addressZipCode?.isMounted ? {
|
|
1238
1279
|
street: this._addressStreet?.isMounted ? this._addressStreet.value : "",
|
|
1239
1280
|
city: this._addressCity?.isMounted ? this._addressCity.value : "",
|
|
1240
1281
|
country: this._addressCountry?.isMounted ? this._addressCountry.value : "",
|
|
@@ -1242,43 +1283,46 @@ var le = class {
|
|
|
1242
1283
|
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1243
1284
|
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1244
1285
|
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1245
|
-
} : void 0,
|
|
1286
|
+
} : void 0, i = this._cardholderName?.isMounted ? this._cardholderName.value : "", a = [r?.firstName ?? "", r?.lastName ?? ""].filter(Boolean), o = i || a.join(" ");
|
|
1246
1287
|
if (!this._card?.isMounted || this._card.captureState === "unsupported") return {
|
|
1247
1288
|
ok: !1,
|
|
1248
1289
|
error: {
|
|
1249
|
-
message:
|
|
1290
|
+
message: Ne,
|
|
1250
1291
|
status: 0,
|
|
1251
|
-
statusText: "No Payment Method"
|
|
1292
|
+
statusText: "No Payment Method",
|
|
1293
|
+
failureClass: S.NOT_SENT
|
|
1252
1294
|
}
|
|
1253
1295
|
};
|
|
1254
|
-
if (!this._card.isVgsMode) return
|
|
1296
|
+
if (!this._card.isVgsMode) return C(g.CARD_CAPTURE_UNAVAILABLE, { reason: k.NO_TOKENIZATION_SESSION }), {
|
|
1255
1297
|
ok: !1,
|
|
1256
|
-
error: {
|
|
1257
|
-
message:
|
|
1298
|
+
error: l({
|
|
1299
|
+
message: A().t("cardUnavailable"),
|
|
1258
1300
|
status: 0,
|
|
1259
|
-
statusText: "Card Capture Unavailable"
|
|
1260
|
-
|
|
1301
|
+
statusText: "Card Capture Unavailable",
|
|
1302
|
+
failureClass: S.NOT_SENT
|
|
1303
|
+
}, p.CAPTURE_UNAVAILABLE)
|
|
1261
1304
|
};
|
|
1262
1305
|
try {
|
|
1263
|
-
let
|
|
1306
|
+
let e = await this._card.getPayload();
|
|
1264
1307
|
return {
|
|
1265
1308
|
ok: !0,
|
|
1266
1309
|
formData: {
|
|
1267
1310
|
name: o,
|
|
1268
|
-
email:
|
|
1269
|
-
phoneNumber:
|
|
1270
|
-
billingAddress:
|
|
1271
|
-
vgsCardData:
|
|
1311
|
+
email: t,
|
|
1312
|
+
phoneNumber: n || void 0,
|
|
1313
|
+
billingAddress: r,
|
|
1314
|
+
vgsCardData: e
|
|
1272
1315
|
}
|
|
1273
1316
|
};
|
|
1274
|
-
} catch {
|
|
1317
|
+
} catch (t) {
|
|
1275
1318
|
return {
|
|
1276
1319
|
ok: !1,
|
|
1277
|
-
error: {
|
|
1278
|
-
message:
|
|
1320
|
+
error: l({
|
|
1321
|
+
message: Me,
|
|
1279
1322
|
status: 0,
|
|
1280
|
-
statusText: "Card Tokenization Failed"
|
|
1281
|
-
|
|
1323
|
+
statusText: "Card Tokenization Failed",
|
|
1324
|
+
failureClass: S.NOT_SENT
|
|
1325
|
+
}, e(t) ?? p.SDK_ERROR)
|
|
1282
1326
|
};
|
|
1283
1327
|
}
|
|
1284
1328
|
}
|
|
@@ -1306,7 +1350,7 @@ var le = class {
|
|
|
1306
1350
|
let t = e["--odus-font-family"];
|
|
1307
1351
|
if (t) {
|
|
1308
1352
|
this._fontCleanup?.();
|
|
1309
|
-
let { cleanup: e } =
|
|
1353
|
+
let { cleanup: e } = ee({ fontFamily: t });
|
|
1310
1354
|
this._fontCleanup = e;
|
|
1311
1355
|
}
|
|
1312
1356
|
for (let t of this._allElements()) t.setTheme(e);
|
|
@@ -1322,18 +1366,24 @@ var le = class {
|
|
|
1322
1366
|
this._changeListeners.push(e);
|
|
1323
1367
|
}
|
|
1324
1368
|
destroy() {
|
|
1325
|
-
this._fontCleanup?.(), this._card?.destroy(), this._email?.destroy(), this._phone?.destroy(), this._addressStreet?.destroy(), this._addressFirstName?.destroy(), this._addressLastName?.destroy(), this._cardholderName?.destroy(), this._addressCity?.destroy(), this._addressState?.destroy(), this._addressZipCode?.destroy(), this._addressCountry?.destroy(), this._applePay?.destroy(), this._paypal?.destroy(), this._error?.destroy(), this._changeListeners.length = 0;
|
|
1369
|
+
this._readiness.leave(), this._fontCleanup?.(), this._card?.destroy(), this._email?.destroy(), this._phone?.destroy(), this._addressStreet?.destroy(), this._addressFirstName?.destroy(), this._addressLastName?.destroy(), this._cardholderName?.destroy(), this._addressCity?.destroy(), this._addressState?.destroy(), this._addressZipCode?.destroy(), this._addressCountry?.destroy(), this._applePay?.destroy(), this._paypal?.destroy(), this._error?.destroy(), this._changeListeners.length = 0;
|
|
1326
1370
|
}
|
|
1327
1371
|
setCallbacks(e) {
|
|
1328
1372
|
Object.assign(this._callbacks, e);
|
|
1329
1373
|
}
|
|
1374
|
+
_onApplePayStartFailed = (e) => this._readiness.reportSubmit(o(e));
|
|
1330
1375
|
_trackElement(e) {
|
|
1331
|
-
e.
|
|
1332
|
-
|
|
1376
|
+
e.setMountFailureListener((e) => {
|
|
1377
|
+
e === v.MOUNT_FAILED ? this._readiness.fail({ reason: e }) : this._readiness.exclude({ reason: e });
|
|
1378
|
+
}), e.on("ready", () => {
|
|
1379
|
+
this._mountedReported || (this._mountedReported = !0, C(g.CHECKOUT_MOUNTED, { container_id: "elements" })), this._readiness.markMounted(), this._settleLoad();
|
|
1333
1380
|
}), e.on("change", () => {
|
|
1334
1381
|
for (let e of this._changeListeners) e();
|
|
1335
1382
|
});
|
|
1336
1383
|
}
|
|
1384
|
+
_settleLoad() {
|
|
1385
|
+
this._allElements().some((e) => e.isMounted && (e !== this._card || this._card.captureState !== "unsupported")) && (this._paymentState.cardCapture !== "unsupported" && this._card?.isMounted || this._readiness.ready());
|
|
1386
|
+
}
|
|
1337
1387
|
_allElements() {
|
|
1338
1388
|
return [
|
|
1339
1389
|
this._card,
|
|
@@ -1353,19 +1403,20 @@ var le = class {
|
|
|
1353
1403
|
].filter((e) => e !== void 0);
|
|
1354
1404
|
}
|
|
1355
1405
|
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1356
|
-
let { paymentId: r, checkoutKey: i } = this._paymentState,
|
|
1406
|
+
let { paymentId: r, checkoutKey: i } = this._paymentState, a = this._getPaymentMethod(e, t);
|
|
1357
1407
|
if (!r || !i) return this._reportSubmitFailure({
|
|
1358
|
-
message:
|
|
1408
|
+
message: Pe,
|
|
1359
1409
|
status: 0,
|
|
1360
|
-
statusText: "No Associated Payment"
|
|
1361
|
-
|
|
1362
|
-
|
|
1410
|
+
statusText: "No Associated Payment",
|
|
1411
|
+
failureClass: S.NOT_SENT
|
|
1412
|
+
}, a), !1;
|
|
1413
|
+
this._emitLoadingState(!0), C(g.PAYMENT_SUBMIT_STARTED, {
|
|
1363
1414
|
payment_id: r,
|
|
1364
|
-
payment_method:
|
|
1415
|
+
payment_method: a
|
|
1365
1416
|
});
|
|
1366
|
-
let
|
|
1417
|
+
let o = performance.now();
|
|
1367
1418
|
try {
|
|
1368
|
-
let
|
|
1419
|
+
let s = await this._apiService.authorizePayment({
|
|
1369
1420
|
paymentId: r,
|
|
1370
1421
|
checkoutKey: i,
|
|
1371
1422
|
formData: e,
|
|
@@ -1373,24 +1424,28 @@ var le = class {
|
|
|
1373
1424
|
applePayData: t,
|
|
1374
1425
|
customCustomerData: n
|
|
1375
1426
|
});
|
|
1376
|
-
return
|
|
1427
|
+
return this._readiness.reportSubmit({
|
|
1428
|
+
outcome: le.SUCCEEDED,
|
|
1429
|
+
paymentMethod: a
|
|
1430
|
+
}), x(T.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1377
1431
|
payment_id: r,
|
|
1378
|
-
payment_method:
|
|
1432
|
+
payment_method: a,
|
|
1379
1433
|
status: "success"
|
|
1380
|
-
}),
|
|
1434
|
+
}), C(g.PAYMENT_SUBMIT_SUCCESS, {
|
|
1381
1435
|
payment_id: r,
|
|
1382
|
-
payment_method:
|
|
1383
|
-
}), this._handlePaymentResponse(
|
|
1436
|
+
payment_method: a
|
|
1437
|
+
}), this._handlePaymentResponse(s);
|
|
1384
1438
|
} catch (e) {
|
|
1385
|
-
return
|
|
1439
|
+
return x(T.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1386
1440
|
payment_id: r,
|
|
1387
|
-
payment_method:
|
|
1441
|
+
payment_method: a,
|
|
1388
1442
|
status: "failed"
|
|
1389
|
-
}),
|
|
1443
|
+
}), C(g.PAYMENT_SUBMIT_FAILED, {
|
|
1390
1444
|
payment_id: r,
|
|
1391
|
-
payment_method:
|
|
1392
|
-
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1393
|
-
|
|
1445
|
+
payment_method: a,
|
|
1446
|
+
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1447
|
+
...w(e)
|
|
1448
|
+
}), this._readiness.reportSubmit(d(e, a)), this._handleAuthorizationError(e), !1;
|
|
1394
1449
|
} finally {
|
|
1395
1450
|
this._emitLoadingState(!1);
|
|
1396
1451
|
}
|
|
@@ -1405,35 +1460,36 @@ var le = class {
|
|
|
1405
1460
|
}
|
|
1406
1461
|
_handlePaymentResponse(e) {
|
|
1407
1462
|
let t = this._paymentState.paymentId ?? "";
|
|
1408
|
-
return e.latestTransaction.status === "authorized" ? (
|
|
1463
|
+
return e.latestTransaction.status === "authorized" ? (C(g.PAYMENT_AUTHORIZED, {
|
|
1409
1464
|
payment_id: t,
|
|
1410
1465
|
status: e.latestTransaction.status
|
|
1411
|
-
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (
|
|
1466
|
+
}), m(() => this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status)), !0) : e.latestTransaction.status === "failed" ? (C(g.PAYMENT_FAILED, {
|
|
1412
1467
|
payment_id: t,
|
|
1413
1468
|
status: e.latestTransaction.status
|
|
1414
|
-
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (
|
|
1469
|
+
}), m(() => this._callbacks.onPaymentFailed?.(e.latestTransaction.status)), !1) : e.status === "requires_action" && (C(g.PAYMENT_ACTION_REQUIRED, {
|
|
1415
1470
|
payment_id: t,
|
|
1416
1471
|
status: e.status
|
|
1417
|
-
}), this._callbacks.onActionRequired?.(e.action.redirectUrl), !0);
|
|
1472
|
+
}), m(() => this._callbacks.onActionRequired?.(e.action.redirectUrl)), !0);
|
|
1418
1473
|
}
|
|
1419
1474
|
_reportSubmitFailure(e, t) {
|
|
1420
1475
|
let n = {
|
|
1421
1476
|
payment_id: this._paymentState.paymentId ?? "",
|
|
1422
1477
|
payment_method: t
|
|
1423
1478
|
};
|
|
1424
|
-
|
|
1479
|
+
C(g.PAYMENT_SUBMIT_STARTED, n), C(g.PAYMENT_SUBMIT_FAILED, {
|
|
1425
1480
|
...n,
|
|
1426
|
-
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1427
|
-
|
|
1481
|
+
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1482
|
+
...w(e)
|
|
1483
|
+
}), this._readiness.reportSubmit(d(e, t)), this._handleAuthorizationError(e);
|
|
1428
1484
|
}
|
|
1429
1485
|
_handleAuthorizationError(e) {
|
|
1430
|
-
let t = this._readErrorMessage(e,
|
|
1486
|
+
let t = this._readErrorMessage(e, je);
|
|
1431
1487
|
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1432
1488
|
}
|
|
1433
1489
|
_readErrorMessage(e, t) {
|
|
1434
1490
|
let n = e;
|
|
1435
|
-
return typeof n?.message == "string" && n.message ? n.message :
|
|
1491
|
+
return typeof n?.message == "string" && n.message ? n.message : ne(n?.details) ?? t;
|
|
1436
1492
|
}
|
|
1437
1493
|
};
|
|
1438
1494
|
//#endregion
|
|
1439
|
-
export {
|
|
1495
|
+
export { L as AddressCityElement, z as AddressCountryElement, B as AddressFirstNameElement, V as AddressLastNameElement, H as AddressStateElement, U as AddressStreetElement, W as AddressZipCodeElement, G as ApplePayElement, I as BaseElement, J as CardElement, Y as CardholderElement, X as EmailElement, Z as ErrorElement, Fe as OdusElements, Q as PayPalElement, $ as PhoneElement };
|