@getspot/spot-widget-react 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 +4 -6
- package/dist/ReactSpotWidget.d.ts +4 -2
- package/dist/ReactSpotWidget.d.ts.map +1 -1
- package/dist/index.d.ts +4 -2
- package/dist/index.es.js +49 -47
- package/dist/index.umd.js +1 -1
- package/package.json +4 -4
- package/dist/setupTests.d.ts +0 -2
- package/dist/setupTests.d.ts.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,20 @@
|
|
|
1
|
+
## [4.0.1](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-react@4.0.0...@getspot/spot-widget-react@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-react@3.3.2...@getspot/spot-widget-react@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-react@3.3.1...@getspot/spot-widget-react@3.3.2) (2026-01-09)
|
|
2
19
|
|
|
3
20
|
|
package/README.md
CHANGED
|
@@ -79,7 +79,7 @@ This package includes full TypeScript definitions. All props are typed for bette
|
|
|
79
79
|
| Prop | Type | Default | Description |
|
|
80
80
|
|------|------|---------|-------------|
|
|
81
81
|
| `showTable` | `boolean` | `true` | Whether to show the payout table |
|
|
82
|
-
| `
|
|
82
|
+
| `selection` | `SelectionEnum` | `'unselected'` | Initial selection state for the widget |
|
|
83
83
|
| `theme` | `Theme` | `undefined` | Theme customization options for styling the widget |
|
|
84
84
|
|
|
85
85
|
### Callback Props
|
|
@@ -184,11 +184,9 @@ For multiple items in a cart:
|
|
|
184
184
|
|
|
185
185
|
```tsx
|
|
186
186
|
{
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
currencyCode: 'USD' | 'CAD' | 'AUD'
|
|
191
|
-
},
|
|
187
|
+
cartId: string,
|
|
188
|
+
cartName: string,
|
|
189
|
+
currencyCode: 'USD' | 'CAD' | 'AUD',
|
|
192
190
|
items: Array<{
|
|
193
191
|
// Same fields as single quote, minus cartId and currencyCode
|
|
194
192
|
cartItemId?: string // Optional unique identifier for cart item
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type SpotWidgetOptions, type SelectionData, type Quote, type QuoteUpdates } from "@getspot/spot-widget";
|
|
2
|
+
import { type SpotWidgetOptions, type SelectionData, type Quote, type QuoteUpdates, type QuoteRequestData, type ApiConfig, SelectionEnum } from "@getspot/spot-widget";
|
|
3
3
|
/**
|
|
4
4
|
* Props for the ReactSpotWidget component
|
|
5
5
|
*/
|
|
@@ -11,7 +11,7 @@ interface ReactSpotWidgetProps extends Omit<SpotWidgetOptions, 'location' | 'cal
|
|
|
11
11
|
/** Whether to show the payout table. Defaults to true */
|
|
12
12
|
showTable?: boolean;
|
|
13
13
|
/** Whether the widget should be pre-selected for opt-in. Defaults to false */
|
|
14
|
-
|
|
14
|
+
selection?: SelectionEnum;
|
|
15
15
|
/** Theme customization options for styling the widget */
|
|
16
16
|
theme?: SpotWidgetOptions['theme'];
|
|
17
17
|
/** Callback fired when a quote is successfully retrieved */
|
|
@@ -80,4 +80,6 @@ export interface ReactSpotWidgetRef {
|
|
|
80
80
|
*/
|
|
81
81
|
declare const ReactSpotWidget: React.ForwardRefExoticComponent<ReactSpotWidgetProps & React.RefAttributes<ReactSpotWidgetRef>>;
|
|
82
82
|
export default ReactSpotWidget;
|
|
83
|
+
export type { Quote, QuoteUpdates, SelectionData, SpotWidgetOptions, QuoteRequestData, ApiConfig };
|
|
84
|
+
export { SelectionEnum };
|
|
83
85
|
//# sourceMappingURL=ReactSpotWidget.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReactSpotWidget.d.ts","sourceRoot":"","sources":["../src/ReactSpotWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmF,MAAM,OAAO,CAAC;AA+BxG,OAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"ReactSpotWidget.d.ts","sourceRoot":"","sources":["../src/ReactSpotWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmF,MAAM,OAAO,CAAC;AA+BxG,OAAmB,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,KAAK,EAAE,KAAK,YAAY,EAAE,KAAK,gBAAgB,EAAE,KAAK,SAAS,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAEnL;;GAEG;AACH,UAAU,oBAAqB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,UAAU,GAAG,WAAW,CAAC;IACtF,0EAA0E;IAC1E,SAAS,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;IAC1C,iEAAiE;IACjE,gBAAgB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,CAAC;IACxD,yDAAyD;IACzD,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,8EAA8E;IAC9E,SAAS,CAAC,EAAE,aAAa,CAAC;IAC1B,yDAAyD;IACzD,KAAK,CAAC,EAAE,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACnC,4DAA4D;IAC5D,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,YAAY,GAAG,IAAI,CAAC;IACzD,+DAA+D;IAC/D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACxC,gEAAgE;IAChE,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IACzC,iEAAiE;IACjE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAC;QAAC,YAAY,CAAC,EAAE,GAAG,CAAA;KAAE,KAAK,IAAI,CAAC;IACpF,qDAAqD;IACrD,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,GAAG,CAAA;KAAE,KAAK,IAAI,CAAC;IAClE,2EAA2E;IAC3E,iBAAiB,CAAC,EAAE,CAAC,IAAI,EAAE,aAAa,KAAK,IAAI,CAAC;IAClD,gDAAgD;IAChD,SAAS,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,6CAA6C;IAC7C,WAAW,EAAE,CAAC,mBAAmB,EAAE,iBAAiB,CAAC,kBAAkB,CAAC,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IAC9F,qCAAqC;IACrC,YAAY,EAAE,MAAM,aAAa,GAAG,IAAI,CAAC;IACzC,kDAAkD;IAClD,iBAAiB,EAAE,MAAM,OAAO,CAAC;IACjC,yDAAyD;IACzD,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,eAAe,iGAwLnB,CAAC;AAIH,eAAe,eAAe,CAAC;AAC/B,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,SAAS,EAAE,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { type SpotWidgetOptions, type SelectionData, type Quote, type QuoteUpdates } from "@getspot/spot-widget";
|
|
2
|
+
import { type SpotWidgetOptions, type SelectionData, type Quote, type QuoteUpdates, type QuoteRequestData, type ApiConfig, SelectionEnum } from "@getspot/spot-widget";
|
|
3
3
|
/**
|
|
4
4
|
* Props for the ReactSpotWidget component
|
|
5
5
|
*/
|
|
@@ -11,7 +11,7 @@ interface ReactSpotWidgetProps extends Omit<SpotWidgetOptions, 'location' | 'cal
|
|
|
11
11
|
/** Whether to show the payout table. Defaults to true */
|
|
12
12
|
showTable?: boolean;
|
|
13
13
|
/** Whether the widget should be pre-selected for opt-in. Defaults to false */
|
|
14
|
-
|
|
14
|
+
selection?: SelectionEnum;
|
|
15
15
|
/** Theme customization options for styling the widget */
|
|
16
16
|
theme?: SpotWidgetOptions['theme'];
|
|
17
17
|
/** Callback fired when a quote is successfully retrieved */
|
|
@@ -80,4 +80,6 @@ export interface ReactSpotWidgetRef {
|
|
|
80
80
|
*/
|
|
81
81
|
declare const ReactSpotWidget: React.ForwardRefExoticComponent<ReactSpotWidgetProps & React.RefAttributes<ReactSpotWidgetRef>>;
|
|
82
82
|
export default ReactSpotWidget;
|
|
83
|
+
export type { Quote, QuoteUpdates, SelectionData, SpotWidgetOptions, QuoteRequestData, ApiConfig };
|
|
84
|
+
export { SelectionEnum };
|
|
83
85
|
//# sourceMappingURL=ReactSpotWidget.d.ts.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
1
|
+
import { jsx as A } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as B, useRef as p, useCallback as O, useMemo as H, useImperativeHandle as K, useEffect as x } from "react";
|
|
3
|
+
import P, { SelectionEnum as L } from "@getspot/spot-widget";
|
|
4
|
+
import { SelectionEnum as Y } from "@getspot/spot-widget";
|
|
4
5
|
function i(c, u) {
|
|
5
6
|
if (c === u) return !0;
|
|
6
7
|
if (c == null || u == null || typeof c != "object" || typeof u != "object") return !1;
|
|
@@ -10,43 +11,43 @@ function i(c, u) {
|
|
|
10
11
|
if (!d.includes(f) || !i(c[f], u[f])) return !1;
|
|
11
12
|
return !0;
|
|
12
13
|
}
|
|
13
|
-
function
|
|
14
|
+
function U(c, u) {
|
|
14
15
|
const s = p(void 0);
|
|
15
16
|
return (!s.current || !i(s.current.deps, u)) && (s.current = { deps: u, value: c() }), s.current.value;
|
|
16
17
|
}
|
|
17
|
-
const
|
|
18
|
+
const z = B(({
|
|
18
19
|
apiConfig: c,
|
|
19
20
|
quoteRequestData: u,
|
|
20
21
|
showTable: s = !0,
|
|
21
|
-
|
|
22
|
+
selection: d = L.UNSELECTED,
|
|
22
23
|
theme: f,
|
|
23
|
-
callbacks:
|
|
24
|
-
useMockData:
|
|
25
|
-
mockData:
|
|
26
|
-
onQuoteRetrieved:
|
|
27
|
-
onOptIn:
|
|
24
|
+
callbacks: m = {},
|
|
25
|
+
useMockData: v,
|
|
26
|
+
mockData: R,
|
|
27
|
+
onQuoteRetrieved: Q,
|
|
28
|
+
onOptIn: k,
|
|
28
29
|
onOptOut: h,
|
|
29
|
-
onError:
|
|
30
|
-
onNoMatchingQuote:
|
|
31
|
-
onSelectionChange:
|
|
32
|
-
},
|
|
30
|
+
onError: E,
|
|
31
|
+
onNoMatchingQuote: S,
|
|
32
|
+
onSelectionChange: C
|
|
33
|
+
}, T) => {
|
|
33
34
|
const g = p(null), n = p(null), o = p({
|
|
34
|
-
onQuoteRetrieved:
|
|
35
|
-
onOptIn:
|
|
35
|
+
onQuoteRetrieved: Q,
|
|
36
|
+
onOptIn: k,
|
|
36
37
|
onOptOut: h,
|
|
37
|
-
onError:
|
|
38
|
-
onNoMatchingQuote:
|
|
39
|
-
onSelectionChange:
|
|
40
|
-
}), w = p(
|
|
38
|
+
onError: E,
|
|
39
|
+
onNoMatchingQuote: S,
|
|
40
|
+
onSelectionChange: C
|
|
41
|
+
}), w = p(m);
|
|
41
42
|
o.current = {
|
|
42
|
-
onQuoteRetrieved:
|
|
43
|
-
onOptIn:
|
|
43
|
+
onQuoteRetrieved: Q,
|
|
44
|
+
onOptIn: k,
|
|
44
45
|
onOptOut: h,
|
|
45
|
-
onError:
|
|
46
|
-
onNoMatchingQuote:
|
|
47
|
-
onSelectionChange:
|
|
48
|
-
}, w.current =
|
|
49
|
-
const
|
|
46
|
+
onError: E,
|
|
47
|
+
onNoMatchingQuote: S,
|
|
48
|
+
onSelectionChange: C
|
|
49
|
+
}, w.current = m;
|
|
50
|
+
const I = O((e) => {
|
|
50
51
|
var t, r;
|
|
51
52
|
return (r = (t = o.current).onQuoteRetrieved) == null ? void 0 : r.call(t, e);
|
|
52
53
|
}, []), j = O((e) => {
|
|
@@ -58,10 +59,10 @@ const F = H(({
|
|
|
58
59
|
}, []), M = O((e) => {
|
|
59
60
|
var t, r;
|
|
60
61
|
(r = (t = o.current).onError) == null || r.call(t, e);
|
|
61
|
-
}, []),
|
|
62
|
+
}, []), D = O((e) => {
|
|
62
63
|
var t, r;
|
|
63
64
|
(r = (t = o.current).onNoMatchingQuote) == null || r.call(t, e);
|
|
64
|
-
}, []),
|
|
65
|
+
}, []), N = H(() => {
|
|
65
66
|
const e = {}, t = [
|
|
66
67
|
"onQuoteRetrieved",
|
|
67
68
|
"onOptIn",
|
|
@@ -71,29 +72,29 @@ const F = H(({
|
|
|
71
72
|
];
|
|
72
73
|
for (const r of t)
|
|
73
74
|
e[r] = (...a) => {
|
|
74
|
-
var
|
|
75
|
-
const l = (
|
|
75
|
+
var W;
|
|
76
|
+
const l = (W = w.current) == null ? void 0 : W[r];
|
|
76
77
|
if (l) return l(...a);
|
|
77
78
|
};
|
|
78
79
|
return {
|
|
79
80
|
...e,
|
|
80
|
-
...o.current.onQuoteRetrieved && { onQuoteRetrieved:
|
|
81
|
+
...o.current.onQuoteRetrieved && { onQuoteRetrieved: I },
|
|
81
82
|
...o.current.onOptIn && { onOptIn: j },
|
|
82
83
|
...o.current.onOptOut && { onOptOut: q },
|
|
83
84
|
...o.current.onError && { onError: M },
|
|
84
|
-
...o.current.onNoMatchingQuote && { noMatchingQuote:
|
|
85
|
+
...o.current.onNoMatchingQuote && { noMatchingQuote: D }
|
|
85
86
|
};
|
|
86
|
-
}, [
|
|
87
|
+
}, [I, j, q, M, D]), b = U(() => ({
|
|
87
88
|
apiConfig: c,
|
|
88
89
|
quoteRequestData: u,
|
|
89
90
|
showTable: s,
|
|
90
|
-
|
|
91
|
+
selection: d,
|
|
91
92
|
theme: f,
|
|
92
|
-
callbacks:
|
|
93
|
-
useMockData:
|
|
94
|
-
mockData:
|
|
95
|
-
}), [c, u, s, d, f,
|
|
96
|
-
T
|
|
93
|
+
callbacks: N,
|
|
94
|
+
useMockData: v,
|
|
95
|
+
mockData: R
|
|
96
|
+
}), [c, u, s, d, f, N, v, R]);
|
|
97
|
+
K(T, () => ({
|
|
97
98
|
updateQuote: (e) => {
|
|
98
99
|
var t;
|
|
99
100
|
return ((t = n.current) == null ? void 0 : t.updateQuote(e)) ?? Promise.resolve(!1);
|
|
@@ -111,22 +112,23 @@ const F = H(({
|
|
|
111
112
|
}
|
|
112
113
|
}));
|
|
113
114
|
const y = p(void 0);
|
|
114
|
-
return
|
|
115
|
+
return x(() => (g.current && !n.current && (n.current = new P({
|
|
115
116
|
location: g.current,
|
|
116
117
|
...b
|
|
117
118
|
}), y.current = b), () => {
|
|
118
119
|
n.current && (n.current.destroy(), n.current = null);
|
|
119
|
-
}), []),
|
|
120
|
+
}), []), x(() => {
|
|
120
121
|
if (n.current && y.current) {
|
|
121
122
|
const e = y.current, t = b;
|
|
122
|
-
i(e.apiConfig, t.apiConfig) && i(e.theme, t.theme) && e.showTable === t.showTable && e.
|
|
123
|
+
i(e.apiConfig, t.apiConfig) && i(e.theme, t.theme) && e.showTable === t.showTable && e.selection === t.selection && i(e.callbacks, t.callbacks) && !i(e.quoteRequestData, t.quoteRequestData) ? n.current.updateQuote(t.quoteRequestData) : i(e, t) || (n.current.destroy(), n.current = new P({
|
|
123
124
|
location: g.current,
|
|
124
125
|
...t
|
|
125
126
|
})), y.current = t;
|
|
126
127
|
}
|
|
127
|
-
}, [b]), /* @__PURE__ */
|
|
128
|
+
}, [b]), /* @__PURE__ */ A("div", { ref: g });
|
|
128
129
|
});
|
|
129
|
-
|
|
130
|
+
z.displayName = "ReactSpotWidget";
|
|
130
131
|
export {
|
|
131
|
-
|
|
132
|
+
Y as SelectionEnum,
|
|
133
|
+
z as default
|
|
132
134
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(s,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("react/jsx-runtime"),require("react"),require("@getspot/spot-widget")):typeof define=="function"&&define.amd?define(["exports","react/jsx-runtime","react","@getspot/spot-widget"],b):(s=typeof globalThis<"u"?globalThis:s||self,b(s.ReactSpotWidget={},s.React,s.React,s.SpotWidget))})(this,function(s,b,r,R){"use strict";function a(l,c){if(l===c)return!0;if(l==null||c==null||typeof l!="object"||typeof c!="object")return!1;const i=Object.keys(l),O=Object.keys(c);if(i.length!==O.length)return!1;for(let p of i)if(!O.includes(p)||!a(l[p],c[p]))return!1;return!0}function _(l,c){const i=r.useRef(void 0);return(!i.current||!a(i.current.deps,c))&&(i.current={deps:c,value:l()}),i.current.value}const k=r.forwardRef(({apiConfig:l,quoteRequestData:c,showTable:i=!0,selection:O=R.SelectionEnum.UNSELECTED,theme:p,callbacks:m={},useMockData:h,mockData:C,onQuoteRetrieved:E,onOptIn:Q,onOptOut:S,onError:j,onNoMatchingQuote:q,onSelectionChange:w},A)=>{const g=r.useRef(null),u=r.useRef(null),o=r.useRef({onQuoteRetrieved:E,onOptIn:Q,onOptOut:S,onError:j,onNoMatchingQuote:q,onSelectionChange:w}),M=r.useRef(m);o.current={onQuoteRetrieved:E,onOptIn:Q,onOptOut:S,onError:j,onNoMatchingQuote:q,onSelectionChange:w},M.current=m;const I=r.useCallback(e=>{var t,n;return(n=(t=o.current).onQuoteRetrieved)==null?void 0:n.call(t,e)},[]),P=r.useCallback(e=>{var t,n,d,f;(n=(t=o.current).onOptIn)==null||n.call(t,e),(f=(d=o.current).onSelectionChange)==null||f.call(d,e)},[]),T=r.useCallback(e=>{var t,n,d,f;(n=(t=o.current).onOptOut)==null||n.call(t,e),(f=(d=o.current).onSelectionChange)==null||f.call(d,e)},[]),x=r.useCallback(e=>{var t,n;(n=(t=o.current).onError)==null||n.call(t,e)},[]),D=r.useCallback(e=>{var t,n;(n=(t=o.current).onNoMatchingQuote)==null||n.call(t,e)},[]),N=r.useMemo(()=>{const e={},t=["onQuoteRetrieved","onOptIn","onOptOut","onError","noMatchingQuote"];for(const n of t)e[n]=(...d)=>{var W;const f=(W=M.current)==null?void 0:W[n];if(f)return f(...d)};return{...e,...o.current.onQuoteRetrieved&&{onQuoteRetrieved:I},...o.current.onOptIn&&{onOptIn:P},...o.current.onOptOut&&{onOptOut:T},...o.current.onError&&{onError:x},...o.current.onNoMatchingQuote&&{noMatchingQuote:D}}},[I,P,T,x,D]),y=_(()=>({apiConfig:l,quoteRequestData:c,showTable:i,selection:O,theme:p,callbacks:N,useMockData:h,mockData:C}),[l,c,i,O,p,N,h,C]);r.useImperativeHandle(A,()=>({updateQuote:e=>{var t;return((t=u.current)==null?void 0:t.updateQuote(e))??Promise.resolve(!1)},getSelection:()=>{var e;return((e=u.current)==null?void 0:e.getSelection())??null},validateSelection:()=>{var e;return((e=u.current)==null?void 0:e.validateSelection())??!1},destroy:()=>{u.current&&(u.current.destroy(),u.current=null)}}));const v=r.useRef(void 0);return r.useEffect(()=>(g.current&&!u.current&&(u.current=new R({location:g.current,...y}),v.current=y),()=>{u.current&&(u.current.destroy(),u.current=null)}),[]),r.useEffect(()=>{if(u.current&&v.current){const e=v.current,t=y;a(e.apiConfig,t.apiConfig)&&a(e.theme,t.theme)&&e.showTable===t.showTable&&e.selection===t.selection&&a(e.callbacks,t.callbacks)&&!a(e.quoteRequestData,t.quoteRequestData)?u.current.updateQuote(t.quoteRequestData):a(e,t)||(u.current.destroy(),u.current=new R({location:g.current,...t})),v.current=t}},[y]),b.jsx("div",{ref:g})});k.displayName="ReactSpotWidget",Object.defineProperty(s,"SelectionEnum",{enumerable:!0,get:()=>R.SelectionEnum}),s.default=k,Object.defineProperties(s,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getspot/spot-widget-react",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.1",
|
|
4
4
|
"description": "React wrapper for Spot Widget",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"CHANGELOG.md"
|
|
15
15
|
],
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@getspot/spot-widget": "^
|
|
17
|
+
"@getspot/spot-widget": "^4.0.1"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@types/react": ">=18.0.0",
|
|
@@ -48,8 +48,8 @@
|
|
|
48
48
|
"vite": "^5.0.0"
|
|
49
49
|
},
|
|
50
50
|
"scripts": {
|
|
51
|
-
"build": "vite build && npx -p typescript tsc --emitDeclarationOnly && cp dist/ReactSpotWidget.d.ts dist/index.d.ts",
|
|
52
|
-
"docs": "npx -p typedoc -p typedoc-plugin-markdown typedoc --plugin typedoc-plugin-markdown --out docs src/ReactSpotWidget.tsx",
|
|
51
|
+
"build": "vite build && npx -p typescript tsc -p tsconfig.build.json --emitDeclarationOnly && cp dist/ReactSpotWidget.d.ts dist/index.d.ts",
|
|
52
|
+
"docs": "npx -p typedoc -p typedoc-plugin-markdown typedoc --plugin typedoc-plugin-markdown --tsconfig tsconfig.build.json --out docs src/ReactSpotWidget.tsx",
|
|
53
53
|
"docs:readme": "npm run docs && node scripts/generate-readme.js",
|
|
54
54
|
"test": "jest --watchAll=false",
|
|
55
55
|
"test:watch": "jest --watch",
|
package/dist/setupTests.d.ts
DELETED
package/dist/setupTests.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"setupTests.d.ts","sourceRoot":"","sources":["../src/setupTests.ts"],"names":[],"mappings":"AAAA,OAAO,2BAA2B,CAAC"}
|