@faststore/core 2.1.9 → 2.1.11
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/.next/BUILD_ID +1 -0
- package/.next/build-manifest.json +125 -0
- package/.next/cache/.tsbuildinfo +1 -0
- package/.next/cache/config.json +7 -0
- package/.next/cache/eslint/.cache_1gneedd +1 -0
- package/.next/cache/next-server.js.nft.json +1 -0
- package/.next/cache/webpack/client-production/0.pack +0 -0
- package/.next/cache/webpack/client-production/index.pack +0 -0
- package/.next/cache/webpack/server-production/0.pack +0 -0
- package/.next/cache/webpack/server-production/index.pack +0 -0
- package/.next/export-marker.json +1 -0
- package/.next/images-manifest.json +1 -0
- package/.next/next-server.js.nft.json +1 -0
- package/.next/package.json +1 -0
- package/.next/prerender-manifest.json +1 -0
- package/.next/react-loadable-manifest.json +44 -0
- package/.next/required-server-files.json +1 -0
- package/.next/routes-manifest.json +1 -0
- package/.next/server/chunks/123.js +58 -0
- package/.next/server/chunks/143.js +106 -0
- package/.next/server/chunks/183.js +90 -0
- package/.next/server/chunks/184.js +61 -0
- package/.next/server/chunks/205.js +722 -0
- package/.next/server/chunks/247.js +61 -0
- package/.next/server/chunks/253.js +535 -0
- package/.next/server/chunks/269.js +516 -0
- package/.next/server/chunks/287.js +58 -0
- package/.next/server/chunks/289.js +242 -0
- package/.next/server/chunks/312.js +697 -0
- package/.next/server/chunks/350.js +143 -0
- package/.next/server/chunks/487.js +9142 -0
- package/.next/server/chunks/502.js +626 -0
- package/.next/server/chunks/513.js +257 -0
- package/.next/server/chunks/576.js +90 -0
- package/.next/server/chunks/597.js +211 -0
- package/.next/server/chunks/650.js +9142 -0
- package/.next/server/chunks/676.js +32 -0
- package/.next/server/chunks/701.js +87 -0
- package/.next/server/chunks/74.js +3949 -0
- package/.next/server/chunks/825.js +4039 -0
- package/.next/server/chunks/854.js +72 -0
- package/.next/server/chunks/859.js +959 -0
- package/.next/server/chunks/886.js +120 -0
- package/.next/server/chunks/90.js +537 -0
- package/.next/server/chunks/907.js +1957 -0
- package/.next/server/chunks/98.js +124 -0
- package/.next/server/chunks/font-manifest.json +1 -0
- package/.next/server/font-manifest.json +1 -0
- package/.next/server/middleware-build-manifest.js +1 -0
- package/.next/server/middleware-manifest.json +6 -0
- package/.next/server/middleware-react-loadable-manifest.js +1 -0
- package/.next/server/pages/404.js +386 -0
- package/.next/server/pages/404.js.nft.json +1 -0
- package/.next/server/pages/500.js +388 -0
- package/.next/server/pages/500.js.nft.json +1 -0
- package/.next/server/pages/[...slug].js +778 -0
- package/.next/server/pages/[...slug].js.nft.json +1 -0
- package/.next/server/pages/[slug]/p.js +2388 -0
- package/.next/server/pages/[slug]/p.js.nft.json +1 -0
- package/.next/server/pages/_app.js +281 -0
- package/.next/server/pages/_app.js.nft.json +1 -0
- package/.next/server/pages/_document.js +340 -0
- package/.next/server/pages/_document.js.nft.json +1 -0
- package/.next/server/pages/_error.js +164 -0
- package/.next/server/pages/_error.js.nft.json +1 -0
- package/.next/server/pages/account.js +363 -0
- package/.next/server/pages/account.js.nft.json +1 -0
- package/.next/server/pages/api/graphql.js +365 -0
- package/.next/server/pages/api/graphql.js.nft.json +1 -0
- package/.next/server/pages/api/preview.js +119 -0
- package/.next/server/pages/api/preview.js.nft.json +1 -0
- package/.next/server/pages/checkout.js +363 -0
- package/.next/server/pages/checkout.js.nft.json +1 -0
- package/.next/server/pages/en-US/404.html +81 -0
- package/.next/server/pages/en-US/404.json +1 -0
- package/.next/server/pages/en-US/500.html +81 -0
- package/.next/server/pages/en-US/500.json +1 -0
- package/.next/server/pages/en-US/account.html +81 -0
- package/.next/server/pages/en-US/account.json +1 -0
- package/.next/server/pages/en-US/checkout.html +81 -0
- package/.next/server/pages/en-US/checkout.json +1 -0
- package/.next/server/pages/en-US/login.html +81 -0
- package/.next/server/pages/en-US/login.json +1 -0
- package/.next/server/pages/en-US/s.html +81 -0
- package/.next/server/pages/en-US/s.json +1 -0
- package/.next/server/pages/en-US.html +81 -0
- package/.next/server/pages/en-US.json +1 -0
- package/.next/server/pages/index.js +911 -0
- package/.next/server/pages/index.js.nft.json +1 -0
- package/.next/server/pages/login.js +368 -0
- package/.next/server/pages/login.js.nft.json +1 -0
- package/.next/server/pages/s.js +466 -0
- package/.next/server/pages/s.js.nft.json +1 -0
- package/.next/server/pages-manifest.json +16 -0
- package/.next/server/webpack-api-runtime.js +229 -0
- package/.next/server/webpack-runtime.js +229 -0
- package/.next/static/T9sG2WoM_My6Ij2K840vx/_buildManifest.js +1 -0
- package/.next/static/T9sG2WoM_My6Ij2K840vx/_ssgManifest.js +1 -0
- package/.next/static/chunks/143.dd8a556e6957baa1.js +1 -0
- package/.next/static/chunks/483-8cdf0a75faf72228.js +1 -0
- package/.next/static/chunks/495.0ecd099878b2a36d.js +1 -0
- package/.next/static/chunks/502.2270ffae48e3dccd.js +1 -0
- package/.next/static/chunks/548-ab84e9e8b49413ab.js +1 -0
- package/.next/static/chunks/597.f8d0595b113c70af.js +1 -0
- package/.next/static/chunks/64.7ea3677ac3a10e00.js +1 -0
- package/.next/static/chunks/651.7142f31ce1e052b3.js +1 -0
- package/.next/static/chunks/682-2ddb0eba685de554.js +1 -0
- package/.next/static/chunks/738-67a288ca3569cdbb.js +1 -0
- package/.next/static/chunks/741.52f7fb873418346f.js +1 -0
- package/.next/static/chunks/791-817b0bd2c0d34f5d.js +1 -0
- package/.next/static/chunks/98.97381d2021f86cd9.js +1 -0
- package/.next/static/chunks/framework-dfd14d7ce6600b03.js +1 -0
- package/.next/static/chunks/main-fd466221927468fd.js +1 -0
- package/.next/static/chunks/pages/404-c3b320b915df45bb.js +1 -0
- package/.next/static/chunks/pages/500-d37a3a2e931f6995.js +1 -0
- package/.next/static/chunks/pages/[...slug]-7370214f166e8584.js +1 -0
- package/.next/static/chunks/pages/[slug]/p-7b946d76b9f0d9db.js +1 -0
- package/.next/static/chunks/pages/_app-79d333aa6001a806.js +1 -0
- package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +1 -0
- package/.next/static/chunks/pages/account-86a1b6e7db03bab6.js +1 -0
- package/.next/static/chunks/pages/checkout-c77dbc66c0b35ec3.js +1 -0
- package/.next/static/chunks/pages/index-4f3314ad44c30b8f.js +1 -0
- package/.next/static/chunks/pages/login-bbf85bc59afce37c.js +1 -0
- package/.next/static/chunks/pages/s-dd486933e8ba7fbf.js +1 -0
- package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +1 -0
- package/.next/static/chunks/webpack-3eefca84f4c29194.js +1 -0
- package/.next/static/css/0cb9134bc2d237e2.css +1 -0
- package/.next/static/css/0d62ff2d64099b84.css +1 -0
- package/.next/static/css/0f8ce5203de8ae6f.css +1 -0
- package/.next/static/css/104f0f3ce3be32c6.css +1 -0
- package/.next/static/css/23a9d5dfc051ec6e.css +1 -0
- package/.next/static/css/2e00f7ba49c754b3.css +1 -0
- package/.next/static/css/6e41f1b6078c14c1.css +1 -0
- package/.next/static/css/7d822a137c54a781.css +1 -0
- package/.next/static/css/d4a0d9df8c6df555.css +1 -0
- package/.next/static/css/e02cdad8fc000339.css +1 -0
- package/.next/trace +76 -0
- package/package.json +2 -2
- package/public/~partytown/debug/partytown-atomics.js +556 -0
- package/public/~partytown/debug/partytown-media.js +374 -0
- package/public/~partytown/debug/partytown-sandbox-sw.js +543 -0
- package/public/~partytown/debug/partytown-sw.js +59 -0
- package/public/~partytown/debug/partytown-ww-atomics.js +1789 -0
- package/public/~partytown/debug/partytown-ww-sw.js +1781 -0
- package/public/~partytown/debug/partytown.js +72 -0
- package/public/~partytown/partytown-atomics.js +2 -0
- package/public/~partytown/partytown-media.js +2 -0
- package/public/~partytown/partytown-sw.js +2 -0
- package/public/~partytown/partytown.js +2 -0
- package/cms-webhook-urls.json +0 -5
|
@@ -0,0 +1,722 @@
|
|
|
1
|
+
exports.id = 205;
|
|
2
|
+
exports.ids = [205];
|
|
3
|
+
exports.modules = {
|
|
4
|
+
|
|
5
|
+
/***/ 94285:
|
|
6
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
7
|
+
|
|
8
|
+
"use strict";
|
|
9
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
10
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
11
|
+
/* harmony export */ });
|
|
12
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
|
|
13
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
14
|
+
|
|
15
|
+
const ProductShelf = (0,react__WEBPACK_IMPORTED_MODULE_0__.forwardRef)(function ProductShelf({ testId = 'fs-product-shelf', children, ...otherProps }, ref) {
|
|
16
|
+
return (react__WEBPACK_IMPORTED_MODULE_0___default().createElement("div", { ref: ref, "data-fs-product-shelf": true, "data-testid": testId, ...otherProps }, children));
|
|
17
|
+
});
|
|
18
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProductShelf);
|
|
19
|
+
//# sourceMappingURL=ProductShelf.js.map
|
|
20
|
+
|
|
21
|
+
/***/ }),
|
|
22
|
+
|
|
23
|
+
/***/ 86237:
|
|
24
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
25
|
+
|
|
26
|
+
"use strict";
|
|
27
|
+
|
|
28
|
+
// EXPORTS
|
|
29
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
30
|
+
"z": () => (/* binding */ Components),
|
|
31
|
+
"x": () => (/* binding */ productShelfPropsCustomization)
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// EXTERNAL MODULE: ../components/dist/organisms/ProductShelf/ProductShelf.js
|
|
35
|
+
var ProductShelf = __webpack_require__(94285);
|
|
36
|
+
// EXTERNAL MODULE: ./src/components/product/ProductCard/index.ts + 4 modules
|
|
37
|
+
var ProductCard = __webpack_require__(56475);
|
|
38
|
+
// EXTERNAL MODULE: external "react"
|
|
39
|
+
var external_react_ = __webpack_require__(16689);
|
|
40
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
41
|
+
// EXTERNAL MODULE: ../components/dist/molecules/IconButton/IconButton.js
|
|
42
|
+
var IconButton = __webpack_require__(82765);
|
|
43
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Icon/Icon.js
|
|
44
|
+
var Icon = __webpack_require__(25045);
|
|
45
|
+
// EXTERNAL MODULE: external "react-swipeable"
|
|
46
|
+
var external_react_swipeable_ = __webpack_require__(3789);
|
|
47
|
+
;// CONCATENATED MODULE: ../components/dist/hooks/useSlider.js
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
const nextPage = (current, total) => (current + 1) % total;
|
|
51
|
+
const previousPage = (current, total) => (total - ((total - current + 1) % total)) % total;
|
|
52
|
+
function reducer(state, action) {
|
|
53
|
+
switch (action.type) {
|
|
54
|
+
case 'NEXT_PAGE': {
|
|
55
|
+
// If `state.infinite` is true, we need to take into account an extra
|
|
56
|
+
// page in the calculation. This extra page is a clone of the first page.
|
|
57
|
+
const adjustedTotalPages = state.infinite
|
|
58
|
+
? state.totalPages + 1
|
|
59
|
+
: state.totalPages;
|
|
60
|
+
const nextPageIndex = nextPage(state.currentPage, adjustedTotalPages);
|
|
61
|
+
const nextItemIndex = (nextPageIndex % adjustedTotalPages) * state.itemsPerPage;
|
|
62
|
+
return {
|
|
63
|
+
...state,
|
|
64
|
+
sliding: true,
|
|
65
|
+
slideDirection: 'next',
|
|
66
|
+
currentItem: nextItemIndex,
|
|
67
|
+
currentPage: nextPageIndex,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
case 'PREVIOUS_PAGE': {
|
|
71
|
+
// If `state.infinite` is true, we need to take into account an extra
|
|
72
|
+
// page in the calculation. This extra page is a clone of the first page.
|
|
73
|
+
const adjustedTotalPages = state.infinite
|
|
74
|
+
? state.totalPages + 1
|
|
75
|
+
: state.totalPages;
|
|
76
|
+
// If `state.infinite` is true and we're currently on page 0, we need to
|
|
77
|
+
// let the slider go to page -1. This -1 page is a clone of the last page.
|
|
78
|
+
const shouldGoToClone = state.infinite && state.currentPage === 0;
|
|
79
|
+
const previousPageIndex = shouldGoToClone
|
|
80
|
+
? -1
|
|
81
|
+
: previousPage(state.currentPage, state.totalPages);
|
|
82
|
+
return {
|
|
83
|
+
...state,
|
|
84
|
+
sliding: true,
|
|
85
|
+
slideDirection: 'previous',
|
|
86
|
+
currentItem: (previousPageIndex % adjustedTotalPages) * state.itemsPerPage,
|
|
87
|
+
currentPage: previousPageIndex,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
case 'GO_TO_PAGE': {
|
|
91
|
+
if (action.payload.pageIndex === state.currentPage) {
|
|
92
|
+
return state;
|
|
93
|
+
}
|
|
94
|
+
return {
|
|
95
|
+
...state,
|
|
96
|
+
sliding: action.payload.shouldSlide,
|
|
97
|
+
slideDirection: action.payload.pageIndex > state.currentPage ? 'next' : 'previous',
|
|
98
|
+
currentItem: (action.payload.pageIndex % state.totalPages) * state.itemsPerPage,
|
|
99
|
+
currentPage: action.payload.pageIndex,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
case 'STOP_SLIDE':
|
|
103
|
+
return { ...state, sliding: false };
|
|
104
|
+
default:
|
|
105
|
+
return state;
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
const defaultSliderState = (totalItems, itemsPerPage, infinite) => ({
|
|
109
|
+
currentItem: 0,
|
|
110
|
+
currentPage: 0,
|
|
111
|
+
sliding: false,
|
|
112
|
+
slideDirection: 'next',
|
|
113
|
+
totalItems,
|
|
114
|
+
itemsPerPage,
|
|
115
|
+
totalPages: Math.ceil(totalItems / itemsPerPage),
|
|
116
|
+
infinite,
|
|
117
|
+
});
|
|
118
|
+
const slide = (page, dispatch) => {
|
|
119
|
+
if (page === 'next') {
|
|
120
|
+
dispatch({ type: 'NEXT_PAGE' });
|
|
121
|
+
}
|
|
122
|
+
if (page === 'previous') {
|
|
123
|
+
dispatch({ type: 'PREVIOUS_PAGE' });
|
|
124
|
+
}
|
|
125
|
+
if (typeof page === 'number') {
|
|
126
|
+
dispatch({
|
|
127
|
+
type: 'GO_TO_PAGE',
|
|
128
|
+
payload: {
|
|
129
|
+
pageIndex: page,
|
|
130
|
+
shouldSlide: true,
|
|
131
|
+
},
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
const useSlider = ({ totalItems, itemsPerPage = 1, infiniteMode = false, shouldSlideOnSwipe = true, ...swipeableConfigOverrides }) => {
|
|
136
|
+
const [sliderState, sliderDispatch] = (0,external_react_.useReducer)(reducer, undefined, () => defaultSliderState(totalItems, itemsPerPage, infiniteMode));
|
|
137
|
+
const handlers = (0,external_react_swipeable_.useSwipeable)({
|
|
138
|
+
onSwipedRight: () => shouldSlideOnSwipe && slide('previous', sliderDispatch),
|
|
139
|
+
onSwipedLeft: () => shouldSlideOnSwipe && slide('next', sliderDispatch),
|
|
140
|
+
trackMouse: true,
|
|
141
|
+
...swipeableConfigOverrides,
|
|
142
|
+
});
|
|
143
|
+
return {
|
|
144
|
+
handlers,
|
|
145
|
+
slide,
|
|
146
|
+
sliderState,
|
|
147
|
+
sliderDispatch,
|
|
148
|
+
};
|
|
149
|
+
};
|
|
150
|
+
//# sourceMappingURL=useSlider.js.map
|
|
151
|
+
// EXTERNAL MODULE: ../components/dist/atoms/Button/Button.js
|
|
152
|
+
var Button = __webpack_require__(57578);
|
|
153
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/Carousel/CarouselBullets.js
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
const defaultAriaLabel = (id, idx, isActive) => isActive ? `Current page from ${id}` : `Go to page ${idx + 1} from ${id}`;
|
|
157
|
+
const CarouselBullets = (0,external_react_.forwardRef)(function Bullets({ id, totalQuantity, activeBullet, onClick, testId = 'fs-carousel-bullets', ariaLabelGenerator = defaultAriaLabel, ariaControlsGenerator, ...otherProps }, ref) {
|
|
158
|
+
const bulletIndexes = (0,external_react_.useMemo)(() => Array(totalQuantity).fill(0), [totalQuantity]);
|
|
159
|
+
return (external_react_default().createElement("div", { ref: ref, "data-fs-carousel-bullets": true, "data-testid": testId, role: "tablist", ...otherProps }, bulletIndexes.map((_, idx) => {
|
|
160
|
+
const isActive = activeBullet === idx;
|
|
161
|
+
return (external_react_default().createElement(Button/* default */.Z, { key: `${id}-${idx}`, role: "tab", tabIndex: -1, "data-fs-carousel-bullet": true, testId: `${testId}-bullet`, onClick: (e) => onClick(e, idx), "aria-label": ariaLabelGenerator(id, idx, isActive), "aria-controls": ariaControlsGenerator?.(idx), "aria-selected": isActive, variant: "tertiary" }));
|
|
162
|
+
})));
|
|
163
|
+
});
|
|
164
|
+
/* harmony default export */ const Carousel_CarouselBullets = (CarouselBullets);
|
|
165
|
+
//# sourceMappingURL=CarouselBullets.js.map
|
|
166
|
+
;// CONCATENATED MODULE: ../components/dist/hooks/useSlideVisibility.js
|
|
167
|
+
|
|
168
|
+
function isSlideVisible({ itemsPerPage, currentSlide, slideIdx, totalItems, }) {
|
|
169
|
+
const isClonedSlide = currentSlide < 0 || currentSlide >= totalItems;
|
|
170
|
+
const isVisible = slideIdx >= currentSlide && slideIdx < currentSlide + itemsPerPage;
|
|
171
|
+
return isClonedSlide || isVisible;
|
|
172
|
+
}
|
|
173
|
+
const useSlideVisibility = ({ currentSlide, itemsPerPage, totalItems, }) => {
|
|
174
|
+
/** Keeps track of slides that have been visualized before.
|
|
175
|
+
* We want to keep rendering them because the issue is mostly rendering
|
|
176
|
+
* slides that might never be viewed; On the other hand, hiding slides
|
|
177
|
+
* that were visible causes visual glitches */
|
|
178
|
+
const visitedSlides = (0,external_react_.useRef)(new Set());
|
|
179
|
+
(0,external_react_.useEffect)(() => {
|
|
180
|
+
for (let i = 0; i < itemsPerPage; i++) {
|
|
181
|
+
visitedSlides.current.add(currentSlide + i);
|
|
182
|
+
}
|
|
183
|
+
}, [currentSlide, itemsPerPage]);
|
|
184
|
+
const isItemVisible = (index) => isSlideVisible({
|
|
185
|
+
slideIdx: index,
|
|
186
|
+
currentSlide,
|
|
187
|
+
itemsPerPage,
|
|
188
|
+
totalItems,
|
|
189
|
+
});
|
|
190
|
+
const shouldRenderItem = (index) => {
|
|
191
|
+
return visitedSlides.current.has(index) || isItemVisible(index);
|
|
192
|
+
};
|
|
193
|
+
return { shouldRenderItem, isItemVisible };
|
|
194
|
+
};
|
|
195
|
+
//# sourceMappingURL=useSlideVisibility.js.map
|
|
196
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/Carousel/CarouselItem.js
|
|
197
|
+
|
|
198
|
+
|
|
199
|
+
function CarouselItem({ id, index, state, children, totalItems, infiniteMode, isScrollCarousel, }) {
|
|
200
|
+
const { isItemVisible, shouldRenderItem } = useSlideVisibility({
|
|
201
|
+
totalItems,
|
|
202
|
+
currentSlide: state.currentItem,
|
|
203
|
+
itemsPerPage: state.itemsPerPage,
|
|
204
|
+
});
|
|
205
|
+
const style = (!isScrollCarousel && { width: '100%' }) ||
|
|
206
|
+
(isScrollCarousel && {
|
|
207
|
+
maxWidth: '60%',
|
|
208
|
+
display: 'inline-block',
|
|
209
|
+
});
|
|
210
|
+
const shouldDisplayItem = isScrollCarousel || shouldRenderItem(index - Number(infiniteMode));
|
|
211
|
+
return (external_react_default().createElement("li", { style: style, id: `${id}-carousel-item-${index}`, "data-fs-carousel-item": true, "data-fs-carousel-item-visible": isItemVisible(index - Number(infiniteMode)) || undefined }, shouldDisplayItem ? children : null));
|
|
212
|
+
}
|
|
213
|
+
/* harmony default export */ const Carousel_CarouselItem = (CarouselItem);
|
|
214
|
+
//# sourceMappingURL=CarouselItem.js.map
|
|
215
|
+
;// CONCATENATED MODULE: ../components/dist/molecules/Carousel/Carousel.js
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
const createTransformValues = (infinite, totalItems) => {
|
|
222
|
+
const transformMap = {};
|
|
223
|
+
const slideWidth = 100 / totalItems;
|
|
224
|
+
for (let idx = 0; idx < totalItems; ++idx) {
|
|
225
|
+
const currIdx = infinite ? idx - 1 : idx;
|
|
226
|
+
const transformValue = -(slideWidth * idx);
|
|
227
|
+
transformMap[currIdx] = transformValue;
|
|
228
|
+
}
|
|
229
|
+
return transformMap;
|
|
230
|
+
};
|
|
231
|
+
function Carousel({ children, className, 'aria-label': ariaLabel, infiniteMode = true, controls = 'complete', testId = 'fs-carousel', transition = {
|
|
232
|
+
duration: 400,
|
|
233
|
+
property: 'transform',
|
|
234
|
+
}, id = 'fs-carousel', variant = 'slide', itemsPerPage = 1, navigationIcons = undefined, ...swipeableConfigOverrides }) {
|
|
235
|
+
const carouselTrackRef = (0,external_react_.useRef)(null);
|
|
236
|
+
const isSlideCarousel = variant === 'slide';
|
|
237
|
+
const isScrollCarousel = variant === 'scroll';
|
|
238
|
+
const childrenArray = external_react_default().Children.toArray(children);
|
|
239
|
+
const childrenCount = childrenArray.length;
|
|
240
|
+
const numberOfSlides = infiniteMode ? childrenCount + 2 : childrenCount;
|
|
241
|
+
const slidingTransition = `${transition.property} ${transition.duration}ms ${transition.timing ?? ''} ${transition.delay ?? ''}`;
|
|
242
|
+
const { handlers, slide, sliderState, sliderDispatch } = useSlider({
|
|
243
|
+
itemsPerPage,
|
|
244
|
+
infiniteMode,
|
|
245
|
+
totalItems: childrenCount,
|
|
246
|
+
shouldSlideOnSwipe: isSlideCarousel,
|
|
247
|
+
...swipeableConfigOverrides,
|
|
248
|
+
});
|
|
249
|
+
const pagesCount = Math.ceil(childrenCount / sliderState.itemsPerPage);
|
|
250
|
+
const showNavigationArrows = pagesCount !== 1 &&
|
|
251
|
+
(controls === 'complete' || controls === 'navigationArrows');
|
|
252
|
+
const showPaginationBullets = pagesCount !== 1 &&
|
|
253
|
+
(controls === 'complete' || controls === 'paginationBullets');
|
|
254
|
+
const transformValues = (0,external_react_.useMemo)(() => createTransformValues(infiniteMode, numberOfSlides), [numberOfSlides, infiniteMode]);
|
|
255
|
+
const postRenderedSlides = infiniteMode && children ? childrenArray.slice(0, 1) : [];
|
|
256
|
+
const preRenderedSlides = infiniteMode && children ? childrenArray.slice(childrenCount - 1) : [];
|
|
257
|
+
const slides = preRenderedSlides.concat(children ?? [], postRenderedSlides);
|
|
258
|
+
const slideCarouselTrackStyle = (0,external_react_.useMemo)(() => ({
|
|
259
|
+
display: 'flex',
|
|
260
|
+
width: `${numberOfSlides * 100}%`,
|
|
261
|
+
transition: sliderState.sliding ? slidingTransition : undefined,
|
|
262
|
+
transform: `translate3d(${transformValues[sliderState.currentPage]}%, 0, 0)`,
|
|
263
|
+
}), [
|
|
264
|
+
numberOfSlides,
|
|
265
|
+
transformValues,
|
|
266
|
+
slidingTransition,
|
|
267
|
+
sliderState.sliding,
|
|
268
|
+
sliderState.currentPage,
|
|
269
|
+
]);
|
|
270
|
+
const scrollCarouselTrackStyle = (0,external_react_.useMemo)(() => ({
|
|
271
|
+
width: '100%',
|
|
272
|
+
display: 'block',
|
|
273
|
+
overflowX: 'scroll',
|
|
274
|
+
whiteSpace: 'nowrap',
|
|
275
|
+
}), []);
|
|
276
|
+
const carouselTrackStyle = (isSlideCarousel && slideCarouselTrackStyle) ||
|
|
277
|
+
(isScrollCarousel && scrollCarouselTrackStyle);
|
|
278
|
+
const slidePrevious = () => {
|
|
279
|
+
if (sliderState.sliding ||
|
|
280
|
+
(!infiniteMode && sliderState.currentPage === 0)) {
|
|
281
|
+
return;
|
|
282
|
+
}
|
|
283
|
+
slide('previous', sliderDispatch);
|
|
284
|
+
};
|
|
285
|
+
const slideNext = () => {
|
|
286
|
+
if (sliderState.sliding ||
|
|
287
|
+
(!infiniteMode && sliderState.currentPage === childrenCount - 1)) {
|
|
288
|
+
return;
|
|
289
|
+
}
|
|
290
|
+
slide('next', sliderDispatch);
|
|
291
|
+
};
|
|
292
|
+
const onScrollTrack = (event) => {
|
|
293
|
+
if (isSlideCarousel || itemsPerPage > 1) {
|
|
294
|
+
return;
|
|
295
|
+
}
|
|
296
|
+
const itemWidth = Number(event.currentTarget.firstElementChild?.scrollWidth);
|
|
297
|
+
const scrollOffset = event.currentTarget?.scrollLeft;
|
|
298
|
+
const formatter = scrollOffset > itemWidth / 2 ? Math.round : Math.floor;
|
|
299
|
+
const page = formatter(scrollOffset / itemWidth);
|
|
300
|
+
slide(page, sliderDispatch);
|
|
301
|
+
};
|
|
302
|
+
const onTransitionTrackEnd = () => {
|
|
303
|
+
sliderDispatch({
|
|
304
|
+
type: 'STOP_SLIDE',
|
|
305
|
+
});
|
|
306
|
+
if (infiniteMode && sliderState.currentItem >= childrenCount) {
|
|
307
|
+
sliderDispatch({
|
|
308
|
+
type: 'GO_TO_PAGE',
|
|
309
|
+
payload: {
|
|
310
|
+
pageIndex: 0,
|
|
311
|
+
shouldSlide: false,
|
|
312
|
+
},
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
if (infiniteMode && sliderState.currentItem < 0) {
|
|
316
|
+
sliderDispatch({
|
|
317
|
+
type: 'GO_TO_PAGE',
|
|
318
|
+
payload: {
|
|
319
|
+
pageIndex: sliderState.totalPages - 1,
|
|
320
|
+
shouldSlide: false,
|
|
321
|
+
},
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
const onScrollPagination = async (index, slideDirection) => {
|
|
326
|
+
if (slideDirection === 'previous' && sliderState.currentPage === 0) {
|
|
327
|
+
return;
|
|
328
|
+
}
|
|
329
|
+
if (slideDirection === 'next' &&
|
|
330
|
+
sliderState.currentPage === sliderState.totalPages - 1) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
let scrollOffset;
|
|
334
|
+
const carouselItemsWidth = Number(carouselTrackRef.current?.firstElementChild?.clientWidth);
|
|
335
|
+
if (itemsPerPage > 1) {
|
|
336
|
+
scrollOffset = index * carouselItemsWidth * itemsPerPage;
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
scrollOffset = index * carouselItemsWidth - carouselItemsWidth * 0.125;
|
|
340
|
+
}
|
|
341
|
+
carouselTrackRef.current?.scrollTo({
|
|
342
|
+
left: scrollOffset,
|
|
343
|
+
behavior: 'smooth',
|
|
344
|
+
});
|
|
345
|
+
slide(index, sliderDispatch);
|
|
346
|
+
};
|
|
347
|
+
// accessible behavior for tablist
|
|
348
|
+
const handleBulletsKeyDown = (event) => {
|
|
349
|
+
switch (event.key) {
|
|
350
|
+
case 'ArrowLeft': {
|
|
351
|
+
isSlideCarousel && slidePrevious();
|
|
352
|
+
isScrollCarousel &&
|
|
353
|
+
onScrollPagination(sliderState.currentPage - 1, 'previous');
|
|
354
|
+
break;
|
|
355
|
+
}
|
|
356
|
+
case 'ArrowRight': {
|
|
357
|
+
isSlideCarousel && slideNext();
|
|
358
|
+
isScrollCarousel &&
|
|
359
|
+
onScrollPagination(sliderState.currentPage + 1, 'next');
|
|
360
|
+
break;
|
|
361
|
+
}
|
|
362
|
+
case 'Home': {
|
|
363
|
+
slide(0, sliderDispatch);
|
|
364
|
+
break;
|
|
365
|
+
}
|
|
366
|
+
case 'End': {
|
|
367
|
+
slide(childrenCount - 1, sliderDispatch);
|
|
368
|
+
break;
|
|
369
|
+
}
|
|
370
|
+
default:
|
|
371
|
+
}
|
|
372
|
+
};
|
|
373
|
+
return (external_react_default().createElement("section", { id: id, "data-fs-carousel": true, className: className, "data-testid": testId, "aria-label": ariaLabel },
|
|
374
|
+
external_react_default().createElement("div", { "data-fs-carousel-track-container": true, style: {
|
|
375
|
+
width: '100%',
|
|
376
|
+
overflow: 'hidden',
|
|
377
|
+
display: isScrollCarousel ? 'block' : undefined,
|
|
378
|
+
}, ...handlers },
|
|
379
|
+
external_react_default().createElement("ul", { "aria-live": "polite", ref: carouselTrackRef, style: carouselTrackStyle, "data-fs-carousel-track": true, onScroll: onScrollTrack, onTransitionEnd: onTransitionTrackEnd }, slides.map((currentSlide, idx) => (external_react_default().createElement(Carousel_CarouselItem, { id: id, index: idx, key: String(idx), state: sliderState, totalItems: childrenCount, infiniteMode: infiniteMode, isScrollCarousel: isScrollCarousel }, currentSlide))))),
|
|
380
|
+
showNavigationArrows && (external_react_default().createElement("div", { "data-fs-carousel-controls": true },
|
|
381
|
+
external_react_default().createElement(IconButton/* default */.Z, { "data-fs-carousel-control": "left", "aria-controls": id, "aria-label": "previous", icon: navigationIcons?.left ?? (external_react_default().createElement(Icon/* default */.Z, { name: "ArrowLeft", width: 20, height: 20, weight: "bold" })), onClick: () => {
|
|
382
|
+
isSlideCarousel && slidePrevious();
|
|
383
|
+
isScrollCarousel &&
|
|
384
|
+
onScrollPagination(sliderState.currentPage - 1, 'previous');
|
|
385
|
+
} }),
|
|
386
|
+
external_react_default().createElement(IconButton/* default */.Z, { "data-fs-carousel-control": "right", "aria-controls": id, "aria-label": "next", icon: navigationIcons?.right ?? (external_react_default().createElement(Icon/* default */.Z, { name: "ArrowRight", width: 20, height: 20, weight: "bold" })), onClick: () => {
|
|
387
|
+
isSlideCarousel && slideNext();
|
|
388
|
+
isScrollCarousel &&
|
|
389
|
+
onScrollPagination(sliderState.currentPage + 1, 'next');
|
|
390
|
+
} }))),
|
|
391
|
+
showPaginationBullets && (external_react_default().createElement(Carousel_CarouselBullets, { id: id, tabIndex: 0, activeBullet: sliderState.currentPage, totalQuantity: pagesCount, onKeyDown: handleBulletsKeyDown, onClick: async (_, idx) => {
|
|
392
|
+
isSlideCarousel &&
|
|
393
|
+
!sliderState.sliding &&
|
|
394
|
+
slide(idx, sliderDispatch);
|
|
395
|
+
isScrollCarousel && onScrollPagination(idx);
|
|
396
|
+
}, onFocus: (event) => event.currentTarget.focus(), ariaControlsGenerator: (idx) => `${id}-carousel-item-${idx}` }))));
|
|
397
|
+
}
|
|
398
|
+
/* harmony default export */ const Carousel_Carousel = (Carousel);
|
|
399
|
+
//# sourceMappingURL=Carousel.js.map
|
|
400
|
+
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
401
|
+
var jsx_runtime_ = __webpack_require__(20997);
|
|
402
|
+
;// CONCATENATED MODULE: ./src/components/ui/Carousel/Carousel.tsx
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
|
|
406
|
+
function Carousel_Carousel_Carousel({
|
|
407
|
+
id,
|
|
408
|
+
testId,
|
|
409
|
+
children,
|
|
410
|
+
itemsPerPage = 5
|
|
411
|
+
}) {
|
|
412
|
+
const isMobile = window.innerWidth <= 768;
|
|
413
|
+
return /*#__PURE__*/jsx_runtime_.jsx(Carousel_Carousel, {
|
|
414
|
+
id: id,
|
|
415
|
+
testId: testId,
|
|
416
|
+
variant: "scroll",
|
|
417
|
+
infiniteMode: false,
|
|
418
|
+
itemsPerPage: isMobile ? 1 : itemsPerPage,
|
|
419
|
+
children: children
|
|
420
|
+
});
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
/* harmony default export */ const ui_Carousel_Carousel = (Carousel_Carousel_Carousel);
|
|
424
|
+
;// CONCATENATED MODULE: ./src/components/ui/Carousel/index.ts
|
|
425
|
+
|
|
426
|
+
;// CONCATENATED MODULE: ./src/customizations/components/overrides/ProductShelf.tsx
|
|
427
|
+
// This is an example of how it can be used on the starter.
|
|
428
|
+
const SECTION = 'ProductShelf';
|
|
429
|
+
const overrides = {
|
|
430
|
+
name: SECTION,
|
|
431
|
+
components: {
|
|
432
|
+
ProductShelf: {
|
|
433
|
+
props: {}
|
|
434
|
+
},
|
|
435
|
+
__experimentalCarousel: {
|
|
436
|
+
props: {}
|
|
437
|
+
},
|
|
438
|
+
__experimentalProductCard: {
|
|
439
|
+
props: {}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
/* harmony default export */ const overrides_ProductShelf = (overrides);
|
|
444
|
+
;// CONCATENATED MODULE: ./src/components/sections/ProductShelf/Overrides.tsx
|
|
445
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
446
|
+
|
|
447
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
448
|
+
|
|
449
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
450
|
+
|
|
451
|
+
|
|
452
|
+
|
|
453
|
+
|
|
454
|
+
|
|
455
|
+
const productShelfComponentsCustomization = {};
|
|
456
|
+
const productShelfPropsCustomization = {};
|
|
457
|
+
Object.entries(overrides_ProductShelf.components).forEach(([key, value]) => {
|
|
458
|
+
if (value.Component) {
|
|
459
|
+
productShelfComponentsCustomization[key] = value.Component;
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
Object.entries(overrides_ProductShelf.components).forEach(([key, value]) => {
|
|
463
|
+
if (value.props) {
|
|
464
|
+
productShelfPropsCustomization[key] = value.props;
|
|
465
|
+
}
|
|
466
|
+
});
|
|
467
|
+
|
|
468
|
+
const Components = _objectSpread({
|
|
469
|
+
ProductShelf: ProductShelf/* default */.Z,
|
|
470
|
+
__experimentalCarousel: ui_Carousel_Carousel,
|
|
471
|
+
__experimentalProductCard: ProductCard/* default */.Z
|
|
472
|
+
}, productShelfComponentsCustomization);
|
|
473
|
+
|
|
474
|
+
|
|
475
|
+
|
|
476
|
+
/***/ }),
|
|
477
|
+
|
|
478
|
+
/***/ 70424:
|
|
479
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
480
|
+
|
|
481
|
+
"use strict";
|
|
482
|
+
|
|
483
|
+
// EXPORTS
|
|
484
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
485
|
+
"Z": () => (/* reexport */ ProductShelfSkeleton_ProductShelfSkeleton)
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
// EXTERNAL MODULE: ../components/dist/organisms/ProductShelf/ProductShelf.js
|
|
489
|
+
var ProductShelf = __webpack_require__(94285);
|
|
490
|
+
// EXTERNAL MODULE: external "react"
|
|
491
|
+
var external_react_ = __webpack_require__(16689);
|
|
492
|
+
var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
|
|
493
|
+
;// CONCATENATED MODULE: ../components/dist/organisms/ProductShelf/ProductShelfItems.js
|
|
494
|
+
|
|
495
|
+
const ProductShelfItems = (0,external_react_.forwardRef)(function ProductShelfItems({ testId = 'fs-product-shelf-items', children, ...otherProps }, ref) {
|
|
496
|
+
return (external_react_default().createElement("ul", { role: "list", ref: ref, "data-fs-product-shelf-items": true, "data-testid": testId, ...otherProps }, children));
|
|
497
|
+
});
|
|
498
|
+
/* harmony default export */ const ProductShelf_ProductShelfItems = (ProductShelfItems);
|
|
499
|
+
//# sourceMappingURL=ProductShelfItems.js.map
|
|
500
|
+
;// CONCATENATED MODULE: ../components/dist/organisms/ProductShelf/ProductShelfItem.js
|
|
501
|
+
|
|
502
|
+
const ProductShelfItem = (0,external_react_.forwardRef)(function ProductShelfItem({ testId = 'fs-product-shelf-item', children, ...otherProps }, ref) {
|
|
503
|
+
return (external_react_default().createElement("li", { role: "listitem", ref: ref, "data-fs-product-shelf-item": true, "data-testid": testId, ...otherProps }, children));
|
|
504
|
+
});
|
|
505
|
+
/* harmony default export */ const ProductShelf_ProductShelfItem = (ProductShelfItem);
|
|
506
|
+
//# sourceMappingURL=ProductShelfItem.js.map
|
|
507
|
+
// EXTERNAL MODULE: ./src/constants.ts
|
|
508
|
+
var constants = __webpack_require__(18459);
|
|
509
|
+
// EXTERNAL MODULE: ./src/components/skeletons/ProductCardSkeleton/index.ts + 1 modules
|
|
510
|
+
var ProductCardSkeleton = __webpack_require__(73288);
|
|
511
|
+
// EXTERNAL MODULE: external "react/jsx-runtime"
|
|
512
|
+
var jsx_runtime_ = __webpack_require__(20997);
|
|
513
|
+
;// CONCATENATED MODULE: ./src/components/skeletons/ProductShelfSkeleton/ProductShelfSkeleton.tsx
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
function ProductShelfSkeleton({
|
|
521
|
+
children,
|
|
522
|
+
aspectRatio,
|
|
523
|
+
loading = true
|
|
524
|
+
}) {
|
|
525
|
+
return loading ? /*#__PURE__*/jsx_runtime_.jsx(ProductShelf/* default */.Z, {
|
|
526
|
+
"data-fs-product-shelf-skeleton": true,
|
|
527
|
+
children: /*#__PURE__*/jsx_runtime_.jsx(ProductShelf_ProductShelfItems, {
|
|
528
|
+
className: "layout__content",
|
|
529
|
+
children: Array.from({
|
|
530
|
+
length: constants/* ITEMS_PER_SECTION */.K
|
|
531
|
+
}, (_, index) => /*#__PURE__*/jsx_runtime_.jsx(ProductShelf_ProductShelfItem, {
|
|
532
|
+
children: /*#__PURE__*/jsx_runtime_.jsx(ProductCardSkeleton/* default */.Z, {
|
|
533
|
+
aspectRatio: aspectRatio,
|
|
534
|
+
sectioned: true,
|
|
535
|
+
bordered: true
|
|
536
|
+
})
|
|
537
|
+
}, String(index)))
|
|
538
|
+
})
|
|
539
|
+
}) : /*#__PURE__*/jsx_runtime_.jsx(jsx_runtime_.Fragment, {
|
|
540
|
+
children: children
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
|
|
544
|
+
/* harmony default export */ const ProductShelfSkeleton_ProductShelfSkeleton = (ProductShelfSkeleton);
|
|
545
|
+
;// CONCATENATED MODULE: ./src/components/skeletons/ProductShelfSkeleton/index.ts
|
|
546
|
+
|
|
547
|
+
|
|
548
|
+
/***/ }),
|
|
549
|
+
|
|
550
|
+
/***/ 77691:
|
|
551
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
552
|
+
|
|
553
|
+
"use strict";
|
|
554
|
+
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
555
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
556
|
+
/* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
|
|
557
|
+
/* harmony export */ });
|
|
558
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(16689);
|
|
559
|
+
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
|
|
560
|
+
/* harmony import */ var src_components_skeletons_ProductShelfSkeleton__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(70424);
|
|
561
|
+
/* harmony import */ var src_sdk_analytics_hooks_useViewItemListEvent__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(55184);
|
|
562
|
+
/* harmony import */ var src_sdk_product_useProductsQuery__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(24867);
|
|
563
|
+
/* harmony import */ var src_utils_utilities__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(43952);
|
|
564
|
+
/* harmony import */ var src_components_sections_ProductShelf_Overrides__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(86237);
|
|
565
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(20997);
|
|
566
|
+
/* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__);
|
|
567
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([src_sdk_product_useProductsQuery__WEBPACK_IMPORTED_MODULE_3__]);
|
|
568
|
+
src_sdk_product_useProductsQuery__WEBPACK_IMPORTED_MODULE_3__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
569
|
+
const _excluded = ["title", "inView", "productCardConfiguration"];
|
|
570
|
+
|
|
571
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
572
|
+
|
|
573
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
574
|
+
|
|
575
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
576
|
+
|
|
577
|
+
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
578
|
+
|
|
579
|
+
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
580
|
+
|
|
581
|
+
|
|
582
|
+
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
|
|
587
|
+
|
|
588
|
+
|
|
589
|
+
|
|
590
|
+
|
|
591
|
+
const {
|
|
592
|
+
ProductShelf: ProductShelfWrapper,
|
|
593
|
+
__experimentalCarousel: Carousel,
|
|
594
|
+
__experimentalProductCard: ProductCard
|
|
595
|
+
} = src_components_sections_ProductShelf_Overrides__WEBPACK_IMPORTED_MODULE_4__/* .Components */ .z;
|
|
596
|
+
|
|
597
|
+
function ProductShelf(_ref) {
|
|
598
|
+
let {
|
|
599
|
+
title,
|
|
600
|
+
inView,
|
|
601
|
+
productCardConfiguration: {
|
|
602
|
+
bordered = src_components_sections_ProductShelf_Overrides__WEBPACK_IMPORTED_MODULE_4__/* .Props.__experimentalProductCard.bordered */ .x.__experimentalProductCard.bordered,
|
|
603
|
+
showDiscountBadge = src_components_sections_ProductShelf_Overrides__WEBPACK_IMPORTED_MODULE_4__/* .Props.__experimentalProductCard.showDiscountBadge */ .x.__experimentalProductCard.showDiscountBadge
|
|
604
|
+
} = {}
|
|
605
|
+
} = _ref,
|
|
606
|
+
variables = _objectWithoutProperties(_ref, _excluded);
|
|
607
|
+
|
|
608
|
+
const titleId = (0,src_utils_utilities__WEBPACK_IMPORTED_MODULE_6__/* .textToKebabCase */ .B)(title);
|
|
609
|
+
const id = (0,react__WEBPACK_IMPORTED_MODULE_0__.useId)();
|
|
610
|
+
const viewedOnce = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
|
|
611
|
+
const products = (0,src_sdk_product_useProductsQuery__WEBPACK_IMPORTED_MODULE_3__/* .useProductsQuery */ .kN)(variables);
|
|
612
|
+
const productEdges = products?.edges ?? [];
|
|
613
|
+
const aspectRatio = 1;
|
|
614
|
+
const {
|
|
615
|
+
sendViewItemListEvent
|
|
616
|
+
} = (0,src_sdk_analytics_hooks_useViewItemListEvent__WEBPACK_IMPORTED_MODULE_2__/* .useViewItemListEvent */ .m)({
|
|
617
|
+
products: productEdges,
|
|
618
|
+
title,
|
|
619
|
+
page: 0,
|
|
620
|
+
pageSize: 0
|
|
621
|
+
});
|
|
622
|
+
(0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
|
|
623
|
+
if (inView && !viewedOnce.current && productEdges.length) {
|
|
624
|
+
sendViewItemListEvent();
|
|
625
|
+
viewedOnce.current = true;
|
|
626
|
+
}
|
|
627
|
+
}, [inView, productEdges.length, sendViewItemListEvent]);
|
|
628
|
+
|
|
629
|
+
if (products?.edges.length === 0) {
|
|
630
|
+
return null;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.Fragment, {
|
|
634
|
+
children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx("h2", {
|
|
635
|
+
className: "text__title-section layout__content",
|
|
636
|
+
children: title
|
|
637
|
+
}), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx(src_components_skeletons_ProductShelfSkeleton__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, {
|
|
638
|
+
aspectRatio: aspectRatio,
|
|
639
|
+
loading: products === undefined,
|
|
640
|
+
children: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx(ProductShelfWrapper, _objectSpread(_objectSpread({}, src_components_sections_ProductShelf_Overrides__WEBPACK_IMPORTED_MODULE_4__/* .Props.ProductShelfWrapper */ .x.ProductShelfWrapper), {}, {
|
|
641
|
+
children: /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_5__.jsx(Carousel, _objectSpread(_objectSpread({
|
|
642
|
+
id: titleId || id
|
|
643
|
+
}, src_components_sections_ProductShelf_Overrides__WEBPACK_IMPORTED_MODULE_4__/* .Props.__experimentalCarousel */ .x.__experimentalCarousel), {}, {
|
|
644
|
+
children: productEdges.map((product, idx) => /*#__PURE__*/(0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(ProductCard, _objectSpread(_objectSpread({
|
|
645
|
+
aspectRatio: aspectRatio,
|
|
646
|
+
imgProps: {
|
|
647
|
+
width: 216,
|
|
648
|
+
height: 216,
|
|
649
|
+
sizes: '(max-width: 768px) 42vw, 30vw'
|
|
650
|
+
}
|
|
651
|
+
}, src_components_sections_ProductShelf_Overrides__WEBPACK_IMPORTED_MODULE_4__/* .Props.__experimentalProductCard */ .x.__experimentalProductCard), {}, {
|
|
652
|
+
bordered: bordered,
|
|
653
|
+
showDiscountBadge: showDiscountBadge // Dynamic props shouldn't be overridable
|
|
654
|
+
// This decision can be reviewed later if needed
|
|
655
|
+
,
|
|
656
|
+
key: `${product.node.id}`,
|
|
657
|
+
product: product.node,
|
|
658
|
+
index: idx + 1
|
|
659
|
+
})))
|
|
660
|
+
}))
|
|
661
|
+
}))
|
|
662
|
+
})]
|
|
663
|
+
});
|
|
664
|
+
}
|
|
665
|
+
|
|
666
|
+
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ProductShelf);
|
|
667
|
+
__webpack_async_result__();
|
|
668
|
+
} catch(e) { __webpack_async_result__(e); } });
|
|
669
|
+
|
|
670
|
+
/***/ }),
|
|
671
|
+
|
|
672
|
+
/***/ 34805:
|
|
673
|
+
/***/ ((module, __webpack_exports__, __webpack_require__) => {
|
|
674
|
+
|
|
675
|
+
"use strict";
|
|
676
|
+
__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
|
|
677
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
678
|
+
/* harmony export */ "Z": () => (/* reexport safe */ _ProductShelf__WEBPACK_IMPORTED_MODULE_0__.Z)
|
|
679
|
+
/* harmony export */ });
|
|
680
|
+
/* harmony import */ var _ProductShelf__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(77691);
|
|
681
|
+
var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_ProductShelf__WEBPACK_IMPORTED_MODULE_0__]);
|
|
682
|
+
_ProductShelf__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
|
|
683
|
+
|
|
684
|
+
__webpack_async_result__();
|
|
685
|
+
} catch(e) { __webpack_async_result__(e); } });
|
|
686
|
+
|
|
687
|
+
/***/ }),
|
|
688
|
+
|
|
689
|
+
/***/ 43952:
|
|
690
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
691
|
+
|
|
692
|
+
"use strict";
|
|
693
|
+
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
|
|
694
|
+
/* harmony export */ "B": () => (/* binding */ textToKebabCase)
|
|
695
|
+
/* harmony export */ });
|
|
696
|
+
//Input "Example Text!". Output: example-text
|
|
697
|
+
function textToKebabCase(text) {
|
|
698
|
+
// Replace spaces and special characters with hyphens
|
|
699
|
+
let kebabCase = text.replace(/[^\w\s]/gi, '-'); // Remove whitespace
|
|
700
|
+
|
|
701
|
+
kebabCase = kebabCase.replace(/\s+/g, '-'); // Convert to lowercase
|
|
702
|
+
|
|
703
|
+
kebabCase = kebabCase.toLowerCase();
|
|
704
|
+
return kebabCase ?? '';
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
/***/ }),
|
|
708
|
+
|
|
709
|
+
/***/ 56627:
|
|
710
|
+
/***/ ((module) => {
|
|
711
|
+
|
|
712
|
+
// Exports
|
|
713
|
+
module.exports = {
|
|
714
|
+
"section": "section_section__C1DoH",
|
|
715
|
+
"loading": "section_loading__k5bCF"
|
|
716
|
+
};
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
/***/ })
|
|
720
|
+
|
|
721
|
+
};
|
|
722
|
+
;
|