@getspot/spot-widget-react 4.0.2 → 4.0.3

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,10 @@
1
+ ## [4.0.3](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-react@4.0.2...@getspot/spot-widget-react@4.0.3) (2026-01-30)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * ability to add border color to spot component and logo ([2be9401](https://gitlab.com/getspot/spot-widget/commit/2be9401b60518b75dc89a1bbb4ece6d5fad0c902))
7
+
1
8
  ## [4.0.2](https://gitlab.com/getspot/spot-widget/compare/@getspot/spot-widget-react@4.0.1...@getspot/spot-widget-react@4.0.2) (2026-01-21)
2
9
 
3
10
 
@@ -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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AC,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,iGA0LnB,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.es.js CHANGED
@@ -1,7 +1,7 @@
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";
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 L, useEffect as P } from "react";
3
+ import T, { SelectionEnum as U } from "@getspot/spot-widget";
4
+ import { SelectionEnum as Z } 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,58 +11,59 @@ 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 U(c, u) {
14
+ function z(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 z = B(({
18
+ const F = H(({
19
19
  apiConfig: c,
20
20
  quoteRequestData: u,
21
21
  showTable: s = !0,
22
- selection: d = L.UNSELECTED,
22
+ selection: d = U.UNSELECTED,
23
23
  theme: f,
24
24
  callbacks: m = {},
25
25
  useMockData: v,
26
26
  mockData: R,
27
- onQuoteRetrieved: Q,
28
- onOptIn: k,
29
- onOptOut: h,
30
- onError: E,
31
- onNoMatchingQuote: S,
32
- onSelectionChange: C
33
- }, T) => {
27
+ logoPosition: Q,
28
+ onQuoteRetrieved: k,
29
+ onOptIn: h,
30
+ onOptOut: E,
31
+ onError: S,
32
+ onNoMatchingQuote: C,
33
+ onSelectionChange: w
34
+ }, A) => {
34
35
  const g = p(null), n = p(null), o = p({
35
- onQuoteRetrieved: Q,
36
- onOptIn: k,
37
- onOptOut: h,
38
- onError: E,
39
- onNoMatchingQuote: S,
40
- onSelectionChange: C
41
- }), w = p(m);
36
+ onQuoteRetrieved: k,
37
+ onOptIn: h,
38
+ onOptOut: E,
39
+ onError: S,
40
+ onNoMatchingQuote: C,
41
+ onSelectionChange: w
42
+ }), I = p(m);
42
43
  o.current = {
43
- onQuoteRetrieved: Q,
44
- onOptIn: k,
45
- onOptOut: h,
46
- onError: E,
47
- onNoMatchingQuote: S,
48
- onSelectionChange: C
49
- }, w.current = m;
50
- const I = O((e) => {
44
+ onQuoteRetrieved: k,
45
+ onOptIn: h,
46
+ onOptOut: E,
47
+ onError: S,
48
+ onNoMatchingQuote: C,
49
+ onSelectionChange: w
50
+ }, I.current = m;
51
+ const j = O((e) => {
51
52
  var t, r;
52
53
  return (r = (t = o.current).onQuoteRetrieved) == null ? void 0 : r.call(t, e);
53
- }, []), j = O((e) => {
54
+ }, []), q = O((e) => {
54
55
  var t, r, a, l;
55
56
  (r = (t = o.current).onOptIn) == null || r.call(t, e), (l = (a = o.current).onSelectionChange) == null || l.call(a, e);
56
- }, []), q = O((e) => {
57
+ }, []), M = O((e) => {
57
58
  var t, r, a, l;
58
59
  (r = (t = o.current).onOptOut) == null || r.call(t, e), (l = (a = o.current).onSelectionChange) == null || l.call(a, e);
59
- }, []), M = O((e) => {
60
+ }, []), D = O((e) => {
60
61
  var t, r;
61
62
  (r = (t = o.current).onError) == null || r.call(t, e);
62
- }, []), D = O((e) => {
63
+ }, []), N = O((e) => {
63
64
  var t, r;
64
65
  (r = (t = o.current).onNoMatchingQuote) == null || r.call(t, e);
65
- }, []), N = H(() => {
66
+ }, []), W = K(() => {
66
67
  const e = {}, t = [
67
68
  "onQuoteRetrieved",
68
69
  "onOptIn",
@@ -72,29 +73,30 @@ const z = B(({
72
73
  ];
73
74
  for (const r of t)
74
75
  e[r] = (...a) => {
75
- var W;
76
- const l = (W = w.current) == null ? void 0 : W[r];
76
+ var x;
77
+ const l = (x = I.current) == null ? void 0 : x[r];
77
78
  if (l) return l(...a);
78
79
  };
79
80
  return {
80
81
  ...e,
81
- ...o.current.onQuoteRetrieved && { onQuoteRetrieved: I },
82
- ...o.current.onOptIn && { onOptIn: j },
83
- ...o.current.onOptOut && { onOptOut: q },
84
- ...o.current.onError && { onError: M },
85
- ...o.current.onNoMatchingQuote && { noMatchingQuote: D }
82
+ ...o.current.onQuoteRetrieved && { onQuoteRetrieved: j },
83
+ ...o.current.onOptIn && { onOptIn: q },
84
+ ...o.current.onOptOut && { onOptOut: M },
85
+ ...o.current.onError && { onError: D },
86
+ ...o.current.onNoMatchingQuote && { noMatchingQuote: N }
86
87
  };
87
- }, [I, j, q, M, D]), b = U(() => ({
88
+ }, [j, q, M, D, N]), b = z(() => ({
88
89
  apiConfig: c,
89
90
  quoteRequestData: u,
90
91
  showTable: s,
91
92
  selection: d,
92
93
  theme: f,
93
- callbacks: N,
94
+ callbacks: W,
94
95
  useMockData: v,
95
- mockData: R
96
- }), [c, u, s, d, f, N, v, R]);
97
- K(T, () => ({
96
+ mockData: R,
97
+ logoPosition: Q
98
+ }), [c, u, s, d, f, W, v, R, Q]);
99
+ L(A, () => ({
98
100
  updateQuote: (e) => {
99
101
  var t;
100
102
  return ((t = n.current) == null ? void 0 : t.updateQuote(e)) ?? Promise.resolve(!1);
@@ -112,23 +114,23 @@ const z = B(({
112
114
  }
113
115
  }));
114
116
  const y = p(void 0);
115
- return x(() => (g.current && !n.current && (n.current = new P({
117
+ return P(() => (g.current && !n.current && (n.current = new T({
116
118
  location: g.current,
117
119
  ...b
118
120
  }), y.current = b), () => {
119
121
  n.current && (n.current.destroy(), n.current = null);
120
- }), []), x(() => {
122
+ }), []), P(() => {
121
123
  if (n.current && y.current) {
122
124
  const e = y.current, t = b;
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({
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 T({
124
126
  location: g.current,
125
127
  ...t
126
128
  })), y.current = t;
127
129
  }
128
- }, [b]), /* @__PURE__ */ A("div", { ref: g });
130
+ }, [b]), /* @__PURE__ */ B("div", { ref: g });
129
131
  });
130
- z.displayName = "ReactSpotWidget";
132
+ F.displayName = "ReactSpotWidget";
131
133
  export {
132
- Y as SelectionEnum,
133
- z as default
134
+ Z as SelectionEnum,
135
+ F as default
134
136
  };
package/dist/index.umd.js CHANGED
@@ -1 +1 @@
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"}})});
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 A(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,logoPosition:E,onQuoteRetrieved:Q,onOptIn:S,onOptOut:j,onError:q,onNoMatchingQuote:w,onSelectionChange:M},B)=>{const y=r.useRef(null),u=r.useRef(null),o=r.useRef({onQuoteRetrieved:Q,onOptIn:S,onOptOut:j,onError:q,onNoMatchingQuote:w,onSelectionChange:M}),I=r.useRef(m);o.current={onQuoteRetrieved:Q,onOptIn:S,onOptOut:j,onError:q,onNoMatchingQuote:w,onSelectionChange:M},I.current=m;const T=r.useCallback(e=>{var t,n;return(n=(t=o.current).onQuoteRetrieved)==null?void 0:n.call(t,e)},[]),x=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)},[]),N=r.useCallback(e=>{var t,n;(n=(t=o.current).onError)==null||n.call(t,e)},[]),P=r.useCallback(e=>{var t,n;(n=(t=o.current).onNoMatchingQuote)==null||n.call(t,e)},[]),W=r.useMemo(()=>{const e={},t=["onQuoteRetrieved","onOptIn","onOptOut","onError","noMatchingQuote"];for(const n of t)e[n]=(...d)=>{var _;const f=(_=I.current)==null?void 0:_[n];if(f)return f(...d)};return{...e,...o.current.onQuoteRetrieved&&{onQuoteRetrieved:T},...o.current.onOptIn&&{onOptIn:x},...o.current.onOptOut&&{onOptOut:D},...o.current.onError&&{onError:N},...o.current.onNoMatchingQuote&&{noMatchingQuote:P}}},[T,x,D,N,P]),g=A(()=>({apiConfig:l,quoteRequestData:c,showTable:i,selection:O,theme:p,callbacks:W,useMockData:h,mockData:C,logoPosition:E}),[l,c,i,O,p,W,h,C,E]);r.useImperativeHandle(B,()=>({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(()=>(y.current&&!u.current&&(u.current=new R({location:y.current,...g}),v.current=g),()=>{u.current&&(u.current.destroy(),u.current=null)}),[]),r.useEffect(()=>{if(u.current&&v.current){const e=v.current,t=g;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:y.current,...t})),v.current=t}},[g]),b.jsx("div",{ref:y})});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": "4.0.2",
3
+ "version": "4.0.3",
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.0.2"
17
+ "@getspot/spot-widget": "^4.0.3"
18
18
  },
19
19
  "peerDependencies": {
20
20
  "@types/react": ">=18.0.0",