@odus/checkout 1.8.2 → 1.9.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 +74 -58
- package/dist/components/checkout/form/Form.d.ts +10 -1
- package/dist/components/checkout/form/Form.d.ts.map +1 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts +6 -2
- package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
- package/dist/components/checkout/form/PaymentMethods.d.ts +5 -1
- package/dist/components/checkout/form/PaymentMethods.d.ts.map +1 -1
- package/dist/components/payment-methods/applePay/ApplePayButton.d.ts +9 -1
- package/dist/components/payment-methods/applePay/ApplePayButton.d.ts.map +1 -1
- package/dist/core/api/CheckoutAPI.service.d.ts.map +1 -1
- package/dist/elements/ApplePayElement.d.ts +5 -1
- package/dist/elements/ApplePayElement.d.ts.map +1 -1
- package/dist/elements/OdusElements.d.ts +26 -0
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements/PhoneElement.d.ts.map +1 -1
- package/dist/elements.es.js +240 -198
- package/dist/services/checkout/Checkout.service.d.ts +12 -0
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/services/checkout/CheckoutForm.service.d.ts +1 -1
- package/dist/services/checkout/CheckoutForm.service.d.ts.map +1 -1
- package/dist/shared.js +516 -511
- package/dist/types/telemetry/TelemetryEvents.type.d.ts +5 -0
- package/dist/types/telemetry/TelemetryEvents.type.d.ts.map +1 -1
- package/dist/utils/helpers/readApiMessage.util.d.ts +7 -0
- package/dist/utils/helpers/readApiMessage.util.d.ts.map +1 -0
- package/package.json +8 -4
package/dist/elements.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { B as e, C as t, D as n, E as r, G as i, H as a,
|
|
1
|
+
import { B as e, C as t, D as n, E as r, G as i, H as a, K as o, L as s, Q as c, R as l, S as u, T as ee, U as te, V as d, W as f, X as p, Y as m, Z as h, a as g, d as _, g as v, h as y, i as ne, l as b, n as re, o as ie, q as x, r as ae, s as S, t as C, u as w } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var
|
|
3
|
+
var T = ".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}", E = ".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}", D = ".input-label{font-family:var(--odus-font-family,inherit);font-size:var(--odus-label-font-size,14px);font-weight:var(--odus-label-font-weight,400);color:var(--odus-label-color,var(--odus-color-text,#1a1a1a));letter-spacing:var(--odus-label-letter-spacing,normal);line-height:var(--odus-label-line-height,1.4);margin-bottom:var(--odus-label-margin-bottom,6px)}", O = ":host{--odus-font-family:system-ui, sans-serif;--odus-font-size:16px;--odus-color-error:#dc2727;--odus-color-text:#1a1a1a;--odus-color-background:#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}", k = class {
|
|
4
4
|
shadowRoot = null;
|
|
5
5
|
host = null;
|
|
6
6
|
options = {};
|
|
@@ -64,9 +64,9 @@ var w = ".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 O;
|
|
68
68
|
}
|
|
69
|
-
},
|
|
69
|
+
}, A = class extends k {
|
|
70
70
|
_value = "";
|
|
71
71
|
_error = null;
|
|
72
72
|
_input = null;
|
|
@@ -91,9 +91,9 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
91
91
|
}
|
|
92
92
|
getCss() {
|
|
93
93
|
return super.getCss() + [
|
|
94
|
-
T,
|
|
95
94
|
E,
|
|
96
|
-
|
|
95
|
+
D,
|
|
96
|
+
T
|
|
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-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
105
105
|
getError() {
|
|
106
106
|
return this._error;
|
|
107
107
|
}
|
|
108
|
-
},
|
|
108
|
+
}, j = ".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}", M = class extends k {
|
|
109
109
|
_value = "";
|
|
110
110
|
_error = null;
|
|
111
111
|
_select = null;
|
|
@@ -117,13 +117,13 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
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
119
|
let { t: e, locale: t } = r();
|
|
120
|
-
this._select = new
|
|
120
|
+
this._select = new w({
|
|
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: v(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);
|
|
@@ -135,9 +135,9 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
135
135
|
}
|
|
136
136
|
getCss() {
|
|
137
137
|
return super.getCss() + [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
138
|
+
D,
|
|
139
|
+
T,
|
|
140
|
+
j
|
|
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,7 +149,7 @@ var w = ".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
|
+
}, N = class extends k {
|
|
153
153
|
_value = "";
|
|
154
154
|
_error = null;
|
|
155
155
|
_input = null;
|
|
@@ -174,9 +174,9 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
174
174
|
}
|
|
175
175
|
getCss() {
|
|
176
176
|
return super.getCss() + [
|
|
177
|
-
T,
|
|
178
177
|
E,
|
|
179
|
-
|
|
178
|
+
D,
|
|
179
|
+
T
|
|
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,7 +188,7 @@ var w = ".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
|
+
}, P = class extends k {
|
|
192
192
|
_value = "";
|
|
193
193
|
_error = null;
|
|
194
194
|
_input = null;
|
|
@@ -213,9 +213,9 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
213
213
|
}
|
|
214
214
|
getCss() {
|
|
215
215
|
return super.getCss() + [
|
|
216
|
-
T,
|
|
217
216
|
E,
|
|
218
|
-
|
|
217
|
+
D,
|
|
218
|
+
T
|
|
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,7 +227,7 @@ var w = ".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
|
+
}, F = /* @__PURE__ */ new Set(["US", "CA"]), I = class extends k {
|
|
231
231
|
_value = "";
|
|
232
232
|
_country = "";
|
|
233
233
|
_input = null;
|
|
@@ -235,17 +235,17 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
235
235
|
setCountry(e) {
|
|
236
236
|
let t = this._country;
|
|
237
237
|
if (this._country = e, !this.shadowRoot) return;
|
|
238
|
-
let n =
|
|
238
|
+
let n = F.has(t), i = F.has(e);
|
|
239
239
|
if (n && i && t !== e) {
|
|
240
240
|
let { t } = r(), n = e, i = t(n === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
241
|
-
this._select?.setOptions(
|
|
241
|
+
this._select?.setOptions(y(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, F.has(this._country)) {
|
|
249
249
|
let e = this._country;
|
|
250
250
|
this._renderSelect(e);
|
|
251
251
|
} else this._renderInput();
|
|
@@ -269,8 +269,8 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
269
269
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
270
270
|
}
|
|
271
271
|
_renderSelect(e) {
|
|
272
|
-
let { t } = r(), n =
|
|
273
|
-
this._select = new
|
|
272
|
+
let { t } = r(), n = y(e), i = t(e === "US" ? "address.chooseState" : "address.chooseProvince");
|
|
273
|
+
this._select = new w({
|
|
274
274
|
name: "billingAddress.state",
|
|
275
275
|
label: this.options.label ?? t("address.state"),
|
|
276
276
|
error: !1,
|
|
@@ -288,10 +288,10 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
288
288
|
}
|
|
289
289
|
getCss() {
|
|
290
290
|
return super.getCss() + [
|
|
291
|
-
T,
|
|
292
291
|
E,
|
|
293
|
-
|
|
294
|
-
|
|
292
|
+
D,
|
|
293
|
+
T,
|
|
294
|
+
j
|
|
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() {
|
|
@@ -305,7 +305,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
305
305
|
let { t: e } = r();
|
|
306
306
|
return e("validation.stateRequired");
|
|
307
307
|
}
|
|
308
|
-
},
|
|
308
|
+
}, L = class extends k {
|
|
309
309
|
_value = "";
|
|
310
310
|
_error = null;
|
|
311
311
|
_input = null;
|
|
@@ -335,9 +335,9 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
335
335
|
}
|
|
336
336
|
getCss() {
|
|
337
337
|
return super.getCss() + [
|
|
338
|
-
T,
|
|
339
338
|
E,
|
|
340
|
-
|
|
339
|
+
D,
|
|
340
|
+
T
|
|
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,7 +349,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
349
349
|
getError() {
|
|
350
350
|
return this._error;
|
|
351
351
|
}
|
|
352
|
-
},
|
|
352
|
+
}, R = class extends k {
|
|
353
353
|
_value = "";
|
|
354
354
|
_error = null;
|
|
355
355
|
_input = null;
|
|
@@ -374,9 +374,9 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
374
374
|
}
|
|
375
375
|
getCss() {
|
|
376
376
|
return super.getCss() + [
|
|
377
|
-
T,
|
|
378
377
|
E,
|
|
379
|
-
|
|
378
|
+
D,
|
|
379
|
+
T
|
|
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-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
388
388
|
getError() {
|
|
389
389
|
return this._error;
|
|
390
390
|
}
|
|
391
|
-
},
|
|
391
|
+
}, z = "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)}", B = {
|
|
392
392
|
name: "odus-elements",
|
|
393
393
|
styles: {
|
|
394
394
|
fontSize: 14,
|
|
@@ -412,7 +412,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
412
412
|
}
|
|
413
413
|
},
|
|
414
414
|
additionalPaymentMethods: {}
|
|
415
|
-
},
|
|
415
|
+
}, V = class extends k {
|
|
416
416
|
_paymentContext = null;
|
|
417
417
|
_applePayData = null;
|
|
418
418
|
_authorized = !1;
|
|
@@ -431,16 +431,16 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
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 (!
|
|
434
|
+
if (!g(a, r?.countryCode)) {
|
|
435
435
|
this._setAvailability(!1);
|
|
436
436
|
return;
|
|
437
437
|
}
|
|
438
|
-
if (!
|
|
438
|
+
if (!ne()) {
|
|
439
439
|
this._setAvailability(!1);
|
|
440
440
|
return;
|
|
441
441
|
}
|
|
442
442
|
this._button = new ae({
|
|
443
|
-
checkoutProfile:
|
|
443
|
+
checkoutProfile: B,
|
|
444
444
|
paymentId: e,
|
|
445
445
|
checkoutKey: t,
|
|
446
446
|
environment: n,
|
|
@@ -449,7 +449,10 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
449
449
|
requiredBillingContactFields: o,
|
|
450
450
|
requiredShippingContactFields: s,
|
|
451
451
|
onSubmit: async ({ applePayData: e }) => {
|
|
452
|
-
|
|
452
|
+
if (!e) return !1;
|
|
453
|
+
this._applePayData = e, this._authorized = !0, this.emit("change", e);
|
|
454
|
+
let t = await c(e);
|
|
455
|
+
return t || (this._authorized = !1, this.emit("change", e)), t;
|
|
453
456
|
}
|
|
454
457
|
}), this.shadowRoot.appendChild(this._button.getElement()), this._setAvailability(!0);
|
|
455
458
|
}
|
|
@@ -457,7 +460,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
457
460
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
458
461
|
}
|
|
459
462
|
getCss() {
|
|
460
|
-
return super.getCss() +
|
|
463
|
+
return super.getCss() + z + "\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
464
|
}
|
|
462
465
|
getValue() {
|
|
463
466
|
return this._applePayData;
|
|
@@ -468,7 +471,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
468
471
|
getError() {
|
|
469
472
|
return null;
|
|
470
473
|
}
|
|
471
|
-
},
|
|
474
|
+
}, H = ".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}", U = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvWpIQFjQQCPpaIlJKpegirp5kLkzLB1AxHmnLk73D3TJbAGqr1QmlsWDBtMPMRpdzzUM7ZwX3kzhIuATV4Pe7RKp3nZlVmcrT0YCQXBrTwqZNh775z58GP2kZs+gVfNqBampJPzSB/hB62KkByhECn6grrRjiAVwJyZVEvs/2vrxaEpO+aE16emtX12RgI5JdzdOiNyZEQteU6zRBRJEocPWVxExaOpVVVJ5+UnW0LcalzA+lRGRTrQJ5JguAPiAOzRPTK/lYFFpCAl/F8wtoAVG1c8zO2NcQ0Pko+fmeidRFxJ/did2btV+9Mkze3mBphwFmvnxa35LF+Cs/XJHDwIDAQAB", W = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8gGPMwBRPuVyJReZGIkWH/+Bf5pnpDN1bSR2cLYLXVT8CaSnTw74qeboSnktgYCi1D9R3Bj2fYzTIwGGZb8KinLdxwbqZmHwrE9cFhCaHbG/E0PbqQGhXP2vbniZTT4M0i0Cbi7ES3Bw5zqNbIZZnX041QEpxLvIyWPKZCX+fBogNMhWfCF779aclChjHkwZMsufThVWE9xklWGxXiytx5aL4I5JPxq0I7cAkZGGs4aF/GxWwPaq7R3wPikJQ0YHnCMfcURzl2Hnw/inqyMy+JB6djTq2/BdzMAhWTh3cDWq9Xu+gEkb/QCd0n1yYIdKuDISlk/AfHdWe34IvzhVyQIDAQAB", G = {
|
|
472
475
|
name: "odus-elements",
|
|
473
476
|
styles: {
|
|
474
477
|
fontSize: 14,
|
|
@@ -492,7 +495,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
492
495
|
}
|
|
493
496
|
},
|
|
494
497
|
additionalPaymentMethods: {}
|
|
495
|
-
},
|
|
498
|
+
}, K = class {
|
|
496
499
|
_cardNumber = "";
|
|
497
500
|
_cardExpiry = "";
|
|
498
501
|
_cardCvv = "";
|
|
@@ -506,8 +509,8 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
506
509
|
renderSection(e, t, n) {
|
|
507
510
|
this._section?.getElement().remove();
|
|
508
511
|
let { t: i } = r();
|
|
509
|
-
this._section = new
|
|
510
|
-
checkoutProfile:
|
|
512
|
+
this._section = new S({
|
|
513
|
+
checkoutProfile: G,
|
|
511
514
|
cardNumber: this._cardNumber,
|
|
512
515
|
cardNumberTouched: !1,
|
|
513
516
|
cardCvv: this._cardCvv,
|
|
@@ -525,7 +528,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
525
528
|
this._touchedFields.add(n.name), this._updateFocusManagerState(), t(this.getValue());
|
|
526
529
|
},
|
|
527
530
|
onBlur: (e) => {
|
|
528
|
-
let t = e.target, r = t.name ?? "cardExpiry", i =
|
|
531
|
+
let t = e.target, r = t.name ?? "cardExpiry", i = s();
|
|
529
532
|
if (this._touchedFields.add(r), t.name === "cardNumber") {
|
|
530
533
|
let e = i.cardNumber(this._cardNumber);
|
|
531
534
|
this._section?.updateCardNumber(this._cardNumber, e, !0);
|
|
@@ -548,7 +551,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
548
551
|
};
|
|
549
552
|
}
|
|
550
553
|
async getPayload(e) {
|
|
551
|
-
let t = e === "live" ?
|
|
554
|
+
let t = e === "live" ? W : U, n = new f();
|
|
552
555
|
n.setPublicKey(t);
|
|
553
556
|
let r = this._cardNumber.replace(/\s+/g, ""), i = this._cardExpiry.replace(/\s+/g, "").split("/"), a = i[0] ?? "", o = i[1] ?? "";
|
|
554
557
|
return o.length === 2 && (o = `20${o}`), {
|
|
@@ -559,11 +562,11 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
559
562
|
};
|
|
560
563
|
}
|
|
561
564
|
isValid() {
|
|
562
|
-
let e =
|
|
565
|
+
let e = s(), t = this._cardCvv.length >= 3;
|
|
563
566
|
return !e.cardNumber(this._cardNumber) && !e.cardExpiry(this._cardExpiry) && t;
|
|
564
567
|
}
|
|
565
568
|
getError() {
|
|
566
|
-
let e =
|
|
569
|
+
let e = s();
|
|
567
570
|
return e.cardNumber(this._cardNumber) ?? e.cardExpiry(this._cardExpiry) ?? null;
|
|
568
571
|
}
|
|
569
572
|
destroy() {
|
|
@@ -589,7 +592,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
589
592
|
this._focusHandlers = [];
|
|
590
593
|
}
|
|
591
594
|
_updateFocusManagerState() {
|
|
592
|
-
let e =
|
|
595
|
+
let e = s(), t = {
|
|
593
596
|
cardNumber: this._cardNumber,
|
|
594
597
|
cardExpiry: this._cardExpiry,
|
|
595
598
|
cardCvv: this._cardCvv,
|
|
@@ -601,7 +604,7 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
601
604
|
for (let e of this._touchedFields) o[e] = !0;
|
|
602
605
|
this._focusManager.handleStateUpdate(t, n, o);
|
|
603
606
|
}
|
|
604
|
-
},
|
|
607
|
+
}, q = {
|
|
605
608
|
"--odus-font-family": "system-ui, sans-serif",
|
|
606
609
|
"--odus-font-size": "16px",
|
|
607
610
|
"--odus-color-error": "#dc2727",
|
|
@@ -625,11 +628,11 @@ var w = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
625
628
|
"--odus-button-height": "48px",
|
|
626
629
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
627
630
|
}["--odus-font-size"];
|
|
628
|
-
function
|
|
631
|
+
function oe(e, t) {
|
|
629
632
|
let n = Object.keys(e);
|
|
630
633
|
return n.length === Object.keys(t).length && n.every((n) => e[n] === t[n]);
|
|
631
634
|
}
|
|
632
|
-
var
|
|
635
|
+
var se = class {
|
|
633
636
|
_vgsService;
|
|
634
637
|
_vgsJwt;
|
|
635
638
|
_vgsState = {};
|
|
@@ -648,8 +651,8 @@ var oe = class {
|
|
|
648
651
|
renderSection(e, t) {
|
|
649
652
|
this._section?.getElement().remove();
|
|
650
653
|
let { t: n } = r();
|
|
651
|
-
this._section = new
|
|
652
|
-
checkoutProfile:
|
|
654
|
+
this._section = new S({
|
|
655
|
+
checkoutProfile: G,
|
|
653
656
|
cardNumber: "",
|
|
654
657
|
cardNumberTouched: !1,
|
|
655
658
|
cardCvv: "",
|
|
@@ -693,7 +696,7 @@ var oe = class {
|
|
|
693
696
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
694
697
|
let r = n.errors?.[0];
|
|
695
698
|
if (!r) continue;
|
|
696
|
-
let i =
|
|
699
|
+
let i = b(t, r.code);
|
|
697
700
|
if (i) return e(i);
|
|
698
701
|
}
|
|
699
702
|
return null;
|
|
@@ -703,7 +706,7 @@ var oe = class {
|
|
|
703
706
|
...this._currentTheme,
|
|
704
707
|
...e
|
|
705
708
|
};
|
|
706
|
-
|
|
709
|
+
oe(this._currentTheme, t) || (this._currentTheme = t, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme()));
|
|
707
710
|
}
|
|
708
711
|
resetTheme(e) {
|
|
709
712
|
let t = e.filter((e) => e in this._currentTheme);
|
|
@@ -721,15 +724,15 @@ var oe = class {
|
|
|
721
724
|
}, 300);
|
|
722
725
|
}
|
|
723
726
|
_buildProfileFromTheme(e) {
|
|
724
|
-
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ??
|
|
727
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? q, 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`;
|
|
725
728
|
return {
|
|
726
|
-
...
|
|
729
|
+
...G,
|
|
727
730
|
styles: {
|
|
728
|
-
...
|
|
729
|
-
fontSize: parseInt(t, 10) || parseInt(
|
|
731
|
+
...G.styles,
|
|
732
|
+
fontSize: parseInt(t, 10) || parseInt(q, 10),
|
|
730
733
|
fontFamily: n,
|
|
731
734
|
textColor: r,
|
|
732
|
-
borderRadius: parseInt(i, 10) ||
|
|
735
|
+
borderRadius: parseInt(i, 10) || G.styles.borderRadius
|
|
733
736
|
}
|
|
734
737
|
};
|
|
735
738
|
}
|
|
@@ -778,16 +781,16 @@ var oe = class {
|
|
|
778
781
|
if (!r?.isTouched || r.isFocused || r.isValid) continue;
|
|
779
782
|
let i = r.errors?.[0];
|
|
780
783
|
if (!i) continue;
|
|
781
|
-
let a =
|
|
784
|
+
let a = b(n, i.code);
|
|
782
785
|
a && (t[n] = e(a));
|
|
783
786
|
}
|
|
784
787
|
return t;
|
|
785
788
|
}
|
|
786
|
-
}, J = class extends
|
|
789
|
+
}, J = class extends k {
|
|
787
790
|
_environment = "test";
|
|
788
791
|
_isVgsMode = !1;
|
|
789
792
|
_mountContainer = null;
|
|
790
|
-
_nativeAdapter = new
|
|
793
|
+
_nativeAdapter = new K();
|
|
791
794
|
_vgsAdapter = null;
|
|
792
795
|
_vgsJwt = null;
|
|
793
796
|
get isVgsMode() {
|
|
@@ -797,7 +800,7 @@ var oe = class {
|
|
|
797
800
|
this._environment = e;
|
|
798
801
|
}
|
|
799
802
|
setVgsJwt(e) {
|
|
800
|
-
this._vgsAdapter && this._vgsJwt === e || (this._isVgsMode = !0, this._vgsJwt = e, this._vgsAdapter?.destroy(), this._vgsAdapter = new
|
|
803
|
+
this._vgsAdapter && this._vgsJwt === e || (this._isVgsMode = !0, this._vgsJwt = e, this._vgsAdapter?.destroy(), this._vgsAdapter = new se(e, this._environment), this.isMounted && this._mountContainer && (this.unmount(), this.mount(this._mountContainer)));
|
|
801
804
|
}
|
|
802
805
|
mount(e) {
|
|
803
806
|
this.isMounted && this.unmount();
|
|
@@ -838,10 +841,10 @@ var oe = class {
|
|
|
838
841
|
}
|
|
839
842
|
getCss() {
|
|
840
843
|
return super.getCss() + [
|
|
841
|
-
T,
|
|
842
844
|
E,
|
|
843
|
-
|
|
844
|
-
|
|
845
|
+
D,
|
|
846
|
+
T,
|
|
847
|
+
H
|
|
845
848
|
].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 ";
|
|
846
849
|
}
|
|
847
850
|
getValue() {
|
|
@@ -864,7 +867,7 @@ var oe = class {
|
|
|
864
867
|
getError() {
|
|
865
868
|
return this._isVgsMode ? this._vgsAdapter?.getError() ?? null : this._nativeAdapter.getError();
|
|
866
869
|
}
|
|
867
|
-
}, Y = class extends
|
|
870
|
+
}, Y = class extends k {
|
|
868
871
|
_value = "";
|
|
869
872
|
_error = null;
|
|
870
873
|
_input = null;
|
|
@@ -890,9 +893,9 @@ var oe = class {
|
|
|
890
893
|
}
|
|
891
894
|
getCss() {
|
|
892
895
|
return super.getCss() + [
|
|
893
|
-
T,
|
|
894
896
|
E,
|
|
895
|
-
|
|
897
|
+
D,
|
|
898
|
+
T
|
|
896
899
|
].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 ";
|
|
897
900
|
}
|
|
898
901
|
getValue() {
|
|
@@ -904,7 +907,7 @@ var oe = class {
|
|
|
904
907
|
getError() {
|
|
905
908
|
return this._error;
|
|
906
909
|
}
|
|
907
|
-
},
|
|
910
|
+
}, ce = {
|
|
908
911
|
name: "odus-elements",
|
|
909
912
|
styles: {
|
|
910
913
|
fontSize: 14,
|
|
@@ -928,7 +931,7 @@ var oe = class {
|
|
|
928
931
|
}
|
|
929
932
|
},
|
|
930
933
|
additionalPaymentMethods: {}
|
|
931
|
-
}, X = class extends
|
|
934
|
+
}, X = class extends k {
|
|
932
935
|
_email = "";
|
|
933
936
|
_error = null;
|
|
934
937
|
_suggestion = null;
|
|
@@ -937,10 +940,10 @@ var oe = class {
|
|
|
937
940
|
if (!this.shadowRoot) return;
|
|
938
941
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
939
942
|
let { t: e } = r();
|
|
940
|
-
this._field = new
|
|
943
|
+
this._field = new ie({
|
|
941
944
|
value: this._email,
|
|
942
945
|
error: !1,
|
|
943
|
-
checkoutProfile:
|
|
946
|
+
checkoutProfile: ce,
|
|
944
947
|
translationFunc: e,
|
|
945
948
|
label: this.options.label,
|
|
946
949
|
placeholder: this.options.placeholder,
|
|
@@ -949,23 +952,23 @@ var oe = class {
|
|
|
949
952
|
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);
|
|
950
953
|
},
|
|
951
954
|
onBlur: () => {
|
|
952
|
-
let e =
|
|
955
|
+
let e = s();
|
|
953
956
|
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);
|
|
954
957
|
}
|
|
955
958
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
956
959
|
}
|
|
957
960
|
getCss() {
|
|
958
961
|
return super.getCss() + [
|
|
959
|
-
T,
|
|
960
962
|
E,
|
|
961
|
-
|
|
963
|
+
D,
|
|
964
|
+
T
|
|
962
965
|
].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 ";
|
|
963
966
|
}
|
|
964
967
|
getValue() {
|
|
965
968
|
return this._email;
|
|
966
969
|
}
|
|
967
970
|
getIsValid() {
|
|
968
|
-
return !
|
|
971
|
+
return !s().email(this._email);
|
|
969
972
|
}
|
|
970
973
|
getError() {
|
|
971
974
|
return this._error;
|
|
@@ -973,24 +976,24 @@ var oe = class {
|
|
|
973
976
|
get suggestion() {
|
|
974
977
|
return this._suggestion;
|
|
975
978
|
}
|
|
976
|
-
},
|
|
979
|
+
}, le = "@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 k {
|
|
977
980
|
_alert = null;
|
|
978
981
|
_message = null;
|
|
979
982
|
render() {
|
|
980
|
-
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new
|
|
983
|
+
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new C({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
981
984
|
}
|
|
982
985
|
setError(e) {
|
|
983
986
|
if (this._message = e, !this.shadowRoot) {
|
|
984
987
|
this.emit("error", e);
|
|
985
988
|
return;
|
|
986
989
|
}
|
|
987
|
-
this._alert ? this._alert.setMessage(e) : (this._alert = new
|
|
990
|
+
this._alert ? this._alert.setMessage(e) : (this._alert = new C({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
|
|
988
991
|
}
|
|
989
992
|
clearError() {
|
|
990
993
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
991
994
|
}
|
|
992
995
|
getCss() {
|
|
993
|
-
return super.getCss() +
|
|
996
|
+
return super.getCss() + le + "\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 ";
|
|
994
997
|
}
|
|
995
998
|
getValue() {
|
|
996
999
|
return null;
|
|
@@ -1001,7 +1004,7 @@ var oe = class {
|
|
|
1001
1004
|
getError() {
|
|
1002
1005
|
return this._message;
|
|
1003
1006
|
}
|
|
1004
|
-
},
|
|
1007
|
+
}, ue = ".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}", de = {
|
|
1005
1008
|
name: "odus-elements",
|
|
1006
1009
|
styles: {
|
|
1007
1010
|
fontSize: 14,
|
|
@@ -1025,7 +1028,7 @@ var oe = class {
|
|
|
1025
1028
|
}
|
|
1026
1029
|
},
|
|
1027
1030
|
additionalPaymentMethods: {}
|
|
1028
|
-
}, Q = class extends
|
|
1031
|
+
}, Q = class extends k {
|
|
1029
1032
|
_paymentContext = null;
|
|
1030
1033
|
_button = null;
|
|
1031
1034
|
setPaymentContext(e) {
|
|
@@ -1034,8 +1037,8 @@ var oe = class {
|
|
|
1034
1037
|
render() {
|
|
1035
1038
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
1036
1039
|
let { onAuthorize: e } = this._paymentContext;
|
|
1037
|
-
this._button = new
|
|
1038
|
-
checkoutProfile:
|
|
1040
|
+
this._button = new re({
|
|
1041
|
+
checkoutProfile: de,
|
|
1039
1042
|
onSubmit: async () => {
|
|
1040
1043
|
this._button?.setSubmitting(!0);
|
|
1041
1044
|
try {
|
|
@@ -1047,7 +1050,7 @@ var oe = class {
|
|
|
1047
1050
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
1048
1051
|
}
|
|
1049
1052
|
getCss() {
|
|
1050
|
-
return super.getCss() +
|
|
1053
|
+
return super.getCss() + ue + "\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 ";
|
|
1051
1054
|
}
|
|
1052
1055
|
getValue() {
|
|
1053
1056
|
return null;
|
|
@@ -1058,7 +1061,7 @@ var oe = class {
|
|
|
1058
1061
|
getError() {
|
|
1059
1062
|
return null;
|
|
1060
1063
|
}
|
|
1061
|
-
},
|
|
1064
|
+
}, fe = ".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}", pe = {
|
|
1062
1065
|
name: "odus-elements",
|
|
1063
1066
|
styles: {
|
|
1064
1067
|
fontSize: 14,
|
|
@@ -1082,7 +1085,7 @@ var oe = class {
|
|
|
1082
1085
|
}
|
|
1083
1086
|
},
|
|
1084
1087
|
additionalPaymentMethods: {}
|
|
1085
|
-
}, $ = class extends
|
|
1088
|
+
}, $ = class extends k {
|
|
1086
1089
|
_phone = "";
|
|
1087
1090
|
_error = null;
|
|
1088
1091
|
_field = null;
|
|
@@ -1097,7 +1100,7 @@ var oe = class {
|
|
|
1097
1100
|
this._field = new t({
|
|
1098
1101
|
value: this._phone,
|
|
1099
1102
|
error: !1,
|
|
1100
|
-
checkoutProfile:
|
|
1103
|
+
checkoutProfile: pe,
|
|
1101
1104
|
translationFunc: n,
|
|
1102
1105
|
locale: i,
|
|
1103
1106
|
label: this.options.label,
|
|
@@ -1108,36 +1111,39 @@ var oe = class {
|
|
|
1108
1111
|
},
|
|
1109
1112
|
onBlur: () => {
|
|
1110
1113
|
this._phone = this._field?.getValue() ?? "";
|
|
1111
|
-
let e =
|
|
1114
|
+
let e = s(), t = this._field?.getCountry();
|
|
1112
1115
|
this._error = e.phoneNumber(this._phone, t) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1113
1116
|
}
|
|
1114
1117
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
1118
|
+
}).catch((t) => {
|
|
1119
|
+
!this.shadowRoot || this._renderGeneration !== e || console.error("Error creating phone number field:", t);
|
|
1115
1120
|
});
|
|
1116
1121
|
}
|
|
1117
1122
|
getCss() {
|
|
1118
1123
|
return super.getCss() + [
|
|
1119
|
-
T,
|
|
1120
1124
|
E,
|
|
1121
|
-
|
|
1122
|
-
|
|
1125
|
+
D,
|
|
1126
|
+
T,
|
|
1127
|
+
fe
|
|
1123
1128
|
].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 ";
|
|
1124
1129
|
}
|
|
1125
1130
|
getValue() {
|
|
1126
1131
|
return this._phone;
|
|
1127
1132
|
}
|
|
1128
1133
|
getIsValid() {
|
|
1129
|
-
let e =
|
|
1134
|
+
let e = s(), t = this._field?.getCountry();
|
|
1130
1135
|
return !e.phoneNumber(this._phone, t);
|
|
1131
1136
|
}
|
|
1132
1137
|
getError() {
|
|
1133
1138
|
return this._error;
|
|
1134
1139
|
}
|
|
1135
|
-
},
|
|
1140
|
+
}, me = "Payment failed", he = "We couldn't securely process your card details. Please check your card information and try again.", ge = "No payment details were entered. Please add your card and try again.", _e = "This payment is no longer available. Please reload the page and try again.", ve = class {
|
|
1136
1141
|
_config;
|
|
1137
1142
|
_apiService;
|
|
1138
1143
|
_changeListeners = [];
|
|
1139
1144
|
_callbacks;
|
|
1140
1145
|
_paymentState = {};
|
|
1146
|
+
_associationSequence = 0;
|
|
1141
1147
|
_fontCleanup;
|
|
1142
1148
|
_sessionId;
|
|
1143
1149
|
_mountedReported = !1;
|
|
@@ -1157,11 +1163,11 @@ var oe = class {
|
|
|
1157
1163
|
_error;
|
|
1158
1164
|
elements;
|
|
1159
1165
|
constructor(e) {
|
|
1160
|
-
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(),
|
|
1166
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), i({
|
|
1161
1167
|
environment: e.environment,
|
|
1162
1168
|
sessionId: this._sessionId,
|
|
1163
1169
|
integration: "elements"
|
|
1164
|
-
}),
|
|
1170
|
+
}), x(p.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && n.setLocale(e.locale), this._apiService = new d(e.apiKey, e.environment);
|
|
1165
1171
|
let t = {};
|
|
1166
1172
|
Object.defineProperty(t, "email", {
|
|
1167
1173
|
get: () => (this._email || (this._email = new X(), this._trackElement(this._email)), this._email),
|
|
@@ -1172,7 +1178,7 @@ var oe = class {
|
|
|
1172
1178
|
});
|
|
1173
1179
|
let r = {};
|
|
1174
1180
|
Object.defineProperty(r, "applePay", {
|
|
1175
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1181
|
+
get: () => (this._applePay || (this._applePay = new V(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1176
1182
|
paymentId: this._paymentState.paymentId,
|
|
1177
1183
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1178
1184
|
environment: this._config.environment,
|
|
@@ -1188,78 +1194,83 @@ var oe = class {
|
|
|
1188
1194
|
get: () => (this._paypal || (this._paypal = new Q(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1189
1195
|
paymentId: this._paymentState.paymentId,
|
|
1190
1196
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1191
|
-
onAuthorize: () =>
|
|
1197
|
+
onAuthorize: async () => {
|
|
1198
|
+
await this._executeAuthorization({ formData: null });
|
|
1199
|
+
}
|
|
1192
1200
|
})), this._paypal),
|
|
1193
1201
|
enumerable: !0
|
|
1194
1202
|
});
|
|
1195
|
-
let
|
|
1196
|
-
Object.defineProperty(
|
|
1197
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1203
|
+
let a = {};
|
|
1204
|
+
Object.defineProperty(a, "street", {
|
|
1205
|
+
get: () => (this._addressStreet || (this._addressStreet = new L(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1198
1206
|
enumerable: !0
|
|
1199
|
-
}), Object.defineProperty(
|
|
1200
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1207
|
+
}), Object.defineProperty(a, "firstName", {
|
|
1208
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new N(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1201
1209
|
enumerable: !0
|
|
1202
|
-
}), Object.defineProperty(
|
|
1203
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1210
|
+
}), Object.defineProperty(a, "lastName", {
|
|
1211
|
+
get: () => (this._addressLastName || (this._addressLastName = new P(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1204
1212
|
enumerable: !0
|
|
1205
|
-
}), Object.defineProperty(
|
|
1206
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1213
|
+
}), Object.defineProperty(a, "city", {
|
|
1214
|
+
get: () => (this._addressCity || (this._addressCity = new A(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1207
1215
|
enumerable: !0
|
|
1208
|
-
}), Object.defineProperty(
|
|
1209
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1216
|
+
}), Object.defineProperty(a, "state", {
|
|
1217
|
+
get: () => (this._addressState || (this._addressState = new I(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1210
1218
|
enumerable: !0
|
|
1211
|
-
}), Object.defineProperty(
|
|
1212
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1219
|
+
}), Object.defineProperty(a, "zipCode", {
|
|
1220
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new R(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1213
1221
|
enumerable: !0
|
|
1214
|
-
}), Object.defineProperty(
|
|
1215
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1222
|
+
}), Object.defineProperty(a, "country", {
|
|
1223
|
+
get: () => (this._addressCountry || (this._addressCountry = new M(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1216
1224
|
this._addressState?.setCountry(e);
|
|
1217
1225
|
})), this._addressCountry),
|
|
1218
1226
|
enumerable: !0
|
|
1219
1227
|
});
|
|
1220
|
-
let
|
|
1228
|
+
let o = {
|
|
1221
1229
|
contact: t,
|
|
1222
1230
|
express: r
|
|
1223
1231
|
};
|
|
1224
|
-
Object.defineProperty(
|
|
1232
|
+
Object.defineProperty(o, "card", {
|
|
1225
1233
|
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._card),
|
|
1226
1234
|
enumerable: !0
|
|
1227
|
-
}), Object.defineProperty(
|
|
1235
|
+
}), Object.defineProperty(o, "cardholderName", {
|
|
1228
1236
|
get: () => (this._cardholderName || (this._cardholderName = new Y(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1229
1237
|
enumerable: !0
|
|
1230
|
-
}), Object.defineProperty(
|
|
1231
|
-
get: () =>
|
|
1238
|
+
}), Object.defineProperty(o, "address", {
|
|
1239
|
+
get: () => a,
|
|
1232
1240
|
enumerable: !0
|
|
1233
|
-
}), Object.defineProperty(
|
|
1241
|
+
}), Object.defineProperty(o, "error", {
|
|
1234
1242
|
get: () => (this._error || (this._error = new Z(), this._trackElement(this._error)), this._error),
|
|
1235
1243
|
enumerable: !0
|
|
1236
|
-
}), this.elements =
|
|
1244
|
+
}), this.elements = o;
|
|
1237
1245
|
}
|
|
1238
1246
|
async associatePayment(e, t) {
|
|
1239
1247
|
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1240
|
-
|
|
1241
|
-
let n;
|
|
1248
|
+
let n = ++this._associationSequence, r;
|
|
1242
1249
|
try {
|
|
1243
|
-
|
|
1250
|
+
r = await c({
|
|
1244
1251
|
id: e,
|
|
1245
1252
|
checkoutKey: t,
|
|
1246
1253
|
environment: this._config.environment
|
|
1247
1254
|
});
|
|
1248
1255
|
} catch (t) {
|
|
1249
|
-
throw
|
|
1256
|
+
throw n === this._associationSequence && (this._paymentState = {}), x(p.PAYMENT_ASSOCIATION_FAILED, {
|
|
1250
1257
|
payment_id: e,
|
|
1251
1258
|
error_message: t instanceof Error ? t.message : "Unknown error"
|
|
1252
|
-
}),
|
|
1259
|
+
}), o(t instanceof Error ? t : Error("Failed to associate payment"), { payment_id: e }), t;
|
|
1253
1260
|
}
|
|
1254
|
-
this._paymentState
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1261
|
+
n === this._associationSequence && (this._paymentState = {
|
|
1262
|
+
paymentId: e,
|
|
1263
|
+
checkoutKey: t,
|
|
1264
|
+
checkoutDetails: {
|
|
1265
|
+
amount: r.amount,
|
|
1266
|
+
currency: r.currency,
|
|
1267
|
+
countryCode: r.countryCode
|
|
1268
|
+
}
|
|
1269
|
+
}, x(p.PAYMENT_ASSOCIATED, {
|
|
1259
1270
|
payment_id: e,
|
|
1260
|
-
currency:
|
|
1261
|
-
country_code:
|
|
1262
|
-
}),
|
|
1271
|
+
currency: r.currency,
|
|
1272
|
+
country_code: r.countryCode
|
|
1273
|
+
}), r.vgsJwt && (this._paymentState.vgsJwt = r.vgsJwt, this._card?.setVgsJwt(r.vgsJwt)), this._card?.setEnvironment(this._config.environment), this._applePay?.setPaymentContext({
|
|
1263
1274
|
paymentId: e,
|
|
1264
1275
|
checkoutKey: t,
|
|
1265
1276
|
environment: this._config.environment,
|
|
@@ -1272,8 +1283,10 @@ var oe = class {
|
|
|
1272
1283
|
}), this._paypal?.setPaymentContext({
|
|
1273
1284
|
paymentId: e,
|
|
1274
1285
|
checkoutKey: t,
|
|
1275
|
-
onAuthorize: () =>
|
|
1276
|
-
|
|
1286
|
+
onAuthorize: async () => {
|
|
1287
|
+
await this._executeAuthorization({ formData: null });
|
|
1288
|
+
}
|
|
1289
|
+
}));
|
|
1277
1290
|
}
|
|
1278
1291
|
validate() {
|
|
1279
1292
|
let e = {}, { t } = r();
|
|
@@ -1283,7 +1296,6 @@ var oe = class {
|
|
|
1283
1296
|
};
|
|
1284
1297
|
}
|
|
1285
1298
|
async _getPayload() {
|
|
1286
|
-
if (this._applePay?.isMounted && this._applePay.isValid) return null;
|
|
1287
1299
|
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 ? {
|
|
1288
1300
|
street: this._addressStreet?.isMounted ? this._addressStreet.value : "",
|
|
1289
1301
|
city: this._addressCity?.isMounted ? this._addressCity.value : "",
|
|
@@ -1296,32 +1308,48 @@ var oe = class {
|
|
|
1296
1308
|
if (this._card?.isMounted && this._card.isVgsMode) try {
|
|
1297
1309
|
let r = await this._card.getPayload();
|
|
1298
1310
|
return {
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
|
|
1306
|
-
|
|
1311
|
+
ok: !0,
|
|
1312
|
+
formData: {
|
|
1313
|
+
name: a,
|
|
1314
|
+
email: e,
|
|
1315
|
+
phoneNumber: t || void 0,
|
|
1316
|
+
cardNumber: "",
|
|
1317
|
+
cardExpiry: "",
|
|
1318
|
+
cardCvv: "",
|
|
1319
|
+
billingAddress: n,
|
|
1320
|
+
vgsCardData: r
|
|
1321
|
+
}
|
|
1307
1322
|
};
|
|
1308
1323
|
} catch {
|
|
1309
|
-
return
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1324
|
+
return {
|
|
1325
|
+
ok: !1,
|
|
1326
|
+
error: {
|
|
1327
|
+
message: he,
|
|
1328
|
+
status: 0,
|
|
1329
|
+
statusText: "Card Tokenization Failed"
|
|
1330
|
+
}
|
|
1331
|
+
};
|
|
1314
1332
|
}
|
|
1315
1333
|
let o = this._card?.isMounted ? this._card.value : null;
|
|
1316
1334
|
return o ? {
|
|
1317
|
-
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
|
|
1335
|
+
ok: !0,
|
|
1336
|
+
formData: {
|
|
1337
|
+
name: a,
|
|
1338
|
+
email: e,
|
|
1339
|
+
phoneNumber: t || void 0,
|
|
1340
|
+
cardNumber: o.number,
|
|
1341
|
+
cardExpiry: o.expiry,
|
|
1342
|
+
cardCvv: o.cvv,
|
|
1343
|
+
billingAddress: n
|
|
1344
|
+
}
|
|
1345
|
+
} : {
|
|
1346
|
+
ok: !1,
|
|
1347
|
+
error: {
|
|
1348
|
+
message: ge,
|
|
1349
|
+
status: 0,
|
|
1350
|
+
statusText: "No Payment Method"
|
|
1351
|
+
}
|
|
1352
|
+
};
|
|
1325
1353
|
}
|
|
1326
1354
|
async authorize(e) {
|
|
1327
1355
|
if (!this._paymentState.paymentId || !this._paymentState.checkoutKey) throw Error("Call associatePayment() before authorize()");
|
|
@@ -1333,8 +1361,12 @@ var oe = class {
|
|
|
1333
1361
|
return;
|
|
1334
1362
|
}
|
|
1335
1363
|
let t = await this._getPayload();
|
|
1364
|
+
if (!t.ok) {
|
|
1365
|
+
this._reportSubmitFailure(t.error, "card");
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1336
1368
|
await this._executeAuthorization({
|
|
1337
|
-
formData: t,
|
|
1369
|
+
formData: t.formData,
|
|
1338
1370
|
applePayData: void 0,
|
|
1339
1371
|
customCustomerData: e?.customerData
|
|
1340
1372
|
});
|
|
@@ -1366,7 +1398,7 @@ var oe = class {
|
|
|
1366
1398
|
}
|
|
1367
1399
|
_trackElement(e) {
|
|
1368
1400
|
e.on("ready", () => {
|
|
1369
|
-
this._mountedReported || (this._mountedReported = !0,
|
|
1401
|
+
this._mountedReported || (this._mountedReported = !0, x(p.CHECKOUT_MOUNTED, { container_id: "elements" }));
|
|
1370
1402
|
}), e.on("change", () => {
|
|
1371
1403
|
for (let e of this._changeListeners) e();
|
|
1372
1404
|
});
|
|
@@ -1390,40 +1422,44 @@ var oe = class {
|
|
|
1390
1422
|
].filter((e) => e !== void 0);
|
|
1391
1423
|
}
|
|
1392
1424
|
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1393
|
-
this.
|
|
1394
|
-
|
|
1395
|
-
|
|
1425
|
+
let { paymentId: r, checkoutKey: i } = this._paymentState, a = this._getPaymentMethod(e, t);
|
|
1426
|
+
if (!r || !i) return this._reportSubmitFailure({
|
|
1427
|
+
message: _e,
|
|
1428
|
+
status: 0,
|
|
1429
|
+
statusText: "No Associated Payment"
|
|
1430
|
+
}, a), !1;
|
|
1431
|
+
this._emitLoadingState(!0), x(p.PAYMENT_SUBMIT_STARTED, {
|
|
1396
1432
|
payment_id: r,
|
|
1397
|
-
payment_method:
|
|
1433
|
+
payment_method: a
|
|
1398
1434
|
});
|
|
1399
|
-
let
|
|
1435
|
+
let o = performance.now();
|
|
1400
1436
|
try {
|
|
1401
|
-
let
|
|
1437
|
+
let s = await this._apiService.authorizePayment({
|
|
1402
1438
|
paymentId: r,
|
|
1403
|
-
checkoutKey:
|
|
1439
|
+
checkoutKey: i,
|
|
1404
1440
|
formData: e,
|
|
1405
1441
|
returnUrl: this._config.returnUrl,
|
|
1406
1442
|
applePayData: t,
|
|
1407
1443
|
customCustomerData: n
|
|
1408
1444
|
});
|
|
1409
|
-
|
|
1445
|
+
return m(h.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1410
1446
|
payment_id: r,
|
|
1411
|
-
payment_method:
|
|
1447
|
+
payment_method: a,
|
|
1412
1448
|
status: "success"
|
|
1413
|
-
}),
|
|
1449
|
+
}), x(p.PAYMENT_SUBMIT_SUCCESS, {
|
|
1414
1450
|
payment_id: r,
|
|
1415
|
-
payment_method:
|
|
1416
|
-
}), this._handlePaymentResponse(
|
|
1451
|
+
payment_method: a
|
|
1452
|
+
}), this._handlePaymentResponse(s);
|
|
1417
1453
|
} catch (e) {
|
|
1418
|
-
|
|
1454
|
+
return m(h.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1419
1455
|
payment_id: r,
|
|
1420
|
-
payment_method:
|
|
1456
|
+
payment_method: a,
|
|
1421
1457
|
status: "failed"
|
|
1422
|
-
}),
|
|
1458
|
+
}), x(p.PAYMENT_SUBMIT_FAILED, {
|
|
1423
1459
|
payment_id: r,
|
|
1424
|
-
payment_method:
|
|
1425
|
-
error_message: e
|
|
1426
|
-
}), this._handleAuthorizationError(e);
|
|
1460
|
+
payment_method: a,
|
|
1461
|
+
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1462
|
+
}), this._handleAuthorizationError(e), !1;
|
|
1427
1463
|
} finally {
|
|
1428
1464
|
this._emitLoadingState(!1);
|
|
1429
1465
|
}
|
|
@@ -1438,29 +1474,35 @@ var oe = class {
|
|
|
1438
1474
|
}
|
|
1439
1475
|
_handlePaymentResponse(e) {
|
|
1440
1476
|
let t = this._paymentState.paymentId ?? "";
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
}
|
|
1448
|
-
if (e.latestTransaction.status === "failed") {
|
|
1449
|
-
s(h.PAYMENT_FAILED, {
|
|
1450
|
-
payment_id: t,
|
|
1451
|
-
status: e.latestTransaction.status
|
|
1452
|
-
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status);
|
|
1453
|
-
return;
|
|
1454
|
-
}
|
|
1455
|
-
e.status === "requires_action" && (s(h.PAYMENT_ACTION_REQUIRED, {
|
|
1477
|
+
return e.latestTransaction.status === "authorized" ? (x(p.PAYMENT_AUTHORIZED, {
|
|
1478
|
+
payment_id: t,
|
|
1479
|
+
status: e.latestTransaction.status
|
|
1480
|
+
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (x(p.PAYMENT_FAILED, {
|
|
1481
|
+
payment_id: t,
|
|
1482
|
+
status: e.latestTransaction.status
|
|
1483
|
+
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (x(p.PAYMENT_ACTION_REQUIRED, {
|
|
1456
1484
|
payment_id: t,
|
|
1457
1485
|
status: e.status
|
|
1458
|
-
}), this._callbacks.onActionRequired?.(e.action.redirectUrl));
|
|
1486
|
+
}), this._callbacks.onActionRequired?.(e.action.redirectUrl), !0);
|
|
1487
|
+
}
|
|
1488
|
+
_reportSubmitFailure(e, t) {
|
|
1489
|
+
let n = {
|
|
1490
|
+
payment_id: this._paymentState.paymentId ?? "",
|
|
1491
|
+
payment_method: t
|
|
1492
|
+
};
|
|
1493
|
+
x(p.PAYMENT_SUBMIT_STARTED, n), x(p.PAYMENT_SUBMIT_FAILED, {
|
|
1494
|
+
...n,
|
|
1495
|
+
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1496
|
+
}), this._handleAuthorizationError(e);
|
|
1459
1497
|
}
|
|
1460
1498
|
_handleAuthorizationError(e) {
|
|
1461
|
-
let t = e
|
|
1499
|
+
let t = this._readErrorMessage(e, me);
|
|
1462
1500
|
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1463
1501
|
}
|
|
1502
|
+
_readErrorMessage(e, t) {
|
|
1503
|
+
let n = e;
|
|
1504
|
+
return typeof n?.message == "string" && n.message ? n.message : te(n?.details) ?? t;
|
|
1505
|
+
}
|
|
1464
1506
|
};
|
|
1465
1507
|
//#endregion
|
|
1466
|
-
export {
|
|
1508
|
+
export { A as AddressCityElement, M as AddressCountryElement, N as AddressFirstNameElement, P as AddressLastNameElement, I as AddressStateElement, L as AddressStreetElement, R as AddressZipCodeElement, V as ApplePayElement, k as BaseElement, J as CardElement, Y as CardholderElement, X as EmailElement, Z as ErrorElement, ve as OdusElements, Q as PayPalElement, $ as PhoneElement };
|