@getspot/spot-widget 4.4.0 → 4.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## [4.4.2](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.4.1...@getspot/spot-widget@4.4.2) (2026-08-05)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **core:** stop the covered-items toggle submitting the host form ([273fe9a](https://gitlab.com/getspot/spot-widget/commit/273fe9a5349bd0382efc581b99405b90a5618597))
7
+
8
+ ## [4.4.1](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.4.0...@getspot/spot-widget@4.4.1) (2026-07-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **core:** prevent duplicate widget render when unmounted mid-init ([5e16427](https://gitlab.com/getspot/spot-widget/commit/5e1642796b42b8fb6b7937616ba74454e63e3eac))
14
+
1
15
  # [4.4.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.3.1...@getspot/spot-widget@4.4.0) (2026-07-10)
2
16
 
3
17
 
package/dist/index.d.ts CHANGED
@@ -11,6 +11,7 @@ declare class SpotWidget {
11
11
  private _stateSelectEl?;
12
12
  private _onResize;
13
13
  private _resizeObserver?;
14
+ private _destroyed;
14
15
  constructor(options?: Partial<SpotWidgetOptions>);
15
16
  private _init;
16
17
  private _renderWidget;
@@ -33,6 +34,7 @@ declare class SpotWidget {
33
34
  updateQuote(newQuoteRequestData: SpotWidgetOptions["quoteRequestData"]): Promise<boolean>;
34
35
  getSelection(): SelectionData | null;
35
36
  destroy(): void;
37
+ private _teardownDom;
36
38
  }
37
39
  export default SpotWidget;
38
40
  export { SelectionEnum } from "./types.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EAKnB,MAAM,YAAY,CAAC;AAkBpB,cAAM,UAAU;IACd,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,cAAc,CAAC,CAAc;IACrC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAE7B,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM;YAuBtC,KAAK;IAoGnB,OAAO,CAAC,aAAa;IA0ErB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,uBAAuB;IAqC/B,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,cAAc,CAAC,CAAS;IAEhC,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,2BAA2B;IAWnC,OAAO,CAAC,qBAAqB;IA6F7B,kBAAkB,IAAI,IAAI;IAgB1B,kBAAkB,IAAI,IAAI;IAM1B,iBAAiB,IAAI,OAAO;IAgBtB,WAAW,CACf,mBAAmB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,GACzD,OAAO,CAAC,OAAO,CAAC;IAsEnB,YAAY,IAAI,aAAa,GAAG,IAAI;IAgCpC,OAAO,IAAI,IAAI;CAahB;AAED,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,KAAK,EACL,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,SAAS,EACT,KAAK,GACN,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EAKnB,MAAM,YAAY,CAAC;AAkBpB,cAAM,UAAU;IACd,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,cAAc,CAAC,CAAc;IACrC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAiB;IACzC,OAAO,CAAC,UAAU,CAAS;gBAEf,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM;YAuBtC,KAAK;IA4GnB,OAAO,CAAC,aAAa;IA0ErB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,uBAAuB;IAqC/B,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,cAAc,CAAC,CAAS;IAEhC,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,sBAAsB;IAW9B,OAAO,CAAC,2BAA2B;IAWnC,OAAO,CAAC,qBAAqB;IA6F7B,kBAAkB,IAAI,IAAI;IAgB1B,kBAAkB,IAAI,IAAI;IAM1B,iBAAiB,IAAI,OAAO;IAgBtB,WAAW,CACf,mBAAmB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,GACzD,OAAO,CAAC,OAAO,CAAC;IA8EnB,YAAY,IAAI,aAAa,GAAG,IAAI;IAgCpC,OAAO,IAAI,IAAI;IAQf,OAAO,CAAC,YAAY;CAarB;AAED,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,KAAK,EACL,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,SAAS,EACT,KAAK,GACN,MAAM,YAAY,CAAC"}
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
- async function T(c, t, r, s) {
1
+ async function T(d, t, r, s) {
2
2
  try {
3
- const i = s ? { ...r, state: s } : r, a = await fetch(c, {
3
+ const i = s ? { ...r, state: s } : r, a = await fetch(d, {
4
4
  method: "POST",
5
5
  headers: {
6
6
  "Content-Type": "application/json",
@@ -17,9 +17,9 @@ async function T(c, t, r, s) {
17
17
  throw i instanceof Error ? i : new Error("Unknown error occurred while fetching quote");
18
18
  }
19
19
  }
20
- async function z(c, t, r) {
20
+ async function z(d, t, r) {
21
21
  try {
22
- const s = c.replace("/quote", "/quote/batch"), i = await fetch(s, {
22
+ const s = d.replace("/quote", "/quote/batch"), i = await fetch(s, {
23
23
  method: "POST",
24
24
  headers: {
25
25
  "Content-Type": "application/json",
@@ -36,7 +36,7 @@ async function z(c, t, r) {
36
36
  throw s instanceof Error ? s : new Error("Unknown error occurred while fetching batch quote");
37
37
  }
38
38
  }
39
- async function N(c, t, r, s) {
39
+ async function N(d, t, r, s) {
40
40
  var i;
41
41
  try {
42
42
  const a = {
@@ -48,7 +48,7 @@ async function N(c, t, r, s) {
48
48
  ...m,
49
49
  cartItemId: m.cartItemId || `item-${f + 1}`
50
50
  }))
51
- }, e = await z(c, t, a);
51
+ }, e = await z(d, t, a);
52
52
  if (e.status !== "QUOTES_AVAILABLE" && e.status !== "QUOTE_AVAILABLE")
53
53
  return { status: "NO_MATCHING_QUOTE" };
54
54
  const o = e.quotes.map((m) => {
@@ -141,7 +141,7 @@ const E = "non-us-resident", A = "Unfortunately, we are currently unable to offe
141
141
  { value: "WV", label: "West Virginia" },
142
142
  { value: "WI", label: "Wisconsin" },
143
143
  { value: "WY", label: "Wyoming" }
144
- ], O = new Set(L.map((c) => c.value)), I = [
144
+ ], O = new Set(L.map((d) => d.value)), I = [
145
145
  "USD",
146
146
  "CAD",
147
147
  "AUD",
@@ -170,14 +170,14 @@ const E = "non-us-resident", A = "Unfortunately, we are currently unable to offe
170
170
  production: "https://api.getspot.com/v1/quote",
171
171
  local: "http://localhost:3999/api/v1/quote"
172
172
  };
173
- function M(c) {
173
+ function M(d) {
174
174
  const {
175
175
  apiConfig: t = {},
176
176
  quoteRequestData: r,
177
177
  callbacks: s = {},
178
178
  location: i,
179
179
  theme: a
180
- } = c, {
180
+ } = d, {
181
181
  environment: e = "sandbox",
182
182
  partnerId: o,
183
183
  customEndpoint: p
@@ -201,50 +201,50 @@ function M(c) {
201
201
  "productName"
202
202
  ];
203
203
  function v(l, u = null) {
204
- const d = u !== null ? `quoteRequestData[${u}]` : "quoteRequestData";
204
+ const c = u !== null ? `quoteRequestData[${u}]` : "quoteRequestData";
205
205
  f.forEach((g) => {
206
206
  if (!Object.prototype.hasOwnProperty.call(l, g) || l[g] === void 0 || l[g] === null)
207
- throw new Error(`Missing required ${d} field: '${g}'`);
207
+ throw new Error(`Missing required ${c} field: '${g}'`);
208
208
  });
209
209
  const b = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;
210
210
  if (!b.test(l.startDate))
211
- throw new Error(`${d}.startDate must be a valid ISO8601 string`);
211
+ throw new Error(`${c}.startDate must be a valid ISO8601 string`);
212
212
  if (!b.test(l.endDate))
213
- throw new Error(`${d}.endDate must be a valid ISO8601 string`);
213
+ throw new Error(`${c}.endDate must be a valid ISO8601 string`);
214
214
  if (typeof l.currencyCode != "string")
215
- throw new Error(`${d}.currencyCode must be a string`);
215
+ throw new Error(`${c}.currencyCode must be a string`);
216
216
  if (!I.includes(l.currencyCode))
217
- throw new Error(`Invalid ${d}.currencyCode: ${l.currencyCode}`);
217
+ throw new Error(`Invalid ${c}.currencyCode: ${l.currencyCode}`);
218
218
  if (typeof l.eventType != "string")
219
- throw new Error(`${d}.eventType must be a string`);
219
+ throw new Error(`${c}.eventType must be a string`);
220
220
  if (typeof l.productType != "string")
221
- throw new Error(`${d}.productType must be a string`);
221
+ throw new Error(`${c}.productType must be a string`);
222
222
  const w = ["Pass", "Trip", "Registration"];
223
223
  if (!w.includes(l.productType))
224
224
  throw new Error(
225
- `${d}.productType must be one of ${w.join(", ")}`
225
+ `${c}.productType must be one of ${w.join(", ")}`
226
226
  );
227
227
  if (typeof l.productDuration != "string")
228
- throw new Error(`${d}.productDuration must be a string`);
228
+ throw new Error(`${c}.productDuration must be a string`);
229
229
  const C = ["Daily", "Seasonal", "Trip", "Event"];
230
230
  if (!C.includes(l.productDuration))
231
231
  throw new Error(
232
- `${d}.productDuration must be one of ${C.join(", ")}`
232
+ `${c}.productDuration must be one of ${C.join(", ")}`
233
233
  );
234
234
  if (typeof l.productPrice != "number" || isNaN(l.productPrice))
235
- throw new Error(`${d}.productPrice must be a valid number`);
235
+ throw new Error(`${c}.productPrice must be a valid number`);
236
236
  if (typeof l.productId != "string")
237
- throw new Error(`${d}.productId must be a string`);
237
+ throw new Error(`${c}.productId must be a string`);
238
238
  if (typeof l.cartId != "string")
239
- throw new Error(`${d}.cartId must be a string`);
239
+ throw new Error(`${c}.cartId must be a string`);
240
240
  if (typeof l.productName != "string")
241
- throw new Error(`${d}.productName must be a string`);
241
+ throw new Error(`${c}.productName must be a string`);
242
242
  }
243
243
  if ("items" in r) {
244
- const l = r, { cartId: u, cartName: d, currencyCode: b, items: w } = l;
244
+ const l = r, { cartId: u, cartName: c, currencyCode: b, items: w } = l;
245
245
  if (!u || typeof u != "string")
246
246
  throw new Error("quoteRequestData.cartId must be a string");
247
- if (!d || typeof d != "string")
247
+ if (!c || typeof c != "string")
248
248
  throw new Error("quoteRequestData.cartName must be a string");
249
249
  if (!b || typeof b != "string")
250
250
  throw new Error("quoteRequestData.currencyCode must be a string");
@@ -320,29 +320,29 @@ function M(c) {
320
320
  throw new Error(
321
321
  "Theme must be an object with CSS variables, do not include the '--' prefix"
322
322
  );
323
- if (c.state && !O.has(c.state))
324
- throw new Error(`Invalid state: '${c.state}'. Must be a 2-character US state or territory code.`);
323
+ if (d.state && !O.has(d.state))
324
+ throw new Error(`Invalid state: '${d.state}'. Must be a 2-character US state or territory code.`);
325
325
  }
326
- var _ = /* @__PURE__ */ ((c) => (c.YES = "yes", c.NO = "no", c.UNSELECTED = "unselected", c))(_ || {});
327
- function n(c, { text: t, className: r, parent: s, innerHTML: i, href: a, target: e } = {}) {
328
- const o = document.createElement(c);
326
+ var _ = /* @__PURE__ */ ((d) => (d.YES = "yes", d.NO = "no", d.UNSELECTED = "unselected", d))(_ || {});
327
+ function n(d, { text: t, className: r, parent: s, innerHTML: i, href: a, target: e } = {}) {
328
+ const o = document.createElement(d);
329
329
  return r && (o.className = r), t != null && (o.textContent = t), i != null && (o.innerHTML = i), a && "href" in o && (o.href = a), e && "target" in o && (o.target = e), s && s.appendChild(o), o;
330
330
  }
331
- function $(c, { name: t, description: r }) {
331
+ function $(d, { name: t, description: r }) {
332
332
  n("div", {
333
333
  className: "spot-header__title",
334
334
  text: t,
335
- parent: c
335
+ parent: d
336
336
  }), n("div", {
337
337
  className: "spot-header__description",
338
338
  text: r,
339
- parent: c
339
+ parent: d
340
340
  });
341
341
  }
342
- function V(c, t = []) {
342
+ function V(d, t = []) {
343
343
  const r = n("ul", {
344
344
  className: "spot-benefits__list",
345
- parent: c
345
+ parent: d
346
346
  });
347
347
  t.forEach((s) => {
348
348
  const i = n("li", { parent: r });
@@ -353,11 +353,11 @@ function V(c, t = []) {
353
353
  </svg>`, n("span", { text: s, parent: i });
354
354
  });
355
355
  }
356
- function Q(c, t = []) {
356
+ function Q(d, t = []) {
357
357
  if (!t || t.length === 0) return;
358
358
  const r = n("div", {
359
359
  className: "spot-qualifying-reasons__container",
360
- parent: c
360
+ parent: d
361
361
  }), s = [...t].sort((o, p) => o.rank - p.rank), i = n("div", {
362
362
  className: "spot-qualifying-reasons__grid",
363
363
  parent: r
@@ -405,7 +405,7 @@ function Q(c, t = []) {
405
405
  });
406
406
  });
407
407
  }
408
- function U(c, t = [], r) {
408
+ function U(d, t = [], r) {
409
409
  if (t.length === 0 || !r || r <= 1)
410
410
  return;
411
411
  const s = /* @__PURE__ */ new Map();
@@ -413,17 +413,17 @@ function U(c, t = [], r) {
413
413
  s.set(u, (s.get(u) || 0) + 1);
414
414
  });
415
415
  const a = Array.from(s.entries()).map(
416
- ([u, d]) => ({
416
+ ([u, c]) => ({
417
417
  item: u,
418
- count: d,
419
- displayText: d > 1 ? `${d} x ${u}` : u
418
+ count: c,
419
+ displayText: c > 1 ? `${c} x ${u}` : u
420
420
  })
421
- ).sort((u, d) => {
422
- const b = u.item.charAt(0), w = d.item.charAt(0), C = /[a-zA-Z]/.test(b), g = /[a-zA-Z]/.test(w);
423
- return !C && g ? -1 : C && !g ? 1 : u.item.localeCompare(d.item, void 0, { sensitivity: "base" });
421
+ ).sort((u, c) => {
422
+ const b = u.item.charAt(0), w = c.item.charAt(0), C = /[a-zA-Z]/.test(b), g = /[a-zA-Z]/.test(w);
423
+ return !C && g ? -1 : C && !g ? 1 : u.item.localeCompare(c.item, void 0, { sensitivity: "base" });
424
424
  }), e = n("div", {
425
425
  className: "spot-covered-items__container",
426
- parent: c
426
+ parent: d
427
427
  }), o = n("div", {
428
428
  className: "spot-covered-items__header",
429
429
  parent: e
@@ -431,7 +431,7 @@ function U(c, t = [], r) {
431
431
  className: "spot-covered-items__toggle",
432
432
  parent: o
433
433
  });
434
- n("span", {
434
+ p.type = "button", n("span", {
435
435
  className: "spot-covered-items__title",
436
436
  text: `Items Covered in Your Cart (${t.length})`,
437
437
  parent: p
@@ -457,12 +457,12 @@ function U(c, t = [], r) {
457
457
  parent: v
458
458
  });
459
459
  a.forEach(({ displayText: u }) => {
460
- const d = n("li", { parent: h });
461
- n("span", { text: u, parent: d });
460
+ const c = n("li", { parent: h });
461
+ n("span", { text: u, parent: c });
462
462
  });
463
463
  let l = !1;
464
464
  v.style.display = "none", p.addEventListener("click", (u) => {
465
- u.stopPropagation(), l = !l, v.style.display = l ? "block" : "none", f.innerHTML = l ? "▲" : "▼", p.setAttribute("aria-expanded", l.toString());
465
+ u.stopPropagation(), u.preventDefault(), l = !l, v.style.display = l ? "block" : "none", f.innerHTML = l ? "▲" : "▼", p.setAttribute("aria-expanded", l.toString());
466
466
  }), p.setAttribute("aria-expanded", "false"), p.setAttribute("aria-controls", "covered-items-list"), v.setAttribute("id", "covered-items-list");
467
467
  }
468
468
  const Z = {
@@ -490,10 +490,10 @@ const Z = {
490
490
  THB: "THB ฿",
491
491
  ZAR: "ZAR R"
492
492
  };
493
- function B(c, t = [], r = "USD") {
493
+ function B(d, t = [], r = "USD") {
494
494
  const s = Z[r] ?? `${r} `, i = n("div", {
495
495
  className: "spot-table__container",
496
- parent: c
496
+ parent: d
497
497
  }), a = n("table", {
498
498
  className: "spot-refund__table spot-table--dynamic",
499
499
  parent: i
@@ -507,10 +507,10 @@ function B(c, t = [], r = "USD") {
507
507
  n("td", { text: l, parent: h });
508
508
  });
509
509
  }
510
- function j(c, t) {
510
+ function j(d, t) {
511
511
  const r = n("div", {
512
512
  className: "spot-state-dropdown__wrapper",
513
- parent: c
513
+ parent: d
514
514
  });
515
515
  n("label", {
516
516
  className: "spot-state-dropdown__label",
@@ -540,10 +540,10 @@ function j(c, t) {
540
540
  parent: r
541
541
  }), s;
542
542
  }
543
- function F(c, t, r, s = !1) {
543
+ function F(d, t, r, s = !1) {
544
544
  const i = n("div", {
545
545
  className: `spot-selection__options${s ? " spot-selection__options--disabled" : ""}`,
546
- parent: c
546
+ parent: d
547
547
  }), a = n("label", {
548
548
  className: `spot-selection__option ${t === _.YES ? "selected" : ""}`,
549
549
  parent: i
@@ -562,13 +562,13 @@ function F(c, t, r, s = !1) {
562
562
  }), p = n("input", { parent: o });
563
563
  return p.type = "radio", p.name = "selection", p.value = _.NO, t === _.NO && (p.checked = !0), s && (p.disabled = !0), n("span", { text: r.noOptionText, parent: o }), i;
564
564
  }
565
- function H(c, t) {
565
+ function H(d, t) {
566
566
  var s;
567
567
  const r = (s = t.communication) == null ? void 0 : s.paymentTerms;
568
568
  if (r) {
569
569
  const i = n("div", {
570
570
  className: "spot-payment-terms",
571
- parent: c
571
+ parent: d
572
572
  });
573
573
  return n("div", {
574
574
  className: "spot-payment-terms__header",
@@ -581,11 +581,11 @@ function H(c, t) {
581
581
  }), i;
582
582
  }
583
583
  }
584
- function W(c, t, r = "bottom-right") {
584
+ function W(d, t, r = "bottom-right") {
585
585
  if (r === "top-right") {
586
586
  const o = n("div", {
587
587
  className: "spot-logo__top-right",
588
- parent: c
588
+ parent: d
589
589
  });
590
590
  o.innerHTML = `
591
591
  <svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
@@ -606,7 +606,7 @@ function W(c, t, r = "bottom-right") {
606
606
  }
607
607
  const s = n("div", {
608
608
  className: "spot-footer__container",
609
- parent: c
609
+ parent: d
610
610
  }), i = n("div", {
611
611
  className: "spot-footer__terms",
612
612
  parent: s
@@ -642,9 +642,9 @@ function W(c, t, r = "bottom-right") {
642
642
  return s;
643
643
  }
644
644
  const Y = ":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-border-line-width: .0625rem;--spot-border-color: #e0e0e0;--spot-max-width: 51rem;--spot-margin: 1rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-bullets-checkmark-color: #2e2e2e;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-state-dropdown-label-font-size: .875rem;--spot-state-dropdown-label-font-weight: 600;--spot-state-dropdown-label-margin-bottom: .25rem;--spot-state-dropdown-select-border: .0625rem solid #e0e0e0;--spot-state-dropdown-select-border-radius: .375rem;--spot-state-dropdown-select-padding: .5rem .75rem;--spot-state-dropdown-select-font-size: .875rem;--spot-state-dropdown-select-background: #ffffff;--spot-state-dropdown-wrapper-margin-bottom: .75rem;--spot-state-dropdown-error-color: var(--spot-selection-error-font-color);--spot-state-dropdown-error-font-size: .8125rem;--spot-state-dropdown-error-margin-top: .25rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-covered-items-background: #f1f3f5;--spot-covered-items-hover-background: #e9ecef;--spot-covered-items-border-radius: .5rem;--spot-covered-items-padding: .75rem 1rem;--spot-covered-items-font-size: .875rem;--spot-covered-items-font-weight: 400;--spot-covered-items-font-color: #000000;--spot-covered-items-font-family: Arial;--spot-covered-items-arrow-font-size: .6rem;--spot-covered-items-arrow-color: #636569;--spot-covered-items-view-all-color: #636569;--spot-covered-items-view-all-font-size: .875rem;--spot-covered-items-view-all-font-weight: 400;--spot-covered-items-content-background: #f8f9fa;--spot-covered-items-content-border: 1px solid #e0e0e0;--spot-covered-items-content-border-radius: .5rem;--spot-covered-items-content-padding: .75rem 1rem;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 1.5rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:var(--spot-border-line-width) solid var(--spot-border-color);border-radius:var(--spot-border-radius);max-width:var(--spot-max-width);margin:var(--spot-margin);container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__wrapper{min-width:0;word-wrap:normal}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container{grid-row:1;margin-bottom:var(--spot-benefits-margin-bottom)}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1;margin-bottom:var(--spot-covered-items-margin-bottom)}.desktop-layout .spot-selection__wrapper{grid-row:3;grid-column:1;margin-top:var(--spot-desktop-radio-margin-top)}.desktop-layout .spot-payment-terms__wrapper{grid-row:4;grid-column:1;margin-top:var(--spot-payment-terms-margin-top)}.desktop-layout .spot-table__container{grid-row:1 / span 4;grid-column:2;width:auto;min-width:20.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-table__container{display:flex;justify-content:flex-start;margin-top:1rem;margin-bottom:1rem;box-sizing:border-box;padding:0 .3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-refund__table{width:100%;max-width:22rem;table-layout:auto}@media (max-width: 850px){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 500px){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 600px){.spot-refund__table th{padding:0rem}}.spot-benefits__list{list-style-type:none;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-benefits__list li{margin-bottom:.375rem;display:flex;align-items:flex-start;gap:.5rem}.spot-benefits__list li svg{flex-shrink:0;position:relative;top:.125rem}.spot-bullets__checkmark path{stroke:var(--spot-bullets-checkmark-color)}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:.85rem;margin-bottom:.5rem;max-width:26rem}.spot-content__wrapper.desktop-layout:has(.spot-table__container) .spot-covered-items__container{margin-top:0rem;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-covered-items__list li:last-child{margin-bottom:0}.spot-covered-items__header{margin-bottom:.5rem}.spot-covered-items__toggle{background:var(--spot-covered-items-background);border:none;border-radius:var(--spot-covered-items-border-radius);padding:var(--spot-covered-items-padding);cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;transition:all .2s ease}.spot-covered-items__toggle:hover{background-color:var(--spot-covered-items-hover-background)}.spot-covered-items__toggle:focus{outline:none;box-shadow:0 0 0 2px #0000001a}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;margin:0;padding:0}.spot-covered-items__right-section{display:flex;align-items:center;gap:.5rem;margin-left:auto}.spot-covered-items__view-all{font-size:var(--spot-covered-items-view-all-font-size);font-weight:var(--spot-covered-items-view-all-font-weight);color:var(--spot-covered-items-view-all-color);font-family:var(--spot-covered-items-font-family);line-height:125%}.spot-covered-items__arrow{font-size:var(--spot-covered-items-arrow-font-size);transition:transform .2s ease;color:var(--spot-covered-items-arrow-color);flex-shrink:0;transform:scaleX(1.5)}.spot-covered-items__content{margin-top:.5rem;transition:all .2s ease;overflow:hidden}.spot-covered-items__list{background-color:var(--spot-covered-items-content-background);border:var(--spot-covered-items-content-border);border-radius:var(--spot-covered-items-content-border-radius);margin:0;padding:var(--spot-covered-items-content-padding)}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}.spot-state-dropdown__wrapper{display:flex;flex-direction:column;margin-bottom:var(--spot-state-dropdown-wrapper-margin-bottom)}.spot-state-dropdown__label{font-size:var(--spot-state-dropdown-label-font-size);font-weight:var(--spot-state-dropdown-label-font-weight);font-family:var(--spot-font-family);color:var(--spot-font-color);margin-bottom:var(--spot-state-dropdown-label-margin-bottom)}.spot-state-dropdown__select{width:100%;box-sizing:border-box;border:var(--spot-state-dropdown-select-border);border-radius:var(--spot-state-dropdown-select-border-radius);padding:var(--spot-state-dropdown-select-padding);font-size:var(--spot-state-dropdown-select-font-size);font-family:var(--spot-font-family);color:var(--spot-font-color);background-color:var(--spot-state-dropdown-select-background);cursor:pointer;-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.spot-state-dropdown__select:focus{outline:none;box-shadow:0 0 0 2px #00000026}.spot-state-dropdown__select--error{border-color:var(--spot-state-dropdown-error-color)}.spot-state-dropdown__select--error:focus{box-shadow:0 0 0 2px #ff000026}.spot-state-dropdown__error{display:none;color:var(--spot-state-dropdown-error-color);font-size:var(--spot-state-dropdown-error-font-size);font-family:var(--spot-font-family);margin-top:var(--spot-state-dropdown-error-margin-top)}.spot-state-dropdown__error--visible{display:block}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;min-width:.75rem;border:.0625rem solid var(--spot-radio-border);border-radius:var(--spot-radio-border-radius);margin-right:.5rem;position:relative;vertical-align:middle;top:-.0625rem;cursor:pointer;flex-shrink:0}input[type=radio]:checked{background:var(--spot-radio-checked-background);box-shadow:inset 0 0 0 .0625rem #fff}.spot-selection__options{display:flex;flex-direction:column;gap:.5rem}.spot-selection__option{display:flex;align-items:center;flex-wrap:nowrap;position:relative;transition:background .2s;cursor:pointer;font-size:var(--spot-radio-text-font-size);font-weight:var(--spot-radio-text-font-weight);color:var(--spot-radio-text-font-color);font-family:var(--spot-radio-text-font-family);padding:var(--spot-radio-text-padding);margin-right:.5rem}.spot-selection__option.selected{background:var(--spot-radio-selection-background);border-radius:var(--spot-radio-selection-border-radius);padding:var(--spot-radio-selection-padding)}.spot-selection__recommended-tag{background:var(--spot-recommended-tag-background);color:var(--spot-recommended-tag-font-color);font-size:var(--spot-recommended-tag-font-size);font-weight:var(--spot-recommended-tag-font-weight);padding:var(--spot-recommended-tag-padding);border-radius:var(--spot-recommended-tag-border-radius);margin-left:.75rem;white-space:nowrap;flex-shrink:0}@media (max-width: 850px){.spot-selection__recommended-tag{margin-left:.5rem}}@media (max-width: 600px){.spot-selection__recommended-tag{margin-left:.5rem;font-size:.75rem;padding:.1875rem .4375rem}}.spot-selection__error{color:var(--spot-selection-error-font-color);font-size:var(--spot-selection-error-font-size);padding:var(--spot-selection-error-padding);display:none}.spot-selection__options--disabled .spot-selection__option{opacity:.4;cursor:not-allowed;pointer-events:none}.spot-selection__options--disabled input[type=radio]{cursor:not-allowed}.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);color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);line-height:1.4;word-wrap:normal;-webkit-hyphens:none;hyphens:none;flex:1;min-width:0;overflow-wrap:normal}.spot-footer__terms-link{text-decoration:var(--spot-terms-link-text-decoration);font-size:var(--spot-terms-link-font-size);font-weight:var(--spot-terms-link-font-weight);color:var(--spot-terms-link-font-color);font-family:var(--spot-terms-link-font-family);padding:var(--spot-terms-link-padding)}.spot-footer__container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;flex-wrap:nowrap;gap:var(--spot-footer-gap)}@container (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}@media (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}.spot-footer__powered-by{margin-top:0;flex-shrink:0}.spot-logo__top-right{position:absolute;top:-14px;right:40px;z-index:10;background:linear-gradient(to bottom,transparent 50%,inherit 50%);padding:0 .25rem}.spot-logo__top-right svg{border-radius:1.25rem;border:var(--spot-border-line-width) solid var(--spot-border-color);display:block;background:var(--spot-background-color)}@container (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}@media (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}";
645
- function G(c) {
645
+ function G(d) {
646
646
  const t = document.createElement("style");
647
- t.textContent = c, document.head.appendChild(t);
647
+ t.textContent = d, document.head.appendChild(t);
648
648
  }
649
649
  G(Y);
650
650
  const R = {
@@ -654,7 +654,7 @@ const R = {
654
654
  };
655
655
  class K {
656
656
  constructor(t = {}) {
657
- this.options = {
657
+ this._destroyed = !1, this.options = {
658
658
  location: "body",
659
659
  showTable: !0,
660
660
  logoPosition: "bottom-right",
@@ -687,6 +687,7 @@ class K {
687
687
  this._validState()
688
688
  );
689
689
  }
690
+ if (this._destroyed) return;
690
691
  if (e.status !== "QUOTE_AVAILABLE") {
691
692
  e.status === "NO_MATCHING_QUOTE" && ((t = this.options.callbacks) != null && t.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
692
693
  status: "NO_MATCHING_QUOTE",
@@ -724,6 +725,7 @@ class K {
724
725
  o && this._applyQuoteUpdates(o);
725
726
  }
726
727
  } catch (e) {
728
+ if (this._destroyed) return;
727
729
  if ((i = this.options.callbacks) != null && i.onError) {
728
730
  const o = e;
729
731
  (a = this.options.callbacks) == null || a.onError({
@@ -805,7 +807,7 @@ class K {
805
807
  !this.quote || !this.container || (t.spotPriceWithFees !== void 0 && (this.quote.communication.yesOptionText = this.quote.communication.yesOptionText.replace(
806
808
  `$${this.quote.spotPrice.toFixed(2)}`,
807
809
  `$${t.spotPriceWithFees.toFixed(2)}`
808
- )), this.destroy(), this._renderWidget());
810
+ )), this._teardownDom(), this._renderWidget());
809
811
  }
810
812
  _isPassOrTrip() {
811
813
  const t = this.options.quoteRequestData;
@@ -870,13 +872,13 @@ class K {
870
872
  h.batchQuoteDetails = this.quote.originalQuotes.map(
871
873
  (u) => {
872
874
  var b;
873
- const d = (b = l.items) == null ? void 0 : b.find(
875
+ const c = (b = l.items) == null ? void 0 : b.find(
874
876
  (w) => (w.cartItemId || `item-${l.items.indexOf(w) + 1}`) === u.cartItemId
875
877
  );
876
878
  return {
877
879
  quoteId: u.id,
878
- productPrice: (d == null ? void 0 : d.productPrice) || u.spotPrice,
879
- cartItemId: (d == null ? void 0 : d.cartItemId) || ""
880
+ productPrice: (c == null ? void 0 : c.productPrice) || u.spotPrice,
881
+ cartItemId: (c == null ? void 0 : c.cartItemId) || ""
880
882
  };
881
883
  }
882
884
  );
@@ -894,13 +896,13 @@ class K {
894
896
  h.batchQuoteDetails = this.quote.originalQuotes.map(
895
897
  (u) => {
896
898
  var b;
897
- const d = (b = l.items) == null ? void 0 : b.find(
899
+ const c = (b = l.items) == null ? void 0 : b.find(
898
900
  (w) => (w.cartItemId || `item-${l.items.indexOf(w) + 1}`) === u.cartItemId
899
901
  );
900
902
  return {
901
903
  quoteId: u.id,
902
- productPrice: (d == null ? void 0 : d.productPrice) || u.spotPrice,
903
- cartItemId: (d == null ? void 0 : d.cartItemId) || ""
904
+ productPrice: (c == null ? void 0 : c.productPrice) || u.spotPrice,
905
+ cartItemId: (c == null ? void 0 : c.cartItemId) || ""
904
906
  };
905
907
  }
906
908
  );
@@ -933,6 +935,7 @@ class K {
933
935
  }
934
936
  async updateQuote(t) {
935
937
  var r, s, i, a;
938
+ if (this._destroyed) return !1;
936
939
  try {
937
940
  const e = {
938
941
  ...this.options,
@@ -950,17 +953,19 @@ class K {
950
953
  e.quoteRequestData,
951
954
  this._validState()
952
955
  );
956
+ if (this._destroyed) return !1;
953
957
  if (h.status !== "QUOTE_AVAILABLE")
954
- return this.destroy(), h.status === "NO_MATCHING_QUOTE" && ((r = this.options.callbacks) != null && r.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
958
+ return this._teardownDom(), h.status === "NO_MATCHING_QUOTE" && ((r = this.options.callbacks) != null && r.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
955
959
  status: "NO_MATCHING_QUOTE",
956
960
  data: e.quoteRequestData
957
961
  }), !1;
958
- if (this.options.quoteRequestData = e.quoteRequestData, this.quote = h.data, this.destroy(), this._renderWidget(), (s = this.options.callbacks) != null && s.onQuoteRetrieved) {
962
+ if (this.options.quoteRequestData = e.quoteRequestData, this.quote = h.data, this._teardownDom(), this._renderWidget(), (s = this.options.callbacks) != null && s.onQuoteRetrieved) {
959
963
  const l = this.options.callbacks.onQuoteRetrieved(this.quote);
960
964
  l && this._applyQuoteUpdates(l);
961
965
  }
962
966
  return !0;
963
967
  } catch (e) {
968
+ if (this._destroyed) return !1;
964
969
  const o = e;
965
970
  return (a = (i = this.options.callbacks) == null ? void 0 : i.onError) == null || a.call(i, {
966
971
  message: o.message,
@@ -996,6 +1001,12 @@ class K {
996
1001
  return t;
997
1002
  }
998
1003
  destroy() {
1004
+ this._destroyed = !0, this._teardownDom();
1005
+ }
1006
+ // Detaches the rendered DOM and its listeners without marking the instance
1007
+ // as permanently destroyed. Used by destroy() and by internal re-renders
1008
+ // (updateQuote, quote updates) that tear down and rebuild the same instance.
1009
+ _teardownDom() {
999
1010
  window.removeEventListener("resize", this._onResize), this._resizeObserver && (this._resizeObserver.disconnect(), this._resizeObserver = void 0), this._resizeTimeout && window.clearTimeout(this._resizeTimeout), this.container && this.container.parentNode && this.container.parentNode.removeChild(this.container);
1000
1011
  }
1001
1012
  }
package/dist/index.umd.js CHANGED
@@ -1,8 +1,8 @@
1
- (function(C,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(C=typeof globalThis<"u"?globalThis:C||self,k(C.SpotWidget={}))})(this,function(C){"use strict";async function k(c,t,r,s){try{const i=s?{...r,state:s}:r,n=await fetch(c,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(i)}),e=await n.json();if(!n.ok){const o=new Error((e==null?void 0:e.message)||"Failed to fetch quote");throw o.status=n.status,o.responseBody=e,o}return e}catch(i){throw i instanceof Error?i:new Error("Unknown error occurred while fetching quote")}}async function z(c,t,r){try{const s=c.replace("/quote","/quote/batch"),i=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(r)}),n=await i.json();if(!i.ok){const e=new Error((n==null?void 0:n.message)||"Failed to fetch batch quote");throw e.status=i.status,e.responseBody=n,e}return n}catch(s){throw s instanceof Error?s:new Error("Unknown error occurred while fetching batch quote")}}async function S(c,t,r,s){var i;try{const n={...r,...s?{state:s}:{},isPartialPayment:r.isPartialPayment||!1,roundTo:r.roundTo||void 0,items:r.items.map((m,f)=>({...m,cartItemId:m.cartItemId||`item-${f+1}`}))},e=await z(c,t,n);if(e.status!=="QUOTES_AVAILABLE"&&e.status!=="QUOTE_AVAILABLE")return{status:"NO_MATCHING_QUOTE"};const o=e.quotes.map(m=>{const f=r.items.find((v,h)=>(v.cartItemId||`item-${h+1}`)===m.cartItemId);return f?f.participantDescription?`${f.productName} - ${f.participantDescription}`:f.productName:`Item ${m.id}`}),p=Math.round((e.totalSpotPrice||e.spotPrice||0)*100)/100;return{status:"QUOTE_AVAILABLE",data:{id:e.quotes?e.quotes.map(m=>m.id).join(","):((i=e.data)==null?void 0:i.id)||"",spotPrice:p,currencyCode:e.currencyCode||"",communication:{...e.communication,yesOptionText:e.communication.yesOptionText.replace(String(e.totalSpotPrice),String(p))},payoutSchedule:e.payoutSchedule.map(m=>({...m,amount:m.amount!==void 0?m.amount:0})),coveredItems:o,originalQuotes:e.quotes||(e.data?[e.data]:[])},spotPrice:p,coveredItems:o}}catch(n){throw n instanceof Error?n:new Error("Unknown error occurred while fetching multiple quotes")}}const E="non-us-resident",A="Unfortunately, we are currently unable to offer coverage or process claims for non-US residents.",T=[{value:"AL",label:"Alabama"},{value:"AK",label:"Alaska"},{value:"AS",label:"American Samoa"},{value:"AZ",label:"Arizona"},{value:"AR",label:"Arkansas"},{value:"CA",label:"California"},{value:"CO",label:"Colorado"},{value:"CT",label:"Connecticut"},{value:"DE",label:"Delaware"},{value:"DC",label:"District of Columbia"},{value:"FL",label:"Florida"},{value:"GA",label:"Georgia"},{value:"GU",label:"Guam"},{value:"HI",label:"Hawaii"},{value:"ID",label:"Idaho"},{value:"IL",label:"Illinois"},{value:"IN",label:"Indiana"},{value:"IA",label:"Iowa"},{value:"KS",label:"Kansas"},{value:"KY",label:"Kentucky"},{value:"LA",label:"Louisiana"},{value:"ME",label:"Maine"},{value:"MD",label:"Maryland"},{value:"MA",label:"Massachusetts"},{value:"MI",label:"Michigan"},{value:"MN",label:"Minnesota"},{value:"MS",label:"Mississippi"},{value:"MO",label:"Missouri"},{value:"MT",label:"Montana"},{value:"NE",label:"Nebraska"},{value:"NV",label:"Nevada"},{value:"NH",label:"New Hampshire"},{value:"NJ",label:"New Jersey"},{value:"NM",label:"New Mexico"},{value:"NY",label:"New York"},{value:"NC",label:"North Carolina"},{value:"ND",label:"North Dakota"},{value:"MP",label:"Northern Mariana Islands"},{value:"OH",label:"Ohio"},{value:"OK",label:"Oklahoma"},{value:"OR",label:"Oregon"},{value:"PA",label:"Pennsylvania"},{value:"PR",label:"Puerto Rico"},{value:"RI",label:"Rhode Island"},{value:"SC",label:"South Carolina"},{value:"SD",label:"South Dakota"},{value:"TN",label:"Tennessee"},{value:"TX",label:"Texas"},{value:"VI",label:"U.S. Virgin Islands"},{value:"UT",label:"Utah"},{value:"VT",label:"Vermont"},{value:"VA",label:"Virginia"},{value:"WA",label:"Washington"},{value:"WV",label:"West Virginia"},{value:"WI",label:"Wisconsin"},{value:"WY",label:"Wyoming"}],P=new Set(T.map(c=>c.value)),D=["USD","CAD","AUD","NZD","EUR","MXN","AED","GBP","MAD","SAR","BGN","BRL","CHF","DKK","INR","JPY","MYR","NOK","PLN","SEK","SGD","THB","ZAR"],$={sandbox:"https://api.sandbox.getspot.com/v1/quote",production:"https://api.getspot.com/v1/quote",local:"http://localhost:3999/api/v1/quote"};function N(c){const{apiConfig:t={},quoteRequestData:r,callbacks:s={},location:i,theme:n}=c,{environment:e="sandbox",partnerId:o,customEndpoint:p}=t;if(!o||typeof o!="string")throw new Error("Invalid or missing partnerId in apiConfig");if(!(p||$[e]))throw new Error(`Invalid environment in apiConfig: ${e}`);if(!r||typeof r!="object"&&!Array.isArray(r))throw new Error("quoteRequestData must be a non-null object or array");const f=["startDate","endDate","currencyCode","eventType","productType","productDuration","productPrice","productId","cartId","productName"];function v(l,u=null){const d=u!==null?`quoteRequestData[${u}]`:"quoteRequestData";f.forEach(g=>{if(!Object.prototype.hasOwnProperty.call(l,g)||l[g]===void 0||l[g]===null)throw new Error(`Missing required ${d} field: '${g}'`)});const _=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!_.test(l.startDate))throw new Error(`${d}.startDate must be a valid ISO8601 string`);if(!_.test(l.endDate))throw new Error(`${d}.endDate must be a valid ISO8601 string`);if(typeof l.currencyCode!="string")throw new Error(`${d}.currencyCode must be a string`);if(!D.includes(l.currencyCode))throw new Error(`Invalid ${d}.currencyCode: ${l.currencyCode}`);if(typeof l.eventType!="string")throw new Error(`${d}.eventType must be a string`);if(typeof l.productType!="string")throw new Error(`${d}.productType must be a string`);const w=["Pass","Trip","Registration"];if(!w.includes(l.productType))throw new Error(`${d}.productType must be one of ${w.join(", ")}`);if(typeof l.productDuration!="string")throw new Error(`${d}.productDuration must be a string`);const q=["Daily","Seasonal","Trip","Event"];if(!q.includes(l.productDuration))throw new Error(`${d}.productDuration must be one of ${q.join(", ")}`);if(typeof l.productPrice!="number"||isNaN(l.productPrice))throw new Error(`${d}.productPrice must be a valid number`);if(typeof l.productId!="string")throw new Error(`${d}.productId must be a string`);if(typeof l.cartId!="string")throw new Error(`${d}.cartId must be a string`);if(typeof l.productName!="string")throw new Error(`${d}.productName must be a string`)}if("items"in r){const l=r,{cartId:u,cartName:d,currencyCode:_,items:w}=l;if(!u||typeof u!="string")throw new Error("quoteRequestData.cartId must be a string");if(!d||typeof d!="string")throw new Error("quoteRequestData.cartName must be a string");if(!_||typeof _!="string")throw new Error("quoteRequestData.currencyCode must be a string");if(!D.includes(_))throw new Error(`Invalid quoteRequestData.currencyCode: ${_}`);if(!Array.isArray(w)||w.length===0)throw new Error("quoteRequestData.items must be a non-empty array");const q=["startDate","endDate","eventType","productType","productDuration","productPrice","productId","productName"];w.forEach((g,H)=>{if(!g||typeof g!="object")throw new Error(`quoteRequestData.items[${H}] must be a non-null object`);const y=`quoteRequestData.items[${H}]`;q.forEach(x=>{if(!Object.prototype.hasOwnProperty.call(g,x)||g[x]===void 0||g[x]===null)throw new Error(`Missing required ${y} field: '${x}'`)});const R=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!R.test(g.startDate))throw new Error(`${y}.startDate must be a valid ISO8601 string`);if(!R.test(g.endDate))throw new Error(`${y}.endDate must be a valid ISO8601 string`);if(typeof g.eventType!="string")throw new Error(`${y}.eventType must be a string`);if(typeof g.productType!="string")throw new Error(`${y}.productType must be a string`);const L=["Pass","Trip","Registration"];if(!L.includes(g.productType))throw new Error(`${y}.productType must be one of ${L.join(", ")}`);if(typeof g.productDuration!="string")throw new Error(`${y}.productDuration must be a string`);const O=["Daily","Seasonal","Trip","Event"];if(!O.includes(g.productDuration))throw new Error(`${y}.productDuration must be one of ${O.join(", ")}`);if(typeof g.productPrice!="number"||isNaN(g.productPrice))throw new Error(`${y}.productPrice must be a valid number`);if(typeof g.productId!="string")throw new Error(`${y}.productId must be a string`);if(typeof g.productName!="string")throw new Error(`${y}.productName must be a string`)})}else if(Array.isArray(r)){if(r.length===0)throw new Error("quoteRequestData array cannot be empty");r.forEach((l,u)=>{if(!l||typeof l!="object")throw new Error(`quoteRequestData[${u}] must be a non-null object`);v(l,u)})}else v(r);if(["onOptIn","onOptOut","onQuoteRetrieved","onError","noMatchingQuote"].forEach(l=>{const u=s[l];if(u&&typeof u!="function")throw new Error(`Callback '${l}' must be a function.`)}),typeof i=="string"&&!document.querySelector(i))throw new Error(`Invalid location selector: '${i}'`);if(n&&typeof n!="object")throw new Error("Theme must be an object with CSS variables, do not include the '--' prefix");if(c.state&&!P.has(c.state))throw new Error(`Invalid state: '${c.state}'. Must be a 2-character US state or territory code.`)}var b=(c=>(c.YES="yes",c.NO="no",c.UNSELECTED="unselected",c))(b||{});function a(c,{text:t,className:r,parent:s,innerHTML:i,href:n,target:e}={}){const o=document.createElement(c);return r&&(o.className=r),t!=null&&(o.textContent=t),i!=null&&(o.innerHTML=i),n&&"href"in o&&(o.href=n),e&&"target"in o&&(o.target=e),s&&s.appendChild(o),o}function V(c,{name:t,description:r}){a("div",{className:"spot-header__title",text:t,parent:c}),a("div",{className:"spot-header__description",text:r,parent:c})}function U(c,t=[]){const r=a("ul",{className:"spot-benefits__list",parent:c});t.forEach(s=>{const i=a("li",{parent:r});i.innerHTML=`
1
+ (function(C,k){typeof exports=="object"&&typeof module<"u"?k(exports):typeof define=="function"&&define.amd?define(["exports"],k):(C=typeof globalThis<"u"?globalThis:C||self,k(C.SpotWidget={}))})(this,function(C){"use strict";async function k(d,t,r,s){try{const i=s?{...r,state:s}:r,n=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(i)}),e=await n.json();if(!n.ok){const o=new Error((e==null?void 0:e.message)||"Failed to fetch quote");throw o.status=n.status,o.responseBody=e,o}return e}catch(i){throw i instanceof Error?i:new Error("Unknown error occurred while fetching quote")}}async function z(d,t,r){try{const s=d.replace("/quote","/quote/batch"),i=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(r)}),n=await i.json();if(!i.ok){const e=new Error((n==null?void 0:n.message)||"Failed to fetch batch quote");throw e.status=i.status,e.responseBody=n,e}return n}catch(s){throw s instanceof Error?s:new Error("Unknown error occurred while fetching batch quote")}}async function D(d,t,r,s){var i;try{const n={...r,...s?{state:s}:{},isPartialPayment:r.isPartialPayment||!1,roundTo:r.roundTo||void 0,items:r.items.map((m,f)=>({...m,cartItemId:m.cartItemId||`item-${f+1}`}))},e=await z(d,t,n);if(e.status!=="QUOTES_AVAILABLE"&&e.status!=="QUOTE_AVAILABLE")return{status:"NO_MATCHING_QUOTE"};const o=e.quotes.map(m=>{const f=r.items.find((v,h)=>(v.cartItemId||`item-${h+1}`)===m.cartItemId);return f?f.participantDescription?`${f.productName} - ${f.participantDescription}`:f.productName:`Item ${m.id}`}),p=Math.round((e.totalSpotPrice||e.spotPrice||0)*100)/100;return{status:"QUOTE_AVAILABLE",data:{id:e.quotes?e.quotes.map(m=>m.id).join(","):((i=e.data)==null?void 0:i.id)||"",spotPrice:p,currencyCode:e.currencyCode||"",communication:{...e.communication,yesOptionText:e.communication.yesOptionText.replace(String(e.totalSpotPrice),String(p))},payoutSchedule:e.payoutSchedule.map(m=>({...m,amount:m.amount!==void 0?m.amount:0})),coveredItems:o,originalQuotes:e.quotes||(e.data?[e.data]:[])},spotPrice:p,coveredItems:o}}catch(n){throw n instanceof Error?n:new Error("Unknown error occurred while fetching multiple quotes")}}const E="non-us-resident",A="Unfortunately, we are currently unable to offer coverage or process claims for non-US residents.",S=[{value:"AL",label:"Alabama"},{value:"AK",label:"Alaska"},{value:"AS",label:"American Samoa"},{value:"AZ",label:"Arizona"},{value:"AR",label:"Arkansas"},{value:"CA",label:"California"},{value:"CO",label:"Colorado"},{value:"CT",label:"Connecticut"},{value:"DE",label:"Delaware"},{value:"DC",label:"District of Columbia"},{value:"FL",label:"Florida"},{value:"GA",label:"Georgia"},{value:"GU",label:"Guam"},{value:"HI",label:"Hawaii"},{value:"ID",label:"Idaho"},{value:"IL",label:"Illinois"},{value:"IN",label:"Indiana"},{value:"IA",label:"Iowa"},{value:"KS",label:"Kansas"},{value:"KY",label:"Kentucky"},{value:"LA",label:"Louisiana"},{value:"ME",label:"Maine"},{value:"MD",label:"Maryland"},{value:"MA",label:"Massachusetts"},{value:"MI",label:"Michigan"},{value:"MN",label:"Minnesota"},{value:"MS",label:"Mississippi"},{value:"MO",label:"Missouri"},{value:"MT",label:"Montana"},{value:"NE",label:"Nebraska"},{value:"NV",label:"Nevada"},{value:"NH",label:"New Hampshire"},{value:"NJ",label:"New Jersey"},{value:"NM",label:"New Mexico"},{value:"NY",label:"New York"},{value:"NC",label:"North Carolina"},{value:"ND",label:"North Dakota"},{value:"MP",label:"Northern Mariana Islands"},{value:"OH",label:"Ohio"},{value:"OK",label:"Oklahoma"},{value:"OR",label:"Oregon"},{value:"PA",label:"Pennsylvania"},{value:"PR",label:"Puerto Rico"},{value:"RI",label:"Rhode Island"},{value:"SC",label:"South Carolina"},{value:"SD",label:"South Dakota"},{value:"TN",label:"Tennessee"},{value:"TX",label:"Texas"},{value:"VI",label:"U.S. Virgin Islands"},{value:"UT",label:"Utah"},{value:"VT",label:"Vermont"},{value:"VA",label:"Virginia"},{value:"WA",label:"Washington"},{value:"WV",label:"West Virginia"},{value:"WI",label:"Wisconsin"},{value:"WY",label:"Wyoming"}],P=new Set(S.map(d=>d.value)),T=["USD","CAD","AUD","NZD","EUR","MXN","AED","GBP","MAD","SAR","BGN","BRL","CHF","DKK","INR","JPY","MYR","NOK","PLN","SEK","SGD","THB","ZAR"],$={sandbox:"https://api.sandbox.getspot.com/v1/quote",production:"https://api.getspot.com/v1/quote",local:"http://localhost:3999/api/v1/quote"};function N(d){const{apiConfig:t={},quoteRequestData:r,callbacks:s={},location:i,theme:n}=d,{environment:e="sandbox",partnerId:o,customEndpoint:p}=t;if(!o||typeof o!="string")throw new Error("Invalid or missing partnerId in apiConfig");if(!(p||$[e]))throw new Error(`Invalid environment in apiConfig: ${e}`);if(!r||typeof r!="object"&&!Array.isArray(r))throw new Error("quoteRequestData must be a non-null object or array");const f=["startDate","endDate","currencyCode","eventType","productType","productDuration","productPrice","productId","cartId","productName"];function v(l,u=null){const c=u!==null?`quoteRequestData[${u}]`:"quoteRequestData";f.forEach(g=>{if(!Object.prototype.hasOwnProperty.call(l,g)||l[g]===void 0||l[g]===null)throw new Error(`Missing required ${c} field: '${g}'`)});const _=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!_.test(l.startDate))throw new Error(`${c}.startDate must be a valid ISO8601 string`);if(!_.test(l.endDate))throw new Error(`${c}.endDate must be a valid ISO8601 string`);if(typeof l.currencyCode!="string")throw new Error(`${c}.currencyCode must be a string`);if(!T.includes(l.currencyCode))throw new Error(`Invalid ${c}.currencyCode: ${l.currencyCode}`);if(typeof l.eventType!="string")throw new Error(`${c}.eventType must be a string`);if(typeof l.productType!="string")throw new Error(`${c}.productType must be a string`);const w=["Pass","Trip","Registration"];if(!w.includes(l.productType))throw new Error(`${c}.productType must be one of ${w.join(", ")}`);if(typeof l.productDuration!="string")throw new Error(`${c}.productDuration must be a string`);const q=["Daily","Seasonal","Trip","Event"];if(!q.includes(l.productDuration))throw new Error(`${c}.productDuration must be one of ${q.join(", ")}`);if(typeof l.productPrice!="number"||isNaN(l.productPrice))throw new Error(`${c}.productPrice must be a valid number`);if(typeof l.productId!="string")throw new Error(`${c}.productId must be a string`);if(typeof l.cartId!="string")throw new Error(`${c}.cartId must be a string`);if(typeof l.productName!="string")throw new Error(`${c}.productName must be a string`)}if("items"in r){const l=r,{cartId:u,cartName:c,currencyCode:_,items:w}=l;if(!u||typeof u!="string")throw new Error("quoteRequestData.cartId must be a string");if(!c||typeof c!="string")throw new Error("quoteRequestData.cartName must be a string");if(!_||typeof _!="string")throw new Error("quoteRequestData.currencyCode must be a string");if(!T.includes(_))throw new Error(`Invalid quoteRequestData.currencyCode: ${_}`);if(!Array.isArray(w)||w.length===0)throw new Error("quoteRequestData.items must be a non-empty array");const q=["startDate","endDate","eventType","productType","productDuration","productPrice","productId","productName"];w.forEach((g,H)=>{if(!g||typeof g!="object")throw new Error(`quoteRequestData.items[${H}] must be a non-null object`);const y=`quoteRequestData.items[${H}]`;q.forEach(x=>{if(!Object.prototype.hasOwnProperty.call(g,x)||g[x]===void 0||g[x]===null)throw new Error(`Missing required ${y} field: '${x}'`)});const R=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!R.test(g.startDate))throw new Error(`${y}.startDate must be a valid ISO8601 string`);if(!R.test(g.endDate))throw new Error(`${y}.endDate must be a valid ISO8601 string`);if(typeof g.eventType!="string")throw new Error(`${y}.eventType must be a string`);if(typeof g.productType!="string")throw new Error(`${y}.productType must be a string`);const L=["Pass","Trip","Registration"];if(!L.includes(g.productType))throw new Error(`${y}.productType must be one of ${L.join(", ")}`);if(typeof g.productDuration!="string")throw new Error(`${y}.productDuration must be a string`);const O=["Daily","Seasonal","Trip","Event"];if(!O.includes(g.productDuration))throw new Error(`${y}.productDuration must be one of ${O.join(", ")}`);if(typeof g.productPrice!="number"||isNaN(g.productPrice))throw new Error(`${y}.productPrice must be a valid number`);if(typeof g.productId!="string")throw new Error(`${y}.productId must be a string`);if(typeof g.productName!="string")throw new Error(`${y}.productName must be a string`)})}else if(Array.isArray(r)){if(r.length===0)throw new Error("quoteRequestData array cannot be empty");r.forEach((l,u)=>{if(!l||typeof l!="object")throw new Error(`quoteRequestData[${u}] must be a non-null object`);v(l,u)})}else v(r);if(["onOptIn","onOptOut","onQuoteRetrieved","onError","noMatchingQuote"].forEach(l=>{const u=s[l];if(u&&typeof u!="function")throw new Error(`Callback '${l}' must be a function.`)}),typeof i=="string"&&!document.querySelector(i))throw new Error(`Invalid location selector: '${i}'`);if(n&&typeof n!="object")throw new Error("Theme must be an object with CSS variables, do not include the '--' prefix");if(d.state&&!P.has(d.state))throw new Error(`Invalid state: '${d.state}'. Must be a 2-character US state or territory code.`)}var b=(d=>(d.YES="yes",d.NO="no",d.UNSELECTED="unselected",d))(b||{});function a(d,{text:t,className:r,parent:s,innerHTML:i,href:n,target:e}={}){const o=document.createElement(d);return r&&(o.className=r),t!=null&&(o.textContent=t),i!=null&&(o.innerHTML=i),n&&"href"in o&&(o.href=n),e&&"target"in o&&(o.target=e),s&&s.appendChild(o),o}function V(d,{name:t,description:r}){a("div",{className:"spot-header__title",text:t,parent:d}),a("div",{className:"spot-header__description",text:r,parent:d})}function U(d,t=[]){const r=a("ul",{className:"spot-benefits__list",parent:d});t.forEach(s=>{const i=a("li",{parent:r});i.innerHTML=`
2
2
  <svg width="14" height="14" viewBox="0 0 14 14" fill="none" class="spot-bullets__checkmark">
3
3
  <path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
4
4
  stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
5
- </svg>`,a("span",{text:s,parent:i})})}function Q(c,t=[]){if(!t||t.length===0)return;const r=a("div",{className:"spot-qualifying-reasons__container",parent:c}),s=[...t].sort((o,p)=>o.rank-p.rank),i=a("div",{className:"spot-qualifying-reasons__grid",parent:r}),n={"Accident & Illness":"cross.svg","Family Emergencies":"users.svg",Layoffs:"building.svg","Jury Duty":"scale.svg","Work Travel Conflict":"briefcase.svg","Severe Weather":"umbrella.svg","Travel Interruption":"plane.svg","Military Duty":"medal.svg"};let e;try{const o=document.currentScript;if(o!=null&&o.src){const p=new URL(o.src);e=p.origin+p.pathname.replace(/\/[^/]*$/,"/")}else e=window.location.origin+window.location.pathname.replace(/\/[^/]*$/,"/");e+="assets/"}catch{e="./assets/"}s.forEach(o=>{var v,h,l;const p=a("div",{className:"spot-qualifying-reasons__item",parent:i}),m=a("div",{className:"spot-qualifying-reasons__icon-wrapper",parent:p}),f=n[((v=o.benefitType)==null?void 0:v.name)||""]||n[o.name||""];if(f){const u=a("img",{parent:m});u.src=e+f,u.alt=((h=o.benefitType)==null?void 0:h.name)||o.name||"",u.className="spot-qualifying-reasons__icon"}a("span",{className:"spot-qualifying-reasons__label",text:((l=o.benefitType)==null?void 0:l.name)||o.name||"",parent:p})})}function Z(c,t=[],r){if(t.length===0||!r||r<=1)return;const s=new Map;t.forEach(u=>{s.set(u,(s.get(u)||0)+1)});const n=Array.from(s.entries()).map(([u,d])=>({item:u,count:d,displayText:d>1?`${d} x ${u}`:u})).sort((u,d)=>{const _=u.item.charAt(0),w=d.item.charAt(0),q=/[a-zA-Z]/.test(_),g=/[a-zA-Z]/.test(w);return!q&&g?-1:q&&!g?1:u.item.localeCompare(d.item,void 0,{sensitivity:"base"})}),e=a("div",{className:"spot-covered-items__container",parent:c}),o=a("div",{className:"spot-covered-items__header",parent:e}),p=a("button",{className:"spot-covered-items__toggle",parent:o});a("span",{className:"spot-covered-items__title",text:`Items Covered in Your Cart (${t.length})`,parent:p});const m=a("div",{className:"spot-covered-items__right-section",parent:p});a("span",{className:"spot-covered-items__view-all",text:"View All",parent:m});const f=a("span",{className:"spot-covered-items__arrow",innerHTML:"▼",parent:m}),v=a("div",{className:"spot-covered-items__content",parent:e}),h=a("ul",{className:"spot-covered-items__list",parent:v});n.forEach(({displayText:u})=>{const d=a("li",{parent:h});a("span",{text:u,parent:d})});let l=!1;v.style.display="none",p.addEventListener("click",u=>{u.stopPropagation(),l=!l,v.style.display=l?"block":"none",f.innerHTML=l?"▲":"▼",p.setAttribute("aria-expanded",l.toString())}),p.setAttribute("aria-expanded","false"),p.setAttribute("aria-controls","covered-items-list"),v.setAttribute("id","covered-items-list")}const B={USD:"$",CAD:"CAD $",AUD:"AUD $",NZD:"NZD $",MXN:"MXN $",EUR:"EUR €",GBP:"GBP £",AED:"AED ",MAD:"MAD ",SAR:"SAR ",BGN:"BGN лв",BRL:"BRL R$",CHF:"CHF ",DKK:"DKK kr",INR:"INR ₹",JPY:"JPY ¥",MYR:"MYR RM",NOK:"NOK kr",PLN:"PLN zł",SEK:"SEK kr",SGD:"SGD $",THB:"THB ฿",ZAR:"ZAR R"};function j(c,t=[],r="USD"){const s=B[r]??`${r} `,i=a("div",{className:"spot-table__container",parent:c}),n=a("table",{className:"spot-refund__table spot-table--dynamic",parent:i}),e=a("thead",{parent:n}),o=a("tr",{parent:e});a("th",{text:"When you cancel",parent:o}),a("th",{text:"You will receive",parent:o});const p=a("tbody",{parent:n});t.forEach(({text:m,percent:f,amount:v})=>{const h=a("tr",{parent:p});a("td",{text:m,parent:h});const l=f==="Not eligible for refund"?"Not eligible for a refund":`${s}${v} refund`;a("td",{text:l,parent:h})})}function F(c,t){const r=a("div",{className:"spot-state-dropdown__wrapper",parent:c});a("label",{className:"spot-state-dropdown__label",text:"State of Residence",parent:r});const s=a("select",{className:"spot-state-dropdown__select",parent:r});s.setAttribute("aria-label","State of Residence");const i=a("option",{text:"Select a state...",parent:s});i.value="",i.selected=!t,T.forEach(({value:e,label:o})=>{const p=a("option",{text:o,parent:s});p.value=e,e===t&&(p.selected=!0)});const n=a("option",{text:"Not a US Resident",parent:s});return n.value=E,t===E&&(n.selected=!0),a("div",{className:"spot-state-dropdown__error",text:A,parent:r}),s}function W(c,t,r,s=!1){const i=a("div",{className:`spot-selection__options${s?" spot-selection__options--disabled":""}`,parent:c}),n=a("label",{className:`spot-selection__option ${t===b.YES?"selected":""}`,parent:i}),e=a("input",{parent:n});e.type="radio",e.name="selection",e.value=b.YES,t===b.YES&&(e.checked=!0),s&&(e.disabled=!0),a("strong",{text:r.yesOptionText,parent:n}),a("span",{className:"spot-selection__recommended-tag",text:"Recommended",parent:n});const o=a("label",{className:`spot-selection__option ${t===b.NO?"selected":""}`,parent:i}),p=a("input",{parent:o});return p.type="radio",p.name="selection",p.value=b.NO,t===b.NO&&(p.checked=!0),s&&(p.disabled=!0),a("span",{text:r.noOptionText,parent:o}),i}function I(c,t){var s;const r=(s=t.communication)==null?void 0:s.paymentTerms;if(r){const i=a("div",{className:"spot-payment-terms",parent:c});return a("div",{className:"spot-payment-terms__header",text:"PAYMENT TERMS",parent:i}),a("div",{className:"spot-payment-terms__body",text:r||"",parent:i}),i}}function Y(c,t,r="bottom-right"){if(r==="top-right"){const o=a("div",{className:"spot-logo__top-right",parent:c});o.innerHTML=`
5
+ </svg>`,a("span",{text:s,parent:i})})}function Q(d,t=[]){if(!t||t.length===0)return;const r=a("div",{className:"spot-qualifying-reasons__container",parent:d}),s=[...t].sort((o,p)=>o.rank-p.rank),i=a("div",{className:"spot-qualifying-reasons__grid",parent:r}),n={"Accident & Illness":"cross.svg","Family Emergencies":"users.svg",Layoffs:"building.svg","Jury Duty":"scale.svg","Work Travel Conflict":"briefcase.svg","Severe Weather":"umbrella.svg","Travel Interruption":"plane.svg","Military Duty":"medal.svg"};let e;try{const o=document.currentScript;if(o!=null&&o.src){const p=new URL(o.src);e=p.origin+p.pathname.replace(/\/[^/]*$/,"/")}else e=window.location.origin+window.location.pathname.replace(/\/[^/]*$/,"/");e+="assets/"}catch{e="./assets/"}s.forEach(o=>{var v,h,l;const p=a("div",{className:"spot-qualifying-reasons__item",parent:i}),m=a("div",{className:"spot-qualifying-reasons__icon-wrapper",parent:p}),f=n[((v=o.benefitType)==null?void 0:v.name)||""]||n[o.name||""];if(f){const u=a("img",{parent:m});u.src=e+f,u.alt=((h=o.benefitType)==null?void 0:h.name)||o.name||"",u.className="spot-qualifying-reasons__icon"}a("span",{className:"spot-qualifying-reasons__label",text:((l=o.benefitType)==null?void 0:l.name)||o.name||"",parent:p})})}function Z(d,t=[],r){if(t.length===0||!r||r<=1)return;const s=new Map;t.forEach(u=>{s.set(u,(s.get(u)||0)+1)});const n=Array.from(s.entries()).map(([u,c])=>({item:u,count:c,displayText:c>1?`${c} x ${u}`:u})).sort((u,c)=>{const _=u.item.charAt(0),w=c.item.charAt(0),q=/[a-zA-Z]/.test(_),g=/[a-zA-Z]/.test(w);return!q&&g?-1:q&&!g?1:u.item.localeCompare(c.item,void 0,{sensitivity:"base"})}),e=a("div",{className:"spot-covered-items__container",parent:d}),o=a("div",{className:"spot-covered-items__header",parent:e}),p=a("button",{className:"spot-covered-items__toggle",parent:o});p.type="button",a("span",{className:"spot-covered-items__title",text:`Items Covered in Your Cart (${t.length})`,parent:p});const m=a("div",{className:"spot-covered-items__right-section",parent:p});a("span",{className:"spot-covered-items__view-all",text:"View All",parent:m});const f=a("span",{className:"spot-covered-items__arrow",innerHTML:"▼",parent:m}),v=a("div",{className:"spot-covered-items__content",parent:e}),h=a("ul",{className:"spot-covered-items__list",parent:v});n.forEach(({displayText:u})=>{const c=a("li",{parent:h});a("span",{text:u,parent:c})});let l=!1;v.style.display="none",p.addEventListener("click",u=>{u.stopPropagation(),u.preventDefault(),l=!l,v.style.display=l?"block":"none",f.innerHTML=l?"▲":"▼",p.setAttribute("aria-expanded",l.toString())}),p.setAttribute("aria-expanded","false"),p.setAttribute("aria-controls","covered-items-list"),v.setAttribute("id","covered-items-list")}const B={USD:"$",CAD:"CAD $",AUD:"AUD $",NZD:"NZD $",MXN:"MXN $",EUR:"EUR €",GBP:"GBP £",AED:"AED ",MAD:"MAD ",SAR:"SAR ",BGN:"BGN лв",BRL:"BRL R$",CHF:"CHF ",DKK:"DKK kr",INR:"INR ₹",JPY:"JPY ¥",MYR:"MYR RM",NOK:"NOK kr",PLN:"PLN zł",SEK:"SEK kr",SGD:"SGD $",THB:"THB ฿",ZAR:"ZAR R"};function j(d,t=[],r="USD"){const s=B[r]??`${r} `,i=a("div",{className:"spot-table__container",parent:d}),n=a("table",{className:"spot-refund__table spot-table--dynamic",parent:i}),e=a("thead",{parent:n}),o=a("tr",{parent:e});a("th",{text:"When you cancel",parent:o}),a("th",{text:"You will receive",parent:o});const p=a("tbody",{parent:n});t.forEach(({text:m,percent:f,amount:v})=>{const h=a("tr",{parent:p});a("td",{text:m,parent:h});const l=f==="Not eligible for refund"?"Not eligible for a refund":`${s}${v} refund`;a("td",{text:l,parent:h})})}function F(d,t){const r=a("div",{className:"spot-state-dropdown__wrapper",parent:d});a("label",{className:"spot-state-dropdown__label",text:"State of Residence",parent:r});const s=a("select",{className:"spot-state-dropdown__select",parent:r});s.setAttribute("aria-label","State of Residence");const i=a("option",{text:"Select a state...",parent:s});i.value="",i.selected=!t,S.forEach(({value:e,label:o})=>{const p=a("option",{text:o,parent:s});p.value=e,e===t&&(p.selected=!0)});const n=a("option",{text:"Not a US Resident",parent:s});return n.value=E,t===E&&(n.selected=!0),a("div",{className:"spot-state-dropdown__error",text:A,parent:r}),s}function W(d,t,r,s=!1){const i=a("div",{className:`spot-selection__options${s?" spot-selection__options--disabled":""}`,parent:d}),n=a("label",{className:`spot-selection__option ${t===b.YES?"selected":""}`,parent:i}),e=a("input",{parent:n});e.type="radio",e.name="selection",e.value=b.YES,t===b.YES&&(e.checked=!0),s&&(e.disabled=!0),a("strong",{text:r.yesOptionText,parent:n}),a("span",{className:"spot-selection__recommended-tag",text:"Recommended",parent:n});const o=a("label",{className:`spot-selection__option ${t===b.NO?"selected":""}`,parent:i}),p=a("input",{parent:o});return p.type="radio",p.name="selection",p.value=b.NO,t===b.NO&&(p.checked=!0),s&&(p.disabled=!0),a("span",{text:r.noOptionText,parent:o}),i}function I(d,t){var s;const r=(s=t.communication)==null?void 0:s.paymentTerms;if(r){const i=a("div",{className:"spot-payment-terms",parent:d});return a("div",{className:"spot-payment-terms__header",text:"PAYMENT TERMS",parent:i}),a("div",{className:"spot-payment-terms__body",text:r||"",parent:i}),i}}function Y(d,t,r="bottom-right"){if(r==="top-right"){const o=a("div",{className:"spot-logo__top-right",parent:d});o.innerHTML=`
6
6
  <svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
7
7
  <rect width="145" height="28"/>
8
8
  <rect x="-655" y="-270" width="819" height="325" rx="10"/>
@@ -17,7 +17,7 @@
17
17
  <rect width="45.405" height="14.8867" fill="white" transform="translate(87 8)"/>
18
18
  </clipPath>
19
19
  </defs>
20
- </svg>`}const s=a("div",{className:"spot-footer__container",parent:c}),i=a("div",{className:"spot-footer__terms",parent:s}),n=`<a href="${t.communication.termsAndConditionsUrl}" target="_blank" class="spot-footer__terms-link">Terms & Conditions</a>`,e=t.communication.legalDisclaimer.replace(/terms (and|&) conditions/gi,n);if(a("span",{innerHTML:e,parent:i}),r==="bottom-right"){const o=a("p",{className:"spot-footer__powered-by",parent:s});o.innerHTML=`
20
+ </svg>`}const s=a("div",{className:"spot-footer__container",parent:d}),i=a("div",{className:"spot-footer__terms",parent:s}),n=`<a href="${t.communication.termsAndConditionsUrl}" target="_blank" class="spot-footer__terms-link">Terms & Conditions</a>`,e=t.communication.legalDisclaimer.replace(/terms (and|&) conditions/gi,n);if(a("span",{innerHTML:e,parent:i}),r==="bottom-right"){const o=a("p",{className:"spot-footer__powered-by",parent:s});o.innerHTML=`
21
21
  <svg width="145" height="28" viewBox="0 0 145 28" fill="none" xmlns="http://www.w3.org/2000/svg">
22
22
  <rect width="145" height="28"/>
23
23
  <rect x="-655" y="-270" width="819" height="325" rx="10"/>
@@ -32,4 +32,4 @@
32
32
  <rect width="45.405" height="14.8867" fill="white" transform="translate(87 8)"/>
33
33
  </clipPath>
34
34
  </defs>
35
- </svg>`}return s}const G=":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-border-line-width: .0625rem;--spot-border-color: #e0e0e0;--spot-max-width: 51rem;--spot-margin: 1rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-bullets-checkmark-color: #2e2e2e;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-state-dropdown-label-font-size: .875rem;--spot-state-dropdown-label-font-weight: 600;--spot-state-dropdown-label-margin-bottom: .25rem;--spot-state-dropdown-select-border: .0625rem solid #e0e0e0;--spot-state-dropdown-select-border-radius: .375rem;--spot-state-dropdown-select-padding: .5rem .75rem;--spot-state-dropdown-select-font-size: .875rem;--spot-state-dropdown-select-background: #ffffff;--spot-state-dropdown-wrapper-margin-bottom: .75rem;--spot-state-dropdown-error-color: var(--spot-selection-error-font-color);--spot-state-dropdown-error-font-size: .8125rem;--spot-state-dropdown-error-margin-top: .25rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-covered-items-background: #f1f3f5;--spot-covered-items-hover-background: #e9ecef;--spot-covered-items-border-radius: .5rem;--spot-covered-items-padding: .75rem 1rem;--spot-covered-items-font-size: .875rem;--spot-covered-items-font-weight: 400;--spot-covered-items-font-color: #000000;--spot-covered-items-font-family: Arial;--spot-covered-items-arrow-font-size: .6rem;--spot-covered-items-arrow-color: #636569;--spot-covered-items-view-all-color: #636569;--spot-covered-items-view-all-font-size: .875rem;--spot-covered-items-view-all-font-weight: 400;--spot-covered-items-content-background: #f8f9fa;--spot-covered-items-content-border: 1px solid #e0e0e0;--spot-covered-items-content-border-radius: .5rem;--spot-covered-items-content-padding: .75rem 1rem;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 1.5rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:var(--spot-border-line-width) solid var(--spot-border-color);border-radius:var(--spot-border-radius);max-width:var(--spot-max-width);margin:var(--spot-margin);container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__wrapper{min-width:0;word-wrap:normal}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container{grid-row:1;margin-bottom:var(--spot-benefits-margin-bottom)}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1;margin-bottom:var(--spot-covered-items-margin-bottom)}.desktop-layout .spot-selection__wrapper{grid-row:3;grid-column:1;margin-top:var(--spot-desktop-radio-margin-top)}.desktop-layout .spot-payment-terms__wrapper{grid-row:4;grid-column:1;margin-top:var(--spot-payment-terms-margin-top)}.desktop-layout .spot-table__container{grid-row:1 / span 4;grid-column:2;width:auto;min-width:20.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-table__container{display:flex;justify-content:flex-start;margin-top:1rem;margin-bottom:1rem;box-sizing:border-box;padding:0 .3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-refund__table{width:100%;max-width:22rem;table-layout:auto}@media (max-width: 850px){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 500px){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 600px){.spot-refund__table th{padding:0rem}}.spot-benefits__list{list-style-type:none;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-benefits__list li{margin-bottom:.375rem;display:flex;align-items:flex-start;gap:.5rem}.spot-benefits__list li svg{flex-shrink:0;position:relative;top:.125rem}.spot-bullets__checkmark path{stroke:var(--spot-bullets-checkmark-color)}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:.85rem;margin-bottom:.5rem;max-width:26rem}.spot-content__wrapper.desktop-layout:has(.spot-table__container) .spot-covered-items__container{margin-top:0rem;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-covered-items__list li:last-child{margin-bottom:0}.spot-covered-items__header{margin-bottom:.5rem}.spot-covered-items__toggle{background:var(--spot-covered-items-background);border:none;border-radius:var(--spot-covered-items-border-radius);padding:var(--spot-covered-items-padding);cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;transition:all .2s ease}.spot-covered-items__toggle:hover{background-color:var(--spot-covered-items-hover-background)}.spot-covered-items__toggle:focus{outline:none;box-shadow:0 0 0 2px #0000001a}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;margin:0;padding:0}.spot-covered-items__right-section{display:flex;align-items:center;gap:.5rem;margin-left:auto}.spot-covered-items__view-all{font-size:var(--spot-covered-items-view-all-font-size);font-weight:var(--spot-covered-items-view-all-font-weight);color:var(--spot-covered-items-view-all-color);font-family:var(--spot-covered-items-font-family);line-height:125%}.spot-covered-items__arrow{font-size:var(--spot-covered-items-arrow-font-size);transition:transform .2s ease;color:var(--spot-covered-items-arrow-color);flex-shrink:0;transform:scaleX(1.5)}.spot-covered-items__content{margin-top:.5rem;transition:all .2s ease;overflow:hidden}.spot-covered-items__list{background-color:var(--spot-covered-items-content-background);border:var(--spot-covered-items-content-border);border-radius:var(--spot-covered-items-content-border-radius);margin:0;padding:var(--spot-covered-items-content-padding)}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}.spot-state-dropdown__wrapper{display:flex;flex-direction:column;margin-bottom:var(--spot-state-dropdown-wrapper-margin-bottom)}.spot-state-dropdown__label{font-size:var(--spot-state-dropdown-label-font-size);font-weight:var(--spot-state-dropdown-label-font-weight);font-family:var(--spot-font-family);color:var(--spot-font-color);margin-bottom:var(--spot-state-dropdown-label-margin-bottom)}.spot-state-dropdown__select{width:100%;box-sizing:border-box;border:var(--spot-state-dropdown-select-border);border-radius:var(--spot-state-dropdown-select-border-radius);padding:var(--spot-state-dropdown-select-padding);font-size:var(--spot-state-dropdown-select-font-size);font-family:var(--spot-font-family);color:var(--spot-font-color);background-color:var(--spot-state-dropdown-select-background);cursor:pointer;-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.spot-state-dropdown__select:focus{outline:none;box-shadow:0 0 0 2px #00000026}.spot-state-dropdown__select--error{border-color:var(--spot-state-dropdown-error-color)}.spot-state-dropdown__select--error:focus{box-shadow:0 0 0 2px #ff000026}.spot-state-dropdown__error{display:none;color:var(--spot-state-dropdown-error-color);font-size:var(--spot-state-dropdown-error-font-size);font-family:var(--spot-font-family);margin-top:var(--spot-state-dropdown-error-margin-top)}.spot-state-dropdown__error--visible{display:block}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;min-width:.75rem;border:.0625rem solid var(--spot-radio-border);border-radius:var(--spot-radio-border-radius);margin-right:.5rem;position:relative;vertical-align:middle;top:-.0625rem;cursor:pointer;flex-shrink:0}input[type=radio]:checked{background:var(--spot-radio-checked-background);box-shadow:inset 0 0 0 .0625rem #fff}.spot-selection__options{display:flex;flex-direction:column;gap:.5rem}.spot-selection__option{display:flex;align-items:center;flex-wrap:nowrap;position:relative;transition:background .2s;cursor:pointer;font-size:var(--spot-radio-text-font-size);font-weight:var(--spot-radio-text-font-weight);color:var(--spot-radio-text-font-color);font-family:var(--spot-radio-text-font-family);padding:var(--spot-radio-text-padding);margin-right:.5rem}.spot-selection__option.selected{background:var(--spot-radio-selection-background);border-radius:var(--spot-radio-selection-border-radius);padding:var(--spot-radio-selection-padding)}.spot-selection__recommended-tag{background:var(--spot-recommended-tag-background);color:var(--spot-recommended-tag-font-color);font-size:var(--spot-recommended-tag-font-size);font-weight:var(--spot-recommended-tag-font-weight);padding:var(--spot-recommended-tag-padding);border-radius:var(--spot-recommended-tag-border-radius);margin-left:.75rem;white-space:nowrap;flex-shrink:0}@media (max-width: 850px){.spot-selection__recommended-tag{margin-left:.5rem}}@media (max-width: 600px){.spot-selection__recommended-tag{margin-left:.5rem;font-size:.75rem;padding:.1875rem .4375rem}}.spot-selection__error{color:var(--spot-selection-error-font-color);font-size:var(--spot-selection-error-font-size);padding:var(--spot-selection-error-padding);display:none}.spot-selection__options--disabled .spot-selection__option{opacity:.4;cursor:not-allowed;pointer-events:none}.spot-selection__options--disabled input[type=radio]{cursor:not-allowed}.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);color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);line-height:1.4;word-wrap:normal;-webkit-hyphens:none;hyphens:none;flex:1;min-width:0;overflow-wrap:normal}.spot-footer__terms-link{text-decoration:var(--spot-terms-link-text-decoration);font-size:var(--spot-terms-link-font-size);font-weight:var(--spot-terms-link-font-weight);color:var(--spot-terms-link-font-color);font-family:var(--spot-terms-link-font-family);padding:var(--spot-terms-link-padding)}.spot-footer__container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;flex-wrap:nowrap;gap:var(--spot-footer-gap)}@container (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}@media (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}.spot-footer__powered-by{margin-top:0;flex-shrink:0}.spot-logo__top-right{position:absolute;top:-14px;right:40px;z-index:10;background:linear-gradient(to bottom,transparent 50%,inherit 50%);padding:0 .25rem}.spot-logo__top-right svg{border-radius:1.25rem;border:var(--spot-border-line-width) solid var(--spot-border-color);display:block;background:var(--spot-background-color)}@container (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}@media (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}";function K(c){const t=document.createElement("style");t.textContent=c,document.head.appendChild(t)}K(G);const M={sandbox:"https://api.sandbox.getspot.com/api/v1/quote",production:"https://api.getspot.com/api/v1/quote",local:"http://localhost:3999/api/v1/quote"};class X{constructor(t={}){this.options={location:"body",showTable:!0,logoPosition:"bottom-right",apiConfig:{environment:"production",partnerId:""},quoteRequestData:{},callbacks:{},useMockData:!1,...t,selection:t.selection??b.UNSELECTED},this._onResize=this._updateLayout.bind(this),this.root=typeof this.options.location=="string"?document.querySelector(this.options.location):this.options.location,this.currentSelection=this.options.selection,this._init()}async _init(){var t,r,s,i,n;try{N(this.options),this.currentState=this.options.state;let e;if(this.options.useMockData&&this.options.mockData)e=this.options.mockData;else{const{environment:o,partnerId:p}=this.options.apiConfig,f=this.options.apiConfig.customEndpoint||M[o];e="items"in this.options.quoteRequestData?await S(f,p,this.options.quoteRequestData,this._validState()):await k(f,p,this.options.quoteRequestData,this._validState())}if(e.status!=="QUOTE_AVAILABLE"){e.status==="NO_MATCHING_QUOTE"&&((t=this.options.callbacks)!=null&&t.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:this.options.quoteRequestData});return}if(this.quote=e.data,!this.quote)throw new Error("No quote data in response");if(this._renderWidget(),this.options.selection===b.YES&&((r=this.options.callbacks)!=null&&r.onOptIn)){const o={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id,state:this._validState()};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const p=this.options.quoteRequestData;o.batchQuoteDetails=this.quote.originalQuotes.map(m=>{var v;const f=(v=p.items)==null?void 0:v.find(h=>(h.cartItemId||`item-${p.items.indexOf(h)+1}`)===m.cartItemId);return{quoteId:m.id,productPrice:(f==null?void 0:f.productPrice)||m.spotPrice,cartItemId:(f==null?void 0:f.cartItemId)||""}})}this.options.callbacks.onOptIn(o)}if((s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const o=this.options.callbacks.onQuoteRetrieved(this.quote);o&&this._applyQuoteUpdates(o)}}catch(e){if((i=this.options.callbacks)!=null&&i.onError){const o=e;(n=this.options.callbacks)==null||n.onError({message:o.message,status:o.status,responseBody:o.responseBody})}}}_renderWidget(){if(!this.quote)return;this.container=document.createElement("div"),this.container.className="spot-refund-guarantee",this.root.appendChild(this.container),Object.entries(this.options.theme||{}).forEach(([e,o])=>{const p=`--${e}`;this.container.style.setProperty(p,o)}),V(this.container,this.quote.communication);const t=document.createElement("div");if(t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?Q(t,this.quote.qualifyingReasons):U(t,this.quote.communication.bulletPoints),this.quote.coveredItems){const e=this._getTotalItemsInRequest();Z(t,this.quote.coveredItems,e)}this.options.showTable&&!this.quote.qualifyingReasons&&j(t,this.quote.payoutSchedule,this.quote.currencyCode);const r=a("div",{className:"spot-selection__wrapper",parent:t});this._isPassOrTrip()&&!this.options.state&&(this._stateSelectEl=F(r,this.currentState),this._setNonUsResidentError(this.currentState===E));const i=!this._isQuotingAvailable(),n=W(r,this.currentSelection,this.quote.communication,i);this.paymentTermsEl=a("div",{className:"spot-payment-terms__wrapper",parent:t}),this.currentSelection===b.YES&&I(this.paymentTermsEl,this.quote),Y(this.container,this.quote,this.options.logoPosition),window.addEventListener("resize",this._onResize),this._setupResizeObserver(),this._updateLayout(),this._setupOptionListeners(n),this._setupStateDropdownListener()}_updateLayout(){if(!this.container||!this.quote)return;const t=this.container.querySelector(".spot-content__wrapper"),r=this.options.showTable&&!this.quote.qualifyingReasons;if(!t||!r){t==null||t.classList.remove("desktop-layout");return}const s=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",s)}_shouldUseDesktopLayout(t){const r=this.container.offsetWidth-40,s=325,i=16;if(r>=900)return!0;if(r>=650){const n=t.classList.contains("desktop-layout");t.classList.remove("desktop-layout"),t.offsetHeight;const e=t.querySelector(".spot-benefits__list, .spot-qualifying-reasons__container");if(!e)return n&&t.classList.add("desktop-layout"),n;const p=Math.min(e.scrollWidth,400)+s+i;return n&&t.classList.add("desktop-layout"),r>=p}return!1}_setupResizeObserver(){!this.container||!window.ResizeObserver||(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=window.setTimeout(()=>{this._updateLayout()},100)}),this._resizeObserver.observe(this.container))}_getTotalItemsInRequest(){return"items"in this.options.quoteRequestData?this.options.quoteRequestData.items.length:1}_applyQuoteUpdates(t){!this.quote||!this.container||(t.spotPriceWithFees!==void 0&&(this.quote.communication.yesOptionText=this.quote.communication.yesOptionText.replace(`$${this.quote.spotPrice.toFixed(2)}`,`$${t.spotPriceWithFees.toFixed(2)}`)),this.destroy(),this._renderWidget())}_isPassOrTrip(){const t=this.options.quoteRequestData;if(Array.isArray(t))return t.some(s=>s.productType==="Pass"||s.productType==="Trip");if("items"in t)return t.items.some(s=>s.productType==="Pass"||s.productType==="Trip");const r=t;return r.productType==="Pass"||r.productType==="Trip"}_validState(){if(this._isPassOrTrip()&&!(!this.currentState||this.currentState===E))return this.currentState}_isQuotingAvailable(){return!this._isPassOrTrip()||this.options.state?!0:!!this.currentState&&this.currentState!==E}_setRadiosDisabled(t){var i,n,e;const r=(i=this.container)==null?void 0:i.querySelectorAll('input[name="selection"]'),s=(n=this.container)==null?void 0:n.querySelector(".spot-selection__options");r==null||r.forEach(o=>{o.disabled=t}),s==null||s.classList.toggle("spot-selection__options--disabled",t),t&&(r==null||r.forEach(o=>{o.checked=!1}),(e=this.container)==null||e.querySelectorAll(".spot-selection__option").forEach(o=>{o.classList.remove("selected")}),this.currentSelection=b.UNSELECTED,this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""))}_setNonUsResidentError(t){var s;if(!this._stateSelectEl)return;this._stateSelectEl.classList.toggle("spot-state-dropdown__select--error",t);const r=(s=this._stateSelectEl.parentElement)==null?void 0:s.querySelector(".spot-state-dropdown__error");r==null||r.classList.toggle("spot-state-dropdown__error--visible",t)}_setupStateDropdownListener(){this._stateSelectEl&&this._stateSelectEl.addEventListener("change",()=>{this.currentState=this._stateSelectEl.value,this._setRadiosDisabled(!this._isQuotingAvailable()),this._setNonUsResidentError(this.currentState===E)})}_setupOptionListeners(t){const r=t.querySelectorAll('input[type="radio"]'),s=t.querySelectorAll(".spot-selection__option");r.forEach(i=>{i.addEventListener("change",n=>{var p,m,f,v;const e=n.target,o=e.value;if(this.hideSelectionError(),this.currentSelection=o,s.forEach(h=>h.classList.remove("selected")),(p=e.closest(".spot-selection__option"))==null||p.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),o===b.YES&&((m=this.quote)!=null&&m.communication.paymentTerms&&I(this.paymentTermsEl,this.quote),(f=this.options.callbacks)!=null&&f.onOptIn)){const h={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id,state:this._validState()};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const l=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var _;const d=(_=l.items)==null?void 0:_.find(w=>(w.cartItemId||`item-${l.items.indexOf(w)+1}`)===u.cartItemId);return{quoteId:u.id,productPrice:(d==null?void 0:d.productPrice)||u.spotPrice,cartItemId:(d==null?void 0:d.cartItemId)||""}})}this.options.callbacks.onOptIn(h)}if(o===b.NO&&((v=this.options.callbacks)!=null&&v.onOptOut)){const h={status:"QUOTE_DECLINED",quoteId:this.quote.id,state:this._validState()};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const l=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var _;const d=(_=l.items)==null?void 0:_.find(w=>(w.cartItemId||`item-${l.items.indexOf(w)+1}`)===u.cartItemId);return{quoteId:u.id,productPrice:(d==null?void 0:d.productPrice)||u.spotPrice,cartItemId:(d==null?void 0:d.cartItemId)||""}})}this.options.callbacks.onOptOut(h)}})})}showSelectionError(){var t;if(!this.errorEl){this.errorEl=document.createElement("div"),this.errorEl.className="spot-selection__error",this.errorEl.textContent="Please make a selection";const r=(t=this.container)==null?void 0:t.querySelector(".spot-selection__options");r&&r.insertAdjacentElement("afterend",this.errorEl)}this.errorEl.style.display="block"}hideSelectionError(){this.errorEl&&(this.errorEl.style.display="none")}validateSelection(){if(!this.container)return!1;const t=!!this.container.querySelector('input[name="selection"]:checked');return t?this.hideSelectionError():this.showSelectionError(),t}async updateQuote(t){var r,s,i,n;try{const e={...this.options,quoteRequestData:t};N(e);const{environment:o,partnerId:p,customEndpoint:m}=this.options.apiConfig,f=m||M[o],h="items"in e.quoteRequestData?await S(f,p,e.quoteRequestData,this._validState()):await k(f,p,e.quoteRequestData,this._validState());if(h.status!=="QUOTE_AVAILABLE")return this.destroy(),h.status==="NO_MATCHING_QUOTE"&&((r=this.options.callbacks)!=null&&r.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:e.quoteRequestData}),!1;if(this.options.quoteRequestData=e.quoteRequestData,this.quote=h.data,this.destroy(),this._renderWidget(),(s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const l=this.options.callbacks.onQuoteRetrieved(this.quote);l&&this._applyQuoteUpdates(l)}return!0}catch(e){const o=e;return(n=(i=this.options.callbacks)==null?void 0:i.onError)==null||n.call(i,{message:o.message,status:o.status,responseBody:o.responseBody}),!1}}getSelection(){var r,s,i;if(this.currentSelection==null||this.currentSelection==b.UNSELECTED)return null;const t={selection:this.currentSelection,quoteId:(r=this.quote)==null?void 0:r.id,spotPrice:(s=this.quote)==null?void 0:s.spotPrice,status:this.currentSelection===b.YES?"QUOTE_ACCEPTED":"QUOTE_DECLINED",state:this.currentState};if((i=this.quote)!=null&&i.originalQuotes&&this.quote.originalQuotes.length>0){const n=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(e=>{var p;const o=(p=n.items)==null?void 0:p.find(m=>(m.cartItemId||`item-${n.items.indexOf(m)+1}`)===e.cartItemId);return{quoteId:e.id,productPrice:(o==null?void 0:o.productPrice)||e.spotPrice,cartItemId:(o==null?void 0:o.cartItemId)||""}})}return t}destroy(){window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeTimeout&&window.clearTimeout(this._resizeTimeout),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}}C.NON_US_RESIDENT_VALUE=E,C.SelectionEnum=b,C.default=X,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
35
+ </svg>`}return s}const G=":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-border-line-width: .0625rem;--spot-border-color: #e0e0e0;--spot-max-width: 51rem;--spot-margin: 1rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-bullets-checkmark-color: #2e2e2e;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-state-dropdown-label-font-size: .875rem;--spot-state-dropdown-label-font-weight: 600;--spot-state-dropdown-label-margin-bottom: .25rem;--spot-state-dropdown-select-border: .0625rem solid #e0e0e0;--spot-state-dropdown-select-border-radius: .375rem;--spot-state-dropdown-select-padding: .5rem .75rem;--spot-state-dropdown-select-font-size: .875rem;--spot-state-dropdown-select-background: #ffffff;--spot-state-dropdown-wrapper-margin-bottom: .75rem;--spot-state-dropdown-error-color: var(--spot-selection-error-font-color);--spot-state-dropdown-error-font-size: .8125rem;--spot-state-dropdown-error-margin-top: .25rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-covered-items-background: #f1f3f5;--spot-covered-items-hover-background: #e9ecef;--spot-covered-items-border-radius: .5rem;--spot-covered-items-padding: .75rem 1rem;--spot-covered-items-font-size: .875rem;--spot-covered-items-font-weight: 400;--spot-covered-items-font-color: #000000;--spot-covered-items-font-family: Arial;--spot-covered-items-arrow-font-size: .6rem;--spot-covered-items-arrow-color: #636569;--spot-covered-items-view-all-color: #636569;--spot-covered-items-view-all-font-size: .875rem;--spot-covered-items-view-all-font-weight: 400;--spot-covered-items-content-background: #f8f9fa;--spot-covered-items-content-border: 1px solid #e0e0e0;--spot-covered-items-content-border-radius: .5rem;--spot-covered-items-content-padding: .75rem 1rem;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 1.5rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:var(--spot-border-line-width) solid var(--spot-border-color);border-radius:var(--spot-border-radius);max-width:var(--spot-max-width);margin:var(--spot-margin);container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__wrapper{min-width:0;word-wrap:normal}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container{grid-row:1;margin-bottom:var(--spot-benefits-margin-bottom)}.desktop-layout .spot-covered-items__container{grid-row:2;grid-column:1;margin-bottom:var(--spot-covered-items-margin-bottom)}.desktop-layout .spot-selection__wrapper{grid-row:3;grid-column:1;margin-top:var(--spot-desktop-radio-margin-top)}.desktop-layout .spot-payment-terms__wrapper{grid-row:4;grid-column:1;margin-top:var(--spot-payment-terms-margin-top)}.desktop-layout .spot-table__container{grid-row:1 / span 4;grid-column:2;width:auto;min-width:20.3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-table__container{display:flex;justify-content:flex-start;margin-top:1rem;margin-bottom:1rem;box-sizing:border-box;padding:0 .3125rem}.spot-content__wrapper:not(.desktop-layout) .spot-refund__table{width:100%;max-width:22rem;table-layout:auto}@media (max-width: 850px){.spot-selection__recommended-tag{display:inline-block;margin-left:0}}@media (max-width: 500px){.spot-selection__recommended-tag{margin-top:.5rem}}@media (max-width: 600px){.spot-refund__table th{padding:0rem}}.spot-benefits__list{list-style-type:none;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-benefits__list li{margin-bottom:.375rem;display:flex;align-items:flex-start;gap:.5rem}.spot-benefits__list li svg{flex-shrink:0;position:relative;top:.125rem}.spot-bullets__checkmark path{stroke:var(--spot-bullets-checkmark-color)}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:.85rem;margin-bottom:.5rem;max-width:26rem}.spot-content__wrapper.desktop-layout:has(.spot-table__container) .spot-covered-items__container{margin-top:0rem;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-covered-items__list li:last-child{margin-bottom:0}.spot-covered-items__header{margin-bottom:.5rem}.spot-covered-items__toggle{background:var(--spot-covered-items-background);border:none;border-radius:var(--spot-covered-items-border-radius);padding:var(--spot-covered-items-padding);cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;transition:all .2s ease}.spot-covered-items__toggle:hover{background-color:var(--spot-covered-items-hover-background)}.spot-covered-items__toggle:focus{outline:none;box-shadow:0 0 0 2px #0000001a}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;margin:0;padding:0}.spot-covered-items__right-section{display:flex;align-items:center;gap:.5rem;margin-left:auto}.spot-covered-items__view-all{font-size:var(--spot-covered-items-view-all-font-size);font-weight:var(--spot-covered-items-view-all-font-weight);color:var(--spot-covered-items-view-all-color);font-family:var(--spot-covered-items-font-family);line-height:125%}.spot-covered-items__arrow{font-size:var(--spot-covered-items-arrow-font-size);transition:transform .2s ease;color:var(--spot-covered-items-arrow-color);flex-shrink:0;transform:scaleX(1.5)}.spot-covered-items__content{margin-top:.5rem;transition:all .2s ease;overflow:hidden}.spot-covered-items__list{background-color:var(--spot-covered-items-content-background);border:var(--spot-covered-items-content-border);border-radius:var(--spot-covered-items-content-border-radius);margin:0;padding:var(--spot-covered-items-content-padding)}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}.spot-state-dropdown__wrapper{display:flex;flex-direction:column;margin-bottom:var(--spot-state-dropdown-wrapper-margin-bottom)}.spot-state-dropdown__label{font-size:var(--spot-state-dropdown-label-font-size);font-weight:var(--spot-state-dropdown-label-font-weight);font-family:var(--spot-font-family);color:var(--spot-font-color);margin-bottom:var(--spot-state-dropdown-label-margin-bottom)}.spot-state-dropdown__select{width:100%;box-sizing:border-box;border:var(--spot-state-dropdown-select-border);border-radius:var(--spot-state-dropdown-select-border-radius);padding:var(--spot-state-dropdown-select-padding);font-size:var(--spot-state-dropdown-select-font-size);font-family:var(--spot-font-family);color:var(--spot-font-color);background-color:var(--spot-state-dropdown-select-background);cursor:pointer;-webkit-appearance:auto;-moz-appearance:auto;appearance:auto}.spot-state-dropdown__select:focus{outline:none;box-shadow:0 0 0 2px #00000026}.spot-state-dropdown__select--error{border-color:var(--spot-state-dropdown-error-color)}.spot-state-dropdown__select--error:focus{box-shadow:0 0 0 2px #ff000026}.spot-state-dropdown__error{display:none;color:var(--spot-state-dropdown-error-color);font-size:var(--spot-state-dropdown-error-font-size);font-family:var(--spot-font-family);margin-top:var(--spot-state-dropdown-error-margin-top)}.spot-state-dropdown__error--visible{display:block}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;min-width:.75rem;border:.0625rem solid var(--spot-radio-border);border-radius:var(--spot-radio-border-radius);margin-right:.5rem;position:relative;vertical-align:middle;top:-.0625rem;cursor:pointer;flex-shrink:0}input[type=radio]:checked{background:var(--spot-radio-checked-background);box-shadow:inset 0 0 0 .0625rem #fff}.spot-selection__options{display:flex;flex-direction:column;gap:.5rem}.spot-selection__option{display:flex;align-items:center;flex-wrap:nowrap;position:relative;transition:background .2s;cursor:pointer;font-size:var(--spot-radio-text-font-size);font-weight:var(--spot-radio-text-font-weight);color:var(--spot-radio-text-font-color);font-family:var(--spot-radio-text-font-family);padding:var(--spot-radio-text-padding);margin-right:.5rem}.spot-selection__option.selected{background:var(--spot-radio-selection-background);border-radius:var(--spot-radio-selection-border-radius);padding:var(--spot-radio-selection-padding)}.spot-selection__recommended-tag{background:var(--spot-recommended-tag-background);color:var(--spot-recommended-tag-font-color);font-size:var(--spot-recommended-tag-font-size);font-weight:var(--spot-recommended-tag-font-weight);padding:var(--spot-recommended-tag-padding);border-radius:var(--spot-recommended-tag-border-radius);margin-left:.75rem;white-space:nowrap;flex-shrink:0}@media (max-width: 850px){.spot-selection__recommended-tag{margin-left:.5rem}}@media (max-width: 600px){.spot-selection__recommended-tag{margin-left:.5rem;font-size:.75rem;padding:.1875rem .4375rem}}.spot-selection__error{color:var(--spot-selection-error-font-color);font-size:var(--spot-selection-error-font-size);padding:var(--spot-selection-error-padding);display:none}.spot-selection__options--disabled .spot-selection__option{opacity:.4;cursor:not-allowed;pointer-events:none}.spot-selection__options--disabled input[type=radio]{cursor:not-allowed}.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);color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);line-height:1.4;word-wrap:normal;-webkit-hyphens:none;hyphens:none;flex:1;min-width:0;overflow-wrap:normal}.spot-footer__terms-link{text-decoration:var(--spot-terms-link-text-decoration);font-size:var(--spot-terms-link-font-size);font-weight:var(--spot-terms-link-font-weight);color:var(--spot-terms-link-font-color);font-family:var(--spot-terms-link-font-family);padding:var(--spot-terms-link-padding)}.spot-footer__container{display:flex;flex-direction:row;justify-content:space-between;align-items:flex-start;flex-wrap:nowrap;gap:var(--spot-footer-gap)}@container (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}@media (max-width: 650px){.spot-footer__container{flex-direction:column!important;align-items:flex-start!important;flex-wrap:wrap!important}.spot-footer__terms{margin-right:0!important;margin-bottom:.5rem!important;flex:none!important;width:100%!important;max-width:none!important}}.spot-footer__powered-by{margin-top:0;flex-shrink:0}.spot-logo__top-right{position:absolute;top:-14px;right:40px;z-index:10;background:linear-gradient(to bottom,transparent 50%,inherit 50%);padding:0 .25rem}.spot-logo__top-right svg{border-radius:1.25rem;border:var(--spot-border-line-width) solid var(--spot-border-color);display:block;background:var(--spot-background-color)}@container (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}@media (min-width: 651px){.spot-footer__powered-by{margin-top:0;align-self:center}.spot-footer__terms{margin-right:var(--spot-footer-terms-margin-right)}}";function K(d){const t=document.createElement("style");t.textContent=d,document.head.appendChild(t)}K(G);const M={sandbox:"https://api.sandbox.getspot.com/api/v1/quote",production:"https://api.getspot.com/api/v1/quote",local:"http://localhost:3999/api/v1/quote"};class X{constructor(t={}){this._destroyed=!1,this.options={location:"body",showTable:!0,logoPosition:"bottom-right",apiConfig:{environment:"production",partnerId:""},quoteRequestData:{},callbacks:{},useMockData:!1,...t,selection:t.selection??b.UNSELECTED},this._onResize=this._updateLayout.bind(this),this.root=typeof this.options.location=="string"?document.querySelector(this.options.location):this.options.location,this.currentSelection=this.options.selection,this._init()}async _init(){var t,r,s,i,n;try{N(this.options),this.currentState=this.options.state;let e;if(this.options.useMockData&&this.options.mockData)e=this.options.mockData;else{const{environment:o,partnerId:p}=this.options.apiConfig,f=this.options.apiConfig.customEndpoint||M[o];e="items"in this.options.quoteRequestData?await D(f,p,this.options.quoteRequestData,this._validState()):await k(f,p,this.options.quoteRequestData,this._validState())}if(this._destroyed)return;if(e.status!=="QUOTE_AVAILABLE"){e.status==="NO_MATCHING_QUOTE"&&((t=this.options.callbacks)!=null&&t.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:this.options.quoteRequestData});return}if(this.quote=e.data,!this.quote)throw new Error("No quote data in response");if(this._renderWidget(),this.options.selection===b.YES&&((r=this.options.callbacks)!=null&&r.onOptIn)){const o={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id,state:this._validState()};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const p=this.options.quoteRequestData;o.batchQuoteDetails=this.quote.originalQuotes.map(m=>{var v;const f=(v=p.items)==null?void 0:v.find(h=>(h.cartItemId||`item-${p.items.indexOf(h)+1}`)===m.cartItemId);return{quoteId:m.id,productPrice:(f==null?void 0:f.productPrice)||m.spotPrice,cartItemId:(f==null?void 0:f.cartItemId)||""}})}this.options.callbacks.onOptIn(o)}if((s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const o=this.options.callbacks.onQuoteRetrieved(this.quote);o&&this._applyQuoteUpdates(o)}}catch(e){if(this._destroyed)return;if((i=this.options.callbacks)!=null&&i.onError){const o=e;(n=this.options.callbacks)==null||n.onError({message:o.message,status:o.status,responseBody:o.responseBody})}}}_renderWidget(){if(!this.quote)return;this.container=document.createElement("div"),this.container.className="spot-refund-guarantee",this.root.appendChild(this.container),Object.entries(this.options.theme||{}).forEach(([e,o])=>{const p=`--${e}`;this.container.style.setProperty(p,o)}),V(this.container,this.quote.communication);const t=document.createElement("div");if(t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?Q(t,this.quote.qualifyingReasons):U(t,this.quote.communication.bulletPoints),this.quote.coveredItems){const e=this._getTotalItemsInRequest();Z(t,this.quote.coveredItems,e)}this.options.showTable&&!this.quote.qualifyingReasons&&j(t,this.quote.payoutSchedule,this.quote.currencyCode);const r=a("div",{className:"spot-selection__wrapper",parent:t});this._isPassOrTrip()&&!this.options.state&&(this._stateSelectEl=F(r,this.currentState),this._setNonUsResidentError(this.currentState===E));const i=!this._isQuotingAvailable(),n=W(r,this.currentSelection,this.quote.communication,i);this.paymentTermsEl=a("div",{className:"spot-payment-terms__wrapper",parent:t}),this.currentSelection===b.YES&&I(this.paymentTermsEl,this.quote),Y(this.container,this.quote,this.options.logoPosition),window.addEventListener("resize",this._onResize),this._setupResizeObserver(),this._updateLayout(),this._setupOptionListeners(n),this._setupStateDropdownListener()}_updateLayout(){if(!this.container||!this.quote)return;const t=this.container.querySelector(".spot-content__wrapper"),r=this.options.showTable&&!this.quote.qualifyingReasons;if(!t||!r){t==null||t.classList.remove("desktop-layout");return}const s=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",s)}_shouldUseDesktopLayout(t){const r=this.container.offsetWidth-40,s=325,i=16;if(r>=900)return!0;if(r>=650){const n=t.classList.contains("desktop-layout");t.classList.remove("desktop-layout"),t.offsetHeight;const e=t.querySelector(".spot-benefits__list, .spot-qualifying-reasons__container");if(!e)return n&&t.classList.add("desktop-layout"),n;const p=Math.min(e.scrollWidth,400)+s+i;return n&&t.classList.add("desktop-layout"),r>=p}return!1}_setupResizeObserver(){!this.container||!window.ResizeObserver||(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=window.setTimeout(()=>{this._updateLayout()},100)}),this._resizeObserver.observe(this.container))}_getTotalItemsInRequest(){return"items"in this.options.quoteRequestData?this.options.quoteRequestData.items.length:1}_applyQuoteUpdates(t){!this.quote||!this.container||(t.spotPriceWithFees!==void 0&&(this.quote.communication.yesOptionText=this.quote.communication.yesOptionText.replace(`$${this.quote.spotPrice.toFixed(2)}`,`$${t.spotPriceWithFees.toFixed(2)}`)),this._teardownDom(),this._renderWidget())}_isPassOrTrip(){const t=this.options.quoteRequestData;if(Array.isArray(t))return t.some(s=>s.productType==="Pass"||s.productType==="Trip");if("items"in t)return t.items.some(s=>s.productType==="Pass"||s.productType==="Trip");const r=t;return r.productType==="Pass"||r.productType==="Trip"}_validState(){if(this._isPassOrTrip()&&!(!this.currentState||this.currentState===E))return this.currentState}_isQuotingAvailable(){return!this._isPassOrTrip()||this.options.state?!0:!!this.currentState&&this.currentState!==E}_setRadiosDisabled(t){var i,n,e;const r=(i=this.container)==null?void 0:i.querySelectorAll('input[name="selection"]'),s=(n=this.container)==null?void 0:n.querySelector(".spot-selection__options");r==null||r.forEach(o=>{o.disabled=t}),s==null||s.classList.toggle("spot-selection__options--disabled",t),t&&(r==null||r.forEach(o=>{o.checked=!1}),(e=this.container)==null||e.querySelectorAll(".spot-selection__option").forEach(o=>{o.classList.remove("selected")}),this.currentSelection=b.UNSELECTED,this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""))}_setNonUsResidentError(t){var s;if(!this._stateSelectEl)return;this._stateSelectEl.classList.toggle("spot-state-dropdown__select--error",t);const r=(s=this._stateSelectEl.parentElement)==null?void 0:s.querySelector(".spot-state-dropdown__error");r==null||r.classList.toggle("spot-state-dropdown__error--visible",t)}_setupStateDropdownListener(){this._stateSelectEl&&this._stateSelectEl.addEventListener("change",()=>{this.currentState=this._stateSelectEl.value,this._setRadiosDisabled(!this._isQuotingAvailable()),this._setNonUsResidentError(this.currentState===E)})}_setupOptionListeners(t){const r=t.querySelectorAll('input[type="radio"]'),s=t.querySelectorAll(".spot-selection__option");r.forEach(i=>{i.addEventListener("change",n=>{var p,m,f,v;const e=n.target,o=e.value;if(this.hideSelectionError(),this.currentSelection=o,s.forEach(h=>h.classList.remove("selected")),(p=e.closest(".spot-selection__option"))==null||p.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),o===b.YES&&((m=this.quote)!=null&&m.communication.paymentTerms&&I(this.paymentTermsEl,this.quote),(f=this.options.callbacks)!=null&&f.onOptIn)){const h={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id,state:this._validState()};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const l=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var _;const c=(_=l.items)==null?void 0:_.find(w=>(w.cartItemId||`item-${l.items.indexOf(w)+1}`)===u.cartItemId);return{quoteId:u.id,productPrice:(c==null?void 0:c.productPrice)||u.spotPrice,cartItemId:(c==null?void 0:c.cartItemId)||""}})}this.options.callbacks.onOptIn(h)}if(o===b.NO&&((v=this.options.callbacks)!=null&&v.onOptOut)){const h={status:"QUOTE_DECLINED",quoteId:this.quote.id,state:this._validState()};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const l=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var _;const c=(_=l.items)==null?void 0:_.find(w=>(w.cartItemId||`item-${l.items.indexOf(w)+1}`)===u.cartItemId);return{quoteId:u.id,productPrice:(c==null?void 0:c.productPrice)||u.spotPrice,cartItemId:(c==null?void 0:c.cartItemId)||""}})}this.options.callbacks.onOptOut(h)}})})}showSelectionError(){var t;if(!this.errorEl){this.errorEl=document.createElement("div"),this.errorEl.className="spot-selection__error",this.errorEl.textContent="Please make a selection";const r=(t=this.container)==null?void 0:t.querySelector(".spot-selection__options");r&&r.insertAdjacentElement("afterend",this.errorEl)}this.errorEl.style.display="block"}hideSelectionError(){this.errorEl&&(this.errorEl.style.display="none")}validateSelection(){if(!this.container)return!1;const t=!!this.container.querySelector('input[name="selection"]:checked');return t?this.hideSelectionError():this.showSelectionError(),t}async updateQuote(t){var r,s,i,n;if(this._destroyed)return!1;try{const e={...this.options,quoteRequestData:t};N(e);const{environment:o,partnerId:p,customEndpoint:m}=this.options.apiConfig,f=m||M[o],h="items"in e.quoteRequestData?await D(f,p,e.quoteRequestData,this._validState()):await k(f,p,e.quoteRequestData,this._validState());if(this._destroyed)return!1;if(h.status!=="QUOTE_AVAILABLE")return this._teardownDom(),h.status==="NO_MATCHING_QUOTE"&&((r=this.options.callbacks)!=null&&r.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:e.quoteRequestData}),!1;if(this.options.quoteRequestData=e.quoteRequestData,this.quote=h.data,this._teardownDom(),this._renderWidget(),(s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const l=this.options.callbacks.onQuoteRetrieved(this.quote);l&&this._applyQuoteUpdates(l)}return!0}catch(e){if(this._destroyed)return!1;const o=e;return(n=(i=this.options.callbacks)==null?void 0:i.onError)==null||n.call(i,{message:o.message,status:o.status,responseBody:o.responseBody}),!1}}getSelection(){var r,s,i;if(this.currentSelection==null||this.currentSelection==b.UNSELECTED)return null;const t={selection:this.currentSelection,quoteId:(r=this.quote)==null?void 0:r.id,spotPrice:(s=this.quote)==null?void 0:s.spotPrice,status:this.currentSelection===b.YES?"QUOTE_ACCEPTED":"QUOTE_DECLINED",state:this.currentState};if((i=this.quote)!=null&&i.originalQuotes&&this.quote.originalQuotes.length>0){const n=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(e=>{var p;const o=(p=n.items)==null?void 0:p.find(m=>(m.cartItemId||`item-${n.items.indexOf(m)+1}`)===e.cartItemId);return{quoteId:e.id,productPrice:(o==null?void 0:o.productPrice)||e.spotPrice,cartItemId:(o==null?void 0:o.cartItemId)||""}})}return t}destroy(){this._destroyed=!0,this._teardownDom()}_teardownDom(){window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeTimeout&&window.clearTimeout(this._resizeTimeout),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}}C.NON_US_RESIDENT_VALUE=E,C.SelectionEnum=b,C.default=X,Object.defineProperties(C,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
package/dist/ui.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,SAAS,EAAE,CAAC;AAExE,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC1D,GAAG,EAAE,CAAC,EACN,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAE,cAAmB,GACxE,qBAAqB,CAAC,CAAC,CAAC,CAS1B;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAC,GACjE,IAAI,CAWN;AAGD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,MAAM,EAAO,GACrB,IAAI,CAcN;AAGD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,EACtB,iBAAiB,GAAE,gBAAgB,EAAO,GACzC,IAAI,CA0EN;AAGD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,YAAY,GAAE,MAAM,EAAO,EAC3B,mBAAmB,CAAC,EAAE,MAAM,GAC3B,IAAI,CAiHN;AA6BD,wBAAgB,WAAW,CACzB,SAAS,EAAE,WAAW,EACtB,QAAQ,GAAE,kBAAkB,EAAO,EACnC,YAAY,GAAE,MAAc,GAC3B,IAAI,CA2BN;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,iBAAiB,CA6CnB;AAGD,wBAAgB,aAAa,CAC3B,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,aAAa,EAC5B,QAAQ,UAAQ,GACf,WAAW,CA4Cb;AAGD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,KAAK,GACX,WAAW,GAAG,IAAI,CAuBpB;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,KAAK,EACZ,YAAY,GAAE,cAAc,GAAG,WAA4B,GAC1D,WAAW,CAwEb"}
1
+ {"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../src/ui.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,aAAa,EACb,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,EACL,aAAa,EACd,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC9F,OAAO,EAAE,0BAA0B,EAAE,qBAAqB,EAAE,SAAS,EAAE,CAAC;AAExE,wBAAgB,MAAM,CAAC,CAAC,SAAS,MAAM,qBAAqB,EAC1D,GAAG,EAAE,CAAC,EACN,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAE,cAAmB,GACxE,qBAAqB,CAAC,CAAC,CAAC,CAS1B;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,IAAI,CAAC,aAAa,EAAE,MAAM,GAAG,aAAa,CAAC,GACjE,IAAI,CAWN;AAGD,wBAAgB,cAAc,CAC5B,SAAS,EAAE,WAAW,EACtB,OAAO,GAAE,MAAM,EAAO,GACrB,IAAI,CAcN;AAGD,wBAAgB,uBAAuB,CACrC,SAAS,EAAE,WAAW,EACtB,iBAAiB,GAAE,gBAAgB,EAAO,GACzC,IAAI,CA0EN;AAGD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,YAAY,GAAE,MAAM,EAAO,EAC3B,mBAAmB,CAAC,EAAE,MAAM,GAC3B,IAAI,CAuHN;AA6BD,wBAAgB,WAAW,CACzB,SAAS,EAAE,WAAW,EACtB,QAAQ,GAAE,kBAAkB,EAAO,EACnC,YAAY,GAAE,MAAc,GAC3B,IAAI,CA2BN;AAED,wBAAgB,mBAAmB,CACjC,SAAS,EAAE,WAAW,EACtB,YAAY,CAAC,EAAE,MAAM,GACpB,iBAAiB,CA6CnB;AAGD,wBAAgB,aAAa,CAC3B,SAAS,EAAE,WAAW,EACtB,SAAS,EAAE,aAAa,EACxB,aAAa,EAAE,aAAa,EAC5B,QAAQ,UAAQ,GACf,WAAW,CA4Cb;AAGD,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,KAAK,GACX,WAAW,GAAG,IAAI,CAuBpB;AAGD,wBAAgB,YAAY,CAC1B,SAAS,EAAE,WAAW,EACtB,KAAK,EAAE,KAAK,EACZ,YAAY,GAAE,cAAc,GAAG,WAA4B,GAC1D,WAAW,CAwEb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getspot/spot-widget",
3
- "version": "4.4.0",
3
+ "version": "4.4.2",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },