@getspot/spot-widget 4.1.0 → 4.2.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 +9 -0
- 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 +497 -356
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +5 -2
- 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.2.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.1.1...@getspot/spot-widget@4.2.0) (2026-05-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **core:** allow user to select state in widget and make selection available ([d5758ba](https://gitlab.com/getspot/spot-widget/commit/d5758baa147cb31e018e15ef1280a7599c3b515b))
|
|
7
|
+
|
|
8
|
+
## [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)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **core:** prevent payment terms from displaying if they are empty in api response ([918df9d](https://gitlab.com/getspot/spot-widget/commit/918df9d6685a6c83ac16e17bf9b063b817b1f128))
|
|
14
|
+
|
|
1
15
|
# [4.1.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.0.4...@getspot/spot-widget@4.1.0) (2026-03-04)
|
|
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
|
|
|
@@ -482,6 +483,13 @@ export interface SelectionData {
|
|
|
482
483
|
spotPrice?: number;
|
|
483
484
|
quoteId?: string;
|
|
484
485
|
selection?: string;
|
|
486
|
+
/**
|
|
487
|
+
* Customer's US state code (e.g. "TX"). Set when:
|
|
488
|
+
* - The partner passes a `state` prop (captured at their checkout), or
|
|
489
|
+
* - The user selects a US state from the selector shown on Pass/Trip offers.
|
|
490
|
+
* Undefined when neither applies.
|
|
491
|
+
*/
|
|
492
|
+
state?: string;
|
|
485
493
|
batchQuoteDetails?: Array<{
|
|
486
494
|
quoteId: string;
|
|
487
495
|
productPrice: number;
|
|
@@ -525,6 +533,7 @@ export interface SpotWidgetOptions {
|
|
|
525
533
|
isPartialPayment?: boolean;
|
|
526
534
|
useMockData?: boolean;
|
|
527
535
|
mockData?: ApiResponse;
|
|
536
|
+
state?: string;
|
|
528
537
|
}
|
|
529
538
|
```
|
|
530
539
|
|
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,o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