@sledge-app/react-instant-search 2.0.70 → 2.0.72

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.
@@ -2886,6 +2886,7 @@ const Badge = (props) => {
2886
2886
  const [isRequiredLogin, setIsRequiredLogin] = React__default.useState(false);
2887
2887
  const [data, setData] = React__default.useState({});
2888
2888
  const [openFlyoutWishlistWidget, setOpenFlyoutWishlistWidget] = React__default.useState(false);
2889
+ const [shouldMountWidget, setShouldMountWidget] = React__default.useState(false);
2889
2890
  const { use_wishlist_flyout } = ((_b = dataSettings == null ? void 0 : dataSettings.display) == null ? void 0 : _b.widget) || {};
2890
2891
  const { floating_button_type } = (dataSettings == null ? void 0 : dataSettings.launch_point) || {};
2891
2892
  const { alert_login, alert, login_button, header_title: language_header_title, see_all_wishlist } = ((_c = dataSettings == null ? void 0 : dataSettings.languages) == null ? void 0 : _c.widget) || {};
@@ -2969,6 +2970,10 @@ const Badge = (props) => {
2969
2970
  triggerRenderWishlistBadge(false);
2970
2971
  handleGetWishlistInfo();
2971
2972
  }, [valueRenderWishlistBadge, isRenderAppWishlist]);
2973
+ React__default.useEffect(() => {
2974
+ if (openFlyoutWishlistWidget)
2975
+ setShouldMountWidget(true);
2976
+ }, [openFlyoutWishlistWidget]);
2972
2977
  const mainClassName = "sledge-wishlist__badge-wrapper";
2973
2978
  let productCardsComponent = null;
2974
2979
  if (React__default.Children.count(children)) {
@@ -3099,10 +3104,10 @@ const Badge = (props) => {
3099
3104
  ...sledgeAnonymId && !is_required_login ? {
3100
3105
  flyoutInfoContent: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { dangerouslySetInnerHTML: { __html: alert || "Please login to save your wishlist across devices." } })
3101
3106
  } : {},
3102
- content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-flyout-widget__wishlist-content", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(Widget.Root, { isFlyout: useWishlistFlyout, children: [
3107
+ content: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-flyout-widget__wishlist-content", children: shouldMountWidget ? /* @__PURE__ */ jsxRuntimeExports.jsxs(Widget.Root, { isFlyout: useWishlistFlyout, dataInfo: data, children: [
3103
3108
  /* @__PURE__ */ jsxRuntimeExports.jsx(CustomComponents, { productCard: productCardsComponent }),
3104
3109
  /* @__PURE__ */ jsxRuntimeExports.jsx(Widget.List, {})
3105
- ] }) }),
3110
+ ] }) : null }),
3106
3111
  footer: /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge-flyout-widget__wishlist-footer", children: /* @__PURE__ */ jsxRuntimeExports.jsx("a", { href: urlWishlistWidget, className: "sledge-flyout-widget__wishlist-see-all-button", children: /* @__PURE__ */ jsxRuntimeExports.jsx(Button, { type: "button", colorType: "success", fullWidth: true, children: see_all_wishlist || "See All Wishlist" }) }) }),
3107
3112
  open: openFlyoutWishlistWidget,
3108
3113
  setOpen: setOpenFlyoutWishlistWidget,
@@ -5834,8 +5839,16 @@ const FlyoutSidebar = ({ title, content, footer = null, open, setOpen, position
5834
5839
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__flyout-close-field-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx("button", { className: "sledge__flyout-close-field", type: "button", onClick: () => setOpen(false), children: /* @__PURE__ */ jsxRuntimeExports.jsx(CloseIcon, { width: 14, height: 14, color: "#393d4e" }) }) })
5835
5840
  ] }),
5836
5841
  flyoutInfoContent ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__flyout-mobile-info", children: flyoutInfoContent }) : null,
5837
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { ref: contentContainerRef, className: `sledge__flyout-mobile-content ${showBlurEffect ? "sledge__flyout-mobile-content-blur-effect" : ""}`, children: isLoading ? null : content }),
5838
- footer ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__flyout-mobile-footer", children: isLoading ? null : footer }) : null
5842
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
5843
+ "div",
5844
+ {
5845
+ ref: contentContainerRef,
5846
+ className: `sledge__flyout-mobile-content ${showBlurEffect ? "sledge__flyout-mobile-content-blur-effect" : ""}`,
5847
+ style: isLoading ? { display: "none" } : void 0,
5848
+ children: content
5849
+ }
5850
+ ),
5851
+ footer ? /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "sledge__flyout-mobile-footer", style: isLoading ? { display: "none" } : void 0, children: footer }) : null
5839
5852
  ] })
5840
5853
  ] }),
5841
5854
  document.body
@@ -9141,7 +9154,7 @@ const DesktopLayout = (props) => {
9141
9154
  );
9142
9155
  };
9143
9156
  const FilterFlyoutLayout = (props) => {
9144
- var _a, _b, _c, _d;
9157
+ var _a, _b, _c, _d, _e, _f;
9145
9158
  const {
9146
9159
  displaySettings,
9147
9160
  languageSettings,
@@ -9178,6 +9191,7 @@ const FilterFlyoutLayout = (props) => {
9178
9191
  searchAndSelectOption: searchAndSelectOptionSkeleton,
9179
9192
  productGrid: productGridSkeleton
9180
9193
  } = skeleton || {};
9194
+ const columnGridElement = ((_a = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _a.show_switch_view_option) ? /* @__PURE__ */ jsxRuntimeExports.jsx(ColumnGridSelectorWrapper, { children: columnGridSelector }) : null;
9181
9195
  return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9182
9196
  /* @__PURE__ */ jsxRuntimeExports.jsx(
9183
9197
  FlyoutSidebar,
@@ -9193,23 +9207,26 @@ const FilterFlyoutLayout = (props) => {
9193
9207
  ),
9194
9208
  /* @__PURE__ */ jsxRuntimeExports.jsx(ResultWrapper, { displaySettings, children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ResultData, { children: [
9195
9209
  /* @__PURE__ */ jsxRuntimeExports.jsx(ResultDataKeyword, { children: isFirstLoading ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9196
- ((_a = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a.show_total_products) ? summaryTextSkeleton : null,
9210
+ ((_b = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _b.show_total_products) ? summaryTextSkeleton : null,
9197
9211
  searchFieldSkeletonComponent,
9198
9212
  filterHorizontalSkeleton,
9199
9213
  selectOptionSkeletonComponent
9200
9214
  ] }) : /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
9201
- /* @__PURE__ */ jsxRuntimeExports.jsx(SummaryTextHorizontal, { children: summaryText }),
9202
- ((_b = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _b.show_switch_view_option) ? /* @__PURE__ */ jsxRuntimeExports.jsx(ColumnGridSelectorWrapper, { children: columnGridSelector }) : null,
9215
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(SummaryTextHorizontal, { children: [
9216
+ summaryText,
9217
+ ((_c = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _c.hide_search_bar) ? columnGridElement : null
9218
+ ] }),
9219
+ ((_d = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _d.hide_search_bar) ? null : columnGridElement,
9203
9220
  /* @__PURE__ */ jsxRuntimeExports.jsx(FilterHorizontalBlockMobile, { children: /* @__PURE__ */ jsxRuntimeExports.jsxs(ResultSearchFieldFlex, { children: [
9204
9221
  /* @__PURE__ */ jsxRuntimeExports.jsxs(Button, { type: "button", className: "sledge-instant-search__trigger-filter-flyout", onClick: () => setOpenFilterFlyout == null ? void 0 : setOpenFilterFlyout(true), children: [
9205
9222
  /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: language_filter || "Filter" }),
9206
9223
  /* @__PURE__ */ jsxRuntimeExports.jsx(FilterIcon, { width: 18, height: 18, color: "#393d4e" })
9207
9224
  ] }),
9208
- ((_c = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _c.hide_search_bar) ? null : searchField
9225
+ ((_e = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _e.hide_search_bar) ? null : searchField
9209
9226
  ] }) }),
9210
9227
  /* @__PURE__ */ jsxRuntimeExports.jsxs(SelectFieldWrapper, { children: [
9211
9228
  /* @__PURE__ */ jsxRuntimeExports.jsx(SelectFieldItem, { children: sort }),
9212
- ((_d = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _d.hide_limit_options) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(SelectFieldItem, { children: limit })
9229
+ ((_f = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _f.hide_limit_options) ? null : /* @__PURE__ */ jsxRuntimeExports.jsx(SelectFieldItem, { children: limit })
9213
9230
  ] })
9214
9231
  ] }) }),
9215
9232
  isLoading ? /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: productGridSkeleton }) : /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children: (searchResult == null ? void 0 : searchResult.length) ? /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
@@ -9344,7 +9361,7 @@ const StickyFilterButtonLayout = (props) => {
9344
9361
  ] });
9345
9362
  };
9346
9363
  const MobileLayout = (props) => {
9347
- var _a, _b, _c;
9364
+ var _a, _b, _c, _d;
9348
9365
  const { displaySettings } = props;
9349
9366
  const renderLayout = () => {
9350
9367
  var _a2;
@@ -9366,7 +9383,8 @@ const MobileLayout = (props) => {
9366
9383
  layout: (_a = displaySettings == null ? void 0 : displaySettings.filter) == null ? void 0 : _a.mobile_layout,
9367
9384
  additionalProps: {
9368
9385
  "data-hide-search-bar": (_b = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _b.hide_search_bar,
9369
- "data-hide-limit-options": (_c = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _c.hide_limit_options
9386
+ "data-hide-limit-options": (_c = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _c.hide_limit_options,
9387
+ "data-show-switch-view-option": (_d = displaySettings == null ? void 0 : displaySettings.search) == null ? void 0 : _d.show_switch_view_option
9370
9388
  },
9371
9389
  children: renderLayout()
9372
9390
  }