@odus/checkout 1.16.1 → 1.17.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/checkout.es.js +136 -136
- package/dist/elements/OdusElements.d.ts.map +1 -1
- package/dist/elements.es.js +217 -217
- package/dist/loader.es.js +87 -0
- package/dist/phone.js +37 -37
- package/dist/services/checkout/Checkout.service.d.ts.map +1 -1
- package/dist/shared.js +3 -3
- package/dist/types/payment/Payment.type.d.ts +2 -1
- package/dist/types/payment/Payment.type.d.ts.map +1 -1
- package/dist/utils/helpers/paymentResult.util.d.ts +12 -0
- package/dist/utils/helpers/paymentResult.util.d.ts.map +1 -0
- package/package.json +6 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as e,
|
|
1
|
+
import { $ as e, B as t, C as n, E as r, G as i, I as a, J as o, K as s, L as c, R as l, S as u, T as d, U as ee, W as te, X as ne, Y as re, Z as f, _ as ie, _t as p, a as ae, b as oe, c as se, ct as m, d as h, et as ce, f as g, ft as _, gt as v, ht as y, i as le, it as b, l as ue, mt as x, n as S, nt as de, o as fe, ot as C, p as w, pt as T, q as E, r as pe, rt as D, s as me, st as he, t as ge, tt as _e, ut as O, vt as ve, w as ye, y as be, yt as k, z as A } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var
|
|
3
|
+
var j = ".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}", M = ".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}", N = ".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)}", P = (e) => "adoptedStyleSheets" in e, xe = (e, t) => {
|
|
4
4
|
let n = (e.nodeType === Node.DOCUMENT_NODE ? e : e.ownerDocument)?.defaultView?.CSSStyleSheet;
|
|
5
5
|
if (!n) return null;
|
|
6
6
|
try {
|
|
@@ -9,9 +9,9 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
9
9
|
} catch {
|
|
10
10
|
return null;
|
|
11
11
|
}
|
|
12
|
-
},
|
|
13
|
-
let r = e.getRootNode(), i =
|
|
14
|
-
if (i &&
|
|
12
|
+
}, F = (e, t, n) => {
|
|
13
|
+
let r = e.getRootNode(), i = P(r) ? xe(r, t) : null;
|
|
14
|
+
if (i && P(r)) try {
|
|
15
15
|
return r.adoptedStyleSheets = [...r.adoptedStyleSheets, i], {
|
|
16
16
|
update: (e) => i.replaceSync(e),
|
|
17
17
|
remove: () => {
|
|
@@ -26,7 +26,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
26
26
|
},
|
|
27
27
|
remove: () => a.remove()
|
|
28
28
|
};
|
|
29
|
-
}, Se = ":host{--odus-font-family:system-ui, sans-serif;--odus-font-size:16px;--odus-color-error:#dc2727;--odus-color-text:#1a1a1a;--odus-color-background:#fff;--odus-border-color:#e0e0e0;--odus-border-radius:6px;--odus-spacing-sm:8px;--odus-spacing-md:16px;--odus-spacing-lg:24px;--odus-input-height:44px;--odus-input-padding:8px 12px;--odus-input-font-size:var(--odus-font-size);--odus-input-font-weight:400;--odus-input-letter-spacing:.02em;--odus-input-line-height:1.5;--odus-input-placeholder-color:#717173;--odus-input-placeholder-opacity:.3;--odus-input-focus-shadow:0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d;--odus-label-font-size:14px;--odus-label-font-weight:400;--odus-label-color:var(--odus-color-text);--odus-label-letter-spacing:normal;--odus-label-line-height:1.4;--odus-label-margin-bottom:6px;--odus-card-gap:12px;--odus-button-height:48px;--odus-button-border-radius:var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{box-shadow:var(--odus-input-focus-shadow,0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d);z-index:2;position:relative}.input-label{font-family:var(--odus-font-family,inherit)!important;font-size:var(--odus-label-font-size,14px)!important;font-weight:var(--odus-label-font-weight,400)!important;color:var(--odus-label-color,var(--odus-color-text,#1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing,normal)!important;line-height:var(--odus-label-line-height,1.4)!important;margin-bottom:var(--odus-label-margin-bottom,6px)!important}.form-helper-text{font-family:var(--odus-font-family,inherit)!important}",
|
|
29
|
+
}, Se = ":host{--odus-font-family:system-ui, sans-serif;--odus-font-size:16px;--odus-color-error:#dc2727;--odus-color-text:#1a1a1a;--odus-color-background:#fff;--odus-border-color:#e0e0e0;--odus-border-radius:6px;--odus-spacing-sm:8px;--odus-spacing-md:16px;--odus-spacing-lg:24px;--odus-input-height:44px;--odus-input-padding:8px 12px;--odus-input-font-size:var(--odus-font-size);--odus-input-font-weight:400;--odus-input-letter-spacing:.02em;--odus-input-line-height:1.5;--odus-input-placeholder-color:#717173;--odus-input-placeholder-opacity:.3;--odus-input-focus-shadow:0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d;--odus-label-font-size:14px;--odus-label-font-weight:400;--odus-label-color:var(--odus-color-text);--odus-label-letter-spacing:normal;--odus-label-line-height:1.4;--odus-label-margin-bottom:6px;--odus-card-gap:12px;--odus-button-height:48px;--odus-button-border-radius:var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{box-shadow:var(--odus-input-focus-shadow,0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d);z-index:2;position:relative}.input-label{font-family:var(--odus-font-family,inherit)!important;font-size:var(--odus-label-font-size,14px)!important;font-weight:var(--odus-label-font-weight,400)!important;color:var(--odus-label-color,var(--odus-color-text,#1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing,normal)!important;line-height:var(--odus-label-line-height,1.4)!important;margin-bottom:var(--odus-label-margin-bottom,6px)!important}.form-helper-text{font-family:var(--odus-font-family,inherit)!important}", I = (e) => typeof e == "string" ? e : e instanceof HTMLElement ? e.id ? `#${e.id}` : e.tagName.toLowerCase() : String(e), L = class {
|
|
30
30
|
shadowRoot = null;
|
|
31
31
|
host = null;
|
|
32
32
|
options = {};
|
|
@@ -50,15 +50,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
50
50
|
if (!n) throw Error(`[${this.elementName}] mount target not found: ${String(e)}`);
|
|
51
51
|
t = !0, this.mountTarget = e, this.attach(n);
|
|
52
52
|
} catch (n) {
|
|
53
|
-
throw this.unmount(),
|
|
54
|
-
container_id:
|
|
53
|
+
throw this.unmount(), b(T.CHECKOUT_MOUNT_FAILED, {
|
|
54
|
+
container_id: I(e),
|
|
55
55
|
error_message: n instanceof Error ? n.message : "Unknown error"
|
|
56
|
-
}),
|
|
56
|
+
}), D(n instanceof Error ? n : /* @__PURE__ */ Error("Failed to mount element"), { container_id: I(e) }), this._mountFailureListener?.(t ? x.MOUNT_FAILED : x.CONTAINER_NOT_FOUND), n;
|
|
57
57
|
}
|
|
58
58
|
this.emit("ready");
|
|
59
59
|
}
|
|
60
60
|
attach(e) {
|
|
61
|
-
this.host = (e.ownerDocument ?? document).createElement("div"), this.shadowRoot = this.host.attachShadow({ mode: "open" }), this.styles =
|
|
61
|
+
this.host = (e.ownerDocument ?? document).createElement("div"), this.shadowRoot = this.host.attachShadow({ mode: "open" }), this.styles = F(this.shadowRoot, this.getCss(), this.shadowRoot), e.appendChild(this.host), this.reapplyTheme(), this.render();
|
|
62
62
|
}
|
|
63
63
|
unmount() {
|
|
64
64
|
this.styles?.remove(), this.styles = null, this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null;
|
|
@@ -106,15 +106,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
106
106
|
getCss() {
|
|
107
107
|
return Se;
|
|
108
108
|
}
|
|
109
|
-
},
|
|
109
|
+
}, R = class extends L {
|
|
110
110
|
_value = "";
|
|
111
111
|
_error = null;
|
|
112
112
|
_input = null;
|
|
113
113
|
render() {
|
|
114
114
|
if (!this.shadowRoot) return;
|
|
115
115
|
this._input?.getElement().remove();
|
|
116
|
-
let { t: e } =
|
|
117
|
-
this._input = new
|
|
116
|
+
let { t: e } = d();
|
|
117
|
+
this._input = new w({
|
|
118
118
|
name: "billingAddress.city",
|
|
119
119
|
label: this.options.label ?? e("address.townCity"),
|
|
120
120
|
error: !1,
|
|
@@ -125,15 +125,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
125
125
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
126
126
|
}
|
|
127
127
|
}), this._input.addEventListener("blur", () => {
|
|
128
|
-
let { t: e } =
|
|
128
|
+
let { t: e } = d();
|
|
129
129
|
this._error = this._value.trim() ? null : e("validation.townCityRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
130
130
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
131
131
|
}
|
|
132
132
|
getCss() {
|
|
133
133
|
return super.getCss() + [
|
|
134
|
-
j,
|
|
135
134
|
M,
|
|
136
|
-
|
|
135
|
+
N,
|
|
136
|
+
j
|
|
137
137
|
].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 ";
|
|
138
138
|
}
|
|
139
139
|
getValue() {
|
|
@@ -145,7 +145,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
145
145
|
getError() {
|
|
146
146
|
return this._error;
|
|
147
147
|
}
|
|
148
|
-
},
|
|
148
|
+
}, z = ".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}", B = class extends L {
|
|
149
149
|
_value = "";
|
|
150
150
|
_error = null;
|
|
151
151
|
_select = null;
|
|
@@ -156,28 +156,28 @@ var A = ".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._select?.getElement().remove(), this.options.initialValue && !this._value && (this._value = String(this.options.initialValue), this.emit("change", this._value));
|
|
159
|
-
let { t: e, locale: t } =
|
|
160
|
-
this._select = new
|
|
159
|
+
let { t: e, locale: t } = d();
|
|
160
|
+
this._select = new g({
|
|
161
161
|
name: "billingAddress.country",
|
|
162
162
|
label: this.options.label ?? e("address.chooseCountry"),
|
|
163
163
|
error: !1,
|
|
164
164
|
placeholder: this.options.placeholder ?? e("address.chooseCountry"),
|
|
165
165
|
value: this._value,
|
|
166
|
-
options:
|
|
166
|
+
options: ie(this._allowedCountries, t),
|
|
167
167
|
autocomplete: "country",
|
|
168
168
|
onChange: (e) => {
|
|
169
169
|
this._value = e.target.value, this._error = null, this.emit("change", this._value);
|
|
170
170
|
}
|
|
171
171
|
}), this._select.addEventListener("blur", () => {
|
|
172
|
-
let { t: e } =
|
|
172
|
+
let { t: e } = d();
|
|
173
173
|
this._error = this._value ? null : e("validation.countryRequired"), this._select?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
174
174
|
}), this.shadowRoot.appendChild(this._select.getElement());
|
|
175
175
|
}
|
|
176
176
|
getCss() {
|
|
177
177
|
return super.getCss() + [
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
178
|
+
N,
|
|
179
|
+
j,
|
|
180
|
+
z
|
|
181
181
|
].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 ";
|
|
182
182
|
}
|
|
183
183
|
getValue() {
|
|
@@ -189,15 +189,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
189
189
|
getError() {
|
|
190
190
|
return this._error;
|
|
191
191
|
}
|
|
192
|
-
},
|
|
192
|
+
}, V = class extends L {
|
|
193
193
|
_value = "";
|
|
194
194
|
_error = null;
|
|
195
195
|
_input = null;
|
|
196
196
|
render() {
|
|
197
197
|
if (!this.shadowRoot) return;
|
|
198
198
|
this._input?.getElement().remove();
|
|
199
|
-
let { t: e } =
|
|
200
|
-
this._input = new
|
|
199
|
+
let { t: e } = d();
|
|
200
|
+
this._input = new w({
|
|
201
201
|
name: "billingAddress.firstName",
|
|
202
202
|
label: this.options.label ?? e("address.firstName"),
|
|
203
203
|
error: !1,
|
|
@@ -208,15 +208,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
208
208
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
209
209
|
}
|
|
210
210
|
}), this._input.addEventListener("blur", () => {
|
|
211
|
-
let { t: e } =
|
|
211
|
+
let { t: e } = d();
|
|
212
212
|
this._error = this._value.trim() ? null : e("validation.firstNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
213
213
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
214
214
|
}
|
|
215
215
|
getCss() {
|
|
216
216
|
return super.getCss() + [
|
|
217
|
-
j,
|
|
218
217
|
M,
|
|
219
|
-
|
|
218
|
+
N,
|
|
219
|
+
j
|
|
220
220
|
].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 ";
|
|
221
221
|
}
|
|
222
222
|
getValue() {
|
|
@@ -228,15 +228,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
228
228
|
getError() {
|
|
229
229
|
return this._error;
|
|
230
230
|
}
|
|
231
|
-
},
|
|
231
|
+
}, H = class extends L {
|
|
232
232
|
_value = "";
|
|
233
233
|
_error = null;
|
|
234
234
|
_input = null;
|
|
235
235
|
render() {
|
|
236
236
|
if (!this.shadowRoot) return;
|
|
237
237
|
this._input?.getElement().remove();
|
|
238
|
-
let { t: e } =
|
|
239
|
-
this._input = new
|
|
238
|
+
let { t: e } = d();
|
|
239
|
+
this._input = new w({
|
|
240
240
|
name: "billingAddress.lastName",
|
|
241
241
|
label: this.options.label ?? e("address.lastName"),
|
|
242
242
|
error: !1,
|
|
@@ -247,15 +247,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
247
247
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
248
248
|
}
|
|
249
249
|
}), this._input.addEventListener("blur", () => {
|
|
250
|
-
let { t: e } =
|
|
250
|
+
let { t: e } = d();
|
|
251
251
|
this._error = this._value.trim() ? null : e("validation.lastNameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
252
252
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
253
253
|
}
|
|
254
254
|
getCss() {
|
|
255
255
|
return super.getCss() + [
|
|
256
|
-
j,
|
|
257
256
|
M,
|
|
258
|
-
|
|
257
|
+
N,
|
|
258
|
+
j
|
|
259
259
|
].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 ";
|
|
260
260
|
}
|
|
261
261
|
getValue() {
|
|
@@ -267,26 +267,26 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
267
267
|
getError() {
|
|
268
268
|
return this._error;
|
|
269
269
|
}
|
|
270
|
-
},
|
|
270
|
+
}, U = class extends L {
|
|
271
271
|
_value = "";
|
|
272
272
|
_country = "";
|
|
273
273
|
_input = null;
|
|
274
274
|
_select = null;
|
|
275
275
|
setCountry(e) {
|
|
276
|
-
let
|
|
276
|
+
let n = this._country;
|
|
277
277
|
if (this._country = e, !this.shadowRoot) return;
|
|
278
|
-
let
|
|
279
|
-
if (
|
|
280
|
-
let { t } =
|
|
281
|
-
this._select?.setOptions(
|
|
282
|
-
} else
|
|
278
|
+
let r = A(n), i = A(e);
|
|
279
|
+
if (r && i && n !== e) {
|
|
280
|
+
let { t: n } = d(), r = t(e), i = n(l(r));
|
|
281
|
+
this._select?.setOptions(c(r), this.options.placeholder ?? i), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
282
|
+
} else r !== i && (this._value = "", this.render(), this.emit("change", this._value));
|
|
283
283
|
}
|
|
284
284
|
render() {
|
|
285
|
-
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null,
|
|
285
|
+
this.shadowRoot && (this._input?.getElement().remove(), this._select?.getElement().remove(), this._input = null, this._select = null, A(this._country) ? this._renderSelect(t(this._country)) : this._renderInput());
|
|
286
286
|
}
|
|
287
287
|
_renderInput() {
|
|
288
|
-
let { t: e } =
|
|
289
|
-
this._input = new
|
|
288
|
+
let { t: e } = d();
|
|
289
|
+
this._input = new w({
|
|
290
290
|
name: "billingAddress.state",
|
|
291
291
|
label: this.options.label ?? e("address.state"),
|
|
292
292
|
error: !1,
|
|
@@ -302,8 +302,8 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
302
302
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
303
303
|
}
|
|
304
304
|
_renderSelect(e) {
|
|
305
|
-
let { t } =
|
|
306
|
-
this._select = new
|
|
305
|
+
let { t } = d(), n = c(e), r = t(l(e));
|
|
306
|
+
this._select = new g({
|
|
307
307
|
name: "billingAddress.state",
|
|
308
308
|
label: this.options.label ?? t("address.state"),
|
|
309
309
|
error: !1,
|
|
@@ -321,10 +321,10 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
321
321
|
}
|
|
322
322
|
getCss() {
|
|
323
323
|
return super.getCss() + [
|
|
324
|
-
j,
|
|
325
324
|
M,
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
N,
|
|
326
|
+
j,
|
|
327
|
+
z
|
|
328
328
|
].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 ";
|
|
329
329
|
}
|
|
330
330
|
getValue() {
|
|
@@ -335,18 +335,18 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
335
335
|
}
|
|
336
336
|
getError() {
|
|
337
337
|
if (this.getIsValid()) return null;
|
|
338
|
-
let { t: e } =
|
|
338
|
+
let { t: e } = d();
|
|
339
339
|
return e("validation.stateRequired");
|
|
340
340
|
}
|
|
341
|
-
},
|
|
341
|
+
}, W = class extends L {
|
|
342
342
|
_value = "";
|
|
343
343
|
_error = null;
|
|
344
344
|
_input = null;
|
|
345
345
|
render() {
|
|
346
346
|
if (!this.shadowRoot) return;
|
|
347
347
|
this._input?.getElement().remove();
|
|
348
|
-
let { t: e } =
|
|
349
|
-
this._input = new
|
|
348
|
+
let { t: e } = d();
|
|
349
|
+
this._input = new w({
|
|
350
350
|
name: "billingAddress.street",
|
|
351
351
|
label: this.options.label ?? e("address.addressLine1"),
|
|
352
352
|
error: !1,
|
|
@@ -362,15 +362,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
362
362
|
this.emit("change", this._value);
|
|
363
363
|
}
|
|
364
364
|
}), this._input.addEventListener("blur", () => {
|
|
365
|
-
let { t: e } =
|
|
365
|
+
let { t: e } = d();
|
|
366
366
|
this._error = this._value.trim() ? null : e("validation.addressLine1Required"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
367
367
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
368
368
|
}
|
|
369
369
|
getCss() {
|
|
370
370
|
return super.getCss() + [
|
|
371
|
-
j,
|
|
372
371
|
M,
|
|
373
|
-
|
|
372
|
+
N,
|
|
373
|
+
j
|
|
374
374
|
].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 ";
|
|
375
375
|
}
|
|
376
376
|
getValue() {
|
|
@@ -382,15 +382,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
382
382
|
getError() {
|
|
383
383
|
return this._error;
|
|
384
384
|
}
|
|
385
|
-
},
|
|
385
|
+
}, G = class extends L {
|
|
386
386
|
_value = "";
|
|
387
387
|
_error = null;
|
|
388
388
|
_input = null;
|
|
389
389
|
render() {
|
|
390
390
|
if (!this.shadowRoot) return;
|
|
391
391
|
this._input?.getElement().remove();
|
|
392
|
-
let { t: e } =
|
|
393
|
-
this._input = new
|
|
392
|
+
let { t: e } = d();
|
|
393
|
+
this._input = new w({
|
|
394
394
|
name: "billingAddress.zipCode",
|
|
395
395
|
label: this.options.label ?? e("address.postalCode"),
|
|
396
396
|
error: !1,
|
|
@@ -401,15 +401,15 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
401
401
|
this._value = e.target.value, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
402
402
|
}
|
|
403
403
|
}), this._input.addEventListener("blur", () => {
|
|
404
|
-
let { t: e } =
|
|
404
|
+
let { t: e } = d();
|
|
405
405
|
this._error = this._value.trim() ? null : e("validation.postalCodeRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
406
406
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
407
407
|
}
|
|
408
408
|
getCss() {
|
|
409
409
|
return super.getCss() + [
|
|
410
|
-
j,
|
|
411
410
|
M,
|
|
412
|
-
|
|
411
|
+
N,
|
|
412
|
+
j
|
|
413
413
|
].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 ";
|
|
414
414
|
}
|
|
415
415
|
getValue() {
|
|
@@ -445,7 +445,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
445
445
|
}
|
|
446
446
|
},
|
|
447
447
|
additionalPaymentMethods: {}
|
|
448
|
-
},
|
|
448
|
+
}, K = class extends L {
|
|
449
449
|
_paymentContext = null;
|
|
450
450
|
_applePayData = null;
|
|
451
451
|
_authorized = !1;
|
|
@@ -464,7 +464,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
464
464
|
return;
|
|
465
465
|
}
|
|
466
466
|
let { paymentId: e, checkoutKey: t, environment: n, checkoutDetails: r, displayName: i, countries: a, requiredBillingContactFields: o, requiredShippingContactFields: s, onAuthorize: c, onStartFailed: l, onPaymentDataFailed: u } = this._paymentContext;
|
|
467
|
-
|
|
467
|
+
fe(a, r?.countryCode) && ae() ? (this._button = new le({
|
|
468
468
|
checkoutProfile: we,
|
|
469
469
|
paymentId: e,
|
|
470
470
|
checkoutKey: t,
|
|
@@ -498,7 +498,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
498
498
|
getError() {
|
|
499
499
|
return null;
|
|
500
500
|
}
|
|
501
|
-
}, Te = ".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}",
|
|
501
|
+
}, Te = ".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}", q = {
|
|
502
502
|
name: "odus-elements",
|
|
503
503
|
styles: {
|
|
504
504
|
fontSize: 14,
|
|
@@ -522,7 +522,7 @@ var A = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
522
522
|
}
|
|
523
523
|
},
|
|
524
524
|
additionalPaymentMethods: {}
|
|
525
|
-
},
|
|
525
|
+
}, J = {
|
|
526
526
|
"--odus-font-family": "system-ui, sans-serif",
|
|
527
527
|
"--odus-font-size": "16px",
|
|
528
528
|
"--odus-color-error": "#dc2727",
|
|
@@ -564,16 +564,16 @@ var De = class {
|
|
|
564
564
|
_onFieldsNotReady = null;
|
|
565
565
|
_onFieldsReady = null;
|
|
566
566
|
constructor(e, t, n = {}) {
|
|
567
|
-
this._vgsJwt = e, this._environment = t, this._onInitFailure = n.onInitFailure ?? null, this._onFieldsNotReady = n.onFieldsNotReady ?? null, this._onFieldsReady = n.onFieldsReady ?? null, this._vgsService = new
|
|
567
|
+
this._vgsJwt = e, this._environment = t, this._onInitFailure = n.onInitFailure ?? null, this._onFieldsNotReady = n.onFieldsNotReady ?? null, this._onFieldsReady = n.onFieldsReady ?? null, this._vgsService = new E();
|
|
568
568
|
}
|
|
569
569
|
get section() {
|
|
570
570
|
return this._section;
|
|
571
571
|
}
|
|
572
572
|
renderSection(e, t) {
|
|
573
573
|
this._section?.getElement().remove();
|
|
574
|
-
let { t: n } =
|
|
575
|
-
this._section = new
|
|
576
|
-
checkoutProfile:
|
|
574
|
+
let { t: n } = d();
|
|
575
|
+
this._section = new ue({
|
|
576
|
+
checkoutProfile: q,
|
|
577
577
|
translationFunc: n,
|
|
578
578
|
vgsService: this._vgsService
|
|
579
579
|
}), this._applySkeletonMetrics(), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
|
|
@@ -585,7 +585,7 @@ var De = class {
|
|
|
585
585
|
}
|
|
586
586
|
_onChangeEmit = null;
|
|
587
587
|
initVgs() {
|
|
588
|
-
let e = ++this._initGeneration, t = { ...this._currentTheme }, n =
|
|
588
|
+
let e = ++this._initGeneration, t = { ...this._currentTheme }, n = u(this._buildProfileFromTheme(t).styles.fontFamily);
|
|
589
589
|
this._vgsService.init(this._environment).then((r) => {
|
|
590
590
|
e === this._initGeneration && (this._vgsService.createForm(r, (e) => this._handleStateChange(e)), this._mountFields(e, t, n).catch((t) => {
|
|
591
591
|
e === this._initGeneration && (console.error("Failed to mount VGS card fields:", t), this._onFieldsNotReady?.());
|
|
@@ -595,25 +595,25 @@ var De = class {
|
|
|
595
595
|
});
|
|
596
596
|
}
|
|
597
597
|
async getPayload() {
|
|
598
|
-
if (!this._vgsJwt) throw
|
|
599
|
-
let
|
|
598
|
+
if (!this._vgsJwt) throw e(/* @__PURE__ */ Error("VGS not initialized"), k.NOT_INITIALIZED);
|
|
599
|
+
let t = await this._vgsService.createCard(this._vgsJwt);
|
|
600
600
|
return {
|
|
601
|
-
cardId:
|
|
602
|
-
expMonth:
|
|
603
|
-
expYear:
|
|
604
|
-
name:
|
|
601
|
+
cardId: t.cardId,
|
|
602
|
+
expMonth: t.expMonth,
|
|
603
|
+
expYear: t.expYear,
|
|
604
|
+
name: t.name
|
|
605
605
|
};
|
|
606
606
|
}
|
|
607
607
|
isValid() {
|
|
608
608
|
return this._vgsFieldsValid;
|
|
609
609
|
}
|
|
610
610
|
getError() {
|
|
611
|
-
let { t: e } =
|
|
611
|
+
let { t: e } = d();
|
|
612
612
|
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
613
613
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
614
614
|
let r = n.errors?.[0];
|
|
615
615
|
if (!r) continue;
|
|
616
|
-
let i =
|
|
616
|
+
let i = h(t, r.code);
|
|
617
617
|
if (i) return e(i);
|
|
618
618
|
}
|
|
619
619
|
return null;
|
|
@@ -637,19 +637,19 @@ var De = class {
|
|
|
637
637
|
}
|
|
638
638
|
_reinitWithTheme() {
|
|
639
639
|
this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
|
|
640
|
-
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new
|
|
640
|
+
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new E(), this._section?.setVgsService(this._vgsService), this.initVgs();
|
|
641
641
|
}, 300);
|
|
642
642
|
}
|
|
643
643
|
_buildProfileFromTheme(e) {
|
|
644
|
-
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ??
|
|
644
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? J, n = e["--odus-font-family"] ?? q.styles.fontFamily, r = e["--odus-color-text"] ?? q.styles.textColor, i = e["--odus-border-radius"] ?? `${q.styles.borderRadius}px`;
|
|
645
645
|
return {
|
|
646
|
-
...
|
|
646
|
+
...q,
|
|
647
647
|
styles: {
|
|
648
|
-
...
|
|
649
|
-
fontSize: parseInt(t, 10) || parseInt(
|
|
648
|
+
...q.styles,
|
|
649
|
+
fontSize: parseInt(t, 10) || parseInt(J, 10),
|
|
650
650
|
fontFamily: n,
|
|
651
651
|
textColor: r,
|
|
652
|
-
borderRadius: parseInt(i, 10) ||
|
|
652
|
+
borderRadius: parseInt(i, 10) || q.styles.borderRadius
|
|
653
653
|
}
|
|
654
654
|
};
|
|
655
655
|
}
|
|
@@ -671,7 +671,7 @@ var De = class {
|
|
|
671
671
|
placeholderColor: t["--odus-input-placeholder-color"],
|
|
672
672
|
placeholderOpacity: t["--odus-input-placeholder-opacity"],
|
|
673
673
|
padding: t["--odus-input-padding"]
|
|
674
|
-
}), { t: c } =
|
|
674
|
+
}), { t: c } = d();
|
|
675
675
|
this._vgsService.mountCardFields({
|
|
676
676
|
cardNumber: a.cardNumber ? `#${a.cardNumber}` : void 0,
|
|
677
677
|
cardExpiry: a.cardExpiry ? `#${a.cardExpiry}` : void 0,
|
|
@@ -691,7 +691,7 @@ var De = class {
|
|
|
691
691
|
}
|
|
692
692
|
_handleStateChange(e) {
|
|
693
693
|
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
694
|
-
let { t } =
|
|
694
|
+
let { t } = d(), n = this._deriveFieldErrors(t);
|
|
695
695
|
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
696
696
|
}
|
|
697
697
|
_deriveFieldErrors(e) {
|
|
@@ -700,19 +700,19 @@ var De = class {
|
|
|
700
700
|
if (!r?.isTouched || r.isFocused || r.isValid) continue;
|
|
701
701
|
let i = r.errors?.[0];
|
|
702
702
|
if (!i) continue;
|
|
703
|
-
let a =
|
|
703
|
+
let a = h(n, i.code);
|
|
704
704
|
a && (t[n] = e(a));
|
|
705
705
|
}
|
|
706
706
|
return t;
|
|
707
707
|
}
|
|
708
|
-
}, Oe = "Card capture is unavailable: no tokenization session",
|
|
708
|
+
}, Oe = "Card capture is unavailable: no tokenization session", Y = class extends L {
|
|
709
709
|
elementName = "CardElement";
|
|
710
710
|
_environment = "test";
|
|
711
711
|
_captureState = "pending";
|
|
712
712
|
_vgsAdapter = null;
|
|
713
713
|
_vgsJwt = null;
|
|
714
714
|
_reportedUnavailable = !1;
|
|
715
|
-
_unavailableReason =
|
|
715
|
+
_unavailableReason = _.NO_TOKENIZATION_SESSION;
|
|
716
716
|
_loadOutcomeListener = null;
|
|
717
717
|
get isVgsMode() {
|
|
718
718
|
return this._captureState === "vgs";
|
|
@@ -731,10 +731,10 @@ var De = class {
|
|
|
731
731
|
this._captureState = "vgs", this._reportedUnavailable = !1, this._vgsJwt = e, this._vgsAdapter?.destroy();
|
|
732
732
|
let t = new De(e, this._environment, {
|
|
733
733
|
onInitFailure: () => {
|
|
734
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
734
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(_.INIT_FAILED);
|
|
735
735
|
},
|
|
736
736
|
onFieldsNotReady: () => {
|
|
737
|
-
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(
|
|
737
|
+
this._vgsAdapter === t && this.isMounted && this.markCaptureUnavailable(_.FIELDS_NOT_READY);
|
|
738
738
|
},
|
|
739
739
|
onFieldsReady: () => {
|
|
740
740
|
this._vgsAdapter === t && this.isMounted && this._loadOutcomeListener?.({ status: "ready" });
|
|
@@ -742,7 +742,7 @@ var De = class {
|
|
|
742
742
|
});
|
|
743
743
|
this._vgsAdapter = t, this.isMounted && this.mountTarget && (this.unmount(), this.mount(this.mountTarget));
|
|
744
744
|
}
|
|
745
|
-
markCaptureUnavailable(e =
|
|
745
|
+
markCaptureUnavailable(e = _.NO_TOKENIZATION_SESSION) {
|
|
746
746
|
if (this._captureState === "unavailable") return;
|
|
747
747
|
let t = this.mountTarget, n = this.isMounted && t !== null;
|
|
748
748
|
this.isMounted && this.unmount(), this._unavailableReason = e, this._captureState = "unavailable", this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, n && t && this.mount(t);
|
|
@@ -753,7 +753,7 @@ var De = class {
|
|
|
753
753
|
this.isMounted && this.unmount(), this._captureState = "unsupported", this._reportedUnavailable = !1, this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, t && e && this.mount(e);
|
|
754
754
|
}
|
|
755
755
|
attach(e) {
|
|
756
|
-
this._captureState === "vgs" ? (this.host = (e.ownerDocument ?? document).createElement("div"), e.appendChild(this.host), this.styles =
|
|
756
|
+
this._captureState === "vgs" ? (this.host = (e.ownerDocument ?? document).createElement("div"), e.appendChild(this.host), this.styles = F(this.host, this.getCss(), this.host), this.reapplyTheme(), Object.keys(this._appliedTheme).length > 0 && this._vgsAdapter?.applyTheme(this._appliedTheme), this.render(), this._vgsAdapter?.initVgs()) : super.attach(e);
|
|
757
757
|
}
|
|
758
758
|
unmount() {
|
|
759
759
|
this._captureState === "vgs" ? (this.styles?.remove(), this.styles = null, this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null) : super.unmount();
|
|
@@ -772,19 +772,19 @@ var De = class {
|
|
|
772
772
|
this.clearBody();
|
|
773
773
|
let e = document.createElement("div");
|
|
774
774
|
e.className = "card-pending";
|
|
775
|
-
let t = be
|
|
776
|
-
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${
|
|
775
|
+
let t = oe(be, q.styles.fontSize);
|
|
776
|
+
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${q.styles.borderRadius}px)`;
|
|
777
777
|
let n = document.createElement("div");
|
|
778
778
|
n.className = "vgs-field-skeleton", e.appendChild(n), this.shadowRoot.appendChild(e);
|
|
779
779
|
}
|
|
780
780
|
renderUnavailableNotice() {
|
|
781
781
|
if (!this.shadowRoot) return;
|
|
782
782
|
this.clearBody();
|
|
783
|
-
let { t: e } =
|
|
784
|
-
checkoutProfile:
|
|
783
|
+
let { t: e } = d(), t = new se({
|
|
784
|
+
checkoutProfile: q,
|
|
785
785
|
translationFunc: e
|
|
786
786
|
});
|
|
787
|
-
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0,
|
|
787
|
+
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0, b(T.CARD_CAPTURE_UNAVAILABLE, { reason: this._unavailableReason })), this._loadOutcomeListener?.({
|
|
788
788
|
status: "failed",
|
|
789
789
|
reason: this._unavailableReason
|
|
790
790
|
});
|
|
@@ -806,9 +806,9 @@ var De = class {
|
|
|
806
806
|
}
|
|
807
807
|
getCss() {
|
|
808
808
|
return super.getCss() + [
|
|
809
|
-
j,
|
|
810
809
|
M,
|
|
811
|
-
|
|
810
|
+
N,
|
|
811
|
+
j,
|
|
812
812
|
Te
|
|
813
813
|
].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 ";
|
|
814
814
|
}
|
|
@@ -827,17 +827,17 @@ var De = class {
|
|
|
827
827
|
return this._captureState === "unsupported" ? !0 : this._vgsAdapter?.isValid() ?? !1;
|
|
828
828
|
}
|
|
829
829
|
getError() {
|
|
830
|
-
return this._captureState === "unavailable" ?
|
|
830
|
+
return this._captureState === "unavailable" ? d().t("cardUnavailable") : this._vgsAdapter?.getError() ?? null;
|
|
831
831
|
}
|
|
832
|
-
},
|
|
832
|
+
}, X = class extends L {
|
|
833
833
|
_value = "";
|
|
834
834
|
_error = null;
|
|
835
835
|
_input = null;
|
|
836
836
|
render() {
|
|
837
837
|
if (!this.shadowRoot) return;
|
|
838
838
|
this._input?.getElement().remove();
|
|
839
|
-
let { t: e } =
|
|
840
|
-
this._input = new
|
|
839
|
+
let { t: e } = d();
|
|
840
|
+
this._input = new w({
|
|
841
841
|
name: "billingAddress.cardholderName",
|
|
842
842
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
843
843
|
error: !1,
|
|
@@ -849,15 +849,15 @@ var De = class {
|
|
|
849
849
|
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
850
850
|
}
|
|
851
851
|
}), this._input.addEventListener("blur", () => {
|
|
852
|
-
let { t: e } =
|
|
852
|
+
let { t: e } = d();
|
|
853
853
|
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
854
854
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
855
855
|
}
|
|
856
856
|
getCss() {
|
|
857
857
|
return super.getCss() + [
|
|
858
|
-
j,
|
|
859
858
|
M,
|
|
860
|
-
|
|
859
|
+
N,
|
|
860
|
+
j
|
|
861
861
|
].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 ";
|
|
862
862
|
}
|
|
863
863
|
getValue() {
|
|
@@ -893,7 +893,7 @@ var De = class {
|
|
|
893
893
|
}
|
|
894
894
|
},
|
|
895
895
|
additionalPaymentMethods: {}
|
|
896
|
-
},
|
|
896
|
+
}, Z = class extends L {
|
|
897
897
|
_email = "";
|
|
898
898
|
_error = null;
|
|
899
899
|
_suggestion = null;
|
|
@@ -901,8 +901,8 @@ var De = class {
|
|
|
901
901
|
render() {
|
|
902
902
|
if (!this.shadowRoot) return;
|
|
903
903
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
904
|
-
let { t: e } =
|
|
905
|
-
this._field = new
|
|
904
|
+
let { t: e } = d();
|
|
905
|
+
this._field = new me({
|
|
906
906
|
value: this._email,
|
|
907
907
|
error: !1,
|
|
908
908
|
checkoutProfile: ke,
|
|
@@ -914,23 +914,23 @@ var De = class {
|
|
|
914
914
|
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);
|
|
915
915
|
},
|
|
916
916
|
onBlur: () => {
|
|
917
|
-
let e =
|
|
917
|
+
let e = a();
|
|
918
918
|
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);
|
|
919
919
|
}
|
|
920
920
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
921
921
|
}
|
|
922
922
|
getCss() {
|
|
923
923
|
return super.getCss() + [
|
|
924
|
-
j,
|
|
925
924
|
M,
|
|
926
|
-
|
|
925
|
+
N,
|
|
926
|
+
j
|
|
927
927
|
].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 ";
|
|
928
928
|
}
|
|
929
929
|
getValue() {
|
|
930
930
|
return this._email;
|
|
931
931
|
}
|
|
932
932
|
getIsValid() {
|
|
933
|
-
return !
|
|
933
|
+
return !a().email(this._email);
|
|
934
934
|
}
|
|
935
935
|
getError() {
|
|
936
936
|
return this._error;
|
|
@@ -938,14 +938,14 @@ var De = class {
|
|
|
938
938
|
get suggestion() {
|
|
939
939
|
return this._suggestion;
|
|
940
940
|
}
|
|
941
|
-
}, Ae = "@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}",
|
|
941
|
+
}, Ae = "@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}", Q = class extends L {
|
|
942
942
|
_alert = null;
|
|
943
943
|
_message = null;
|
|
944
944
|
render() {
|
|
945
|
-
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new
|
|
945
|
+
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new S({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
946
946
|
}
|
|
947
947
|
setError(e) {
|
|
948
|
-
this._message = e, this.shadowRoot && (this._alert ? this._alert.setMessage(e) : (this._alert = new
|
|
948
|
+
this._message = e, this.shadowRoot && (this._alert ? this._alert.setMessage(e) : (this._alert = new S({ message: e }), this.shadowRoot.appendChild(this._alert.getElement()))), this.emit("error", e);
|
|
949
949
|
}
|
|
950
950
|
clearError() {
|
|
951
951
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
@@ -986,7 +986,7 @@ var De = class {
|
|
|
986
986
|
}
|
|
987
987
|
},
|
|
988
988
|
additionalPaymentMethods: {}
|
|
989
|
-
},
|
|
989
|
+
}, $ = class extends L {
|
|
990
990
|
_paymentContext = null;
|
|
991
991
|
_button = null;
|
|
992
992
|
setPaymentContext(e) {
|
|
@@ -995,7 +995,7 @@ var De = class {
|
|
|
995
995
|
render() {
|
|
996
996
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
997
997
|
let { onAuthorize: e } = this._paymentContext;
|
|
998
|
-
this._button = new
|
|
998
|
+
this._button = new pe({
|
|
999
999
|
checkoutProfile: Me,
|
|
1000
1000
|
onSubmit: async () => {
|
|
1001
1001
|
this._button?.setSubmitting(!0);
|
|
@@ -1043,7 +1043,7 @@ var De = class {
|
|
|
1043
1043
|
}
|
|
1044
1044
|
},
|
|
1045
1045
|
additionalPaymentMethods: {}
|
|
1046
|
-
},
|
|
1046
|
+
}, Fe = class extends L {
|
|
1047
1047
|
_phone = "";
|
|
1048
1048
|
_error = null;
|
|
1049
1049
|
_field = null;
|
|
@@ -1059,15 +1059,15 @@ var De = class {
|
|
|
1059
1059
|
if (!this.shadowRoot) return;
|
|
1060
1060
|
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1061
1061
|
let e = ++this._renderGeneration;
|
|
1062
|
-
|
|
1062
|
+
ee().then(({ PhoneNumberField: t }) => {
|
|
1063
1063
|
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1064
|
-
let { t:
|
|
1064
|
+
let { t: n, locale: r } = d();
|
|
1065
1065
|
this._field = new t({
|
|
1066
1066
|
value: this._phone,
|
|
1067
1067
|
error: !1,
|
|
1068
1068
|
checkoutProfile: Pe,
|
|
1069
|
-
translationFunc:
|
|
1070
|
-
locale:
|
|
1069
|
+
translationFunc: n,
|
|
1070
|
+
locale: r,
|
|
1071
1071
|
label: this.options.label,
|
|
1072
1072
|
placeholder: this.options.placeholder,
|
|
1073
1073
|
defaultCountry: this.options.defaultCountry,
|
|
@@ -1076,26 +1076,26 @@ var De = class {
|
|
|
1076
1076
|
},
|
|
1077
1077
|
onBlur: () => {
|
|
1078
1078
|
this._phone = this._field?.getValue() ?? "";
|
|
1079
|
-
let e =
|
|
1079
|
+
let e = a(), t = this._field?.getCountry();
|
|
1080
1080
|
this._error = e.phoneNumber(this._phone, t) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1081
1081
|
}
|
|
1082
1082
|
}), this.shadowRoot.appendChild(this._field.getElement()), this._loadOutcomeListener?.({ status: "ready" });
|
|
1083
1083
|
}).catch((t) => {
|
|
1084
1084
|
this.shadowRoot && this._renderGeneration === e && (console.error("Error creating phone number field:", t), this._loadOutcomeListener?.({
|
|
1085
1085
|
status: "failed",
|
|
1086
|
-
reason:
|
|
1086
|
+
reason: x.FORM_RENDER_FAILED,
|
|
1087
1087
|
attributes: {
|
|
1088
1088
|
form_part: "phone_number",
|
|
1089
|
-
error_class:
|
|
1089
|
+
error_class: _e(t)
|
|
1090
1090
|
}
|
|
1091
1091
|
}));
|
|
1092
1092
|
});
|
|
1093
1093
|
}
|
|
1094
1094
|
getCss() {
|
|
1095
1095
|
return super.getCss() + [
|
|
1096
|
-
j,
|
|
1097
1096
|
M,
|
|
1098
|
-
|
|
1097
|
+
N,
|
|
1098
|
+
j,
|
|
1099
1099
|
Ne
|
|
1100
1100
|
].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 ";
|
|
1101
1101
|
}
|
|
@@ -1103,7 +1103,7 @@ var De = class {
|
|
|
1103
1103
|
return this._phone;
|
|
1104
1104
|
}
|
|
1105
1105
|
getIsValid() {
|
|
1106
|
-
let e =
|
|
1106
|
+
let e = a(), t = this._field?.getCountry();
|
|
1107
1107
|
return !e.phoneNumber(this._phone, t);
|
|
1108
1108
|
}
|
|
1109
1109
|
getError() {
|
|
@@ -1112,7 +1112,7 @@ var De = class {
|
|
|
1112
1112
|
destroy() {
|
|
1113
1113
|
this._loadOutcomeListener = null, super.destroy();
|
|
1114
1114
|
}
|
|
1115
|
-
},
|
|
1115
|
+
}, Ie = "Payment failed", Le = "We couldn't securely process your card details. Please check your card information and try again.", Re = "No payment details were entered. Please add your card and try again.", ze = "This payment is no longer available. Please reload the page and try again.", Be = class {
|
|
1116
1116
|
_config;
|
|
1117
1117
|
_apiService;
|
|
1118
1118
|
_changeListeners = [];
|
|
@@ -1122,7 +1122,7 @@ var De = class {
|
|
|
1122
1122
|
_fontCleanup;
|
|
1123
1123
|
_sessionId;
|
|
1124
1124
|
_mountedReported = !1;
|
|
1125
|
-
_readiness = new
|
|
1125
|
+
_readiness = new i();
|
|
1126
1126
|
_cardFieldsReady = !1;
|
|
1127
1127
|
_card;
|
|
1128
1128
|
_email;
|
|
@@ -1140,17 +1140,17 @@ var De = class {
|
|
|
1140
1140
|
_error;
|
|
1141
1141
|
elements;
|
|
1142
1142
|
constructor(e) {
|
|
1143
|
-
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(),
|
|
1143
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), s(), de({
|
|
1144
1144
|
environment: e.environment,
|
|
1145
1145
|
sessionId: this._sessionId,
|
|
1146
1146
|
integration: "elements"
|
|
1147
|
-
}),
|
|
1148
|
-
let
|
|
1149
|
-
Object.defineProperty(
|
|
1150
|
-
get: () => (this._email || (this._email = new
|
|
1147
|
+
}), b(T.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && r.setLocale(e.locale), this._apiService = new ye(e.apiKey, e.environment);
|
|
1148
|
+
let t = {};
|
|
1149
|
+
Object.defineProperty(t, "email", {
|
|
1150
|
+
get: () => (this._email || (this._email = new Z(), this._trackElement(this._email)), this._email),
|
|
1151
1151
|
enumerable: !0
|
|
1152
|
-
}), Object.defineProperty(
|
|
1153
|
-
get: () => (this._phone || (this._phone = new
|
|
1152
|
+
}), Object.defineProperty(t, "phone", {
|
|
1153
|
+
get: () => (this._phone || (this._phone = new Fe(), this._trackElement(this._phone), this._phone.setLoadOutcomeListener((e) => {
|
|
1154
1154
|
e.status === "ready" ? this._settleLoad() : this._readiness.fail({
|
|
1155
1155
|
reason: e.reason,
|
|
1156
1156
|
attributes: e.attributes
|
|
@@ -1158,9 +1158,9 @@ var De = class {
|
|
|
1158
1158
|
})), this._phone),
|
|
1159
1159
|
enumerable: !0
|
|
1160
1160
|
});
|
|
1161
|
-
let
|
|
1162
|
-
Object.defineProperty(
|
|
1163
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1161
|
+
let n = {};
|
|
1162
|
+
Object.defineProperty(n, "applePay", {
|
|
1163
|
+
get: () => (this._applePay || (this._applePay = new K(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1164
1164
|
paymentId: this._paymentState.paymentId,
|
|
1165
1165
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1166
1166
|
environment: this._config.environment,
|
|
@@ -1174,8 +1174,8 @@ var De = class {
|
|
|
1174
1174
|
onPaymentDataFailed: this._onApplePayPaymentDataFailed
|
|
1175
1175
|
})), this._applePay),
|
|
1176
1176
|
enumerable: !0
|
|
1177
|
-
}), Object.defineProperty(
|
|
1178
|
-
get: () => (this._paypal || (this._paypal = new
|
|
1177
|
+
}), Object.defineProperty(n, "payPal", {
|
|
1178
|
+
get: () => (this._paypal || (this._paypal = new $(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1179
1179
|
paymentId: this._paymentState.paymentId,
|
|
1180
1180
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1181
1181
|
onAuthorize: async () => {
|
|
@@ -1184,60 +1184,60 @@ var De = class {
|
|
|
1184
1184
|
})), this._paypal),
|
|
1185
1185
|
enumerable: !0
|
|
1186
1186
|
});
|
|
1187
|
-
let
|
|
1188
|
-
Object.defineProperty(
|
|
1189
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1187
|
+
let i = {};
|
|
1188
|
+
Object.defineProperty(i, "street", {
|
|
1189
|
+
get: () => (this._addressStreet || (this._addressStreet = new W(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1190
1190
|
enumerable: !0
|
|
1191
|
-
}), Object.defineProperty(
|
|
1192
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1191
|
+
}), Object.defineProperty(i, "firstName", {
|
|
1192
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new V(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1193
1193
|
enumerable: !0
|
|
1194
|
-
}), Object.defineProperty(
|
|
1195
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1194
|
+
}), Object.defineProperty(i, "lastName", {
|
|
1195
|
+
get: () => (this._addressLastName || (this._addressLastName = new H(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1196
1196
|
enumerable: !0
|
|
1197
|
-
}), Object.defineProperty(
|
|
1198
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1197
|
+
}), Object.defineProperty(i, "city", {
|
|
1198
|
+
get: () => (this._addressCity || (this._addressCity = new R(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1199
1199
|
enumerable: !0
|
|
1200
|
-
}), Object.defineProperty(
|
|
1201
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1200
|
+
}), Object.defineProperty(i, "state", {
|
|
1201
|
+
get: () => (this._addressState || (this._addressState = new U(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1202
1202
|
enumerable: !0
|
|
1203
|
-
}), Object.defineProperty(
|
|
1204
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1203
|
+
}), Object.defineProperty(i, "zipCode", {
|
|
1204
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new G(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1205
1205
|
enumerable: !0
|
|
1206
|
-
}), Object.defineProperty(
|
|
1207
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1206
|
+
}), Object.defineProperty(i, "country", {
|
|
1207
|
+
get: () => (this._addressCountry || (this._addressCountry = new B(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1208
1208
|
this._addressState?.setCountry(e);
|
|
1209
1209
|
})), this._addressCountry),
|
|
1210
1210
|
enumerable: !0
|
|
1211
1211
|
});
|
|
1212
|
-
let
|
|
1213
|
-
contact:
|
|
1214
|
-
express:
|
|
1212
|
+
let a = {
|
|
1213
|
+
contact: t,
|
|
1214
|
+
express: n
|
|
1215
1215
|
};
|
|
1216
|
-
Object.defineProperty(
|
|
1217
|
-
get: () => (this._card || (this._card = new
|
|
1216
|
+
Object.defineProperty(a, "card", {
|
|
1217
|
+
get: () => (this._card || (this._card = new Y(), this._card.setEnvironment(this._config.environment), this._card.on("ready", () => {
|
|
1218
1218
|
this._cardFieldsReady = !1;
|
|
1219
1219
|
}), this._trackElement(this._card), this._card.setLoadOutcomeListener((e) => {
|
|
1220
1220
|
this._readiness.markMounted(), e.status === "ready" ? (this._cardFieldsReady = !0, this._settleLoad()) : this._readiness.settle(e);
|
|
1221
1221
|
}), 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),
|
|
1222
1222
|
enumerable: !0
|
|
1223
|
-
}), Object.defineProperty(
|
|
1224
|
-
get: () => (this._cardholderName || (this._cardholderName = new
|
|
1223
|
+
}), Object.defineProperty(a, "cardholderName", {
|
|
1224
|
+
get: () => (this._cardholderName || (this._cardholderName = new X(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1225
1225
|
enumerable: !0
|
|
1226
|
-
}), Object.defineProperty(
|
|
1227
|
-
get: () =>
|
|
1226
|
+
}), Object.defineProperty(a, "address", {
|
|
1227
|
+
get: () => i,
|
|
1228
1228
|
enumerable: !0
|
|
1229
|
-
}), Object.defineProperty(
|
|
1230
|
-
get: () => (this._error || (this._error = new
|
|
1229
|
+
}), Object.defineProperty(a, "error", {
|
|
1230
|
+
get: () => (this._error || (this._error = new Q(), this._trackElement(this._error)), this._error),
|
|
1231
1231
|
enumerable: !0
|
|
1232
|
-
}), this.elements =
|
|
1232
|
+
}), this.elements = a;
|
|
1233
1233
|
}
|
|
1234
1234
|
async associatePayment(e, t) {
|
|
1235
1235
|
if (!e || !t) throw Error("paymentId and checkoutKey are required");
|
|
1236
1236
|
let n = ++this._associationSequence;
|
|
1237
|
-
this._readiness.start(e),
|
|
1237
|
+
this._readiness.start(e), o(this._config.environment);
|
|
1238
1238
|
let r;
|
|
1239
1239
|
try {
|
|
1240
|
-
r = await
|
|
1240
|
+
r = await he({
|
|
1241
1241
|
id: e,
|
|
1242
1242
|
checkoutKey: t,
|
|
1243
1243
|
environment: this._config.environment
|
|
@@ -1245,15 +1245,15 @@ var De = class {
|
|
|
1245
1245
|
} catch (t) {
|
|
1246
1246
|
if (n === this._associationSequence) {
|
|
1247
1247
|
this._paymentState = {};
|
|
1248
|
-
let { ours: e, ...n } =
|
|
1248
|
+
let { ours: e, ...n } = ne(t, p.CHECKOUT_DETAILS);
|
|
1249
1249
|
e ? this._readiness.fail(n) : this._readiness.exclude(n);
|
|
1250
1250
|
}
|
|
1251
|
-
throw
|
|
1251
|
+
throw b(T.PAYMENT_ASSOCIATION_FAILED, {
|
|
1252
1252
|
payment_id: e,
|
|
1253
1253
|
error_message: t instanceof Error ? t.message : "Unknown error",
|
|
1254
|
-
stage:
|
|
1255
|
-
...
|
|
1256
|
-
}),
|
|
1254
|
+
stage: p.CHECKOUT_DETAILS,
|
|
1255
|
+
...m(t)
|
|
1256
|
+
}), D(t instanceof Error ? t : Error("Failed to associate payment"), { payment_id: e }), t;
|
|
1257
1257
|
}
|
|
1258
1258
|
n === this._associationSequence && (this._paymentState = {
|
|
1259
1259
|
paymentId: e,
|
|
@@ -1263,7 +1263,7 @@ var De = class {
|
|
|
1263
1263
|
currency: r.currency,
|
|
1264
1264
|
countryCode: r.countryCode
|
|
1265
1265
|
}
|
|
1266
|
-
}, this._readiness.markAssociated(),
|
|
1266
|
+
}, this._readiness.markAssociated(), b(T.PAYMENT_ASSOCIATED, {
|
|
1267
1267
|
payment_id: e,
|
|
1268
1268
|
currency: r.currency,
|
|
1269
1269
|
country_code: r.countryCode
|
|
@@ -1288,7 +1288,7 @@ var De = class {
|
|
|
1288
1288
|
}), this._settleLoad());
|
|
1289
1289
|
}
|
|
1290
1290
|
validate() {
|
|
1291
|
-
let e = {}, { t } =
|
|
1291
|
+
let e = {}, { t } = d();
|
|
1292
1292
|
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"), {
|
|
1293
1293
|
valid: Object.keys(e).length === 0,
|
|
1294
1294
|
errors: e
|
|
@@ -1307,20 +1307,20 @@ var De = class {
|
|
|
1307
1307
|
if (!this._card?.isMounted || this._card.captureState === "unsupported") return {
|
|
1308
1308
|
ok: !1,
|
|
1309
1309
|
error: {
|
|
1310
|
-
message:
|
|
1310
|
+
message: Re,
|
|
1311
1311
|
status: 0,
|
|
1312
1312
|
statusText: "No Payment Method",
|
|
1313
1313
|
failureClass: v.NOT_SENT
|
|
1314
1314
|
}
|
|
1315
1315
|
};
|
|
1316
|
-
if (!this._card.isVgsMode) return
|
|
1316
|
+
if (!this._card.isVgsMode) return b(T.CARD_CAPTURE_UNAVAILABLE, { reason: _.NO_TOKENIZATION_SESSION }), {
|
|
1317
1317
|
ok: !1,
|
|
1318
|
-
error:
|
|
1319
|
-
message:
|
|
1318
|
+
error: e({
|
|
1319
|
+
message: d().t("cardUnavailable"),
|
|
1320
1320
|
status: 0,
|
|
1321
1321
|
statusText: "Card Capture Unavailable",
|
|
1322
1322
|
failureClass: v.NOT_SENT
|
|
1323
|
-
},
|
|
1323
|
+
}, k.CAPTURE_UNAVAILABLE)
|
|
1324
1324
|
};
|
|
1325
1325
|
try {
|
|
1326
1326
|
let e = await this._card.getPayload();
|
|
@@ -1337,12 +1337,12 @@ var De = class {
|
|
|
1337
1337
|
} catch (t) {
|
|
1338
1338
|
return {
|
|
1339
1339
|
ok: !1,
|
|
1340
|
-
error:
|
|
1341
|
-
message:
|
|
1340
|
+
error: e({
|
|
1341
|
+
message: Le,
|
|
1342
1342
|
status: 0,
|
|
1343
1343
|
statusText: "Card Tokenization Failed",
|
|
1344
1344
|
failureClass: v.NOT_SENT
|
|
1345
|
-
},
|
|
1345
|
+
}, ce(t) ?? k.SDK_ERROR)
|
|
1346
1346
|
};
|
|
1347
1347
|
}
|
|
1348
1348
|
}
|
|
@@ -1366,7 +1366,7 @@ var De = class {
|
|
|
1366
1366
|
let t = e["--odus-font-family"];
|
|
1367
1367
|
if (t) {
|
|
1368
1368
|
this._fontCleanup?.();
|
|
1369
|
-
let { cleanup: e } =
|
|
1369
|
+
let { cleanup: e } = n({ fontFamily: t });
|
|
1370
1370
|
this._fontCleanup = e;
|
|
1371
1371
|
}
|
|
1372
1372
|
for (let t of this._allElements()) t.setTheme(e);
|
|
@@ -1387,13 +1387,13 @@ var De = class {
|
|
|
1387
1387
|
setCallbacks(e) {
|
|
1388
1388
|
Object.assign(this._callbacks, e);
|
|
1389
1389
|
}
|
|
1390
|
-
_onApplePayStartFailed = (e) => this._readiness.reportSubmit(
|
|
1390
|
+
_onApplePayStartFailed = (e) => this._readiness.reportSubmit(re(e));
|
|
1391
1391
|
_onApplePayPaymentDataFailed = (e) => this._readiness.reportSubmit(e);
|
|
1392
1392
|
_trackElement(e) {
|
|
1393
1393
|
e.setMountFailureListener((e) => {
|
|
1394
|
-
e ===
|
|
1394
|
+
e === x.MOUNT_FAILED ? this._readiness.fail({ reason: e }) : this._readiness.exclude({ reason: e });
|
|
1395
1395
|
}), e.on("ready", () => {
|
|
1396
|
-
this._mountedReported || (this._mountedReported = !0,
|
|
1396
|
+
this._mountedReported || (this._mountedReported = !0, b(T.CHECKOUT_MOUNTED, { container_id: "elements" })), this._readiness.markMounted(), this._settleLoad();
|
|
1397
1397
|
}), e.on("change", () => {
|
|
1398
1398
|
for (let e of this._changeListeners) e();
|
|
1399
1399
|
});
|
|
@@ -1422,12 +1422,12 @@ var De = class {
|
|
|
1422
1422
|
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1423
1423
|
let { paymentId: r, checkoutKey: i } = this._paymentState, a = this._getPaymentMethod(e, t);
|
|
1424
1424
|
if (!r || !i) return this._reportSubmitFailure({
|
|
1425
|
-
message:
|
|
1425
|
+
message: ze,
|
|
1426
1426
|
status: 0,
|
|
1427
1427
|
statusText: "No Associated Payment",
|
|
1428
1428
|
failureClass: v.NOT_SENT
|
|
1429
1429
|
}, a), !1;
|
|
1430
|
-
this._emitLoadingState(!0),
|
|
1430
|
+
this._emitLoadingState(!0), b(T.PAYMENT_SUBMIT_STARTED, {
|
|
1431
1431
|
payment_id: r,
|
|
1432
1432
|
payment_method: a
|
|
1433
1433
|
});
|
|
@@ -1442,27 +1442,27 @@ var De = class {
|
|
|
1442
1442
|
customCustomerData: n
|
|
1443
1443
|
});
|
|
1444
1444
|
return this._readiness.reportSubmit({
|
|
1445
|
-
outcome:
|
|
1445
|
+
outcome: ve.SUCCEEDED,
|
|
1446
1446
|
paymentMethod: a
|
|
1447
|
-
}),
|
|
1447
|
+
}), C(y.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1448
1448
|
payment_id: r,
|
|
1449
1449
|
payment_method: a,
|
|
1450
1450
|
status: "success"
|
|
1451
|
-
}),
|
|
1451
|
+
}), b(T.PAYMENT_SUBMIT_SUCCESS, {
|
|
1452
1452
|
payment_id: r,
|
|
1453
1453
|
payment_method: a
|
|
1454
1454
|
}), this._handlePaymentResponse(s);
|
|
1455
1455
|
} catch (e) {
|
|
1456
|
-
return
|
|
1456
|
+
return C(y.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1457
1457
|
payment_id: r,
|
|
1458
1458
|
payment_method: a,
|
|
1459
1459
|
status: "failed"
|
|
1460
|
-
}),
|
|
1460
|
+
}), b(T.PAYMENT_SUBMIT_FAILED, {
|
|
1461
1461
|
payment_id: r,
|
|
1462
1462
|
payment_method: a,
|
|
1463
1463
|
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1464
|
-
...
|
|
1465
|
-
}), this._readiness.reportSubmit(
|
|
1464
|
+
...m(e)
|
|
1465
|
+
}), this._readiness.reportSubmit(f(e, a)), this._handleAuthorizationError(e), !1;
|
|
1466
1466
|
} finally {
|
|
1467
1467
|
this._emitLoadingState(!1);
|
|
1468
1468
|
}
|
|
@@ -1476,37 +1476,37 @@ var De = class {
|
|
|
1476
1476
|
} catch {}
|
|
1477
1477
|
}
|
|
1478
1478
|
_handlePaymentResponse(e) {
|
|
1479
|
-
let t = this._paymentState.paymentId ?? "";
|
|
1480
|
-
return
|
|
1479
|
+
let t = this._paymentState.paymentId ?? "", n = ge(e);
|
|
1480
|
+
return n === "authorized" ? (b(T.PAYMENT_AUTHORIZED, {
|
|
1481
1481
|
payment_id: t,
|
|
1482
|
-
status:
|
|
1483
|
-
}),
|
|
1482
|
+
status: n
|
|
1483
|
+
}), O(() => this._callbacks.onPaymentSucceeded?.(n)), !0) : n === "failed" ? (b(T.PAYMENT_FAILED, {
|
|
1484
1484
|
payment_id: t,
|
|
1485
|
-
status:
|
|
1486
|
-
}),
|
|
1485
|
+
status: n
|
|
1486
|
+
}), O(() => this._callbacks.onPaymentFailed?.(n)), !1) : e.status === "requires_action" && (b(T.PAYMENT_ACTION_REQUIRED, {
|
|
1487
1487
|
payment_id: t,
|
|
1488
1488
|
status: e.status
|
|
1489
|
-
}),
|
|
1489
|
+
}), O(() => this._callbacks.onActionRequired?.(e.action.redirectUrl)), !0);
|
|
1490
1490
|
}
|
|
1491
1491
|
_reportSubmitFailure(e, t) {
|
|
1492
1492
|
let n = {
|
|
1493
1493
|
payment_id: this._paymentState.paymentId ?? "",
|
|
1494
1494
|
payment_method: t
|
|
1495
1495
|
};
|
|
1496
|
-
|
|
1496
|
+
b(T.PAYMENT_SUBMIT_STARTED, n), b(T.PAYMENT_SUBMIT_FAILED, {
|
|
1497
1497
|
...n,
|
|
1498
1498
|
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1499
|
-
...
|
|
1500
|
-
}), this._readiness.reportSubmit(
|
|
1499
|
+
...m(e)
|
|
1500
|
+
}), this._readiness.reportSubmit(f(e, t)), this._handleAuthorizationError(e);
|
|
1501
1501
|
}
|
|
1502
1502
|
_handleAuthorizationError(e) {
|
|
1503
|
-
let t = this._readErrorMessage(e,
|
|
1503
|
+
let t = this._readErrorMessage(e, Ie);
|
|
1504
1504
|
this._callbacks.onPaymentFailed?.(t), this._error?.isMounted && this._error.setError(t);
|
|
1505
1505
|
}
|
|
1506
1506
|
_readErrorMessage(e, t) {
|
|
1507
1507
|
let n = e;
|
|
1508
|
-
return typeof n?.message == "string" && n.message ? n.message :
|
|
1508
|
+
return typeof n?.message == "string" && n.message ? n.message : te(n?.details) ?? t;
|
|
1509
1509
|
}
|
|
1510
1510
|
};
|
|
1511
1511
|
//#endregion
|
|
1512
|
-
export {
|
|
1512
|
+
export { R as AddressCityElement, B as AddressCountryElement, V as AddressFirstNameElement, H as AddressLastNameElement, U as AddressStateElement, W as AddressStreetElement, G as AddressZipCodeElement, K as ApplePayElement, L as BaseElement, Y as CardElement, X as CardholderElement, Z as EmailElement, Q as ErrorElement, Be as OdusElements, $ as PayPalElement, Fe as PhoneElement };
|