@getspot/spot-widget-react 3.2.2 → 3.3.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 CHANGED
@@ -1,3 +1,17 @@
1
+ # [3.3.0](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-react@3.2.3...@getspot/spot-widget-react@3.3.0) (2025-12-22)
2
+
3
+
4
+ ### Features
5
+
6
+ * **react:** add storybook support. run 'pnpm run storybook' to see ([7f751d1](https://gitlab.com/getspot/spot-widget/commit/7f751d15f8d3705ca746bf695169fd0f7b6d79ca))
7
+
8
+ ## [3.2.3](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-react@3.2.2...@getspot/spot-widget-react@3.2.3) (2025-12-18)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **core:** stop event propogation on covered items toggle ([357cd77](https://gitlab.com/getspot/spot-widget/commit/357cd77c01d9245b1ac852270b6494911307abf1))
14
+
1
15
  ## [3.2.2](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-react@3.2.1...@getspot/spot-widget-react@3.2.2) (2025-12-16)
2
16
 
3
17
 
@@ -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;AAE7H;;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,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,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"}
package/dist/index.es.js CHANGED
@@ -1,6 +1,6 @@
1
- import { jsx as x } from "react/jsx-runtime";
2
- import { forwardRef as A, useRef as p, useCallback as O, useMemo as B, useImperativeHandle as H, useEffect as W } from "react";
3
- import N from "@getspot/spot-widget";
1
+ import { jsx as B } from "react/jsx-runtime";
2
+ import { forwardRef as H, useRef as p, useCallback as O, useMemo as K, useImperativeHandle as T, useEffect as P } from "react";
3
+ import x from "@getspot/spot-widget";
4
4
  function i(c, u) {
5
5
  if (c === u) return !0;
6
6
  if (c == null || u == null || typeof c != "object" || typeof u != "object") return !1;
@@ -10,56 +10,58 @@ function i(c, u) {
10
10
  if (!d.includes(f) || !i(c[f], u[f])) return !1;
11
11
  return !0;
12
12
  }
13
- function K(c, u) {
13
+ function z(c, u) {
14
14
  const s = p(void 0);
15
15
  return (!s.current || !i(s.current.deps, u)) && (s.current = { deps: u, value: c() }), s.current.value;
16
16
  }
17
- const T = A(({
17
+ const F = H(({
18
18
  apiConfig: c,
19
19
  quoteRequestData: u,
20
20
  showTable: s = !0,
21
21
  optInSelected: d = !1,
22
22
  theme: f,
23
23
  callbacks: v = {},
24
+ useMockData: R,
25
+ mockData: Q,
24
26
  onQuoteRetrieved: k,
25
- onOptIn: R,
26
- onOptOut: m,
27
- onError: Q,
28
- onNoMatchingQuote: h,
29
- onSelectionChange: S
30
- }, P) => {
27
+ onOptIn: m,
28
+ onOptOut: h,
29
+ onError: S,
30
+ onNoMatchingQuote: C,
31
+ onSelectionChange: I
32
+ }, A) => {
31
33
  const g = p(null), n = p(null), o = p({
32
34
  onQuoteRetrieved: k,
33
- onOptIn: R,
34
- onOptOut: m,
35
- onError: Q,
36
- onNoMatchingQuote: h,
37
- onSelectionChange: S
38
- }), C = p(v);
35
+ onOptIn: m,
36
+ onOptOut: h,
37
+ onError: S,
38
+ onNoMatchingQuote: C,
39
+ onSelectionChange: I
40
+ }), w = p(v);
39
41
  o.current = {
40
42
  onQuoteRetrieved: k,
41
- onOptIn: R,
42
- onOptOut: m,
43
- onError: Q,
44
- onNoMatchingQuote: h,
45
- onSelectionChange: S
46
- }, C.current = v;
47
- const I = O((e) => {
43
+ onOptIn: m,
44
+ onOptOut: h,
45
+ onError: S,
46
+ onNoMatchingQuote: C,
47
+ onSelectionChange: I
48
+ }, w.current = v;
49
+ const E = O((e) => {
48
50
  var t, r;
49
51
  return (r = (t = o.current).onQuoteRetrieved) == null ? void 0 : r.call(t, e);
50
- }, []), w = O((e) => {
52
+ }, []), j = O((e) => {
51
53
  var t, r, a, l;
52
54
  (r = (t = o.current).onOptIn) == null || r.call(t, e), (l = (a = o.current).onSelectionChange) == null || l.call(a, e);
53
- }, []), E = O((e) => {
55
+ }, []), q = O((e) => {
54
56
  var t, r, a, l;
55
57
  (r = (t = o.current).onOptOut) == null || r.call(t, e), (l = (a = o.current).onSelectionChange) == null || l.call(a, e);
56
58
  }, []), M = O((e) => {
57
59
  var t, r;
58
60
  (r = (t = o.current).onError) == null || r.call(t, e);
59
- }, []), j = O((e) => {
61
+ }, []), W = O((e) => {
60
62
  var t, r;
61
63
  (r = (t = o.current).onNoMatchingQuote) == null || r.call(t, e);
62
- }, []), q = B(() => {
64
+ }, []), D = K(() => {
63
65
  const e = {}, t = [
64
66
  "onQuoteRetrieved",
65
67
  "onOptIn",
@@ -69,27 +71,29 @@ const T = A(({
69
71
  ];
70
72
  for (const r of t)
71
73
  e[r] = (...a) => {
72
- var D;
73
- const l = (D = C.current) == null ? void 0 : D[r];
74
+ var N;
75
+ const l = (N = w.current) == null ? void 0 : N[r];
74
76
  if (l) return l(...a);
75
77
  };
76
78
  return {
77
79
  ...e,
78
- ...o.current.onQuoteRetrieved && { onQuoteRetrieved: I },
79
- ...o.current.onOptIn && { onOptIn: w },
80
- ...o.current.onOptOut && { onOptOut: E },
80
+ ...o.current.onQuoteRetrieved && { onQuoteRetrieved: E },
81
+ ...o.current.onOptIn && { onOptIn: j },
82
+ ...o.current.onOptOut && { onOptOut: q },
81
83
  ...o.current.onError && { onError: M },
82
- ...o.current.onNoMatchingQuote && { noMatchingQuote: j }
84
+ ...o.current.onNoMatchingQuote && { noMatchingQuote: W }
83
85
  };
84
- }, [I, w, E, M, j]), b = K(() => ({
86
+ }, [E, j, q, M, W]), b = z(() => ({
85
87
  apiConfig: c,
86
88
  quoteRequestData: u,
87
89
  showTable: s,
88
90
  optInSelected: d,
89
91
  theme: f,
90
- callbacks: q
91
- }), [c, u, s, d, f, q]);
92
- H(P, () => ({
92
+ callbacks: D,
93
+ useMockData: R,
94
+ mockData: Q
95
+ }), [c, u, s, d, f, D, R, Q]);
96
+ T(A, () => ({
93
97
  updateQuote: (e) => {
94
98
  var t;
95
99
  return ((t = n.current) == null ? void 0 : t.updateQuote(e)) ?? Promise.resolve(!1);
@@ -107,22 +111,22 @@ const T = A(({
107
111
  }
108
112
  }));
109
113
  const y = p(void 0);
110
- return W(() => (g.current && !n.current && (n.current = new N({
114
+ return P(() => (g.current && !n.current && (n.current = new x({
111
115
  location: g.current,
112
116
  ...b
113
117
  }), y.current = b), () => {
114
118
  n.current && (n.current.destroy(), n.current = null);
115
- }), []), W(() => {
119
+ }), []), P(() => {
116
120
  if (n.current && y.current) {
117
121
  const e = y.current, t = b;
118
- i(e.apiConfig, t.apiConfig) && i(e.theme, t.theme) && e.showTable === t.showTable && e.optInSelected === t.optInSelected && i(e.callbacks, t.callbacks) && !i(e.quoteRequestData, t.quoteRequestData) ? n.current.updateQuote(t.quoteRequestData) : i(e, t) || (n.current.destroy(), n.current = new N({
122
+ i(e.apiConfig, t.apiConfig) && i(e.theme, t.theme) && e.showTable === t.showTable && e.optInSelected === t.optInSelected && i(e.callbacks, t.callbacks) && !i(e.quoteRequestData, t.quoteRequestData) ? n.current.updateQuote(t.quoteRequestData) : i(e, t) || (n.current.destroy(), n.current = new x({
119
123
  location: g.current,
120
124
  ...t
121
125
  })), y.current = t;
122
126
  }
123
- }, [b]), /* @__PURE__ */ x("div", { ref: g });
127
+ }, [b]), /* @__PURE__ */ B("div", { ref: g });
124
128
  });
125
- T.displayName = "ReactSpotWidget";
129
+ F.displayName = "ReactSpotWidget";
126
130
  export {
127
- T as default
131
+ F as default
128
132
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
1
- (function(i,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("react/jsx-runtime"),require("react"),require("@getspot/spot-widget")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react","@getspot/spot-widget"],n):(i=typeof globalThis<"u"?globalThis:i||self,i.ReactSpotWidget=n(i.React,i.React,i.SpotWidget))})(this,function(i,n,k){"use strict";function a(s,c){if(s===c)return!0;if(s==null||c==null||typeof s!="object"||typeof c!="object")return!1;const l=Object.keys(s),R=Object.keys(c);if(l.length!==R.length)return!1;for(let d of l)if(!R.includes(d)||!a(s[d],c[d]))return!1;return!0}function N(s,c){const l=n.useRef(void 0);return(!l.current||!a(l.current.deps,c))&&(l.current={deps:c,value:s()}),l.current.value}const y=n.forwardRef(({apiConfig:s,quoteRequestData:c,showTable:l=!0,optInSelected:R=!1,theme:d,callbacks:v={},onQuoteRetrieved:h,onOptIn:Q,onOptOut:m,onError:C,onNoMatchingQuote:S,onSelectionChange:j},P)=>{const O=n.useRef(null),u=n.useRef(null),o=n.useRef({onQuoteRetrieved:h,onOptIn:Q,onOptOut:m,onError:C,onNoMatchingQuote:S,onSelectionChange:j}),q=n.useRef(v);o.current={onQuoteRetrieved:h,onOptIn:Q,onOptOut:m,onError:C,onNoMatchingQuote:S,onSelectionChange:j},q.current=v;const w=n.useCallback(e=>{var t,r;return(r=(t=o.current).onQuoteRetrieved)==null?void 0:r.call(t,e)},[]),E=n.useCallback(e=>{var t,r,p,f;(r=(t=o.current).onOptIn)==null||r.call(t,e),(f=(p=o.current).onSelectionChange)==null||f.call(p,e)},[]),I=n.useCallback(e=>{var t,r,p,f;(r=(t=o.current).onOptOut)==null||r.call(t,e),(f=(p=o.current).onSelectionChange)==null||f.call(p,e)},[]),M=n.useCallback(e=>{var t,r;(r=(t=o.current).onError)==null||r.call(t,e)},[]),x=n.useCallback(e=>{var t,r;(r=(t=o.current).onNoMatchingQuote)==null||r.call(t,e)},[]),D=n.useMemo(()=>{const e={},t=["onQuoteRetrieved","onOptIn","onOptOut","onError","noMatchingQuote"];for(const r of t)e[r]=(...p)=>{var W;const f=(W=q.current)==null?void 0:W[r];if(f)return f(...p)};return{...e,...o.current.onQuoteRetrieved&&{onQuoteRetrieved:w},...o.current.onOptIn&&{onOptIn:E},...o.current.onOptOut&&{onOptOut:I},...o.current.onError&&{onError:M},...o.current.onNoMatchingQuote&&{noMatchingQuote:x}}},[w,E,I,M,x]),g=N(()=>({apiConfig:s,quoteRequestData:c,showTable:l,optInSelected:R,theme:d,callbacks:D}),[s,c,l,R,d,D]);n.useImperativeHandle(P,()=>({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 b=n.useRef(void 0);return n.useEffect(()=>(O.current&&!u.current&&(u.current=new k({location:O.current,...g}),b.current=g),()=>{u.current&&(u.current.destroy(),u.current=null)}),[]),n.useEffect(()=>{if(u.current&&b.current){const e=b.current,t=g;a(e.apiConfig,t.apiConfig)&&a(e.theme,t.theme)&&e.showTable===t.showTable&&e.optInSelected===t.optInSelected&&a(e.callbacks,t.callbacks)&&!a(e.quoteRequestData,t.quoteRequestData)?u.current.updateQuote(t.quoteRequestData):a(e,t)||(u.current.destroy(),u.current=new k({location:O.current,...t})),b.current=t}},[g]),i.jsx("div",{ref:O})});return y.displayName="ReactSpotWidget",y});
1
+ (function(i,n){typeof exports=="object"&&typeof module<"u"?module.exports=n(require("react/jsx-runtime"),require("react"),require("@getspot/spot-widget")):typeof define=="function"&&define.amd?define(["react/jsx-runtime","react","@getspot/spot-widget"],n):(i=typeof globalThis<"u"?globalThis:i||self,i.ReactSpotWidget=n(i.React,i.React,i.SpotWidget))})(this,function(i,n,y){"use strict";function a(s,c){if(s===c)return!0;if(s==null||c==null||typeof s!="object"||typeof c!="object")return!1;const l=Object.keys(s),R=Object.keys(c);if(l.length!==R.length)return!1;for(let d of l)if(!R.includes(d)||!a(s[d],c[d]))return!1;return!0}function T(s,c){const l=n.useRef(void 0);return(!l.current||!a(l.current.deps,c))&&(l.current={deps:c,value:s()}),l.current.value}const k=n.forwardRef(({apiConfig:s,quoteRequestData:c,showTable:l=!0,optInSelected:R=!1,theme:d,callbacks:v={},useMockData:h,mockData:Q,onQuoteRetrieved:C,onOptIn:m,onOptOut:S,onError:j,onNoMatchingQuote:q,onSelectionChange:w},A)=>{const O=n.useRef(null),u=n.useRef(null),o=n.useRef({onQuoteRetrieved:C,onOptIn:m,onOptOut:S,onError:j,onNoMatchingQuote:q,onSelectionChange:w}),E=n.useRef(v);o.current={onQuoteRetrieved:C,onOptIn:m,onOptOut:S,onError:j,onNoMatchingQuote:q,onSelectionChange:w},E.current=v;const I=n.useCallback(e=>{var t,r;return(r=(t=o.current).onQuoteRetrieved)==null?void 0:r.call(t,e)},[]),x=n.useCallback(e=>{var t,r,p,f;(r=(t=o.current).onOptIn)==null||r.call(t,e),(f=(p=o.current).onSelectionChange)==null||f.call(p,e)},[]),M=n.useCallback(e=>{var t,r,p,f;(r=(t=o.current).onOptOut)==null||r.call(t,e),(f=(p=o.current).onSelectionChange)==null||f.call(p,e)},[]),W=n.useCallback(e=>{var t,r;(r=(t=o.current).onError)==null||r.call(t,e)},[]),D=n.useCallback(e=>{var t,r;(r=(t=o.current).onNoMatchingQuote)==null||r.call(t,e)},[]),N=n.useMemo(()=>{const e={},t=["onQuoteRetrieved","onOptIn","onOptOut","onError","noMatchingQuote"];for(const r of t)e[r]=(...p)=>{var P;const f=(P=E.current)==null?void 0:P[r];if(f)return f(...p)};return{...e,...o.current.onQuoteRetrieved&&{onQuoteRetrieved:I},...o.current.onOptIn&&{onOptIn:x},...o.current.onOptOut&&{onOptOut:M},...o.current.onError&&{onError:W},...o.current.onNoMatchingQuote&&{noMatchingQuote:D}}},[I,x,M,W,D]),g=T(()=>({apiConfig:s,quoteRequestData:c,showTable:l,optInSelected:R,theme:d,callbacks:N,useMockData:h,mockData:Q}),[s,c,l,R,d,N,h,Q]);n.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 b=n.useRef(void 0);return n.useEffect(()=>(O.current&&!u.current&&(u.current=new y({location:O.current,...g}),b.current=g),()=>{u.current&&(u.current.destroy(),u.current=null)}),[]),n.useEffect(()=>{if(u.current&&b.current){const e=b.current,t=g;a(e.apiConfig,t.apiConfig)&&a(e.theme,t.theme)&&e.showTable===t.showTable&&e.optInSelected===t.optInSelected&&a(e.callbacks,t.callbacks)&&!a(e.quoteRequestData,t.quoteRequestData)?u.current.updateQuote(t.quoteRequestData):a(e,t)||(u.current.destroy(),u.current=new y({location:O.current,...t})),b.current=t}},[g]),i.jsx("div",{ref:O})});return k.displayName="ReactSpotWidget",k});
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getspot/spot-widget-react",
3
- "version": "3.2.2",
3
+ "version": "3.3.0",
4
4
  "description": "React wrapper for Spot Widget",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -14,31 +14,38 @@
14
14
  "CHANGELOG.md"
15
15
  ],
16
16
  "dependencies": {
17
- "@getspot/spot-widget": "^3.2.4"
17
+ "@getspot/spot-widget": "^3.3.0"
18
18
  },
19
19
  "peerDependencies": {
20
- "react": ">=18.0.0",
21
- "react-dom": ">=18.0.0",
22
20
  "@types/react": ">=18.0.0",
23
- "@types/react-dom": ">=18.0.0"
21
+ "@types/react-dom": ">=18.0.0",
22
+ "react": ">=18.0.0",
23
+ "react-dom": ">=18.0.0"
24
24
  },
25
25
  "devDependencies": {
26
- "vite": "^5.0.0",
27
- "@vitejs/plugin-react": "^4.0.0",
28
- "typescript": "~5.4.0",
29
- "@types/react": "^18.0.0",
30
- "@types/react-dom": "^18.0.0",
31
- "typedoc": "^0.28.0",
32
- "typedoc-plugin-markdown": "^4.0.0",
33
- "jest": "^29.0.0",
34
- "@testing-library/react": "^14.0.0",
26
+ "@storybook/addon-essentials": "^8.6.15",
27
+ "@storybook/addon-interactions": "^8.6.15",
28
+ "@storybook/blocks": "^8.6.15",
29
+ "@storybook/react": "^8.6.15",
30
+ "@storybook/react-vite": "^8.6.15",
31
+ "@storybook/test": "^8.6.15",
35
32
  "@testing-library/jest-dom": "^6.0.0",
33
+ "@testing-library/react": "^14.0.0",
36
34
  "@testing-library/user-event": "^14.0.0",
37
35
  "@types/jest": "^29.0.0",
36
+ "@types/react": "^18.0.0",
37
+ "@types/react-dom": "^18.0.0",
38
+ "@vitejs/plugin-react": "^4.0.0",
39
+ "jest": "^29.0.0",
38
40
  "jest-environment-jsdom": "^29.0.0",
39
41
  "react": "^18.0.0",
40
42
  "react-dom": "^18.0.0",
41
- "ts-jest": "^29.0.0"
43
+ "storybook": "^8.6.15",
44
+ "ts-jest": "^29.0.0",
45
+ "typedoc": "^0.28.0",
46
+ "typedoc-plugin-markdown": "^4.0.0",
47
+ "typescript": "~5.4.0",
48
+ "vite": "^5.0.0"
42
49
  },
43
50
  "scripts": {
44
51
  "build": "vite build && npx -p typescript tsc --emitDeclarationOnly && cp dist/ReactSpotWidget.d.ts dist/index.d.ts",
@@ -47,6 +54,8 @@
47
54
  "test": "jest --watchAll=false",
48
55
  "test:watch": "jest --watch",
49
56
  "test:coverage": "jest --coverage",
50
- "test:ci": "jest --ci --coverage --watchAll=false"
57
+ "test:ci": "jest --ci --coverage --watchAll=false",
58
+ "storybook": "storybook dev -p 6006",
59
+ "build-storybook": "storybook build"
51
60
  }
52
61
  }
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ReactSpotWidget.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ReactSpotWidget.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/ReactSpotWidget.test.tsx"],"names":[],"mappings":""}