@getspot/spot-widget 2.0.1 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/README.md +13 -8
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +344 -291
- package/dist/index.umd.js +18 -3
- package/dist/types.d.ts +9 -8
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +3 -3
- package/dist/ui.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -339,7 +339,7 @@ This package exports the following types and interfaces:
|
|
|
339
339
|
|
|
340
340
|
```typescript
|
|
341
341
|
export interface ApiConfig {
|
|
342
|
-
environment:
|
|
342
|
+
environment: "sandbox" | "production" | "local";
|
|
343
343
|
partnerId: string;
|
|
344
344
|
customEndpoint?: string;
|
|
345
345
|
}
|
|
@@ -362,7 +362,7 @@ export interface QuoteMetadata {
|
|
|
362
362
|
export interface CartInfo {
|
|
363
363
|
cartId: string;
|
|
364
364
|
cartName: string;
|
|
365
|
-
currencyCode:
|
|
365
|
+
currencyCode: "USD" | "CAD" | "AUD";
|
|
366
366
|
metadata?: QuoteMetadata;
|
|
367
367
|
isPartialPayment?: boolean;
|
|
368
368
|
}
|
|
@@ -373,15 +373,15 @@ export interface CartInfo {
|
|
|
373
373
|
```typescript
|
|
374
374
|
export interface QuoteItem {
|
|
375
375
|
productPrice: number;
|
|
376
|
-
productType:
|
|
377
|
-
productDuration:
|
|
376
|
+
productType: "Pass" | "Trip" | "Registration";
|
|
377
|
+
productDuration: "Daily" | "Seasonal" | "Trip" | "Event";
|
|
378
378
|
productId: string;
|
|
379
379
|
cartId: string;
|
|
380
380
|
cartName: string;
|
|
381
381
|
productName: string;
|
|
382
382
|
participantDescription?: string;
|
|
383
383
|
eventType: string;
|
|
384
|
-
currencyCode:
|
|
384
|
+
currencyCode: "USD" | "CAD" | "AUD";
|
|
385
385
|
startDate: string;
|
|
386
386
|
endDate: string;
|
|
387
387
|
partnerRiskEnd?: Date;
|
|
@@ -460,7 +460,7 @@ export interface Quote {
|
|
|
460
460
|
|
|
461
461
|
```typescript
|
|
462
462
|
export interface ApiResponse {
|
|
463
|
-
status:
|
|
463
|
+
status: "QUOTE_AVAILABLE" | "QUOTES_AVAILABLE" | "NO_MATCHING_QUOTE";
|
|
464
464
|
data?: Quote;
|
|
465
465
|
quotes?: Quote[];
|
|
466
466
|
totalSpotPrice?: number;
|
|
@@ -476,7 +476,7 @@ export interface ApiResponse {
|
|
|
476
476
|
|
|
477
477
|
```typescript
|
|
478
478
|
export interface SelectionData {
|
|
479
|
-
status:
|
|
479
|
+
status: "QUOTE_ACCEPTED" | "QUOTE_DECLINED";
|
|
480
480
|
spotPrice?: number;
|
|
481
481
|
quoteId?: string;
|
|
482
482
|
selection?: string;
|
|
@@ -495,7 +495,11 @@ export interface Callbacks {
|
|
|
495
495
|
onOptIn?: (data: SelectionData) => void;
|
|
496
496
|
onOptOut?: (data: SelectionData) => void;
|
|
497
497
|
onQuoteRetrieved?: (quote: Quote) => void;
|
|
498
|
-
onError?: (error: {
|
|
498
|
+
onError?: (error: {
|
|
499
|
+
message: string;
|
|
500
|
+
status?: number;
|
|
501
|
+
responseBody?: any;
|
|
502
|
+
}) => void;
|
|
499
503
|
noMatchingQuote?: (data: { status: string; data: QuoteRequestData }) => void;
|
|
500
504
|
}
|
|
501
505
|
```
|
|
@@ -515,6 +519,7 @@ export interface SpotWidgetOptions {
|
|
|
515
519
|
location?: string | HTMLElement;
|
|
516
520
|
showTable?: boolean;
|
|
517
521
|
optInSelected?: boolean;
|
|
522
|
+
logoPosition?: "bottom-right" | "top-right";
|
|
518
523
|
apiConfig: ApiConfig;
|
|
519
524
|
quoteRequestData: QuoteRequestData;
|
|
520
525
|
callbacks?: Callbacks;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,18 +8,22 @@ declare class SpotWidget {
|
|
|
8
8
|
private errorEl?;
|
|
9
9
|
private quote?;
|
|
10
10
|
private _onResize;
|
|
11
|
+
private _resizeObserver?;
|
|
11
12
|
constructor(options?: Partial<SpotWidgetOptions>);
|
|
12
13
|
private _init;
|
|
13
14
|
private _renderWidget;
|
|
14
15
|
private _updateLayout;
|
|
16
|
+
private _shouldUseDesktopLayout;
|
|
17
|
+
private _setupResizeObserver;
|
|
18
|
+
private _resizeTimeout?;
|
|
15
19
|
private _setupOptionListeners;
|
|
16
20
|
showSelectionError(): void;
|
|
17
21
|
hideSelectionError(): void;
|
|
18
22
|
validateSelection(): boolean;
|
|
19
|
-
updateQuote(newQuoteRequestData: SpotWidgetOptions[
|
|
23
|
+
updateQuote(newQuoteRequestData: SpotWidgetOptions["quoteRequestData"]): Promise<boolean>;
|
|
20
24
|
getSelection(): SelectionData | null;
|
|
21
25
|
destroy(): void;
|
|
22
26
|
}
|
|
23
27
|
export default SpotWidget;
|
|
24
|
-
export type { SpotWidgetOptions, SelectionData, Quote, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, CartInfo, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme } from
|
|
28
|
+
export type { SpotWidgetOptions, SelectionData, Quote, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, CartInfo, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme, } from "./types.js";
|
|
25
29
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EACV,iBAAiB,EAEjB,aA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