@getspot/spot-widget 1.4.0 → 2.0.1

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