@faststore/core 2.0.117-alpha.0 → 2.0.120-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 (160) hide show
  1. package/.turbo/turbo-build.log +38 -26
  2. package/CHANGELOG.md +10 -0
  3. package/cms/faststore/content-types.json +6 -0
  4. package/cms/faststore/sections.json +8 -0
  5. package/package.json +3 -3
  6. package/src/Layout.tsx +2 -24
  7. package/src/components/cms/GlobalSections.tsx +81 -0
  8. package/src/components/cms/RenderSections.tsx +39 -0
  9. package/src/components/common/Alert/Alert.tsx +7 -5
  10. package/src/components/common/Alert/index.ts +1 -0
  11. package/src/components/sections/Alert/Alert.tsx +28 -0
  12. package/src/pages/404.tsx +25 -3
  13. package/src/pages/500.tsx +25 -3
  14. package/src/pages/[...slug].tsx +85 -66
  15. package/src/pages/[slug]/p.tsx +16 -6
  16. package/src/pages/account.tsx +25 -3
  17. package/src/pages/checkout.tsx +25 -3
  18. package/src/pages/index.tsx +20 -10
  19. package/src/pages/login.tsx +25 -3
  20. package/src/pages/s.tsx +63 -39
  21. package/.next/BUILD_ID +0 -1
  22. package/.next/build-manifest.json +0 -99
  23. package/.next/cache/.tsbuildinfo +0 -1
  24. package/.next/cache/config.json +0 -7
  25. package/.next/cache/eslint/.cache_1gneedd +0 -1
  26. package/.next/cache/next-server.js.nft.json +0 -1
  27. package/.next/cache/webpack/client-production/0.pack +0 -0
  28. package/.next/cache/webpack/client-production/index.pack +0 -0
  29. package/.next/cache/webpack/server-production/0.pack +0 -0
  30. package/.next/cache/webpack/server-production/index.pack +0 -0
  31. package/.next/export-marker.json +0 -1
  32. package/.next/images-manifest.json +0 -1
  33. package/.next/next-server.js.nft.json +0 -1
  34. package/.next/package.json +0 -1
  35. package/.next/prerender-manifest.json +0 -1
  36. package/.next/react-loadable-manifest.json +0 -42
  37. package/.next/required-server-files.json +0 -1
  38. package/.next/routes-manifest.json +0 -1
  39. package/.next/server/chunks/120.js +0 -435
  40. package/.next/server/chunks/123.js +0 -58
  41. package/.next/server/chunks/1394.js +0 -3801
  42. package/.next/server/chunks/1597.js +0 -151
  43. package/.next/server/chunks/1608.js +0 -515
  44. package/.next/server/chunks/2154.js +0 -206
  45. package/.next/server/chunks/247.js +0 -61
  46. package/.next/server/chunks/2502.js +0 -584
  47. package/.next/server/chunks/2914.js +0 -95
  48. package/.next/server/chunks/2922.js +0 -7293
  49. package/.next/server/chunks/3264.js +0 -67
  50. package/.next/server/chunks/3431.js +0 -7241
  51. package/.next/server/chunks/350.js +0 -142
  52. package/.next/server/chunks/3746.js +0 -250
  53. package/.next/server/chunks/3898.js +0 -240
  54. package/.next/server/chunks/4312.js +0 -674
  55. package/.next/server/chunks/4371.js +0 -1424
  56. package/.next/server/chunks/5098.js +0 -124
  57. package/.next/server/chunks/5335.js +0 -544
  58. package/.next/server/chunks/5576.js +0 -79
  59. package/.next/server/chunks/6280.js +0 -322
  60. package/.next/server/chunks/6465.js +0 -91
  61. package/.next/server/chunks/676.js +0 -32
  62. package/.next/server/chunks/6859.js +0 -959
  63. package/.next/server/chunks/6881.js +0 -320
  64. package/.next/server/chunks/6898.js +0 -149
  65. package/.next/server/chunks/7104.js +0 -235
  66. package/.next/server/chunks/7181.js +0 -664
  67. package/.next/server/chunks/7183.js +0 -79
  68. package/.next/server/chunks/8098.js +0 -246
  69. package/.next/server/chunks/810.js +0 -432
  70. package/.next/server/chunks/8287.js +0 -58
  71. package/.next/server/chunks/9143.js +0 -106
  72. package/.next/server/chunks/9557.js +0 -119
  73. package/.next/server/chunks/9854.js +0 -72
  74. package/.next/server/chunks/font-manifest.json +0 -1
  75. package/.next/server/font-manifest.json +0 -1
  76. package/.next/server/middleware-build-manifest.js +0 -1
  77. package/.next/server/middleware-manifest.json +0 -6
  78. package/.next/server/middleware-react-loadable-manifest.js +0 -1
  79. package/.next/server/pages/404.js.nft.json +0 -1
  80. package/.next/server/pages/500.js.nft.json +0 -1
  81. package/.next/server/pages/[...slug].js +0 -666
  82. package/.next/server/pages/[...slug].js.nft.json +0 -1
  83. package/.next/server/pages/[slug]/p.js +0 -2327
  84. package/.next/server/pages/[slug]/p.js.nft.json +0 -1
  85. package/.next/server/pages/_app.js +0 -2454
  86. package/.next/server/pages/_app.js.nft.json +0 -1
  87. package/.next/server/pages/_document.js +0 -304
  88. package/.next/server/pages/_document.js.nft.json +0 -1
  89. package/.next/server/pages/_error.js +0 -164
  90. package/.next/server/pages/_error.js.nft.json +0 -1
  91. package/.next/server/pages/account.js.nft.json +0 -1
  92. package/.next/server/pages/api/graphql.js +0 -315
  93. package/.next/server/pages/api/graphql.js.nft.json +0 -1
  94. package/.next/server/pages/api/preview.js +0 -118
  95. package/.next/server/pages/api/preview.js.nft.json +0 -1
  96. package/.next/server/pages/checkout.js.nft.json +0 -1
  97. package/.next/server/pages/en-US/404.html +0 -81
  98. package/.next/server/pages/en-US/500.html +0 -81
  99. package/.next/server/pages/en-US/account.html +0 -81
  100. package/.next/server/pages/en-US/checkout.html +0 -81
  101. package/.next/server/pages/en-US/login.html +0 -81
  102. package/.next/server/pages/en-US/s.html +0 -81
  103. package/.next/server/pages/en-US.html +0 -81
  104. package/.next/server/pages/en-US.json +0 -1
  105. package/.next/server/pages/index.js +0 -475
  106. package/.next/server/pages/index.js.nft.json +0 -1
  107. package/.next/server/pages/login.js.nft.json +0 -1
  108. package/.next/server/pages/s.js.nft.json +0 -1
  109. package/.next/server/pages-manifest.json +0 -16
  110. package/.next/server/webpack-api-runtime.js +0 -229
  111. package/.next/server/webpack-runtime.js +0 -229
  112. package/.next/static/chunks/143.dd8a556e6957baa1.js +0 -1
  113. package/.next/static/chunks/170.79b2f8527e327bca.js +0 -1
  114. package/.next/static/chunks/264-5b07911df63b8601.js +0 -1
  115. package/.next/static/chunks/351-a4e28d64f48c5269.js +0 -1
  116. package/.next/static/chunks/54.e6562383f8a1dfe7.js +0 -1
  117. package/.next/static/chunks/597.fc79494903e8bb84.js +0 -1
  118. package/.next/static/chunks/608.59e69b83f35d9c44.js +0 -1
  119. package/.next/static/chunks/651.7142f31ce1e052b3.js +0 -1
  120. package/.next/static/chunks/741.52f7fb873418346f.js +0 -1
  121. package/.next/static/chunks/781-e1b538e051ff4c3e.js +0 -1
  122. package/.next/static/chunks/98.97381d2021f86cd9.js +0 -1
  123. package/.next/static/chunks/996.98e590872c51f815.js +0 -1
  124. package/.next/static/chunks/framework-dfd14d7ce6600b03.js +0 -1
  125. package/.next/static/chunks/main-9746772201fe3ac1.js +0 -1
  126. package/.next/static/chunks/pages/404-3637ef83b3359df7.js +0 -1
  127. package/.next/static/chunks/pages/500-910883c20541d9ce.js +0 -1
  128. package/.next/static/chunks/pages/[...slug]-29d3b81ee0953846.js +0 -1
  129. package/.next/static/chunks/pages/[slug]/p-9b24055cb30ee7a8.js +0 -1
  130. package/.next/static/chunks/pages/_app-4aeb21d72aeea9b7.js +0 -1
  131. package/.next/static/chunks/pages/_error-a7a0c1d9bfbb4f38.js +0 -1
  132. package/.next/static/chunks/pages/account-b8fc5222ffe89b60.js +0 -1
  133. package/.next/static/chunks/pages/checkout-f8cb7cb22225ef9d.js +0 -1
  134. package/.next/static/chunks/pages/index-d48285f48d2a66ea.js +0 -1
  135. package/.next/static/chunks/pages/login-45cc84352bac2408.js +0 -1
  136. package/.next/static/chunks/pages/s-ba2868e14fedb65b.js +0 -1
  137. package/.next/static/chunks/polyfills-c67a75d1b6f99dc8.js +0 -1
  138. package/.next/static/chunks/webpack-f725b61675603493.js +0 -1
  139. package/.next/static/css/1f987650dd4e39d0.css +0 -1
  140. package/.next/static/css/3a57acf6e411f24d.css +0 -1
  141. package/.next/static/css/4abccf9803c3c356.css +0 -1
  142. package/.next/static/css/502746c995f64cce.css +0 -1
  143. package/.next/static/css/6507cb48401e73a4.css +0 -1
  144. package/.next/static/css/6f4d3e91f1d161a8.css +0 -1
  145. package/.next/static/kFT8gMGQbscGgKaZLxG_K/_buildManifest.js +0 -1
  146. package/.next/static/kFT8gMGQbscGgKaZLxG_K/_ssgManifest.js +0 -1
  147. package/.next/static/media/brandless-neutral.76ddf63a.png +0 -0
  148. package/.next/trace +0 -64
  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
  160. package/src/components/cms/RenderPageSections.tsx +0 -37
@@ -1,250 +0,0 @@
1
- "use strict";
2
- exports.id = 3746;
3
- exports.ids = [3746];
4
- exports.modules = {
5
-
6
- /***/ 4436:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
-
10
- // EXPORTS
11
- __webpack_require__.d(__webpack_exports__, {
12
- "Z": () => (/* reexport */ product_ProductGrid_ProductGrid)
13
- });
14
-
15
- // EXTERNAL MODULE: ./src/components/skeletons/ProductGridSkeleton/index.ts + 1 modules
16
- var ProductGridSkeleton = __webpack_require__(9913);
17
- // EXTERNAL MODULE: external "react"
18
- var external_react_ = __webpack_require__(6689);
19
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
20
- ;// CONCATENATED MODULE: ../components/dist/organisms/ProductGrid/ProductGrid.js
21
-
22
- const ProductGrid = (0,external_react_.forwardRef)(function ProductGridItem({ testId = 'fs-product-grid', children, ...otherProps }, ref) {
23
- return (external_react_default().createElement("ul", { ref: ref, "data-fs-product-grid": true, ...otherProps }, children));
24
- });
25
- /* harmony default export */ const ProductGrid_ProductGrid = (ProductGrid);
26
- //# sourceMappingURL=ProductGrid.js.map
27
- ;// CONCATENATED MODULE: ../components/dist/organisms/ProductGrid/ProductGridItem.js
28
-
29
- const ProductGridItem = (0,external_react_.forwardRef)(function ProductGridItem({ testId = 'fs-product-grid-item', children, ...otherProps }, ref) {
30
- return (external_react_default().createElement("li", { ref: ref, "data-fs-product-grid-item": true, ...otherProps }, children));
31
- });
32
- /* harmony default export */ const ProductGrid_ProductGridItem = (ProductGridItem);
33
- //# sourceMappingURL=ProductGridItem.js.map
34
- // EXTERNAL MODULE: ./src/components/product/ProductCard/index.ts + 4 modules
35
- var ProductCard = __webpack_require__(6475);
36
- // EXTERNAL MODULE: external "react/jsx-runtime"
37
- var jsx_runtime_ = __webpack_require__(997);
38
- ;// CONCATENATED MODULE: ./src/components/product/ProductGrid/ProductGrid.tsx
39
-
40
-
41
-
42
-
43
-
44
- function ProductGrid_ProductGrid_ProductGrid({
45
- products,
46
- page,
47
- pageSize
48
- }) {
49
- const aspectRatio = 1;
50
- console.log(products);
51
- return /*#__PURE__*/jsx_runtime_.jsx(ProductGridSkeleton/* default */.Z, {
52
- aspectRatio: aspectRatio,
53
- loading: products.length === 0,
54
- children: /*#__PURE__*/jsx_runtime_.jsx(ProductGrid_ProductGrid, {
55
- children: products.map(({
56
- node: product
57
- }, idx) => /*#__PURE__*/jsx_runtime_.jsx(ProductGrid_ProductGridItem, {
58
- children: /*#__PURE__*/jsx_runtime_.jsx(ProductCard/* default */.Z, {
59
- product: product,
60
- index: pageSize * page + idx + 1,
61
- bordered: true,
62
- aspectRatio: aspectRatio
63
- })
64
- }, `${product.id}`))
65
- })
66
- });
67
- }
68
-
69
- /* harmony default export */ const product_ProductGrid_ProductGrid = (ProductGrid_ProductGrid_ProductGrid);
70
- ;// CONCATENATED MODULE: ./src/components/product/ProductGrid/index.ts
71
-
72
-
73
- /***/ }),
74
-
75
- /***/ 3746:
76
- /***/ ((module, __webpack_exports__, __webpack_require__) => {
77
-
78
- __webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
79
- __webpack_require__.r(__webpack_exports__);
80
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
81
- /* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
82
- /* harmony export */ });
83
- /* harmony import */ var _faststore_sdk__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7794);
84
- /* harmony import */ var src_components_product_ProductGrid__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(4436);
85
- /* harmony import */ var src_sdk_search_Sentinel__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(713);
86
- /* harmony import */ var _ProductTiles__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8872);
87
- /* harmony import */ var _usePageProducts__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(763);
88
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(997);
89
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
90
- var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_ProductTiles__WEBPACK_IMPORTED_MODULE_2__, _usePageProducts__WEBPACK_IMPORTED_MODULE_3__]);
91
- ([_ProductTiles__WEBPACK_IMPORTED_MODULE_2__, _usePageProducts__WEBPACK_IMPORTED_MODULE_3__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
92
-
93
-
94
-
95
-
96
-
97
- /* If showSponsoredProducts is true, a ProductTiles will be displayed in between two blocks of ProductGrid on the page 0 */
98
-
99
-
100
-
101
-
102
-
103
- function GalleryPage({
104
- page,
105
- title,
106
- showSponsoredProducts = true
107
- }) {
108
- const products = (0,_usePageProducts__WEBPACK_IMPORTED_MODULE_3__/* .useProducts */ .r)(page) ?? [];
109
- const {
110
- itemsPerPage
111
- } = (0,_faststore_sdk__WEBPACK_IMPORTED_MODULE_5__/* .useSearch */ .R)();
112
- const productsSponsored = showSponsoredProducts ? products.slice(0, 2) : undefined;
113
- const middleItemIndex = Math.ceil(itemsPerPage / 2);
114
- const shouldDisplaySponsoredProducts = page === 0 && productsSponsored && productsSponsored.length > 1;
115
- return /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
116
- children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx(src_sdk_search_Sentinel__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z, {
117
- products: products,
118
- page: page,
119
- pageSize: itemsPerPage,
120
- title: title
121
- }), shouldDisplaySponsoredProducts ? /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.Fragment, {
122
- children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx(src_components_product_ProductGrid__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z, {
123
- products: products.slice(0, middleItemIndex),
124
- page: page,
125
- pageSize: middleItemIndex
126
- }), /*#__PURE__*/(0,react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsxs)("div", {
127
- "data-fs-product-listing-sponsored": true,
128
- children: [/*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx("h3", {
129
- children: "Sponsored"
130
- }), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx(_ProductTiles__WEBPACK_IMPORTED_MODULE_2__/* ["default"] */ .Z, {
131
- selectedFacets: [{
132
- key: 'productClusterIds',
133
- value: '141'
134
- }],
135
- title: ""
136
- })]
137
- }), /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx(src_components_product_ProductGrid__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z, {
138
- products: products.slice(middleItemIndex, itemsPerPage),
139
- page: page,
140
- pageSize: middleItemIndex
141
- })]
142
- }) : /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx(src_components_product_ProductGrid__WEBPACK_IMPORTED_MODULE_0__/* ["default"] */ .Z, {
143
- products: products,
144
- page: page,
145
- pageSize: itemsPerPage
146
- })]
147
- });
148
- }
149
-
150
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (GalleryPage);
151
- __webpack_async_result__();
152
- } catch(e) { __webpack_async_result__(e); } });
153
-
154
- /***/ }),
155
-
156
- /***/ 713:
157
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
158
-
159
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
160
- /* harmony export */ "Z": () => (__WEBPACK_DEFAULT_EXPORT__)
161
- /* harmony export */ });
162
- /* harmony import */ var _faststore_sdk__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(7794);
163
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
164
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
165
- /* harmony import */ var react_intersection_observer__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(9785);
166
- /* harmony import */ var react_intersection_observer__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(react_intersection_observer__WEBPACK_IMPORTED_MODULE_1__);
167
- /* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(1853);
168
- /* harmony import */ var next_router__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(next_router__WEBPACK_IMPORTED_MODULE_2__);
169
- /* harmony import */ var _analytics_hooks_useViewItemListEvent__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(5184);
170
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(997);
171
- /* harmony import */ var react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__);
172
-
173
-
174
-
175
-
176
-
177
-
178
-
179
- // Adds/Replaces ?page= to the querystring of the page
180
- const replacePagination = (page, router) => {
181
- const url = new URL(window.location.href); // In case the page argument already matches the target page
182
-
183
- if (url.searchParams.get('page') === page) {
184
- return;
185
- } // Set ?page= parameter and replace route
186
-
187
-
188
- url.searchParams.set('page', page);
189
- router.replace(url, undefined, {
190
- shallow: true,
191
- scroll: false
192
- });
193
- };
194
- /**
195
- * Use this component to add a boundary between pages so we can
196
- * change the current page being viewed on infinite pagination.
197
- *
198
- * For more info: https://developers.google.com/search/blog/2014/02/infinite-scroll-search-friendly
199
- *
200
- * Also, this component's name is kind of curious. Wikipedia calls is Page Break(https://en.wikipedia.org/wiki/Page_break)
201
- * however all codes I've seen online use Sentinel
202
- */
203
-
204
-
205
- function Sentinel({
206
- page,
207
- pageSize,
208
- products,
209
- title
210
- }) {
211
- const viewedRef = (0,react__WEBPACK_IMPORTED_MODULE_0__.useRef)(false);
212
- const {
213
- ref,
214
- inView
215
- } = (0,react_intersection_observer__WEBPACK_IMPORTED_MODULE_1__.useInView)();
216
- const {
217
- pages
218
- } = (0,_faststore_sdk__WEBPACK_IMPORTED_MODULE_5__/* .useSearch */ .R)();
219
- const router = (0,next_router__WEBPACK_IMPORTED_MODULE_2__.useRouter)();
220
- const {
221
- sendViewItemListEvent
222
- } = (0,_analytics_hooks_useViewItemListEvent__WEBPACK_IMPORTED_MODULE_3__/* .useViewItemListEvent */ .m)({
223
- products,
224
- title,
225
- page,
226
- pageSize
227
- });
228
- (0,react__WEBPACK_IMPORTED_MODULE_0__.useEffect)(() => {
229
- // Only replace pagination state when infinite scroll
230
- // state has more than one page being rendered to the screen
231
- if (inView && pages.length > 1) {
232
- replacePagination(page.toString(), router);
233
- }
234
-
235
- if (inView && !viewedRef.current && products.length) {
236
- sendViewItemListEvent();
237
- viewedRef.current = true;
238
- }
239
- }, [pages.length, inView, page, router, sendViewItemListEvent, products.length]);
240
- return /*#__PURE__*/react_jsx_runtime__WEBPACK_IMPORTED_MODULE_4__.jsx("div", {
241
- ref: ref
242
- });
243
- }
244
-
245
- /* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Sentinel);
246
-
247
- /***/ })
248
-
249
- };
250
- ;
@@ -1,240 +0,0 @@
1
- "use strict";
2
- exports.id = 3898;
3
- exports.ids = [3898];
4
- exports.modules = {
5
-
6
- /***/ 6321:
7
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
8
-
9
-
10
- // EXPORTS
11
- __webpack_require__.d(__webpack_exports__, {
12
- "_": () => (/* binding */ Context),
13
- "z": () => (/* binding */ Provider)
14
- });
15
-
16
- // EXTERNAL MODULE: external "react"
17
- var external_react_ = __webpack_require__(6689);
18
- var external_react_default = /*#__PURE__*/__webpack_require__.n(external_react_);
19
- // EXTERNAL MODULE: ./node_modules/@faststore/sdk/dist/utils/error.js
20
- var error = __webpack_require__(670);
21
- ;// CONCATENATED MODULE: ./node_modules/@faststore/sdk/dist/search/useInfiniteSearchState.js
22
-
23
-
24
- const reducer = (state, action) => {
25
- switch (action.type) {
26
- case 'addPrev': {
27
- const prev = state[0] - 1;
28
- return [prev, ...state];
29
- }
30
- case 'addNext': {
31
- const next = Number(state[state.length - 1]) + 1;
32
- return [...state, next];
33
- }
34
- case 'reset': {
35
- const { payload } = action;
36
- return [payload];
37
- }
38
- default:
39
- throw new error/* SDKError */.q('Unknown action for infinite search');
40
- }
41
- };
42
- const useSearchInfiniteState = (initialPage) => {
43
- const [pages, dispatch] = (0,external_react_.useReducer)(reducer, undefined, () => [initialPage]);
44
- const actions = (0,external_react_.useMemo)(() => ({
45
- addPrevPage: () => dispatch({ type: 'addPrev' }),
46
- addNextPage: () => dispatch({ type: 'addNext' }),
47
- resetInfiniteScroll: (page) => dispatch({ type: 'reset', payload: page }),
48
- }), []);
49
- return { pages, ...actions };
50
- };
51
- //# sourceMappingURL=useInfiniteSearchState.js.map
52
- // EXTERNAL MODULE: ./node_modules/@faststore/sdk/dist/search/useSearchState.js
53
- var useSearchState = __webpack_require__(3264);
54
- ;// CONCATENATED MODULE: ./node_modules/@faststore/sdk/dist/search/Provider.js
55
-
56
-
57
-
58
- const Context = (0,external_react_.createContext)(undefined);
59
- const Provider = ({ children, itemsPerPage, onChange, ...rest }) => {
60
- const { state, ...searchActions } = (0,useSearchState/* useSearchState */.X)(rest, onChange);
61
- const { pages, ...infiniteActions } = useSearchInfiniteState(state.page);
62
- const value = (0,external_react_.useMemo)(() => ({
63
- state,
64
- ...searchActions,
65
- pages,
66
- ...infiniteActions,
67
- itemsPerPage,
68
- }), [infiniteActions, itemsPerPage, pages, searchActions, state]);
69
- return external_react_default().createElement(Context.Provider, { value: value }, children);
70
- };
71
- //# sourceMappingURL=Provider.js.map
72
-
73
- /***/ }),
74
-
75
- /***/ 3291:
76
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
77
-
78
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
79
- /* harmony export */ "uL": () => (/* binding */ setFacet),
80
- /* harmony export */ "wB": () => (/* binding */ toggleFacet),
81
- /* harmony export */ "wb": () => (/* binding */ isSearchSort)
82
- /* harmony export */ });
83
- /* unused harmony exports removeFacet, toggleFacets */
84
- /* harmony import */ var _utils_error__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(670);
85
-
86
- const sortKeys = new Set([
87
- 'price_desc',
88
- 'price_asc',
89
- 'orders_desc',
90
- 'name_desc',
91
- 'name_asc',
92
- 'release_desc',
93
- 'discount_desc',
94
- 'score_desc',
95
- ]);
96
- const isSearchSort = (x) => sortKeys.has(x);
97
- const removeFacet = (facets, facet) => {
98
- const { value } = facet;
99
- const index = facets.findIndex((x) => x.value === value);
100
- if (index < 0) {
101
- throw new _utils_error__WEBPACK_IMPORTED_MODULE_0__/* .SDKError */ .q(`Cannot remove ${value} from search params`);
102
- }
103
- return facets.filter((_, it) => it === 0 || it !== index);
104
- };
105
- const setFacet = (facets, facet, unique) => {
106
- if (unique === true) {
107
- const index = facets.findIndex((f) => f.key === facet.key);
108
- if (index > -1) {
109
- return facets.map((f, it) => (it === index ? facet : f));
110
- }
111
- }
112
- return [...facets, facet];
113
- };
114
- const toggleFacet = (facets, item) => {
115
- const found = facets.find((facet) => facet.key === item.key && facet.value === item.value);
116
- if (found !== undefined) {
117
- return removeFacet(facets, item);
118
- }
119
- return setFacet(facets, item, false);
120
- };
121
- const toggleFacets = (facets, items) => items.reduce((acc, curr) => toggleFacet(acc, curr), facets);
122
- //# sourceMappingURL=facets.js.map
123
-
124
- /***/ }),
125
-
126
- /***/ 2888:
127
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
128
-
129
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
130
- /* harmony export */ "Q": () => (/* binding */ parse)
131
- /* harmony export */ });
132
- /* harmony import */ var _utils_error__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(670);
133
- /* harmony import */ var _facets__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3291);
134
- /* harmony import */ var _useSearchState__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(3264);
135
-
136
-
137
-
138
- const parse = ({ pathname, searchParams }) => {
139
- const state = (0,_useSearchState__WEBPACK_IMPORTED_MODULE_0__/* .initialize */ .j)({
140
- base: pathname,
141
- term: searchParams.get('q') ?? null,
142
- sort: searchParams.get('sort') ?? undefined,
143
- page: Number(searchParams.get('page') ?? 0),
144
- });
145
- if (!(0,_facets__WEBPACK_IMPORTED_MODULE_1__/* .isSearchSort */ .wb)(state.sort)) {
146
- throw new _utils_error__WEBPACK_IMPORTED_MODULE_2__/* .SDKError */ .q(`Uknown sorting option ${state.sort}`);
147
- }
148
- const facets = searchParams.get('facets')?.split(',') ?? [];
149
- for (const facet of facets) {
150
- const values = searchParams.getAll(facet);
151
- for (const value of values) {
152
- state.selectedFacets = (0,_facets__WEBPACK_IMPORTED_MODULE_1__/* .setFacet */ .uL)(state.selectedFacets, {
153
- key: facet,
154
- value,
155
- });
156
- }
157
- }
158
- return state;
159
- };
160
- //# sourceMappingURL=serializer.js.map
161
-
162
- /***/ }),
163
-
164
- /***/ 2549:
165
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
166
-
167
- /* harmony export */ __webpack_require__.d(__webpack_exports__, {
168
- /* harmony export */ "h": () => (/* binding */ usePagination)
169
- /* harmony export */ });
170
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6689);
171
- /* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
172
- /* harmony import */ var _utils_format__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3364);
173
- /* harmony import */ var _useSearch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7794);
174
-
175
-
176
-
177
- const getLink = (state) => {
178
- const { pathname, search } = (0,_utils_format__WEBPACK_IMPORTED_MODULE_1__/* ["default"] */ .Z)(state);
179
- return `${pathname}${search}`;
180
- };
181
- const usePagination = (totalItems) => {
182
- const { pages, itemsPerPage, state } = (0,_useSearch__WEBPACK_IMPORTED_MODULE_2__/* .useSearch */ .R)();
183
- const total = Math.ceil(totalItems / itemsPerPage);
184
- const next = Number(pages[pages.length - 1]) + 1;
185
- const prev = pages[0] - 1;
186
- return (0,react__WEBPACK_IMPORTED_MODULE_0__.useMemo)(() => ({
187
- next: next < total && {
188
- cursor: next,
189
- link: getLink({ ...state, page: next }),
190
- },
191
- prev: prev > -1 && {
192
- cursor: prev,
193
- link: getLink({ ...state, page: prev }),
194
- },
195
- }), [next, prev, state, total]);
196
- };
197
- //# sourceMappingURL=usePagination.js.map
198
-
199
- /***/ }),
200
-
201
- /***/ 7794:
202
- /***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
203
-
204
-
205
- // EXPORTS
206
- __webpack_require__.d(__webpack_exports__, {
207
- "R": () => (/* binding */ useSearch)
208
- });
209
-
210
- // EXTERNAL MODULE: ./node_modules/@faststore/sdk/dist/search/Provider.js + 1 modules
211
- var Provider = __webpack_require__(6321);
212
- // EXTERNAL MODULE: external "react"
213
- var external_react_ = __webpack_require__(6689);
214
- // EXTERNAL MODULE: ./node_modules/@faststore/sdk/dist/utils/error.js
215
- var error = __webpack_require__(670);
216
- ;// CONCATENATED MODULE: ./node_modules/@faststore/sdk/dist/utils/useContext.js
217
-
218
-
219
- /**
220
- * @description Like React.useContext but throws when the context's value === undefined.
221
- * This is useful when you want to force the context to be present in the React's tree before using it
222
- */
223
- const useContext = (context) => {
224
- const value = (0,external_react_.useContext)(context);
225
- if (value !== undefined) {
226
- return value;
227
- }
228
- throw new error/* SDKError */.q(`${context.displayName ?? 'Context'} needs to be on the React tree`);
229
- };
230
- //# sourceMappingURL=useContext.js.map
231
- ;// CONCATENATED MODULE: ./node_modules/@faststore/sdk/dist/search/useSearch.js
232
-
233
-
234
- const useSearch = () => useContext(Provider/* Context */._);
235
- //# sourceMappingURL=useSearch.js.map
236
-
237
- /***/ })
238
-
239
- };
240
- ;