@odus/checkout 1.8.0 → 1.8.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 +166 -145
- package/dist/components/checkout/card-elements/CardCvvElement.d.ts.map +1 -1
- package/dist/components/checkout/card-elements/CardNumberElement.d.ts.map +1 -1
- package/dist/components/checkout/form/AddressSection.d.ts +10 -0
- package/dist/components/checkout/form/AddressSection.d.ts.map +1 -1
- package/dist/components/checkout/form/CardSection.d.ts +14 -1
- package/dist/components/checkout/form/CardSection.d.ts.map +1 -1
- package/dist/components/checkout/form/CardholderSection.d.ts.map +1 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts +1 -0
- package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
- package/dist/components/checkout/form/PaymentMethods.d.ts.map +1 -1
- package/dist/components/common/HelperText.d.ts +2 -0
- package/dist/components/common/HelperText.d.ts.map +1 -1
- package/dist/components/common/Input.d.ts +14 -2
- package/dist/components/common/Input.d.ts.map +1 -1
- package/dist/components/common/Select.d.ts +7 -0
- package/dist/components/common/Select.d.ts.map +1 -1
- package/dist/elements/ApplePayElement.d.ts.map +1 -1
- package/dist/elements/card/VgsCardAdapter.d.ts +6 -0
- package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
- package/dist/elements.es.js +237 -236
- package/dist/index.css +1 -1
- package/dist/locales/cs.json.d.ts +1 -1
- package/dist/locales/de.json.d.ts +1 -1
- package/dist/locales/en.json.d.ts +1 -1
- package/dist/locales/es.json.d.ts +1 -1
- package/dist/locales/fr.json.d.ts +1 -1
- package/dist/locales/it.json.d.ts +1 -1
- package/dist/locales/nl.json.d.ts +1 -1
- package/dist/locales/pl.json.d.ts +1 -1
- package/dist/locales/pt.json.d.ts +1 -1
- package/dist/locales/sk.json.d.ts +1 -1
- package/dist/locales/tr.json.d.ts +1 -1
- package/dist/phone.js +29 -29
- package/dist/shared.js +169 -151
- package/dist/utils/country/isCountryAllowed.util.d.ts +17 -0
- package/dist/utils/country/isCountryAllowed.util.d.ts.map +1 -0
- package/dist/utils/helpers/vgsFieldMetrics.util.d.ts +9 -0
- package/dist/utils/helpers/vgsFieldMetrics.util.d.ts.map +1 -0
- package/package.json +1 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as e, C as t,
|
|
1
|
+
import { B as e, C as t, D as n, E as r, G as i, H as a, J as o, K as s, L as c, R as ee, S as l, T as u, U as d, V as f, W as p, X as m, Y as h, Z as g, a as te, d as _, g as ne, h as v, i as re, l as y, n as ie, o as ae, r as oe, s as b, t as x, u as S } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var
|
|
3
|
+
var C = ".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}", w = ".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}", T = ".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)}", E = ":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}", D = class {
|
|
4
4
|
shadowRoot = null;
|
|
5
5
|
host = null;
|
|
6
6
|
options = {};
|
|
@@ -64,17 +64,17 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
64
64
|
this.options.callbacks?.[e]?.(t);
|
|
65
65
|
}
|
|
66
66
|
getCss() {
|
|
67
|
-
return
|
|
67
|
+
return E;
|
|
68
68
|
}
|
|
69
|
-
},
|
|
69
|
+
}, O = class extends D {
|
|
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 } = r();
|
|
77
|
+
this._input = new _({
|
|
78
78
|
name: "billingAddress.city",
|
|
79
79
|
label: this.options.label ?? e("address.townCity"),
|
|
80
80
|
error: !1,
|
|
@@ -85,15 +85,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
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 } = r();
|
|
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
|
+
w,
|
|
94
95
|
T,
|
|
95
|
-
|
|
96
|
-
w
|
|
96
|
+
C
|
|
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 w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
105
105
|
getError() {
|
|
106
106
|
return this._error;
|
|
107
107
|
}
|
|
108
|
-
},
|
|
108
|
+
}, k = ".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}", A = class extends D {
|
|
109
109
|
_value = "";
|
|
110
110
|
_error = null;
|
|
111
111
|
_select = null;
|
|
@@ -116,28 +116,28 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
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:
|
|
120
|
-
this._select = new
|
|
119
|
+
let { t: e, locale: t } = r();
|
|
120
|
+
this._select = new S({
|
|
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: ne(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 } = r();
|
|
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
|
+
T,
|
|
139
|
+
C,
|
|
140
|
+
k
|
|
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 w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
149
149
|
getError() {
|
|
150
150
|
return this._error;
|
|
151
151
|
}
|
|
152
|
-
},
|
|
152
|
+
}, j = class extends D {
|
|
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 } = r();
|
|
160
|
+
this._input = new _({
|
|
161
161
|
name: "billingAddress.firstName",
|
|
162
162
|
label: this.options.label ?? e("address.firstName"),
|
|
163
163
|
error: !1,
|
|
@@ -168,15 +168,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
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 } = r();
|
|
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
|
+
w,
|
|
177
178
|
T,
|
|
178
|
-
|
|
179
|
-
w
|
|
179
|
+
C
|
|
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 w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
188
188
|
getError() {
|
|
189
189
|
return this._error;
|
|
190
190
|
}
|
|
191
|
-
},
|
|
191
|
+
}, M = class extends D {
|
|
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 } = r();
|
|
199
|
+
this._input = new _({
|
|
200
200
|
name: "billingAddress.lastName",
|
|
201
201
|
label: this.options.label ?? e("address.lastName"),
|
|
202
202
|
error: !1,
|
|
@@ -207,15 +207,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
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 } = r();
|
|
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
|
+
w,
|
|
216
217
|
T,
|
|
217
|
-
|
|
218
|
-
w
|
|
218
|
+
C
|
|
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,33 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
227
227
|
getError() {
|
|
228
228
|
return this._error;
|
|
229
229
|
}
|
|
230
|
-
},
|
|
230
|
+
}, N = /* @__PURE__ */ new Set(["US", "CA"]), P = class extends D {
|
|
231
231
|
_value = "";
|
|
232
232
|
_country = "";
|
|
233
233
|
_input = null;
|
|
234
234
|
_select = null;
|
|
235
235
|
setCountry(e) {
|
|
236
|
-
let
|
|
236
|
+
let t = this._country;
|
|
237
237
|
if (this._country = e, !this.shadowRoot) return;
|
|
238
|
-
let
|
|
239
|
-
if (
|
|
240
|
-
let { t
|
|
241
|
-
this._select?.setOptions(v(
|
|
238
|
+
let n = N.has(t), i = N.has(e);
|
|
239
|
+
if (n && i && t !== e) {
|
|
240
|
+
let { t } = r(), n = e, i = t(n === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
241
|
+
this._select?.setOptions(v(n), this.options.placeholder ?? i), this._value = "", this.emit("change", this._value);
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
n !== i && (this._value = "", this.render(), this.emit("change", this._value));
|
|
245
245
|
}
|
|
246
246
|
render() {
|
|
247
247
|
if (this.shadowRoot) {
|
|
248
|
-
if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null,
|
|
248
|
+
if (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, N.has(this._country)) {
|
|
249
249
|
let e = this._country;
|
|
250
250
|
this._renderSelect(e);
|
|
251
251
|
} else this._renderInput();
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
_renderInput() {
|
|
255
|
-
let { t: e } =
|
|
256
|
-
this._input = new
|
|
255
|
+
let { t: e } = r();
|
|
256
|
+
this._input = new _({
|
|
257
257
|
name: "billingAddress.state",
|
|
258
258
|
label: this.options.label ?? e("address.state"),
|
|
259
259
|
error: !1,
|
|
@@ -269,14 +269,14 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
269
269
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
270
270
|
}
|
|
271
271
|
_renderSelect(e) {
|
|
272
|
-
let { t
|
|
273
|
-
this._select = new
|
|
272
|
+
let { t } = r(), n = v(e), i = t(e === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
273
|
+
this._select = new S({
|
|
274
274
|
name: "billingAddress.state",
|
|
275
|
-
label: this.options.label ??
|
|
275
|
+
label: this.options.label ?? t("address.state"),
|
|
276
276
|
error: !1,
|
|
277
277
|
placeholder: this.options.placeholder ?? i,
|
|
278
278
|
value: this._value,
|
|
279
|
-
options:
|
|
279
|
+
options: n,
|
|
280
280
|
autocomplete: "address-level1",
|
|
281
281
|
onChange: (e) => {
|
|
282
282
|
this._value = e.target.value, this._select?.setError(!1), this.emit("change", this._value);
|
|
@@ -288,10 +288,10 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
288
288
|
}
|
|
289
289
|
getCss() {
|
|
290
290
|
return super.getCss() + [
|
|
291
|
-
T,
|
|
292
|
-
E,
|
|
293
291
|
w,
|
|
294
|
-
|
|
292
|
+
T,
|
|
293
|
+
C,
|
|
294
|
+
k
|
|
295
295
|
].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
296
|
}
|
|
297
297
|
getValue() {
|
|
@@ -302,18 +302,18 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
302
302
|
}
|
|
303
303
|
getError() {
|
|
304
304
|
if (this.getIsValid()) return null;
|
|
305
|
-
let { t: e } =
|
|
305
|
+
let { t: e } = r();
|
|
306
306
|
return e("validation.stateRequired");
|
|
307
307
|
}
|
|
308
|
-
},
|
|
308
|
+
}, F = class extends D {
|
|
309
309
|
_value = "";
|
|
310
310
|
_error = null;
|
|
311
311
|
_input = null;
|
|
312
312
|
render() {
|
|
313
313
|
if (!this.shadowRoot) return;
|
|
314
314
|
this._input?.getElement().remove();
|
|
315
|
-
let { t: e } =
|
|
316
|
-
this._input = new
|
|
315
|
+
let { t: e } = r();
|
|
316
|
+
this._input = new _({
|
|
317
317
|
name: "billingAddress.street",
|
|
318
318
|
label: this.options.label ?? e("address.addressLine1"),
|
|
319
319
|
error: !1,
|
|
@@ -329,15 +329,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
329
329
|
this.emit("change", this._value);
|
|
330
330
|
}
|
|
331
331
|
}), this._input.addEventListener("blur", () => {
|
|
332
|
-
let { t: e } =
|
|
332
|
+
let { t: e } = r();
|
|
333
333
|
this._error = this._value.trim() ? null : e("validation.addressLine1Required"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
334
334
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
335
335
|
}
|
|
336
336
|
getCss() {
|
|
337
337
|
return super.getCss() + [
|
|
338
|
+
w,
|
|
338
339
|
T,
|
|
339
|
-
|
|
340
|
-
w
|
|
340
|
+
C
|
|
341
341
|
].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
342
|
}
|
|
343
343
|
getValue() {
|
|
@@ -349,15 +349,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
349
349
|
getError() {
|
|
350
350
|
return this._error;
|
|
351
351
|
}
|
|
352
|
-
},
|
|
352
|
+
}, I = class extends D {
|
|
353
353
|
_value = "";
|
|
354
354
|
_error = null;
|
|
355
355
|
_input = null;
|
|
356
356
|
render() {
|
|
357
357
|
if (!this.shadowRoot) return;
|
|
358
358
|
this._input?.getElement().remove();
|
|
359
|
-
let { t: e } =
|
|
360
|
-
this._input = new
|
|
359
|
+
let { t: e } = r();
|
|
360
|
+
this._input = new _({
|
|
361
361
|
name: "billingAddress.zipCode",
|
|
362
362
|
label: this.options.label ?? e("address.postalCode"),
|
|
363
363
|
error: !1,
|
|
@@ -368,15 +368,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
368
368
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
369
369
|
}
|
|
370
370
|
}), this._input.addEventListener("blur", () => {
|
|
371
|
-
let { t: e } =
|
|
371
|
+
let { t: e } = r();
|
|
372
372
|
this._error = this._value.trim() ? null : e("validation.postalCodeRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
373
373
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
374
374
|
}
|
|
375
375
|
getCss() {
|
|
376
376
|
return super.getCss() + [
|
|
377
|
+
w,
|
|
377
378
|
T,
|
|
378
|
-
|
|
379
|
-
w
|
|
379
|
+
C
|
|
380
380
|
].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
381
|
}
|
|
382
382
|
getValue() {
|
|
@@ -388,7 +388,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
388
388
|
getError() {
|
|
389
389
|
return this._error;
|
|
390
390
|
}
|
|
391
|
-
},
|
|
391
|
+
}, L = "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)}", R = {
|
|
392
392
|
name: "odus-elements",
|
|
393
393
|
styles: {
|
|
394
394
|
fontSize: 14,
|
|
@@ -412,7 +412,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
412
412
|
}
|
|
413
413
|
},
|
|
414
414
|
additionalPaymentMethods: {}
|
|
415
|
-
},
|
|
415
|
+
}, z = class extends D {
|
|
416
416
|
_paymentContext = null;
|
|
417
417
|
_applePayData = null;
|
|
418
418
|
_authorized = !1;
|
|
@@ -431,16 +431,16 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
433
|
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c } = this._paymentContext;
|
|
434
|
-
if (a
|
|
434
|
+
if (!te(a, r?.countryCode)) {
|
|
435
435
|
this._setAvailability(!1);
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
438
|
-
if (!
|
|
438
|
+
if (!re()) {
|
|
439
439
|
this._setAvailability(!1);
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
|
-
this._button = new
|
|
443
|
-
checkoutProfile:
|
|
442
|
+
this._button = new oe({
|
|
443
|
+
checkoutProfile: R,
|
|
444
444
|
paymentId: e,
|
|
445
445
|
checkoutKey: t,
|
|
446
446
|
environment: n,
|
|
@@ -457,7 +457,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
457
457
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
458
458
|
}
|
|
459
459
|
getCss() {
|
|
460
|
-
return super.getCss() +
|
|
460
|
+
return super.getCss() + L + "\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 ";
|
|
461
461
|
}
|
|
462
462
|
getValue() {
|
|
463
463
|
return this._applePayData;
|
|
@@ -468,7 +468,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
468
468
|
getError() {
|
|
469
469
|
return null;
|
|
470
470
|
}
|
|
471
|
-
},
|
|
471
|
+
}, B = ".card-element{border-radius:inherit;box-sizing:border-box;background:#fff;border:none;height:38.5px;padding:0;transition:box-shadow .1s ease-in;position:relative;box-shadow:0 0 0 1px #e0e0e0,0 2px 4px #00000012,0 1px 1.5px #0000000d}.card-element iframe{width:100%;min-width:0;display:block}.card-element-focus{box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}.card-icon{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}", V = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpegirp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhECn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJEocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wtoAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJHDwIDAQAB", H = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gGPMwBRPuVyJReZGIkWH/+Bf5pnpDN1bSR2cLYLXVT8CaSnTw74qeboSnktgYCi1D9R3Bj2fYzTIwGGZb8KinLdxwbqZmHwrE9cFhCaHbG/E0PbqQGhXP2vbniZTT4M0i0Cbi7ES3Bw5zqNbIZZnX041QEpxLvIyWPKZCX+fBogNMhWfCF779aclChjHkwZMsufThVWE9xklWGxXiytx5aL4I5JPxq0I7cAkZGGs4aF/GxWwPaq7R3wPikJQ0YHnCMfcURzl2Hnw/inqyMy+JB6djTq2/BdzMAhWTh3cDWq9Xu+gEkb/QCd0n1yYIdKuDISlk/AfHdWe34IvzhVyQIDAQAB", U = {
|
|
472
472
|
name: "odus-elements",
|
|
473
473
|
styles: {
|
|
474
474
|
fontSize: 14,
|
|
@@ -492,51 +492,51 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
492
492
|
}
|
|
493
493
|
},
|
|
494
494
|
additionalPaymentMethods: {}
|
|
495
|
-
},
|
|
495
|
+
}, W = class {
|
|
496
496
|
_cardNumber = "";
|
|
497
497
|
_cardExpiry = "";
|
|
498
498
|
_cardCvv = "";
|
|
499
499
|
_section = null;
|
|
500
|
-
_focusManager = new
|
|
500
|
+
_focusManager = new l();
|
|
501
501
|
_touchedFields = /* @__PURE__ */ new Set();
|
|
502
502
|
_focusHandlers = [];
|
|
503
503
|
get section() {
|
|
504
504
|
return this._section;
|
|
505
505
|
}
|
|
506
|
-
renderSection(e,
|
|
506
|
+
renderSection(e, t, n) {
|
|
507
507
|
this._section?.getElement().remove();
|
|
508
|
-
let { t:
|
|
509
|
-
this._section = new
|
|
510
|
-
checkoutProfile:
|
|
508
|
+
let { t: i } = r();
|
|
509
|
+
this._section = new b({
|
|
510
|
+
checkoutProfile: U,
|
|
511
511
|
cardNumber: this._cardNumber,
|
|
512
512
|
cardNumberTouched: !1,
|
|
513
513
|
cardCvv: this._cardCvv,
|
|
514
514
|
cardCvvTouched: !1,
|
|
515
515
|
cardExpiry: this._cardExpiry,
|
|
516
516
|
cardExpiryTouched: !1,
|
|
517
|
-
translationFunc:
|
|
517
|
+
translationFunc: i,
|
|
518
518
|
onChange: (e) => {
|
|
519
|
-
let
|
|
520
|
-
if (
|
|
521
|
-
else if (
|
|
522
|
-
let e =
|
|
519
|
+
let n = e.target;
|
|
520
|
+
if (n.name === "cardNumber") this._cardNumber = n.value;
|
|
521
|
+
else if (n.name === "cardExpiry") {
|
|
522
|
+
let e = ee.cardExpiry(n.value);
|
|
523
523
|
this._cardExpiry = e, this._section?.updateCardExpiry(e);
|
|
524
|
-
} else
|
|
525
|
-
this._touchedFields.add(
|
|
524
|
+
} else n.name === "cardCvv" && (this._cardCvv = n.value);
|
|
525
|
+
this._touchedFields.add(n.name), this._updateFocusManagerState(), t(this.getValue());
|
|
526
526
|
},
|
|
527
527
|
onBlur: (e) => {
|
|
528
|
-
let t = e.target,
|
|
529
|
-
if (this._touchedFields.add(
|
|
530
|
-
let e =
|
|
528
|
+
let t = e.target, r = t.name ?? "cardExpiry", i = c();
|
|
529
|
+
if (this._touchedFields.add(r), t.name === "cardNumber") {
|
|
530
|
+
let e = i.cardNumber(this._cardNumber);
|
|
531
531
|
this._section?.updateCardNumber(this._cardNumber, e, !0);
|
|
532
532
|
} else if (t.name === "cardCvv") {
|
|
533
|
-
let e =
|
|
533
|
+
let e = i.cardCvv(this._cardCvv, this._cardNumber);
|
|
534
534
|
this._section?.updateCardCvv(this._cardCvv, e, !0);
|
|
535
535
|
} else {
|
|
536
|
-
let e =
|
|
536
|
+
let e = i.cardExpiry(this._cardExpiry);
|
|
537
537
|
this._section?.updateCardExpiry(this._cardExpiry, e, !0);
|
|
538
538
|
}
|
|
539
|
-
this._updateFocusManagerState(),
|
|
539
|
+
this._updateFocusManagerState(), n(this.getValue());
|
|
540
540
|
}
|
|
541
541
|
}), e.appendChild(this._section.getElement()), this._registerFocusFields();
|
|
542
542
|
}
|
|
@@ -547,15 +547,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
547
547
|
cvv: this._cardCvv
|
|
548
548
|
};
|
|
549
549
|
}
|
|
550
|
-
async getPayload(
|
|
551
|
-
let
|
|
552
|
-
|
|
553
|
-
let
|
|
554
|
-
return
|
|
555
|
-
encryptedCardNumber:
|
|
556
|
-
encryptedCvv:
|
|
557
|
-
expMonth:
|
|
558
|
-
expYear:
|
|
550
|
+
async getPayload(e) {
|
|
551
|
+
let t = e === "live" ? H : V, n = new d();
|
|
552
|
+
n.setPublicKey(t);
|
|
553
|
+
let r = this._cardNumber.replace(/\s+/g, ""), i = this._cardExpiry.replace(/\s+/g, "").split("/"), a = i[0] ?? "", o = i[1] ?? "";
|
|
554
|
+
return o.length === 2 && (o = `20${o}`), {
|
|
555
|
+
encryptedCardNumber: n.encrypt(r),
|
|
556
|
+
encryptedCvv: n.encrypt(this._cardCvv),
|
|
557
|
+
expMonth: a,
|
|
558
|
+
expYear: o
|
|
559
559
|
};
|
|
560
560
|
}
|
|
561
561
|
isValid() {
|
|
@@ -601,7 +601,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
601
601
|
for (let e of this._touchedFields) o[e] = !0;
|
|
602
602
|
this._focusManager.handleStateUpdate(t, n, o);
|
|
603
603
|
}
|
|
604
|
-
},
|
|
604
|
+
}, G = {
|
|
605
605
|
"--odus-font-family": "system-ui, sans-serif",
|
|
606
606
|
"--odus-font-size": "16px",
|
|
607
607
|
"--odus-color-error": "#dc2727",
|
|
@@ -624,7 +624,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
624
624
|
"--odus-card-gap": "12px",
|
|
625
625
|
"--odus-button-height": "48px",
|
|
626
626
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
627
|
-
}["--odus-font-size"],
|
|
627
|
+
}["--odus-font-size"], K = class {
|
|
628
628
|
_vgsService;
|
|
629
629
|
_vgsJwt;
|
|
630
630
|
_vgsState = {};
|
|
@@ -634,28 +634,33 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
634
634
|
_environment = "test";
|
|
635
635
|
_section = null;
|
|
636
636
|
_initGeneration = 0;
|
|
637
|
-
constructor(
|
|
638
|
-
this._vgsJwt =
|
|
637
|
+
constructor(t, n) {
|
|
638
|
+
this._vgsJwt = t, this._environment = n, this._vgsService = new e();
|
|
639
639
|
}
|
|
640
640
|
get section() {
|
|
641
641
|
return this._section;
|
|
642
642
|
}
|
|
643
|
-
renderSection(e,
|
|
643
|
+
renderSection(e, t) {
|
|
644
644
|
this._section?.getElement().remove();
|
|
645
|
-
let { t:
|
|
646
|
-
this._section = new
|
|
647
|
-
checkoutProfile:
|
|
645
|
+
let { t: n } = r();
|
|
646
|
+
this._section = new b({
|
|
647
|
+
checkoutProfile: U,
|
|
648
648
|
cardNumber: "",
|
|
649
649
|
cardNumberTouched: !1,
|
|
650
650
|
cardCvv: "",
|
|
651
651
|
cardCvvTouched: !1,
|
|
652
652
|
cardExpiry: "",
|
|
653
653
|
cardExpiryTouched: !1,
|
|
654
|
-
translationFunc:
|
|
654
|
+
translationFunc: n,
|
|
655
655
|
onChange: () => {},
|
|
656
656
|
onBlur: () => {},
|
|
657
657
|
vgsService: this._vgsService
|
|
658
|
-
}), e.appendChild(this._section.getElement()), this._onChangeEmit =
|
|
658
|
+
}), this._applySkeletonMetrics(), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
|
|
659
|
+
}
|
|
660
|
+
_applySkeletonMetrics() {
|
|
661
|
+
if (!this._section) return;
|
|
662
|
+
let e = this._buildProfileFromTheme(this._currentTheme);
|
|
663
|
+
this._section.updateVgsWrapperStyles(this._currentTheme["--odus-border-color"] ?? "#e0e0e0", e.styles.borderRadius), this._section.setVgsFieldMetrics(this._currentTheme["--odus-input-padding"] ?? "8px 12px", e.styles.fontSize);
|
|
659
664
|
}
|
|
660
665
|
_onChangeEmit = null;
|
|
661
666
|
initVgs() {
|
|
@@ -678,79 +683,75 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
678
683
|
return this._vgsFieldsValid;
|
|
679
684
|
}
|
|
680
685
|
getError() {
|
|
681
|
-
let { t: e } =
|
|
686
|
+
let { t: e } = r();
|
|
682
687
|
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
683
688
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
684
689
|
let r = n.errors?.[0];
|
|
685
690
|
if (!r) continue;
|
|
686
|
-
let i =
|
|
691
|
+
let i = y(t, r.code);
|
|
687
692
|
if (i) return e(i);
|
|
688
693
|
}
|
|
689
694
|
return null;
|
|
690
695
|
}
|
|
691
696
|
applyTheme(e) {
|
|
692
|
-
|
|
697
|
+
this._currentTheme = {
|
|
693
698
|
...this._currentTheme,
|
|
694
699
|
...e
|
|
695
|
-
},
|
|
696
|
-
let t = this._buildProfileFromTheme(this._currentTheme), n = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
|
|
697
|
-
this._section.updateVgsWrapperStyles(n, t.styles.borderRadius), this._reinitWithTheme();
|
|
700
|
+
}, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme());
|
|
698
701
|
}
|
|
699
702
|
resetTheme(e) {
|
|
700
703
|
for (let t of e) delete this._currentTheme[t];
|
|
701
|
-
|
|
702
|
-
let t = this._buildProfileFromTheme(this._currentTheme), n = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
|
|
703
|
-
this._section.updateVgsWrapperStyles(n, t.styles.borderRadius), this._reinitWithTheme();
|
|
704
|
+
this._section && (this._applySkeletonMetrics(), this._reinitWithTheme());
|
|
704
705
|
}
|
|
705
706
|
destroy() {
|
|
706
707
|
this._vgsReinitTimer &&= (clearTimeout(this._vgsReinitTimer), null), this._vgsService.destroy(), this._section = null;
|
|
707
708
|
}
|
|
708
709
|
_reinitWithTheme() {
|
|
709
710
|
this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
|
|
710
|
-
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new
|
|
711
|
+
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new e(), this._section?.setVgsService(this._vgsService), this.initVgs();
|
|
711
712
|
}, 300);
|
|
712
713
|
}
|
|
713
714
|
_buildProfileFromTheme(e) {
|
|
714
|
-
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ??
|
|
715
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? G, n = e["--odus-font-family"] ?? U.styles.fontFamily, r = e["--odus-color-text"] ?? U.styles.textColor, i = e["--odus-border-radius"] ?? `${U.styles.borderRadius}px`;
|
|
715
716
|
return {
|
|
716
|
-
...
|
|
717
|
+
...U,
|
|
717
718
|
styles: {
|
|
718
|
-
...
|
|
719
|
-
fontSize: parseInt(t, 10) || parseInt(
|
|
719
|
+
...U.styles,
|
|
720
|
+
fontSize: parseInt(t, 10) || parseInt(G, 10),
|
|
720
721
|
fontFamily: n,
|
|
721
722
|
textColor: r,
|
|
722
|
-
borderRadius: parseInt(i, 10) ||
|
|
723
|
+
borderRadius: parseInt(i, 10) || U.styles.borderRadius
|
|
723
724
|
}
|
|
724
725
|
};
|
|
725
726
|
}
|
|
726
727
|
async _mountFields(e) {
|
|
727
728
|
if (!this._section) return;
|
|
728
|
-
let n = this._buildProfileFromTheme(this._currentTheme),
|
|
729
|
-
this.
|
|
730
|
-
let
|
|
731
|
-
for (let e of Object.values(
|
|
729
|
+
let n = this._buildProfileFromTheme(this._currentTheme), i = this._currentTheme["--odus-border-color"] ?? "#e0e0e0";
|
|
730
|
+
this._applySkeletonMetrics();
|
|
731
|
+
let a = this._section.getVgsContainerIds();
|
|
732
|
+
for (let e of Object.values(a)) {
|
|
732
733
|
if (!e) continue;
|
|
733
734
|
let t = document.getElementById(e);
|
|
734
735
|
t && t.querySelectorAll("iframe").forEach((e) => e.remove());
|
|
735
736
|
}
|
|
736
|
-
let
|
|
737
|
+
let o = await t(n.styles.fontFamily);
|
|
737
738
|
if (e !== this._initGeneration) return;
|
|
738
|
-
let
|
|
739
|
-
borderColor:
|
|
739
|
+
let s = this._section.buildVgsFieldCss(n, o, {
|
|
740
|
+
borderColor: i,
|
|
740
741
|
backgroundColor: this._currentTheme["--odus-color-background"],
|
|
741
742
|
placeholderColor: this._currentTheme["--odus-input-placeholder-color"],
|
|
742
743
|
placeholderOpacity: this._currentTheme["--odus-input-placeholder-opacity"],
|
|
743
744
|
padding: this._currentTheme["--odus-input-padding"]
|
|
744
|
-
}), { t:
|
|
745
|
+
}), { t: c } = r();
|
|
745
746
|
this._vgsService.mountCardFields({
|
|
746
|
-
cardNumber:
|
|
747
|
-
cardExpiry:
|
|
748
|
-
cardCvv:
|
|
749
|
-
},
|
|
747
|
+
cardNumber: a.cardNumber ? `#${a.cardNumber}` : void 0,
|
|
748
|
+
cardExpiry: a.cardExpiry ? `#${a.cardExpiry}` : void 0,
|
|
749
|
+
cardCvv: a.cardCvv ? `#${a.cardCvv}` : void 0
|
|
750
|
+
}, s, {
|
|
750
751
|
cardNumber: "1234 5678 9012 3456",
|
|
751
|
-
cardExpiry:
|
|
752
|
+
cardExpiry: c("cardExpiry"),
|
|
752
753
|
cardCvv: "CVV",
|
|
753
|
-
cardholderName:
|
|
754
|
+
cardholderName: c("cardholderName")
|
|
754
755
|
}, (e) => {
|
|
755
756
|
this._section?.updateVgsCardBrand(e);
|
|
756
757
|
}), this._vgsService.waitForFieldsReady().then(() => {
|
|
@@ -759,8 +760,8 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
759
760
|
}
|
|
760
761
|
_handleStateChange(e) {
|
|
761
762
|
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
762
|
-
let { t
|
|
763
|
-
this._section?.handleVgsStateChange(e,
|
|
763
|
+
let { t } = r(), n = this._deriveFieldErrors(t);
|
|
764
|
+
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
764
765
|
}
|
|
765
766
|
_deriveFieldErrors(e) {
|
|
766
767
|
let t = {};
|
|
@@ -768,16 +769,16 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
768
769
|
if (!r?.isTouched || r.isFocused || r.isValid) continue;
|
|
769
770
|
let i = r.errors?.[0];
|
|
770
771
|
if (!i) continue;
|
|
771
|
-
let a =
|
|
772
|
+
let a = y(n, i.code);
|
|
772
773
|
a && (t[n] = e(a));
|
|
773
774
|
}
|
|
774
775
|
return t;
|
|
775
776
|
}
|
|
776
|
-
},
|
|
777
|
+
}, q = class extends D {
|
|
777
778
|
_environment = "test";
|
|
778
779
|
_isVgsMode = !1;
|
|
779
780
|
_mountContainer = null;
|
|
780
|
-
_nativeAdapter = new
|
|
781
|
+
_nativeAdapter = new W();
|
|
781
782
|
_vgsAdapter = null;
|
|
782
783
|
get isVgsMode() {
|
|
783
784
|
return this._isVgsMode;
|
|
@@ -786,7 +787,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
786
787
|
this._environment = e;
|
|
787
788
|
}
|
|
788
789
|
setVgsJwt(e) {
|
|
789
|
-
this._isVgsMode = !0, this._vgsAdapter = new
|
|
790
|
+
this._isVgsMode = !0, this._vgsAdapter = new K(e, this._environment), this.isMounted && this._mountContainer && (this.unmount(), this.mount(this._mountContainer));
|
|
790
791
|
}
|
|
791
792
|
mount(e) {
|
|
792
793
|
this.isMounted && this.unmount();
|
|
@@ -827,10 +828,10 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
827
828
|
}
|
|
828
829
|
getCss() {
|
|
829
830
|
return super.getCss() + [
|
|
830
|
-
T,
|
|
831
|
-
E,
|
|
832
831
|
w,
|
|
833
|
-
|
|
832
|
+
T,
|
|
833
|
+
C,
|
|
834
|
+
B
|
|
834
835
|
].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 ";
|
|
835
836
|
}
|
|
836
837
|
getValue() {
|
|
@@ -853,15 +854,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
853
854
|
getError() {
|
|
854
855
|
return this._isVgsMode ? this._vgsAdapter?.getError() ?? null : this._nativeAdapter.getError();
|
|
855
856
|
}
|
|
856
|
-
},
|
|
857
|
+
}, J = class extends D {
|
|
857
858
|
_value = "";
|
|
858
859
|
_error = null;
|
|
859
860
|
_input = null;
|
|
860
861
|
render() {
|
|
861
862
|
if (!this.shadowRoot) return;
|
|
862
863
|
this._input?.getElement().remove();
|
|
863
|
-
let { t: e } =
|
|
864
|
-
this._input = new
|
|
864
|
+
let { t: e } = r();
|
|
865
|
+
this._input = new _({
|
|
865
866
|
name: "billingAddress.cardholderName",
|
|
866
867
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
867
868
|
error: !1,
|
|
@@ -873,15 +874,15 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
873
874
|
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
874
875
|
}
|
|
875
876
|
}), this._input.addEventListener("blur", () => {
|
|
876
|
-
let { t: e } =
|
|
877
|
+
let { t: e } = r();
|
|
877
878
|
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
878
879
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
879
880
|
}
|
|
880
881
|
getCss() {
|
|
881
882
|
return super.getCss() + [
|
|
883
|
+
w,
|
|
882
884
|
T,
|
|
883
|
-
|
|
884
|
-
w
|
|
885
|
+
C
|
|
885
886
|
].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 ";
|
|
886
887
|
}
|
|
887
888
|
getValue() {
|
|
@@ -893,7 +894,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
893
894
|
getError() {
|
|
894
895
|
return this._error;
|
|
895
896
|
}
|
|
896
|
-
},
|
|
897
|
+
}, se = {
|
|
897
898
|
name: "odus-elements",
|
|
898
899
|
styles: {
|
|
899
900
|
fontSize: 14,
|
|
@@ -917,7 +918,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
917
918
|
}
|
|
918
919
|
},
|
|
919
920
|
additionalPaymentMethods: {}
|
|
920
|
-
},
|
|
921
|
+
}, Y = class extends D {
|
|
921
922
|
_email = "";
|
|
922
923
|
_error = null;
|
|
923
924
|
_suggestion = null;
|
|
@@ -925,11 +926,11 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
925
926
|
render() {
|
|
926
927
|
if (!this.shadowRoot) return;
|
|
927
928
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
928
|
-
let { t: e } =
|
|
929
|
-
this._field = new
|
|
929
|
+
let { t: e } = r();
|
|
930
|
+
this._field = new ae({
|
|
930
931
|
value: this._email,
|
|
931
932
|
error: !1,
|
|
932
|
-
checkoutProfile:
|
|
933
|
+
checkoutProfile: se,
|
|
933
934
|
translationFunc: e,
|
|
934
935
|
label: this.options.label,
|
|
935
936
|
placeholder: this.options.placeholder,
|
|
@@ -945,9 +946,9 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
945
946
|
}
|
|
946
947
|
getCss() {
|
|
947
948
|
return super.getCss() + [
|
|
949
|
+
w,
|
|
948
950
|
T,
|
|
949
|
-
|
|
950
|
-
w
|
|
951
|
+
C
|
|
951
952
|
].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 ";
|
|
952
953
|
}
|
|
953
954
|
getValue() {
|
|
@@ -962,7 +963,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
962
963
|
get suggestion() {
|
|
963
964
|
return this._suggestion;
|
|
964
965
|
}
|
|
965
|
-
},
|
|
966
|
+
}, ce = "@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}", X = class extends D {
|
|
966
967
|
_alert = null;
|
|
967
968
|
_message = null;
|
|
968
969
|
render() {
|
|
@@ -979,7 +980,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
979
980
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
980
981
|
}
|
|
981
982
|
getCss() {
|
|
982
|
-
return super.getCss() +
|
|
983
|
+
return super.getCss() + ce + "\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 ";
|
|
983
984
|
}
|
|
984
985
|
getValue() {
|
|
985
986
|
return null;
|
|
@@ -990,7 +991,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
990
991
|
getError() {
|
|
991
992
|
return this._message;
|
|
992
993
|
}
|
|
993
|
-
},
|
|
994
|
+
}, Z = ".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}", le = {
|
|
994
995
|
name: "odus-elements",
|
|
995
996
|
styles: {
|
|
996
997
|
fontSize: 14,
|
|
@@ -1014,7 +1015,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1014
1015
|
}
|
|
1015
1016
|
},
|
|
1016
1017
|
additionalPaymentMethods: {}
|
|
1017
|
-
}, Q = class extends
|
|
1018
|
+
}, Q = class extends D {
|
|
1018
1019
|
_paymentContext = null;
|
|
1019
1020
|
_button = null;
|
|
1020
1021
|
setPaymentContext(e) {
|
|
@@ -1023,8 +1024,8 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1023
1024
|
render() {
|
|
1024
1025
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
1025
1026
|
let { onAuthorize: e } = this._paymentContext;
|
|
1026
|
-
this._button = new
|
|
1027
|
-
checkoutProfile:
|
|
1027
|
+
this._button = new ie({
|
|
1028
|
+
checkoutProfile: le,
|
|
1028
1029
|
onSubmit: async () => {
|
|
1029
1030
|
this._button?.setSubmitting(!0);
|
|
1030
1031
|
try {
|
|
@@ -1036,7 +1037,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1036
1037
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
1037
1038
|
}
|
|
1038
1039
|
getCss() {
|
|
1039
|
-
return super.getCss() +
|
|
1040
|
+
return super.getCss() + Z + "\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 ";
|
|
1040
1041
|
}
|
|
1041
1042
|
getValue() {
|
|
1042
1043
|
return null;
|
|
@@ -1047,7 +1048,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1047
1048
|
getError() {
|
|
1048
1049
|
return null;
|
|
1049
1050
|
}
|
|
1050
|
-
},
|
|
1051
|
+
}, ue = ".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}", de = {
|
|
1051
1052
|
name: "odus-elements",
|
|
1052
1053
|
styles: {
|
|
1053
1054
|
fontSize: 14,
|
|
@@ -1071,7 +1072,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1071
1072
|
}
|
|
1072
1073
|
},
|
|
1073
1074
|
additionalPaymentMethods: {}
|
|
1074
|
-
}, $ = class extends
|
|
1075
|
+
}, $ = class extends D {
|
|
1075
1076
|
_phone = "";
|
|
1076
1077
|
_error = null;
|
|
1077
1078
|
_field = null;
|
|
@@ -1080,14 +1081,14 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1080
1081
|
if (!this.shadowRoot) return;
|
|
1081
1082
|
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1082
1083
|
let e = ++this._renderGeneration;
|
|
1083
|
-
|
|
1084
|
+
a().then(({ PhoneNumberField: t }) => {
|
|
1084
1085
|
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1085
|
-
let { t:
|
|
1086
|
-
this._field = new
|
|
1086
|
+
let { t: n, locale: i } = r();
|
|
1087
|
+
this._field = new t({
|
|
1087
1088
|
value: this._phone,
|
|
1088
1089
|
error: !1,
|
|
1089
|
-
checkoutProfile:
|
|
1090
|
-
translationFunc:
|
|
1090
|
+
checkoutProfile: de,
|
|
1091
|
+
translationFunc: n,
|
|
1091
1092
|
locale: i,
|
|
1092
1093
|
label: this.options.label,
|
|
1093
1094
|
placeholder: this.options.placeholder,
|
|
@@ -1105,10 +1106,10 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1105
1106
|
}
|
|
1106
1107
|
getCss() {
|
|
1107
1108
|
return super.getCss() + [
|
|
1108
|
-
T,
|
|
1109
|
-
E,
|
|
1110
1109
|
w,
|
|
1111
|
-
|
|
1110
|
+
T,
|
|
1111
|
+
C,
|
|
1112
|
+
ue
|
|
1112
1113
|
].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 ";
|
|
1113
1114
|
}
|
|
1114
1115
|
getValue() {
|
|
@@ -1121,7 +1122,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1121
1122
|
getError() {
|
|
1122
1123
|
return this._error;
|
|
1123
1124
|
}
|
|
1124
|
-
},
|
|
1125
|
+
}, fe = class {
|
|
1125
1126
|
_config;
|
|
1126
1127
|
_apiService;
|
|
1127
1128
|
_changeListeners = [];
|
|
@@ -1146,22 +1147,22 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1146
1147
|
_error;
|
|
1147
1148
|
elements;
|
|
1148
1149
|
constructor(e) {
|
|
1149
|
-
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(),
|
|
1150
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), p({
|
|
1150
1151
|
environment: e.environment,
|
|
1151
1152
|
sessionId: this._sessionId,
|
|
1152
1153
|
integration: "elements"
|
|
1153
|
-
}),
|
|
1154
|
+
}), s(h.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && n.setLocale(e.locale), this._apiService = new f(e.apiKey, e.environment);
|
|
1154
1155
|
let t = {};
|
|
1155
1156
|
Object.defineProperty(t, "email", {
|
|
1156
|
-
get: () => (this._email || (this._email = new
|
|
1157
|
+
get: () => (this._email || (this._email = new Y(), this._trackElement(this._email)), this._email),
|
|
1157
1158
|
enumerable: !0
|
|
1158
1159
|
}), Object.defineProperty(t, "phone", {
|
|
1159
1160
|
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone)), this._phone),
|
|
1160
1161
|
enumerable: !0
|
|
1161
1162
|
});
|
|
1162
|
-
let
|
|
1163
|
-
Object.defineProperty(
|
|
1164
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1163
|
+
let r = {};
|
|
1164
|
+
Object.defineProperty(r, "applePay", {
|
|
1165
|
+
get: () => (this._applePay || (this._applePay = new z(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1165
1166
|
paymentId: this._paymentState.paymentId,
|
|
1166
1167
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1167
1168
|
environment: this._config.environment,
|
|
@@ -1173,7 +1174,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1173
1174
|
})
|
|
1174
1175
|
})), this._applePay),
|
|
1175
1176
|
enumerable: !0
|
|
1176
|
-
}), Object.defineProperty(
|
|
1177
|
+
}), Object.defineProperty(r, "payPal", {
|
|
1177
1178
|
get: () => (this._paypal || (this._paypal = new Q(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1178
1179
|
paymentId: this._paymentState.paymentId,
|
|
1179
1180
|
checkoutKey: this._paymentState.checkoutKey,
|
|
@@ -1181,61 +1182,61 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1181
1182
|
})), this._paypal),
|
|
1182
1183
|
enumerable: !0
|
|
1183
1184
|
});
|
|
1184
|
-
let
|
|
1185
|
-
Object.defineProperty(
|
|
1186
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1185
|
+
let i = {};
|
|
1186
|
+
Object.defineProperty(i, "street", {
|
|
1187
|
+
get: () => (this._addressStreet || (this._addressStreet = new F(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1187
1188
|
enumerable: !0
|
|
1188
|
-
}), Object.defineProperty(
|
|
1189
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1189
|
+
}), Object.defineProperty(i, "firstName", {
|
|
1190
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new j(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1190
1191
|
enumerable: !0
|
|
1191
|
-
}), Object.defineProperty(
|
|
1192
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1192
|
+
}), Object.defineProperty(i, "lastName", {
|
|
1193
|
+
get: () => (this._addressLastName || (this._addressLastName = new M(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1193
1194
|
enumerable: !0
|
|
1194
|
-
}), Object.defineProperty(
|
|
1195
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1195
|
+
}), Object.defineProperty(i, "city", {
|
|
1196
|
+
get: () => (this._addressCity || (this._addressCity = new O(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1196
1197
|
enumerable: !0
|
|
1197
|
-
}), Object.defineProperty(
|
|
1198
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1198
|
+
}), Object.defineProperty(i, "state", {
|
|
1199
|
+
get: () => (this._addressState || (this._addressState = new P(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1199
1200
|
enumerable: !0
|
|
1200
|
-
}), Object.defineProperty(
|
|
1201
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1201
|
+
}), Object.defineProperty(i, "zipCode", {
|
|
1202
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new I(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1202
1203
|
enumerable: !0
|
|
1203
|
-
}), Object.defineProperty(
|
|
1204
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1204
|
+
}), Object.defineProperty(i, "country", {
|
|
1205
|
+
get: () => (this._addressCountry || (this._addressCountry = new A(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1205
1206
|
this._addressState?.setCountry(e);
|
|
1206
1207
|
})), this._addressCountry),
|
|
1207
1208
|
enumerable: !0
|
|
1208
1209
|
});
|
|
1209
|
-
let
|
|
1210
|
+
let a = {
|
|
1210
1211
|
contact: t,
|
|
1211
|
-
express:
|
|
1212
|
+
express: r
|
|
1212
1213
|
};
|
|
1213
|
-
Object.defineProperty(
|
|
1214
|
-
get: () => (this._card || (this._card = new
|
|
1214
|
+
Object.defineProperty(a, "card", {
|
|
1215
|
+
get: () => (this._card || (this._card = new q(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._paymentState.vgsJwt && this._card.setVgsJwt(this._paymentState.vgsJwt)), this._card),
|
|
1215
1216
|
enumerable: !0
|
|
1216
|
-
}), Object.defineProperty(
|
|
1217
|
-
get: () => (this._cardholderName || (this._cardholderName = new
|
|
1217
|
+
}), Object.defineProperty(a, "cardholderName", {
|
|
1218
|
+
get: () => (this._cardholderName || (this._cardholderName = new J(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1218
1219
|
enumerable: !0
|
|
1219
|
-
}), Object.defineProperty(
|
|
1220
|
-
get: () =>
|
|
1220
|
+
}), Object.defineProperty(a, "address", {
|
|
1221
|
+
get: () => i,
|
|
1221
1222
|
enumerable: !0
|
|
1222
|
-
}), Object.defineProperty(
|
|
1223
|
-
get: () => (this._error || (this._error = new
|
|
1223
|
+
}), Object.defineProperty(a, "error", {
|
|
1224
|
+
get: () => (this._error || (this._error = new X(), this._trackElement(this._error)), this._error),
|
|
1224
1225
|
enumerable: !0
|
|
1225
|
-
}), this.elements =
|
|
1226
|
+
}), this.elements = a;
|
|
1226
1227
|
}
|
|
1227
1228
|
async associatePayment(e, t) {
|
|
1228
1229
|
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1229
1230
|
this._paymentState.paymentId = e, this._paymentState.checkoutKey = t;
|
|
1230
1231
|
let n;
|
|
1231
1232
|
try {
|
|
1232
|
-
n = await
|
|
1233
|
+
n = await g({
|
|
1233
1234
|
id: e,
|
|
1234
1235
|
checkoutKey: t,
|
|
1235
1236
|
environment: this._config.environment
|
|
1236
1237
|
});
|
|
1237
1238
|
} catch (t) {
|
|
1238
|
-
throw
|
|
1239
|
+
throw s(h.PAYMENT_ASSOCIATION_FAILED, {
|
|
1239
1240
|
payment_id: e,
|
|
1240
1241
|
error_message: t instanceof Error ? t.message : "Unknown error"
|
|
1241
1242
|
}), i(t instanceof Error ? t : Error("Failed to associate payment"), { payment_id: e }), t;
|
|
@@ -1244,7 +1245,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1244
1245
|
amount: n.amount,
|
|
1245
1246
|
currency: n.currency,
|
|
1246
1247
|
countryCode: n.countryCode
|
|
1247
|
-
},
|
|
1248
|
+
}, s(h.PAYMENT_ASSOCIATED, {
|
|
1248
1249
|
payment_id: e,
|
|
1249
1250
|
currency: n.currency,
|
|
1250
1251
|
country_code: n.countryCode
|
|
@@ -1265,8 +1266,8 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1265
1266
|
});
|
|
1266
1267
|
}
|
|
1267
1268
|
validate() {
|
|
1268
|
-
let e = {}, { t
|
|
1269
|
-
return this._card?.isMounted && !this._card.isValid && (e.card = this._card.error ??
|
|
1269
|
+
let e = {}, { t } = r();
|
|
1270
|
+
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"), {
|
|
1270
1271
|
valid: Object.keys(e).length === 0,
|
|
1271
1272
|
errors: e
|
|
1272
1273
|
};
|
|
@@ -1332,7 +1333,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1332
1333
|
let t = e["--odus-font-family"];
|
|
1333
1334
|
if (t) {
|
|
1334
1335
|
this._fontCleanup?.();
|
|
1335
|
-
let { cleanup: e } =
|
|
1336
|
+
let { cleanup: e } = u({ fontFamily: t });
|
|
1336
1337
|
this._fontCleanup = e;
|
|
1337
1338
|
}
|
|
1338
1339
|
for (let t of this._allElements()) t.setTheme(e);
|
|
@@ -1355,7 +1356,7 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1355
1356
|
}
|
|
1356
1357
|
_trackElement(e) {
|
|
1357
1358
|
e.on("ready", () => {
|
|
1358
|
-
this._mountedReported || (this._mountedReported = !0,
|
|
1359
|
+
this._mountedReported || (this._mountedReported = !0, s(h.CHECKOUT_MOUNTED, { container_id: "elements" }));
|
|
1359
1360
|
}), e.on("change", () => {
|
|
1360
1361
|
for (let e of this._changeListeners) e();
|
|
1361
1362
|
});
|
|
@@ -1380,37 +1381,37 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1380
1381
|
}
|
|
1381
1382
|
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1382
1383
|
this._emitLoadingState(!0);
|
|
1383
|
-
let
|
|
1384
|
-
|
|
1385
|
-
payment_id:
|
|
1386
|
-
payment_method:
|
|
1384
|
+
let r = this._paymentState.paymentId, i = this._getPaymentMethod(e, t);
|
|
1385
|
+
s(h.PAYMENT_SUBMIT_STARTED, {
|
|
1386
|
+
payment_id: r,
|
|
1387
|
+
payment_method: i
|
|
1387
1388
|
});
|
|
1388
|
-
let
|
|
1389
|
+
let a = performance.now();
|
|
1389
1390
|
try {
|
|
1390
1391
|
let c = await this._apiService.authorizePayment({
|
|
1391
|
-
paymentId:
|
|
1392
|
+
paymentId: r,
|
|
1392
1393
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1393
1394
|
formData: e,
|
|
1394
1395
|
returnUrl: this._config.returnUrl,
|
|
1395
1396
|
applePayData: t,
|
|
1396
1397
|
customCustomerData: n
|
|
1397
1398
|
});
|
|
1398
|
-
|
|
1399
|
-
payment_id:
|
|
1400
|
-
payment_method:
|
|
1399
|
+
o(m.PAYMENT_AUTHORIZATION_TIME, performance.now() - a, "ms", {
|
|
1400
|
+
payment_id: r,
|
|
1401
|
+
payment_method: i,
|
|
1401
1402
|
status: "success"
|
|
1402
|
-
}),
|
|
1403
|
-
payment_id:
|
|
1404
|
-
payment_method:
|
|
1403
|
+
}), s(h.PAYMENT_SUBMIT_SUCCESS, {
|
|
1404
|
+
payment_id: r,
|
|
1405
|
+
payment_method: i
|
|
1405
1406
|
}), this._handlePaymentResponse(c);
|
|
1406
1407
|
} catch (e) {
|
|
1407
|
-
|
|
1408
|
-
payment_id:
|
|
1409
|
-
payment_method:
|
|
1408
|
+
o(m.PAYMENT_AUTHORIZATION_TIME, performance.now() - a, "ms", {
|
|
1409
|
+
payment_id: r,
|
|
1410
|
+
payment_method: i,
|
|
1410
1411
|
status: "failed"
|
|
1411
|
-
}),
|
|
1412
|
-
payment_id:
|
|
1413
|
-
payment_method:
|
|
1412
|
+
}), s(h.PAYMENT_SUBMIT_FAILED, {
|
|
1413
|
+
payment_id: r,
|
|
1414
|
+
payment_method: i,
|
|
1414
1415
|
error_message: e.details?.message ?? "Unknown error"
|
|
1415
1416
|
}), this._handleAuthorizationError(e);
|
|
1416
1417
|
} finally {
|
|
@@ -1428,20 +1429,20 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1428
1429
|
_handlePaymentResponse(e) {
|
|
1429
1430
|
let t = this._paymentState.paymentId ?? "";
|
|
1430
1431
|
if (e.latestTransaction.status === "authorized") {
|
|
1431
|
-
|
|
1432
|
+
s(h.PAYMENT_AUTHORIZED, {
|
|
1432
1433
|
payment_id: t,
|
|
1433
1434
|
status: e.latestTransaction.status
|
|
1434
1435
|
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status);
|
|
1435
1436
|
return;
|
|
1436
1437
|
}
|
|
1437
1438
|
if (e.latestTransaction.status === "failed") {
|
|
1438
|
-
|
|
1439
|
+
s(h.PAYMENT_FAILED, {
|
|
1439
1440
|
payment_id: t,
|
|
1440
1441
|
status: e.latestTransaction.status
|
|
1441
1442
|
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status);
|
|
1442
1443
|
return;
|
|
1443
1444
|
}
|
|
1444
|
-
e.status === "requires_action" && (
|
|
1445
|
+
e.status === "requires_action" && (s(h.PAYMENT_ACTION_REQUIRED, {
|
|
1445
1446
|
payment_id: t,
|
|
1446
1447
|
status: e.status
|
|
1447
1448
|
}), this._callbacks.onActionRequired?.(e.action.redirectUrl));
|
|
@@ -1452,4 +1453,4 @@ var w = ".form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inhe
|
|
|
1452
1453
|
}
|
|
1453
1454
|
};
|
|
1454
1455
|
//#endregion
|
|
1455
|
-
export {
|
|
1456
|
+
export { O as AddressCityElement, A as AddressCountryElement, j as AddressFirstNameElement, M as AddressLastNameElement, P as AddressStateElement, F as AddressStreetElement, I as AddressZipCodeElement, z as ApplePayElement, D as BaseElement, q as CardElement, J as CardholderElement, Y as EmailElement, X as ErrorElement, fe as OdusElements, Q as PayPalElement, $ as PhoneElement };
|