@getspot/spot-widget 2.1.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +10 -6
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +96 -81
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +4 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @getspot/spot-widget
|
|
2
2
|
|
|
3
|
+
## 3.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a7c82e3: Update to possible values of QuoteUpdates; Also, handle the yesOptionText replacement for spotPriceWithFees
|
|
8
|
+
|
|
9
|
+
## 3.0.0
|
|
10
|
+
|
|
11
|
+
### Major Changes
|
|
12
|
+
|
|
13
|
+
- c1cce5f: Add ability to override displayed price in onQuoteRetrieved callback
|
|
14
|
+
|
|
3
15
|
## 2.1.1
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -456,6 +456,14 @@ export interface Quote {
|
|
|
456
456
|
}
|
|
457
457
|
```
|
|
458
458
|
|
|
459
|
+
#### QuoteUpdates
|
|
460
|
+
|
|
461
|
+
```typescript
|
|
462
|
+
export interface QuoteUpdates {
|
|
463
|
+
spotPriceWithFees?: number;
|
|
464
|
+
}
|
|
465
|
+
```
|
|
466
|
+
|
|
459
467
|
#### ApiResponse
|
|
460
468
|
|
|
461
469
|
```typescript
|
|
@@ -494,12 +502,8 @@ export interface SelectionData {
|
|
|
494
502
|
export interface Callbacks {
|
|
495
503
|
onOptIn?: (data: SelectionData) => void;
|
|
496
504
|
onOptOut?: (data: SelectionData) => void;
|
|
497
|
-
onQuoteRetrieved?: (quote: Quote) => void;
|
|
498
|
-
onError?: (error: {
|
|
499
|
-
message: string;
|
|
500
|
-
status?: number;
|
|
501
|
-
responseBody?: any;
|
|
502
|
-
}) => void;
|
|
505
|
+
onQuoteRetrieved?: (quote: Quote) => QuoteUpdates | void;
|
|
506
|
+
onError?: (error: { message: string; status?: number; responseBody?: any }) => void;
|
|
503
507
|
noMatchingQuote?: (data: { status: string; data: QuoteRequestData }) => void;
|
|
504
508
|
}
|
|
505
509
|
```
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ declare class SpotWidget {
|
|
|
16
16
|
private _shouldUseDesktopLayout;
|
|
17
17
|
private _setupResizeObserver;
|
|
18
18
|
private _resizeTimeout?;
|
|
19
|
+
private _applyQuoteUpdates;
|
|
19
20
|
private _setupOptionListeners;
|
|
20
21
|
showSelectionError(): void;
|
|
21
22
|
hideSelectionError(): void;
|
|
@@ -25,5 +26,5 @@ declare class SpotWidget {
|
|
|
25
26
|
destroy(): void;
|
|
26
27
|
}
|
|
27
28
|
export default SpotWidget;
|
|
28
|
-
export type { SpotWidgetOptions, SelectionData, Quote, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, CartInfo, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme, } from "./types.js";
|
|
29
|
+
export type { SpotWidgetOptions, SelectionData, Quote, QuoteUpdates, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, CartInfo, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme, } from "./types.js";
|
|
29
30
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,iBAAiB,EAEjB,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts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.js
CHANGED
|
@@ -43,48 +43,48 @@ async function D(d, t, o) {
|
|
|
43
43
|
cartId: o.cartInfo.cartId,
|
|
44
44
|
cartName: o.cartInfo.cartName,
|
|
45
45
|
currencyCode: o.cartInfo.currencyCode,
|
|
46
|
-
items: o.items.map((
|
|
47
|
-
cartItemId:
|
|
48
|
-
productPrice:
|
|
49
|
-
productType:
|
|
50
|
-
productDuration:
|
|
51
|
-
productId:
|
|
52
|
-
productName:
|
|
53
|
-
participantDescription:
|
|
54
|
-
eventType:
|
|
55
|
-
startDate:
|
|
56
|
-
endDate:
|
|
46
|
+
items: o.items.map((a, u) => ({
|
|
47
|
+
cartItemId: a.cartItemId || `item-${u + 1}`,
|
|
48
|
+
productPrice: a.productPrice,
|
|
49
|
+
productType: a.productType,
|
|
50
|
+
productDuration: a.productDuration,
|
|
51
|
+
productId: a.productId,
|
|
52
|
+
productName: a.productName,
|
|
53
|
+
participantDescription: a.participantDescription,
|
|
54
|
+
eventType: a.eventType,
|
|
55
|
+
startDate: a.startDate,
|
|
56
|
+
endDate: a.endDate
|
|
57
57
|
}))
|
|
58
58
|
}, e = await H(d, t, r);
|
|
59
59
|
if (e.status !== "QUOTES_AVAILABLE" && e.status !== "QUOTE_AVAILABLE")
|
|
60
60
|
return { status: "NO_MATCHING_QUOTE" };
|
|
61
|
-
const n = e.quotes.map((
|
|
61
|
+
const n = e.quotes.map((a) => {
|
|
62
62
|
const u = o.items.find(
|
|
63
|
-
(h, f) => (h.cartItemId || `item-${f + 1}`) ===
|
|
63
|
+
(h, f) => (h.cartItemId || `item-${f + 1}`) === a.cartItemId
|
|
64
64
|
);
|
|
65
|
-
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${
|
|
66
|
-
}),
|
|
65
|
+
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${a.id}`;
|
|
66
|
+
}), s = Math.round((e.totalSpotPrice || e.spotPrice || 0) * 100) / 100;
|
|
67
67
|
return {
|
|
68
68
|
status: "QUOTE_AVAILABLE",
|
|
69
69
|
data: {
|
|
70
|
-
id: e.quotes ? e.quotes.map((
|
|
71
|
-
spotPrice:
|
|
70
|
+
id: e.quotes ? e.quotes.map((a) => a.id).join(",") : ((i = e.data) == null ? void 0 : i.id) || "",
|
|
71
|
+
spotPrice: s,
|
|
72
72
|
currencyCode: e.currencyCode || "",
|
|
73
73
|
communication: {
|
|
74
74
|
...e.communication,
|
|
75
75
|
yesOptionText: e.communication.yesOptionText.replace(
|
|
76
76
|
String(e.totalSpotPrice),
|
|
77
|
-
String(
|
|
77
|
+
String(s)
|
|
78
78
|
)
|
|
79
79
|
},
|
|
80
|
-
payoutSchedule: e.payoutSchedule.map((
|
|
81
|
-
...
|
|
82
|
-
amount:
|
|
80
|
+
payoutSchedule: e.payoutSchedule.map((a) => ({
|
|
81
|
+
...a,
|
|
82
|
+
amount: a.amount !== void 0 ? a.amount : 0
|
|
83
83
|
})),
|
|
84
84
|
coveredItems: n,
|
|
85
85
|
originalQuotes: e.quotes || (e.data ? [e.data] : [])
|
|
86
86
|
},
|
|
87
|
-
spotPrice:
|
|
87
|
+
spotPrice: s,
|
|
88
88
|
coveredItems: n
|
|
89
89
|
};
|
|
90
90
|
} catch (r) {
|
|
@@ -105,12 +105,12 @@ function I(d) {
|
|
|
105
105
|
theme: e
|
|
106
106
|
} = d, {
|
|
107
107
|
environment: n = "sandbox",
|
|
108
|
-
partnerId:
|
|
109
|
-
customEndpoint:
|
|
108
|
+
partnerId: s,
|
|
109
|
+
customEndpoint: a
|
|
110
110
|
} = t;
|
|
111
|
-
if (!
|
|
111
|
+
if (!s || typeof s != "string")
|
|
112
112
|
throw new Error("Invalid or missing partnerId in apiConfig");
|
|
113
|
-
if (!(
|
|
113
|
+
if (!(a || M[n]))
|
|
114
114
|
throw new Error(`Invalid environment in apiConfig: ${n}`);
|
|
115
115
|
if (!o || typeof o != "object" && !Array.isArray(o))
|
|
116
116
|
throw new Error("quoteRequestData must be a non-null object or array");
|
|
@@ -250,8 +250,8 @@ function I(d) {
|
|
|
250
250
|
);
|
|
251
251
|
}
|
|
252
252
|
function p(d, { text: t, className: o, parent: i, innerHTML: r, href: e, target: n } = {}) {
|
|
253
|
-
const
|
|
254
|
-
return o && (
|
|
253
|
+
const s = document.createElement(d);
|
|
254
|
+
return o && (s.className = o), t != null && (s.textContent = t), r != null && (s.innerHTML = r), e && "href" in s && (s.href = e), n && "target" in s && (s.target = n), i && i.appendChild(s), s;
|
|
255
255
|
}
|
|
256
256
|
function N(d, { name: t, description: o }) {
|
|
257
257
|
p("div", {
|
|
@@ -283,7 +283,7 @@ function O(d, t = []) {
|
|
|
283
283
|
const o = p("div", {
|
|
284
284
|
className: "spot-qualifying-reasons__container",
|
|
285
285
|
parent: d
|
|
286
|
-
}), i = [...t].sort((
|
|
286
|
+
}), i = [...t].sort((a, u) => a.rank - u.rank), r = p("div", {
|
|
287
287
|
className: "spot-qualifying-reasons__grid",
|
|
288
288
|
parent: o
|
|
289
289
|
}), e = {
|
|
@@ -295,8 +295,8 @@ function O(d, t = []) {
|
|
|
295
295
|
"Severe Weather": "umbrella.svg",
|
|
296
296
|
"Travel Interruption": "plane.svg",
|
|
297
297
|
"Military Duty": "medal.svg"
|
|
298
|
-
}, n = new URL(import.meta.url),
|
|
299
|
-
i.forEach((
|
|
298
|
+
}, n = new URL(import.meta.url), s = n.origin + n.pathname.replace(/\/src\/[^/]*$/, "/assets/");
|
|
299
|
+
i.forEach((a) => {
|
|
300
300
|
var y, c, l;
|
|
301
301
|
const u = p("div", {
|
|
302
302
|
className: "spot-qualifying-reasons__item",
|
|
@@ -304,16 +304,16 @@ function O(d, t = []) {
|
|
|
304
304
|
}), h = p("div", {
|
|
305
305
|
className: "spot-qualifying-reasons__icon-wrapper",
|
|
306
306
|
parent: u
|
|
307
|
-
}), f = e[((y =
|
|
307
|
+
}), f = e[((y = a.benefitType) == null ? void 0 : y.name) || ""] || e[a.name || ""];
|
|
308
308
|
if (f) {
|
|
309
309
|
const m = p("img", {
|
|
310
310
|
parent: h
|
|
311
311
|
});
|
|
312
|
-
m.src =
|
|
312
|
+
m.src = s + f, m.alt = ((c = a.benefitType) == null ? void 0 : c.name) || a.name || "", m.className = "spot-qualifying-reasons__icon";
|
|
313
313
|
}
|
|
314
314
|
p("span", {
|
|
315
315
|
className: "spot-qualifying-reasons__label",
|
|
316
|
-
text: ((l =
|
|
316
|
+
text: ((l = a.benefitType) == null ? void 0 : l.name) || a.name || "",
|
|
317
317
|
parent: u
|
|
318
318
|
});
|
|
319
319
|
});
|
|
@@ -348,14 +348,14 @@ function P(d, t = []) {
|
|
|
348
348
|
}), r = p("thead", { parent: i }), e = p("tr", { parent: r });
|
|
349
349
|
p("th", { text: "When you cancel", parent: e }), p("th", { text: "You will receive", parent: e });
|
|
350
350
|
const n = p("tbody", { parent: i });
|
|
351
|
-
t.forEach(({ text:
|
|
351
|
+
t.forEach(({ text: s, percent: a, amount: u }) => {
|
|
352
352
|
const h = p("tr", { parent: n });
|
|
353
|
-
p("td", { text:
|
|
354
|
-
const f =
|
|
353
|
+
p("td", { text: s, parent: h });
|
|
354
|
+
const f = a === "Not eligible for refund" ? "Not eligible for a refund" : `$${u} refund`;
|
|
355
355
|
p("td", { text: f, parent: h });
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
|
-
function
|
|
358
|
+
function $(d, t, o) {
|
|
359
359
|
const i = p("div", {
|
|
360
360
|
className: "spot-selection__options",
|
|
361
361
|
parent: d
|
|
@@ -374,10 +374,10 @@ function V(d, t, o) {
|
|
|
374
374
|
const n = p("label", {
|
|
375
375
|
className: "spot-selection__option",
|
|
376
376
|
parent: i
|
|
377
|
-
}),
|
|
378
|
-
return
|
|
377
|
+
}), s = p("input", { parent: n });
|
|
378
|
+
return s.type = "radio", s.name = "selection", s.value = "no", p("span", { text: o.noOptionText, parent: n }), i;
|
|
379
379
|
}
|
|
380
|
-
function
|
|
380
|
+
function V(d, t) {
|
|
381
381
|
var r;
|
|
382
382
|
const o = (r = t.communication) == null ? void 0 : r.paymentTerms, i = p("div", {
|
|
383
383
|
className: "spot-payment-terms",
|
|
@@ -393,7 +393,7 @@ function R(d, t) {
|
|
|
393
393
|
parent: i
|
|
394
394
|
}), i;
|
|
395
395
|
}
|
|
396
|
-
function
|
|
396
|
+
function R(d, t, o = "bottom-right") {
|
|
397
397
|
if (o === "top-right") {
|
|
398
398
|
const e = p("div", {
|
|
399
399
|
className: "spot-logo__top-right",
|
|
@@ -456,12 +456,12 @@ function $(d, t, o = "bottom-right") {
|
|
|
456
456
|
}
|
|
457
457
|
return i;
|
|
458
458
|
}
|
|
459
|
-
const S = ":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--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:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:51rem;margin:1rem;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__options{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__options{grid-row:3;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;padding-left:.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-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:0;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;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-payment-terms__wrapper{margin-top:1rem}.spot-payment-terms__header{font-weight:var(--spot-payment-terms-header-font-weight);margin-bottom:.5rem;padding:var(--spot-payment-terms-header-padding);font-size:var(--spot-payment-terms-header-font-size);border-bottom:1px solid var(--spot-payment-terms-header-border-color)}.spot-payment-terms{background-color:var(--spot-payment-terms-background);border-radius:var(--spot-payment-terms-border-radius);padding:var(--spot-payment-terms-padding);margin-right:.5rem;color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);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:#fff;padding:0 8px}@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)}}";
|
|
460
|
-
function
|
|
459
|
+
const Q = ":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--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:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:51rem;margin:1rem;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__options{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__options{grid-row:3;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;padding-left:.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-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:0;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;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-payment-terms__wrapper{margin-top:1rem}.spot-payment-terms__header{font-weight:var(--spot-payment-terms-header-font-weight);margin-bottom:.5rem;padding:var(--spot-payment-terms-header-padding);font-size:var(--spot-payment-terms-header-font-size);border-bottom:1px solid var(--spot-payment-terms-header-border-color)}.spot-payment-terms{background-color:var(--spot-payment-terms-background);border-radius:var(--spot-payment-terms-border-radius);padding:var(--spot-payment-terms-padding);margin-right:.5rem;color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);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:#fff;padding:0 8px}@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)}}";
|
|
460
|
+
function S(d) {
|
|
461
461
|
const t = document.createElement("style");
|
|
462
462
|
t.textContent = d, document.head.appendChild(t);
|
|
463
463
|
}
|
|
464
|
-
Q
|
|
464
|
+
S(Q);
|
|
465
465
|
const T = {
|
|
466
466
|
sandbox: "https://api.sandbox.getspot.com/api/v1/quote",
|
|
467
467
|
production: "https://api.getspot.com/api/v1/quote",
|
|
@@ -489,14 +489,14 @@ class Z {
|
|
|
489
489
|
if (this.options.useMockData && this.options.mockData)
|
|
490
490
|
n = this.options.mockData;
|
|
491
491
|
else {
|
|
492
|
-
const { environment:
|
|
492
|
+
const { environment: s, partnerId: a } = this.options.apiConfig, h = this.options.apiConfig.customEndpoint || T[s];
|
|
493
493
|
n = "cartInfo" in this.options.quoteRequestData && "items" in this.options.quoteRequestData ? await D(
|
|
494
494
|
h,
|
|
495
|
-
|
|
495
|
+
a,
|
|
496
496
|
this.options.quoteRequestData
|
|
497
497
|
) : await k(
|
|
498
498
|
h,
|
|
499
|
-
|
|
499
|
+
a,
|
|
500
500
|
this.options.quoteRequestData
|
|
501
501
|
);
|
|
502
502
|
}
|
|
@@ -510,17 +510,17 @@ class Z {
|
|
|
510
510
|
if (this.quote = n.data, !this.quote)
|
|
511
511
|
throw new Error("No quote data in response");
|
|
512
512
|
if (this._renderWidget(), this.options.optInSelected && ((o = this.options.callbacks) != null && o.onOptIn)) {
|
|
513
|
-
const
|
|
513
|
+
const s = {
|
|
514
514
|
status: "QUOTE_ACCEPTED",
|
|
515
515
|
spotPrice: this.quote.spotPrice,
|
|
516
516
|
quoteId: this.quote.id
|
|
517
517
|
};
|
|
518
518
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
519
|
-
const
|
|
520
|
-
|
|
519
|
+
const a = this.options.quoteRequestData;
|
|
520
|
+
s.batchQuoteDetails = this.quote.originalQuotes.map((u) => {
|
|
521
521
|
var f;
|
|
522
|
-
const h = (f =
|
|
523
|
-
(y) => (y.cartItemId || `item-${
|
|
522
|
+
const h = (f = a.items) == null ? void 0 : f.find(
|
|
523
|
+
(y) => (y.cartItemId || `item-${a.items.indexOf(y) + 1}`) === u.id
|
|
524
524
|
);
|
|
525
525
|
return {
|
|
526
526
|
quoteId: u.id,
|
|
@@ -529,16 +529,19 @@ class Z {
|
|
|
529
529
|
};
|
|
530
530
|
});
|
|
531
531
|
}
|
|
532
|
-
this.options.callbacks.onOptIn(
|
|
532
|
+
this.options.callbacks.onOptIn(s);
|
|
533
|
+
}
|
|
534
|
+
if ((i = this.options.callbacks) != null && i.onQuoteRetrieved) {
|
|
535
|
+
const s = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
536
|
+
s && this._applyQuoteUpdates(s);
|
|
533
537
|
}
|
|
534
|
-
(i = this.options.callbacks) != null && i.onQuoteRetrieved && this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
535
538
|
} catch (n) {
|
|
536
539
|
if ((r = this.options.callbacks) != null && r.onError) {
|
|
537
|
-
const
|
|
540
|
+
const s = n;
|
|
538
541
|
(e = this.options.callbacks) == null || e.onError({
|
|
539
|
-
message:
|
|
540
|
-
status:
|
|
541
|
-
responseBody:
|
|
542
|
+
message: s.message,
|
|
543
|
+
status: s.status,
|
|
544
|
+
responseBody: s.responseBody
|
|
542
545
|
});
|
|
543
546
|
}
|
|
544
547
|
}
|
|
@@ -551,7 +554,7 @@ class Z {
|
|
|
551
554
|
}), N(this.container, this.quote.communication);
|
|
552
555
|
const t = document.createElement("div");
|
|
553
556
|
t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ? O(t, this.quote.qualifyingReasons) : z(t, this.quote.communication.bulletPoints), this.quote.coveredItems && L(t, this.quote.coveredItems), this.options.showTable && !this.quote.qualifyingReasons && P(t, this.quote.payoutSchedule);
|
|
554
|
-
const o =
|
|
557
|
+
const o = $(
|
|
555
558
|
t,
|
|
556
559
|
this.options.optInSelected,
|
|
557
560
|
this.quote.communication
|
|
@@ -559,7 +562,7 @@ class Z {
|
|
|
559
562
|
t.appendChild(o), this.paymentTermsEl = p("div", {
|
|
560
563
|
className: "spot-payment-terms__wrapper",
|
|
561
564
|
parent: t
|
|
562
|
-
}),
|
|
565
|
+
}), R(this.container, this.quote, this.options.logoPosition), window.addEventListener("resize", this._onResize), this._setupResizeObserver(), this._updateLayout(), this._setupOptionListeners(o);
|
|
563
566
|
}
|
|
564
567
|
_updateLayout() {
|
|
565
568
|
if (!this.container || !this.quote) return;
|
|
@@ -585,8 +588,8 @@ class Z {
|
|
|
585
588
|
);
|
|
586
589
|
if (!n)
|
|
587
590
|
return e && t.classList.add("desktop-layout"), e;
|
|
588
|
-
const
|
|
589
|
-
return e && t.classList.add("desktop-layout"), o >=
|
|
591
|
+
const a = Math.min(n.scrollWidth, 400) + i + r;
|
|
592
|
+
return e && t.classList.add("desktop-layout"), o >= a;
|
|
590
593
|
}
|
|
591
594
|
return !1;
|
|
592
595
|
}
|
|
@@ -597,15 +600,21 @@ class Z {
|
|
|
597
600
|
}, 100);
|
|
598
601
|
}), this._resizeObserver.observe(this.container));
|
|
599
602
|
}
|
|
603
|
+
_applyQuoteUpdates(t) {
|
|
604
|
+
!this.quote || !this.container || (t.spotPriceWithFees !== void 0 && (this.quote.communication.yesOptionText = this.quote.communication.yesOptionText.replace(
|
|
605
|
+
`$${this.quote.spotPrice.toFixed(2)}`,
|
|
606
|
+
`$${t.spotPriceWithFees.toFixed(2)}`
|
|
607
|
+
)), this.destroy(), this._renderWidget());
|
|
608
|
+
}
|
|
600
609
|
_setupOptionListeners(t) {
|
|
601
610
|
const o = t.querySelectorAll(
|
|
602
611
|
'input[type="radio"]'
|
|
603
612
|
), i = t.querySelectorAll(".spot-selection__option");
|
|
604
613
|
o.forEach((r) => {
|
|
605
614
|
r.addEventListener("change", (e) => {
|
|
606
|
-
var
|
|
607
|
-
const n = e.target,
|
|
608
|
-
if (this.hideSelectionError(), this.currentSelection =
|
|
615
|
+
var a, u, h;
|
|
616
|
+
const n = e.target, s = n.value;
|
|
617
|
+
if (this.hideSelectionError(), this.currentSelection = s, i.forEach((f) => f.classList.remove("selected")), (a = n.closest(".spot-selection__option")) == null || a.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), s === "yes" && (this.options.quoteRequestData.isPartialPayment && V(this.paymentTermsEl, this.quote), (u = this.options.callbacks) != null && u.onOptIn)) {
|
|
609
618
|
const f = {
|
|
610
619
|
status: "QUOTE_ACCEPTED",
|
|
611
620
|
spotPrice: this.quote.spotPrice,
|
|
@@ -629,7 +638,7 @@ class Z {
|
|
|
629
638
|
}
|
|
630
639
|
this.options.callbacks.onOptIn(f);
|
|
631
640
|
}
|
|
632
|
-
if (
|
|
641
|
+
if (s === "no" && ((h = this.options.callbacks) != null && h.onOptOut)) {
|
|
633
642
|
const f = {
|
|
634
643
|
status: "QUOTE_DECLINED",
|
|
635
644
|
quoteId: this.quote.id
|
|
@@ -684,25 +693,31 @@ class Z {
|
|
|
684
693
|
quoteRequestData: t
|
|
685
694
|
};
|
|
686
695
|
I(n);
|
|
687
|
-
const { environment:
|
|
696
|
+
const { environment: s, partnerId: a, customEndpoint: u } = this.options.apiConfig, h = u || T[s], y = "cartInfo" in n.quoteRequestData && "items" in n.quoteRequestData ? await D(
|
|
688
697
|
h,
|
|
689
|
-
|
|
698
|
+
a,
|
|
690
699
|
n.quoteRequestData
|
|
691
700
|
) : await k(
|
|
692
701
|
h,
|
|
693
|
-
|
|
702
|
+
a,
|
|
694
703
|
n.quoteRequestData
|
|
695
704
|
);
|
|
696
|
-
|
|
697
|
-
status
|
|
698
|
-
|
|
699
|
-
|
|
705
|
+
if (y.status !== "QUOTE_AVAILABLE")
|
|
706
|
+
return y.status === "NO_MATCHING_QUOTE" && ((o = this.options.callbacks) != null && o.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
707
|
+
status: "NO_MATCHING_QUOTE",
|
|
708
|
+
data: n.quoteRequestData
|
|
709
|
+
}), !1;
|
|
710
|
+
if (this.options.quoteRequestData = n.quoteRequestData, this.quote = y.data, this.currentSelection = null, this.destroy(), this._renderWidget(), (i = this.options.callbacks) != null && i.onQuoteRetrieved) {
|
|
711
|
+
const c = this.options.callbacks.onQuoteRetrieved(this.quote);
|
|
712
|
+
c && this._applyQuoteUpdates(c);
|
|
713
|
+
}
|
|
714
|
+
return !0;
|
|
700
715
|
} catch (n) {
|
|
701
|
-
const
|
|
716
|
+
const s = n;
|
|
702
717
|
return (e = (r = this.options.callbacks) == null ? void 0 : r.onError) == null || e.call(r, {
|
|
703
|
-
message:
|
|
704
|
-
status:
|
|
705
|
-
responseBody:
|
|
718
|
+
message: s.message,
|
|
719
|
+
status: s.status,
|
|
720
|
+
responseBody: s.responseBody
|
|
706
721
|
}), !1;
|
|
707
722
|
}
|
|
708
723
|
}
|
|
@@ -718,13 +733,13 @@ class Z {
|
|
|
718
733
|
if ((r = this.quote) != null && r.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
719
734
|
const e = this.options.quoteRequestData;
|
|
720
735
|
t.batchQuoteDetails = this.quote.originalQuotes.map((n) => {
|
|
721
|
-
var
|
|
722
|
-
const
|
|
736
|
+
var a;
|
|
737
|
+
const s = (a = e.items) == null ? void 0 : a.find(
|
|
723
738
|
(u) => (u.cartItemId || `item-${e.items.indexOf(u) + 1}`) === n.id
|
|
724
739
|
);
|
|
725
740
|
return {
|
|
726
741
|
quoteId: n.id,
|
|
727
|
-
productPrice: (
|
|
742
|
+
productPrice: (s == null ? void 0 : s.productPrice) || n.spotPrice,
|
|
728
743
|
cartItemId: n.id
|
|
729
744
|
};
|
|
730
745
|
});
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(_,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(_=typeof globalThis<"u"?globalThis:_||self,_.SpotWidget=v())})(this,function(){"use strict";var _=typeof document<"u"?document.currentScript:null;async function v(d,t,o){try{const
|
|
1
|
+
(function(_,v){typeof exports=="object"&&typeof module<"u"?module.exports=v():typeof define=="function"&&define.amd?define(v):(_=typeof globalThis<"u"?globalThis:_||self,_.SpotWidget=v())})(this,function(){"use strict";var _=typeof document<"u"?document.currentScript:null;async function v(d,t,o){try{const i=await fetch(d,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(o)}),r=await i.json();if(!i.ok){const e=new Error((r==null?void 0:r.message)||"Failed to fetch quote");throw e.status=i.status,e.responseBody=r,e}return r}catch(i){throw i instanceof Error?i:new Error("Unknown error occurred while fetching quote")}}async function M(d,t,o){try{const i=d.replace("/quote","/quote/batch"),r=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(o)}),e=await r.json();if(!r.ok){const s=new Error((e==null?void 0:e.message)||"Failed to fetch batch quote");throw s.status=r.status,s.responseBody=e,s}return e}catch(i){throw i instanceof Error?i:new Error("Unknown error occurred while fetching batch quote")}}async function E(d,t,o){var i;try{const r={cartId:o.cartInfo.cartId,cartName:o.cartInfo.cartName,currencyCode:o.cartInfo.currencyCode,items:o.items.map((a,u)=>({cartItemId:a.cartItemId||`item-${u+1}`,productPrice:a.productPrice,productType:a.productType,productDuration:a.productDuration,productId:a.productId,productName:a.productName,participantDescription:a.participantDescription,eventType:a.eventType,startDate:a.startDate,endDate:a.endDate}))},e=await M(d,t,r);if(e.status!=="QUOTES_AVAILABLE"&&e.status!=="QUOTE_AVAILABLE")return{status:"NO_MATCHING_QUOTE"};const s=e.quotes.map(a=>{const u=o.items.find((h,f)=>(h.cartItemId||`item-${f+1}`)===a.cartItemId);return u?u.participantDescription?`${u.productName} - ${u.participantDescription}`:u.productName:`Item ${a.id}`}),n=Math.round((e.totalSpotPrice||e.spotPrice||0)*100)/100;return{status:"QUOTE_AVAILABLE",data:{id:e.quotes?e.quotes.map(a=>a.id).join(","):((i=e.data)==null?void 0:i.id)||"",spotPrice:n,currencyCode:e.currencyCode||"",communication:{...e.communication,yesOptionText:e.communication.yesOptionText.replace(String(e.totalSpotPrice),String(n))},payoutSchedule:e.payoutSchedule.map(a=>({...a,amount:a.amount!==void 0?a.amount:0})),coveredItems:s,originalQuotes:e.quotes||(e.data?[e.data]:[])},spotPrice:n,coveredItems:s}}catch(r){throw r instanceof Error?r:new Error("Unknown error occurred while fetching multiple quotes")}}const N={sandbox:"https://api.sandbox.getspot.com/v1/quote",production:"https://api.getspot.com/v1/quote",local:"http://localhost:3999/api/v1/quote"};function x(d){const{apiConfig:t={},quoteRequestData:o,callbacks:i={},location:r,theme:e}=d,{environment:s="sandbox",partnerId:n,customEndpoint:a}=t;if(!n||typeof n!="string")throw new Error("Invalid or missing partnerId in apiConfig");if(!(a||N[s]))throw new Error(`Invalid environment in apiConfig: ${s}`);if(!o||typeof o!="object"&&!Array.isArray(o))throw new Error("quoteRequestData must be a non-null object or array");const h=["startDate","endDate","currencyCode","eventType","productType","productDuration","productPrice","productId","cartId","productName"];function f(c,l=null){const m=l!==null?`quoteRequestData[${l}]`:"quoteRequestData";h.forEach(w=>{if(!Object.prototype.hasOwnProperty.call(c,w)||c[w]===void 0||c[w]===null)throw new Error(`Missing required ${m} field: '${w}'`)});const b=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!b.test(c.startDate))throw new Error(`${m}.startDate must be a valid ISO8601 string`);if(!b.test(c.endDate))throw new Error(`${m}.endDate must be a valid ISO8601 string`);if(typeof c.currencyCode!="string")throw new Error(`${m}.currencyCode must be a string`);if(!["USD","CAD","AUD"].includes(c.currencyCode))throw new Error(`Invalid ${m}.currencyCode: ${c.currencyCode}`);if(typeof c.eventType!="string")throw new Error(`${m}.eventType must be a string`);if(typeof c.productType!="string")throw new Error(`${m}.productType must be a string`);const g=["Pass","Trip","Registration"];if(!g.includes(c.productType))throw new Error(`${m}.productType must be one of ${g.join(", ")}`);if(typeof c.productDuration!="string")throw new Error(`${m}.productDuration must be a string`);const C=["Daily","Seasonal","Trip","Event"];if(!C.includes(c.productDuration))throw new Error(`${m}.productDuration must be one of ${C.join(", ")}`);if(typeof c.productPrice!="number"||isNaN(c.productPrice))throw new Error(`${m}.productPrice must be a valid number`);if(typeof c.productId!="string")throw new Error(`${m}.productId must be a string`);if(typeof c.cartId!="string")throw new Error(`${m}.cartId must be a string`);if(typeof c.productName!="string")throw new Error(`${m}.productName must be a string`)}if("cartInfo"in o&&"items"in o){const c=o,{cartInfo:l,items:m}=c;if(!l||typeof l!="object")throw new Error("quoteRequestData.cartInfo must be a non-null object");if(!l.cartId||typeof l.cartId!="string")throw new Error("quoteRequestData.cartInfo.cartId must be a string");if(!l.cartName||typeof l.cartName!="string")throw new Error("quoteRequestData.cartInfo.cartName must be a string");if(!l.currencyCode||typeof l.currencyCode!="string")throw new Error("quoteRequestData.cartInfo.currencyCode must be a string");if(!["USD","CAD","AUD"].includes(l.currencyCode))throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${l.currencyCode}`);if(!Array.isArray(m)||m.length===0)throw new Error("quoteRequestData.items must be a non-empty array");const I=["startDate","endDate","eventType","productType","productDuration","productPrice","productId","productName"];m.forEach((g,C)=>{if(!g||typeof g!="object")throw new Error(`quoteRequestData.items[${C}] must be a non-null object`);const w=`quoteRequestData.items[${C}]`;I.forEach(q=>{if(!Object.prototype.hasOwnProperty.call(g,q)||g[q]===void 0||g[q]===null)throw new Error(`Missing required ${w} field: '${q}'`)});const D=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!D.test(g.startDate))throw new Error(`${w}.startDate must be a valid ISO8601 string`);if(!D.test(g.endDate))throw new Error(`${w}.endDate must be a valid ISO8601 string`);if(typeof g.eventType!="string")throw new Error(`${w}.eventType must be a string`);if(typeof g.productType!="string")throw new Error(`${w}.productType must be a string`);const T=["Pass","Trip","Registration"];if(!T.includes(g.productType))throw new Error(`${w}.productType must be one of ${T.join(", ")}`);if(typeof g.productDuration!="string")throw new Error(`${w}.productDuration must be a string`);const H=["Daily","Seasonal","Trip","Event"];if(!H.includes(g.productDuration))throw new Error(`${w}.productDuration must be one of ${H.join(", ")}`);if(typeof g.productPrice!="number"||isNaN(g.productPrice))throw new Error(`${w}.productPrice must be a valid number`);if(typeof g.productId!="string")throw new Error(`${w}.productId must be a string`);if(typeof g.productName!="string")throw new Error(`${w}.productName must be a string`)})}else if(Array.isArray(o)){if(o.length===0)throw new Error("quoteRequestData array cannot be empty");o.forEach((c,l)=>{if(!c||typeof c!="object")throw new Error(`quoteRequestData[${l}] must be a non-null object`);f(c,l)})}else f(o);if(["onOptIn","onOptOut","onQuoteRetrieved","onError","noMatchingQuote"].forEach(c=>{const l=i[c];if(l&&typeof l!="function")throw new Error(`Callback '${c}' must be a function.`)}),typeof r=="string"&&!document.querySelector(r))throw new Error(`Invalid location selector: '${r}'`);if(e&&typeof e!="object")throw new Error("Theme must be an object with CSS variables, do not include the '--' prefix")}function p(d,{text:t,className:o,parent:i,innerHTML:r,href:e,target:s}={}){const n=document.createElement(d);return o&&(n.className=o),t!=null&&(n.textContent=t),r!=null&&(n.innerHTML=r),e&&"href"in n&&(n.href=e),s&&"target"in n&&(n.target=s),i&&i.appendChild(n),n}function z(d,{name:t,description:o}){p("div",{className:"spot-header__title",text:t,parent:d}),p("div",{className:"spot-header__description",text:o,parent:d})}function O(d,t=[]){const o=p("ul",{className:"spot-benefits__list",parent:d});t.forEach(i=>{const r=p("li",{parent:o});r.innerHTML=`
|
|
2
2
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none">
|
|
3
3
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
4
4
|
stroke="#2E2E2E" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
</svg>`,p("span",{text:
|
|
5
|
+
</svg>`,p("span",{text:i,parent:r})})}function L(d,t=[]){if(!t||t.length===0)return;const o=p("div",{className:"spot-qualifying-reasons__container",parent:d}),i=[...t].sort((a,u)=>a.rank-u.rank),r=p("div",{className:"spot-qualifying-reasons__grid",parent:o}),e={"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"},s=new URL(typeof document>"u"&&typeof location>"u"?require("url").pathToFileURL(__filename).href:typeof document>"u"?location.href:_&&_.tagName.toUpperCase()==="SCRIPT"&&_.src||new URL("index.umd.js",document.baseURI).href),n=s.origin+s.pathname.replace(/\/src\/[^/]*$/,"/assets/");i.forEach(a=>{var y,c,l;const u=p("div",{className:"spot-qualifying-reasons__item",parent:r}),h=p("div",{className:"spot-qualifying-reasons__icon-wrapper",parent:u}),f=e[((y=a.benefitType)==null?void 0:y.name)||""]||e[a.name||""];if(f){const m=p("img",{parent:h});m.src=n+f,m.alt=((c=a.benefitType)==null?void 0:c.name)||a.name||"",m.className="spot-qualifying-reasons__icon"}p("span",{className:"spot-qualifying-reasons__label",text:((l=a.benefitType)==null?void 0:l.name)||a.name||"",parent:u})})}function P(d,t=[]){if(t.length===0)return;const o=p("div",{className:"spot-covered-items__container",parent:d});p("div",{className:"spot-covered-items__title",text:"Items covered in your cart:",parent:o});const i=p("ul",{className:"spot-covered-items__list",parent:o});t.forEach(r=>{const e=p("li",{parent:i});p("span",{text:r,parent:e})})}function R(d,t=[]){const o=p("div",{className:"spot-table__container",parent:d}),i=p("table",{className:"spot-refund__table spot-table--dynamic",parent:o}),r=p("thead",{parent:i}),e=p("tr",{parent:r});p("th",{text:"When you cancel",parent:e}),p("th",{text:"You will receive",parent:e});const s=p("tbody",{parent:i});t.forEach(({text:n,percent:a,amount:u})=>{const h=p("tr",{parent:s});p("td",{text:n,parent:h});const f=a==="Not eligible for refund"?"Not eligible for a refund":`$${u} refund`;p("td",{text:f,parent:h})})}function $(d,t,o){const i=p("div",{className:"spot-selection__options",parent:d}),r=p("label",{className:`spot-selection__option ${t?"selected":""}`,parent:i}),e=p("input",{parent:r});e.type="radio",e.name="selection",e.value="yes",t&&(e.checked=!0),p("strong",{text:o.yesOptionText,parent:r}),p("span",{className:"spot-selection__recommended-tag",text:"Recommended",parent:r});const s=p("label",{className:"spot-selection__option",parent:i}),n=p("input",{parent:s});return n.type="radio",n.name="selection",n.value="no",p("span",{text:o.noOptionText,parent:s}),i}function V(d,t){var r;const o=(r=t.communication)==null?void 0:r.paymentTerms,i=p("div",{className:"spot-payment-terms",parent:d});return p("div",{className:"spot-payment-terms__header",text:"PAYMENT TERMS",parent:i}),p("div",{className:"spot-payment-terms__body",text:o||"",parent:i}),i}function S(d,t,o="bottom-right"){if(o==="top-right"){const e=p("div",{className:"spot-logo__top-right",parent:d});e.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
|
|
20
|
+
</svg>`}const i=p("div",{className:"spot-footer__container",parent:d}),r=p("div",{className:"spot-footer__terms",parent:i});if(p("span",{innerHTML:t.communication.legalDisclaimer,parent:r}),p("br",{parent:r}),p("a",{href:t.communication.termsAndConditionsUrl,target:"_blank",className:"spot-footer__terms-link",text:"Refund Guarantee Terms and Conditions",parent:r}),o==="bottom-right"){const e=p("p",{className:"spot-footer__powered-by",parent:i});e.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 n}const Q=":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--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:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:51rem;margin:1rem;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__options{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__options{grid-row:3;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;padding-left:.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-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:0;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;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-payment-terms__wrapper{margin-top:1rem}.spot-payment-terms__header{font-weight:var(--spot-payment-terms-header-font-weight);margin-bottom:.5rem;padding:var(--spot-payment-terms-header-padding);font-size:var(--spot-payment-terms-header-font-size);border-bottom:1px solid var(--spot-payment-terms-header-border-color)}.spot-payment-terms{background-color:var(--spot-payment-terms-background);border-radius:var(--spot-payment-terms-border-radius);padding:var(--spot-payment-terms-padding);margin-right:.5rem;color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);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:#fff;padding:0 8px}@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 Z(d){const t=document.createElement("style");t.textContent=d,document.head.appendChild(t)}Z(Q);const k={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 A{constructor(t={}){this.options={location:"body",showTable:!0,optInSelected:!1,logoPosition:"bottom-right",apiConfig:{environment:"production",partnerId:""},quoteRequestData:{},callbacks:{},useMockData:!1,...t},this._onResize=this._updateLayout.bind(this),this.root=typeof this.options.location=="string"?document.querySelector(this.options.location):this.options.location,this.currentSelection=this.options.optInSelected?"yes":null,this._init()}async _init(){var t,o,n,r,e;try{x(this.options);let i;if(this.options.useMockData&&this.options.mockData)i=this.options.mockData;else{const{environment:a,partnerId:s}=this.options.apiConfig,h=this.options.apiConfig.customEndpoint||k[a];i="cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?await E(h,s,this.options.quoteRequestData):await v(h,s,this.options.quoteRequestData)}if(i.status!=="QUOTE_AVAILABLE"){i.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=i.data,!this.quote)throw new Error("No quote data in response");if(this._renderWidget(),this.options.optInSelected&&((o=this.options.callbacks)!=null&&o.onOptIn)){const a={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const s=this.options.quoteRequestData;a.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var f;const h=(f=s.items)==null?void 0:f.find(y=>(y.cartItemId||`item-${s.items.indexOf(y)+1}`)===u.id);return{quoteId:u.id,productPrice:(h==null?void 0:h.productPrice)||u.spotPrice,cartItemId:u.id}})}this.options.callbacks.onOptIn(a)}(n=this.options.callbacks)!=null&&n.onQuoteRetrieved&&this.options.callbacks.onQuoteRetrieved(this.quote)}catch(i){if((r=this.options.callbacks)!=null&&r.onError){const a=i;(e=this.options.callbacks)==null||e.onError({message:a.message,status:a.status,responseBody:a.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(([n,r])=>{const e=`--${n}`;this.container.style.setProperty(e,r)}),z(this.container,this.quote.communication);const t=document.createElement("div");t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?L(t,this.quote.qualifyingReasons):O(t,this.quote.communication.bulletPoints),this.quote.coveredItems&&P(t,this.quote.coveredItems),this.options.showTable&&!this.quote.qualifyingReasons&&R(t,this.quote.payoutSchedule);const o=V(t,this.options.optInSelected,this.quote.communication);t.appendChild(o),this.paymentTermsEl=p("div",{className:"spot-payment-terms__wrapper",parent:t}),$(this.container,this.quote,this.options.logoPosition),window.addEventListener("resize",this._onResize),this._setupResizeObserver(),this._updateLayout(),this._setupOptionListeners(o)}_updateLayout(){if(!this.container||!this.quote)return;const t=this.container.querySelector(".spot-content__wrapper"),o=this.options.showTable&&!this.quote.qualifyingReasons;if(!t||!o){t==null||t.classList.remove("desktop-layout");return}const n=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",n)}_shouldUseDesktopLayout(t){const o=this.container.offsetWidth-40,n=325,r=16;if(o>=900)return!0;if(o>=650){const e=t.classList.contains("desktop-layout");t.classList.remove("desktop-layout"),t.offsetHeight;const i=t.querySelector(".spot-benefits__list, .spot-qualifying-reasons__container");if(!i)return e&&t.classList.add("desktop-layout"),e;const s=Math.min(i.scrollWidth,400)+n+r;return e&&t.classList.add("desktop-layout"),o>=s}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))}_setupOptionListeners(t){const o=t.querySelectorAll('input[type="radio"]'),n=t.querySelectorAll(".spot-selection__option");o.forEach(r=>{r.addEventListener("change",e=>{var s,u,h;const i=e.target,a=i.value;if(this.hideSelectionError(),this.currentSelection=a,n.forEach(f=>f.classList.remove("selected")),(s=i.closest(".spot-selection__option"))==null||s.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),a==="yes"&&(this.options.quoteRequestData.isPartialPayment&&S(this.paymentTermsEl,this.quote),(u=this.options.callbacks)!=null&&u.onOptIn)){const f={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;f.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const l=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(l==null?void 0:l.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptIn(f)}if(a==="no"&&((h=this.options.callbacks)!=null&&h.onOptOut)){const f={status:"QUOTE_DECLINED",quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;f.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const l=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(l==null?void 0:l.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptOut(f)}})})}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 o=(t=this.container)==null?void 0:t.querySelector(".spot-selection__options");o&&o.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 o,n,r,e;try{const i={...this.options,quoteRequestData:t};x(i);const{environment:a,partnerId:s,customEndpoint:u}=this.options.apiConfig,h=u||k[a],y="cartInfo"in i.quoteRequestData&&"items"in i.quoteRequestData?await E(h,s,i.quoteRequestData):await v(h,s,i.quoteRequestData);return y.status!=="QUOTE_AVAILABLE"?(y.status==="NO_MATCHING_QUOTE"&&((o=this.options.callbacks)!=null&&o.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:i.quoteRequestData}),!1):(this.options.quoteRequestData=i.quoteRequestData,this.quote=y.data,this.currentSelection=null,this.destroy(),this._renderWidget(),(n=this.options.callbacks)!=null&&n.onQuoteRetrieved&&this.options.callbacks.onQuoteRetrieved(this.quote),!0)}catch(i){const a=i;return(e=(r=this.options.callbacks)==null?void 0:r.onError)==null||e.call(r,{message:a.message,status:a.status,responseBody:a.responseBody}),!1}}getSelection(){var o,n,r;if(this.currentSelection==null)return null;const t={selection:this.currentSelection,quoteId:(o=this.quote)==null?void 0:o.id,spotPrice:(n=this.quote)==null?void 0:n.spotPrice,status:this.currentSelection==="yes"?"QUOTE_ACCEPTED":"QUOTE_DECLINED"};if((r=this.quote)!=null&&r.originalQuotes&&this.quote.originalQuotes.length>0){const e=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(i=>{var s;const a=(s=e.items)==null?void 0:s.find(u=>(u.cartItemId||`item-${e.items.indexOf(u)+1}`)===i.id);return{quoteId:i.id,productPrice:(a==null?void 0:a.productPrice)||i.spotPrice,cartItemId:i.id}})}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)}}return A});
|
|
35
|
+
</svg>`}return i}const Q=":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 0rem;--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:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:51rem;margin:1rem;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__options{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__options{grid-row:3;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;padding-left:.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-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:0;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}input[type=radio]{-webkit-appearance:none;-moz-appearance:none;appearance:none;width:.75rem;height:.75rem;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-payment-terms__wrapper{margin-top:1rem}.spot-payment-terms__header{font-weight:var(--spot-payment-terms-header-font-weight);margin-bottom:.5rem;padding:var(--spot-payment-terms-header-padding);font-size:var(--spot-payment-terms-header-font-size);border-bottom:1px solid var(--spot-payment-terms-header-border-color)}.spot-payment-terms{background-color:var(--spot-payment-terms-background);border-radius:var(--spot-payment-terms-border-radius);padding:var(--spot-payment-terms-padding);margin-right:.5rem;color:var(--spot-payment-terms-font-color);font-size:var(--spot-payment-terms-font-size)}.spot-footer__terms{margin-top:.625rem;margin-right:.25rem;font-size:var(--spot-terms-font-size);font-weight:var(--spot-terms-font-weight);color:var(--spot-terms-font-color);font-family:var(--spot-terms-font-family);padding:var(--spot-terms-padding);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:#fff;padding:0 8px}@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 Z(d){const t=document.createElement("style");t.textContent=d,document.head.appendChild(t)}Z(Q);const k={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 A{constructor(t={}){this.options={location:"body",showTable:!0,optInSelected:!1,logoPosition:"bottom-right",apiConfig:{environment:"production",partnerId:""},quoteRequestData:{},callbacks:{},useMockData:!1,...t},this._onResize=this._updateLayout.bind(this),this.root=typeof this.options.location=="string"?document.querySelector(this.options.location):this.options.location,this.currentSelection=this.options.optInSelected?"yes":null,this._init()}async _init(){var t,o,i,r,e;try{x(this.options);let s;if(this.options.useMockData&&this.options.mockData)s=this.options.mockData;else{const{environment:n,partnerId:a}=this.options.apiConfig,h=this.options.apiConfig.customEndpoint||k[n];s="cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?await E(h,a,this.options.quoteRequestData):await v(h,a,this.options.quoteRequestData)}if(s.status!=="QUOTE_AVAILABLE"){s.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=s.data,!this.quote)throw new Error("No quote data in response");if(this._renderWidget(),this.options.optInSelected&&((o=this.options.callbacks)!=null&&o.onOptIn)){const n={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const a=this.options.quoteRequestData;n.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var f;const h=(f=a.items)==null?void 0:f.find(y=>(y.cartItemId||`item-${a.items.indexOf(y)+1}`)===u.id);return{quoteId:u.id,productPrice:(h==null?void 0:h.productPrice)||u.spotPrice,cartItemId:u.id}})}this.options.callbacks.onOptIn(n)}if((i=this.options.callbacks)!=null&&i.onQuoteRetrieved){const n=this.options.callbacks.onQuoteRetrieved(this.quote);n&&this._applyQuoteUpdates(n)}}catch(s){if((r=this.options.callbacks)!=null&&r.onError){const n=s;(e=this.options.callbacks)==null||e.onError({message:n.message,status:n.status,responseBody:n.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(([i,r])=>{const e=`--${i}`;this.container.style.setProperty(e,r)}),z(this.container,this.quote.communication);const t=document.createElement("div");t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?L(t,this.quote.qualifyingReasons):O(t,this.quote.communication.bulletPoints),this.quote.coveredItems&&P(t,this.quote.coveredItems),this.options.showTable&&!this.quote.qualifyingReasons&&R(t,this.quote.payoutSchedule);const o=$(t,this.options.optInSelected,this.quote.communication);t.appendChild(o),this.paymentTermsEl=p("div",{className:"spot-payment-terms__wrapper",parent:t}),S(this.container,this.quote,this.options.logoPosition),window.addEventListener("resize",this._onResize),this._setupResizeObserver(),this._updateLayout(),this._setupOptionListeners(o)}_updateLayout(){if(!this.container||!this.quote)return;const t=this.container.querySelector(".spot-content__wrapper"),o=this.options.showTable&&!this.quote.qualifyingReasons;if(!t||!o){t==null||t.classList.remove("desktop-layout");return}const i=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",i)}_shouldUseDesktopLayout(t){const o=this.container.offsetWidth-40,i=325,r=16;if(o>=900)return!0;if(o>=650){const e=t.classList.contains("desktop-layout");t.classList.remove("desktop-layout"),t.offsetHeight;const s=t.querySelector(".spot-benefits__list, .spot-qualifying-reasons__container");if(!s)return e&&t.classList.add("desktop-layout"),e;const a=Math.min(s.scrollWidth,400)+i+r;return e&&t.classList.add("desktop-layout"),o>=a}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))}_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())}_setupOptionListeners(t){const o=t.querySelectorAll('input[type="radio"]'),i=t.querySelectorAll(".spot-selection__option");o.forEach(r=>{r.addEventListener("change",e=>{var a,u,h;const s=e.target,n=s.value;if(this.hideSelectionError(),this.currentSelection=n,i.forEach(f=>f.classList.remove("selected")),(a=s.closest(".spot-selection__option"))==null||a.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),n==="yes"&&(this.options.quoteRequestData.isPartialPayment&&V(this.paymentTermsEl,this.quote),(u=this.options.callbacks)!=null&&u.onOptIn)){const f={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;f.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const l=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(l==null?void 0:l.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptIn(f)}if(n==="no"&&((h=this.options.callbacks)!=null&&h.onOptOut)){const f={status:"QUOTE_DECLINED",quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;f.batchQuoteDetails=this.quote.originalQuotes.map(c=>{var m;const l=(m=y.items)==null?void 0:m.find(b=>(b.cartItemId||`item-${y.items.indexOf(b)+1}`)===c.id);return{quoteId:c.id,productPrice:(l==null?void 0:l.productPrice)||c.spotPrice,cartItemId:c.id}})}this.options.callbacks.onOptOut(f)}})})}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 o=(t=this.container)==null?void 0:t.querySelector(".spot-selection__options");o&&o.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 o,i,r,e;try{const s={...this.options,quoteRequestData:t};x(s);const{environment:n,partnerId:a,customEndpoint:u}=this.options.apiConfig,h=u||k[n],y="cartInfo"in s.quoteRequestData&&"items"in s.quoteRequestData?await E(h,a,s.quoteRequestData):await v(h,a,s.quoteRequestData);if(y.status!=="QUOTE_AVAILABLE")return y.status==="NO_MATCHING_QUOTE"&&((o=this.options.callbacks)!=null&&o.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:s.quoteRequestData}),!1;if(this.options.quoteRequestData=s.quoteRequestData,this.quote=y.data,this.currentSelection=null,this.destroy(),this._renderWidget(),(i=this.options.callbacks)!=null&&i.onQuoteRetrieved){const c=this.options.callbacks.onQuoteRetrieved(this.quote);c&&this._applyQuoteUpdates(c)}return!0}catch(s){const n=s;return(e=(r=this.options.callbacks)==null?void 0:r.onError)==null||e.call(r,{message:n.message,status:n.status,responseBody:n.responseBody}),!1}}getSelection(){var o,i,r;if(this.currentSelection==null)return null;const t={selection:this.currentSelection,quoteId:(o=this.quote)==null?void 0:o.id,spotPrice:(i=this.quote)==null?void 0:i.spotPrice,status:this.currentSelection==="yes"?"QUOTE_ACCEPTED":"QUOTE_DECLINED"};if((r=this.quote)!=null&&r.originalQuotes&&this.quote.originalQuotes.length>0){const e=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(s=>{var a;const n=(a=e.items)==null?void 0:a.find(u=>(u.cartItemId||`item-${e.items.indexOf(u)+1}`)===s.id);return{quoteId:s.id,productPrice:(n==null?void 0:n.productPrice)||s.spotPrice,cartItemId:s.id}})}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)}}return A});
|
package/dist/types.d.ts
CHANGED
|
@@ -79,6 +79,9 @@ export interface Quote {
|
|
|
79
79
|
coveredItems?: string[];
|
|
80
80
|
originalQuotes?: Quote[];
|
|
81
81
|
}
|
|
82
|
+
export interface QuoteUpdates {
|
|
83
|
+
spotPriceWithFees?: number;
|
|
84
|
+
}
|
|
82
85
|
export interface ApiResponse {
|
|
83
86
|
status: "QUOTE_AVAILABLE" | "QUOTES_AVAILABLE" | "NO_MATCHING_QUOTE";
|
|
84
87
|
data?: Quote;
|
|
@@ -104,7 +107,7 @@ export interface SelectionData {
|
|
|
104
107
|
export interface Callbacks {
|
|
105
108
|
onOptIn?: (data: SelectionData) => void;
|
|
106
109
|
onOptOut?: (data: SelectionData) => void;
|
|
107
|
-
onQuoteRetrieved?: (quote: Quote) => void;
|
|
110
|
+
onQuoteRetrieved?: (quote: Quote) => QuoteUpdates | void;
|
|
108
111
|
onError?: (error: {
|
|
109
112
|
message: string;
|
|
110
113
|
status?: number;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,WAAW,EAAE,SAAS,GAAG,YAAY,GAAG,OAAO,CAAC;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;IACpC,QAAQ,CAAC,EAAE,aAAa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