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