@faststore/core 2.0.160-alpha.0 → 2.0.163-alpha.0

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