@wix/headless-stores 0.0.36 → 0.0.37

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 (129) hide show
  1. package/cjs/dist/react/Category.d.ts +65 -59
  2. package/cjs/dist/react/Category.js +50 -83
  3. package/cjs/dist/react/CategoryList.d.ts +184 -0
  4. package/cjs/dist/react/CategoryList.js +174 -0
  5. package/cjs/dist/react/Product.d.ts +3 -3
  6. package/cjs/dist/react/Product.js +6 -6
  7. package/cjs/dist/react/ProductActions.d.ts +1 -1
  8. package/cjs/dist/react/ProductActions.js +2 -2
  9. package/{dist/react/ProductsList.d.ts → cjs/dist/react/ProductList.d.ts} +71 -38
  10. package/cjs/dist/react/{ProductsList.js → ProductList.js} +30 -26
  11. package/cjs/dist/react/ProductListFilters.d.ts +244 -0
  12. package/cjs/dist/react/ProductListFilters.js +216 -0
  13. package/cjs/dist/react/ProductListPagination.d.ts +246 -0
  14. package/cjs/dist/react/ProductListPagination.js +207 -0
  15. package/cjs/dist/react/ProductListSort.d.ts +87 -0
  16. package/cjs/dist/react/ProductListSort.js +85 -0
  17. package/cjs/dist/react/ProductModifiers.d.ts +5 -5
  18. package/cjs/dist/react/ProductModifiers.js +10 -10
  19. package/cjs/dist/react/ProductVariantSelector.d.ts +5 -5
  20. package/cjs/dist/react/ProductVariantSelector.js +13 -10
  21. package/cjs/dist/react/SelectedVariant.d.ts +3 -3
  22. package/cjs/dist/react/SelectedVariant.js +6 -6
  23. package/cjs/dist/react/index.d.ts +7 -9
  24. package/cjs/dist/react/index.js +7 -9
  25. package/cjs/dist/services/buy-now-service.d.ts +208 -0
  26. package/cjs/dist/services/buy-now-service.js +132 -1
  27. package/cjs/dist/services/categories-list-service.d.ts +163 -0
  28. package/cjs/dist/services/categories-list-service.js +148 -0
  29. package/cjs/dist/services/category-service.d.ts +115 -70
  30. package/cjs/dist/services/category-service.js +101 -110
  31. package/cjs/dist/services/index.d.ts +6 -7
  32. package/cjs/dist/services/index.js +5 -16
  33. package/cjs/dist/services/pay-now-service.d.ts +146 -0
  34. package/cjs/dist/services/pay-now-service.js +112 -1
  35. package/cjs/dist/services/product-service.d.ts +71 -0
  36. package/cjs/dist/services/product-service.js +47 -0
  37. package/cjs/dist/services/products-list-filters-service.d.ts +292 -0
  38. package/cjs/dist/services/products-list-filters-service.js +446 -0
  39. package/cjs/dist/services/products-list-pagination-service.d.ts +186 -0
  40. package/cjs/dist/services/products-list-pagination-service.js +179 -0
  41. package/cjs/dist/services/products-list-service.d.ts +138 -52
  42. package/cjs/dist/services/products-list-service.js +98 -51
  43. package/cjs/dist/services/products-list-sort-service.d.ts +117 -0
  44. package/cjs/dist/services/products-list-sort-service.js +144 -0
  45. package/cjs/dist/utils/url-params.d.ts +68 -0
  46. package/cjs/dist/utils/url-params.js +72 -4
  47. package/dist/react/Category.d.ts +65 -59
  48. package/dist/react/Category.js +50 -83
  49. package/dist/react/CategoryList.d.ts +184 -0
  50. package/dist/react/CategoryList.js +174 -0
  51. package/dist/react/Product.d.ts +3 -3
  52. package/dist/react/Product.js +6 -6
  53. package/dist/react/ProductActions.d.ts +1 -1
  54. package/dist/react/ProductActions.js +2 -2
  55. package/{cjs/dist/react/ProductsList.d.ts → dist/react/ProductList.d.ts} +71 -38
  56. package/dist/react/{ProductsList.js → ProductList.js} +30 -26
  57. package/dist/react/ProductListFilters.d.ts +244 -0
  58. package/dist/react/ProductListFilters.js +216 -0
  59. package/dist/react/ProductListPagination.d.ts +246 -0
  60. package/dist/react/ProductListPagination.js +207 -0
  61. package/dist/react/ProductListSort.d.ts +87 -0
  62. package/dist/react/ProductListSort.js +85 -0
  63. package/dist/react/ProductModifiers.d.ts +5 -5
  64. package/dist/react/ProductModifiers.js +10 -10
  65. package/dist/react/ProductVariantSelector.d.ts +5 -5
  66. package/dist/react/ProductVariantSelector.js +13 -10
  67. package/dist/react/SelectedVariant.d.ts +3 -3
  68. package/dist/react/SelectedVariant.js +6 -6
  69. package/dist/react/index.d.ts +7 -9
  70. package/dist/react/index.js +7 -9
  71. package/dist/services/buy-now-service.d.ts +208 -0
  72. package/dist/services/buy-now-service.js +132 -1
  73. package/dist/services/categories-list-service.d.ts +163 -0
  74. package/dist/services/categories-list-service.js +148 -0
  75. package/dist/services/category-service.d.ts +115 -70
  76. package/dist/services/category-service.js +101 -110
  77. package/dist/services/index.d.ts +6 -7
  78. package/dist/services/index.js +5 -16
  79. package/dist/services/pay-now-service.d.ts +146 -0
  80. package/dist/services/pay-now-service.js +112 -1
  81. package/dist/services/product-service.d.ts +71 -0
  82. package/dist/services/product-service.js +47 -0
  83. package/dist/services/products-list-filters-service.d.ts +292 -0
  84. package/dist/services/products-list-filters-service.js +446 -0
  85. package/dist/services/products-list-pagination-service.d.ts +186 -0
  86. package/dist/services/products-list-pagination-service.js +179 -0
  87. package/dist/services/products-list-service.d.ts +138 -52
  88. package/dist/services/products-list-service.js +98 -51
  89. package/dist/services/products-list-sort-service.d.ts +117 -0
  90. package/dist/services/products-list-sort-service.js +144 -0
  91. package/dist/utils/url-params.d.ts +68 -0
  92. package/dist/utils/url-params.js +72 -4
  93. package/package.json +3 -3
  94. package/cjs/dist/react/Collection.d.ts +0 -294
  95. package/cjs/dist/react/Collection.js +0 -345
  96. package/cjs/dist/react/FilteredCollection.d.ts +0 -299
  97. package/cjs/dist/react/FilteredCollection.js +0 -352
  98. package/cjs/dist/react/RelatedProducts.d.ts +0 -169
  99. package/cjs/dist/react/RelatedProducts.js +0 -180
  100. package/cjs/dist/react/Sort.d.ts +0 -37
  101. package/cjs/dist/react/Sort.js +0 -36
  102. package/cjs/dist/services/catalog-service.d.ts +0 -36
  103. package/cjs/dist/services/catalog-service.js +0 -193
  104. package/cjs/dist/services/collection-service.d.ts +0 -124
  105. package/cjs/dist/services/collection-service.js +0 -628
  106. package/cjs/dist/services/filter-service.d.ts +0 -35
  107. package/cjs/dist/services/filter-service.js +0 -119
  108. package/cjs/dist/services/related-products-service.d.ts +0 -100
  109. package/cjs/dist/services/related-products-service.js +0 -127
  110. package/cjs/dist/services/sort-service.d.ts +0 -20
  111. package/cjs/dist/services/sort-service.js +0 -27
  112. package/dist/react/Collection.d.ts +0 -294
  113. package/dist/react/Collection.js +0 -345
  114. package/dist/react/FilteredCollection.d.ts +0 -299
  115. package/dist/react/FilteredCollection.js +0 -352
  116. package/dist/react/RelatedProducts.d.ts +0 -169
  117. package/dist/react/RelatedProducts.js +0 -180
  118. package/dist/react/Sort.d.ts +0 -37
  119. package/dist/react/Sort.js +0 -36
  120. package/dist/services/catalog-service.d.ts +0 -36
  121. package/dist/services/catalog-service.js +0 -193
  122. package/dist/services/collection-service.d.ts +0 -124
  123. package/dist/services/collection-service.js +0 -628
  124. package/dist/services/filter-service.d.ts +0 -35
  125. package/dist/services/filter-service.js +0 -119
  126. package/dist/services/related-products-service.d.ts +0 -100
  127. package/dist/services/related-products-service.js +0 -127
  128. package/dist/services/sort-service.d.ts +0 -20
  129. package/dist/services/sort-service.js +0 -27
@@ -1,345 +0,0 @@
1
- import { useService } from "@wix/services-manager-react";
2
- import { CollectionServiceDefinition } from "../services/collection-service.js";
3
- import { InventoryAvailabilityStatus, } from "@wix/auto_sdk_stores_products-v-3";
4
- /**
5
- * Headless component for product grid
6
- *
7
- * @component
8
- * @example
9
- * ```tsx
10
- * import { Collection } from '@wix/stores/components';
11
- *
12
- * function ProductGrid() {
13
- * return (
14
- * <Collection.Grid>
15
- * {({ products, isLoading, error, isEmpty, totalProducts, hasProducts }) => (
16
- * <div>
17
- * {isLoading && <div>Loading products...</div>}
18
- * {error && <div>Error: {error}</div>}
19
- * {isEmpty && <div>No products found</div>}
20
- * {hasProducts && (
21
- * <div>
22
- * <p>Showing {products.length} of {totalProducts} products</p>
23
- * <div className="product-grid">
24
- * {products.map(product => (
25
- * <div key={product.id} className="product-card">
26
- * <h3>{product.name}</h3>
27
- * <p>{product.price?.price} {product.price?.currency}</p>
28
- * </div>
29
- * ))}
30
- * </div>
31
- * </div>
32
- * )}
33
- * </div>
34
- * )}
35
- * </Collection.Grid>
36
- * );
37
- * }
38
- * ```
39
- */
40
- export const Grid = (props) => {
41
- const service = useService(CollectionServiceDefinition);
42
- // Debug logging to help identify service issues
43
- if (!service) {
44
- console.error("CollectionService is undefined");
45
- return props.children({
46
- products: [],
47
- isLoading: false,
48
- error: "Service not available",
49
- isEmpty: true,
50
- totalProducts: 0,
51
- hasProducts: false,
52
- });
53
- }
54
- // Safely access service properties with error handling
55
- try {
56
- const productList = service.products?.get() || [];
57
- const isLoading = service.isLoading?.get() || false;
58
- const error = service.error?.get() || null;
59
- const totalProducts = service.totalProducts?.get() || 0;
60
- const hasProducts = service.hasProducts?.get() || false;
61
- return props.children({
62
- products: productList,
63
- isLoading,
64
- error,
65
- isEmpty: !hasProducts && !isLoading,
66
- totalProducts,
67
- hasProducts,
68
- });
69
- }
70
- catch (err) {
71
- console.error("Error accessing service properties:", err);
72
- return props.children({
73
- products: [],
74
- isLoading: false,
75
- error: "Failed to load products",
76
- isEmpty: true,
77
- totalProducts: 0,
78
- hasProducts: false,
79
- });
80
- }
81
- };
82
- /**
83
- * Headless component for individual product item
84
- *
85
- * @component
86
- * @example
87
- * ```tsx
88
- * import { Collection } from '@wix/stores/components';
89
- *
90
- * function ProductCard({ product }) {
91
- * return (
92
- * <Collection.Item product={product}>
93
- * {({ id, title, slug, image, price, compareAtPrice, description, available }) => (
94
- * <div className={`product-card ${!available ? 'unavailable' : ''}`}>
95
- * {image && <img src={image} alt={title} />}
96
- * <h3>{title}</h3>
97
- * <p>{description}</p>
98
- * <div className="pricing">
99
- * <span className="price">{price}</span>
100
- * {compareAtPrice && (
101
- * <span className="compare-price"><s>{compareAtPrice}</s></span>
102
- * )}
103
- * </div>
104
- * {!available && <div className="badge">Out of Stock</div>}
105
- * <a href={`/products/${slug}`}>View Product</a>
106
- * </div>
107
- * )}
108
- * </Collection.Item>
109
- * );
110
- * }
111
- * ```
112
- */
113
- export const Item = (props) => {
114
- const { product } = props;
115
- // Use actual v3 API structure based on real data
116
- // Images are in media.main.image, not media.itemsInfo.items
117
- const image = product?.media?.main?.image || null;
118
- // Create formatted price since formattedAmount is not available
119
- const rawAmount = product.actualPriceRange?.minValue?.amount;
120
- const price = rawAmount ? `$${rawAmount}` : "$0.00";
121
- // Create formatted compare-at price
122
- const rawCompareAmount = product.compareAtPriceRange?.minValue?.amount;
123
- const compareAtPrice = rawCompareAmount ? `$${rawCompareAmount}` : null;
124
- const availabilityStatus = product.inventory?.availabilityStatus;
125
- const available = availabilityStatus === InventoryAvailabilityStatus.IN_STOCK ||
126
- availabilityStatus === InventoryAvailabilityStatus.PARTIALLY_OUT_OF_STOCK;
127
- const description = typeof product.description === "string" ? product.description : "";
128
- return props.children({
129
- id: product._id || "",
130
- title: product.name || "",
131
- slug: product.slug || "",
132
- image,
133
- price,
134
- compareAtPrice,
135
- description,
136
- available,
137
- });
138
- };
139
- /**
140
- * Headless component for load more products functionality
141
- * Note: V3 API uses simplified loading without traditional pagination
142
- *
143
- * @component
144
- * @example
145
- * ```tsx
146
- * import { Collection } from '@wix/stores/components';
147
- *
148
- * function LoadMoreButton() {
149
- * return (
150
- * <Collection.LoadMore>
151
- * {({ loadMore, refresh, isLoading, hasProducts, totalProducts, hasMoreProducts }) => (
152
- * <div className="load-more-section">
153
- * {hasProducts && (
154
- * <div>
155
- * <p>Loaded {totalProducts} products</p>
156
- * <div className="actions">
157
- * {hasMoreProducts && (
158
- * <button
159
- * onClick={loadMore}
160
- * disabled={isLoading}
161
- * >
162
- * {isLoading ? 'Loading...' : 'Load More Products'}
163
- * </button>
164
- * )}
165
- * <button onClick={refresh}>Refresh Collection</button>
166
- * </div>
167
- * </div>
168
- * )}
169
- * </div>
170
- * )}
171
- * </Collection.LoadMore>
172
- * );
173
- * }
174
- * ```
175
- */
176
- export const LoadMore = (props) => {
177
- const service = useService(CollectionServiceDefinition);
178
- // Error handling for undefined service
179
- if (!service) {
180
- console.error("CollectionService is undefined in LoadMore");
181
- return props.children({
182
- loadMore: async () => { },
183
- refresh: async () => { },
184
- isLoading: false,
185
- hasProducts: false,
186
- totalProducts: 0,
187
- hasMoreProducts: false,
188
- });
189
- }
190
- try {
191
- const isLoading = service.isLoading?.get() || false;
192
- const hasProducts = service.hasProducts?.get() || false;
193
- const totalProducts = service.totalProducts?.get() || 0;
194
- const hasMoreProducts = service.hasMoreProducts?.get() || false;
195
- return props.children({
196
- loadMore: service.loadMore || (async () => { }),
197
- refresh: service.refresh || (async () => { }),
198
- isLoading,
199
- hasProducts,
200
- totalProducts,
201
- hasMoreProducts,
202
- });
203
- }
204
- catch (err) {
205
- console.error("Error in LoadMore:", err);
206
- return props.children({
207
- loadMore: async () => { },
208
- refresh: async () => { },
209
- isLoading: false,
210
- hasProducts: false,
211
- totalProducts: 0,
212
- hasMoreProducts: false,
213
- });
214
- }
215
- };
216
- /**
217
- * Headless component for collection header with product count
218
- *
219
- * @component
220
- * @example
221
- * ```tsx
222
- * import { Collection } from '@wix/stores/components';
223
- *
224
- * function CollectionHeader() {
225
- * return (
226
- * <Collection.Header>
227
- * {({ totalProducts, isLoading, hasProducts }) => (
228
- * <div className="collection-header">
229
- * {isLoading && <div>Loading collection...</div>}
230
- * {hasProducts && !isLoading && (
231
- * <h2>Products ({totalProducts} items)</h2>
232
- * )}
233
- * {!hasProducts && !isLoading && (
234
- * <h2>No products found</h2>
235
- * )}
236
- * </div>
237
- * )}
238
- * </Collection.Header>
239
- * );
240
- * }
241
- * ```
242
- */
243
- export const Header = (props) => {
244
- const service = useService(CollectionServiceDefinition);
245
- // Error handling for undefined service
246
- if (!service) {
247
- console.error("CollectionService is undefined in Header");
248
- return props.children({
249
- totalProducts: 0,
250
- isLoading: false,
251
- hasProducts: false,
252
- });
253
- }
254
- try {
255
- const totalProducts = service.totalProducts?.get() || 0;
256
- const isLoading = service.isLoading?.get() || false;
257
- const hasProducts = service.hasProducts?.get() || false;
258
- return props.children({
259
- totalProducts,
260
- isLoading,
261
- hasProducts,
262
- });
263
- }
264
- catch (err) {
265
- console.error("Error in Header:", err);
266
- return props.children({
267
- totalProducts: 0,
268
- isLoading: false,
269
- hasProducts: false,
270
- });
271
- }
272
- };
273
- /**
274
- * Headless component for collection actions (refresh, load more)
275
- * Replaces traditional pagination for V3 API
276
- *
277
- * @component
278
- * @example
279
- * ```tsx
280
- * import { Collection } from '@wix/stores/components';
281
- *
282
- * function CollectionActions() {
283
- * return (
284
- * <Collection.Actions>
285
- * {({ refresh, loadMore, isLoading, error }) => (
286
- * <div className="collection-actions">
287
- * {error && (
288
- * <div className="error">
289
- * Error: {error}
290
- * <button onClick={refresh}>Retry</button>
291
- * </div>
292
- * )}
293
- * <div className="action-buttons">
294
- * <button
295
- * onClick={refresh}
296
- * disabled={isLoading}
297
- * >
298
- * {isLoading ? 'Refreshing...' : 'Refresh'}
299
- * </button>
300
- * <button
301
- * onClick={loadMore}
302
- * disabled={isLoading}
303
- * >
304
- * Load More
305
- * </button>
306
- * </div>
307
- * </div>
308
- * )}
309
- * </Collection.Actions>
310
- * );
311
- * }
312
- * ```
313
- */
314
- export const Actions = (props) => {
315
- const service = useService(CollectionServiceDefinition);
316
- // Error handling for undefined service
317
- if (!service) {
318
- console.error("CollectionService is undefined in Actions");
319
- return props.children({
320
- refresh: async () => { },
321
- loadMore: async () => { },
322
- isLoading: false,
323
- error: "Service not available",
324
- });
325
- }
326
- try {
327
- const isLoading = service.isLoading?.get() || false;
328
- const error = service.error?.get() || null;
329
- return props.children({
330
- refresh: service.refresh || (async () => { }),
331
- loadMore: service.loadMore || (async () => { }),
332
- isLoading,
333
- error,
334
- });
335
- }
336
- catch (err) {
337
- console.error("Error in Actions:", err);
338
- return props.children({
339
- refresh: async () => { },
340
- loadMore: async () => { },
341
- isLoading: false,
342
- error: "Failed to load actions",
343
- });
344
- }
345
- };
@@ -1,299 +0,0 @@
1
- import React, { type ReactNode } from "react";
2
- import { type AvailableOptions, type FilterServiceAPI, type Filter } from "../services/filter-service.js";
3
- import { type V3Product } from "@wix/auto_sdk_stores_products-v-3";
4
- import type { PropsWithChildren } from "react";
5
- export type { AvailableOptions, Filter, FilterServiceAPI };
6
- /**
7
- * Root component that provides the FilteredCollection service context to its children.
8
- * This component sets up the necessary services for managing filtered collection functionality.
9
- *
10
- * @order 1
11
- * @component
12
- * @example
13
- * ```tsx
14
- * import { FilteredCollection } from '@wix/stores/components';
15
- *
16
- * function FilteredProductsPage() {
17
- * return (
18
- * <FilteredCollection.Root>
19
- * <div>
20
- * <FilteredCollection.Filters>
21
- * {({ applyFilters, clearFilters, currentFilters, availableOptions, isFiltered }) => (
22
- * <div className="filters">
23
- * <h3>Filters</h3>
24
- * <div className="price-filter">
25
- * <label>Price Range</label>
26
- * <input
27
- * type="range"
28
- * min={availableOptions.priceRange.min}
29
- * max={availableOptions.priceRange.max}
30
- * value={currentFilters.priceRange.min}
31
- * onChange={(e) => applyFilters({
32
- * ...currentFilters,
33
- * priceRange: { ...currentFilters.priceRange, min: Number(e.target.value) }
34
- * })}
35
- * />
36
- * </div>
37
- * {isFiltered && (
38
- * <button onClick={clearFilters}>Clear All Filters</button>
39
- * )}
40
- * </div>
41
- * )}
42
- * </FilteredCollection.Filters>
43
- *
44
- * <FilteredCollection.Grid>
45
- * {({ products, isLoading, error, isEmpty, totalProducts, hasMoreProducts }) => (
46
- * <div>
47
- * {isLoading && <div>Loading filtered products...</div>}
48
- * {error && <div>Error: {error}</div>}
49
- * {isEmpty && <div>No products match your filters</div>}
50
- * {products.length > 0 && (
51
- * <div>
52
- * <p>Showing {products.length} of {totalProducts} products</p>
53
- * <div className="filtered-grid">
54
- * {products.map(product => (
55
- * <FilteredCollection.Item key={product.id} product={product}>
56
- * {({ title, image, price, available, slug }) => (
57
- * <div className={`product-item ${!available ? 'unavailable' : ''}`}>
58
- * {image && <img src={image} alt={title} />}
59
- * <h3>{title}</h3>
60
- * <div className="price">{price}</div>
61
- * <a href={`/product/${slug}`}>View Details</a>
62
- * </div>
63
- * )}
64
- * </FilteredCollection.Item>
65
- * ))}
66
- * </div>
67
- * {hasMoreProducts && (
68
- * <FilteredCollection.LoadMore>
69
- * {({ loadMore, isLoading }) => (
70
- * <button onClick={loadMore} disabled={isLoading}>
71
- * {isLoading ? 'Loading...' : 'Load More'}
72
- * </button>
73
- * )}
74
- * </FilteredCollection.LoadMore>
75
- * )}
76
- * </div>
77
- * )}
78
- * </div>
79
- * )}
80
- * </FilteredCollection.Grid>
81
- * </div>
82
- * </FilteredCollection.Root>
83
- * );
84
- * }
85
- * ```
86
- */
87
- export declare function Root(props: PropsWithChildren<{}>): import("react/jsx-runtime").JSX.Element;
88
- export interface FiltersLoadingProps {
89
- children: (data: {
90
- isFullyLoaded: boolean;
91
- }) => ReactNode;
92
- }
93
- /**
94
- * Headless component for displaying a loading state for filters
95
- *
96
- * @component
97
- * @example
98
- * ```tsx
99
- * import { FilteredCollection } from '@wix/stores/components';
100
- *
101
- * function FiltersLoadingIndicator() {
102
- * return (
103
- * <FilteredCollection.FiltersLoading>
104
- * {({ isFullyLoaded }) => (
105
- * <div>
106
- * {!isFullyLoaded && (
107
- * <div className="loading-pulse">
108
- * Loading filters...
109
- * </div>
110
- * )}
111
- * </div>
112
- * )}
113
- * </FilteredCollection.FiltersLoading>
114
- * );
115
- * }
116
- * ```
117
- */
118
- export declare const FiltersLoading: React.FC<FiltersLoadingProps>;
119
- export interface FilteredGridProps {
120
- children: (data: {
121
- products: V3Product[];
122
- totalProducts: number;
123
- isLoading: boolean;
124
- error: string | null;
125
- isEmpty: boolean;
126
- hasMoreProducts: boolean;
127
- }) => ReactNode;
128
- }
129
- /**
130
- * Headless component for displaying a grid of filtered products
131
- *
132
- * @component
133
- * @example
134
- * ```tsx
135
- * import { FilteredCollection } from '@wix/stores/components';
136
- *
137
- * function FilteredProductsGrid() {
138
- * return (
139
- * <FilteredCollection.Grid>
140
- * {({ products, isLoading, error, isEmpty, totalProducts, hasMoreProducts }) => (
141
- * <div>
142
- * {isLoading && <div>Loading filtered products...</div>}
143
- * {error && <div>Error: {error}</div>}
144
- * {isEmpty && <div>No products match your filters</div>}
145
- * {products.length > 0 && (
146
- * <div>
147
- * <p>Showing {products.length} of {totalProducts} products</p>
148
- * <div className="filtered-grid">
149
- * {products.map(product => (
150
- * <div key={product.id}>{product.name}</div>
151
- * ))}
152
- * </div>
153
- * {hasMoreProducts && <button>Load More</button>}
154
- * </div>
155
- * )}
156
- * </div>
157
- * )}
158
- * </FilteredCollection.Grid>
159
- * );
160
- * }
161
- * ```
162
- */
163
- export declare const Grid: React.FC<FilteredGridProps>;
164
- export interface FilteredItemProps {
165
- product: V3Product;
166
- children: (data: {
167
- title: string;
168
- image: string | null;
169
- imageAltText: string | null;
170
- price: string;
171
- compareAtPrice: string | null;
172
- available: boolean;
173
- slug: string;
174
- description?: string;
175
- }) => ReactNode;
176
- }
177
- /**
178
- * Headless component for displaying a filtered product item
179
- *
180
- * @component
181
- * @example
182
- * ```tsx
183
- * import { FilteredCollection } from '@wix/stores/components';
184
- *
185
- * function FilteredProductItem({ product }) {
186
- * return (
187
- * <FilteredCollection.Item product={product}>
188
- * {({ title, image, price, compareAtPrice, available, slug, description }) => (
189
- * <div className={`product-item ${!available ? 'unavailable' : ''}`}>
190
- * {image && <img src={image} alt={title} />}
191
- * <h3>{title}</h3>
192
- * {description && <p>{description}</p>}
193
- * <div className="price">
194
- * <span className="current">{price}</span>
195
- * {compareAtPrice && <span className="compare"><s>{compareAtPrice}</s></span>}
196
- * </div>
197
- * {!available && <div className="out-of-stock">Out of Stock</div>}
198
- * <a href={`/product/${slug}`}>View Details</a>
199
- * </div>
200
- * )}
201
- * </FilteredCollection.Item>
202
- * );
203
- * }
204
- * ```
205
- */
206
- export declare const Item: React.FC<FilteredItemProps>;
207
- export interface FilteredLoadMoreProps {
208
- children: (data: {
209
- loadMore: () => Promise<void>;
210
- refresh: () => Promise<void>;
211
- isLoading: boolean;
212
- hasProducts: boolean;
213
- totalProducts: number;
214
- hasMoreProducts: boolean;
215
- }) => ReactNode;
216
- }
217
- /**
218
- * Headless component for load more filtered products functionality
219
- *
220
- * @component
221
- * @example
222
- * ```tsx
223
- * import { FilteredCollection } from '@wix/stores/components';
224
- *
225
- * function LoadMoreProducts() {
226
- * return (
227
- * <FilteredCollection.LoadMore>
228
- * {({ loadMore, refresh, isLoading, hasProducts, totalProducts, hasMoreProducts }) => (
229
- * <div>
230
- * {hasProducts && (
231
- * <div>
232
- * <p>Showing products ({totalProducts} total)</p>
233
- * {hasMoreProducts && (
234
- * <button
235
- * onClick={loadMore}
236
- * disabled={isLoading}
237
- * >
238
- * {isLoading ? 'Loading...' : 'Load More'}
239
- * </button>
240
- * )}
241
- * <button onClick={refresh}>Refresh</button>
242
- * </div>
243
- * )}
244
- * </div>
245
- * )}
246
- * </FilteredCollection.LoadMore>
247
- * );
248
- * }
249
- * ```
250
- */
251
- export declare const LoadMore: React.FC<FilteredLoadMoreProps>;
252
- export interface FilteredFiltersProps {
253
- children: (data: {
254
- applyFilters: (filters: Filter) => void;
255
- clearFilters: () => void;
256
- currentFilters: Filter;
257
- allProducts: V3Product[];
258
- availableOptions: AvailableOptions;
259
- isFiltered: boolean;
260
- }) => ReactNode;
261
- }
262
- /**
263
- * Headless component for product filters with available options
264
- *
265
- * @component
266
- * @example
267
- * ```tsx
268
- * import { FilteredCollection } from '@wix/stores/components';
269
- *
270
- * function ProductFilters() {
271
- * return (
272
- * <FilteredCollection.Filters>
273
- * {({ applyFilters, clearFilters, currentFilters, availableOptions, isFiltered }) => (
274
- * <div className="filters">
275
- * <h3>Filters</h3>
276
- * <div className="price-filter">
277
- * <label>Price Range</label>
278
- * <input
279
- * type="range"
280
- * min={availableOptions.priceRange.min}
281
- * max={availableOptions.priceRange.max}
282
- * value={currentFilters.priceRange.min}
283
- * onChange={(e) => applyFilters({
284
- * ...currentFilters,
285
- * priceRange: { ...currentFilters.priceRange, min: Number(e.target.value) }
286
- * })}
287
- * />
288
- * </div>
289
- * {isFiltered && (
290
- * <button onClick={clearFilters}>Clear All Filters</button>
291
- * )}
292
- * </div>
293
- * )}
294
- * </FilteredCollection.Filters>
295
- * );
296
- * }
297
- * ```
298
- */
299
- export declare const Filters: React.FC<FilteredFiltersProps>;