@odus/checkout 1.13.0 → 1.14.1
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 +190 -166
- package/dist/components/checkout/form/Form.d.ts +11 -1
- package/dist/components/checkout/form/Form.d.ts.map +1 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts +4 -0
- 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 +4 -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 +7 -0
- package/dist/elements/BaseElement.d.ts.map +1 -1
- package/dist/elements/OdusElements.d.ts +2 -1
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
- package/dist/elements.es.js +243 -219
- package/dist/phone.js +2 -0
- package/dist/services/checkout/Checkout.service.d.ts +1 -1
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/services/checkout/CheckoutForm.service.d.ts +2 -1
- 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 +1312 -1049
- 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 +156 -3
- 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 +1 -1
- package/dist/services/telemetry/LoadTimer.service.d.ts +0 -28
- package/dist/services/telemetry/LoadTimer.service.d.ts.map +0 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,27 +1,32 @@
|
|
|
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
|
|
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
8
|
elementName = "BaseElement";
|
|
9
9
|
mountTarget = null;
|
|
10
|
+
_mountFailureListener = null;
|
|
10
11
|
listeners = /* @__PURE__ */ new Map();
|
|
11
12
|
get isMounted() {
|
|
12
13
|
return this.host !== null;
|
|
13
14
|
}
|
|
14
|
-
|
|
15
|
+
setMountFailureListener(e) {
|
|
16
|
+
this._mountFailureListener = e;
|
|
17
|
+
}
|
|
18
|
+
mount(e) {
|
|
15
19
|
this.isMounted && this.unmount();
|
|
20
|
+
let t = !1;
|
|
16
21
|
try {
|
|
17
|
-
let
|
|
18
|
-
if (!
|
|
19
|
-
this.mountTarget =
|
|
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);
|
|
20
25
|
} catch (n) {
|
|
21
|
-
throw this.unmount(),
|
|
22
|
-
container_id:
|
|
26
|
+
throw this.unmount(), C(g.CHECKOUT_MOUNT_FAILED, {
|
|
27
|
+
container_id: F(e),
|
|
23
28
|
error_message: n instanceof Error ? n.message : "Unknown error"
|
|
24
|
-
}),
|
|
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;
|
|
25
30
|
}
|
|
26
31
|
this.emit("ready");
|
|
27
32
|
}
|
|
@@ -77,17 +82,17 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
77
82
|
this.options.callbacks?.[e]?.(t);
|
|
78
83
|
}
|
|
79
84
|
getCss() {
|
|
80
|
-
return
|
|
85
|
+
return ve;
|
|
81
86
|
}
|
|
82
|
-
},
|
|
87
|
+
}, L = class extends I {
|
|
83
88
|
_value = "";
|
|
84
89
|
_error = null;
|
|
85
90
|
_input = null;
|
|
86
91
|
render() {
|
|
87
92
|
if (!this.shadowRoot) return;
|
|
88
93
|
this._input?.getElement().remove();
|
|
89
|
-
let { t: e } =
|
|
90
|
-
this._input = new
|
|
94
|
+
let { t: e } = A();
|
|
95
|
+
this._input = new _({
|
|
91
96
|
name: "billingAddress.city",
|
|
92
97
|
label: this.options.label ?? e("address.townCity"),
|
|
93
98
|
error: !1,
|
|
@@ -98,15 +103,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
98
103
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
99
104
|
}
|
|
100
105
|
}), this._input.addEventListener("blur", () => {
|
|
101
|
-
let { t: e } =
|
|
106
|
+
let { t: e } = A();
|
|
102
107
|
this._error = this._value.trim() ? null : e("validation.townCityRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
103
108
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
104
109
|
}
|
|
105
110
|
getCss() {
|
|
106
111
|
return super.getCss() + [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
112
|
+
N,
|
|
113
|
+
P,
|
|
114
|
+
M
|
|
110
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 ";
|
|
111
116
|
}
|
|
112
117
|
getValue() {
|
|
@@ -118,7 +123,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
118
123
|
getError() {
|
|
119
124
|
return this._error;
|
|
120
125
|
}
|
|
121
|
-
},
|
|
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 {
|
|
122
127
|
_value = "";
|
|
123
128
|
_error = null;
|
|
124
129
|
_select = null;
|
|
@@ -129,28 +134,28 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
129
134
|
render() {
|
|
130
135
|
if (!this.shadowRoot) return;
|
|
131
136
|
this._select?.getElement().remove(), this.options.initialValue && !this._value && (this._value = String(this.options.initialValue), this.emit("change", this._value));
|
|
132
|
-
let { t: e, locale: t } =
|
|
133
|
-
this._select = new
|
|
137
|
+
let { t: e, locale: t } = A();
|
|
138
|
+
this._select = new h({
|
|
134
139
|
name: "billingAddress.country",
|
|
135
140
|
label: this.options.label ?? e("address.chooseCountry"),
|
|
136
141
|
error: !1,
|
|
137
142
|
placeholder: this.options.placeholder ?? e("address.chooseCountry"),
|
|
138
143
|
value: this._value,
|
|
139
|
-
options:
|
|
144
|
+
options: ce(this._allowedCountries, t),
|
|
140
145
|
autocomplete: "country",
|
|
141
146
|
onChange: (e) => {
|
|
142
147
|
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
143
148
|
}
|
|
144
149
|
}), this._select.addEventListener("blur", () => {
|
|
145
|
-
let { t: e } =
|
|
150
|
+
let { t: e } = A();
|
|
146
151
|
this._error = this._value ? null : e("validation.countryRequired"), this._select?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
147
152
|
}), this.shadowRoot.appendChild(this._select.getElement());
|
|
148
153
|
}
|
|
149
154
|
getCss() {
|
|
150
155
|
return super.getCss() + [
|
|
156
|
+
P,
|
|
151
157
|
M,
|
|
152
|
-
|
|
153
|
-
I
|
|
158
|
+
R
|
|
154
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 ";
|
|
155
160
|
}
|
|
156
161
|
getValue() {
|
|
@@ -162,15 +167,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
162
167
|
getError() {
|
|
163
168
|
return this._error;
|
|
164
169
|
}
|
|
165
|
-
},
|
|
170
|
+
}, B = class extends I {
|
|
166
171
|
_value = "";
|
|
167
172
|
_error = null;
|
|
168
173
|
_input = null;
|
|
169
174
|
render() {
|
|
170
175
|
if (!this.shadowRoot) return;
|
|
171
176
|
this._input?.getElement().remove();
|
|
172
|
-
let { t: e } =
|
|
173
|
-
this._input = new
|
|
177
|
+
let { t: e } = A();
|
|
178
|
+
this._input = new _({
|
|
174
179
|
name: "billingAddress.firstName",
|
|
175
180
|
label: this.options.label ?? e("address.firstName"),
|
|
176
181
|
error: !1,
|
|
@@ -181,15 +186,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
181
186
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
182
187
|
}
|
|
183
188
|
}), this._input.addEventListener("blur", () => {
|
|
184
|
-
let { t: e } =
|
|
189
|
+
let { t: e } = A();
|
|
185
190
|
this._error = this._value.trim() ? null : e("validation.firstNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
186
191
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
187
192
|
}
|
|
188
193
|
getCss() {
|
|
189
194
|
return super.getCss() + [
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
195
|
+
N,
|
|
196
|
+
P,
|
|
197
|
+
M
|
|
193
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 ";
|
|
194
199
|
}
|
|
195
200
|
getValue() {
|
|
@@ -201,15 +206,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
201
206
|
getError() {
|
|
202
207
|
return this._error;
|
|
203
208
|
}
|
|
204
|
-
},
|
|
209
|
+
}, V = class extends I {
|
|
205
210
|
_value = "";
|
|
206
211
|
_error = null;
|
|
207
212
|
_input = null;
|
|
208
213
|
render() {
|
|
209
214
|
if (!this.shadowRoot) return;
|
|
210
215
|
this._input?.getElement().remove();
|
|
211
|
-
let { t: e } =
|
|
212
|
-
this._input = new
|
|
216
|
+
let { t: e } = A();
|
|
217
|
+
this._input = new _({
|
|
213
218
|
name: "billingAddress.lastName",
|
|
214
219
|
label: this.options.label ?? e("address.lastName"),
|
|
215
220
|
error: !1,
|
|
@@ -220,15 +225,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
220
225
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
221
226
|
}
|
|
222
227
|
}), this._input.addEventListener("blur", () => {
|
|
223
|
-
let { t: e } =
|
|
228
|
+
let { t: e } = A();
|
|
224
229
|
this._error = this._value.trim() ? null : e("validation.lastNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
225
230
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
226
231
|
}
|
|
227
232
|
getCss() {
|
|
228
233
|
return super.getCss() + [
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
234
|
+
N,
|
|
235
|
+
P,
|
|
236
|
+
M
|
|
232
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 ";
|
|
233
238
|
}
|
|
234
239
|
getValue() {
|
|
@@ -240,7 +245,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
240
245
|
getError() {
|
|
241
246
|
return this._error;
|
|
242
247
|
}
|
|
243
|
-
},
|
|
248
|
+
}, H = class extends I {
|
|
244
249
|
_value = "";
|
|
245
250
|
_country = "";
|
|
246
251
|
_input = null;
|
|
@@ -248,20 +253,20 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
248
253
|
setCountry(e) {
|
|
249
254
|
let t = this._country;
|
|
250
255
|
if (this._country = e, !this.shadowRoot) return;
|
|
251
|
-
let n =
|
|
256
|
+
let n = u(t), r = u(e);
|
|
252
257
|
if (n && r && t !== e) {
|
|
253
|
-
let { t } =
|
|
258
|
+
let { t } = A(), n = j(e), r = t(c(n));
|
|
254
259
|
this._select?.setOptions(a(n), this.options.placeholder ?? r), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
255
260
|
return;
|
|
256
261
|
}
|
|
257
262
|
n !== r && (this._value = "", this.render(), this.emit("change", this._value));
|
|
258
263
|
}
|
|
259
264
|
render() {
|
|
260
|
-
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());
|
|
261
266
|
}
|
|
262
267
|
_renderInput() {
|
|
263
|
-
let { t: e } =
|
|
264
|
-
this._input = new
|
|
268
|
+
let { t: e } = A();
|
|
269
|
+
this._input = new _({
|
|
265
270
|
name: "billingAddress.state",
|
|
266
271
|
label: this.options.label ?? e("address.state"),
|
|
267
272
|
error: !1,
|
|
@@ -277,8 +282,8 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
277
282
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
278
283
|
}
|
|
279
284
|
_renderSelect(e) {
|
|
280
|
-
let { t } =
|
|
281
|
-
this._select = new
|
|
285
|
+
let { t } = A(), n = a(e), r = t(c(e));
|
|
286
|
+
this._select = new h({
|
|
282
287
|
name: "billingAddress.state",
|
|
283
288
|
label: this.options.label ?? t("address.state"),
|
|
284
289
|
error: !1,
|
|
@@ -296,10 +301,10 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
296
301
|
}
|
|
297
302
|
getCss() {
|
|
298
303
|
return super.getCss() + [
|
|
299
|
-
|
|
304
|
+
N,
|
|
305
|
+
P,
|
|
300
306
|
M,
|
|
301
|
-
|
|
302
|
-
I
|
|
307
|
+
R
|
|
303
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 ";
|
|
304
309
|
}
|
|
305
310
|
getValue() {
|
|
@@ -310,18 +315,18 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
310
315
|
}
|
|
311
316
|
getError() {
|
|
312
317
|
if (this.getIsValid()) return null;
|
|
313
|
-
let { t: e } =
|
|
318
|
+
let { t: e } = A();
|
|
314
319
|
return e("validation.stateRequired");
|
|
315
320
|
}
|
|
316
|
-
},
|
|
321
|
+
}, U = class extends I {
|
|
317
322
|
_value = "";
|
|
318
323
|
_error = null;
|
|
319
324
|
_input = null;
|
|
320
325
|
render() {
|
|
321
326
|
if (!this.shadowRoot) return;
|
|
322
327
|
this._input?.getElement().remove();
|
|
323
|
-
let { t: e } =
|
|
324
|
-
this._input = new
|
|
328
|
+
let { t: e } = A();
|
|
329
|
+
this._input = new _({
|
|
325
330
|
name: "billingAddress.street",
|
|
326
331
|
label: this.options.label ?? e("address.addressLine1"),
|
|
327
332
|
error: !1,
|
|
@@ -337,15 +342,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
337
342
|
this.emit("change", this._value);
|
|
338
343
|
}
|
|
339
344
|
}), this._input.addEventListener("blur", () => {
|
|
340
|
-
let { t: e } =
|
|
345
|
+
let { t: e } = A();
|
|
341
346
|
this._error = this._value.trim() ? null : e("validation.addressLine1Required"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
342
347
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
343
348
|
}
|
|
344
349
|
getCss() {
|
|
345
350
|
return super.getCss() + [
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
351
|
+
N,
|
|
352
|
+
P,
|
|
353
|
+
M
|
|
349
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 ";
|
|
350
355
|
}
|
|
351
356
|
getValue() {
|
|
@@ -357,15 +362,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
357
362
|
getError() {
|
|
358
363
|
return this._error;
|
|
359
364
|
}
|
|
360
|
-
},
|
|
365
|
+
}, W = class extends I {
|
|
361
366
|
_value = "";
|
|
362
367
|
_error = null;
|
|
363
368
|
_input = null;
|
|
364
369
|
render() {
|
|
365
370
|
if (!this.shadowRoot) return;
|
|
366
371
|
this._input?.getElement().remove();
|
|
367
|
-
let { t: e } =
|
|
368
|
-
this._input = new
|
|
372
|
+
let { t: e } = A();
|
|
373
|
+
this._input = new _({
|
|
369
374
|
name: "billingAddress.zipCode",
|
|
370
375
|
label: this.options.label ?? e("address.postalCode"),
|
|
371
376
|
error: !1,
|
|
@@ -376,15 +381,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
376
381
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
377
382
|
}
|
|
378
383
|
}), this._input.addEventListener("blur", () => {
|
|
379
|
-
let { t: e } =
|
|
384
|
+
let { t: e } = A();
|
|
380
385
|
this._error = this._value.trim() ? null : e("validation.postalCodeRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
381
386
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
382
387
|
}
|
|
383
388
|
getCss() {
|
|
384
389
|
return super.getCss() + [
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
390
|
+
N,
|
|
391
|
+
P,
|
|
392
|
+
M
|
|
388
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 ";
|
|
389
394
|
}
|
|
390
395
|
getValue() {
|
|
@@ -396,7 +401,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
396
401
|
getError() {
|
|
397
402
|
return this._error;
|
|
398
403
|
}
|
|
399
|
-
},
|
|
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 = {
|
|
400
405
|
name: "odus-elements",
|
|
401
406
|
styles: {
|
|
402
407
|
fontSize: 14,
|
|
@@ -420,7 +425,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
420
425
|
}
|
|
421
426
|
},
|
|
422
427
|
additionalPaymentMethods: {}
|
|
423
|
-
}, G = class extends
|
|
428
|
+
}, G = class extends I {
|
|
424
429
|
_paymentContext = null;
|
|
425
430
|
_applePayData = null;
|
|
426
431
|
_authorized = !1;
|
|
@@ -438,17 +443,17 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
438
443
|
this._setAvailability(!1);
|
|
439
444
|
return;
|
|
440
445
|
}
|
|
441
|
-
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c } = this._paymentContext;
|
|
442
|
-
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)) {
|
|
443
448
|
this._setAvailability(!1);
|
|
444
449
|
return;
|
|
445
450
|
}
|
|
446
|
-
if (!
|
|
451
|
+
if (!b()) {
|
|
447
452
|
this._setAvailability(!1);
|
|
448
453
|
return;
|
|
449
454
|
}
|
|
450
|
-
this._button = new
|
|
451
|
-
checkoutProfile:
|
|
455
|
+
this._button = new pe({
|
|
456
|
+
checkoutProfile: be,
|
|
452
457
|
paymentId: e,
|
|
453
458
|
checkoutKey: t,
|
|
454
459
|
environment: n,
|
|
@@ -456,6 +461,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
456
461
|
displayName: i,
|
|
457
462
|
requiredBillingContactFields: o,
|
|
458
463
|
requiredShippingContactFields: s,
|
|
464
|
+
onStartFailed: l,
|
|
459
465
|
onSubmit: async ({ applePayData: e }) => {
|
|
460
466
|
if (!e) return !1;
|
|
461
467
|
this._applePayData = e, this._authorized = !0, this.emit("change", e);
|
|
@@ -468,7 +474,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
468
474
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
469
475
|
}
|
|
470
476
|
getCss() {
|
|
471
|
-
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 ";
|
|
472
478
|
}
|
|
473
479
|
getValue() {
|
|
474
480
|
return this._applePayData;
|
|
@@ -479,7 +485,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
479
485
|
getError() {
|
|
480
486
|
return null;
|
|
481
487
|
}
|
|
482
|
-
},
|
|
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 = {
|
|
483
489
|
name: "odus-elements",
|
|
484
490
|
styles: {
|
|
485
491
|
fontSize: 14,
|
|
@@ -527,11 +533,11 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
527
533
|
"--odus-button-height": "48px",
|
|
528
534
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
529
535
|
}["--odus-font-size"];
|
|
530
|
-
function
|
|
536
|
+
function Se(e, t) {
|
|
531
537
|
let n = Object.keys(e);
|
|
532
538
|
return n.length === Object.keys(t).length && n.every((n) => e[n] === t[n]);
|
|
533
539
|
}
|
|
534
|
-
var
|
|
540
|
+
var Ce = class {
|
|
535
541
|
_vgsService;
|
|
536
542
|
_vgsJwt;
|
|
537
543
|
_vgsState = {};
|
|
@@ -552,7 +558,7 @@ var fe = class {
|
|
|
552
558
|
}
|
|
553
559
|
renderSection(e, t) {
|
|
554
560
|
this._section?.getElement().remove();
|
|
555
|
-
let { t: n } =
|
|
561
|
+
let { t: n } = A();
|
|
556
562
|
this._section = new oe({
|
|
557
563
|
checkoutProfile: K,
|
|
558
564
|
translationFunc: n,
|
|
@@ -566,7 +572,7 @@ var fe = class {
|
|
|
566
572
|
}
|
|
567
573
|
_onChangeEmit = null;
|
|
568
574
|
initVgs() {
|
|
569
|
-
let e = ++this._initGeneration, t = { ...this._currentTheme }, n =
|
|
575
|
+
let e = ++this._initGeneration, t = { ...this._currentTheme }, n = ge(this._buildProfileFromTheme(t).styles.fontFamily);
|
|
570
576
|
this._vgsService.init(this._environment).then((r) => {
|
|
571
577
|
e === this._initGeneration && (this._vgsService.createForm(r, (e) => this._handleStateChange(e)), this._mountFields(e, t, n).catch((t) => {
|
|
572
578
|
e === this._initGeneration && (console.error("Failed to mount VGS card fields:", t), this._onFieldsNotReady?.());
|
|
@@ -576,7 +582,7 @@ var fe = class {
|
|
|
576
582
|
});
|
|
577
583
|
}
|
|
578
584
|
async getPayload() {
|
|
579
|
-
if (!this._vgsJwt) throw Error("VGS not initialized");
|
|
585
|
+
if (!this._vgsJwt) throw l(/* @__PURE__ */ Error("VGS not initialized"), p.NOT_INITIALIZED);
|
|
580
586
|
let e = await this._vgsService.createCard(this._vgsJwt);
|
|
581
587
|
return {
|
|
582
588
|
cardId: e.cardId,
|
|
@@ -589,12 +595,12 @@ var fe = class {
|
|
|
589
595
|
return this._vgsFieldsValid;
|
|
590
596
|
}
|
|
591
597
|
getError() {
|
|
592
|
-
let { t: e } =
|
|
598
|
+
let { t: e } = A();
|
|
593
599
|
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
594
600
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
595
601
|
let r = n.errors?.[0];
|
|
596
602
|
if (!r) continue;
|
|
597
|
-
let i =
|
|
603
|
+
let i = O(t, r.code);
|
|
598
604
|
if (i) return e(i);
|
|
599
605
|
}
|
|
600
606
|
return null;
|
|
@@ -604,7 +610,7 @@ var fe = class {
|
|
|
604
610
|
...this._currentTheme,
|
|
605
611
|
...e
|
|
606
612
|
};
|
|
607
|
-
|
|
613
|
+
Se(this._currentTheme, t) || (this._currentTheme = t, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme()));
|
|
608
614
|
}
|
|
609
615
|
resetTheme(e) {
|
|
610
616
|
let t = e.filter((e) => e in this._currentTheme);
|
|
@@ -652,7 +658,7 @@ var fe = class {
|
|
|
652
658
|
placeholderColor: t["--odus-input-placeholder-color"],
|
|
653
659
|
placeholderOpacity: t["--odus-input-placeholder-opacity"],
|
|
654
660
|
padding: t["--odus-input-padding"]
|
|
655
|
-
}), { t: c } =
|
|
661
|
+
}), { t: c } = A();
|
|
656
662
|
this._vgsService.mountCardFields({
|
|
657
663
|
cardNumber: a.cardNumber ? `#${a.cardNumber}` : void 0,
|
|
658
664
|
cardExpiry: a.cardExpiry ? `#${a.cardExpiry}` : void 0,
|
|
@@ -672,7 +678,7 @@ var fe = class {
|
|
|
672
678
|
}
|
|
673
679
|
_handleStateChange(e) {
|
|
674
680
|
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
675
|
-
let { t } =
|
|
681
|
+
let { t } = A(), n = this._deriveFieldErrors(t);
|
|
676
682
|
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
677
683
|
}
|
|
678
684
|
_deriveFieldErrors(e) {
|
|
@@ -681,19 +687,19 @@ var fe = class {
|
|
|
681
687
|
if (!r?.isTouched || r.isFocused || r.isValid) continue;
|
|
682
688
|
let i = r.errors?.[0];
|
|
683
689
|
if (!i) continue;
|
|
684
|
-
let a =
|
|
690
|
+
let a = O(n, i.code);
|
|
685
691
|
a && (t[n] = e(a));
|
|
686
692
|
}
|
|
687
693
|
return t;
|
|
688
694
|
}
|
|
689
|
-
},
|
|
695
|
+
}, we = "Card capture is unavailable: no tokenization session", J = class extends I {
|
|
690
696
|
elementName = "CardElement";
|
|
691
697
|
_environment = "test";
|
|
692
698
|
_captureState = "pending";
|
|
693
699
|
_vgsAdapter = null;
|
|
694
700
|
_vgsJwt = null;
|
|
695
701
|
_reportedUnavailable = !1;
|
|
696
|
-
_unavailableReason =
|
|
702
|
+
_unavailableReason = k.NO_TOKENIZATION_SESSION;
|
|
697
703
|
_loadOutcomeListener = null;
|
|
698
704
|
get isVgsMode() {
|
|
699
705
|
return this._captureState === "vgs";
|
|
@@ -710,12 +716,12 @@ var fe = class {
|
|
|
710
716
|
setVgsJwt(e) {
|
|
711
717
|
if (this._vgsAdapter && this._vgsJwt === e) return;
|
|
712
718
|
this._captureState = "vgs", this._reportedUnavailable = !1, this._vgsJwt = e, this._vgsAdapter?.destroy();
|
|
713
|
-
let t = new
|
|
719
|
+
let t = new Ce(e, this._environment, {
|
|
714
720
|
onInitFailure: () => {
|
|
715
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
721
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(k.INIT_FAILED);
|
|
716
722
|
},
|
|
717
723
|
onFieldsNotReady: () => {
|
|
718
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
724
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(k.FIELDS_NOT_READY);
|
|
719
725
|
},
|
|
720
726
|
onFieldsReady: () => {
|
|
721
727
|
this._vgsAdapter === t && this.isMounted && this._loadOutcomeListener?.({ status: "ready" });
|
|
@@ -723,7 +729,7 @@ var fe = class {
|
|
|
723
729
|
});
|
|
724
730
|
this._vgsAdapter = t, this.isMounted && this.mountTarget && (this.unmount(), this.mount(this.mountTarget));
|
|
725
731
|
}
|
|
726
|
-
markCaptureUnavailable(e =
|
|
732
|
+
markCaptureUnavailable(e = k.NO_TOKENIZATION_SESSION) {
|
|
727
733
|
if (this._captureState === "unavailable") return;
|
|
728
734
|
let t = this.mountTarget, n = this.isMounted && t !== null;
|
|
729
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);
|
|
@@ -769,7 +775,7 @@ var fe = class {
|
|
|
769
775
|
this.clearBody();
|
|
770
776
|
let e = document.createElement("div");
|
|
771
777
|
e.className = "card-pending";
|
|
772
|
-
let t =
|
|
778
|
+
let t = _e(he, K.styles.fontSize);
|
|
773
779
|
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${K.styles.borderRadius}px)`;
|
|
774
780
|
let n = document.createElement("div");
|
|
775
781
|
n.className = "vgs-field-skeleton", e.appendChild(n), this.shadowRoot.appendChild(e);
|
|
@@ -777,11 +783,11 @@ var fe = class {
|
|
|
777
783
|
renderUnavailableNotice() {
|
|
778
784
|
if (!this.shadowRoot) return;
|
|
779
785
|
this.clearBody();
|
|
780
|
-
let { t: e } =
|
|
786
|
+
let { t: e } = A(), t = new me({
|
|
781
787
|
checkoutProfile: K,
|
|
782
788
|
translationFunc: e
|
|
783
789
|
});
|
|
784
|
-
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?.({
|
|
785
791
|
status: "failed",
|
|
786
792
|
reason: this._unavailableReason
|
|
787
793
|
});
|
|
@@ -803,10 +809,10 @@ var fe = class {
|
|
|
803
809
|
}
|
|
804
810
|
getCss() {
|
|
805
811
|
return super.getCss() + [
|
|
806
|
-
|
|
812
|
+
N,
|
|
813
|
+
P,
|
|
807
814
|
M,
|
|
808
|
-
|
|
809
|
-
ue
|
|
815
|
+
xe
|
|
810
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 ";
|
|
811
817
|
}
|
|
812
818
|
getValue() {
|
|
@@ -817,24 +823,24 @@ var fe = class {
|
|
|
817
823
|
};
|
|
818
824
|
}
|
|
819
825
|
async getPayload() {
|
|
820
|
-
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(
|
|
826
|
+
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(we);
|
|
821
827
|
return this._vgsAdapter.getPayload();
|
|
822
828
|
}
|
|
823
829
|
getIsValid() {
|
|
824
830
|
return this._captureState === "unsupported" ? !0 : this._vgsAdapter?.isValid() ?? !1;
|
|
825
831
|
}
|
|
826
832
|
getError() {
|
|
827
|
-
return this._captureState === "unavailable" ?
|
|
833
|
+
return this._captureState === "unavailable" ? A().t("cardUnavailable") : this._vgsAdapter?.getError() ?? null;
|
|
828
834
|
}
|
|
829
|
-
}, Y = class extends
|
|
835
|
+
}, Y = class extends I {
|
|
830
836
|
_value = "";
|
|
831
837
|
_error = null;
|
|
832
838
|
_input = null;
|
|
833
839
|
render() {
|
|
834
840
|
if (!this.shadowRoot) return;
|
|
835
841
|
this._input?.getElement().remove();
|
|
836
|
-
let { t: e } =
|
|
837
|
-
this._input = new
|
|
842
|
+
let { t: e } = A();
|
|
843
|
+
this._input = new _({
|
|
838
844
|
name: "billingAddress.cardholderName",
|
|
839
845
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
840
846
|
error: !1,
|
|
@@ -846,15 +852,15 @@ var fe = class {
|
|
|
846
852
|
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
847
853
|
}
|
|
848
854
|
}), this._input.addEventListener("blur", () => {
|
|
849
|
-
let { t: e } =
|
|
855
|
+
let { t: e } = A();
|
|
850
856
|
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
851
857
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
852
858
|
}
|
|
853
859
|
getCss() {
|
|
854
860
|
return super.getCss() + [
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
861
|
+
N,
|
|
862
|
+
P,
|
|
863
|
+
M
|
|
858
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 ";
|
|
859
865
|
}
|
|
860
866
|
getValue() {
|
|
@@ -866,7 +872,7 @@ var fe = class {
|
|
|
866
872
|
getError() {
|
|
867
873
|
return this._error;
|
|
868
874
|
}
|
|
869
|
-
},
|
|
875
|
+
}, Te = {
|
|
870
876
|
name: "odus-elements",
|
|
871
877
|
styles: {
|
|
872
878
|
fontSize: 14,
|
|
@@ -890,7 +896,7 @@ var fe = class {
|
|
|
890
896
|
}
|
|
891
897
|
},
|
|
892
898
|
additionalPaymentMethods: {}
|
|
893
|
-
}, X = class extends
|
|
899
|
+
}, X = class extends I {
|
|
894
900
|
_email = "";
|
|
895
901
|
_error = null;
|
|
896
902
|
_suggestion = null;
|
|
@@ -898,11 +904,11 @@ var fe = class {
|
|
|
898
904
|
render() {
|
|
899
905
|
if (!this.shadowRoot) return;
|
|
900
906
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
901
|
-
let { t: e } =
|
|
902
|
-
this._field = new
|
|
907
|
+
let { t: e } = A();
|
|
908
|
+
this._field = new de({
|
|
903
909
|
value: this._email,
|
|
904
910
|
error: !1,
|
|
905
|
-
checkoutProfile:
|
|
911
|
+
checkoutProfile: Te,
|
|
906
912
|
translationFunc: e,
|
|
907
913
|
label: this.options.label,
|
|
908
914
|
placeholder: this.options.placeholder,
|
|
@@ -918,9 +924,9 @@ var fe = class {
|
|
|
918
924
|
}
|
|
919
925
|
getCss() {
|
|
920
926
|
return super.getCss() + [
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
927
|
+
N,
|
|
928
|
+
P,
|
|
929
|
+
M
|
|
924
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 ";
|
|
925
931
|
}
|
|
926
932
|
getValue() {
|
|
@@ -935,24 +941,24 @@ var fe = class {
|
|
|
935
941
|
get suggestion() {
|
|
936
942
|
return this._suggestion;
|
|
937
943
|
}
|
|
938
|
-
},
|
|
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 {
|
|
939
945
|
_alert = null;
|
|
940
946
|
_message = null;
|
|
941
947
|
render() {
|
|
942
|
-
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())));
|
|
943
949
|
}
|
|
944
950
|
setError(e) {
|
|
945
951
|
if (this._message = e, !this.shadowRoot) {
|
|
946
952
|
this.emit("error", e);
|
|
947
953
|
return;
|
|
948
954
|
}
|
|
949
|
-
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);
|
|
950
956
|
}
|
|
951
957
|
clearError() {
|
|
952
958
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
953
959
|
}
|
|
954
960
|
getCss() {
|
|
955
|
-
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 ";
|
|
956
962
|
}
|
|
957
963
|
getValue() {
|
|
958
964
|
return null;
|
|
@@ -963,7 +969,7 @@ var fe = class {
|
|
|
963
969
|
getError() {
|
|
964
970
|
return this._message;
|
|
965
971
|
}
|
|
966
|
-
},
|
|
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 = {
|
|
967
973
|
name: "odus-elements",
|
|
968
974
|
styles: {
|
|
969
975
|
fontSize: 14,
|
|
@@ -987,7 +993,7 @@ var fe = class {
|
|
|
987
993
|
}
|
|
988
994
|
},
|
|
989
995
|
additionalPaymentMethods: {}
|
|
990
|
-
}, Q = class extends
|
|
996
|
+
}, Q = class extends I {
|
|
991
997
|
_paymentContext = null;
|
|
992
998
|
_button = null;
|
|
993
999
|
setPaymentContext(e) {
|
|
@@ -996,8 +1002,8 @@ var fe = class {
|
|
|
996
1002
|
render() {
|
|
997
1003
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
998
1004
|
let { onAuthorize: e } = this._paymentContext;
|
|
999
|
-
this._button = new
|
|
1000
|
-
checkoutProfile:
|
|
1005
|
+
this._button = new ue({
|
|
1006
|
+
checkoutProfile: Oe,
|
|
1001
1007
|
onSubmit: async () => {
|
|
1002
1008
|
this._button?.setSubmitting(!0);
|
|
1003
1009
|
try {
|
|
@@ -1009,7 +1015,7 @@ var fe = class {
|
|
|
1009
1015
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
1010
1016
|
}
|
|
1011
1017
|
getCss() {
|
|
1012
|
-
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 ";
|
|
1013
1019
|
}
|
|
1014
1020
|
getValue() {
|
|
1015
1021
|
return null;
|
|
@@ -1020,7 +1026,7 @@ var fe = class {
|
|
|
1020
1026
|
getError() {
|
|
1021
1027
|
return null;
|
|
1022
1028
|
}
|
|
1023
|
-
},
|
|
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 = {
|
|
1024
1030
|
name: "odus-elements",
|
|
1025
1031
|
styles: {
|
|
1026
1032
|
fontSize: 14,
|
|
@@ -1044,7 +1050,7 @@ var fe = class {
|
|
|
1044
1050
|
}
|
|
1045
1051
|
},
|
|
1046
1052
|
additionalPaymentMethods: {}
|
|
1047
|
-
}, $ = class extends
|
|
1053
|
+
}, $ = class extends I {
|
|
1048
1054
|
_phone = "";
|
|
1049
1055
|
_error = null;
|
|
1050
1056
|
_field = null;
|
|
@@ -1055,11 +1061,11 @@ var fe = class {
|
|
|
1055
1061
|
let e = ++this._renderGeneration;
|
|
1056
1062
|
i().then(({ PhoneNumberField: t }) => {
|
|
1057
1063
|
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1058
|
-
let { t: r, locale: i } =
|
|
1064
|
+
let { t: r, locale: i } = A();
|
|
1059
1065
|
this._field = new t({
|
|
1060
1066
|
value: this._phone,
|
|
1061
1067
|
error: !1,
|
|
1062
|
-
checkoutProfile:
|
|
1068
|
+
checkoutProfile: Ae,
|
|
1063
1069
|
translationFunc: r,
|
|
1064
1070
|
locale: i,
|
|
1065
1071
|
label: this.options.label,
|
|
@@ -1080,10 +1086,10 @@ var fe = class {
|
|
|
1080
1086
|
}
|
|
1081
1087
|
getCss() {
|
|
1082
1088
|
return super.getCss() + [
|
|
1083
|
-
|
|
1089
|
+
N,
|
|
1090
|
+
P,
|
|
1084
1091
|
M,
|
|
1085
|
-
|
|
1086
|
-
ve
|
|
1092
|
+
ke
|
|
1087
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 ";
|
|
1088
1094
|
}
|
|
1089
1095
|
getValue() {
|
|
@@ -1096,7 +1102,7 @@ var fe = class {
|
|
|
1096
1102
|
getError() {
|
|
1097
1103
|
return this._error;
|
|
1098
1104
|
}
|
|
1099
|
-
},
|
|
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 {
|
|
1100
1106
|
_config;
|
|
1101
1107
|
_apiService;
|
|
1102
1108
|
_changeListeners = [];
|
|
@@ -1106,7 +1112,7 @@ var fe = class {
|
|
|
1106
1112
|
_fontCleanup;
|
|
1107
1113
|
_sessionId;
|
|
1108
1114
|
_mountedReported = !1;
|
|
1109
|
-
|
|
1115
|
+
_readiness = new re();
|
|
1110
1116
|
_card;
|
|
1111
1117
|
_email;
|
|
1112
1118
|
_phone;
|
|
@@ -1123,11 +1129,11 @@ var fe = class {
|
|
|
1123
1129
|
_error;
|
|
1124
1130
|
elements;
|
|
1125
1131
|
constructor(e) {
|
|
1126
|
-
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), r(),
|
|
1132
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), r(), se({
|
|
1127
1133
|
environment: e.environment,
|
|
1128
1134
|
sessionId: this._sessionId,
|
|
1129
1135
|
integration: "elements"
|
|
1130
|
-
}),
|
|
1136
|
+
}), C(g.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && te.setLocale(e.locale), this._apiService = new t(e.apiKey, e.environment);
|
|
1131
1137
|
let n = {};
|
|
1132
1138
|
Object.defineProperty(n, "email", {
|
|
1133
1139
|
get: () => (this._email || (this._email = new X(), this._trackElement(this._email)), this._email),
|
|
@@ -1147,7 +1153,8 @@ var fe = class {
|
|
|
1147
1153
|
onAuthorize: (e) => this._executeAuthorization({
|
|
1148
1154
|
formData: null,
|
|
1149
1155
|
applePayData: e
|
|
1150
|
-
})
|
|
1156
|
+
}),
|
|
1157
|
+
onStartFailed: this._onApplePayStartFailed
|
|
1151
1158
|
})), this._applePay),
|
|
1152
1159
|
enumerable: !0
|
|
1153
1160
|
}), Object.defineProperty(i, "payPal", {
|
|
@@ -1162,25 +1169,25 @@ var fe = class {
|
|
|
1162
1169
|
});
|
|
1163
1170
|
let a = {};
|
|
1164
1171
|
Object.defineProperty(a, "street", {
|
|
1165
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1172
|
+
get: () => (this._addressStreet || (this._addressStreet = new U(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1166
1173
|
enumerable: !0
|
|
1167
1174
|
}), Object.defineProperty(a, "firstName", {
|
|
1168
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1175
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new B(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1169
1176
|
enumerable: !0
|
|
1170
1177
|
}), Object.defineProperty(a, "lastName", {
|
|
1171
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1178
|
+
get: () => (this._addressLastName || (this._addressLastName = new V(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1172
1179
|
enumerable: !0
|
|
1173
1180
|
}), Object.defineProperty(a, "city", {
|
|
1174
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1181
|
+
get: () => (this._addressCity || (this._addressCity = new L(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1175
1182
|
enumerable: !0
|
|
1176
1183
|
}), Object.defineProperty(a, "state", {
|
|
1177
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1184
|
+
get: () => (this._addressState || (this._addressState = new H(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1178
1185
|
enumerable: !0
|
|
1179
1186
|
}), Object.defineProperty(a, "zipCode", {
|
|
1180
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1187
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new W(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1181
1188
|
enumerable: !0
|
|
1182
1189
|
}), Object.defineProperty(a, "country", {
|
|
1183
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1190
|
+
get: () => (this._addressCountry || (this._addressCountry = new z(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1184
1191
|
this._addressState?.setCountry(e);
|
|
1185
1192
|
})), this._addressCountry),
|
|
1186
1193
|
enumerable: !0
|
|
@@ -1191,7 +1198,7 @@ var fe = class {
|
|
|
1191
1198
|
};
|
|
1192
1199
|
Object.defineProperty(o, "card", {
|
|
1193
1200
|
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._card.setLoadOutcomeListener((e) => {
|
|
1194
|
-
this.
|
|
1201
|
+
this._readiness.markMounted(), this._readiness.settle(e);
|
|
1195
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),
|
|
1196
1203
|
enumerable: !0
|
|
1197
1204
|
}), Object.defineProperty(o, "cardholderName", {
|
|
@@ -1205,65 +1212,70 @@ var fe = class {
|
|
|
1205
1212
|
enumerable: !0
|
|
1206
1213
|
}), this.elements = o;
|
|
1207
1214
|
}
|
|
1208
|
-
async associatePayment(
|
|
1209
|
-
if (!
|
|
1210
|
-
let
|
|
1211
|
-
|
|
1212
|
-
let
|
|
1215
|
+
async associatePayment(e, t) {
|
|
1216
|
+
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1217
|
+
let n = ++this._associationSequence;
|
|
1218
|
+
this._readiness.start(e), fe(this._config.environment);
|
|
1219
|
+
let r;
|
|
1213
1220
|
try {
|
|
1214
|
-
|
|
1215
|
-
id:
|
|
1216
|
-
checkoutKey:
|
|
1221
|
+
r = await ae({
|
|
1222
|
+
id: e,
|
|
1223
|
+
checkoutKey: t,
|
|
1217
1224
|
environment: this._config.environment
|
|
1218
1225
|
});
|
|
1219
|
-
} catch (
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1226
|
+
} catch (t) {
|
|
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, {
|
|
1233
|
+
payment_id: e,
|
|
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;
|
|
1227
1238
|
}
|
|
1228
|
-
|
|
1229
|
-
paymentId:
|
|
1230
|
-
checkoutKey:
|
|
1239
|
+
n === this._associationSequence && (this._paymentState = {
|
|
1240
|
+
paymentId: e,
|
|
1241
|
+
checkoutKey: t,
|
|
1231
1242
|
checkoutDetails: {
|
|
1232
|
-
amount:
|
|
1233
|
-
currency:
|
|
1234
|
-
countryCode:
|
|
1243
|
+
amount: r.amount,
|
|
1244
|
+
currency: r.currency,
|
|
1245
|
+
countryCode: r.countryCode
|
|
1235
1246
|
}
|
|
1236
|
-
}, this.
|
|
1237
|
-
payment_id:
|
|
1238
|
-
currency:
|
|
1239
|
-
country_code:
|
|
1240
|
-
}), this._card?.setEnvironment(this._config.environment),
|
|
1241
|
-
paymentId:
|
|
1242
|
-
checkoutKey:
|
|
1247
|
+
}, this._readiness.markAssociated(), C(g.PAYMENT_ASSOCIATED, {
|
|
1248
|
+
payment_id: e,
|
|
1249
|
+
currency: r.currency,
|
|
1250
|
+
country_code: r.countryCode
|
|
1251
|
+
}), this._card?.setEnvironment(this._config.environment), r.supportedPaymentMethods?.includes("card") ? r.vgsJwt ? (this._paymentState.vgsJwt = r.vgsJwt, this._paymentState.cardCapture = void 0, this._card?.setVgsJwt(r.vgsJwt)) : (this._paymentState.vgsJwt = void 0, this._paymentState.cardCapture = "unavailable", this._card?.markCaptureUnavailable()) : (this._paymentState.vgsJwt = void 0, this._paymentState.cardCapture = "unsupported", this._card?.resetCardCapture()), this._applePay?.setPaymentContext({
|
|
1252
|
+
paymentId: e,
|
|
1253
|
+
checkoutKey: t,
|
|
1243
1254
|
environment: this._config.environment,
|
|
1244
1255
|
checkoutDetails: this._paymentState.checkoutDetails,
|
|
1245
1256
|
...this._config.additionalPaymentMethods?.applePay,
|
|
1246
1257
|
onAuthorize: (e) => this._executeAuthorization({
|
|
1247
1258
|
formData: null,
|
|
1248
1259
|
applePayData: e
|
|
1249
|
-
})
|
|
1260
|
+
}),
|
|
1261
|
+
onStartFailed: this._onApplePayStartFailed
|
|
1250
1262
|
}), this._paypal?.setPaymentContext({
|
|
1251
|
-
paymentId:
|
|
1252
|
-
checkoutKey:
|
|
1263
|
+
paymentId: e,
|
|
1264
|
+
checkoutKey: t,
|
|
1253
1265
|
onAuthorize: async () => {
|
|
1254
1266
|
await this._executeAuthorization({ formData: null });
|
|
1255
1267
|
}
|
|
1256
1268
|
}), this._settleLoad());
|
|
1257
1269
|
}
|
|
1258
1270
|
validate() {
|
|
1259
|
-
let e = {}, { t } =
|
|
1271
|
+
let e = {}, { t } = A();
|
|
1260
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"), {
|
|
1261
1273
|
valid: Object.keys(e).length === 0,
|
|
1262
1274
|
errors: e
|
|
1263
1275
|
};
|
|
1264
1276
|
}
|
|
1265
1277
|
async _getPayload() {
|
|
1266
|
-
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 ? {
|
|
1267
1279
|
street: this._addressStreet?.isMounted ? this._addressStreet.value : "",
|
|
1268
1280
|
city: this._addressCity?.isMounted ? this._addressCity.value : "",
|
|
1269
1281
|
country: this._addressCountry?.isMounted ? this._addressCountry.value : "",
|
|
@@ -1271,43 +1283,46 @@ var fe = class {
|
|
|
1271
1283
|
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1272
1284
|
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1273
1285
|
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1274
|
-
} : void 0,
|
|
1286
|
+
} : void 0, i = this._cardholderName?.isMounted ? this._cardholderName.value : "", a = [r?.firstName ?? "", r?.lastName ?? ""].filter(Boolean), o = i || a.join(" ");
|
|
1275
1287
|
if (!this._card?.isMounted || this._card.captureState === "unsupported") return {
|
|
1276
1288
|
ok: !1,
|
|
1277
1289
|
error: {
|
|
1278
|
-
message:
|
|
1290
|
+
message: Ne,
|
|
1279
1291
|
status: 0,
|
|
1280
|
-
statusText: "No Payment Method"
|
|
1292
|
+
statusText: "No Payment Method",
|
|
1293
|
+
failureClass: S.NOT_SENT
|
|
1281
1294
|
}
|
|
1282
1295
|
};
|
|
1283
|
-
if (!this._card.isVgsMode) return
|
|
1296
|
+
if (!this._card.isVgsMode) return C(g.CARD_CAPTURE_UNAVAILABLE, { reason: k.NO_TOKENIZATION_SESSION }), {
|
|
1284
1297
|
ok: !1,
|
|
1285
|
-
error: {
|
|
1286
|
-
message:
|
|
1298
|
+
error: l({
|
|
1299
|
+
message: A().t("cardUnavailable"),
|
|
1287
1300
|
status: 0,
|
|
1288
|
-
statusText: "Card Capture Unavailable"
|
|
1289
|
-
|
|
1301
|
+
statusText: "Card Capture Unavailable",
|
|
1302
|
+
failureClass: S.NOT_SENT
|
|
1303
|
+
}, p.CAPTURE_UNAVAILABLE)
|
|
1290
1304
|
};
|
|
1291
1305
|
try {
|
|
1292
|
-
let
|
|
1306
|
+
let e = await this._card.getPayload();
|
|
1293
1307
|
return {
|
|
1294
1308
|
ok: !0,
|
|
1295
1309
|
formData: {
|
|
1296
|
-
name:
|
|
1297
|
-
email:
|
|
1298
|
-
phoneNumber:
|
|
1299
|
-
billingAddress:
|
|
1300
|
-
vgsCardData:
|
|
1310
|
+
name: o,
|
|
1311
|
+
email: t,
|
|
1312
|
+
phoneNumber: n || void 0,
|
|
1313
|
+
billingAddress: r,
|
|
1314
|
+
vgsCardData: e
|
|
1301
1315
|
}
|
|
1302
1316
|
};
|
|
1303
|
-
} catch {
|
|
1317
|
+
} catch (t) {
|
|
1304
1318
|
return {
|
|
1305
1319
|
ok: !1,
|
|
1306
|
-
error: {
|
|
1307
|
-
message:
|
|
1320
|
+
error: l({
|
|
1321
|
+
message: Me,
|
|
1308
1322
|
status: 0,
|
|
1309
|
-
statusText: "Card Tokenization Failed"
|
|
1310
|
-
|
|
1323
|
+
statusText: "Card Tokenization Failed",
|
|
1324
|
+
failureClass: S.NOT_SENT
|
|
1325
|
+
}, e(t) ?? p.SDK_ERROR)
|
|
1311
1326
|
};
|
|
1312
1327
|
}
|
|
1313
1328
|
}
|
|
@@ -1335,7 +1350,7 @@ var fe = class {
|
|
|
1335
1350
|
let t = e["--odus-font-family"];
|
|
1336
1351
|
if (t) {
|
|
1337
1352
|
this._fontCleanup?.();
|
|
1338
|
-
let { cleanup: e } =
|
|
1353
|
+
let { cleanup: e } = ee({ fontFamily: t });
|
|
1339
1354
|
this._fontCleanup = e;
|
|
1340
1355
|
}
|
|
1341
1356
|
for (let t of this._allElements()) t.setTheme(e);
|
|
@@ -1351,20 +1366,23 @@ var fe = class {
|
|
|
1351
1366
|
this._changeListeners.push(e);
|
|
1352
1367
|
}
|
|
1353
1368
|
destroy() {
|
|
1354
|
-
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;
|
|
1355
1370
|
}
|
|
1356
1371
|
setCallbacks(e) {
|
|
1357
1372
|
Object.assign(this._callbacks, e);
|
|
1358
1373
|
}
|
|
1374
|
+
_onApplePayStartFailed = (e) => this._readiness.reportSubmit(o(e));
|
|
1359
1375
|
_trackElement(e) {
|
|
1360
|
-
e.
|
|
1361
|
-
|
|
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();
|
|
1362
1380
|
}), e.on("change", () => {
|
|
1363
1381
|
for (let e of this._changeListeners) e();
|
|
1364
1382
|
});
|
|
1365
1383
|
}
|
|
1366
1384
|
_settleLoad() {
|
|
1367
|
-
this._allElements().some((e) => e.isMounted && (e !== this._card || this._card.captureState !== "unsupported")) && (this._paymentState.cardCapture !== "unsupported" && this._card?.isMounted || this.
|
|
1385
|
+
this._allElements().some((e) => e.isMounted && (e !== this._card || this._card.captureState !== "unsupported")) && (this._paymentState.cardCapture !== "unsupported" && this._card?.isMounted || this._readiness.ready());
|
|
1368
1386
|
}
|
|
1369
1387
|
_allElements() {
|
|
1370
1388
|
return [
|
|
@@ -1387,11 +1405,12 @@ var fe = class {
|
|
|
1387
1405
|
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1388
1406
|
let { paymentId: r, checkoutKey: i } = this._paymentState, a = this._getPaymentMethod(e, t);
|
|
1389
1407
|
if (!r || !i) return this._reportSubmitFailure({
|
|
1390
|
-
message:
|
|
1408
|
+
message: Pe,
|
|
1391
1409
|
status: 0,
|
|
1392
|
-
statusText: "No Associated Payment"
|
|
1410
|
+
statusText: "No Associated Payment",
|
|
1411
|
+
failureClass: S.NOT_SENT
|
|
1393
1412
|
}, a), !1;
|
|
1394
|
-
this._emitLoadingState(!0),
|
|
1413
|
+
this._emitLoadingState(!0), C(g.PAYMENT_SUBMIT_STARTED, {
|
|
1395
1414
|
payment_id: r,
|
|
1396
1415
|
payment_method: a
|
|
1397
1416
|
});
|
|
@@ -1405,24 +1424,28 @@ var fe = class {
|
|
|
1405
1424
|
applePayData: t,
|
|
1406
1425
|
customCustomerData: n
|
|
1407
1426
|
});
|
|
1408
|
-
return
|
|
1427
|
+
return this._readiness.reportSubmit({
|
|
1428
|
+
outcome: le.SUCCEEDED,
|
|
1429
|
+
paymentMethod: a
|
|
1430
|
+
}), x(T.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1409
1431
|
payment_id: r,
|
|
1410
1432
|
payment_method: a,
|
|
1411
1433
|
status: "success"
|
|
1412
|
-
}),
|
|
1434
|
+
}), C(g.PAYMENT_SUBMIT_SUCCESS, {
|
|
1413
1435
|
payment_id: r,
|
|
1414
1436
|
payment_method: a
|
|
1415
1437
|
}), this._handlePaymentResponse(s);
|
|
1416
1438
|
} catch (e) {
|
|
1417
|
-
return
|
|
1439
|
+
return x(T.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1418
1440
|
payment_id: r,
|
|
1419
1441
|
payment_method: a,
|
|
1420
1442
|
status: "failed"
|
|
1421
|
-
}),
|
|
1443
|
+
}), C(g.PAYMENT_SUBMIT_FAILED, {
|
|
1422
1444
|
payment_id: r,
|
|
1423
1445
|
payment_method: a,
|
|
1424
|
-
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1425
|
-
|
|
1446
|
+
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1447
|
+
...w(e)
|
|
1448
|
+
}), this._readiness.reportSubmit(d(e, a)), this._handleAuthorizationError(e), !1;
|
|
1426
1449
|
} finally {
|
|
1427
1450
|
this._emitLoadingState(!1);
|
|
1428
1451
|
}
|
|
@@ -1437,35 +1460,36 @@ var fe = class {
|
|
|
1437
1460
|
}
|
|
1438
1461
|
_handlePaymentResponse(e) {
|
|
1439
1462
|
let t = this._paymentState.paymentId ?? "";
|
|
1440
|
-
return e.latestTransaction.status === "authorized" ? (
|
|
1463
|
+
return e.latestTransaction.status === "authorized" ? (C(g.PAYMENT_AUTHORIZED, {
|
|
1441
1464
|
payment_id: t,
|
|
1442
1465
|
status: e.latestTransaction.status
|
|
1443
|
-
}), 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, {
|
|
1444
1467
|
payment_id: t,
|
|
1445
1468
|
status: e.latestTransaction.status
|
|
1446
|
-
}), 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, {
|
|
1447
1470
|
payment_id: t,
|
|
1448
1471
|
status: e.status
|
|
1449
|
-
}), this._callbacks.onActionRequired?.(e.action.redirectUrl), !0);
|
|
1472
|
+
}), m(() => this._callbacks.onActionRequired?.(e.action.redirectUrl)), !0);
|
|
1450
1473
|
}
|
|
1451
1474
|
_reportSubmitFailure(e, t) {
|
|
1452
1475
|
let n = {
|
|
1453
1476
|
payment_id: this._paymentState.paymentId ?? "",
|
|
1454
1477
|
payment_method: t
|
|
1455
1478
|
};
|
|
1456
|
-
|
|
1479
|
+
C(g.PAYMENT_SUBMIT_STARTED, n), C(g.PAYMENT_SUBMIT_FAILED, {
|
|
1457
1480
|
...n,
|
|
1458
|
-
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1459
|
-
|
|
1481
|
+
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1482
|
+
...w(e)
|
|
1483
|
+
}), this._readiness.reportSubmit(d(e, t)), this._handleAuthorizationError(e);
|
|
1460
1484
|
}
|
|
1461
1485
|
_handleAuthorizationError(e) {
|
|
1462
|
-
let t = this._readErrorMessage(e,
|
|
1486
|
+
let t = this._readErrorMessage(e, je);
|
|
1463
1487
|
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1464
1488
|
}
|
|
1465
1489
|
_readErrorMessage(e, t) {
|
|
1466
1490
|
let n = e;
|
|
1467
|
-
return typeof n?.message == "string" && n.message ? n.message :
|
|
1491
|
+
return typeof n?.message == "string" && n.message ? n.message : ne(n?.details) ?? t;
|
|
1468
1492
|
}
|
|
1469
1493
|
};
|
|
1470
1494
|
//#endregion
|
|
1471
|
-
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 };
|