@sledge-app/react-instant-search 0.0.65 → 0.0.67

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.
@@ -816,7 +816,7 @@ const WidgetHeaderClearTrigger = ({ buttonText, shareId, dataSettings, isFirstLo
816
816
  onSubmit: window.sledgeWishlistWidgetClearList || {}
817
817
  });
818
818
  };
819
- return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !shareId && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "132px", height: "46px", color: "grey-100", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", colorType: "danger", onClick: handleClick, style: display_button_clear_all_style, children: button_clear_all ? button_clear_all : buttonText || "Clear Wishlist" }) }) }) }) });
819
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !isRequiredLogin && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: !shareId && /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(SkeletonLoading.Item, { width: "132px", height: "46px", color: "grey-100", rounded: "md" }) : /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", colorType: "danger", onClick: handleClick, style: display_button_clear_all_style, children: buttonText ? buttonText : button_clear_all || "Clear Wishlist" }) }) }) }) });
820
820
  };
821
821
  const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger, shareLink, shareId, dataSettings, isFirstLoading }) => {
822
822
  var _a, _b, _c, _d, _e, _f;
@@ -968,7 +968,7 @@ const WidgetHeaderShareTrigger = ({ wishlistData, buttonText, showShareTrigger,
968
968
  children: shareId ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
969
969
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "sledge-wishlist__badge-counter sledge-wishlist__badge-counter-top-right", children: wishlistData.length }),
970
970
  isLoadingBulkAdd ? "Adding..." : "Add to your wishlist"
971
- ] }) : button_share ? button_share : buttonText || "Share Wishlist"
971
+ ] }) : buttonText ? buttonText : button_share || "Share Wishlist"
972
972
  }
973
973
  ) }) }) }) });
974
974
  };
@@ -996,7 +996,7 @@ const WidgetHeaderSearchForm = ({ setIsLoading, setKeyword, keyword, placeholder
996
996
  {
997
997
  type: "text",
998
998
  icon: /* @__PURE__ */ jsxRuntimeExports.jsx(SearchIcon, { width: 18, height: 18, color: "#868686" }),
999
- placeholder: search_form_placeholder ? search_form_placeholder : placeholder || "Search product...",
999
+ placeholder: placeholder ? placeholder : search_form_placeholder || "Search product...",
1000
1000
  value: keyword,
1001
1001
  fieldRef: searchFieldRef,
1002
1002
  onChange: ({ value }) => handleChangeField(value),
@@ -1021,7 +1021,7 @@ const WidgetHeaderTitle = ({ text, dataSettings }) => {
1021
1021
  ...display_header_title_font_weight && { fontWeight: display_header_title_font_weight },
1022
1022
  ...display_header_title_text_transform && { textTransform: display_header_title_text_transform }
1023
1023
  };
1024
- return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { style: display_header_title_style, children: language_header_title ? language_header_title : text || "My Wishlist" }) });
1024
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-wishlist__widget-header-item", children: /* @__PURE__ */ jsxRuntimeExports.jsx("h1", { style: display_header_title_style, children: text ? text : language_header_title || "My Wishlist" }) });
1025
1025
  };
1026
1026
  const WidgetHeaderLimit = ({ options, defaultLimitOptions, selectedLimit, setSelectedLimit, setIsRefreshWidgetList, dataSettings }) => {
1027
1027
  var _a;
@@ -1158,7 +1158,7 @@ const getReviewInfo = async (id) => {
1158
1158
  };
1159
1159
  const Rating = (props) => {
1160
1160
  var _a;
1161
- const { value, size = "md", data, withSkeletonLoading = true, isScrollToElementWidget = true } = props;
1161
+ const { value, size = "md", data, withSkeletonLoading = true, isScrollToElementWidget = true, defaultData } = props;
1162
1162
  const { productId } = data || {};
1163
1163
  const { isRenderApp, triggerRenderMultipleComponent } = React__default.useContext(SledgeContext);
1164
1164
  const [isFirstLoading, setIsFirstLoading] = React__default.useState(true);
@@ -1178,12 +1178,19 @@ const Rating = (props) => {
1178
1178
  let run = false;
1179
1179
  let valueTotalReview = 0;
1180
1180
  let valueAverageReview;
1181
- response = await getReviewInfo(validateProductId);
1182
- if (!response)
1183
- return;
1184
- const { status, data: data2 } = response;
1185
- const { code } = status;
1186
- run = code === 200 || false;
1181
+ let data2;
1182
+ if (!defaultData) {
1183
+ response = await getReviewInfo(validateProductId);
1184
+ if (!response)
1185
+ return;
1186
+ const { status } = response;
1187
+ data2 = response.data;
1188
+ const { code } = status;
1189
+ run = code === 200 || false;
1190
+ } else {
1191
+ data2 = defaultData;
1192
+ run = true;
1193
+ }
1187
1194
  valueTotalReview = (data2 == null ? void 0 : data2.review_count) ? data2.review_count : 0;
1188
1195
  valueAverageReview = ((_a2 = data2 == null ? void 0 : data2.rating) == null ? void 0 : _a2.average) ? data2.rating.average : 0;
1189
1196
  if (run) {
@@ -1409,7 +1416,7 @@ const VISIBLE_ANIMATION = {
1409
1416
  };
1410
1417
  const WidgetHeaderSummary = (props) => {
1411
1418
  var _a, _b, _c;
1412
- const { data, dataSettings } = props;
1419
+ const { data, dataSettings, defaultData } = props;
1413
1420
  const { productId } = data || {};
1414
1421
  const { fill_color: display_summary_bar_fill_color, outline_color: display_summary_bar_outline_color } = ((_b = (_a = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _a.widget) == null ? void 0 : _b.summary_bar) || {};
1415
1422
  const { review_singular, review_plural } = ((_c = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _c.widget) || {};
@@ -1431,16 +1438,23 @@ const WidgetHeaderSummary = (props) => {
1431
1438
  const handleProductReviewInfo = async () => {
1432
1439
  var _a2;
1433
1440
  let response;
1441
+ let data2;
1434
1442
  let run = false;
1435
1443
  let valueTotalReview = 0;
1436
1444
  let valueRatingList;
1437
1445
  let valueAverageReview;
1438
- response = await getReviewInfo(productId);
1439
- if (!response)
1440
- return;
1441
- const { status, data: data2 } = response;
1442
- const { code } = status;
1443
- run = code === 200 || false;
1446
+ if (!defaultData) {
1447
+ response = await getReviewInfo(productId);
1448
+ if (!response)
1449
+ return;
1450
+ const { status } = response;
1451
+ const { code } = status;
1452
+ data2 = response.data;
1453
+ run = code === 200 || false;
1454
+ } else {
1455
+ data2 = defaultData;
1456
+ run = true;
1457
+ }
1444
1458
  valueTotalReview = (data2 == null ? void 0 : data2.review_count) ? data2.review_count : 0;
1445
1459
  valueRatingList = (data2 == null ? void 0 : data2.rating) ? {
1446
1460
  5: data2.rating["5"] || 0,
@@ -2480,6 +2494,7 @@ const SearchIconWidgetPopup = () => {
2480
2494
  };
2481
2495
  }
2482
2496
  handleSettings(localStorage.getItem(LOCAL_STORAGE_KEY.INSTANT_SEARCH_SETTING) || "");
2497
+ showInfo ? document.body.classList.add("sledge__open-popup-state") : document.body.classList.remove("sledge__open-popup-state");
2483
2498
  }, [showInfo]);
2484
2499
  React__default.useEffect(() => {
2485
2500
  if (Boolean(previousState && (previousState == null ? void 0 : previousState.keyword) !== keyword)) {