@getspot/spot-widget 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.es.js CHANGED
@@ -1,116 +1,120 @@
1
- async function I(c, e, o) {
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
- "X-Spot-Partner-Id": e
7
+ "X-Spot-Partner-Id": t
8
8
  },
9
- body: JSON.stringify(o)
10
- }), t = await n.json();
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;
9
+ body: JSON.stringify(e)
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 t;
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 x(c, e, o) {
20
+ async function N(u, t, e) {
21
21
  try {
22
- const n = c.replace("/quote", "/quote/batch"), t = 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
- "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 p = new Error((r == null ? void 0 : r.message) || "Failed to fetch batch quote");
32
- throw p.status = t.status, p.responseBody = r, p;
28
+ body: JSON.stringify(e)
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, e, o) {
39
+ async function k(u, t, e) {
40
+ var r;
40
41
  try {
41
42
  const n = {
42
- cartId: o.cartInfo.cartId,
43
- cartName: o.cartInfo.cartName,
44
- currencyCode: o.cartInfo.currencyCode,
45
- items: o.items.map((i, u) => ({
46
- cartItemId: i.cartItemId || `item-${u + 1}`,
47
- productPrice: i.productPrice,
48
- productType: i.productType,
49
- productDuration: i.productDuration,
50
- productId: i.productId,
51
- productName: i.productName,
52
- participantDescription: i.participantDescription,
53
- eventType: i.eventType,
54
- startDate: i.startDate,
55
- endDate: i.endDate
43
+ cartId: e.cartInfo.cartId,
44
+ cartName: e.cartInfo.cartName,
45
+ currencyCode: e.cartInfo.currencyCode,
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
- }, t = await x(c, e, n);
58
- if (t.status !== "QUOTES_AVAILABLE" && t.status !== "QUOTE_AVAILABLE")
58
+ }, o = await N(u, t, n);
59
+ if (o.status !== "QUOTES_AVAILABLE" && o.status !== "QUOTE_AVAILABLE")
59
60
  return { status: "NO_MATCHING_QUOTE" };
60
- const r = t.quotes.map((i) => {
61
- const u = o.items.find(
62
- (g) => (g.cartItemId || `item-${o.items.indexOf(g) + 1}`) === i.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 u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${i.cartItemId}`;
65
- }), p = Math.round((t.totalSpotPrice || t.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: t.quotes ? t.quotes.map((i) => i.id).join(",") : t.id,
70
- spotPrice: p,
71
- currencyCode: t.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
- ...t.communication,
74
- yesOptionText: t.communication.yesOptionText.replace(t.totalSpotPrice, p)
74
+ ...o.communication,
75
+ yesOptionText: o.communication.yesOptionText.replace(
76
+ String(o.totalSpotPrice),
77
+ String(s)
78
+ )
75
79
  },
76
- payoutSchedule: t.payoutSchedule.map((i) => ({
77
- ...i,
78
- amount: i.amount !== void 0 ? i.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: t.quotes || [t]
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
- apiConfig: e = {},
98
- quoteRequestData: o,
99
- callbacks: n = {},
100
- location: t,
101
- theme: r
102
- } = c, {
101
+ apiConfig: t = {},
102
+ quoteRequestData: e,
103
+ callbacks: r = {},
104
+ location: n,
105
+ theme: o
106
+ } = u, {
103
107
  environment: p = "sandbox",
104
- partnerId: i,
105
- endpoint: u
106
- } = e;
107
- if (!i || typeof i != "string")
108
+ partnerId: s,
109
+ customEndpoint: c
110
+ } = t;
111
+ if (!s || typeof s != "string")
108
112
  throw new Error("Invalid or missing partnerId in apiConfig");
109
- if (!(u || N[p]))
113
+ if (!(c || O[p]))
110
114
  throw new Error(`Invalid environment in apiConfig: ${p}`);
111
- if (!o || typeof o != "object" && !Array.isArray(o))
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 h = [
117
+ const b = [
114
118
  "startDate",
115
119
  "endDate",
116
120
  "currencyCode",
@@ -122,246 +126,296 @@ function k(c) {
122
126
  "cartId",
123
127
  "productName"
124
128
  ];
125
- function d(s, l = null) {
126
- const f = l !== null ? `quoteRequestData[${l}]` : "quoteRequestData";
127
- h.forEach((v) => {
128
- if (!Object.prototype.hasOwnProperty.call(s, v) || s[v] === void 0 || s[v] === null)
129
- throw new Error(`Missing required ${f} 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(`${f}.startDate must be a valid ISO8601 string`);
134
- if (!w.test(s.endDate))
135
- throw new Error(`${f}.endDate must be a valid ISO8601 string`);
136
- if (typeof s.currencyCode != "string")
137
- throw new Error(`${f}.currencyCode must be a string`);
138
- if (!["USD", "CAD", "AUD"].includes(s.currencyCode))
139
- throw new Error(`Invalid ${f}.currencyCode: ${s.currencyCode}`);
140
- if (typeof s.eventType != "string")
141
- throw new Error(`${f}.eventType must be a string`);
142
- if (typeof s.productType != "string")
143
- throw new Error(`${f}.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
- `${f}.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(`${f}.productDuration must be a string`);
151
- const y = ["Daily", "Seasonal", "Trip", "Event"];
152
- if (!y.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
- `${f}.productDuration must be one of ${y.join(", ")}`
158
+ `${l}.productDuration must be one of ${_.join(", ")}`
155
159
  );
156
- if (typeof s.productPrice != "number" || isNaN(s.productPrice))
157
- throw new Error(`${f}.productPrice must be a valid number`);
158
- if (typeof s.productId != "string")
159
- throw new Error(`${f}.productId must be a string`);
160
- if (typeof s.cartId != "string")
161
- throw new Error(`${f}.cartId must be a string`);
162
- if (typeof s.productName != "string")
163
- throw new Error(`${f}.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 (o.cartInfo && o.items) {
166
- const { cartInfo: s, items: l } = o;
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}`);
179
+ if (!["USD", "CAD", "AUD"].includes(d.currencyCode))
180
+ throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${d.currencyCode}`);
177
181
  if (!Array.isArray(l) || l.length === 0)
178
182
  throw new Error("quoteRequestData.items must be a non-empty array");
179
- const w = h.filter((m) => m !== "cartId" && m !== "currencyCode");
180
- l.forEach((m, _) => {
181
- if (!m || typeof m != "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
196
  const y = `quoteRequestData.items[${_}]`;
184
- w.forEach((C) => {
185
- if (!Object.prototype.hasOwnProperty.call(m, C) || m[C] === void 0 || m[C] === null)
186
- throw new Error(`Missing required ${y} field: '${C}'`);
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(m.startDate))
201
+ const C = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
202
+ if (!C.test(h.startDate))
190
203
  throw new Error(`${y}.startDate must be a valid ISO8601 string`);
191
- if (!v.test(m.endDate))
204
+ if (!C.test(h.endDate))
192
205
  throw new Error(`${y}.endDate must be a valid ISO8601 string`);
193
- if (typeof m.eventType != "string")
206
+ if (typeof h.eventType != "string")
194
207
  throw new Error(`${y}.eventType must be a string`);
195
- if (typeof m.productType != "string")
208
+ if (typeof h.productType != "string")
196
209
  throw new Error(`${y}.productType must be a string`);
197
210
  const E = ["Pass", "Trip", "Registration"];
198
- if (!E.includes(m.productType))
211
+ if (!E.includes(h.productType))
199
212
  throw new Error(`${y}.productType must be one of ${E.join(", ")}`);
200
- if (typeof m.productDuration != "string")
213
+ if (typeof h.productDuration != "string")
201
214
  throw new Error(`${y}.productDuration must be a string`);
202
- const q = ["Daily", "Seasonal", "Trip", "Event"];
203
- if (!q.includes(m.productDuration))
204
- throw new Error(`${y}.productDuration must be one of ${q.join(", ")}`);
205
- if (typeof m.productPrice != "number" || isNaN(m.productPrice))
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))
206
219
  throw new Error(`${y}.productPrice must be a valid number`);
207
- if (typeof m.productId != "string")
220
+ if (typeof h.productId != "string")
208
221
  throw new Error(`${y}.productId must be a string`);
209
- if (typeof m.productName != "string")
222
+ if (typeof h.productName != "string")
210
223
  throw new Error(`${y}.productName must be a string`);
211
224
  });
212
- } else if (Array.isArray(o)) {
213
- if (o.length === 0)
225
+ } else if (Array.isArray(e)) {
226
+ if (e.length === 0)
214
227
  throw new Error("quoteRequestData array cannot be empty");
215
- o.forEach((s, l) => {
216
- if (!s || typeof s != "object")
217
- throw new Error(`quoteRequestData[${l}] must be a non-null object`);
218
- d(s, l);
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
- d(o);
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 l = n[s];
230
- if (l && typeof l != "function")
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}'`);
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 a(c, { text: e, className: o, parent: n, innerHTML: t } = {}) {
240
- const r = document.createElement(c);
241
- return o && (r.className = o), e != null && (r.textContent = e), t != null && (r.innerHTML = t), 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: e, description: o }) {
244
- a("div", {
256
+ function P(u, { name: t, description: e }) {
257
+ i("div", {
245
258
  className: "spot-header__title",
246
- text: e,
247
- parent: c
248
- }), a("div", {
259
+ text: t,
260
+ parent: u
261
+ }), i("div", {
249
262
  className: "spot-header__description",
250
- text: o,
251
- parent: c
263
+ text: e,
264
+ parent: u
252
265
  });
253
266
  }
254
- function P(c, e = []) {
255
- const o = a("ul", {
267
+ function $(u, t = []) {
268
+ const e = i("ul", {
256
269
  className: "spot-benefits__list",
257
- parent: c
270
+ parent: u
258
271
  });
259
- e.forEach((n) => {
260
- const t = a("li", { parent: o });
261
- t.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>`, a("span", { text: n, parent: t });
278
+ </svg>`, i("span", { text: r, parent: n });
279
+ });
280
+ }
281
+ function z(u, t = []) {
282
+ if (!t || t.length === 0) return;
283
+ const e = i("div", {
284
+ className: "spot-qualifying-reasons__container",
285
+ parent: u
286
+ }), r = [...t].sort((c, m) => c.rank - m.rank), n = i("div", {
287
+ className: "spot-qualifying-reasons__grid",
288
+ parent: e
289
+ }), o = {
290
+ "Accident & Illness": "cross.svg",
291
+ "Family Emergencies": "users.svg",
292
+ Layoffs: "building.svg",
293
+ "Jury Duty": "scale.svg",
294
+ "Work Travel Conflict": "briefcase.svg",
295
+ "Severe Weather": "umbrella.svg",
296
+ "Travel Interruption": "plane.svg",
297
+ "Military Duty": "medal.svg"
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", {
302
+ className: "spot-qualifying-reasons__item",
303
+ parent: n
304
+ }), b = i("div", {
305
+ className: "spot-qualifying-reasons__icon-wrapper",
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
311
+ });
312
+ l.src = s + f, l.alt = ((a = c.benefitType) == null ? void 0 : a.name) || c.name || "", l.className = "spot-qualifying-reasons__icon";
313
+ }
314
+ i("span", {
315
+ className: "spot-qualifying-reasons__label",
316
+ text: ((d = c.benefitType) == null ? void 0 : d.name) || c.name || "",
317
+ parent: m
318
+ });
266
319
  });
267
320
  }
268
- function $(c, e = []) {
269
- if (e.length === 0) return;
270
- const o = a("div", {
321
+ function R(u, t = []) {
322
+ if (t.length === 0) return;
323
+ const e = i("div", {
271
324
  className: "spot-covered-items__container",
272
- parent: c
325
+ parent: u
273
326
  });
274
- a("div", {
327
+ i("div", {
275
328
  className: "spot-covered-items__title",
276
329
  text: "Items covered in your cart:",
277
- parent: o
330
+ parent: e
278
331
  });
279
- const n = a("ul", {
332
+ const r = i("ul", {
280
333
  className: "spot-covered-items__list",
281
- parent: o
334
+ parent: e
282
335
  });
283
- e.forEach((t) => {
284
- const r = a("li", { parent: n });
285
- a("span", { text: t, parent: r });
336
+ t.forEach((n) => {
337
+ const o = i("li", { parent: r });
338
+ i("span", { text: n, parent: o });
286
339
  });
287
340
  }
288
- function R(c, e = []) {
289
- const o = a("div", {
341
+ function S(u, t = []) {
342
+ const e = i("div", {
290
343
  className: "spot-table__container",
291
- parent: c
292
- }), n = a("table", {
344
+ parent: u
345
+ }), r = i("table", {
293
346
  className: "spot-refund__table spot-table--dynamic",
294
- parent: o
295
- }), t = a("thead", { parent: n }), r = a("tr", { parent: t });
296
- a("th", { text: "When you cancel", parent: r }), a("th", { text: "You will receive", parent: r });
297
- const p = a("tbody", { parent: n });
298
- e.forEach(({ text: i, percent: u, amount: g }) => {
299
- const h = a("tr", { parent: p });
300
- a("td", { text: i, parent: h });
301
- const d = u === "Not eligible for refund" ? "Not eligible for a refund" : `$${g} refund`;
302
- a("td", { text: d, parent: h });
347
+ parent: e
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 });
303
356
  });
304
357
  }
305
- function Q(c, e, o) {
306
- const n = a("div", {
358
+ function Q(u, t, e) {
359
+ const r = i("div", {
307
360
  className: "spot-selection__options",
308
- parent: c
309
- }), t = a("label", {
310
- className: `spot-selection__option ${e ? "selected" : ""}`,
361
+ parent: u
362
+ }), n = i("label", {
363
+ className: `spot-selection__option ${t ? "selected" : ""}`,
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", {
367
+ text: e.yesOptionText,
311
368
  parent: n
312
- }), r = a("input", { parent: t });
313
- r.type = "radio", r.name = "selection", r.value = "yes", e && (r.checked = !0), a("strong", {
314
- text: o.yesOptionText,
315
- parent: t
316
- }), a("span", {
369
+ }), i("span", {
317
370
  className: "spot-selection__recommended-tag",
318
371
  text: "Recommended",
319
- parent: t
372
+ parent: n
320
373
  });
321
- const p = a("label", {
374
+ const p = i("label", {
322
375
  className: "spot-selection__option",
323
- parent: n
324
- }), i = a("input", { parent: p });
325
- return i.type = "radio", i.name = "selection", i.value = "no", a("span", { text: o.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;
326
379
  }
327
- function H(c, e) {
328
- var t;
329
- const o = (t = e.communication) == null ? void 0 : t.paymentTerms, n = a("div", {
380
+ function H(u, t) {
381
+ var n;
382
+ const e = (n = t.communication) == null ? void 0 : n.paymentTerms, r = i("div", {
330
383
  className: "spot-payment-terms",
331
- parent: c
384
+ parent: u
332
385
  });
333
- return a("div", {
386
+ return i("div", {
334
387
  className: "spot-payment-terms__header",
335
388
  text: "PAYMENT TERMS",
336
- parent: n
337
- }), a("div", {
389
+ parent: r
390
+ }), i("div", {
338
391
  className: "spot-payment-terms__body",
339
- text: o,
340
- parent: n
341
- }), n;
392
+ text: e || "",
393
+ parent: r
394
+ }), r;
342
395
  }
343
- function S(c, e) {
344
- const o = a("div", {
396
+ function M(u, t) {
397
+ const e = i("div", {
345
398
  className: "spot-footer__container",
346
- parent: c
347
- }), n = a("div", {
399
+ parent: u
400
+ }), r = i("div", {
348
401
  className: "spot-footer__terms",
349
- parent: o
402
+ parent: e
350
403
  });
351
- a("span", {
352
- innerHTML: e.communication.legalDisclaimer,
353
- parent: n
354
- }), a("br", { parent: n }), a("a", {
355
- href: e.communication.termsAndConditionsUrl,
404
+ i("span", {
405
+ innerHTML: t.communication.legalDisclaimer,
406
+ parent: r
407
+ }), i("br", { parent: r }), i("a", {
408
+ href: t.communication.termsAndConditionsUrl,
409
+ target: "_blank",
356
410
  className: "spot-footer__terms-link",
357
411
  text: "Refund Guarantee Terms and Conditions",
358
- parent: n
412
+ parent: r
359
413
  });
360
- const t = a("p", {
414
+ const n = i("p", {
361
415
  className: "spot-footer__powered-by",
362
- parent: o
416
+ parent: e
363
417
  });
364
- return t.innerHTML = `
418
+ return n.innerHTML = `
365
419
  <svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
366
420
  <rect width="145" height="28"/>
367
421
  <rect x="-655" y="-270" width="819" height="325" rx="10"/>
@@ -376,21 +430,21 @@ function S(c, e) {
376
430
  <rect width="45.405" height="14.8867" fill="white" transform="translate(87 8)"/>
377
431
  </clipPath>
378
432
  </defs>
379
- </svg>`, o;
433
+ </svg>`, e;
380
434
  }
381
- const z = ":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 M(c) {
383
- const e = document.createElement("style");
384
- e.textContent = c, document.head.appendChild(e);
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) {
437
+ const t = document.createElement("style");
438
+ t.textContent = u, document.head.appendChild(t);
385
439
  }
386
- M(z);
387
- const T = {
440
+ A(L);
441
+ const x = {
388
442
  sandbox: "https://api.sandbox.getspot.com/api/v1/quote",
389
443
  production: "https://api.getspot.com/api/v1/quote",
390
444
  local: "http://localhost:3999/api/v1/quote"
391
445
  };
392
- class L {
393
- constructor(e = {}) {
446
+ class V {
447
+ constructor(t = {}) {
394
448
  this.options = {
395
449
  location: "body",
396
450
  showTable: !0,
@@ -398,121 +452,147 @@ class L {
398
452
  apiConfig: { environment: "production", partnerId: "" },
399
453
  quoteRequestData: {},
400
454
  callbacks: {},
401
- ...e
455
+ ...t
402
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();
403
457
  }
404
458
  async _init() {
405
- var e, o, n, t, r;
459
+ var t, e, r, n, o;
406
460
  try {
407
- k(this.options);
408
- const { environment: p, partnerId: i } = this.options.apiConfig, g = this.options.apiConfig.customEndpoint || T[p], d = this.options.quoteRequestData.cartInfo && this.options.quoteRequestData.items ? await D(g, i, this.options.quoteRequestData) : await I(g, i, 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({
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,
465
+ this.options.quoteRequestData
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({
411
469
  status: "NO_MATCHING_QUOTE",
412
470
  data: this.options.quoteRequestData
413
471
  });
414
472
  return;
415
473
  }
416
- if (this.quote = d.data, this._renderWidget(), this.options.optInSelected && ((o = this.options.callbacks) != null && o.onOptIn)) {
417
- const b = {
474
+ if (this.quote = f.data, this._renderWidget(), this.options.optInSelected && ((e = this.options.callbacks) != null && e.onOptIn)) {
475
+ const g = {
418
476
  status: "QUOTE_ACCEPTED",
419
477
  spotPrice: this.quote.spotPrice,
420
478
  quoteId: this.quote.id
421
479
  };
422
- this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (b.batchQuoteDetails = this.quote.originalQuotes.map((s) => {
423
- var f;
424
- const l = (f = this.options.quoteRequestData.items) == null ? void 0 : f.find(
425
- (w) => (w.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(w) + 1}`) === s.cartItemId
426
- );
427
- return {
428
- quoteId: s.id,
429
- productPrice: (l == null ? void 0 : l.productPrice) || s.spotPrice,
430
- cartItemId: s.cartItemId
431
- };
432
- })), this.options.callbacks.onOptIn(b);
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);
433
495
  }
434
- (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);
435
497
  } catch (p) {
436
- (t = this.options.callbacks) != null && t.onError && ((r = this.options.callbacks) == null || r.onError({
437
- message: p.message,
438
- status: p.status,
439
- responseBody: p.responseBody
440
- }));
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
+ }
441
506
  }
442
507
  }
443
508
  _renderWidget() {
444
- this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([n, t]) => {
445
- const r = `--${n}`;
446
- this.container.style.setProperty(r, t);
447
- }), O(this.container, this.quote.communication);
448
- const e = document.createElement("div");
449
- 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 && R(e, this.quote.payoutSchedule);
450
- const o = Q(
451
- e,
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);
514
+ const t = document.createElement("div");
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);
516
+ const e = Q(
517
+ t,
452
518
  this.options.optInSelected,
453
519
  this.quote.communication
454
520
  );
455
- e.appendChild(o), this.paymentTermsEl = a("div", {
521
+ t.appendChild(e), this.paymentTermsEl = i("div", {
456
522
  className: "spot-payment-terms__wrapper",
457
- parent: e
458
- }), S(this.container, this.quote), window.addEventListener("resize", this._onResize), this._updateLayout(), this._setupOptionListeners(o);
523
+ parent: t
524
+ }), M(this.container, this.quote), window.addEventListener("resize", this._onResize), this._updateLayout(), this._setupOptionListeners(e);
459
525
  }
460
526
  _updateLayout() {
461
- const e = window.matchMedia("(min-width: 768px)").matches;
462
- this.container.querySelector(".spot-content__wrapper").classList.toggle("desktop-layout", e && this.options.showTable);
527
+ var r;
528
+ if (!this.container || !this.quote) return;
529
+ const t = window.matchMedia("(min-width: 768px)").matches, e = this.options.showTable && !this.quote.qualifyingReasons;
530
+ (r = this.container.querySelector(".spot-content__wrapper")) == null || r.classList.toggle("desktop-layout", t && e);
463
531
  }
464
- _setupOptionListeners(e) {
465
- const o = e.querySelectorAll('input[type="radio"]'), n = e.querySelectorAll(".spot-selection__option");
466
- o.forEach((t) => {
467
- t.addEventListener("change", (r) => {
468
- var i, u, g;
469
- const p = r.target.value;
470
- if (this.hideSelectionError(), this.currentSelection = p, n.forEach((h) => h.classList.remove("selected")), (i = r.target.closest(".spot-selection__option")) == null || i.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), p === "yes" && (this.options.quoteRequestData.isPartialPayment && H(this.paymentTermsEl, this.quote), (u = this.options.callbacks) != null && u.onOptIn)) {
471
- const h = {
532
+ _setupOptionListeners(t) {
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 = {
472
540
  status: "QUOTE_ACCEPTED",
473
541
  spotPrice: this.quote.spotPrice,
474
542
  quoteId: this.quote.id
475
543
  };
476
- this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (h.batchQuoteDetails = this.quote.originalQuotes.map((d) => {
477
- var s;
478
- const b = (s = this.options.quoteRequestData.items) == null ? void 0 : s.find(
479
- (l) => (l.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(l) + 1}`) === d.cartItemId
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
+ }
480
558
  );
481
- return {
482
- quoteId: d.id,
483
- productPrice: (b == null ? void 0 : b.productPrice) || d.spotPrice,
484
- cartItemId: d.cartItemId
485
- };
486
- })), this.options.callbacks.onOptIn(h);
559
+ }
560
+ this.options.callbacks.onOptIn(f);
487
561
  }
488
- if (p === "no" && ((g = this.options.callbacks) != null && g.onOptOut)) {
489
- const h = {
562
+ if (s === "no" && ((b = this.options.callbacks) != null && b.onOptOut)) {
563
+ const f = {
490
564
  status: "QUOTE_DECLINED",
491
565
  quoteId: this.quote.id
492
566
  };
493
- this.quote.originalQuotes && this.quote.originalQuotes.length > 0 && (h.batchQuoteDetails = this.quote.originalQuotes.map((d) => {
494
- var s;
495
- const b = (s = this.options.quoteRequestData.items) == null ? void 0 : s.find(
496
- (l) => (l.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(l) + 1}`) === d.cartItemId
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
+ }
497
581
  );
498
- return {
499
- quoteId: d.id,
500
- productPrice: (b == null ? void 0 : b.productPrice) || d.spotPrice,
501
- cartItemId: d.cartItemId
502
- };
503
- })), this.options.callbacks.onOptOut(h);
582
+ }
583
+ this.options.callbacks.onOptOut(f);
504
584
  }
505
585
  });
506
586
  });
507
587
  }
508
588
  showSelectionError() {
509
- var e;
589
+ var t;
510
590
  if (!this.errorEl) {
511
591
  this.errorEl = document.createElement("div"), this.errorEl.className = "spot-selection__error", this.errorEl.textContent = "Please make a selection";
512
- const o = (e = this.container) == null ? void 0 : e.querySelector(
592
+ const e = (t = this.container) == null ? void 0 : t.querySelector(
513
593
  ".spot-selection__options"
514
594
  );
515
- o && o.insertAdjacentElement("afterend", this.errorEl);
595
+ e && e.insertAdjacentElement("afterend", this.errorEl);
516
596
  }
517
597
  this.errorEl.style.display = "block";
518
598
  }
@@ -521,61 +601,74 @@ class L {
521
601
  }
522
602
  validateSelection() {
523
603
  if (!this.container) return !1;
524
- const e = !!this.container.querySelector(
604
+ const t = !!this.container.querySelector(
525
605
  'input[name="selection"]:checked'
526
606
  );
527
- return e ? this.hideSelectionError() : this.showSelectionError(), e;
607
+ return t ? this.hideSelectionError() : this.showSelectionError(), t;
528
608
  }
529
- async updateQuote(e) {
530
- var o, n, t;
609
+ async updateQuote(t) {
610
+ var e, r, n, o;
531
611
  try {
532
- const r = {
612
+ const p = {
533
613
  ...this.options,
534
- quoteRequestData: e
614
+ quoteRequestData: t
535
615
  };
536
- k(r);
616
+ T(p);
537
617
  const {
538
- environment: p,
539
- partnerId: i,
540
- endpoint: u
541
- } = this.options.apiConfig, g = u || T[p], d = r.quoteRequestData.cartInfo && r.quoteRequestData.items ? await D(g, i, r.quoteRequestData) : await I(g, i, r.quoteRequestData);
542
- return d.status !== "QUOTE_AVAILABLE" ? (d.status === "NO_MATCHING_QUOTE" && ((o = this.options.callbacks) != null && o.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
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
629
+ );
630
+ return g.status !== "QUOTE_AVAILABLE" ? (g.status === "NO_MATCHING_QUOTE" && ((e = this.options.callbacks) != null && e.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
543
631
  status: "NO_MATCHING_QUOTE",
544
- data: r.quoteRequestData
545
- }), !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);
546
- } catch (r) {
547
- return (t = this.options.callbacks) == null || t.onError({
548
- message: r.message,
549
- status: r.status,
550
- 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
551
640
  }), !1;
552
641
  }
553
642
  }
554
643
  getSelection() {
555
- var o, n, t;
644
+ var e, r, n;
556
645
  if (this.currentSelection == null) return null;
557
- const e = {
646
+ const t = {
558
647
  selection: this.currentSelection,
559
- quoteId: (o = this.quote) == null ? void 0 : o.id,
560
- spotPrice: (n = this.quote) == null ? void 0 : n.spotPrice,
648
+ quoteId: (e = this.quote) == null ? void 0 : e.id,
649
+ spotPrice: (r = this.quote) == null ? void 0 : r.spotPrice,
561
650
  status: this.currentSelection === "yes" ? "QUOTE_ACCEPTED" : "QUOTE_DECLINED"
562
651
  };
563
- return (t = this.quote) != null && t.originalQuotes && this.quote.originalQuotes.length > 0 && (e.batchQuoteDetails = this.quote.originalQuotes.map((r) => {
564
- var i;
565
- const p = (i = this.options.quoteRequestData.items) == null ? void 0 : i.find(
566
- (u) => (u.cartItemId || `item-${this.options.quoteRequestData.items.indexOf(u) + 1}`) === r.cartItemId
567
- );
568
- return {
569
- quoteId: r.id,
570
- productPrice: (p == null ? void 0 : p.productPrice) || r.spotPrice,
571
- cartItemId: r.cartItemId
572
- };
573
- })), e;
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;
574
667
  }
575
668
  destroy() {
576
669
  window.removeEventListener("resize", this._onResize), this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container);
577
670
  }
578
671
  }
579
672
  export {
580
- L as default
673
+ V as default
581
674
  };