@getspot/spot-widget 2.1.0 → 3.0.0
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 +12 -0
- package/README.md +13 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +280 -255
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +7 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
async function k(
|
|
1
|
+
async function k(d, t, o) {
|
|
2
2
|
try {
|
|
3
|
-
const i = await fetch(
|
|
3
|
+
const i = await fetch(d, {
|
|
4
4
|
method: "POST",
|
|
5
5
|
headers: {
|
|
6
6
|
"Content-Type": "application/json",
|
|
@@ -17,9 +17,9 @@ async function k(u, t, o) {
|
|
|
17
17
|
throw i instanceof Error ? i : new Error("Unknown error occurred while fetching quote");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async function H(
|
|
20
|
+
async function H(d, t, o) {
|
|
21
21
|
try {
|
|
22
|
-
const i =
|
|
22
|
+
const i = d.replace("/quote", "/quote/batch"), r = await fetch(i, {
|
|
23
23
|
method: "POST",
|
|
24
24
|
headers: {
|
|
25
25
|
"Content-Type": "application/json",
|
|
@@ -28,64 +28,64 @@ async function H(u, t, o) {
|
|
|
28
28
|
body: JSON.stringify(o)
|
|
29
29
|
}), e = await r.json();
|
|
30
30
|
if (!r.ok) {
|
|
31
|
-
const
|
|
32
|
-
throw
|
|
31
|
+
const n = new Error((e == null ? void 0 : e.message) || "Failed to fetch batch quote");
|
|
32
|
+
throw n.status = r.status, n.responseBody = e, n;
|
|
33
33
|
}
|
|
34
34
|
return e;
|
|
35
35
|
} catch (i) {
|
|
36
36
|
throw i instanceof Error ? i : new Error("Unknown error occurred while fetching batch quote");
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
|
-
async function
|
|
39
|
+
async function D(d, t, o) {
|
|
40
40
|
var i;
|
|
41
41
|
try {
|
|
42
42
|
const r = {
|
|
43
43
|
cartId: o.cartInfo.cartId,
|
|
44
44
|
cartName: o.cartInfo.cartName,
|
|
45
45
|
currencyCode: o.cartInfo.currencyCode,
|
|
46
|
-
items: o.items.map((
|
|
47
|
-
cartItemId:
|
|
48
|
-
productPrice:
|
|
49
|
-
productType:
|
|
50
|
-
productDuration:
|
|
51
|
-
productId:
|
|
52
|
-
productName:
|
|
53
|
-
participantDescription:
|
|
54
|
-
eventType:
|
|
55
|
-
startDate:
|
|
56
|
-
endDate:
|
|
46
|
+
items: o.items.map((a, u) => ({
|
|
47
|
+
cartItemId: a.cartItemId || `item-${u + 1}`,
|
|
48
|
+
productPrice: a.productPrice,
|
|
49
|
+
productType: a.productType,
|
|
50
|
+
productDuration: a.productDuration,
|
|
51
|
+
productId: a.productId,
|
|
52
|
+
productName: a.productName,
|
|
53
|
+
participantDescription: a.participantDescription,
|
|
54
|
+
eventType: a.eventType,
|
|
55
|
+
startDate: a.startDate,
|
|
56
|
+
endDate: a.endDate
|
|
57
57
|
}))
|
|
58
|
-
}, e = await H(
|
|
58
|
+
}, e = await H(d, t, r);
|
|
59
59
|
if (e.status !== "QUOTES_AVAILABLE" && e.status !== "QUOTE_AVAILABLE")
|
|
60
60
|
return { status: "NO_MATCHING_QUOTE" };
|
|
61
|
-
const
|
|
62
|
-
const
|
|
63
|
-
(
|
|
61
|
+
const n = e.quotes.map((a) => {
|
|
62
|
+
const u = o.items.find(
|
|
63
|
+
(h, f) => (h.cartItemId || `item-${f + 1}`) === a.cartItemId
|
|
64
64
|
);
|
|
65
|
-
return
|
|
66
|
-
}),
|
|
65
|
+
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${a.id}`;
|
|
66
|
+
}), s = Math.round((e.totalSpotPrice || e.spotPrice || 0) * 100) / 100;
|
|
67
67
|
return {
|
|
68
68
|
status: "QUOTE_AVAILABLE",
|
|
69
69
|
data: {
|
|
70
|
-
id: e.quotes ? e.quotes.map((
|
|
71
|
-
spotPrice:
|
|
70
|
+
id: e.quotes ? e.quotes.map((a) => a.id).join(",") : ((i = e.data) == null ? void 0 : i.id) || "",
|
|
71
|
+
spotPrice: s,
|
|
72
72
|
currencyCode: e.currencyCode || "",
|
|
73
73
|
communication: {
|
|
74
74
|
...e.communication,
|
|
75
75
|
yesOptionText: e.communication.yesOptionText.replace(
|
|
76
76
|
String(e.totalSpotPrice),
|
|
77
|
-
String(
|
|
77
|
+
String(s)
|
|
78
78
|
)
|
|
79
79
|
},
|
|
80
|
-
payoutSchedule: e.payoutSchedule.map((
|
|
81
|
-
...
|
|
82
|
-
amount:
|
|
80
|
+
payoutSchedule: e.payoutSchedule.map((a) => ({
|
|
81
|
+
...a,
|
|
82
|
+
amount: a.amount !== void 0 ? a.amount : 0
|
|
83
83
|
})),
|
|
84
|
-
coveredItems:
|
|
84
|
+
coveredItems: n,
|
|
85
85
|
originalQuotes: e.quotes || (e.data ? [e.data] : [])
|
|
86
86
|
},
|
|
87
|
-
spotPrice:
|
|
88
|
-
coveredItems:
|
|
87
|
+
spotPrice: s,
|
|
88
|
+
coveredItems: n
|
|
89
89
|
};
|
|
90
90
|
} catch (r) {
|
|
91
91
|
throw r instanceof Error ? r : new Error("Unknown error occurred while fetching multiple quotes");
|
|
@@ -96,25 +96,25 @@ const M = {
|
|
|
96
96
|
production: "https://api.getspot.com/v1/quote",
|
|
97
97
|
local: "http://localhost:3999/api/v1/quote"
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function I(d) {
|
|
100
100
|
const {
|
|
101
101
|
apiConfig: t = {},
|
|
102
102
|
quoteRequestData: o,
|
|
103
103
|
callbacks: i = {},
|
|
104
104
|
location: r,
|
|
105
105
|
theme: e
|
|
106
|
-
} =
|
|
107
|
-
environment:
|
|
108
|
-
partnerId:
|
|
109
|
-
customEndpoint:
|
|
106
|
+
} = d, {
|
|
107
|
+
environment: n = "sandbox",
|
|
108
|
+
partnerId: s,
|
|
109
|
+
customEndpoint: a
|
|
110
110
|
} = t;
|
|
111
|
-
if (!
|
|
111
|
+
if (!s || typeof s != "string")
|
|
112
112
|
throw new Error("Invalid or missing partnerId in apiConfig");
|
|
113
|
-
if (!(
|
|
114
|
-
throw new Error(`Invalid environment in apiConfig: ${
|
|
113
|
+
if (!(a || M[n]))
|
|
114
|
+
throw new Error(`Invalid environment in apiConfig: ${n}`);
|
|
115
115
|
if (!o || typeof o != "object" && !Array.isArray(o))
|
|
116
116
|
throw new Error("quoteRequestData must be a non-null object or array");
|
|
117
|
-
const
|
|
117
|
+
const h = [
|
|
118
118
|
"startDate",
|
|
119
119
|
"endDate",
|
|
120
120
|
"currencyCode",
|
|
@@ -126,61 +126,61 @@ function D(u) {
|
|
|
126
126
|
"cartId",
|
|
127
127
|
"productName"
|
|
128
128
|
];
|
|
129
|
-
function f(c,
|
|
130
|
-
const
|
|
131
|
-
|
|
132
|
-
if (!Object.prototype.hasOwnProperty.call(c,
|
|
133
|
-
throw new Error(`Missing required ${
|
|
129
|
+
function f(c, l = null) {
|
|
130
|
+
const m = l !== null ? `quoteRequestData[${l}]` : "quoteRequestData";
|
|
131
|
+
h.forEach((w) => {
|
|
132
|
+
if (!Object.prototype.hasOwnProperty.call(c, w) || c[w] === void 0 || c[w] === null)
|
|
133
|
+
throw new Error(`Missing required ${m} field: '${w}'`);
|
|
134
134
|
});
|
|
135
|
-
const
|
|
136
|
-
if (!
|
|
137
|
-
throw new Error(`${
|
|
138
|
-
if (!
|
|
139
|
-
throw new Error(`${
|
|
135
|
+
const b = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
136
|
+
if (!b.test(c.startDate))
|
|
137
|
+
throw new Error(`${m}.startDate must be a valid ISO8601 string`);
|
|
138
|
+
if (!b.test(c.endDate))
|
|
139
|
+
throw new Error(`${m}.endDate must be a valid ISO8601 string`);
|
|
140
140
|
if (typeof c.currencyCode != "string")
|
|
141
|
-
throw new Error(`${
|
|
141
|
+
throw new Error(`${m}.currencyCode must be a string`);
|
|
142
142
|
if (!["USD", "CAD", "AUD"].includes(c.currencyCode))
|
|
143
|
-
throw new Error(`Invalid ${
|
|
143
|
+
throw new Error(`Invalid ${m}.currencyCode: ${c.currencyCode}`);
|
|
144
144
|
if (typeof c.eventType != "string")
|
|
145
|
-
throw new Error(`${
|
|
145
|
+
throw new Error(`${m}.eventType must be a string`);
|
|
146
146
|
if (typeof c.productType != "string")
|
|
147
|
-
throw new Error(`${
|
|
148
|
-
const
|
|
149
|
-
if (!
|
|
147
|
+
throw new Error(`${m}.productType must be a string`);
|
|
148
|
+
const g = ["Pass", "Trip", "Registration"];
|
|
149
|
+
if (!g.includes(c.productType))
|
|
150
150
|
throw new Error(
|
|
151
|
-
`${
|
|
151
|
+
`${m}.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(`${m}.productDuration must be a string`);
|
|
155
|
+
const _ = ["Daily", "Seasonal", "Trip", "Event"];
|
|
156
|
+
if (!_.includes(c.productDuration))
|
|
157
157
|
throw new Error(
|
|
158
|
-
`${
|
|
158
|
+
`${m}.productDuration must be one of ${_.join(", ")}`
|
|
159
159
|
);
|
|
160
160
|
if (typeof c.productPrice != "number" || isNaN(c.productPrice))
|
|
161
|
-
throw new Error(`${
|
|
161
|
+
throw new Error(`${m}.productPrice must be a valid number`);
|
|
162
162
|
if (typeof c.productId != "string")
|
|
163
|
-
throw new Error(`${
|
|
163
|
+
throw new Error(`${m}.productId must be a string`);
|
|
164
164
|
if (typeof c.cartId != "string")
|
|
165
|
-
throw new Error(`${
|
|
165
|
+
throw new Error(`${m}.cartId must be a string`);
|
|
166
166
|
if (typeof c.productName != "string")
|
|
167
|
-
throw new Error(`${
|
|
167
|
+
throw new Error(`${m}.productName must be a string`);
|
|
168
168
|
}
|
|
169
169
|
if ("cartInfo" in o && "items" in o) {
|
|
170
|
-
const c = o, { cartInfo:
|
|
171
|
-
if (!
|
|
170
|
+
const c = o, { cartInfo: l, items: m } = c;
|
|
171
|
+
if (!l || typeof l != "object")
|
|
172
172
|
throw new Error("quoteRequestData.cartInfo must be a non-null object");
|
|
173
|
-
if (!
|
|
173
|
+
if (!l.cartId || typeof l.cartId != "string")
|
|
174
174
|
throw new Error("quoteRequestData.cartInfo.cartId must be a string");
|
|
175
|
-
if (!
|
|
175
|
+
if (!l.cartName || typeof l.cartName != "string")
|
|
176
176
|
throw new Error("quoteRequestData.cartInfo.cartName must be a string");
|
|
177
|
-
if (!
|
|
177
|
+
if (!l.currencyCode || typeof l.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(l.currencyCode))
|
|
180
|
+
throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${l.currencyCode}`);
|
|
181
|
+
if (!Array.isArray(m) || m.length === 0)
|
|
182
182
|
throw new Error("quoteRequestData.items must be a non-empty array");
|
|
183
|
-
const
|
|
183
|
+
const C = [
|
|
184
184
|
"startDate",
|
|
185
185
|
"endDate",
|
|
186
186
|
"eventType",
|
|
@@ -190,45 +190,45 @@ function D(u) {
|
|
|
190
190
|
"productId",
|
|
191
191
|
"productName"
|
|
192
192
|
];
|
|
193
|
-
|
|
194
|
-
if (!
|
|
195
|
-
throw new Error(`quoteRequestData.items[${
|
|
196
|
-
const
|
|
197
|
-
|
|
198
|
-
if (!Object.prototype.hasOwnProperty.call(
|
|
199
|
-
throw new Error(`Missing required ${
|
|
193
|
+
m.forEach((g, _) => {
|
|
194
|
+
if (!g || typeof g != "object")
|
|
195
|
+
throw new Error(`quoteRequestData.items[${_}] must be a non-null object`);
|
|
196
|
+
const w = `quoteRequestData.items[${_}]`;
|
|
197
|
+
C.forEach((v) => {
|
|
198
|
+
if (!Object.prototype.hasOwnProperty.call(g, v) || g[v] === void 0 || g[v] === null)
|
|
199
|
+
throw new Error(`Missing required ${w} field: '${v}'`);
|
|
200
200
|
});
|
|
201
201
|
const q = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
|
|
202
|
-
if (!q.test(
|
|
203
|
-
throw new Error(`${
|
|
204
|
-
if (!q.test(
|
|
205
|
-
throw new Error(`${
|
|
206
|
-
if (typeof
|
|
207
|
-
throw new Error(`${
|
|
208
|
-
if (typeof
|
|
209
|
-
throw new Error(`${
|
|
202
|
+
if (!q.test(g.startDate))
|
|
203
|
+
throw new Error(`${w}.startDate must be a valid ISO8601 string`);
|
|
204
|
+
if (!q.test(g.endDate))
|
|
205
|
+
throw new Error(`${w}.endDate must be a valid ISO8601 string`);
|
|
206
|
+
if (typeof g.eventType != "string")
|
|
207
|
+
throw new Error(`${w}.eventType must be a string`);
|
|
208
|
+
if (typeof g.productType != "string")
|
|
209
|
+
throw new Error(`${w}.productType must be a string`);
|
|
210
210
|
const E = ["Pass", "Trip", "Registration"];
|
|
211
|
-
if (!E.includes(
|
|
212
|
-
throw new Error(`${
|
|
213
|
-
if (typeof
|
|
214
|
-
throw new Error(`${
|
|
211
|
+
if (!E.includes(g.productType))
|
|
212
|
+
throw new Error(`${w}.productType must be one of ${E.join(", ")}`);
|
|
213
|
+
if (typeof g.productDuration != "string")
|
|
214
|
+
throw new Error(`${w}.productDuration must be a string`);
|
|
215
215
|
const x = ["Daily", "Seasonal", "Trip", "Event"];
|
|
216
|
-
if (!x.includes(
|
|
217
|
-
throw new Error(`${
|
|
218
|
-
if (typeof
|
|
219
|
-
throw new Error(`${
|
|
220
|
-
if (typeof
|
|
221
|
-
throw new Error(`${
|
|
222
|
-
if (typeof
|
|
223
|
-
throw new Error(`${
|
|
216
|
+
if (!x.includes(g.productDuration))
|
|
217
|
+
throw new Error(`${w}.productDuration must be one of ${x.join(", ")}`);
|
|
218
|
+
if (typeof g.productPrice != "number" || isNaN(g.productPrice))
|
|
219
|
+
throw new Error(`${w}.productPrice must be a valid number`);
|
|
220
|
+
if (typeof g.productId != "string")
|
|
221
|
+
throw new Error(`${w}.productId must be a string`);
|
|
222
|
+
if (typeof g.productName != "string")
|
|
223
|
+
throw new Error(`${w}.productName must be a string`);
|
|
224
224
|
});
|
|
225
225
|
} else if (Array.isArray(o)) {
|
|
226
226
|
if (o.length === 0)
|
|
227
227
|
throw new Error("quoteRequestData array cannot be empty");
|
|
228
|
-
o.forEach((c,
|
|
228
|
+
o.forEach((c, l) => {
|
|
229
229
|
if (!c || typeof c != "object")
|
|
230
|
-
throw new Error(`quoteRequestData[${
|
|
231
|
-
f(c,
|
|
230
|
+
throw new Error(`quoteRequestData[${l}] must be a non-null object`);
|
|
231
|
+
f(c, l);
|
|
232
232
|
});
|
|
233
233
|
} else
|
|
234
234
|
f(o);
|
|
@@ -239,8 +239,8 @@ function D(u) {
|
|
|
239
239
|
"onError",
|
|
240
240
|
"noMatchingQuote"
|
|
241
241
|
].forEach((c) => {
|
|
242
|
-
const
|
|
243
|
-
if (
|
|
242
|
+
const l = i[c];
|
|
243
|
+
if (l && typeof l != "function")
|
|
244
244
|
throw new Error(`Callback '${c}' must be a function.`);
|
|
245
245
|
}), typeof r == "string" && !document.querySelector(r))
|
|
246
246
|
throw new Error(`Invalid location selector: '${r}'`);
|
|
@@ -249,41 +249,41 @@ function D(u) {
|
|
|
249
249
|
"Theme must be an object with CSS variables, do not include the '--' prefix"
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
|
-
function
|
|
253
|
-
const
|
|
254
|
-
return o && (
|
|
252
|
+
function p(d, { text: t, className: o, parent: i, innerHTML: r, href: e, target: n } = {}) {
|
|
253
|
+
const s = document.createElement(d);
|
|
254
|
+
return o && (s.className = o), t != null && (s.textContent = t), r != null && (s.innerHTML = r), e && "href" in s && (s.href = e), n && "target" in s && (s.target = n), i && i.appendChild(s), s;
|
|
255
255
|
}
|
|
256
|
-
function N(
|
|
257
|
-
|
|
256
|
+
function N(d, { name: t, description: o }) {
|
|
257
|
+
p("div", {
|
|
258
258
|
className: "spot-header__title",
|
|
259
259
|
text: t,
|
|
260
|
-
parent:
|
|
261
|
-
}),
|
|
260
|
+
parent: d
|
|
261
|
+
}), p("div", {
|
|
262
262
|
className: "spot-header__description",
|
|
263
263
|
text: o,
|
|
264
|
-
parent:
|
|
264
|
+
parent: d
|
|
265
265
|
});
|
|
266
266
|
}
|
|
267
|
-
function
|
|
268
|
-
const o =
|
|
267
|
+
function O(d, t = []) {
|
|
268
|
+
const o = p("ul", {
|
|
269
269
|
className: "spot-benefits__list",
|
|
270
|
-
parent:
|
|
270
|
+
parent: d
|
|
271
271
|
});
|
|
272
272
|
t.forEach((i) => {
|
|
273
|
-
const r =
|
|
273
|
+
const r = p("li", { parent: o });
|
|
274
274
|
r.innerHTML = `
|
|
275
275
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
276
276
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
277
277
|
stroke="#2E2E2E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
278
|
-
</svg>`,
|
|
278
|
+
</svg>`, p("span", { text: i, parent: r });
|
|
279
279
|
});
|
|
280
280
|
}
|
|
281
|
-
function
|
|
281
|
+
function z(d, t = []) {
|
|
282
282
|
if (!t || t.length === 0) return;
|
|
283
|
-
const o =
|
|
283
|
+
const o = p("div", {
|
|
284
284
|
className: "spot-qualifying-reasons__container",
|
|
285
|
-
parent:
|
|
286
|
-
}), i = [...t].sort((
|
|
285
|
+
parent: d
|
|
286
|
+
}), i = [...t].sort((a, u) => a.rank - u.rank), r = p("div", {
|
|
287
287
|
className: "spot-qualifying-reasons__grid",
|
|
288
288
|
parent: o
|
|
289
289
|
}), e = {
|
|
@@ -295,109 +295,109 @@ function O(u, t = []) {
|
|
|
295
295
|
"Severe Weather": "umbrella.svg",
|
|
296
296
|
"Travel Interruption": "plane.svg",
|
|
297
297
|
"Military Duty": "medal.svg"
|
|
298
|
-
},
|
|
299
|
-
i.forEach((
|
|
300
|
-
var
|
|
301
|
-
const
|
|
298
|
+
}, n = new URL(import.meta.url), s = n.origin + n.pathname.replace(/\/src\/[^/]*$/, "/assets/");
|
|
299
|
+
i.forEach((a) => {
|
|
300
|
+
var y, c, l;
|
|
301
|
+
const u = p("div", {
|
|
302
302
|
className: "spot-qualifying-reasons__item",
|
|
303
303
|
parent: r
|
|
304
|
-
}),
|
|
304
|
+
}), h = p("div", {
|
|
305
305
|
className: "spot-qualifying-reasons__icon-wrapper",
|
|
306
|
-
parent:
|
|
307
|
-
}), f = e[((
|
|
306
|
+
parent: u
|
|
307
|
+
}), f = e[((y = a.benefitType) == null ? void 0 : y.name) || ""] || e[a.name || ""];
|
|
308
308
|
if (f) {
|
|
309
|
-
const
|
|
310
|
-
parent:
|
|
309
|
+
const m = p("img", {
|
|
310
|
+
parent: h
|
|
311
311
|
});
|
|
312
|
-
|
|
312
|
+
m.src = s + f, m.alt = ((c = a.benefitType) == null ? void 0 : c.name) || a.name || "", m.className = "spot-qualifying-reasons__icon";
|
|
313
313
|
}
|
|
314
|
-
|
|
314
|
+
p("span", {
|
|
315
315
|
className: "spot-qualifying-reasons__label",
|
|
316
|
-
text: ((
|
|
317
|
-
parent:
|
|
316
|
+
text: ((l = a.benefitType) == null ? void 0 : l.name) || a.name || "",
|
|
317
|
+
parent: u
|
|
318
318
|
});
|
|
319
319
|
});
|
|
320
320
|
}
|
|
321
|
-
function L(
|
|
321
|
+
function L(d, t = []) {
|
|
322
322
|
if (t.length === 0) return;
|
|
323
|
-
const o =
|
|
323
|
+
const o = p("div", {
|
|
324
324
|
className: "spot-covered-items__container",
|
|
325
|
-
parent:
|
|
325
|
+
parent: d
|
|
326
326
|
});
|
|
327
|
-
|
|
327
|
+
p("div", {
|
|
328
328
|
className: "spot-covered-items__title",
|
|
329
329
|
text: "Items covered in your cart:",
|
|
330
330
|
parent: o
|
|
331
331
|
});
|
|
332
|
-
const i =
|
|
332
|
+
const i = p("ul", {
|
|
333
333
|
className: "spot-covered-items__list",
|
|
334
334
|
parent: o
|
|
335
335
|
});
|
|
336
336
|
t.forEach((r) => {
|
|
337
|
-
const e =
|
|
338
|
-
|
|
337
|
+
const e = p("li", { parent: i });
|
|
338
|
+
p("span", { text: r, parent: e });
|
|
339
339
|
});
|
|
340
340
|
}
|
|
341
|
-
function P(
|
|
342
|
-
const o =
|
|
341
|
+
function P(d, t = []) {
|
|
342
|
+
const o = p("div", {
|
|
343
343
|
className: "spot-table__container",
|
|
344
|
-
parent:
|
|
345
|
-
}), i =
|
|
344
|
+
parent: d
|
|
345
|
+
}), i = p("table", {
|
|
346
346
|
className: "spot-refund__table spot-table--dynamic",
|
|
347
347
|
parent: o
|
|
348
|
-
}), r =
|
|
349
|
-
|
|
350
|
-
const
|
|
351
|
-
t.forEach(({ text:
|
|
352
|
-
const
|
|
353
|
-
|
|
354
|
-
const f =
|
|
355
|
-
|
|
348
|
+
}), r = p("thead", { parent: i }), e = p("tr", { parent: r });
|
|
349
|
+
p("th", { text: "When you cancel", parent: e }), p("th", { text: "You will receive", parent: e });
|
|
350
|
+
const n = p("tbody", { parent: i });
|
|
351
|
+
t.forEach(({ text: s, percent: a, amount: u }) => {
|
|
352
|
+
const h = p("tr", { parent: n });
|
|
353
|
+
p("td", { text: s, parent: h });
|
|
354
|
+
const f = a === "Not eligible for refund" ? "Not eligible for a refund" : `$${u} refund`;
|
|
355
|
+
p("td", { text: f, parent: h });
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
|
-
function V(
|
|
359
|
-
const i =
|
|
358
|
+
function V(d, t, o) {
|
|
359
|
+
const i = p("div", {
|
|
360
360
|
className: "spot-selection__options",
|
|
361
|
-
parent:
|
|
362
|
-
}), r =
|
|
361
|
+
parent: d
|
|
362
|
+
}), r = p("label", {
|
|
363
363
|
className: `spot-selection__option ${t ? "selected" : ""}`,
|
|
364
364
|
parent: i
|
|
365
|
-
}), e =
|
|
366
|
-
e.type = "radio", e.name = "selection", e.value = "yes", t && (e.checked = !0),
|
|
365
|
+
}), e = p("input", { parent: r });
|
|
366
|
+
e.type = "radio", e.name = "selection", e.value = "yes", t && (e.checked = !0), p("strong", {
|
|
367
367
|
text: o.yesOptionText,
|
|
368
368
|
parent: r
|
|
369
|
-
}),
|
|
369
|
+
}), p("span", {
|
|
370
370
|
className: "spot-selection__recommended-tag",
|
|
371
371
|
text: "Recommended",
|
|
372
372
|
parent: r
|
|
373
373
|
});
|
|
374
|
-
const
|
|
374
|
+
const n = p("label", {
|
|
375
375
|
className: "spot-selection__option",
|
|
376
376
|
parent: i
|
|
377
|
-
}),
|
|
378
|
-
return
|
|
377
|
+
}), s = p("input", { parent: n });
|
|
378
|
+
return s.type = "radio", s.name = "selection", s.value = "no", p("span", { text: o.noOptionText, parent: n }), i;
|
|
379
379
|
}
|
|
380
|
-
function R(
|
|
380
|
+
function R(d, t) {
|
|
381
381
|
var r;
|
|
382
|
-
const o = (r = t.communication) == null ? void 0 : r.paymentTerms, i =
|
|
382
|
+
const o = (r = t.communication) == null ? void 0 : r.paymentTerms, i = p("div", {
|
|
383
383
|
className: "spot-payment-terms",
|
|
384
|
-
parent:
|
|
384
|
+
parent: d
|
|
385
385
|
});
|
|
386
|
-
return
|
|
386
|
+
return p("div", {
|
|
387
387
|
className: "spot-payment-terms__header",
|
|
388
388
|
text: "PAYMENT TERMS",
|
|
389
389
|
parent: i
|
|
390
|
-
}),
|
|
390
|
+
}), p("div", {
|
|
391
391
|
className: "spot-payment-terms__body",
|
|
392
392
|
text: o || "",
|
|
393
393
|
parent: i
|
|
394
394
|
}), i;
|
|
395
395
|
}
|
|
396
|
-
function $(
|
|
396
|
+
function $(d, t, o = "bottom-right") {
|
|
397
397
|
if (o === "top-right") {
|
|
398
|
-
const e =
|
|
398
|
+
const e = p("div", {
|
|
399
399
|
className: "spot-logo__top-right",
|
|
400
|
-
parent:
|
|
400
|
+
parent: d
|
|
401
401
|
});
|
|
402
402
|
e.innerHTML = `
|
|
403
403
|
<svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -416,24 +416,24 @@ function $(u, t, o = "bottom-right") {
|
|
|
416
416
|
</defs>
|
|
417
417
|
</svg>`;
|
|
418
418
|
}
|
|
419
|
-
const i =
|
|
419
|
+
const i = p("div", {
|
|
420
420
|
className: "spot-footer__container",
|
|
421
|
-
parent:
|
|
422
|
-
}), r =
|
|
421
|
+
parent: d
|
|
422
|
+
}), r = p("div", {
|
|
423
423
|
className: "spot-footer__terms",
|
|
424
424
|
parent: i
|
|
425
425
|
});
|
|
426
|
-
if (
|
|
426
|
+
if (p("span", {
|
|
427
427
|
innerHTML: t.communication.legalDisclaimer,
|
|
428
428
|
parent: r
|
|
429
|
-
}),
|
|
429
|
+
}), p("br", { parent: r }), p("a", {
|
|
430
430
|
href: t.communication.termsAndConditionsUrl,
|
|
431
431
|
target: "_blank",
|
|
432
432
|
className: "spot-footer__terms-link",
|
|
433
433
|
text: "Refund Guarantee Terms and Conditions",
|
|
434
434
|
parent: r
|
|
435
435
|
}), o === "bottom-right") {
|
|
436
|
-
const e =
|
|
436
|
+
const e = p("p", {
|
|
437
437
|
className: "spot-footer__powered-by",
|
|
438
438
|
parent: i
|
|
439
439
|
});
|
|
@@ -456,12 +456,12 @@ function $(u, t, o = "bottom-right") {
|
|
|
456
456
|
}
|
|
457
457
|
return i;
|
|
458
458
|
}
|
|
459
|
-
const S = ":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:51rem;margin:1rem;container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__options{min-width:0;word-wrap:normal}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container{grid-row:1;margin-bottom:var(--spot-benefits-margin-bottom)}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1;margin-bottom:var(--spot-covered-items-margin-bottom)}.desktop-layout .spot-selection__options{grid-row:3;margin-top:var(--spot-desktop-radio-margin-top)}.desktop-layout .spot-payment-terms__wrapper{grid-row:4;grid-column:1;margin-top:var(--spot-payment-terms-margin-top)}.desktop-layout .spot-table__container{grid-row:1 / span 4;grid-column:2;width:auto;min-width:20.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-table__container{display:flex;justify-content:flex-start;margin-top:1rem;margin-bottom:1rem;padding-left:.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-refund__table{width:100%;max-width:22rem;table-layout:auto}@media (max-width: 850px){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 500px){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 600px){.spot-refund__table th{padding:0rem}}.spot-benefits__list{list-style-type:none;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-benefits__list li{margin-bottom:.375rem;display:flex;align-items:flex-start;gap:.5rem}.spot-benefits__list li svg{flex-shrink:0;position:relative;top:.125rem}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:0;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;min-width:.75rem;border:.0625rem solid var(--spot-radio-border);border-radius:var(--spot-radio-border-radius);margin-right:.5rem;position:relative;vertical-align:middle;top:-.0625rem;cursor:pointer;flex-shrink:0}input[type=radio]:checked{background:var(--spot-radio-checked-background);box-shadow:inset 0 0 0 .0625rem #fff}.spot-selection__options{display:flex;flex-direction:column;gap:.5rem}.spot-selection__option{display:flex;align-items:center;flex-wrap:nowrap;position:relative;transition:background .2s;cursor:pointer;font-size:var(--spot-radio-text-font-size);font-weight:var(--spot-radio-text-font-weight);color:var(--spot-radio-text-font-color);font-family:var(--spot-radio-text-font-family);padding:var(--spot-radio-text-padding);margin-right:.5rem}.spot-selection__option.selected{background:var(--spot-radio-selection-background);border-radius:var(--spot-radio-selection-border-radius);padding:var(--spot-radio-selection-padding)}.spot-selection__recommended-tag{background:var(--spot-recommended-tag-background);color:var(--spot-recommended-tag-font-color);font-size:var(--spot-recommended-tag-font-size);font-weight:var(--spot-recommended-tag-font-weight);padding:var(--spot-recommended-tag-padding);border-radius:var(--spot-recommended-tag-border-radius);margin-left:.75rem;white-space:nowrap;flex-shrink:0}@media (max-width: 850px){.spot-selection__recommended-tag{margin-left:.5rem}}@media (max-width: 600px){.spot-selection__recommended-tag{margin-left:.5rem;font-size:.75rem;padding:.1875rem .4375rem}}.spot-selection__error{color:var(--spot-selection-error-font-color);font-size:var(--spot-selection-error-font-size);padding:var(--spot-selection-error-padding);display:none}.spot-payment-terms__wrapper{margin-top:1rem}.spot-payment-terms__header{font-weight:var(--spot-payment-terms-header-font-weight);margin-bottom:.5rem;padding:var(--spot-payment-terms-header-padding);font-size:var(--spot-payment-terms-header-font-size);border-bottom:1px solid var(--spot-payment-terms-header-border-color)}.spot-payment-terms{background-color:var(--spot-payment-terms-background);border-radius:var(--spot-payment-terms-border-radius);padding:var(--spot-payment-terms-padding);margin-right:.5rem;color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);line-height:1.4;word-wrap:normal;-webkit-hyphens:none;hyphens:none;flex:1;min-width:0;overflow-wrap:normal}.spot-footer__terms-link{text-decoration:var(--spot-terms-link-text-decoration);font-size:var(--spot-terms-link-font-size);font-weight:var(--spot-terms-link-font-weight);color:var(--spot-terms-link-font-color);font-family:var(--spot-terms-link-font-family);padding:var(--spot-terms-link-padding)}.spot-footer__container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;flex-wrap:nowrap;gap:var(--spot-footer-gap)}@container (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}@media (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}.spot-footer__powered-by{margin-top:0;flex-shrink:0}.spot-logo__top-right{position:absolute;top:-14px;right:40px;z-index:10;background:#fff;padding:0 8px}@container (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}@media (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}";
|
|
460
|
-
function
|
|
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(d) {
|
|
461
461
|
const t = document.createElement("style");
|
|
462
|
-
t.textContent =
|
|
462
|
+
t.textContent = d, document.head.appendChild(t);
|
|
463
463
|
}
|
|
464
|
-
Q
|
|
464
|
+
S(Q);
|
|
465
465
|
const T = {
|
|
466
466
|
sandbox: "https://api.sandbox.getspot.com/api/v1/quote",
|
|
467
467
|
production: "https://api.getspot.com/api/v1/quote",
|
|
@@ -477,55 +477,71 @@ class Z {
|
|
|
477
477
|
apiConfig: { environment: "production", partnerId: "" },
|
|
478
478
|
quoteRequestData: {},
|
|
479
479
|
callbacks: {},
|
|
480
|
+
useMockData: !1,
|
|
480
481
|
...t
|
|
481
482
|
}, 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();
|
|
482
483
|
}
|
|
483
484
|
async _init() {
|
|
484
485
|
var t, o, i, r, e;
|
|
485
486
|
try {
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
n
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
487
|
+
I(this.options);
|
|
488
|
+
let n;
|
|
489
|
+
if (this.options.useMockData && this.options.mockData)
|
|
490
|
+
n = this.options.mockData;
|
|
491
|
+
else {
|
|
492
|
+
const { environment: s, partnerId: a } = this.options.apiConfig, h = this.options.apiConfig.customEndpoint || T[s];
|
|
493
|
+
n = "cartInfo" in this.options.quoteRequestData && "items" in this.options.quoteRequestData ? await D(
|
|
494
|
+
h,
|
|
495
|
+
a,
|
|
496
|
+
this.options.quoteRequestData
|
|
497
|
+
) : await k(
|
|
498
|
+
h,
|
|
499
|
+
a,
|
|
500
|
+
this.options.quoteRequestData
|
|
501
|
+
);
|
|
502
|
+
}
|
|
503
|
+
if (n.status !== "QUOTE_AVAILABLE") {
|
|
504
|
+
n.status === "NO_MATCHING_QUOTE" && ((t = this.options.callbacks) != null && t.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
494
505
|
status: "NO_MATCHING_QUOTE",
|
|
495
506
|
data: this.options.quoteRequestData
|
|
496
507
|
});
|
|
497
508
|
return;
|
|
498
509
|
}
|
|
499
|
-
if (this.quote =
|
|
500
|
-
|
|
510
|
+
if (this.quote = n.data, !this.quote)
|
|
511
|
+
throw new Error("No quote data in response");
|
|
512
|
+
if (this._renderWidget(), this.options.optInSelected && ((o = this.options.callbacks) != null && o.onOptIn)) {
|
|
513
|
+
const s = {
|
|
501
514
|
status: "QUOTE_ACCEPTED",
|
|
502
515
|
spotPrice: this.quote.spotPrice,
|
|
503
516
|
quoteId: this.quote.id
|
|
504
517
|
};
|
|
505
518
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
var
|
|
509
|
-
const
|
|
510
|
-
(
|
|
519
|
+
const a = this.options.quoteRequestData;
|
|
520
|
+
s.batchQuoteDetails = this.quote.originalQuotes.map((u) => {
|
|
521
|
+
var f;
|
|
522
|
+
const h = (f = a.items) == null ? void 0 : f.find(
|
|
523
|
+
(y) => (y.cartItemId || `item-${a.items.indexOf(y) + 1}`) === u.id
|
|
511
524
|
);
|
|
512
525
|
return {
|
|
513
|
-
quoteId:
|
|
514
|
-
productPrice: (
|
|
515
|
-
cartItemId:
|
|
526
|
+
quoteId: u.id,
|
|
527
|
+
productPrice: (h == null ? void 0 : h.productPrice) || u.spotPrice,
|
|
528
|
+
cartItemId: u.id
|
|
516
529
|
};
|
|
517
530
|
});
|
|
518
531
|
}
|
|
519
|
-
this.options.callbacks.onOptIn(
|
|
532
|
+
this.options.callbacks.onOptIn(s);
|
|
520
533
|
}
|
|
521
|
-
(i = this.options.callbacks) != null && i.onQuoteRetrieved
|
|
522
|
-
|
|
534
|
+
if ((i = this.options.callbacks) != null && i.onQuoteRetrieved) {
|
|
535
|
+
const s = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
536
|
+
s && this._applyQuoteUpdates(s);
|
|
537
|
+
}
|
|
538
|
+
} catch (n) {
|
|
523
539
|
if ((r = this.options.callbacks) != null && r.onError) {
|
|
524
|
-
const
|
|
540
|
+
const s = n;
|
|
525
541
|
(e = this.options.callbacks) == null || e.onError({
|
|
526
|
-
message:
|
|
527
|
-
status:
|
|
528
|
-
responseBody:
|
|
542
|
+
message: s.message,
|
|
543
|
+
status: s.status,
|
|
544
|
+
responseBody: s.responseBody
|
|
529
545
|
});
|
|
530
546
|
}
|
|
531
547
|
}
|
|
@@ -537,13 +553,13 @@ class Z {
|
|
|
537
553
|
this.container.style.setProperty(e, r);
|
|
538
554
|
}), N(this.container, this.quote.communication);
|
|
539
555
|
const t = document.createElement("div");
|
|
540
|
-
t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ?
|
|
556
|
+
t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ? z(t, this.quote.qualifyingReasons) : O(t, this.quote.communication.bulletPoints), this.quote.coveredItems && L(t, this.quote.coveredItems), this.options.showTable && !this.quote.qualifyingReasons && P(t, this.quote.payoutSchedule);
|
|
541
557
|
const o = V(
|
|
542
558
|
t,
|
|
543
559
|
this.options.optInSelected,
|
|
544
560
|
this.quote.communication
|
|
545
561
|
);
|
|
546
|
-
t.appendChild(o), this.paymentTermsEl =
|
|
562
|
+
t.appendChild(o), this.paymentTermsEl = p("div", {
|
|
547
563
|
className: "spot-payment-terms__wrapper",
|
|
548
564
|
parent: t
|
|
549
565
|
}), $(this.container, this.quote, this.options.logoPosition), window.addEventListener("resize", this._onResize), this._setupResizeObserver(), this._updateLayout(), this._setupOptionListeners(o);
|
|
@@ -567,13 +583,13 @@ class Z {
|
|
|
567
583
|
if (o >= 650) {
|
|
568
584
|
const e = t.classList.contains("desktop-layout");
|
|
569
585
|
t.classList.remove("desktop-layout"), t.offsetHeight;
|
|
570
|
-
const
|
|
586
|
+
const n = t.querySelector(
|
|
571
587
|
".spot-benefits__list, .spot-qualifying-reasons__container"
|
|
572
588
|
);
|
|
573
|
-
if (!
|
|
589
|
+
if (!n)
|
|
574
590
|
return e && t.classList.add("desktop-layout"), e;
|
|
575
|
-
const
|
|
576
|
-
return e && t.classList.add("desktop-layout"), o >=
|
|
591
|
+
const a = Math.min(n.scrollWidth, 400) + i + r;
|
|
592
|
+
return e && t.classList.add("desktop-layout"), o >= a;
|
|
577
593
|
}
|
|
578
594
|
return !1;
|
|
579
595
|
}
|
|
@@ -584,31 +600,34 @@ class Z {
|
|
|
584
600
|
}, 100);
|
|
585
601
|
}), this._resizeObserver.observe(this.container));
|
|
586
602
|
}
|
|
603
|
+
_applyQuoteUpdates(t) {
|
|
604
|
+
!this.quote || !this.container || (t.spotPrice !== void 0 && (this.quote.spotPrice = t.spotPrice), t.yesOptionText !== void 0 && (this.quote.communication.yesOptionText = t.yesOptionText), this.destroy(), this._renderWidget());
|
|
605
|
+
}
|
|
587
606
|
_setupOptionListeners(t) {
|
|
588
607
|
const o = t.querySelectorAll(
|
|
589
608
|
'input[type="radio"]'
|
|
590
609
|
), i = t.querySelectorAll(".spot-selection__option");
|
|
591
610
|
o.forEach((r) => {
|
|
592
611
|
r.addEventListener("change", (e) => {
|
|
593
|
-
var
|
|
594
|
-
const
|
|
595
|
-
if (this.hideSelectionError(), this.currentSelection =
|
|
612
|
+
var a, u, h;
|
|
613
|
+
const n = e.target, s = n.value;
|
|
614
|
+
if (this.hideSelectionError(), this.currentSelection = s, i.forEach((f) => f.classList.remove("selected")), (a = n.closest(".spot-selection__option")) == null || a.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), s === "yes" && (this.options.quoteRequestData.isPartialPayment && R(this.paymentTermsEl, this.quote), (u = this.options.callbacks) != null && u.onOptIn)) {
|
|
596
615
|
const f = {
|
|
597
616
|
status: "QUOTE_ACCEPTED",
|
|
598
617
|
spotPrice: this.quote.spotPrice,
|
|
599
618
|
quoteId: this.quote.id
|
|
600
619
|
};
|
|
601
620
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
602
|
-
const
|
|
621
|
+
const y = this.options.quoteRequestData;
|
|
603
622
|
f.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
604
623
|
(c) => {
|
|
605
|
-
var
|
|
606
|
-
const
|
|
607
|
-
(
|
|
624
|
+
var m;
|
|
625
|
+
const l = (m = y.items) == null ? void 0 : m.find(
|
|
626
|
+
(b) => (b.cartItemId || `item-${y.items.indexOf(b) + 1}`) === c.id
|
|
608
627
|
);
|
|
609
628
|
return {
|
|
610
629
|
quoteId: c.id,
|
|
611
|
-
productPrice: (
|
|
630
|
+
productPrice: (l == null ? void 0 : l.productPrice) || c.spotPrice,
|
|
612
631
|
cartItemId: c.id
|
|
613
632
|
};
|
|
614
633
|
}
|
|
@@ -616,22 +635,22 @@ class Z {
|
|
|
616
635
|
}
|
|
617
636
|
this.options.callbacks.onOptIn(f);
|
|
618
637
|
}
|
|
619
|
-
if (
|
|
638
|
+
if (s === "no" && ((h = this.options.callbacks) != null && h.onOptOut)) {
|
|
620
639
|
const f = {
|
|
621
640
|
status: "QUOTE_DECLINED",
|
|
622
641
|
quoteId: this.quote.id
|
|
623
642
|
};
|
|
624
643
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
625
|
-
const
|
|
644
|
+
const y = this.options.quoteRequestData;
|
|
626
645
|
f.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
627
646
|
(c) => {
|
|
628
|
-
var
|
|
629
|
-
const
|
|
630
|
-
(
|
|
647
|
+
var m;
|
|
648
|
+
const l = (m = y.items) == null ? void 0 : m.find(
|
|
649
|
+
(b) => (b.cartItemId || `item-${y.items.indexOf(b) + 1}`) === c.id
|
|
631
650
|
);
|
|
632
651
|
return {
|
|
633
652
|
quoteId: c.id,
|
|
634
|
-
productPrice: (
|
|
653
|
+
productPrice: (l == null ? void 0 : l.productPrice) || c.spotPrice,
|
|
635
654
|
cartItemId: c.id
|
|
636
655
|
};
|
|
637
656
|
}
|
|
@@ -666,30 +685,36 @@ class Z {
|
|
|
666
685
|
async updateQuote(t) {
|
|
667
686
|
var o, i, r, e;
|
|
668
687
|
try {
|
|
669
|
-
const
|
|
688
|
+
const n = {
|
|
670
689
|
...this.options,
|
|
671
690
|
quoteRequestData: t
|
|
672
691
|
};
|
|
673
|
-
|
|
674
|
-
const { environment:
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
692
|
+
I(n);
|
|
693
|
+
const { environment: s, partnerId: a, customEndpoint: u } = this.options.apiConfig, h = u || T[s], y = "cartInfo" in n.quoteRequestData && "items" in n.quoteRequestData ? await D(
|
|
694
|
+
h,
|
|
695
|
+
a,
|
|
696
|
+
n.quoteRequestData
|
|
678
697
|
) : await k(
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
698
|
+
h,
|
|
699
|
+
a,
|
|
700
|
+
n.quoteRequestData
|
|
682
701
|
);
|
|
683
|
-
|
|
684
|
-
status
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
702
|
+
if (y.status !== "QUOTE_AVAILABLE")
|
|
703
|
+
return y.status === "NO_MATCHING_QUOTE" && ((o = this.options.callbacks) != null && o.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
704
|
+
status: "NO_MATCHING_QUOTE",
|
|
705
|
+
data: n.quoteRequestData
|
|
706
|
+
}), !1;
|
|
707
|
+
if (this.options.quoteRequestData = n.quoteRequestData, this.quote = y.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (i = this.options.callbacks) != null && i.onQuoteRetrieved) {
|
|
708
|
+
const c = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
709
|
+
c && this._applyQuoteUpdates(c);
|
|
710
|
+
}
|
|
711
|
+
return !0;
|
|
712
|
+
} catch (n) {
|
|
713
|
+
const s = n;
|
|
689
714
|
return (e = (r = this.options.callbacks) == null ? void 0 : r.onError) == null || e.call(r, {
|
|
690
|
-
message:
|
|
691
|
-
status:
|
|
692
|
-
responseBody:
|
|
715
|
+
message: s.message,
|
|
716
|
+
status: s.status,
|
|
717
|
+
responseBody: s.responseBody
|
|
693
718
|
}), !1;
|
|
694
719
|
}
|
|
695
720
|
}
|
|
@@ -704,15 +729,15 @@ class Z {
|
|
|
704
729
|
};
|
|
705
730
|
if ((r = this.quote) != null && r.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
706
731
|
const e = this.options.quoteRequestData;
|
|
707
|
-
t.batchQuoteDetails = this.quote.originalQuotes.map((
|
|
708
|
-
var
|
|
709
|
-
const
|
|
710
|
-
(
|
|
732
|
+
t.batchQuoteDetails = this.quote.originalQuotes.map((n) => {
|
|
733
|
+
var a;
|
|
734
|
+
const s = (a = e.items) == null ? void 0 : a.find(
|
|
735
|
+
(u) => (u.cartItemId || `item-${e.items.indexOf(u) + 1}`) === n.id
|
|
711
736
|
);
|
|
712
737
|
return {
|
|
713
|
-
quoteId:
|
|
714
|
-
productPrice: (
|
|
715
|
-
cartItemId:
|
|
738
|
+
quoteId: n.id,
|
|
739
|
+
productPrice: (s == null ? void 0 : s.productPrice) || n.spotPrice,
|
|
740
|
+
cartItemId: n.id
|
|
716
741
|
};
|
|
717
742
|
});
|
|
718
743
|
}
|