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