@getspot/spot-widget-react 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/dist/ReactSpotWidget.d.ts +1 -0
- package/dist/ReactSpotWidget.d.ts.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.es.js +52 -49
- package/dist/index.umd.js +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
# [4.2.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-react@4.1.1...@getspot/spot-widget-react@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-react@4.1.0...@getspot/spot-widget-react@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-react@4.0.4...@getspot/spot-widget-react@4.1.0) (2026-03-04)
|
|
2
16
|
|
|
3
17
|
|
|
@@ -82,4 +82,5 @@ declare const ReactSpotWidget: React.ForwardRefExoticComponent<ReactSpotWidgetPr
|
|
|
82
82
|
export default ReactSpotWidget;
|
|
83
83
|
export type { Quote, QuoteUpdates, SelectionData, SpotWidgetOptions, QuoteRequestData, ApiConfig };
|
|
84
84
|
export { SelectionEnum };
|
|
85
|
+
export { NON_US_RESIDENT_VALUE } from "@getspot/spot-widget";
|
|
85
86
|
//# 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,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,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EAAE,MAAM,IAAI,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,QAAA,MAAM,eAAe,iGA6LnB,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;AACzB,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -82,4 +82,5 @@ declare const ReactSpotWidget: React.ForwardRefExoticComponent<ReactSpotWidgetPr
|
|
|
82
82
|
export default ReactSpotWidget;
|
|
83
83
|
export type { Quote, QuoteUpdates, SelectionData, SpotWidgetOptions, QuoteRequestData, ApiConfig };
|
|
84
84
|
export { SelectionEnum };
|
|
85
|
+
export { NON_US_RESIDENT_VALUE } from "@getspot/spot-widget";
|
|
85
86
|
//# sourceMappingURL=ReactSpotWidget.d.ts.map
|
package/dist/index.es.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import { forwardRef as
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { jsx as L } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef as P, useRef as p, useCallback as O, useMemo as B, useImperativeHandle as H, useEffect as U } from "react";
|
|
3
|
+
import _, { SelectionEnum as K } from "@getspot/spot-widget";
|
|
4
|
+
import { NON_US_RESIDENT_VALUE as Z, SelectionEnum as $ } from "@getspot/spot-widget";
|
|
5
5
|
function i(c, u) {
|
|
6
6
|
if (c === u) return !0;
|
|
7
7
|
if (c == null || u == null || typeof c != "object" || typeof u != "object") return !1;
|
|
@@ -11,59 +11,60 @@ function i(c, u) {
|
|
|
11
11
|
if (!d.includes(f) || !i(c[f], u[f])) return !1;
|
|
12
12
|
return !0;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function V(c, u) {
|
|
15
15
|
const s = p(void 0);
|
|
16
16
|
return (!s.current || !i(s.current.deps, u)) && (s.current = { deps: u, value: c() }), s.current.value;
|
|
17
17
|
}
|
|
18
|
-
const
|
|
18
|
+
const z = P(({
|
|
19
19
|
apiConfig: c,
|
|
20
20
|
quoteRequestData: u,
|
|
21
21
|
showTable: s = !0,
|
|
22
|
-
selection: d =
|
|
22
|
+
selection: d = K.UNSELECTED,
|
|
23
23
|
theme: f,
|
|
24
24
|
callbacks: m = {},
|
|
25
25
|
useMockData: v,
|
|
26
26
|
mockData: R,
|
|
27
|
-
logoPosition:
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
27
|
+
logoPosition: E,
|
|
28
|
+
state: Q,
|
|
29
|
+
onQuoteRetrieved: S,
|
|
30
|
+
onOptIn: k,
|
|
31
|
+
onOptOut: h,
|
|
32
|
+
onError: C,
|
|
33
|
+
onNoMatchingQuote: I,
|
|
34
|
+
onSelectionChange: N
|
|
34
35
|
}, A) => {
|
|
35
36
|
const g = p(null), n = p(null), o = p({
|
|
36
|
-
onQuoteRetrieved:
|
|
37
|
-
onOptIn:
|
|
38
|
-
onOptOut:
|
|
39
|
-
onError:
|
|
40
|
-
onNoMatchingQuote:
|
|
41
|
-
onSelectionChange:
|
|
42
|
-
}),
|
|
37
|
+
onQuoteRetrieved: S,
|
|
38
|
+
onOptIn: k,
|
|
39
|
+
onOptOut: h,
|
|
40
|
+
onError: C,
|
|
41
|
+
onNoMatchingQuote: I,
|
|
42
|
+
onSelectionChange: N
|
|
43
|
+
}), w = p(m);
|
|
43
44
|
o.current = {
|
|
44
|
-
onQuoteRetrieved:
|
|
45
|
-
onOptIn:
|
|
46
|
-
onOptOut:
|
|
47
|
-
onError:
|
|
48
|
-
onNoMatchingQuote:
|
|
49
|
-
onSelectionChange:
|
|
50
|
-
},
|
|
45
|
+
onQuoteRetrieved: S,
|
|
46
|
+
onOptIn: k,
|
|
47
|
+
onOptOut: h,
|
|
48
|
+
onError: C,
|
|
49
|
+
onNoMatchingQuote: I,
|
|
50
|
+
onSelectionChange: N
|
|
51
|
+
}, w.current = m;
|
|
51
52
|
const j = O((e) => {
|
|
52
53
|
var t, r;
|
|
53
54
|
return (r = (t = o.current).onQuoteRetrieved) == null ? void 0 : r.call(t, e);
|
|
54
55
|
}, []), q = O((e) => {
|
|
55
56
|
var t, r, a, l;
|
|
56
57
|
(r = (t = o.current).onOptIn) == null || r.call(t, e), (l = (a = o.current).onSelectionChange) == null || l.call(a, e);
|
|
57
|
-
}, []),
|
|
58
|
+
}, []), D = O((e) => {
|
|
58
59
|
var t, r, a, l;
|
|
59
60
|
(r = (t = o.current).onOptOut) == null || r.call(t, e), (l = (a = o.current).onSelectionChange) == null || l.call(a, e);
|
|
60
|
-
}, []),
|
|
61
|
+
}, []), M = O((e) => {
|
|
61
62
|
var t, r;
|
|
62
63
|
(r = (t = o.current).onError) == null || r.call(t, e);
|
|
63
|
-
}, []),
|
|
64
|
+
}, []), W = O((e) => {
|
|
64
65
|
var t, r;
|
|
65
66
|
(r = (t = o.current).onNoMatchingQuote) == null || r.call(t, e);
|
|
66
|
-
}, []),
|
|
67
|
+
}, []), x = B(() => {
|
|
67
68
|
const e = {}, t = [
|
|
68
69
|
"onQuoteRetrieved",
|
|
69
70
|
"onOptIn",
|
|
@@ -73,30 +74,31 @@ const F = H(({
|
|
|
73
74
|
];
|
|
74
75
|
for (const r of t)
|
|
75
76
|
e[r] = (...a) => {
|
|
76
|
-
var
|
|
77
|
-
const l = (
|
|
77
|
+
var T;
|
|
78
|
+
const l = (T = w.current) == null ? void 0 : T[r];
|
|
78
79
|
if (l) return l(...a);
|
|
79
80
|
};
|
|
80
81
|
return {
|
|
81
82
|
...e,
|
|
82
83
|
...o.current.onQuoteRetrieved && { onQuoteRetrieved: j },
|
|
83
84
|
...o.current.onOptIn && { onOptIn: q },
|
|
84
|
-
...o.current.onOptOut && { onOptOut:
|
|
85
|
-
...o.current.onError && { onError:
|
|
86
|
-
...o.current.onNoMatchingQuote && { noMatchingQuote:
|
|
85
|
+
...o.current.onOptOut && { onOptOut: D },
|
|
86
|
+
...o.current.onError && { onError: M },
|
|
87
|
+
...o.current.onNoMatchingQuote && { noMatchingQuote: W }
|
|
87
88
|
};
|
|
88
|
-
}, [j, q,
|
|
89
|
+
}, [j, q, D, M, W]), b = V(() => ({
|
|
89
90
|
apiConfig: c,
|
|
90
91
|
quoteRequestData: u,
|
|
91
92
|
showTable: s,
|
|
92
93
|
selection: d,
|
|
93
94
|
theme: f,
|
|
94
|
-
callbacks:
|
|
95
|
+
callbacks: x,
|
|
95
96
|
useMockData: v,
|
|
96
97
|
mockData: R,
|
|
97
|
-
logoPosition:
|
|
98
|
-
|
|
99
|
-
|
|
98
|
+
logoPosition: E,
|
|
99
|
+
state: Q
|
|
100
|
+
}), [c, u, s, d, f, x, v, R, E, Q]);
|
|
101
|
+
H(A, () => ({
|
|
100
102
|
updateQuote: (e) => {
|
|
101
103
|
var t;
|
|
102
104
|
return ((t = n.current) == null ? void 0 : t.updateQuote(e)) ?? Promise.resolve(!1);
|
|
@@ -114,23 +116,24 @@ const F = H(({
|
|
|
114
116
|
}
|
|
115
117
|
}));
|
|
116
118
|
const y = p(void 0);
|
|
117
|
-
return
|
|
119
|
+
return U(() => (g.current && !n.current && (n.current = new _({
|
|
118
120
|
location: g.current,
|
|
119
121
|
...b
|
|
120
122
|
}), y.current = b), () => {
|
|
121
123
|
n.current && (n.current.destroy(), n.current = null);
|
|
122
|
-
}), []),
|
|
124
|
+
}), []), U(() => {
|
|
123
125
|
if (n.current && y.current) {
|
|
124
126
|
const e = y.current, t = b;
|
|
125
|
-
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
|
|
127
|
+
i(e.apiConfig, t.apiConfig) && i(e.theme, t.theme) && e.showTable === t.showTable && e.selection === t.selection && e.state === t.state && i(e.callbacks, t.callbacks) && !i(e.quoteRequestData, t.quoteRequestData) ? n.current.updateQuote(t.quoteRequestData) : i(e, t) || (n.current.destroy(), n.current = new _({
|
|
126
128
|
location: g.current,
|
|
127
129
|
...t
|
|
128
130
|
})), y.current = t;
|
|
129
131
|
}
|
|
130
|
-
}, [b]), /* @__PURE__ */
|
|
132
|
+
}, [b]), /* @__PURE__ */ L("div", { ref: g });
|
|
131
133
|
});
|
|
132
|
-
|
|
134
|
+
z.displayName = "ReactSpotWidget";
|
|
133
135
|
export {
|
|
134
|
-
Z as
|
|
135
|
-
|
|
136
|
+
Z as NON_US_RESIDENT_VALUE,
|
|
137
|
+
$ as SelectionEnum,
|
|
138
|
+
z as default
|
|
136
139
|
};
|
package/dist/index.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(
|
|
1
|
+
(function(c,O){typeof exports=="object"&&typeof module<"u"?O(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"],O):(c=typeof globalThis<"u"?globalThis:c||self,O(c.ReactSpotWidget={},c.React,c.React,c.SpotWidget))})(this,function(c,O,r,b){"use strict";function a(l,s){if(l===s)return!0;if(l==null||s==null||typeof l!="object"||typeof s!="object")return!1;const i=Object.keys(l),R=Object.keys(s);if(i.length!==R.length)return!1;for(let p of i)if(!R.includes(p)||!a(l[p],s[p]))return!1;return!0}function L(l,s){const i=r.useRef(void 0);return(!i.current||!a(i.current.deps,s))&&(i.current={deps:s,value:l()}),i.current.value}const v=r.forwardRef(({apiConfig:l,quoteRequestData:s,showTable:i=!0,selection:R=b.SelectionEnum.UNSELECTED,theme:p,callbacks:k={},useMockData:m,mockData:S,logoPosition:h,state:C,onQuoteRetrieved:Q,onOptIn:j,onOptOut:N,onError:q,onNoMatchingQuote:w,onSelectionChange:I},V)=>{const y=r.useRef(null),u=r.useRef(null),o=r.useRef({onQuoteRetrieved:Q,onOptIn:j,onOptOut:N,onError:q,onNoMatchingQuote:w,onSelectionChange:I}),_=r.useRef(k);o.current={onQuoteRetrieved:Q,onOptIn:j,onOptOut:N,onError:q,onNoMatchingQuote:w,onSelectionChange:I},_.current=k;const M=r.useCallback(e=>{var t,n;return(n=(t=o.current).onQuoteRetrieved)==null?void 0:n.call(t,e)},[]),T=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)},[]),D=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)},[]),P=r.useCallback(e=>{var t,n;(n=(t=o.current).onError)==null||n.call(t,e)},[]),U=r.useCallback(e=>{var t,n;(n=(t=o.current).onNoMatchingQuote)==null||n.call(t,e)},[]),x=r.useMemo(()=>{const e={},t=["onQuoteRetrieved","onOptIn","onOptOut","onError","noMatchingQuote"];for(const n of t)e[n]=(...d)=>{var A;const f=(A=_.current)==null?void 0:A[n];if(f)return f(...d)};return{...e,...o.current.onQuoteRetrieved&&{onQuoteRetrieved:M},...o.current.onOptIn&&{onOptIn:T},...o.current.onOptOut&&{onOptOut:D},...o.current.onError&&{onError:P},...o.current.onNoMatchingQuote&&{noMatchingQuote:U}}},[M,T,D,P,U]),g=L(()=>({apiConfig:l,quoteRequestData:s,showTable:i,selection:R,theme:p,callbacks:x,useMockData:m,mockData:S,logoPosition:h,state:C}),[l,s,i,R,p,x,m,S,h,C]);r.useImperativeHandle(V,()=>({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 E=r.useRef(void 0);return r.useEffect(()=>(y.current&&!u.current&&(u.current=new b({location:y.current,...g}),E.current=g),()=>{u.current&&(u.current.destroy(),u.current=null)}),[]),r.useEffect(()=>{if(u.current&&E.current){const e=E.current,t=g;a(e.apiConfig,t.apiConfig)&&a(e.theme,t.theme)&&e.showTable===t.showTable&&e.selection===t.selection&&e.state===t.state&&a(e.callbacks,t.callbacks)&&!a(e.quoteRequestData,t.quoteRequestData)?u.current.updateQuote(t.quoteRequestData):a(e,t)||(u.current.destroy(),u.current=new b({location:y.current,...t})),E.current=t}},[g]),O.jsx("div",{ref:y})});v.displayName="ReactSpotWidget",Object.defineProperty(c,"NON_US_RESIDENT_VALUE",{enumerable:!0,get:()=>b.NON_US_RESIDENT_VALUE}),Object.defineProperty(c,"SelectionEnum",{enumerable:!0,get:()=>b.SelectionEnum}),c.default=v,Object.defineProperties(c,{__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": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
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": "^4.
|
|
17
|
+
"@getspot/spot-widget": "^4.2.0"
|
|
18
18
|
},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@types/react": ">=18.0.0",
|