@odus/checkout 1.10.2 → 1.11.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/checkout.es.js +171 -171
- package/dist/components/checkout/form/AddressSection.d.ts.map +1 -1
- package/dist/components/checkout/form/FormStateCoordinator.d.ts.map +1 -1
- package/dist/elements/AddressStateElement.d.ts.map +1 -1
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements.es.js +248 -253
- package/dist/phone.js +44 -44
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/shared.js +744 -699
- package/dist/utils/dom/index.d.ts +1 -0
- package/dist/utils/dom/index.d.ts.map +1 -1
- package/dist/utils/dom/preconnectOrigins.d.ts +12 -0
- package/dist/utils/dom/preconnectOrigins.d.ts.map +1 -0
- package/dist/utils/state/stateNames.d.ts +29 -6
- package/dist/utils/state/stateNames.d.ts.map +1 -1
- package/dist/utils/validation/createValidationSchema.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as e, B as t, C as n, E as r, G as i, I as a, K as o, L as s, Q as c, R as l, S as ee, T as u, U as te, W as d, X as ne, Y as f, Z as p, a as m, c as re, d as h, et as ie, f as g, g as ae, i as _, n as v, o as oe, q as y, r as b, s as x, t as S, u as C, v as w, w as T, x as E, y as D, z as O } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var
|
|
3
|
+
var k = ".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}", A = ".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}", j = ".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)}", se = ":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}", M = class {
|
|
4
4
|
shadowRoot = null;
|
|
5
5
|
host = null;
|
|
6
6
|
options = {};
|
|
@@ -64,17 +64,17 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
64
64
|
this.options.callbacks?.[e]?.(t);
|
|
65
65
|
}
|
|
66
66
|
getCss() {
|
|
67
|
-
return
|
|
67
|
+
return se;
|
|
68
68
|
}
|
|
69
|
-
},
|
|
69
|
+
}, N = class extends M {
|
|
70
70
|
_value = "";
|
|
71
71
|
_error = null;
|
|
72
72
|
_input = null;
|
|
73
73
|
render() {
|
|
74
74
|
if (!this.shadowRoot) return;
|
|
75
75
|
this._input?.getElement().remove();
|
|
76
|
-
let { t: e } =
|
|
77
|
-
this._input = new
|
|
76
|
+
let { t: e } = u();
|
|
77
|
+
this._input = new g({
|
|
78
78
|
name: "billingAddress.city",
|
|
79
79
|
label: this.options.label ?? e("address.townCity"),
|
|
80
80
|
error: !1,
|
|
@@ -85,15 +85,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
85
85
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
86
86
|
}
|
|
87
87
|
}), this._input.addEventListener("blur", () => {
|
|
88
|
-
let { t: e } =
|
|
88
|
+
let { t: e } = u();
|
|
89
89
|
this._error = this._value.trim() ? null : e("validation.townCityRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
90
90
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
91
91
|
}
|
|
92
92
|
getCss() {
|
|
93
93
|
return super.getCss() + [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
A,
|
|
95
|
+
j,
|
|
96
|
+
k
|
|
97
97
|
].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
98
|
}
|
|
99
99
|
getValue() {
|
|
@@ -105,7 +105,7 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
105
105
|
getError() {
|
|
106
106
|
return this._error;
|
|
107
107
|
}
|
|
108
|
-
},
|
|
108
|
+
}, P = ".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}", F = class extends M {
|
|
109
109
|
_value = "";
|
|
110
110
|
_error = null;
|
|
111
111
|
_select = null;
|
|
@@ -116,28 +116,28 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
116
116
|
render() {
|
|
117
117
|
if (!this.shadowRoot) return;
|
|
118
118
|
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 } =
|
|
120
|
-
this._select = new
|
|
119
|
+
let { t: e, locale: t } = u();
|
|
120
|
+
this._select = new h({
|
|
121
121
|
name: "billingAddress.country",
|
|
122
122
|
label: this.options.label ?? e("address.chooseCountry"),
|
|
123
123
|
error: !1,
|
|
124
124
|
placeholder: this.options.placeholder ?? e("address.chooseCountry"),
|
|
125
125
|
value: this._value,
|
|
126
|
-
options:
|
|
126
|
+
options: ae(this._allowedCountries, t),
|
|
127
127
|
autocomplete: "country",
|
|
128
128
|
onChange: (e) => {
|
|
129
129
|
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
130
130
|
}
|
|
131
131
|
}), this._select.addEventListener("blur", () => {
|
|
132
|
-
let { t: e } =
|
|
132
|
+
let { t: e } = u();
|
|
133
133
|
this._error = this._value ? null : e("validation.countryRequired"), this._select?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
134
134
|
}), this.shadowRoot.appendChild(this._select.getElement());
|
|
135
135
|
}
|
|
136
136
|
getCss() {
|
|
137
137
|
return super.getCss() + [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
j,
|
|
139
|
+
k,
|
|
140
|
+
P
|
|
141
141
|
].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
142
|
}
|
|
143
143
|
getValue() {
|
|
@@ -149,15 +149,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
149
149
|
getError() {
|
|
150
150
|
return this._error;
|
|
151
151
|
}
|
|
152
|
-
},
|
|
152
|
+
}, I = class extends M {
|
|
153
153
|
_value = "";
|
|
154
154
|
_error = null;
|
|
155
155
|
_input = null;
|
|
156
156
|
render() {
|
|
157
157
|
if (!this.shadowRoot) return;
|
|
158
158
|
this._input?.getElement().remove();
|
|
159
|
-
let { t: e } =
|
|
160
|
-
this._input = new
|
|
159
|
+
let { t: e } = u();
|
|
160
|
+
this._input = new g({
|
|
161
161
|
name: "billingAddress.firstName",
|
|
162
162
|
label: this.options.label ?? e("address.firstName"),
|
|
163
163
|
error: !1,
|
|
@@ -168,15 +168,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
168
168
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
169
169
|
}
|
|
170
170
|
}), this._input.addEventListener("blur", () => {
|
|
171
|
-
let { t: e } =
|
|
171
|
+
let { t: e } = u();
|
|
172
172
|
this._error = this._value.trim() ? null : e("validation.firstNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
173
173
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
174
174
|
}
|
|
175
175
|
getCss() {
|
|
176
176
|
return super.getCss() + [
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
177
|
+
A,
|
|
178
|
+
j,
|
|
179
|
+
k
|
|
180
180
|
].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
181
|
}
|
|
182
182
|
getValue() {
|
|
@@ -188,15 +188,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
188
188
|
getError() {
|
|
189
189
|
return this._error;
|
|
190
190
|
}
|
|
191
|
-
},
|
|
191
|
+
}, L = class extends M {
|
|
192
192
|
_value = "";
|
|
193
193
|
_error = null;
|
|
194
194
|
_input = null;
|
|
195
195
|
render() {
|
|
196
196
|
if (!this.shadowRoot) return;
|
|
197
197
|
this._input?.getElement().remove();
|
|
198
|
-
let { t: e } =
|
|
199
|
-
this._input = new
|
|
198
|
+
let { t: e } = u();
|
|
199
|
+
this._input = new g({
|
|
200
200
|
name: "billingAddress.lastName",
|
|
201
201
|
label: this.options.label ?? e("address.lastName"),
|
|
202
202
|
error: !1,
|
|
@@ -207,15 +207,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
207
207
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
208
208
|
}
|
|
209
209
|
}), this._input.addEventListener("blur", () => {
|
|
210
|
-
let { t: e } =
|
|
210
|
+
let { t: e } = u();
|
|
211
211
|
this._error = this._value.trim() ? null : e("validation.lastNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
212
212
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
213
213
|
}
|
|
214
214
|
getCss() {
|
|
215
215
|
return super.getCss() + [
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
216
|
+
A,
|
|
217
|
+
j,
|
|
218
|
+
k
|
|
219
219
|
].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
220
|
}
|
|
221
221
|
getValue() {
|
|
@@ -227,33 +227,28 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
227
227
|
getError() {
|
|
228
228
|
return this._error;
|
|
229
229
|
}
|
|
230
|
-
},
|
|
230
|
+
}, R = class extends M {
|
|
231
231
|
_value = "";
|
|
232
232
|
_country = "";
|
|
233
233
|
_input = null;
|
|
234
234
|
_select = null;
|
|
235
235
|
setCountry(e) {
|
|
236
|
-
let
|
|
236
|
+
let n = this._country;
|
|
237
237
|
if (this._country = e, !this.shadowRoot) return;
|
|
238
|
-
let r =
|
|
239
|
-
if (r && i &&
|
|
240
|
-
let { t } =
|
|
241
|
-
this._select?.setOptions(
|
|
238
|
+
let r = O(n), i = O(e);
|
|
239
|
+
if (r && i && n !== e) {
|
|
240
|
+
let { t: n } = u(), r = t(e), i = n(l(r));
|
|
241
|
+
this._select?.setOptions(s(r), this.options.placeholder ?? i), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
244
|
r !== i && (this._value = "", this.render(), this.emit("change", this._value));
|
|
245
245
|
}
|
|
246
246
|
render() {
|
|
247
|
-
|
|
248
|
-
if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, F.has(this._country)) {
|
|
249
|
-
let e = this._country;
|
|
250
|
-
this._renderSelect(e);
|
|
251
|
-
} else this._renderInput();
|
|
252
|
-
}
|
|
247
|
+
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, O(this._country) ? this._renderSelect(t(this._country)) : this._renderInput());
|
|
253
248
|
}
|
|
254
249
|
_renderInput() {
|
|
255
|
-
let { t: e } =
|
|
256
|
-
this._input = new
|
|
250
|
+
let { t: e } = u();
|
|
251
|
+
this._input = new g({
|
|
257
252
|
name: "billingAddress.state",
|
|
258
253
|
label: this.options.label ?? e("address.state"),
|
|
259
254
|
error: !1,
|
|
@@ -269,14 +264,14 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
269
264
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
270
265
|
}
|
|
271
266
|
_renderSelect(e) {
|
|
272
|
-
let { t } =
|
|
273
|
-
this._select = new
|
|
267
|
+
let { t } = u(), n = s(e), r = t(l(e));
|
|
268
|
+
this._select = new h({
|
|
274
269
|
name: "billingAddress.state",
|
|
275
270
|
label: this.options.label ?? t("address.state"),
|
|
276
271
|
error: !1,
|
|
277
|
-
placeholder: this.options.placeholder ??
|
|
272
|
+
placeholder: this.options.placeholder ?? r,
|
|
278
273
|
value: this._value,
|
|
279
|
-
options:
|
|
274
|
+
options: n,
|
|
280
275
|
autocomplete: "address-level1",
|
|
281
276
|
onChange: (e) => {
|
|
282
277
|
this._value = e.target.value, this._select?.setError(!1), this.emit("change", this._value);
|
|
@@ -288,10 +283,10 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
288
283
|
}
|
|
289
284
|
getCss() {
|
|
290
285
|
return super.getCss() + [
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
286
|
+
A,
|
|
287
|
+
j,
|
|
288
|
+
k,
|
|
289
|
+
P
|
|
295
290
|
].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 ";
|
|
296
291
|
}
|
|
297
292
|
getValue() {
|
|
@@ -302,18 +297,18 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
302
297
|
}
|
|
303
298
|
getError() {
|
|
304
299
|
if (this.getIsValid()) return null;
|
|
305
|
-
let { t: e } =
|
|
300
|
+
let { t: e } = u();
|
|
306
301
|
return e("validation.stateRequired");
|
|
307
302
|
}
|
|
308
|
-
},
|
|
303
|
+
}, z = class extends M {
|
|
309
304
|
_value = "";
|
|
310
305
|
_error = null;
|
|
311
306
|
_input = null;
|
|
312
307
|
render() {
|
|
313
308
|
if (!this.shadowRoot) return;
|
|
314
309
|
this._input?.getElement().remove();
|
|
315
|
-
let { t: e } =
|
|
316
|
-
this._input = new
|
|
310
|
+
let { t: e } = u();
|
|
311
|
+
this._input = new g({
|
|
317
312
|
name: "billingAddress.street",
|
|
318
313
|
label: this.options.label ?? e("address.addressLine1"),
|
|
319
314
|
error: !1,
|
|
@@ -329,15 +324,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
329
324
|
this.emit("change", this._value);
|
|
330
325
|
}
|
|
331
326
|
}), this._input.addEventListener("blur", () => {
|
|
332
|
-
let { t: e } =
|
|
327
|
+
let { t: e } = u();
|
|
333
328
|
this._error = this._value.trim() ? null : e("validation.addressLine1Required"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
334
329
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
335
330
|
}
|
|
336
331
|
getCss() {
|
|
337
332
|
return super.getCss() + [
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
333
|
+
A,
|
|
334
|
+
j,
|
|
335
|
+
k
|
|
341
336
|
].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 ";
|
|
342
337
|
}
|
|
343
338
|
getValue() {
|
|
@@ -349,15 +344,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
349
344
|
getError() {
|
|
350
345
|
return this._error;
|
|
351
346
|
}
|
|
352
|
-
},
|
|
347
|
+
}, B = class extends M {
|
|
353
348
|
_value = "";
|
|
354
349
|
_error = null;
|
|
355
350
|
_input = null;
|
|
356
351
|
render() {
|
|
357
352
|
if (!this.shadowRoot) return;
|
|
358
353
|
this._input?.getElement().remove();
|
|
359
|
-
let { t: e } =
|
|
360
|
-
this._input = new
|
|
354
|
+
let { t: e } = u();
|
|
355
|
+
this._input = new g({
|
|
361
356
|
name: "billingAddress.zipCode",
|
|
362
357
|
label: this.options.label ?? e("address.postalCode"),
|
|
363
358
|
error: !1,
|
|
@@ -368,15 +363,15 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
368
363
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
369
364
|
}
|
|
370
365
|
}), this._input.addEventListener("blur", () => {
|
|
371
|
-
let { t: e } =
|
|
366
|
+
let { t: e } = u();
|
|
372
367
|
this._error = this._value.trim() ? null : e("validation.postalCodeRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
373
368
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
374
369
|
}
|
|
375
370
|
getCss() {
|
|
376
371
|
return super.getCss() + [
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
372
|
+
A,
|
|
373
|
+
j,
|
|
374
|
+
k
|
|
380
375
|
].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 ";
|
|
381
376
|
}
|
|
382
377
|
getValue() {
|
|
@@ -388,7 +383,7 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
388
383
|
getError() {
|
|
389
384
|
return this._error;
|
|
390
385
|
}
|
|
391
|
-
},
|
|
386
|
+
}, V = "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)}", H = {
|
|
392
387
|
name: "odus-elements",
|
|
393
388
|
styles: {
|
|
394
389
|
fontSize: 14,
|
|
@@ -412,7 +407,7 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
412
407
|
}
|
|
413
408
|
},
|
|
414
409
|
additionalPaymentMethods: {}
|
|
415
|
-
},
|
|
410
|
+
}, U = class extends M {
|
|
416
411
|
_paymentContext = null;
|
|
417
412
|
_applePayData = null;
|
|
418
413
|
_authorized = !1;
|
|
@@ -431,16 +426,16 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
431
426
|
return;
|
|
432
427
|
}
|
|
433
428
|
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c } = this._paymentContext;
|
|
434
|
-
if (!
|
|
429
|
+
if (!m(a, r?.countryCode)) {
|
|
435
430
|
this._setAvailability(!1);
|
|
436
431
|
return;
|
|
437
432
|
}
|
|
438
|
-
if (!
|
|
433
|
+
if (!_()) {
|
|
439
434
|
this._setAvailability(!1);
|
|
440
435
|
return;
|
|
441
436
|
}
|
|
442
|
-
this._button = new
|
|
443
|
-
checkoutProfile:
|
|
437
|
+
this._button = new b({
|
|
438
|
+
checkoutProfile: H,
|
|
444
439
|
paymentId: e,
|
|
445
440
|
checkoutKey: t,
|
|
446
441
|
environment: n,
|
|
@@ -460,7 +455,7 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
460
455
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
461
456
|
}
|
|
462
457
|
getCss() {
|
|
463
|
-
return super.getCss() +
|
|
458
|
+
return super.getCss() + V + "\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 ";
|
|
464
459
|
}
|
|
465
460
|
getValue() {
|
|
466
461
|
return this._applePayData;
|
|
@@ -471,7 +466,7 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
471
466
|
getError() {
|
|
472
467
|
return null;
|
|
473
468
|
}
|
|
474
|
-
},
|
|
469
|
+
}, W = ".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}", G = {
|
|
475
470
|
name: "odus-elements",
|
|
476
471
|
styles: {
|
|
477
472
|
fontSize: 14,
|
|
@@ -495,7 +490,7 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
495
490
|
}
|
|
496
491
|
},
|
|
497
492
|
additionalPaymentMethods: {}
|
|
498
|
-
},
|
|
493
|
+
}, K = {
|
|
499
494
|
"--odus-font-family": "system-ui, sans-serif",
|
|
500
495
|
"--odus-font-size": "16px",
|
|
501
496
|
"--odus-color-error": "#dc2727",
|
|
@@ -519,11 +514,11 @@ var E = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
519
514
|
"--odus-button-height": "48px",
|
|
520
515
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
521
516
|
}["--odus-font-size"];
|
|
522
|
-
function
|
|
517
|
+
function ce(e, t) {
|
|
523
518
|
let n = Object.keys(e);
|
|
524
519
|
return n.length === Object.keys(t).length && n.every((n) => e[n] === t[n]);
|
|
525
520
|
}
|
|
526
|
-
var
|
|
521
|
+
var q = class {
|
|
527
522
|
_vgsService;
|
|
528
523
|
_vgsJwt;
|
|
529
524
|
_vgsState = {};
|
|
@@ -535,18 +530,18 @@ var K = class {
|
|
|
535
530
|
_initGeneration = 0;
|
|
536
531
|
_onInitFailure = null;
|
|
537
532
|
_onFieldsNotReady = null;
|
|
538
|
-
constructor(e, t,
|
|
539
|
-
this._vgsJwt = e, this._environment = t, this._onInitFailure =
|
|
533
|
+
constructor(e, t, r = {}) {
|
|
534
|
+
this._vgsJwt = e, this._environment = t, this._onInitFailure = r.onInitFailure ?? null, this._onFieldsNotReady = r.onFieldsNotReady ?? null, this._vgsService = new n();
|
|
540
535
|
}
|
|
541
536
|
get section() {
|
|
542
537
|
return this._section;
|
|
543
538
|
}
|
|
544
539
|
renderSection(e, t) {
|
|
545
540
|
this._section?.getElement().remove();
|
|
546
|
-
let { t:
|
|
547
|
-
this._section = new
|
|
548
|
-
checkoutProfile:
|
|
549
|
-
translationFunc:
|
|
541
|
+
let { t: n } = u();
|
|
542
|
+
this._section = new re({
|
|
543
|
+
checkoutProfile: G,
|
|
544
|
+
translationFunc: n,
|
|
550
545
|
vgsService: this._vgsService
|
|
551
546
|
}), this._applySkeletonMetrics(), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
|
|
552
547
|
}
|
|
@@ -580,7 +575,7 @@ var K = class {
|
|
|
580
575
|
return this._vgsFieldsValid;
|
|
581
576
|
}
|
|
582
577
|
getError() {
|
|
583
|
-
let { t: e } =
|
|
578
|
+
let { t: e } = u();
|
|
584
579
|
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
585
580
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
586
581
|
let r = n.errors?.[0];
|
|
@@ -595,7 +590,7 @@ var K = class {
|
|
|
595
590
|
...this._currentTheme,
|
|
596
591
|
...e
|
|
597
592
|
};
|
|
598
|
-
|
|
593
|
+
ce(this._currentTheme, t) || (this._currentTheme = t, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme()));
|
|
599
594
|
}
|
|
600
595
|
resetTheme(e) {
|
|
601
596
|
let t = e.filter((e) => e in this._currentTheme);
|
|
@@ -609,50 +604,50 @@ var K = class {
|
|
|
609
604
|
}
|
|
610
605
|
_reinitWithTheme() {
|
|
611
606
|
this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
|
|
612
|
-
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new
|
|
607
|
+
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new n(), this._section?.setVgsService(this._vgsService), this.initVgs();
|
|
613
608
|
}, 300);
|
|
614
609
|
}
|
|
615
610
|
_buildProfileFromTheme(e) {
|
|
616
|
-
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ??
|
|
611
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? K, n = e["--odus-font-family"] ?? G.styles.fontFamily, r = e["--odus-color-text"] ?? G.styles.textColor, i = e["--odus-border-radius"] ?? `${G.styles.borderRadius}px`;
|
|
617
612
|
return {
|
|
618
|
-
...
|
|
613
|
+
...G,
|
|
619
614
|
styles: {
|
|
620
|
-
...
|
|
621
|
-
fontSize: parseInt(t, 10) || parseInt(
|
|
615
|
+
...G.styles,
|
|
616
|
+
fontSize: parseInt(t, 10) || parseInt(K, 10),
|
|
622
617
|
fontFamily: n,
|
|
623
618
|
textColor: r,
|
|
624
|
-
borderRadius: parseInt(i, 10) ||
|
|
619
|
+
borderRadius: parseInt(i, 10) || G.styles.borderRadius
|
|
625
620
|
}
|
|
626
621
|
};
|
|
627
622
|
}
|
|
628
623
|
async _mountFields(e) {
|
|
629
624
|
if (!this._section) return;
|
|
630
|
-
let
|
|
625
|
+
let t = this._buildProfileFromTheme(this._currentTheme), n = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
|
|
631
626
|
this._applySkeletonMetrics();
|
|
632
|
-
let
|
|
633
|
-
for (let e of Object.values(
|
|
627
|
+
let r = this._section.getVgsContainerIds();
|
|
628
|
+
for (let e of Object.values(r)) {
|
|
634
629
|
if (!e) continue;
|
|
635
630
|
let t = document.getElementById(e);
|
|
636
631
|
t && t.querySelectorAll("iframe").forEach((e) => e.remove());
|
|
637
632
|
}
|
|
638
|
-
let
|
|
633
|
+
let i = await E(t.styles.fontFamily);
|
|
639
634
|
if (e !== this._initGeneration) return;
|
|
640
|
-
let
|
|
641
|
-
borderColor:
|
|
635
|
+
let a = this._section.buildVgsFieldCss(t, i, {
|
|
636
|
+
borderColor: n,
|
|
642
637
|
backgroundColor: this._currentTheme["--odus-color-background"],
|
|
643
638
|
placeholderColor: this._currentTheme["--odus-input-placeholder-color"],
|
|
644
639
|
placeholderOpacity: this._currentTheme["--odus-input-placeholder-opacity"],
|
|
645
640
|
padding: this._currentTheme["--odus-input-padding"]
|
|
646
|
-
}), { t:
|
|
641
|
+
}), { t: o } = u();
|
|
647
642
|
this._vgsService.mountCardFields({
|
|
648
|
-
cardNumber:
|
|
649
|
-
cardExpiry:
|
|
650
|
-
cardCvv:
|
|
651
|
-
},
|
|
643
|
+
cardNumber: r.cardNumber ? `#${r.cardNumber}` : void 0,
|
|
644
|
+
cardExpiry: r.cardExpiry ? `#${r.cardExpiry}` : void 0,
|
|
645
|
+
cardCvv: r.cardCvv ? `#${r.cardCvv}` : void 0
|
|
646
|
+
}, a, {
|
|
652
647
|
cardNumber: "1234 5678 9012 3456",
|
|
653
|
-
cardExpiry:
|
|
648
|
+
cardExpiry: o("cardExpiry"),
|
|
654
649
|
cardCvv: "CVV",
|
|
655
|
-
cardholderName:
|
|
650
|
+
cardholderName: o("cardholderName")
|
|
656
651
|
}, (e) => {
|
|
657
652
|
this._section?.updateVgsCardBrand(e);
|
|
658
653
|
}), this._vgsService.waitForFieldsReady().then(() => {
|
|
@@ -663,8 +658,8 @@ var K = class {
|
|
|
663
658
|
}
|
|
664
659
|
_handleStateChange(e) {
|
|
665
660
|
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
666
|
-
let { t } =
|
|
667
|
-
this._section?.handleVgsStateChange(e,
|
|
661
|
+
let { t } = u(), n = this._deriveFieldErrors(t);
|
|
662
|
+
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
668
663
|
}
|
|
669
664
|
_deriveFieldErrors(e) {
|
|
670
665
|
let t = {};
|
|
@@ -677,14 +672,14 @@ var K = class {
|
|
|
677
672
|
}
|
|
678
673
|
return t;
|
|
679
674
|
}
|
|
680
|
-
},
|
|
675
|
+
}, le = "Card capture is unavailable: no tokenization session", J = class extends M {
|
|
681
676
|
_environment = "test";
|
|
682
677
|
_captureState = "pending";
|
|
683
678
|
_mountContainer = null;
|
|
684
679
|
_vgsAdapter = null;
|
|
685
680
|
_vgsJwt = null;
|
|
686
681
|
_reportedUnavailable = !1;
|
|
687
|
-
_unavailableReason =
|
|
682
|
+
_unavailableReason = p.NO_TOKENIZATION_SESSION;
|
|
688
683
|
get isVgsMode() {
|
|
689
684
|
return this._captureState === "vgs";
|
|
690
685
|
}
|
|
@@ -697,17 +692,17 @@ var K = class {
|
|
|
697
692
|
setVgsJwt(e) {
|
|
698
693
|
if (this._vgsAdapter && this._vgsJwt === e) return;
|
|
699
694
|
this._captureState = "vgs", this._reportedUnavailable = !1, this._vgsJwt = e, this._vgsAdapter?.destroy();
|
|
700
|
-
let t = new
|
|
695
|
+
let t = new q(e, this._environment, {
|
|
701
696
|
onInitFailure: () => {
|
|
702
|
-
this._vgsAdapter
|
|
697
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(p.INIT_FAILED);
|
|
703
698
|
},
|
|
704
699
|
onFieldsNotReady: () => {
|
|
705
|
-
this._vgsAdapter
|
|
700
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(p.FIELDS_NOT_READY);
|
|
706
701
|
}
|
|
707
702
|
});
|
|
708
703
|
this._vgsAdapter = t, this.isMounted && this._mountContainer && (this.unmount(), this.mount(this._mountContainer));
|
|
709
704
|
}
|
|
710
|
-
markCaptureUnavailable(e =
|
|
705
|
+
markCaptureUnavailable(e = p.NO_TOKENIZATION_SESSION) {
|
|
711
706
|
if (this._captureState === "unavailable") return;
|
|
712
707
|
let t = this._mountContainer, n = this.isMounted && t !== null;
|
|
713
708
|
this.isMounted && this.unmount(), this._unavailableReason = e, this._captureState = "unavailable", this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, n && t && this.mount(t);
|
|
@@ -754,19 +749,19 @@ var K = class {
|
|
|
754
749
|
this.clearBody();
|
|
755
750
|
let e = document.createElement("div");
|
|
756
751
|
e.className = "card-pending";
|
|
757
|
-
let t =
|
|
758
|
-
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${
|
|
752
|
+
let t = D(w, G.styles.fontSize);
|
|
753
|
+
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${G.styles.borderRadius}px)`;
|
|
759
754
|
let n = document.createElement("div");
|
|
760
755
|
n.className = "vgs-field-skeleton", e.appendChild(n), this.shadowRoot.appendChild(e);
|
|
761
756
|
}
|
|
762
757
|
renderUnavailableNotice() {
|
|
763
758
|
if (!this.shadowRoot) return;
|
|
764
759
|
this.clearBody();
|
|
765
|
-
let { t: e } =
|
|
766
|
-
checkoutProfile:
|
|
760
|
+
let { t: e } = u(), t = new x({
|
|
761
|
+
checkoutProfile: G,
|
|
767
762
|
translationFunc: e
|
|
768
763
|
});
|
|
769
|
-
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0,
|
|
764
|
+
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0, y(c.CARD_CAPTURE_UNAVAILABLE, { reason: this._unavailableReason }));
|
|
770
765
|
}
|
|
771
766
|
focus() {
|
|
772
767
|
this._vgsAdapter?.section?.focus();
|
|
@@ -778,17 +773,17 @@ var K = class {
|
|
|
778
773
|
this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, this._captureState = "pending", this._reportedUnavailable = !1, super.destroy();
|
|
779
774
|
}
|
|
780
775
|
setTheme(e) {
|
|
781
|
-
super.setTheme(e),
|
|
776
|
+
super.setTheme(e), this._captureState === "vgs" && this._vgsAdapter && this._vgsAdapter.applyTheme(e);
|
|
782
777
|
}
|
|
783
778
|
resetTheme(e) {
|
|
784
|
-
super.resetTheme(e),
|
|
779
|
+
super.resetTheme(e), this._captureState === "vgs" && this._vgsAdapter && this._vgsAdapter.resetTheme(Object.keys(e));
|
|
785
780
|
}
|
|
786
781
|
getCss() {
|
|
787
782
|
return super.getCss() + [
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
783
|
+
A,
|
|
784
|
+
j,
|
|
785
|
+
k,
|
|
786
|
+
W
|
|
792
787
|
].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 ";
|
|
793
788
|
}
|
|
794
789
|
getValue() {
|
|
@@ -799,24 +794,24 @@ var K = class {
|
|
|
799
794
|
};
|
|
800
795
|
}
|
|
801
796
|
async getPayload() {
|
|
802
|
-
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(
|
|
797
|
+
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(le);
|
|
803
798
|
return this._vgsAdapter.getPayload();
|
|
804
799
|
}
|
|
805
800
|
getIsValid() {
|
|
806
801
|
return this._captureState === "unsupported" ? !0 : this._vgsAdapter?.isValid() ?? !1;
|
|
807
802
|
}
|
|
808
803
|
getError() {
|
|
809
|
-
return this._captureState === "unavailable" ?
|
|
804
|
+
return this._captureState === "unavailable" ? u().t("cardUnavailable") : this._vgsAdapter?.getError() ?? null;
|
|
810
805
|
}
|
|
811
|
-
},
|
|
806
|
+
}, Y = class extends M {
|
|
812
807
|
_value = "";
|
|
813
808
|
_error = null;
|
|
814
809
|
_input = null;
|
|
815
810
|
render() {
|
|
816
811
|
if (!this.shadowRoot) return;
|
|
817
812
|
this._input?.getElement().remove();
|
|
818
|
-
let { t: e } =
|
|
819
|
-
this._input = new
|
|
813
|
+
let { t: e } = u();
|
|
814
|
+
this._input = new g({
|
|
820
815
|
name: "billingAddress.cardholderName",
|
|
821
816
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
822
817
|
error: !1,
|
|
@@ -828,15 +823,15 @@ var K = class {
|
|
|
828
823
|
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
829
824
|
}
|
|
830
825
|
}), this._input.addEventListener("blur", () => {
|
|
831
|
-
let { t: e } =
|
|
826
|
+
let { t: e } = u();
|
|
832
827
|
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
833
828
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
834
829
|
}
|
|
835
830
|
getCss() {
|
|
836
831
|
return super.getCss() + [
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
832
|
+
A,
|
|
833
|
+
j,
|
|
834
|
+
k
|
|
840
835
|
].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 ";
|
|
841
836
|
}
|
|
842
837
|
getValue() {
|
|
@@ -848,7 +843,7 @@ var K = class {
|
|
|
848
843
|
getError() {
|
|
849
844
|
return this._error;
|
|
850
845
|
}
|
|
851
|
-
},
|
|
846
|
+
}, ue = {
|
|
852
847
|
name: "odus-elements",
|
|
853
848
|
styles: {
|
|
854
849
|
fontSize: 14,
|
|
@@ -872,7 +867,7 @@ var K = class {
|
|
|
872
867
|
}
|
|
873
868
|
},
|
|
874
869
|
additionalPaymentMethods: {}
|
|
875
|
-
},
|
|
870
|
+
}, X = class extends M {
|
|
876
871
|
_email = "";
|
|
877
872
|
_error = null;
|
|
878
873
|
_suggestion = null;
|
|
@@ -880,11 +875,11 @@ var K = class {
|
|
|
880
875
|
render() {
|
|
881
876
|
if (!this.shadowRoot) return;
|
|
882
877
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
883
|
-
let { t: e } =
|
|
884
|
-
this._field = new
|
|
878
|
+
let { t: e } = u();
|
|
879
|
+
this._field = new oe({
|
|
885
880
|
value: this._email,
|
|
886
881
|
error: !1,
|
|
887
|
-
checkoutProfile:
|
|
882
|
+
checkoutProfile: ue,
|
|
888
883
|
translationFunc: e,
|
|
889
884
|
label: this.options.label,
|
|
890
885
|
placeholder: this.options.placeholder,
|
|
@@ -893,23 +888,23 @@ var K = class {
|
|
|
893
888
|
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);
|
|
894
889
|
},
|
|
895
890
|
onBlur: () => {
|
|
896
|
-
let e =
|
|
891
|
+
let e = a();
|
|
897
892
|
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);
|
|
898
893
|
}
|
|
899
894
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
900
895
|
}
|
|
901
896
|
getCss() {
|
|
902
897
|
return super.getCss() + [
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
898
|
+
A,
|
|
899
|
+
j,
|
|
900
|
+
k
|
|
906
901
|
].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 ";
|
|
907
902
|
}
|
|
908
903
|
getValue() {
|
|
909
904
|
return this._email;
|
|
910
905
|
}
|
|
911
906
|
getIsValid() {
|
|
912
|
-
return !
|
|
907
|
+
return !a().email(this._email);
|
|
913
908
|
}
|
|
914
909
|
getError() {
|
|
915
910
|
return this._error;
|
|
@@ -917,7 +912,7 @@ var K = class {
|
|
|
917
912
|
get suggestion() {
|
|
918
913
|
return this._suggestion;
|
|
919
914
|
}
|
|
920
|
-
},
|
|
915
|
+
}, de = "@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 M {
|
|
921
916
|
_alert = null;
|
|
922
917
|
_message = null;
|
|
923
918
|
render() {
|
|
@@ -934,7 +929,7 @@ var K = class {
|
|
|
934
929
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
935
930
|
}
|
|
936
931
|
getCss() {
|
|
937
|
-
return super.getCss() +
|
|
932
|
+
return super.getCss() + de + "\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 ";
|
|
938
933
|
}
|
|
939
934
|
getValue() {
|
|
940
935
|
return null;
|
|
@@ -945,7 +940,7 @@ var K = class {
|
|
|
945
940
|
getError() {
|
|
946
941
|
return this._message;
|
|
947
942
|
}
|
|
948
|
-
},
|
|
943
|
+
}, fe = ".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}", pe = {
|
|
949
944
|
name: "odus-elements",
|
|
950
945
|
styles: {
|
|
951
946
|
fontSize: 14,
|
|
@@ -969,7 +964,7 @@ var K = class {
|
|
|
969
964
|
}
|
|
970
965
|
},
|
|
971
966
|
additionalPaymentMethods: {}
|
|
972
|
-
}, Q = class extends
|
|
967
|
+
}, Q = class extends M {
|
|
973
968
|
_paymentContext = null;
|
|
974
969
|
_button = null;
|
|
975
970
|
setPaymentContext(e) {
|
|
@@ -978,8 +973,8 @@ var K = class {
|
|
|
978
973
|
render() {
|
|
979
974
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
980
975
|
let { onAuthorize: e } = this._paymentContext;
|
|
981
|
-
this._button = new
|
|
982
|
-
checkoutProfile:
|
|
976
|
+
this._button = new v({
|
|
977
|
+
checkoutProfile: pe,
|
|
983
978
|
onSubmit: async () => {
|
|
984
979
|
this._button?.setSubmitting(!0);
|
|
985
980
|
try {
|
|
@@ -991,7 +986,7 @@ var K = class {
|
|
|
991
986
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
992
987
|
}
|
|
993
988
|
getCss() {
|
|
994
|
-
return super.getCss() +
|
|
989
|
+
return super.getCss() + fe + "\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 ";
|
|
995
990
|
}
|
|
996
991
|
getValue() {
|
|
997
992
|
return null;
|
|
@@ -1002,7 +997,7 @@ var K = class {
|
|
|
1002
997
|
getError() {
|
|
1003
998
|
return null;
|
|
1004
999
|
}
|
|
1005
|
-
},
|
|
1000
|
+
}, me = ".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}", he = {
|
|
1006
1001
|
name: "odus-elements",
|
|
1007
1002
|
styles: {
|
|
1008
1003
|
fontSize: 14,
|
|
@@ -1026,7 +1021,7 @@ var K = class {
|
|
|
1026
1021
|
}
|
|
1027
1022
|
},
|
|
1028
1023
|
additionalPaymentMethods: {}
|
|
1029
|
-
}, $ = class extends
|
|
1024
|
+
}, $ = class extends M {
|
|
1030
1025
|
_phone = "";
|
|
1031
1026
|
_error = null;
|
|
1032
1027
|
_field = null;
|
|
@@ -1034,16 +1029,16 @@ var K = class {
|
|
|
1034
1029
|
render() {
|
|
1035
1030
|
if (!this.shadowRoot) return;
|
|
1036
1031
|
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1037
|
-
let
|
|
1038
|
-
|
|
1039
|
-
if (!this.shadowRoot || this._renderGeneration !==
|
|
1040
|
-
let { t:
|
|
1041
|
-
this._field = new
|
|
1032
|
+
let e = ++this._renderGeneration;
|
|
1033
|
+
te().then(({ PhoneNumberField: t }) => {
|
|
1034
|
+
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1035
|
+
let { t: n, locale: r } = u();
|
|
1036
|
+
this._field = new t({
|
|
1042
1037
|
value: this._phone,
|
|
1043
1038
|
error: !1,
|
|
1044
|
-
checkoutProfile:
|
|
1045
|
-
translationFunc:
|
|
1046
|
-
locale:
|
|
1039
|
+
checkoutProfile: he,
|
|
1040
|
+
translationFunc: n,
|
|
1041
|
+
locale: r,
|
|
1047
1042
|
label: this.options.label,
|
|
1048
1043
|
placeholder: this.options.placeholder,
|
|
1049
1044
|
defaultCountry: this.options.defaultCountry,
|
|
@@ -1052,33 +1047,33 @@ var K = class {
|
|
|
1052
1047
|
},
|
|
1053
1048
|
onBlur: () => {
|
|
1054
1049
|
this._phone = this._field?.getValue() ?? "";
|
|
1055
|
-
let e =
|
|
1050
|
+
let e = a(), t = this._field?.getCountry();
|
|
1056
1051
|
this._error = e.phoneNumber(this._phone, t) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1057
1052
|
}
|
|
1058
1053
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
1059
|
-
}).catch((
|
|
1060
|
-
|
|
1054
|
+
}).catch((t) => {
|
|
1055
|
+
this.shadowRoot && this._renderGeneration === e && console.error("Error creating phone number field:", t);
|
|
1061
1056
|
});
|
|
1062
1057
|
}
|
|
1063
1058
|
getCss() {
|
|
1064
1059
|
return super.getCss() + [
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1060
|
+
A,
|
|
1061
|
+
j,
|
|
1062
|
+
k,
|
|
1063
|
+
me
|
|
1069
1064
|
].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 ";
|
|
1070
1065
|
}
|
|
1071
1066
|
getValue() {
|
|
1072
1067
|
return this._phone;
|
|
1073
1068
|
}
|
|
1074
1069
|
getIsValid() {
|
|
1075
|
-
let e =
|
|
1070
|
+
let e = a(), t = this._field?.getCountry();
|
|
1076
1071
|
return !e.phoneNumber(this._phone, t);
|
|
1077
1072
|
}
|
|
1078
1073
|
getError() {
|
|
1079
1074
|
return this._error;
|
|
1080
1075
|
}
|
|
1081
|
-
},
|
|
1076
|
+
}, ge = "Payment failed", _e = "We couldn't securely process your card details. Please check your card information and try again.", ve = "No payment details were entered. Please add your card and try again.", ye = "This payment is no longer available. Please reload the page and try again.", be = class {
|
|
1082
1077
|
_config;
|
|
1083
1078
|
_apiService;
|
|
1084
1079
|
_changeListeners = [];
|
|
@@ -1104,14 +1099,14 @@ var K = class {
|
|
|
1104
1099
|
_error;
|
|
1105
1100
|
elements;
|
|
1106
1101
|
constructor(e) {
|
|
1107
|
-
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), i({
|
|
1102
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), ne(), i({
|
|
1108
1103
|
environment: e.environment,
|
|
1109
1104
|
sessionId: this._sessionId,
|
|
1110
1105
|
integration: "elements"
|
|
1111
|
-
}),
|
|
1106
|
+
}), y(c.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && r.setLocale(e.locale), this._apiService = new T(e.apiKey, e.environment);
|
|
1112
1107
|
let t = {};
|
|
1113
1108
|
Object.defineProperty(t, "email", {
|
|
1114
|
-
get: () => (this._email || (this._email = new
|
|
1109
|
+
get: () => (this._email || (this._email = new X(), this._trackElement(this._email)), this._email),
|
|
1115
1110
|
enumerable: !0
|
|
1116
1111
|
}), Object.defineProperty(t, "phone", {
|
|
1117
1112
|
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone)), this._phone),
|
|
@@ -1119,7 +1114,7 @@ var K = class {
|
|
|
1119
1114
|
});
|
|
1120
1115
|
let n = {};
|
|
1121
1116
|
Object.defineProperty(n, "applePay", {
|
|
1122
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1117
|
+
get: () => (this._applePay || (this._applePay = new U(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1123
1118
|
paymentId: this._paymentState.paymentId,
|
|
1124
1119
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1125
1120
|
environment: this._config.environment,
|
|
@@ -1141,63 +1136,63 @@ var K = class {
|
|
|
1141
1136
|
})), this._paypal),
|
|
1142
1137
|
enumerable: !0
|
|
1143
1138
|
});
|
|
1144
|
-
let
|
|
1145
|
-
Object.defineProperty(
|
|
1146
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1139
|
+
let a = {};
|
|
1140
|
+
Object.defineProperty(a, "street", {
|
|
1141
|
+
get: () => (this._addressStreet || (this._addressStreet = new z(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1147
1142
|
enumerable: !0
|
|
1148
|
-
}), Object.defineProperty(
|
|
1149
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1143
|
+
}), Object.defineProperty(a, "firstName", {
|
|
1144
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new I(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1150
1145
|
enumerable: !0
|
|
1151
|
-
}), Object.defineProperty(
|
|
1152
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1146
|
+
}), Object.defineProperty(a, "lastName", {
|
|
1147
|
+
get: () => (this._addressLastName || (this._addressLastName = new L(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1153
1148
|
enumerable: !0
|
|
1154
|
-
}), Object.defineProperty(
|
|
1155
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1149
|
+
}), Object.defineProperty(a, "city", {
|
|
1150
|
+
get: () => (this._addressCity || (this._addressCity = new N(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1156
1151
|
enumerable: !0
|
|
1157
|
-
}), Object.defineProperty(
|
|
1158
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1152
|
+
}), Object.defineProperty(a, "state", {
|
|
1153
|
+
get: () => (this._addressState || (this._addressState = new R(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1159
1154
|
enumerable: !0
|
|
1160
|
-
}), Object.defineProperty(
|
|
1161
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1155
|
+
}), Object.defineProperty(a, "zipCode", {
|
|
1156
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new B(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1162
1157
|
enumerable: !0
|
|
1163
|
-
}), Object.defineProperty(
|
|
1164
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1158
|
+
}), Object.defineProperty(a, "country", {
|
|
1159
|
+
get: () => (this._addressCountry || (this._addressCountry = new F(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1165
1160
|
this._addressState?.setCountry(e);
|
|
1166
1161
|
})), this._addressCountry),
|
|
1167
1162
|
enumerable: !0
|
|
1168
1163
|
});
|
|
1169
|
-
let
|
|
1164
|
+
let o = {
|
|
1170
1165
|
contact: t,
|
|
1171
1166
|
express: n
|
|
1172
1167
|
};
|
|
1173
|
-
Object.defineProperty(
|
|
1174
|
-
get: () => (this._card || (this._card = new
|
|
1168
|
+
Object.defineProperty(o, "card", {
|
|
1169
|
+
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), 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),
|
|
1175
1170
|
enumerable: !0
|
|
1176
|
-
}), Object.defineProperty(
|
|
1177
|
-
get: () => (this._cardholderName || (this._cardholderName = new
|
|
1171
|
+
}), Object.defineProperty(o, "cardholderName", {
|
|
1172
|
+
get: () => (this._cardholderName || (this._cardholderName = new Y(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1178
1173
|
enumerable: !0
|
|
1179
|
-
}), Object.defineProperty(
|
|
1180
|
-
get: () =>
|
|
1174
|
+
}), Object.defineProperty(o, "address", {
|
|
1175
|
+
get: () => a,
|
|
1181
1176
|
enumerable: !0
|
|
1182
|
-
}), Object.defineProperty(
|
|
1183
|
-
get: () => (this._error || (this._error = new
|
|
1177
|
+
}), Object.defineProperty(o, "error", {
|
|
1178
|
+
get: () => (this._error || (this._error = new Z(), this._trackElement(this._error)), this._error),
|
|
1184
1179
|
enumerable: !0
|
|
1185
|
-
}), this.elements =
|
|
1180
|
+
}), this.elements = o;
|
|
1186
1181
|
}
|
|
1187
1182
|
async associatePayment(e, t) {
|
|
1188
1183
|
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1189
1184
|
let n = ++this._associationSequence, r;
|
|
1190
1185
|
try {
|
|
1191
|
-
r = await
|
|
1186
|
+
r = await ie({
|
|
1192
1187
|
id: e,
|
|
1193
1188
|
checkoutKey: t,
|
|
1194
1189
|
environment: this._config.environment
|
|
1195
1190
|
});
|
|
1196
1191
|
} catch (t) {
|
|
1197
|
-
throw n === this._associationSequence && (this._paymentState = {}),
|
|
1192
|
+
throw n === this._associationSequence && (this._paymentState = {}), y(c.PAYMENT_ASSOCIATION_FAILED, {
|
|
1198
1193
|
payment_id: e,
|
|
1199
1194
|
error_message: t instanceof Error ? t.message : "Unknown error"
|
|
1200
|
-
}),
|
|
1195
|
+
}), o(t instanceof Error ? t : Error("Failed to associate payment"), { payment_id: e }), t;
|
|
1201
1196
|
}
|
|
1202
1197
|
n === this._associationSequence && (this._paymentState = {
|
|
1203
1198
|
paymentId: e,
|
|
@@ -1207,7 +1202,7 @@ var K = class {
|
|
|
1207
1202
|
currency: r.currency,
|
|
1208
1203
|
countryCode: r.countryCode
|
|
1209
1204
|
}
|
|
1210
|
-
},
|
|
1205
|
+
}, y(c.PAYMENT_ASSOCIATED, {
|
|
1211
1206
|
payment_id: e,
|
|
1212
1207
|
currency: r.currency,
|
|
1213
1208
|
country_code: r.countryCode
|
|
@@ -1230,14 +1225,14 @@ var K = class {
|
|
|
1230
1225
|
}));
|
|
1231
1226
|
}
|
|
1232
1227
|
validate() {
|
|
1233
|
-
let e = {}, { t } =
|
|
1228
|
+
let e = {}, { t } = u();
|
|
1234
1229
|
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"), {
|
|
1235
1230
|
valid: Object.keys(e).length === 0,
|
|
1236
1231
|
errors: e
|
|
1237
1232
|
};
|
|
1238
1233
|
}
|
|
1239
1234
|
async _getPayload() {
|
|
1240
|
-
let e = this._email?.isMounted ? this._email.value : "", t = this._phone?.isMounted ? this._phone.value : void 0,
|
|
1235
|
+
let e = this._email?.isMounted ? this._email.value : "", t = this._phone?.isMounted ? this._phone.value : void 0, n = this._addressStreet?.isMounted || this._addressCity?.isMounted || this._addressCountry?.isMounted || this._addressFirstName?.isMounted || this._addressLastName?.isMounted || this._cardholderName?.isMounted || this._addressState?.isMounted || this._addressZipCode?.isMounted ? {
|
|
1241
1236
|
street: this._addressStreet?.isMounted ? this._addressStreet.value : "",
|
|
1242
1237
|
city: this._addressCity?.isMounted ? this._addressCity.value : "",
|
|
1243
1238
|
country: this._addressCountry?.isMounted ? this._addressCountry.value : "",
|
|
@@ -1245,40 +1240,40 @@ var K = class {
|
|
|
1245
1240
|
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1246
1241
|
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1247
1242
|
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1248
|
-
} : void 0,
|
|
1243
|
+
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [n?.firstName ?? "", n?.lastName ?? ""].filter(Boolean), a = r || i.join(" ");
|
|
1249
1244
|
if (!this._card?.isMounted || this._card.captureState === "unsupported") return {
|
|
1250
1245
|
ok: !1,
|
|
1251
1246
|
error: {
|
|
1252
|
-
message:
|
|
1247
|
+
message: ve,
|
|
1253
1248
|
status: 0,
|
|
1254
1249
|
statusText: "No Payment Method"
|
|
1255
1250
|
}
|
|
1256
1251
|
};
|
|
1257
|
-
if (!this._card.isVgsMode) return
|
|
1252
|
+
if (!this._card.isVgsMode) return y(c.CARD_CAPTURE_UNAVAILABLE, { reason: p.NO_TOKENIZATION_SESSION }), {
|
|
1258
1253
|
ok: !1,
|
|
1259
1254
|
error: {
|
|
1260
|
-
message:
|
|
1255
|
+
message: u().t("cardUnavailable"),
|
|
1261
1256
|
status: 0,
|
|
1262
1257
|
statusText: "Card Capture Unavailable"
|
|
1263
1258
|
}
|
|
1264
1259
|
};
|
|
1265
1260
|
try {
|
|
1266
|
-
let
|
|
1261
|
+
let r = await this._card.getPayload();
|
|
1267
1262
|
return {
|
|
1268
1263
|
ok: !0,
|
|
1269
1264
|
formData: {
|
|
1270
|
-
name:
|
|
1265
|
+
name: a,
|
|
1271
1266
|
email: e,
|
|
1272
1267
|
phoneNumber: t || void 0,
|
|
1273
|
-
billingAddress:
|
|
1274
|
-
vgsCardData:
|
|
1268
|
+
billingAddress: n,
|
|
1269
|
+
vgsCardData: r
|
|
1275
1270
|
}
|
|
1276
1271
|
};
|
|
1277
1272
|
} catch {
|
|
1278
1273
|
return {
|
|
1279
1274
|
ok: !1,
|
|
1280
1275
|
error: {
|
|
1281
|
-
message:
|
|
1276
|
+
message: _e,
|
|
1282
1277
|
status: 0,
|
|
1283
1278
|
statusText: "Card Tokenization Failed"
|
|
1284
1279
|
}
|
|
@@ -1309,7 +1304,7 @@ var K = class {
|
|
|
1309
1304
|
let t = e["--odus-font-family"];
|
|
1310
1305
|
if (t) {
|
|
1311
1306
|
this._fontCleanup?.();
|
|
1312
|
-
let { cleanup: e } =
|
|
1307
|
+
let { cleanup: e } = ee({ fontFamily: t });
|
|
1313
1308
|
this._fontCleanup = e;
|
|
1314
1309
|
}
|
|
1315
1310
|
for (let t of this._allElements()) t.setTheme(e);
|
|
@@ -1332,7 +1327,7 @@ var K = class {
|
|
|
1332
1327
|
}
|
|
1333
1328
|
_trackElement(e) {
|
|
1334
1329
|
e.on("ready", () => {
|
|
1335
|
-
this._mountedReported || (this._mountedReported = !0,
|
|
1330
|
+
this._mountedReported || (this._mountedReported = !0, y(c.CHECKOUT_MOUNTED, { container_id: "elements" }));
|
|
1336
1331
|
}), e.on("change", () => {
|
|
1337
1332
|
for (let e of this._changeListeners) e();
|
|
1338
1333
|
});
|
|
@@ -1355,45 +1350,45 @@ var K = class {
|
|
|
1355
1350
|
this._error
|
|
1356
1351
|
].filter((e) => e !== void 0);
|
|
1357
1352
|
}
|
|
1358
|
-
async _executeAuthorization({ formData:
|
|
1359
|
-
let { paymentId:
|
|
1360
|
-
if (!
|
|
1361
|
-
message:
|
|
1353
|
+
async _executeAuthorization({ formData: t, applePayData: n, customCustomerData: r }) {
|
|
1354
|
+
let { paymentId: i, checkoutKey: a } = this._paymentState, o = this._getPaymentMethod(t, n);
|
|
1355
|
+
if (!i || !a) return this._reportSubmitFailure({
|
|
1356
|
+
message: ye,
|
|
1362
1357
|
status: 0,
|
|
1363
1358
|
statusText: "No Associated Payment"
|
|
1364
|
-
},
|
|
1365
|
-
this._emitLoadingState(!0),
|
|
1366
|
-
payment_id:
|
|
1367
|
-
payment_method:
|
|
1359
|
+
}, o), !1;
|
|
1360
|
+
this._emitLoadingState(!0), y(c.PAYMENT_SUBMIT_STARTED, {
|
|
1361
|
+
payment_id: i,
|
|
1362
|
+
payment_method: o
|
|
1368
1363
|
});
|
|
1369
|
-
let
|
|
1364
|
+
let s = performance.now();
|
|
1370
1365
|
try {
|
|
1371
1366
|
let l = await this._apiService.authorizePayment({
|
|
1372
|
-
paymentId:
|
|
1373
|
-
checkoutKey:
|
|
1374
|
-
formData:
|
|
1367
|
+
paymentId: i,
|
|
1368
|
+
checkoutKey: a,
|
|
1369
|
+
formData: t,
|
|
1375
1370
|
returnUrl: this._config.returnUrl,
|
|
1376
|
-
applePayData:
|
|
1377
|
-
customCustomerData:
|
|
1371
|
+
applePayData: n,
|
|
1372
|
+
customCustomerData: r
|
|
1378
1373
|
});
|
|
1379
|
-
return
|
|
1380
|
-
payment_id:
|
|
1381
|
-
payment_method:
|
|
1374
|
+
return f(e.PAYMENT_AUTHORIZATION_TIME, performance.now() - s, "ms", {
|
|
1375
|
+
payment_id: i,
|
|
1376
|
+
payment_method: o,
|
|
1382
1377
|
status: "success"
|
|
1383
|
-
}),
|
|
1384
|
-
payment_id:
|
|
1385
|
-
payment_method:
|
|
1378
|
+
}), y(c.PAYMENT_SUBMIT_SUCCESS, {
|
|
1379
|
+
payment_id: i,
|
|
1380
|
+
payment_method: o
|
|
1386
1381
|
}), this._handlePaymentResponse(l);
|
|
1387
|
-
} catch (
|
|
1388
|
-
return
|
|
1389
|
-
payment_id:
|
|
1390
|
-
payment_method:
|
|
1382
|
+
} catch (t) {
|
|
1383
|
+
return f(e.PAYMENT_AUTHORIZATION_TIME, performance.now() - s, "ms", {
|
|
1384
|
+
payment_id: i,
|
|
1385
|
+
payment_method: o,
|
|
1391
1386
|
status: "failed"
|
|
1392
|
-
}),
|
|
1393
|
-
payment_id:
|
|
1394
|
-
payment_method:
|
|
1395
|
-
error_message: this._readErrorMessage(
|
|
1396
|
-
}), this._handleAuthorizationError(
|
|
1387
|
+
}), y(c.PAYMENT_SUBMIT_FAILED, {
|
|
1388
|
+
payment_id: i,
|
|
1389
|
+
payment_method: o,
|
|
1390
|
+
error_message: this._readErrorMessage(t, "Unknown error")
|
|
1391
|
+
}), this._handleAuthorizationError(t), !1;
|
|
1397
1392
|
} finally {
|
|
1398
1393
|
this._emitLoadingState(!1);
|
|
1399
1394
|
}
|
|
@@ -1408,13 +1403,13 @@ var K = class {
|
|
|
1408
1403
|
}
|
|
1409
1404
|
_handlePaymentResponse(e) {
|
|
1410
1405
|
let t = this._paymentState.paymentId ?? "";
|
|
1411
|
-
return e.latestTransaction.status === "authorized" ? (
|
|
1406
|
+
return e.latestTransaction.status === "authorized" ? (y(c.PAYMENT_AUTHORIZED, {
|
|
1412
1407
|
payment_id: t,
|
|
1413
1408
|
status: e.latestTransaction.status
|
|
1414
|
-
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (
|
|
1409
|
+
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (y(c.PAYMENT_FAILED, {
|
|
1415
1410
|
payment_id: t,
|
|
1416
1411
|
status: e.latestTransaction.status
|
|
1417
|
-
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (
|
|
1412
|
+
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (y(c.PAYMENT_ACTION_REQUIRED, {
|
|
1418
1413
|
payment_id: t,
|
|
1419
1414
|
status: e.status
|
|
1420
1415
|
}), this._callbacks.onActionRequired?.(e.action.redirectUrl), !0);
|
|
@@ -1424,19 +1419,19 @@ var K = class {
|
|
|
1424
1419
|
payment_id: this._paymentState.paymentId ?? "",
|
|
1425
1420
|
payment_method: t
|
|
1426
1421
|
};
|
|
1427
|
-
|
|
1422
|
+
y(c.PAYMENT_SUBMIT_STARTED, n), y(c.PAYMENT_SUBMIT_FAILED, {
|
|
1428
1423
|
...n,
|
|
1429
1424
|
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1430
1425
|
}), this._handleAuthorizationError(e);
|
|
1431
1426
|
}
|
|
1432
1427
|
_handleAuthorizationError(e) {
|
|
1433
|
-
let t = this._readErrorMessage(e,
|
|
1428
|
+
let t = this._readErrorMessage(e, ge);
|
|
1434
1429
|
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1435
1430
|
}
|
|
1436
1431
|
_readErrorMessage(e, t) {
|
|
1437
1432
|
let n = e;
|
|
1438
|
-
return typeof n?.message == "string" && n.message ? n.message :
|
|
1433
|
+
return typeof n?.message == "string" && n.message ? n.message : d(n?.details) ?? t;
|
|
1439
1434
|
}
|
|
1440
1435
|
};
|
|
1441
1436
|
//#endregion
|
|
1442
|
-
export {
|
|
1437
|
+
export { N as AddressCityElement, F as AddressCountryElement, I as AddressFirstNameElement, L as AddressLastNameElement, R as AddressStateElement, z as AddressStreetElement, B as AddressZipCodeElement, U as ApplePayElement, M as BaseElement, J as CardElement, Y as CardholderElement, X as EmailElement, Z as ErrorElement, be as OdusElements, Q as PayPalElement, $ as PhoneElement };
|