@bonlineza/luxity-lib 2.38.0 → 2.38.2

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/build/bundle.js CHANGED
@@ -1565,10 +1565,10 @@
1565
1565
  var relativeInlineStyle = styled.css(_templateObject$i || (_templateObject$i = _taggedTemplateLiteral(["\n position: relative;\n"])));
1566
1566
  var topMiddleBodyStyle = styled.css(_templateObject2$1 || (_templateObject2$1 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 1;\n bottom: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])));
1567
1567
  var getTopMiddleArrowAfterStyle = function getTopMiddleArrowAfterStyle(props) {
1568
- return styled.css(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n /*Bottom Arrow*/\n top: 100%; /* At the bottom of the tooltip */\n left: calc(50% - ", ");\n border-width: ", ";\n border-style: solid;\n border-color: ", " transparent transparent transparent;\n"])), props.apexWidth, props.apexWidth, props.theme.colors.base);
1568
+ return styled.css(_templateObject3$1 || (_templateObject3$1 = _taggedTemplateLiteral(["\n /*Bottom Arrow*/\n top: 100%; /* At the bottom of the tooltip */\n left: calc(50% - ", ");\n border-width: ", ";\n border-style: solid;\n border-color: ", " transparent transparent transparent;\n"])), props.$apexWidth, props.$apexWidth, props.theme.colors.base);
1569
1569
  };
1570
1570
  var getBottomMiddleBodyStyle = function getBottomMiddleBodyStyle(props) {
1571
- return styled.css(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props.bodyWidth);
1571
+ return styled.css(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props.$bodyWidth);
1572
1572
  };
1573
1573
  var getBottomMiddleArrowAfterStyle = function getBottomMiddleArrowAfterStyle(props) {
1574
1574
  return styled.css(_templateObject5 || (_templateObject5 = _taggedTemplateLiteral(["\n /*Top Arrow*/\n bottom: 100%; /* At the top of the tooltip */\n top: initial;\n left: 50%;\n border-style: solid;\n border-color: transparent transparent ", " transparent;\n"])), props.theme.colors.base);
@@ -1578,10 +1578,10 @@
1578
1578
 
1579
1579
  var getBodyStyle = function getBodyStyle() {
1580
1580
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1581
- var _props$toolTipPositio = props.toolTipPosition,
1582
- toolTipPosition = _props$toolTipPositio === void 0 ? '' : _props$toolTipPositio;
1581
+ var _props$$toolTipPositi = props.$toolTipPosition,
1582
+ $toolTipPosition = _props$$toolTipPositi === void 0 ? '' : _props$$toolTipPositi;
1583
1583
 
1584
- switch (toolTipPosition) {
1584
+ switch ($toolTipPosition) {
1585
1585
  case 'top':
1586
1586
  return topMiddleBodyStyle;
1587
1587
 
@@ -1595,9 +1595,9 @@
1595
1595
 
1596
1596
  var getAfterStyling = function getAfterStyling() {
1597
1597
  var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
1598
- var toolTipPosition = props.toolTipPosition;
1598
+ var $toolTipPosition = props.$toolTipPosition;
1599
1599
 
1600
- switch (toolTipPosition) {
1600
+ switch ($toolTipPosition) {
1601
1601
  case 'top':
1602
1602
  return getTopMiddleArrowAfterStyle(props);
1603
1603
 
@@ -1610,7 +1610,7 @@
1610
1610
  };
1611
1611
 
1612
1612
  var Body$1 = styled__default.span(_templateObject$j || (_templateObject$j = _taggedTemplateLiteral(["\n ", ";\n visibility: hidden;\n opacity: 0;\n width: ", ";\n transition: visibility 0.3s linear, opacity 0.3s linear;\n background-color: ", ";\n color: white;\n text-align: center;\n border-radius: 5px;\n ", "\n &::after {\n content: ' ';\n position: absolute;\n ", "\n }\n"])), relativeInlineStyle, function (props) {
1613
- return props.bodyWidth;
1613
+ return props.$bodyWidth;
1614
1614
  }, function (props) {
1615
1615
  return props.theme.colors.base || 'black';
1616
1616
  }, function (props) {
@@ -1622,33 +1622,33 @@
1622
1622
  var _templateObject$k;
1623
1623
  var Container = styled__default.div(_templateObject$k || (_templateObject$k = _taggedTemplateLiteral(["\n ", ";\n cursor: pointer;\n &:hover ", " {\n opacity: 1;\n visibility: visible;\n }\n"])), relativeInlineStyle, Body$1);
1624
1624
 
1625
+ /* eslint-disable react/require-default-props */
1626
+
1625
1627
  var Tooltip = function Tooltip(_ref) {
1626
- var children = _ref.children,
1627
- toolTipText = _ref.toolTipText,
1628
- toolTipPosition = _ref.toolTipPosition,
1629
- bodyWidth = _ref.bodyWidth,
1630
- apexWidth = _ref.apexWidth,
1631
- containerClassName = _ref.containerClassName,
1632
- bodyClassName = _ref.bodyClassName;
1628
+ var _ref$children = _ref.children,
1629
+ children = _ref$children === void 0 ? null : _ref$children,
1630
+ _ref$toolTipText = _ref.toolTipText,
1631
+ toolTipText = _ref$toolTipText === void 0 ? '' : _ref$toolTipText,
1632
+ _ref$toolTipPosition = _ref.toolTipPosition,
1633
+ toolTipPosition = _ref$toolTipPosition === void 0 ? 'top' : _ref$toolTipPosition,
1634
+ _ref$bodyWidth = _ref.bodyWidth,
1635
+ bodyWidth = _ref$bodyWidth === void 0 ? '8em' : _ref$bodyWidth,
1636
+ _ref$apexWidth = _ref.apexWidth,
1637
+ apexWidth = _ref$apexWidth === void 0 ? '5px' : _ref$apexWidth,
1638
+ _ref$containerClassNa = _ref.containerClassName,
1639
+ containerClassName = _ref$containerClassNa === void 0 ? '' : _ref$containerClassNa,
1640
+ _ref$bodyClassName = _ref.bodyClassName,
1641
+ bodyClassName = _ref$bodyClassName === void 0 ? '' : _ref$bodyClassName;
1633
1642
  return /*#__PURE__*/React__default.createElement(Container, {
1634
1643
  className: containerClassName
1635
1644
  }, children, /*#__PURE__*/React__default.createElement(Body$1, {
1636
- toolTipPosition: toolTipPosition,
1637
- bodyWidth: bodyWidth,
1638
- apexWidth: apexWidth,
1645
+ $toolTipPosition: toolTipPosition,
1646
+ $bodyWidth: bodyWidth,
1647
+ $apexWidth: apexWidth,
1639
1648
  className: bodyClassName
1640
1649
  }, toolTipText));
1641
1650
  };
1642
1651
 
1643
- Tooltip.defaultProps = {
1644
- children: null,
1645
- toolTipText: '',
1646
- toolTipPosition: 'top',
1647
- bodyWidth: '8em',
1648
- apexWidth: '5px',
1649
- containerClassName: '',
1650
- bodyClassName: ''
1651
- };
1652
1652
  var Tooltip$1 = themed(Tooltip);
1653
1653
 
1654
1654
  var _templateObject$l, _templateObject2$2;
@@ -15500,6 +15500,7 @@
15500
15500
  track: link === null || link === void 0 ? void 0 : link.track,
15501
15501
  target: link.target
15502
15502
  }, link.label) : /*#__PURE__*/React__default.createElement("div", {
15503
+ key: link.label,
15503
15504
  className: "footer__text"
15504
15505
  }, link.label);
15505
15506
  })));
@@ -15803,7 +15804,7 @@
15803
15804
  };
15804
15805
 
15805
15806
  var SearchResults = function SearchResults(_ref) {
15806
- var _searchResults$brands, _searchResults$produc, _searchResults$brands2, _searchResults$produc2, _initialSearchData$tr, _initialSearchData$la, _limitBrands, _limitBrands2, _initialSearchData$la2, _searchResults$produc3;
15807
+ var _searchResults$brands, _searchResults$produc, _initialSearchData$tr, _initialSearchData$la, _limitBrands, _limitBrands2, _initialSearchData$la2, _searchResults$produc2;
15807
15808
 
15808
15809
  var searchValue = _ref.searchValue,
15809
15810
  searchResults = _ref.searchResults,
@@ -15817,7 +15818,10 @@
15817
15818
  currency = _ref.currency,
15818
15819
  currencySymbol = _ref.currencySymbol,
15819
15820
  onProductSearchResultClick = _ref.onProductSearchResultClick,
15820
- onBrandSearchResultClick = _ref.onBrandSearchResultClick;
15821
+ onBrandSearchResultClick = _ref.onBrandSearchResultClick,
15822
+ onCreateInterests = _ref.onCreateInterests,
15823
+ noResultsImage = _ref.noResultsImage,
15824
+ showNoResults = _ref.showNoResults;
15821
15825
 
15822
15826
  var _useState = React.useState(false),
15823
15827
  _useState2 = _slicedToArray(_useState, 2),
@@ -15835,15 +15839,16 @@
15835
15839
  window.removeEventListener('resize', checkIfMobile);
15836
15840
  };
15837
15841
  }, []);
15838
- var shouldShowInitialData = isSearchFocused && (!searchValue || searchValue.trim().length < 3) || (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim().length) >= 3 && !(searchResults !== null && searchResults !== void 0 && (_searchResults$brands = searchResults.brands) !== null && _searchResults$brands !== void 0 && _searchResults$brands.length) && !(searchResults !== null && searchResults !== void 0 && (_searchResults$produc = searchResults.products) !== null && _searchResults$produc !== void 0 && _searchResults$produc.length);
15839
- var hasResults = (searchResults === null || searchResults === void 0 ? void 0 : (_searchResults$brands2 = searchResults.brands) === null || _searchResults$brands2 === void 0 ? void 0 : _searchResults$brands2.length) > 0 || (searchResults === null || searchResults === void 0 ? void 0 : (_searchResults$produc2 = searchResults.products) === null || _searchResults$produc2 === void 0 ? void 0 : _searchResults$produc2.length) > 0;
15842
+ var hasSearchBeenPerformed = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim().length) >= 3;
15843
+ var hasResults = (searchResults === null || searchResults === void 0 ? void 0 : (_searchResults$brands = searchResults.brands) === null || _searchResults$brands === void 0 ? void 0 : _searchResults$brands.length) > 0 || (searchResults === null || searchResults === void 0 ? void 0 : (_searchResults$produc = searchResults.products) === null || _searchResults$produc === void 0 ? void 0 : _searchResults$produc.length) > 0;
15840
15844
  var hasInitialData = (initialSearchData === null || initialSearchData === void 0 ? void 0 : (_initialSearchData$tr = initialSearchData.trending_brands) === null || _initialSearchData$tr === void 0 ? void 0 : _initialSearchData$tr.length) > 0 || (initialSearchData === null || initialSearchData === void 0 ? void 0 : (_initialSearchData$la = initialSearchData.latest_products) === null || _initialSearchData$la === void 0 ? void 0 : _initialSearchData$la.length) > 0;
15845
+ var shouldShowInitialData = isSearchFocused && (!hasSearchBeenPerformed || !hasResults && !showNoResults);
15841
15846
 
15842
- if (!hasResults && !hasInitialData) {
15847
+ if (!isSearchFocused) {
15843
15848
  return null;
15844
15849
  }
15845
15850
 
15846
- if (!isSearchFocused) {
15851
+ if (!hasResults && !hasInitialData && !showNoResults) {
15847
15852
  return null;
15848
15853
  }
15849
15854
 
@@ -15924,7 +15929,36 @@
15924
15929
  }
15925
15930
 
15926
15931
  return brands;
15927
- };
15932
+ }; // Show no results state
15933
+
15934
+
15935
+ if (showNoResults) {
15936
+ return /*#__PURE__*/React__default.createElement("div", {
15937
+ className: "search-results",
15938
+ ref: searchResultsRef
15939
+ }, /*#__PURE__*/React__default.createElement("div", {
15940
+ className: "search-results__no-results"
15941
+ }, /*#__PURE__*/React__default.createElement("h2", {
15942
+ className: "search-results__header"
15943
+ }, "TOP MATCHES"), /*#__PURE__*/React__default.createElement("div", {
15944
+ className: "search-results__no-results-content"
15945
+ }, /*#__PURE__*/React__default.createElement("div", {
15946
+ className: "search-results__no-results-image"
15947
+ }, /*#__PURE__*/React__default.createElement("img", {
15948
+ src: noResultsImage,
15949
+ alt: "No results"
15950
+ })), /*#__PURE__*/React__default.createElement("div", {
15951
+ className: "search-results__no-results-text"
15952
+ }, /*#__PURE__*/React__default.createElement("p", {
15953
+ className: "search-results__no-results-title"
15954
+ }, "There are currently no products in stock that match your selection"), /*#__PURE__*/React__default.createElement("p", {
15955
+ className: "search-results__no-results-description"
15956
+ }, "Create an interest now and receive instant notifications as your interests list."))), /*#__PURE__*/React__default.createElement("button", {
15957
+ type: "button",
15958
+ className: "search-results__create-interest-button",
15959
+ onClick: onCreateInterests
15960
+ }, "Create Interests")));
15961
+ }
15928
15962
 
15929
15963
  return /*#__PURE__*/React__default.createElement("div", {
15930
15964
  className: "search-results",
@@ -15981,7 +16015,7 @@
15981
16015
  }
15982
16016
  }, "View all items")), /*#__PURE__*/React__default.createElement("div", {
15983
16017
  className: "search-results__product-list"
15984
- }, shouldShowInitialData ? initialSearchData === null || initialSearchData === void 0 ? void 0 : (_initialSearchData$la2 = initialSearchData.latest_products) === null || _initialSearchData$la2 === void 0 ? void 0 : _initialSearchData$la2.map(renderProductCard) : searchResults === null || searchResults === void 0 ? void 0 : (_searchResults$produc3 = searchResults.products) === null || _searchResults$produc3 === void 0 ? void 0 : _searchResults$produc3.map(renderProductCard)), /*#__PURE__*/React__default.createElement("button", {
16018
+ }, shouldShowInitialData ? initialSearchData === null || initialSearchData === void 0 ? void 0 : (_initialSearchData$la2 = initialSearchData.latest_products) === null || _initialSearchData$la2 === void 0 ? void 0 : _initialSearchData$la2.map(renderProductCard) : searchResults === null || searchResults === void 0 ? void 0 : (_searchResults$produc2 = searchResults.products) === null || _searchResults$produc2 === void 0 ? void 0 : _searchResults$produc2.map(renderProductCard)), /*#__PURE__*/React__default.createElement("button", {
15985
16019
  type: "button",
15986
16020
  className: "search-results__view-all-button",
15987
16021
  onClick: function onClick() {
@@ -16008,7 +16042,7 @@
16008
16042
 
16009
16043
  var searchProductsFilter = function searchProductsFilter(search, limit, currencyCode) {
16010
16044
  return {
16011
- query: "\n query LUXITY_PRODUCTS_FILTER(\n $search: String!\n $limit: Int!\n $page: Int!\n $sort_by: String!\n $with_sold: Boolean!\n $currency_code: String!\n ) {\n luxity_products_filter(\n search: $search\n limit: $limit\n page: $page\n sort_by: $sort_by\n with_sold: $with_sold\n ) {\n data {\n id\n product {\n sku\n name\n price(currency_code: $currency_code)\n promotion_price(currency_code: $currency_code)\n est_retail_price(currency_code: $currency_code)\n condition\n currency_symbol(currency_code: $currency_code)\n }\n category_type\n gender\n status\n featured_image\n on_promotion\n promotion_discount\n luxity_brand {\n id\n name\n slug\n }\n }\n total\n }\n }\n ",
16045
+ query: "\n query LUXITY_PRODUCTS_FILTER(\n $search: String!\n $limit: Int!\n $page: Int!\n $sort_by: String!\n $with_sold: Boolean!\n $currency_code: String!\n ) {\n luxity_products_filter(\n search: $search\n limit: $limit\n page: $page\n sort_by: $sort_by\n with_sold: $with_sold\n ) {\n data {\n id\n product {\n sku\n name\n price(currency_code: $currency_code)\n promotion_price(currency_code: $currency_code)\n est_retail_price(currency_code: $currency_code)\n condition\n currency_symbol(currency_code: $currency_code)\n }\n product_slug\n category_type\n gender\n status\n featured_image\n on_promotion\n promotion_discount\n luxity_brand {\n id\n name\n slug\n }\n }\n total\n }\n }\n ",
16012
16046
  variables: {
16013
16047
  search: search,
16014
16048
  limit: limit,
@@ -16024,7 +16058,8 @@
16024
16058
  var endpoint = _ref.endpoint,
16025
16059
  onSearchLoading = _ref.onSearchLoading,
16026
16060
  currency = _ref.currency,
16027
- onSearchPreview = _ref.onSearchPreview;
16061
+ onSearchPreview = _ref.onSearchPreview,
16062
+ onNoResults = _ref.onNoResults;
16028
16063
  var currentSearchRequestToken = React.useRef(null);
16029
16064
  var debounce = React.useCallback(function (func, wait) {
16030
16065
  var timeout;
@@ -16061,7 +16096,12 @@
16061
16096
  setSearchResults({
16062
16097
  brands: [],
16063
16098
  products: []
16064
- });
16099
+ }); // Reset no results state when clearing search
16100
+
16101
+ if (typeof onNoResults === 'function') {
16102
+ onNoResults(false);
16103
+ }
16104
+
16065
16105
  return;
16066
16106
  } // Cancel any ongoing search request to prevent race conditions
16067
16107
 
@@ -16072,7 +16112,12 @@
16072
16112
 
16073
16113
 
16074
16114
  var newSearchToken = axios.CancelToken.source();
16075
- currentSearchRequestToken.current = newSearchToken; // Set loading to true when starting the search request
16115
+ currentSearchRequestToken.current = newSearchToken; // Reset no results state when starting new search (user is typing)
16116
+
16117
+ if (typeof onNoResults === 'function') {
16118
+ onNoResults(false);
16119
+ } // Set loading to true when starting the search request
16120
+
16076
16121
 
16077
16122
  if (typeof onSearchLoading === 'function') {
16078
16123
  onSearchLoading(true);
@@ -16108,11 +16153,15 @@
16108
16153
  }); // Map products to old structure with prices
16109
16154
 
16110
16155
  var products = productsData.map(function (product) {
16156
+ // Generate product link: /products/{category_type}/{brand_slug}/{product_slug}
16157
+ var categorySlug = product.category_type.toLowerCase().replace(/\s+/g, '-');
16158
+ var brandSlug = product.luxity_brand.slug;
16159
+ var productSlug = product.product_slug;
16160
+ var link = "/products/".concat(categorySlug, "/").concat(brandSlug, "/").concat(productSlug);
16111
16161
  return {
16112
16162
  name: product.product.name,
16113
16163
  brand: product.luxity_brand.name,
16114
- link: "/products/".concat(product.id),
16115
- // Using product ID for link
16164
+ link: link,
16116
16165
  price: product.product.price || 0,
16117
16166
  promotion_price: product.product.promotion_price || null,
16118
16167
  est_retail_price: product.product.est_retail_price || 0,
@@ -16121,9 +16170,9 @@
16121
16170
  featured_image: product.featured_image,
16122
16171
  on_promotion: product.on_promotion || false,
16123
16172
  promotion_discount: product.promotion_discount || 0,
16124
- // Keep new fields for potential future use
16125
16173
  id: product.id,
16126
16174
  category_type: product.category_type,
16175
+ product_slug: product.product_slug,
16127
16176
  luxity_brand: product.luxity_brand
16128
16177
  };
16129
16178
  });
@@ -16132,7 +16181,13 @@
16132
16181
  products: products,
16133
16182
  total: totalResults
16134
16183
  };
16135
- setSearchResults(searchResults);
16184
+ setSearchResults(searchResults); // Check if we have no results (empty aggregations)
16185
+
16186
+ var hasNoResults = brandsData.length === 0 && productsData.length === 0;
16187
+
16188
+ if (typeof onNoResults === 'function') {
16189
+ onNoResults(hasNoResults);
16190
+ }
16136
16191
 
16137
16192
  if (typeof onSearchPreview === 'function') {
16138
16193
  var hasResults = brands.length > 0 || products.length > 0;
@@ -16142,11 +16197,7 @@
16142
16197
  });
16143
16198
  }
16144
16199
 
16145
- currentSearchRequestToken.current = null; // Set loading to false when search completes successfully
16146
-
16147
- if (typeof onSearchLoading === 'function') {
16148
- onSearchLoading(false);
16149
- }
16200
+ currentSearchRequestToken.current = null;
16150
16201
  }
16151
16202
  }).catch(function (error) {
16152
16203
  if (!axios.isCancel(error)) {
@@ -16154,14 +16205,10 @@
16154
16205
  brands: [],
16155
16206
  products: []
16156
16207
  });
16157
- currentSearchRequestToken.current = null; // Set loading to false when search fails
16158
-
16159
- if (typeof onSearchLoading === 'function') {
16160
- onSearchLoading(false);
16161
- }
16208
+ currentSearchRequestToken.current = null;
16162
16209
  }
16163
16210
  });
16164
- }, [endpoint, currency, onSearchPreview, onSearchLoading]);
16211
+ }, [endpoint, currency, onSearchPreview, onSearchLoading, onNoResults]);
16165
16212
  var debouncedSearch = React.useMemo(function () {
16166
16213
  return debounce(function (searchQuery, setSearchResults) {
16167
16214
  return performSearch(searchQuery, setSearchResults);
@@ -16266,22 +16313,6 @@
16266
16313
  }
16267
16314
  }, [searchValue, immediateSearch, setIsSearchFocused, setSearchValue]);
16268
16315
  };
16269
- var useSearchUrlQuery = function useSearchUrlQuery(setSearchValue, debouncedSearch) {
16270
- var hasProcessedUrlQuery = React.useRef(false);
16271
- React.useEffect(function () {
16272
- if (hasProcessedUrlQuery.current) return;
16273
- var urlParams = new URLSearchParams(window.location.search);
16274
- var queryParam = urlParams.get('q');
16275
- var isSearchPage = window.location.pathname.includes('/search');
16276
-
16277
- if (queryParam && queryParam.trim() !== '' && isSearchPage) {
16278
- hasProcessedUrlQuery.current = true;
16279
- setSearchValue(queryParam);
16280
- debouncedSearch(queryParam);
16281
- }
16282
- }, [setSearchValue, debouncedSearch]);
16283
- return hasProcessedUrlQuery;
16284
- };
16285
16316
 
16286
16317
  var removeCategoryByName = function removeCategoryByName(categories, name) {
16287
16318
  var _categories$filter;
@@ -16331,17 +16362,9 @@
16331
16362
  isExclusive = _ref.isExclusive,
16332
16363
  shop = _ref.shop,
16333
16364
  app = _ref.app,
16334
- categoryConfig = _ref.categoryConfig;
16335
-
16336
- var _useSearch = useSearch({
16337
- endpoint: endpoint,
16338
- onSearchLoading: onSearchLoading,
16339
- currency: currency,
16340
- onSearchPreview: onSearchPreview
16341
- }),
16342
- fetchInitialSearchData = _useSearch.fetchInitialSearchData,
16343
- createDebouncedSearch = _useSearch.createDebouncedSearch,
16344
- createImmediateSearch = _useSearch.createImmediateSearch;
16365
+ categoryConfig = _ref.categoryConfig,
16366
+ onCreateInterests = _ref.onCreateInterests,
16367
+ noResultsImage = _ref.noResultsImage;
16345
16368
 
16346
16369
  var _useState = React.useState(''),
16347
16370
  _useState2 = _slicedToArray(_useState, 2),
@@ -16392,14 +16415,30 @@
16392
16415
  cachedResults = _useState16[0],
16393
16416
  setCachedResults = _useState16[1];
16394
16417
 
16418
+ var _useState17 = React.useState(false),
16419
+ _useState18 = _slicedToArray(_useState17, 2),
16420
+ showNoResults = _useState18[0],
16421
+ setShowNoResults = _useState18[1];
16422
+
16395
16423
  var searchResultsRef = React.useRef(null);
16424
+
16425
+ var _useSearch = useSearch({
16426
+ endpoint: endpoint,
16427
+ onSearchLoading: onSearchLoading,
16428
+ currency: currency,
16429
+ onSearchPreview: onSearchPreview,
16430
+ onNoResults: setShowNoResults
16431
+ }),
16432
+ fetchInitialSearchData = _useSearch.fetchInitialSearchData,
16433
+ createDebouncedSearch = _useSearch.createDebouncedSearch,
16434
+ createImmediateSearch = _useSearch.createImmediateSearch;
16435
+
16396
16436
  var debouncedSearch = createDebouncedSearch(function (results) {
16397
16437
  setSearchResults(results);
16398
16438
  setCachedResults(results);
16399
16439
  });
16400
16440
  var immediateSearch = createImmediateSearch(setSearchValue, setSearchResults, onSearchSubmit);
16401
16441
  var handleChange = useSearchInputChange(setSearchValue, setIsSearchFocused, debouncedSearch, setSearchResults, setCachedResults);
16402
- useSearchUrlQuery(setSearchValue, debouncedSearch);
16403
16442
  useSearchClickOutside(searchResultsRef, searchResults, setCachedResults, setIsSearchFocused, setSearchResults);
16404
16443
 
16405
16444
  var handleSearchClick = function handleSearchClick() {
@@ -16526,6 +16565,7 @@
16526
16565
  products: []
16527
16566
  });
16528
16567
  setIsSearchFocused(false);
16568
+ setShowNoResults(false);
16529
16569
  },
16530
16570
  searchResultsRef: searchResultsRef,
16531
16571
  onSearchSubmit: onSearchSubmit,
@@ -16536,7 +16576,10 @@
16536
16576
  currency: currency,
16537
16577
  currencySymbol: currencySymbol,
16538
16578
  onProductSearchResultClick: onProductSearchResultClick,
16539
- onBrandSearchResultClick: onBrandSearchResultClick
16579
+ onBrandSearchResultClick: onBrandSearchResultClick,
16580
+ onCreateInterests: onCreateInterests,
16581
+ noResultsImage: noResultsImage,
16582
+ showNoResults: showNoResults
16540
16583
  }), /*#__PURE__*/React__default.createElement("nav", {
16541
16584
  className: "navbar__nav-links navbar__nav-links--wrap"
16542
16585
  }, renderDropdownLinks(), !!stores.length && /*#__PURE__*/React__default.createElement("li", {
@@ -17254,61 +17297,69 @@
17254
17297
  shop = _ref.shop,
17255
17298
  app = _ref.app,
17256
17299
  categoryConfig = _ref.categoryConfig,
17257
- name = _ref.name;
17300
+ name = _ref.name,
17301
+ onCreateInterests = _ref.onCreateInterests,
17302
+ noResultsImage = _ref.noResultsImage;
17303
+
17304
+ var _useState = React.useState(false),
17305
+ _useState2 = _slicedToArray(_useState, 2),
17306
+ showNoResults = _useState2[0],
17307
+ setShowNoResults = _useState2[1];
17258
17308
 
17259
17309
  var _useSearch = useSearch({
17260
17310
  endpoint: endpoint,
17261
17311
  onSearchLoading: onSearchLoading,
17262
17312
  currency: currency,
17263
- onSearchPreview: onSearchPreview
17313
+ onSearchPreview: onSearchPreview,
17314
+ onNoResults: setShowNoResults
17264
17315
  }),
17265
17316
  fetchInitialSearchData = _useSearch.fetchInitialSearchData,
17266
17317
  createDebouncedSearch = _useSearch.createDebouncedSearch,
17267
17318
  createImmediateSearch = _useSearch.createImmediateSearch;
17268
17319
 
17269
- var _useState = React.useState(''),
17270
- _useState2 = _slicedToArray(_useState, 2),
17271
- searchValue = _useState2[0],
17272
- setSearchValue = _useState2[1];
17273
-
17274
- var _useState3 = React.useState(false),
17320
+ var _useState3 = React.useState(''),
17275
17321
  _useState4 = _slicedToArray(_useState3, 2),
17276
- showSearchBar = _useState4[0],
17277
- setShowSearchbar = _useState4[1];
17322
+ searchValue = _useState4[0],
17323
+ setSearchValue = _useState4[1];
17278
17324
 
17279
17325
  var _useState5 = React.useState(false),
17280
17326
  _useState6 = _slicedToArray(_useState5, 2),
17281
- showSideNav = _useState6[0],
17282
- setShowSideNav = _useState6[1];
17327
+ showSearchBar = _useState6[0],
17328
+ setShowSearchbar = _useState6[1];
17283
17329
 
17284
- var _useState7 = React.useState({
17285
- brands: [],
17286
- products: []
17287
- }),
17330
+ var _useState7 = React.useState(false),
17288
17331
  _useState8 = _slicedToArray(_useState7, 2),
17289
- searchResults = _useState8[0],
17290
- setSearchResults = _useState8[1];
17332
+ showSideNav = _useState8[0],
17333
+ setShowSideNav = _useState8[1];
17291
17334
 
17292
17335
  var _useState9 = React.useState({
17293
17336
  brands: [],
17294
17337
  products: []
17295
17338
  }),
17296
17339
  _useState10 = _slicedToArray(_useState9, 2),
17297
- cachedResults = _useState10[0],
17298
- setCachedResults = _useState10[1];
17340
+ searchResults = _useState10[0],
17341
+ setSearchResults = _useState10[1];
17299
17342
 
17300
- var _useState11 = React.useState(false),
17343
+ var _useState11 = React.useState({
17344
+ brands: [],
17345
+ products: []
17346
+ }),
17301
17347
  _useState12 = _slicedToArray(_useState11, 2),
17302
- isSearchFocused = _useState12[0],
17303
- setIsSearchFocused = _useState12[1];
17348
+ cachedResults = _useState12[0],
17349
+ setCachedResults = _useState12[1];
17304
17350
 
17305
- var _useState13 = React.useState({
17351
+ var _useState13 = React.useState(false),
17352
+ _useState14 = _slicedToArray(_useState13, 2),
17353
+ isSearchFocused = _useState14[0],
17354
+ setIsSearchFocused = _useState14[1];
17355
+
17356
+ var _useState15 = React.useState({
17306
17357
  trending_brands: [],
17307
17358
  latest_products: []
17308
17359
  }),
17309
- _useState14 = _slicedToArray(_useState13, 2),
17310
- initialSearchView = _useState14[0],
17311
- setInitialSearchView = _useState14[1];
17360
+ _useState16 = _slicedToArray(_useState15, 2),
17361
+ initialSearchView = _useState16[0],
17362
+ setInitialSearchView = _useState16[1];
17312
17363
 
17313
17364
  var searchResultsRef = React.useRef(null);
17314
17365
  var searchInputRef = React.useRef(null);
@@ -17318,7 +17369,6 @@
17318
17369
  });
17319
17370
  var immediateSearch = createImmediateSearch(setSearchValue, setSearchResults, onSearchSubmit);
17320
17371
  var handleChange = useSearchInputChange(setSearchValue, setIsSearchFocused, debouncedSearch, setSearchResults, setCachedResults);
17321
- useSearchUrlQuery(setSearchValue, debouncedSearch);
17322
17372
  var handleKeyDown = useSearchInputKeyDown(searchValue, immediateSearch, setIsSearchFocused, setSearchValue);
17323
17373
  React.useMemo(function () {
17324
17374
  if (!initialSearchData) {
@@ -17351,6 +17401,7 @@
17351
17401
  brands: [],
17352
17402
  products: []
17353
17403
  });
17404
+ setShowNoResults(false);
17354
17405
  }
17355
17406
  };
17356
17407
 
@@ -17535,6 +17586,7 @@
17535
17586
  products: []
17536
17587
  });
17537
17588
  setIsSearchFocused(false);
17589
+ setShowNoResults(false);
17538
17590
  },
17539
17591
  onSearchSubmit: onSearchSubmit,
17540
17592
  setSearchValue: setSearchValue,
@@ -17545,7 +17597,10 @@
17545
17597
  currency: currency,
17546
17598
  currencySymbol: currencySymbol,
17547
17599
  onProductSearchResultClick: onProductSearchResultClick,
17548
- onBrandSearchResultClick: onBrandSearchResultClick
17600
+ onBrandSearchResultClick: onBrandSearchResultClick,
17601
+ onCreateInterests: onCreateInterests,
17602
+ noResultsImage: noResultsImage,
17603
+ showNoResults: showNoResults
17549
17604
  }))), shop && /*#__PURE__*/React__default.createElement(LuxitySideNav, {
17550
17605
  accordionIcon: accordionIcon,
17551
17606
  logoSrc: logoSrc,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bonlineza/luxity-lib",
3
- "version": "2.38.0",
3
+ "version": "2.38.2",
4
4
  "scripts": {
5
5
  "start": "start-storybook -p 9001 -c .storybook -s ./public",
6
6
  "clean": "rimraf ./build/*.*",