@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/CurrencySelect.js +27 -27
- package/GraphQLDropdownSelector.js +8 -8
- package/LuxityDesktopHeader.js +125 -83
- package/LuxityFooter.js +28 -27
- package/LuxityGraphQLDropdownSelector.js +8 -8
- package/LuxityMobileHeader.js +141 -99
- package/LuxitySideNav.js +27 -27
- package/MaterialSelector.js +8 -8
- package/ModelSelector.js +8 -8
- package/Tooltip.js +27 -27
- package/build/bundle.css +1 -1
- package/build/bundle.js +167 -112
- package/package.json +1 -1
package/CurrencySelect.js
CHANGED
|
@@ -42,10 +42,10 @@
|
|
|
42
42
|
var relativeInlineStyle = styled.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
43
43
|
var topMiddleBodyStyle = styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 1;\n bottom: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])));
|
|
44
44
|
var getTopMiddleArrowAfterStyle = function getTopMiddleArrowAfterStyle(props) {
|
|
45
|
-
return styled.css(_templateObject3 || (_templateObject3 = _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
|
|
45
|
+
return styled.css(_templateObject3 || (_templateObject3 = _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);
|
|
46
46
|
};
|
|
47
47
|
var getBottomMiddleBodyStyle = function getBottomMiddleBodyStyle(props) {
|
|
48
|
-
return styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props
|
|
48
|
+
return styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props.$bodyWidth);
|
|
49
49
|
};
|
|
50
50
|
var getBottomMiddleArrowAfterStyle = function getBottomMiddleArrowAfterStyle(props) {
|
|
51
51
|
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);
|
|
@@ -55,10 +55,10 @@
|
|
|
55
55
|
|
|
56
56
|
var getBodyStyle = function getBodyStyle() {
|
|
57
57
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
58
|
-
var _props
|
|
59
|
-
toolTipPosition = _props
|
|
58
|
+
var _props$$toolTipPositi = props.$toolTipPosition,
|
|
59
|
+
$toolTipPosition = _props$$toolTipPositi === void 0 ? '' : _props$$toolTipPositi;
|
|
60
60
|
|
|
61
|
-
switch (toolTipPosition) {
|
|
61
|
+
switch ($toolTipPosition) {
|
|
62
62
|
case 'top':
|
|
63
63
|
return topMiddleBodyStyle;
|
|
64
64
|
|
|
@@ -72,9 +72,9 @@
|
|
|
72
72
|
|
|
73
73
|
var getAfterStyling = function getAfterStyling() {
|
|
74
74
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
75
|
-
var toolTipPosition = props
|
|
75
|
+
var $toolTipPosition = props.$toolTipPosition;
|
|
76
76
|
|
|
77
|
-
switch (toolTipPosition) {
|
|
77
|
+
switch ($toolTipPosition) {
|
|
78
78
|
case 'top':
|
|
79
79
|
return getTopMiddleArrowAfterStyle(props);
|
|
80
80
|
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
};
|
|
88
88
|
|
|
89
89
|
var Body = styled__default.span(_templateObject$1 || (_templateObject$1 = _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) {
|
|
90
|
-
return props
|
|
90
|
+
return props.$bodyWidth;
|
|
91
91
|
}, function (props) {
|
|
92
92
|
return props.theme.colors.base || 'black';
|
|
93
93
|
}, function (props) {
|
|
@@ -163,33 +163,33 @@
|
|
|
163
163
|
});
|
|
164
164
|
});
|
|
165
165
|
|
|
166
|
+
/* eslint-disable react/require-default-props */
|
|
167
|
+
|
|
166
168
|
var Tooltip = function Tooltip(_ref) {
|
|
167
|
-
var children = _ref.children,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
169
|
+
var _ref$children = _ref.children,
|
|
170
|
+
children = _ref$children === void 0 ? null : _ref$children,
|
|
171
|
+
_ref$toolTipText = _ref.toolTipText,
|
|
172
|
+
toolTipText = _ref$toolTipText === void 0 ? '' : _ref$toolTipText,
|
|
173
|
+
_ref$toolTipPosition = _ref.toolTipPosition,
|
|
174
|
+
toolTipPosition = _ref$toolTipPosition === void 0 ? 'top' : _ref$toolTipPosition,
|
|
175
|
+
_ref$bodyWidth = _ref.bodyWidth,
|
|
176
|
+
bodyWidth = _ref$bodyWidth === void 0 ? '8em' : _ref$bodyWidth,
|
|
177
|
+
_ref$apexWidth = _ref.apexWidth,
|
|
178
|
+
apexWidth = _ref$apexWidth === void 0 ? '5px' : _ref$apexWidth,
|
|
179
|
+
_ref$containerClassNa = _ref.containerClassName,
|
|
180
|
+
containerClassName = _ref$containerClassNa === void 0 ? '' : _ref$containerClassNa,
|
|
181
|
+
_ref$bodyClassName = _ref.bodyClassName,
|
|
182
|
+
bodyClassName = _ref$bodyClassName === void 0 ? '' : _ref$bodyClassName;
|
|
174
183
|
return /*#__PURE__*/React__default.createElement(Container, {
|
|
175
184
|
className: containerClassName
|
|
176
185
|
}, children, /*#__PURE__*/React__default.createElement(Body, {
|
|
177
|
-
toolTipPosition: toolTipPosition,
|
|
178
|
-
bodyWidth: bodyWidth,
|
|
179
|
-
apexWidth: apexWidth,
|
|
186
|
+
$toolTipPosition: toolTipPosition,
|
|
187
|
+
$bodyWidth: bodyWidth,
|
|
188
|
+
$apexWidth: apexWidth,
|
|
180
189
|
className: bodyClassName
|
|
181
190
|
}, toolTipText));
|
|
182
191
|
};
|
|
183
192
|
|
|
184
|
-
Tooltip.defaultProps = {
|
|
185
|
-
children: null,
|
|
186
|
-
toolTipText: '',
|
|
187
|
-
toolTipPosition: 'top',
|
|
188
|
-
bodyWidth: '8em',
|
|
189
|
-
apexWidth: '5px',
|
|
190
|
-
containerClassName: '',
|
|
191
|
-
bodyClassName: ''
|
|
192
|
-
};
|
|
193
193
|
var Tooltip$1 = themed(Tooltip);
|
|
194
194
|
|
|
195
195
|
var CurrencySelect = function CurrencySelect(_ref) {
|
|
@@ -1313,10 +1313,10 @@
|
|
|
1313
1313
|
var relativeInlineStyle = styled.css(_templateObject$i || (_templateObject$i = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
1314
1314
|
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"])));
|
|
1315
1315
|
var getTopMiddleArrowAfterStyle = function getTopMiddleArrowAfterStyle(props) {
|
|
1316
|
-
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
|
|
1316
|
+
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);
|
|
1317
1317
|
};
|
|
1318
1318
|
var getBottomMiddleBodyStyle = function getBottomMiddleBodyStyle(props) {
|
|
1319
|
-
return styled.css(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props
|
|
1319
|
+
return styled.css(_templateObject4$1 || (_templateObject4$1 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props.$bodyWidth);
|
|
1320
1320
|
};
|
|
1321
1321
|
var getBottomMiddleArrowAfterStyle = function getBottomMiddleArrowAfterStyle(props) {
|
|
1322
1322
|
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);
|
|
@@ -1326,10 +1326,10 @@
|
|
|
1326
1326
|
|
|
1327
1327
|
var getBodyStyle = function getBodyStyle() {
|
|
1328
1328
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1329
|
-
var _props
|
|
1330
|
-
toolTipPosition = _props
|
|
1329
|
+
var _props$$toolTipPositi = props.$toolTipPosition,
|
|
1330
|
+
$toolTipPosition = _props$$toolTipPositi === void 0 ? '' : _props$$toolTipPositi;
|
|
1331
1331
|
|
|
1332
|
-
switch (toolTipPosition) {
|
|
1332
|
+
switch ($toolTipPosition) {
|
|
1333
1333
|
case 'top':
|
|
1334
1334
|
return topMiddleBodyStyle;
|
|
1335
1335
|
|
|
@@ -1343,9 +1343,9 @@
|
|
|
1343
1343
|
|
|
1344
1344
|
var getAfterStyling = function getAfterStyling() {
|
|
1345
1345
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
1346
|
-
var toolTipPosition = props
|
|
1346
|
+
var $toolTipPosition = props.$toolTipPosition;
|
|
1347
1347
|
|
|
1348
|
-
switch (toolTipPosition) {
|
|
1348
|
+
switch ($toolTipPosition) {
|
|
1349
1349
|
case 'top':
|
|
1350
1350
|
return getTopMiddleArrowAfterStyle(props);
|
|
1351
1351
|
|
|
@@ -1358,7 +1358,7 @@
|
|
|
1358
1358
|
};
|
|
1359
1359
|
|
|
1360
1360
|
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) {
|
|
1361
|
-
return props
|
|
1361
|
+
return props.$bodyWidth;
|
|
1362
1362
|
}, function (props) {
|
|
1363
1363
|
return props.theme.colors.base || 'black';
|
|
1364
1364
|
}, function (props) {
|
package/LuxityDesktopHeader.js
CHANGED
|
@@ -298,7 +298,7 @@
|
|
|
298
298
|
};
|
|
299
299
|
|
|
300
300
|
var SearchResults = function SearchResults(_ref) {
|
|
301
|
-
var _searchResults$brands, _searchResults$produc,
|
|
301
|
+
var _searchResults$brands, _searchResults$produc, _initialSearchData$tr, _initialSearchData$la, _limitBrands, _limitBrands2, _initialSearchData$la2, _searchResults$produc2;
|
|
302
302
|
|
|
303
303
|
var searchValue = _ref.searchValue,
|
|
304
304
|
searchResults = _ref.searchResults,
|
|
@@ -312,7 +312,10 @@
|
|
|
312
312
|
currency = _ref.currency,
|
|
313
313
|
currencySymbol = _ref.currencySymbol,
|
|
314
314
|
onProductSearchResultClick = _ref.onProductSearchResultClick,
|
|
315
|
-
onBrandSearchResultClick = _ref.onBrandSearchResultClick
|
|
315
|
+
onBrandSearchResultClick = _ref.onBrandSearchResultClick,
|
|
316
|
+
onCreateInterests = _ref.onCreateInterests,
|
|
317
|
+
noResultsImage = _ref.noResultsImage,
|
|
318
|
+
showNoResults = _ref.showNoResults;
|
|
316
319
|
|
|
317
320
|
var _useState = React.useState(false),
|
|
318
321
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -330,15 +333,16 @@
|
|
|
330
333
|
window.removeEventListener('resize', checkIfMobile);
|
|
331
334
|
};
|
|
332
335
|
}, []);
|
|
333
|
-
var
|
|
334
|
-
var hasResults = (searchResults === null || searchResults === void 0 ? void 0 : (_searchResults$
|
|
336
|
+
var hasSearchBeenPerformed = (searchValue === null || searchValue === void 0 ? void 0 : searchValue.trim().length) >= 3;
|
|
337
|
+
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;
|
|
335
338
|
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;
|
|
339
|
+
var shouldShowInitialData = isSearchFocused && (!hasSearchBeenPerformed || !hasResults && !showNoResults);
|
|
336
340
|
|
|
337
|
-
if (!
|
|
341
|
+
if (!isSearchFocused) {
|
|
338
342
|
return null;
|
|
339
343
|
}
|
|
340
344
|
|
|
341
|
-
if (!
|
|
345
|
+
if (!hasResults && !hasInitialData && !showNoResults) {
|
|
342
346
|
return null;
|
|
343
347
|
}
|
|
344
348
|
|
|
@@ -419,7 +423,36 @@
|
|
|
419
423
|
}
|
|
420
424
|
|
|
421
425
|
return brands;
|
|
422
|
-
};
|
|
426
|
+
}; // Show no results state
|
|
427
|
+
|
|
428
|
+
|
|
429
|
+
if (showNoResults) {
|
|
430
|
+
return /*#__PURE__*/React__default.createElement("div", {
|
|
431
|
+
className: "search-results",
|
|
432
|
+
ref: searchResultsRef
|
|
433
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
434
|
+
className: "search-results__no-results"
|
|
435
|
+
}, /*#__PURE__*/React__default.createElement("h2", {
|
|
436
|
+
className: "search-results__header"
|
|
437
|
+
}, "TOP MATCHES"), /*#__PURE__*/React__default.createElement("div", {
|
|
438
|
+
className: "search-results__no-results-content"
|
|
439
|
+
}, /*#__PURE__*/React__default.createElement("div", {
|
|
440
|
+
className: "search-results__no-results-image"
|
|
441
|
+
}, /*#__PURE__*/React__default.createElement("img", {
|
|
442
|
+
src: noResultsImage,
|
|
443
|
+
alt: "No results"
|
|
444
|
+
})), /*#__PURE__*/React__default.createElement("div", {
|
|
445
|
+
className: "search-results__no-results-text"
|
|
446
|
+
}, /*#__PURE__*/React__default.createElement("p", {
|
|
447
|
+
className: "search-results__no-results-title"
|
|
448
|
+
}, "There are currently no products in stock that match your selection"), /*#__PURE__*/React__default.createElement("p", {
|
|
449
|
+
className: "search-results__no-results-description"
|
|
450
|
+
}, "Create an interest now and receive instant notifications as your interests list."))), /*#__PURE__*/React__default.createElement("button", {
|
|
451
|
+
type: "button",
|
|
452
|
+
className: "search-results__create-interest-button",
|
|
453
|
+
onClick: onCreateInterests
|
|
454
|
+
}, "Create Interests")));
|
|
455
|
+
}
|
|
423
456
|
|
|
424
457
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
425
458
|
className: "search-results",
|
|
@@ -476,7 +509,7 @@
|
|
|
476
509
|
}
|
|
477
510
|
}, "View all items")), /*#__PURE__*/React__default.createElement("div", {
|
|
478
511
|
className: "search-results__product-list"
|
|
479
|
-
}, 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$
|
|
512
|
+
}, 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", {
|
|
480
513
|
type: "button",
|
|
481
514
|
className: "search-results__view-all-button",
|
|
482
515
|
onClick: function onClick() {
|
|
@@ -497,10 +530,10 @@
|
|
|
497
530
|
var relativeInlineStyle = styled.css(_templateObject || (_templateObject = _taggedTemplateLiteral(["\n position: relative;\n"])));
|
|
498
531
|
var topMiddleBodyStyle = styled.css(_templateObject2 || (_templateObject2 = _taggedTemplateLiteral(["\n position: absolute;\n z-index: 1;\n bottom: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n"])));
|
|
499
532
|
var getTopMiddleArrowAfterStyle = function getTopMiddleArrowAfterStyle(props) {
|
|
500
|
-
return styled.css(_templateObject3 || (_templateObject3 = _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
|
|
533
|
+
return styled.css(_templateObject3 || (_templateObject3 = _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);
|
|
501
534
|
};
|
|
502
535
|
var getBottomMiddleBodyStyle = function getBottomMiddleBodyStyle(props) {
|
|
503
|
-
return styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props
|
|
536
|
+
return styled.css(_templateObject4 || (_templateObject4 = _taggedTemplateLiteral(["\n position: absolute;\n top: 100%;\n left: calc(50% - ", " / 2);\n"])), props.$bodyWidth);
|
|
504
537
|
};
|
|
505
538
|
var getBottomMiddleArrowAfterStyle = function getBottomMiddleArrowAfterStyle(props) {
|
|
506
539
|
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);
|
|
@@ -510,10 +543,10 @@
|
|
|
510
543
|
|
|
511
544
|
var getBodyStyle = function getBodyStyle() {
|
|
512
545
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
513
|
-
var _props
|
|
514
|
-
toolTipPosition = _props
|
|
546
|
+
var _props$$toolTipPositi = props.$toolTipPosition,
|
|
547
|
+
$toolTipPosition = _props$$toolTipPositi === void 0 ? '' : _props$$toolTipPositi;
|
|
515
548
|
|
|
516
|
-
switch (toolTipPosition) {
|
|
549
|
+
switch ($toolTipPosition) {
|
|
517
550
|
case 'top':
|
|
518
551
|
return topMiddleBodyStyle;
|
|
519
552
|
|
|
@@ -527,9 +560,9 @@
|
|
|
527
560
|
|
|
528
561
|
var getAfterStyling = function getAfterStyling() {
|
|
529
562
|
var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
530
|
-
var toolTipPosition = props
|
|
563
|
+
var $toolTipPosition = props.$toolTipPosition;
|
|
531
564
|
|
|
532
|
-
switch (toolTipPosition) {
|
|
565
|
+
switch ($toolTipPosition) {
|
|
533
566
|
case 'top':
|
|
534
567
|
return getTopMiddleArrowAfterStyle(props);
|
|
535
568
|
|
|
@@ -542,7 +575,7 @@
|
|
|
542
575
|
};
|
|
543
576
|
|
|
544
577
|
var Body = styled__default.span(_templateObject$1 || (_templateObject$1 = _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) {
|
|
545
|
-
return props
|
|
578
|
+
return props.$bodyWidth;
|
|
546
579
|
}, function (props) {
|
|
547
580
|
return props.theme.colors.base || 'black';
|
|
548
581
|
}, function (props) {
|
|
@@ -618,33 +651,33 @@
|
|
|
618
651
|
});
|
|
619
652
|
});
|
|
620
653
|
|
|
654
|
+
/* eslint-disable react/require-default-props */
|
|
655
|
+
|
|
621
656
|
var Tooltip = function Tooltip(_ref) {
|
|
622
|
-
var children = _ref.children,
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
657
|
+
var _ref$children = _ref.children,
|
|
658
|
+
children = _ref$children === void 0 ? null : _ref$children,
|
|
659
|
+
_ref$toolTipText = _ref.toolTipText,
|
|
660
|
+
toolTipText = _ref$toolTipText === void 0 ? '' : _ref$toolTipText,
|
|
661
|
+
_ref$toolTipPosition = _ref.toolTipPosition,
|
|
662
|
+
toolTipPosition = _ref$toolTipPosition === void 0 ? 'top' : _ref$toolTipPosition,
|
|
663
|
+
_ref$bodyWidth = _ref.bodyWidth,
|
|
664
|
+
bodyWidth = _ref$bodyWidth === void 0 ? '8em' : _ref$bodyWidth,
|
|
665
|
+
_ref$apexWidth = _ref.apexWidth,
|
|
666
|
+
apexWidth = _ref$apexWidth === void 0 ? '5px' : _ref$apexWidth,
|
|
667
|
+
_ref$containerClassNa = _ref.containerClassName,
|
|
668
|
+
containerClassName = _ref$containerClassNa === void 0 ? '' : _ref$containerClassNa,
|
|
669
|
+
_ref$bodyClassName = _ref.bodyClassName,
|
|
670
|
+
bodyClassName = _ref$bodyClassName === void 0 ? '' : _ref$bodyClassName;
|
|
629
671
|
return /*#__PURE__*/React__default.createElement(Container, {
|
|
630
672
|
className: containerClassName
|
|
631
673
|
}, children, /*#__PURE__*/React__default.createElement(Body, {
|
|
632
|
-
toolTipPosition: toolTipPosition,
|
|
633
|
-
bodyWidth: bodyWidth,
|
|
634
|
-
apexWidth: apexWidth,
|
|
674
|
+
$toolTipPosition: toolTipPosition,
|
|
675
|
+
$bodyWidth: bodyWidth,
|
|
676
|
+
$apexWidth: apexWidth,
|
|
635
677
|
className: bodyClassName
|
|
636
678
|
}, toolTipText));
|
|
637
679
|
};
|
|
638
680
|
|
|
639
|
-
Tooltip.defaultProps = {
|
|
640
|
-
children: null,
|
|
641
|
-
toolTipText: '',
|
|
642
|
-
toolTipPosition: 'top',
|
|
643
|
-
bodyWidth: '8em',
|
|
644
|
-
apexWidth: '5px',
|
|
645
|
-
containerClassName: '',
|
|
646
|
-
bodyClassName: ''
|
|
647
|
-
};
|
|
648
681
|
var Tooltip$1 = themed(Tooltip);
|
|
649
682
|
|
|
650
683
|
var CurrencySelect = function CurrencySelect(_ref) {
|
|
@@ -706,7 +739,7 @@
|
|
|
706
739
|
|
|
707
740
|
var searchProductsFilter = function searchProductsFilter(search, limit, currencyCode) {
|
|
708
741
|
return {
|
|
709
|
-
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 ",
|
|
742
|
+
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 ",
|
|
710
743
|
variables: {
|
|
711
744
|
search: search,
|
|
712
745
|
limit: limit,
|
|
@@ -722,7 +755,8 @@
|
|
|
722
755
|
var endpoint = _ref.endpoint,
|
|
723
756
|
onSearchLoading = _ref.onSearchLoading,
|
|
724
757
|
currency = _ref.currency,
|
|
725
|
-
onSearchPreview = _ref.onSearchPreview
|
|
758
|
+
onSearchPreview = _ref.onSearchPreview,
|
|
759
|
+
onNoResults = _ref.onNoResults;
|
|
726
760
|
var currentSearchRequestToken = React.useRef(null);
|
|
727
761
|
var debounce = React.useCallback(function (func, wait) {
|
|
728
762
|
var timeout;
|
|
@@ -759,7 +793,12 @@
|
|
|
759
793
|
setSearchResults({
|
|
760
794
|
brands: [],
|
|
761
795
|
products: []
|
|
762
|
-
});
|
|
796
|
+
}); // Reset no results state when clearing search
|
|
797
|
+
|
|
798
|
+
if (typeof onNoResults === 'function') {
|
|
799
|
+
onNoResults(false);
|
|
800
|
+
}
|
|
801
|
+
|
|
763
802
|
return;
|
|
764
803
|
} // Cancel any ongoing search request to prevent race conditions
|
|
765
804
|
|
|
@@ -770,7 +809,12 @@
|
|
|
770
809
|
|
|
771
810
|
|
|
772
811
|
var newSearchToken = axios.CancelToken.source();
|
|
773
|
-
currentSearchRequestToken.current = newSearchToken; //
|
|
812
|
+
currentSearchRequestToken.current = newSearchToken; // Reset no results state when starting new search (user is typing)
|
|
813
|
+
|
|
814
|
+
if (typeof onNoResults === 'function') {
|
|
815
|
+
onNoResults(false);
|
|
816
|
+
} // Set loading to true when starting the search request
|
|
817
|
+
|
|
774
818
|
|
|
775
819
|
if (typeof onSearchLoading === 'function') {
|
|
776
820
|
onSearchLoading(true);
|
|
@@ -806,11 +850,15 @@
|
|
|
806
850
|
}); // Map products to old structure with prices
|
|
807
851
|
|
|
808
852
|
var products = productsData.map(function (product) {
|
|
853
|
+
// Generate product link: /products/{category_type}/{brand_slug}/{product_slug}
|
|
854
|
+
var categorySlug = product.category_type.toLowerCase().replace(/\s+/g, '-');
|
|
855
|
+
var brandSlug = product.luxity_brand.slug;
|
|
856
|
+
var productSlug = product.product_slug;
|
|
857
|
+
var link = "/products/".concat(categorySlug, "/").concat(brandSlug, "/").concat(productSlug);
|
|
809
858
|
return {
|
|
810
859
|
name: product.product.name,
|
|
811
860
|
brand: product.luxity_brand.name,
|
|
812
|
-
link:
|
|
813
|
-
// Using product ID for link
|
|
861
|
+
link: link,
|
|
814
862
|
price: product.product.price || 0,
|
|
815
863
|
promotion_price: product.product.promotion_price || null,
|
|
816
864
|
est_retail_price: product.product.est_retail_price || 0,
|
|
@@ -819,9 +867,9 @@
|
|
|
819
867
|
featured_image: product.featured_image,
|
|
820
868
|
on_promotion: product.on_promotion || false,
|
|
821
869
|
promotion_discount: product.promotion_discount || 0,
|
|
822
|
-
// Keep new fields for potential future use
|
|
823
870
|
id: product.id,
|
|
824
871
|
category_type: product.category_type,
|
|
872
|
+
product_slug: product.product_slug,
|
|
825
873
|
luxity_brand: product.luxity_brand
|
|
826
874
|
};
|
|
827
875
|
});
|
|
@@ -830,7 +878,13 @@
|
|
|
830
878
|
products: products,
|
|
831
879
|
total: totalResults
|
|
832
880
|
};
|
|
833
|
-
setSearchResults(searchResults);
|
|
881
|
+
setSearchResults(searchResults); // Check if we have no results (empty aggregations)
|
|
882
|
+
|
|
883
|
+
var hasNoResults = brandsData.length === 0 && productsData.length === 0;
|
|
884
|
+
|
|
885
|
+
if (typeof onNoResults === 'function') {
|
|
886
|
+
onNoResults(hasNoResults);
|
|
887
|
+
}
|
|
834
888
|
|
|
835
889
|
if (typeof onSearchPreview === 'function') {
|
|
836
890
|
var hasResults = brands.length > 0 || products.length > 0;
|
|
@@ -840,11 +894,7 @@
|
|
|
840
894
|
});
|
|
841
895
|
}
|
|
842
896
|
|
|
843
|
-
currentSearchRequestToken.current = null;
|
|
844
|
-
|
|
845
|
-
if (typeof onSearchLoading === 'function') {
|
|
846
|
-
onSearchLoading(false);
|
|
847
|
-
}
|
|
897
|
+
currentSearchRequestToken.current = null;
|
|
848
898
|
}
|
|
849
899
|
}).catch(function (error) {
|
|
850
900
|
if (!axios.isCancel(error)) {
|
|
@@ -852,14 +902,10 @@
|
|
|
852
902
|
brands: [],
|
|
853
903
|
products: []
|
|
854
904
|
});
|
|
855
|
-
currentSearchRequestToken.current = null;
|
|
856
|
-
|
|
857
|
-
if (typeof onSearchLoading === 'function') {
|
|
858
|
-
onSearchLoading(false);
|
|
859
|
-
}
|
|
905
|
+
currentSearchRequestToken.current = null;
|
|
860
906
|
}
|
|
861
907
|
});
|
|
862
|
-
}, [endpoint, currency, onSearchPreview, onSearchLoading]);
|
|
908
|
+
}, [endpoint, currency, onSearchPreview, onSearchLoading, onNoResults]);
|
|
863
909
|
var debouncedSearch = React.useMemo(function () {
|
|
864
910
|
return debounce(function (searchQuery, setSearchResults) {
|
|
865
911
|
return performSearch(searchQuery, setSearchResults);
|
|
@@ -964,22 +1010,6 @@
|
|
|
964
1010
|
}
|
|
965
1011
|
}, [searchValue, immediateSearch, setIsSearchFocused, setSearchValue]);
|
|
966
1012
|
};
|
|
967
|
-
var useSearchUrlQuery = function useSearchUrlQuery(setSearchValue, debouncedSearch) {
|
|
968
|
-
var hasProcessedUrlQuery = React.useRef(false);
|
|
969
|
-
React.useEffect(function () {
|
|
970
|
-
if (hasProcessedUrlQuery.current) return;
|
|
971
|
-
var urlParams = new URLSearchParams(window.location.search);
|
|
972
|
-
var queryParam = urlParams.get('q');
|
|
973
|
-
var isSearchPage = window.location.pathname.includes('/search');
|
|
974
|
-
|
|
975
|
-
if (queryParam && queryParam.trim() !== '' && isSearchPage) {
|
|
976
|
-
hasProcessedUrlQuery.current = true;
|
|
977
|
-
setSearchValue(queryParam);
|
|
978
|
-
debouncedSearch(queryParam);
|
|
979
|
-
}
|
|
980
|
-
}, [setSearchValue, debouncedSearch]);
|
|
981
|
-
return hasProcessedUrlQuery;
|
|
982
|
-
};
|
|
983
1013
|
|
|
984
1014
|
var removeCategoryByName = function removeCategoryByName(categories, name) {
|
|
985
1015
|
var _categories$filter;
|
|
@@ -1029,17 +1059,9 @@
|
|
|
1029
1059
|
isExclusive = _ref.isExclusive,
|
|
1030
1060
|
shop = _ref.shop,
|
|
1031
1061
|
app = _ref.app,
|
|
1032
|
-
categoryConfig = _ref.categoryConfig
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
endpoint: endpoint,
|
|
1036
|
-
onSearchLoading: onSearchLoading,
|
|
1037
|
-
currency: currency,
|
|
1038
|
-
onSearchPreview: onSearchPreview
|
|
1039
|
-
}),
|
|
1040
|
-
fetchInitialSearchData = _useSearch.fetchInitialSearchData,
|
|
1041
|
-
createDebouncedSearch = _useSearch.createDebouncedSearch,
|
|
1042
|
-
createImmediateSearch = _useSearch.createImmediateSearch;
|
|
1062
|
+
categoryConfig = _ref.categoryConfig,
|
|
1063
|
+
onCreateInterests = _ref.onCreateInterests,
|
|
1064
|
+
noResultsImage = _ref.noResultsImage;
|
|
1043
1065
|
|
|
1044
1066
|
var _useState = React.useState(''),
|
|
1045
1067
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -1090,14 +1112,30 @@
|
|
|
1090
1112
|
cachedResults = _useState16[0],
|
|
1091
1113
|
setCachedResults = _useState16[1];
|
|
1092
1114
|
|
|
1115
|
+
var _useState17 = React.useState(false),
|
|
1116
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
1117
|
+
showNoResults = _useState18[0],
|
|
1118
|
+
setShowNoResults = _useState18[1];
|
|
1119
|
+
|
|
1093
1120
|
var searchResultsRef = React.useRef(null);
|
|
1121
|
+
|
|
1122
|
+
var _useSearch = useSearch({
|
|
1123
|
+
endpoint: endpoint,
|
|
1124
|
+
onSearchLoading: onSearchLoading,
|
|
1125
|
+
currency: currency,
|
|
1126
|
+
onSearchPreview: onSearchPreview,
|
|
1127
|
+
onNoResults: setShowNoResults
|
|
1128
|
+
}),
|
|
1129
|
+
fetchInitialSearchData = _useSearch.fetchInitialSearchData,
|
|
1130
|
+
createDebouncedSearch = _useSearch.createDebouncedSearch,
|
|
1131
|
+
createImmediateSearch = _useSearch.createImmediateSearch;
|
|
1132
|
+
|
|
1094
1133
|
var debouncedSearch = createDebouncedSearch(function (results) {
|
|
1095
1134
|
setSearchResults(results);
|
|
1096
1135
|
setCachedResults(results);
|
|
1097
1136
|
});
|
|
1098
1137
|
var immediateSearch = createImmediateSearch(setSearchValue, setSearchResults, onSearchSubmit);
|
|
1099
1138
|
var handleChange = useSearchInputChange(setSearchValue, setIsSearchFocused, debouncedSearch, setSearchResults, setCachedResults);
|
|
1100
|
-
useSearchUrlQuery(setSearchValue, debouncedSearch);
|
|
1101
1139
|
useSearchClickOutside(searchResultsRef, searchResults, setCachedResults, setIsSearchFocused, setSearchResults);
|
|
1102
1140
|
|
|
1103
1141
|
var handleSearchClick = function handleSearchClick() {
|
|
@@ -1224,6 +1262,7 @@
|
|
|
1224
1262
|
products: []
|
|
1225
1263
|
});
|
|
1226
1264
|
setIsSearchFocused(false);
|
|
1265
|
+
setShowNoResults(false);
|
|
1227
1266
|
},
|
|
1228
1267
|
searchResultsRef: searchResultsRef,
|
|
1229
1268
|
onSearchSubmit: onSearchSubmit,
|
|
@@ -1234,7 +1273,10 @@
|
|
|
1234
1273
|
currency: currency,
|
|
1235
1274
|
currencySymbol: currencySymbol,
|
|
1236
1275
|
onProductSearchResultClick: onProductSearchResultClick,
|
|
1237
|
-
onBrandSearchResultClick: onBrandSearchResultClick
|
|
1276
|
+
onBrandSearchResultClick: onBrandSearchResultClick,
|
|
1277
|
+
onCreateInterests: onCreateInterests,
|
|
1278
|
+
noResultsImage: noResultsImage,
|
|
1279
|
+
showNoResults: showNoResults
|
|
1238
1280
|
}), /*#__PURE__*/React__default.createElement("nav", {
|
|
1239
1281
|
className: "navbar__nav-links navbar__nav-links--wrap"
|
|
1240
1282
|
}, renderDropdownLinks(), !!stores.length && /*#__PURE__*/React__default.createElement("li", {
|