@ubnt/store.core 9.15.0-alpha.1 → 9.15.0-alpha.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/CHANGELOG.md +9 -0
- package/lib/assets/attention.svg +5 -5
- package/lib/assets/attention2.svg +5 -5
- package/lib/assets/close2.svg +3 -2
- package/lib/assets/close3.svg +2 -3
- package/lib/assets/plus2.svg +4 -1
- package/lib/assets/plus3.svg +1 -4
- package/lib/assets/ucgMax.jpg +0 -0
- package/lib/assets/ucgMax2.jpg +0 -0
- package/lib/assets/ucgUltra.jpg +0 -0
- package/lib/assets/ucgUltra2.jpg +0 -0
- package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.js +1 -1
- package/lib/components/FeaturesSection_deprecated/AllFeaturesButton/AllFeaturesButton.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.js +1 -1
- package/lib/components/FeaturesSection_deprecated/FeaturesSection.mjs +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.js +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/close.svg.mjs +2 -2
- package/lib/components/FeaturesSection_deprecated/assets/plus.svg.js +1 -1
- package/lib/components/FeaturesSection_deprecated/assets/plus.svg.mjs +2 -2
- package/lib/components/Header/CartModalV2/Item/Item.js +3 -3
- package/lib/components/Header/CartModalV2/Item/Item.mjs +2 -2
- package/lib/components/LandingPagePro/LandingPagePro.d.ts +2 -2
- package/lib/components/LandingPagePro/LandingPagePro.js +31 -11
- package/lib/components/LandingPagePro/LandingPagePro.js.map +1 -1
- package/lib/components/LandingPagePro/LandingPagePro.mjs +32 -12
- package/lib/components/LandingPagePro/LandingPagePro.mjs.map +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.js +5 -5
- package/lib/components/ModelCompareV3/assets/Consoles/bigCompare/ucgUltra.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/ucgMax.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.js +1 -1
- package/lib/components/ModelCompareV3/assets/Consoles/ucgUltra.jpg.mjs +2 -2
- package/lib/components/ModelCompareV3/data/CloudGateways.js +6 -6
- package/lib/components/ModelCompareV3/data/CloudGateways.mjs +4 -4
- package/lib/components/ModelCompareV3/data/products/ucgMax.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgMax.mjs +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.js +1 -1
- package/lib/components/ModelCompareV3/data/products/ucgUltra.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/InputCard.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/InputCard/assets/attention.svg.mjs +2 -2
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/ProgressBarChart.mjs +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.js +1 -1
- package/lib/components/ResourceCalculatorV1/ComputeResourceCalculator/components/ProgressBarChart/assets/attention.svg.mjs +2 -2
- package/lib/components/VideoPlayerNew/VideoPlayer.js +1 -1
- package/lib/components/VideoPlayerNew/VideoPlayer.mjs +1 -1
- package/lib/components/VideoPlayerNew/assets/close.svg.js +1 -1
- package/lib/components/VideoPlayerNew/assets/close.svg.mjs +2 -2
- package/lib/constants/icons/generic/index.js +3 -3
- package/lib/constants/icons/generic/index.mjs +1 -1
- package/lib/constants/icons/generic/plus.svg.js +5 -5
- package/lib/constants/icons/generic/plus.svg.mjs +2 -2
- package/lib/contexts/MenuContext/context.js +11 -51
- package/lib/contexts/MenuContext/context.js.map +1 -1
- package/lib/contexts/MenuContext/context.mjs +12 -46
- package/lib/contexts/MenuContext/context.mjs.map +1 -1
- package/lib/contexts/MenuContext/mapping.d.ts +9 -45
- package/lib/contexts/MenuContext/mapping.js +41 -1365
- package/lib/contexts/MenuContext/mapping.js.map +1 -1
- package/lib/contexts/MenuContext/mapping.mjs +42 -1353
- package/lib/contexts/MenuContext/mapping.mjs.map +1 -1
- package/lib/contexts/MenuContext/types.d.ts +1 -2
- package/lib/contexts/MenuContext/types.js.map +1 -1
- package/lib/contexts/MenuContext/types.mjs.map +1 -1
- package/lib/contexts/MenuContext/utils.d.ts +1 -3
- package/lib/contexts/MenuContext/utils.js +1 -18
- package/lib/contexts/MenuContext/utils.js.map +1 -1
- package/lib/contexts/MenuContext/utils.mjs +2 -17
- package/lib/contexts/MenuContext/utils.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,15 @@
|
|
|
6
6
|
|
|
7
7
|
## Releases
|
|
8
8
|
|
|
9
|
+
### 9.15.0-alpha.2
|
|
10
|
+
|
|
11
|
+
- [Chore] [MIC-389](https://ubiquiti.atlassian.net/browse/MIC-389) Performance improvements:
|
|
12
|
+
- Remove unused data from Menu mapping
|
|
13
|
+
|
|
14
|
+
### 9.14.1
|
|
15
|
+
|
|
16
|
+
- [Fix] [NEP-3518](https://ubiquiti.atlassian.net/browse/NEP-3518) Add horizontal padding to input card footer note
|
|
17
|
+
|
|
9
18
|
### 9.15.0-alpha.1
|
|
10
19
|
|
|
11
20
|
- [Fix] [NEP-3518](https://ubiquiti.atlassian.net/browse/NEP-3518) Resource calc add padding to input card footer note
|
package/lib/assets/attention.svg
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
<circle cx="
|
|
3
|
-
<path d="
|
|
4
|
-
<path d="
|
|
5
|
-
<circle cx="
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="8" cy="8" r="8" fill="#A4A7B5"/>
|
|
3
|
+
<path d="M12.1136 10.125L8.64952 4.125C8.36084 3.625 7.63916 3.625 7.35048 4.125L3.88638 10.125C3.5977 10.625 3.95855 11.25 4.5359 11.25H11.4641C12.0415 11.25 12.4023 10.625 12.1136 10.125Z" stroke="white" stroke-width="0.5"/>
|
|
4
|
+
<path d="M8.19799 8.11407L8.42929 6.49497C8.46661 6.23373 8.2639 6 8 6C7.7361 6 7.53339 6.23373 7.57071 6.49497L7.80201 8.11407C7.83472 8.34302 8.16528 8.34303 8.19799 8.11407Z" fill="white"/>
|
|
5
|
+
<circle cx="8" cy="9.5" r="0.5" fill="white"/>
|
|
6
6
|
</svg>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
<circle cx="
|
|
3
|
-
<path d="
|
|
4
|
-
<path d="
|
|
5
|
-
<circle cx="
|
|
1
|
+
<svg width="18" height="18" viewBox="0 0 18 18" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="9" cy="9" r="9" fill="#F7D55E"/>
|
|
3
|
+
<path d="M9.73071 4.64062C9.40595 4.07813 8.59405 4.07812 8.26929 4.64062L4.37218 11.3906C4.04742 11.9531 4.45336 12.6562 5.10288 12.6562H12.8971C13.5466 12.6562 13.9526 11.9531 13.6278 11.3906L9.73071 4.64062Z" stroke="white" stroke-width="0.5625"/>
|
|
4
|
+
<path d="M9.22274 9.12833L9.48295 7.30685C9.52494 7.01295 9.29688 6.75 9 6.75C8.70312 6.75 8.47506 7.01295 8.51705 7.30685L8.77726 9.12833C8.81406 9.3859 9.18594 9.3859 9.22274 9.12833Z" fill="white"/>
|
|
5
|
+
<circle cx="9" cy="10.6875" r="0.5625" fill="#F7D55E"/>
|
|
6
6
|
</svg>
|
package/lib/assets/close2.svg
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.2175 18.6475C4.9275 18.9375 4.9275 19.4175 5.2175 19.7075C5.5075 19.9975 5.9875 19.9975 6.2775 19.7075L12.4675 13.5175L18.6575 19.7075C18.9475 19.9975 19.4275 19.9975 19.7175 19.7075C20.0075 19.4175 20.0075 18.9375 19.7175 18.6475L13.5275 12.4675L19.7175 6.2775C20.0075 5.9875 20.0075 5.5075 19.7175 5.2175C19.4275 4.9275 18.9475 4.9275 18.6575 5.2175L12.4675 11.4075L6.2775 5.2175C5.9875 4.9275 5.5075 4.9275 5.2175 5.2175C4.9275 5.5075 4.9275 5.9875 5.2175 6.2775L11.4075 12.4675L5.2175 18.6475Z" fill="currentColor"/>
|
|
3
4
|
</svg>
|
package/lib/assets/close3.svg
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
<svg width="
|
|
2
|
-
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.2175 18.6475C4.9275 18.9375 4.9275 19.4175 5.2175 19.7075C5.5075 19.9975 5.9875 19.9975 6.2775 19.7075L12.4675 13.5175L18.6575 19.7075C18.9475 19.9975 19.4275 19.9975 19.7175 19.7075C20.0075 19.4175 20.0075 18.9375 19.7175 18.6475L13.5275 12.4675L19.7175 6.2775C20.0075 5.9875 20.0075 5.5075 19.7175 5.2175C19.4275 4.9275 18.9475 4.9275 18.6575 5.2175L12.4675 11.4075L6.2775 5.2175C5.9875 4.9275 5.5075 4.9275 5.2175 5.2175C4.9275 5.5075 4.9275 5.9875 5.2175 6.2775L11.4075 12.4675L5.2175 18.6475Z" fill="currentColor"/>
|
|
1
|
+
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M5.7175 18.6475C5.4275 18.9375 5.4275 19.4175 5.7175 19.7075C6.0075 19.9975 6.4875 19.9975 6.7775 19.7075L12.9675 13.5175L19.1575 19.7075C19.4475 19.9975 19.9275 19.9975 20.2175 19.7075C20.5075 19.4175 20.5075 18.9375 20.2175 18.6475L14.0275 12.4675L20.2175 6.2775C20.5075 5.9875 20.5075 5.5075 20.2175 5.2175C19.9275 4.9275 19.4475 4.9275 19.1575 5.2175L12.9675 11.4075L6.7775 5.2175C6.4875 4.9275 6.0075 4.9275 5.7175 5.2175C5.4275 5.5075 5.4275 5.9875 5.7175 6.2775L11.9075 12.4675L5.7175 18.6475Z" fill="#36373C"/>
|
|
4
3
|
</svg>
|
package/lib/assets/plus2.svg
CHANGED
|
@@ -1 +1,4 @@
|
|
|
1
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="none"
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none"
|
|
2
|
+
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C8 0.453333 7.54667 0 7 0C6.45333 0 6 0.453333 6 1V6H1C0.453333 6 0 6.45333 0 7C0 7.54667 0.453333 8 1 8H6V13C6 13.5467 6.45333 14 7 14C7.54667 14 8 13.5467 8 13V8H13C13.5467 8 14 7.54667 14 7C14 6.45333 13.5467 6 13 6H8V1Z" fill="currentColor"/>
|
|
4
|
+
</svg>
|
package/lib/assets/plus3.svg
CHANGED
|
@@ -1,4 +1 @@
|
|
|
1
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="none"
|
|
2
|
-
xmlns="http://www.w3.org/2000/svg">
|
|
3
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M8 1C8 0.453333 7.54667 0 7 0C6.45333 0 6 0.453333 6 1V6H1C0.453333 6 0 6.45333 0 7C0 7.54667 0.453333 8 1 8H6V13C6 13.5467 6.45333 14 7 14C7.54667 14 8 13.5467 8 13V8H13C13.5467 8 14 7.54667 14 7C14 6.45333 13.5467 6 13 6H8V1Z" fill="currentColor"/>
|
|
4
|
-
</svg>
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M6.5 7.49985V13.4998C6.5 13.776 6.72386 13.9998 7 13.9998C7.27614 13.9998 7.5 13.776 7.5 13.4998V7.49985H13.5C13.7761 7.49985 14 7.27599 14 6.99985C14 6.7237 13.7761 6.49985 13.5 6.49985H7.5V0.499847C7.5 0.223705 7.27614 -0.000152588 7 -0.000152588C6.72386 -0.000152588 6.5 0.223705 6.5 0.499847V6.49985H0.5C0.223858 6.49985 0 6.7237 0 6.99985C0 7.27599 0.223857 7.49985 0.5 7.49985H6.5Z" fill="currentColor"/></svg>
|
package/lib/assets/ucgMax.jpg
CHANGED
|
Binary file
|
package/lib/assets/ucgMax2.jpg
CHANGED
|
Binary file
|
package/lib/assets/ucgUltra.jpg
CHANGED
|
Binary file
|
package/lib/assets/ucgUltra2.jpg
CHANGED
|
Binary file
|
|
@@ -5,7 +5,7 @@ require('../../StyleableSvgImage/index.js');
|
|
|
5
5
|
require('../assets/plus.svg.js');
|
|
6
6
|
var AllFeaturesButton_styles = require('./AllFeaturesButton.styles.js');
|
|
7
7
|
var StyleableSvgImage = require('../../StyleableSvgImage/StyleableSvgImage.js');
|
|
8
|
-
var PlusIcon = require("../../../assets/
|
|
8
|
+
var PlusIcon = require("../../../assets/plus2.svg");
|
|
9
9
|
function _interopDefault(e) {
|
|
10
10
|
return e && e.__esModule ? e : {
|
|
11
11
|
default: e
|
|
@@ -3,7 +3,7 @@ import '../../StyleableSvgImage/index.mjs';
|
|
|
3
3
|
import '../assets/plus.svg.mjs';
|
|
4
4
|
import { StyledButton, InnerWrap } from './AllFeaturesButton.styles.mjs';
|
|
5
5
|
import { StyleableSvgImage } from '../../StyleableSvgImage/StyleableSvgImage.mjs';
|
|
6
|
-
import PlusIcon__default from "../../../assets/
|
|
6
|
+
import PlusIcon__default from "../../../assets/plus2.svg";
|
|
7
7
|
"use strict";
|
|
8
8
|
const AllFeaturesButton = ({
|
|
9
9
|
className,
|
|
@@ -14,7 +14,7 @@ var FeaturesSection_styles = require('./FeaturesSection.styles.js');
|
|
|
14
14
|
var useLockBodyScrollCustom = require('../../hooks/useLockBodyScrollCustom.js');
|
|
15
15
|
var Container = require('../Container/Container.js');
|
|
16
16
|
var StyleableSvgImage = require('../StyleableSvgImage/StyleableSvgImage.js');
|
|
17
|
-
var CloseSvg = require("../../assets/
|
|
17
|
+
var CloseSvg = require("../../assets/close2.svg");
|
|
18
18
|
function _interopDefault(e) {
|
|
19
19
|
return e && e.__esModule ? e : {
|
|
20
20
|
default: e
|
|
@@ -12,7 +12,7 @@ import { WrapOuter, OverlayWrap, OverlayClose, Wrap, MetaWrap, SubHeading, Headi
|
|
|
12
12
|
import { useLockBodyScrollCustom } from '../../hooks/useLockBodyScrollCustom.mjs';
|
|
13
13
|
import { Container } from '../Container/Container.mjs';
|
|
14
14
|
import { StyleableSvgImage } from '../StyleableSvgImage/StyleableSvgImage.mjs';
|
|
15
|
-
import CloseSvg__default from "../../assets/
|
|
15
|
+
import CloseSvg__default from "../../assets/close2.svg";
|
|
16
16
|
"use strict";
|
|
17
17
|
const FEATURES_DEFAULT_PLAYBACK = 500;
|
|
18
18
|
const parseTime = time => parseFloat(time.toFixed(3));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "../../../assets/
|
|
2
|
-
export { default } from "../../../assets/
|
|
1
|
+
export * from "../../../assets/close2.svg";
|
|
2
|
+
export { default } from "../../../assets/close2.svg";
|
|
3
3
|
//# sourceMappingURL=close.svg.mjs.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from "../../../assets/
|
|
2
|
-
export { default } from "../../../assets/
|
|
1
|
+
export * from "../../../assets/plus2.svg";
|
|
2
|
+
export { default } from "../../../assets/plus2.svg";
|
|
3
3
|
//# sourceMappingURL=plus.svg.mjs.map
|
|
@@ -9,14 +9,14 @@ var Item_styles = require('./Item.styles.js');
|
|
|
9
9
|
var CustomImage = require('../../../CustomImage/CustomImage.js');
|
|
10
10
|
var StyleableSvgImage = require('../../../StyleableSvgImage/StyleableSvgImage.js');
|
|
11
11
|
var _externalAssets_CrL$Ujdd = require("../../../../assets/minus2.svg");
|
|
12
|
-
var
|
|
12
|
+
var _externalAssets_CVKiTNEM = require("../../../../assets/plus3.svg");
|
|
13
13
|
function _interopDefault(e) {
|
|
14
14
|
return e && e.__esModule ? e : {
|
|
15
15
|
default: e
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
var _externalAssets_CrL$Ujdd__default = /*#__PURE__*/_interopDefault(_externalAssets_CrL$Ujdd);
|
|
19
|
-
var
|
|
19
|
+
var _externalAssets_CVKiTNEM__default = /*#__PURE__*/_interopDefault(_externalAssets_CVKiTNEM);
|
|
20
20
|
"use strict";
|
|
21
21
|
const CartModalItem = function CartModalItem2({
|
|
22
22
|
renderImage,
|
|
@@ -80,7 +80,7 @@ const CartModalItem = function CartModalItem2({
|
|
|
80
80
|
disabled: item.controls.loading || controlsDisableIncrease,
|
|
81
81
|
children: /* @__PURE__ */jsxRuntime.jsx(Item_styles.ControlsIcon, {
|
|
82
82
|
children: /* @__PURE__ */jsxRuntime.jsx(StyleableSvgImage.StyleableSvgImage, {
|
|
83
|
-
src:
|
|
83
|
+
src: _externalAssets_CVKiTNEM__default["default"],
|
|
84
84
|
width: 9,
|
|
85
85
|
height: 9
|
|
86
86
|
})
|
|
@@ -7,7 +7,7 @@ import { Wrap, ProductAnchor, ProductImageWrap, ProductMeta, ProductTitle, Produ
|
|
|
7
7
|
import { CustomImage } from '../../../CustomImage/CustomImage.mjs';
|
|
8
8
|
import { StyleableSvgImage } from '../../../StyleableSvgImage/StyleableSvgImage.mjs';
|
|
9
9
|
import _externalAssets_CrL$Ujdd__default from "../../../../assets/minus2.svg";
|
|
10
|
-
import
|
|
10
|
+
import _externalAssets_CVKiTNEM__default from "../../../../assets/plus3.svg";
|
|
11
11
|
"use strict";
|
|
12
12
|
const CartModalItem = function CartModalItem2({
|
|
13
13
|
renderImage,
|
|
@@ -71,7 +71,7 @@ const CartModalItem = function CartModalItem2({
|
|
|
71
71
|
disabled: item.controls.loading || controlsDisableIncrease,
|
|
72
72
|
children: /* @__PURE__ */jsx(ControlsIcon, {
|
|
73
73
|
children: /* @__PURE__ */jsx(StyleableSvgImage, {
|
|
74
|
-
src:
|
|
74
|
+
src: _externalAssets_CVKiTNEM__default,
|
|
75
75
|
width: 9,
|
|
76
76
|
height: 9
|
|
77
77
|
})
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StoreId } from "../../types";
|
|
1
|
+
import type { StoreId } from "../../types";
|
|
2
2
|
import type { RenderImageFn } from "../CustomImage/CustomImage.types";
|
|
3
3
|
import type { LandingPageSearchProps } from "../LandingPageSearch/LandingPageSearch.types";
|
|
4
4
|
import type { CategoriesProps, FiltersProps, ProductTypeProps, SidebarTranslations } from "../LandingPageSidebar/LandingPageSidebar.types";
|
|
@@ -20,5 +20,5 @@ export interface LandingPageProProps {
|
|
|
20
20
|
/**
|
|
21
21
|
* @deprecated This component is deprecated and will be removed in the future.
|
|
22
22
|
*/
|
|
23
|
-
export declare const LandingPagePro: ({
|
|
23
|
+
export declare const LandingPagePro: ({ sidebarProps, productGridProps, searchProps, renderImage, isCartSummaryOpen, }: LandingPageProProps) => JSX.Element;
|
|
24
24
|
export {};
|
|
@@ -6,7 +6,6 @@ var react = require('react');
|
|
|
6
6
|
require('../../contexts/MenuContext/index.js');
|
|
7
7
|
var mapping = require('../../contexts/MenuContext/mapping.js');
|
|
8
8
|
require('../../types/index.js');
|
|
9
|
-
var collectionSlug = require('../../utils/collectionSlug.js');
|
|
10
9
|
var url = require('../../utils/url.js');
|
|
11
10
|
require('../LandingPageSearch/index.js');
|
|
12
11
|
require('../LandingPageSidebar/index.js');
|
|
@@ -22,7 +21,7 @@ var ProductGrid = require('../ProductGrid/ProductGrid.js');
|
|
|
22
21
|
"use strict";
|
|
23
22
|
const maximumPriceFilterLookup = /* @__PURE__ */new Map([[currencies.CAD.code, 7e4], [currencies.EUR.code, 7e4], [currencies.AED.code, 7e4]]);
|
|
24
23
|
const LandingPagePro = ({
|
|
25
|
-
storeId =
|
|
24
|
+
// storeId = StoreId.Us,
|
|
26
25
|
sidebarProps,
|
|
27
26
|
productGridProps,
|
|
28
27
|
searchProps,
|
|
@@ -35,12 +34,13 @@ const LandingPagePro = ({
|
|
|
35
34
|
const isSearchUsed = react.useMemo(() => !!searchProps.searchValue, [searchProps.searchValue]);
|
|
36
35
|
const categories = react.useMemo(() => {
|
|
37
36
|
const navItems = sidebarProps.productTypeBlock.activeType === "unifi" ? navigation.primary.items : navigation.secondary.items;
|
|
38
|
-
const items = navItems.filter(item => item.id !== mapping.NavigationItemId.UnifiIdentity && item.id !== mapping.NavigationItemId.UispSoftware
|
|
37
|
+
const items = navItems.filter(item => item.id !== mapping.NavigationItemId.UnifiIdentity && item.id !== mapping.NavigationItemId.UispSoftware
|
|
39
38
|
/**
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
!(item.id ===
|
|
39
|
+
* TODO: Hacky way to hide Amplifi from sidebar on US store
|
|
40
|
+
* since we don't pass storePath in `navigation` variable from useMenu()
|
|
41
|
+
*/
|
|
42
|
+
// !(item.id === NavigationItemId.Amplifi && storeId === StoreId.Us),
|
|
43
|
+
).map(item => {
|
|
44
44
|
switch (item.id) {
|
|
45
45
|
case mapping.NavigationItemId.Accessories:
|
|
46
46
|
return {
|
|
@@ -60,7 +60,9 @@ const LandingPagePro = ({
|
|
|
60
60
|
return {
|
|
61
61
|
label: innerItem.label,
|
|
62
62
|
items: innerItem.items,
|
|
63
|
-
slug:
|
|
63
|
+
slug:
|
|
64
|
+
// getCollectionSlugFromPath(innerItem.path) ||
|
|
65
|
+
url.slugify(innerItem.id),
|
|
64
66
|
products: []
|
|
65
67
|
};
|
|
66
68
|
});
|
|
@@ -82,11 +84,29 @@ const LandingPagePro = ({
|
|
|
82
84
|
if (isIncluded) {
|
|
83
85
|
return true;
|
|
84
86
|
}
|
|
85
|
-
return category.items.some(innerItem => innerItem?.items
|
|
87
|
+
return category.items.some(innerItem => innerItem?.items
|
|
88
|
+
// &&
|
|
89
|
+
// innerItem.items.some(
|
|
90
|
+
// (subItem) =>
|
|
91
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
92
|
+
// product.defaultCollectionSlug ||
|
|
93
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
94
|
+
// product.organizationalCollectionSlug,
|
|
95
|
+
// ),
|
|
96
|
+
);
|
|
86
97
|
});
|
|
87
98
|
if (items[activeCategoryIndex]) {
|
|
88
99
|
items[activeCategoryIndex]?.items[0]?.products?.push(product);
|
|
89
|
-
const activeCategoryInnerIndex = items[activeCategoryIndex]?.items.findIndex(item => item.slug === product.defaultCollectionSlug || item.slug === product.organizationalCollectionSlug
|
|
100
|
+
const activeCategoryInnerIndex = items[activeCategoryIndex]?.items.findIndex(item => item.slug === product.defaultCollectionSlug || item.slug === product.organizationalCollectionSlug
|
|
101
|
+
// ||
|
|
102
|
+
// item.items.some(
|
|
103
|
+
// (subItem) =>
|
|
104
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
105
|
+
// product.defaultCollectionSlug ||
|
|
106
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
107
|
+
// product.organizationalCollectionSlug,
|
|
108
|
+
// ),
|
|
109
|
+
);
|
|
90
110
|
if (typeof activeCategoryInnerIndex === "number" && items[activeCategoryIndex]?.items[activeCategoryInnerIndex] && activeCategoryInnerIndex !== 0) {
|
|
91
111
|
items[activeCategoryIndex]?.items[activeCategoryInnerIndex]?.products?.push(product);
|
|
92
112
|
}
|
|
@@ -96,7 +116,7 @@ const LandingPagePro = ({
|
|
|
96
116
|
...category,
|
|
97
117
|
items: category.items.filter(item => item?.products?.length)
|
|
98
118
|
}));
|
|
99
|
-
}, [navigation.primary.items, navigation.secondary.items, productGridProps?.products, sidebarProps.productTypeBlock.activeType, sidebarProps.translations.all
|
|
119
|
+
}, [navigation.primary.items, navigation.secondary.items, productGridProps?.products, sidebarProps.productTypeBlock.activeType, sidebarProps.translations.all]);
|
|
100
120
|
const maxPriceFilterAmount = react.useMemo(() => {
|
|
101
121
|
return {
|
|
102
122
|
amount: maximumPriceFilterLookup.get(sidebarProps.filtersBlock?.currency || generated.Currency.Cad) || 7e4,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LandingPagePro.js","sources":["../../../src/components/LandingPagePro/LandingPagePro.tsx"],"sourcesContent":["import { AED, CAD, EUR } from \"@dinero.js/currencies\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { useMenu } from \"../../contexts/MenuContext\";\nimport { NavigationItemId } from \"../../contexts/MenuContext/mapping\";\nimport type { ParsedNavigationSubSubItem } from \"../../contexts/MenuContext/types\";\nimport { Currency, StoreId } from \"../../types\";\nimport { getCollectionSlugFromPath } from \"../../utils/collectionSlug\";\nimport { slugify } from \"../../utils/url\";\nimport type { RenderImageFn } from \"../CustomImage/CustomImage.types\";\nimport { LandingPageSearch } from \"../LandingPageSearch\";\nimport type { LandingPageSearchProps } from \"../LandingPageSearch/LandingPageSearch.types\";\nimport { LandingPageSidebar } from \"../LandingPageSidebar\";\nimport type {\n CategoriesProps,\n FiltersProps,\n LandingPageSidebarProps,\n ProductTypeProps,\n SidebarTranslations,\n} from \"../LandingPageSidebar/LandingPageSidebar.types\";\nimport { ProductGrid } from \"../ProductGrid\";\nimport { ProductGridSortOption } from \"../ProductGrid/ProductGrid.types\";\nimport type {\n GridProduct,\n ProductGridProps,\n} from \"../ProductGrid/ProductGrid.types\";\nimport * as S from \"./LandingPagePro.styles\";\nimport { compareSortWeights, productHasSomeInStock } from \"./utils\";\n\ninterface SidebarProps {\n translations: SidebarTranslations;\n categoriesBlock?: CategoriesProps;\n filtersBlock?: Omit<FiltersProps, \"minValue\" | \"maxValue\">;\n productTypeBlock: ProductTypeProps;\n}\n\nexport interface LandingPageProProps {\n storeId?: StoreId;\n sidebarProps: SidebarProps;\n productGridProps: Omit<\n ProductGridProps,\n | \"renderImage\"\n | \"clearFilters\"\n | \"hasFilters\"\n | \"isLoading\"\n | \"isDefaultCategory\"\n >;\n searchProps: Omit<LandingPageSearchProps, \"renderImage\">;\n renderImage: RenderImageFn;\n isCartSummaryOpen?: boolean;\n}\n\n/**\n * Mapping of maximum price filter\n */\nconst maximumPriceFilterLookup = new Map([\n [CAD.code, 70000],\n [EUR.code, 70000],\n [AED.code, 70000],\n]);\n\n/**\n * @deprecated This component is deprecated and will be removed in the future.\n */\nexport const LandingPagePro = ({\n storeId = StoreId.Us,\n sidebarProps,\n productGridProps,\n searchProps,\n renderImage,\n isCartSummaryOpen,\n}: LandingPageProProps) => {\n const { navigation } = useMenu();\n\n const isSearchUsed = useMemo(\n () => !!searchProps.searchValue,\n [searchProps.searchValue],\n );\n\n const categories: LandingPageSidebarProps[\"categories\"] = useMemo(() => {\n const navItems =\n sidebarProps.productTypeBlock.activeType === \"unifi\"\n ? navigation.primary.items\n : navigation.secondary.items;\n const items = navItems\n .filter(\n (item) =>\n item.id !== NavigationItemId.UnifiIdentity &&\n item.id !== NavigationItemId.UispSoftware &&\n /**\n * TODO: Hacky way to hide Amplifi from sidebar on US store\n * since we don't pass storePath in `navigation` variable from useMenu()\n */\n !(item.id === NavigationItemId.Amplifi && storeId === StoreId.Us),\n )\n // HACK: Change the category titles\n .map((item) => {\n switch (item.id) {\n case NavigationItemId.Accessories:\n return {\n ...item,\n label: \"Accessories\",\n };\n case NavigationItemId.CameraSecurity:\n return {\n ...item,\n label: \"Camera Security\",\n };\n default:\n return item;\n }\n })\n .map((category) => {\n const innerItems: {\n label: string;\n slug: string;\n products: ProductGridProps[\"products\"];\n items: ParsedNavigationSubSubItem[];\n }[] = category.items\n // HACK: We are filtering out \"door-access\" from the 2nd level so that products are collected in 1st level \"Door Access\"\n .filter((item) => item.id !== \"door-access\")\n .map((innerItem) => {\n return {\n label: innerItem.label,\n items: innerItem.items,\n slug:\n getCollectionSlugFromPath(innerItem.path) ||\n slugify(innerItem.id),\n products: [],\n };\n });\n\n innerItems.unshift({\n label: `${sidebarProps.translations.all} ${category.label}`,\n slug: category.id,\n products: [],\n items: [],\n });\n\n return {\n label: category.label,\n id: category.id,\n items: innerItems,\n };\n });\n\n productGridProps?.products?.forEach((product) => {\n const activeCategoryIndex = items.findIndex((category) => {\n const isIncluded = category.items.some(\n (item) =>\n item.slug === product.defaultCollectionSlug ||\n item.slug === product.organizationalCollectionSlug,\n );\n\n if (isIncluded) {\n return true;\n }\n\n return category.items.some(\n (innerItem) =>\n innerItem?.items &&\n innerItem.items.some(\n (subItem) =>\n getCollectionSlugFromPath(subItem.path) ===\n product.defaultCollectionSlug ||\n getCollectionSlugFromPath(subItem.path) ===\n product.organizationalCollectionSlug,\n ),\n );\n });\n\n // Add product to \"All ...\" category\n if (items[activeCategoryIndex]) {\n items[activeCategoryIndex]?.items[0]?.products?.push(product);\n\n const activeCategoryInnerIndex = items[\n activeCategoryIndex\n ]?.items.findIndex(\n (item) =>\n item.slug === product.defaultCollectionSlug ||\n item.slug === product.organizationalCollectionSlug ||\n item.items.some(\n (subItem) =>\n getCollectionSlugFromPath(subItem.path) ===\n product.defaultCollectionSlug ||\n getCollectionSlugFromPath(subItem.path) ===\n product.organizationalCollectionSlug,\n ),\n );\n\n // Add product to the category where it belongs, except the \"All ...\" category\n if (\n typeof activeCategoryInnerIndex === \"number\" &&\n items[activeCategoryIndex]?.items[activeCategoryInnerIndex] &&\n activeCategoryInnerIndex !== 0\n ) {\n items[activeCategoryIndex]?.items[\n activeCategoryInnerIndex\n ]?.products?.push(product);\n }\n }\n });\n\n return items.map((category) => ({\n ...category,\n items: category.items.filter((item) => item?.products?.length),\n }));\n }, [\n navigation.primary.items,\n navigation.secondary.items,\n productGridProps?.products,\n sidebarProps.productTypeBlock.activeType,\n sidebarProps.translations.all,\n storeId,\n ]);\n\n const maxPriceFilterAmount = useMemo(() => {\n return {\n amount:\n maximumPriceFilterLookup.get(\n sidebarProps.filtersBlock?.currency || Currency.Cad,\n ) || 70000,\n currency: sidebarProps.filtersBlock?.currency || Currency.Cad,\n };\n }, [sidebarProps.filtersBlock?.currency]);\n\n const categoryProducts = useMemo(() => {\n // If category is set to \"all\" -> return all products\n if (!sidebarProps?.categoriesBlock?.activeCategory) {\n return productGridProps.products;\n }\n\n const activeCategoryIndex = categories.findIndex((category) =>\n category.items.some(\n (item) => item.slug === sidebarProps.categoriesBlock?.activeCategory,\n ),\n );\n const activeCategoryInnerIndex = categories[\n activeCategoryIndex\n ]?.items.findIndex(\n (item) => item.slug === sidebarProps.categoriesBlock?.activeCategory,\n );\n\n if (\n typeof activeCategoryInnerIndex === \"number\" &&\n categories[activeCategoryIndex]?.items[activeCategoryInnerIndex]\n ) {\n return (\n categories[activeCategoryIndex]?.items[activeCategoryInnerIndex]\n ?.products || []\n );\n }\n return [];\n }, [\n categories,\n productGridProps.products,\n sidebarProps.categoriesBlock?.activeCategory,\n ]);\n\n // #############################################################################\n // Products\n // #############################################################################\n const productsFilter = useCallback(\n (product: GridProduct): boolean => {\n // TODO: Make enum for filter values\n // Filter out non is in stock\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"inStock\",\n ) &&\n !product.variants.find((variant) => variant.isInStock)\n ) {\n return false;\n }\n // Filter out non coming soon\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"comingSoon\",\n ) &&\n // TODO: Might need to add check if one of the variants is in stock\n !product.variants.find((variant) => variant.isComingSoon)\n ) {\n return false;\n }\n // Filter out non previously purchased\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"previouslyPurchased\",\n ) &&\n !product.isPreviouslyPurchased\n ) {\n return false;\n }\n // Filter out non newest products\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\"newest\") &&\n !product.isNew\n ) {\n return false;\n }\n // Filter out non \"early access\" products\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"earlyAccess\",\n ) &&\n !product.variants.find((variant) => variant.isEarlyAccess)\n ) {\n return false;\n }\n // Filter out non \"price from\" products\n if (\n sidebarProps.filtersBlock?.activeFilters.priceFrom?.displayPrice &&\n product.displayPrice.amount <\n sidebarProps.filtersBlock.activeFilters.priceFrom.displayPrice.amount\n ) {\n return false;\n }\n // Filter out non \"price to\" products\n // eslint-disable-next-line sonarjs/prefer-single-boolean-return\n if (sidebarProps.filtersBlock?.activeFilters.priceTo?.displayPrice) {\n // First check if range \"to\" value has max value, then we need to show products that has bigger price too\n if (\n sidebarProps.filtersBlock?.activeFilters.priceTo?.displayPrice\n ?.amount >= maxPriceFilterAmount.amount\n ) {\n return true;\n } else if (\n product.displayPrice.amount >\n sidebarProps.filtersBlock.activeFilters.priceTo.displayPrice.amount\n ) {\n return false;\n }\n }\n\n return true;\n },\n [\n maxPriceFilterAmount.amount,\n sidebarProps.filtersBlock?.activeFilters?.filters,\n sidebarProps.filtersBlock?.activeFilters?.priceFrom?.displayPrice,\n sidebarProps.filtersBlock?.activeFilters?.priceTo?.displayPrice,\n ],\n );\n\n const productsSort = useCallback(\n (currentProduct: GridProduct, nextProduct: GridProduct): number => {\n // Stock\n const currentInStock = productHasSomeInStock(currentProduct);\n const nextInStock = productHasSomeInStock(nextProduct);\n\n // Resolve custom sort weighting\n // If search is used, we set to 0\n const sortWeight = !isSearchUsed\n ? compareSortWeights({\n current: currentProduct.sortWeight,\n next: nextProduct.sortWeight,\n })\n : 0;\n\n // Resolve sort value\n // If search is used, we set to 0\n let sortValue = !isSearchUsed\n ? (Number(!!nextInStock) - Number(!!currentInStock)) * 2\n : 0;\n\n switch (productGridProps.sortValue) {\n case ProductGridSortOption.lowestPrice:\n sortValue +=\n currentProduct.displayPrice.amount -\n nextProduct.displayPrice.amount;\n break;\n case ProductGridSortOption.highestPrice:\n sortValue +=\n nextProduct.displayPrice.amount -\n currentProduct.displayPrice.amount;\n break;\n case ProductGridSortOption.newestProducts:\n sortValue +=\n Number(!!nextProduct.isNew) - Number(!!currentProduct.isNew);\n break;\n case ProductGridSortOption.oldestProducts:\n sortValue +=\n Number(!!currentProduct.isNew) - Number(!!nextProduct.isNew);\n break;\n default:\n // Sort by featured\n if (\n // Not searching\n !isSearchUsed &&\n // Has no sort weight\n !sortWeight\n ) {\n sortValue +=\n Number(!!nextProduct.isFeatured) -\n Number(!!currentProduct.isFeatured);\n }\n break;\n }\n\n // Combine resolved values\n return sortValue + sortWeight;\n },\n [isSearchUsed, productGridProps.sortValue],\n );\n\n const products = useMemo(() => {\n if (categoryProducts === null) {\n return null;\n }\n\n return categoryProducts?.filter(productsFilter).sort(productsSort);\n }, [categoryProducts, productsFilter, productsSort]);\n\n const filtersBlock = useMemo(() => {\n if (!sidebarProps.filtersBlock) {\n return undefined;\n }\n\n const minValDisplayPrice = productGridProps?.products?.length\n ? productGridProps.products.reduce((prev, curr) =>\n prev.displayPrice.amount < curr.displayPrice.amount ? prev : curr,\n ).displayPrice\n : undefined;\n\n return {\n ...sidebarProps.filtersBlock,\n minValue: {\n displayPrice: minValDisplayPrice,\n },\n maxValue: {\n displayPrice: maxPriceFilterAmount,\n },\n };\n }, [\n maxPriceFilterAmount,\n productGridProps.products,\n sidebarProps.filtersBlock,\n ]);\n\n const hasFilters = useMemo(() => {\n return (\n !!filtersBlock?.activeFilters.filters?.length ||\n filtersBlock?.activeFilters.priceFrom !== undefined ||\n filtersBlock?.activeFilters.priceTo !== undefined\n );\n }, [\n filtersBlock?.activeFilters.filters?.length,\n filtersBlock?.activeFilters.priceFrom,\n filtersBlock?.activeFilters.priceTo,\n ]);\n\n const areCategoriesLoading = useMemo(\n () =>\n !!(\n sidebarProps.categoriesBlock &&\n sidebarProps.categoriesBlock.activeCategory === undefined\n ),\n [sidebarProps.categoriesBlock],\n );\n\n const isSidebarLoading = useMemo(\n () => areCategoriesLoading || !productGridProps.isFullyLoaded,\n [areCategoriesLoading, productGridProps.isFullyLoaded],\n );\n\n const isDefaultCategory = useMemo(\n () => !sidebarProps.categoriesBlock?.activeCategory,\n [sidebarProps.categoriesBlock?.activeCategory],\n );\n\n return (\n <S.Container size=\"desktop\">\n <LandingPageSidebar\n {...sidebarProps}\n isLoading={isSidebarLoading}\n categories={categories}\n filtersBlock={filtersBlock}\n isSearchUsed={isSearchUsed}\n productCount={productGridProps?.products?.length}\n productTypeProps={sidebarProps.productTypeBlock}\n isCartSummaryOpen={isCartSummaryOpen}\n />\n <S.ProductsContainer>\n {!sidebarProps.categoriesBlock ? (\n <S.SearchLoader height={40} />\n ) : (\n <LandingPageSearch {...searchProps} renderImage={renderImage} />\n )}\n <ProductGrid\n {...productGridProps}\n products={products}\n hasFilters={hasFilters}\n renderImage={renderImage}\n clearFilters={() => {\n filtersBlock?.onChange({});\n }}\n isLoading={areCategoriesLoading}\n isDefaultCategory={isDefaultCategory}\n />\n </S.ProductsContainer>\n </S.Container>\n );\n};\n"],"names":["maximumPriceFilterLookup","Map","CAD","code","EUR","AED","LandingPagePro","storeId","StoreId","Us","sidebarProps","productGridProps","searchProps","renderImage","isCartSummaryOpen","navigation","useMenu","isSearchUsed","useMemo","searchValue","categories","navItems","productTypeBlock","activeType","primary","items","secondary","filter","item","id","NavigationItemId","UnifiIdentity","UispSoftware","Amplifi","map","Accessories","label","CameraSecurity","category","innerItems","innerItem","slug","getCollectionSlugFromPath","path","slugify","products","unshift","translations","all","forEach","product","activeCategoryIndex","findIndex","isIncluded","some","defaultCollectionSlug","organizationalCollectionSlug","subItem","push","activeCategoryInnerIndex","length","maxPriceFilterAmount","amount","get","filtersBlock","currency","Currency","Cad","categoryProducts","categoriesBlock","activeCategory","productsFilter","useCallback","activeFilters","filters","includes","variants","find","variant","isInStock","isComingSoon","isPreviouslyPurchased","isNew","isEarlyAccess","priceFrom","displayPrice","priceTo","productsSort","currentProduct","nextProduct","currentInStock","productHasSomeInStock","nextInStock","sortWeight","compareSortWeights","current","next","sortValue","Number","ProductGridSortOption","lowestPrice","highestPrice","newestProducts","oldestProducts","isFeatured","sort","minValDisplayPrice","reduce","prev","curr","minValue","maxValue","hasFilters","areCategoriesLoading","isSidebarLoading","isFullyLoaded","isDefaultCategory","jsxs","S.Container","Container","size","children","jsx","LandingPageSidebar","isLoading","productCount","productTypeProps","S.ProductsContainer","S.SearchLoader","SearchLoader","height","LandingPageSearch","ProductGrid","clearFilters","onChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAuDA,MAAMA,wBAAA,GAAA,mBAA+BC,GAAI,CAAA,CACvC,CAACC,UAAI,CAAAA,GAAA,CAAAC,IAAA,EAAM,GAAK,CAAA,EAChB,CAACC,UAAI,CAAAA,GAAA,CAAAD,IAAA,EAAM,GAAK,CAAA,EAChB,CAACE,UAAI,CAAAA,GAAA,CAAAF,IAAA,EAAM,GAAK,CAAA,CACjB,CAAA;AAKM,MAAMG,iBAAiBA,CAAC;EAC7BC,UAAUC,SAAQ,CAAAA,OAAA,CAAAC,EAAA;EAClBC,YAAA;EACAC,gBAAA;EACAC,WAAA;EACAC,WAAA;EACAC;AACF,CAA2B,KAAA;EACnB,MAAA;IAAEC;GAAW,GAAIC,OAAAA,CAAAA,OAAQ,EAAA;EAE/B,MAAMC,YAAe,GAAAC,KAAA,CAAAA,OAAA,CACnB,MAAM,CAAC,CAACN,WAAY,CAAAO,WAAA,EACpB,CAACP,YAAYO,WAAW,CAAA,CAC1B;EAEM,MAAAC,UAAA,GAAoDF,KAAAA,CAAAA,QAAQ,MAAM;IAChE,MAAAG,QAAA,GACJX,aAAaY,gBAAiB,CAAAC,UAAA,KAAe,UACzCR,UA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CAAAA,IAAA,CAAAC,qBAAA,CAAAC,SAAA,EAAA;IAAYC,MAAK,SAChB;IAAAC,QAAA,EAAA,CAAA,eAAAC,UAAA,CAAAA,GAAA,CAACC,kBAAA,CAAAA,kBAAA,EAAA;MACE,GAAGjH,YAAA;MACJkH,SAAW,EAAAV,gBAAA;MACX9F,UAAA;MACA4C,YAAA;MACA/C,YAAA;MACA4G,YAAA,EAAclH,kBAAkBkC,QAAU,EAAAe,MAAA;MAC1CkE,kBAAkBpH,YAAa,CAAAY,gBAAA;MAC/BR;IAAA,CACF,CAAA,EAAA,eACAuG,eAAA,CAACU,qBAAAA,CAAAA,iBAAE,EAAF;MACEN,QAAA,EAAA,CAAA,CAAC/G,YAAa,CAAA2D,eAAA,GAAA,eACZqD,UAAA,CAAAA,GAAA,CAAAM,qBAAA,CAAAC,YAAA,EAAA;QAAeC,MAAQ,EAAA;OAAI,CAE5B,GAAA,eAAAR,UAAA,CAAAA,GAAA,CAACS,iBAAmB,CAAAA,iBAAA,EAAA;QAAA,GAAGvH;QAAaC;MAA0B,CAAA,CAAA,EAAA,eAEhE6G,UAAA,CAAAA,GAAA,CAACU,WAAA,CAAAA,WAAA,EAAA;QACE,GAAGzH,gBAAA;QACJkC,QAAA;QACAmE,UAAA;QACAnG,WAAA;QACAwH,cAAcA,CAAA,KAAM;UACJrE,YAAA,EAAAsE,QAAA,CAAS,CAAA,CAAE,CAAA;QAC3B,CAAA;QACAV,SAAW,EAAAX,oBAAA;QACXG;MAAA,CACF,CAAA;KACF,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
1
|
+
{"version":3,"file":"LandingPagePro.js","sources":["../../../src/components/LandingPagePro/LandingPagePro.tsx"],"sourcesContent":["import { AED, CAD, EUR } from \"@dinero.js/currencies\";\nimport { useCallback, useMemo } from \"react\";\n\nimport { useMenu } from \"../../contexts/MenuContext\";\nimport { NavigationItemId } from \"../../contexts/MenuContext/mapping\";\nimport type { ParsedNavigationSubSubItem } from \"../../contexts/MenuContext/types\";\nimport type { StoreId } from \"../../types\";\nimport { Currency } from \"../../types\";\n// import { getCollectionSlugFromPath } from \"../../utils/collectionSlug\";\nimport { slugify } from \"../../utils/url\";\nimport type { RenderImageFn } from \"../CustomImage/CustomImage.types\";\nimport { LandingPageSearch } from \"../LandingPageSearch\";\nimport type { LandingPageSearchProps } from \"../LandingPageSearch/LandingPageSearch.types\";\nimport { LandingPageSidebar } from \"../LandingPageSidebar\";\nimport type {\n CategoriesProps,\n FiltersProps,\n LandingPageSidebarProps,\n ProductTypeProps,\n SidebarTranslations,\n} from \"../LandingPageSidebar/LandingPageSidebar.types\";\nimport { ProductGrid } from \"../ProductGrid\";\nimport { ProductGridSortOption } from \"../ProductGrid/ProductGrid.types\";\nimport type {\n GridProduct,\n ProductGridProps,\n} from \"../ProductGrid/ProductGrid.types\";\nimport * as S from \"./LandingPagePro.styles\";\nimport { compareSortWeights, productHasSomeInStock } from \"./utils\";\n\ninterface SidebarProps {\n translations: SidebarTranslations;\n categoriesBlock?: CategoriesProps;\n filtersBlock?: Omit<FiltersProps, \"minValue\" | \"maxValue\">;\n productTypeBlock: ProductTypeProps;\n}\n\nexport interface LandingPageProProps {\n storeId?: StoreId;\n sidebarProps: SidebarProps;\n productGridProps: Omit<\n ProductGridProps,\n | \"renderImage\"\n | \"clearFilters\"\n | \"hasFilters\"\n | \"isLoading\"\n | \"isDefaultCategory\"\n >;\n searchProps: Omit<LandingPageSearchProps, \"renderImage\">;\n renderImage: RenderImageFn;\n isCartSummaryOpen?: boolean;\n}\n\n/**\n * Mapping of maximum price filter\n */\nconst maximumPriceFilterLookup = new Map([\n [CAD.code, 70000],\n [EUR.code, 70000],\n [AED.code, 70000],\n]);\n\n/**\n * @deprecated This component is deprecated and will be removed in the future.\n */\nexport const LandingPagePro = ({\n // storeId = StoreId.Us,\n sidebarProps,\n productGridProps,\n searchProps,\n renderImage,\n isCartSummaryOpen,\n}: LandingPageProProps) => {\n const { navigation } = useMenu();\n\n const isSearchUsed = useMemo(\n () => !!searchProps.searchValue,\n [searchProps.searchValue],\n );\n\n const categories: LandingPageSidebarProps[\"categories\"] = useMemo(() => {\n const navItems =\n sidebarProps.productTypeBlock.activeType === \"unifi\"\n ? navigation.primary.items\n : navigation.secondary.items;\n const items = navItems\n .filter(\n (item) =>\n item.id !== NavigationItemId.UnifiIdentity &&\n item.id !== NavigationItemId.UispSoftware,\n /**\n * TODO: Hacky way to hide Amplifi from sidebar on US store\n * since we don't pass storePath in `navigation` variable from useMenu()\n */\n // !(item.id === NavigationItemId.Amplifi && storeId === StoreId.Us),\n )\n // HACK: Change the category titles\n .map((item) => {\n switch (item.id) {\n case NavigationItemId.Accessories:\n return {\n ...item,\n label: \"Accessories\",\n };\n case NavigationItemId.CameraSecurity:\n return {\n ...item,\n label: \"Camera Security\",\n };\n default:\n return item;\n }\n })\n .map((category) => {\n const innerItems: {\n label: string;\n slug: string;\n products: ProductGridProps[\"products\"];\n items: ParsedNavigationSubSubItem[];\n }[] = category.items\n // HACK: We are filtering out \"door-access\" from the 2nd level so that products are collected in 1st level \"Door Access\"\n .filter((item) => item.id !== \"door-access\")\n .map((innerItem) => {\n return {\n label: innerItem.label,\n items: innerItem.items,\n slug:\n // getCollectionSlugFromPath(innerItem.path) ||\n slugify(innerItem.id),\n products: [],\n };\n });\n\n innerItems.unshift({\n label: `${sidebarProps.translations.all} ${category.label}`,\n slug: category.id,\n products: [],\n items: [],\n });\n\n return {\n label: category.label,\n id: category.id,\n items: innerItems,\n };\n });\n\n productGridProps?.products?.forEach((product) => {\n const activeCategoryIndex = items.findIndex((category) => {\n const isIncluded = category.items.some(\n (item) =>\n item.slug === product.defaultCollectionSlug ||\n item.slug === product.organizationalCollectionSlug,\n );\n\n if (isIncluded) {\n return true;\n }\n\n return category.items.some(\n (innerItem) => innerItem?.items,\n // &&\n // innerItem.items.some(\n // (subItem) =>\n // getCollectionSlugFromPath(subItem.path) ===\n // product.defaultCollectionSlug ||\n // getCollectionSlugFromPath(subItem.path) ===\n // product.organizationalCollectionSlug,\n // ),\n );\n });\n\n // Add product to \"All ...\" category\n if (items[activeCategoryIndex]) {\n items[activeCategoryIndex]?.items[0]?.products?.push(product);\n\n const activeCategoryInnerIndex = items[\n activeCategoryIndex\n ]?.items.findIndex(\n (item) =>\n item.slug === product.defaultCollectionSlug ||\n item.slug === product.organizationalCollectionSlug,\n // ||\n // item.items.some(\n // (subItem) =>\n // getCollectionSlugFromPath(subItem.path) ===\n // product.defaultCollectionSlug ||\n // getCollectionSlugFromPath(subItem.path) ===\n // product.organizationalCollectionSlug,\n // ),\n );\n\n // Add product to the category where it belongs, except the \"All ...\" category\n if (\n typeof activeCategoryInnerIndex === \"number\" &&\n items[activeCategoryIndex]?.items[activeCategoryInnerIndex] &&\n activeCategoryInnerIndex !== 0\n ) {\n items[activeCategoryIndex]?.items[\n activeCategoryInnerIndex\n ]?.products?.push(product);\n }\n }\n });\n\n return items.map((category) => ({\n ...category,\n items: category.items.filter((item) => item?.products?.length),\n }));\n }, [\n navigation.primary.items,\n navigation.secondary.items,\n productGridProps?.products,\n sidebarProps.productTypeBlock.activeType,\n sidebarProps.translations.all,\n ]);\n\n const maxPriceFilterAmount = useMemo(() => {\n return {\n amount:\n maximumPriceFilterLookup.get(\n sidebarProps.filtersBlock?.currency || Currency.Cad,\n ) || 70000,\n currency: sidebarProps.filtersBlock?.currency || Currency.Cad,\n };\n }, [sidebarProps.filtersBlock?.currency]);\n\n const categoryProducts = useMemo(() => {\n // If category is set to \"all\" -> return all products\n if (!sidebarProps?.categoriesBlock?.activeCategory) {\n return productGridProps.products;\n }\n\n const activeCategoryIndex = categories.findIndex((category) =>\n category.items.some(\n (item) => item.slug === sidebarProps.categoriesBlock?.activeCategory,\n ),\n );\n const activeCategoryInnerIndex = categories[\n activeCategoryIndex\n ]?.items.findIndex(\n (item) => item.slug === sidebarProps.categoriesBlock?.activeCategory,\n );\n\n if (\n typeof activeCategoryInnerIndex === \"number\" &&\n categories[activeCategoryIndex]?.items[activeCategoryInnerIndex]\n ) {\n return (\n categories[activeCategoryIndex]?.items[activeCategoryInnerIndex]\n ?.products || []\n );\n }\n return [];\n }, [\n categories,\n productGridProps.products,\n sidebarProps.categoriesBlock?.activeCategory,\n ]);\n\n // #############################################################################\n // Products\n // #############################################################################\n const productsFilter = useCallback(\n (product: GridProduct): boolean => {\n // TODO: Make enum for filter values\n // Filter out non is in stock\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"inStock\",\n ) &&\n !product.variants.find((variant) => variant.isInStock)\n ) {\n return false;\n }\n // Filter out non coming soon\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"comingSoon\",\n ) &&\n // TODO: Might need to add check if one of the variants is in stock\n !product.variants.find((variant) => variant.isComingSoon)\n ) {\n return false;\n }\n // Filter out non previously purchased\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"previouslyPurchased\",\n ) &&\n !product.isPreviouslyPurchased\n ) {\n return false;\n }\n // Filter out non newest products\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\"newest\") &&\n !product.isNew\n ) {\n return false;\n }\n // Filter out non \"early access\" products\n if (\n sidebarProps.filtersBlock?.activeFilters?.filters?.includes(\n \"earlyAccess\",\n ) &&\n !product.variants.find((variant) => variant.isEarlyAccess)\n ) {\n return false;\n }\n // Filter out non \"price from\" products\n if (\n sidebarProps.filtersBlock?.activeFilters.priceFrom?.displayPrice &&\n product.displayPrice.amount <\n sidebarProps.filtersBlock.activeFilters.priceFrom.displayPrice.amount\n ) {\n return false;\n }\n // Filter out non \"price to\" products\n // eslint-disable-next-line sonarjs/prefer-single-boolean-return\n if (sidebarProps.filtersBlock?.activeFilters.priceTo?.displayPrice) {\n // First check if range \"to\" value has max value, then we need to show products that has bigger price too\n if (\n sidebarProps.filtersBlock?.activeFilters.priceTo?.displayPrice\n ?.amount >= maxPriceFilterAmount.amount\n ) {\n return true;\n } else if (\n product.displayPrice.amount >\n sidebarProps.filtersBlock.activeFilters.priceTo.displayPrice.amount\n ) {\n return false;\n }\n }\n\n return true;\n },\n [\n maxPriceFilterAmount.amount,\n sidebarProps.filtersBlock?.activeFilters?.filters,\n sidebarProps.filtersBlock?.activeFilters?.priceFrom?.displayPrice,\n sidebarProps.filtersBlock?.activeFilters?.priceTo?.displayPrice,\n ],\n );\n\n const productsSort = useCallback(\n (currentProduct: GridProduct, nextProduct: GridProduct): number => {\n // Stock\n const currentInStock = productHasSomeInStock(currentProduct);\n const nextInStock = productHasSomeInStock(nextProduct);\n\n // Resolve custom sort weighting\n // If search is used, we set to 0\n const sortWeight = !isSearchUsed\n ? compareSortWeights({\n current: currentProduct.sortWeight,\n next: nextProduct.sortWeight,\n })\n : 0;\n\n // Resolve sort value\n // If search is used, we set to 0\n let sortValue = !isSearchUsed\n ? (Number(!!nextInStock) - Number(!!currentInStock)) * 2\n : 0;\n\n switch (productGridProps.sortValue) {\n case ProductGridSortOption.lowestPrice:\n sortValue +=\n currentProduct.displayPrice.amount -\n nextProduct.displayPrice.amount;\n break;\n case ProductGridSortOption.highestPrice:\n sortValue +=\n nextProduct.displayPrice.amount -\n currentProduct.displayPrice.amount;\n break;\n case ProductGridSortOption.newestProducts:\n sortValue +=\n Number(!!nextProduct.isNew) - Number(!!currentProduct.isNew);\n break;\n case ProductGridSortOption.oldestProducts:\n sortValue +=\n Number(!!currentProduct.isNew) - Number(!!nextProduct.isNew);\n break;\n default:\n // Sort by featured\n if (\n // Not searching\n !isSearchUsed &&\n // Has no sort weight\n !sortWeight\n ) {\n sortValue +=\n Number(!!nextProduct.isFeatured) -\n Number(!!currentProduct.isFeatured);\n }\n break;\n }\n\n // Combine resolved values\n return sortValue + sortWeight;\n },\n [isSearchUsed, productGridProps.sortValue],\n );\n\n const products = useMemo(() => {\n if (categoryProducts === null) {\n return null;\n }\n\n return categoryProducts?.filter(productsFilter).sort(productsSort);\n }, [categoryProducts, productsFilter, productsSort]);\n\n const filtersBlock = useMemo(() => {\n if (!sidebarProps.filtersBlock) {\n return undefined;\n }\n\n const minValDisplayPrice = productGridProps?.products?.length\n ? productGridProps.products.reduce((prev, curr) =>\n prev.displayPrice.amount < curr.displayPrice.amount ? prev : curr,\n ).displayPrice\n : undefined;\n\n return {\n ...sidebarProps.filtersBlock,\n minValue: {\n displayPrice: minValDisplayPrice,\n },\n maxValue: {\n displayPrice: maxPriceFilterAmount,\n },\n };\n }, [\n maxPriceFilterAmount,\n productGridProps.products,\n sidebarProps.filtersBlock,\n ]);\n\n const hasFilters = useMemo(() => {\n return (\n !!filtersBlock?.activeFilters.filters?.length ||\n filtersBlock?.activeFilters.priceFrom !== undefined ||\n filtersBlock?.activeFilters.priceTo !== undefined\n );\n }, [\n filtersBlock?.activeFilters.filters?.length,\n filtersBlock?.activeFilters.priceFrom,\n filtersBlock?.activeFilters.priceTo,\n ]);\n\n const areCategoriesLoading = useMemo(\n () =>\n !!(\n sidebarProps.categoriesBlock &&\n sidebarProps.categoriesBlock.activeCategory === undefined\n ),\n [sidebarProps.categoriesBlock],\n );\n\n const isSidebarLoading = useMemo(\n () => areCategoriesLoading || !productGridProps.isFullyLoaded,\n [areCategoriesLoading, productGridProps.isFullyLoaded],\n );\n\n const isDefaultCategory = useMemo(\n () => !sidebarProps.categoriesBlock?.activeCategory,\n [sidebarProps.categoriesBlock?.activeCategory],\n );\n\n return (\n <S.Container size=\"desktop\">\n <LandingPageSidebar\n {...sidebarProps}\n isLoading={isSidebarLoading}\n categories={categories}\n filtersBlock={filtersBlock}\n isSearchUsed={isSearchUsed}\n productCount={productGridProps?.products?.length}\n productTypeProps={sidebarProps.productTypeBlock}\n isCartSummaryOpen={isCartSummaryOpen}\n />\n <S.ProductsContainer>\n {!sidebarProps.categoriesBlock ? (\n <S.SearchLoader height={40} />\n ) : (\n <LandingPageSearch {...searchProps} renderImage={renderImage} />\n )}\n <ProductGrid\n {...productGridProps}\n products={products}\n hasFilters={hasFilters}\n renderImage={renderImage}\n clearFilters={() => {\n filtersBlock?.onChange({});\n }}\n isLoading={areCategoriesLoading}\n isDefaultCategory={isDefaultCategory}\n />\n </S.ProductsContainer>\n </S.Container>\n );\n};\n"],"names":["maximumPriceFilterLookup","Map","CAD","code","EUR","AED","LandingPagePro","sidebarProps","productGridProps","searchProps","renderImage","isCartSummaryOpen","navigation","useMenu","isSearchUsed","useMemo","searchValue","categories","navItems","productTypeBlock","activeType","primary","items","secondary","filter","item","id","NavigationItemId","UnifiIdentity","UispSoftware","map","Accessories","label","CameraSecurity","category","innerItems","innerItem","slug","slugify","products","unshift","translations","all","forEach","product","activeCategoryIndex","findIndex","isIncluded","some","defaultCollectionSlug","organizationalCollectionSlug","push","activeCategoryInnerIndex","length","maxPriceFilterAmount","amount","get","filtersBlock","currency","Currency","Cad","categoryProducts","categoriesBlock","activeCategory","productsFilter","useCallback","activeFilters","filters","includes","variants","find","variant","isInStock","isComingSoon","isPreviouslyPurchased","isNew","isEarlyAccess","priceFrom","displayPrice","priceTo","productsSort","currentProduct","nextProduct","currentInStock","productHasSomeInStock","nextInStock","sortWeight","compareSortWeights","current","next","sortValue","Number","ProductGridSortOption","lowestPrice","highestPrice","newestProducts","oldestProducts","isFeatured","sort","minValDisplayPrice","reduce","prev","curr","minValue","maxValue","hasFilters","areCategoriesLoading","isSidebarLoading","isFullyLoaded","isDefaultCategory","jsxs","S.Container","Container","size","children","jsx","LandingPageSidebar","isLoading","productCount","productTypeProps","S.ProductsContainer","S.SearchLoader","SearchLoader","height","LandingPageSearch","ProductGrid","clearFilters","onChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAwDA,MAAMA,wBAAA,GAAA,mBAA+BC,GAAI,CAAA,CACvC,CAACC,UAAI,CAAAA,GAAA,CAAAC,IAAA,EAAM,GAAK,CAAA,EAChB,CAACC,UAAI,CAAAA,GAAA,CAAAD,IAAA,EAAM,GAAK,CAAA,EAChB,CAACE,UAAI,CAAAA,GAAA,CAAAF,IAAA,EAAM,GAAK,CAAA,CACjB,CAAA;AAKM,MAA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,EAAAV,gBAAA;MACX1F,UAAA;MACAwC,YAAA;MACA3C,YAAA;MACAwG,YAAA,EAAc9G,kBAAkB+B,QAAU,EAAAc,MAAA;MAC1CkE,kBAAkBhH,YAAa,CAAAY,gBAAA;MAC/BR;IAAA,CACF,CAAA,EAAA,eACAmG,eAAA,CAACU,qBAAAA,CAAAA,iBAAE,EAAF;MACEN,QAAA,EAAA,CAAA,CAAC3G,YAAa,CAAAuD,eAAA,GAAA,eACZqD,UAAA,CAAAA,GAAA,CAAAM,qBAAA,CAAAC,YAAA,EAAA;QAAeC,MAAQ,EAAA;OAAI,CAE5B,GAAA,eAAAR,UAAA,CAAAA,GAAA,CAACS,iBAAmB,CAAAA,iBAAA,EAAA;QAAA,GAAGnH;QAAaC;MAA0B,CAAA,CAAA,EAAA,eAEhEyG,UAAA,CAAAA,GAAA,CAACU,WAAA,CAAAA,WAAA,EAAA;QACE,GAAGrH,gBAAA;QACJ+B,QAAA;QACAkE,UAAA;QACA/F,WAAA;QACAoH,cAAcA,CAAA,KAAM;UACJrE,YAAA,EAAAsE,QAAA,CAAS,CAAA,CAAE,CAAA;QAC3B,CAAA;QACAV,SAAW,EAAAX,oBAAA;QACXG;MAAA,CACF,CAAA;KACF,CAAA;EACF,CAAA,CAAA;AAEJ,CAAA;"}
|
|
@@ -4,7 +4,6 @@ import { useMemo, useCallback } from 'react';
|
|
|
4
4
|
import '../../contexts/MenuContext/index.mjs';
|
|
5
5
|
import { NavigationItemId } from '../../contexts/MenuContext/mapping.mjs';
|
|
6
6
|
import '../../types/index.mjs';
|
|
7
|
-
import { getCollectionSlugFromPath } from '../../utils/collectionSlug.mjs';
|
|
8
7
|
import { slugify } from '../../utils/url.mjs';
|
|
9
8
|
import '../LandingPageSearch/index.mjs';
|
|
10
9
|
import '../LandingPageSidebar/index.mjs';
|
|
@@ -13,14 +12,14 @@ import { ProductGridSortOption } from '../ProductGrid/ProductGrid.types.mjs';
|
|
|
13
12
|
import { Container, ProductsContainer, SearchLoader } from './LandingPagePro.styles.mjs';
|
|
14
13
|
import { productHasSomeInStock, compareSortWeights } from './utils.mjs';
|
|
15
14
|
import { useMenu } from '../../contexts/MenuContext/context.mjs';
|
|
16
|
-
import {
|
|
15
|
+
import { Currency } from '../../types/generated.mjs';
|
|
17
16
|
import { LandingPageSidebar } from '../LandingPageSidebar/LandingPageSidebar.mjs';
|
|
18
17
|
import { LandingPageSearch } from '../LandingPageSearch/LandingPageSearch.mjs';
|
|
19
18
|
import { ProductGrid } from '../ProductGrid/ProductGrid.mjs';
|
|
20
19
|
"use strict";
|
|
21
20
|
const maximumPriceFilterLookup = /* @__PURE__ */new Map([[CAD.code, 7e4], [EUR.code, 7e4], [AED.code, 7e4]]);
|
|
22
21
|
const LandingPagePro = ({
|
|
23
|
-
storeId = StoreId.Us,
|
|
22
|
+
// storeId = StoreId.Us,
|
|
24
23
|
sidebarProps,
|
|
25
24
|
productGridProps,
|
|
26
25
|
searchProps,
|
|
@@ -33,12 +32,13 @@ const LandingPagePro = ({
|
|
|
33
32
|
const isSearchUsed = useMemo(() => !!searchProps.searchValue, [searchProps.searchValue]);
|
|
34
33
|
const categories = useMemo(() => {
|
|
35
34
|
const navItems = sidebarProps.productTypeBlock.activeType === "unifi" ? navigation.primary.items : navigation.secondary.items;
|
|
36
|
-
const items = navItems.filter(item => item.id !== NavigationItemId.UnifiIdentity && item.id !== NavigationItemId.UispSoftware
|
|
35
|
+
const items = navItems.filter(item => item.id !== NavigationItemId.UnifiIdentity && item.id !== NavigationItemId.UispSoftware
|
|
37
36
|
/**
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
!(item.id === NavigationItemId.Amplifi && storeId === StoreId.Us)
|
|
37
|
+
* TODO: Hacky way to hide Amplifi from sidebar on US store
|
|
38
|
+
* since we don't pass storePath in `navigation` variable from useMenu()
|
|
39
|
+
*/
|
|
40
|
+
// !(item.id === NavigationItemId.Amplifi && storeId === StoreId.Us),
|
|
41
|
+
).map(item => {
|
|
42
42
|
switch (item.id) {
|
|
43
43
|
case NavigationItemId.Accessories:
|
|
44
44
|
return {
|
|
@@ -58,7 +58,9 @@ const LandingPagePro = ({
|
|
|
58
58
|
return {
|
|
59
59
|
label: innerItem.label,
|
|
60
60
|
items: innerItem.items,
|
|
61
|
-
slug:
|
|
61
|
+
slug:
|
|
62
|
+
// getCollectionSlugFromPath(innerItem.path) ||
|
|
63
|
+
slugify(innerItem.id),
|
|
62
64
|
products: []
|
|
63
65
|
};
|
|
64
66
|
});
|
|
@@ -80,11 +82,29 @@ const LandingPagePro = ({
|
|
|
80
82
|
if (isIncluded) {
|
|
81
83
|
return true;
|
|
82
84
|
}
|
|
83
|
-
return category.items.some(innerItem => innerItem?.items
|
|
85
|
+
return category.items.some(innerItem => innerItem?.items
|
|
86
|
+
// &&
|
|
87
|
+
// innerItem.items.some(
|
|
88
|
+
// (subItem) =>
|
|
89
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
90
|
+
// product.defaultCollectionSlug ||
|
|
91
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
92
|
+
// product.organizationalCollectionSlug,
|
|
93
|
+
// ),
|
|
94
|
+
);
|
|
84
95
|
});
|
|
85
96
|
if (items[activeCategoryIndex]) {
|
|
86
97
|
items[activeCategoryIndex]?.items[0]?.products?.push(product);
|
|
87
|
-
const activeCategoryInnerIndex = items[activeCategoryIndex]?.items.findIndex(item => item.slug === product.defaultCollectionSlug || item.slug === product.organizationalCollectionSlug
|
|
98
|
+
const activeCategoryInnerIndex = items[activeCategoryIndex]?.items.findIndex(item => item.slug === product.defaultCollectionSlug || item.slug === product.organizationalCollectionSlug
|
|
99
|
+
// ||
|
|
100
|
+
// item.items.some(
|
|
101
|
+
// (subItem) =>
|
|
102
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
103
|
+
// product.defaultCollectionSlug ||
|
|
104
|
+
// getCollectionSlugFromPath(subItem.path) ===
|
|
105
|
+
// product.organizationalCollectionSlug,
|
|
106
|
+
// ),
|
|
107
|
+
);
|
|
88
108
|
if (typeof activeCategoryInnerIndex === "number" && items[activeCategoryIndex]?.items[activeCategoryInnerIndex] && activeCategoryInnerIndex !== 0) {
|
|
89
109
|
items[activeCategoryIndex]?.items[activeCategoryInnerIndex]?.products?.push(product);
|
|
90
110
|
}
|
|
@@ -94,7 +114,7 @@ const LandingPagePro = ({
|
|
|
94
114
|
...category,
|
|
95
115
|
items: category.items.filter(item => item?.products?.length)
|
|
96
116
|
}));
|
|
97
|
-
}, [navigation.primary.items, navigation.secondary.items, productGridProps?.products, sidebarProps.productTypeBlock.activeType, sidebarProps.translations.all
|
|
117
|
+
}, [navigation.primary.items, navigation.secondary.items, productGridProps?.products, sidebarProps.productTypeBlock.activeType, sidebarProps.translations.all]);
|
|
98
118
|
const maxPriceFilterAmount = useMemo(() => {
|
|
99
119
|
return {
|
|
100
120
|
amount: maximumPriceFilterLookup.get(sidebarProps.filtersBlock?.currency || Currency.Cad) || 7e4,
|