@getspot/spot-widget 3.2.5 → 3.3.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 +14 -0
- package/README.md +16 -0
- package/dist/api.d.ts +2 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +156 -163
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +12 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [3.3.1](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@3.3.0...@getspot/spot-widget@3.3.1) (2026-01-07)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **core:** pass along isPartialPayment and roundTo on batch quote request ([50295cb](https://gitlab.com/getspot/spot-widget/commit/50295cbdf7860dd93c261bfb27294f10cd1f045c))
|
|
7
|
+
|
|
8
|
+
# [3.3.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@3.2.5...@getspot/spot-widget@3.3.0) (2025-12-22)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **react:** add storybook support. run 'pnpm run storybook' to see ([7f751d1](https://gitlab.com/getspot/spot-widget/commit/7f751d15f8d3705ca746bf695169fd0f7b6d79ca))
|
|
14
|
+
|
|
1
15
|
## [3.2.5](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@3.2.4...@getspot/spot-widget@3.2.5) (2025-12-18)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -365,6 +365,7 @@ export interface CartInfo {
|
|
|
365
365
|
currencyCode: "USD" | "CAD" | "AUD";
|
|
366
366
|
metadata?: QuoteMetadata;
|
|
367
367
|
isPartialPayment?: boolean;
|
|
368
|
+
roundTo?: number;
|
|
368
369
|
}
|
|
369
370
|
```
|
|
370
371
|
|
|
@@ -393,6 +394,7 @@ export interface QuoteItem {
|
|
|
393
394
|
hostCountryState?: string;
|
|
394
395
|
destinations?: string[];
|
|
395
396
|
dob?: string;
|
|
397
|
+
roundTo?: number;
|
|
396
398
|
}
|
|
397
399
|
```
|
|
398
400
|
|
|
@@ -405,6 +407,20 @@ export interface BatchQuoteRequest {
|
|
|
405
407
|
}
|
|
406
408
|
```
|
|
407
409
|
|
|
410
|
+
#### ApiBatchQuoteRequest
|
|
411
|
+
|
|
412
|
+
```typescript
|
|
413
|
+
export interface ApiBatchQuoteRequest {
|
|
414
|
+
cartId: string;
|
|
415
|
+
cartName: string;
|
|
416
|
+
currencyCode: "USD" | "CAD" | "AUD";
|
|
417
|
+
metadata?: QuoteMetadata;
|
|
418
|
+
isPartialPayment?: boolean;
|
|
419
|
+
roundTo?: number;
|
|
420
|
+
items: BatchQuoteItem[];
|
|
421
|
+
}
|
|
422
|
+
```
|
|
423
|
+
|
|
408
424
|
#### QualifyingReason
|
|
409
425
|
|
|
410
426
|
```typescript
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResponse, QuoteRequestData, BatchQuoteRequest } from './types.js';
|
|
1
|
+
import type { ApiResponse, QuoteRequestData, BatchQuoteRequest, ApiBatchQuoteRequest } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieve quote from Spot API
|
|
4
4
|
* @param endpoint – Spot API URL
|
|
@@ -14,7 +14,7 @@ export declare function fetchQuote(endpoint: string, partnerId: string, payload:
|
|
|
14
14
|
* @param batchPayload – batch request data with items array
|
|
15
15
|
* @returns Promise resolving to API response
|
|
16
16
|
*/
|
|
17
|
-
export declare function fetchBatchQuote(endpoint: string, partnerId: string, batchPayload:
|
|
17
|
+
export declare function fetchBatchQuote(endpoint: string, partnerId: string, batchPayload: ApiBatchQuoteRequest): Promise<ApiResponse>;
|
|
18
18
|
/**
|
|
19
19
|
* Retrieve multiple quotes in parallel from Spot API
|
|
20
20
|
* @param endpoint – Spot API URL
|
package/dist/api.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,gBAAgB,EAAE,iBAAiB,EAAE,oBAAoB,EAAkB,MAAM,YAAY,CAAC;AAEnI;;;;;;GAMG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gBAAgB,GACxB,OAAO,CAAC,WAAW,CAAC,CAwBtB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,oBAAoB,GACjC,OAAO,CAAC,WAAW,CAAC,CAyBtB;AAED;;;;;;GAMG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,iBAAiB,GAC3B,OAAO,CAAC,WAAW,CAAC,CAwEtB"}
|
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,EAGd,MAAM,YAAY,CAAC;AAkBpB,cAAM,UAAU;IACd,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,cAAc,CAAC,CAAc;IACrC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAE7B,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM;YAuBtC,KAAK;IAiGnB,OAAO,CAAC,aAAa;IAoDrB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,uBAAuB;IAqC/B,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,cAAc,CAAC,CAAS;IAEhC,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,qBAAqB;IA2F7B,kBAAkB,IAAI,IAAI;IAgB1B,kBAAkB,IAAI,IAAI;IAM1B,iBAAiB,IAAI,OAAO;IAgBtB,WAAW,CACf,mBAAmB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,GACzD,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,iBAAiB,EAEjB,aAAa,EAGd,MAAM,YAAY,CAAC;AAkBpB,cAAM,UAAU;IACd,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,cAAc,CAAC,CAAc;IACrC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAE7B,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM;YAuBtC,KAAK;IAiGnB,OAAO,CAAC,aAAa;IAoDrB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,uBAAuB;IAqC/B,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,cAAc,CAAC,CAAS;IAEhC,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,qBAAqB;IA2F7B,kBAAkB,IAAI,IAAI;IAgB1B,kBAAkB,IAAI,IAAI;IAM1B,iBAAiB,IAAI,OAAO;IAgBtB,WAAW,CACf,mBAAmB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,GACzD,OAAO,CAAC,OAAO,CAAC;IAuEnB,YAAY,IAAI,aAAa,GAAG,IAAI;IA+BpC,OAAO,IAAI,IAAI;CAahB;AAED,eAAe,UAAU,CAAC;AAC1B,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,KAAK,EACL,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,QAAQ,EACR,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,SAAS,EACT,KAAK,GACN,MAAM,YAAY,CAAC"}
|
package/dist/index.es.js
CHANGED
|
@@ -7,29 +7,29 @@ async function x(m, t, o) {
|
|
|
7
7
|
"X-Spot-Partner-Id": t
|
|
8
8
|
},
|
|
9
9
|
body: JSON.stringify(o)
|
|
10
|
-
}),
|
|
10
|
+
}), n = await s.json();
|
|
11
11
|
if (!s.ok) {
|
|
12
|
-
const r = new Error((
|
|
13
|
-
throw r.status = s.status, r.responseBody =
|
|
12
|
+
const r = new Error((n == null ? void 0 : n.message) || "Failed to fetch quote");
|
|
13
|
+
throw r.status = s.status, r.responseBody = n, r;
|
|
14
14
|
}
|
|
15
|
-
return
|
|
15
|
+
return n;
|
|
16
16
|
} catch (s) {
|
|
17
17
|
throw s instanceof Error ? s : new Error("Unknown error occurred while fetching quote");
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
async function H(m, t, o) {
|
|
21
21
|
try {
|
|
22
|
-
const s = m.replace("/quote", "/quote/batch"),
|
|
22
|
+
const s = m.replace("/quote", "/quote/batch"), n = await fetch(s, {
|
|
23
23
|
method: "POST",
|
|
24
24
|
headers: {
|
|
25
25
|
"Content-Type": "application/json",
|
|
26
26
|
"X-Spot-Partner-Id": t
|
|
27
27
|
},
|
|
28
28
|
body: JSON.stringify(o)
|
|
29
|
-
}), r = await
|
|
30
|
-
if (!
|
|
29
|
+
}), r = await n.json();
|
|
30
|
+
if (!n.ok) {
|
|
31
31
|
const i = new Error((r == null ? void 0 : r.message) || "Failed to fetch batch quote");
|
|
32
|
-
throw i.status =
|
|
32
|
+
throw i.status = n.status, i.responseBody = r, i;
|
|
33
33
|
}
|
|
34
34
|
return r;
|
|
35
35
|
} catch (s) {
|
|
@@ -39,36 +39,29 @@ async function H(m, t, o) {
|
|
|
39
39
|
async function I(m, t, o) {
|
|
40
40
|
var s;
|
|
41
41
|
try {
|
|
42
|
-
const
|
|
42
|
+
const n = {
|
|
43
43
|
cartId: o.cartInfo.cartId,
|
|
44
44
|
cartName: o.cartInfo.cartName,
|
|
45
45
|
currencyCode: o.cartInfo.currencyCode,
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
productId: n.productId,
|
|
52
|
-
productName: n.productName,
|
|
53
|
-
participantDescription: n.participantDescription,
|
|
54
|
-
eventType: n.eventType,
|
|
55
|
-
eventId: n.eventId,
|
|
56
|
-
startDate: n.startDate,
|
|
57
|
-
endDate: n.endDate
|
|
46
|
+
isPartialPayment: o.cartInfo.isPartialPayment || !1,
|
|
47
|
+
roundTo: o.cartInfo.roundTo || void 0,
|
|
48
|
+
items: o.items.map((c, u) => ({
|
|
49
|
+
...c,
|
|
50
|
+
cartItemId: c.cartItemId || `item-${u + 1}`
|
|
58
51
|
}))
|
|
59
|
-
}, r = await H(m, t,
|
|
52
|
+
}, r = await H(m, t, n);
|
|
60
53
|
if (r.status !== "QUOTES_AVAILABLE" && r.status !== "QUOTE_AVAILABLE")
|
|
61
54
|
return { status: "NO_MATCHING_QUOTE" };
|
|
62
|
-
const i = r.quotes.map((
|
|
55
|
+
const i = r.quotes.map((c) => {
|
|
63
56
|
const u = o.items.find(
|
|
64
|
-
(f, h) => (f.cartItemId || `item-${h + 1}`) ===
|
|
57
|
+
(f, h) => (f.cartItemId || `item-${h + 1}`) === c.cartItemId
|
|
65
58
|
);
|
|
66
|
-
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${
|
|
59
|
+
return u ? u.participantDescription ? `${u.productName} - ${u.participantDescription}` : u.productName : `Item ${c.id}`;
|
|
67
60
|
}), e = Math.round((r.totalSpotPrice || r.spotPrice || 0) * 100) / 100;
|
|
68
61
|
return {
|
|
69
62
|
status: "QUOTE_AVAILABLE",
|
|
70
63
|
data: {
|
|
71
|
-
id: r.quotes ? r.quotes.map((
|
|
64
|
+
id: r.quotes ? r.quotes.map((c) => c.id).join(",") : ((s = r.data) == null ? void 0 : s.id) || "",
|
|
72
65
|
spotPrice: e,
|
|
73
66
|
currencyCode: r.currencyCode || "",
|
|
74
67
|
communication: {
|
|
@@ -78,9 +71,9 @@ async function I(m, t, o) {
|
|
|
78
71
|
String(e)
|
|
79
72
|
)
|
|
80
73
|
},
|
|
81
|
-
payoutSchedule: r.payoutSchedule.map((
|
|
82
|
-
...
|
|
83
|
-
amount:
|
|
74
|
+
payoutSchedule: r.payoutSchedule.map((c) => ({
|
|
75
|
+
...c,
|
|
76
|
+
amount: c.amount !== void 0 ? c.amount : 0
|
|
84
77
|
})),
|
|
85
78
|
coveredItems: i,
|
|
86
79
|
originalQuotes: r.quotes || (r.data ? [r.data] : [])
|
|
@@ -88,8 +81,8 @@ async function I(m, t, o) {
|
|
|
88
81
|
spotPrice: e,
|
|
89
82
|
coveredItems: i
|
|
90
83
|
};
|
|
91
|
-
} catch (
|
|
92
|
-
throw
|
|
84
|
+
} catch (n) {
|
|
85
|
+
throw n instanceof Error ? n : new Error("Unknown error occurred while fetching multiple quotes");
|
|
93
86
|
}
|
|
94
87
|
}
|
|
95
88
|
const z = {
|
|
@@ -102,16 +95,16 @@ function D(m) {
|
|
|
102
95
|
apiConfig: t = {},
|
|
103
96
|
quoteRequestData: o,
|
|
104
97
|
callbacks: s = {},
|
|
105
|
-
location:
|
|
98
|
+
location: n,
|
|
106
99
|
theme: r
|
|
107
100
|
} = m, {
|
|
108
101
|
environment: i = "sandbox",
|
|
109
102
|
partnerId: e,
|
|
110
|
-
customEndpoint:
|
|
103
|
+
customEndpoint: c
|
|
111
104
|
} = t;
|
|
112
105
|
if (!e || typeof e != "string")
|
|
113
106
|
throw new Error("Invalid or missing partnerId in apiConfig");
|
|
114
|
-
if (!(
|
|
107
|
+
if (!(c || z[i]))
|
|
115
108
|
throw new Error(`Invalid environment in apiConfig: ${i}`);
|
|
116
109
|
if (!o || typeof o != "object" && !Array.isArray(o))
|
|
117
110
|
throw new Error("quoteRequestData must be a non-null object or array");
|
|
@@ -127,8 +120,8 @@ function D(m) {
|
|
|
127
120
|
"cartId",
|
|
128
121
|
"productName"
|
|
129
122
|
];
|
|
130
|
-
function h(d,
|
|
131
|
-
const l =
|
|
123
|
+
function h(d, a = null) {
|
|
124
|
+
const l = a !== null ? `quoteRequestData[${a}]` : "quoteRequestData";
|
|
132
125
|
f.forEach((v) => {
|
|
133
126
|
if (!Object.prototype.hasOwnProperty.call(d, v) || d[v] === void 0 || d[v] === null)
|
|
134
127
|
throw new Error(`Missing required ${l} field: '${v}'`);
|
|
@@ -168,17 +161,17 @@ function D(m) {
|
|
|
168
161
|
throw new Error(`${l}.productName must be a string`);
|
|
169
162
|
}
|
|
170
163
|
if ("cartInfo" in o && "items" in o) {
|
|
171
|
-
const d = o, { cartInfo:
|
|
172
|
-
if (!
|
|
164
|
+
const d = o, { cartInfo: a, items: l } = d;
|
|
165
|
+
if (!a || typeof a != "object")
|
|
173
166
|
throw new Error("quoteRequestData.cartInfo must be a non-null object");
|
|
174
|
-
if (!
|
|
167
|
+
if (!a.cartId || typeof a.cartId != "string")
|
|
175
168
|
throw new Error("quoteRequestData.cartInfo.cartId must be a string");
|
|
176
|
-
if (!
|
|
169
|
+
if (!a.cartName || typeof a.cartName != "string")
|
|
177
170
|
throw new Error("quoteRequestData.cartInfo.cartName must be a string");
|
|
178
|
-
if (!
|
|
171
|
+
if (!a.currencyCode || typeof a.currencyCode != "string")
|
|
179
172
|
throw new Error("quoteRequestData.cartInfo.currencyCode must be a string");
|
|
180
|
-
if (!["USD", "CAD", "AUD"].includes(
|
|
181
|
-
throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${
|
|
173
|
+
if (!["USD", "CAD", "AUD"].includes(a.currencyCode))
|
|
174
|
+
throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${a.currencyCode}`);
|
|
182
175
|
if (!Array.isArray(l) || l.length === 0)
|
|
183
176
|
throw new Error("quoteRequestData.items must be a non-empty array");
|
|
184
177
|
const _ = [
|
|
@@ -226,10 +219,10 @@ function D(m) {
|
|
|
226
219
|
} else if (Array.isArray(o)) {
|
|
227
220
|
if (o.length === 0)
|
|
228
221
|
throw new Error("quoteRequestData array cannot be empty");
|
|
229
|
-
o.forEach((d,
|
|
222
|
+
o.forEach((d, a) => {
|
|
230
223
|
if (!d || typeof d != "object")
|
|
231
|
-
throw new Error(`quoteRequestData[${
|
|
232
|
-
h(d,
|
|
224
|
+
throw new Error(`quoteRequestData[${a}] must be a non-null object`);
|
|
225
|
+
h(d, a);
|
|
233
226
|
});
|
|
234
227
|
} else
|
|
235
228
|
h(o);
|
|
@@ -240,51 +233,51 @@ function D(m) {
|
|
|
240
233
|
"onError",
|
|
241
234
|
"noMatchingQuote"
|
|
242
235
|
].forEach((d) => {
|
|
243
|
-
const
|
|
244
|
-
if (
|
|
236
|
+
const a = s[d];
|
|
237
|
+
if (a && typeof a != "function")
|
|
245
238
|
throw new Error(`Callback '${d}' must be a function.`);
|
|
246
|
-
}), typeof
|
|
247
|
-
throw new Error(`Invalid location selector: '${
|
|
239
|
+
}), typeof n == "string" && !document.querySelector(n))
|
|
240
|
+
throw new Error(`Invalid location selector: '${n}'`);
|
|
248
241
|
if (r && typeof r != "object")
|
|
249
242
|
throw new Error(
|
|
250
243
|
"Theme must be an object with CSS variables, do not include the '--' prefix"
|
|
251
244
|
);
|
|
252
245
|
}
|
|
253
|
-
function
|
|
246
|
+
function p(m, { text: t, className: o, parent: s, innerHTML: n, href: r, target: i } = {}) {
|
|
254
247
|
const e = document.createElement(m);
|
|
255
|
-
return o && (e.className = o), t != null && (e.textContent = t),
|
|
248
|
+
return o && (e.className = o), t != null && (e.textContent = t), n != null && (e.innerHTML = n), r && "href" in e && (e.href = r), i && "target" in e && (e.target = i), s && s.appendChild(e), e;
|
|
256
249
|
}
|
|
257
|
-
function
|
|
258
|
-
|
|
250
|
+
function M(m, { name: t, description: o }) {
|
|
251
|
+
p("div", {
|
|
259
252
|
className: "spot-header__title",
|
|
260
253
|
text: t,
|
|
261
254
|
parent: m
|
|
262
|
-
}),
|
|
255
|
+
}), p("div", {
|
|
263
256
|
className: "spot-header__description",
|
|
264
257
|
text: o,
|
|
265
258
|
parent: m
|
|
266
259
|
});
|
|
267
260
|
}
|
|
268
|
-
function
|
|
269
|
-
const o =
|
|
261
|
+
function N(m, t = []) {
|
|
262
|
+
const o = p("ul", {
|
|
270
263
|
className: "spot-benefits__list",
|
|
271
264
|
parent: m
|
|
272
265
|
});
|
|
273
266
|
t.forEach((s) => {
|
|
274
|
-
const
|
|
275
|
-
|
|
267
|
+
const n = p("li", { parent: o });
|
|
268
|
+
n.innerHTML = `
|
|
276
269
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" class="spot-bullets__checkmark">
|
|
277
270
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
278
271
|
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
279
|
-
</svg>`,
|
|
272
|
+
</svg>`, p("span", { text: s, parent: n });
|
|
280
273
|
});
|
|
281
274
|
}
|
|
282
275
|
function L(m, t = []) {
|
|
283
276
|
if (!t || t.length === 0) return;
|
|
284
|
-
const o =
|
|
277
|
+
const o = p("div", {
|
|
285
278
|
className: "spot-qualifying-reasons__container",
|
|
286
279
|
parent: m
|
|
287
|
-
}), s = [...t].sort((e,
|
|
280
|
+
}), s = [...t].sort((e, c) => e.rank - c.rank), n = p("div", {
|
|
288
281
|
className: "spot-qualifying-reasons__grid",
|
|
289
282
|
parent: o
|
|
290
283
|
}), r = {
|
|
@@ -301,8 +294,8 @@ function L(m, t = []) {
|
|
|
301
294
|
try {
|
|
302
295
|
const e = document.currentScript;
|
|
303
296
|
if (e != null && e.src) {
|
|
304
|
-
const
|
|
305
|
-
i =
|
|
297
|
+
const c = new URL(e.src);
|
|
298
|
+
i = c.origin + c.pathname.replace(/\/[^/]*$/, "/");
|
|
306
299
|
} else
|
|
307
300
|
i = window.location.origin + window.location.pathname.replace(/\/[^/]*$/, "/");
|
|
308
301
|
i += "assets/";
|
|
@@ -311,23 +304,23 @@ function L(m, t = []) {
|
|
|
311
304
|
}
|
|
312
305
|
s.forEach((e) => {
|
|
313
306
|
var h, y, d;
|
|
314
|
-
const
|
|
307
|
+
const c = p("div", {
|
|
315
308
|
className: "spot-qualifying-reasons__item",
|
|
316
|
-
parent: a
|
|
317
|
-
}), u = c("div", {
|
|
318
|
-
className: "spot-qualifying-reasons__icon-wrapper",
|
|
319
309
|
parent: n
|
|
310
|
+
}), u = p("div", {
|
|
311
|
+
className: "spot-qualifying-reasons__icon-wrapper",
|
|
312
|
+
parent: c
|
|
320
313
|
}), f = r[((h = e.benefitType) == null ? void 0 : h.name) || ""] || r[e.name || ""];
|
|
321
314
|
if (f) {
|
|
322
|
-
const
|
|
315
|
+
const a = p("img", {
|
|
323
316
|
parent: u
|
|
324
317
|
});
|
|
325
|
-
|
|
318
|
+
a.src = i + f, a.alt = ((y = e.benefitType) == null ? void 0 : y.name) || e.name || "", a.className = "spot-qualifying-reasons__icon";
|
|
326
319
|
}
|
|
327
|
-
|
|
320
|
+
p("span", {
|
|
328
321
|
className: "spot-qualifying-reasons__label",
|
|
329
322
|
text: ((d = e.benefitType) == null ? void 0 : d.name) || e.name || "",
|
|
330
|
-
parent:
|
|
323
|
+
parent: c
|
|
331
324
|
});
|
|
332
325
|
});
|
|
333
326
|
}
|
|
@@ -335,112 +328,112 @@ function O(m, t = [], o) {
|
|
|
335
328
|
if (t.length === 0 || !o || o <= 1)
|
|
336
329
|
return;
|
|
337
330
|
const s = /* @__PURE__ */ new Map();
|
|
338
|
-
t.forEach((
|
|
339
|
-
s.set(
|
|
331
|
+
t.forEach((a) => {
|
|
332
|
+
s.set(a, (s.get(a) || 0) + 1);
|
|
340
333
|
});
|
|
341
334
|
const r = Array.from(s.entries()).map(
|
|
342
|
-
([
|
|
343
|
-
item:
|
|
335
|
+
([a, l]) => ({
|
|
336
|
+
item: a,
|
|
344
337
|
count: l,
|
|
345
|
-
displayText: l > 1 ? `${l} x ${
|
|
338
|
+
displayText: l > 1 ? `${l} x ${a}` : a
|
|
346
339
|
})
|
|
347
|
-
).sort((
|
|
348
|
-
const w =
|
|
349
|
-
return !g && b ? -1 : g && !b ? 1 :
|
|
350
|
-
}), i =
|
|
340
|
+
).sort((a, l) => {
|
|
341
|
+
const w = a.item.charAt(0), _ = l.item.charAt(0), g = /[a-zA-Z]/.test(w), b = /[a-zA-Z]/.test(_);
|
|
342
|
+
return !g && b ? -1 : g && !b ? 1 : a.item.localeCompare(l.item, void 0, { sensitivity: "base" });
|
|
343
|
+
}), i = p("div", {
|
|
351
344
|
className: "spot-covered-items__container",
|
|
352
345
|
parent: m
|
|
353
|
-
}), e =
|
|
346
|
+
}), e = p("div", {
|
|
354
347
|
className: "spot-covered-items__header",
|
|
355
348
|
parent: i
|
|
356
|
-
}),
|
|
349
|
+
}), c = p("button", {
|
|
357
350
|
className: "spot-covered-items__toggle",
|
|
358
351
|
parent: e
|
|
359
352
|
});
|
|
360
|
-
|
|
353
|
+
p("span", {
|
|
361
354
|
className: "spot-covered-items__title",
|
|
362
355
|
text: `Items Covered in Your Cart (${t.length})`,
|
|
363
|
-
parent:
|
|
356
|
+
parent: c
|
|
364
357
|
});
|
|
365
|
-
const u =
|
|
358
|
+
const u = p("div", {
|
|
366
359
|
className: "spot-covered-items__right-section",
|
|
367
|
-
parent:
|
|
360
|
+
parent: c
|
|
368
361
|
});
|
|
369
|
-
|
|
362
|
+
p("span", {
|
|
370
363
|
className: "spot-covered-items__view-all",
|
|
371
364
|
text: "View All",
|
|
372
365
|
parent: u
|
|
373
366
|
});
|
|
374
|
-
const f =
|
|
367
|
+
const f = p("span", {
|
|
375
368
|
className: "spot-covered-items__arrow",
|
|
376
369
|
innerHTML: "▼",
|
|
377
370
|
parent: u
|
|
378
|
-
}), h =
|
|
371
|
+
}), h = p("div", {
|
|
379
372
|
className: "spot-covered-items__content",
|
|
380
373
|
parent: i
|
|
381
|
-
}), y =
|
|
374
|
+
}), y = p("ul", {
|
|
382
375
|
className: "spot-covered-items__list",
|
|
383
376
|
parent: h
|
|
384
377
|
});
|
|
385
|
-
r.forEach(({ displayText:
|
|
386
|
-
const l =
|
|
387
|
-
|
|
378
|
+
r.forEach(({ displayText: a }) => {
|
|
379
|
+
const l = p("li", { parent: y });
|
|
380
|
+
p("span", { text: a, parent: l });
|
|
388
381
|
});
|
|
389
382
|
let d = !1;
|
|
390
|
-
h.style.display = "none",
|
|
391
|
-
|
|
392
|
-
}),
|
|
383
|
+
h.style.display = "none", c.addEventListener("click", (a) => {
|
|
384
|
+
a.stopPropagation(), d = !d, h.style.display = d ? "block" : "none", f.innerHTML = d ? "▲" : "▼", c.setAttribute("aria-expanded", d.toString());
|
|
385
|
+
}), c.setAttribute("aria-expanded", "false"), c.setAttribute("aria-controls", "covered-items-list"), h.setAttribute("id", "covered-items-list");
|
|
393
386
|
}
|
|
394
387
|
function P(m, t = []) {
|
|
395
|
-
const o =
|
|
388
|
+
const o = p("div", {
|
|
396
389
|
className: "spot-table__container",
|
|
397
390
|
parent: m
|
|
398
|
-
}), s =
|
|
391
|
+
}), s = p("table", {
|
|
399
392
|
className: "spot-refund__table spot-table--dynamic",
|
|
400
393
|
parent: o
|
|
401
|
-
}),
|
|
402
|
-
|
|
403
|
-
const i =
|
|
404
|
-
t.forEach(({ text: e, percent:
|
|
405
|
-
const f =
|
|
406
|
-
|
|
407
|
-
const h =
|
|
408
|
-
|
|
394
|
+
}), n = p("thead", { parent: s }), r = p("tr", { parent: n });
|
|
395
|
+
p("th", { text: "When you cancel", parent: r }), p("th", { text: "You will receive", parent: r });
|
|
396
|
+
const i = p("tbody", { parent: s });
|
|
397
|
+
t.forEach(({ text: e, percent: c, amount: u }) => {
|
|
398
|
+
const f = p("tr", { parent: i });
|
|
399
|
+
p("td", { text: e, parent: f });
|
|
400
|
+
const h = c === "Not eligible for refund" ? "Not eligible for a refund" : `$${u} refund`;
|
|
401
|
+
p("td", { text: h, parent: f });
|
|
409
402
|
});
|
|
410
403
|
}
|
|
411
404
|
function $(m, t, o) {
|
|
412
|
-
const s =
|
|
405
|
+
const s = p("div", {
|
|
413
406
|
className: "spot-selection__options",
|
|
414
407
|
parent: m
|
|
415
|
-
}),
|
|
408
|
+
}), n = p("label", {
|
|
416
409
|
className: `spot-selection__option ${t ? "selected" : ""}`,
|
|
417
410
|
parent: s
|
|
418
|
-
}), r =
|
|
419
|
-
r.type = "radio", r.name = "selection", r.value = "yes", t && (r.checked = !0),
|
|
411
|
+
}), r = p("input", { parent: n });
|
|
412
|
+
r.type = "radio", r.name = "selection", r.value = "yes", t && (r.checked = !0), p("strong", {
|
|
420
413
|
text: o.yesOptionText,
|
|
421
|
-
parent:
|
|
422
|
-
}),
|
|
414
|
+
parent: n
|
|
415
|
+
}), p("span", {
|
|
423
416
|
className: "spot-selection__recommended-tag",
|
|
424
417
|
text: "Recommended",
|
|
425
|
-
parent:
|
|
418
|
+
parent: n
|
|
426
419
|
});
|
|
427
|
-
const i =
|
|
420
|
+
const i = p("label", {
|
|
428
421
|
className: "spot-selection__option",
|
|
429
422
|
parent: s
|
|
430
|
-
}), e =
|
|
431
|
-
return e.type = "radio", e.name = "selection", e.value = "no",
|
|
423
|
+
}), e = p("input", { parent: i });
|
|
424
|
+
return e.type = "radio", e.name = "selection", e.value = "no", p("span", { text: o.noOptionText, parent: i }), s;
|
|
432
425
|
}
|
|
433
426
|
function R(m, t) {
|
|
434
|
-
var
|
|
435
|
-
const o = (
|
|
427
|
+
var n;
|
|
428
|
+
const o = (n = t.communication) == null ? void 0 : n.paymentTerms, s = p("div", {
|
|
436
429
|
className: "spot-payment-terms",
|
|
437
430
|
parent: m
|
|
438
431
|
});
|
|
439
|
-
return
|
|
432
|
+
return p("div", {
|
|
440
433
|
className: "spot-payment-terms__header",
|
|
441
434
|
text: "PAYMENT TERMS",
|
|
442
435
|
parent: s
|
|
443
|
-
}),
|
|
436
|
+
}), p("div", {
|
|
444
437
|
className: "spot-payment-terms__body",
|
|
445
438
|
text: o || "",
|
|
446
439
|
parent: s
|
|
@@ -448,7 +441,7 @@ function R(m, t) {
|
|
|
448
441
|
}
|
|
449
442
|
function V(m, t, o = "bottom-right") {
|
|
450
443
|
if (o === "top-right") {
|
|
451
|
-
const e =
|
|
444
|
+
const e = p("div", {
|
|
452
445
|
className: "spot-logo__top-right",
|
|
453
446
|
parent: m
|
|
454
447
|
});
|
|
@@ -469,21 +462,21 @@ function V(m, t, o = "bottom-right") {
|
|
|
469
462
|
</defs>
|
|
470
463
|
</svg>`;
|
|
471
464
|
}
|
|
472
|
-
const s =
|
|
465
|
+
const s = p("div", {
|
|
473
466
|
className: "spot-footer__container",
|
|
474
467
|
parent: m
|
|
475
|
-
}),
|
|
468
|
+
}), n = p("div", {
|
|
476
469
|
className: "spot-footer__terms",
|
|
477
470
|
parent: s
|
|
478
471
|
}), r = `<a href="${t.communication.termsAndConditionsUrl}" target="_blank" class="spot-footer__terms-link">Terms & Conditions</a>`, i = t.communication.legalDisclaimer.replace(
|
|
479
472
|
/terms (and|&) conditions/gi,
|
|
480
473
|
r
|
|
481
474
|
);
|
|
482
|
-
if (
|
|
475
|
+
if (p("span", {
|
|
483
476
|
innerHTML: i,
|
|
484
|
-
parent:
|
|
477
|
+
parent: n
|
|
485
478
|
}), o === "bottom-right") {
|
|
486
|
-
const e =
|
|
479
|
+
const e = p("p", {
|
|
487
480
|
className: "spot-footer__powered-by",
|
|
488
481
|
parent: s
|
|
489
482
|
});
|
|
@@ -532,21 +525,21 @@ class A {
|
|
|
532
525
|
}, 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();
|
|
533
526
|
}
|
|
534
527
|
async _init() {
|
|
535
|
-
var t, o, s,
|
|
528
|
+
var t, o, s, n, r;
|
|
536
529
|
try {
|
|
537
530
|
D(this.options);
|
|
538
531
|
let i;
|
|
539
532
|
if (this.options.useMockData && this.options.mockData)
|
|
540
533
|
i = this.options.mockData;
|
|
541
534
|
else {
|
|
542
|
-
const { environment: e, partnerId:
|
|
535
|
+
const { environment: e, partnerId: c } = this.options.apiConfig, f = this.options.apiConfig.customEndpoint || T[e];
|
|
543
536
|
i = "cartInfo" in this.options.quoteRequestData && "items" in this.options.quoteRequestData ? await I(
|
|
544
537
|
f,
|
|
545
|
-
|
|
538
|
+
c,
|
|
546
539
|
this.options.quoteRequestData
|
|
547
540
|
) : await x(
|
|
548
541
|
f,
|
|
549
|
-
|
|
542
|
+
c,
|
|
550
543
|
this.options.quoteRequestData
|
|
551
544
|
);
|
|
552
545
|
}
|
|
@@ -566,11 +559,11 @@ class A {
|
|
|
566
559
|
quoteId: this.quote.id
|
|
567
560
|
};
|
|
568
561
|
if (this.quote.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
569
|
-
const
|
|
562
|
+
const c = this.options.quoteRequestData;
|
|
570
563
|
e.batchQuoteDetails = this.quote.originalQuotes.map((u) => {
|
|
571
564
|
var h;
|
|
572
|
-
const f = (h =
|
|
573
|
-
(y) => (y.cartItemId || `item-${
|
|
565
|
+
const f = (h = c.items) == null ? void 0 : h.find(
|
|
566
|
+
(y) => (y.cartItemId || `item-${c.items.indexOf(y) + 1}`) === u.cartItemId
|
|
574
567
|
);
|
|
575
568
|
return {
|
|
576
569
|
quoteId: u.id,
|
|
@@ -586,7 +579,7 @@ class A {
|
|
|
586
579
|
e && this._applyQuoteUpdates(e);
|
|
587
580
|
}
|
|
588
581
|
} catch (i) {
|
|
589
|
-
if ((
|
|
582
|
+
if ((n = this.options.callbacks) != null && n.onError) {
|
|
590
583
|
const e = i;
|
|
591
584
|
(r = this.options.callbacks) == null || r.onError({
|
|
592
585
|
message: e.message,
|
|
@@ -598,12 +591,12 @@ class A {
|
|
|
598
591
|
}
|
|
599
592
|
_renderWidget() {
|
|
600
593
|
if (!this.quote) return;
|
|
601
|
-
this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([s,
|
|
594
|
+
this.container = document.createElement("div"), this.container.className = "spot-refund-guarantee", this.root.appendChild(this.container), Object.entries(this.options.theme || {}).forEach(([s, n]) => {
|
|
602
595
|
const r = `--${s}`;
|
|
603
|
-
this.container.style.setProperty(r,
|
|
604
|
-
}),
|
|
596
|
+
this.container.style.setProperty(r, n);
|
|
597
|
+
}), M(this.container, this.quote.communication);
|
|
605
598
|
const t = document.createElement("div");
|
|
606
|
-
if (t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ? L(t, this.quote.qualifyingReasons) :
|
|
599
|
+
if (t.className = "spot-content__wrapper", this.container.appendChild(t), this.quote.qualifyingReasons ? L(t, this.quote.qualifyingReasons) : N(t, this.quote.communication.bulletPoints), this.quote.coveredItems) {
|
|
607
600
|
const s = this._getTotalItemsInRequest();
|
|
608
601
|
O(t, this.quote.coveredItems, s);
|
|
609
602
|
}
|
|
@@ -613,7 +606,7 @@ class A {
|
|
|
613
606
|
this.options.optInSelected,
|
|
614
607
|
this.quote.communication
|
|
615
608
|
);
|
|
616
|
-
t.appendChild(o), this.paymentTermsEl =
|
|
609
|
+
t.appendChild(o), this.paymentTermsEl = p("div", {
|
|
617
610
|
className: "spot-payment-terms__wrapper",
|
|
618
611
|
parent: t
|
|
619
612
|
}), V(this.container, this.quote, this.options.logoPosition), window.addEventListener("resize", this._onResize), this._setupResizeObserver(), this._updateLayout(), this._setupOptionListeners(o);
|
|
@@ -631,7 +624,7 @@ class A {
|
|
|
631
624
|
t.classList.toggle("desktop-layout", s);
|
|
632
625
|
}
|
|
633
626
|
_shouldUseDesktopLayout(t) {
|
|
634
|
-
const o = this.container.offsetWidth - 40, s = 325,
|
|
627
|
+
const o = this.container.offsetWidth - 40, s = 325, n = 16;
|
|
635
628
|
if (o >= 900)
|
|
636
629
|
return !0;
|
|
637
630
|
if (o >= 650) {
|
|
@@ -642,8 +635,8 @@ class A {
|
|
|
642
635
|
);
|
|
643
636
|
if (!i)
|
|
644
637
|
return r && t.classList.add("desktop-layout"), r;
|
|
645
|
-
const
|
|
646
|
-
return r && t.classList.add("desktop-layout"), o >=
|
|
638
|
+
const c = Math.min(i.scrollWidth, 400) + s + n;
|
|
639
|
+
return r && t.classList.add("desktop-layout"), o >= c;
|
|
647
640
|
}
|
|
648
641
|
return !1;
|
|
649
642
|
}
|
|
@@ -667,11 +660,11 @@ class A {
|
|
|
667
660
|
const o = t.querySelectorAll(
|
|
668
661
|
'input[type="radio"]'
|
|
669
662
|
), s = t.querySelectorAll(".spot-selection__option");
|
|
670
|
-
o.forEach((
|
|
671
|
-
|
|
672
|
-
var
|
|
663
|
+
o.forEach((n) => {
|
|
664
|
+
n.addEventListener("change", (r) => {
|
|
665
|
+
var c, u, f;
|
|
673
666
|
const i = r.target, e = i.value;
|
|
674
|
-
if (this.hideSelectionError(), this.currentSelection = e, s.forEach((h) => h.classList.remove("selected")), (
|
|
667
|
+
if (this.hideSelectionError(), this.currentSelection = e, s.forEach((h) => h.classList.remove("selected")), (c = i.closest(".spot-selection__option")) == null || c.classList.add("selected"), this.paymentTermsEl && (this.paymentTermsEl.innerHTML = ""), e === "yes" && (this.options.quoteRequestData.isPartialPayment && R(this.paymentTermsEl, this.quote), (u = this.options.callbacks) != null && u.onOptIn)) {
|
|
675
668
|
const h = {
|
|
676
669
|
status: "QUOTE_ACCEPTED",
|
|
677
670
|
spotPrice: this.quote.spotPrice,
|
|
@@ -682,13 +675,13 @@ class A {
|
|
|
682
675
|
h.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
683
676
|
(d) => {
|
|
684
677
|
var l;
|
|
685
|
-
const
|
|
678
|
+
const a = (l = y.items) == null ? void 0 : l.find(
|
|
686
679
|
(w) => (w.cartItemId || `item-${y.items.indexOf(w) + 1}`) === d.cartItemId
|
|
687
680
|
);
|
|
688
681
|
return {
|
|
689
682
|
quoteId: d.id,
|
|
690
|
-
productPrice: (
|
|
691
|
-
cartItemId: (
|
|
683
|
+
productPrice: (a == null ? void 0 : a.productPrice) || d.spotPrice,
|
|
684
|
+
cartItemId: (a == null ? void 0 : a.cartItemId) || ""
|
|
692
685
|
};
|
|
693
686
|
}
|
|
694
687
|
);
|
|
@@ -705,13 +698,13 @@ class A {
|
|
|
705
698
|
h.batchQuoteDetails = this.quote.originalQuotes.map(
|
|
706
699
|
(d) => {
|
|
707
700
|
var l;
|
|
708
|
-
const
|
|
701
|
+
const a = (l = y.items) == null ? void 0 : l.find(
|
|
709
702
|
(w) => (w.cartItemId || `item-${y.items.indexOf(w) + 1}`) === d.cartItemId
|
|
710
703
|
);
|
|
711
704
|
return {
|
|
712
705
|
quoteId: d.id,
|
|
713
|
-
productPrice: (
|
|
714
|
-
cartItemId: (
|
|
706
|
+
productPrice: (a == null ? void 0 : a.productPrice) || d.spotPrice,
|
|
707
|
+
cartItemId: (a == null ? void 0 : a.cartItemId) || ""
|
|
715
708
|
};
|
|
716
709
|
}
|
|
717
710
|
);
|
|
@@ -743,24 +736,24 @@ class A {
|
|
|
743
736
|
return t ? this.hideSelectionError() : this.showSelectionError(), t;
|
|
744
737
|
}
|
|
745
738
|
async updateQuote(t) {
|
|
746
|
-
var o, s,
|
|
739
|
+
var o, s, n, r;
|
|
747
740
|
try {
|
|
748
741
|
const i = {
|
|
749
742
|
...this.options,
|
|
750
743
|
quoteRequestData: t
|
|
751
744
|
};
|
|
752
745
|
D(i);
|
|
753
|
-
const { environment: e, partnerId:
|
|
746
|
+
const { environment: e, partnerId: c, customEndpoint: u } = this.options.apiConfig, f = u || T[e], y = "cartInfo" in i.quoteRequestData && "items" in i.quoteRequestData ? await I(
|
|
754
747
|
f,
|
|
755
|
-
|
|
748
|
+
c,
|
|
756
749
|
i.quoteRequestData
|
|
757
750
|
) : await x(
|
|
758
751
|
f,
|
|
759
|
-
|
|
752
|
+
c,
|
|
760
753
|
i.quoteRequestData
|
|
761
754
|
);
|
|
762
755
|
if (y.status !== "QUOTE_AVAILABLE")
|
|
763
|
-
return y.status === "NO_MATCHING_QUOTE" && ((o = this.options.callbacks) != null && o.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
756
|
+
return this.destroy(), y.status === "NO_MATCHING_QUOTE" && ((o = this.options.callbacks) != null && o.noMatchingQuote) && this.options.callbacks.noMatchingQuote({
|
|
764
757
|
status: "NO_MATCHING_QUOTE",
|
|
765
758
|
data: i.quoteRequestData
|
|
766
759
|
}), !1;
|
|
@@ -771,7 +764,7 @@ class A {
|
|
|
771
764
|
return !0;
|
|
772
765
|
} catch (i) {
|
|
773
766
|
const e = i;
|
|
774
|
-
return (r = (
|
|
767
|
+
return (r = (n = this.options.callbacks) == null ? void 0 : n.onError) == null || r.call(n, {
|
|
775
768
|
message: e.message,
|
|
776
769
|
status: e.status,
|
|
777
770
|
responseBody: e.responseBody
|
|
@@ -779,7 +772,7 @@ class A {
|
|
|
779
772
|
}
|
|
780
773
|
}
|
|
781
774
|
getSelection() {
|
|
782
|
-
var o, s,
|
|
775
|
+
var o, s, n;
|
|
783
776
|
if (this.currentSelection == null) return null;
|
|
784
777
|
const t = {
|
|
785
778
|
selection: this.currentSelection,
|
|
@@ -787,11 +780,11 @@ class A {
|
|
|
787
780
|
spotPrice: (s = this.quote) == null ? void 0 : s.spotPrice,
|
|
788
781
|
status: this.currentSelection === "yes" ? "QUOTE_ACCEPTED" : "QUOTE_DECLINED"
|
|
789
782
|
};
|
|
790
|
-
if ((
|
|
783
|
+
if ((n = this.quote) != null && n.originalQuotes && this.quote.originalQuotes.length > 0) {
|
|
791
784
|
const r = this.options.quoteRequestData;
|
|
792
785
|
t.batchQuoteDetails = this.quote.originalQuotes.map((i) => {
|
|
793
|
-
var
|
|
794
|
-
const e = (
|
|
786
|
+
var c;
|
|
787
|
+
const e = (c = r.items) == null ? void 0 : c.find(
|
|
795
788
|
(u) => (u.cartItemId || `item-${r.items.indexOf(u) + 1}`) === i.cartItemId
|
|
796
789
|
);
|
|
797
790
|
return {
|
package/dist/index.umd.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
(function(_,C){typeof exports=="object"&&typeof module<"u"?module.exports=C():typeof define=="function"&&define.amd?define(C):(_=typeof globalThis<"u"?globalThis:_||self,_.SpotWidget=C())})(this,function(){"use strict";async function _(m,t,o){try{const s=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(o)}),
|
|
1
|
+
(function(_,C){typeof exports=="object"&&typeof module<"u"?module.exports=C():typeof define=="function"&&define.amd?define(C):(_=typeof globalThis<"u"?globalThis:_||self,_.SpotWidget=C())})(this,function(){"use strict";async function _(m,t,o){try{const s=await fetch(m,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(o)}),n=await s.json();if(!s.ok){const r=new Error((n==null?void 0:n.message)||"Failed to fetch quote");throw r.status=s.status,r.responseBody=n,r}return n}catch(s){throw s instanceof Error?s:new Error("Unknown error occurred while fetching quote")}}async function C(m,t,o){try{const s=m.replace("/quote","/quote/batch"),n=await fetch(s,{method:"POST",headers:{"Content-Type":"application/json","X-Spot-Partner-Id":t},body:JSON.stringify(o)}),r=await n.json();if(!n.ok){const i=new Error((r==null?void 0:r.message)||"Failed to fetch batch quote");throw i.status=n.status,i.responseBody=r,i}return r}catch(s){throw s instanceof Error?s:new Error("Unknown error occurred while fetching batch quote")}}async function x(m,t,o){var s;try{const n={cartId:o.cartInfo.cartId,cartName:o.cartInfo.cartName,currencyCode:o.cartInfo.currencyCode,isPartialPayment:o.cartInfo.isPartialPayment||!1,roundTo:o.cartInfo.roundTo||void 0,items:o.items.map((c,u)=>({...c,cartItemId:c.cartItemId||`item-${u+1}`}))},r=await C(m,t,n);if(r.status!=="QUOTES_AVAILABLE"&&r.status!=="QUOTE_AVAILABLE")return{status:"NO_MATCHING_QUOTE"};const i=r.quotes.map(c=>{const u=o.items.find((f,h)=>(f.cartItemId||`item-${h+1}`)===c.cartItemId);return u?u.participantDescription?`${u.productName} - ${u.participantDescription}`:u.productName:`Item ${c.id}`}),e=Math.round((r.totalSpotPrice||r.spotPrice||0)*100)/100;return{status:"QUOTE_AVAILABLE",data:{id:r.quotes?r.quotes.map(c=>c.id).join(","):((s=r.data)==null?void 0:s.id)||"",spotPrice:e,currencyCode:r.currencyCode||"",communication:{...r.communication,yesOptionText:r.communication.yesOptionText.replace(String(r.totalSpotPrice),String(e))},payoutSchedule:r.payoutSchedule.map(c=>({...c,amount:c.amount!==void 0?c.amount:0})),coveredItems:i,originalQuotes:r.quotes||(r.data?[r.data]:[])},spotPrice:e,coveredItems:i}}catch(n){throw n instanceof Error?n:new Error("Unknown error occurred while fetching multiple quotes")}}const z={sandbox:"https://api.sandbox.getspot.com/v1/quote",production:"https://api.getspot.com/v1/quote",local:"http://localhost:3999/api/v1/quote"};function E(m){const{apiConfig:t={},quoteRequestData:o,callbacks:s={},location:n,theme:r}=m,{environment:i="sandbox",partnerId:e,customEndpoint:c}=t;if(!e||typeof e!="string")throw new Error("Invalid or missing partnerId in apiConfig");if(!(c||z[i]))throw new Error(`Invalid environment in apiConfig: ${i}`);if(!o||typeof o!="object"&&!Array.isArray(o))throw new Error("quoteRequestData must be a non-null object or array");const f=["startDate","endDate","currencyCode","eventType","productType","productDuration","productPrice","productId","cartId","productName"];function h(d,a=null){const l=a!==null?`quoteRequestData[${a}]`:"quoteRequestData";f.forEach(v=>{if(!Object.prototype.hasOwnProperty.call(d,v)||d[v]===void 0||d[v]===null)throw new Error(`Missing required ${l} field: '${v}'`)});const w=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!w.test(d.startDate))throw new Error(`${l}.startDate must be a valid ISO8601 string`);if(!w.test(d.endDate))throw new Error(`${l}.endDate must be a valid ISO8601 string`);if(typeof d.currencyCode!="string")throw new Error(`${l}.currencyCode must be a string`);if(!["USD","CAD","AUD"].includes(d.currencyCode))throw new Error(`Invalid ${l}.currencyCode: ${d.currencyCode}`);if(typeof d.eventType!="string")throw new Error(`${l}.eventType must be a string`);if(typeof d.productType!="string")throw new Error(`${l}.productType must be a string`);const g=["Pass","Trip","Registration"];if(!g.includes(d.productType))throw new Error(`${l}.productType must be one of ${g.join(", ")}`);if(typeof d.productDuration!="string")throw new Error(`${l}.productDuration must be a string`);const b=["Daily","Seasonal","Trip","Event"];if(!b.includes(d.productDuration))throw new Error(`${l}.productDuration must be one of ${b.join(", ")}`);if(typeof d.productPrice!="number"||isNaN(d.productPrice))throw new Error(`${l}.productPrice must be a valid number`);if(typeof d.productId!="string")throw new Error(`${l}.productId must be a string`);if(typeof d.cartId!="string")throw new Error(`${l}.cartId must be a string`);if(typeof d.productName!="string")throw new Error(`${l}.productName must be a string`)}if("cartInfo"in o&&"items"in o){const d=o,{cartInfo:a,items:l}=d;if(!a||typeof a!="object")throw new Error("quoteRequestData.cartInfo must be a non-null object");if(!a.cartId||typeof a.cartId!="string")throw new Error("quoteRequestData.cartInfo.cartId must be a string");if(!a.cartName||typeof a.cartName!="string")throw new Error("quoteRequestData.cartInfo.cartName must be a string");if(!a.currencyCode||typeof a.currencyCode!="string")throw new Error("quoteRequestData.cartInfo.currencyCode must be a string");if(!["USD","CAD","AUD"].includes(a.currencyCode))throw new Error(`Invalid quoteRequestData.cartInfo.currencyCode: ${a.currencyCode}`);if(!Array.isArray(l)||l.length===0)throw new Error("quoteRequestData.items must be a non-empty array");const q=["startDate","endDate","eventType","productType","productDuration","productPrice","productId","productName"];l.forEach((g,b)=>{if(!g||typeof g!="object")throw new Error(`quoteRequestData.items[${b}] must be a non-null object`);const v=`quoteRequestData.items[${b}]`;q.forEach(k=>{if(!Object.prototype.hasOwnProperty.call(g,k)||g[k]===void 0||g[k]===null)throw new Error(`Missing required ${v} field: '${k}'`)});const T=/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?Z$/;if(!T.test(g.startDate))throw new Error(`${v}.startDate must be a valid ISO8601 string`);if(!T.test(g.endDate))throw new Error(`${v}.endDate must be a valid ISO8601 string`);if(typeof g.eventType!="string")throw new Error(`${v}.eventType must be a string`);if(typeof g.productType!="string")throw new Error(`${v}.productType must be a string`);const D=["Pass","Trip","Registration"];if(!D.includes(g.productType))throw new Error(`${v}.productType must be one of ${D.join(", ")}`);if(typeof g.productDuration!="string")throw new Error(`${v}.productDuration must be a string`);const H=["Daily","Seasonal","Trip","Event"];if(!H.includes(g.productDuration))throw new Error(`${v}.productDuration must be one of ${H.join(", ")}`);if(typeof g.productPrice!="number"||isNaN(g.productPrice))throw new Error(`${v}.productPrice must be a valid number`);if(typeof g.productId!="string")throw new Error(`${v}.productId must be a string`);if(typeof g.productName!="string")throw new Error(`${v}.productName must be a string`)})}else if(Array.isArray(o)){if(o.length===0)throw new Error("quoteRequestData array cannot be empty");o.forEach((d,a)=>{if(!d||typeof d!="object")throw new Error(`quoteRequestData[${a}] must be a non-null object`);h(d,a)})}else h(o);if(["onOptIn","onOptOut","onQuoteRetrieved","onError","noMatchingQuote"].forEach(d=>{const a=s[d];if(a&&typeof a!="function")throw new Error(`Callback '${d}' must be a function.`)}),typeof n=="string"&&!document.querySelector(n))throw new Error(`Invalid location selector: '${n}'`);if(r&&typeof r!="object")throw new Error("Theme must be an object with CSS variables, do not include the '--' prefix")}function p(m,{text:t,className:o,parent:s,innerHTML:n,href:r,target:i}={}){const e=document.createElement(m);return o&&(e.className=o),t!=null&&(e.textContent=t),n!=null&&(e.innerHTML=n),r&&"href"in e&&(e.href=r),i&&"target"in e&&(e.target=i),s&&s.appendChild(e),e}function M(m,{name:t,description:o}){p("div",{className:"spot-header__title",text:t,parent:m}),p("div",{className:"spot-header__description",text:o,parent:m})}function N(m,t=[]){const o=p("ul",{className:"spot-benefits__list",parent:m});t.forEach(s=>{const n=p("li",{parent:o});n.innerHTML=`
|
|
2
2
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" class="spot-bullets__checkmark">
|
|
3
3
|
<path d="M11.6666 3.5L5.24998 9.91667L2.33331 7"
|
|
4
4
|
stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
</svg>`,
|
|
5
|
+
</svg>`,p("span",{text:s,parent:n})})}function L(m,t=[]){if(!t||t.length===0)return;const o=p("div",{className:"spot-qualifying-reasons__container",parent:m}),s=[...t].sort((e,c)=>e.rank-c.rank),n=p("div",{className:"spot-qualifying-reasons__grid",parent:o}),r={"Accident & Illness":"cross.svg","Family Emergencies":"users.svg",Layoffs:"building.svg","Jury Duty":"scale.svg","Work Travel Conflict":"briefcase.svg","Severe Weather":"umbrella.svg","Travel Interruption":"plane.svg","Military Duty":"medal.svg"};let i;try{const e=document.currentScript;if(e!=null&&e.src){const c=new URL(e.src);i=c.origin+c.pathname.replace(/\/[^/]*$/,"/")}else i=window.location.origin+window.location.pathname.replace(/\/[^/]*$/,"/");i+="assets/"}catch{i="./assets/"}s.forEach(e=>{var h,y,d;const c=p("div",{className:"spot-qualifying-reasons__item",parent:n}),u=p("div",{className:"spot-qualifying-reasons__icon-wrapper",parent:c}),f=r[((h=e.benefitType)==null?void 0:h.name)||""]||r[e.name||""];if(f){const a=p("img",{parent:u});a.src=i+f,a.alt=((y=e.benefitType)==null?void 0:y.name)||e.name||"",a.className="spot-qualifying-reasons__icon"}p("span",{className:"spot-qualifying-reasons__label",text:((d=e.benefitType)==null?void 0:d.name)||e.name||"",parent:c})})}function O(m,t=[],o){if(t.length===0||!o||o<=1)return;const s=new Map;t.forEach(a=>{s.set(a,(s.get(a)||0)+1)});const r=Array.from(s.entries()).map(([a,l])=>({item:a,count:l,displayText:l>1?`${l} x ${a}`:a})).sort((a,l)=>{const w=a.item.charAt(0),q=l.item.charAt(0),g=/[a-zA-Z]/.test(w),b=/[a-zA-Z]/.test(q);return!g&&b?-1:g&&!b?1:a.item.localeCompare(l.item,void 0,{sensitivity:"base"})}),i=p("div",{className:"spot-covered-items__container",parent:m}),e=p("div",{className:"spot-covered-items__header",parent:i}),c=p("button",{className:"spot-covered-items__toggle",parent:e});p("span",{className:"spot-covered-items__title",text:`Items Covered in Your Cart (${t.length})`,parent:c});const u=p("div",{className:"spot-covered-items__right-section",parent:c});p("span",{className:"spot-covered-items__view-all",text:"View All",parent:u});const f=p("span",{className:"spot-covered-items__arrow",innerHTML:"▼",parent:u}),h=p("div",{className:"spot-covered-items__content",parent:i}),y=p("ul",{className:"spot-covered-items__list",parent:h});r.forEach(({displayText:a})=>{const l=p("li",{parent:y});p("span",{text:a,parent:l})});let d=!1;h.style.display="none",c.addEventListener("click",a=>{a.stopPropagation(),d=!d,h.style.display=d?"block":"none",f.innerHTML=d?"▲":"▼",c.setAttribute("aria-expanded",d.toString())}),c.setAttribute("aria-expanded","false"),c.setAttribute("aria-controls","covered-items-list"),h.setAttribute("id","covered-items-list")}function P(m,t=[]){const o=p("div",{className:"spot-table__container",parent:m}),s=p("table",{className:"spot-refund__table spot-table--dynamic",parent:o}),n=p("thead",{parent:s}),r=p("tr",{parent:n});p("th",{text:"When you cancel",parent:r}),p("th",{text:"You will receive",parent:r});const i=p("tbody",{parent:s});t.forEach(({text:e,percent:c,amount:u})=>{const f=p("tr",{parent:i});p("td",{text:e,parent:f});const h=c==="Not eligible for refund"?"Not eligible for a refund":`$${u} refund`;p("td",{text:h,parent:f})})}function $(m,t,o){const s=p("div",{className:"spot-selection__options",parent:m}),n=p("label",{className:`spot-selection__option ${t?"selected":""}`,parent:s}),r=p("input",{parent:n});r.type="radio",r.name="selection",r.value="yes",t&&(r.checked=!0),p("strong",{text:o.yesOptionText,parent:n}),p("span",{className:"spot-selection__recommended-tag",text:"Recommended",parent:n});const i=p("label",{className:"spot-selection__option",parent:s}),e=p("input",{parent:i});return e.type="radio",e.name="selection",e.value="no",p("span",{text:o.noOptionText,parent:i}),s}function R(m,t){var n;const o=(n=t.communication)==null?void 0:n.paymentTerms,s=p("div",{className:"spot-payment-terms",parent:m});return p("div",{className:"spot-payment-terms__header",text:"PAYMENT TERMS",parent:s}),p("div",{className:"spot-payment-terms__body",text:o||"",parent:s}),s}function V(m,t,o="bottom-right"){if(o==="top-right"){const e=p("div",{className:"spot-logo__top-right",parent:m});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 s=
|
|
20
|
+
</svg>`}const s=p("div",{className:"spot-footer__container",parent:m}),n=p("div",{className:"spot-footer__terms",parent:s}),r=`<a href="${t.communication.termsAndConditionsUrl}" target="_blank" class="spot-footer__terms-link">Terms & Conditions</a>`,i=t.communication.legalDisclaimer.replace(/terms (and|&) conditions/gi,r);if(p("span",{innerHTML:i,parent:n}),o==="bottom-right"){const e=p("p",{className:"spot-footer__powered-by",parent:s});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 s}const S=":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-max-width: 51rem;--spot-margin: 1rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-bullets-checkmark-color: #2e2e2e;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-covered-items-background: #f1f3f5;--spot-covered-items-hover-background: #e9ecef;--spot-covered-items-border-radius: .5rem;--spot-covered-items-padding: .75rem 1rem;--spot-covered-items-font-size: .875rem;--spot-covered-items-font-weight: 400;--spot-covered-items-font-color: #000000;--spot-covered-items-font-family: Arial;--spot-covered-items-arrow-font-size: .6rem;--spot-covered-items-arrow-color: #636569;--spot-covered-items-view-all-color: #636569;--spot-covered-items-view-all-font-size: .875rem;--spot-covered-items-view-all-font-weight: 400;--spot-covered-items-content-background: #f8f9fa;--spot-covered-items-content-border: 1px solid #e0e0e0;--spot-covered-items-content-border-radius: .5rem;--spot-covered-items-content-padding: .75rem 1rem;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 1.5rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:var(--spot-max-width);margin:var(--spot-margin);container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__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-bullets__checkmark path{stroke:var(--spot-bullets-checkmark-color)}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:.85rem;margin-bottom:.5rem;max-width:26rem}.spot-content__wrapper.desktop-layout:has(.spot-table__container) .spot-covered-items__container{margin-top:0rem;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-covered-items__list li:last-child{margin-bottom:0}.spot-covered-items__header{margin-bottom:.5rem}.spot-covered-items__toggle{background:var(--spot-covered-items-background);border:none;border-radius:var(--spot-covered-items-border-radius);padding:var(--spot-covered-items-padding);cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;transition:all .2s ease}.spot-covered-items__toggle:hover{background-color:var(--spot-covered-items-hover-background)}.spot-covered-items__toggle:focus{outline:none;box-shadow:0 0 0 2px #0000001a}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;margin:0;padding:0}.spot-covered-items__right-section{display:flex;align-items:center;gap:.5rem;margin-left:auto}.spot-covered-items__view-all{font-size:var(--spot-covered-items-view-all-font-size);font-weight:var(--spot-covered-items-view-all-font-weight);color:var(--spot-covered-items-view-all-color);font-family:var(--spot-covered-items-font-family);line-height:125%}.spot-covered-items__arrow{font-size:var(--spot-covered-items-arrow-font-size);transition:transform .2s ease;color:var(--spot-covered-items-arrow-color);flex-shrink:0;transform:scaleX(1.5)}.spot-covered-items__content{margin-top:.5rem;transition:all .2s ease;overflow:hidden}.spot-covered-items__list{background-color:var(--spot-covered-items-content-background);border:var(--spot-covered-items-content-border);border-radius:var(--spot-covered-items-content-border-radius);margin:0;padding:var(--spot-covered-items-content-padding)}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}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 Q(m){const t=document.createElement("style");t.textContent=m,document.head.appendChild(t)}Q(S);const I={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,s,a,r;try{E(this.options);let i;if(this.options.useMockData&&this.options.mockData)i=this.options.mockData;else{const{environment:e,partnerId:n}=this.options.apiConfig,f=this.options.apiConfig.customEndpoint||I[e];i="cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?await x(f,n,this.options.quoteRequestData):await _(f,n,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 e={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const n=this.options.quoteRequestData;e.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var h;const f=(h=n.items)==null?void 0:h.find(y=>(y.cartItemId||`item-${n.items.indexOf(y)+1}`)===u.cartItemId);return{quoteId:u.id,productPrice:(f==null?void 0:f.productPrice)||u.spotPrice,cartItemId:(f==null?void 0:f.cartItemId)||""}})}this.options.callbacks.onOptIn(e)}if((s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const e=this.options.callbacks.onQuoteRetrieved(this.quote);e&&this._applyQuoteUpdates(e)}}catch(i){if((a=this.options.callbacks)!=null&&a.onError){const e=i;(r=this.options.callbacks)==null||r.onError({message:e.message,status:e.status,responseBody:e.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(([s,a])=>{const r=`--${s}`;this.container.style.setProperty(r,a)}),N(this.container,this.quote.communication);const t=document.createElement("div");if(t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?L(t,this.quote.qualifyingReasons):M(t,this.quote.communication.bulletPoints),this.quote.coveredItems){const s=this._getTotalItemsInRequest();O(t,this.quote.coveredItems,s)}this.options.showTable&&!this.quote.qualifyingReasons&&P(t,this.quote.payoutSchedule);const o=$(t,this.options.optInSelected,this.quote.communication);t.appendChild(o),this.paymentTermsEl=c("div",{className:"spot-payment-terms__wrapper",parent:t}),V(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 s=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",s)}_shouldUseDesktopLayout(t){const o=this.container.offsetWidth-40,s=325,a=16;if(o>=900)return!0;if(o>=650){const r=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 r&&t.classList.add("desktop-layout"),r;const n=Math.min(i.scrollWidth,400)+s+a;return r&&t.classList.add("desktop-layout"),o>=n}return!1}_setupResizeObserver(){!this.container||!window.ResizeObserver||(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=window.setTimeout(()=>{this._updateLayout()},100)}),this._resizeObserver.observe(this.container))}_getTotalItemsInRequest(){return"cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?this.options.quoteRequestData.items.length:1}_applyQuoteUpdates(t){!this.quote||!this.container||(t.spotPriceWithFees!==void 0&&(this.quote.communication.yesOptionText=this.quote.communication.yesOptionText.replace(`$${this.quote.spotPrice.toFixed(2)}`,`$${t.spotPriceWithFees.toFixed(2)}`)),this.destroy(),this._renderWidget())}_setupOptionListeners(t){const o=t.querySelectorAll('input[type="radio"]'),s=t.querySelectorAll(".spot-selection__option");o.forEach(a=>{a.addEventListener("change",r=>{var n,u,f;const i=r.target,e=i.value;if(this.hideSelectionError(),this.currentSelection=e,s.forEach(h=>h.classList.remove("selected")),(n=i.closest(".spot-selection__option"))==null||n.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),e==="yes"&&(this.options.quoteRequestData.isPartialPayment&&R(this.paymentTermsEl,this.quote),(u=this.options.callbacks)!=null&&u.onOptIn)){const h={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;h.batchQuoteDetails=this.quote.originalQuotes.map(d=>{var l;const p=(l=y.items)==null?void 0:l.find(w=>(w.cartItemId||`item-${y.items.indexOf(w)+1}`)===d.cartItemId);return{quoteId:d.id,productPrice:(p==null?void 0:p.productPrice)||d.spotPrice,cartItemId:(p==null?void 0:p.cartItemId)||""}})}this.options.callbacks.onOptIn(h)}if(e==="no"&&((f=this.options.callbacks)!=null&&f.onOptOut)){const h={status:"QUOTE_DECLINED",quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(d=>{var l;const p=(l=y.items)==null?void 0:l.find(w=>(w.cartItemId||`item-${y.items.indexOf(w)+1}`)===d.cartItemId);return{quoteId:d.id,productPrice:(p==null?void 0:p.productPrice)||d.spotPrice,cartItemId:(p==null?void 0:p.cartItemId)||""}})}this.options.callbacks.onOptOut(h)}})})}showSelectionError(){var t;if(!this.errorEl){this.errorEl=document.createElement("div"),this.errorEl.className="spot-selection__error",this.errorEl.textContent="Please make a selection";const 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,s,a,r;try{const i={...this.options,quoteRequestData:t};E(i);const{environment:e,partnerId:n,customEndpoint:u}=this.options.apiConfig,f=u||I[e],y="cartInfo"in i.quoteRequestData&&"items"in i.quoteRequestData?await x(f,n,i.quoteRequestData):await _(f,n,i.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:i.quoteRequestData}),!1;if(this.options.quoteRequestData=i.quoteRequestData,this.quote=y.data,this.currentSelection=null,this.destroy(),this._renderWidget(),(s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const d=this.options.callbacks.onQuoteRetrieved(this.quote);d&&this._applyQuoteUpdates(d)}return!0}catch(i){const e=i;return(r=(a=this.options.callbacks)==null?void 0:a.onError)==null||r.call(a,{message:e.message,status:e.status,responseBody:e.responseBody}),!1}}getSelection(){var o,s,a;if(this.currentSelection==null)return null;const t={selection:this.currentSelection,quoteId:(o=this.quote)==null?void 0:o.id,spotPrice:(s=this.quote)==null?void 0:s.spotPrice,status:this.currentSelection==="yes"?"QUOTE_ACCEPTED":"QUOTE_DECLINED"};if((a=this.quote)!=null&&a.originalQuotes&&this.quote.originalQuotes.length>0){const r=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(i=>{var n;const e=(n=r.items)==null?void 0:n.find(u=>(u.cartItemId||`item-${r.items.indexOf(u)+1}`)===i.cartItemId);return{quoteId:i.id,productPrice:(e==null?void 0:e.productPrice)||i.spotPrice,cartItemId:(e==null?void 0:e.cartItemId)||""}})}return t}destroy(){window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeTimeout&&window.clearTimeout(this._resizeTimeout),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}}return A});
|
|
35
|
+
</svg>`}return s}const S=":root{--spot-font-family: Arial;--spot-padding: 1.25rem;--spot-background-color: #ffffff;--spot-font-color: #000000;--spot-border-radius: .5rem;--spot-max-width: 51rem;--spot-margin: 1rem;--spot-title-font-size: 1.25rem;--spot-title-font-weight: 700;--spot-title-padding: 0 0 1.25rem 0;--spot-description-font-size: .875rem;--spot-description-font-weight: 400;--spot-description-padding: 0 0 .5rem 0;--spot-bullets-font-size: .875rem;--spot-bullets-font-weight: 400;--spot-bullets-padding: .3125rem;--spot-bullets-checkmark-color: #2e2e2e;--spot-table-border-radius: .625rem;--spot-table-header-font-size: .875rem;--spot-table-header-font-weight: 700;--spot-table-header-padding: 0 .5rem .625rem;--spot-table-cell-font-size: .815rem;--spot-table-cell-font-weight: 400;--spot-table-cell-padding: 0 .625rem;--spot-radio-border: #000000;--spot-radio-border-radius: .625rem;--spot-radio-checked-background: #000000;--spot-radio-text-font-size: .875rem;--spot-radio-text-font-weight: 400;--spot-radio-text-padding: .625rem;--spot-radio-selection-background: #f4f4f4;--spot-radio-selection-border-radius: .625rem;--spot-radio-selection-padding: .625rem;--spot-recommended-tag-background: #000000;--spot-recommended-tag-font-color: #ffffff;--spot-recommended-tag-font-size: .875rem;--spot-recommended-tag-font-weight: 700;--spot-recommended-tag-padding: .25rem .5rem;--spot-recommended-tag-border-radius: .5rem;--spot-selection-error-font-color: #ff0000;--spot-selection-error-font-size: .875rem;--spot-qualifying-reasons-margin: .75rem 0;--spot-qualifying-reasons-padding: 0 .3125rem;--spot-qualifying-reasons-column-gap: 3rem;--spot-qualifying-reasons-row-gap: .25rem;--spot-qualifying-reasons-grid-padding-left: 1rem;--spot-qualifying-reasons-icon-wrapper-size: 1.125rem;--spot-qualifying-reasons-icon-size: .75rem;--spot-qualifying-reasons-icon-border-color: #2e2e2e;--spot-qualifying-reasons-icon-border-width: 1px;--spot-qualifying-reasons-icon-background: #ffffff;--spot-qualifying-reasons-item-gap: .625rem;--spot-qualifying-reasons-label-font-size: .8rem;--spot-qualifying-reasons-label-font-weight: 400;--spot-qualifying-reasons-label-font-color: #000000;--spot-qualifying-reasons-label-font-family: Arial;--spot-selection-error-padding: .5rem;--spot-payment-terms-background: #f4f4f4;--spot-payment-terms-border-radius: .625rem;--spot-payment-terms-padding: 1rem;--spot-payment-terms-font-color: #636569;--spot-payment-terms-font-size: .75rem;--spot-payment-terms-header-font-weight: 700;--spot-payment-terms-header-font-size: .875rem;--spot-payment-terms-header-margin-bottom: .5rem;--spot-payment-terms-header-border-color: #c2c2c2;--spot-payment-terms-header-padding: 0 0 .5rem 0;--spot-terms-font-size: .75rem;--spot-terms-font-weight: 400;--spot-terms-font-color: #636569;--spot-terms-padding: 0;--spot-terms-link-text-decoration: underline;--spot-terms-link-font-size: .75rem;--spot-terms-link-font-weight: 400;--spot-terms-link-font-color: #636569;--spot-terms-link-padding: 0;--spot-covered-items-background: #f1f3f5;--spot-covered-items-hover-background: #e9ecef;--spot-covered-items-border-radius: .5rem;--spot-covered-items-padding: .75rem 1rem;--spot-covered-items-font-size: .875rem;--spot-covered-items-font-weight: 400;--spot-covered-items-font-color: #000000;--spot-covered-items-font-family: Arial;--spot-covered-items-arrow-font-size: .6rem;--spot-covered-items-arrow-color: #636569;--spot-covered-items-view-all-color: #636569;--spot-covered-items-view-all-font-size: .875rem;--spot-covered-items-view-all-font-weight: 400;--spot-covered-items-content-background: #f8f9fa;--spot-covered-items-content-border: 1px solid #e0e0e0;--spot-covered-items-content-border-radius: .5rem;--spot-covered-items-content-padding: .75rem 1rem;--spot-desktop-radio-margin-top: -1.5rem;--spot-benefits-margin-bottom: 0rem;--spot-covered-items-margin-bottom: 1.5rem;--spot-footer-gap: 1rem;--spot-footer-terms-margin-right: 7rem;--spot-payment-terms-margin-top: .5rem;--spot-logo-top-right-margin: 1rem}.spot-refund-guarantee{font-family:var(--spot-font-family);padding:var(--spot-padding);background-color:var(--spot-background-color);color:var(--spot-font-color);border:.0625rem solid #e0e0e0;border-radius:var(--spot-border-radius);max-width:var(--spot-max-width);margin:var(--spot-margin);container-type:inline-size;position:relative;word-wrap:normal;overflow-wrap:normal;-webkit-hyphens:none;hyphens:none}.spot-refund-guarantee *{color:inherit}.spot-header__title{font-size:var(--spot-title-font-size);font-weight:var(--spot-title-font-weight);padding:var(--spot-title-padding);color:var(--spot-title-font-color);font-family:var(--spot-title-font-family);line-height:120%;letter-spacing:-.03125rem}.spot-header__description{font-size:var(--spot-description-font-size);font-weight:var(--spot-description-font-weight);color:var(--spot-description-font-color);font-family:var(--spot-description-font-family);padding:var(--spot-description-padding);line-height:125%;letter-spacing:-.025rem}.spot-content__wrapper{display:flex;flex-direction:column}.spot-content__wrapper.desktop-layout{display:grid;grid-template-columns:1fr auto;align-items:start;gap:1rem}.desktop-layout .spot-benefits__list,.desktop-layout .spot-qualifying-reasons__container,.desktop-layout .spot-covered-items__container,.desktop-layout .spot-selection__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-bullets__checkmark path{stroke:var(--spot-bullets-checkmark-color)}.spot-qualifying-reasons__container{margin:var(--spot-qualifying-reasons-margin);padding:var(--spot-qualifying-reasons-padding)}.spot-qualifying-reasons__grid{display:grid;grid-template-columns:repeat(2,minmax(0,max-content));column-gap:var(--spot-qualifying-reasons-column-gap);row-gap:var(--spot-qualifying-reasons-row-gap);max-width:100%;padding-left:var(--spot-qualifying-reasons-grid-padding-left)}.spot-qualifying-reasons__item{display:flex;align-items:center;gap:var(--spot-qualifying-reasons-item-gap)}.spot-qualifying-reasons__icon-wrapper{width:var(--spot-qualifying-reasons-icon-wrapper-size);height:var(--spot-qualifying-reasons-icon-wrapper-size);border-radius:50%;border:var(--spot-qualifying-reasons-icon-border-width) solid var(--spot-qualifying-reasons-icon-border-color);background-color:var(--spot-qualifying-reasons-icon-background);display:flex;align-items:center;justify-content:center;flex-shrink:0}.spot-qualifying-reasons__icon{width:var(--spot-qualifying-reasons-icon-size);height:var(--spot-qualifying-reasons-icon-size)}.spot-qualifying-reasons__label{font-size:var(--spot-qualifying-reasons-label-font-size);font-weight:var(--spot-qualifying-reasons-label-font-weight);color:var(--spot-qualifying-reasons-label-font-color);font-family:var(--spot-qualifying-reasons-label-font-family);line-height:1.2}@media (max-width: 480px){.spot-qualifying-reasons__grid{grid-template-columns:1fr}}.spot-covered-items__container{margin-top:.85rem;margin-bottom:.5rem;max-width:26rem}.spot-content__wrapper.desktop-layout:has(.spot-table__container) .spot-covered-items__container{margin-top:0rem;margin-bottom:1rem}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);padding:0 .3125rem .25rem;line-height:125%;margin:0}.spot-covered-items__list{list-style-type:disc;list-style-position:inside;line-height:125%;gap:.5625rem;font-size:var(--spot-bullets-font-size);font-weight:var(--spot-bullets-font-weight);color:var(--spot-bullets-font-color);font-family:var(--spot-bullets-font-family);padding:var(--spot-bullets-padding);margin-block-start:0rem;margin-block-end:0rem}.spot-covered-items__list li{margin-bottom:.3rem;text-align:left}.spot-covered-items__list li:last-child{margin-bottom:0}.spot-covered-items__header{margin-bottom:.5rem}.spot-covered-items__toggle{background:var(--spot-covered-items-background);border:none;border-radius:var(--spot-covered-items-border-radius);padding:var(--spot-covered-items-padding);cursor:pointer;display:flex;align-items:center;justify-content:space-between;width:100%;font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;transition:all .2s ease}.spot-covered-items__toggle:hover{background-color:var(--spot-covered-items-hover-background)}.spot-covered-items__toggle:focus{outline:none;box-shadow:0 0 0 2px #0000001a}.spot-covered-items__title{font-size:var(--spot-covered-items-font-size);font-weight:var(--spot-covered-items-font-weight);color:var(--spot-covered-items-font-color);font-family:var(--spot-covered-items-font-family);line-height:125%;margin:0;padding:0}.spot-covered-items__right-section{display:flex;align-items:center;gap:.5rem;margin-left:auto}.spot-covered-items__view-all{font-size:var(--spot-covered-items-view-all-font-size);font-weight:var(--spot-covered-items-view-all-font-weight);color:var(--spot-covered-items-view-all-color);font-family:var(--spot-covered-items-font-family);line-height:125%}.spot-covered-items__arrow{font-size:var(--spot-covered-items-arrow-font-size);transition:transform .2s ease;color:var(--spot-covered-items-arrow-color);flex-shrink:0;transform:scaleX(1.5)}.spot-covered-items__content{margin-top:.5rem;transition:all .2s ease;overflow:hidden}.spot-covered-items__list{background-color:var(--spot-covered-items-content-background);border:var(--spot-covered-items-content-border);border-radius:var(--spot-covered-items-content-border-radius);margin:0;padding:var(--spot-covered-items-content-padding)}.spot-table__container{width:100%}.spot-refund__table{max-width:22rem;border-radius:var(--spot-table-border-radius);overflow:hidden;border:.09375rem solid #636569;table-layout:fixed;margin-bottom:.5rem;margin-top:.25rem;padding:.625rem}.spot-refund__table--dynamic{height:auto!important;min-height:7.5rem}.spot-refund__table td,.spot-refund__table th{padding:.375rem .625rem;text-align:left}.spot-refund__table th{text-align:left;font-size:var(--spot-table-header-font-size);font-weight:var(--spot-table-header-font-weight);color:var(--spot-table-header-font-color);font-family:var(--spot-table-header-font-family);padding:var(--spot-table-header-padding)}.spot-refund__table td{text-align:left;font-size:var(--spot-table-cell-font-size);font-weight:var(--spot-table-cell-font-weight);color:var(--spot-table-cell-font-color);font-family:var(--spot-table-cell-font-family);padding:var(--spot-table-cell-padding)}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 Q(m){const t=document.createElement("style");t.textContent=m,document.head.appendChild(t)}Q(S);const I={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,s,n,r;try{E(this.options);let i;if(this.options.useMockData&&this.options.mockData)i=this.options.mockData;else{const{environment:e,partnerId:c}=this.options.apiConfig,f=this.options.apiConfig.customEndpoint||I[e];i="cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?await x(f,c,this.options.quoteRequestData):await _(f,c,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 e={status:"QUOTE_ACCEPTED",spotPrice:this.quote.spotPrice,quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const c=this.options.quoteRequestData;e.batchQuoteDetails=this.quote.originalQuotes.map(u=>{var h;const f=(h=c.items)==null?void 0:h.find(y=>(y.cartItemId||`item-${c.items.indexOf(y)+1}`)===u.cartItemId);return{quoteId:u.id,productPrice:(f==null?void 0:f.productPrice)||u.spotPrice,cartItemId:(f==null?void 0:f.cartItemId)||""}})}this.options.callbacks.onOptIn(e)}if((s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const e=this.options.callbacks.onQuoteRetrieved(this.quote);e&&this._applyQuoteUpdates(e)}}catch(i){if((n=this.options.callbacks)!=null&&n.onError){const e=i;(r=this.options.callbacks)==null||r.onError({message:e.message,status:e.status,responseBody:e.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(([s,n])=>{const r=`--${s}`;this.container.style.setProperty(r,n)}),M(this.container,this.quote.communication);const t=document.createElement("div");if(t.className="spot-content__wrapper",this.container.appendChild(t),this.quote.qualifyingReasons?L(t,this.quote.qualifyingReasons):N(t,this.quote.communication.bulletPoints),this.quote.coveredItems){const s=this._getTotalItemsInRequest();O(t,this.quote.coveredItems,s)}this.options.showTable&&!this.quote.qualifyingReasons&&P(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}),V(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 s=this._shouldUseDesktopLayout(t);t.classList.toggle("desktop-layout",s)}_shouldUseDesktopLayout(t){const o=this.container.offsetWidth-40,s=325,n=16;if(o>=900)return!0;if(o>=650){const r=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 r&&t.classList.add("desktop-layout"),r;const c=Math.min(i.scrollWidth,400)+s+n;return r&&t.classList.add("desktop-layout"),o>=c}return!1}_setupResizeObserver(){!this.container||!window.ResizeObserver||(this._resizeObserver=new ResizeObserver(()=>{this._resizeTimeout&&clearTimeout(this._resizeTimeout),this._resizeTimeout=window.setTimeout(()=>{this._updateLayout()},100)}),this._resizeObserver.observe(this.container))}_getTotalItemsInRequest(){return"cartInfo"in this.options.quoteRequestData&&"items"in this.options.quoteRequestData?this.options.quoteRequestData.items.length:1}_applyQuoteUpdates(t){!this.quote||!this.container||(t.spotPriceWithFees!==void 0&&(this.quote.communication.yesOptionText=this.quote.communication.yesOptionText.replace(`$${this.quote.spotPrice.toFixed(2)}`,`$${t.spotPriceWithFees.toFixed(2)}`)),this.destroy(),this._renderWidget())}_setupOptionListeners(t){const o=t.querySelectorAll('input[type="radio"]'),s=t.querySelectorAll(".spot-selection__option");o.forEach(n=>{n.addEventListener("change",r=>{var c,u,f;const i=r.target,e=i.value;if(this.hideSelectionError(),this.currentSelection=e,s.forEach(h=>h.classList.remove("selected")),(c=i.closest(".spot-selection__option"))==null||c.classList.add("selected"),this.paymentTermsEl&&(this.paymentTermsEl.innerHTML=""),e==="yes"&&(this.options.quoteRequestData.isPartialPayment&&R(this.paymentTermsEl,this.quote),(u=this.options.callbacks)!=null&&u.onOptIn)){const h={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;h.batchQuoteDetails=this.quote.originalQuotes.map(d=>{var l;const a=(l=y.items)==null?void 0:l.find(w=>(w.cartItemId||`item-${y.items.indexOf(w)+1}`)===d.cartItemId);return{quoteId:d.id,productPrice:(a==null?void 0:a.productPrice)||d.spotPrice,cartItemId:(a==null?void 0:a.cartItemId)||""}})}this.options.callbacks.onOptIn(h)}if(e==="no"&&((f=this.options.callbacks)!=null&&f.onOptOut)){const h={status:"QUOTE_DECLINED",quoteId:this.quote.id};if(this.quote.originalQuotes&&this.quote.originalQuotes.length>0){const y=this.options.quoteRequestData;h.batchQuoteDetails=this.quote.originalQuotes.map(d=>{var l;const a=(l=y.items)==null?void 0:l.find(w=>(w.cartItemId||`item-${y.items.indexOf(w)+1}`)===d.cartItemId);return{quoteId:d.id,productPrice:(a==null?void 0:a.productPrice)||d.spotPrice,cartItemId:(a==null?void 0:a.cartItemId)||""}})}this.options.callbacks.onOptOut(h)}})})}showSelectionError(){var t;if(!this.errorEl){this.errorEl=document.createElement("div"),this.errorEl.className="spot-selection__error",this.errorEl.textContent="Please make a selection";const 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,s,n,r;try{const i={...this.options,quoteRequestData:t};E(i);const{environment:e,partnerId:c,customEndpoint:u}=this.options.apiConfig,f=u||I[e],y="cartInfo"in i.quoteRequestData&&"items"in i.quoteRequestData?await x(f,c,i.quoteRequestData):await _(f,c,i.quoteRequestData);if(y.status!=="QUOTE_AVAILABLE")return this.destroy(),y.status==="NO_MATCHING_QUOTE"&&((o=this.options.callbacks)!=null&&o.noMatchingQuote)&&this.options.callbacks.noMatchingQuote({status:"NO_MATCHING_QUOTE",data:i.quoteRequestData}),!1;if(this.options.quoteRequestData=i.quoteRequestData,this.quote=y.data,this.currentSelection=null,this.destroy(),this._renderWidget(),(s=this.options.callbacks)!=null&&s.onQuoteRetrieved){const d=this.options.callbacks.onQuoteRetrieved(this.quote);d&&this._applyQuoteUpdates(d)}return!0}catch(i){const e=i;return(r=(n=this.options.callbacks)==null?void 0:n.onError)==null||r.call(n,{message:e.message,status:e.status,responseBody:e.responseBody}),!1}}getSelection(){var o,s,n;if(this.currentSelection==null)return null;const t={selection:this.currentSelection,quoteId:(o=this.quote)==null?void 0:o.id,spotPrice:(s=this.quote)==null?void 0:s.spotPrice,status:this.currentSelection==="yes"?"QUOTE_ACCEPTED":"QUOTE_DECLINED"};if((n=this.quote)!=null&&n.originalQuotes&&this.quote.originalQuotes.length>0){const r=this.options.quoteRequestData;t.batchQuoteDetails=this.quote.originalQuotes.map(i=>{var c;const e=(c=r.items)==null?void 0:c.find(u=>(u.cartItemId||`item-${r.items.indexOf(u)+1}`)===i.cartItemId);return{quoteId:i.id,productPrice:(e==null?void 0:e.productPrice)||i.spotPrice,cartItemId:(e==null?void 0:e.cartItemId)||""}})}return t}destroy(){window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=void 0),this._resizeTimeout&&window.clearTimeout(this._resizeTimeout),this.container&&this.container.parentNode&&this.container.parentNode.removeChild(this.container)}}return A});
|
package/dist/types.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export interface CartInfo {
|
|
|
15
15
|
currencyCode: "USD" | "CAD" | "AUD";
|
|
16
16
|
metadata?: QuoteMetadata;
|
|
17
17
|
isPartialPayment?: boolean;
|
|
18
|
+
roundTo?: number;
|
|
18
19
|
}
|
|
19
20
|
export interface QuoteItem {
|
|
20
21
|
productPrice: number;
|
|
@@ -38,8 +39,9 @@ export interface QuoteItem {
|
|
|
38
39
|
hostCountryState?: string;
|
|
39
40
|
destinations?: string[];
|
|
40
41
|
dob?: string;
|
|
42
|
+
roundTo?: number;
|
|
41
43
|
}
|
|
42
|
-
type BatchItem = Omit<QuoteItem, "cartName" | "cartItemId" | "cartId" | "currencyCode" | "isPartialPayment" | "metadata">;
|
|
44
|
+
type BatchItem = Omit<QuoteItem, "cartName" | "cartItemId" | "cartId" | "currencyCode" | "isPartialPayment" | "metadata" | "roundTo">;
|
|
43
45
|
export interface BatchQuoteItem extends BatchItem {
|
|
44
46
|
cartItemId: string;
|
|
45
47
|
}
|
|
@@ -47,6 +49,15 @@ export interface BatchQuoteRequest {
|
|
|
47
49
|
cartInfo: CartInfo;
|
|
48
50
|
items: BatchQuoteItem[];
|
|
49
51
|
}
|
|
52
|
+
export interface ApiBatchQuoteRequest {
|
|
53
|
+
cartId: string;
|
|
54
|
+
cartName: string;
|
|
55
|
+
currencyCode: "USD" | "CAD" | "AUD";
|
|
56
|
+
metadata?: QuoteMetadata;
|
|
57
|
+
isPartialPayment?: boolean;
|
|
58
|
+
roundTo?: number;
|
|
59
|
+
items: BatchQuoteItem[];
|
|
60
|
+
}
|
|
50
61
|
export type QuoteRequestData = QuoteItem | BatchQuoteRequest;
|
|
51
62
|
export interface QualifyingReason {
|
|
52
63
|
rank: 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,CAAC;IACzB,gBAAgB,CAAC,EAAE,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|