@odus/checkout 1.11.0 → 1.11.2
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 +122 -121
- package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
- package/dist/core/vgs/VGSCollectService.d.ts +20 -0
- package/dist/core/vgs/VGSCollectService.d.ts.map +1 -1
- package/dist/core/vgs/index.d.ts +1 -1
- package/dist/core/vgs/index.d.ts.map +1 -1
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
- package/dist/elements.es.js +173 -171
- package/dist/phone.js +4 -4
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/shared.js +3984 -3970
- package/dist/utils/dom/appendGoogleFont.d.ts.map +1 -1
- package/dist/utils/dom/fetchGoogleFontFace.d.ts.map +1 -1
- package/dist/utils/dom/googleFontUrl.d.ts +26 -0
- package/dist/utils/dom/googleFontUrl.d.ts.map +1 -0
- package/dist/utils/dom/index.d.ts +1 -0
- package/dist/utils/dom/index.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as e, F as t, G as n, H as r, I as i, J as a, K as o, L as s, Q as c, R as l, S as u, T as d, U as f, W as ee, X as te, Y as p, Z as ne, a as m, c as re, d as h, et as g, f as _, g as v, i as ie, n as ae, o as y, q as b, r as x, s as S, t as C, tt as w, u as T, v as E, w as D, x as oe, y as se, z as O } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-index:3;position:relative}.form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inherit);font-size:12px;font-weight:500;line-height:var(--odus-helper-text-line-height,14px);background:var(--odus-color-background,#fff);pointer-events:none;transition:opacity .2s ease-in-out;display:block;position:absolute;top:2px;left:0;right:0}.form-helper-text-hidden{opacity:0;visibility:hidden}.form-helper-text-hint{color:var(--odus-color-muted,#6b7280);font-weight:400}", A = ".input-wrapper{box-sizing:border-box;flex-direction:column;align-items:stretch;width:100%;min-width:0;display:flex}.input-wrapper *{box-sizing:border-box}.form-input{opacity:1;font-size:var(--odus-input-font-size,16px);font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input[name=cardNumber]{padding-right:100px}.form-input-error{box-shadow:0 0 0 1px var(--odus-color-error,#dc2727), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{z-index:2;position:relative;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}", j = ".input-label{font-family:var(--odus-font-family,inherit);font-size:var(--odus-label-font-size,14px);font-weight:var(--odus-label-font-weight,400);color:var(--odus-label-color,var(--odus-color-text,#1a1a1a));letter-spacing:var(--odus-label-letter-spacing,normal);line-height:var(--odus-label-line-height,1.4);margin-bottom:var(--odus-label-margin-bottom,6px)}",
|
|
3
|
+
var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-index:3;position:relative}.form-helper-text{color:#dc2727;font-family:var(--odus-font-family,inherit);font-size:12px;font-weight:500;line-height:var(--odus-helper-text-line-height,14px);background:var(--odus-color-background,#fff);pointer-events:none;transition:opacity .2s ease-in-out;display:block;position:absolute;top:2px;left:0;right:0}.form-helper-text-hidden{opacity:0;visibility:hidden}.form-helper-text-hint{color:var(--odus-color-muted,#6b7280);font-weight:400}", A = ".input-wrapper{box-sizing:border-box;flex-direction:column;align-items:stretch;width:100%;min-width:0;display:flex}.input-wrapper *{box-sizing:border-box}.form-input{opacity:1;font-size:var(--odus-input-font-size,16px);font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input[name=cardNumber]{padding-right:100px}.form-input-error{box-shadow:0 0 0 1px var(--odus-color-error,#dc2727), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{z-index:2;position:relative;box-shadow:0 0 0 1px #3297d3b3,0 1px 1px #00000012,0 0 0 4px #3297d34d}", j = ".input-label{font-family:var(--odus-font-family,inherit);font-size:var(--odus-label-font-size,14px);font-weight:var(--odus-label-font-weight,400);color:var(--odus-label-color,var(--odus-color-text,#1a1a1a));letter-spacing:var(--odus-label-letter-spacing,normal);line-height:var(--odus-label-line-height,1.4);margin-bottom:var(--odus-label-margin-bottom,6px)}", ce = ":host{--odus-font-family:system-ui, sans-serif;--odus-font-size:16px;--odus-color-error:#dc2727;--odus-color-text:#1a1a1a;--odus-color-background:#fff;--odus-border-color:#e0e0e0;--odus-border-radius:6px;--odus-spacing-sm:8px;--odus-spacing-md:16px;--odus-spacing-lg:24px;--odus-input-height:44px;--odus-input-padding:8px 12px;--odus-input-font-size:var(--odus-font-size);--odus-input-font-weight:400;--odus-input-letter-spacing:.02em;--odus-input-line-height:1.5;--odus-input-placeholder-color:#717173;--odus-input-placeholder-opacity:.3;--odus-input-focus-shadow:0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d;--odus-label-font-size:14px;--odus-label-font-weight:400;--odus-label-color:var(--odus-color-text);--odus-label-letter-spacing:normal;--odus-label-line-height:1.4;--odus-label-margin-bottom:6px;--odus-card-gap:12px;--odus-button-height:48px;--odus-button-border-radius:var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{box-shadow:var(--odus-input-focus-shadow,0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d);z-index:2;position:relative}.input-label{font-family:var(--odus-font-family,inherit)!important;font-size:var(--odus-label-font-size,14px)!important;font-weight:var(--odus-label-font-weight,400)!important;color:var(--odus-label-color,var(--odus-color-text,#1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing,normal)!important;line-height:var(--odus-label-line-height,1.4)!important;margin-bottom:var(--odus-label-margin-bottom,6px)!important}.form-helper-text{font-family:var(--odus-font-family,inherit)!important}", M = class {
|
|
4
4
|
shadowRoot = null;
|
|
5
5
|
host = null;
|
|
6
6
|
options = {};
|
|
@@ -64,7 +64,7 @@ var k = ".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 ce;
|
|
68
68
|
}
|
|
69
69
|
}, N = class extends M {
|
|
70
70
|
_value = "";
|
|
@@ -73,8 +73,8 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
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 } = D();
|
|
77
|
+
this._input = new _({
|
|
78
78
|
name: "billingAddress.city",
|
|
79
79
|
label: this.options.label ?? e("address.townCity"),
|
|
80
80
|
error: !1,
|
|
@@ -85,7 +85,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
85
85
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
86
86
|
}
|
|
87
87
|
}), this._input.addEventListener("blur", () => {
|
|
88
|
-
let { t: e } =
|
|
88
|
+
let { t: e } = D();
|
|
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
|
}
|
|
@@ -116,20 +116,20 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
116
116
|
render() {
|
|
117
117
|
if (!this.shadowRoot) return;
|
|
118
118
|
this._select?.getElement().remove(), this.options.initialValue && !this._value && (this._value = String(this.options.initialValue), this.emit("change", this._value));
|
|
119
|
-
let { t: e, locale: t } =
|
|
119
|
+
let { t: e, locale: t } = D();
|
|
120
120
|
this._select = new h({
|
|
121
121
|
name: "billingAddress.country",
|
|
122
122
|
label: this.options.label ?? e("address.chooseCountry"),
|
|
123
123
|
error: !1,
|
|
124
124
|
placeholder: this.options.placeholder ?? e("address.chooseCountry"),
|
|
125
125
|
value: this._value,
|
|
126
|
-
options:
|
|
126
|
+
options: 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);
|
|
130
130
|
}
|
|
131
131
|
}), this._select.addEventListener("blur", () => {
|
|
132
|
-
let { t: e } =
|
|
132
|
+
let { t: e } = D();
|
|
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
|
}
|
|
@@ -156,8 +156,8 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
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 } = D();
|
|
160
|
+
this._input = new _({
|
|
161
161
|
name: "billingAddress.firstName",
|
|
162
162
|
label: this.options.label ?? e("address.firstName"),
|
|
163
163
|
error: !1,
|
|
@@ -168,7 +168,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
168
168
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
169
169
|
}
|
|
170
170
|
}), this._input.addEventListener("blur", () => {
|
|
171
|
-
let { t: e } =
|
|
171
|
+
let { t: e } = D();
|
|
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
|
}
|
|
@@ -195,8 +195,8 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
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 } = D();
|
|
199
|
+
this._input = new _({
|
|
200
200
|
name: "billingAddress.lastName",
|
|
201
201
|
label: this.options.label ?? e("address.lastName"),
|
|
202
202
|
error: !1,
|
|
@@ -207,7 +207,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
207
207
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
208
208
|
}
|
|
209
209
|
}), this._input.addEventListener("blur", () => {
|
|
210
|
-
let { t: e } =
|
|
210
|
+
let { t: e } = D();
|
|
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
|
}
|
|
@@ -233,22 +233,22 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
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(
|
|
238
|
+
let n = l(t), r = l(e);
|
|
239
|
+
if (n && r && t !== e) {
|
|
240
|
+
let { t } = D(), n = O(e), r = t(s(n));
|
|
241
|
+
this._select?.setOptions(i(n), this.options.placeholder ?? r), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
242
242
|
return;
|
|
243
243
|
}
|
|
244
|
-
|
|
244
|
+
n !== r && (this._value = "", this.render(), this.emit("change", this._value));
|
|
245
245
|
}
|
|
246
246
|
render() {
|
|
247
|
-
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null,
|
|
247
|
+
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, l(this._country) ? this._renderSelect(O(this._country)) : this._renderInput());
|
|
248
248
|
}
|
|
249
249
|
_renderInput() {
|
|
250
|
-
let { t: e } =
|
|
251
|
-
this._input = new
|
|
250
|
+
let { t: e } = D();
|
|
251
|
+
this._input = new _({
|
|
252
252
|
name: "billingAddress.state",
|
|
253
253
|
label: this.options.label ?? e("address.state"),
|
|
254
254
|
error: !1,
|
|
@@ -264,7 +264,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
264
264
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
265
265
|
}
|
|
266
266
|
_renderSelect(e) {
|
|
267
|
-
let { t } =
|
|
267
|
+
let { t } = D(), n = i(e), r = t(s(e));
|
|
268
268
|
this._select = new h({
|
|
269
269
|
name: "billingAddress.state",
|
|
270
270
|
label: this.options.label ?? t("address.state"),
|
|
@@ -297,7 +297,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
297
297
|
}
|
|
298
298
|
getError() {
|
|
299
299
|
if (this.getIsValid()) return null;
|
|
300
|
-
let { t: e } =
|
|
300
|
+
let { t: e } = D();
|
|
301
301
|
return e("validation.stateRequired");
|
|
302
302
|
}
|
|
303
303
|
}, z = class extends M {
|
|
@@ -307,8 +307,8 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
307
307
|
render() {
|
|
308
308
|
if (!this.shadowRoot) return;
|
|
309
309
|
this._input?.getElement().remove();
|
|
310
|
-
let { t: e } =
|
|
311
|
-
this._input = new
|
|
310
|
+
let { t: e } = D();
|
|
311
|
+
this._input = new _({
|
|
312
312
|
name: "billingAddress.street",
|
|
313
313
|
label: this.options.label ?? e("address.addressLine1"),
|
|
314
314
|
error: !1,
|
|
@@ -324,7 +324,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
324
324
|
this.emit("change", this._value);
|
|
325
325
|
}
|
|
326
326
|
}), this._input.addEventListener("blur", () => {
|
|
327
|
-
let { t: e } =
|
|
327
|
+
let { t: e } = D();
|
|
328
328
|
this._error = this._value.trim() ? null : e("validation.addressLine1Required"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
329
329
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
330
330
|
}
|
|
@@ -351,8 +351,8 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
351
351
|
render() {
|
|
352
352
|
if (!this.shadowRoot) return;
|
|
353
353
|
this._input?.getElement().remove();
|
|
354
|
-
let { t: e } =
|
|
355
|
-
this._input = new
|
|
354
|
+
let { t: e } = D();
|
|
355
|
+
this._input = new _({
|
|
356
356
|
name: "billingAddress.zipCode",
|
|
357
357
|
label: this.options.label ?? e("address.postalCode"),
|
|
358
358
|
error: !1,
|
|
@@ -363,7 +363,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
363
363
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
364
364
|
}
|
|
365
365
|
}), this._input.addEventListener("blur", () => {
|
|
366
|
-
let { t: e } =
|
|
366
|
+
let { t: e } = D();
|
|
367
367
|
this._error = this._value.trim() ? null : e("validation.postalCodeRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
368
368
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
369
369
|
}
|
|
@@ -430,11 +430,11 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
430
430
|
this._setAvailability(!1);
|
|
431
431
|
return;
|
|
432
432
|
}
|
|
433
|
-
if (!
|
|
433
|
+
if (!ie()) {
|
|
434
434
|
this._setAvailability(!1);
|
|
435
435
|
return;
|
|
436
436
|
}
|
|
437
|
-
this._button = new
|
|
437
|
+
this._button = new x({
|
|
438
438
|
checkoutProfile: H,
|
|
439
439
|
paymentId: e,
|
|
440
440
|
checkoutKey: t,
|
|
@@ -514,11 +514,11 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
514
514
|
"--odus-button-height": "48px",
|
|
515
515
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
516
516
|
}["--odus-font-size"];
|
|
517
|
-
function
|
|
517
|
+
function q(e, t) {
|
|
518
518
|
let n = Object.keys(e);
|
|
519
519
|
return n.length === Object.keys(t).length && n.every((n) => e[n] === t[n]);
|
|
520
520
|
}
|
|
521
|
-
var
|
|
521
|
+
var le = class {
|
|
522
522
|
_vgsService;
|
|
523
523
|
_vgsJwt;
|
|
524
524
|
_vgsState = {};
|
|
@@ -538,7 +538,7 @@ var q = class {
|
|
|
538
538
|
}
|
|
539
539
|
renderSection(e, t) {
|
|
540
540
|
this._section?.getElement().remove();
|
|
541
|
-
let { t: n } =
|
|
541
|
+
let { t: n } = D();
|
|
542
542
|
this._section = new re({
|
|
543
543
|
checkoutProfile: G,
|
|
544
544
|
translationFunc: n,
|
|
@@ -552,9 +552,9 @@ var q = class {
|
|
|
552
552
|
}
|
|
553
553
|
_onChangeEmit = null;
|
|
554
554
|
initVgs() {
|
|
555
|
-
let e = ++this._initGeneration;
|
|
556
|
-
this._vgsService.init(this._environment).then((
|
|
557
|
-
e === this._initGeneration && (this._vgsService.createForm(
|
|
555
|
+
let e = ++this._initGeneration, t = { ...this._currentTheme }, n = oe(this._buildProfileFromTheme(t).styles.fontFamily);
|
|
556
|
+
this._vgsService.init(this._environment).then((r) => {
|
|
557
|
+
e === this._initGeneration && (this._vgsService.createForm(r, (e) => this._handleStateChange(e)), this._mountFields(e, t, n).catch((t) => {
|
|
558
558
|
e === this._initGeneration && (console.error("Failed to mount VGS card fields:", t), this._onFieldsNotReady?.());
|
|
559
559
|
}));
|
|
560
560
|
}).catch((t) => {
|
|
@@ -575,12 +575,12 @@ var q = class {
|
|
|
575
575
|
return this._vgsFieldsValid;
|
|
576
576
|
}
|
|
577
577
|
getError() {
|
|
578
|
-
let { t: e } =
|
|
578
|
+
let { t: e } = D();
|
|
579
579
|
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
580
580
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
581
581
|
let r = n.errors?.[0];
|
|
582
582
|
if (!r) continue;
|
|
583
|
-
let i =
|
|
583
|
+
let i = T(t, r.code);
|
|
584
584
|
if (i) return e(i);
|
|
585
585
|
}
|
|
586
586
|
return null;
|
|
@@ -590,7 +590,7 @@ var q = class {
|
|
|
590
590
|
...this._currentTheme,
|
|
591
591
|
...e
|
|
592
592
|
};
|
|
593
|
-
|
|
593
|
+
q(this._currentTheme, t) || (this._currentTheme = t, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme()));
|
|
594
594
|
}
|
|
595
595
|
resetTheme(e) {
|
|
596
596
|
let t = e.filter((e) => e in this._currentTheme);
|
|
@@ -620,34 +620,34 @@ var q = class {
|
|
|
620
620
|
}
|
|
621
621
|
};
|
|
622
622
|
}
|
|
623
|
-
async _mountFields(e) {
|
|
623
|
+
async _mountFields(e, t, n) {
|
|
624
624
|
if (!this._section) return;
|
|
625
|
-
let
|
|
625
|
+
let r = this._buildProfileFromTheme(t), i = t["--odus-border-color"] ?? "#e0e0e0";
|
|
626
626
|
this._applySkeletonMetrics();
|
|
627
|
-
let
|
|
628
|
-
for (let e of Object.values(
|
|
627
|
+
let a = this._section.getVgsContainerIds();
|
|
628
|
+
for (let e of Object.values(a)) {
|
|
629
629
|
if (!e) continue;
|
|
630
630
|
let t = document.getElementById(e);
|
|
631
631
|
t && t.querySelectorAll("iframe").forEach((e) => e.remove());
|
|
632
632
|
}
|
|
633
|
-
let
|
|
633
|
+
let o = await n;
|
|
634
634
|
if (e !== this._initGeneration) return;
|
|
635
|
-
let
|
|
636
|
-
borderColor:
|
|
637
|
-
backgroundColor:
|
|
638
|
-
placeholderColor:
|
|
639
|
-
placeholderOpacity:
|
|
640
|
-
padding:
|
|
641
|
-
}), { t:
|
|
635
|
+
let s = this._section.buildVgsFieldCss(r, o, {
|
|
636
|
+
borderColor: i,
|
|
637
|
+
backgroundColor: t["--odus-color-background"],
|
|
638
|
+
placeholderColor: t["--odus-input-placeholder-color"],
|
|
639
|
+
placeholderOpacity: t["--odus-input-placeholder-opacity"],
|
|
640
|
+
padding: t["--odus-input-padding"]
|
|
641
|
+
}), { t: c } = D();
|
|
642
642
|
this._vgsService.mountCardFields({
|
|
643
|
-
cardNumber:
|
|
644
|
-
cardExpiry:
|
|
645
|
-
cardCvv:
|
|
646
|
-
},
|
|
643
|
+
cardNumber: a.cardNumber ? `#${a.cardNumber}` : void 0,
|
|
644
|
+
cardExpiry: a.cardExpiry ? `#${a.cardExpiry}` : void 0,
|
|
645
|
+
cardCvv: a.cardCvv ? `#${a.cardCvv}` : void 0
|
|
646
|
+
}, s, {
|
|
647
647
|
cardNumber: "1234 5678 9012 3456",
|
|
648
|
-
cardExpiry:
|
|
648
|
+
cardExpiry: c("cardExpiry"),
|
|
649
649
|
cardCvv: "CVV",
|
|
650
|
-
cardholderName:
|
|
650
|
+
cardholderName: c("cardholderName")
|
|
651
651
|
}, (e) => {
|
|
652
652
|
this._section?.updateVgsCardBrand(e);
|
|
653
653
|
}), this._vgsService.waitForFieldsReady().then(() => {
|
|
@@ -658,7 +658,7 @@ var q = class {
|
|
|
658
658
|
}
|
|
659
659
|
_handleStateChange(e) {
|
|
660
660
|
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
661
|
-
let { t } =
|
|
661
|
+
let { t } = D(), n = this._deriveFieldErrors(t);
|
|
662
662
|
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
663
663
|
}
|
|
664
664
|
_deriveFieldErrors(e) {
|
|
@@ -667,19 +667,19 @@ var q = class {
|
|
|
667
667
|
if (!r?.isTouched || r.isFocused || r.isValid) continue;
|
|
668
668
|
let i = r.errors?.[0];
|
|
669
669
|
if (!i) continue;
|
|
670
|
-
let a =
|
|
670
|
+
let a = T(n, i.code);
|
|
671
671
|
a && (t[n] = e(a));
|
|
672
672
|
}
|
|
673
673
|
return t;
|
|
674
674
|
}
|
|
675
|
-
},
|
|
675
|
+
}, ue = "Card capture is unavailable: no tokenization session", J = class extends M {
|
|
676
676
|
_environment = "test";
|
|
677
677
|
_captureState = "pending";
|
|
678
678
|
_mountContainer = null;
|
|
679
679
|
_vgsAdapter = null;
|
|
680
680
|
_vgsJwt = null;
|
|
681
681
|
_reportedUnavailable = !1;
|
|
682
|
-
_unavailableReason =
|
|
682
|
+
_unavailableReason = b.NO_TOKENIZATION_SESSION;
|
|
683
683
|
get isVgsMode() {
|
|
684
684
|
return this._captureState === "vgs";
|
|
685
685
|
}
|
|
@@ -692,17 +692,17 @@ var q = class {
|
|
|
692
692
|
setVgsJwt(e) {
|
|
693
693
|
if (this._vgsAdapter && this._vgsJwt === e) return;
|
|
694
694
|
this._captureState = "vgs", this._reportedUnavailable = !1, this._vgsJwt = e, this._vgsAdapter?.destroy();
|
|
695
|
-
let t = new
|
|
695
|
+
let t = new le(e, this._environment, {
|
|
696
696
|
onInitFailure: () => {
|
|
697
|
-
this._vgsAdapter
|
|
697
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(b.INIT_FAILED);
|
|
698
698
|
},
|
|
699
699
|
onFieldsNotReady: () => {
|
|
700
|
-
this._vgsAdapter
|
|
700
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(b.FIELDS_NOT_READY);
|
|
701
701
|
}
|
|
702
702
|
});
|
|
703
703
|
this._vgsAdapter = t, this.isMounted && this._mountContainer && (this.unmount(), this.mount(this._mountContainer));
|
|
704
704
|
}
|
|
705
|
-
markCaptureUnavailable(e =
|
|
705
|
+
markCaptureUnavailable(e = b.NO_TOKENIZATION_SESSION) {
|
|
706
706
|
if (this._captureState === "unavailable") return;
|
|
707
707
|
let t = this._mountContainer, n = this.isMounted && t !== null;
|
|
708
708
|
this.isMounted && this.unmount(), this._unavailableReason = e, this._captureState = "unavailable", this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, n && t && this.mount(t);
|
|
@@ -749,7 +749,7 @@ var q = class {
|
|
|
749
749
|
this.clearBody();
|
|
750
750
|
let e = document.createElement("div");
|
|
751
751
|
e.className = "card-pending";
|
|
752
|
-
let t =
|
|
752
|
+
let t = se(E, G.styles.fontSize);
|
|
753
753
|
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${G.styles.borderRadius}px)`;
|
|
754
754
|
let n = document.createElement("div");
|
|
755
755
|
n.className = "vgs-field-skeleton", e.appendChild(n), this.shadowRoot.appendChild(e);
|
|
@@ -757,11 +757,11 @@ var q = class {
|
|
|
757
757
|
renderUnavailableNotice() {
|
|
758
758
|
if (!this.shadowRoot) return;
|
|
759
759
|
this.clearBody();
|
|
760
|
-
let { t: e } =
|
|
760
|
+
let { t: e } = D(), t = new S({
|
|
761
761
|
checkoutProfile: G,
|
|
762
762
|
translationFunc: e
|
|
763
763
|
});
|
|
764
|
-
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0,
|
|
764
|
+
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0, c(a.CARD_CAPTURE_UNAVAILABLE, { reason: this._unavailableReason }));
|
|
765
765
|
}
|
|
766
766
|
focus() {
|
|
767
767
|
this._vgsAdapter?.section?.focus();
|
|
@@ -773,10 +773,10 @@ var q = class {
|
|
|
773
773
|
this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, this._captureState = "pending", this._reportedUnavailable = !1, super.destroy();
|
|
774
774
|
}
|
|
775
775
|
setTheme(e) {
|
|
776
|
-
super.setTheme(e),
|
|
776
|
+
super.setTheme(e), this._captureState === "vgs" && this._vgsAdapter && this._vgsAdapter.applyTheme(e);
|
|
777
777
|
}
|
|
778
778
|
resetTheme(e) {
|
|
779
|
-
super.resetTheme(e),
|
|
779
|
+
super.resetTheme(e), this._captureState === "vgs" && this._vgsAdapter && this._vgsAdapter.resetTheme(Object.keys(e));
|
|
780
780
|
}
|
|
781
781
|
getCss() {
|
|
782
782
|
return super.getCss() + [
|
|
@@ -794,14 +794,14 @@ var q = class {
|
|
|
794
794
|
};
|
|
795
795
|
}
|
|
796
796
|
async getPayload() {
|
|
797
|
-
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(
|
|
797
|
+
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(ue);
|
|
798
798
|
return this._vgsAdapter.getPayload();
|
|
799
799
|
}
|
|
800
800
|
getIsValid() {
|
|
801
801
|
return this._captureState === "unsupported" ? !0 : this._vgsAdapter?.isValid() ?? !1;
|
|
802
802
|
}
|
|
803
803
|
getError() {
|
|
804
|
-
return this._captureState === "unavailable" ?
|
|
804
|
+
return this._captureState === "unavailable" ? D().t("cardUnavailable") : this._vgsAdapter?.getError() ?? null;
|
|
805
805
|
}
|
|
806
806
|
}, Y = class extends M {
|
|
807
807
|
_value = "";
|
|
@@ -810,8 +810,8 @@ var q = class {
|
|
|
810
810
|
render() {
|
|
811
811
|
if (!this.shadowRoot) return;
|
|
812
812
|
this._input?.getElement().remove();
|
|
813
|
-
let { t: e } =
|
|
814
|
-
this._input = new
|
|
813
|
+
let { t: e } = D();
|
|
814
|
+
this._input = new _({
|
|
815
815
|
name: "billingAddress.cardholderName",
|
|
816
816
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
817
817
|
error: !1,
|
|
@@ -823,7 +823,7 @@ var q = class {
|
|
|
823
823
|
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
824
824
|
}
|
|
825
825
|
}), this._input.addEventListener("blur", () => {
|
|
826
|
-
let { t: e } =
|
|
826
|
+
let { t: e } = D();
|
|
827
827
|
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
828
828
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
829
829
|
}
|
|
@@ -843,7 +843,7 @@ var q = class {
|
|
|
843
843
|
getError() {
|
|
844
844
|
return this._error;
|
|
845
845
|
}
|
|
846
|
-
},
|
|
846
|
+
}, de = {
|
|
847
847
|
name: "odus-elements",
|
|
848
848
|
styles: {
|
|
849
849
|
fontSize: 14,
|
|
@@ -875,11 +875,11 @@ var q = class {
|
|
|
875
875
|
render() {
|
|
876
876
|
if (!this.shadowRoot) return;
|
|
877
877
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
878
|
-
let { t: e } =
|
|
879
|
-
this._field = new
|
|
878
|
+
let { t: e } = D();
|
|
879
|
+
this._field = new y({
|
|
880
880
|
value: this._email,
|
|
881
881
|
error: !1,
|
|
882
|
-
checkoutProfile:
|
|
882
|
+
checkoutProfile: de,
|
|
883
883
|
translationFunc: e,
|
|
884
884
|
label: this.options.label,
|
|
885
885
|
placeholder: this.options.placeholder,
|
|
@@ -888,7 +888,7 @@ var q = class {
|
|
|
888
888
|
this._email = t.value ?? this._field?.getValue() ?? "", this._error = null, this._suggestion = null, this._field?.setError(!1), this._field?.setSuggestion(null), this.emit("change", this._email);
|
|
889
889
|
},
|
|
890
890
|
onBlur: () => {
|
|
891
|
-
let e =
|
|
891
|
+
let e = t();
|
|
892
892
|
this._error = e.email(this._email) ?? null, this._suggestion = e.emailSuggestion(this._email) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this._field?.setSuggestion(this._suggestion), this.emit("blur", this._email);
|
|
893
893
|
}
|
|
894
894
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
@@ -904,7 +904,7 @@ var q = class {
|
|
|
904
904
|
return this._email;
|
|
905
905
|
}
|
|
906
906
|
getIsValid() {
|
|
907
|
-
return !
|
|
907
|
+
return !t().email(this._email);
|
|
908
908
|
}
|
|
909
909
|
getError() {
|
|
910
910
|
return this._error;
|
|
@@ -912,24 +912,24 @@ var q = class {
|
|
|
912
912
|
get suggestion() {
|
|
913
913
|
return this._suggestion;
|
|
914
914
|
}
|
|
915
|
-
},
|
|
915
|
+
}, fe = "@keyframes slideIn{0%{opacity:0;transform:translateY(-10px)}to{opacity:1;transform:translateY(0)}}.error-alert{background-color:#fef2f2;border:1px solid #fecaca;border-radius:8px;padding:16px;animation:.3s ease-out slideIn;box-shadow:0 1px 3px #0000001a,0 1px 2px #0000000f}.error-alert-content{align-items:flex-start;gap:12px;display:flex}.error-alert-icon-container{color:#dc2626;background-color:#fee2e2;border-radius:50%;flex-shrink:0;justify-content:center;align-items:center;width:32px;height:32px;display:flex}.error-alert-icon{color:#dc2626}.error-alert-text-container{flex:1;min-width:0}.error-alert-title{color:#991b1b;margin:0 0 4px;font-size:14px;font-weight:600;line-height:1.4}.error-alert-message{font-family:var(--odus-font-family,inherit);color:#7f1d1d;word-break:break-word;margin:0;font-size:14px;line-height:1.5}", Z = class extends M {
|
|
916
916
|
_alert = null;
|
|
917
917
|
_message = null;
|
|
918
918
|
render() {
|
|
919
|
-
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new
|
|
919
|
+
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new C({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
920
920
|
}
|
|
921
921
|
setError(e) {
|
|
922
922
|
if (this._message = e, !this.shadowRoot) {
|
|
923
923
|
this.emit("error", e);
|
|
924
924
|
return;
|
|
925
925
|
}
|
|
926
|
-
this._alert ? this._alert.setMessage(e) : (this._alert = new
|
|
926
|
+
this._alert ? this._alert.setMessage(e) : (this._alert = new C({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
|
|
927
927
|
}
|
|
928
928
|
clearError() {
|
|
929
929
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
930
930
|
}
|
|
931
931
|
getCss() {
|
|
932
|
-
return super.getCss() +
|
|
932
|
+
return super.getCss() + fe + "\n :host { display: block; }\n .error-alert-icon,\n .error-alert-icon-container {\n color: var(--odus-color-error, #e53e3e) !important;\n }\n .error-alert-message {\n color: var(--odus-color-text, #1a1a1a) !important;\n }\n ";
|
|
933
933
|
}
|
|
934
934
|
getValue() {
|
|
935
935
|
return null;
|
|
@@ -940,7 +940,7 @@ var q = class {
|
|
|
940
940
|
getError() {
|
|
941
941
|
return this._message;
|
|
942
942
|
}
|
|
943
|
-
},
|
|
943
|
+
}, pe = ".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}", me = {
|
|
944
944
|
name: "odus-elements",
|
|
945
945
|
styles: {
|
|
946
946
|
fontSize: 14,
|
|
@@ -973,8 +973,8 @@ var q = class {
|
|
|
973
973
|
render() {
|
|
974
974
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
975
975
|
let { onAuthorize: e } = this._paymentContext;
|
|
976
|
-
this._button = new
|
|
977
|
-
checkoutProfile:
|
|
976
|
+
this._button = new ae({
|
|
977
|
+
checkoutProfile: me,
|
|
978
978
|
onSubmit: async () => {
|
|
979
979
|
this._button?.setSubmitting(!0);
|
|
980
980
|
try {
|
|
@@ -986,7 +986,7 @@ var q = class {
|
|
|
986
986
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
987
987
|
}
|
|
988
988
|
getCss() {
|
|
989
|
-
return super.getCss() +
|
|
989
|
+
return super.getCss() + pe + "\n :host { display: block; }\n .paypal {\n width: 100%;\n box-sizing: border-box;\n border-radius: var(--odus-button-border-radius, 6px);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n ";
|
|
990
990
|
}
|
|
991
991
|
getValue() {
|
|
992
992
|
return null;
|
|
@@ -997,7 +997,7 @@ var q = class {
|
|
|
997
997
|
getError() {
|
|
998
998
|
return null;
|
|
999
999
|
}
|
|
1000
|
-
},
|
|
1000
|
+
}, he = ".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}", ge = {
|
|
1001
1001
|
name: "odus-elements",
|
|
1002
1002
|
styles: {
|
|
1003
1003
|
fontSize: 14,
|
|
@@ -1030,15 +1030,15 @@ var q = class {
|
|
|
1030
1030
|
if (!this.shadowRoot) return;
|
|
1031
1031
|
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1032
1032
|
let e = ++this._renderGeneration;
|
|
1033
|
-
|
|
1033
|
+
r().then(({ PhoneNumberField: n }) => {
|
|
1034
1034
|
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1035
|
-
let { t:
|
|
1036
|
-
this._field = new
|
|
1035
|
+
let { t: r, locale: i } = D();
|
|
1036
|
+
this._field = new n({
|
|
1037
1037
|
value: this._phone,
|
|
1038
1038
|
error: !1,
|
|
1039
|
-
checkoutProfile:
|
|
1040
|
-
translationFunc:
|
|
1041
|
-
locale:
|
|
1039
|
+
checkoutProfile: ge,
|
|
1040
|
+
translationFunc: r,
|
|
1041
|
+
locale: i,
|
|
1042
1042
|
label: this.options.label,
|
|
1043
1043
|
placeholder: this.options.placeholder,
|
|
1044
1044
|
defaultCountry: this.options.defaultCountry,
|
|
@@ -1047,12 +1047,12 @@ var q = class {
|
|
|
1047
1047
|
},
|
|
1048
1048
|
onBlur: () => {
|
|
1049
1049
|
this._phone = this._field?.getValue() ?? "";
|
|
1050
|
-
let e =
|
|
1051
|
-
this._error = e.phoneNumber(this._phone,
|
|
1050
|
+
let e = t(), n = this._field?.getCountry();
|
|
1051
|
+
this._error = e.phoneNumber(this._phone, n) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1052
1052
|
}
|
|
1053
1053
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
1054
1054
|
}).catch((t) => {
|
|
1055
|
-
|
|
1055
|
+
this.shadowRoot && this._renderGeneration === e && console.error("Error creating phone number field:", t);
|
|
1056
1056
|
});
|
|
1057
1057
|
}
|
|
1058
1058
|
getCss() {
|
|
@@ -1060,20 +1060,20 @@ var q = class {
|
|
|
1060
1060
|
A,
|
|
1061
1061
|
j,
|
|
1062
1062
|
k,
|
|
1063
|
-
|
|
1063
|
+
he
|
|
1064
1064
|
].join("\n") + "\n :host { display: block; }\n .form-input,\n .country-select-wrapper {\n color: var(--odus-color-text, #1a1a1a) !important;\n font-family: var(--odus-font-family, system-ui, sans-serif) !important;\n font-size: var(--odus-input-font-size, 16px) !important;\n background: var(--odus-color-background, #ffffff) !important;\n border-radius: 0 !important;\n box-shadow: none !important;\n }\n .phone-number-field-container {\n min-height: calc(var(--odus-input-font-size, 16px) * 1.5 + 16px);\n box-shadow:\n 0 0 0 1px var(--odus-border-color, #e0e0e0),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n border-radius: var(--odus-border-radius, 6px) !important;\n overflow: hidden;\n }\n .phone-number-field-container:focus-within {\n box-shadow: var(\n --odus-input-focus-shadow,\n 0 0 0 1px rgba(50, 151, 211, 0.7),\n 0 1px 1px 0 rgba(0, 0, 0, 0.07),\n 0 0 0 4px rgba(50, 151, 211, 0.3)\n ) !important;\n }\n .phone-number-field-container.error {\n box-shadow: 0 0 0 1px var(--odus-color-error, #dc2727) !important;\n }\n .form-input:focus {\n box-shadow: none !important;\n outline: none !important;\n }\n .form-input-error {\n box-shadow:\n 0 0 0 1px var(--odus-color-error, #dc2727),\n 0 2px 4px 0 rgba(0, 0, 0, 0.07),\n 0 1px 1.5px 0 rgba(0, 0, 0, 0.05) !important;\n }\n .form-helper-text {\n color: var(--odus-color-error, #dc2727) !important;\n }\n ";
|
|
1065
1065
|
}
|
|
1066
1066
|
getValue() {
|
|
1067
1067
|
return this._phone;
|
|
1068
1068
|
}
|
|
1069
1069
|
getIsValid() {
|
|
1070
|
-
let e =
|
|
1071
|
-
return !e.phoneNumber(this._phone,
|
|
1070
|
+
let e = t(), n = this._field?.getCountry();
|
|
1071
|
+
return !e.phoneNumber(this._phone, n);
|
|
1072
1072
|
}
|
|
1073
1073
|
getError() {
|
|
1074
1074
|
return this._error;
|
|
1075
1075
|
}
|
|
1076
|
-
},
|
|
1076
|
+
}, _e = "Payment failed", ve = "We couldn't securely process your card details. Please check your card information and try again.", ye = "No payment details were entered. Please add your card and try again.", be = "This payment is no longer available. Please reload the page and try again.", xe = class {
|
|
1077
1077
|
_config;
|
|
1078
1078
|
_apiService;
|
|
1079
1079
|
_changeListeners = [];
|
|
@@ -1098,22 +1098,22 @@ var q = class {
|
|
|
1098
1098
|
_paypal;
|
|
1099
1099
|
_error;
|
|
1100
1100
|
elements;
|
|
1101
|
-
constructor(
|
|
1102
|
-
this._config =
|
|
1103
|
-
environment:
|
|
1101
|
+
constructor(t) {
|
|
1102
|
+
this._config = t, this._callbacks = { ...t.callbacks }, this._sessionId = crypto.randomUUID(), ee(), te({
|
|
1103
|
+
environment: t.environment,
|
|
1104
1104
|
sessionId: this._sessionId,
|
|
1105
1105
|
integration: "elements"
|
|
1106
|
-
}),
|
|
1107
|
-
let
|
|
1108
|
-
Object.defineProperty(
|
|
1106
|
+
}), c(a.CHECKOUT_INITIALIZED, { environment: t.environment }), t.locale && d.setLocale(t.locale), this._apiService = new e(t.apiKey, t.environment);
|
|
1107
|
+
let n = {};
|
|
1108
|
+
Object.defineProperty(n, "email", {
|
|
1109
1109
|
get: () => (this._email || (this._email = new X(), this._trackElement(this._email)), this._email),
|
|
1110
1110
|
enumerable: !0
|
|
1111
|
-
}), Object.defineProperty(
|
|
1111
|
+
}), Object.defineProperty(n, "phone", {
|
|
1112
1112
|
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone)), this._phone),
|
|
1113
1113
|
enumerable: !0
|
|
1114
1114
|
});
|
|
1115
|
-
let
|
|
1116
|
-
Object.defineProperty(
|
|
1115
|
+
let r = {};
|
|
1116
|
+
Object.defineProperty(r, "applePay", {
|
|
1117
1117
|
get: () => (this._applePay || (this._applePay = new U(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1118
1118
|
paymentId: this._paymentState.paymentId,
|
|
1119
1119
|
checkoutKey: this._paymentState.checkoutKey,
|
|
@@ -1126,7 +1126,7 @@ var q = class {
|
|
|
1126
1126
|
})
|
|
1127
1127
|
})), this._applePay),
|
|
1128
1128
|
enumerable: !0
|
|
1129
|
-
}), Object.defineProperty(
|
|
1129
|
+
}), Object.defineProperty(r, "payPal", {
|
|
1130
1130
|
get: () => (this._paypal || (this._paypal = new Q(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1131
1131
|
paymentId: this._paymentState.paymentId,
|
|
1132
1132
|
checkoutKey: this._paymentState.checkoutKey,
|
|
@@ -1136,34 +1136,34 @@ var q = class {
|
|
|
1136
1136
|
})), this._paypal),
|
|
1137
1137
|
enumerable: !0
|
|
1138
1138
|
});
|
|
1139
|
-
let
|
|
1140
|
-
Object.defineProperty(
|
|
1139
|
+
let i = {};
|
|
1140
|
+
Object.defineProperty(i, "street", {
|
|
1141
1141
|
get: () => (this._addressStreet || (this._addressStreet = new z(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1142
1142
|
enumerable: !0
|
|
1143
|
-
}), Object.defineProperty(
|
|
1143
|
+
}), Object.defineProperty(i, "firstName", {
|
|
1144
1144
|
get: () => (this._addressFirstName || (this._addressFirstName = new I(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1145
1145
|
enumerable: !0
|
|
1146
|
-
}), Object.defineProperty(
|
|
1146
|
+
}), Object.defineProperty(i, "lastName", {
|
|
1147
1147
|
get: () => (this._addressLastName || (this._addressLastName = new L(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1148
1148
|
enumerable: !0
|
|
1149
|
-
}), Object.defineProperty(
|
|
1149
|
+
}), Object.defineProperty(i, "city", {
|
|
1150
1150
|
get: () => (this._addressCity || (this._addressCity = new N(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1151
1151
|
enumerable: !0
|
|
1152
|
-
}), Object.defineProperty(
|
|
1152
|
+
}), Object.defineProperty(i, "state", {
|
|
1153
1153
|
get: () => (this._addressState || (this._addressState = new R(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1154
1154
|
enumerable: !0
|
|
1155
|
-
}), Object.defineProperty(
|
|
1155
|
+
}), Object.defineProperty(i, "zipCode", {
|
|
1156
1156
|
get: () => (this._addressZipCode || (this._addressZipCode = new B(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1157
1157
|
enumerable: !0
|
|
1158
|
-
}), Object.defineProperty(
|
|
1158
|
+
}), Object.defineProperty(i, "country", {
|
|
1159
1159
|
get: () => (this._addressCountry || (this._addressCountry = new F(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1160
1160
|
this._addressState?.setCountry(e);
|
|
1161
1161
|
})), this._addressCountry),
|
|
1162
1162
|
enumerable: !0
|
|
1163
1163
|
});
|
|
1164
1164
|
let o = {
|
|
1165
|
-
contact:
|
|
1166
|
-
express:
|
|
1165
|
+
contact: n,
|
|
1166
|
+
express: r
|
|
1167
1167
|
};
|
|
1168
1168
|
Object.defineProperty(o, "card", {
|
|
1169
1169
|
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._paymentState.vgsJwt ? this._card.setVgsJwt(this._paymentState.vgsJwt) : this._paymentState.cardCapture === "unavailable" ? this._card.markCaptureUnavailable() : this._paymentState.cardCapture === "unsupported" && this._card.resetCardCapture()), this._card),
|
|
@@ -1172,7 +1172,7 @@ var q = class {
|
|
|
1172
1172
|
get: () => (this._cardholderName || (this._cardholderName = new Y(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1173
1173
|
enumerable: !0
|
|
1174
1174
|
}), Object.defineProperty(o, "address", {
|
|
1175
|
-
get: () =>
|
|
1175
|
+
get: () => i,
|
|
1176
1176
|
enumerable: !0
|
|
1177
1177
|
}), Object.defineProperty(o, "error", {
|
|
1178
1178
|
get: () => (this._error || (this._error = new Z(), this._trackElement(this._error)), this._error),
|
|
@@ -1181,18 +1181,20 @@ var q = class {
|
|
|
1181
1181
|
}
|
|
1182
1182
|
async associatePayment(e, t) {
|
|
1183
1183
|
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1184
|
-
let n = ++this._associationSequence
|
|
1184
|
+
let n = ++this._associationSequence;
|
|
1185
|
+
o(this._config.environment);
|
|
1186
|
+
let r;
|
|
1185
1187
|
try {
|
|
1186
|
-
r = await
|
|
1188
|
+
r = await w({
|
|
1187
1189
|
id: e,
|
|
1188
1190
|
checkoutKey: t,
|
|
1189
1191
|
environment: this._config.environment
|
|
1190
1192
|
});
|
|
1191
1193
|
} catch (t) {
|
|
1192
|
-
throw n === this._associationSequence && (this._paymentState = {}),
|
|
1194
|
+
throw n === this._associationSequence && (this._paymentState = {}), c(a.PAYMENT_ASSOCIATION_FAILED, {
|
|
1193
1195
|
payment_id: e,
|
|
1194
1196
|
error_message: t instanceof Error ? t.message : "Unknown error"
|
|
1195
|
-
}),
|
|
1197
|
+
}), ne(t instanceof Error ? t : Error("Failed to associate payment"), { payment_id: e }), t;
|
|
1196
1198
|
}
|
|
1197
1199
|
n === this._associationSequence && (this._paymentState = {
|
|
1198
1200
|
paymentId: e,
|
|
@@ -1202,7 +1204,7 @@ var q = class {
|
|
|
1202
1204
|
currency: r.currency,
|
|
1203
1205
|
countryCode: r.countryCode
|
|
1204
1206
|
}
|
|
1205
|
-
},
|
|
1207
|
+
}, c(a.PAYMENT_ASSOCIATED, {
|
|
1206
1208
|
payment_id: e,
|
|
1207
1209
|
currency: r.currency,
|
|
1208
1210
|
country_code: r.countryCode
|
|
@@ -1225,7 +1227,7 @@ var q = class {
|
|
|
1225
1227
|
}));
|
|
1226
1228
|
}
|
|
1227
1229
|
validate() {
|
|
1228
|
-
let e = {}, { t } =
|
|
1230
|
+
let e = {}, { t } = D();
|
|
1229
1231
|
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"), {
|
|
1230
1232
|
valid: Object.keys(e).length === 0,
|
|
1231
1233
|
errors: e
|
|
@@ -1240,19 +1242,19 @@ var q = class {
|
|
|
1240
1242
|
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1241
1243
|
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1242
1244
|
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1243
|
-
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [n?.firstName ?? "", n?.lastName ?? ""].filter(Boolean),
|
|
1245
|
+
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [n?.firstName ?? "", n?.lastName ?? ""].filter(Boolean), o = r || i.join(" ");
|
|
1244
1246
|
if (!this._card?.isMounted || this._card.captureState === "unsupported") return {
|
|
1245
1247
|
ok: !1,
|
|
1246
1248
|
error: {
|
|
1247
|
-
message:
|
|
1249
|
+
message: ye,
|
|
1248
1250
|
status: 0,
|
|
1249
1251
|
statusText: "No Payment Method"
|
|
1250
1252
|
}
|
|
1251
1253
|
};
|
|
1252
|
-
if (!this._card.isVgsMode) return
|
|
1254
|
+
if (!this._card.isVgsMode) return c(a.CARD_CAPTURE_UNAVAILABLE, { reason: b.NO_TOKENIZATION_SESSION }), {
|
|
1253
1255
|
ok: !1,
|
|
1254
1256
|
error: {
|
|
1255
|
-
message:
|
|
1257
|
+
message: D().t("cardUnavailable"),
|
|
1256
1258
|
status: 0,
|
|
1257
1259
|
statusText: "Card Capture Unavailable"
|
|
1258
1260
|
}
|
|
@@ -1262,7 +1264,7 @@ var q = class {
|
|
|
1262
1264
|
return {
|
|
1263
1265
|
ok: !0,
|
|
1264
1266
|
formData: {
|
|
1265
|
-
name:
|
|
1267
|
+
name: o,
|
|
1266
1268
|
email: e,
|
|
1267
1269
|
phoneNumber: t || void 0,
|
|
1268
1270
|
billingAddress: n,
|
|
@@ -1273,7 +1275,7 @@ var q = class {
|
|
|
1273
1275
|
return {
|
|
1274
1276
|
ok: !1,
|
|
1275
1277
|
error: {
|
|
1276
|
-
message:
|
|
1278
|
+
message: ve,
|
|
1277
1279
|
status: 0,
|
|
1278
1280
|
statusText: "Card Tokenization Failed"
|
|
1279
1281
|
}
|
|
@@ -1304,7 +1306,7 @@ var q = class {
|
|
|
1304
1306
|
let t = e["--odus-font-family"];
|
|
1305
1307
|
if (t) {
|
|
1306
1308
|
this._fontCleanup?.();
|
|
1307
|
-
let { cleanup: e } =
|
|
1309
|
+
let { cleanup: e } = u({ fontFamily: t });
|
|
1308
1310
|
this._fontCleanup = e;
|
|
1309
1311
|
}
|
|
1310
1312
|
for (let t of this._allElements()) t.setTheme(e);
|
|
@@ -1327,7 +1329,7 @@ var q = class {
|
|
|
1327
1329
|
}
|
|
1328
1330
|
_trackElement(e) {
|
|
1329
1331
|
e.on("ready", () => {
|
|
1330
|
-
this._mountedReported || (this._mountedReported = !0,
|
|
1332
|
+
this._mountedReported || (this._mountedReported = !0, c(a.CHECKOUT_MOUNTED, { container_id: "elements" }));
|
|
1331
1333
|
}), e.on("change", () => {
|
|
1332
1334
|
for (let e of this._changeListeners) e();
|
|
1333
1335
|
});
|
|
@@ -1350,45 +1352,45 @@ var q = class {
|
|
|
1350
1352
|
this._error
|
|
1351
1353
|
].filter((e) => e !== void 0);
|
|
1352
1354
|
}
|
|
1353
|
-
async _executeAuthorization({ formData:
|
|
1354
|
-
let { paymentId:
|
|
1355
|
-
if (!
|
|
1356
|
-
message:
|
|
1355
|
+
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1356
|
+
let { paymentId: r, checkoutKey: i } = this._paymentState, o = this._getPaymentMethod(e, t);
|
|
1357
|
+
if (!r || !i) return this._reportSubmitFailure({
|
|
1358
|
+
message: be,
|
|
1357
1359
|
status: 0,
|
|
1358
1360
|
statusText: "No Associated Payment"
|
|
1359
1361
|
}, o), !1;
|
|
1360
|
-
this._emitLoadingState(!0),
|
|
1361
|
-
payment_id:
|
|
1362
|
+
this._emitLoadingState(!0), c(a.PAYMENT_SUBMIT_STARTED, {
|
|
1363
|
+
payment_id: r,
|
|
1362
1364
|
payment_method: o
|
|
1363
1365
|
});
|
|
1364
1366
|
let s = performance.now();
|
|
1365
1367
|
try {
|
|
1366
1368
|
let l = await this._apiService.authorizePayment({
|
|
1367
|
-
paymentId:
|
|
1368
|
-
checkoutKey:
|
|
1369
|
-
formData:
|
|
1369
|
+
paymentId: r,
|
|
1370
|
+
checkoutKey: i,
|
|
1371
|
+
formData: e,
|
|
1370
1372
|
returnUrl: this._config.returnUrl,
|
|
1371
|
-
applePayData:
|
|
1372
|
-
customCustomerData:
|
|
1373
|
+
applePayData: t,
|
|
1374
|
+
customCustomerData: n
|
|
1373
1375
|
});
|
|
1374
|
-
return
|
|
1375
|
-
payment_id:
|
|
1376
|
+
return g(p.PAYMENT_AUTHORIZATION_TIME, performance.now() - s, "ms", {
|
|
1377
|
+
payment_id: r,
|
|
1376
1378
|
payment_method: o,
|
|
1377
1379
|
status: "success"
|
|
1378
|
-
}),
|
|
1379
|
-
payment_id:
|
|
1380
|
+
}), c(a.PAYMENT_SUBMIT_SUCCESS, {
|
|
1381
|
+
payment_id: r,
|
|
1380
1382
|
payment_method: o
|
|
1381
1383
|
}), this._handlePaymentResponse(l);
|
|
1382
|
-
} catch (
|
|
1383
|
-
return
|
|
1384
|
-
payment_id:
|
|
1384
|
+
} catch (e) {
|
|
1385
|
+
return g(p.PAYMENT_AUTHORIZATION_TIME, performance.now() - s, "ms", {
|
|
1386
|
+
payment_id: r,
|
|
1385
1387
|
payment_method: o,
|
|
1386
1388
|
status: "failed"
|
|
1387
|
-
}),
|
|
1388
|
-
payment_id:
|
|
1389
|
+
}), c(a.PAYMENT_SUBMIT_FAILED, {
|
|
1390
|
+
payment_id: r,
|
|
1389
1391
|
payment_method: o,
|
|
1390
|
-
error_message: this._readErrorMessage(
|
|
1391
|
-
}), this._handleAuthorizationError(
|
|
1392
|
+
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1393
|
+
}), this._handleAuthorizationError(e), !1;
|
|
1392
1394
|
} finally {
|
|
1393
1395
|
this._emitLoadingState(!1);
|
|
1394
1396
|
}
|
|
@@ -1403,13 +1405,13 @@ var q = class {
|
|
|
1403
1405
|
}
|
|
1404
1406
|
_handlePaymentResponse(e) {
|
|
1405
1407
|
let t = this._paymentState.paymentId ?? "";
|
|
1406
|
-
return e.latestTransaction.status === "authorized" ? (
|
|
1408
|
+
return e.latestTransaction.status === "authorized" ? (c(a.PAYMENT_AUTHORIZED, {
|
|
1407
1409
|
payment_id: t,
|
|
1408
1410
|
status: e.latestTransaction.status
|
|
1409
|
-
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (
|
|
1411
|
+
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (c(a.PAYMENT_FAILED, {
|
|
1410
1412
|
payment_id: t,
|
|
1411
1413
|
status: e.latestTransaction.status
|
|
1412
|
-
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (
|
|
1414
|
+
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (c(a.PAYMENT_ACTION_REQUIRED, {
|
|
1413
1415
|
payment_id: t,
|
|
1414
1416
|
status: e.status
|
|
1415
1417
|
}), this._callbacks.onActionRequired?.(e.action.redirectUrl), !0);
|
|
@@ -1419,19 +1421,19 @@ var q = class {
|
|
|
1419
1421
|
payment_id: this._paymentState.paymentId ?? "",
|
|
1420
1422
|
payment_method: t
|
|
1421
1423
|
};
|
|
1422
|
-
|
|
1424
|
+
c(a.PAYMENT_SUBMIT_STARTED, n), c(a.PAYMENT_SUBMIT_FAILED, {
|
|
1423
1425
|
...n,
|
|
1424
1426
|
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1425
1427
|
}), this._handleAuthorizationError(e);
|
|
1426
1428
|
}
|
|
1427
1429
|
_handleAuthorizationError(e) {
|
|
1428
|
-
let t = this._readErrorMessage(e,
|
|
1430
|
+
let t = this._readErrorMessage(e, _e);
|
|
1429
1431
|
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1430
1432
|
}
|
|
1431
1433
|
_readErrorMessage(e, t) {
|
|
1432
1434
|
let n = e;
|
|
1433
|
-
return typeof n?.message == "string" && n.message ? n.message :
|
|
1435
|
+
return typeof n?.message == "string" && n.message ? n.message : f(n?.details) ?? t;
|
|
1434
1436
|
}
|
|
1435
1437
|
};
|
|
1436
1438
|
//#endregion
|
|
1437
|
-
export { N as AddressCityElement, F as AddressCountryElement, I as AddressFirstNameElement, L as AddressLastNameElement, R as AddressStateElement, z as AddressStreetElement, B as AddressZipCodeElement, U as ApplePayElement, M as BaseElement, J as CardElement, Y as CardholderElement, X as EmailElement, Z as ErrorElement,
|
|
1439
|
+
export { N as AddressCityElement, F as AddressCountryElement, I as AddressFirstNameElement, L as AddressLastNameElement, R as AddressStateElement, z as AddressStreetElement, B as AddressZipCodeElement, U as ApplePayElement, M as BaseElement, J as CardElement, Y as CardholderElement, X as EmailElement, Z as ErrorElement, xe as OdusElements, Q as PayPalElement, $ as PhoneElement };
|