@getspot/spot-widget 1.2.0 → 1.4.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/dist/index.es.js CHANGED
@@ -1,49 +1,49 @@
1
- async function I(p, e, o) {
1
+ async function I(c, t, e) {
2
2
  try {
3
- const n = await fetch(p, {
3
+ const n = await fetch(c, {
4
4
  method: "POST",
5
5
  headers: {
6
6
  "Content-Type": "application/json",
7
- "X-Spot-Partner-Id": e
7
+ "X-Spot-Partner-Id": t
8
8
  },
9
- body: JSON.stringify(o)
10
- }), t = await n.json();
9
+ body: JSON.stringify(e)
10
+ }), o = await n.json();
11
11
  if (!n.ok) {
12
- const r = new Error((t == null ? void 0 : t.message) || "Failed to fetch quote");
13
- throw r.status = n.status, r.responseBody = t, r;
12
+ const r = new Error((o == null ? void 0 : o.message) || "Failed to fetch quote");
13
+ throw r.status = n.status, r.responseBody = o, r;
14
14
  }
15
- return t;
15
+ return o;
16
16
  } catch (n) {
17
17
  throw n instanceof Error ? n : new Error("Unknown error occurred while fetching quote");
18
18
  }
19
19
  }
20
- async function x(p, e, o) {
20
+ async function T(c, t, e) {
21
21
  try {
22
- const n = p.replace("/quote", "/quote/batch"), t = await fetch(n, {
22
+ const n = c.replace("/quote", "/quote/batch"), o = await fetch(n, {
23
23
  method: "POST",
24
24
  headers: {
25
25
  "Content-Type": "application/json",
26
- "X-Spot-Partner-Id": e
26
+ "X-Spot-Partner-Id": t
27
27
  },
28
- body: JSON.stringify(o)
29
- }), r = await t.json();
30
- if (!t.ok) {
31
- const c = new Error((r == null ? void 0 : r.message) || "Failed to fetch batch quote");
32
- throw c.status = t.status, c.responseBody = r, c;
28
+ body: JSON.stringify(e)
29
+ }), r = await o.json();
30
+ if (!o.ok) {
31
+ const p = new Error((r == null ? void 0 : r.message) || "Failed to fetch batch quote");
32
+ throw p.status = o.status, p.responseBody = r, p;
33
33
  }
34
34
  return r;
35
35
  } catch (n) {
36
36
  throw n instanceof Error ? n : new Error("Unknown error occurred while fetching batch quote");
37
37
  }
38
38
  }
39
- async function k(p, e, o) {
39
+ async function D(c, t, e) {
40
40
  try {
41
41
  const n = {
42
- cartId: o.cartInfo.cartId,
43
- cartName: o.cartInfo.cartName,
44
- currencyCode: o.cartInfo.currencyCode,
45
- items: o.items.map((a, u) => ({
46
- cartItemId: a.cartItemId || `item-${u + 1}`,
42
+ cartId: e.cartInfo.cartId,
43
+ cartName: e.cartInfo.cartName,
44
+ currencyCode: e.cartInfo.currencyCode,
45
+ items: e.items.map((a, d) => ({
46
+ cartItemId: a.cartItemId || `item-${d + 1}`,
47
47
  productPrice: a.productPrice,
48
48
  productType: a.productType,
49
49
  productDuration: a.productDuration,
@@ -54,33 +54,33 @@ async function k(p, e, o) {
54
54
  startDate: a.startDate,
55
55
  endDate: a.endDate
56
56
  }))
57
- }, t = await x(p, e, n);
58
- if (t.status !== "QUOTES_AVAILABLE" && t.status !== "QUOTE_AVAILABLE")
57
+ }, o = await T(c, t, n);
58
+ if (o.status !== "QUOTES_AVAILABLE" && o.status !== "QUOTE_AVAILABLE")
59
59
  return { status: "NO_MATCHING_QUOTE" };
60
- const r = t.quotes.map((a) => {
61
- const u = o.items.find(
62
- (h) => (h.cartItemId || `item-${o.items.indexOf(h) + 1}`) === a.cartItemId
60
+ const r = o.quotes.map((a) => {
61
+ const d = e.items.find(
62
+ (h) => (h.cartItemId || `item-${e.items.indexOf(h) + 1}`) === a.cartItemId
63
63
  );
64
- return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${a.cartItemId}`;
65
- }), c = Math.round((t.totalSpotPrice || t.spotPrice || 0) * 100) / 100;
64
+ return d ? d.participantDescription ? `${d.productName} - ${d.participantDescription}` : d.productName : `Item ${a.cartItemId}`;
65
+ }), p = Math.round((o.totalSpotPrice || o.spotPrice || 0) * 100) / 100;
66
66
  return {
67
67
  status: "QUOTE_AVAILABLE",
68
68
  data: {
69
- id: t.quotes ? t.quotes.map((a) => a.id).join(",") : t.id,
70
- spotPrice: c,
71
- currencyCode: t.currencyCode,
69
+ id: o.quotes ? o.quotes.map((a) => a.id).join(",") : o.id,
70
+ spotPrice: p,
71
+ currencyCode: o.currencyCode,
72
72
  communication: {
73
- ...t.communication,
74
- yesOptionText: t.communication.yesOptionText.replace(t.totalSpotPrice, c)
73
+ ...o.communication,
74
+ yesOptionText: o.communication.yesOptionText.replace(o.totalSpotPrice, p)
75
75
  },
76
- payoutSchedule: t.payoutSchedule.map((a) => ({
76
+ payoutSchedule: o.payoutSchedule.map((a) => ({
77
77
  ...a,
78
78
  amount: a.amount !== void 0 ? a.amount : 0
79
79
  })),
80
80
  coveredItems: r,
81
- originalQuotes: t.quotes || [t]
81
+ originalQuotes: o.quotes || [o]
82
82
  },
83
- spotPrice: c,
83
+ spotPrice: p,
84
84
  coveredItems: r
85
85
  };
86
86
  } catch (n) {
@@ -92,25 +92,25 @@ const N = {
92
92
  production: "https://api.getspot.com/v1/quote",
93
93
  local: "http://localhost:3999/api/v1/quote"
94
94
  };
95
- function D(p) {
95
+ function k(c) {
96
96
  const {
97
- apiConfig: e = {},
98
- quoteRequestData: o,
97
+ apiConfig: t = {},
98
+ quoteRequestData: e,
99
99
  callbacks: n = {},
100
- location: t,
100
+ location: o,
101
101
  theme: r
102
- } = p, {
103
- environment: c = "sandbox",
102
+ } = c, {
103
+ environment: p = "sandbox",
104
104
  partnerId: a,
105
- endpoint: u
106
- } = e;
105
+ endpoint: d
106
+ } = t;
107
107
  if (!a || typeof a != "string")
108
108
  throw new Error("Invalid or missing partnerId in apiConfig");
109
- if (!(u || N[c]))
110
- throw new Error(`Invalid environment in apiConfig: ${c}`);
111
- if (!o || typeof o != "object" && !Array.isArray(o))
109
+ if (!(d || N[p]))
110
+ throw new Error(`Invalid environment in apiConfig: ${p}`);
111
+ if (!e || typeof e != "object" && !Array.isArray(e))
112
112
  throw new Error("quoteRequestData must be a non-null object or array");
113
- const m = [
113
+ const g = [
114
114
  "startDate",
115
115
  "endDate",
116
116
  "currencyCode",
@@ -122,48 +122,48 @@ function D(p) {
122
122
  "cartId",
123
123
  "productName"
124
124
  ];
125
- function d(s, y = null) {
126
- const f = y !== null ? `quoteRequestData[${y}]` : "quoteRequestData";
127
- m.forEach((b) => {
128
- if (!Object.prototype.hasOwnProperty.call(s, b) || s[b] === void 0 || s[b] === null)
129
- throw new Error(`Missing required ${f} field: '${b}'`);
125
+ function l(s, u = null) {
126
+ const m = u !== null ? `quoteRequestData[${u}]` : "quoteRequestData";
127
+ g.forEach((v) => {
128
+ if (!Object.prototype.hasOwnProperty.call(s, v) || s[v] === void 0 || s[v] === null)
129
+ throw new Error(`Missing required ${m} field: '${v}'`);
130
130
  });
131
- const v = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
132
- if (!v.test(s.startDate))
133
- throw new Error(`${f}.startDate must be a valid ISO8601 string`);
134
- if (!v.test(s.endDate))
135
- throw new Error(`${f}.endDate must be a valid ISO8601 string`);
131
+ const w = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
132
+ if (!w.test(s.startDate))
133
+ throw new Error(`${m}.startDate must be a valid ISO8601 string`);
134
+ if (!w.test(s.endDate))
135
+ throw new Error(`${m}.endDate must be a valid ISO8601 string`);
136
136
  if (typeof s.currencyCode != "string")
137
- throw new Error(`${f}.currencyCode must be a string`);
137
+ throw new Error(`${m}.currencyCode must be a string`);
138
138
  if (!["USD", "CAD", "AUD"].includes(s.currencyCode))
139
- throw new Error(`Invalid ${f}.currencyCode: ${s.currencyCode}`);
139
+ throw new Error(`Invalid ${m}.currencyCode: ${s.currencyCode}`);
140
140
  if (typeof s.eventType != "string")
141
- throw new Error(`${f}.eventType must be a string`);
141
+ throw new Error(`${m}.eventType must be a string`);
142
142
  if (typeof s.productType != "string")
143
- throw new Error(`${f}.productType must be a string`);
144
- const w = ["Pass", "Trip", "Registration"];
145
- if (!w.includes(s.productType))
143
+ throw new Error(`${m}.productType must be a string`);
144
+ const _ = ["Pass", "Trip", "Registration"];
145
+ if (!_.includes(s.productType))
146
146
  throw new Error(
147
- `${f}.productType must be one of ${w.join(", ")}`
147
+ `${m}.productType must be one of ${_.join(", ")}`
148
148
  );
149
149
  if (typeof s.productDuration != "string")
150
- throw new Error(`${f}.productDuration must be a string`);
151
- const g = ["Daily", "Seasonal", "Trip", "Event"];
152
- if (!g.includes(s.productDuration))
150
+ throw new Error(`${m}.productDuration must be a string`);
151
+ const b = ["Daily", "Seasonal", "Trip", "Event"];
152
+ if (!b.includes(s.productDuration))
153
153
  throw new Error(
154
- `${f}.productDuration must be one of ${g.join(", ")}`
154
+ `${m}.productDuration must be one of ${b.join(", ")}`
155
155
  );
156
156
  if (typeof s.productPrice != "number" || isNaN(s.productPrice))
157
- throw new Error(`${f}.productPrice must be a valid number`);
157
+ throw new Error(`${m}.productPrice must be a valid number`);
158
158
  if (typeof s.productId != "string")
159
- throw new Error(`${f}.productId must be a string`);
159
+ throw new Error(`${m}.productId must be a string`);
160
160
  if (typeof s.cartId != "string")
161
- throw new Error(`${f}.cartId must be a string`);
161
+ throw new Error(`${m}.cartId must be a string`);
162
162
  if (typeof s.productName != "string")
163
- throw new Error(`${f}.productName must be a string`);
163
+ throw new Error(`${m}.productName must be a string`);
164
164
  }
165
- if (o.cartInfo && o.items) {
166
- const { cartInfo: s, items: y } = o;
165
+ if (e.cartInfo && e.items) {
166
+ const { cartInfo: s, items: u } = e;
167
167
  if (!s || typeof s != "object")
168
168
  throw new Error("quoteRequestData.cartInfo must be a non-null object");
169
169
  if (!s.cartId || typeof s.cartId != "string")
@@ -174,51 +174,51 @@ function D(p) {
174
174
  throw new Error("quoteRequestData.cartInfo.currencyCode must be a string");
175
175
  if (!["USD", "CAD", "AUD"].includes(s.currencyCode))
176
176
  throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${s.currencyCode}`);
177
- if (!Array.isArray(y) || y.length === 0)
177
+ if (!Array.isArray(u) || u.length === 0)
178
178
  throw new Error("quoteRequestData.items must be a non-empty array");
179
- const v = m.filter((l) => l !== "cartId" && l !== "currencyCode");
180
- y.forEach((l, w) => {
181
- if (!l || typeof l != "object")
182
- throw new Error(`quoteRequestData.items[${w}] must be a non-null object`);
183
- const g = `quoteRequestData.items[${w}]`;
184
- v.forEach((_) => {
185
- if (!Object.prototype.hasOwnProperty.call(l, _) || l[_] === void 0 || l[_] === null)
186
- throw new Error(`Missing required ${g} field: '${_}'`);
179
+ const w = g.filter((f) => f !== "cartId" && f !== "currencyCode");
180
+ u.forEach((f, _) => {
181
+ if (!f || typeof f != "object")
182
+ throw new Error(`quoteRequestData.items[${_}] must be a non-null object`);
183
+ const b = `quoteRequestData.items[${_}]`;
184
+ w.forEach((q) => {
185
+ if (!Object.prototype.hasOwnProperty.call(f, q) || f[q] === void 0 || f[q] === null)
186
+ throw new Error(`Missing required ${b} field: '${q}'`);
187
187
  });
188
- const b = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
189
- if (!b.test(l.startDate))
190
- throw new Error(`${g}.startDate must be a valid ISO8601 string`);
191
- if (!b.test(l.endDate))
192
- throw new Error(`${g}.endDate must be a valid ISO8601 string`);
193
- if (typeof l.eventType != "string")
194
- throw new Error(`${g}.eventType must be a string`);
195
- if (typeof l.productType != "string")
196
- throw new Error(`${g}.productType must be a string`);
197
- const E = ["Pass", "Trip", "Registration"];
198
- if (!E.includes(l.productType))
199
- throw new Error(`${g}.productType must be one of ${E.join(", ")}`);
200
- if (typeof l.productDuration != "string")
201
- throw new Error(`${g}.productDuration must be a string`);
202
- const q = ["Daily", "Seasonal", "Trip", "Event"];
203
- if (!q.includes(l.productDuration))
204
- throw new Error(`${g}.productDuration must be one of ${q.join(", ")}`);
205
- if (typeof l.productPrice != "number" || isNaN(l.productPrice))
206
- throw new Error(`${g}.productPrice must be a valid number`);
207
- if (typeof l.productId != "string")
208
- throw new Error(`${g}.productId must be a string`);
209
- if (typeof l.productName != "string")
210
- throw new Error(`${g}.productName must be a string`);
188
+ const v = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
189
+ if (!v.test(f.startDate))
190
+ throw new Error(`${b}.startDate must be a valid ISO8601 string`);
191
+ if (!v.test(f.endDate))
192
+ throw new Error(`${b}.endDate must be a valid ISO8601 string`);
193
+ if (typeof f.eventType != "string")
194
+ throw new Error(`${b}.eventType must be a string`);
195
+ if (typeof f.productType != "string")
196
+ throw new Error(`${b}.productType must be a string`);
197
+ const C = ["Pass", "Trip", "Registration"];
198
+ if (!C.includes(f.productType))
199
+ throw new Error(`${b}.productType must be one of ${C.join(", ")}`);
200
+ if (typeof f.productDuration != "string")
201
+ throw new Error(`${b}.productDuration must be a string`);
202
+ const E = ["Daily", "Seasonal", "Trip", "Event"];
203
+ if (!E.includes(f.productDuration))
204
+ throw new Error(`${b}.productDuration must be one of ${E.join(", ")}`);
205
+ if (typeof f.productPrice != "number" || isNaN(f.productPrice))
206
+ throw new Error(`${b}.productPrice must be a valid number`);
207
+ if (typeof f.productId != "string")
208
+ throw new Error(`${b}.productId must be a string`);
209
+ if (typeof f.productName != "string")
210
+ throw new Error(`${b}.productName must be a string`);
211
211
  });
212
- } else if (Array.isArray(o)) {
213
- if (o.length === 0)
212
+ } else if (Array.isArray(e)) {
213
+ if (e.length === 0)
214
214
  throw new Error("quoteRequestData array cannot be empty");
215
- o.forEach((s, y) => {
215
+ e.forEach((s, u) => {
216
216
  if (!s || typeof s != "object")
217
- throw new Error(`quoteRequestData[${y}] must be a non-null object`);
218
- d(s, y);
217
+ throw new Error(`quoteRequestData[${u}] must be a non-null object`);
218
+ l(s, u);
219
219
  });
220
220
  } else
221
- d(o);
221
+ l(e);
222
222
  if ([
223
223
  "onOptIn",
224
224
  "onOptOut",
@@ -226,109 +226,149 @@ function D(p) {
226
226
  "onError",
227
227
  "noMatchingQuote"
228
228
  ].forEach((s) => {
229
- const y = n[s];
230
- if (y && typeof y != "function")
229
+ const u = n[s];
230
+ if (u && typeof u != "function")
231
231
  throw new Error(`Callback '${s}' must be a function.`);
232
- }), typeof t == "string" && !document.querySelector(t))
233
- throw new Error(`Invalid location selector: '${t}'`);
232
+ }), typeof o == "string" && !document.querySelector(o))
233
+ throw new Error(`Invalid location selector: '${o}'`);
234
234
  if (r && typeof r != "object")
235
235
  throw new Error(
236
236
  "Theme must be an object with CSS variables, do not include the '--' prefix"
237
237
  );
238
238
  }
239
- function i(p, { text: e, className: o, parent: n, innerHTML: t } = {}) {
240
- const r = document.createElement(p);
241
- return o && (r.className = o), e != null && (r.textContent = e), t != null && (r.innerHTML = t), n && n.appendChild(r), r;
239
+ function i(c, { text: t, className: e, parent: n, innerHTML: o } = {}) {
240
+ const r = document.createElement(c);
241
+ return e && (r.className = e), t != null && (r.textContent = t), o != null && (r.innerHTML = o), n && n.appendChild(r), r;
242
242
  }
243
- function O(p, { name: e, description: o }) {
243
+ function O(c, { name: t, description: e }) {
244
244
  i("div", {
245
245
  className: "spot-header__title",
246
- text: e,
247
- parent: p
246
+ text: t,
247
+ parent: c
248
248
  }), i("div", {
249
249
  className: "spot-header__description",
250
- text: o,
251
- parent: p
250
+ text: e,
251
+ parent: c
252
252
  });
253
253
  }
254
- function P(p, e = []) {
255
- const o = i("ul", {
254
+ function R(c, t = []) {
255
+ const e = i("ul", {
256
256
  className: "spot-benefits__list",
257
- parent: p
257
+ parent: c
258
258
  });
259
- e.forEach((n) => {
260
- const t = i("li", { parent: o });
261
- t.innerHTML = `
259
+ t.forEach((n) => {
260
+ const o = i("li", { parent: e });
261
+ o.innerHTML = `
262
262
  <svg width="14" height="14" viewBox="0 0 14 14" fill="none">
263
263
  <path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
264
264
  stroke="#2E2E2E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
265
- </svg>`, i("span", { text: n, parent: t });
265
+ </svg>`, i("span", { text: n, parent: o });
266
+ });
267
+ }
268
+ function P(c, t = []) {
269
+ if (!t || t.length === 0) return;
270
+ const e = i("div", {
271
+ className: "spot-qualifying-reasons__container",
272
+ parent: c
273
+ }), n = [...t].sort((d, h) => d.rank - h.rank), o = i("div", {
274
+ className: "spot-qualifying-reasons__grid",
275
+ parent: e
276
+ }), r = {
277
+ "Accident & Illness": "cross.svg",
278
+ "Family Emergencies": "users.svg",
279
+ Layoffs: "building.svg",
280
+ "Jury Duty": "scale.svg",
281
+ "Work Travel Conflict": "briefcase.svg",
282
+ "Severe Weather": "umbrella.svg",
283
+ "Travel Interruption": "plane.svg",
284
+ "Military Duty": "medal.svg"
285
+ }, p = new URL(import.meta.url), a = p.origin + p.pathname.replace(/\/src\/[^/]*$/, "/assets/");
286
+ n.forEach((d) => {
287
+ var y, s, u;
288
+ const h = i("div", {
289
+ className: "spot-qualifying-reasons__item",
290
+ parent: o
291
+ }), g = i("div", {
292
+ className: "spot-qualifying-reasons__icon-wrapper",
293
+ parent: h
294
+ }), l = r[(y = d.benefitType) == null ? void 0 : y.name] || r[d.name];
295
+ if (l) {
296
+ const m = i("img", {
297
+ parent: g
298
+ });
299
+ m.src = a + l, m.alt = ((s = d.benefitType) == null ? void 0 : s.name) || d.name || "", m.className = "spot-qualifying-reasons__icon";
300
+ }
301
+ i("span", {
302
+ className: "spot-qualifying-reasons__label",
303
+ text: ((u = d.benefitType) == null ? void 0 : u.name) || d.name || "",
304
+ parent: h
305
+ });
266
306
  });
267
307
  }
268
- function $(p, e = []) {
269
- if (e.length === 0) return;
270
- const o = i("div", {
308
+ function $(c, t = []) {
309
+ if (t.length === 0) return;
310
+ const e = i("div", {
271
311
  className: "spot-covered-items__container",
272
- parent: p
312
+ parent: c
273
313
  });
274
314
  i("div", {
275
315
  className: "spot-covered-items__title",
276
316
  text: "Items covered in your cart:",
277
- parent: o
317
+ parent: e
278
318
  });
279
319
  const n = i("ul", {
280
320
  className: "spot-covered-items__list",
281
- parent: o
321
+ parent: e
282
322
  });
283
- e.forEach((t) => {
323
+ t.forEach((o) => {
284
324
  const r = i("li", { parent: n });
285
- i("span", { text: t, parent: r });
325
+ i("span", { text: o, parent: r });
286
326
  });
287
327
  }
288
- function Q(p, e = []) {
289
- const o = i("div", {
328
+ function z(c, t = []) {
329
+ const e = i("div", {
290
330
  className: "spot-table__container",
291
- parent: p
331
+ parent: c
292
332
  }), n = i("table", {
293
333
  className: "spot-refund__table spot-table--dynamic",
294
- parent: o
295
- }), t = i("thead", { parent: n }), r = i("tr", { parent: t });
334
+ parent: e
335
+ }), o = i("thead", { parent: n }), r = i("tr", { parent: o });
296
336
  i("th", { text: "When you cancel", parent: r }), i("th", { text: "You will receive", parent: r });
297
- const c = i("tbody", { parent: n });
298
- e.forEach(({ text: a, percent: u, amount: h }) => {
299
- const m = i("tr", { parent: c });
300
- i("td", { text: a, parent: m });
301
- const d = u === "Not eligible for refund" ? "Not eligible for a refund" : `$${h} refund`;
302
- i("td", { text: d, parent: m });
337
+ const p = i("tbody", { parent: n });
338
+ t.forEach(({ text: a, percent: d, amount: h }) => {
339
+ const g = i("tr", { parent: p });
340
+ i("td", { text: a, parent: g });
341
+ const l = d === "Not eligible for refund" ? "Not eligible for a refund" : `$${h} refund`;
342
+ i("td", { text: l, parent: g });
303
343
  });
304
344
  }
305
- function H(p, e, o) {
345
+ function Q(c, t, e) {
306
346
  const n = i("div", {
307
347
  className: "spot-selection__options",
308
- parent: p
309
- }), t = i("label", {
310
- className: `spot-selection__option ${e ? "selected" : ""}`,
348
+ parent: c
349
+ }), o = i("label", {
350
+ className: `spot-selection__option ${t ? "selected" : ""}`,
311
351
  parent: n
312
- }), r = i("input", { parent: t });
313
- r.type = "radio", r.name = "selection", r.value = "yes", e && (r.checked = !0), i("strong", {
314
- text: o.yesOptionText,
315
- parent: t
352
+ }), r = i("input", { parent: o });
353
+ r.type = "radio", r.name = "selection", r.value = "yes", t && (r.checked = !0), i("strong", {
354
+ text: e.yesOptionText,
355
+ parent: o
316
356
  }), i("span", {
317
357
  className: "spot-selection__recommended-tag",
318
358
  text: "Recommended",
319
- parent: t
359
+ parent: o
320
360
  });
321
- const c = i("label", {
361
+ const p = i("label", {
322
362
  className: "spot-selection__option",
323
363
  parent: n
324
- }), a = i("input", { parent: c });
325
- return a.type = "radio", a.name = "selection", a.value = "no", i("span", { text: o.noOptionText, parent: c }), n;
364
+ }), a = i("input", { parent: p });
365
+ return a.type = "radio", a.name = "selection", a.value = "no", i("span", { text: e.noOptionText, parent: p }), n;
326
366
  }
327
- function S(p, e) {
328
- var t;
329
- const o = (t = e.communication) == null ? void 0 : t.paymentTerms, n = i("div", {
367
+ function S(c, t) {
368
+ var o;
369
+ const e = (o = t.communication) == null ? void 0 : o.paymentTerms, n = i("div", {
330
370
  className: "spot-payment-terms",
331
- parent: p
371
+ parent: c
332
372
  });
333
373
  return i("div", {
334
374
  className: "spot-payment-terms__header",
@@ -336,32 +376,32 @@ function S(p, e) {
336
376
  parent: n
337
377
  }), i("div", {
338
378
  className: "spot-payment-terms__body",
339
- text: o,
379
+ text: e,
340
380
  parent: n
341
381
  }), n;
342
382
  }
343
- function z(p, e) {
344
- const o = i("div", {
383
+ function H(c, t) {
384
+ const e = i("div", {
345
385
  className: "spot-footer__container",
346
- parent: p
386
+ parent: c
347
387
  }), n = i("div", {
348
388
  className: "spot-footer__terms",
349
- parent: o
389
+ parent: e
350
390
  });
351
391
  i("span", {
352
- innerHTML: e.communication.legalDisclaimer,
392
+ innerHTML: t.communication.legalDisclaimer,
353
393
  parent: n
354
394
  }), i("br", { parent: n }), i("a", {
355
- href: e.communication.termsAndConditionsUrl,
395
+ href: t.communication.termsAndConditionsUrl,
356
396
  className: "spot-footer__terms-link",
357
397
  text: "Refund Guarantee Terms and Conditions",
358
398
  parent: n
359
399
  });
360
- const t = i("p", {
400
+ const o = i("p", {
361
401
  className: "spot-footer__powered-by",
362
- parent: o
402
+ parent: e
363
403
  });
364
- return t.innerHTML = `
404
+ return o.innerHTML = `
365
405
  <svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
366
406
  <rect width="145" height="28"/>
367
407
  <rect x="-655" y="-270" width="819" height="325" rx="10"/>
@@ -376,21 +416,21 @@ function z(p, e) {
376
416
  <rect width="45.405" height="14.8867" fill="white" transform="translate(87 8)"/>
377
417
  </clipPath>
378
418
  </defs>
379
- </svg>`, o;
419
+ </svg>`, e;
380
420
  }
381
- const M = ":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-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-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}.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}@media (min-width: 48rem){.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr 20.3125rem;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list{grid-row:1}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1}.desktop-layout .spot-selection__options{grid-row:3}.desktop-layout .spot-table__container{grid-row:1 / span 3}}@media (max-width: 52.438rem){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 47.938rem){.spot-selection__recommended-tag{margin-top:0rem}}@media (max-width: 32.125rem){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 47.9375rem){.spot-table__container{display:flex;justify-content:center}.spot-selection__recommended-tag{display:inline-block;margin-left:0}.spot-footer__container{flex-direction:column;margin-top:.5rem}.spot-refund__table{width:100%;table-layout:auto}.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:.5rem;display:flex;align-items:flex-start;gap:.5rem}.spot-benefits__list li svg{flex-shrink:0;position:relative;top:.125rem}.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:1.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;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}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:block;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;gap:.5rem;flex:1 0 0;align-self:stretch}.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:1.5rem;white-space:nowrap}.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)}.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;justify-content:space-between;align-items:center}.spot-footer__powered-by{margin-top:1.5rem}";
382
- function R(p) {
383
- const e = document.createElement("style");
384
- e.textContent = p, document.head.appendChild(e);
421
+ const M = ":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-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}.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}@media (min-width: 48rem){.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr 20.3125rem;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list{grid-row:1}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1}.desktop-layout .spot-selection__options{grid-row:3}.desktop-layout .spot-table__container{grid-row:1 / span 3}}@media (max-width: 52.438rem){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 47.938rem){.spot-selection__recommended-tag{margin-top:0rem}}@media (max-width: 32.125rem){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 47.9375rem){.spot-table__container{display:flex;justify-content:center}.spot-selection__recommended-tag{display:inline-block;margin-left:0}.spot-footer__container{flex-direction:column;margin-top:.5rem}.spot-refund__table{width:100%;table-layout:auto}.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:.5rem;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:1.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;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}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:block;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;gap:.5rem;flex:1 0 0;align-self:stretch}.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:1.5rem;white-space:nowrap}.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)}.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;justify-content:space-between;align-items:center}.spot-footer__powered-by{margin-top:1.5rem}";
422
+ function L(c) {
423
+ const t = document.createElement("style");
424
+ t.textContent = c, document.head.appendChild(t);
385
425
  }
386
- R(M);
387
- const T = {
426
+ L(M);
427
+ const x = {
388
428
  sandbox: "https://api.sandbox.getspot.com/api/v1/quote",
389
429
  production: "https://api.getspot.com/api/v1/quote",
390
430
  local: "http://localhost:3999/api/v1/quote"
391
431
  };
392
- class L {
393
- constructor(e = {}) {
432
+ class A {
433
+ constructor(t = {}) {
394
434
  this.options = {
395
435
  location: "body",
396
436
  showTable: !0,
@@ -398,103 +438,129 @@ class L {
398
438
  apiConfig: { environment: "production", partnerId: "" },
399
439
  quoteRequestData: {},
400
440
  callbacks: {},
401
- ...e
441
+ ...t
402
442
  }, 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();
403
443
  }
404
444
  async _init() {
405
- var e, o, n, t, r;
445
+ var t, e, n, o, r;
406
446
  try {
407
- D(this.options);
408
- const { environment: c, partnerId: a } = this.options.apiConfig, h = this.options.apiConfig.customEndpoint || T[c], d = this.options.quoteRequestData.cartInfo && this.options.quoteRequestData.items ? await k(h, a, this.options.quoteRequestData) : await I(h, a, this.options.quoteRequestData);
409
- if (d.status !== "QUOTE_AVAILABLE") {
410
- d.status === "NO_MATCHING_QUOTE" && ((e = this.options.callbacks) != null && e.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
447
+ k(this.options);
448
+ const { environment: p, partnerId: a } = this.options.apiConfig, h = this.options.apiConfig.customEndpoint || x[p], l = this.options.quoteRequestData.cartInfo && this.options.quoteRequestData.items ? await D(
449
+ h,
450
+ a,
451
+ this.options.quoteRequestData
452
+ ) : await I(h, a, this.options.quoteRequestData);
453
+ if (l.status !== "QUOTE_AVAILABLE") {
454
+ l.status === "NO_MATCHING_QUOTE" && ((t = this.options.callbacks) != null && t.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
411
455
  status: "NO_MATCHING_QUOTE",
412
456
  data: this.options.quoteRequestData
413
457
  });
414
458
  return;
415
459
  }
416
- if (this.quote = d.data, this._renderWidget(), this.options.optInSelected && ((o = this.options.callbacks) != null && o.onOptIn)) {
417
- const C = {
460
+ if (this.quote = l.data, this._renderWidget(), this.options.optInSelected && ((e = this.options.callbacks) != null && e.onOptIn)) {
461
+ const y = {
418
462
  status: "QUOTE_ACCEPTED",
419
463
  spotPrice: this.quote.spotPrice,
420
464
  quoteId: this.quote.id
421
465
  };
422
- this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (C.batchQuoteDetails = this.quote.originalQuotes.map((s) => ({
423
- quoteId: s.id,
424
- productPrice: s.spotPrice,
425
- cartItemId: s.cartItemId
426
- }))), this.options.callbacks.onOptIn(C);
466
+ this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (y.batchQuoteDetails = this.quote.originalQuotes.map((s) => {
467
+ var m;
468
+ const u = (m = this.options.quoteRequestData.items) == null ? void 0 : m.find(
469
+ (w) => (w.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(w) + 1}`) === s.cartItemId
470
+ );
471
+ return {
472
+ quoteId: s.id,
473
+ productPrice: (u == null ? void 0 : u.productPrice) || s.spotPrice,
474
+ cartItemId: s.cartItemId
475
+ };
476
+ })), this.options.callbacks.onOptIn(y);
427
477
  }
428
478
  (n = this.options.callbacks) != null && n.onQuoteRetrieved && this.options.callbacks.onQuoteRetrieved(this.quote);
429
- } catch (c) {
430
- (t = this.options.callbacks) != null && t.onError && ((r = this.options.callbacks) == null || r.onError({
431
- message: c.message,
432
- status: c.status,
433
- responseBody: c.responseBody
479
+ } catch (p) {
480
+ (o = this.options.callbacks) != null && o.onError && ((r = this.options.callbacks) == null || r.onError({
481
+ message: p.message,
482
+ status: p.status,
483
+ responseBody: p.responseBody
434
484
  }));
435
485
  }
436
486
  }
437
487
  _renderWidget() {
438
- this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([n, t]) => {
488
+ this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([n, o]) => {
439
489
  const r = `--${n}`;
440
- this.container.style.setProperty(r, t);
490
+ this.container.style.setProperty(r, o);
441
491
  }), O(this.container, this.quote.communication);
442
- const e = document.createElement("div");
443
- e.className = "spot-content__wrapper", this.container.appendChild(e), P(e, this.quote.communication.bulletPoints), this.quote.coveredItems && $(e, this.quote.coveredItems), this.options.showTable && Q(e, this.quote.payoutSchedule);
444
- const o = H(
445
- e,
492
+ const t = document.createElement("div");
493
+ t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ? P(t, this.quote.qualifyingReasons) : R(t, this.quote.communication.bulletPoints), this.quote.coveredItems && $(t, this.quote.coveredItems), this.options.showTable && !this.quote.qualifyingReasons && z(t, this.quote.payoutSchedule);
494
+ const e = Q(
495
+ t,
446
496
  this.options.optInSelected,
447
497
  this.quote.communication
448
498
  );
449
- e.appendChild(o), this.paymentTermsEl = i("div", {
499
+ t.appendChild(e), this.paymentTermsEl = i("div", {
450
500
  className: "spot-payment-terms__wrapper",
451
- parent: e
452
- }), z(this.container, this.quote), window.addEventListener("resize", this._onResize), this._updateLayout(), this._setupOptionListeners(o);
501
+ parent: t
502
+ }), H(this.container, this.quote), window.addEventListener("resize", this._onResize), this._updateLayout(), this._setupOptionListeners(e);
453
503
  }
454
504
  _updateLayout() {
455
- const e = window.matchMedia("(min-width: 768px)").matches;
456
- this.container.querySelector(".spot-content__wrapper").classList.toggle("desktop-layout", e && this.options.showTable);
505
+ const t = window.matchMedia("(min-width: 768px)").matches, e = this.options.showTable && !this.quote.qualifyingReasons;
506
+ this.container.querySelector(".spot-content__wrapper").classList.toggle("desktop-layout", t && e);
457
507
  }
458
- _setupOptionListeners(e) {
459
- const o = e.querySelectorAll('input[type="radio"]'), n = e.querySelectorAll(".spot-selection__option");
460
- o.forEach((t) => {
461
- t.addEventListener("change", (r) => {
462
- var a, u, h;
463
- const c = r.target.value;
464
- if (this.hideSelectionError(), this.currentSelection = c, n.forEach((m) => m.classList.remove("selected")), (a = r.target.closest(".spot-selection__option")) == null || a.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), c === "yes" && (this.options.quoteRequestData.isPartialPayment && S(this.paymentTermsEl, this.quote), (u = this.options.callbacks) != null && u.onOptIn)) {
465
- const m = {
508
+ _setupOptionListeners(t) {
509
+ const e = t.querySelectorAll('input[type="radio"]'), n = t.querySelectorAll(".spot-selection__option");
510
+ e.forEach((o) => {
511
+ o.addEventListener("change", (r) => {
512
+ var a, d, h;
513
+ const p = r.target.value;
514
+ if (this.hideSelectionError(), this.currentSelection = p, n.forEach((g) => g.classList.remove("selected")), (a = r.target.closest(".spot-selection__option")) == null || a.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), p === "yes" && (this.options.quoteRequestData.isPartialPayment && S(this.paymentTermsEl, this.quote), (d = this.options.callbacks) != null && d.onOptIn)) {
515
+ const g = {
466
516
  status: "QUOTE_ACCEPTED",
467
517
  spotPrice: this.quote.spotPrice,
468
518
  quoteId: this.quote.id
469
519
  };
470
- this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (m.batchQuoteDetails = this.quote.originalQuotes.map((d) => ({
471
- quoteId: d.id,
472
- productPrice: d.spotPrice,
473
- cartItemId: d.cartItemId
474
- }))), this.options.callbacks.onOptIn(m);
520
+ this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (g.batchQuoteDetails = this.quote.originalQuotes.map(
521
+ (l) => {
522
+ var s;
523
+ const y = (s = this.options.quoteRequestData.items) == null ? void 0 : s.find(
524
+ (u) => (u.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(u) + 1}`) === l.cartItemId
525
+ );
526
+ return {
527
+ quoteId: l.id,
528
+ productPrice: (y == null ? void 0 : y.productPrice) || l.spotPrice,
529
+ cartItemId: l.cartItemId
530
+ };
531
+ }
532
+ )), this.options.callbacks.onOptIn(g);
475
533
  }
476
- if (c === "no" && ((h = this.options.callbacks) != null && h.onOptOut)) {
477
- const m = {
534
+ if (p === "no" && ((h = this.options.callbacks) != null && h.onOptOut)) {
535
+ const g = {
478
536
  status: "QUOTE_DECLINED",
479
537
  quoteId: this.quote.id
480
538
  };
481
- this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (m.batchQuoteDetails = this.quote.originalQuotes.map((d) => ({
482
- quoteId: d.id,
483
- productPrice: d.spotPrice,
484
- cartItemId: d.cartItemId
485
- }))), this.options.callbacks.onOptOut(m);
539
+ this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (g.batchQuoteDetails = this.quote.originalQuotes.map(
540
+ (l) => {
541
+ var s;
542
+ const y = (s = this.options.quoteRequestData.items) == null ? void 0 : s.find(
543
+ (u) => (u.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(u) + 1}`) === l.cartItemId
544
+ );
545
+ return {
546
+ quoteId: l.id,
547
+ productPrice: (y == null ? void 0 : y.productPrice) || l.spotPrice,
548
+ cartItemId: l.cartItemId
549
+ };
550
+ }
551
+ )), this.options.callbacks.onOptOut(g);
486
552
  }
487
553
  });
488
554
  });
489
555
  }
490
556
  showSelectionError() {
491
- var e;
557
+ var t;
492
558
  if (!this.errorEl) {
493
559
  this.errorEl = document.createElement("div"), this.errorEl.className = "spot-selection__error", this.errorEl.textContent = "Please make a selection";
494
- const o = (e = this.container) == null ? void 0 : e.querySelector(
560
+ const e = (t = this.container) == null ? void 0 : t.querySelector(
495
561
  ".spot-selection__options"
496
562
  );
497
- o && o.insertAdjacentElement("afterend", this.errorEl);
563
+ e && e.insertAdjacentElement("afterend", this.errorEl);
498
564
  }
499
565
  this.errorEl.style.display = "block";
500
566
  }
@@ -503,30 +569,38 @@ class L {
503
569
  }
504
570
  validateSelection() {
505
571
  if (!this.container) return !1;
506
- const e = !!this.container.querySelector(
572
+ const t = !!this.container.querySelector(
507
573
  'input[name="selection"]:checked'
508
574
  );
509
- return e ? this.hideSelectionError() : this.showSelectionError(), e;
575
+ return t ? this.hideSelectionError() : this.showSelectionError(), t;
510
576
  }
511
- async updateQuote(e) {
512
- var o, n, t;
577
+ async updateQuote(t) {
578
+ var e, n, o;
513
579
  try {
514
580
  const r = {
515
581
  ...this.options,
516
- quoteRequestData: e
582
+ quoteRequestData: t
517
583
  };
518
- D(r);
584
+ k(r);
519
585
  const {
520
- environment: c,
586
+ environment: p,
521
587
  partnerId: a,
522
- endpoint: u
523
- } = this.options.apiConfig, h = u || T[c], d = r.quoteRequestData.cartInfo && r.quoteRequestData.items ? await k(h, a, r.quoteRequestData) : await I(h, a, r.quoteRequestData);
524
- return d.status !== "QUOTE_AVAILABLE" ? (d.status === "NO_MATCHING_QUOTE" && ((o = this.options.callbacks) != null && o.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
588
+ endpoint: d
589
+ } = this.options.apiConfig, h = d || x[p], l = r.quoteRequestData.cartInfo && r.quoteRequestData.items ? await D(
590
+ h,
591
+ a,
592
+ r.quoteRequestData
593
+ ) : await I(
594
+ h,
595
+ a,
596
+ r.quoteRequestData
597
+ );
598
+ return l.status !== "QUOTE_AVAILABLE" ? (l.status === "NO_MATCHING_QUOTE" && ((e = this.options.callbacks) != null && e.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
525
599
  status: "NO_MATCHING_QUOTE",
526
600
  data: r.quoteRequestData
527
- }), !1) : (this.options.quoteRequestData = r.quoteRequestData, this.quote = d.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (n = this.options.callbacks) != null && n.onQuoteRetrieved && this.options.callbacks.onQuoteRetrieved(this.quote), !0);
601
+ }), !1) : (this.options.quoteRequestData = r.quoteRequestData, this.quote = l.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (n = this.options.callbacks) != null && n.onQuoteRetrieved && this.options.callbacks.onQuoteRetrieved(this.quote), !0);
528
602
  } catch (r) {
529
- return (t = this.options.callbacks) == null || t.onError({
603
+ return (o = this.options.callbacks) == null || o.onError({
530
604
  message: r.message,
531
605
  status: r.status,
532
606
  responseBody: r.responseBody
@@ -534,24 +608,30 @@ class L {
534
608
  }
535
609
  }
536
610
  getSelection() {
537
- var o, n, t;
611
+ var e, n, o;
538
612
  if (this.currentSelection == null) return null;
539
- const e = {
613
+ const t = {
540
614
  selection: this.currentSelection,
541
- quoteId: (o = this.quote) == null ? void 0 : o.id,
615
+ quoteId: (e = this.quote) == null ? void 0 : e.id,
542
616
  spotPrice: (n = this.quote) == null ? void 0 : n.spotPrice,
543
617
  status: this.currentSelection === "yes" ? "QUOTE_ACCEPTED" : "QUOTE_DECLINED"
544
618
  };
545
- return (t = this.quote) != null && t.originalQuotes && this.quote.originalQuotes.length > 0 && (e.batchQuoteDetails = this.quote.originalQuotes.map((r) => ({
546
- quoteId: r.id,
547
- productPrice: r.spotPrice,
548
- cartItemId: r.cartItemId
549
- }))), e;
619
+ return (o = this.quote) != null && o.originalQuotes && this.quote.originalQuotes.length > 0 && (t.batchQuoteDetails = this.quote.originalQuotes.map((r) => {
620
+ var a;
621
+ const p = (a = this.options.quoteRequestData.items) == null ? void 0 : a.find(
622
+ (d) => (d.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(d) + 1}`) === r.cartItemId
623
+ );
624
+ return {
625
+ quoteId: r.id,
626
+ productPrice: (p == null ? void 0 : p.productPrice) || r.spotPrice,
627
+ cartItemId: r.cartItemId
628
+ };
629
+ })), t;
550
630
  }
551
631
  destroy() {
552
632
  window.removeEventListener("resize", this._onResize), this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container);
553
633
  }
554
634
  }
555
635
  export {
556
- L as default
636
+ A as default
557
637
  };