@getspot/spot-widget 3.3.2 → 4.0.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 +17 -0
- package/README.md +18 -30
- package/dist/api.d.ts +3 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.es.js +243 -243
- package/dist/index.umd.js +4 -4
- package/dist/types.d.ts +7 -14
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.d.ts +2 -2
- package/dist/ui.d.ts.map +1 -1
- package/dist/validateOptions.d.ts.map +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [4.0.1](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@4.0.0...@getspot/spot-widget@4.0.1) (2026-01-12)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* when the selection is no we need to check the NO option ([628f5f4](https://gitlab.com/getspot/spot-widget/commit/628f5f453d95bf4956ed4328b8c1fceeb633edd2))
|
|
7
|
+
|
|
8
|
+
# [4.0.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@3.3.2...@getspot/spot-widget@4.0.0) (2026-01-12)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
* feat!(core): replacing optInSelected prop with selection enum ([0d40913](https://gitlab.com/getspot/spot-widget/commit/0d409135aa50eaa98995b9c1e20ca05cc7e2b2fc))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### BREAKING CHANGES
|
|
15
|
+
|
|
16
|
+
* better preselection of widget optIn/optOut
|
|
17
|
+
|
|
1
18
|
## [3.3.2](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget@3.3.1...@getspot/spot-widget@3.3.2) (2026-01-09)
|
|
2
19
|
|
|
3
20
|
|
package/README.md
CHANGED
|
@@ -75,7 +75,7 @@ const widget = new SpotWidget(options);
|
|
|
75
75
|
| `apiConfig` | `ApiConfig` | Yes | - | API configuration |
|
|
76
76
|
| `quoteRequestData` | `QuoteRequestData` | Yes | - | Quote request information |
|
|
77
77
|
| `showTable` | `boolean` | No | `true` | Whether to show payout table |
|
|
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
81
|
|
|
@@ -113,11 +113,9 @@ const widget = new SpotWidget(options);
|
|
|
113
113
|
|
|
114
114
|
```typescript
|
|
115
115
|
{
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
currencyCode: 'USD' | 'CAD' | 'AUD';
|
|
120
|
-
};
|
|
116
|
+
cartId: string;
|
|
117
|
+
cartName: string;
|
|
118
|
+
currencyCode: 'USD' | 'CAD' | 'AUD';
|
|
121
119
|
items: Array<{
|
|
122
120
|
// All single product fields except cartId and currencyCode
|
|
123
121
|
cartItemId?: string; // Optional item identifier
|
|
@@ -356,19 +354,6 @@ export interface QuoteMetadata {
|
|
|
356
354
|
}
|
|
357
355
|
```
|
|
358
356
|
|
|
359
|
-
#### CartInfo
|
|
360
|
-
|
|
361
|
-
```typescript
|
|
362
|
-
export interface CartInfo {
|
|
363
|
-
cartId: string;
|
|
364
|
-
cartName: string;
|
|
365
|
-
currencyCode: "USD" | "CAD" | "AUD";
|
|
366
|
-
metadata?: QuoteMetadata;
|
|
367
|
-
isPartialPayment?: boolean;
|
|
368
|
-
roundTo?: number;
|
|
369
|
-
}
|
|
370
|
-
```
|
|
371
|
-
|
|
372
357
|
#### QuoteItem
|
|
373
358
|
|
|
374
359
|
```typescript
|
|
@@ -402,15 +387,6 @@ export interface QuoteItem {
|
|
|
402
387
|
|
|
403
388
|
```typescript
|
|
404
389
|
export interface BatchQuoteRequest {
|
|
405
|
-
cartInfo: CartInfo;
|
|
406
|
-
items: BatchQuoteItem[];
|
|
407
|
-
}
|
|
408
|
-
```
|
|
409
|
-
|
|
410
|
-
#### ApiBatchQuoteRequest
|
|
411
|
-
|
|
412
|
-
```typescript
|
|
413
|
-
export interface ApiBatchQuoteRequest {
|
|
414
390
|
cartId: string;
|
|
415
391
|
cartName: string;
|
|
416
392
|
currencyCode: "USD" | "CAD" | "AUD";
|
|
@@ -540,7 +516,7 @@ export interface Theme {
|
|
|
540
516
|
export interface SpotWidgetOptions {
|
|
541
517
|
location?: string | HTMLElement;
|
|
542
518
|
showTable?: boolean;
|
|
543
|
-
|
|
519
|
+
selection?: SelectionEnum;
|
|
544
520
|
logoPosition?: "bottom-right" | "top-right";
|
|
545
521
|
apiConfig: ApiConfig;
|
|
546
522
|
quoteRequestData: QuoteRequestData;
|
|
@@ -565,12 +541,24 @@ export interface ElementOptions {
|
|
|
565
541
|
}
|
|
566
542
|
```
|
|
567
543
|
|
|
544
|
+
### Enums
|
|
545
|
+
|
|
546
|
+
#### SelectionEnum
|
|
547
|
+
|
|
548
|
+
```typescript
|
|
549
|
+
export enum SelectionEnum {
|
|
550
|
+
YES = 'yes',
|
|
551
|
+
NO = 'no',
|
|
552
|
+
UNSELECTED = 'unselected',
|
|
553
|
+
}
|
|
554
|
+
```
|
|
555
|
+
|
|
568
556
|
### Type Aliases
|
|
569
557
|
|
|
570
558
|
#### QuoteRequestData
|
|
571
559
|
|
|
572
560
|
```typescript
|
|
573
|
-
export type QuoteRequestData = QuoteItem | BatchQuoteRequest;
|
|
561
|
+
export type QuoteRequestData = QuoteItem | BatchQuoteRequest | QuoteItem[];
|
|
574
562
|
```
|
|
575
563
|
|
|
576
564
|
## Framework Integration
|
package/dist/api.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApiResponse, QuoteRequestData, BatchQuoteRequest
|
|
1
|
+
import type { ApiResponse, QuoteRequestData, BatchQuoteRequest } from './types.js';
|
|
2
2
|
/**
|
|
3
3
|
* Retrieve quote from Spot API
|
|
4
4
|
* @param endpoint – Spot API URL
|
|
@@ -14,12 +14,12 @@ 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: BatchQuoteRequest): Promise<ApiResponse>;
|
|
18
18
|
/**
|
|
19
19
|
* Retrieve multiple quotes in parallel from Spot API
|
|
20
20
|
* @param endpoint – Spot API URL
|
|
21
21
|
* @param partnerId – partner UUID
|
|
22
|
-
* @param batchData – batch quote data with
|
|
22
|
+
* @param batchData – batch quote data with cart metadata and items
|
|
23
23
|
* @returns Promise resolving to formatted API response
|
|
24
24
|
*/
|
|
25
25
|
export declare function fetchMultipleQuotes(endpoint: string, partnerId: string, batchData: BatchQuoteRequest): Promise<ApiResponse>;
|
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,
|
|
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;;;;;;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,iBAAiB,GAC9B,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
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type SpotWidgetOptions, type SelectionData } from "./types.js";
|
|
2
2
|
declare class SpotWidget {
|
|
3
3
|
private options;
|
|
4
4
|
private root;
|
|
@@ -27,5 +27,6 @@ declare class SpotWidget {
|
|
|
27
27
|
destroy(): void;
|
|
28
28
|
}
|
|
29
29
|
export default SpotWidget;
|
|
30
|
-
export
|
|
30
|
+
export { SelectionEnum } from "./types.js";
|
|
31
|
+
export type { SpotWidgetOptions, SelectionData, Quote, QuoteUpdates, ApiConfig, QuoteRequestData, QuoteItem, BatchQuoteItem, BatchQuoteRequest, QualifyingReason, PayoutScheduleItem, Communication, ApiResponse, ApiError, ElementOptions, QuoteMetadata, Callbacks, Theme, } from "./types.js";
|
|
31
32
|
//# 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,EACL,KAAK,iBAAiB,EAEtB,KAAK,aAAa,EAInB,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,CAA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