@getspot/spot-widget 4.1.1 → 4.3.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 +14 -0
- package/README.md +59 -4
- package/dist/api.d.ts +4 -2
- package/dist/api.d.ts.map +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +539 -364
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +10 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +4 -1
- package/dist/ui.d.ts.map +1 -1
- package/dist/validateOptions.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [4.3.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.2.0...@getspot/spot-widget@4.3.0) (2026-06-22)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **core:** publish 13 currencies for Competition Corner [ST-5242] ([c700cc6](https://gitlab.com/getspot/spot-widget/commit/c700cc6557c66a4b9d24e799fdbe3b9f24f342eb))
|
|
7
|
+
|
|
8
|
+
# [4.2.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.1.1...@getspot/spot-widget@4.2.0) (2026-05-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **core:** allow user to select state in widget and make selection available ([d5758ba](https://gitlab.com/getspot/spot-widget/commit/d5758baa147cb31e018e15ef1280a7599c3b515b))
|
|
14
|
+
|
|
1
15
|
## [4.1.1](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.1.0...@getspot/spot-widget@4.1.1) (2026-03-06)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -78,6 +78,7 @@ const widget = new SpotWidget(options);
|
|
|
78
78
|
| `selection` | `SelectionEnum` | No | `SelectionEnum.UNSELECTED` | Initial selection state for the widget |
|
|
79
79
|
| `theme` | `Theme` | No | - | Custom styling |
|
|
80
80
|
| `callbacks` | `Callbacks` | No | `{}` | Event callbacks |
|
|
81
|
+
| `state` | `string` | No | - | Customer's 2-letter US state code (e.g. `"TX"`). Only applies to Pass/Trip offers — ignored for Registration. When provided, hides the state selector and passes the value through to downstream calls. When omitted, the selector is shown automatically. |
|
|
81
82
|
|
|
82
83
|
### ApiConfig
|
|
83
84
|
|
|
@@ -97,7 +98,7 @@ const widget = new SpotWidget(options);
|
|
|
97
98
|
{
|
|
98
99
|
startDate: string; // ISO 8601 date
|
|
99
100
|
endDate: string; // ISO 8601 date
|
|
100
|
-
currencyCode: 'USD' | 'CAD' | 'AUD' | 'NZD' | 'EUR' | 'MXN' | 'AED' | 'GBP' | 'MAD' | 'SAR';
|
|
101
|
+
currencyCode: 'USD' | 'CAD' | 'AUD' | 'NZD' | 'EUR' | 'MXN' | 'AED' | 'GBP' | 'MAD' | 'SAR' | 'BGN' | 'BRL' | 'CHF' | 'DKK' | 'INR' | 'JPY' | 'MYR' | 'NOK' | 'PLN' | 'SEK' | 'SGD' | 'THB' | 'ZAR';
|
|
101
102
|
eventType: string; // Event description
|
|
102
103
|
productType: 'Pass' | 'Trip' | 'Registration';
|
|
103
104
|
productDuration: 'Daily' | 'Seasonal' | 'Trip' | 'Event';
|
|
@@ -115,7 +116,7 @@ const widget = new SpotWidget(options);
|
|
|
115
116
|
{
|
|
116
117
|
cartId: string;
|
|
117
118
|
cartName: string;
|
|
118
|
-
currencyCode: 'USD' | 'CAD' | 'AUD' | 'NZD' | 'EUR' | 'MXN' | 'AED' | 'GBP' | 'MAD' | 'SAR';
|
|
119
|
+
currencyCode: 'USD' | 'CAD' | 'AUD' | 'NZD' | 'EUR' | 'MXN' | 'AED' | 'GBP' | 'MAD' | 'SAR' | 'BGN' | 'BRL' | 'CHF' | 'DKK' | 'INR' | 'JPY' | 'MYR' | 'NOK' | 'PLN' | 'SEK' | 'SGD' | 'THB' | 'ZAR';
|
|
119
120
|
items: Array<{
|
|
120
121
|
// All single product fields except cartId and currencyCode
|
|
121
122
|
cartItemId?: string; // Optional item identifier
|
|
@@ -369,7 +370,30 @@ export interface QuoteItem {
|
|
|
369
370
|
participantDescription?: string;
|
|
370
371
|
eventType: string;
|
|
371
372
|
eventId?: string;
|
|
372
|
-
currencyCode:
|
|
373
|
+
currencyCode:
|
|
374
|
+
| "USD"
|
|
375
|
+
| "CAD"
|
|
376
|
+
| "AUD"
|
|
377
|
+
| "NZD"
|
|
378
|
+
| "EUR"
|
|
379
|
+
| "MXN"
|
|
380
|
+
| "AED"
|
|
381
|
+
| "GBP"
|
|
382
|
+
| "MAD"
|
|
383
|
+
| "SAR"
|
|
384
|
+
| "BGN"
|
|
385
|
+
| "BRL"
|
|
386
|
+
| "CHF"
|
|
387
|
+
| "DKK"
|
|
388
|
+
| "INR"
|
|
389
|
+
| "JPY"
|
|
390
|
+
| "MYR"
|
|
391
|
+
| "NOK"
|
|
392
|
+
| "PLN"
|
|
393
|
+
| "SEK"
|
|
394
|
+
| "SGD"
|
|
395
|
+
| "THB"
|
|
396
|
+
| "ZAR";
|
|
373
397
|
startDate: string;
|
|
374
398
|
endDate: string;
|
|
375
399
|
partnerRiskEnd?: Date;
|
|
@@ -389,7 +413,30 @@ export interface QuoteItem {
|
|
|
389
413
|
export interface BatchQuoteRequest {
|
|
390
414
|
cartId: string;
|
|
391
415
|
cartName: string;
|
|
392
|
-
currencyCode:
|
|
416
|
+
currencyCode:
|
|
417
|
+
| "USD"
|
|
418
|
+
| "CAD"
|
|
419
|
+
| "AUD"
|
|
420
|
+
| "NZD"
|
|
421
|
+
| "EUR"
|
|
422
|
+
| "MXN"
|
|
423
|
+
| "AED"
|
|
424
|
+
| "GBP"
|
|
425
|
+
| "MAD"
|
|
426
|
+
| "SAR"
|
|
427
|
+
| "BGN"
|
|
428
|
+
| "BRL"
|
|
429
|
+
| "CHF"
|
|
430
|
+
| "DKK"
|
|
431
|
+
| "INR"
|
|
432
|
+
| "JPY"
|
|
433
|
+
| "MYR"
|
|
434
|
+
| "NOK"
|
|
435
|
+
| "PLN"
|
|
436
|
+
| "SEK"
|
|
437
|
+
| "SGD"
|
|
438
|
+
| "THB"
|
|
439
|
+
| "ZAR";
|
|
393
440
|
metadata?: QuoteMetadata;
|
|
394
441
|
isPartialPayment?: boolean;
|
|
395
442
|
roundTo?: number;
|
|
@@ -482,6 +529,13 @@ export interface SelectionData {
|
|
|
482
529
|
spotPrice?: number;
|
|
483
530
|
quoteId?: string;
|
|
484
531
|
selection?: string;
|
|
532
|
+
/**
|
|
533
|
+
* Customer's US state code (e.g. "TX"). Set when:
|
|
534
|
+
* - The partner passes a `state` prop (captured at their checkout), or
|
|
535
|
+
* - The user selects a US state from the selector shown on Pass/Trip offers.
|
|
536
|
+
* Undefined when neither applies.
|
|
537
|
+
*/
|
|
538
|
+
state?: string;
|
|
485
539
|
batchQuoteDetails?: Array<{
|
|
486
540
|
quoteId: string;
|
|
487
541
|
productPrice: number;
|
|
@@ -525,6 +579,7 @@ export interface SpotWidgetOptions {
|
|
|
525
579
|
isPartialPayment?: boolean;
|
|
526
580
|
useMockData?: boolean;
|
|
527
581
|
mockData?: ApiResponse;
|
|
582
|
+
state?: string;
|
|
528
583
|
}
|
|
529
584
|
```
|
|
530
585
|
|
package/dist/api.d.ts
CHANGED
|
@@ -4,9 +4,10 @@ import type { ApiResponse, QuoteRequestData, BatchQuoteRequest } from './types.j
|
|
|
4
4
|
* @param endpoint – Spot API URL
|
|
5
5
|
* @param partnerId – partner UUID
|
|
6
6
|
* @param payload – quoteRequestData
|
|
7
|
+
* @param state – customer's US state code (e.g. "TX"); included in request body when provided for state-aware quoting
|
|
7
8
|
* @returns Promise resolving to API response
|
|
8
9
|
*/
|
|
9
|
-
export declare function fetchQuote(endpoint: string, partnerId: string, payload: QuoteRequestData): Promise<ApiResponse>;
|
|
10
|
+
export declare function fetchQuote(endpoint: string, partnerId: string, payload: QuoteRequestData, state?: string): Promise<ApiResponse>;
|
|
10
11
|
/**
|
|
11
12
|
* Retrieve batch quote from Spot API
|
|
12
13
|
* @param endpoint – Spot API URL
|
|
@@ -20,7 +21,8 @@ export declare function fetchBatchQuote(endpoint: string, partnerId: string, bat
|
|
|
20
21
|
* @param endpoint – Spot API URL
|
|
21
22
|
* @param partnerId – partner UUID
|
|
22
23
|
* @param batchData – batch quote data with cart metadata and items
|
|
24
|
+
* @param state – customer's US state code (e.g. "TX"); included in request body when provided for state-aware quoting
|
|
23
25
|
* @returns Promise resolving to formatted API response
|
|
24
26
|
*/
|
|
25
|
-
export declare function fetchMultipleQuotes(endpoint: string, partnerId: string, batchData: BatchQuoteRequest): Promise<ApiResponse>;
|
|
27
|
+
export declare function fetchMultipleQuotes(endpoint: string, partnerId: string, batchData: BatchQuoteRequest, state?: string): Promise<ApiResponse>;
|
|
26
28
|
//# sourceMappingURL=api.d.ts.map
|
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,EAAkB,MAAM,YAAY,CAAC;AAE7G
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../src/api.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAY,gBAAgB,EAAE,iBAAiB,EAAkB,MAAM,YAAY,CAAC;AAE7G;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gBAAgB,EACzB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAyBtB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,iBAAiB,GAC9B,OAAO,CAAC,WAAW,CAAC,CAyBtB;AAED;;;;;;;GAOG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,iBAAiB,EAC5B,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,WAAW,CAAC,CAuEtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,eAAO,MAAM,SAAS,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAyDvD,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ declare class SpotWidget {
|
|
|
3
3
|
private options;
|
|
4
4
|
private root;
|
|
5
5
|
private currentSelection;
|
|
6
|
+
private currentState?;
|
|
6
7
|
private container?;
|
|
7
8
|
private paymentTermsEl?;
|
|
8
9
|
private errorEl?;
|
|
9
10
|
private quote?;
|
|
11
|
+
private _stateSelectEl?;
|
|
10
12
|
private _onResize;
|
|
11
13
|
private _resizeObserver?;
|
|
12
14
|
constructor(options?: Partial<SpotWidgetOptions>);
|
|
@@ -18,6 +20,11 @@ declare class SpotWidget {
|
|
|
18
20
|
private _getTotalItemsInRequest;
|
|
19
21
|
private _resizeTimeout?;
|
|
20
22
|
private _applyQuoteUpdates;
|
|
23
|
+
private _isPassOrTrip;
|
|
24
|
+
private _validState;
|
|
25
|
+
private _isQuotingAvailable;
|
|
26
|
+
private _setRadiosDisabled;
|
|
27
|
+
private _setupStateDropdownListener;
|
|
21
28
|
private _setupOptionListeners;
|
|
22
29
|
showSelectionError(): void;
|
|
23
30
|
hideSelectionError(): void;
|
|
@@ -28,5 +35,6 @@ declare class SpotWidget {
|
|
|
28
35
|
}
|
|
29
36
|
export default SpotWidget;
|
|
30
37
|
export { SelectionEnum } from "./types.js";
|
|
38
|
+
export { NON_US_RESIDENT_VALUE } from "./constants.js";
|
|
31
39
|
export type { SpotWidgetOptions, SelectionData, Quote, QuoteUpdates, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme, } from "./types.js";
|
|
32
40
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EAKnB,MAAM,YAAY,CAAC;AAkBpB,cAAM,UAAU;IACd,OAAO,CAAC,OAAO,CAAoB;IACnC,OAAO,CAAC,IAAI,CAAc;IAC1B,OAAO,CAAC,gBAAgB,CAAgB;IACxC,OAAO,CAAC,YAAY,CAAC,CAAS;IAC9B,OAAO,CAAC,SAAS,CAAC,CAAc;IAChC,OAAO,CAAC,cAAc,CAAC,CAAc;IACrC,OAAO,CAAC,OAAO,CAAC,CAAc;IAC9B,OAAO,CAAC,KAAK,CAAC,CAAQ;IACtB,OAAO,CAAC,cAAc,CAAC,CAAoB;IAC3C,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,eAAe,CAAC,CAAiB;gBAE7B,OAAO,GAAE,OAAO,CAAC,iBAAiB,CAAM;YAuBtC,KAAK;IAoGnB,OAAO,CAAC,aAAa;IAwErB,OAAO,CAAC,aAAa;IAkBrB,OAAO,CAAC,uBAAuB;IAqC/B,OAAO,CAAC,oBAAoB;IAkB5B,OAAO,CAAC,uBAAuB;IAW/B,OAAO,CAAC,cAAc,CAAC,CAAS;IAEhC,OAAO,CAAC,kBAAkB;IAiB1B,OAAO,CAAC,aAAa;IAcrB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,mBAAmB;IAM3B,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,2BAA2B;IAUnC,OAAO,CAAC,qBAAqB;IA6F7B,kBAAkB,IAAI,IAAI;IAgB1B,kBAAkB,IAAI,IAAI;IAM1B,iBAAiB,IAAI,OAAO;IAgBtB,WAAW,CACf,mBAAmB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,GACzD,OAAO,CAAC,OAAO,CAAC;IAuEnB,YAAY,IAAI,aAAa,GAAG,IAAI;IAgCpC,OAAO,IAAI,IAAI;CAahB;AAED,eAAe,UAAU,CAAC;AAC1B,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAC3C,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AACvD,YAAY,EACV,iBAAiB,EACjB,aAAa,EACb,KAAK,EACL,YAAY,EACZ,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,aAAa,EACb,WAAW,EACX,QAAQ,EACR,cAAc,EACd,aAAa,EACb,SAAS,EACT,KAAK,GACN,MAAM,YAAY,CAAC"}
|