@odus/checkout 1.12.0 → 1.13.0
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 +160 -141
- package/dist/components/checkout/form/Form.d.ts +7 -0
- package/dist/components/checkout/form/Form.d.ts.map +1 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts +2 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
- package/dist/components/payment-methods/applePay/ApplePayButton.d.ts +1 -0
- package/dist/components/payment-methods/applePay/ApplePayButton.d.ts.map +1 -1
- package/dist/elements/BaseElement.d.ts +8 -0
- package/dist/elements/BaseElement.d.ts.map +1 -1
- package/dist/elements/CardElement.d.ts +10 -3
- package/dist/elements/CardElement.d.ts.map +1 -1
- package/dist/elements/OdusElements.d.ts +8 -0
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements/card/VgsCardAdapter.d.ts +2 -0
- package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
- package/dist/elements.es.js +247 -215
- package/dist/phone.js +8 -14
- package/dist/services/checkout/Checkout.service.d.ts +2 -0
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/services/checkout/CheckoutForm.service.d.ts +2 -0
- package/dist/services/checkout/CheckoutForm.service.d.ts.map +1 -1
- package/dist/services/telemetry/LoadTimer.service.d.ts +28 -0
- package/dist/services/telemetry/LoadTimer.service.d.ts.map +1 -0
- package/dist/services/telemetry/Telemetry.service.d.ts.map +1 -1
- package/dist/shared.js +224 -178
- package/dist/types/telemetry/TelemetryEvents.type.d.ts +35 -0
- package/dist/types/telemetry/TelemetryEvents.type.d.ts.map +1 -1
- package/package.json +2 -2
package/dist/elements.es.js
CHANGED
|
@@ -1,21 +1,34 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { $ as e, C as t, F as n, G as r, H as i, I as a, J as o, K as s, L as c, Q as ee, R as l, S as te, T as ne, U as u, W as re, X as ie, Y as d, Z as f, a as ae, c as oe, d as p, et as m, f as h, g, i as _, n as se, nt as v, o as y, q as b, r as x, rt as S, s as C, t as w, u as T, v as E, w as D, x as ce, y as O, z as k } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var
|
|
3
|
+
var A = ".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}", 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-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}", M = ".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)}", le = ":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}", N = (e) => typeof e == "string" ? e : e instanceof HTMLElement ? e.id ? `#${e.id}` : e.tagName.toLowerCase() : String(e), P = class {
|
|
4
4
|
shadowRoot = null;
|
|
5
5
|
host = null;
|
|
6
6
|
options = {};
|
|
7
7
|
_appliedTheme = {};
|
|
8
|
+
elementName = "BaseElement";
|
|
9
|
+
mountTarget = null;
|
|
8
10
|
listeners = /* @__PURE__ */ new Map();
|
|
9
11
|
get isMounted() {
|
|
10
12
|
return this.host !== null;
|
|
11
13
|
}
|
|
12
|
-
mount(
|
|
14
|
+
mount(t) {
|
|
13
15
|
this.isMounted && this.unmount();
|
|
14
|
-
|
|
15
|
-
|
|
16
|
+
try {
|
|
17
|
+
let e = typeof t == "string" ? document.querySelector(t) : t;
|
|
18
|
+
if (!e) throw Error(`[${this.elementName}] mount target not found: ${String(t)}`);
|
|
19
|
+
this.mountTarget = t, this.attach(e);
|
|
20
|
+
} catch (n) {
|
|
21
|
+
throw this.unmount(), m(d.CHECKOUT_MOUNT_FAILED, {
|
|
22
|
+
container_id: N(t),
|
|
23
|
+
error_message: n instanceof Error ? n.message : "Unknown error"
|
|
24
|
+
}), e(n instanceof Error ? n : /* @__PURE__ */ Error("Failed to mount element"), { container_id: N(t) }), n;
|
|
25
|
+
}
|
|
26
|
+
this.emit("ready");
|
|
27
|
+
}
|
|
28
|
+
attach(e) {
|
|
16
29
|
this.host = document.createElement("div"), this.shadowRoot = this.host.attachShadow({ mode: "open" });
|
|
17
|
-
let
|
|
18
|
-
|
|
30
|
+
let t = document.createElement("style");
|
|
31
|
+
t.textContent = this.getCss(), this.shadowRoot.appendChild(t), e.appendChild(this.host), this.reapplyTheme(), this.render();
|
|
19
32
|
}
|
|
20
33
|
unmount() {
|
|
21
34
|
this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null;
|
|
@@ -64,9 +77,9 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
64
77
|
this.options.callbacks?.[e]?.(t);
|
|
65
78
|
}
|
|
66
79
|
getCss() {
|
|
67
|
-
return
|
|
80
|
+
return le;
|
|
68
81
|
}
|
|
69
|
-
},
|
|
82
|
+
}, F = class extends P {
|
|
70
83
|
_value = "";
|
|
71
84
|
_error = null;
|
|
72
85
|
_input = null;
|
|
@@ -74,7 +87,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
74
87
|
if (!this.shadowRoot) return;
|
|
75
88
|
this._input?.getElement().remove();
|
|
76
89
|
let { t: e } = D();
|
|
77
|
-
this._input = new
|
|
90
|
+
this._input = new h({
|
|
78
91
|
name: "billingAddress.city",
|
|
79
92
|
label: this.options.label ?? e("address.townCity"),
|
|
80
93
|
error: !1,
|
|
@@ -91,9 +104,9 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
91
104
|
}
|
|
92
105
|
getCss() {
|
|
93
106
|
return super.getCss() + [
|
|
94
|
-
A,
|
|
95
107
|
j,
|
|
96
|
-
|
|
108
|
+
M,
|
|
109
|
+
A
|
|
97
110
|
].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
111
|
}
|
|
99
112
|
getValue() {
|
|
@@ -105,7 +118,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
105
118
|
getError() {
|
|
106
119
|
return this._error;
|
|
107
120
|
}
|
|
108
|
-
},
|
|
121
|
+
}, I = ".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}", L = class extends P {
|
|
109
122
|
_value = "";
|
|
110
123
|
_error = null;
|
|
111
124
|
_select = null;
|
|
@@ -117,13 +130,13 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
117
130
|
if (!this.shadowRoot) return;
|
|
118
131
|
this._select?.getElement().remove(), this.options.initialValue && !this._value && (this._value = String(this.options.initialValue), this.emit("change", this._value));
|
|
119
132
|
let { t: e, locale: t } = D();
|
|
120
|
-
this._select = new
|
|
133
|
+
this._select = new p({
|
|
121
134
|
name: "billingAddress.country",
|
|
122
135
|
label: this.options.label ?? e("address.chooseCountry"),
|
|
123
136
|
error: !1,
|
|
124
137
|
placeholder: this.options.placeholder ?? e("address.chooseCountry"),
|
|
125
138
|
value: this._value,
|
|
126
|
-
options:
|
|
139
|
+
options: g(this._allowedCountries, t),
|
|
127
140
|
autocomplete: "country",
|
|
128
141
|
onChange: (e) => {
|
|
129
142
|
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
@@ -135,9 +148,9 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
135
148
|
}
|
|
136
149
|
getCss() {
|
|
137
150
|
return super.getCss() + [
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
151
|
+
M,
|
|
152
|
+
A,
|
|
153
|
+
I
|
|
141
154
|
].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
155
|
}
|
|
143
156
|
getValue() {
|
|
@@ -149,7 +162,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
149
162
|
getError() {
|
|
150
163
|
return this._error;
|
|
151
164
|
}
|
|
152
|
-
},
|
|
165
|
+
}, R = class extends P {
|
|
153
166
|
_value = "";
|
|
154
167
|
_error = null;
|
|
155
168
|
_input = null;
|
|
@@ -157,7 +170,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
157
170
|
if (!this.shadowRoot) return;
|
|
158
171
|
this._input?.getElement().remove();
|
|
159
172
|
let { t: e } = D();
|
|
160
|
-
this._input = new
|
|
173
|
+
this._input = new h({
|
|
161
174
|
name: "billingAddress.firstName",
|
|
162
175
|
label: this.options.label ?? e("address.firstName"),
|
|
163
176
|
error: !1,
|
|
@@ -174,9 +187,9 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
174
187
|
}
|
|
175
188
|
getCss() {
|
|
176
189
|
return super.getCss() + [
|
|
177
|
-
A,
|
|
178
190
|
j,
|
|
179
|
-
|
|
191
|
+
M,
|
|
192
|
+
A
|
|
180
193
|
].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
194
|
}
|
|
182
195
|
getValue() {
|
|
@@ -188,7 +201,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
188
201
|
getError() {
|
|
189
202
|
return this._error;
|
|
190
203
|
}
|
|
191
|
-
},
|
|
204
|
+
}, z = class extends P {
|
|
192
205
|
_value = "";
|
|
193
206
|
_error = null;
|
|
194
207
|
_input = null;
|
|
@@ -196,7 +209,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
196
209
|
if (!this.shadowRoot) return;
|
|
197
210
|
this._input?.getElement().remove();
|
|
198
211
|
let { t: e } = D();
|
|
199
|
-
this._input = new
|
|
212
|
+
this._input = new h({
|
|
200
213
|
name: "billingAddress.lastName",
|
|
201
214
|
label: this.options.label ?? e("address.lastName"),
|
|
202
215
|
error: !1,
|
|
@@ -213,9 +226,9 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
213
226
|
}
|
|
214
227
|
getCss() {
|
|
215
228
|
return super.getCss() + [
|
|
216
|
-
A,
|
|
217
229
|
j,
|
|
218
|
-
|
|
230
|
+
M,
|
|
231
|
+
A
|
|
219
232
|
].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
233
|
}
|
|
221
234
|
getValue() {
|
|
@@ -227,7 +240,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
227
240
|
getError() {
|
|
228
241
|
return this._error;
|
|
229
242
|
}
|
|
230
|
-
},
|
|
243
|
+
}, B = class extends P {
|
|
231
244
|
_value = "";
|
|
232
245
|
_country = "";
|
|
233
246
|
_input = null;
|
|
@@ -237,18 +250,18 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
237
250
|
if (this._country = e, !this.shadowRoot) return;
|
|
238
251
|
let n = l(t), r = l(e);
|
|
239
252
|
if (n && r && t !== e) {
|
|
240
|
-
let { t } = D(), n =
|
|
241
|
-
this._select?.setOptions(
|
|
253
|
+
let { t } = D(), n = k(e), r = t(c(n));
|
|
254
|
+
this._select?.setOptions(a(n), this.options.placeholder ?? r), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
242
255
|
return;
|
|
243
256
|
}
|
|
244
257
|
n !== r && (this._value = "", this.render(), this.emit("change", this._value));
|
|
245
258
|
}
|
|
246
259
|
render() {
|
|
247
|
-
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, l(this._country) ? this._renderSelect(
|
|
260
|
+
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, l(this._country) ? this._renderSelect(k(this._country)) : this._renderInput());
|
|
248
261
|
}
|
|
249
262
|
_renderInput() {
|
|
250
263
|
let { t: e } = D();
|
|
251
|
-
this._input = new
|
|
264
|
+
this._input = new h({
|
|
252
265
|
name: "billingAddress.state",
|
|
253
266
|
label: this.options.label ?? e("address.state"),
|
|
254
267
|
error: !1,
|
|
@@ -264,8 +277,8 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
264
277
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
265
278
|
}
|
|
266
279
|
_renderSelect(e) {
|
|
267
|
-
let { t } = D(), n =
|
|
268
|
-
this._select = new
|
|
280
|
+
let { t } = D(), n = a(e), r = t(c(e));
|
|
281
|
+
this._select = new p({
|
|
269
282
|
name: "billingAddress.state",
|
|
270
283
|
label: this.options.label ?? t("address.state"),
|
|
271
284
|
error: !1,
|
|
@@ -283,10 +296,10 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
283
296
|
}
|
|
284
297
|
getCss() {
|
|
285
298
|
return super.getCss() + [
|
|
286
|
-
A,
|
|
287
299
|
j,
|
|
288
|
-
|
|
289
|
-
|
|
300
|
+
M,
|
|
301
|
+
A,
|
|
302
|
+
I
|
|
290
303
|
].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 ";
|
|
291
304
|
}
|
|
292
305
|
getValue() {
|
|
@@ -300,7 +313,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
300
313
|
let { t: e } = D();
|
|
301
314
|
return e("validation.stateRequired");
|
|
302
315
|
}
|
|
303
|
-
},
|
|
316
|
+
}, V = class extends P {
|
|
304
317
|
_value = "";
|
|
305
318
|
_error = null;
|
|
306
319
|
_input = null;
|
|
@@ -308,7 +321,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
308
321
|
if (!this.shadowRoot) return;
|
|
309
322
|
this._input?.getElement().remove();
|
|
310
323
|
let { t: e } = D();
|
|
311
|
-
this._input = new
|
|
324
|
+
this._input = new h({
|
|
312
325
|
name: "billingAddress.street",
|
|
313
326
|
label: this.options.label ?? e("address.addressLine1"),
|
|
314
327
|
error: !1,
|
|
@@ -330,9 +343,9 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
330
343
|
}
|
|
331
344
|
getCss() {
|
|
332
345
|
return super.getCss() + [
|
|
333
|
-
A,
|
|
334
346
|
j,
|
|
335
|
-
|
|
347
|
+
M,
|
|
348
|
+
A
|
|
336
349
|
].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 ";
|
|
337
350
|
}
|
|
338
351
|
getValue() {
|
|
@@ -344,7 +357,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
344
357
|
getError() {
|
|
345
358
|
return this._error;
|
|
346
359
|
}
|
|
347
|
-
},
|
|
360
|
+
}, H = class extends P {
|
|
348
361
|
_value = "";
|
|
349
362
|
_error = null;
|
|
350
363
|
_input = null;
|
|
@@ -352,7 +365,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
352
365
|
if (!this.shadowRoot) return;
|
|
353
366
|
this._input?.getElement().remove();
|
|
354
367
|
let { t: e } = D();
|
|
355
|
-
this._input = new
|
|
368
|
+
this._input = new h({
|
|
356
369
|
name: "billingAddress.zipCode",
|
|
357
370
|
label: this.options.label ?? e("address.postalCode"),
|
|
358
371
|
error: !1,
|
|
@@ -369,9 +382,9 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
369
382
|
}
|
|
370
383
|
getCss() {
|
|
371
384
|
return super.getCss() + [
|
|
372
|
-
A,
|
|
373
385
|
j,
|
|
374
|
-
|
|
386
|
+
M,
|
|
387
|
+
A
|
|
375
388
|
].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 ";
|
|
376
389
|
}
|
|
377
390
|
getValue() {
|
|
@@ -383,7 +396,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
383
396
|
getError() {
|
|
384
397
|
return this._error;
|
|
385
398
|
}
|
|
386
|
-
},
|
|
399
|
+
}, U = "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)}", W = {
|
|
387
400
|
name: "odus-elements",
|
|
388
401
|
styles: {
|
|
389
402
|
fontSize: 14,
|
|
@@ -407,7 +420,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
407
420
|
}
|
|
408
421
|
},
|
|
409
422
|
additionalPaymentMethods: {}
|
|
410
|
-
},
|
|
423
|
+
}, G = class extends P {
|
|
411
424
|
_paymentContext = null;
|
|
412
425
|
_applePayData = null;
|
|
413
426
|
_authorized = !1;
|
|
@@ -426,16 +439,16 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
426
439
|
return;
|
|
427
440
|
}
|
|
428
441
|
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c } = this._paymentContext;
|
|
429
|
-
if (!
|
|
442
|
+
if (!ae(a, r?.countryCode)) {
|
|
430
443
|
this._setAvailability(!1);
|
|
431
444
|
return;
|
|
432
445
|
}
|
|
433
|
-
if (!
|
|
446
|
+
if (!_()) {
|
|
434
447
|
this._setAvailability(!1);
|
|
435
448
|
return;
|
|
436
449
|
}
|
|
437
450
|
this._button = new x({
|
|
438
|
-
checkoutProfile:
|
|
451
|
+
checkoutProfile: W,
|
|
439
452
|
paymentId: e,
|
|
440
453
|
checkoutKey: t,
|
|
441
454
|
environment: n,
|
|
@@ -455,7 +468,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
455
468
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
456
469
|
}
|
|
457
470
|
getCss() {
|
|
458
|
-
return super.getCss() +
|
|
471
|
+
return super.getCss() + U + "\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 ";
|
|
459
472
|
}
|
|
460
473
|
getValue() {
|
|
461
474
|
return this._applePayData;
|
|
@@ -466,7 +479,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
466
479
|
getError() {
|
|
467
480
|
return null;
|
|
468
481
|
}
|
|
469
|
-
},
|
|
482
|
+
}, ue = ".card-icon{opacity:1;width:18px;transition:opacity .6s ease-in}.card-icon img{max-width:100%;height:auto;display:block}.cards-position{z-index:10;pointer-events:none;align-items:center;gap:8px;display:flex;position:absolute;top:50%;right:12px;transform:translateY(-50%)}.loading{position:relative}.loading:after{content:\"\";border-radius:inherit;background-color:#fff;width:100%;height:100%;position:absolute;inset:0}@media only screen and (min-width:600px){.card-icon{width:20px}}.vgs-card-group iframe,.vgs-wrap iframe{width:100%;min-width:0;display:block}.fake-ph{color:#717173;opacity:.3;font-size:var(--odus-input-font-size,16px);letter-spacing:.02em;font-weight:400;line-height:1.5;font-family:var(--odus-font-family,inherit);pointer-events:none;-webkit-user-select:none;user-select:none;white-space:nowrap;z-index:0;background:#fff;align-items:center;padding:8px 12px;display:flex;position:absolute;inset:0}@keyframes vgs-shimmer{0%{background-position:-200% 0}to{background-position:200% 0}}.vgs-field-skeleton{pointer-events:none;z-index:11;border-radius:inherit;background:linear-gradient(90deg,#f7f7f7 25%,#fdfdfd 50%,#f7f7f7 75%) 0 0/200% 100%;animation:1.5s ease-in-out infinite vgs-shimmer;position:absolute;inset:0}.card-unavailable-message{color:var(--odus-color-error,#dc2727);background:color-mix(in srgb, var(--odus-color-error,#dc2727) 6%, transparent);box-shadow:0 0 0 1px var(--odus-color-error,#dc2727);box-sizing:border-box;padding:12px;line-height:1.4}.card-pending{width:100%;position:relative;overflow:hidden}", K = {
|
|
470
483
|
name: "odus-elements",
|
|
471
484
|
styles: {
|
|
472
485
|
fontSize: 14,
|
|
@@ -490,7 +503,7 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
490
503
|
}
|
|
491
504
|
},
|
|
492
505
|
additionalPaymentMethods: {}
|
|
493
|
-
},
|
|
506
|
+
}, q = {
|
|
494
507
|
"--odus-font-family": "system-ui, sans-serif",
|
|
495
508
|
"--odus-font-size": "16px",
|
|
496
509
|
"--odus-color-error": "#dc2727",
|
|
@@ -514,11 +527,11 @@ var k = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
514
527
|
"--odus-button-height": "48px",
|
|
515
528
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
516
529
|
}["--odus-font-size"];
|
|
517
|
-
function
|
|
530
|
+
function de(e, t) {
|
|
518
531
|
let n = Object.keys(e);
|
|
519
532
|
return n.length === Object.keys(t).length && n.every((n) => e[n] === t[n]);
|
|
520
533
|
}
|
|
521
|
-
var
|
|
534
|
+
var fe = class {
|
|
522
535
|
_vgsService;
|
|
523
536
|
_vgsJwt;
|
|
524
537
|
_vgsState = {};
|
|
@@ -530,8 +543,9 @@ var le = class {
|
|
|
530
543
|
_initGeneration = 0;
|
|
531
544
|
_onInitFailure = null;
|
|
532
545
|
_onFieldsNotReady = null;
|
|
533
|
-
|
|
534
|
-
|
|
546
|
+
_onFieldsReady = null;
|
|
547
|
+
constructor(e, t, n = {}) {
|
|
548
|
+
this._vgsJwt = e, this._environment = t, this._onInitFailure = n.onInitFailure ?? null, this._onFieldsNotReady = n.onFieldsNotReady ?? null, this._onFieldsReady = n.onFieldsReady ?? null, this._vgsService = new s();
|
|
535
549
|
}
|
|
536
550
|
get section() {
|
|
537
551
|
return this._section;
|
|
@@ -539,8 +553,8 @@ var le = class {
|
|
|
539
553
|
renderSection(e, t) {
|
|
540
554
|
this._section?.getElement().remove();
|
|
541
555
|
let { t: n } = D();
|
|
542
|
-
this._section = new
|
|
543
|
-
checkoutProfile:
|
|
556
|
+
this._section = new oe({
|
|
557
|
+
checkoutProfile: K,
|
|
544
558
|
translationFunc: n,
|
|
545
559
|
vgsService: this._vgsService
|
|
546
560
|
}), this._applySkeletonMetrics(), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
|
|
@@ -552,7 +566,7 @@ var le = class {
|
|
|
552
566
|
}
|
|
553
567
|
_onChangeEmit = null;
|
|
554
568
|
initVgs() {
|
|
555
|
-
let e = ++this._initGeneration, t = { ...this._currentTheme }, n =
|
|
569
|
+
let e = ++this._initGeneration, t = { ...this._currentTheme }, n = ce(this._buildProfileFromTheme(t).styles.fontFamily);
|
|
556
570
|
this._vgsService.init(this._environment).then((r) => {
|
|
557
571
|
e === this._initGeneration && (this._vgsService.createForm(r, (e) => this._handleStateChange(e)), this._mountFields(e, t, n).catch((t) => {
|
|
558
572
|
e === this._initGeneration && (console.error("Failed to mount VGS card fields:", t), this._onFieldsNotReady?.());
|
|
@@ -590,7 +604,7 @@ var le = class {
|
|
|
590
604
|
...this._currentTheme,
|
|
591
605
|
...e
|
|
592
606
|
};
|
|
593
|
-
|
|
607
|
+
de(this._currentTheme, t) || (this._currentTheme = t, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme()));
|
|
594
608
|
}
|
|
595
609
|
resetTheme(e) {
|
|
596
610
|
let t = e.filter((e) => e in this._currentTheme);
|
|
@@ -600,23 +614,23 @@ var le = class {
|
|
|
600
614
|
}
|
|
601
615
|
}
|
|
602
616
|
destroy() {
|
|
603
|
-
this._vgsReinitTimer &&= (clearTimeout(this._vgsReinitTimer), null), this._initGeneration += 1, this._onInitFailure = null, this._onFieldsNotReady = null, this._vgsService.destroy(), this._section = null;
|
|
617
|
+
this._vgsReinitTimer &&= (clearTimeout(this._vgsReinitTimer), null), this._initGeneration += 1, this._onInitFailure = null, this._onFieldsNotReady = null, this._onFieldsReady = null, this._vgsService.destroy(), this._section = null;
|
|
604
618
|
}
|
|
605
619
|
_reinitWithTheme() {
|
|
606
620
|
this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
|
|
607
|
-
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new
|
|
621
|
+
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new s(), this._section?.setVgsService(this._vgsService), this.initVgs();
|
|
608
622
|
}, 300);
|
|
609
623
|
}
|
|
610
624
|
_buildProfileFromTheme(e) {
|
|
611
|
-
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ??
|
|
625
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? q, n = e["--odus-font-family"] ?? K.styles.fontFamily, r = e["--odus-color-text"] ?? K.styles.textColor, i = e["--odus-border-radius"] ?? `${K.styles.borderRadius}px`;
|
|
612
626
|
return {
|
|
613
|
-
...
|
|
627
|
+
...K,
|
|
614
628
|
styles: {
|
|
615
|
-
...
|
|
616
|
-
fontSize: parseInt(t, 10) || parseInt(
|
|
629
|
+
...K.styles,
|
|
630
|
+
fontSize: parseInt(t, 10) || parseInt(q, 10),
|
|
617
631
|
fontFamily: n,
|
|
618
632
|
textColor: r,
|
|
619
|
-
borderRadius: parseInt(i, 10) ||
|
|
633
|
+
borderRadius: parseInt(i, 10) || K.styles.borderRadius
|
|
620
634
|
}
|
|
621
635
|
};
|
|
622
636
|
}
|
|
@@ -651,7 +665,7 @@ var le = class {
|
|
|
651
665
|
}, (e) => {
|
|
652
666
|
this._section?.updateVgsCardBrand(e);
|
|
653
667
|
}), this._vgsService.waitForFieldsReady().then(() => {
|
|
654
|
-
this._section?.hideFakePlaceholders();
|
|
668
|
+
e === this._initGeneration && (this._section?.hideFakePlaceholders(), this._onFieldsReady?.());
|
|
655
669
|
}).catch((t) => {
|
|
656
670
|
e === this._initGeneration && (console.error("VGS card fields did not become ready:", t), this._onFieldsNotReady?.());
|
|
657
671
|
});
|
|
@@ -672,14 +686,15 @@ var le = class {
|
|
|
672
686
|
}
|
|
673
687
|
return t;
|
|
674
688
|
}
|
|
675
|
-
},
|
|
689
|
+
}, pe = "Card capture is unavailable: no tokenization session", J = class extends P {
|
|
690
|
+
elementName = "CardElement";
|
|
676
691
|
_environment = "test";
|
|
677
692
|
_captureState = "pending";
|
|
678
|
-
_mountContainer = null;
|
|
679
693
|
_vgsAdapter = null;
|
|
680
694
|
_vgsJwt = null;
|
|
681
695
|
_reportedUnavailable = !1;
|
|
682
|
-
_unavailableReason =
|
|
696
|
+
_unavailableReason = o.NO_TOKENIZATION_SESSION;
|
|
697
|
+
_loadOutcomeListener = null;
|
|
683
698
|
get isVgsMode() {
|
|
684
699
|
return this._captureState === "vgs";
|
|
685
700
|
}
|
|
@@ -689,38 +704,43 @@ var le = class {
|
|
|
689
704
|
setEnvironment(e) {
|
|
690
705
|
this._environment = e;
|
|
691
706
|
}
|
|
707
|
+
setLoadOutcomeListener(e) {
|
|
708
|
+
this._loadOutcomeListener = e;
|
|
709
|
+
}
|
|
692
710
|
setVgsJwt(e) {
|
|
693
711
|
if (this._vgsAdapter && this._vgsJwt === e) return;
|
|
694
712
|
this._captureState = "vgs", this._reportedUnavailable = !1, this._vgsJwt = e, this._vgsAdapter?.destroy();
|
|
695
|
-
let t = new
|
|
713
|
+
let t = new fe(e, this._environment, {
|
|
696
714
|
onInitFailure: () => {
|
|
697
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
715
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(o.INIT_FAILED);
|
|
698
716
|
},
|
|
699
717
|
onFieldsNotReady: () => {
|
|
700
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
718
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(o.FIELDS_NOT_READY);
|
|
719
|
+
},
|
|
720
|
+
onFieldsReady: () => {
|
|
721
|
+
this._vgsAdapter === t && this.isMounted && this._loadOutcomeListener?.({ status: "ready" });
|
|
701
722
|
}
|
|
702
723
|
});
|
|
703
|
-
this._vgsAdapter = t, this.isMounted && this.
|
|
724
|
+
this._vgsAdapter = t, this.isMounted && this.mountTarget && (this.unmount(), this.mount(this.mountTarget));
|
|
704
725
|
}
|
|
705
|
-
markCaptureUnavailable(e =
|
|
726
|
+
markCaptureUnavailable(e = o.NO_TOKENIZATION_SESSION) {
|
|
706
727
|
if (this._captureState === "unavailable") return;
|
|
707
|
-
let t = this.
|
|
728
|
+
let t = this.mountTarget, n = this.isMounted && t !== null;
|
|
708
729
|
this.isMounted && this.unmount(), this._unavailableReason = e, this._captureState = "unavailable", this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, n && t && this.mount(t);
|
|
709
730
|
}
|
|
710
731
|
resetCardCapture() {
|
|
711
732
|
if (this._captureState === "unsupported") return;
|
|
712
|
-
let e = this.
|
|
733
|
+
let e = this.mountTarget, t = this.isMounted && e !== null;
|
|
713
734
|
this.isMounted && this.unmount(), this._captureState = "unsupported", this._reportedUnavailable = !1, this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, t && e && this.mount(e);
|
|
714
735
|
}
|
|
715
|
-
|
|
716
|
-
this.
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
} else super.mount(e);
|
|
736
|
+
attach(e) {
|
|
737
|
+
if (this._captureState !== "vgs") {
|
|
738
|
+
super.attach(e);
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
this.host = document.createElement("div");
|
|
742
|
+
let t = document.createElement("style");
|
|
743
|
+
t.textContent = this.getCss(), this.host.appendChild(t), e.appendChild(this.host), this.reapplyTheme(), Object.keys(this._appliedTheme).length > 0 && this._vgsAdapter?.applyTheme(this._appliedTheme), this.render(), this._vgsAdapter?.initVgs();
|
|
724
744
|
}
|
|
725
745
|
unmount() {
|
|
726
746
|
this._captureState === "vgs" ? (this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null) : super.unmount();
|
|
@@ -749,19 +769,22 @@ var le = class {
|
|
|
749
769
|
this.clearBody();
|
|
750
770
|
let e = document.createElement("div");
|
|
751
771
|
e.className = "card-pending";
|
|
752
|
-
let t =
|
|
753
|
-
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${
|
|
772
|
+
let t = O(E, K.styles.fontSize);
|
|
773
|
+
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${K.styles.borderRadius}px)`;
|
|
754
774
|
let n = document.createElement("div");
|
|
755
775
|
n.className = "vgs-field-skeleton", e.appendChild(n), this.shadowRoot.appendChild(e);
|
|
756
776
|
}
|
|
757
777
|
renderUnavailableNotice() {
|
|
758
778
|
if (!this.shadowRoot) return;
|
|
759
779
|
this.clearBody();
|
|
760
|
-
let { t: e } = D(), t = new
|
|
761
|
-
checkoutProfile:
|
|
780
|
+
let { t: e } = D(), t = new C({
|
|
781
|
+
checkoutProfile: K,
|
|
762
782
|
translationFunc: e
|
|
763
783
|
});
|
|
764
|
-
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0,
|
|
784
|
+
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0, m(d.CARD_CAPTURE_UNAVAILABLE, { reason: this._unavailableReason })), this._loadOutcomeListener?.({
|
|
785
|
+
status: "failed",
|
|
786
|
+
reason: this._unavailableReason
|
|
787
|
+
});
|
|
765
788
|
}
|
|
766
789
|
focus() {
|
|
767
790
|
this._vgsAdapter?.section?.focus();
|
|
@@ -770,7 +793,7 @@ var le = class {
|
|
|
770
793
|
this._vgsAdapter?.section?.focusField(e);
|
|
771
794
|
}
|
|
772
795
|
destroy() {
|
|
773
|
-
this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, this._captureState = "pending", this._reportedUnavailable = !1, super.destroy();
|
|
796
|
+
this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, this._captureState = "pending", this._reportedUnavailable = !1, this._loadOutcomeListener = null, super.destroy();
|
|
774
797
|
}
|
|
775
798
|
setTheme(e) {
|
|
776
799
|
super.setTheme(e), this._captureState === "vgs" && this._vgsAdapter && this._vgsAdapter.applyTheme(e);
|
|
@@ -780,10 +803,10 @@ var le = class {
|
|
|
780
803
|
}
|
|
781
804
|
getCss() {
|
|
782
805
|
return super.getCss() + [
|
|
783
|
-
A,
|
|
784
806
|
j,
|
|
785
|
-
|
|
786
|
-
|
|
807
|
+
M,
|
|
808
|
+
A,
|
|
809
|
+
ue
|
|
787
810
|
].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 ";
|
|
788
811
|
}
|
|
789
812
|
getValue() {
|
|
@@ -794,7 +817,7 @@ var le = class {
|
|
|
794
817
|
};
|
|
795
818
|
}
|
|
796
819
|
async getPayload() {
|
|
797
|
-
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(
|
|
820
|
+
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(pe);
|
|
798
821
|
return this._vgsAdapter.getPayload();
|
|
799
822
|
}
|
|
800
823
|
getIsValid() {
|
|
@@ -803,7 +826,7 @@ var le = class {
|
|
|
803
826
|
getError() {
|
|
804
827
|
return this._captureState === "unavailable" ? D().t("cardUnavailable") : this._vgsAdapter?.getError() ?? null;
|
|
805
828
|
}
|
|
806
|
-
}, Y = class extends
|
|
829
|
+
}, Y = class extends P {
|
|
807
830
|
_value = "";
|
|
808
831
|
_error = null;
|
|
809
832
|
_input = null;
|
|
@@ -811,7 +834,7 @@ var le = class {
|
|
|
811
834
|
if (!this.shadowRoot) return;
|
|
812
835
|
this._input?.getElement().remove();
|
|
813
836
|
let { t: e } = D();
|
|
814
|
-
this._input = new
|
|
837
|
+
this._input = new h({
|
|
815
838
|
name: "billingAddress.cardholderName",
|
|
816
839
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
817
840
|
error: !1,
|
|
@@ -829,9 +852,9 @@ var le = class {
|
|
|
829
852
|
}
|
|
830
853
|
getCss() {
|
|
831
854
|
return super.getCss() + [
|
|
832
|
-
A,
|
|
833
855
|
j,
|
|
834
|
-
|
|
856
|
+
M,
|
|
857
|
+
A
|
|
835
858
|
].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 ";
|
|
836
859
|
}
|
|
837
860
|
getValue() {
|
|
@@ -843,7 +866,7 @@ var le = class {
|
|
|
843
866
|
getError() {
|
|
844
867
|
return this._error;
|
|
845
868
|
}
|
|
846
|
-
},
|
|
869
|
+
}, me = {
|
|
847
870
|
name: "odus-elements",
|
|
848
871
|
styles: {
|
|
849
872
|
fontSize: 14,
|
|
@@ -867,7 +890,7 @@ var le = class {
|
|
|
867
890
|
}
|
|
868
891
|
},
|
|
869
892
|
additionalPaymentMethods: {}
|
|
870
|
-
}, X = class extends
|
|
893
|
+
}, X = class extends P {
|
|
871
894
|
_email = "";
|
|
872
895
|
_error = null;
|
|
873
896
|
_suggestion = null;
|
|
@@ -879,7 +902,7 @@ var le = class {
|
|
|
879
902
|
this._field = new y({
|
|
880
903
|
value: this._email,
|
|
881
904
|
error: !1,
|
|
882
|
-
checkoutProfile:
|
|
905
|
+
checkoutProfile: me,
|
|
883
906
|
translationFunc: e,
|
|
884
907
|
label: this.options.label,
|
|
885
908
|
placeholder: this.options.placeholder,
|
|
@@ -888,23 +911,23 @@ var le = class {
|
|
|
888
911
|
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
912
|
},
|
|
890
913
|
onBlur: () => {
|
|
891
|
-
let e =
|
|
914
|
+
let e = n();
|
|
892
915
|
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
916
|
}
|
|
894
917
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
895
918
|
}
|
|
896
919
|
getCss() {
|
|
897
920
|
return super.getCss() + [
|
|
898
|
-
A,
|
|
899
921
|
j,
|
|
900
|
-
|
|
922
|
+
M,
|
|
923
|
+
A
|
|
901
924
|
].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 ";
|
|
902
925
|
}
|
|
903
926
|
getValue() {
|
|
904
927
|
return this._email;
|
|
905
928
|
}
|
|
906
929
|
getIsValid() {
|
|
907
|
-
return !
|
|
930
|
+
return !n().email(this._email);
|
|
908
931
|
}
|
|
909
932
|
getError() {
|
|
910
933
|
return this._error;
|
|
@@ -912,24 +935,24 @@ var le = class {
|
|
|
912
935
|
get suggestion() {
|
|
913
936
|
return this._suggestion;
|
|
914
937
|
}
|
|
915
|
-
},
|
|
938
|
+
}, he = "@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 P {
|
|
916
939
|
_alert = null;
|
|
917
940
|
_message = null;
|
|
918
941
|
render() {
|
|
919
|
-
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new
|
|
942
|
+
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new w({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
920
943
|
}
|
|
921
944
|
setError(e) {
|
|
922
945
|
if (this._message = e, !this.shadowRoot) {
|
|
923
946
|
this.emit("error", e);
|
|
924
947
|
return;
|
|
925
948
|
}
|
|
926
|
-
this._alert ? this._alert.setMessage(e) : (this._alert = new
|
|
949
|
+
this._alert ? this._alert.setMessage(e) : (this._alert = new w({ message: e }), this.shadowRoot.appendChild(this._alert.getElement())), this.emit("error", e);
|
|
927
950
|
}
|
|
928
951
|
clearError() {
|
|
929
952
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
930
953
|
}
|
|
931
954
|
getCss() {
|
|
932
|
-
return super.getCss() +
|
|
955
|
+
return super.getCss() + he + "\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
956
|
}
|
|
934
957
|
getValue() {
|
|
935
958
|
return null;
|
|
@@ -940,7 +963,7 @@ var le = class {
|
|
|
940
963
|
getError() {
|
|
941
964
|
return this._message;
|
|
942
965
|
}
|
|
943
|
-
},
|
|
966
|
+
}, ge = ".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}", _e = {
|
|
944
967
|
name: "odus-elements",
|
|
945
968
|
styles: {
|
|
946
969
|
fontSize: 14,
|
|
@@ -964,7 +987,7 @@ var le = class {
|
|
|
964
987
|
}
|
|
965
988
|
},
|
|
966
989
|
additionalPaymentMethods: {}
|
|
967
|
-
}, Q = class extends
|
|
990
|
+
}, Q = class extends P {
|
|
968
991
|
_paymentContext = null;
|
|
969
992
|
_button = null;
|
|
970
993
|
setPaymentContext(e) {
|
|
@@ -973,8 +996,8 @@ var le = class {
|
|
|
973
996
|
render() {
|
|
974
997
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
975
998
|
let { onAuthorize: e } = this._paymentContext;
|
|
976
|
-
this._button = new
|
|
977
|
-
checkoutProfile:
|
|
999
|
+
this._button = new se({
|
|
1000
|
+
checkoutProfile: _e,
|
|
978
1001
|
onSubmit: async () => {
|
|
979
1002
|
this._button?.setSubmitting(!0);
|
|
980
1003
|
try {
|
|
@@ -986,7 +1009,7 @@ var le = class {
|
|
|
986
1009
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
987
1010
|
}
|
|
988
1011
|
getCss() {
|
|
989
|
-
return super.getCss() +
|
|
1012
|
+
return super.getCss() + ge + "\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
1013
|
}
|
|
991
1014
|
getValue() {
|
|
992
1015
|
return null;
|
|
@@ -997,7 +1020,7 @@ var le = class {
|
|
|
997
1020
|
getError() {
|
|
998
1021
|
return null;
|
|
999
1022
|
}
|
|
1000
|
-
},
|
|
1023
|
+
}, ve = ".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}", ye = {
|
|
1001
1024
|
name: "odus-elements",
|
|
1002
1025
|
styles: {
|
|
1003
1026
|
fontSize: 14,
|
|
@@ -1021,7 +1044,7 @@ var le = class {
|
|
|
1021
1044
|
}
|
|
1022
1045
|
},
|
|
1023
1046
|
additionalPaymentMethods: {}
|
|
1024
|
-
}, $ = class extends
|
|
1047
|
+
}, $ = class extends P {
|
|
1025
1048
|
_phone = "";
|
|
1026
1049
|
_error = null;
|
|
1027
1050
|
_field = null;
|
|
@@ -1030,13 +1053,13 @@ var le = class {
|
|
|
1030
1053
|
if (!this.shadowRoot) return;
|
|
1031
1054
|
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1032
1055
|
let e = ++this._renderGeneration;
|
|
1033
|
-
|
|
1056
|
+
i().then(({ PhoneNumberField: t }) => {
|
|
1034
1057
|
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1035
1058
|
let { t: r, locale: i } = D();
|
|
1036
|
-
this._field = new
|
|
1059
|
+
this._field = new t({
|
|
1037
1060
|
value: this._phone,
|
|
1038
1061
|
error: !1,
|
|
1039
|
-
checkoutProfile:
|
|
1062
|
+
checkoutProfile: ye,
|
|
1040
1063
|
translationFunc: r,
|
|
1041
1064
|
locale: i,
|
|
1042
1065
|
label: this.options.label,
|
|
@@ -1047,8 +1070,8 @@ var le = class {
|
|
|
1047
1070
|
},
|
|
1048
1071
|
onBlur: () => {
|
|
1049
1072
|
this._phone = this._field?.getValue() ?? "";
|
|
1050
|
-
let e =
|
|
1051
|
-
this._error = e.phoneNumber(this._phone,
|
|
1073
|
+
let e = n(), t = this._field?.getCountry();
|
|
1074
|
+
this._error = e.phoneNumber(this._phone, t) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1052
1075
|
}
|
|
1053
1076
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
1054
1077
|
}).catch((t) => {
|
|
@@ -1057,23 +1080,23 @@ var le = class {
|
|
|
1057
1080
|
}
|
|
1058
1081
|
getCss() {
|
|
1059
1082
|
return super.getCss() + [
|
|
1060
|
-
A,
|
|
1061
1083
|
j,
|
|
1062
|
-
|
|
1063
|
-
|
|
1084
|
+
M,
|
|
1085
|
+
A,
|
|
1086
|
+
ve
|
|
1064
1087
|
].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
1088
|
}
|
|
1066
1089
|
getValue() {
|
|
1067
1090
|
return this._phone;
|
|
1068
1091
|
}
|
|
1069
1092
|
getIsValid() {
|
|
1070
|
-
let e =
|
|
1071
|
-
return !e.phoneNumber(this._phone,
|
|
1093
|
+
let e = n(), t = this._field?.getCountry();
|
|
1094
|
+
return !e.phoneNumber(this._phone, t);
|
|
1072
1095
|
}
|
|
1073
1096
|
getError() {
|
|
1074
1097
|
return this._error;
|
|
1075
1098
|
}
|
|
1076
|
-
},
|
|
1099
|
+
}, be = "Payment failed", xe = "We couldn't securely process your card details. Please check your card information and try again.", Se = "No payment details were entered. Please add your card and try again.", Ce = "This payment is no longer available. Please reload the page and try again.", we = class {
|
|
1077
1100
|
_config;
|
|
1078
1101
|
_apiService;
|
|
1079
1102
|
_changeListeners = [];
|
|
@@ -1083,6 +1106,7 @@ var le = class {
|
|
|
1083
1106
|
_fontCleanup;
|
|
1084
1107
|
_sessionId;
|
|
1085
1108
|
_mountedReported = !1;
|
|
1109
|
+
_loadTimer = new re();
|
|
1086
1110
|
_card;
|
|
1087
1111
|
_email;
|
|
1088
1112
|
_phone;
|
|
@@ -1098,12 +1122,12 @@ var le = class {
|
|
|
1098
1122
|
_paypal;
|
|
1099
1123
|
_error;
|
|
1100
1124
|
elements;
|
|
1101
|
-
constructor(
|
|
1102
|
-
this._config =
|
|
1103
|
-
environment:
|
|
1125
|
+
constructor(e) {
|
|
1126
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), r(), ee({
|
|
1127
|
+
environment: e.environment,
|
|
1104
1128
|
sessionId: this._sessionId,
|
|
1105
1129
|
integration: "elements"
|
|
1106
|
-
}),
|
|
1130
|
+
}), m(d.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && ne.setLocale(e.locale), this._apiService = new t(e.apiKey, e.environment);
|
|
1107
1131
|
let n = {};
|
|
1108
1132
|
Object.defineProperty(n, "email", {
|
|
1109
1133
|
get: () => (this._email || (this._email = new X(), this._trackElement(this._email)), this._email),
|
|
@@ -1112,9 +1136,9 @@ var le = class {
|
|
|
1112
1136
|
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone)), this._phone),
|
|
1113
1137
|
enumerable: !0
|
|
1114
1138
|
});
|
|
1115
|
-
let
|
|
1116
|
-
Object.defineProperty(
|
|
1117
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1139
|
+
let i = {};
|
|
1140
|
+
Object.defineProperty(i, "applePay", {
|
|
1141
|
+
get: () => (this._applePay || (this._applePay = new G(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1118
1142
|
paymentId: this._paymentState.paymentId,
|
|
1119
1143
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1120
1144
|
environment: this._config.environment,
|
|
@@ -1126,7 +1150,7 @@ var le = class {
|
|
|
1126
1150
|
})
|
|
1127
1151
|
})), this._applePay),
|
|
1128
1152
|
enumerable: !0
|
|
1129
|
-
}), Object.defineProperty(
|
|
1153
|
+
}), Object.defineProperty(i, "payPal", {
|
|
1130
1154
|
get: () => (this._paypal || (this._paypal = new Q(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1131
1155
|
paymentId: this._paymentState.paymentId,
|
|
1132
1156
|
checkoutKey: this._paymentState.checkoutKey,
|
|
@@ -1136,81 +1160,86 @@ var le = class {
|
|
|
1136
1160
|
})), this._paypal),
|
|
1137
1161
|
enumerable: !0
|
|
1138
1162
|
});
|
|
1139
|
-
let
|
|
1140
|
-
Object.defineProperty(
|
|
1141
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1163
|
+
let a = {};
|
|
1164
|
+
Object.defineProperty(a, "street", {
|
|
1165
|
+
get: () => (this._addressStreet || (this._addressStreet = new V(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1142
1166
|
enumerable: !0
|
|
1143
|
-
}), Object.defineProperty(
|
|
1144
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1167
|
+
}), Object.defineProperty(a, "firstName", {
|
|
1168
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new R(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1145
1169
|
enumerable: !0
|
|
1146
|
-
}), Object.defineProperty(
|
|
1147
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1170
|
+
}), Object.defineProperty(a, "lastName", {
|
|
1171
|
+
get: () => (this._addressLastName || (this._addressLastName = new z(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1148
1172
|
enumerable: !0
|
|
1149
|
-
}), Object.defineProperty(
|
|
1150
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1173
|
+
}), Object.defineProperty(a, "city", {
|
|
1174
|
+
get: () => (this._addressCity || (this._addressCity = new F(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1151
1175
|
enumerable: !0
|
|
1152
|
-
}), Object.defineProperty(
|
|
1153
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1176
|
+
}), Object.defineProperty(a, "state", {
|
|
1177
|
+
get: () => (this._addressState || (this._addressState = new B(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1154
1178
|
enumerable: !0
|
|
1155
|
-
}), Object.defineProperty(
|
|
1156
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1179
|
+
}), Object.defineProperty(a, "zipCode", {
|
|
1180
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new H(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1157
1181
|
enumerable: !0
|
|
1158
|
-
}), Object.defineProperty(
|
|
1159
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1182
|
+
}), Object.defineProperty(a, "country", {
|
|
1183
|
+
get: () => (this._addressCountry || (this._addressCountry = new L(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1160
1184
|
this._addressState?.setCountry(e);
|
|
1161
1185
|
})), this._addressCountry),
|
|
1162
1186
|
enumerable: !0
|
|
1163
1187
|
});
|
|
1164
1188
|
let o = {
|
|
1165
1189
|
contact: n,
|
|
1166
|
-
express:
|
|
1190
|
+
express: i
|
|
1167
1191
|
};
|
|
1168
1192
|
Object.defineProperty(o, "card", {
|
|
1169
|
-
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this.
|
|
1193
|
+
get: () => (this._card || (this._card = new J(), this._card.setEnvironment(this._config.environment), this._trackElement(this._card), this._card.setLoadOutcomeListener((e) => {
|
|
1194
|
+
this._loadTimer.markMounted(), this._loadTimer.settle(e);
|
|
1195
|
+
}), 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),
|
|
1170
1196
|
enumerable: !0
|
|
1171
1197
|
}), Object.defineProperty(o, "cardholderName", {
|
|
1172
1198
|
get: () => (this._cardholderName || (this._cardholderName = new Y(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1173
1199
|
enumerable: !0
|
|
1174
1200
|
}), Object.defineProperty(o, "address", {
|
|
1175
|
-
get: () =>
|
|
1201
|
+
get: () => a,
|
|
1176
1202
|
enumerable: !0
|
|
1177
1203
|
}), Object.defineProperty(o, "error", {
|
|
1178
1204
|
get: () => (this._error || (this._error = new Z(), this._trackElement(this._error)), this._error),
|
|
1179
1205
|
enumerable: !0
|
|
1180
1206
|
}), this.elements = o;
|
|
1181
1207
|
}
|
|
1182
|
-
async associatePayment(
|
|
1183
|
-
if (!
|
|
1184
|
-
let
|
|
1185
|
-
|
|
1186
|
-
let
|
|
1208
|
+
async associatePayment(t, n) {
|
|
1209
|
+
if (!t || !n) throw Error("paymentId and checkoutKey are required");
|
|
1210
|
+
let r = ++this._associationSequence;
|
|
1211
|
+
b(this._config.environment);
|
|
1212
|
+
let i;
|
|
1187
1213
|
try {
|
|
1188
|
-
|
|
1189
|
-
id:
|
|
1190
|
-
checkoutKey:
|
|
1214
|
+
i = await S({
|
|
1215
|
+
id: t,
|
|
1216
|
+
checkoutKey: n,
|
|
1191
1217
|
environment: this._config.environment
|
|
1192
1218
|
});
|
|
1193
|
-
} catch (
|
|
1194
|
-
throw
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
}),
|
|
1219
|
+
} catch (n) {
|
|
1220
|
+
throw r === this._associationSequence && (this._paymentState = {}, this._loadTimer.settle({
|
|
1221
|
+
status: "failed",
|
|
1222
|
+
reason: ie.ASSOCIATION_FAILED
|
|
1223
|
+
})), m(d.PAYMENT_ASSOCIATION_FAILED, {
|
|
1224
|
+
payment_id: t,
|
|
1225
|
+
error_message: n instanceof Error ? n.message : "Unknown error"
|
|
1226
|
+
}), e(n instanceof Error ? n : Error("Failed to associate payment"), { payment_id: t }), n;
|
|
1198
1227
|
}
|
|
1199
|
-
|
|
1200
|
-
paymentId:
|
|
1201
|
-
checkoutKey:
|
|
1228
|
+
r === this._associationSequence && (this._paymentState = {
|
|
1229
|
+
paymentId: t,
|
|
1230
|
+
checkoutKey: n,
|
|
1202
1231
|
checkoutDetails: {
|
|
1203
|
-
amount:
|
|
1204
|
-
currency:
|
|
1205
|
-
countryCode:
|
|
1232
|
+
amount: i.amount,
|
|
1233
|
+
currency: i.currency,
|
|
1234
|
+
countryCode: i.countryCode
|
|
1206
1235
|
}
|
|
1207
|
-
},
|
|
1208
|
-
payment_id:
|
|
1209
|
-
currency:
|
|
1210
|
-
country_code:
|
|
1211
|
-
}), this._card?.setEnvironment(this._config.environment),
|
|
1212
|
-
paymentId:
|
|
1213
|
-
checkoutKey:
|
|
1236
|
+
}, this._loadTimer.markAssociated(), m(d.PAYMENT_ASSOCIATED, {
|
|
1237
|
+
payment_id: t,
|
|
1238
|
+
currency: i.currency,
|
|
1239
|
+
country_code: i.countryCode
|
|
1240
|
+
}), this._card?.setEnvironment(this._config.environment), i.supportedPaymentMethods?.includes("card") ? i.vgsJwt ? (this._paymentState.vgsJwt = i.vgsJwt, this._paymentState.cardCapture = void 0, this._card?.setVgsJwt(i.vgsJwt)) : (this._paymentState.vgsJwt = void 0, this._paymentState.cardCapture = "unavailable", this._card?.markCaptureUnavailable()) : (this._paymentState.vgsJwt = void 0, this._paymentState.cardCapture = "unsupported", this._card?.resetCardCapture()), this._applePay?.setPaymentContext({
|
|
1241
|
+
paymentId: t,
|
|
1242
|
+
checkoutKey: n,
|
|
1214
1243
|
environment: this._config.environment,
|
|
1215
1244
|
checkoutDetails: this._paymentState.checkoutDetails,
|
|
1216
1245
|
...this._config.additionalPaymentMethods?.applePay,
|
|
@@ -1219,12 +1248,12 @@ var le = class {
|
|
|
1219
1248
|
applePayData: e
|
|
1220
1249
|
})
|
|
1221
1250
|
}), this._paypal?.setPaymentContext({
|
|
1222
|
-
paymentId:
|
|
1223
|
-
checkoutKey:
|
|
1251
|
+
paymentId: t,
|
|
1252
|
+
checkoutKey: n,
|
|
1224
1253
|
onAuthorize: async () => {
|
|
1225
1254
|
await this._executeAuthorization({ formData: null });
|
|
1226
1255
|
}
|
|
1227
|
-
}));
|
|
1256
|
+
}), this._settleLoad());
|
|
1228
1257
|
}
|
|
1229
1258
|
validate() {
|
|
1230
1259
|
let e = {}, { t } = D();
|
|
@@ -1242,16 +1271,16 @@ var le = class {
|
|
|
1242
1271
|
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1243
1272
|
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1244
1273
|
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1245
|
-
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [n?.firstName ?? "", n?.lastName ?? ""].filter(Boolean),
|
|
1274
|
+
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "", i = [n?.firstName ?? "", n?.lastName ?? ""].filter(Boolean), a = r || i.join(" ");
|
|
1246
1275
|
if (!this._card?.isMounted || this._card.captureState === "unsupported") return {
|
|
1247
1276
|
ok: !1,
|
|
1248
1277
|
error: {
|
|
1249
|
-
message:
|
|
1278
|
+
message: Se,
|
|
1250
1279
|
status: 0,
|
|
1251
1280
|
statusText: "No Payment Method"
|
|
1252
1281
|
}
|
|
1253
1282
|
};
|
|
1254
|
-
if (!this._card.isVgsMode) return
|
|
1283
|
+
if (!this._card.isVgsMode) return m(d.CARD_CAPTURE_UNAVAILABLE, { reason: o.NO_TOKENIZATION_SESSION }), {
|
|
1255
1284
|
ok: !1,
|
|
1256
1285
|
error: {
|
|
1257
1286
|
message: D().t("cardUnavailable"),
|
|
@@ -1264,7 +1293,7 @@ var le = class {
|
|
|
1264
1293
|
return {
|
|
1265
1294
|
ok: !0,
|
|
1266
1295
|
formData: {
|
|
1267
|
-
name:
|
|
1296
|
+
name: a,
|
|
1268
1297
|
email: e,
|
|
1269
1298
|
phoneNumber: t || void 0,
|
|
1270
1299
|
billingAddress: n,
|
|
@@ -1275,7 +1304,7 @@ var le = class {
|
|
|
1275
1304
|
return {
|
|
1276
1305
|
ok: !1,
|
|
1277
1306
|
error: {
|
|
1278
|
-
message:
|
|
1307
|
+
message: xe,
|
|
1279
1308
|
status: 0,
|
|
1280
1309
|
statusText: "Card Tokenization Failed"
|
|
1281
1310
|
}
|
|
@@ -1306,7 +1335,7 @@ var le = class {
|
|
|
1306
1335
|
let t = e["--odus-font-family"];
|
|
1307
1336
|
if (t) {
|
|
1308
1337
|
this._fontCleanup?.();
|
|
1309
|
-
let { cleanup: e } =
|
|
1338
|
+
let { cleanup: e } = te({ fontFamily: t });
|
|
1310
1339
|
this._fontCleanup = e;
|
|
1311
1340
|
}
|
|
1312
1341
|
for (let t of this._allElements()) t.setTheme(e);
|
|
@@ -1329,11 +1358,14 @@ var le = class {
|
|
|
1329
1358
|
}
|
|
1330
1359
|
_trackElement(e) {
|
|
1331
1360
|
e.on("ready", () => {
|
|
1332
|
-
this._mountedReported || (this._mountedReported = !0,
|
|
1361
|
+
this._mountedReported || (this._mountedReported = !0, m(d.CHECKOUT_MOUNTED, { container_id: "elements" })), this._loadTimer.markMounted(), this._settleLoad();
|
|
1333
1362
|
}), e.on("change", () => {
|
|
1334
1363
|
for (let e of this._changeListeners) e();
|
|
1335
1364
|
});
|
|
1336
1365
|
}
|
|
1366
|
+
_settleLoad() {
|
|
1367
|
+
this._allElements().some((e) => e.isMounted && (e !== this._card || this._card.captureState !== "unsupported")) && (this._paymentState.cardCapture !== "unsupported" && this._card?.isMounted || this._loadTimer.settle({ status: "ready" }));
|
|
1368
|
+
}
|
|
1337
1369
|
_allElements() {
|
|
1338
1370
|
return [
|
|
1339
1371
|
this._card,
|
|
@@ -1353,19 +1385,19 @@ var le = class {
|
|
|
1353
1385
|
].filter((e) => e !== void 0);
|
|
1354
1386
|
}
|
|
1355
1387
|
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1356
|
-
let { paymentId: r, checkoutKey: i } = this._paymentState,
|
|
1388
|
+
let { paymentId: r, checkoutKey: i } = this._paymentState, a = this._getPaymentMethod(e, t);
|
|
1357
1389
|
if (!r || !i) return this._reportSubmitFailure({
|
|
1358
|
-
message:
|
|
1390
|
+
message: Ce,
|
|
1359
1391
|
status: 0,
|
|
1360
1392
|
statusText: "No Associated Payment"
|
|
1361
|
-
},
|
|
1362
|
-
this._emitLoadingState(!0),
|
|
1393
|
+
}, a), !1;
|
|
1394
|
+
this._emitLoadingState(!0), m(d.PAYMENT_SUBMIT_STARTED, {
|
|
1363
1395
|
payment_id: r,
|
|
1364
|
-
payment_method:
|
|
1396
|
+
payment_method: a
|
|
1365
1397
|
});
|
|
1366
|
-
let
|
|
1398
|
+
let o = performance.now();
|
|
1367
1399
|
try {
|
|
1368
|
-
let
|
|
1400
|
+
let s = await this._apiService.authorizePayment({
|
|
1369
1401
|
paymentId: r,
|
|
1370
1402
|
checkoutKey: i,
|
|
1371
1403
|
formData: e,
|
|
@@ -1373,22 +1405,22 @@ var le = class {
|
|
|
1373
1405
|
applePayData: t,
|
|
1374
1406
|
customCustomerData: n
|
|
1375
1407
|
});
|
|
1376
|
-
return
|
|
1408
|
+
return v(f.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1377
1409
|
payment_id: r,
|
|
1378
|
-
payment_method:
|
|
1410
|
+
payment_method: a,
|
|
1379
1411
|
status: "success"
|
|
1380
|
-
}),
|
|
1412
|
+
}), m(d.PAYMENT_SUBMIT_SUCCESS, {
|
|
1381
1413
|
payment_id: r,
|
|
1382
|
-
payment_method:
|
|
1383
|
-
}), this._handlePaymentResponse(
|
|
1414
|
+
payment_method: a
|
|
1415
|
+
}), this._handlePaymentResponse(s);
|
|
1384
1416
|
} catch (e) {
|
|
1385
|
-
return
|
|
1417
|
+
return v(f.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1386
1418
|
payment_id: r,
|
|
1387
|
-
payment_method:
|
|
1419
|
+
payment_method: a,
|
|
1388
1420
|
status: "failed"
|
|
1389
|
-
}),
|
|
1421
|
+
}), m(d.PAYMENT_SUBMIT_FAILED, {
|
|
1390
1422
|
payment_id: r,
|
|
1391
|
-
payment_method:
|
|
1423
|
+
payment_method: a,
|
|
1392
1424
|
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1393
1425
|
}), this._handleAuthorizationError(e), !1;
|
|
1394
1426
|
} finally {
|
|
@@ -1405,13 +1437,13 @@ var le = class {
|
|
|
1405
1437
|
}
|
|
1406
1438
|
_handlePaymentResponse(e) {
|
|
1407
1439
|
let t = this._paymentState.paymentId ?? "";
|
|
1408
|
-
return e.latestTransaction.status === "authorized" ? (
|
|
1440
|
+
return e.latestTransaction.status === "authorized" ? (m(d.PAYMENT_AUTHORIZED, {
|
|
1409
1441
|
payment_id: t,
|
|
1410
1442
|
status: e.latestTransaction.status
|
|
1411
|
-
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (
|
|
1443
|
+
}), this._callbacks.onPaymentSucceeded?.(e.latestTransaction.status), !0) : e.latestTransaction.status === "failed" ? (m(d.PAYMENT_FAILED, {
|
|
1412
1444
|
payment_id: t,
|
|
1413
1445
|
status: e.latestTransaction.status
|
|
1414
|
-
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (
|
|
1446
|
+
}), this._callbacks.onPaymentFailed?.(e.latestTransaction.status), !1) : e.status === "requires_action" && (m(d.PAYMENT_ACTION_REQUIRED, {
|
|
1415
1447
|
payment_id: t,
|
|
1416
1448
|
status: e.status
|
|
1417
1449
|
}), this._callbacks.onActionRequired?.(e.action.redirectUrl), !0);
|
|
@@ -1421,19 +1453,19 @@ var le = class {
|
|
|
1421
1453
|
payment_id: this._paymentState.paymentId ?? "",
|
|
1422
1454
|
payment_method: t
|
|
1423
1455
|
};
|
|
1424
|
-
|
|
1456
|
+
m(d.PAYMENT_SUBMIT_STARTED, n), m(d.PAYMENT_SUBMIT_FAILED, {
|
|
1425
1457
|
...n,
|
|
1426
1458
|
error_message: this._readErrorMessage(e, "Unknown error")
|
|
1427
1459
|
}), this._handleAuthorizationError(e);
|
|
1428
1460
|
}
|
|
1429
1461
|
_handleAuthorizationError(e) {
|
|
1430
|
-
let t = this._readErrorMessage(e,
|
|
1462
|
+
let t = this._readErrorMessage(e, be);
|
|
1431
1463
|
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1432
1464
|
}
|
|
1433
1465
|
_readErrorMessage(e, t) {
|
|
1434
1466
|
let n = e;
|
|
1435
|
-
return typeof n?.message == "string" && n.message ? n.message :
|
|
1467
|
+
return typeof n?.message == "string" && n.message ? n.message : u(n?.details) ?? t;
|
|
1436
1468
|
}
|
|
1437
1469
|
};
|
|
1438
1470
|
//#endregion
|
|
1439
|
-
export {
|
|
1471
|
+
export { F as AddressCityElement, L as AddressCountryElement, R as AddressFirstNameElement, z as AddressLastNameElement, B as AddressStateElement, V as AddressStreetElement, H as AddressZipCodeElement, G as ApplePayElement, P as BaseElement, J as CardElement, Y as CardholderElement, X as EmailElement, Z as ErrorElement, we as OdusElements, Q as PayPalElement, $ as PhoneElement };
|