@sledge-app/react-instant-search 0.0.48 → 0.0.49

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.
@@ -2,9 +2,9 @@ import { j as jsxRuntimeExports, $ as $cb5cc270b50c6fcd$export$be92b6f5f03c0fe9,
2
2
  import React__default, { createElement } from "react";
3
3
  import { SledgeContext } from "@sledge-app/core";
4
4
  import "react-dom";
5
- const ProductFilterWidget = React__default.memo((props) => {
5
+ const ProductFilterWidget = (props) => {
6
6
  return /* @__PURE__ */ jsxRuntimeExports.jsx(SearchResultWidget, { layoutType: "product-filter", ...props });
7
- });
7
+ };
8
8
  const API_URL = "https://sledge-api-preprod.offstack.io";
9
9
  const INSTANT_SEARCH_ENGINE_URL = "https://instant-search-engine.offstack.io";
10
10
  const LOCAL_STORAGE_KEY = {
@@ -629,7 +629,7 @@ const addToCartTrigger$1 = async (data) => {
629
629
  };
630
630
  const ButtonDetail = "";
631
631
  const Trigger$1 = "";
632
- const Trigger = React__default.memo((props) => {
632
+ const Trigger = (props) => {
633
633
  var _a, _b, _c;
634
634
  const { data, forceActive = false, hidden = false, onAfterAddWishlist, onAfterRemoveWishlist } = props;
635
635
  const { productId, productVariantId } = data || {};
@@ -733,7 +733,7 @@ const Trigger = React__default.memo((props) => {
733
733
  setIsLoading(false);
734
734
  }
735
735
  };
736
- React__default.useEffect(() => {
736
+ React__default.useMemo(() => {
737
737
  if (!(isRenderApp == null ? void 0 : isRenderApp.wishlist))
738
738
  return;
739
739
  if (typeof window !== "undefined") {
@@ -779,7 +779,7 @@ const Trigger = React__default.memo((props) => {
779
779
  children: /* @__PURE__ */ jsxRuntimeExports.jsx(HeartIcon, { width: 16.67, height: 15.83, type: typeIcon, color: colorIcon })
780
780
  }
781
781
  ) }) });
782
- });
782
+ };
783
783
  const Widget$1 = "";
784
784
  const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLoading }) => {
785
785
  var _a, _b, _c, _d, _e;
@@ -1170,7 +1170,7 @@ const getReviewInfo = async (id) => {
1170
1170
  return;
1171
1171
  });
1172
1172
  };
1173
- const Rating = React__default.memo((props) => {
1173
+ const Rating = (props) => {
1174
1174
  var _a;
1175
1175
  const { value, size = "md", data, withSkeletonLoading = true, isScrollToElementWidget = true } = props;
1176
1176
  const { productId } = data || {};
@@ -1302,7 +1302,7 @@ const Rating = React__default.memo((props) => {
1302
1302
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, {})
1303
1303
  ] })
1304
1304
  ] }) });
1305
- });
1305
+ };
1306
1306
  const Widget = "";
1307
1307
  const WidgetHeaderAddTrigger = ({ isFirstLoading, text, dataSettings, data, onAfterAddReview }) => {
1308
1308
  var _a, _b, _c;
@@ -2241,7 +2241,7 @@ const SearchIconWidget = (props) => {
2241
2241
  width: 0,
2242
2242
  height: 0
2243
2243
  });
2244
- React__default.useEffect(() => {
2244
+ React__default.useMemo(() => {
2245
2245
  if (!(isRenderApp == null ? void 0 : isRenderApp.instantSearch))
2246
2246
  return;
2247
2247
  if (size === "xs") {
@@ -2640,7 +2640,7 @@ const SearchIconWidgetPopup = () => {
2640
2640
  ] }) });
2641
2641
  };
2642
2642
  const SearchResultWidget$1 = "";
2643
- const SearchResultWidget = React__default.memo((props) => {
2643
+ const SearchResultWidget = (props) => {
2644
2644
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
2645
2645
  const { isRenderApp, isJsVersion } = React__default.useContext(SledgeContext);
2646
2646
  const { layoutType = "default", query, data, children, onAfterAddToCart, onAfterAddWishlist, onAfterRemoveWishlist, onAfterRenderProduct } = props;
@@ -2803,12 +2803,11 @@ const SearchResultWidget = React__default.memo((props) => {
2803
2803
  await handleInitStates(data2, "totalDataPerIndex");
2804
2804
  }
2805
2805
  };
2806
- React__default.useEffect(() => {
2806
+ React__default.useMemo(() => {
2807
2807
  if (!(isRenderApp == null ? void 0 : isRenderApp.instantSearch))
2808
2808
  return;
2809
2809
  const searchParams = new URLSearchParams(document.location.search);
2810
2810
  setKeyword((searchParams == null ? void 0 : searchParams.get(queryKeyword)) || "");
2811
- console.log("re render");
2812
2811
  handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");
2813
2812
  }, [isRenderApp]);
2814
2813
  React__default.useEffect(() => {
@@ -3133,8 +3132,8 @@ const SearchResultWidget = React__default.memo((props) => {
3133
3132
  searchResultContainerRef
3134
3133
  })
3135
3134
  ] });
3136
- });
3137
- const ResultProduct = React__default.memo((props) => {
3135
+ };
3136
+ const ResultProduct = (props) => {
3138
3137
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t;
3139
3138
  const {
3140
3139
  keyword,
@@ -3781,8 +3780,8 @@ const ResultProduct = React__default.memo((props) => {
3781
3780
  ] })
3782
3781
  ] }) })
3783
3782
  ] });
3784
- });
3785
- const ResultCategory = React__default.memo((props) => {
3783
+ };
3784
+ const ResultCategory = (props) => {
3786
3785
  var _a, _b, _c, _d;
3787
3786
  const { keyword, clickedTabIndexId, clickedTabIndexName, setKeyword, searchResultContainerRef } = props || {};
3788
3787
  const [isFirstLoading, setIsFirstLoading] = React__default.useState(true);
@@ -3902,8 +3901,8 @@ const ResultCategory = React__default.memo((props) => {
3902
3901
  /* @__PURE__ */ jsxRuntimeExports.jsx(Pagination, { currentPage, totalPage, totalResult: totalSearchResult, onChange: (page) => handlePageChange(page) })
3903
3902
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsx(ResultEmpty, {})
3904
3903
  ] }) }) });
3905
- });
3906
- const ResultEmpty = React__default.memo((props) => {
3904
+ };
3905
+ const ResultEmpty = (props) => {
3907
3906
  const [title, setTitle] = React__default.useState("");
3908
3907
  const [description, setDescription] = React__default.useState("");
3909
3908
  React__default.useEffect(() => {
@@ -3914,7 +3913,7 @@ const ResultEmpty = React__default.memo((props) => {
3914
3913
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-empty-title", dangerouslySetInnerHTML: { __html: title } }),
3915
3914
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-instant-search__result-empty-description", dangerouslySetInnerHTML: { __html: description } })
3916
3915
  ] });
3917
- });
3916
+ };
3918
3917
  const SearchWidget$1 = "";
3919
3918
  const SearchWidget = (props) => {
3920
3919
  var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u;
@@ -4033,7 +4032,7 @@ const SearchWidget = (props) => {
4033
4032
  await handleMultiSearch(data);
4034
4033
  }
4035
4034
  };
4036
- React__default.useEffect(() => {
4035
+ React__default.useMemo(() => {
4037
4036
  if (!(isRenderApp == null ? void 0 : isRenderApp.instantSearch))
4038
4037
  return;
4039
4038
  handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");