@sledge-app/react-instant-search 0.0.122 → 0.0.124

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.
@@ -129,7 +129,7 @@ const PAYLOAD_API_ALIASES = {
129
129
  DELETE: "pLC93Tvsu6g7H"
130
130
  };
131
131
  async function swr(url, options) {
132
- if (typeof caches !== "undefined" && options.method === "GET") {
132
+ if (typeof localStorage !== "undefined" && typeof caches !== "undefined" && options.method === "GET") {
133
133
  const data = await getData(url);
134
134
  return await data.json();
135
135
  } else
@@ -154,6 +154,13 @@ async function getData(url) {
154
154
  });
155
155
  });
156
156
  }
157
+ const usePrevious = (value) => {
158
+ const ref = React__default.useRef();
159
+ React__default.useEffect(() => {
160
+ ref.current = value;
161
+ });
162
+ return ref.current;
163
+ };
157
164
  const sanitizeDataId = (id) => {
158
165
  if (!id)
159
166
  return "";
@@ -1680,13 +1687,6 @@ WidgetHeader$1.ShareTrigger = WidgetHeaderShareTrigger;
1680
1687
  WidgetHeader$1.ClearTrigger = WidgetHeaderClearTrigger;
1681
1688
  WidgetHeader$1.Sort = WidgetHeaderSort$1;
1682
1689
  WidgetHeader$1.Limit = WidgetHeaderLimit;
1683
- const usePrevious = (value) => {
1684
- const ref = React__default.useRef();
1685
- React__default.useEffect(() => {
1686
- ref.current = value;
1687
- });
1688
- return ref.current;
1689
- };
1690
1690
  const getReviewInfo = async (id) => {
1691
1691
  let convertId = sanitizeDataId(id);
1692
1692
  let sledgeAuthApp = typeof localStorage !== "undefined" ? localStorage.getItem(LOCAL_STORAGE_KEY.AUTH_APP) || "" : "";
@@ -1728,7 +1728,10 @@ const Rating = (props) => {
1728
1728
  const [isFirstLoading, setIsFirstLoading] = React__default.useState(initLoading);
1729
1729
  const [isLoading, setIsLoading] = React__default.useState(initLoading);
1730
1730
  const [sizing, setSizing] = React__default.useState(
1731
- propsData || typeof total !== "undefined" || typeof average !== "undefined" ? getSizing(size) : {
1731
+ propsData || typeof total !== "undefined" || typeof average !== "undefined" ? size && typeof size === "string" ? getSizing(size) : {
1732
+ width: size == null ? void 0 : size.width,
1733
+ height: size == null ? void 0 : size.height
1734
+ } : {
1732
1735
  width: 0,
1733
1736
  height: 0
1734
1737
  }
@@ -1738,7 +1741,7 @@ const Rating = (props) => {
1738
1741
  const [dataSettings, setDataSettings] = React__default.useState((sledgeSettings == null ? void 0 : sledgeSettings.review) || {});
1739
1742
  const [isFirstTime, setIsFirstTime] = React__default.useState(true);
1740
1743
  const previousState = usePrevious({ productId });
1741
- const { fill_color, outline_color } = ((_c = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _c.rating) || {};
1744
+ const { fill_color = "#23BC45", outline_color = "#8D9196" } = ((_c = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _c.rating) || {};
1742
1745
  const handleProductRatingInfo = async (paramsProductId, isTriggerMultiComponent = false) => {
1743
1746
  var _a2;
1744
1747
  if (paramsProductId !== productId)
@@ -1803,18 +1806,18 @@ const Rating = (props) => {
1803
1806
  return;
1804
1807
  if (size === "xs") {
1805
1808
  setSizing({
1806
- width: 14.4,
1807
- height: 14.4
1809
+ width: 14,
1810
+ height: 14
1808
1811
  });
1809
1812
  } else if (size === "sm") {
1810
1813
  setSizing({
1811
- width: 18,
1812
- height: 18
1814
+ width: 20,
1815
+ height: 20
1813
1816
  });
1814
- } else {
1817
+ } else if (size === "md") {
1815
1818
  setSizing({
1816
- width: 28.8,
1817
- height: 28.8
1819
+ width: 32,
1820
+ height: 32
1818
1821
  });
1819
1822
  }
1820
1823
  let isProductIdChanged = Boolean(previousState && (previousState == null ? void 0 : previousState.productId) !== productId);
@@ -1830,25 +1833,27 @@ const Rating = (props) => {
1830
1833
  setIsFirstLoading(true);
1831
1834
  handleProductRatingInfo(valueRenderProductReviewRating, true);
1832
1835
  }, [productId, valueRenderProductReviewRating]);
1833
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__rating", onClick: handleOnClick, children: isFirstLoading && withSkeletonLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "230px", height: "28px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1836
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-product-review__rating", onClick: handleOnClick, "data-rating-size": size, children: isFirstLoading && withSkeletonLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "230px", height: "28px", color: "lighten", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
1834
1837
  /* @__PURE__ */ jsxRuntimeExports.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", style: { display: "none" }, id: "sledge-product-review-rating-icon-svg-store", children: [
1835
- /* @__PURE__ */ jsxRuntimeExports.jsx("symbol", { id: "sledge-product-review-icons-rating-icon-fill", viewBox: "0 0 30 29", fill: fill_color || "#43c6ac", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1838
+ /* @__PURE__ */ jsxRuntimeExports.jsx("symbol", { viewBox: "0 0 20 20", fill: "none", xmlns: "http://www.w3.org/2000/svg", id: "sledge-product-review-icons-rating-icon-fill", children: /* @__PURE__ */ jsxRuntimeExports.jsx("g", { id: "favorite_major", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1836
1839
  "path",
1837
1840
  {
1841
+ id: "Primary fill",
1838
1842
  fillRule: "evenodd",
1839
1843
  clipRule: "evenodd",
1840
- d: "M7.00014 17.7L1.20174 12.9C0.107339 12.0248 0.587339 10.2648 1.97614 10.0664L10.2001 9.69998L13.7121 0.895176C13.9569 0.407176 14.4545 0.0999756 15.0001 0.0999756C15.5457 0.0999756 16.0433 0.408776 16.2881 0.895176L19.8001 9.69998L28.0241 10.0664C29.4129 10.2648 29.8929 12.0248 28.7985 12.9L23.0001 17.7L24.5825 27.0712C24.7649 28.3496 23.4369 29.3064 22.2833 28.7288L15.0001 24.1L7.71694 28.7272C6.56174 29.3048 5.23534 28.348 5.41774 27.0696L7.00014 17.7Z"
1844
+ d: "M5.00009 12L1.37609 9C0.692087 8.453 0.992087 7.353 1.86009 7.229L7.00009 7L9.19509 1.497C9.34809 1.192 9.65909 1 10.0001 1C10.3411 1 10.6521 1.193 10.8051 1.497L13.0001 7L18.1401 7.229C19.0081 7.353 19.3081 8.453 18.6241 9L15.0001 12L15.9891 17.857C16.1031 18.656 15.2731 19.254 14.5521 18.893L10.0001 16L5.44809 18.892C4.72609 19.253 3.89709 18.655 4.01109 17.856L5.00009 12Z",
1845
+ fill: fill_color
1841
1846
  }
1842
- ) }),
1843
- /* @__PURE__ */ jsxRuntimeExports.jsx("symbol", { id: "sledge-product-review-icons-rating-icon-line", viewBox: "0 0 30 29", stroke: outline_color || "#8D9196", fill: "none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1847
+ ) }) }),
1848
+ /* @__PURE__ */ jsxRuntimeExports.jsx("symbol", { viewBox: "0 0 33 33", fill: "none", xmlns: "http://www.w3.org/2000/svg", id: "sledge-product-review-icons-rating-icon-line", children: /* @__PURE__ */ jsxRuntimeExports.jsx("g", { id: "favorite_major", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
1844
1849
  "path",
1845
1850
  {
1846
- fillRule: "evenodd",
1847
- clipRule: "evenodd",
1848
- d: "M7.00014 17.7L1.20174 12.9C0.107339 12.0248 0.587339 10.2648 1.97614 10.0664L10.2001 9.69998L13.7121 0.895176C13.9569 0.407176 14.4545 0.0999756 15.0001 0.0999756C15.5457 0.0999756 16.0433 0.408776 16.2881 0.895176L19.8001 9.69998L28.0241 10.0664C29.4129 10.2648 29.8929 12.0248 28.7985 12.9L23.0001 17.7L24.5825 27.0712C24.7649 28.3496 23.4369 29.3064 22.2833 28.7288L15.0001 24.1L7.71694 28.7272C6.56174 29.3048 5.23534 28.348 5.41774 27.0696L7.00014 17.7Z",
1851
+ id: "Primary fill",
1852
+ d: "M9.18817 19.8162L9.25542 19.4179L8.94431 19.1604L3.14591 14.3604L3.14598 14.3603L3.13673 14.3529C2.5294 13.8672 2.784 12.8955 3.54372 12.7636L11.7291 12.3989L12.1807 12.3788L12.3481 11.959L15.8472 3.18648C15.977 2.94796 16.2257 2.79961 16.4979 2.79961C16.769 2.79961 17.0185 2.94848 17.1489 3.18698L20.6478 11.959L20.8152 12.3788L21.2668 12.3989L29.4522 12.7636C30.2119 12.8955 30.4665 13.8672 29.8592 14.3529L29.8591 14.3528L29.85 14.3604L24.0516 19.1604L23.7405 19.4179L23.8077 19.8162L25.3884 29.1774C25.4834 29.8833 24.7613 30.4104 24.1224 30.1159L16.8734 25.5088L16.498 25.2702L16.1226 25.5088L8.87373 30.1141C8.23317 30.409 7.51248 29.8817 7.60746 29.1758L9.18817 19.8162Z",
1853
+ stroke: outline_color,
1849
1854
  strokeWidth: "1.4"
1850
1855
  }
1851
- ) }),
1856
+ ) }) }),
1852
1857
  /* @__PURE__ */ jsxRuntimeExports.jsx("defs", { children: /* @__PURE__ */ jsxRuntimeExports.jsxs("g", { id: "sledge-product-review-icons-rating-icon", children: [
1853
1858
  /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#sledge-product-review-icons-rating-icon-line", className: "sledge-product-review__rating-icon-line" }),
1854
1859
  /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#sledge-product-review-icons-rating-icon-fill", className: "sledge-product-review__rating-icon-fill" })
@@ -1865,7 +1870,7 @@ const Rating = (props) => {
1865
1870
  if (item > ratingValue && ratingValue + 1 === item) {
1866
1871
  fillOther = `fill-${commaValue}`;
1867
1872
  }
1868
- return /* @__PURE__ */ createElement("svg", { ...sizing, viewBox: "0 0 30 29", "data-product-review-rating-fill": item <= ratingValue ? "full" : fillOther, key: index }, /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#sledge-product-review-icons-rating-icon" }));
1873
+ return /* @__PURE__ */ createElement("svg", { ...sizing, viewBox: "0 0 33 33", "data-product-review-rating-fill": item <= ratingValue ? "full" : fillOther, key: index }, /* @__PURE__ */ jsxRuntimeExports.jsx("use", { href: "#sledge-product-review-icons-rating-icon" }));
1869
1874
  }),
1870
1875
  withTotal ? /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-product-review__rating-summary-total", children: [
1871
1876
  "(",
@@ -2061,8 +2066,7 @@ const WidgetHeaderSummary = (props) => {
2061
2066
  ) }),
2062
2067
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "sledge-product-review__widget-summary-total", children: [
2063
2068
  totalReview,
2064
- " ",
2065
- totalReview > 1 ? review_plural || "Reviews" : review_singular || "Review"
2069
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-product-review__widget-summary-total-desc", children: totalReview > 1 ? review_plural || "Reviews" : review_singular || "Review" })
2066
2070
  ] }),
2067
2071
  /* @__PURE__ */ jsxRuntimeExports.jsx(motion.div, { variants: ROTATE_FILTER_ARROW_ANIMATION, className: "summary-trigger-icon", children: /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: 20, height: 20, viewBox: "0 0 15 15", fill: "none", xmlns: "http://www.w3.org/2000/svg", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
2068
2072
  "path",