@getspot/spot-widget 3.0.2 → 3.0.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 +6 -0
- package/dist/index.es.js +197 -185
- package/dist/index.umd.js +4 -4
- package/dist/ui.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/index.es.js
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
async function k(
|
|
1
|
+
async function k(l, t, o) {
|
|
2
2
|
try {
|
|
3
|
-
const
|
|
3
|
+
const s = await fetch(l, {
|
|
4
4
|
method: "POST",
|
|
5
5
|
headers: {
|
|
6
6
|
"Content-Type": "application/json",
|
|
7
7
|
"X-Spot-Partner-Id": t
|
|
8
8
|
},
|
|
9
9
|
body: JSON.stringify(o)
|
|
10
|
-
}),
|
|
11
|
-
if (!
|
|
12
|
-
const e = new Error((
|
|
13
|
-
throw e.status =
|
|
10
|
+
}), i = await s.json();
|
|
11
|
+
if (!s.ok) {
|
|
12
|
+
const e = new Error((i == null ? void 0 : i.message) || "Failed to fetch quote");
|
|
13
|
+
throw e.status = s.status, e.responseBody = i, e;
|
|
14
14
|
}
|
|
15
|
-
return
|
|
16
|
-
} catch (
|
|
17
|
-
throw
|
|
15
|
+
return i;
|
|
16
|
+
} catch (s) {
|
|
17
|
+
throw s instanceof Error ? s : new Error("Unknown error occurred while fetching quote");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async function H(
|
|
20
|
+
async function H(l, t, o) {
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
22
|
+
const s = l.replace("/quote", "/quote/batch"), i = 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
28
|
body: JSON.stringify(o)
|
|
29
|
-
}), e = await
|
|
30
|
-
if (!
|
|
29
|
+
}), e = await i.json();
|
|
30
|
+
if (!i.ok) {
|
|
31
31
|
const n = new Error((e == null ? void 0 : e.message) || "Failed to fetch batch quote");
|
|
32
|
-
throw n.status =
|
|
32
|
+
throw n.status = i.status, n.responseBody = e, n;
|
|
33
33
|
}
|
|
34
34
|
return e;
|
|
35
|
-
} catch (
|
|
36
|
-
throw
|
|
35
|
+
} catch (s) {
|
|
36
|
+
throw s instanceof Error ? s : new Error("Unknown error occurred while fetching batch quote");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
async function D(
|
|
40
|
-
var
|
|
39
|
+
async function D(l, t, o) {
|
|
40
|
+
var s;
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
42
|
+
const i = {
|
|
43
43
|
cartId: o.cartInfo.cartId,
|
|
44
44
|
cartName: o.cartInfo.cartName,
|
|
45
45
|
currencyCode: o.cartInfo.currencyCode,
|
|
@@ -55,26 +55,26 @@ async function D(d, t, o) {
|
|
|
55
55
|
startDate: a.startDate,
|
|
56
56
|
endDate: a.endDate
|
|
57
57
|
}))
|
|
58
|
-
}, e = await H(
|
|
58
|
+
}, e = await H(l, t, i);
|
|
59
59
|
if (e.status !== "QUOTES_AVAILABLE" && e.status !== "QUOTE_AVAILABLE")
|
|
60
60
|
return { status: "NO_MATCHING_QUOTE" };
|
|
61
61
|
const n = e.quotes.map((a) => {
|
|
62
62
|
const u = o.items.find(
|
|
63
|
-
(
|
|
63
|
+
(f, h) => (f.cartItemId || `item-${h + 1}`) === a.cartItemId
|
|
64
64
|
);
|
|
65
65
|
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${a.id}`;
|
|
66
|
-
}),
|
|
66
|
+
}), r = Math.round((e.totalSpotPrice || e.spotPrice || 0) * 100) / 100;
|
|
67
67
|
return {
|
|
68
68
|
status: "QUOTE_AVAILABLE",
|
|
69
69
|
data: {
|
|
70
|
-
id: e.quotes ? e.quotes.map((a) => a.id).join(",") : ((
|
|
71
|
-
spotPrice:
|
|
70
|
+
id: e.quotes ? e.quotes.map((a) => a.id).join(",") : ((s = e.data) == null ? void 0 : s.id) || "",
|
|
71
|
+
spotPrice: r,
|
|
72
72
|
currencyCode: e.currencyCode || "",
|
|
73
73
|
communication: {
|
|
74
74
|
...e.communication,
|
|
75
75
|
yesOptionText: e.communication.yesOptionText.replace(
|
|
76
76
|
String(e.totalSpotPrice),
|
|
77
|
-
String(
|
|
77
|
+
String(r)
|
|
78
78
|
)
|
|
79
79
|
},
|
|
80
80
|
payoutSchedule: e.payoutSchedule.map((a) => ({
|
|
@@ -84,11 +84,11 @@ async function D(d, t, o) {
|
|
|
84
84
|
coveredItems: n,
|
|
85
85
|
originalQuotes: e.quotes || (e.data ? [e.data] : [])
|
|
86
86
|
},
|
|
87
|
-
spotPrice:
|
|
87
|
+
spotPrice: r,
|
|
88
88
|
coveredItems: n
|
|
89
89
|
};
|
|
90
|
-
} catch (
|
|
91
|
-
throw
|
|
90
|
+
} catch (i) {
|
|
91
|
+
throw i instanceof Error ? i : new Error("Unknown error occurred while fetching multiple quotes");
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
const M = {
|
|
@@ -96,25 +96,25 @@ const M = {
|
|
|
96
96
|
production: "https://api.getspot.com/v1/quote",
|
|
97
97
|
local: "http://localhost:3999/api/v1/quote"
|
|
98
98
|
};
|
|
99
|
-
function I(
|
|
99
|
+
function I(l) {
|
|
100
100
|
const {
|
|
101
101
|
apiConfig: t = {},
|
|
102
102
|
quoteRequestData: o,
|
|
103
|
-
callbacks:
|
|
104
|
-
location:
|
|
103
|
+
callbacks: s = {},
|
|
104
|
+
location: i,
|
|
105
105
|
theme: e
|
|
106
|
-
} =
|
|
106
|
+
} = l, {
|
|
107
107
|
environment: n = "sandbox",
|
|
108
|
-
partnerId:
|
|
108
|
+
partnerId: r,
|
|
109
109
|
customEndpoint: a
|
|
110
110
|
} = t;
|
|
111
|
-
if (!
|
|
111
|
+
if (!r || typeof r != "string")
|
|
112
112
|
throw new Error("Invalid or missing partnerId in apiConfig");
|
|
113
113
|
if (!(a || M[n]))
|
|
114
114
|
throw new Error(`Invalid environment in apiConfig: ${n}`);
|
|
115
115
|
if (!o || typeof o != "object" && !Array.isArray(o))
|
|
116
116
|
throw new Error("quoteRequestData must be a non-null object or array");
|
|
117
|
-
const
|
|
117
|
+
const f = [
|
|
118
118
|
"startDate",
|
|
119
119
|
"endDate",
|
|
120
120
|
"currencyCode",
|
|
@@ -126,9 +126,9 @@ function I(d) {
|
|
|
126
126
|
"cartId",
|
|
127
127
|
"productName"
|
|
128
128
|
];
|
|
129
|
-
function
|
|
130
|
-
const m =
|
|
131
|
-
|
|
129
|
+
function h(c, d = null) {
|
|
130
|
+
const m = d !== null ? `quoteRequestData[${d}]` : "quoteRequestData";
|
|
131
|
+
f.forEach((w) => {
|
|
132
132
|
if (!Object.prototype.hasOwnProperty.call(c, w) || c[w] === void 0 || c[w] === null)
|
|
133
133
|
throw new Error(`Missing required ${m} field: '${w}'`);
|
|
134
134
|
});
|
|
@@ -167,17 +167,17 @@ function I(d) {
|
|
|
167
167
|
throw new Error(`${m}.productName must be a string`);
|
|
168
168
|
}
|
|
169
169
|
if ("cartInfo" in o && "items" in o) {
|
|
170
|
-
const c = o, { cartInfo:
|
|
171
|
-
if (!
|
|
170
|
+
const c = o, { cartInfo: d, items: m } = c;
|
|
171
|
+
if (!d || typeof d != "object")
|
|
172
172
|
throw new Error("quoteRequestData.cartInfo must be a non-null object");
|
|
173
|
-
if (!
|
|
173
|
+
if (!d.cartId || typeof d.cartId != "string")
|
|
174
174
|
throw new Error("quoteRequestData.cartInfo.cartId must be a string");
|
|
175
|
-
if (!
|
|
175
|
+
if (!d.cartName || typeof d.cartName != "string")
|
|
176
176
|
throw new Error("quoteRequestData.cartInfo.cartName must be a string");
|
|
177
|
-
if (!
|
|
177
|
+
if (!d.currencyCode || typeof d.currencyCode != "string")
|
|
178
178
|
throw new Error("quoteRequestData.cartInfo.currencyCode must be a string");
|
|
179
|
-
if (!["USD", "CAD", "AUD"].includes(
|
|
180
|
-
throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${
|
|
179
|
+
if (!["USD", "CAD", "AUD"].includes(d.currencyCode))
|
|
180
|
+
throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${d.currencyCode}`);
|
|
181
181
|
if (!Array.isArray(m) || m.length === 0)
|
|
182
182
|
throw new Error("quoteRequestData.items must be a non-empty array");
|
|
183
183
|
const C = [
|
|
@@ -225,13 +225,13 @@ function I(d) {
|
|
|
225
225
|
} else if (Array.isArray(o)) {
|
|
226
226
|
if (o.length === 0)
|
|
227
227
|
throw new Error("quoteRequestData array cannot be empty");
|
|
228
|
-
o.forEach((c,
|
|
228
|
+
o.forEach((c, d) => {
|
|
229
229
|
if (!c || typeof c != "object")
|
|
230
|
-
throw new Error(`quoteRequestData[${
|
|
231
|
-
|
|
230
|
+
throw new Error(`quoteRequestData[${d}] must be a non-null object`);
|
|
231
|
+
h(c, d);
|
|
232
232
|
});
|
|
233
233
|
} else
|
|
234
|
-
|
|
234
|
+
h(o);
|
|
235
235
|
if ([
|
|
236
236
|
"onOptIn",
|
|
237
237
|
"onOptOut",
|
|
@@ -239,51 +239,51 @@ function I(d) {
|
|
|
239
239
|
"onError",
|
|
240
240
|
"noMatchingQuote"
|
|
241
241
|
].forEach((c) => {
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
242
|
+
const d = s[c];
|
|
243
|
+
if (d && typeof d != "function")
|
|
244
244
|
throw new Error(`Callback '${c}' must be a function.`);
|
|
245
|
-
}), typeof
|
|
246
|
-
throw new Error(`Invalid location selector: '${
|
|
245
|
+
}), typeof i == "string" && !document.querySelector(i))
|
|
246
|
+
throw new Error(`Invalid location selector: '${i}'`);
|
|
247
247
|
if (e && typeof e != "object")
|
|
248
248
|
throw new Error(
|
|
249
249
|
"Theme must be an object with CSS variables, do not include the '--' prefix"
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
|
-
function p(
|
|
253
|
-
const
|
|
254
|
-
return o && (
|
|
252
|
+
function p(l, { text: t, className: o, parent: s, innerHTML: i, href: e, target: n } = {}) {
|
|
253
|
+
const r = document.createElement(l);
|
|
254
|
+
return o && (r.className = o), t != null && (r.textContent = t), i != null && (r.innerHTML = i), e && "href" in r && (r.href = e), n && "target" in r && (r.target = n), s && s.appendChild(r), r;
|
|
255
255
|
}
|
|
256
|
-
function N(
|
|
256
|
+
function N(l, { name: t, description: o }) {
|
|
257
257
|
p("div", {
|
|
258
258
|
className: "spot-header__title",
|
|
259
259
|
text: t,
|
|
260
|
-
parent:
|
|
260
|
+
parent: l
|
|
261
261
|
}), p("div", {
|
|
262
262
|
className: "spot-header__description",
|
|
263
263
|
text: o,
|
|
264
|
-
parent:
|
|
264
|
+
parent: l
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
|
-
function z(
|
|
267
|
+
function z(l, t = []) {
|
|
268
268
|
const o = p("ul", {
|
|
269
269
|
className: "spot-benefits__list",
|
|
270
|
-
parent:
|
|
270
|
+
parent: l
|
|
271
271
|
});
|
|
272
|
-
t.forEach((
|
|
273
|
-
const
|
|
274
|
-
|
|
272
|
+
t.forEach((s) => {
|
|
273
|
+
const i = p("li", { parent: o });
|
|
274
|
+
i.innerHTML = `
|
|
275
275
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
276
276
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
277
277
|
stroke="#2E2E2E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
278
|
-
</svg>`, p("span", { text:
|
|
278
|
+
</svg>`, p("span", { text: s, parent: i });
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
|
-
function O(
|
|
281
|
+
function O(l, t = []) {
|
|
282
282
|
if (!t || t.length === 0) return;
|
|
283
283
|
const o = p("div", {
|
|
284
284
|
className: "spot-qualifying-reasons__container",
|
|
285
|
-
parent:
|
|
286
|
-
}),
|
|
285
|
+
parent: l
|
|
286
|
+
}), s = [...t].sort((r, a) => r.rank - a.rank), i = p("div", {
|
|
287
287
|
className: "spot-qualifying-reasons__grid",
|
|
288
288
|
parent: o
|
|
289
289
|
}), e = {
|
|
@@ -295,109 +295,121 @@ function O(d, t = []) {
|
|
|
295
295
|
"Severe Weather": "umbrella.svg",
|
|
296
296
|
"Travel Interruption": "plane.svg",
|
|
297
297
|
"Military Duty": "medal.svg"
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
const
|
|
298
|
+
};
|
|
299
|
+
let n;
|
|
300
|
+
try {
|
|
301
|
+
const r = document.currentScript;
|
|
302
|
+
if (r != null && r.src) {
|
|
303
|
+
const a = new URL(r.src);
|
|
304
|
+
n = a.origin + a.pathname.replace(/\/[^/]*$/, "/");
|
|
305
|
+
} else
|
|
306
|
+
n = window.location.origin + window.location.pathname.replace(/\/[^/]*$/, "/");
|
|
307
|
+
n += "assets/";
|
|
308
|
+
} catch {
|
|
309
|
+
n = "./assets/";
|
|
310
|
+
}
|
|
311
|
+
s.forEach((r) => {
|
|
312
|
+
var h, y, c;
|
|
313
|
+
const a = p("div", {
|
|
302
314
|
className: "spot-qualifying-reasons__item",
|
|
303
|
-
parent:
|
|
304
|
-
}),
|
|
315
|
+
parent: i
|
|
316
|
+
}), u = p("div", {
|
|
305
317
|
className: "spot-qualifying-reasons__icon-wrapper",
|
|
306
|
-
parent:
|
|
307
|
-
}), f = e[((
|
|
318
|
+
parent: a
|
|
319
|
+
}), f = e[((h = r.benefitType) == null ? void 0 : h.name) || ""] || e[r.name || ""];
|
|
308
320
|
if (f) {
|
|
309
|
-
const
|
|
310
|
-
parent:
|
|
321
|
+
const d = p("img", {
|
|
322
|
+
parent: u
|
|
311
323
|
});
|
|
312
|
-
|
|
324
|
+
d.src = n + f, d.alt = ((y = r.benefitType) == null ? void 0 : y.name) || r.name || "", d.className = "spot-qualifying-reasons__icon";
|
|
313
325
|
}
|
|
314
326
|
p("span", {
|
|
315
327
|
className: "spot-qualifying-reasons__label",
|
|
316
|
-
text: ((
|
|
317
|
-
parent:
|
|
328
|
+
text: ((c = r.benefitType) == null ? void 0 : c.name) || r.name || "",
|
|
329
|
+
parent: a
|
|
318
330
|
});
|
|
319
331
|
});
|
|
320
332
|
}
|
|
321
|
-
function L(
|
|
333
|
+
function L(l, t = []) {
|
|
322
334
|
if (t.length === 0) return;
|
|
323
335
|
const o = p("div", {
|
|
324
336
|
className: "spot-covered-items__container",
|
|
325
|
-
parent:
|
|
337
|
+
parent: l
|
|
326
338
|
});
|
|
327
339
|
p("div", {
|
|
328
340
|
className: "spot-covered-items__title",
|
|
329
341
|
text: "Items covered in your cart:",
|
|
330
342
|
parent: o
|
|
331
343
|
});
|
|
332
|
-
const
|
|
344
|
+
const s = p("ul", {
|
|
333
345
|
className: "spot-covered-items__list",
|
|
334
346
|
parent: o
|
|
335
347
|
});
|
|
336
|
-
t.forEach((
|
|
337
|
-
const e = p("li", { parent:
|
|
338
|
-
p("span", { text:
|
|
348
|
+
t.forEach((i) => {
|
|
349
|
+
const e = p("li", { parent: s });
|
|
350
|
+
p("span", { text: i, parent: e });
|
|
339
351
|
});
|
|
340
352
|
}
|
|
341
|
-
function P(
|
|
353
|
+
function P(l, t = []) {
|
|
342
354
|
const o = p("div", {
|
|
343
355
|
className: "spot-table__container",
|
|
344
|
-
parent:
|
|
345
|
-
}),
|
|
356
|
+
parent: l
|
|
357
|
+
}), s = p("table", {
|
|
346
358
|
className: "spot-refund__table spot-table--dynamic",
|
|
347
359
|
parent: o
|
|
348
|
-
}),
|
|
360
|
+
}), i = p("thead", { parent: s }), e = p("tr", { parent: i });
|
|
349
361
|
p("th", { text: "When you cancel", parent: e }), p("th", { text: "You will receive", parent: e });
|
|
350
|
-
const n = p("tbody", { parent:
|
|
351
|
-
t.forEach(({ text:
|
|
352
|
-
const
|
|
353
|
-
p("td", { text:
|
|
354
|
-
const
|
|
355
|
-
p("td", { text:
|
|
362
|
+
const n = p("tbody", { parent: s });
|
|
363
|
+
t.forEach(({ text: r, percent: a, amount: u }) => {
|
|
364
|
+
const f = p("tr", { parent: n });
|
|
365
|
+
p("td", { text: r, parent: f });
|
|
366
|
+
const h = a === "Not eligible for refund" ? "Not eligible for a refund" : `$${u} refund`;
|
|
367
|
+
p("td", { text: h, parent: f });
|
|
356
368
|
});
|
|
357
369
|
}
|
|
358
|
-
function $(
|
|
359
|
-
const
|
|
370
|
+
function $(l, t, o) {
|
|
371
|
+
const s = p("div", {
|
|
360
372
|
className: "spot-selection__options",
|
|
361
|
-
parent:
|
|
362
|
-
}),
|
|
373
|
+
parent: l
|
|
374
|
+
}), i = p("label", {
|
|
363
375
|
className: `spot-selection__option ${t ? "selected" : ""}`,
|
|
364
|
-
parent:
|
|
365
|
-
}), e = p("input", { parent:
|
|
376
|
+
parent: s
|
|
377
|
+
}), e = p("input", { parent: i });
|
|
366
378
|
e.type = "radio", e.name = "selection", e.value = "yes", t && (e.checked = !0), p("strong", {
|
|
367
379
|
text: o.yesOptionText,
|
|
368
|
-
parent:
|
|
380
|
+
parent: i
|
|
369
381
|
}), p("span", {
|
|
370
382
|
className: "spot-selection__recommended-tag",
|
|
371
383
|
text: "Recommended",
|
|
372
|
-
parent:
|
|
384
|
+
parent: i
|
|
373
385
|
});
|
|
374
386
|
const n = p("label", {
|
|
375
387
|
className: "spot-selection__option",
|
|
376
|
-
parent:
|
|
377
|
-
}),
|
|
378
|
-
return
|
|
388
|
+
parent: s
|
|
389
|
+
}), r = p("input", { parent: n });
|
|
390
|
+
return r.type = "radio", r.name = "selection", r.value = "no", p("span", { text: o.noOptionText, parent: n }), s;
|
|
379
391
|
}
|
|
380
|
-
function V(
|
|
381
|
-
var
|
|
382
|
-
const o = (
|
|
392
|
+
function V(l, t) {
|
|
393
|
+
var i;
|
|
394
|
+
const o = (i = t.communication) == null ? void 0 : i.paymentTerms, s = p("div", {
|
|
383
395
|
className: "spot-payment-terms",
|
|
384
|
-
parent:
|
|
396
|
+
parent: l
|
|
385
397
|
});
|
|
386
398
|
return p("div", {
|
|
387
399
|
className: "spot-payment-terms__header",
|
|
388
400
|
text: "PAYMENT TERMS",
|
|
389
|
-
parent:
|
|
401
|
+
parent: s
|
|
390
402
|
}), p("div", {
|
|
391
403
|
className: "spot-payment-terms__body",
|
|
392
404
|
text: o || "",
|
|
393
|
-
parent:
|
|
394
|
-
}),
|
|
405
|
+
parent: s
|
|
406
|
+
}), s;
|
|
395
407
|
}
|
|
396
|
-
function R(
|
|
408
|
+
function R(l, t, o = "bottom-right") {
|
|
397
409
|
if (o === "top-right") {
|
|
398
410
|
const e = p("div", {
|
|
399
411
|
className: "spot-logo__top-right",
|
|
400
|
-
parent:
|
|
412
|
+
parent: l
|
|
401
413
|
});
|
|
402
414
|
e.innerHTML = `
|
|
403
415
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -416,26 +428,26 @@ function R(d, t, o = "bottom-right") {
|
|
|
416
428
|
</defs>
|
|
417
429
|
</svg>`;
|
|
418
430
|
}
|
|
419
|
-
const
|
|
431
|
+
const s = p("div", {
|
|
420
432
|
className: "spot-footer__container",
|
|
421
|
-
parent:
|
|
422
|
-
}),
|
|
433
|
+
parent: l
|
|
434
|
+
}), i = p("div", {
|
|
423
435
|
className: "spot-footer__terms",
|
|
424
|
-
parent:
|
|
436
|
+
parent: s
|
|
425
437
|
});
|
|
426
438
|
if (p("span", {
|
|
427
439
|
innerHTML: t.communication.legalDisclaimer,
|
|
428
|
-
parent:
|
|
429
|
-
}), p("br", { parent:
|
|
440
|
+
parent: i
|
|
441
|
+
}), p("br", { parent: i }), p("a", {
|
|
430
442
|
href: t.communication.termsAndConditionsUrl,
|
|
431
443
|
target: "_blank",
|
|
432
444
|
className: "spot-footer__terms-link",
|
|
433
445
|
text: "Refund Guarantee Terms and Conditions",
|
|
434
|
-
parent:
|
|
446
|
+
parent: i
|
|
435
447
|
}), o === "bottom-right") {
|
|
436
448
|
const e = p("p", {
|
|
437
449
|
className: "spot-footer__powered-by",
|
|
438
|
-
parent:
|
|
450
|
+
parent: s
|
|
439
451
|
});
|
|
440
452
|
e.innerHTML = `
|
|
441
453
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -454,12 +466,12 @@ function R(d, t, o = "bottom-right") {
|
|
|
454
466
|
</defs>
|
|
455
467
|
</svg>`;
|
|
456
468
|
}
|
|
457
|
-
return
|
|
469
|
+
return s;
|
|
458
470
|
}
|
|
459
471
|
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-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-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--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-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:0;margin-bottom:1rem}.spot-covered-items__title{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: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-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)}}";
|
|
460
|
-
function S(
|
|
472
|
+
function S(l) {
|
|
461
473
|
const t = document.createElement("style");
|
|
462
|
-
t.textContent =
|
|
474
|
+
t.textContent = l, document.head.appendChild(t);
|
|
463
475
|
}
|
|
464
476
|
S(Q);
|
|
465
477
|
const T = {
|
|
@@ -482,20 +494,20 @@ class Z {
|
|
|
482
494
|
}, 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();
|
|
483
495
|
}
|
|
484
496
|
async _init() {
|
|
485
|
-
var t, o,
|
|
497
|
+
var t, o, s, i, e;
|
|
486
498
|
try {
|
|
487
499
|
I(this.options);
|
|
488
500
|
let n;
|
|
489
501
|
if (this.options.useMockData && this.options.mockData)
|
|
490
502
|
n = this.options.mockData;
|
|
491
503
|
else {
|
|
492
|
-
const { environment:
|
|
504
|
+
const { environment: r, partnerId: a } = this.options.apiConfig, f = this.options.apiConfig.customEndpoint || T[r];
|
|
493
505
|
n = "cartInfo" in this.options.quoteRequestData && "items" in this.options.quoteRequestData ? await D(
|
|
494
|
-
|
|
506
|
+
f,
|
|
495
507
|
a,
|
|
496
508
|
this.options.quoteRequestData
|
|
497
509
|
) : await k(
|
|
498
|
-
|
|
510
|
+
f,
|
|
499
511
|
a,
|
|
500
512
|
this.options.quoteRequestData
|
|
501
513
|
);
|
|
@@ -510,47 +522,47 @@ class Z {
|
|
|
510
522
|
if (this.quote = n.data, !this.quote)
|
|
511
523
|
throw new Error("No quote data in response");
|
|
512
524
|
if (this._renderWidget(), this.options.optInSelected && ((o = this.options.callbacks) != null && o.onOptIn)) {
|
|
513
|
-
const
|
|
525
|
+
const r = {
|
|
514
526
|
status: "QUOTE_ACCEPTED",
|
|
515
527
|
spotPrice: this.quote.spotPrice,
|
|
516
528
|
quoteId: this.quote.id
|
|
517
529
|
};
|
|
518
530
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
519
531
|
const a = this.options.quoteRequestData;
|
|
520
|
-
|
|
521
|
-
var
|
|
522
|
-
const
|
|
532
|
+
r.batchQuoteDetails = this.quote.originalQuotes.map((u) => {
|
|
533
|
+
var h;
|
|
534
|
+
const f = (h = a.items) == null ? void 0 : h.find(
|
|
523
535
|
(y) => (y.cartItemId || `item-${a.items.indexOf(y) + 1}`) === u.id
|
|
524
536
|
);
|
|
525
537
|
return {
|
|
526
538
|
quoteId: u.id,
|
|
527
|
-
productPrice: (
|
|
539
|
+
productPrice: (f == null ? void 0 : f.productPrice) || u.spotPrice,
|
|
528
540
|
cartItemId: u.id
|
|
529
541
|
};
|
|
530
542
|
});
|
|
531
543
|
}
|
|
532
|
-
this.options.callbacks.onOptIn(
|
|
544
|
+
this.options.callbacks.onOptIn(r);
|
|
533
545
|
}
|
|
534
|
-
if ((
|
|
535
|
-
const
|
|
536
|
-
|
|
546
|
+
if ((s = this.options.callbacks) != null && s.onQuoteRetrieved) {
|
|
547
|
+
const r = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
548
|
+
r && this._applyQuoteUpdates(r);
|
|
537
549
|
}
|
|
538
550
|
} catch (n) {
|
|
539
|
-
if ((
|
|
540
|
-
const
|
|
551
|
+
if ((i = this.options.callbacks) != null && i.onError) {
|
|
552
|
+
const r = n;
|
|
541
553
|
(e = this.options.callbacks) == null || e.onError({
|
|
542
|
-
message:
|
|
543
|
-
status:
|
|
544
|
-
responseBody:
|
|
554
|
+
message: r.message,
|
|
555
|
+
status: r.status,
|
|
556
|
+
responseBody: r.responseBody
|
|
545
557
|
});
|
|
546
558
|
}
|
|
547
559
|
}
|
|
548
560
|
}
|
|
549
561
|
_renderWidget() {
|
|
550
562
|
if (!this.quote) return;
|
|
551
|
-
this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([
|
|
552
|
-
const e = `--${
|
|
553
|
-
this.container.style.setProperty(e,
|
|
563
|
+
this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([s, i]) => {
|
|
564
|
+
const e = `--${s}`;
|
|
565
|
+
this.container.style.setProperty(e, i);
|
|
554
566
|
}), N(this.container, this.quote.communication);
|
|
555
567
|
const t = document.createElement("div");
|
|
556
568
|
t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ? O(t, this.quote.qualifyingReasons) : z(t, this.quote.communication.bulletPoints), this.quote.coveredItems && L(t, this.quote.coveredItems), this.options.showTable && !this.quote.qualifyingReasons && P(t, this.quote.payoutSchedule);
|
|
@@ -573,11 +585,11 @@ class Z {
|
|
|
573
585
|
t == null || t.classList.remove("desktop-layout");
|
|
574
586
|
return;
|
|
575
587
|
}
|
|
576
|
-
const
|
|
577
|
-
t.classList.toggle("desktop-layout",
|
|
588
|
+
const s = this._shouldUseDesktopLayout(t);
|
|
589
|
+
t.classList.toggle("desktop-layout", s);
|
|
578
590
|
}
|
|
579
591
|
_shouldUseDesktopLayout(t) {
|
|
580
|
-
const o = this.container.offsetWidth - 40,
|
|
592
|
+
const o = this.container.offsetWidth - 40, s = 325, i = 16;
|
|
581
593
|
if (o >= 900)
|
|
582
594
|
return !0;
|
|
583
595
|
if (o >= 650) {
|
|
@@ -588,7 +600,7 @@ class Z {
|
|
|
588
600
|
);
|
|
589
601
|
if (!n)
|
|
590
602
|
return e && t.classList.add("desktop-layout"), e;
|
|
591
|
-
const a = Math.min(n.scrollWidth, 400) +
|
|
603
|
+
const a = Math.min(n.scrollWidth, 400) + s + i;
|
|
592
604
|
return e && t.classList.add("desktop-layout"), o >= a;
|
|
593
605
|
}
|
|
594
606
|
return !1;
|
|
@@ -609,57 +621,57 @@ class Z {
|
|
|
609
621
|
_setupOptionListeners(t) {
|
|
610
622
|
const o = t.querySelectorAll(
|
|
611
623
|
'input[type="radio"]'
|
|
612
|
-
),
|
|
613
|
-
o.forEach((
|
|
614
|
-
|
|
615
|
-
var a, u,
|
|
616
|
-
const n = e.target,
|
|
617
|
-
if (this.hideSelectionError(), this.currentSelection =
|
|
618
|
-
const
|
|
624
|
+
), s = t.querySelectorAll(".spot-selection__option");
|
|
625
|
+
o.forEach((i) => {
|
|
626
|
+
i.addEventListener("change", (e) => {
|
|
627
|
+
var a, u, f;
|
|
628
|
+
const n = e.target, r = n.value;
|
|
629
|
+
if (this.hideSelectionError(), this.currentSelection = r, s.forEach((h) => h.classList.remove("selected")), (a = n.closest(".spot-selection__option")) == null || a.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), r === "yes" && (this.options.quoteRequestData.isPartialPayment && V(this.paymentTermsEl, this.quote), (u = this.options.callbacks) != null && u.onOptIn)) {
|
|
630
|
+
const h = {
|
|
619
631
|
status: "QUOTE_ACCEPTED",
|
|
620
632
|
spotPrice: this.quote.spotPrice,
|
|
621
633
|
quoteId: this.quote.id
|
|
622
634
|
};
|
|
623
635
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
624
636
|
const y = this.options.quoteRequestData;
|
|
625
|
-
|
|
637
|
+
h.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
626
638
|
(c) => {
|
|
627
639
|
var m;
|
|
628
|
-
const
|
|
640
|
+
const d = (m = y.items) == null ? void 0 : m.find(
|
|
629
641
|
(b) => (b.cartItemId || `item-${y.items.indexOf(b) + 1}`) === c.id
|
|
630
642
|
);
|
|
631
643
|
return {
|
|
632
644
|
quoteId: c.id,
|
|
633
|
-
productPrice: (
|
|
645
|
+
productPrice: (d == null ? void 0 : d.productPrice) || c.spotPrice,
|
|
634
646
|
cartItemId: c.id
|
|
635
647
|
};
|
|
636
648
|
}
|
|
637
649
|
);
|
|
638
650
|
}
|
|
639
|
-
this.options.callbacks.onOptIn(
|
|
651
|
+
this.options.callbacks.onOptIn(h);
|
|
640
652
|
}
|
|
641
|
-
if (
|
|
642
|
-
const
|
|
653
|
+
if (r === "no" && ((f = this.options.callbacks) != null && f.onOptOut)) {
|
|
654
|
+
const h = {
|
|
643
655
|
status: "QUOTE_DECLINED",
|
|
644
656
|
quoteId: this.quote.id
|
|
645
657
|
};
|
|
646
658
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
647
659
|
const y = this.options.quoteRequestData;
|
|
648
|
-
|
|
660
|
+
h.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
649
661
|
(c) => {
|
|
650
662
|
var m;
|
|
651
|
-
const
|
|
663
|
+
const d = (m = y.items) == null ? void 0 : m.find(
|
|
652
664
|
(b) => (b.cartItemId || `item-${y.items.indexOf(b) + 1}`) === c.id
|
|
653
665
|
);
|
|
654
666
|
return {
|
|
655
667
|
quoteId: c.id,
|
|
656
|
-
productPrice: (
|
|
668
|
+
productPrice: (d == null ? void 0 : d.productPrice) || c.spotPrice,
|
|
657
669
|
cartItemId: c.id
|
|
658
670
|
};
|
|
659
671
|
}
|
|
660
672
|
);
|
|
661
673
|
}
|
|
662
|
-
this.options.callbacks.onOptOut(
|
|
674
|
+
this.options.callbacks.onOptOut(h);
|
|
663
675
|
}
|
|
664
676
|
});
|
|
665
677
|
});
|
|
@@ -686,19 +698,19 @@ class Z {
|
|
|
686
698
|
return t ? this.hideSelectionError() : this.showSelectionError(), t;
|
|
687
699
|
}
|
|
688
700
|
async updateQuote(t) {
|
|
689
|
-
var o,
|
|
701
|
+
var o, s, i, e;
|
|
690
702
|
try {
|
|
691
703
|
const n = {
|
|
692
704
|
...this.options,
|
|
693
705
|
quoteRequestData: t
|
|
694
706
|
};
|
|
695
707
|
I(n);
|
|
696
|
-
const { environment:
|
|
697
|
-
|
|
708
|
+
const { environment: r, partnerId: a, customEndpoint: u } = this.options.apiConfig, f = u || T[r], y = "cartInfo" in n.quoteRequestData && "items" in n.quoteRequestData ? await D(
|
|
709
|
+
f,
|
|
698
710
|
a,
|
|
699
711
|
n.quoteRequestData
|
|
700
712
|
) : await k(
|
|
701
|
-
|
|
713
|
+
f,
|
|
702
714
|
a,
|
|
703
715
|
n.quoteRequestData
|
|
704
716
|
);
|
|
@@ -707,39 +719,39 @@ class Z {
|
|
|
707
719
|
status: "NO_MATCHING_QUOTE",
|
|
708
720
|
data: n.quoteRequestData
|
|
709
721
|
}), !1;
|
|
710
|
-
if (this.options.quoteRequestData = n.quoteRequestData, this.quote = y.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (
|
|
722
|
+
if (this.options.quoteRequestData = n.quoteRequestData, this.quote = y.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (s = this.options.callbacks) != null && s.onQuoteRetrieved) {
|
|
711
723
|
const c = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
712
724
|
c && this._applyQuoteUpdates(c);
|
|
713
725
|
}
|
|
714
726
|
return !0;
|
|
715
727
|
} catch (n) {
|
|
716
|
-
const
|
|
717
|
-
return (e = (
|
|
718
|
-
message:
|
|
719
|
-
status:
|
|
720
|
-
responseBody:
|
|
728
|
+
const r = n;
|
|
729
|
+
return (e = (i = this.options.callbacks) == null ? void 0 : i.onError) == null || e.call(i, {
|
|
730
|
+
message: r.message,
|
|
731
|
+
status: r.status,
|
|
732
|
+
responseBody: r.responseBody
|
|
721
733
|
}), !1;
|
|
722
734
|
}
|
|
723
735
|
}
|
|
724
736
|
getSelection() {
|
|
725
|
-
var o,
|
|
737
|
+
var o, s, i;
|
|
726
738
|
if (this.currentSelection == null) return null;
|
|
727
739
|
const t = {
|
|
728
740
|
selection: this.currentSelection,
|
|
729
741
|
quoteId: (o = this.quote) == null ? void 0 : o.id,
|
|
730
|
-
spotPrice: (
|
|
742
|
+
spotPrice: (s = this.quote) == null ? void 0 : s.spotPrice,
|
|
731
743
|
status: this.currentSelection === "yes" ? "QUOTE_ACCEPTED" : "QUOTE_DECLINED"
|
|
732
744
|
};
|
|
733
|
-
if ((
|
|
745
|
+
if ((i = this.quote) != null && i.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
734
746
|
const e = this.options.quoteRequestData;
|
|
735
747
|
t.batchQuoteDetails = this.quote.originalQuotes.map((n) => {
|
|
736
748
|
var a;
|
|
737
|
-
const
|
|
749
|
+
const r = (a = e.items) == null ? void 0 : a.find(
|
|
738
750
|
(u) => (u.cartItemId || `item-${e.items.indexOf(u) + 1}`) === n.id
|
|
739
751
|
);
|
|
740
752
|
return {
|
|
741
753
|
quoteId: n.id,
|
|
742
|
-
productPrice: (
|
|
754
|
+
productPrice: (r == null ? void 0 : r.productPrice) || n.spotPrice,
|
|
743
755
|
cartItemId: n.id
|
|
744
756
|
};
|
|
745
757
|
});
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(_,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(_=typeof globalThis<"u"?globalThis:_||self,_.SpotWidget=v())})(this,function(){"use strict";
|
|
1
|
+
(function(_,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(_=typeof globalThis<"u"?globalThis:_||self,_.SpotWidget=v())})(this,function(){"use strict";async function _(l,t,o){try{const n=await fetch(l,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(o)}),i=await n.json();if(!n.ok){const e=new Error((i==null?void 0:i.message)||"Failed to fetch quote");throw e.status=n.status,e.responseBody=i,e}return i}catch(n){throw n instanceof Error?n:new Error("Unknown error occurred while fetching quote")}}async function v(l,t,o){try{const n=l.replace("/quote","/quote/batch"),i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(o)}),e=await i.json();if(!i.ok){const s=new Error((e==null?void 0:e.message)||"Failed to fetch batch quote");throw s.status=i.status,s.responseBody=e,s}return e}catch(n){throw n instanceof Error?n:new Error("Unknown error occurred while fetching batch quote")}}async function E(l,t,o){var n;try{const i={cartId:o.cartInfo.cartId,cartName:o.cartInfo.cartName,currencyCode:o.cartInfo.currencyCode,items:o.items.map((a,u)=>({cartItemId:a.cartItemId||`item-${u+1}`,productPrice:a.productPrice,productType:a.productType,productDuration:a.productDuration,productId:a.productId,productName:a.productName,participantDescription:a.participantDescription,eventType:a.eventType,startDate:a.startDate,endDate:a.endDate}))},e=await v(l,t,i);if(e.status!=="QUOTES_AVAILABLE"&&e.status!=="QUOTE_AVAILABLE")return{status:"NO_MATCHING_QUOTE"};const s=e.quotes.map(a=>{const u=o.items.find((f,h)=>(f.cartItemId||`item-${h+1}`)===a.cartItemId);return u?u.participantDescription?`${u.productName} - ${u.participantDescription}`:u.productName:`Item ${a.id}`}),r=Math.round((e.totalSpotPrice||e.spotPrice||0)*100)/100;return{status:"QUOTE_AVAILABLE",data:{id:e.quotes?e.quotes.map(a=>a.id).join(","):((n=e.data)==null?void 0:n.id)||"",spotPrice:r,currencyCode:e.currencyCode||"",communication:{...e.communication,yesOptionText:e.communication.yesOptionText.replace(String(e.totalSpotPrice),String(r))},payoutSchedule:e.payoutSchedule.map(a=>({...a,amount:a.amount!==void 0?a.amount:0})),coveredItems:s,originalQuotes:e.quotes||(e.data?[e.data]:[])},spotPrice:r,coveredItems:s}}catch(i){throw i instanceof Error?i:new Error("Unknown error occurred while fetching multiple quotes")}}const M={sandbox:"https://api.sandbox.getspot.com/v1/quote",production:"https://api.getspot.com/v1/quote",local:"http://localhost:3999/api/v1/quote"};function x(l){const{apiConfig:t={},quoteRequestData:o,callbacks:n={},location:i,theme:e}=l,{environment:s="sandbox",partnerId:r,customEndpoint:a}=t;if(!r||typeof r!="string")throw new Error("Invalid or missing partnerId in apiConfig");if(!(a||M[s]))throw new Error(`Invalid environment in apiConfig: ${s}`);if(!o||typeof o!="object"&&!Array.isArray(o))throw new Error("quoteRequestData must be a non-null object or array");const f=["startDate","endDate","currencyCode","eventType","productType","productDuration","productPrice","productId","cartId","productName"];function h(c,d=null){const m=d!==null?`quoteRequestData[${d}]`:"quoteRequestData";f.forEach(w=>{if(!Object.prototype.hasOwnProperty.call(c,w)||c[w]===void 0||c[w]===null)throw new Error(`Missing required ${m} field: '${w}'`)});const b=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!b.test(c.startDate))throw new Error(`${m}.startDate must be a valid ISO8601 string`);if(!b.test(c.endDate))throw new Error(`${m}.endDate must be a valid ISO8601 string`);if(typeof c.currencyCode!="string")throw new Error(`${m}.currencyCode must be a string`);if(!["USD","CAD","AUD"].includes(c.currencyCode))throw new Error(`Invalid ${m}.currencyCode: ${c.currencyCode}`);if(typeof c.eventType!="string")throw new Error(`${m}.eventType must be a string`);if(typeof c.productType!="string")throw new Error(`${m}.productType must be a string`);const g=["Pass","Trip","Registration"];if(!g.includes(c.productType))throw new Error(`${m}.productType must be one of ${g.join(", ")}`);if(typeof c.productDuration!="string")throw new Error(`${m}.productDuration must be a string`);const C=["Daily","Seasonal","Trip","Event"];if(!C.includes(c.productDuration))throw new Error(`${m}.productDuration must be one of ${C.join(", ")}`);if(typeof c.productPrice!="number"||isNaN(c.productPrice))throw new Error(`${m}.productPrice must be a valid number`);if(typeof c.productId!="string")throw new Error(`${m}.productId must be a string`);if(typeof c.cartId!="string")throw new Error(`${m}.cartId must be a string`);if(typeof c.productName!="string")throw new Error(`${m}.productName must be a string`)}if("cartInfo"in o&&"items"in o){const c=o,{cartInfo:d,items:m}=c;if(!d||typeof d!="object")throw new Error("quoteRequestData.cartInfo must be a non-null object");if(!d.cartId||typeof d.cartId!="string")throw new Error("quoteRequestData.cartInfo.cartId must be a string");if(!d.cartName||typeof d.cartName!="string")throw new Error("quoteRequestData.cartInfo.cartName must be a string");if(!d.currencyCode||typeof d.currencyCode!="string")throw new Error("quoteRequestData.cartInfo.currencyCode must be a string");if(!["USD","CAD","AUD"].includes(d.currencyCode))throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${d.currencyCode}`);if(!Array.isArray(m)||m.length===0)throw new Error("quoteRequestData.items must be a non-empty array");const D=["startDate","endDate","eventType","productType","productDuration","productPrice","productId","productName"];m.forEach((g,C)=>{if(!g||typeof g!="object")throw new Error(`quoteRequestData.items[${C}] must be a non-null object`);const w=`quoteRequestData.items[${C}]`;D.forEach(q=>{if(!Object.prototype.hasOwnProperty.call(g,q)||g[q]===void 0||g[q]===null)throw new Error(`Missing required ${w} field: '${q}'`)});const I=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!I.test(g.startDate))throw new Error(`${w}.startDate must be a valid ISO8601 string`);if(!I.test(g.endDate))throw new Error(`${w}.endDate must be a valid ISO8601 string`);if(typeof g.eventType!="string")throw new Error(`${w}.eventType must be a string`);if(typeof g.productType!="string")throw new Error(`${w}.productType must be a string`);const T=["Pass","Trip","Registration"];if(!T.includes(g.productType))throw new Error(`${w}.productType must be one of ${T.join(", ")}`);if(typeof g.productDuration!="string")throw new Error(`${w}.productDuration must be a string`);const H=["Daily","Seasonal","Trip","Event"];if(!H.includes(g.productDuration))throw new Error(`${w}.productDuration must be one of ${H.join(", ")}`);if(typeof g.productPrice!="number"||isNaN(g.productPrice))throw new Error(`${w}.productPrice must be a valid number`);if(typeof g.productId!="string")throw new Error(`${w}.productId must be a string`);if(typeof g.productName!="string")throw new Error(`${w}.productName must be a string`)})}else if(Array.isArray(o)){if(o.length===0)throw new Error("quoteRequestData array cannot be empty");o.forEach((c,d)=>{if(!c||typeof c!="object")throw new Error(`quoteRequestData[${d}] must be a non-null object`);h(c,d)})}else h(o);if(["onOptIn","onOptOut","onQuoteRetrieved","onError","noMatchingQuote"].forEach(c=>{const d=n[c];if(d&&typeof d!="function")throw new Error(`Callback '${c}' must be a function.`)}),typeof i=="string"&&!document.querySelector(i))throw new Error(`Invalid location selector: '${i}'`);if(e&&typeof e!="object")throw new Error("Theme must be an object with CSS variables, do not include the '--' prefix")}function p(l,{text:t,className:o,parent:n,innerHTML:i,href:e,target:s}={}){const r=document.createElement(l);return o&&(r.className=o),t!=null&&(r.textContent=t),i!=null&&(r.innerHTML=i),e&&"href"in r&&(r.href=e),s&&"target"in r&&(r.target=s),n&&n.appendChild(r),r}function N(l,{name:t,description:o}){p("div",{className:"spot-header__title",text:t,parent:l}),p("div",{className:"spot-header__description",text:o,parent:l})}function z(l,t=[]){const o=p("ul",{className:"spot-benefits__list",parent:l});t.forEach(n=>{const i=p("li",{parent:o});i.innerHTML=`
|
|
2
2
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
3
3
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
4
4
|
stroke="#2E2E2E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
</svg>`,p("span",{text:
|
|
5
|
+
</svg>`,p("span",{text:n,parent:i})})}function O(l,t=[]){if(!t||t.length===0)return;const o=p("div",{className:"spot-qualifying-reasons__container",parent:l}),n=[...t].sort((r,a)=>r.rank-a.rank),i=p("div",{className:"spot-qualifying-reasons__grid",parent:o}),e={"Accident & Illness":"cross.svg","Family Emergencies":"users.svg",Layoffs:"building.svg","Jury Duty":"scale.svg","Work Travel Conflict":"briefcase.svg","Severe Weather":"umbrella.svg","Travel Interruption":"plane.svg","Military Duty":"medal.svg"};let s;try{const r=document.currentScript;if(r!=null&&r.src){const a=new URL(r.src);s=a.origin+a.pathname.replace(/\/[^/]*$/,"/")}else s=window.location.origin+window.location.pathname.replace(/\/[^/]*$/,"/");s+="assets/"}catch{s="./assets/"}n.forEach(r=>{var h,y,c;const a=p("div",{className:"spot-qualifying-reasons__item",parent:i}),u=p("div",{className:"spot-qualifying-reasons__icon-wrapper",parent:a}),f=e[((h=r.benefitType)==null?void 0:h.name)||""]||e[r.name||""];if(f){const d=p("img",{parent:u});d.src=s+f,d.alt=((y=r.benefitType)==null?void 0:y.name)||r.name||"",d.className="spot-qualifying-reasons__icon"}p("span",{className:"spot-qualifying-reasons__label",text:((c=r.benefitType)==null?void 0:c.name)||r.name||"",parent:a})})}function L(l,t=[]){if(t.length===0)return;const o=p("div",{className:"spot-covered-items__container",parent:l});p("div",{className:"spot-covered-items__title",text:"Items covered in your cart:",parent:o});const n=p("ul",{className:"spot-covered-items__list",parent:o});t.forEach(i=>{const e=p("li",{parent:n});p("span",{text:i,parent:e})})}function P(l,t=[]){const o=p("div",{className:"spot-table__container",parent:l}),n=p("table",{className:"spot-refund__table spot-table--dynamic",parent:o}),i=p("thead",{parent:n}),e=p("tr",{parent:i});p("th",{text:"When you cancel",parent:e}),p("th",{text:"You will receive",parent:e});const s=p("tbody",{parent:n});t.forEach(({text:r,percent:a,amount:u})=>{const f=p("tr",{parent:s});p("td",{text:r,parent:f});const h=a==="Not eligible for refund"?"Not eligible for a refund":`$${u} refund`;p("td",{text:h,parent:f})})}function $(l,t,o){const n=p("div",{className:"spot-selection__options",parent:l}),i=p("label",{className:`spot-selection__option ${t?"selected":""}`,parent:n}),e=p("input",{parent:i});e.type="radio",e.name="selection",e.value="yes",t&&(e.checked=!0),p("strong",{text:o.yesOptionText,parent:i}),p("span",{className:"spot-selection__recommended-tag",text:"Recommended",parent:i});const s=p("label",{className:"spot-selection__option",parent:n}),r=p("input",{parent:s});return r.type="radio",r.name="selection",r.value="no",p("span",{text:o.noOptionText,parent:s}),n}function V(l,t){var i;const o=(i=t.communication)==null?void 0:i.paymentTerms,n=p("div",{className:"spot-payment-terms",parent:l});return p("div",{className:"spot-payment-terms__header",text:"PAYMENT TERMS",parent:n}),p("div",{className:"spot-payment-terms__body",text:o||"",parent:n}),n}function R(l,t,o="bottom-right"){if(o==="top-right"){const e=p("div",{className:"spot-logo__top-right",parent:l});e.innerHTML=`
|
|
6
6
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
7
7
|
<rect width="145" height="28"/>
|
|
8
8
|
<rect x="-655" y="-270" width="819" height="325" rx="10"/>
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
<rect width="45.405" height="14.8867" fill="white" transform="translate(87 8)"/>
|
|
18
18
|
</clipPath>
|
|
19
19
|
</defs>
|
|
20
|
-
</svg>`}const
|
|
20
|
+
</svg>`}const n=p("div",{className:"spot-footer__container",parent:l}),i=p("div",{className:"spot-footer__terms",parent:n});if(p("span",{innerHTML:t.communication.legalDisclaimer,parent:i}),p("br",{parent:i}),p("a",{href:t.communication.termsAndConditionsUrl,target:"_blank",className:"spot-footer__terms-link",text:"Refund Guarantee Terms and Conditions",parent:i}),o==="bottom-right"){const e=p("p",{className:"spot-footer__powered-by",parent:n});e.innerHTML=`
|
|
21
21
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
22
22
|
<rect width="145" height="28"/>
|
|
23
23
|
<rect x="-655" y="-270" width="819" height="325" rx="10"/>
|
|
@@ -32,4 +32,4 @@
|
|
|
32
32
|
<rect width="45.405" height="14.8867" fill="white" transform="translate(87 8)"/>
|
|
33
33
|
</clipPath>
|
|
34
34
|
</defs>
|
|
35
|
-
</svg>`}return i}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-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-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--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-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:0;margin-bottom:1rem}.spot-covered-items__title{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: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-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)}}";function Z(d){const t=document.createElement("style");t.textContent=d,document.head.appendChild(t)}Z(Q);const k={sandbox:"https://api.sandbox.getspot.com/api/v1/quote",production:"https://api.getspot.com/api/v1/quote",local:"http://localhost:3999/api/v1/quote"};class A{constructor(t={}){this.options={location:"body",showTable:!0,optInSelected:!1,logoPosition:"bottom-right",apiConfig:{environment:"production",partnerId:""},quoteRequestData:{},callbacks:{},useMockData:!1,...t},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()}async _init(){var t,o,i,r,e;try{x(this.options);let s;if(this.options.useMockData&&this.options.mockData)s=this.options.mockData;else{const{environment:n,partnerId:a}=this.options.apiConfig,h=this.options.apiConfig.customEndpoint||k[n];s="cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?await E(h,a,this.options.quoteRequestData):await v(h,a,this.options.quoteRequestData)}if(s.status!=="QUOTE_AVAILABLE"){s.status==="NO_MATCHING_QUOTE"&&((t=this.options.callbacks)!=null&&t.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:this.options.quoteRequestData});return}if(this.quote=s.data,!this.quote)throw new Error("No quote data in response");if(this._renderWidget(),this.options.optInSelected&&((o=this.options.callbacks)!=null&&o.onOptIn)){const n={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const a=this.options.quoteRequestData;n.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var f;const h=(f=a.items)==null?void 0:f.find(y=>(y.cartItemId||`item-${a.items.indexOf(y)+1}`)===u.id);return{quoteId:u.id,productPrice:(h==null?void 0:h.productPrice)||u.spotPrice,cartItemId:u.id}})}this.options.callbacks.onOptIn(n)}if((i=this.options.callbacks)!=null&&i.onQuoteRetrieved){const n=this.options.callbacks.onQuoteRetrieved(this.quote);n&&this._applyQuoteUpdates(n)}}catch(s){if((r=this.options.callbacks)!=null&&r.onError){const n=s;(e=this.options.callbacks)==null||e.onError({message:n.message,status:n.status,responseBody:n.responseBody})}}}_renderWidget(){if(!this.quote)return;this.container=document.createElement("div"),this.container.className="spot-refund-guarantee",this.root.appendChild(this.container),Object.entries(this.options.theme||{}).forEach(([i,r])=>{const e=`--${i}`;this.container.style.setProperty(e,r)}),z(this.container,this.quote.communication);const t=document.createElement("div");t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?L(t,this.quote.qualifyingReasons):O(t,this.quote.communication.bulletPoints),this.quote.coveredItems&&P(t,this.quote.coveredItems),this.options.showTable&&!this.quote.qualifyingReasons&&R(t,this.quote.payoutSchedule);const o=$(t,this.options.optInSelected,this.quote.communication);t.appendChild(o),this.paymentTermsEl=p("div",{className:"spot-payment-terms__wrapper",parent:t}),S(this.container,this.quote,this.options.logoPosition),window.addEventListener("resize",this._onResize),this._setupResizeObserver(),this._updateLayout(),this._setupOptionListeners(o)}_updateLayout(){if(!this.container||!this.quote)return;const t=this.container.querySelector(".spot-content__wrapper"),o=this.options.showTable&&!this.quote.qualifyingReasons;if(!t||!o){t==null||t.classList.remove("desktop-layout");return}const i=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",i)}_shouldUseDesktopLayout(t){const o=this.container.offsetWidth-40,i=325,r=16;if(o>=900)return!0;if(o>=650){const e=t.classList.contains("desktop-layout");t.classList.remove("desktop-layout"),t.offsetHeight;const s=t.querySelector(".spot-benefits__list, .spot-qualifying-reasons__container");if(!s)return e&&t.classList.add("desktop-layout"),e;const a=Math.min(s.scrollWidth,400)+i+r;return e&&t.classList.add("desktop-layout"),o>=a}return!1}_setupResizeObserver(){!this.container||!window.ResizeObserver||(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=window.setTimeout(()=>{this._updateLayout()},100)}),this._resizeObserver.observe(this.container))}_applyQuoteUpdates(t){!this.quote||!this.container||(t.spotPriceWithFees!==void 0&&(this.quote.communication.yesOptionText=this.quote.communication.yesOptionText.replace(`$${this.quote.spotPrice.toFixed(2)}`,`$${t.spotPriceWithFees.toFixed(2)}`)),this.destroy(),this._renderWidget())}_setupOptionListeners(t){const o=t.querySelectorAll('input[type="radio"]'),i=t.querySelectorAll(".spot-selection__option");o.forEach(r=>{r.addEventListener("change",e=>{var a,u,h;const s=e.target,n=s.value;if(this.hideSelectionError(),this.currentSelection=n,i.forEach(f=>f.classList.remove("selected")),(a=s.closest(".spot-selection__option"))==null||a.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),n==="yes"&&(this.options.quoteRequestData.isPartialPayment&&V(this.paymentTermsEl,this.quote),(u=this.options.callbacks)!=null&&u.onOptIn)){const f={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;f.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const l=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(l==null?void 0:l.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptIn(f)}if(n==="no"&&((h=this.options.callbacks)!=null&&h.onOptOut)){const f={status:"QUOTE_DECLINED",quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;f.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const l=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(l==null?void 0:l.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptOut(f)}})})}showSelectionError(){var t;if(!this.errorEl){this.errorEl=document.createElement("div"),this.errorEl.className="spot-selection__error",this.errorEl.textContent="Please make a selection";const o=(t=this.container)==null?void 0:t.querySelector(".spot-selection__options");o&&o.insertAdjacentElement("afterend",this.errorEl)}this.errorEl.style.display="block"}hideSelectionError(){this.errorEl&&(this.errorEl.style.display="none")}validateSelection(){if(!this.container)return!1;const t=!!this.container.querySelector('input[name="selection"]:checked');return t?this.hideSelectionError():this.showSelectionError(),t}async updateQuote(t){var o,i,r,e;try{const s={...this.options,quoteRequestData:t};x(s);const{environment:n,partnerId:a,customEndpoint:u}=this.options.apiConfig,h=u||k[n],y="cartInfo"in s.quoteRequestData&&"items"in s.quoteRequestData?await E(h,a,s.quoteRequestData):await v(h,a,s.quoteRequestData);if(y.status!=="QUOTE_AVAILABLE")return y.status==="NO_MATCHING_QUOTE"&&((o=this.options.callbacks)!=null&&o.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:s.quoteRequestData}),!1;if(this.options.quoteRequestData=s.quoteRequestData,this.quote=y.data,this.currentSelection=null,this.destroy(),this._renderWidget(),(i=this.options.callbacks)!=null&&i.onQuoteRetrieved){const c=this.options.callbacks.onQuoteRetrieved(this.quote);c&&this._applyQuoteUpdates(c)}return!0}catch(s){const n=s;return(e=(r=this.options.callbacks)==null?void 0:r.onError)==null||e.call(r,{message:n.message,status:n.status,responseBody:n.responseBody}),!1}}getSelection(){var o,i,r;if(this.currentSelection==null)return null;const t={selection:this.currentSelection,quoteId:(o=this.quote)==null?void 0:o.id,spotPrice:(i=this.quote)==null?void 0:i.spotPrice,status:this.currentSelection==="yes"?"QUOTE_ACCEPTED":"QUOTE_DECLINED"};if((r=this.quote)!=null&&r.originalQuotes&&this.quote.originalQuotes.length>0){const e=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(s=>{var a;const n=(a=e.items)==null?void 0:a.find(u=>(u.cartItemId||`item-${e.items.indexOf(u)+1}`)===s.id);return{quoteId:s.id,productPrice:(n==null?void 0:n.productPrice)||s.spotPrice,cartItemId:s.id}})}return t}destroy(){window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeTimeout&&window.clearTimeout(this._resizeTimeout),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}}return A});
|
|
35
|
+
</svg>`}return n}const S=":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-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-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--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-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:0;margin-bottom:1rem}.spot-covered-items__title{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: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-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)}}";function Q(l){const t=document.createElement("style");t.textContent=l,document.head.appendChild(t)}Q(S);const k={sandbox:"https://api.sandbox.getspot.com/api/v1/quote",production:"https://api.getspot.com/api/v1/quote",local:"http://localhost:3999/api/v1/quote"};class Z{constructor(t={}){this.options={location:"body",showTable:!0,optInSelected:!1,logoPosition:"bottom-right",apiConfig:{environment:"production",partnerId:""},quoteRequestData:{},callbacks:{},useMockData:!1,...t},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()}async _init(){var t,o,n,i,e;try{x(this.options);let s;if(this.options.useMockData&&this.options.mockData)s=this.options.mockData;else{const{environment:r,partnerId:a}=this.options.apiConfig,f=this.options.apiConfig.customEndpoint||k[r];s="cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?await E(f,a,this.options.quoteRequestData):await _(f,a,this.options.quoteRequestData)}if(s.status!=="QUOTE_AVAILABLE"){s.status==="NO_MATCHING_QUOTE"&&((t=this.options.callbacks)!=null&&t.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:this.options.quoteRequestData});return}if(this.quote=s.data,!this.quote)throw new Error("No quote data in response");if(this._renderWidget(),this.options.optInSelected&&((o=this.options.callbacks)!=null&&o.onOptIn)){const r={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const a=this.options.quoteRequestData;r.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var h;const f=(h=a.items)==null?void 0:h.find(y=>(y.cartItemId||`item-${a.items.indexOf(y)+1}`)===u.id);return{quoteId:u.id,productPrice:(f==null?void 0:f.productPrice)||u.spotPrice,cartItemId:u.id}})}this.options.callbacks.onOptIn(r)}if((n=this.options.callbacks)!=null&&n.onQuoteRetrieved){const r=this.options.callbacks.onQuoteRetrieved(this.quote);r&&this._applyQuoteUpdates(r)}}catch(s){if((i=this.options.callbacks)!=null&&i.onError){const r=s;(e=this.options.callbacks)==null||e.onError({message:r.message,status:r.status,responseBody:r.responseBody})}}}_renderWidget(){if(!this.quote)return;this.container=document.createElement("div"),this.container.className="spot-refund-guarantee",this.root.appendChild(this.container),Object.entries(this.options.theme||{}).forEach(([n,i])=>{const e=`--${n}`;this.container.style.setProperty(e,i)}),N(this.container,this.quote.communication);const t=document.createElement("div");t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?O(t,this.quote.qualifyingReasons):z(t,this.quote.communication.bulletPoints),this.quote.coveredItems&&L(t,this.quote.coveredItems),this.options.showTable&&!this.quote.qualifyingReasons&&P(t,this.quote.payoutSchedule);const o=$(t,this.options.optInSelected,this.quote.communication);t.appendChild(o),this.paymentTermsEl=p("div",{className:"spot-payment-terms__wrapper",parent:t}),R(this.container,this.quote,this.options.logoPosition),window.addEventListener("resize",this._onResize),this._setupResizeObserver(),this._updateLayout(),this._setupOptionListeners(o)}_updateLayout(){if(!this.container||!this.quote)return;const t=this.container.querySelector(".spot-content__wrapper"),o=this.options.showTable&&!this.quote.qualifyingReasons;if(!t||!o){t==null||t.classList.remove("desktop-layout");return}const n=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",n)}_shouldUseDesktopLayout(t){const o=this.container.offsetWidth-40,n=325,i=16;if(o>=900)return!0;if(o>=650){const e=t.classList.contains("desktop-layout");t.classList.remove("desktop-layout"),t.offsetHeight;const s=t.querySelector(".spot-benefits__list, .spot-qualifying-reasons__container");if(!s)return e&&t.classList.add("desktop-layout"),e;const a=Math.min(s.scrollWidth,400)+n+i;return e&&t.classList.add("desktop-layout"),o>=a}return!1}_setupResizeObserver(){!this.container||!window.ResizeObserver||(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=window.setTimeout(()=>{this._updateLayout()},100)}),this._resizeObserver.observe(this.container))}_applyQuoteUpdates(t){!this.quote||!this.container||(t.spotPriceWithFees!==void 0&&(this.quote.communication.yesOptionText=this.quote.communication.yesOptionText.replace(`$${this.quote.spotPrice.toFixed(2)}`,`$${t.spotPriceWithFees.toFixed(2)}`)),this.destroy(),this._renderWidget())}_setupOptionListeners(t){const o=t.querySelectorAll('input[type="radio"]'),n=t.querySelectorAll(".spot-selection__option");o.forEach(i=>{i.addEventListener("change",e=>{var a,u,f;const s=e.target,r=s.value;if(this.hideSelectionError(),this.currentSelection=r,n.forEach(h=>h.classList.remove("selected")),(a=s.closest(".spot-selection__option"))==null||a.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),r==="yes"&&(this.options.quoteRequestData.isPartialPayment&&V(this.paymentTermsEl,this.quote),(u=this.options.callbacks)!=null&&u.onOptIn)){const h={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const d=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(d==null?void 0:d.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptIn(h)}if(r==="no"&&((f=this.options.callbacks)!=null&&f.onOptOut)){const h={status:"QUOTE_DECLINED",quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const d=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(d==null?void 0:d.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptOut(h)}})})}showSelectionError(){var t;if(!this.errorEl){this.errorEl=document.createElement("div"),this.errorEl.className="spot-selection__error",this.errorEl.textContent="Please make a selection";const o=(t=this.container)==null?void 0:t.querySelector(".spot-selection__options");o&&o.insertAdjacentElement("afterend",this.errorEl)}this.errorEl.style.display="block"}hideSelectionError(){this.errorEl&&(this.errorEl.style.display="none")}validateSelection(){if(!this.container)return!1;const t=!!this.container.querySelector('input[name="selection"]:checked');return t?this.hideSelectionError():this.showSelectionError(),t}async updateQuote(t){var o,n,i,e;try{const s={...this.options,quoteRequestData:t};x(s);const{environment:r,partnerId:a,customEndpoint:u}=this.options.apiConfig,f=u||k[r],y="cartInfo"in s.quoteRequestData&&"items"in s.quoteRequestData?await E(f,a,s.quoteRequestData):await _(f,a,s.quoteRequestData);if(y.status!=="QUOTE_AVAILABLE")return y.status==="NO_MATCHING_QUOTE"&&((o=this.options.callbacks)!=null&&o.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:s.quoteRequestData}),!1;if(this.options.quoteRequestData=s.quoteRequestData,this.quote=y.data,this.currentSelection=null,this.destroy(),this._renderWidget(),(n=this.options.callbacks)!=null&&n.onQuoteRetrieved){const c=this.options.callbacks.onQuoteRetrieved(this.quote);c&&this._applyQuoteUpdates(c)}return!0}catch(s){const r=s;return(e=(i=this.options.callbacks)==null?void 0:i.onError)==null||e.call(i,{message:r.message,status:r.status,responseBody:r.responseBody}),!1}}getSelection(){var o,n,i;if(this.currentSelection==null)return null;const t={selection:this.currentSelection,quoteId:(o=this.quote)==null?void 0:o.id,spotPrice:(n=this.quote)==null?void 0:n.spotPrice,status:this.currentSelection==="yes"?"QUOTE_ACCEPTED":"QUOTE_DECLINED"};if((i=this.quote)!=null&&i.originalQuotes&&this.quote.originalQuotes.length>0){const e=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(s=>{var a;const r=(a=e.items)==null?void 0:a.find(u=>(u.cartItemId||`item-${e.items.indexOf(u)+1}`)===s.id);return{quoteId:s.id,productPrice:(r==null?void 0:r.productPrice)||s.spotPrice,cartItemId:s.id}})}return t}destroy(){window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeTimeout&&window.clearTimeout(this._resizeTimeout),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}}return Z});
|
package/dist/ui.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC1D,GAAG,EAAE,CAAC,EACN,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAE,cAAmB,GACxE,qBAAqB,CAAC,CAAC,CAAC,CAS1B;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAC,GACjE,IAAI,CAWN;AAGD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,MAAM,EAAO,GACrB,IAAI,CAcN;AAGD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,EACtB,iBAAiB,GAAE,gBAAgB,EAAO,GACzC,IAAI,
|
|
1
|
+
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACN,MAAM,YAAY,CAAC;AAEpB,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC1D,GAAG,EAAE,CAAC,EACN,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAE,cAAmB,GACxE,qBAAqB,CAAC,CAAC,CAAC,CAS1B;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAC,GACjE,IAAI,CAWN;AAGD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,MAAM,EAAO,GACrB,IAAI,CAcN;AAGD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,EACtB,iBAAiB,GAAE,gBAAgB,EAAO,GACzC,IAAI,CAwEN;AAGD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,YAAY,GAAE,MAAM,EAAO,GAC1B,IAAI,CAoBN;AAGD,wBAAgB,WAAW,CACzB,SAAS,EAAE,WAAW,EACtB,QAAQ,GAAE,kBAAkB,EAAO,GAClC,IAAI,CAyBN;AAGD,wBAAgB,aAAa,CAC3B,SAAS,EAAE,WAAW,EACtB,aAAa,EAAE,OAAO,EACtB,aAAa,EAAE,aAAa,GAC3B,WAAW,CAyCb;AAGD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,KAAK,GACX,WAAW,CAqBb;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,KAAK,EACZ,YAAY,GAAE,cAAc,GAAG,WAA4B,GAC1D,WAAW,CAwEb"}
|