@bonlineza/luxity-lib 2.35.4 → 2.35.6

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
@@ -1,8 +1,8 @@
1
1
  (function (global, factory) {
2
- typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-animate-height'), require('styled-components'), require('numeral'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), require('stylis-rule-sheet'), require('react-dom'), require('prop-types'), require('raf'), require('react-input-autosize'), require('react-transition-group'), require('@bonlineza/b-lib/functions'), require('rc-slider'), require('react-notify-toast'), require('helpers/axios'), require('axios')) :
3
- typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-animate-height', 'styled-components', 'numeral', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'react-notify-toast', 'helpers/axios', 'axios'], factory) :
4
- (global = global || self, factory(global.blib = {}, global.React, global.AnimateHeight, global.styled, global.numeral, global.EllipsisLoader, global.PageReady, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global['react-notify-toast'], global.axiosInstance, global.axios));
5
- }(this, (function (exports, React, AnimateHeight, styled, numeral, EllipsisLoader, PageReady, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axiosInstance, axios) { 'use strict';
2
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('react'), require('react-animate-height'), require('styled-components'), require('numeral'), require('@bonlineza/b-lib/EllipsisLoader'), require('@bonlineza/b-lib/PageReady'), require('stylis-rule-sheet'), require('react-dom'), require('prop-types'), require('raf'), require('react-input-autosize'), require('react-transition-group'), require('@bonlineza/b-lib/functions'), require('rc-slider'), require('react-notify-toast'), require('axios'), require('js-cookie')) :
3
+ typeof define === 'function' && define.amd ? define(['exports', 'react', 'react-animate-height', 'styled-components', 'numeral', '@bonlineza/b-lib/EllipsisLoader', '@bonlineza/b-lib/PageReady', 'stylis-rule-sheet', 'react-dom', 'prop-types', 'raf', 'react-input-autosize', 'react-transition-group', '@bonlineza/b-lib/functions', 'rc-slider', 'react-notify-toast', 'axios', 'js-cookie'], factory) :
4
+ (global = global || self, factory(global.blib = {}, global.React, global.AnimateHeight, global.styled, global.numeral, global.EllipsisLoader, global.PageReady, global['stylis-rule-sheet'], global.reactDom, global.PropTypes, global.raf, global['react-input-autosize'], global['react-transition-group'], global.function, global.rcSlider, global['react-notify-toast'], global.axios, global.Cookies));
5
+ }(this, (function (exports, React, AnimateHeight, styled, numeral, EllipsisLoader, PageReady, stylisRuleSheet, reactDom, PropTypes, raf, AutosizeInput, reactTransitionGroup, functions, rcSlider, Notifications, axios, Cookies) { 'use strict';
6
6
 
7
7
  var React__default = 'default' in React ? React['default'] : React;
8
8
  AnimateHeight = AnimateHeight && Object.prototype.hasOwnProperty.call(AnimateHeight, 'default') ? AnimateHeight['default'] : AnimateHeight;
@@ -15,8 +15,8 @@
15
15
  raf = raf && Object.prototype.hasOwnProperty.call(raf, 'default') ? raf['default'] : raf;
16
16
  AutosizeInput = AutosizeInput && Object.prototype.hasOwnProperty.call(AutosizeInput, 'default') ? AutosizeInput['default'] : AutosizeInput;
17
17
  var Notifications__default = 'default' in Notifications ? Notifications['default'] : Notifications;
18
- axiosInstance = axiosInstance && Object.prototype.hasOwnProperty.call(axiosInstance, 'default') ? axiosInstance['default'] : axiosInstance;
19
18
  axios = axios && Object.prototype.hasOwnProperty.call(axios, 'default') ? axios['default'] : axios;
19
+ Cookies = Cookies && Object.prototype.hasOwnProperty.call(Cookies, 'default') ? Cookies['default'] : Cookies;
20
20
 
21
21
  function ownKeys(object, enumerableOnly) {
22
22
  var keys = Object.keys(object);
@@ -11443,6 +11443,127 @@
11443
11443
  }));
11444
11444
  });
11445
11445
 
11446
+ function getToken() {
11447
+ var _Cookies$get;
11448
+
11449
+ return (_Cookies$get = Cookies.get('_tk')) === null || _Cookies$get === void 0 ? void 0 : _Cookies$get.replace('*', 'Bearer ');
11450
+ }
11451
+ function setToken(value) {
11452
+ Cookies.set('_tk', value, 30);
11453
+ }
11454
+
11455
+ /** @format */
11456
+
11457
+ function getEncodedSearch(currentUrl) {
11458
+ var splitUrl = currentUrl.split('?');
11459
+ var baseUrl = splitUrl[0];
11460
+ var nextUrlSegments = splitUrl[1].split('&');
11461
+ var nextQueryString = splitUrl[1];
11462
+
11463
+ if (nextUrlSegments.length > 0) {
11464
+ nextQueryString = nextUrlSegments.map(function (v) {
11465
+ var nextValue = v;
11466
+
11467
+ if (v.includes('search=')) {
11468
+ var temp = v.split('=');
11469
+ nextValue = "".concat(temp[0], "=").concat(encodeURIComponent(temp[1]));
11470
+ }
11471
+
11472
+ return nextValue;
11473
+ }).join('&');
11474
+ }
11475
+
11476
+ return "".concat(baseUrl, "?").concat(nextQueryString);
11477
+ }
11478
+ /**
11479
+ * Gets an instance of Axios that is configured with the custom failure handlers
11480
+ * @param {Function} onAuthFailed - callback triggers when auth fails - ie, server error is one of ['token_invalid', 'token_not_provided', 'user_not_found', 'token_expired'] or http status is one of [401, 503, 400]
11481
+ * @param {Function} onForbidden - callback triggers when http status = 403
11482
+ */
11483
+
11484
+
11485
+ var axiosInstance = function axiosInstance(onAuthFailed, onForbidden) {
11486
+ var instance = axios.create({
11487
+ validateStatus: function validateStatus(status) {
11488
+ return status >= 200 && status < 300;
11489
+ }
11490
+ });
11491
+ var token = getToken();
11492
+
11493
+ if (token !== '') {
11494
+ instance.defaults.headers.common.Authorization = token;
11495
+ }
11496
+
11497
+ instance.defaults.headers.common['Content-Type'] = 'application/json;charset=UTF-8'; // Add a request interceptor
11498
+
11499
+ instance.interceptors.request.use(function (request, error) {
11500
+ if (error) {
11501
+ return Promise.reject(error.response);
11502
+ }
11503
+
11504
+ if (request.url.includes('search') && request.url.includes('?')) {
11505
+ // do some uri manipulation for ie
11506
+ // https://stackoverflow.com/questions/18220057
11507
+ // eslint-disable-next-line no-param-reassign
11508
+ request.url = getEncodedSearch(request.url);
11509
+ } // eslint-disable-next-line no-param-reassign
11510
+
11511
+
11512
+ request.headers.common['Content-Type'] = 'application/json; charset=utf-8';
11513
+
11514
+ if (typeof request.body === 'undefined') {
11515
+ request.body = {};
11516
+ }
11517
+
11518
+ token = getToken();
11519
+
11520
+ if (token !== '') {
11521
+ // eslint-disable-next-line no-param-reassign
11522
+ request.headers.common.Authorization = token;
11523
+ }
11524
+
11525
+ return request;
11526
+ }, function (error) {
11527
+ return Promise.reject(error.message);
11528
+ }); // Add a response interceptor
11529
+
11530
+ instance.interceptors.response.use(function (response, error) {
11531
+ if (error) {
11532
+ return Promise.reject(error.response);
11533
+ }
11534
+
11535
+ if (response.headers.authorization) {
11536
+ setToken(response.headers.authorization);
11537
+ }
11538
+
11539
+ return response;
11540
+ }, function (error) {
11541
+ if (error.response) {
11542
+ // network error
11543
+ if (error.response.data && error.response.data.error && (error.response.data.error === 'token_invalid' || error.response.data.error === 'token_not_provided' || error.response.data.error === 'user_not_found' || error.response.data.error === 'token_expired') || error.response.status === 401 || error.response.status === 503 || error.response.status === 400) {
11544
+ onAuthFailed();
11545
+ } // if (error.response.status === 500) {
11546
+ // // INTERNAL SERVER ERROR
11547
+ // store.dispatch({
11548
+ // type: AppConstants.OVERLAY.SERVER_ERROR,
11549
+ // });
11550
+ // return Promise.reject(error.response);
11551
+ // }
11552
+
11553
+
11554
+ if (error.response.status === 403) {
11555
+ // FORBIDDEN
11556
+ onForbidden();
11557
+ }
11558
+
11559
+ return Promise.reject(error.response);
11560
+ }
11561
+
11562
+ return Promise.reject(error);
11563
+ });
11564
+ return instance;
11565
+ }; // NOTE: this to be instanciated with params: onAuthFailed, onForbidden
11566
+
11446
11567
  var _excluded$8 = ["children"];
11447
11568
 
11448
11569
  var DropdownSelector = function DropdownSelector(_ref) {
@@ -15648,143 +15769,6 @@
15648
15769
 
15649
15770
  var index$6 = themed(LuxityFooter);
15650
15771
 
15651
- var cssUnit = {
15652
- cm: true,
15653
- mm: true,
15654
- in: true,
15655
- px: true,
15656
- pt: true,
15657
- pc: true,
15658
- em: true,
15659
- ex: true,
15660
- ch: true,
15661
- rem: true,
15662
- vw: true,
15663
- vh: true,
15664
- vmin: true,
15665
- vmax: true,
15666
- "%": true,
15667
- };
15668
- /**
15669
- * If size is a number, append px to the value as default unit.
15670
- * If size is a string, validate against list of valid units.
15671
- * If unit is valid, return size as is.
15672
- * If unit is invalid, console warn issue, replace with px as the unit.
15673
- *
15674
- * @param {(number | string)} size
15675
- * @return {LengthObject} LengthObject
15676
- */
15677
- function parseLengthAndUnit(size) {
15678
- if (typeof size === "number") {
15679
- return {
15680
- value: size,
15681
- unit: "px",
15682
- };
15683
- }
15684
- var value;
15685
- var valueString = (size.match(/^[0-9.]*/) || "").toString();
15686
- if (valueString.includes(".")) {
15687
- value = parseFloat(valueString);
15688
- }
15689
- else {
15690
- value = parseInt(valueString, 10);
15691
- }
15692
- var unit = (size.match(/[^0-9]*$/) || "").toString();
15693
- if (cssUnit[unit]) {
15694
- return {
15695
- value: value,
15696
- unit: unit,
15697
- };
15698
- }
15699
- console.warn("React Spinners: ".concat(size, " is not a valid css value. Defaulting to ").concat(value, "px."));
15700
- return {
15701
- value: value,
15702
- unit: "px",
15703
- };
15704
- }
15705
- /**
15706
- * Take value as an input and return valid css value
15707
- *
15708
- * @param {(number | string)} value
15709
- * @return {string} valid css value
15710
- */
15711
- function cssValue(value) {
15712
- var lengthWithunit = parseLengthAndUnit(value);
15713
- return "".concat(lengthWithunit.value).concat(lengthWithunit.unit);
15714
- }
15715
-
15716
- var createAnimation = function (loaderName, frames, suffix) {
15717
- var animationName = "react-spinners-".concat(loaderName, "-").concat(suffix);
15718
- if (typeof window == "undefined" || !window.document) {
15719
- return animationName;
15720
- }
15721
- var styleEl = document.createElement("style");
15722
- document.head.appendChild(styleEl);
15723
- var styleSheet = styleEl.sheet;
15724
- var keyFrames = "\n @keyframes ".concat(animationName, " {\n ").concat(frames, "\n }\n ");
15725
- if (styleSheet) {
15726
- styleSheet.insertRule(keyFrames, 0);
15727
- }
15728
- return animationName;
15729
- };
15730
-
15731
- var __assign = (undefined && undefined.__assign) || function () {
15732
- __assign = Object.assign || function(t) {
15733
- for (var s, i = 1, n = arguments.length; i < n; i++) {
15734
- s = arguments[i];
15735
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
15736
- t[p] = s[p];
15737
- }
15738
- return t;
15739
- };
15740
- return __assign.apply(this, arguments);
15741
- };
15742
- var __rest = (undefined && undefined.__rest) || function (s, e) {
15743
- var t = {};
15744
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
15745
- t[p] = s[p];
15746
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
15747
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
15748
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
15749
- t[p[i]] = s[p[i]];
15750
- }
15751
- return t;
15752
- };
15753
- var beat = createAnimation("BeatLoader", "50% {transform: scale(0.75);opacity: 0.2} 100% {transform: scale(1);opacity: 1}", "beat");
15754
- function BeatLoader(_a) {
15755
- var _b = _a.loading, loading = _b === void 0 ? true : _b, _c = _a.color, color = _c === void 0 ? "#000000" : _c, _d = _a.speedMultiplier, speedMultiplier = _d === void 0 ? 1 : _d, _e = _a.cssOverride, cssOverride = _e === void 0 ? {} : _e, _f = _a.size, size = _f === void 0 ? 15 : _f, _g = _a.margin, margin = _g === void 0 ? 2 : _g, additionalprops = __rest(_a, ["loading", "color", "speedMultiplier", "cssOverride", "size", "margin"]);
15756
- var wrapper = __assign({ display: "inherit" }, cssOverride);
15757
- var style = function (i) {
15758
- return {
15759
- display: "inline-block",
15760
- backgroundColor: color,
15761
- width: cssValue(size),
15762
- height: cssValue(size),
15763
- margin: cssValue(margin),
15764
- borderRadius: "100%",
15765
- animation: "".concat(beat, " ").concat(0.7 / speedMultiplier, "s ").concat(i % 2 ? "0s" : "".concat(0.35 / speedMultiplier, "s"), " infinite linear"),
15766
- animationFillMode: "both",
15767
- };
15768
- };
15769
- if (!loading) {
15770
- return null;
15771
- }
15772
- return (React.createElement("span", __assign({ style: wrapper }, additionalprops),
15773
- React.createElement("span", { style: style(1) }),
15774
- React.createElement("span", { style: style(2) }),
15775
- React.createElement("span", { style: style(3) })));
15776
- }
15777
-
15778
- var searchProducts = function searchProducts(search, limit) {
15779
- return {
15780
- query: "\n query SearchProducts($search: String!, $limit: Int!) {\n luxity_products_serach_results(search: $search, limit: $limit) {\n brands {\n name\n link\n }\n products {\n name\n link\n }\n luxity_product_ids\n }\n }\n ",
15781
- variables: {
15782
- search: search,
15783
- limit: limit
15784
- }
15785
- };
15786
- };
15787
-
15788
15772
  var Dropdown$1 = function Dropdown(_ref) {
15789
15773
  var title = _ref.title,
15790
15774
  imageSrc = _ref.imageSrc,
@@ -15977,56 +15961,251 @@
15977
15961
  };
15978
15962
 
15979
15963
  var SearchResults = function SearchResults(_ref) {
15964
+ var _searchResults$brands, _searchResults$produc, _searchResults$brands2, _searchResults$produc2, _initialSearchData$tr, _initialSearchData$la, _limitBrands, _limitBrands2, _initialSearchData$la2, _searchResults$produc3;
15965
+
15980
15966
  var searchValue = _ref.searchValue,
15981
15967
  searchResults = _ref.searchResults,
15982
15968
  onViewAll = _ref.onViewAll,
15983
15969
  searchResultsRef = _ref.searchResultsRef,
15984
15970
  onSearchSubmit = _ref.onSearchSubmit,
15985
- setSearchValue = _ref.setSearchValue;
15971
+ setSearchValue = _ref.setSearchValue,
15972
+ initialSearchData = _ref.initialSearchData,
15973
+ isSearchFocused = _ref.isSearchFocused,
15974
+ setIsSearchFocused = _ref.setIsSearchFocused,
15975
+ currency = _ref.currency,
15976
+ currencySymbol = _ref.currencySymbol;
15986
15977
 
15987
- if (searchValue.trim().length >= 3) {
15988
- if (searchResults.brands.length === 0 && searchResults.products.length === 0) {
15989
- return null;
15990
- }
15978
+ var _useState = React.useState(false),
15979
+ _useState2 = _slicedToArray(_useState, 2),
15980
+ isMobile = _useState2[0],
15981
+ setIsMobile = _useState2[1];
15991
15982
 
15992
- return /*#__PURE__*/React__default.createElement("div", {
15993
- className: "z-50 absolute md:top-14 font-body bg-white w-full lg:w-1/2 flex flex-col md:flex-row md:divide-x divide-black lg:mt-1 shadow-md",
15994
- ref: searchResultsRef
15995
- }, /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("div", {
15996
- className: "w-full lg:w-1/3"
15997
- }, /*#__PURE__*/React__default.createElement("p", {
15998
- className: "font-bold p-2 px-4"
15999
- }, "Brands"), searchResults.brands.map(function (brand) {
16000
- return /*#__PURE__*/React__default.createElement("a", {
16001
- key: brand.link,
16002
- href: brand.link,
16003
- className: ""
16004
- }, /*#__PURE__*/React__default.createElement("div", {
16005
- className: "p-2 px-4 hover:bg-gray-100"
16006
- }, brand.name));
15983
+ React.useEffect(function () {
15984
+ var checkIfMobile = function checkIfMobile() {
15985
+ setIsMobile(window.innerWidth <= 1024);
15986
+ };
15987
+
15988
+ checkIfMobile();
15989
+ window.addEventListener('resize', checkIfMobile);
15990
+ return function () {
15991
+ window.removeEventListener('resize', checkIfMobile);
15992
+ };
15993
+ }, []);
15994
+ 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);
15995
+ 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;
15996
+ 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;
15997
+
15998
+ if (!hasResults && !hasInitialData) {
15999
+ return null;
16000
+ }
16001
+
16002
+ if (!isSearchFocused && !hasResults) {
16003
+ return null;
16004
+ }
16005
+
16006
+ var formatPrice = function formatPrice(price) {
16007
+ var formatter = new Intl.NumberFormat(undefined, {
16008
+ minimumFractionDigits: 0,
16009
+ maximumFractionDigits: 2
16010
+ });
16011
+ return "".concat(currencySymbol).concat(formatter.format(price));
16012
+ };
16013
+
16014
+ var renderProductCard = function renderProductCard(product) {
16015
+ var selectedPrice = product.prices ? product.prices.find(function (p) {
16016
+ return p.currency === currency;
16017
+ }) : {
16018
+ price: product.price,
16019
+ retail_price: product.est_retail_price
16020
+ };
16021
+ return /*#__PURE__*/React__default.createElement("a", {
16022
+ key: product.link,
16023
+ href: product.link,
16024
+ className: "product-card"
16025
+ }, (product.image_url || product.featured_image) && /*#__PURE__*/React__default.createElement("div", {
16026
+ className: "product-card__image-container"
16027
+ }, /*#__PURE__*/React__default.createElement("img", {
16028
+ src: product.featured_image,
16029
+ alt: product.name,
16030
+ className: "product-card__image"
16007
16031
  })), /*#__PURE__*/React__default.createElement("div", {
16008
- className: "w-full lg:w-2/3"
16009
- }, /*#__PURE__*/React__default.createElement("p", {
16010
- className: "font-bold p-2 px-4"
16011
- }, "Products"), searchResults.products.map(function (product) {
16012
- return /*#__PURE__*/React__default.createElement("a", {
16013
- key: product.link,
16014
- href: product.link
16015
- }, /*#__PURE__*/React__default.createElement("div", {
16016
- className: "p-2 px-4 hover:bg-gray-100"
16017
- }, product.name));
16018
- }), /*#__PURE__*/React__default.createElement("button", {
16019
- type: "button",
16020
- onClick: function onClick() {
16021
- onViewAll();
16032
+ className: "product-card__details"
16033
+ }, /*#__PURE__*/React__default.createElement("h3", {
16034
+ className: "product-card__name"
16035
+ }, shouldShowInitialData ? /*#__PURE__*/React__default.createElement("span", null, /*#__PURE__*/React__default.createElement("span", {
16036
+ className: "product-card__brand-name"
16037
+ }, product.brand.toUpperCase()), ' ', product.name) : product.name), /*#__PURE__*/React__default.createElement("div", {
16038
+ className: "product-card__info-row"
16039
+ }, /*#__PURE__*/React__default.createElement("div", {
16040
+ className: "product-card__price-group"
16041
+ }, /*#__PURE__*/React__default.createElement("div", {
16042
+ className: "product-card__price"
16043
+ }, formatPrice(selectedPrice.price)), selectedPrice.retail_price > 1 && /*#__PURE__*/React__default.createElement("div", {
16044
+ className: "product-card__retail-price"
16045
+ }, "Est. Retail: ", formatPrice(selectedPrice.retail_price))), /*#__PURE__*/React__default.createElement("div", {
16046
+ className: "product-card__condition"
16047
+ }, /*#__PURE__*/React__default.createElement("span", {
16048
+ className: "product-card__condition-label"
16049
+ }, "Condition:"), product.condition))));
16050
+ };
16051
+
16052
+ var getBrandLink = function getBrandLink(brand) {
16053
+ return "/products/brands/".concat(brand.slug);
16054
+ };
16055
+
16056
+ var limitBrands = function limitBrands(brands) {
16057
+ if (isMobile && brands && brands.length > 4) {
16058
+ return brands.slice(0, 4);
16059
+ }
16060
+
16061
+ return brands;
16062
+ };
16063
+
16064
+ return /*#__PURE__*/React__default.createElement("div", {
16065
+ className: "search-results",
16066
+ ref: searchResultsRef
16067
+ }, /*#__PURE__*/React__default.createElement("div", {
16068
+ className: "search-results__section"
16069
+ }, /*#__PURE__*/React__default.createElement("h2", {
16070
+ className: "search-results__header"
16071
+ }, shouldShowInitialData ? 'TRENDING SEARCHES' : 'BRANDS'), /*#__PURE__*/React__default.createElement("div", {
16072
+ className: "search-results__list"
16073
+ }, shouldShowInitialData ? (_limitBrands = limitBrands(initialSearchData === null || initialSearchData === void 0 ? void 0 : initialSearchData.trending_brands)) === null || _limitBrands === void 0 ? void 0 : _limitBrands.map(function (brand) {
16074
+ return /*#__PURE__*/React__default.createElement("a", {
16075
+ key: brand.id,
16076
+ href: getBrandLink(brand),
16077
+ className: "search-results__item"
16078
+ }, brand.name);
16079
+ }) : (_limitBrands2 = limitBrands(searchResults === null || searchResults === void 0 ? void 0 : searchResults.brands)) === null || _limitBrands2 === void 0 ? void 0 : _limitBrands2.map(function (brand) {
16080
+ return /*#__PURE__*/React__default.createElement("a", {
16081
+ key: brand.link,
16082
+ href: brand.link,
16083
+ className: "search-results__item"
16084
+ }, brand.name);
16085
+ }))), /*#__PURE__*/React__default.createElement("div", {
16086
+ className: "search-results__section"
16087
+ }, /*#__PURE__*/React__default.createElement("div", {
16088
+ className: "search-results__section-header"
16089
+ }, /*#__PURE__*/React__default.createElement("h2", {
16090
+ className: "search-results__header"
16091
+ }, shouldShowInitialData ? 'POPULAR' : 'TOP MATCHES'), /*#__PURE__*/React__default.createElement("button", {
16092
+ type: "button",
16093
+ className: "search-results__view-all-link",
16094
+ onClick: function onClick() {
16095
+ onViewAll();
16096
+ }
16097
+ }, "View all items")), /*#__PURE__*/React__default.createElement("div", {
16098
+ className: "search-results__product-list"
16099
+ }, 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", {
16100
+ type: "button",
16101
+ className: "search-results__view-all-button",
16102
+ onClick: function onClick() {
16103
+ onViewAll();
16104
+
16105
+ if (!shouldShowInitialData) {
16022
16106
  onSearchSubmit(searchValue);
16023
16107
  setSearchValue('');
16024
- },
16025
- className: "bottom-0 mt-5 py-3 w-full font-body text-center text-white uppercase bg-black hover:bg-gray-950 border border-black transition-all ease-in-out duration-300 cursor-pointer"
16026
- }, "View all"))));
16027
- }
16108
+ setIsSearchFocused(false);
16109
+ }
16110
+ }
16111
+ }, "View all items")));
16112
+ };
16028
16113
 
16029
- return null;
16114
+ var searchProducts = function searchProducts(search, limit, currencyCode) {
16115
+ return {
16116
+ query: "\n query SearchProducts($search: String!, $limit: Int!, $currencyCode: String!) {\n luxity_products_serach_results(search: $search, limit: $limit, currency_code: $currencyCode) {\n brands {\n name\n link\n }\n products {\n name\n link\n price\n est_retail_price\n condition\n featured_image\n }\n luxity_product_ids\n }\n }\n ",
16117
+ variables: {
16118
+ search: search,
16119
+ limit: limit,
16120
+ currencyCode: currencyCode
16121
+ }
16122
+ };
16123
+ };
16124
+
16125
+ var useSearch = function useSearch(_ref) {
16126
+ var endpoint = _ref.endpoint,
16127
+ onProductIdsReceived = _ref.onProductIdsReceived,
16128
+ currency = _ref.currency;
16129
+ var debounce = React.useCallback(function (func, wait) {
16130
+ var timeout;
16131
+ return function executedFunction() {
16132
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16133
+ args[_key] = arguments[_key];
16134
+ }
16135
+
16136
+ var later = function later() {
16137
+ clearTimeout(timeout);
16138
+ func.apply(void 0, args);
16139
+ };
16140
+
16141
+ clearTimeout(timeout);
16142
+ timeout = setTimeout(later, wait);
16143
+ };
16144
+ }, []);
16145
+ var fetchInitialSearchData = React.useCallback(function (initialSearchDataUrl, setInitialSearchView) {
16146
+ axios.get("".concat(initialSearchDataUrl)).then(function (_ref2) {
16147
+ var data = _ref2.data;
16148
+ setInitialSearchView({
16149
+ trending_brands: data.trending_brands,
16150
+ latest_products: data.latest_products
16151
+ });
16152
+ }).catch(function () {
16153
+ setInitialSearchView({
16154
+ trending_brands: [],
16155
+ latest_products: []
16156
+ });
16157
+ });
16158
+ }, []);
16159
+ var performSearch = React.useCallback(function (nextValue, setSearchResults) {
16160
+ if (!nextValue || nextValue.trim() === '') {
16161
+ setSearchResults({
16162
+ brands: [],
16163
+ products: [],
16164
+ luxity_product_ids: []
16165
+ });
16166
+ return;
16167
+ }
16168
+
16169
+ axios.post(endpoint, searchProducts(nextValue, 3, currency)).then(function (response) {
16170
+ var searchResults = response.data.data.luxity_products_serach_results;
16171
+ setSearchResults(searchResults);
16172
+
16173
+ if (searchResults && searchResults.luxity_product_ids) {
16174
+ onProductIdsReceived(searchResults.luxity_product_ids);
16175
+ }
16176
+ }).catch(function () {
16177
+ setSearchResults({
16178
+ brands: [],
16179
+ products: [],
16180
+ luxity_product_ids: []
16181
+ });
16182
+ });
16183
+ }, [endpoint, currency, onProductIdsReceived]);
16184
+ var debouncedSearch = React.useMemo(function () {
16185
+ return debounce(function (nextValue, setSearchResults) {
16186
+ return performSearch(nextValue, setSearchResults);
16187
+ }, 500);
16188
+ }, [debounce, performSearch]);
16189
+ var createDebouncedSearch = React.useCallback(function (setSearchResults) {
16190
+ return function (nextValue) {
16191
+ return debouncedSearch(nextValue, setSearchResults);
16192
+ };
16193
+ }, [debouncedSearch]);
16194
+ var createImmediateSearch = React.useCallback(function (setSearchValue, setSearchResults, onSearchSubmit) {
16195
+ return function (value) {
16196
+ setSearchValue('');
16197
+ setSearchResults({
16198
+ brands: [],
16199
+ products: []
16200
+ });
16201
+ onSearchSubmit(value);
16202
+ };
16203
+ }, []);
16204
+ return {
16205
+ fetchInitialSearchData: fetchInitialSearchData,
16206
+ createDebouncedSearch: createDebouncedSearch,
16207
+ createImmediateSearch: createImmediateSearch
16208
+ };
16030
16209
  };
16031
16210
 
16032
16211
  var LuxityDesktopHeader = function LuxityDesktopHeader(_ref) {
@@ -16057,9 +16236,11 @@
16057
16236
  onLogoClick = _ref.onLogoClick,
16058
16237
  endpoint = _ref.endpoint,
16059
16238
  menuData = _ref.menuData,
16239
+ initialSearchData = _ref.initialSearchData,
16060
16240
  onSearchSubmit = _ref.onSearchSubmit,
16061
16241
  onProductIdsReceived = _ref.onProductIdsReceived,
16062
16242
  currency = _ref.currency,
16243
+ currencySymbol = _ref.currencySymbol,
16063
16244
  currencyOptions = _ref.currencyOptions,
16064
16245
  onCurrencyChange = _ref.onCurrencyChange,
16065
16246
  isCurrencySelectionDisabled = _ref.isCurrencySelectionDisabled,
@@ -16070,6 +16251,15 @@
16070
16251
  shop = _ref.shop,
16071
16252
  app = _ref.app;
16072
16253
 
16254
+ var _useSearch = useSearch({
16255
+ endpoint: endpoint,
16256
+ onProductIdsReceived: onProductIdsReceived,
16257
+ currency: currency
16258
+ }),
16259
+ fetchInitialSearchData = _useSearch.fetchInitialSearchData,
16260
+ createDebouncedSearch = _useSearch.createDebouncedSearch,
16261
+ createImmediateSearch = _useSearch.createImmediateSearch;
16262
+
16073
16263
  var _useState = React.useState(''),
16074
16264
  _useState2 = _slicedToArray(_useState, 2),
16075
16265
  searchValue = _useState2[0],
@@ -16080,7 +16270,12 @@
16080
16270
  loading = _useState4[0],
16081
16271
  setLoading = _useState4[1];
16082
16272
 
16083
- var _useState5 = React.useState({
16273
+ var _useState5 = React.useState(false),
16274
+ _useState6 = _slicedToArray(_useState5, 2),
16275
+ isSearchFocused = _useState6[0],
16276
+ setIsSearchFocused = _useState6[1];
16277
+
16278
+ var _useState7 = React.useState({
16084
16279
  latestArrivals: [],
16085
16280
  bags: [],
16086
16281
  shoes: [],
@@ -16090,70 +16285,39 @@
16090
16285
  accessoriesCategories: [],
16091
16286
  apparelStyles: []
16092
16287
  }),
16093
- _useState6 = _slicedToArray(_useState5, 2),
16094
- dropdownData = _useState6[0],
16095
- setDropdownData = _useState6[1];
16096
-
16097
- var _useState7 = React.useState(false),
16098
16288
  _useState8 = _slicedToArray(_useState7, 2),
16099
- hasError = _useState8[0],
16100
- setHasError = _useState8[1];
16289
+ dropdownData = _useState8[0],
16290
+ setDropdownData = _useState8[1];
16101
16291
 
16102
- var _useState9 = React.useState(false),
16292
+ var _useState9 = React.useState({
16293
+ trending_brands: [],
16294
+ latest_products: []
16295
+ }),
16103
16296
  _useState10 = _slicedToArray(_useState9, 2),
16104
- searchLoading = _useState10[0],
16105
- setSearchLoading = _useState10[1];
16297
+ initialSearchView = _useState10[0],
16298
+ setInitialSearchView = _useState10[1];
16106
16299
 
16107
- var _useState11 = React.useState({
16300
+ var _useState11 = React.useState(false),
16301
+ _useState12 = _slicedToArray(_useState11, 2),
16302
+ hasError = _useState12[0],
16303
+ setHasError = _useState12[1];
16304
+
16305
+ var _useState13 = React.useState({
16108
16306
  brands: [],
16109
16307
  products: []
16110
16308
  }),
16111
- _useState12 = _slicedToArray(_useState11, 2),
16112
- searchResults = _useState12[0],
16113
- setSearchResults = _useState12[1];
16309
+ _useState14 = _slicedToArray(_useState13, 2),
16310
+ searchResults = _useState14[0],
16311
+ setSearchResults = _useState14[1];
16114
16312
 
16115
16313
  var searchResultsRef = React.useRef(null);
16116
-
16117
- var debounce = function debounce(func, wait) {
16118
- var timeout;
16119
- return function executedFunction() {
16120
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
16121
- args[_key] = arguments[_key];
16122
- }
16123
-
16124
- var later = function later() {
16125
- clearTimeout(timeout);
16126
- func.apply(void 0, args);
16127
- };
16128
-
16129
- clearTimeout(timeout);
16130
- timeout = setTimeout(later, wait);
16131
- };
16132
- };
16133
-
16134
- var debouncedSearch = React.useCallback(debounce(function (nextValue) {
16135
- setSearchLoading(true);
16136
- axios.post(endpoint, searchProducts(nextValue, 6)).then(function (response) {
16137
- setSearchResults(response.data.data.luxity_products_serach_results);
16138
- var ids = response.data.data.luxity_products_serach_results.luxity_product_ids;
16139
- onProductIdsReceived(ids);
16140
- setSearchLoading(false);
16141
- }).catch(function () {
16142
- setSearchLoading(false);
16143
- });
16144
- }, 500), [endpoint]);
16145
- var immediateSearch = React.useCallback(function (value) {
16146
- setSearchValue('');
16147
- setSearchResults({
16148
- brands: [],
16149
- products: []
16150
- });
16151
- onSearchSubmit(value);
16152
- }, [onSearchSubmit]);
16314
+ var debouncedSearch = createDebouncedSearch(setSearchResults);
16315
+ var immediateSearch = createImmediateSearch(setSearchValue, setSearchResults, onSearchSubmit);
16153
16316
 
16154
16317
  var handleChange = function handleChange(event) {
16155
16318
  var value = event.target.value;
16156
16319
  setSearchValue(value);
16320
+ setIsSearchFocused(true);
16157
16321
 
16158
16322
  if (value.trim().length >= 3) {
16159
16323
  debouncedSearch(value);
@@ -16169,6 +16333,11 @@
16169
16333
  var handleClickOutside = function handleClickOutside(event) {
16170
16334
  if (searchResultsRef.current && !searchResultsRef.current.contains(event.target)) {
16171
16335
  setSearchValue('');
16336
+ setIsSearchFocused(false);
16337
+ setSearchResults({
16338
+ brands: [],
16339
+ products: []
16340
+ });
16172
16341
  }
16173
16342
  };
16174
16343
 
@@ -16188,6 +16357,8 @@
16188
16357
  } else if (event.key === 'Escape') {
16189
16358
  setSearchValue('');
16190
16359
  }
16360
+
16361
+ setIsSearchFocused(false);
16191
16362
  };
16192
16363
 
16193
16364
  function addCategoryToElements(elements, categoryName) {
@@ -16219,6 +16390,9 @@
16219
16390
  return setHasError(true);
16220
16391
  });
16221
16392
  }, [menuData]);
16393
+ React.useMemo(function () {
16394
+ fetchInitialSearchData(initialSearchData, setInitialSearchView);
16395
+ }, [initialSearchData, fetchInitialSearchData]);
16222
16396
 
16223
16397
  var getMarginRight = function getMarginRight(userIsVip, userName) {
16224
16398
  if (userIsVip) return '15px';
@@ -16256,23 +16430,33 @@
16256
16430
  value: searchValue,
16257
16431
  onChange: handleChange,
16258
16432
  onKeyDown: handleKeyDown,
16259
- onClick: onSearch
16260
- }), searchLoading && /*#__PURE__*/React__default.createElement(BeatLoader, {
16261
- color: "#000000",
16262
- loading: searchLoading,
16263
- size: 5,
16264
- "aria-label": "Loading Spinner",
16265
- "data-testid": "loader"
16433
+ onClick: function onClick() {
16434
+ onSearch();
16435
+ setIsSearchFocused(true);
16436
+ },
16437
+ onFocus: function onFocus() {
16438
+ return setIsSearchFocused(true);
16439
+ }
16266
16440
  })), /*#__PURE__*/React__default.createElement(SearchResults, {
16267
16441
  searchValue: searchValue,
16268
16442
  searchResults: searchResults,
16269
16443
  onViewAll: function onViewAll() {
16270
16444
  onSearchSubmit(searchValue);
16271
16445
  setSearchValue('');
16446
+ setSearchResults({
16447
+ brands: [],
16448
+ products: []
16449
+ });
16450
+ setIsSearchFocused(false);
16272
16451
  },
16273
16452
  searchResultsRef: searchResultsRef,
16274
16453
  onSearchSubmit: onSearchSubmit,
16275
- setSearchValue: setSearchValue
16454
+ setSearchValue: setSearchValue,
16455
+ initialSearchData: initialSearchView,
16456
+ isSearchFocused: isSearchFocused,
16457
+ setIsSearchFocused: setIsSearchFocused,
16458
+ currency: currency,
16459
+ currencySymbol: currencySymbol
16276
16460
  }), /*#__PURE__*/React__default.createElement("nav", {
16277
16461
  className: "navbar__nav-links navbar__nav-links--wrap"
16278
16462
  }, /*#__PURE__*/React__default.createElement(DropdownLink$1, {
@@ -17121,6 +17305,7 @@
17121
17305
  onLuxityShopClick = _ref.onLuxityShopClick,
17122
17306
  endpoint = _ref.endpoint,
17123
17307
  menuData = _ref.menuData,
17308
+ initialSearchData = _ref.initialSearchData,
17124
17309
  onSearchSubmit = _ref.onSearchSubmit,
17125
17310
  onProductIdsReceived = _ref.onProductIdsReceived,
17126
17311
  onLogoutClick = _ref.onLogoutClick,
@@ -17134,6 +17319,7 @@
17134
17319
  onPastSalesClick = _ref.onPastSalesClick,
17135
17320
  onPaidOutClick = _ref.onPaidOutClick,
17136
17321
  currency = _ref.currency,
17322
+ currencySymbol = _ref.currencySymbol,
17137
17323
  currencyOptions = _ref.currencyOptions,
17138
17324
  onCurrencyChange = _ref.onCurrencyChange,
17139
17325
  isCurrencySelectionDisabled = _ref.isCurrencySelectionDisabled,
@@ -17142,6 +17328,15 @@
17142
17328
  shop = _ref.shop,
17143
17329
  app = _ref.app;
17144
17330
 
17331
+ var _useSearch = useSearch({
17332
+ endpoint: endpoint,
17333
+ onProductIdsReceived: onProductIdsReceived,
17334
+ currency: currency
17335
+ }),
17336
+ fetchInitialSearchData = _useSearch.fetchInitialSearchData,
17337
+ createDebouncedSearch = _useSearch.createDebouncedSearch,
17338
+ createImmediateSearch = _useSearch.createImmediateSearch;
17339
+
17145
17340
  var _useState = React.useState(''),
17146
17341
  _useState2 = _slicedToArray(_useState, 2),
17147
17342
  searchValue = _useState2[0],
@@ -17157,59 +17352,36 @@
17157
17352
  showSideNav = _useState6[0],
17158
17353
  setShowSideNav = _useState6[1];
17159
17354
 
17160
- var _useState7 = React.useState(false),
17161
- _useState8 = _slicedToArray(_useState7, 2),
17162
- searchLoading = _useState8[0],
17163
- setSearchLoading = _useState8[1];
17164
-
17165
- var _useState9 = React.useState({
17355
+ var _useState7 = React.useState({
17166
17356
  brands: [],
17167
17357
  products: []
17168
17358
  }),
17169
- _useState10 = _slicedToArray(_useState9, 2),
17170
- searchResults = _useState10[0],
17171
- setSearchResults = _useState10[1];
17172
-
17173
- var debounce = function debounce(func, wait) {
17174
- var timeout;
17175
- return function executedFunction() {
17176
- for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
17177
- args[_key] = arguments[_key];
17178
- }
17359
+ _useState8 = _slicedToArray(_useState7, 2),
17360
+ searchResults = _useState8[0],
17361
+ setSearchResults = _useState8[1];
17179
17362
 
17180
- var later = function later() {
17181
- clearTimeout(timeout);
17182
- func.apply(void 0, args);
17183
- };
17363
+ var _useState9 = React.useState(false),
17364
+ _useState10 = _slicedToArray(_useState9, 2),
17365
+ isSearchFocused = _useState10[0],
17366
+ setIsSearchFocused = _useState10[1];
17184
17367
 
17185
- clearTimeout(timeout);
17186
- timeout = setTimeout(later, wait);
17187
- };
17188
- };
17368
+ var _useState11 = React.useState({
17369
+ trending_brands: [],
17370
+ latest_products: []
17371
+ }),
17372
+ _useState12 = _slicedToArray(_useState11, 2),
17373
+ initialSearchView = _useState12[0],
17374
+ setInitialSearchView = _useState12[1];
17189
17375
 
17190
- var debouncedSearch = React.useCallback(debounce(function (nextValue) {
17191
- setSearchLoading(true);
17192
- axios.post(endpoint, searchProducts(nextValue, 6)).then(function (response) {
17193
- setSearchResults(response.data.data.luxity_products_serach_results);
17194
- var ids = response.data.data.luxity_products_serach_results.luxity_product_ids;
17195
- onProductIdsReceived(ids);
17196
- setSearchLoading(false);
17197
- }).catch(function () {
17198
- setSearchLoading(false);
17199
- });
17200
- }, 500), [endpoint]);
17201
- var immediateSearch = React.useCallback(function (value) {
17202
- setSearchValue('');
17203
- setSearchResults({
17204
- brands: [],
17205
- products: []
17206
- });
17207
- onSearchSubmit(value);
17208
- }, [onSearchSubmit]);
17376
+ var searchResultsRef = React.useRef(null);
17377
+ var searchInputRef = React.useRef(null);
17378
+ var debouncedSearch = createDebouncedSearch(setSearchResults);
17379
+ var immediateSearch = createImmediateSearch(setSearchValue, setSearchResults, onSearchSubmit);
17209
17380
 
17210
17381
  var handleChange = function handleChange(event) {
17211
17382
  var value = event.target.value;
17212
17383
  setSearchValue(value);
17384
+ setIsSearchFocused(true);
17213
17385
 
17214
17386
  if (value.trim().length >= 3) {
17215
17387
  debouncedSearch(value);
@@ -17227,17 +17399,53 @@
17227
17399
 
17228
17400
  if (searchValue.trim().length >= 3) {
17229
17401
  immediateSearch(searchValue);
17402
+ setIsSearchFocused(false);
17230
17403
  }
17231
17404
  } else if (event.key === 'Escape') {
17232
17405
  setSearchValue('');
17406
+ setIsSearchFocused(false);
17233
17407
  }
17234
17408
  };
17235
17409
 
17410
+ React.useMemo(function () {
17411
+ fetchInitialSearchData(initialSearchData, setInitialSearchView);
17412
+ }, [initialSearchData, fetchInitialSearchData]);
17413
+ React.useEffect(function () {
17414
+ var handleClickOutside = function handleClickOutside(event) {
17415
+ if (searchResultsRef.current && !searchResultsRef.current.contains(event.target)) {
17416
+ setSearchValue('');
17417
+ setIsSearchFocused(false);
17418
+ setSearchResults({
17419
+ brands: [],
17420
+ products: []
17421
+ });
17422
+ }
17423
+ };
17424
+
17425
+ document.addEventListener('mousedown', handleClickOutside);
17426
+ return function () {
17427
+ document.removeEventListener('mousedown', handleClickOutside);
17428
+ };
17429
+ }, []);
17430
+ React.useEffect(function () {
17431
+ if (showSearchBar && searchInputRef.current) {
17432
+ searchInputRef.current.focus();
17433
+ }
17434
+ }, [showSearchBar]);
17435
+
17236
17436
  var onSearchClick = function onSearchClick() {
17237
17437
  setShowSearchbar(function (prev) {
17238
17438
  return !prev;
17239
17439
  });
17240
17440
  setSearchValue('');
17441
+ setIsSearchFocused(!showSearchBar);
17442
+
17443
+ if (showSearchBar) {
17444
+ setSearchResults({
17445
+ brands: [],
17446
+ products: []
17447
+ });
17448
+ }
17241
17449
  };
17242
17450
 
17243
17451
  var onMenuClick = function onMenuClick() {
@@ -17374,18 +17582,16 @@
17374
17582
  }, /*#__PURE__*/React__default.createElement("div", {
17375
17583
  className: "navbar__product-search"
17376
17584
  }, /*#__PURE__*/React__default.createElement("input", {
17585
+ ref: searchInputRef,
17377
17586
  className: "navbar__form-input",
17378
17587
  type: "text",
17379
17588
  placeholder: "Search for items and designs",
17380
17589
  value: searchValue,
17381
17590
  onChange: handleChange,
17382
- onKeyDown: handleKeyDown
17383
- }), searchLoading && /*#__PURE__*/React__default.createElement(BeatLoader, {
17384
- color: "#000000",
17385
- loading: searchLoading,
17386
- size: 5,
17387
- "aria-label": "Loading Spinner",
17388
- "data-testid": "loader"
17591
+ onKeyDown: handleKeyDown,
17592
+ onFocus: function onFocus() {
17593
+ return setIsSearchFocused(true);
17594
+ }
17389
17595
  })), /*#__PURE__*/React__default.createElement("button", {
17390
17596
  type: "button",
17391
17597
  onClick: onSearchClick
@@ -17395,14 +17601,24 @@
17395
17601
  className: "navbar__input-close-icon"
17396
17602
  })))), /*#__PURE__*/React__default.createElement(SearchResults, {
17397
17603
  searchValue: searchValue,
17398
- searchLoading: searchLoading,
17399
17604
  searchResults: searchResults,
17400
17605
  onViewAll: function onViewAll() {
17401
17606
  onSearchSubmit(searchValue);
17402
17607
  setSearchValue('');
17608
+ setSearchResults({
17609
+ brands: [],
17610
+ products: []
17611
+ });
17612
+ setIsSearchFocused(false);
17403
17613
  },
17404
17614
  onSearchSubmit: onSearchSubmit,
17405
- setSearchValue: setSearchValue
17615
+ setSearchValue: setSearchValue,
17616
+ searchResultsRef: searchResultsRef,
17617
+ initialSearchData: initialSearchView,
17618
+ isSearchFocused: isSearchFocused,
17619
+ setIsSearchFocused: setIsSearchFocused,
17620
+ currency: currency,
17621
+ currencySymbol: currencySymbol
17406
17622
  }), shop && /*#__PURE__*/React__default.createElement(LuxitySideNav, {
17407
17623
  accordionIcon: accordionIcon,
17408
17624
  logoSrc: logoSrc,