@getspot/spot-widget 4.6.0 → 4.8.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 +10 -0
- package/dist/api.d.ts +12 -10
- package/dist/api.d.ts.map +1 -1
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +488 -405
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +1 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [4.8.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.7.0...@getspot/spot-widget@4.8.0) (2026-10-29)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* **core:** add isUSResident residency signal and re-fetch on dropdown change (ST-5408) ([4ba1587](https://gitlab.com/getspot/spot-widget/commit/4ba1587ebba7ebb12a900ab1a8b1bc8758ef4346))
|
|
7
|
+
|
|
8
|
+
# [4.7.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.6.0...@getspot/spot-widget@4.7.0) (2026-09-18)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Features
|
|
12
|
+
|
|
13
|
+
* **core:** expose theme variables for widget spacing (ST-5451) ([db0179b](https://gitlab.com/getspot/spot-widget/commit/db0179b824c8add61d4ae754090401eefe6a2871))
|
|
14
|
+
|
|
1
15
|
# [4.6.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.5.0...@getspot/spot-widget@4.6.0) (2026-08-11)
|
|
2
16
|
|
|
3
17
|
|
package/README.md
CHANGED
|
@@ -579,6 +579,16 @@ export interface SpotWidgetOptions {
|
|
|
579
579
|
isPartialPayment?: boolean;
|
|
580
580
|
useMockData?: boolean;
|
|
581
581
|
mockData?: ApiResponse;
|
|
582
|
+
// Response the widget should return from the residency re-fetch when useMockData is true.
|
|
583
|
+
// Pass a function to vary the response by residency (e.g. return NO_MATCHING_QUOTE only when
|
|
584
|
+
// isUSResident === false). Used by Storybook to exercise ST-5408 flows without a backend.
|
|
585
|
+
// When omitted, re-fetch reuses `mockData`.
|
|
586
|
+
// Accepts a Promise or an async function so Storybook can simulate a slow backend and show
|
|
587
|
+
// the radios locking the instant the re-fetch starts (independent of when it resolves).
|
|
588
|
+
mockRefetchData?:
|
|
589
|
+
| ApiResponse
|
|
590
|
+
| Promise<ApiResponse>
|
|
591
|
+
| ((isUSResident: boolean | undefined) => ApiResponse | Promise<ApiResponse>);
|
|
582
592
|
state?: string;
|
|
583
593
|
}
|
|
584
594
|
```
|
package/dist/api.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { ApiResponse, QuoteRequestData, BatchQuoteRequest } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieve quote from Spot API
|
|
4
|
-
* @param endpoint
|
|
5
|
-
* @param partnerId
|
|
6
|
-
* @param payload
|
|
7
|
-
* @param state
|
|
4
|
+
* @param endpoint – Spot API URL
|
|
5
|
+
* @param partnerId – partner UUID
|
|
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
|
|
8
|
+
* @param isUSResident – residency signal from the "Are you a US Resident?" selector; forwarded to the API when defined so offer matching can gate international-only / US-only offers
|
|
8
9
|
* @returns Promise resolving to API response
|
|
9
10
|
*/
|
|
10
|
-
export declare function fetchQuote(endpoint: string, partnerId: string, payload: QuoteRequestData, state?: string): Promise<ApiResponse>;
|
|
11
|
+
export declare function fetchQuote(endpoint: string, partnerId: string, payload: QuoteRequestData, state?: string, isUSResident?: boolean): Promise<ApiResponse>;
|
|
11
12
|
/**
|
|
12
13
|
* Retrieve batch quote from Spot API
|
|
13
14
|
* @param endpoint – Spot API URL
|
|
@@ -18,11 +19,12 @@ export declare function fetchQuote(endpoint: string, partnerId: string, payload:
|
|
|
18
19
|
export declare function fetchBatchQuote(endpoint: string, partnerId: string, batchPayload: BatchQuoteRequest): Promise<ApiResponse>;
|
|
19
20
|
/**
|
|
20
21
|
* Retrieve multiple quotes in parallel from Spot API
|
|
21
|
-
* @param endpoint
|
|
22
|
-
* @param partnerId
|
|
23
|
-
* @param batchData
|
|
24
|
-
* @param state
|
|
22
|
+
* @param endpoint – Spot API URL
|
|
23
|
+
* @param partnerId – partner UUID
|
|
24
|
+
* @param batchData – batch quote data with cart metadata and items
|
|
25
|
+
* @param state – customer's US state code (e.g. "TX"); included in request body when provided for state-aware quoting
|
|
26
|
+
* @param isUSResident – residency signal from the "Are you a US Resident?" selector; forwarded to the API when defined so offer matching can gate international-only / US-only offers
|
|
25
27
|
* @returns Promise resolving to formatted API response
|
|
26
28
|
*/
|
|
27
|
-
export declare function fetchMultipleQuotes(endpoint: string, partnerId: string, batchData: BatchQuoteRequest, state?: string): Promise<ApiResponse>;
|
|
29
|
+
export declare function fetchMultipleQuotes(endpoint: string, partnerId: string, batchData: BatchQuoteRequest, state?: string, isUSResident?: boolean): Promise<ApiResponse>;
|
|
28
30
|
//# 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;;;;;;;;GAQG;AACH,wBAAsB,UAAU,CAC9B,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,gBAAgB,EACzB,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,WAAW,CAAC,CAiCtB;AAED;;;;;;GAMG;AACH,wBAAsB,eAAe,CACnC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,YAAY,EAAE,iBAAiB,GAC9B,OAAO,CAAC,WAAW,CAAC,CAyBtB;AAED;;;;;;;;GAQG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,iBAAiB,EAC5B,KAAK,CAAC,EAAE,MAAM,EACd,YAAY,CAAC,EAAE,OAAO,GACrB,OAAO,CAAC,WAAW,CAAC,CAwEtB"}
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,9 @@ declare class SpotWidget {
|
|
|
12
12
|
private _onResize;
|
|
13
13
|
private _resizeObserver?;
|
|
14
14
|
private _destroyed;
|
|
15
|
+
private _internationalBlocked;
|
|
16
|
+
private _residencyRequestId;
|
|
17
|
+
private _residencyFetchPending;
|
|
15
18
|
constructor(options?: Partial<SpotWidgetOptions>);
|
|
16
19
|
private _init;
|
|
17
20
|
private _renderWidget;
|
|
@@ -22,10 +25,13 @@ declare class SpotWidget {
|
|
|
22
25
|
private _applyQuoteUpdates;
|
|
23
26
|
private _isPassOrTrip;
|
|
24
27
|
private _validState;
|
|
28
|
+
private _computeIsUSResident;
|
|
25
29
|
private _isQuotingAvailable;
|
|
30
|
+
private _shouldShowNonUsError;
|
|
26
31
|
private _setRadiosDisabled;
|
|
27
32
|
private _setNonUsResidentError;
|
|
28
33
|
private _setupStateDropdownListener;
|
|
34
|
+
private _refetchForResidencyChange;
|
|
29
35
|
private _setupOptionListeners;
|
|
30
36
|
showSelectionError(): void;
|
|
31
37
|
hideSelectionError(): void;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","s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