@getspot/spot-widget 1.3.0 → 1.4.0

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