@getspot/spot-widget 3.0.5 → 3.1.3
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/CHANGELOG.md +29 -0
- package/README.md +1 -0
- package/dist/api.d.ts.map +1 -1
- package/dist/index.es.js +304 -306
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -12
package/dist/index.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
async function x(m, t,
|
|
1
|
+
async function x(m, t, o) {
|
|
2
2
|
try {
|
|
3
3
|
const s = await fetch(m, {
|
|
4
4
|
method: "POST",
|
|
@@ -6,89 +6,90 @@ async function x(m, t, r) {
|
|
|
6
6
|
"Content-Type": "application/json",
|
|
7
7
|
"X-Spot-Partner-Id": t
|
|
8
8
|
},
|
|
9
|
-
body: JSON.stringify(
|
|
10
|
-
}),
|
|
9
|
+
body: JSON.stringify(o)
|
|
10
|
+
}), a = await s.json();
|
|
11
11
|
if (!s.ok) {
|
|
12
|
-
const
|
|
13
|
-
throw
|
|
12
|
+
const r = new Error((a == null ? void 0 : a.message) || "Failed to fetch quote");
|
|
13
|
+
throw r.status = s.status, r.responseBody = a, r;
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return a;
|
|
16
16
|
} catch (s) {
|
|
17
17
|
throw s instanceof Error ? s : new Error("Unknown error occurred while fetching quote");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async function H(m, t,
|
|
20
|
+
async function H(m, t, o) {
|
|
21
21
|
try {
|
|
22
|
-
const s = m.replace("/quote", "/quote/batch"),
|
|
22
|
+
const s = m.replace("/quote", "/quote/batch"), a = await fetch(s, {
|
|
23
23
|
method: "POST",
|
|
24
24
|
headers: {
|
|
25
25
|
"Content-Type": "application/json",
|
|
26
26
|
"X-Spot-Partner-Id": t
|
|
27
27
|
},
|
|
28
|
-
body: JSON.stringify(
|
|
29
|
-
}),
|
|
30
|
-
if (!
|
|
31
|
-
const
|
|
32
|
-
throw
|
|
28
|
+
body: JSON.stringify(o)
|
|
29
|
+
}), r = await a.json();
|
|
30
|
+
if (!a.ok) {
|
|
31
|
+
const i = new Error((r == null ? void 0 : r.message) || "Failed to fetch batch quote");
|
|
32
|
+
throw i.status = a.status, i.responseBody = r, i;
|
|
33
33
|
}
|
|
34
|
-
return
|
|
34
|
+
return r;
|
|
35
35
|
} catch (s) {
|
|
36
36
|
throw s instanceof Error ? s : new Error("Unknown error occurred while fetching batch quote");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
async function I(m, t,
|
|
39
|
+
async function I(m, t, o) {
|
|
40
40
|
var s;
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
43
|
-
cartId:
|
|
44
|
-
cartName:
|
|
45
|
-
currencyCode:
|
|
46
|
-
items:
|
|
47
|
-
cartItemId:
|
|
48
|
-
productPrice:
|
|
49
|
-
productType:
|
|
50
|
-
productDuration:
|
|
51
|
-
productId:
|
|
52
|
-
productName:
|
|
53
|
-
participantDescription:
|
|
54
|
-
eventType:
|
|
55
|
-
|
|
56
|
-
|
|
42
|
+
const a = {
|
|
43
|
+
cartId: o.cartInfo.cartId,
|
|
44
|
+
cartName: o.cartInfo.cartName,
|
|
45
|
+
currencyCode: o.cartInfo.currencyCode,
|
|
46
|
+
items: o.items.map((n, u) => ({
|
|
47
|
+
cartItemId: n.cartItemId || `item-${u + 1}`,
|
|
48
|
+
productPrice: n.productPrice,
|
|
49
|
+
productType: n.productType,
|
|
50
|
+
productDuration: n.productDuration,
|
|
51
|
+
productId: n.productId,
|
|
52
|
+
productName: n.productName,
|
|
53
|
+
participantDescription: n.participantDescription,
|
|
54
|
+
eventType: n.eventType,
|
|
55
|
+
eventId: n.eventId,
|
|
56
|
+
startDate: n.startDate,
|
|
57
|
+
endDate: n.endDate
|
|
57
58
|
}))
|
|
58
|
-
},
|
|
59
|
-
if (
|
|
59
|
+
}, r = await H(m, t, a);
|
|
60
|
+
if (r.status !== "QUOTES_AVAILABLE" && r.status !== "QUOTE_AVAILABLE")
|
|
60
61
|
return { status: "NO_MATCHING_QUOTE" };
|
|
61
|
-
const
|
|
62
|
-
const u =
|
|
63
|
-
(h, f) => (h.cartItemId || `item-${f + 1}`) ===
|
|
62
|
+
const i = r.quotes.map((n) => {
|
|
63
|
+
const u = o.items.find(
|
|
64
|
+
(h, f) => (h.cartItemId || `item-${f + 1}`) === n.cartItemId
|
|
64
65
|
);
|
|
65
|
-
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${
|
|
66
|
-
}),
|
|
66
|
+
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${n.id}`;
|
|
67
|
+
}), e = Math.round((r.totalSpotPrice || r.spotPrice || 0) * 100) / 100;
|
|
67
68
|
return {
|
|
68
69
|
status: "QUOTE_AVAILABLE",
|
|
69
70
|
data: {
|
|
70
|
-
id:
|
|
71
|
-
spotPrice:
|
|
72
|
-
currencyCode:
|
|
71
|
+
id: r.quotes ? r.quotes.map((n) => n.id).join(",") : ((s = r.data) == null ? void 0 : s.id) || "",
|
|
72
|
+
spotPrice: e,
|
|
73
|
+
currencyCode: r.currencyCode || "",
|
|
73
74
|
communication: {
|
|
74
|
-
...
|
|
75
|
-
yesOptionText:
|
|
76
|
-
String(
|
|
77
|
-
String(
|
|
75
|
+
...r.communication,
|
|
76
|
+
yesOptionText: r.communication.yesOptionText.replace(
|
|
77
|
+
String(r.totalSpotPrice),
|
|
78
|
+
String(e)
|
|
78
79
|
)
|
|
79
80
|
},
|
|
80
|
-
payoutSchedule:
|
|
81
|
-
...
|
|
82
|
-
amount:
|
|
81
|
+
payoutSchedule: r.payoutSchedule.map((n) => ({
|
|
82
|
+
...n,
|
|
83
|
+
amount: n.amount !== void 0 ? n.amount : 0
|
|
83
84
|
})),
|
|
84
|
-
coveredItems:
|
|
85
|
-
originalQuotes:
|
|
85
|
+
coveredItems: i,
|
|
86
|
+
originalQuotes: r.quotes || (r.data ? [r.data] : [])
|
|
86
87
|
},
|
|
87
|
-
spotPrice:
|
|
88
|
-
coveredItems:
|
|
88
|
+
spotPrice: e,
|
|
89
|
+
coveredItems: i
|
|
89
90
|
};
|
|
90
|
-
} catch (
|
|
91
|
-
throw
|
|
91
|
+
} catch (a) {
|
|
92
|
+
throw a instanceof Error ? a : new Error("Unknown error occurred while fetching multiple quotes");
|
|
92
93
|
}
|
|
93
94
|
}
|
|
94
95
|
const z = {
|
|
@@ -99,20 +100,20 @@ const z = {
|
|
|
99
100
|
function D(m) {
|
|
100
101
|
const {
|
|
101
102
|
apiConfig: t = {},
|
|
102
|
-
quoteRequestData:
|
|
103
|
+
quoteRequestData: o,
|
|
103
104
|
callbacks: s = {},
|
|
104
|
-
location:
|
|
105
|
-
theme:
|
|
105
|
+
location: a,
|
|
106
|
+
theme: r
|
|
106
107
|
} = m, {
|
|
107
|
-
environment:
|
|
108
|
-
partnerId:
|
|
109
|
-
customEndpoint:
|
|
108
|
+
environment: i = "sandbox",
|
|
109
|
+
partnerId: e,
|
|
110
|
+
customEndpoint: n
|
|
110
111
|
} = t;
|
|
111
|
-
if (!
|
|
112
|
+
if (!e || typeof e != "string")
|
|
112
113
|
throw new Error("Invalid or missing partnerId in apiConfig");
|
|
113
|
-
if (!(
|
|
114
|
-
throw new Error(`Invalid environment in apiConfig: ${
|
|
115
|
-
if (!
|
|
114
|
+
if (!(n || z[i]))
|
|
115
|
+
throw new Error(`Invalid environment in apiConfig: ${i}`);
|
|
116
|
+
if (!o || typeof o != "object" && !Array.isArray(o))
|
|
116
117
|
throw new Error("quoteRequestData must be a non-null object or array");
|
|
117
118
|
const h = [
|
|
118
119
|
"startDate",
|
|
@@ -126,48 +127,48 @@ function D(m) {
|
|
|
126
127
|
"cartId",
|
|
127
128
|
"productName"
|
|
128
129
|
];
|
|
129
|
-
function f(
|
|
130
|
+
function f(p, d = null) {
|
|
130
131
|
const l = d !== null ? `quoteRequestData[${d}]` : "quoteRequestData";
|
|
131
132
|
h.forEach((v) => {
|
|
132
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
133
|
+
if (!Object.prototype.hasOwnProperty.call(p, v) || p[v] === void 0 || p[v] === null)
|
|
133
134
|
throw new Error(`Missing required ${l} field: '${v}'`);
|
|
134
135
|
});
|
|
135
|
-
const
|
|
136
|
-
if (!
|
|
136
|
+
const w = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
137
|
+
if (!w.test(p.startDate))
|
|
137
138
|
throw new Error(`${l}.startDate must be a valid ISO8601 string`);
|
|
138
|
-
if (!
|
|
139
|
+
if (!w.test(p.endDate))
|
|
139
140
|
throw new Error(`${l}.endDate must be a valid ISO8601 string`);
|
|
140
|
-
if (typeof
|
|
141
|
+
if (typeof p.currencyCode != "string")
|
|
141
142
|
throw new Error(`${l}.currencyCode must be a string`);
|
|
142
|
-
if (!["USD", "CAD", "AUD"].includes(
|
|
143
|
-
throw new Error(`Invalid ${l}.currencyCode: ${
|
|
144
|
-
if (typeof
|
|
143
|
+
if (!["USD", "CAD", "AUD"].includes(p.currencyCode))
|
|
144
|
+
throw new Error(`Invalid ${l}.currencyCode: ${p.currencyCode}`);
|
|
145
|
+
if (typeof p.eventType != "string")
|
|
145
146
|
throw new Error(`${l}.eventType must be a string`);
|
|
146
|
-
if (typeof
|
|
147
|
+
if (typeof p.productType != "string")
|
|
147
148
|
throw new Error(`${l}.productType must be a string`);
|
|
148
149
|
const g = ["Pass", "Trip", "Registration"];
|
|
149
|
-
if (!g.includes(
|
|
150
|
+
if (!g.includes(p.productType))
|
|
150
151
|
throw new Error(
|
|
151
152
|
`${l}.productType must be one of ${g.join(", ")}`
|
|
152
153
|
);
|
|
153
|
-
if (typeof
|
|
154
|
+
if (typeof p.productDuration != "string")
|
|
154
155
|
throw new Error(`${l}.productDuration must be a string`);
|
|
155
|
-
const
|
|
156
|
-
if (!
|
|
156
|
+
const b = ["Daily", "Seasonal", "Trip", "Event"];
|
|
157
|
+
if (!b.includes(p.productDuration))
|
|
157
158
|
throw new Error(
|
|
158
|
-
`${l}.productDuration must be one of ${
|
|
159
|
+
`${l}.productDuration must be one of ${b.join(", ")}`
|
|
159
160
|
);
|
|
160
|
-
if (typeof
|
|
161
|
+
if (typeof p.productPrice != "number" || isNaN(p.productPrice))
|
|
161
162
|
throw new Error(`${l}.productPrice must be a valid number`);
|
|
162
|
-
if (typeof
|
|
163
|
+
if (typeof p.productId != "string")
|
|
163
164
|
throw new Error(`${l}.productId must be a string`);
|
|
164
|
-
if (typeof
|
|
165
|
+
if (typeof p.cartId != "string")
|
|
165
166
|
throw new Error(`${l}.cartId must be a string`);
|
|
166
|
-
if (typeof
|
|
167
|
+
if (typeof p.productName != "string")
|
|
167
168
|
throw new Error(`${l}.productName must be a string`);
|
|
168
169
|
}
|
|
169
|
-
if ("cartInfo" in
|
|
170
|
-
const
|
|
170
|
+
if ("cartInfo" in o && "items" in o) {
|
|
171
|
+
const p = o, { cartInfo: d, items: l } = p;
|
|
171
172
|
if (!d || typeof d != "object")
|
|
172
173
|
throw new Error("quoteRequestData.cartInfo must be a non-null object");
|
|
173
174
|
if (!d.cartId || typeof d.cartId != "string")
|
|
@@ -190,10 +191,10 @@ function D(m) {
|
|
|
190
191
|
"productId",
|
|
191
192
|
"productName"
|
|
192
193
|
];
|
|
193
|
-
l.forEach((g,
|
|
194
|
+
l.forEach((g, b) => {
|
|
194
195
|
if (!g || typeof g != "object")
|
|
195
|
-
throw new Error(`quoteRequestData.items[${
|
|
196
|
-
const v = `quoteRequestData.items[${
|
|
196
|
+
throw new Error(`quoteRequestData.items[${b}] must be a non-null object`);
|
|
197
|
+
const v = `quoteRequestData.items[${b}]`;
|
|
197
198
|
_.forEach((C) => {
|
|
198
199
|
if (!Object.prototype.hasOwnProperty.call(g, C) || g[C] === void 0 || g[C] === null)
|
|
199
200
|
throw new Error(`Missing required ${v} field: '${C}'`);
|
|
@@ -207,14 +208,14 @@ function D(m) {
|
|
|
207
208
|
throw new Error(`${v}.eventType must be a string`);
|
|
208
209
|
if (typeof g.productType != "string")
|
|
209
210
|
throw new Error(`${v}.productType must be a string`);
|
|
210
|
-
const
|
|
211
|
-
if (!
|
|
212
|
-
throw new Error(`${v}.productType must be one of ${
|
|
211
|
+
const k = ["Pass", "Trip", "Registration"];
|
|
212
|
+
if (!k.includes(g.productType))
|
|
213
|
+
throw new Error(`${v}.productType must be one of ${k.join(", ")}`);
|
|
213
214
|
if (typeof g.productDuration != "string")
|
|
214
215
|
throw new Error(`${v}.productDuration must be a string`);
|
|
215
|
-
const
|
|
216
|
-
if (!
|
|
217
|
-
throw new Error(`${v}.productDuration must be one of ${
|
|
216
|
+
const E = ["Daily", "Seasonal", "Trip", "Event"];
|
|
217
|
+
if (!E.includes(g.productDuration))
|
|
218
|
+
throw new Error(`${v}.productDuration must be one of ${E.join(", ")}`);
|
|
218
219
|
if (typeof g.productPrice != "number" || isNaN(g.productPrice))
|
|
219
220
|
throw new Error(`${v}.productPrice must be a valid number`);
|
|
220
221
|
if (typeof g.productId != "string")
|
|
@@ -222,71 +223,71 @@ function D(m) {
|
|
|
222
223
|
if (typeof g.productName != "string")
|
|
223
224
|
throw new Error(`${v}.productName must be a string`);
|
|
224
225
|
});
|
|
225
|
-
} else if (Array.isArray(
|
|
226
|
-
if (
|
|
226
|
+
} else if (Array.isArray(o)) {
|
|
227
|
+
if (o.length === 0)
|
|
227
228
|
throw new Error("quoteRequestData array cannot be empty");
|
|
228
|
-
|
|
229
|
-
if (!
|
|
229
|
+
o.forEach((p, d) => {
|
|
230
|
+
if (!p || typeof p != "object")
|
|
230
231
|
throw new Error(`quoteRequestData[${d}] must be a non-null object`);
|
|
231
|
-
f(
|
|
232
|
+
f(p, d);
|
|
232
233
|
});
|
|
233
234
|
} else
|
|
234
|
-
f(
|
|
235
|
+
f(o);
|
|
235
236
|
if ([
|
|
236
237
|
"onOptIn",
|
|
237
238
|
"onOptOut",
|
|
238
239
|
"onQuoteRetrieved",
|
|
239
240
|
"onError",
|
|
240
241
|
"noMatchingQuote"
|
|
241
|
-
].forEach((
|
|
242
|
-
const d = s[
|
|
242
|
+
].forEach((p) => {
|
|
243
|
+
const d = s[p];
|
|
243
244
|
if (d && typeof d != "function")
|
|
244
|
-
throw new Error(`Callback '${
|
|
245
|
-
}), typeof
|
|
246
|
-
throw new Error(`Invalid location selector: '${
|
|
247
|
-
if (
|
|
245
|
+
throw new Error(`Callback '${p}' must be a function.`);
|
|
246
|
+
}), typeof a == "string" && !document.querySelector(a))
|
|
247
|
+
throw new Error(`Invalid location selector: '${a}'`);
|
|
248
|
+
if (r && typeof r != "object")
|
|
248
249
|
throw new Error(
|
|
249
250
|
"Theme must be an object with CSS variables, do not include the '--' prefix"
|
|
250
251
|
);
|
|
251
252
|
}
|
|
252
|
-
function
|
|
253
|
-
const
|
|
254
|
-
return
|
|
253
|
+
function c(m, { text: t, className: o, parent: s, innerHTML: a, href: r, target: i } = {}) {
|
|
254
|
+
const e = document.createElement(m);
|
|
255
|
+
return o && (e.className = o), t != null && (e.textContent = t), a != null && (e.innerHTML = a), r && "href" in e && (e.href = r), i && "target" in e && (e.target = i), s && s.appendChild(e), e;
|
|
255
256
|
}
|
|
256
|
-
function N(m, { name: t, description:
|
|
257
|
-
|
|
257
|
+
function N(m, { name: t, description: o }) {
|
|
258
|
+
c("div", {
|
|
258
259
|
className: "spot-header__title",
|
|
259
260
|
text: t,
|
|
260
261
|
parent: m
|
|
261
|
-
}),
|
|
262
|
+
}), c("div", {
|
|
262
263
|
className: "spot-header__description",
|
|
263
|
-
text:
|
|
264
|
+
text: o,
|
|
264
265
|
parent: m
|
|
265
266
|
});
|
|
266
267
|
}
|
|
267
268
|
function M(m, t = []) {
|
|
268
|
-
const
|
|
269
|
+
const o = c("ul", {
|
|
269
270
|
className: "spot-benefits__list",
|
|
270
271
|
parent: m
|
|
271
272
|
});
|
|
272
273
|
t.forEach((s) => {
|
|
273
|
-
const
|
|
274
|
-
|
|
274
|
+
const a = c("li", { parent: o });
|
|
275
|
+
a.innerHTML = `
|
|
275
276
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" class="spot-bullets__checkmark">
|
|
276
277
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
277
278
|
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
278
|
-
</svg>`,
|
|
279
|
+
</svg>`, c("span", { text: s, parent: a });
|
|
279
280
|
});
|
|
280
281
|
}
|
|
281
282
|
function L(m, t = []) {
|
|
282
283
|
if (!t || t.length === 0) return;
|
|
283
|
-
const
|
|
284
|
+
const o = c("div", {
|
|
284
285
|
className: "spot-qualifying-reasons__container",
|
|
285
286
|
parent: m
|
|
286
|
-
}), s = [...t].sort((
|
|
287
|
+
}), s = [...t].sort((e, n) => e.rank - n.rank), a = c("div", {
|
|
287
288
|
className: "spot-qualifying-reasons__grid",
|
|
288
|
-
parent:
|
|
289
|
-
}),
|
|
289
|
+
parent: o
|
|
290
|
+
}), r = {
|
|
290
291
|
"Accident & Illness": "cross.svg",
|
|
291
292
|
"Family Emergencies": "users.svg",
|
|
292
293
|
Layoffs: "building.svg",
|
|
@@ -296,158 +297,158 @@ function L(m, t = []) {
|
|
|
296
297
|
"Travel Interruption": "plane.svg",
|
|
297
298
|
"Military Duty": "medal.svg"
|
|
298
299
|
};
|
|
299
|
-
let
|
|
300
|
+
let i;
|
|
300
301
|
try {
|
|
301
|
-
const
|
|
302
|
-
if (
|
|
303
|
-
const
|
|
304
|
-
|
|
302
|
+
const e = document.currentScript;
|
|
303
|
+
if (e != null && e.src) {
|
|
304
|
+
const n = new URL(e.src);
|
|
305
|
+
i = n.origin + n.pathname.replace(/\/[^/]*$/, "/");
|
|
305
306
|
} else
|
|
306
|
-
|
|
307
|
-
|
|
307
|
+
i = window.location.origin + window.location.pathname.replace(/\/[^/]*$/, "/");
|
|
308
|
+
i += "assets/";
|
|
308
309
|
} catch {
|
|
309
|
-
|
|
310
|
+
i = "./assets/";
|
|
310
311
|
}
|
|
311
|
-
s.forEach((
|
|
312
|
-
var f, y,
|
|
313
|
-
const
|
|
312
|
+
s.forEach((e) => {
|
|
313
|
+
var f, y, p;
|
|
314
|
+
const n = c("div", {
|
|
314
315
|
className: "spot-qualifying-reasons__item",
|
|
315
|
-
parent: i
|
|
316
|
-
}), u = p("div", {
|
|
317
|
-
className: "spot-qualifying-reasons__icon-wrapper",
|
|
318
316
|
parent: a
|
|
319
|
-
}),
|
|
317
|
+
}), u = c("div", {
|
|
318
|
+
className: "spot-qualifying-reasons__icon-wrapper",
|
|
319
|
+
parent: n
|
|
320
|
+
}), h = r[((f = e.benefitType) == null ? void 0 : f.name) || ""] || r[e.name || ""];
|
|
320
321
|
if (h) {
|
|
321
|
-
const d =
|
|
322
|
+
const d = c("img", {
|
|
322
323
|
parent: u
|
|
323
324
|
});
|
|
324
|
-
d.src =
|
|
325
|
+
d.src = i + h, d.alt = ((y = e.benefitType) == null ? void 0 : y.name) || e.name || "", d.className = "spot-qualifying-reasons__icon";
|
|
325
326
|
}
|
|
326
|
-
|
|
327
|
+
c("span", {
|
|
327
328
|
className: "spot-qualifying-reasons__label",
|
|
328
|
-
text: ((
|
|
329
|
-
parent:
|
|
329
|
+
text: ((p = e.benefitType) == null ? void 0 : p.name) || e.name || "",
|
|
330
|
+
parent: n
|
|
330
331
|
});
|
|
331
332
|
});
|
|
332
333
|
}
|
|
333
|
-
function O(m, t = [],
|
|
334
|
-
if (t.length === 0 || !
|
|
334
|
+
function O(m, t = [], o) {
|
|
335
|
+
if (t.length === 0 || !o || o <= 1)
|
|
335
336
|
return;
|
|
336
337
|
const s = /* @__PURE__ */ new Map();
|
|
337
338
|
t.forEach((d) => {
|
|
338
339
|
s.set(d, (s.get(d) || 0) + 1);
|
|
339
340
|
});
|
|
340
|
-
const
|
|
341
|
+
const r = Array.from(s.entries()).map(
|
|
341
342
|
([d, l]) => ({
|
|
342
343
|
item: d,
|
|
343
344
|
count: l,
|
|
344
345
|
displayText: l > 1 ? `${l} x ${d}` : d
|
|
345
346
|
})
|
|
346
347
|
).sort((d, l) => {
|
|
347
|
-
const
|
|
348
|
-
return !g &&
|
|
349
|
-
}),
|
|
348
|
+
const w = d.item.charAt(0), _ = l.item.charAt(0), g = /[a-zA-Z]/.test(w), b = /[a-zA-Z]/.test(_);
|
|
349
|
+
return !g && b ? -1 : g && !b ? 1 : d.item.localeCompare(l.item, void 0, { sensitivity: "base" });
|
|
350
|
+
}), i = c("div", {
|
|
350
351
|
className: "spot-covered-items__container",
|
|
351
352
|
parent: m
|
|
352
|
-
}),
|
|
353
|
+
}), e = c("div", {
|
|
353
354
|
className: "spot-covered-items__header",
|
|
354
|
-
parent:
|
|
355
|
-
}),
|
|
355
|
+
parent: i
|
|
356
|
+
}), n = c("button", {
|
|
356
357
|
className: "spot-covered-items__toggle",
|
|
357
|
-
parent:
|
|
358
|
+
parent: e
|
|
358
359
|
});
|
|
359
|
-
|
|
360
|
+
c("span", {
|
|
360
361
|
className: "spot-covered-items__title",
|
|
361
362
|
text: `Items Covered in Your Cart (${t.length})`,
|
|
362
|
-
parent:
|
|
363
|
+
parent: n
|
|
363
364
|
});
|
|
364
|
-
const u =
|
|
365
|
+
const u = c("div", {
|
|
365
366
|
className: "spot-covered-items__right-section",
|
|
366
|
-
parent:
|
|
367
|
+
parent: n
|
|
367
368
|
});
|
|
368
|
-
|
|
369
|
+
c("span", {
|
|
369
370
|
className: "spot-covered-items__view-all",
|
|
370
371
|
text: "View All",
|
|
371
372
|
parent: u
|
|
372
373
|
});
|
|
373
|
-
const h =
|
|
374
|
+
const h = c("span", {
|
|
374
375
|
className: "spot-covered-items__arrow",
|
|
375
376
|
innerHTML: "▼",
|
|
376
377
|
parent: u
|
|
377
|
-
}), f =
|
|
378
|
+
}), f = c("div", {
|
|
378
379
|
className: "spot-covered-items__content",
|
|
379
|
-
parent:
|
|
380
|
-
}), y =
|
|
380
|
+
parent: i
|
|
381
|
+
}), y = c("ul", {
|
|
381
382
|
className: "spot-covered-items__list",
|
|
382
383
|
parent: f
|
|
383
384
|
});
|
|
384
|
-
|
|
385
|
-
const l =
|
|
386
|
-
|
|
385
|
+
r.forEach(({ displayText: d }) => {
|
|
386
|
+
const l = c("li", { parent: y });
|
|
387
|
+
c("span", { text: d, parent: l });
|
|
387
388
|
});
|
|
388
|
-
let
|
|
389
|
-
f.style.display = "none",
|
|
390
|
-
|
|
391
|
-
}),
|
|
389
|
+
let p = !1;
|
|
390
|
+
f.style.display = "none", n.addEventListener("click", () => {
|
|
391
|
+
p = !p, f.style.display = p ? "block" : "none", h.innerHTML = p ? "▲" : "▼", n.setAttribute("aria-expanded", p.toString());
|
|
392
|
+
}), n.setAttribute("aria-expanded", "false"), n.setAttribute("aria-controls", "covered-items-list"), f.setAttribute("id", "covered-items-list");
|
|
392
393
|
}
|
|
393
|
-
function
|
|
394
|
-
const
|
|
394
|
+
function $(m, t = []) {
|
|
395
|
+
const o = c("div", {
|
|
395
396
|
className: "spot-table__container",
|
|
396
397
|
parent: m
|
|
397
|
-
}), s =
|
|
398
|
+
}), s = c("table", {
|
|
398
399
|
className: "spot-refund__table spot-table--dynamic",
|
|
399
|
-
parent:
|
|
400
|
-
}),
|
|
401
|
-
|
|
402
|
-
const
|
|
403
|
-
t.forEach(({ text:
|
|
404
|
-
const h =
|
|
405
|
-
|
|
406
|
-
const f =
|
|
407
|
-
|
|
400
|
+
parent: o
|
|
401
|
+
}), a = c("thead", { parent: s }), r = c("tr", { parent: a });
|
|
402
|
+
c("th", { text: "When you cancel", parent: r }), c("th", { text: "You will receive", parent: r });
|
|
403
|
+
const i = c("tbody", { parent: s });
|
|
404
|
+
t.forEach(({ text: e, percent: n, amount: u }) => {
|
|
405
|
+
const h = c("tr", { parent: i });
|
|
406
|
+
c("td", { text: e, parent: h });
|
|
407
|
+
const f = n === "Not eligible for refund" ? "Not eligible for a refund" : `$${u} refund`;
|
|
408
|
+
c("td", { text: f, parent: h });
|
|
408
409
|
});
|
|
409
410
|
}
|
|
410
|
-
function
|
|
411
|
-
const s =
|
|
411
|
+
function P(m, t, o) {
|
|
412
|
+
const s = c("div", {
|
|
412
413
|
className: "spot-selection__options",
|
|
413
414
|
parent: m
|
|
414
|
-
}),
|
|
415
|
+
}), a = c("label", {
|
|
415
416
|
className: `spot-selection__option ${t ? "selected" : ""}`,
|
|
416
417
|
parent: s
|
|
417
|
-
}),
|
|
418
|
-
|
|
419
|
-
text:
|
|
420
|
-
parent:
|
|
421
|
-
}),
|
|
418
|
+
}), r = c("input", { parent: a });
|
|
419
|
+
r.type = "radio", r.name = "selection", r.value = "yes", t && (r.checked = !0), c("strong", {
|
|
420
|
+
text: o.yesOptionText,
|
|
421
|
+
parent: a
|
|
422
|
+
}), c("span", {
|
|
422
423
|
className: "spot-selection__recommended-tag",
|
|
423
424
|
text: "Recommended",
|
|
424
|
-
parent:
|
|
425
|
+
parent: a
|
|
425
426
|
});
|
|
426
|
-
const
|
|
427
|
+
const i = c("label", {
|
|
427
428
|
className: "spot-selection__option",
|
|
428
429
|
parent: s
|
|
429
|
-
}),
|
|
430
|
-
return
|
|
430
|
+
}), e = c("input", { parent: i });
|
|
431
|
+
return e.type = "radio", e.name = "selection", e.value = "no", c("span", { text: o.noOptionText, parent: i }), s;
|
|
431
432
|
}
|
|
432
433
|
function R(m, t) {
|
|
433
|
-
var
|
|
434
|
-
const
|
|
434
|
+
var a;
|
|
435
|
+
const o = (a = t.communication) == null ? void 0 : a.paymentTerms, s = c("div", {
|
|
435
436
|
className: "spot-payment-terms",
|
|
436
437
|
parent: m
|
|
437
438
|
});
|
|
438
|
-
return
|
|
439
|
+
return c("div", {
|
|
439
440
|
className: "spot-payment-terms__header",
|
|
440
441
|
text: "PAYMENT TERMS",
|
|
441
442
|
parent: s
|
|
442
|
-
}),
|
|
443
|
+
}), c("div", {
|
|
443
444
|
className: "spot-payment-terms__body",
|
|
444
|
-
text:
|
|
445
|
+
text: o || "",
|
|
445
446
|
parent: s
|
|
446
447
|
}), s;
|
|
447
448
|
}
|
|
448
|
-
function V(m, t,
|
|
449
|
-
if (
|
|
450
|
-
const e =
|
|
449
|
+
function V(m, t, o = "bottom-right") {
|
|
450
|
+
if (o === "top-right") {
|
|
451
|
+
const e = c("div", {
|
|
451
452
|
className: "spot-logo__top-right",
|
|
452
453
|
parent: m
|
|
453
454
|
});
|
|
@@ -468,24 +469,21 @@ function V(m, t, r = "bottom-right") {
|
|
|
468
469
|
</defs>
|
|
469
470
|
</svg>`;
|
|
470
471
|
}
|
|
471
|
-
const s =
|
|
472
|
+
const s = c("div", {
|
|
472
473
|
className: "spot-footer__container",
|
|
473
474
|
parent: m
|
|
474
|
-
}),
|
|
475
|
+
}), a = c("div", {
|
|
475
476
|
className: "spot-footer__terms",
|
|
476
477
|
parent: s
|
|
477
|
-
})
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
parent: i
|
|
487
|
-
}), r === "bottom-right") {
|
|
488
|
-
const e = p("p", {
|
|
478
|
+
}), r = `<a href="${t.communication.termsAndConditionsUrl}" target="_blank" class="spot-footer__terms-link">Terms & Conditions</a>`, i = t.communication.legalDisclaimer.replace(
|
|
479
|
+
/terms and conditions/gi,
|
|
480
|
+
r
|
|
481
|
+
);
|
|
482
|
+
if (c("span", {
|
|
483
|
+
innerHTML: i,
|
|
484
|
+
parent: a
|
|
485
|
+
}), o === "bottom-right") {
|
|
486
|
+
const e = c("p", {
|
|
489
487
|
className: "spot-footer__powered-by",
|
|
490
488
|
parent: s
|
|
491
489
|
});
|
|
@@ -508,7 +506,7 @@ function V(m, t, r = "bottom-right") {
|
|
|
508
506
|
}
|
|
509
507
|
return s;
|
|
510
508
|
}
|
|
511
|
-
const Q = ":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-bullets-checkmark-color: #2e2e2e;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-covered-items-background: #f1f3f5;--spot-covered-items-hover-background: #e9ecef;--spot-covered-items-border-radius: .5rem;--spot-covered-items-padding: .75rem 1rem;--spot-covered-items-font-size: .875rem;--spot-covered-items-font-weight: 400;--spot-covered-items-font-color: #000000;--spot-covered-items-font-family: Arial;--spot-covered-items-arrow-font-size: .6rem;--spot-covered-items-arrow-color: #636569;--spot-covered-items-view-all-color: #636569;--spot-covered-items-view-all-font-size: .875rem;--spot-covered-items-view-all-font-weight: 400;--spot-covered-items-content-background: #f8f9fa;--spot-covered-items-content-border: 1px solid #e0e0e0;--spot-covered-items-content-border-radius: .5rem;--spot-covered-items-content-padding: .75rem 1rem;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 1.5rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:51rem;margin:1rem;container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__options{min-width:0;word-wrap:normal}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container{grid-row:1;margin-bottom:var(--spot-benefits-margin-bottom)}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1;margin-bottom:var(--spot-covered-items-margin-bottom)}.desktop-layout .spot-selection__options{grid-row:3;margin-top:var(--spot-desktop-radio-margin-top)}.desktop-layout .spot-payment-terms__wrapper{grid-row:4;grid-column:1;margin-top:var(--spot-payment-terms-margin-top)}.desktop-layout .spot-table__container{grid-row:1 / span 4;grid-column:2;width:auto;min-width:20.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-table__container{display:flex;justify-content:flex-start;margin-top:1rem;margin-bottom:1rem;padding-left:.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-refund__table{width:100%;max-width:22rem;table-layout:auto}@media (max-width: 850px){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 500px){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 600px){.spot-refund__table th{padding:0rem}}.spot-benefits__list{list-style-type:none;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-benefits__list li{margin-bottom:.375rem;display:flex;align-items:flex-start;gap:.5rem}.spot-benefits__list li svg{flex-shrink:0;position:relative;top:.125rem}.spot-bullets__checkmark path{stroke:var(--spot-bullets-checkmark-color)}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:.85rem;margin-bottom:.5rem;max-width:26rem}.spot-content__wrapper.desktop-layout:has(.spot-table__container) .spot-covered-items__container{margin-top:0rem;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-covered-items__list li:last-child{margin-bottom:0}.spot-covered-items__header{margin-bottom:.5rem}.spot-covered-items__toggle{background:var(--spot-covered-items-background);border:none;border-radius:var(--spot-covered-items-border-radius);padding:var(--spot-covered-items-padding);cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;transition:all .2s ease}.spot-covered-items__toggle:hover{background-color:var(--spot-covered-items-hover-background)}.spot-covered-items__toggle:focus{outline:none;box-shadow:0 0 0 2px #0000001a}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;margin:0;padding:0}.spot-covered-items__right-section{display:flex;align-items:center;gap:.5rem;margin-left:auto}.spot-covered-items__view-all{font-size:var(--spot-covered-items-view-all-font-size);font-weight:var(--spot-covered-items-view-all-font-weight);color:var(--spot-covered-items-view-all-color);font-family:var(--spot-covered-items-font-family);line-height:125%}.spot-covered-items__arrow{font-size:var(--spot-covered-items-arrow-font-size);transition:transform .2s ease;color:var(--spot-covered-items-arrow-color);flex-shrink:0;transform:scaleX(1.5)}.spot-covered-items__content{margin-top:.5rem;transition:all .2s ease;overflow:hidden}.spot-covered-items__list{background-color:var(--spot-covered-items-content-background);border:var(--spot-covered-items-content-border);border-radius:var(--spot-covered-items-content-border-radius);margin:0;padding:var(--spot-covered-items-content-padding)}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;min-width:.75rem;border:.0625rem solid var(--spot-radio-border);border-radius:var(--spot-radio-border-radius);margin-right:.5rem;position:relative;vertical-align:middle;top:-.0625rem;cursor:pointer;flex-shrink:0}input[type=radio]:checked{background:var(--spot-radio-checked-background);box-shadow:inset 0 0 0 .0625rem #fff}.spot-selection__options{display:flex;flex-direction:column;gap:.5rem}.spot-selection__option{display:flex;align-items:center;flex-wrap:nowrap;position:relative;transition:background .2s;cursor:pointer;font-size:var(--spot-radio-text-font-size);font-weight:var(--spot-radio-text-font-weight);color:var(--spot-radio-text-font-color);font-family:var(--spot-radio-text-font-family);padding:var(--spot-radio-text-padding);margin-right:.5rem}.spot-selection__option.selected{background:var(--spot-radio-selection-background);border-radius:var(--spot-radio-selection-border-radius);padding:var(--spot-radio-selection-padding)}.spot-selection__recommended-tag{background:var(--spot-recommended-tag-background);color:var(--spot-recommended-tag-font-color);font-size:var(--spot-recommended-tag-font-size);font-weight:var(--spot-recommended-tag-font-weight);padding:var(--spot-recommended-tag-padding);border-radius:var(--spot-recommended-tag-border-radius);margin-left:.75rem;white-space:nowrap;flex-shrink:0}@media (max-width: 850px){.spot-selection__recommended-tag{margin-left:.5rem}}@media (max-width: 600px){.spot-selection__recommended-tag{margin-left:.5rem;font-size:.75rem;padding:.1875rem .4375rem}}.spot-selection__error{color:var(--spot-selection-error-font-color);font-size:var(--spot-selection-error-font-size);padding:var(--spot-selection-error-padding);display:none}.spot-payment-terms__wrapper{margin-top:1rem}.spot-payment-terms__header{font-weight:var(--spot-payment-terms-header-font-weight);margin-bottom:.5rem;padding:var(--spot-payment-terms-header-padding);font-size:var(--spot-payment-terms-header-font-size);border-bottom:1px solid var(--spot-payment-terms-header-border-color)}.spot-payment-terms{background-color:var(--spot-payment-terms-background);border-radius:var(--spot-payment-terms-border-radius);padding:var(--spot-payment-terms-padding);margin-right:.5rem;color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);line-height:1.4;word-wrap:normal;-webkit-hyphens:none;hyphens:none;flex:1;min-width:0;overflow-wrap:normal}.spot-footer__terms-link{text-decoration:var(--spot-terms-link-text-decoration);font-size:var(--spot-terms-link-font-size);font-weight:var(--spot-terms-link-font-weight);color:var(--spot-terms-link-font-color);font-family:var(--spot-terms-link-font-family);padding:var(--spot-terms-link-padding)}.spot-footer__container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;flex-wrap:nowrap;gap:var(--spot-footer-gap)}@container (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}@media (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}.spot-footer__powered-by{margin-top:0;flex-shrink:0}.spot-logo__top-right{position:absolute;top:-14px;right:40px;z-index:10;background:#fff;padding:0 8px}@container (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}@media (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}";
|
|
509
|
+
const Q = ":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-max-width: 51rem;--spot-margin: 1rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-bullets-checkmark-color: #2e2e2e;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-covered-items-background: #f1f3f5;--spot-covered-items-hover-background: #e9ecef;--spot-covered-items-border-radius: .5rem;--spot-covered-items-padding: .75rem 1rem;--spot-covered-items-font-size: .875rem;--spot-covered-items-font-weight: 400;--spot-covered-items-font-color: #000000;--spot-covered-items-font-family: Arial;--spot-covered-items-arrow-font-size: .6rem;--spot-covered-items-arrow-color: #636569;--spot-covered-items-view-all-color: #636569;--spot-covered-items-view-all-font-size: .875rem;--spot-covered-items-view-all-font-weight: 400;--spot-covered-items-content-background: #f8f9fa;--spot-covered-items-content-border: 1px solid #e0e0e0;--spot-covered-items-content-border-radius: .5rem;--spot-covered-items-content-padding: .75rem 1rem;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 1.5rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:var(--spot-max-width);margin:var(--spot-margin);container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__options{min-width:0;word-wrap:normal}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container{grid-row:1;margin-bottom:var(--spot-benefits-margin-bottom)}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1;margin-bottom:var(--spot-covered-items-margin-bottom)}.desktop-layout .spot-selection__options{grid-row:3;margin-top:var(--spot-desktop-radio-margin-top)}.desktop-layout .spot-payment-terms__wrapper{grid-row:4;grid-column:1;margin-top:var(--spot-payment-terms-margin-top)}.desktop-layout .spot-table__container{grid-row:1 / span 4;grid-column:2;width:auto;min-width:20.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-table__container{display:flex;justify-content:flex-start;margin-top:1rem;margin-bottom:1rem;padding-left:.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-refund__table{width:100%;max-width:22rem;table-layout:auto}@media (max-width: 850px){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 500px){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 600px){.spot-refund__table th{padding:0rem}}.spot-benefits__list{list-style-type:none;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-benefits__list li{margin-bottom:.375rem;display:flex;align-items:flex-start;gap:.5rem}.spot-benefits__list li svg{flex-shrink:0;position:relative;top:.125rem}.spot-bullets__checkmark path{stroke:var(--spot-bullets-checkmark-color)}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:.85rem;margin-bottom:.5rem;max-width:26rem}.spot-content__wrapper.desktop-layout:has(.spot-table__container) .spot-covered-items__container{margin-top:0rem;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-covered-items__list li:last-child{margin-bottom:0}.spot-covered-items__header{margin-bottom:.5rem}.spot-covered-items__toggle{background:var(--spot-covered-items-background);border:none;border-radius:var(--spot-covered-items-border-radius);padding:var(--spot-covered-items-padding);cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;transition:all .2s ease}.spot-covered-items__toggle:hover{background-color:var(--spot-covered-items-hover-background)}.spot-covered-items__toggle:focus{outline:none;box-shadow:0 0 0 2px #0000001a}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;margin:0;padding:0}.spot-covered-items__right-section{display:flex;align-items:center;gap:.5rem;margin-left:auto}.spot-covered-items__view-all{font-size:var(--spot-covered-items-view-all-font-size);font-weight:var(--spot-covered-items-view-all-font-weight);color:var(--spot-covered-items-view-all-color);font-family:var(--spot-covered-items-font-family);line-height:125%}.spot-covered-items__arrow{font-size:var(--spot-covered-items-arrow-font-size);transition:transform .2s ease;color:var(--spot-covered-items-arrow-color);flex-shrink:0;transform:scaleX(1.5)}.spot-covered-items__content{margin-top:.5rem;transition:all .2s ease;overflow:hidden}.spot-covered-items__list{background-color:var(--spot-covered-items-content-background);border:var(--spot-covered-items-content-border);border-radius:var(--spot-covered-items-content-border-radius);margin:0;padding:var(--spot-covered-items-content-padding)}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;min-width:.75rem;border:.0625rem solid var(--spot-radio-border);border-radius:var(--spot-radio-border-radius);margin-right:.5rem;position:relative;vertical-align:middle;top:-.0625rem;cursor:pointer;flex-shrink:0}input[type=radio]:checked{background:var(--spot-radio-checked-background);box-shadow:inset 0 0 0 .0625rem #fff}.spot-selection__options{display:flex;flex-direction:column;gap:.5rem}.spot-selection__option{display:flex;align-items:center;flex-wrap:nowrap;position:relative;transition:background .2s;cursor:pointer;font-size:var(--spot-radio-text-font-size);font-weight:var(--spot-radio-text-font-weight);color:var(--spot-radio-text-font-color);font-family:var(--spot-radio-text-font-family);padding:var(--spot-radio-text-padding);margin-right:.5rem}.spot-selection__option.selected{background:var(--spot-radio-selection-background);border-radius:var(--spot-radio-selection-border-radius);padding:var(--spot-radio-selection-padding)}.spot-selection__recommended-tag{background:var(--spot-recommended-tag-background);color:var(--spot-recommended-tag-font-color);font-size:var(--spot-recommended-tag-font-size);font-weight:var(--spot-recommended-tag-font-weight);padding:var(--spot-recommended-tag-padding);border-radius:var(--spot-recommended-tag-border-radius);margin-left:.75rem;white-space:nowrap;flex-shrink:0}@media (max-width: 850px){.spot-selection__recommended-tag{margin-left:.5rem}}@media (max-width: 600px){.spot-selection__recommended-tag{margin-left:.5rem;font-size:.75rem;padding:.1875rem .4375rem}}.spot-selection__error{color:var(--spot-selection-error-font-color);font-size:var(--spot-selection-error-font-size);padding:var(--spot-selection-error-padding);display:none}.spot-payment-terms__wrapper{margin-top:1rem}.spot-payment-terms__header{font-weight:var(--spot-payment-terms-header-font-weight);margin-bottom:.5rem;padding:var(--spot-payment-terms-header-padding);font-size:var(--spot-payment-terms-header-font-size);border-bottom:1px solid var(--spot-payment-terms-header-border-color)}.spot-payment-terms{background-color:var(--spot-payment-terms-background);border-radius:var(--spot-payment-terms-border-radius);padding:var(--spot-payment-terms-padding);margin-right:.5rem;color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);line-height:1.4;word-wrap:normal;-webkit-hyphens:none;hyphens:none;flex:1;min-width:0;overflow-wrap:normal}.spot-footer__terms-link{text-decoration:var(--spot-terms-link-text-decoration);font-size:var(--spot-terms-link-font-size);font-weight:var(--spot-terms-link-font-weight);color:var(--spot-terms-link-font-color);font-family:var(--spot-terms-link-font-family);padding:var(--spot-terms-link-padding)}.spot-footer__container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;flex-wrap:nowrap;gap:var(--spot-footer-gap)}@container (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}@media (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}.spot-footer__powered-by{margin-top:0;flex-shrink:0}.spot-logo__top-right{position:absolute;top:-14px;right:40px;z-index:10;background:#fff;padding:0 8px}@container (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}@media (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}";
|
|
512
510
|
function S(m) {
|
|
513
511
|
const t = document.createElement("style");
|
|
514
512
|
t.textContent = m, document.head.appendChild(t);
|
|
@@ -534,45 +532,45 @@ class A {
|
|
|
534
532
|
}, this._onResize = this._updateLayout.bind(this), this.root = typeof this.options.location == "string" ? document.querySelector(this.options.location) : this.options.location, this.currentSelection = this.options.optInSelected ? "yes" : null, this._init();
|
|
535
533
|
}
|
|
536
534
|
async _init() {
|
|
537
|
-
var t,
|
|
535
|
+
var t, o, s, a, r;
|
|
538
536
|
try {
|
|
539
537
|
D(this.options);
|
|
540
|
-
let
|
|
538
|
+
let i;
|
|
541
539
|
if (this.options.useMockData && this.options.mockData)
|
|
542
|
-
|
|
540
|
+
i = this.options.mockData;
|
|
543
541
|
else {
|
|
544
|
-
const { environment:
|
|
545
|
-
|
|
542
|
+
const { environment: e, partnerId: n } = this.options.apiConfig, h = this.options.apiConfig.customEndpoint || T[e];
|
|
543
|
+
i = "cartInfo" in this.options.quoteRequestData && "items" in this.options.quoteRequestData ? await I(
|
|
546
544
|
h,
|
|
547
|
-
|
|
545
|
+
n,
|
|
548
546
|
this.options.quoteRequestData
|
|
549
547
|
) : await x(
|
|
550
548
|
h,
|
|
551
|
-
|
|
549
|
+
n,
|
|
552
550
|
this.options.quoteRequestData
|
|
553
551
|
);
|
|
554
552
|
}
|
|
555
|
-
if (
|
|
556
|
-
|
|
553
|
+
if (i.status !== "QUOTE_AVAILABLE") {
|
|
554
|
+
i.status === "NO_MATCHING_QUOTE" && ((t = this.options.callbacks) != null && t.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
557
555
|
status: "NO_MATCHING_QUOTE",
|
|
558
556
|
data: this.options.quoteRequestData
|
|
559
557
|
});
|
|
560
558
|
return;
|
|
561
559
|
}
|
|
562
|
-
if (this.quote =
|
|
560
|
+
if (this.quote = i.data, !this.quote)
|
|
563
561
|
throw new Error("No quote data in response");
|
|
564
|
-
if (this._renderWidget(), this.options.optInSelected && ((
|
|
565
|
-
const
|
|
562
|
+
if (this._renderWidget(), this.options.optInSelected && ((o = this.options.callbacks) != null && o.onOptIn)) {
|
|
563
|
+
const e = {
|
|
566
564
|
status: "QUOTE_ACCEPTED",
|
|
567
565
|
spotPrice: this.quote.spotPrice,
|
|
568
566
|
quoteId: this.quote.id
|
|
569
567
|
};
|
|
570
568
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
571
|
-
const
|
|
572
|
-
|
|
569
|
+
const n = this.options.quoteRequestData;
|
|
570
|
+
e.batchQuoteDetails = this.quote.originalQuotes.map((u) => {
|
|
573
571
|
var f;
|
|
574
|
-
const h = (f =
|
|
575
|
-
(y) => (y.cartItemId || `item-${
|
|
572
|
+
const h = (f = n.items) == null ? void 0 : f.find(
|
|
573
|
+
(y) => (y.cartItemId || `item-${n.items.indexOf(y) + 1}`) === u.id
|
|
576
574
|
);
|
|
577
575
|
return {
|
|
578
576
|
quoteId: u.id,
|
|
@@ -581,51 +579,51 @@ class A {
|
|
|
581
579
|
};
|
|
582
580
|
});
|
|
583
581
|
}
|
|
584
|
-
this.options.callbacks.onOptIn(
|
|
582
|
+
this.options.callbacks.onOptIn(e);
|
|
585
583
|
}
|
|
586
584
|
if ((s = this.options.callbacks) != null && s.onQuoteRetrieved) {
|
|
587
|
-
const
|
|
588
|
-
|
|
585
|
+
const e = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
586
|
+
e && this._applyQuoteUpdates(e);
|
|
589
587
|
}
|
|
590
|
-
} catch (
|
|
591
|
-
if ((
|
|
592
|
-
const
|
|
593
|
-
(
|
|
594
|
-
message:
|
|
595
|
-
status:
|
|
596
|
-
responseBody:
|
|
588
|
+
} catch (i) {
|
|
589
|
+
if ((a = this.options.callbacks) != null && a.onError) {
|
|
590
|
+
const e = i;
|
|
591
|
+
(r = this.options.callbacks) == null || r.onError({
|
|
592
|
+
message: e.message,
|
|
593
|
+
status: e.status,
|
|
594
|
+
responseBody: e.responseBody
|
|
597
595
|
});
|
|
598
596
|
}
|
|
599
597
|
}
|
|
600
598
|
}
|
|
601
599
|
_renderWidget() {
|
|
602
600
|
if (!this.quote) return;
|
|
603
|
-
this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([s,
|
|
604
|
-
const
|
|
605
|
-
this.container.style.setProperty(
|
|
601
|
+
this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([s, a]) => {
|
|
602
|
+
const r = `--${s}`;
|
|
603
|
+
this.container.style.setProperty(r, a);
|
|
606
604
|
}), N(this.container, this.quote.communication);
|
|
607
605
|
const t = document.createElement("div");
|
|
608
606
|
if (t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ? L(t, this.quote.qualifyingReasons) : M(t, this.quote.communication.bulletPoints), this.quote.coveredItems) {
|
|
609
607
|
const s = this._getTotalItemsInRequest();
|
|
610
608
|
O(t, this.quote.coveredItems, s);
|
|
611
609
|
}
|
|
612
|
-
this.options.showTable && !this.quote.qualifyingReasons &&
|
|
613
|
-
const
|
|
610
|
+
this.options.showTable && !this.quote.qualifyingReasons && $(t, this.quote.payoutSchedule);
|
|
611
|
+
const o = P(
|
|
614
612
|
t,
|
|
615
613
|
this.options.optInSelected,
|
|
616
614
|
this.quote.communication
|
|
617
615
|
);
|
|
618
|
-
t.appendChild(
|
|
616
|
+
t.appendChild(o), this.paymentTermsEl = c("div", {
|
|
619
617
|
className: "spot-payment-terms__wrapper",
|
|
620
618
|
parent: t
|
|
621
|
-
}), V(this.container, this.quote, this.options.logoPosition), window.addEventListener("resize", this._onResize), this._setupResizeObserver(), this._updateLayout(), this._setupOptionListeners(
|
|
619
|
+
}), V(this.container, this.quote, this.options.logoPosition), window.addEventListener("resize", this._onResize), this._setupResizeObserver(), this._updateLayout(), this._setupOptionListeners(o);
|
|
622
620
|
}
|
|
623
621
|
_updateLayout() {
|
|
624
622
|
if (!this.container || !this.quote) return;
|
|
625
623
|
const t = this.container.querySelector(
|
|
626
624
|
".spot-content__wrapper"
|
|
627
|
-
),
|
|
628
|
-
if (!t || !
|
|
625
|
+
), o = this.options.showTable && !this.quote.qualifyingReasons;
|
|
626
|
+
if (!t || !o) {
|
|
629
627
|
t == null || t.classList.remove("desktop-layout");
|
|
630
628
|
return;
|
|
631
629
|
}
|
|
@@ -633,19 +631,19 @@ class A {
|
|
|
633
631
|
t.classList.toggle("desktop-layout", s);
|
|
634
632
|
}
|
|
635
633
|
_shouldUseDesktopLayout(t) {
|
|
636
|
-
const
|
|
637
|
-
if (
|
|
634
|
+
const o = this.container.offsetWidth - 40, s = 325, a = 16;
|
|
635
|
+
if (o >= 900)
|
|
638
636
|
return !0;
|
|
639
|
-
if (
|
|
640
|
-
const
|
|
637
|
+
if (o >= 650) {
|
|
638
|
+
const r = t.classList.contains("desktop-layout");
|
|
641
639
|
t.classList.remove("desktop-layout"), t.offsetHeight;
|
|
642
|
-
const
|
|
640
|
+
const i = t.querySelector(
|
|
643
641
|
".spot-benefits__list, .spot-qualifying-reasons__container"
|
|
644
642
|
);
|
|
645
|
-
if (!
|
|
646
|
-
return
|
|
647
|
-
const
|
|
648
|
-
return
|
|
643
|
+
if (!i)
|
|
644
|
+
return r && t.classList.add("desktop-layout"), r;
|
|
645
|
+
const n = Math.min(i.scrollWidth, 400) + s + a;
|
|
646
|
+
return r && t.classList.add("desktop-layout"), o >= n;
|
|
649
647
|
}
|
|
650
648
|
return !1;
|
|
651
649
|
}
|
|
@@ -666,14 +664,14 @@ class A {
|
|
|
666
664
|
)), this.destroy(), this._renderWidget());
|
|
667
665
|
}
|
|
668
666
|
_setupOptionListeners(t) {
|
|
669
|
-
const
|
|
667
|
+
const o = t.querySelectorAll(
|
|
670
668
|
'input[type="radio"]'
|
|
671
669
|
), s = t.querySelectorAll(".spot-selection__option");
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
var
|
|
675
|
-
const
|
|
676
|
-
if (this.hideSelectionError(), this.currentSelection =
|
|
670
|
+
o.forEach((a) => {
|
|
671
|
+
a.addEventListener("change", (r) => {
|
|
672
|
+
var n, u, h;
|
|
673
|
+
const i = r.target, e = i.value;
|
|
674
|
+
if (this.hideSelectionError(), this.currentSelection = e, s.forEach((f) => f.classList.remove("selected")), (n = i.closest(".spot-selection__option")) == null || n.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), e === "yes" && (this.options.quoteRequestData.isPartialPayment && R(this.paymentTermsEl, this.quote), (u = this.options.callbacks) != null && u.onOptIn)) {
|
|
677
675
|
const f = {
|
|
678
676
|
status: "QUOTE_ACCEPTED",
|
|
679
677
|
spotPrice: this.quote.spotPrice,
|
|
@@ -682,22 +680,22 @@ class A {
|
|
|
682
680
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
683
681
|
const y = this.options.quoteRequestData;
|
|
684
682
|
f.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
685
|
-
(
|
|
683
|
+
(p) => {
|
|
686
684
|
var l;
|
|
687
685
|
const d = (l = y.items) == null ? void 0 : l.find(
|
|
688
|
-
(
|
|
686
|
+
(w) => (w.cartItemId || `item-${y.items.indexOf(w) + 1}`) === p.id
|
|
689
687
|
);
|
|
690
688
|
return {
|
|
691
|
-
quoteId:
|
|
692
|
-
productPrice: (d == null ? void 0 : d.productPrice) ||
|
|
693
|
-
cartItemId:
|
|
689
|
+
quoteId: p.id,
|
|
690
|
+
productPrice: (d == null ? void 0 : d.productPrice) || p.spotPrice,
|
|
691
|
+
cartItemId: p.id
|
|
694
692
|
};
|
|
695
693
|
}
|
|
696
694
|
);
|
|
697
695
|
}
|
|
698
696
|
this.options.callbacks.onOptIn(f);
|
|
699
697
|
}
|
|
700
|
-
if (
|
|
698
|
+
if (e === "no" && ((h = this.options.callbacks) != null && h.onOptOut)) {
|
|
701
699
|
const f = {
|
|
702
700
|
status: "QUOTE_DECLINED",
|
|
703
701
|
quoteId: this.quote.id
|
|
@@ -705,15 +703,15 @@ class A {
|
|
|
705
703
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
706
704
|
const y = this.options.quoteRequestData;
|
|
707
705
|
f.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
708
|
-
(
|
|
706
|
+
(p) => {
|
|
709
707
|
var l;
|
|
710
708
|
const d = (l = y.items) == null ? void 0 : l.find(
|
|
711
|
-
(
|
|
709
|
+
(w) => (w.cartItemId || `item-${y.items.indexOf(w) + 1}`) === p.id
|
|
712
710
|
);
|
|
713
711
|
return {
|
|
714
|
-
quoteId:
|
|
715
|
-
productPrice: (d == null ? void 0 : d.productPrice) ||
|
|
716
|
-
cartItemId:
|
|
712
|
+
quoteId: p.id,
|
|
713
|
+
productPrice: (d == null ? void 0 : d.productPrice) || p.spotPrice,
|
|
714
|
+
cartItemId: p.id
|
|
717
715
|
};
|
|
718
716
|
}
|
|
719
717
|
);
|
|
@@ -727,10 +725,10 @@ class A {
|
|
|
727
725
|
var t;
|
|
728
726
|
if (!this.errorEl) {
|
|
729
727
|
this.errorEl = document.createElement("div"), this.errorEl.className = "spot-selection__error", this.errorEl.textContent = "Please make a selection";
|
|
730
|
-
const
|
|
728
|
+
const o = (t = this.container) == null ? void 0 : t.querySelector(
|
|
731
729
|
".spot-selection__options"
|
|
732
730
|
);
|
|
733
|
-
|
|
731
|
+
o && o.insertAdjacentElement("afterend", this.errorEl);
|
|
734
732
|
}
|
|
735
733
|
this.errorEl.style.display = "block";
|
|
736
734
|
}
|
|
@@ -745,61 +743,61 @@ class A {
|
|
|
745
743
|
return t ? this.hideSelectionError() : this.showSelectionError(), t;
|
|
746
744
|
}
|
|
747
745
|
async updateQuote(t) {
|
|
748
|
-
var
|
|
746
|
+
var o, s, a, r;
|
|
749
747
|
try {
|
|
750
|
-
const
|
|
748
|
+
const i = {
|
|
751
749
|
...this.options,
|
|
752
750
|
quoteRequestData: t
|
|
753
751
|
};
|
|
754
|
-
D(
|
|
755
|
-
const { environment:
|
|
752
|
+
D(i);
|
|
753
|
+
const { environment: e, partnerId: n, customEndpoint: u } = this.options.apiConfig, h = u || T[e], y = "cartInfo" in i.quoteRequestData && "items" in i.quoteRequestData ? await I(
|
|
756
754
|
h,
|
|
757
|
-
|
|
758
|
-
|
|
755
|
+
n,
|
|
756
|
+
i.quoteRequestData
|
|
759
757
|
) : await x(
|
|
760
758
|
h,
|
|
761
|
-
|
|
762
|
-
|
|
759
|
+
n,
|
|
760
|
+
i.quoteRequestData
|
|
763
761
|
);
|
|
764
762
|
if (y.status !== "QUOTE_AVAILABLE")
|
|
765
|
-
return y.status === "NO_MATCHING_QUOTE" && ((
|
|
763
|
+
return y.status === "NO_MATCHING_QUOTE" && ((o = this.options.callbacks) != null && o.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
766
764
|
status: "NO_MATCHING_QUOTE",
|
|
767
|
-
data:
|
|
765
|
+
data: i.quoteRequestData
|
|
768
766
|
}), !1;
|
|
769
|
-
if (this.options.quoteRequestData =
|
|
770
|
-
const
|
|
771
|
-
|
|
767
|
+
if (this.options.quoteRequestData = i.quoteRequestData, this.quote = y.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (s = this.options.callbacks) != null && s.onQuoteRetrieved) {
|
|
768
|
+
const p = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
769
|
+
p && this._applyQuoteUpdates(p);
|
|
772
770
|
}
|
|
773
771
|
return !0;
|
|
774
|
-
} catch (
|
|
775
|
-
const
|
|
776
|
-
return (
|
|
777
|
-
message:
|
|
778
|
-
status:
|
|
779
|
-
responseBody:
|
|
772
|
+
} catch (i) {
|
|
773
|
+
const e = i;
|
|
774
|
+
return (r = (a = this.options.callbacks) == null ? void 0 : a.onError) == null || r.call(a, {
|
|
775
|
+
message: e.message,
|
|
776
|
+
status: e.status,
|
|
777
|
+
responseBody: e.responseBody
|
|
780
778
|
}), !1;
|
|
781
779
|
}
|
|
782
780
|
}
|
|
783
781
|
getSelection() {
|
|
784
|
-
var
|
|
782
|
+
var o, s, a;
|
|
785
783
|
if (this.currentSelection == null) return null;
|
|
786
784
|
const t = {
|
|
787
785
|
selection: this.currentSelection,
|
|
788
|
-
quoteId: (
|
|
786
|
+
quoteId: (o = this.quote) == null ? void 0 : o.id,
|
|
789
787
|
spotPrice: (s = this.quote) == null ? void 0 : s.spotPrice,
|
|
790
788
|
status: this.currentSelection === "yes" ? "QUOTE_ACCEPTED" : "QUOTE_DECLINED"
|
|
791
789
|
};
|
|
792
|
-
if ((
|
|
793
|
-
const
|
|
794
|
-
t.batchQuoteDetails = this.quote.originalQuotes.map((
|
|
795
|
-
var
|
|
796
|
-
const
|
|
797
|
-
(u) => (u.cartItemId || `item-${
|
|
790
|
+
if ((a = this.quote) != null && a.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
791
|
+
const r = this.options.quoteRequestData;
|
|
792
|
+
t.batchQuoteDetails = this.quote.originalQuotes.map((i) => {
|
|
793
|
+
var n;
|
|
794
|
+
const e = (n = r.items) == null ? void 0 : n.find(
|
|
795
|
+
(u) => (u.cartItemId || `item-${r.items.indexOf(u) + 1}`) === i.id
|
|
798
796
|
);
|
|
799
797
|
return {
|
|
800
|
-
quoteId:
|
|
801
|
-
productPrice: (
|
|
802
|
-
cartItemId:
|
|
798
|
+
quoteId: i.id,
|
|
799
|
+
productPrice: (e == null ? void 0 : e.productPrice) || i.spotPrice,
|
|
800
|
+
cartItemId: i.id
|
|
803
801
|
};
|
|
804
802
|
});
|
|
805
803
|
}
|