@getspot/spot-widget 3.0.2 → 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 +27 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +340 -281
- 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
|
|
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(
|
|
10
|
-
}),
|
|
11
|
-
if (!
|
|
12
|
-
const
|
|
13
|
-
throw
|
|
9
|
+
body: JSON.stringify(e)
|
|
10
|
+
}), i = await s.json();
|
|
11
|
+
if (!s.ok) {
|
|
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
|
-
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(m, t, e) {
|
|
21
21
|
try {
|
|
22
|
-
const
|
|
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
|
-
}),
|
|
30
|
-
if (!
|
|
31
|
-
const n = new Error((
|
|
32
|
-
throw n.status =
|
|
28
|
+
body: JSON.stringify(e)
|
|
29
|
+
}), o = await i.json();
|
|
30
|
+
if (!i.ok) {
|
|
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
|
|
35
|
-
} catch (
|
|
36
|
-
throw
|
|
34
|
+
return o;
|
|
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(m, t, e) {
|
|
40
|
+
var s;
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
43
|
-
cartId:
|
|
44
|
-
cartName:
|
|
45
|
-
currencyCode:
|
|
46
|
-
items:
|
|
42
|
+
const i = {
|
|
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,64 +55,64 @@ async function D(d, 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 =
|
|
61
|
+
const n = o.quotes.map((a) => {
|
|
62
|
+
const u = e.items.find(
|
|
63
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
|
-
}),
|
|
66
|
+
}), r = Math.round((o.totalSpotPrice || o.spotPrice || 0) * 100) / 100;
|
|
67
67
|
return {
|
|
68
68
|
status: "QUOTE_AVAILABLE",
|
|
69
69
|
data: {
|
|
70
|
-
id:
|
|
71
|
-
spotPrice:
|
|
72
|
-
currencyCode:
|
|
70
|
+
id: o.quotes ? o.quotes.map((a) => a.id).join(",") : ((s = o.data) == null ? void 0 : s.id) || "",
|
|
71
|
+
spotPrice: r,
|
|
72
|
+
currencyCode: o.currencyCode || "",
|
|
73
73
|
communication: {
|
|
74
|
-
...
|
|
75
|
-
yesOptionText:
|
|
76
|
-
String(
|
|
77
|
-
String(
|
|
74
|
+
...o.communication,
|
|
75
|
+
yesOptionText: o.communication.yesOptionText.replace(
|
|
76
|
+
String(o.totalSpotPrice),
|
|
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
|
-
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
|
-
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:
|
|
103
|
-
callbacks:
|
|
104
|
-
location:
|
|
105
|
-
theme:
|
|
106
|
-
} =
|
|
102
|
+
quoteRequestData: e,
|
|
103
|
+
callbacks: s = {},
|
|
104
|
+
location: i,
|
|
105
|
+
theme: o
|
|
106
|
+
} = m, {
|
|
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
|
-
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
117
|
const h = [
|
|
118
118
|
"startDate",
|
|
@@ -126,61 +126,61 @@ function I(d) {
|
|
|
126
126
|
"cartId",
|
|
127
127
|
"productName"
|
|
128
128
|
];
|
|
129
|
-
function f(c,
|
|
130
|
-
const
|
|
131
|
-
h.forEach((
|
|
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 =
|
|
171
|
-
if (!
|
|
169
|
+
if ("cartInfo" in e && "items" in e) {
|
|
170
|
+
const c = e, { cartInfo: d, items: l } = 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: ${
|
|
181
|
-
if (!Array.isArray(
|
|
179
|
+
if (!["USD", "CAD", "AUD"].includes(d.currencyCode))
|
|
180
|
+
throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${d.currencyCode}`);
|
|
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(d) {
|
|
|
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
|
-
throw new Error(`quoteRequestData[${
|
|
231
|
-
f(c,
|
|
230
|
+
throw new Error(`quoteRequestData[${d}] must be a non-null object`);
|
|
231
|
+
f(c, d);
|
|
232
232
|
});
|
|
233
233
|
} else
|
|
234
|
-
f(
|
|
234
|
+
f(e);
|
|
235
235
|
if ([
|
|
236
236
|
"onOptIn",
|
|
237
237
|
"onOptOut",
|
|
@@ -239,54 +239,54 @@ 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: '${
|
|
247
|
-
if (
|
|
245
|
+
}), typeof i == "string" && !document.querySelector(i))
|
|
246
|
+
throw new Error(`Invalid location selector: '${i}'`);
|
|
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
|
|
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
|
-
t.forEach((
|
|
273
|
-
const
|
|
274
|
-
|
|
275
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
272
|
+
t.forEach((s) => {
|
|
273
|
+
const i = p("li", { parent: e });
|
|
274
|
+
i.innerHTML = `
|
|
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
|
|
278
|
-
</svg>`, p("span", { text:
|
|
277
|
+
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
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:
|
|
286
|
-
}),
|
|
285
|
+
parent: m
|
|
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",
|
|
@@ -295,111 +295,163 @@ 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 f, 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
|
-
}),
|
|
308
|
-
if (
|
|
309
|
-
const
|
|
310
|
-
parent:
|
|
318
|
+
parent: a
|
|
319
|
+
}), h = o[((f = r.benefitType) == null ? void 0 : f.name) || ""] || o[r.name || ""];
|
|
320
|
+
if (h) {
|
|
321
|
+
const d = p("img", {
|
|
322
|
+
parent: u
|
|
311
323
|
});
|
|
312
|
-
|
|
324
|
+
d.src = n + h, 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
|
|
322
|
-
if (t.length === 0)
|
|
323
|
-
|
|
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", {
|
|
324
350
|
className: "spot-covered-items__container",
|
|
325
|
-
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
|
|
326
358
|
});
|
|
327
|
-
p("
|
|
359
|
+
p("span", {
|
|
328
360
|
className: "spot-covered-items__title",
|
|
329
|
-
text:
|
|
330
|
-
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
|
|
331
367
|
});
|
|
332
|
-
|
|
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", {
|
|
333
381
|
className: "spot-covered-items__list",
|
|
334
|
-
parent:
|
|
382
|
+
parent: f
|
|
335
383
|
});
|
|
336
|
-
|
|
337
|
-
const
|
|
338
|
-
p("span", { text:
|
|
384
|
+
o.forEach(({ displayText: d }) => {
|
|
385
|
+
const l = p("li", { parent: y });
|
|
386
|
+
p("span", { text: d, parent: l });
|
|
339
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");
|
|
340
392
|
}
|
|
341
|
-
function P(
|
|
342
|
-
const
|
|
393
|
+
function P(m, t = []) {
|
|
394
|
+
const e = p("div", {
|
|
343
395
|
className: "spot-table__container",
|
|
344
|
-
parent:
|
|
345
|
-
}),
|
|
396
|
+
parent: m
|
|
397
|
+
}), s = p("table", {
|
|
346
398
|
className: "spot-refund__table spot-table--dynamic",
|
|
347
|
-
parent:
|
|
348
|
-
}),
|
|
349
|
-
p("th", { text: "When you cancel", parent:
|
|
350
|
-
const n = p("tbody", { parent:
|
|
351
|
-
t.forEach(({ text:
|
|
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 });
|
|
402
|
+
const n = p("tbody", { parent: s });
|
|
403
|
+
t.forEach(({ text: r, percent: a, amount: u }) => {
|
|
352
404
|
const h = p("tr", { parent: n });
|
|
353
|
-
p("td", { text:
|
|
405
|
+
p("td", { text: r, parent: h });
|
|
354
406
|
const f = a === "Not eligible for refund" ? "Not eligible for a refund" : `$${u} refund`;
|
|
355
407
|
p("td", { text: f, parent: h });
|
|
356
408
|
});
|
|
357
409
|
}
|
|
358
|
-
function $(
|
|
359
|
-
const
|
|
410
|
+
function $(m, t, e) {
|
|
411
|
+
const s = p("div", {
|
|
360
412
|
className: "spot-selection__options",
|
|
361
|
-
parent:
|
|
362
|
-
}),
|
|
413
|
+
parent: m
|
|
414
|
+
}), i = p("label", {
|
|
363
415
|
className: `spot-selection__option ${t ? "selected" : ""}`,
|
|
416
|
+
parent: s
|
|
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,
|
|
364
420
|
parent: i
|
|
365
|
-
}), e = p("input", { parent: r });
|
|
366
|
-
e.type = "radio", e.name = "selection", e.value = "yes", t && (e.checked = !0), p("strong", {
|
|
367
|
-
text: o.yesOptionText,
|
|
368
|
-
parent: r
|
|
369
421
|
}), p("span", {
|
|
370
422
|
className: "spot-selection__recommended-tag",
|
|
371
423
|
text: "Recommended",
|
|
372
|
-
parent:
|
|
424
|
+
parent: i
|
|
373
425
|
});
|
|
374
426
|
const n = p("label", {
|
|
375
427
|
className: "spot-selection__option",
|
|
376
|
-
parent:
|
|
377
|
-
}),
|
|
378
|
-
return
|
|
428
|
+
parent: s
|
|
429
|
+
}), r = p("input", { parent: n });
|
|
430
|
+
return r.type = "radio", r.name = "selection", r.value = "no", p("span", { text: e.noOptionText, parent: n }), s;
|
|
379
431
|
}
|
|
380
|
-
function
|
|
381
|
-
var
|
|
382
|
-
const
|
|
432
|
+
function R(m, t) {
|
|
433
|
+
var i;
|
|
434
|
+
const e = (i = t.communication) == null ? void 0 : i.paymentTerms, s = p("div", {
|
|
383
435
|
className: "spot-payment-terms",
|
|
384
|
-
parent:
|
|
436
|
+
parent: m
|
|
385
437
|
});
|
|
386
438
|
return p("div", {
|
|
387
439
|
className: "spot-payment-terms__header",
|
|
388
440
|
text: "PAYMENT TERMS",
|
|
389
|
-
parent:
|
|
441
|
+
parent: s
|
|
390
442
|
}), p("div", {
|
|
391
443
|
className: "spot-payment-terms__body",
|
|
392
|
-
text:
|
|
393
|
-
parent:
|
|
394
|
-
}),
|
|
444
|
+
text: e || "",
|
|
445
|
+
parent: s
|
|
446
|
+
}), s;
|
|
395
447
|
}
|
|
396
|
-
function
|
|
397
|
-
if (
|
|
398
|
-
const
|
|
448
|
+
function V(m, t, e = "bottom-right") {
|
|
449
|
+
if (e === "top-right") {
|
|
450
|
+
const o = p("div", {
|
|
399
451
|
className: "spot-logo__top-right",
|
|
400
|
-
parent:
|
|
452
|
+
parent: m
|
|
401
453
|
});
|
|
402
|
-
|
|
454
|
+
o.innerHTML = `
|
|
403
455
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
404
456
|
<rect width="145" height="28"/>
|
|
405
457
|
<rect x="-655" y="-270" width="819" height="325" rx="10"/>
|
|
@@ -416,28 +468,28 @@ function R(d, t, o = "bottom-right") {
|
|
|
416
468
|
</defs>
|
|
417
469
|
</svg>`;
|
|
418
470
|
}
|
|
419
|
-
const
|
|
471
|
+
const s = p("div", {
|
|
420
472
|
className: "spot-footer__container",
|
|
421
|
-
parent:
|
|
422
|
-
}),
|
|
473
|
+
parent: m
|
|
474
|
+
}), i = p("div", {
|
|
423
475
|
className: "spot-footer__terms",
|
|
424
|
-
parent:
|
|
476
|
+
parent: s
|
|
425
477
|
});
|
|
426
478
|
if (p("span", {
|
|
427
479
|
innerHTML: t.communication.legalDisclaimer,
|
|
428
|
-
parent:
|
|
429
|
-
}), p("br", { parent:
|
|
480
|
+
parent: i
|
|
481
|
+
}), p("br", { parent: i }), p("a", {
|
|
430
482
|
href: t.communication.termsAndConditionsUrl,
|
|
431
483
|
target: "_blank",
|
|
432
484
|
className: "spot-footer__terms-link",
|
|
433
485
|
text: "Refund Guarantee Terms and Conditions",
|
|
434
|
-
parent:
|
|
435
|
-
}),
|
|
436
|
-
const
|
|
486
|
+
parent: i
|
|
487
|
+
}), e === "bottom-right") {
|
|
488
|
+
const o = p("p", {
|
|
437
489
|
className: "spot-footer__powered-by",
|
|
438
|
-
parent:
|
|
490
|
+
parent: s
|
|
439
491
|
});
|
|
440
|
-
|
|
492
|
+
o.innerHTML = `
|
|
441
493
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
442
494
|
<rect width="145" height="28"/>
|
|
443
495
|
<rect x="-655" y="-270" width="819" height="325" rx="10"/>
|
|
@@ -454,12 +506,12 @@ function R(d, t, o = "bottom-right") {
|
|
|
454
506
|
</defs>
|
|
455
507
|
</svg>`;
|
|
456
508
|
}
|
|
457
|
-
return
|
|
509
|
+
return s;
|
|
458
510
|
}
|
|
459
|
-
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(
|
|
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) {
|
|
461
513
|
const t = document.createElement("style");
|
|
462
|
-
t.textContent =
|
|
514
|
+
t.textContent = m, document.head.appendChild(t);
|
|
463
515
|
}
|
|
464
516
|
S(Q);
|
|
465
517
|
const T = {
|
|
@@ -467,7 +519,7 @@ const T = {
|
|
|
467
519
|
production: "https://api.getspot.com/api/v1/quote",
|
|
468
520
|
local: "http://localhost:3999/api/v1/quote"
|
|
469
521
|
};
|
|
470
|
-
class
|
|
522
|
+
class A {
|
|
471
523
|
constructor(t = {}) {
|
|
472
524
|
this.options = {
|
|
473
525
|
location: "body",
|
|
@@ -482,19 +534,19 @@ class Z {
|
|
|
482
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();
|
|
483
535
|
}
|
|
484
536
|
async _init() {
|
|
485
|
-
var t,
|
|
537
|
+
var t, e, s, i, o;
|
|
486
538
|
try {
|
|
487
539
|
I(this.options);
|
|
488
540
|
let n;
|
|
489
541
|
if (this.options.useMockData && this.options.mockData)
|
|
490
542
|
n = this.options.mockData;
|
|
491
543
|
else {
|
|
492
|
-
const { environment:
|
|
544
|
+
const { environment: r, partnerId: a } = this.options.apiConfig, h = this.options.apiConfig.customEndpoint || T[r];
|
|
493
545
|
n = "cartInfo" in this.options.quoteRequestData && "items" in this.options.quoteRequestData ? await D(
|
|
494
546
|
h,
|
|
495
547
|
a,
|
|
496
548
|
this.options.quoteRequestData
|
|
497
|
-
) : await
|
|
549
|
+
) : await x(
|
|
498
550
|
h,
|
|
499
551
|
a,
|
|
500
552
|
this.options.quoteRequestData
|
|
@@ -509,15 +561,15 @@ class Z {
|
|
|
509
561
|
}
|
|
510
562
|
if (this.quote = n.data, !this.quote)
|
|
511
563
|
throw new Error("No quote data in response");
|
|
512
|
-
if (this._renderWidget(), this.options.optInSelected && ((
|
|
513
|
-
const
|
|
564
|
+
if (this._renderWidget(), this.options.optInSelected && ((e = this.options.callbacks) != null && e.onOptIn)) {
|
|
565
|
+
const r = {
|
|
514
566
|
status: "QUOTE_ACCEPTED",
|
|
515
567
|
spotPrice: this.quote.spotPrice,
|
|
516
568
|
quoteId: this.quote.id
|
|
517
569
|
};
|
|
518
570
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
519
571
|
const a = this.options.quoteRequestData;
|
|
520
|
-
|
|
572
|
+
r.batchQuoteDetails = this.quote.originalQuotes.map((u) => {
|
|
521
573
|
var f;
|
|
522
574
|
const h = (f = a.items) == null ? void 0 : f.find(
|
|
523
575
|
(y) => (y.cartItemId || `item-${a.items.indexOf(y) + 1}`) === u.id
|
|
@@ -529,67 +581,71 @@ class Z {
|
|
|
529
581
|
};
|
|
530
582
|
});
|
|
531
583
|
}
|
|
532
|
-
this.options.callbacks.onOptIn(
|
|
584
|
+
this.options.callbacks.onOptIn(r);
|
|
533
585
|
}
|
|
534
|
-
if ((
|
|
535
|
-
const
|
|
536
|
-
|
|
586
|
+
if ((s = this.options.callbacks) != null && s.onQuoteRetrieved) {
|
|
587
|
+
const r = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
588
|
+
r && this._applyQuoteUpdates(r);
|
|
537
589
|
}
|
|
538
590
|
} catch (n) {
|
|
539
|
-
if ((
|
|
540
|
-
const
|
|
541
|
-
(
|
|
542
|
-
message:
|
|
543
|
-
status:
|
|
544
|
-
responseBody:
|
|
591
|
+
if ((i = this.options.callbacks) != null && i.onError) {
|
|
592
|
+
const r = n;
|
|
593
|
+
(o = this.options.callbacks) == null || o.onError({
|
|
594
|
+
message: r.message,
|
|
595
|
+
status: r.status,
|
|
596
|
+
responseBody: r.responseBody
|
|
545
597
|
});
|
|
546
598
|
}
|
|
547
599
|
}
|
|
548
600
|
}
|
|
549
601
|
_renderWidget() {
|
|
550
602
|
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
|
|
553
|
-
this.container.style.setProperty(
|
|
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]) => {
|
|
604
|
+
const o = `--${s}`;
|
|
605
|
+
this.container.style.setProperty(o, i);
|
|
554
606
|
}), N(this.container, this.quote.communication);
|
|
555
607
|
const t = document.createElement("div");
|
|
556
|
-
t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ?
|
|
557
|
-
|
|
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 = $(
|
|
558
614
|
t,
|
|
559
615
|
this.options.optInSelected,
|
|
560
616
|
this.quote.communication
|
|
561
617
|
);
|
|
562
|
-
t.appendChild(
|
|
618
|
+
t.appendChild(e), this.paymentTermsEl = p("div", {
|
|
563
619
|
className: "spot-payment-terms__wrapper",
|
|
564
620
|
parent: t
|
|
565
|
-
}),
|
|
621
|
+
}), V(this.container, this.quote, this.options.logoPosition), window.addEventListener("resize", this._onResize), this._setupResizeObserver(), this._updateLayout(), this._setupOptionListeners(e);
|
|
566
622
|
}
|
|
567
623
|
_updateLayout() {
|
|
568
624
|
if (!this.container || !this.quote) return;
|
|
569
625
|
const t = this.container.querySelector(
|
|
570
626
|
".spot-content__wrapper"
|
|
571
|
-
),
|
|
572
|
-
if (!t || !
|
|
627
|
+
), e = this.options.showTable && !this.quote.qualifyingReasons;
|
|
628
|
+
if (!t || !e) {
|
|
573
629
|
t == null || t.classList.remove("desktop-layout");
|
|
574
630
|
return;
|
|
575
631
|
}
|
|
576
|
-
const
|
|
577
|
-
t.classList.toggle("desktop-layout",
|
|
632
|
+
const s = this._shouldUseDesktopLayout(t);
|
|
633
|
+
t.classList.toggle("desktop-layout", s);
|
|
578
634
|
}
|
|
579
635
|
_shouldUseDesktopLayout(t) {
|
|
580
|
-
const
|
|
581
|
-
if (
|
|
636
|
+
const e = this.container.offsetWidth - 40, s = 325, i = 16;
|
|
637
|
+
if (e >= 900)
|
|
582
638
|
return !0;
|
|
583
|
-
if (
|
|
584
|
-
const
|
|
639
|
+
if (e >= 650) {
|
|
640
|
+
const o = t.classList.contains("desktop-layout");
|
|
585
641
|
t.classList.remove("desktop-layout"), t.offsetHeight;
|
|
586
642
|
const n = t.querySelector(
|
|
587
643
|
".spot-benefits__list, .spot-qualifying-reasons__container"
|
|
588
644
|
);
|
|
589
645
|
if (!n)
|
|
590
|
-
return
|
|
591
|
-
const a = Math.min(n.scrollWidth, 400) +
|
|
592
|
-
return
|
|
646
|
+
return o && t.classList.add("desktop-layout"), o;
|
|
647
|
+
const a = Math.min(n.scrollWidth, 400) + s + i;
|
|
648
|
+
return o && t.classList.add("desktop-layout"), e >= a;
|
|
593
649
|
}
|
|
594
650
|
return !1;
|
|
595
651
|
}
|
|
@@ -600,6 +656,9 @@ class Z {
|
|
|
600
656
|
}, 100);
|
|
601
657
|
}), this._resizeObserver.observe(this.container));
|
|
602
658
|
}
|
|
659
|
+
_getTotalItemsInRequest() {
|
|
660
|
+
return "cartInfo" in this.options.quoteRequestData && "items" in this.options.quoteRequestData ? this.options.quoteRequestData.items.length : 1;
|
|
661
|
+
}
|
|
603
662
|
_applyQuoteUpdates(t) {
|
|
604
663
|
!this.quote || !this.container || (t.spotPriceWithFees !== void 0 && (this.quote.communication.yesOptionText = this.quote.communication.yesOptionText.replace(
|
|
605
664
|
`$${this.quote.spotPrice.toFixed(2)}`,
|
|
@@ -607,14 +666,14 @@ class Z {
|
|
|
607
666
|
)), this.destroy(), this._renderWidget());
|
|
608
667
|
}
|
|
609
668
|
_setupOptionListeners(t) {
|
|
610
|
-
const
|
|
669
|
+
const e = t.querySelectorAll(
|
|
611
670
|
'input[type="radio"]'
|
|
612
|
-
),
|
|
613
|
-
|
|
614
|
-
|
|
671
|
+
), s = t.querySelectorAll(".spot-selection__option");
|
|
672
|
+
e.forEach((i) => {
|
|
673
|
+
i.addEventListener("change", (o) => {
|
|
615
674
|
var a, u, h;
|
|
616
|
-
const n =
|
|
617
|
-
if (this.hideSelectionError(), this.currentSelection =
|
|
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)) {
|
|
618
677
|
const f = {
|
|
619
678
|
status: "QUOTE_ACCEPTED",
|
|
620
679
|
spotPrice: this.quote.spotPrice,
|
|
@@ -624,13 +683,13 @@ class Z {
|
|
|
624
683
|
const y = this.options.quoteRequestData;
|
|
625
684
|
f.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
626
685
|
(c) => {
|
|
627
|
-
var
|
|
628
|
-
const
|
|
686
|
+
var l;
|
|
687
|
+
const d = (l = y.items) == null ? void 0 : l.find(
|
|
629
688
|
(b) => (b.cartItemId || `item-${y.items.indexOf(b) + 1}`) === c.id
|
|
630
689
|
);
|
|
631
690
|
return {
|
|
632
691
|
quoteId: c.id,
|
|
633
|
-
productPrice: (
|
|
692
|
+
productPrice: (d == null ? void 0 : d.productPrice) || c.spotPrice,
|
|
634
693
|
cartItemId: c.id
|
|
635
694
|
};
|
|
636
695
|
}
|
|
@@ -638,7 +697,7 @@ class Z {
|
|
|
638
697
|
}
|
|
639
698
|
this.options.callbacks.onOptIn(f);
|
|
640
699
|
}
|
|
641
|
-
if (
|
|
700
|
+
if (r === "no" && ((h = this.options.callbacks) != null && h.onOptOut)) {
|
|
642
701
|
const f = {
|
|
643
702
|
status: "QUOTE_DECLINED",
|
|
644
703
|
quoteId: this.quote.id
|
|
@@ -647,13 +706,13 @@ class Z {
|
|
|
647
706
|
const y = this.options.quoteRequestData;
|
|
648
707
|
f.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
649
708
|
(c) => {
|
|
650
|
-
var
|
|
651
|
-
const
|
|
709
|
+
var l;
|
|
710
|
+
const d = (l = y.items) == null ? void 0 : l.find(
|
|
652
711
|
(b) => (b.cartItemId || `item-${y.items.indexOf(b) + 1}`) === c.id
|
|
653
712
|
);
|
|
654
713
|
return {
|
|
655
714
|
quoteId: c.id,
|
|
656
|
-
productPrice: (
|
|
715
|
+
productPrice: (d == null ? void 0 : d.productPrice) || c.spotPrice,
|
|
657
716
|
cartItemId: c.id
|
|
658
717
|
};
|
|
659
718
|
}
|
|
@@ -668,10 +727,10 @@ class Z {
|
|
|
668
727
|
var t;
|
|
669
728
|
if (!this.errorEl) {
|
|
670
729
|
this.errorEl = document.createElement("div"), this.errorEl.className = "spot-selection__error", this.errorEl.textContent = "Please make a selection";
|
|
671
|
-
const
|
|
730
|
+
const e = (t = this.container) == null ? void 0 : t.querySelector(
|
|
672
731
|
".spot-selection__options"
|
|
673
732
|
);
|
|
674
|
-
|
|
733
|
+
e && e.insertAdjacentElement("afterend", this.errorEl);
|
|
675
734
|
}
|
|
676
735
|
this.errorEl.style.display = "block";
|
|
677
736
|
}
|
|
@@ -686,60 +745,60 @@ class Z {
|
|
|
686
745
|
return t ? this.hideSelectionError() : this.showSelectionError(), t;
|
|
687
746
|
}
|
|
688
747
|
async updateQuote(t) {
|
|
689
|
-
var
|
|
748
|
+
var e, s, i, o;
|
|
690
749
|
try {
|
|
691
750
|
const n = {
|
|
692
751
|
...this.options,
|
|
693
752
|
quoteRequestData: t
|
|
694
753
|
};
|
|
695
754
|
I(n);
|
|
696
|
-
const { environment:
|
|
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(
|
|
697
756
|
h,
|
|
698
757
|
a,
|
|
699
758
|
n.quoteRequestData
|
|
700
|
-
) : await
|
|
759
|
+
) : await x(
|
|
701
760
|
h,
|
|
702
761
|
a,
|
|
703
762
|
n.quoteRequestData
|
|
704
763
|
);
|
|
705
764
|
if (y.status !== "QUOTE_AVAILABLE")
|
|
706
|
-
return y.status === "NO_MATCHING_QUOTE" && ((
|
|
765
|
+
return y.status === "NO_MATCHING_QUOTE" && ((e = this.options.callbacks) != null && e.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
707
766
|
status: "NO_MATCHING_QUOTE",
|
|
708
767
|
data: n.quoteRequestData
|
|
709
768
|
}), !1;
|
|
710
|
-
if (this.options.quoteRequestData = n.quoteRequestData, this.quote = y.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (
|
|
769
|
+
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
770
|
const c = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
712
771
|
c && this._applyQuoteUpdates(c);
|
|
713
772
|
}
|
|
714
773
|
return !0;
|
|
715
774
|
} catch (n) {
|
|
716
|
-
const
|
|
717
|
-
return (
|
|
718
|
-
message:
|
|
719
|
-
status:
|
|
720
|
-
responseBody:
|
|
775
|
+
const r = n;
|
|
776
|
+
return (o = (i = this.options.callbacks) == null ? void 0 : i.onError) == null || o.call(i, {
|
|
777
|
+
message: r.message,
|
|
778
|
+
status: r.status,
|
|
779
|
+
responseBody: r.responseBody
|
|
721
780
|
}), !1;
|
|
722
781
|
}
|
|
723
782
|
}
|
|
724
783
|
getSelection() {
|
|
725
|
-
var
|
|
784
|
+
var e, s, i;
|
|
726
785
|
if (this.currentSelection == null) return null;
|
|
727
786
|
const t = {
|
|
728
787
|
selection: this.currentSelection,
|
|
729
|
-
quoteId: (
|
|
730
|
-
spotPrice: (
|
|
788
|
+
quoteId: (e = this.quote) == null ? void 0 : e.id,
|
|
789
|
+
spotPrice: (s = this.quote) == null ? void 0 : s.spotPrice,
|
|
731
790
|
status: this.currentSelection === "yes" ? "QUOTE_ACCEPTED" : "QUOTE_DECLINED"
|
|
732
791
|
};
|
|
733
|
-
if ((
|
|
734
|
-
const
|
|
792
|
+
if ((i = this.quote) != null && i.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
793
|
+
const o = this.options.quoteRequestData;
|
|
735
794
|
t.batchQuoteDetails = this.quote.originalQuotes.map((n) => {
|
|
736
795
|
var a;
|
|
737
|
-
const
|
|
738
|
-
(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
|
|
739
798
|
);
|
|
740
799
|
return {
|
|
741
800
|
quoteId: n.id,
|
|
742
|
-
productPrice: (
|
|
801
|
+
productPrice: (r == null ? void 0 : r.productPrice) || n.spotPrice,
|
|
743
802
|
cartItemId: n.id
|
|
744
803
|
};
|
|
745
804
|
});
|
|
@@ -751,5 +810,5 @@ class Z {
|
|
|
751
810
|
}
|
|
752
811
|
}
|
|
753
812
|
export {
|
|
754
|
-
|
|
813
|
+
A as default
|
|
755
814
|
};
|