@odus/checkout 1.18.0 → 1.19.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 +241 -231
- package/dist/components/checkout/form/AddressSection.d.ts.map +1 -1
- package/dist/components/checkout/form/CardSection.d.ts.map +1 -1
- package/dist/components/checkout/form/CardUnavailableNotice.d.ts.map +1 -1
- package/dist/components/checkout/form/CardholderSection.d.ts.map +1 -1
- package/dist/components/checkout/form/Form.d.ts.map +1 -1
- package/dist/components/checkout/form/FormComponentManager.d.ts.map +1 -1
- package/dist/components/checkout/form/PhoneCountrySelector.d.ts.map +1 -1
- package/dist/components/checkout/form/PhoneNumberField.d.ts.map +1 -1
- package/dist/components/common/CountryDialCodeDropdown.d.ts.map +1 -1
- package/dist/components/common/Input.d.ts.map +1 -1
- package/dist/components/common/Select.d.ts.map +1 -1
- package/dist/core/constants/fontSize.constants.d.ts +7 -0
- package/dist/core/constants/fontSize.constants.d.ts.map +1 -0
- package/dist/core/vgs/VGSCollectService.d.ts +0 -7
- package/dist/core/vgs/VGSCollectService.d.ts.map +1 -1
- package/dist/elements/ApplePayElement.d.ts.map +1 -1
- package/dist/elements/EmailElement.d.ts.map +1 -1
- package/dist/elements/PayPalElement.d.ts.map +1 -1
- package/dist/elements/PhoneElement.d.ts.map +1 -1
- package/dist/elements/card/VgsCardAdapter.d.ts.map +1 -1
- package/dist/elements/cardElement.constants.d.ts.map +1 -1
- package/dist/elements/theme/index.d.ts.map +1 -1
- package/dist/elements.es.js +267 -267
- package/dist/factories/createCheckoutProfile.d.ts.map +1 -1
- package/dist/loader.es.js +1 -1
- package/dist/phone.js +477 -474
- package/dist/shared.js +79 -110
- package/dist/types/common/FormData.type.d.ts +0 -2
- package/dist/types/common/FormData.type.d.ts.map +1 -1
- package/dist/types/telemetry/TelemetryEvents.type.d.ts +2 -2
- package/dist/types/telemetry/TelemetryEvents.type.d.ts.map +1 -1
- package/dist/utils/dom/fontFamily.util.d.ts +23 -0
- package/dist/utils/dom/fontFamily.util.d.ts.map +1 -0
- package/dist/utils/dom/googleFontUrl.d.ts +5 -5
- package/dist/utils/dom/googleFontUrl.d.ts.map +1 -1
- package/dist/utils/dom/index.d.ts +1 -0
- package/dist/utils/dom/index.d.ts.map +1 -1
- package/dist/utils/phone/countryDialCodes.d.ts +6 -0
- package/dist/utils/phone/countryDialCodes.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/elements.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { $ as e, B as t, C as n,
|
|
1
|
+
import { $ as e, B as t, C as n, D as r, E as i, G as a, J as o, K as s, L as c, Q as l, R as u, S as ee, St as d, T as te, V as f, W as ne, X as p, Y as re, Z as ie, _ as ae, _t as m, a as oe, at as se, b as ce, bt as h, c as le, d as g, dt as _, et as v, f as y, gt as b, ht as x, i as ue, it as de, l as fe, lt as S, n as C, nt as w, o as pe, ot as T, p as E, pt as D, q as me, r as he, rt as ge, s as _e, st as O, t as ve, ut as ye, vt as k, xt as be, y as xe, yt as A, z as j } from "./shared.js";
|
|
2
2
|
//#region libs/checkout/src/assets/styles/helperText.css?inline
|
|
3
|
-
var
|
|
3
|
+
var M = ".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}", N = ".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}", P = ".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)}", F = (e) => "adoptedStyleSheets" in e, Se = (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 j = ".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
|
+
}, I = (e, t, n) => {
|
|
13
|
+
let r = e.getRootNode(), i = F(r) ? Se(r, t) : null;
|
|
14
|
+
if (i && F(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 j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
26
26
|
},
|
|
27
27
|
remove: () => a.remove()
|
|
28
28
|
};
|
|
29
|
-
},
|
|
29
|
+
}, Ce = ":host{--odus-font-family:system-ui, sans-serif;--odus-font-size:16px;--odus-color-error:#dc2727;--odus-color-text:#1a1a1a;--odus-color-background:#fff;--odus-border-color:#e0e0e0;--odus-border-radius:6px;--odus-spacing-sm:8px;--odus-spacing-md:16px;--odus-spacing-lg:24px;--odus-input-height:44px;--odus-input-padding:8px 12px;--odus-input-font-size:var(--odus-font-size);--odus-input-font-weight:400;--odus-input-letter-spacing:.02em;--odus-input-line-height:1.5;--odus-input-placeholder-color:#717173;--odus-input-placeholder-opacity:.3;--odus-input-focus-shadow:0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d;--odus-label-font-size:14px;--odus-label-font-weight:400;--odus-label-color:var(--odus-color-text);--odus-label-letter-spacing:normal;--odus-label-line-height:1.4;--odus-label-margin-bottom:6px;--odus-card-gap:12px;--odus-button-height:48px;--odus-button-border-radius:var(--odus-border-radius)}.form-input{opacity:1;font-weight:var(--odus-input-font-weight,400);letter-spacing:var(--odus-input-letter-spacing,.02em);box-shadow:0 0 0 1px var(--odus-border-color,#e0e0e0), 0 2px 4px 0 #00000012, 0 1px 1.5px 0 #0000000d;background:var(--odus-color-background,#fff);padding:var(--odus-input-padding,8px 12px);line-height:var(--odus-input-line-height,1.5);z-index:0;box-sizing:border-box;border:none;outline:none;flex:1;width:100%;min-height:0;transition:box-shadow .1s ease-in,border-radius .2s ease-in}.form-input::placeholder{color:var(--odus-input-placeholder-color,#717173);opacity:var(--odus-input-placeholder-opacity,.3)}.form-input:focus{box-shadow:var(--odus-input-focus-shadow,0 0 0 1px #3297d3b3, 0 1px 1px 0 #00000012, 0 0 0 4px #3297d34d);z-index:2;position:relative}.input-label{font-family:var(--odus-font-family,inherit)!important;font-size:var(--odus-label-font-size,14px)!important;font-weight:var(--odus-label-font-weight,400)!important;color:var(--odus-label-color,var(--odus-color-text,#1a1a1a))!important;letter-spacing:var(--odus-label-letter-spacing,normal)!important;line-height:var(--odus-label-line-height,1.4)!important;margin-bottom:var(--odus-label-margin-bottom,6px)!important}.form-helper-text{font-family:var(--odus-font-family,inherit)!important}", L = (e) => typeof e == "string" ? e : e instanceof HTMLElement ? e.id ? `#${e.id}` : e.tagName.toLowerCase() : String(e), R = class {
|
|
30
30
|
shadowRoot = null;
|
|
31
31
|
host = null;
|
|
32
32
|
options = {};
|
|
@@ -50,15 +50,15 @@ var j = ".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(), O(b.CHECKOUT_MOUNT_FAILED, {
|
|
54
|
+
container_id: L(e),
|
|
55
55
|
error_message: n instanceof Error ? n.message : "Unknown error"
|
|
56
|
-
}),
|
|
56
|
+
}), T(n instanceof Error ? n : /* @__PURE__ */ Error("Failed to mount element"), { container_id: L(e) }), this._mountFailureListener?.(t ? m.MOUNT_FAILED : m.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 = I(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;
|
|
@@ -104,17 +104,17 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
104
104
|
this.options.callbacks?.[e]?.(t);
|
|
105
105
|
}
|
|
106
106
|
getCss() {
|
|
107
|
-
return
|
|
107
|
+
return Ce;
|
|
108
108
|
}
|
|
109
|
-
},
|
|
109
|
+
}, z = class extends R {
|
|
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 } = i();
|
|
117
|
+
this._input = new E({
|
|
118
118
|
name: "billingAddress.city",
|
|
119
119
|
label: this.options.label ?? e("address.townCity"),
|
|
120
120
|
error: !1,
|
|
@@ -125,15 +125,15 @@ var j = ".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 } = i();
|
|
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
|
-
M,
|
|
135
134
|
N,
|
|
136
|
-
|
|
135
|
+
P,
|
|
136
|
+
M
|
|
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 j = ".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
|
+
}, B = ".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}", V = class extends R {
|
|
149
149
|
_value = "";
|
|
150
150
|
_error = null;
|
|
151
151
|
_select = null;
|
|
@@ -156,8 +156,8 @@ var j = ".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 } = i();
|
|
160
|
+
this._select = new y({
|
|
161
161
|
name: "billingAddress.country",
|
|
162
162
|
label: this.options.label ?? e("address.chooseCountry"),
|
|
163
163
|
error: !1,
|
|
@@ -169,15 +169,15 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
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 } = i();
|
|
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
|
+
P,
|
|
179
|
+
M,
|
|
180
|
+
B
|
|
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 j = ".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
|
+
}, H = class extends R {
|
|
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 } = i();
|
|
200
|
+
this._input = new E({
|
|
201
201
|
name: "billingAddress.firstName",
|
|
202
202
|
label: this.options.label ?? e("address.firstName"),
|
|
203
203
|
error: !1,
|
|
@@ -208,15 +208,15 @@ var j = ".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 } = i();
|
|
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
|
-
M,
|
|
218
217
|
N,
|
|
219
|
-
|
|
218
|
+
P,
|
|
219
|
+
M
|
|
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 j = ".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
|
+
}, U = class extends R {
|
|
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 } = i();
|
|
239
|
+
this._input = new E({
|
|
240
240
|
name: "billingAddress.lastName",
|
|
241
241
|
label: this.options.label ?? e("address.lastName"),
|
|
242
242
|
error: !1,
|
|
@@ -247,15 +247,15 @@ var j = ".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 } = i();
|
|
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
|
-
M,
|
|
257
256
|
N,
|
|
258
|
-
|
|
257
|
+
P,
|
|
258
|
+
M
|
|
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,7 +267,7 @@ var j = ".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
|
+
}, W = class extends R {
|
|
271
271
|
_value = "";
|
|
272
272
|
_country = "";
|
|
273
273
|
_input = null;
|
|
@@ -275,18 +275,18 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
275
275
|
setCountry(e) {
|
|
276
276
|
let n = this._country;
|
|
277
277
|
if (this._country = e, !this.shadowRoot) return;
|
|
278
|
-
let r =
|
|
279
|
-
if (r &&
|
|
280
|
-
let { t
|
|
281
|
-
this._select?.setOptions(
|
|
282
|
-
} else r !==
|
|
278
|
+
let r = t(n), a = t(e);
|
|
279
|
+
if (r && a && n !== e) {
|
|
280
|
+
let { t } = i(), n = f(e), r = t(j(n));
|
|
281
|
+
this._select?.setOptions(u(n), this.options.placeholder ?? r), this._select?.setValue(""), this._value = "", this.emit("change", this._value);
|
|
282
|
+
} else r !== a && (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, t(this._country) ? this._renderSelect(f(this._country)) : this._renderInput());
|
|
286
286
|
}
|
|
287
287
|
_renderInput() {
|
|
288
|
-
let { t: e } =
|
|
289
|
-
this._input = new
|
|
288
|
+
let { t: e } = i();
|
|
289
|
+
this._input = new E({
|
|
290
290
|
name: "billingAddress.state",
|
|
291
291
|
label: this.options.label ?? e("address.state"),
|
|
292
292
|
error: !1,
|
|
@@ -302,8 +302,8 @@ var j = ".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 } = i(), n = u(e), r = t(j(e));
|
|
306
|
+
this._select = new y({
|
|
307
307
|
name: "billingAddress.state",
|
|
308
308
|
label: this.options.label ?? t("address.state"),
|
|
309
309
|
error: !1,
|
|
@@ -321,10 +321,10 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
321
321
|
}
|
|
322
322
|
getCss() {
|
|
323
323
|
return super.getCss() + [
|
|
324
|
-
M,
|
|
325
324
|
N,
|
|
326
|
-
|
|
327
|
-
|
|
325
|
+
P,
|
|
326
|
+
M,
|
|
327
|
+
B
|
|
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 j = ".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 } = i();
|
|
339
339
|
return e("validation.stateRequired");
|
|
340
340
|
}
|
|
341
|
-
},
|
|
341
|
+
}, G = class extends R {
|
|
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 } = i();
|
|
349
|
+
this._input = new E({
|
|
350
350
|
name: "billingAddress.street",
|
|
351
351
|
label: this.options.label ?? e("address.addressLine1"),
|
|
352
352
|
error: !1,
|
|
@@ -362,15 +362,15 @@ var j = ".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 } = i();
|
|
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
|
-
M,
|
|
372
371
|
N,
|
|
373
|
-
|
|
372
|
+
P,
|
|
373
|
+
M
|
|
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 j = ".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
|
+
}, K = class extends R {
|
|
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 } = i();
|
|
393
|
+
this._input = new E({
|
|
394
394
|
name: "billingAddress.zipCode",
|
|
395
395
|
label: this.options.label ?? e("address.postalCode"),
|
|
396
396
|
error: !1,
|
|
@@ -401,15 +401,15 @@ var j = ".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 } = i();
|
|
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
|
-
M,
|
|
411
410
|
N,
|
|
412
|
-
|
|
411
|
+
P,
|
|
412
|
+
M
|
|
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() {
|
|
@@ -421,10 +421,10 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
421
421
|
getError() {
|
|
422
422
|
return this._error;
|
|
423
423
|
}
|
|
424
|
-
},
|
|
424
|
+
}, we = "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)}", Te = {
|
|
425
425
|
name: "odus-elements",
|
|
426
426
|
styles: {
|
|
427
|
-
fontSize:
|
|
427
|
+
fontSize: 16,
|
|
428
428
|
textColor: "#000000",
|
|
429
429
|
buttonColor: "#0070f3",
|
|
430
430
|
borderRadius: 4,
|
|
@@ -445,7 +445,7 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
445
445
|
}
|
|
446
446
|
},
|
|
447
447
|
additionalPaymentMethods: {}
|
|
448
|
-
},
|
|
448
|
+
}, q = class extends R {
|
|
449
449
|
_paymentContext = null;
|
|
450
450
|
_applePayData = null;
|
|
451
451
|
_authorized = !1;
|
|
@@ -464,8 +464,8 @@ var j = ".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
|
-
|
|
468
|
-
checkoutProfile:
|
|
467
|
+
pe(a, r?.countryCode) && oe() ? (this._button = new ue({
|
|
468
|
+
checkoutProfile: Te,
|
|
469
469
|
paymentId: e,
|
|
470
470
|
checkoutKey: t,
|
|
471
471
|
environment: n,
|
|
@@ -487,7 +487,7 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
487
487
|
this._isAvailable = e, this.host && (e ? this.host.style.removeProperty("display") : this.host.style.display = "none");
|
|
488
488
|
}
|
|
489
489
|
getCss() {
|
|
490
|
-
return super.getCss() +
|
|
490
|
+
return super.getCss() + we + "\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 ";
|
|
491
491
|
}
|
|
492
492
|
getValue() {
|
|
493
493
|
return this._applePayData;
|
|
@@ -498,10 +498,10 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
498
498
|
getError() {
|
|
499
499
|
return null;
|
|
500
500
|
}
|
|
501
|
-
},
|
|
501
|
+
}, Ee = ".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}", J = {
|
|
502
502
|
name: "odus-elements",
|
|
503
503
|
styles: {
|
|
504
|
-
fontSize:
|
|
504
|
+
fontSize: 16,
|
|
505
505
|
textColor: "#000000",
|
|
506
506
|
buttonColor: "#0070f3",
|
|
507
507
|
borderRadius: 4,
|
|
@@ -522,7 +522,7 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
522
522
|
}
|
|
523
523
|
},
|
|
524
524
|
additionalPaymentMethods: {}
|
|
525
|
-
},
|
|
525
|
+
}, Y = {
|
|
526
526
|
"--odus-font-family": "system-ui, sans-serif",
|
|
527
527
|
"--odus-font-size": "16px",
|
|
528
528
|
"--odus-color-error": "#dc2727",
|
|
@@ -546,11 +546,11 @@ var j = ".form-helper-text-anchor{height:var(--odus-helper-text-space,4px);z-ind
|
|
|
546
546
|
"--odus-button-height": "48px",
|
|
547
547
|
"--odus-button-border-radius": "var(--odus-border-radius)"
|
|
548
548
|
}["--odus-font-size"];
|
|
549
|
-
function
|
|
549
|
+
function De(e, t) {
|
|
550
550
|
let n = Object.keys(e);
|
|
551
551
|
return n.length === Object.keys(t).length && n.every((n) => e[n] === t[n]);
|
|
552
552
|
}
|
|
553
|
-
var
|
|
553
|
+
var Oe = class {
|
|
554
554
|
_vgsService;
|
|
555
555
|
_vgsSession;
|
|
556
556
|
_vgsState = {};
|
|
@@ -564,7 +564,7 @@ var ke = class {
|
|
|
564
564
|
_onFieldsNotReady = null;
|
|
565
565
|
_onFieldsReady = null;
|
|
566
566
|
constructor(e, t, n = {}, r) {
|
|
567
|
-
this._vgsSession = new
|
|
567
|
+
this._vgsSession = new o(e, r), this._environment = t, this._onInitFailure = n.onInitFailure ?? null, this._onFieldsNotReady = n.onFieldsNotReady ?? null, this._onFieldsReady = n.onFieldsReady ?? null, this._vgsService = new p();
|
|
568
568
|
}
|
|
569
569
|
setJwtRenewer(e) {
|
|
570
570
|
this._vgsSession.setRenewer(e);
|
|
@@ -574,9 +574,9 @@ var ke = class {
|
|
|
574
574
|
}
|
|
575
575
|
renderSection(e, t) {
|
|
576
576
|
this._section?.getElement().remove();
|
|
577
|
-
let { t: n } =
|
|
577
|
+
let { t: n } = i();
|
|
578
578
|
this._section = new fe({
|
|
579
|
-
checkoutProfile:
|
|
579
|
+
checkoutProfile: J,
|
|
580
580
|
translationFunc: n,
|
|
581
581
|
vgsService: this._vgsService
|
|
582
582
|
}), this._applySkeletonMetrics(), e.appendChild(this._section.getElement()), this._onChangeEmit = t;
|
|
@@ -598,7 +598,7 @@ var ke = class {
|
|
|
598
598
|
});
|
|
599
599
|
}
|
|
600
600
|
async getPayload() {
|
|
601
|
-
if (!this._vgsSession.jwt) throw
|
|
601
|
+
if (!this._vgsSession.jwt) throw w(/* @__PURE__ */ Error("VGS not initialized"), d.NOT_INITIALIZED);
|
|
602
602
|
let e = await this._vgsService.createCard(this._vgsSession);
|
|
603
603
|
return {
|
|
604
604
|
cardId: e.cardId,
|
|
@@ -611,7 +611,7 @@ var ke = class {
|
|
|
611
611
|
return this._vgsFieldsValid;
|
|
612
612
|
}
|
|
613
613
|
getError() {
|
|
614
|
-
let { t: e } =
|
|
614
|
+
let { t: e } = i();
|
|
615
615
|
for (let [t, n] of Object.entries(this._vgsState)) {
|
|
616
616
|
if (!n?.isTouched || n.isFocused || n.isValid) continue;
|
|
617
617
|
let r = n.errors?.[0];
|
|
@@ -626,7 +626,7 @@ var ke = class {
|
|
|
626
626
|
...this._currentTheme,
|
|
627
627
|
...e
|
|
628
628
|
};
|
|
629
|
-
|
|
629
|
+
De(this._currentTheme, t) || (this._currentTheme = t, this._section && (this._applySkeletonMetrics(), this._reinitWithTheme()));
|
|
630
630
|
}
|
|
631
631
|
resetTheme(e) {
|
|
632
632
|
let t = e.filter((e) => e in this._currentTheme);
|
|
@@ -640,50 +640,50 @@ var ke = class {
|
|
|
640
640
|
}
|
|
641
641
|
_reinitWithTheme() {
|
|
642
642
|
this._vgsReinitTimer && clearTimeout(this._vgsReinitTimer), this._vgsReinitTimer = setTimeout(() => {
|
|
643
|
-
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new
|
|
643
|
+
this._vgsReinitTimer = null, this._vgsService.destroy(), this._vgsService = new p(), this._section?.setVgsService(this._vgsService), this.initVgs();
|
|
644
644
|
}, 300);
|
|
645
645
|
}
|
|
646
646
|
_buildProfileFromTheme(e) {
|
|
647
|
-
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ??
|
|
647
|
+
let t = e["--odus-input-font-size"] ?? e["--odus-font-size"] ?? Y, n = e["--odus-font-family"] ?? J.styles.fontFamily, r = e["--odus-color-text"] ?? J.styles.textColor, i = e["--odus-border-radius"] ?? `${J.styles.borderRadius}px`;
|
|
648
648
|
return {
|
|
649
|
-
...
|
|
649
|
+
...J,
|
|
650
650
|
styles: {
|
|
651
|
-
...
|
|
652
|
-
fontSize: parseInt(t, 10) || parseInt(
|
|
651
|
+
...J.styles,
|
|
652
|
+
fontSize: parseInt(t, 10) || parseInt(Y, 10),
|
|
653
653
|
fontFamily: n,
|
|
654
654
|
textColor: r,
|
|
655
|
-
borderRadius: parseInt(i, 10) ||
|
|
655
|
+
borderRadius: parseInt(i, 10) || J.styles.borderRadius
|
|
656
656
|
}
|
|
657
657
|
};
|
|
658
658
|
}
|
|
659
659
|
async _mountFields(e, t, n) {
|
|
660
660
|
if (!this._section) return;
|
|
661
|
-
let r = this._buildProfileFromTheme(t),
|
|
661
|
+
let r = this._buildProfileFromTheme(t), a = t["--odus-border-color"] ?? "#e0e0e0";
|
|
662
662
|
this._applySkeletonMetrics();
|
|
663
|
-
let
|
|
664
|
-
for (let e of Object.values(
|
|
663
|
+
let o = this._section.getVgsContainerIds();
|
|
664
|
+
for (let e of Object.values(o)) {
|
|
665
665
|
if (!e) continue;
|
|
666
666
|
let t = document.getElementById(e);
|
|
667
667
|
t && t.querySelectorAll("iframe").forEach((e) => e.remove());
|
|
668
668
|
}
|
|
669
|
-
let
|
|
669
|
+
let s = await n;
|
|
670
670
|
if (e !== this._initGeneration) return;
|
|
671
|
-
let
|
|
672
|
-
borderColor:
|
|
671
|
+
let c = this._section.buildVgsFieldCss(r, s, {
|
|
672
|
+
borderColor: a,
|
|
673
673
|
backgroundColor: t["--odus-color-background"],
|
|
674
674
|
placeholderColor: t["--odus-input-placeholder-color"],
|
|
675
675
|
placeholderOpacity: t["--odus-input-placeholder-opacity"],
|
|
676
676
|
padding: t["--odus-input-padding"]
|
|
677
|
-
}), { t:
|
|
677
|
+
}), { t: l } = i();
|
|
678
678
|
this._vgsService.mountCardFields({
|
|
679
|
-
cardNumber:
|
|
680
|
-
cardExpiry:
|
|
681
|
-
cardCvv:
|
|
682
|
-
},
|
|
679
|
+
cardNumber: o.cardNumber ? `#${o.cardNumber}` : void 0,
|
|
680
|
+
cardExpiry: o.cardExpiry ? `#${o.cardExpiry}` : void 0,
|
|
681
|
+
cardCvv: o.cardCvv ? `#${o.cardCvv}` : void 0
|
|
682
|
+
}, c, {
|
|
683
683
|
cardNumber: "1234 5678 9012 3456",
|
|
684
|
-
cardExpiry:
|
|
684
|
+
cardExpiry: l("cardExpiry"),
|
|
685
685
|
cardCvv: "CVV",
|
|
686
|
-
cardholderName:
|
|
686
|
+
cardholderName: l("cardholderName")
|
|
687
687
|
}, (e) => {
|
|
688
688
|
this._section?.updateVgsCardBrand(e);
|
|
689
689
|
}), this._vgsService.waitForFieldsReady().then(() => {
|
|
@@ -694,7 +694,7 @@ var ke = class {
|
|
|
694
694
|
}
|
|
695
695
|
_handleStateChange(e) {
|
|
696
696
|
this._vgsState = e, this._vgsFieldsValid = Object.values(e).every((e) => e?.isValid === !0);
|
|
697
|
-
let { t } =
|
|
697
|
+
let { t } = i(), n = this._deriveFieldErrors(t);
|
|
698
698
|
this._section?.handleVgsStateChange(e, n), this._onChangeEmit?.();
|
|
699
699
|
}
|
|
700
700
|
_deriveFieldErrors(e) {
|
|
@@ -708,7 +708,7 @@ var ke = class {
|
|
|
708
708
|
}
|
|
709
709
|
return t;
|
|
710
710
|
}
|
|
711
|
-
},
|
|
711
|
+
}, X = "odus-card-vgs-host", ke = "Card capture is unavailable: no tokenization session", Z = class extends R {
|
|
712
712
|
elementName = "CardElement";
|
|
713
713
|
_environment = "test";
|
|
714
714
|
_captureState = "pending";
|
|
@@ -735,7 +735,7 @@ var ke = class {
|
|
|
735
735
|
return;
|
|
736
736
|
}
|
|
737
737
|
this._captureState = "vgs", this._reportedUnavailable = !1, this._vgsJwt = e, this._vgsAdapter?.destroy();
|
|
738
|
-
let n = new
|
|
738
|
+
let n = new Oe(e, this._environment, {
|
|
739
739
|
onInitFailure: () => {
|
|
740
740
|
this._vgsAdapter === n && this.isMounted && this.markCaptureUnavailable(x.INIT_FAILED);
|
|
741
741
|
},
|
|
@@ -759,7 +759,7 @@ var ke = class {
|
|
|
759
759
|
this.isMounted && this.unmount(), this._captureState = "unsupported", this._reportedUnavailable = !1, this._vgsAdapter?.destroy(), this._vgsAdapter = null, this._vgsJwt = null, t && e && this.mount(e);
|
|
760
760
|
}
|
|
761
761
|
attach(e) {
|
|
762
|
-
this._captureState === "vgs" ? (this.host = (e.ownerDocument ?? document).createElement("div"), this.host.className =
|
|
762
|
+
this._captureState === "vgs" ? (this.host = (e.ownerDocument ?? document).createElement("div"), this.host.className = X, e.appendChild(this.host), this.styles = I(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);
|
|
763
763
|
}
|
|
764
764
|
unmount() {
|
|
765
765
|
this._captureState === "vgs" ? (this.styles?.remove(), this.styles = null, this.host?.parentElement?.removeChild(this.host), this.host = null, this.shadowRoot = null) : super.unmount();
|
|
@@ -778,19 +778,19 @@ var ke = class {
|
|
|
778
778
|
this.clearBody();
|
|
779
779
|
let e = document.createElement("div");
|
|
780
780
|
e.className = "card-pending";
|
|
781
|
-
let t =
|
|
782
|
-
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${
|
|
781
|
+
let t = ce(xe, J.styles.fontSize);
|
|
782
|
+
e.style.height = `calc((${t}) * 2 - 1px)`, e.style.borderRadius = `var(--odus-border-radius, ${J.styles.borderRadius}px)`;
|
|
783
783
|
let n = document.createElement("div");
|
|
784
784
|
n.className = "vgs-field-skeleton", e.appendChild(n), this.shadowRoot.appendChild(e);
|
|
785
785
|
}
|
|
786
786
|
renderUnavailableNotice() {
|
|
787
787
|
if (!this.shadowRoot) return;
|
|
788
788
|
this.clearBody();
|
|
789
|
-
let { t: e } =
|
|
790
|
-
checkoutProfile:
|
|
789
|
+
let { t: e } = i(), t = new le({
|
|
790
|
+
checkoutProfile: J,
|
|
791
791
|
translationFunc: e
|
|
792
792
|
});
|
|
793
|
-
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0,
|
|
793
|
+
this.shadowRoot.appendChild(t.getElement()), this.emit("error", e("cardUnavailable")), this._reportedUnavailable || (this._reportedUnavailable = !0, O(b.CARD_CAPTURE_UNAVAILABLE, { reason: this._unavailableReason })), this._loadOutcomeListener?.({
|
|
794
794
|
status: "failed",
|
|
795
795
|
reason: this._unavailableReason
|
|
796
796
|
});
|
|
@@ -812,15 +812,15 @@ var ke = class {
|
|
|
812
812
|
}
|
|
813
813
|
getCss() {
|
|
814
814
|
return super.getCss() + [
|
|
815
|
-
M,
|
|
816
815
|
N,
|
|
817
|
-
|
|
818
|
-
|
|
816
|
+
P,
|
|
817
|
+
M,
|
|
818
|
+
Ee
|
|
819
819
|
].join("\n") + `
|
|
820
820
|
:host { display: block; }
|
|
821
821
|
/* The theme's :host defaults never reach the light-DOM VGS host, so
|
|
822
822
|
without this its labels inherit the merchant page's font. */
|
|
823
|
-
.${
|
|
823
|
+
.${X} {
|
|
824
824
|
--odus-font-family: system-ui, sans-serif;
|
|
825
825
|
}
|
|
826
826
|
.card-grid {
|
|
@@ -874,24 +874,24 @@ var ke = class {
|
|
|
874
874
|
};
|
|
875
875
|
}
|
|
876
876
|
async getPayload() {
|
|
877
|
-
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(
|
|
877
|
+
if (this._captureState !== "vgs" || !this._vgsAdapter) throw Error(ke);
|
|
878
878
|
return this._vgsAdapter.getPayload();
|
|
879
879
|
}
|
|
880
880
|
getIsValid() {
|
|
881
881
|
return this._captureState === "unsupported" ? !0 : this._vgsAdapter?.isValid() ?? !1;
|
|
882
882
|
}
|
|
883
883
|
getError() {
|
|
884
|
-
return this._captureState === "unavailable" ?
|
|
884
|
+
return this._captureState === "unavailable" ? i().t("cardUnavailable") : this._vgsAdapter?.getError() ?? null;
|
|
885
885
|
}
|
|
886
|
-
},
|
|
886
|
+
}, Q = class extends R {
|
|
887
887
|
_value = "";
|
|
888
888
|
_error = null;
|
|
889
889
|
_input = null;
|
|
890
890
|
render() {
|
|
891
891
|
if (!this.shadowRoot) return;
|
|
892
892
|
this._input?.getElement().remove();
|
|
893
|
-
let { t: e } =
|
|
894
|
-
this._input = new
|
|
893
|
+
let { t: e } = i();
|
|
894
|
+
this._input = new E({
|
|
895
895
|
name: "billingAddress.cardholderName",
|
|
896
896
|
label: this.options.label ?? e("cardholderNameLabel"),
|
|
897
897
|
error: !1,
|
|
@@ -903,15 +903,15 @@ var ke = class {
|
|
|
903
903
|
t !== n && this._input?.setValue(n), this._value = n, this._error = null, this._input?.setError(!1), this.emit("change", this._value);
|
|
904
904
|
}
|
|
905
905
|
}), this._input.addEventListener("blur", () => {
|
|
906
|
-
let { t: e } =
|
|
906
|
+
let { t: e } = i();
|
|
907
907
|
this._error = this._value.trim() ? null : e("validation.nameRequired"), this._input?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._value);
|
|
908
908
|
}), this.shadowRoot.appendChild(this._input.getElement());
|
|
909
909
|
}
|
|
910
910
|
getCss() {
|
|
911
911
|
return super.getCss() + [
|
|
912
|
-
M,
|
|
913
912
|
N,
|
|
914
|
-
|
|
913
|
+
P,
|
|
914
|
+
M
|
|
915
915
|
].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 ";
|
|
916
916
|
}
|
|
917
917
|
getValue() {
|
|
@@ -923,10 +923,10 @@ var ke = class {
|
|
|
923
923
|
getError() {
|
|
924
924
|
return this._error;
|
|
925
925
|
}
|
|
926
|
-
},
|
|
926
|
+
}, Ae = {
|
|
927
927
|
name: "odus-elements",
|
|
928
928
|
styles: {
|
|
929
|
-
fontSize:
|
|
929
|
+
fontSize: 16,
|
|
930
930
|
textColor: "#000000",
|
|
931
931
|
buttonColor: "#0070f3",
|
|
932
932
|
borderRadius: 4,
|
|
@@ -947,7 +947,7 @@ var ke = class {
|
|
|
947
947
|
}
|
|
948
948
|
},
|
|
949
949
|
additionalPaymentMethods: {}
|
|
950
|
-
},
|
|
950
|
+
}, je = class extends R {
|
|
951
951
|
_email = "";
|
|
952
952
|
_error = null;
|
|
953
953
|
_suggestion = null;
|
|
@@ -955,11 +955,11 @@ var ke = class {
|
|
|
955
955
|
render() {
|
|
956
956
|
if (!this.shadowRoot) return;
|
|
957
957
|
this._field?.getElement().remove(), this.options.initialValue && !this._email && (this._email = String(this.options.initialValue));
|
|
958
|
-
let { t: e } =
|
|
959
|
-
this._field = new
|
|
958
|
+
let { t: e } = i();
|
|
959
|
+
this._field = new _e({
|
|
960
960
|
value: this._email,
|
|
961
961
|
error: !1,
|
|
962
|
-
checkoutProfile:
|
|
962
|
+
checkoutProfile: Ae,
|
|
963
963
|
translationFunc: e,
|
|
964
964
|
label: this.options.label,
|
|
965
965
|
placeholder: this.options.placeholder,
|
|
@@ -968,23 +968,23 @@ var ke = class {
|
|
|
968
968
|
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);
|
|
969
969
|
},
|
|
970
970
|
onBlur: () => {
|
|
971
|
-
let e =
|
|
971
|
+
let e = c();
|
|
972
972
|
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);
|
|
973
973
|
}
|
|
974
974
|
}), this.shadowRoot.appendChild(this._field.getElement());
|
|
975
975
|
}
|
|
976
976
|
getCss() {
|
|
977
977
|
return super.getCss() + [
|
|
978
|
-
M,
|
|
979
978
|
N,
|
|
980
|
-
|
|
979
|
+
P,
|
|
980
|
+
M
|
|
981
981
|
].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 ";
|
|
982
982
|
}
|
|
983
983
|
getValue() {
|
|
984
984
|
return this._email;
|
|
985
985
|
}
|
|
986
986
|
getIsValid() {
|
|
987
|
-
return !
|
|
987
|
+
return !c().email(this._email);
|
|
988
988
|
}
|
|
989
989
|
getError() {
|
|
990
990
|
return this._error;
|
|
@@ -992,14 +992,14 @@ var ke = class {
|
|
|
992
992
|
get suggestion() {
|
|
993
993
|
return this._suggestion;
|
|
994
994
|
}
|
|
995
|
-
}, Me = "@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}",
|
|
995
|
+
}, Me = "@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}", Ne = class extends R {
|
|
996
996
|
_alert = null;
|
|
997
997
|
_message = null;
|
|
998
998
|
render() {
|
|
999
|
-
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new
|
|
999
|
+
this.shadowRoot && (this._alert?.getElement().remove(), this._alert = null, this._message && (this._alert = new C({ message: this._message }), this.shadowRoot.appendChild(this._alert.getElement())));
|
|
1000
1000
|
}
|
|
1001
1001
|
setError(e) {
|
|
1002
|
-
this._message = e, this.shadowRoot && (this._alert ? this._alert.setMessage(e) : (this._alert = new
|
|
1002
|
+
this._message = e, this.shadowRoot && (this._alert ? this._alert.setMessage(e) : (this._alert = new C({ message: e }), this.shadowRoot.appendChild(this._alert.getElement()))), this.emit("error", e);
|
|
1003
1003
|
}
|
|
1004
1004
|
clearError() {
|
|
1005
1005
|
this._message = null, this._alert?.getElement().remove(), this._alert = null;
|
|
@@ -1016,10 +1016,10 @@ var ke = class {
|
|
|
1016
1016
|
getError() {
|
|
1017
1017
|
return this._message;
|
|
1018
1018
|
}
|
|
1019
|
-
},
|
|
1019
|
+
}, Pe = ".paypal{color:#253b80;text-transform:none;cursor:pointer;background-color:#ffc439;border-radius:4px;padding:8px 16px;font-weight:700;box-shadow:0 2px 4px #0000001a}.paypal:hover{filter:brightness(.95);background-color:#ffc439}.paypal-icon-container{justify-content:center;align-items:center;display:flex}.paypal-icon-container img{width:69px;height:22px}", Fe = {
|
|
1020
1020
|
name: "odus-elements",
|
|
1021
1021
|
styles: {
|
|
1022
|
-
fontSize:
|
|
1022
|
+
fontSize: 16,
|
|
1023
1023
|
textColor: "#000000",
|
|
1024
1024
|
buttonColor: "#0070f3",
|
|
1025
1025
|
borderRadius: 4,
|
|
@@ -1040,7 +1040,7 @@ var ke = class {
|
|
|
1040
1040
|
}
|
|
1041
1041
|
},
|
|
1042
1042
|
additionalPaymentMethods: {}
|
|
1043
|
-
},
|
|
1043
|
+
}, Ie = class extends R {
|
|
1044
1044
|
_paymentContext = null;
|
|
1045
1045
|
_button = null;
|
|
1046
1046
|
setPaymentContext(e) {
|
|
@@ -1049,8 +1049,8 @@ var ke = class {
|
|
|
1049
1049
|
render() {
|
|
1050
1050
|
if (!this.shadowRoot || (this._button?.getElement().remove(), this._button = null, !this._paymentContext)) return;
|
|
1051
1051
|
let { onAuthorize: e } = this._paymentContext;
|
|
1052
|
-
this._button = new
|
|
1053
|
-
checkoutProfile:
|
|
1052
|
+
this._button = new he({
|
|
1053
|
+
checkoutProfile: Fe,
|
|
1054
1054
|
onSubmit: async () => {
|
|
1055
1055
|
this._button?.setSubmitting(!0);
|
|
1056
1056
|
try {
|
|
@@ -1062,7 +1062,7 @@ var ke = class {
|
|
|
1062
1062
|
}), this.shadowRoot.appendChild(this._button.getElement());
|
|
1063
1063
|
}
|
|
1064
1064
|
getCss() {
|
|
1065
|
-
return super.getCss() +
|
|
1065
|
+
return super.getCss() + Pe + "\n :host { display: block; }\n .paypal {\n width: 100%;\n box-sizing: border-box;\n border-radius: var(--odus-button-border-radius, 6px);\n display: flex;\n align-items: center;\n justify-content: center;\n }\n ";
|
|
1066
1066
|
}
|
|
1067
1067
|
getValue() {
|
|
1068
1068
|
return null;
|
|
@@ -1073,10 +1073,10 @@ var ke = class {
|
|
|
1073
1073
|
getError() {
|
|
1074
1074
|
return null;
|
|
1075
1075
|
}
|
|
1076
|
-
},
|
|
1076
|
+
}, Le = ".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}", Re = {
|
|
1077
1077
|
name: "odus-elements",
|
|
1078
1078
|
styles: {
|
|
1079
|
-
fontSize:
|
|
1079
|
+
fontSize: 16,
|
|
1080
1080
|
textColor: "#000000",
|
|
1081
1081
|
buttonColor: "#0070f3",
|
|
1082
1082
|
borderRadius: 4,
|
|
@@ -1097,7 +1097,7 @@ var ke = class {
|
|
|
1097
1097
|
}
|
|
1098
1098
|
},
|
|
1099
1099
|
additionalPaymentMethods: {}
|
|
1100
|
-
},
|
|
1100
|
+
}, $ = class extends R {
|
|
1101
1101
|
_phone = "";
|
|
1102
1102
|
_error = null;
|
|
1103
1103
|
_field = null;
|
|
@@ -1113,13 +1113,13 @@ var ke = class {
|
|
|
1113
1113
|
if (!this.shadowRoot) return;
|
|
1114
1114
|
this._field?.destroy(), this._field?.getElement().remove(), this._field = null, this.options.initialValue && !this._phone && (this._phone = String(this.options.initialValue));
|
|
1115
1115
|
let e = ++this._renderGeneration;
|
|
1116
|
-
|
|
1116
|
+
ne().then(({ PhoneNumberField: t }) => {
|
|
1117
1117
|
if (!this.shadowRoot || this._renderGeneration !== e) return;
|
|
1118
|
-
let { t: n, locale: r } =
|
|
1118
|
+
let { t: n, locale: r } = i();
|
|
1119
1119
|
this._field = new t({
|
|
1120
1120
|
value: this._phone,
|
|
1121
1121
|
error: !1,
|
|
1122
|
-
checkoutProfile:
|
|
1122
|
+
checkoutProfile: Re,
|
|
1123
1123
|
translationFunc: n,
|
|
1124
1124
|
locale: r,
|
|
1125
1125
|
label: this.options.label,
|
|
@@ -1130,34 +1130,34 @@ var ke = class {
|
|
|
1130
1130
|
},
|
|
1131
1131
|
onBlur: () => {
|
|
1132
1132
|
this._phone = this._field?.getValue() ?? "";
|
|
1133
|
-
let e =
|
|
1133
|
+
let e = c(), t = this._field?.getCountry();
|
|
1134
1134
|
this._error = e.phoneNumber(this._phone, t) ?? null, this._field?.setError(!!this._error, this._error ?? void 0), this.emit("blur", this._phone);
|
|
1135
1135
|
}
|
|
1136
1136
|
}), this.shadowRoot.appendChild(this._field.getElement()), this._loadOutcomeListener?.({ status: "ready" });
|
|
1137
1137
|
}).catch((t) => {
|
|
1138
1138
|
this.shadowRoot && this._renderGeneration === e && (console.error("Error creating phone number field:", t), this._loadOutcomeListener?.({
|
|
1139
1139
|
status: "failed",
|
|
1140
|
-
reason:
|
|
1140
|
+
reason: m.FORM_RENDER_FAILED,
|
|
1141
1141
|
attributes: {
|
|
1142
1142
|
form_part: "phone_number",
|
|
1143
|
-
error_class:
|
|
1143
|
+
error_class: de(t)
|
|
1144
1144
|
}
|
|
1145
1145
|
}));
|
|
1146
1146
|
});
|
|
1147
1147
|
}
|
|
1148
1148
|
getCss() {
|
|
1149
1149
|
return super.getCss() + [
|
|
1150
|
-
M,
|
|
1151
1150
|
N,
|
|
1152
|
-
|
|
1153
|
-
|
|
1151
|
+
P,
|
|
1152
|
+
M,
|
|
1153
|
+
Le
|
|
1154
1154
|
].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 ";
|
|
1155
1155
|
}
|
|
1156
1156
|
getValue() {
|
|
1157
1157
|
return this._phone;
|
|
1158
1158
|
}
|
|
1159
1159
|
getIsValid() {
|
|
1160
|
-
let e =
|
|
1160
|
+
let e = c(), t = this._field?.getCountry();
|
|
1161
1161
|
return !e.phoneNumber(this._phone, t);
|
|
1162
1162
|
}
|
|
1163
1163
|
getError() {
|
|
@@ -1176,7 +1176,7 @@ var ke = class {
|
|
|
1176
1176
|
_fontCleanup;
|
|
1177
1177
|
_sessionId;
|
|
1178
1178
|
_mountedReported = !1;
|
|
1179
|
-
_readiness = new
|
|
1179
|
+
_readiness = new s();
|
|
1180
1180
|
_cardFieldsReady = !1;
|
|
1181
1181
|
_card;
|
|
1182
1182
|
_email;
|
|
@@ -1194,17 +1194,17 @@ var ke = class {
|
|
|
1194
1194
|
_error;
|
|
1195
1195
|
elements;
|
|
1196
1196
|
constructor(e) {
|
|
1197
|
-
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(),
|
|
1197
|
+
this._config = e, this._callbacks = { ...e.callbacks }, this._sessionId = crypto.randomUUID(), me(), se({
|
|
1198
1198
|
environment: e.environment,
|
|
1199
1199
|
sessionId: this._sessionId,
|
|
1200
1200
|
integration: "elements"
|
|
1201
|
-
}),
|
|
1201
|
+
}), O(b.CHECKOUT_INITIALIZED, { environment: e.environment }), e.locale && r.setLocale(e.locale), this._apiService = new te(e.apiKey, e.environment);
|
|
1202
1202
|
let t = {};
|
|
1203
1203
|
Object.defineProperty(t, "email", {
|
|
1204
|
-
get: () => (this._email || (this._email = new
|
|
1204
|
+
get: () => (this._email || (this._email = new je(), this._trackElement(this._email)), this._email),
|
|
1205
1205
|
enumerable: !0
|
|
1206
1206
|
}), Object.defineProperty(t, "phone", {
|
|
1207
|
-
get: () => (this._phone || (this._phone = new
|
|
1207
|
+
get: () => (this._phone || (this._phone = new $(), this._trackElement(this._phone), this._phone.setLoadOutcomeListener((e) => {
|
|
1208
1208
|
e.status === "ready" ? this._settleLoad() : this._readiness.fail({
|
|
1209
1209
|
reason: e.reason,
|
|
1210
1210
|
attributes: e.attributes
|
|
@@ -1214,7 +1214,7 @@ var ke = class {
|
|
|
1214
1214
|
});
|
|
1215
1215
|
let n = {};
|
|
1216
1216
|
Object.defineProperty(n, "applePay", {
|
|
1217
|
-
get: () => (this._applePay || (this._applePay = new
|
|
1217
|
+
get: () => (this._applePay || (this._applePay = new q(), this._trackElement(this._applePay), this._paymentState.paymentId && this._paymentState.checkoutKey && this._applePay.setPaymentContext({
|
|
1218
1218
|
paymentId: this._paymentState.paymentId,
|
|
1219
1219
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1220
1220
|
environment: this._config.environment,
|
|
@@ -1229,7 +1229,7 @@ var ke = class {
|
|
|
1229
1229
|
})), this._applePay),
|
|
1230
1230
|
enumerable: !0
|
|
1231
1231
|
}), Object.defineProperty(n, "payPal", {
|
|
1232
|
-
get: () => (this._paypal || (this._paypal = new
|
|
1232
|
+
get: () => (this._paypal || (this._paypal = new Ie(), this._trackElement(this._paypal), this._paymentState.paymentId && this._paymentState.checkoutKey && this._paypal.setPaymentContext({
|
|
1233
1233
|
paymentId: this._paymentState.paymentId,
|
|
1234
1234
|
checkoutKey: this._paymentState.checkoutKey,
|
|
1235
1235
|
onAuthorize: async () => {
|
|
@@ -1240,25 +1240,25 @@ var ke = class {
|
|
|
1240
1240
|
});
|
|
1241
1241
|
let i = {};
|
|
1242
1242
|
Object.defineProperty(i, "street", {
|
|
1243
|
-
get: () => (this._addressStreet || (this._addressStreet = new
|
|
1243
|
+
get: () => (this._addressStreet || (this._addressStreet = new G(), this._trackElement(this._addressStreet)), this._addressStreet),
|
|
1244
1244
|
enumerable: !0
|
|
1245
1245
|
}), Object.defineProperty(i, "firstName", {
|
|
1246
|
-
get: () => (this._addressFirstName || (this._addressFirstName = new
|
|
1246
|
+
get: () => (this._addressFirstName || (this._addressFirstName = new H(), this._trackElement(this._addressFirstName)), this._addressFirstName),
|
|
1247
1247
|
enumerable: !0
|
|
1248
1248
|
}), Object.defineProperty(i, "lastName", {
|
|
1249
|
-
get: () => (this._addressLastName || (this._addressLastName = new
|
|
1249
|
+
get: () => (this._addressLastName || (this._addressLastName = new U(), this._trackElement(this._addressLastName)), this._addressLastName),
|
|
1250
1250
|
enumerable: !0
|
|
1251
1251
|
}), Object.defineProperty(i, "city", {
|
|
1252
|
-
get: () => (this._addressCity || (this._addressCity = new
|
|
1252
|
+
get: () => (this._addressCity || (this._addressCity = new z(), this._trackElement(this._addressCity)), this._addressCity),
|
|
1253
1253
|
enumerable: !0
|
|
1254
1254
|
}), Object.defineProperty(i, "state", {
|
|
1255
|
-
get: () => (this._addressState || (this._addressState = new
|
|
1255
|
+
get: () => (this._addressState || (this._addressState = new W(), this._trackElement(this._addressState), this._addressCountry?.value && this._addressState.setCountry(this._addressCountry.value)), this._addressState),
|
|
1256
1256
|
enumerable: !0
|
|
1257
1257
|
}), Object.defineProperty(i, "zipCode", {
|
|
1258
|
-
get: () => (this._addressZipCode || (this._addressZipCode = new
|
|
1258
|
+
get: () => (this._addressZipCode || (this._addressZipCode = new K(), this._trackElement(this._addressZipCode)), this._addressZipCode),
|
|
1259
1259
|
enumerable: !0
|
|
1260
1260
|
}), Object.defineProperty(i, "country", {
|
|
1261
|
-
get: () => (this._addressCountry || (this._addressCountry = new
|
|
1261
|
+
get: () => (this._addressCountry || (this._addressCountry = new V(), this._trackElement(this._addressCountry), this._addressCountry.on("change", (e) => {
|
|
1262
1262
|
this._addressState?.setCountry(e);
|
|
1263
1263
|
})), this._addressCountry),
|
|
1264
1264
|
enumerable: !0
|
|
@@ -1268,69 +1268,69 @@ var ke = class {
|
|
|
1268
1268
|
express: n
|
|
1269
1269
|
};
|
|
1270
1270
|
Object.defineProperty(a, "card", {
|
|
1271
|
-
get: () => (this._card || (this._card = new
|
|
1271
|
+
get: () => (this._card || (this._card = new Z(), this._card.setEnvironment(this._config.environment), this._card.on("ready", () => {
|
|
1272
1272
|
this._cardFieldsReady = !1;
|
|
1273
1273
|
}), this._trackElement(this._card), this._card.setLoadOutcomeListener((e) => {
|
|
1274
1274
|
this._readiness.markMounted(), e.status === "ready" ? (this._cardFieldsReady = !0, this._settleLoad()) : this._readiness.settle(e);
|
|
1275
1275
|
}), this._paymentState.vgsJwt ? this._card.setVgsJwt(this._paymentState.vgsJwt, this._renewVgsJwt(this._paymentState)) : this._paymentState.cardCapture === "unavailable" ? this._card.markCaptureUnavailable() : this._paymentState.cardCapture === "unsupported" && this._card.resetCardCapture()), this._card),
|
|
1276
1276
|
enumerable: !0
|
|
1277
1277
|
}), Object.defineProperty(a, "cardholderName", {
|
|
1278
|
-
get: () => (this._cardholderName || (this._cardholderName = new
|
|
1278
|
+
get: () => (this._cardholderName || (this._cardholderName = new Q(), this._trackElement(this._cardholderName)), this._cardholderName),
|
|
1279
1279
|
enumerable: !0
|
|
1280
1280
|
}), Object.defineProperty(a, "address", {
|
|
1281
1281
|
get: () => i,
|
|
1282
1282
|
enumerable: !0
|
|
1283
1283
|
}), Object.defineProperty(a, "error", {
|
|
1284
|
-
get: () => (this._error || (this._error = new
|
|
1284
|
+
get: () => (this._error || (this._error = new Ne(), this._trackElement(this._error)), this._error),
|
|
1285
1285
|
enumerable: !0
|
|
1286
1286
|
}), this.elements = a;
|
|
1287
1287
|
}
|
|
1288
1288
|
_renewVgsJwt({ paymentId: e, checkoutKey: t }) {
|
|
1289
|
-
if (e && t) return
|
|
1289
|
+
if (e && t) return re({
|
|
1290
1290
|
id: e,
|
|
1291
1291
|
checkoutKey: t,
|
|
1292
1292
|
environment: this._config.environment
|
|
1293
1293
|
});
|
|
1294
1294
|
}
|
|
1295
|
-
async associatePayment(
|
|
1296
|
-
if (!
|
|
1297
|
-
let
|
|
1298
|
-
this._readiness.start(
|
|
1299
|
-
let
|
|
1295
|
+
async associatePayment(t, n) {
|
|
1296
|
+
if (!t || !n) throw Error("paymentId and checkoutKey are required");
|
|
1297
|
+
let r = ++this._associationSequence;
|
|
1298
|
+
this._readiness.start(t), ie(this._config.environment);
|
|
1299
|
+
let i;
|
|
1300
1300
|
try {
|
|
1301
|
-
|
|
1302
|
-
id:
|
|
1303
|
-
checkoutKey:
|
|
1301
|
+
i = await ye({
|
|
1302
|
+
id: t,
|
|
1303
|
+
checkoutKey: n,
|
|
1304
1304
|
environment: this._config.environment
|
|
1305
1305
|
});
|
|
1306
|
-
} catch (
|
|
1307
|
-
if (
|
|
1306
|
+
} catch (n) {
|
|
1307
|
+
if (r === this._associationSequence) {
|
|
1308
1308
|
this._paymentState = {};
|
|
1309
|
-
let { ours:
|
|
1310
|
-
|
|
1309
|
+
let { ours: t, ...r } = e(n, h.CHECKOUT_DETAILS);
|
|
1310
|
+
t ? this._readiness.fail(r) : this._readiness.exclude(r);
|
|
1311
1311
|
}
|
|
1312
|
-
throw
|
|
1313
|
-
payment_id:
|
|
1314
|
-
error_message:
|
|
1315
|
-
stage:
|
|
1316
|
-
...
|
|
1317
|
-
}),
|
|
1312
|
+
throw O(b.PAYMENT_ASSOCIATION_FAILED, {
|
|
1313
|
+
payment_id: t,
|
|
1314
|
+
error_message: n instanceof Error ? n.message : "Unknown error",
|
|
1315
|
+
stage: h.CHECKOUT_DETAILS,
|
|
1316
|
+
..._(n)
|
|
1317
|
+
}), T(n instanceof Error ? n : Error("Failed to associate payment"), { payment_id: t }), n;
|
|
1318
1318
|
}
|
|
1319
|
-
|
|
1320
|
-
paymentId:
|
|
1321
|
-
checkoutKey:
|
|
1319
|
+
r === this._associationSequence && (this._paymentState = {
|
|
1320
|
+
paymentId: t,
|
|
1321
|
+
checkoutKey: n,
|
|
1322
1322
|
checkoutDetails: {
|
|
1323
|
-
amount:
|
|
1324
|
-
currency:
|
|
1325
|
-
countryCode:
|
|
1323
|
+
amount: i.amount,
|
|
1324
|
+
currency: i.currency,
|
|
1325
|
+
countryCode: i.countryCode
|
|
1326
1326
|
}
|
|
1327
|
-
}, this._readiness.markAssociated(),
|
|
1328
|
-
payment_id:
|
|
1329
|
-
currency:
|
|
1330
|
-
country_code:
|
|
1331
|
-
}), this._card?.setEnvironment(this._config.environment),
|
|
1332
|
-
paymentId:
|
|
1333
|
-
checkoutKey:
|
|
1327
|
+
}, this._readiness.markAssociated(), O(b.PAYMENT_ASSOCIATED, {
|
|
1328
|
+
payment_id: t,
|
|
1329
|
+
currency: i.currency,
|
|
1330
|
+
country_code: i.countryCode
|
|
1331
|
+
}), 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._renewVgsJwt(this._paymentState))) : (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({
|
|
1332
|
+
paymentId: t,
|
|
1333
|
+
checkoutKey: n,
|
|
1334
1334
|
environment: this._config.environment,
|
|
1335
1335
|
checkoutDetails: this._paymentState.checkoutDetails,
|
|
1336
1336
|
...this._config.additionalPaymentMethods?.applePay,
|
|
@@ -1341,15 +1341,15 @@ var ke = class {
|
|
|
1341
1341
|
onStartFailed: this._onApplePayStartFailed,
|
|
1342
1342
|
onPaymentDataFailed: this._onApplePayPaymentDataFailed
|
|
1343
1343
|
}), this._paypal?.setPaymentContext({
|
|
1344
|
-
paymentId:
|
|
1345
|
-
checkoutKey:
|
|
1344
|
+
paymentId: t,
|
|
1345
|
+
checkoutKey: n,
|
|
1346
1346
|
onAuthorize: async () => {
|
|
1347
1347
|
await this._executeAuthorization({ formData: null });
|
|
1348
1348
|
}
|
|
1349
1349
|
}), this._settleLoad());
|
|
1350
1350
|
}
|
|
1351
1351
|
validate() {
|
|
1352
|
-
let e = {}, { t } =
|
|
1352
|
+
let e = {}, { t } = i();
|
|
1353
1353
|
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"), {
|
|
1354
1354
|
valid: Object.keys(e).length === 0,
|
|
1355
1355
|
errors: e
|
|
@@ -1364,31 +1364,31 @@ var ke = class {
|
|
|
1364
1364
|
lastName: this._addressLastName?.isMounted ? this._addressLastName.value : "",
|
|
1365
1365
|
state: this._addressState?.isMounted ? this._addressState.value : "",
|
|
1366
1366
|
zipCode: this._addressZipCode?.isMounted ? this._addressZipCode.value : ""
|
|
1367
|
-
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "",
|
|
1367
|
+
} : void 0, r = this._cardholderName?.isMounted ? this._cardholderName.value : "", a = [n?.firstName ?? "", n?.lastName ?? ""].filter(Boolean), o = r || a.join(" ");
|
|
1368
1368
|
if (!this._card?.isMounted || this._card.captureState === "unsupported") return {
|
|
1369
1369
|
ok: !1,
|
|
1370
1370
|
error: {
|
|
1371
1371
|
message: Ve,
|
|
1372
1372
|
status: 0,
|
|
1373
1373
|
statusText: "No Payment Method",
|
|
1374
|
-
failureClass:
|
|
1374
|
+
failureClass: A.NOT_SENT
|
|
1375
1375
|
}
|
|
1376
1376
|
};
|
|
1377
|
-
if (!this._card.isVgsMode) return
|
|
1377
|
+
if (!this._card.isVgsMode) return O(b.CARD_CAPTURE_UNAVAILABLE, { reason: x.NO_TOKENIZATION_SESSION }), {
|
|
1378
1378
|
ok: !1,
|
|
1379
|
-
error:
|
|
1380
|
-
message:
|
|
1379
|
+
error: w({
|
|
1380
|
+
message: i().t("cardUnavailable"),
|
|
1381
1381
|
status: 0,
|
|
1382
1382
|
statusText: "Card Capture Unavailable",
|
|
1383
|
-
failureClass:
|
|
1384
|
-
},
|
|
1383
|
+
failureClass: A.NOT_SENT
|
|
1384
|
+
}, d.CAPTURE_UNAVAILABLE)
|
|
1385
1385
|
};
|
|
1386
1386
|
try {
|
|
1387
1387
|
let r = await this._card.getPayload();
|
|
1388
1388
|
return {
|
|
1389
1389
|
ok: !0,
|
|
1390
1390
|
formData: {
|
|
1391
|
-
name:
|
|
1391
|
+
name: o,
|
|
1392
1392
|
email: e,
|
|
1393
1393
|
phoneNumber: t || void 0,
|
|
1394
1394
|
billingAddress: n,
|
|
@@ -1398,12 +1398,12 @@ var ke = class {
|
|
|
1398
1398
|
} catch (e) {
|
|
1399
1399
|
return {
|
|
1400
1400
|
ok: !1,
|
|
1401
|
-
error:
|
|
1401
|
+
error: w({
|
|
1402
1402
|
message: Be,
|
|
1403
1403
|
status: 0,
|
|
1404
1404
|
statusText: "Card Tokenization Failed",
|
|
1405
|
-
failureClass:
|
|
1406
|
-
},
|
|
1405
|
+
failureClass: A.NOT_SENT
|
|
1406
|
+
}, ge(e) ?? d.SDK_ERROR)
|
|
1407
1407
|
};
|
|
1408
1408
|
}
|
|
1409
1409
|
}
|
|
@@ -1448,13 +1448,13 @@ var ke = class {
|
|
|
1448
1448
|
setCallbacks(e) {
|
|
1449
1449
|
Object.assign(this._callbacks, e);
|
|
1450
1450
|
}
|
|
1451
|
-
_onApplePayStartFailed = (e) => this._readiness.reportSubmit(
|
|
1451
|
+
_onApplePayStartFailed = (e) => this._readiness.reportSubmit(l(e));
|
|
1452
1452
|
_onApplePayPaymentDataFailed = (e) => this._readiness.reportSubmit(e);
|
|
1453
1453
|
_trackElement(e) {
|
|
1454
1454
|
e.setMountFailureListener((e) => {
|
|
1455
|
-
e ===
|
|
1455
|
+
e === m.MOUNT_FAILED ? this._readiness.fail({ reason: e }) : this._readiness.exclude({ reason: e });
|
|
1456
1456
|
}), e.on("ready", () => {
|
|
1457
|
-
this._mountedReported || (this._mountedReported = !0,
|
|
1457
|
+
this._mountedReported || (this._mountedReported = !0, O(b.CHECKOUT_MOUNTED, { container_id: "elements" })), this._readiness.markMounted(), this._settleLoad();
|
|
1458
1458
|
}), e.on("change", () => {
|
|
1459
1459
|
for (let e of this._changeListeners) e();
|
|
1460
1460
|
});
|
|
@@ -1480,50 +1480,50 @@ var ke = class {
|
|
|
1480
1480
|
this._error
|
|
1481
1481
|
].filter((e) => e !== void 0);
|
|
1482
1482
|
}
|
|
1483
|
-
async _executeAuthorization({ formData:
|
|
1484
|
-
let { paymentId:
|
|
1485
|
-
if (!
|
|
1483
|
+
async _executeAuthorization({ formData: e, applePayData: t, customCustomerData: n }) {
|
|
1484
|
+
let { paymentId: r, checkoutKey: i } = this._paymentState, a = this._getPaymentMethod(e, t);
|
|
1485
|
+
if (!r || !i) return this._reportSubmitFailure({
|
|
1486
1486
|
message: He,
|
|
1487
1487
|
status: 0,
|
|
1488
1488
|
statusText: "No Associated Payment",
|
|
1489
|
-
failureClass:
|
|
1490
|
-
},
|
|
1491
|
-
this._emitLoadingState(!0),
|
|
1492
|
-
payment_id:
|
|
1493
|
-
payment_method:
|
|
1489
|
+
failureClass: A.NOT_SENT
|
|
1490
|
+
}, a), !1;
|
|
1491
|
+
this._emitLoadingState(!0), O(b.PAYMENT_SUBMIT_STARTED, {
|
|
1492
|
+
payment_id: r,
|
|
1493
|
+
payment_method: a
|
|
1494
1494
|
});
|
|
1495
|
-
let
|
|
1495
|
+
let o = performance.now();
|
|
1496
1496
|
try {
|
|
1497
|
-
let
|
|
1498
|
-
paymentId:
|
|
1499
|
-
checkoutKey:
|
|
1500
|
-
formData:
|
|
1497
|
+
let s = await this._apiService.authorizePayment({
|
|
1498
|
+
paymentId: r,
|
|
1499
|
+
checkoutKey: i,
|
|
1500
|
+
formData: e,
|
|
1501
1501
|
returnUrl: this._config.returnUrl,
|
|
1502
|
-
applePayData:
|
|
1503
|
-
customCustomerData:
|
|
1502
|
+
applePayData: t,
|
|
1503
|
+
customCustomerData: n
|
|
1504
1504
|
});
|
|
1505
1505
|
return this._readiness.reportSubmit({
|
|
1506
|
-
outcome:
|
|
1507
|
-
paymentMethod:
|
|
1508
|
-
}),
|
|
1509
|
-
payment_id:
|
|
1510
|
-
payment_method:
|
|
1506
|
+
outcome: be.SUCCEEDED,
|
|
1507
|
+
paymentMethod: a
|
|
1508
|
+
}), S(k.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1509
|
+
payment_id: r,
|
|
1510
|
+
payment_method: a,
|
|
1511
1511
|
status: "success"
|
|
1512
|
-
}),
|
|
1513
|
-
payment_id:
|
|
1514
|
-
payment_method:
|
|
1515
|
-
}), this._handlePaymentResponse(
|
|
1516
|
-
} catch (
|
|
1517
|
-
return
|
|
1518
|
-
payment_id:
|
|
1519
|
-
payment_method:
|
|
1512
|
+
}), O(b.PAYMENT_SUBMIT_SUCCESS, {
|
|
1513
|
+
payment_id: r,
|
|
1514
|
+
payment_method: a
|
|
1515
|
+
}), this._handlePaymentResponse(s);
|
|
1516
|
+
} catch (e) {
|
|
1517
|
+
return S(k.PAYMENT_AUTHORIZATION_TIME, performance.now() - o, "ms", {
|
|
1518
|
+
payment_id: r,
|
|
1519
|
+
payment_method: a,
|
|
1520
1520
|
status: "failed"
|
|
1521
|
-
}),
|
|
1522
|
-
payment_id:
|
|
1523
|
-
payment_method:
|
|
1524
|
-
error_message: this._readErrorMessage(
|
|
1525
|
-
...
|
|
1526
|
-
}), this._readiness.reportSubmit(e
|
|
1521
|
+
}), O(b.PAYMENT_SUBMIT_FAILED, {
|
|
1522
|
+
payment_id: r,
|
|
1523
|
+
payment_method: a,
|
|
1524
|
+
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1525
|
+
..._(e)
|
|
1526
|
+
}), this._readiness.reportSubmit(v(e, a)), this._handleAuthorizationError(e), !1;
|
|
1527
1527
|
} finally {
|
|
1528
1528
|
this._emitLoadingState(!1);
|
|
1529
1529
|
}
|
|
@@ -1537,28 +1537,28 @@ var ke = class {
|
|
|
1537
1537
|
} catch {}
|
|
1538
1538
|
}
|
|
1539
1539
|
_handlePaymentResponse(e) {
|
|
1540
|
-
let t = this._paymentState.paymentId ?? "", n =
|
|
1541
|
-
return n === "authorized" ? (
|
|
1540
|
+
let t = this._paymentState.paymentId ?? "", n = ve(e);
|
|
1541
|
+
return n === "authorized" ? (O(b.PAYMENT_AUTHORIZED, {
|
|
1542
1542
|
payment_id: t,
|
|
1543
1543
|
status: n
|
|
1544
|
-
}),
|
|
1544
|
+
}), D(() => this._callbacks.onPaymentSucceeded?.(n)), !0) : n === "failed" ? (O(b.PAYMENT_FAILED, {
|
|
1545
1545
|
payment_id: t,
|
|
1546
1546
|
status: n
|
|
1547
|
-
}),
|
|
1547
|
+
}), D(() => this._callbacks.onPaymentFailed?.(n)), !1) : e.status === "requires_action" && (O(b.PAYMENT_ACTION_REQUIRED, {
|
|
1548
1548
|
payment_id: t,
|
|
1549
1549
|
status: e.status
|
|
1550
|
-
}),
|
|
1550
|
+
}), D(() => this._callbacks.onActionRequired?.(e.action.redirectUrl)), !0);
|
|
1551
1551
|
}
|
|
1552
|
-
_reportSubmitFailure(
|
|
1553
|
-
let
|
|
1552
|
+
_reportSubmitFailure(e, t) {
|
|
1553
|
+
let n = {
|
|
1554
1554
|
payment_id: this._paymentState.paymentId ?? "",
|
|
1555
|
-
payment_method:
|
|
1555
|
+
payment_method: t
|
|
1556
1556
|
};
|
|
1557
|
-
|
|
1558
|
-
...
|
|
1559
|
-
error_message: this._readErrorMessage(
|
|
1560
|
-
...
|
|
1561
|
-
}), this._readiness.reportSubmit(e
|
|
1557
|
+
O(b.PAYMENT_SUBMIT_STARTED, n), O(b.PAYMENT_SUBMIT_FAILED, {
|
|
1558
|
+
...n,
|
|
1559
|
+
error_message: this._readErrorMessage(e, "Unknown error"),
|
|
1560
|
+
..._(e)
|
|
1561
|
+
}), this._readiness.reportSubmit(v(e, t)), this._handleAuthorizationError(e);
|
|
1562
1562
|
}
|
|
1563
1563
|
_handleAuthorizationError(e) {
|
|
1564
1564
|
let t = this._readErrorMessage(e, ze);
|
|
@@ -1566,8 +1566,8 @@ var ke = class {
|
|
|
1566
1566
|
}
|
|
1567
1567
|
_readErrorMessage(e, t) {
|
|
1568
1568
|
let n = e;
|
|
1569
|
-
return typeof n?.message == "string" && n.message ? n.message :
|
|
1569
|
+
return typeof n?.message == "string" && n.message ? n.message : a(n?.details) ?? t;
|
|
1570
1570
|
}
|
|
1571
1571
|
};
|
|
1572
1572
|
//#endregion
|
|
1573
|
-
export {
|
|
1573
|
+
export { z as AddressCityElement, V as AddressCountryElement, H as AddressFirstNameElement, U as AddressLastNameElement, W as AddressStateElement, G as AddressStreetElement, K as AddressZipCodeElement, q as ApplePayElement, R as BaseElement, Z as CardElement, Q as CardholderElement, je as EmailElement, Ne as ErrorElement, Ue as OdusElements, Ie as PayPalElement, $ as PhoneElement };
|