@wix/headless-stores 0.0.56 → 0.0.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/dist/react/Category.d.ts +1 -0
- package/cjs/dist/react/Category.js +11 -22
- package/cjs/dist/react/CategoryList.js +2 -3
- package/cjs/dist/react/Product.d.ts +73 -30
- package/cjs/dist/react/Product.js +27 -145
- package/cjs/dist/react/ProductList.d.ts +9 -4
- package/cjs/dist/react/ProductList.js +4 -32
- package/cjs/dist/react/ProductListSort.d.ts +14 -0
- package/cjs/dist/react/ProductListSort.js +14 -0
- package/cjs/dist/react/core/ProductList.d.ts +3 -0
- package/cjs/dist/react/core/ProductList.js +2 -0
- package/cjs/dist/react/core/ProductListFilters.d.ts +8 -180
- package/cjs/dist/react/core/ProductListFilters.js +137 -171
- package/cjs/dist/react/core/ProductListPagination.d.ts +0 -192
- package/cjs/dist/react/core/ProductListPagination.js +2 -160
- package/cjs/dist/react/core/ProductListSort.d.ts +9 -57
- package/cjs/dist/react/core/ProductListSort.js +32 -52
- package/cjs/dist/react/core/SelectedVariant.js +2 -2
- package/cjs/dist/services/index.d.ts +2 -2
- package/cjs/dist/services/products-list-search-service.d.ts +3 -162
- package/cjs/dist/services/products-list-search-service.js +31 -424
- package/cjs/dist/services/products-list-service.d.ts +86 -4
- package/cjs/dist/services/products-list-service.js +125 -4
- package/cjs/dist/utils/renderChildren.d.ts +2 -1
- package/cjs/dist/utils/renderChildren.js +5 -2
- package/dist/react/Category.d.ts +1 -0
- package/dist/react/Category.js +11 -22
- package/dist/react/CategoryList.js +2 -3
- package/dist/react/Product.d.ts +73 -30
- package/dist/react/Product.js +27 -145
- package/dist/react/ProductList.d.ts +9 -4
- package/dist/react/ProductList.js +4 -32
- package/dist/react/ProductListSort.d.ts +14 -0
- package/dist/react/ProductListSort.js +14 -0
- package/dist/react/core/ProductList.d.ts +3 -0
- package/dist/react/core/ProductList.js +2 -0
- package/dist/react/core/ProductListFilters.d.ts +8 -180
- package/dist/react/core/ProductListFilters.js +137 -171
- package/dist/react/core/ProductListPagination.d.ts +0 -192
- package/dist/react/core/ProductListPagination.js +2 -160
- package/dist/react/core/ProductListSort.d.ts +9 -57
- package/dist/react/core/ProductListSort.js +32 -52
- package/dist/react/core/SelectedVariant.js +2 -2
- package/dist/services/index.d.ts +2 -2
- package/dist/services/products-list-search-service.d.ts +3 -162
- package/dist/services/products-list-search-service.js +31 -424
- package/dist/services/products-list-service.d.ts +86 -4
- package/dist/services/products-list-service.js +125 -4
- package/dist/utils/renderChildren.d.ts +2 -1
- package/dist/utils/renderChildren.js +5 -2
- package/package.json +4 -3
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { defineService, implementService } from '@wix/services-definitions';
|
|
2
2
|
import { SignalsServiceDefinition, } from '@wix/services-definitions/core-services/signals';
|
|
3
|
-
import { productsV3, readOnlyVariantsV3 } from '@wix/stores';
|
|
3
|
+
import { customizationsV3, productsV3, readOnlyVariantsV3 } from '@wix/stores';
|
|
4
4
|
import { loadCategoriesListServiceConfig } from './categories-list-service.js';
|
|
5
|
-
import { parseUrlToSearchOptions, } from './products-list-search-service.js';
|
|
5
|
+
import { InventoryStatusType, parseUrlToSearchOptions, } from './products-list-search-service.js';
|
|
6
6
|
export const DEFAULT_QUERY_LIMIT = 100;
|
|
7
7
|
/**
|
|
8
8
|
* Loads products list service configuration from the Wix Stores API for SSR initialization.
|
|
@@ -118,10 +118,13 @@ export const DEFAULT_QUERY_LIMIT = 100;
|
|
|
118
118
|
*/
|
|
119
119
|
export async function loadProductsListServiceConfig(input) {
|
|
120
120
|
let searchOptions;
|
|
121
|
+
const { items: customizations = [] } = await customizationsV3
|
|
122
|
+
.queryCustomizations()
|
|
123
|
+
.find();
|
|
121
124
|
if (typeof input === 'string') {
|
|
122
125
|
// URL input - parse it
|
|
123
126
|
const categoriesListConfig = await loadCategoriesListServiceConfig();
|
|
124
|
-
const { searchOptions: parsedOptions } = await parseUrlToSearchOptions(input, categoriesListConfig.categories);
|
|
127
|
+
const { searchOptions: parsedOptions } = await parseUrlToSearchOptions(input, categoriesListConfig.categories, customizations);
|
|
125
128
|
searchOptions = parsedOptions;
|
|
126
129
|
}
|
|
127
130
|
else {
|
|
@@ -139,6 +142,7 @@ export async function loadProductsListServiceConfig(input) {
|
|
|
139
142
|
searchOptions,
|
|
140
143
|
pagingMetadata: resultWithFilter.pagingMetadata,
|
|
141
144
|
aggregations: resultWithoutFilter.aggregationData ?? {},
|
|
145
|
+
customizations,
|
|
142
146
|
};
|
|
143
147
|
}
|
|
144
148
|
/**
|
|
@@ -292,6 +296,14 @@ export const ProductListService = implementService.withConfig()(ProductsListServ
|
|
|
292
296
|
const productsSignal = signalsService.signal(config.products);
|
|
293
297
|
const searchOptionsSignal = signalsService.signal(config.searchOptions);
|
|
294
298
|
const pagingMetadataSignal = signalsService.signal(config.pagingMetadata);
|
|
299
|
+
const minPriceSignal = signalsService.signal(getMinPrice(config.aggregations.results));
|
|
300
|
+
const maxPriceSignal = signalsService.signal(getMaxPrice(config.aggregations.results));
|
|
301
|
+
const availableProductOptionsSignal = signalsService.signal(getAvailableProductOptions(config.aggregations.results, config.customizations));
|
|
302
|
+
const availableInventoryStatusesSignal = signalsService.signal([
|
|
303
|
+
InventoryStatusType.IN_STOCK,
|
|
304
|
+
InventoryStatusType.OUT_OF_STOCK,
|
|
305
|
+
InventoryStatusType.PARTIALLY_OUT_OF_STOCK,
|
|
306
|
+
]);
|
|
295
307
|
const aggregationsSignal = signalsService.signal(config.aggregations);
|
|
296
308
|
const isLoadingSignal = signalsService.signal(false);
|
|
297
309
|
const errorSignal = signalsService.signal(null);
|
|
@@ -331,7 +343,15 @@ export const ProductListService = implementService.withConfig()(ProductsListServ
|
|
|
331
343
|
searchOptions: searchOptionsSignal,
|
|
332
344
|
pagingMetadata: pagingMetadataSignal,
|
|
333
345
|
aggregations: aggregationsSignal,
|
|
334
|
-
|
|
346
|
+
/* Metadata for products list */
|
|
347
|
+
minPrice: minPriceSignal,
|
|
348
|
+
maxPrice: maxPriceSignal,
|
|
349
|
+
availableInventoryStatuses: availableInventoryStatusesSignal,
|
|
350
|
+
availableProductOptions: availableProductOptionsSignal,
|
|
351
|
+
/* End of Metadata for products list */
|
|
352
|
+
setSearchOptions: (searchOptions) => {
|
|
353
|
+
searchOptionsSignal.set(searchOptions);
|
|
354
|
+
},
|
|
335
355
|
setSort: (sort) => {
|
|
336
356
|
const currentOptions = searchOptionsSignal.peek();
|
|
337
357
|
searchOptionsSignal.set({
|
|
@@ -346,7 +366,108 @@ export const ProductListService = implementService.withConfig()(ProductsListServ
|
|
|
346
366
|
filter,
|
|
347
367
|
});
|
|
348
368
|
},
|
|
369
|
+
resetFilter: () => {
|
|
370
|
+
const currentOptions = searchOptionsSignal.peek();
|
|
371
|
+
searchOptionsSignal.set({
|
|
372
|
+
...currentOptions,
|
|
373
|
+
filter: {},
|
|
374
|
+
});
|
|
375
|
+
},
|
|
376
|
+
isFiltered: () => {
|
|
377
|
+
return signalsService.computed(() => {
|
|
378
|
+
const currentOptions = searchOptionsSignal.peek();
|
|
379
|
+
if (!currentOptions.filter)
|
|
380
|
+
return false;
|
|
381
|
+
return (currentOptions.filter !== undefined &&
|
|
382
|
+
Object.keys(currentOptions.filter).length > 0);
|
|
383
|
+
});
|
|
384
|
+
},
|
|
349
385
|
isLoading: isLoadingSignal,
|
|
350
386
|
error: errorSignal,
|
|
387
|
+
loadMore: (count) => {
|
|
388
|
+
const currentOptions = searchOptionsSignal.peek();
|
|
389
|
+
searchOptionsSignal.set({
|
|
390
|
+
...currentOptions,
|
|
391
|
+
cursorPaging: {
|
|
392
|
+
cursor: pagingMetadataSignal.get().cursors?.next,
|
|
393
|
+
limit: currentOptions.cursorPaging?.limit ?? 0 + count,
|
|
394
|
+
},
|
|
395
|
+
});
|
|
396
|
+
},
|
|
397
|
+
hasMoreProducts: signalsService.computed(() => pagingMetadataSignal.get().hasNext ?? false),
|
|
351
398
|
};
|
|
352
399
|
});
|
|
400
|
+
function getMinPrice(aggregationData) {
|
|
401
|
+
const minPriceAggregation = aggregationData.find((data) => data.fieldPath === 'actualPriceRange.minValue.amount');
|
|
402
|
+
if (minPriceAggregation?.scalar?.value) {
|
|
403
|
+
return Number(minPriceAggregation.scalar.value) || 0;
|
|
404
|
+
}
|
|
405
|
+
return 0;
|
|
406
|
+
}
|
|
407
|
+
function getMaxPrice(aggregationData) {
|
|
408
|
+
const maxPriceAggregation = aggregationData.find((data) => data.fieldPath === 'actualPriceRange.maxValue.amount');
|
|
409
|
+
if (maxPriceAggregation?.scalar?.value) {
|
|
410
|
+
return Number(maxPriceAggregation.scalar.value) || 0;
|
|
411
|
+
}
|
|
412
|
+
return 0;
|
|
413
|
+
}
|
|
414
|
+
function getAvailableProductOptions(aggregationData = [], customizations = []) {
|
|
415
|
+
const matchesAggregationName = (name, aggregationNames) => {
|
|
416
|
+
return aggregationNames.some((aggName) => aggName.toLowerCase() === name.toLowerCase());
|
|
417
|
+
};
|
|
418
|
+
const sortChoicesIntelligently = (choices) => {
|
|
419
|
+
return [...choices].sort((a, b) => {
|
|
420
|
+
const aIsNumber = /^\d+$/.test(a.name);
|
|
421
|
+
const bIsNumber = /^\d+$/.test(b.name);
|
|
422
|
+
if (aIsNumber && bIsNumber) {
|
|
423
|
+
return parseInt(a.name) - parseInt(b.name);
|
|
424
|
+
}
|
|
425
|
+
if (aIsNumber && !bIsNumber)
|
|
426
|
+
return -1;
|
|
427
|
+
if (!aIsNumber && bIsNumber)
|
|
428
|
+
return 1;
|
|
429
|
+
return a.name.localeCompare(b.name);
|
|
430
|
+
});
|
|
431
|
+
};
|
|
432
|
+
const optionNames = [];
|
|
433
|
+
const choiceNames = [];
|
|
434
|
+
aggregationData.forEach((result) => {
|
|
435
|
+
if (result.name === 'optionNames' && result.values?.results) {
|
|
436
|
+
optionNames.push(...result.values.results
|
|
437
|
+
.map((item) => item.value)
|
|
438
|
+
.filter((value) => typeof value === 'string'));
|
|
439
|
+
}
|
|
440
|
+
if (result.name === 'choiceNames' && result.values?.results) {
|
|
441
|
+
choiceNames.push(...result.values.results
|
|
442
|
+
.map((item) => item.value)
|
|
443
|
+
.filter((value) => typeof value === 'string'));
|
|
444
|
+
}
|
|
445
|
+
});
|
|
446
|
+
const options = customizations
|
|
447
|
+
.filter((customization) => customization.name &&
|
|
448
|
+
customization._id &&
|
|
449
|
+
customization.customizationType ===
|
|
450
|
+
customizationsV3.CustomizationType.PRODUCT_OPTION &&
|
|
451
|
+
(optionNames.length === 0 ||
|
|
452
|
+
matchesAggregationName(customization.name, optionNames)))
|
|
453
|
+
.map((customization) => {
|
|
454
|
+
const choices = (customization.choicesSettings?.choices || [])
|
|
455
|
+
.filter((choice) => choice._id &&
|
|
456
|
+
choice.name &&
|
|
457
|
+
(choiceNames.length === 0 ||
|
|
458
|
+
matchesAggregationName(choice.name, choiceNames)))
|
|
459
|
+
.map((choice) => ({
|
|
460
|
+
id: choice._id,
|
|
461
|
+
name: choice.name,
|
|
462
|
+
colorCode: choice.colorCode,
|
|
463
|
+
}));
|
|
464
|
+
return {
|
|
465
|
+
id: customization._id,
|
|
466
|
+
name: customization.name,
|
|
467
|
+
choices: sortChoicesIntelligently(choices),
|
|
468
|
+
optionRenderType: customization.customizationRenderType,
|
|
469
|
+
};
|
|
470
|
+
})
|
|
471
|
+
.filter((option) => option.choices.length > 0);
|
|
472
|
+
return options;
|
|
473
|
+
}
|
|
@@ -9,6 +9,7 @@ export interface RenderChildrenParams<THTMLElement = HTMLElement, TProps = any>
|
|
|
9
9
|
props: TProps;
|
|
10
10
|
/** Ref to forward to the rendered element */
|
|
11
11
|
ref: React.Ref<THTMLElement>;
|
|
12
|
+
content?: string | null;
|
|
12
13
|
}
|
|
13
14
|
/**
|
|
14
15
|
* Utility function to handle children rendering.
|
|
@@ -38,4 +39,4 @@ export interface RenderChildrenParams<THTMLElement = HTMLElement, TProps = any>
|
|
|
38
39
|
* });
|
|
39
40
|
* ```
|
|
40
41
|
*/
|
|
41
|
-
export declare function renderChildren<THTMLElement = HTMLElement, TProps = any>({ children, props, ref, }: RenderChildrenParams<THTMLElement, TProps>): React.ReactNode | null;
|
|
42
|
+
export declare function renderChildren<THTMLElement = HTMLElement, TProps = any>({ children, props, ref, content, }: RenderChildrenParams<THTMLElement, TProps>): React.ReactNode | null;
|
|
@@ -27,13 +27,16 @@ import React from 'react';
|
|
|
27
27
|
* });
|
|
28
28
|
* ```
|
|
29
29
|
*/
|
|
30
|
-
export function renderChildren({ children, props, ref, }) {
|
|
30
|
+
export function renderChildren({ children, props, ref, content, }) {
|
|
31
31
|
// Early return if no children provided
|
|
32
32
|
if (!children)
|
|
33
33
|
return null;
|
|
34
34
|
// Handle React element pattern
|
|
35
35
|
if (React.isValidElement(children)) {
|
|
36
|
-
return children
|
|
36
|
+
return React.cloneElement(children, {
|
|
37
|
+
ref,
|
|
38
|
+
...(content ? { children: content } : {}),
|
|
39
|
+
});
|
|
37
40
|
}
|
|
38
41
|
// Handle render function pattern
|
|
39
42
|
if (typeof children === 'function') {
|
package/dist/react/Category.d.ts
CHANGED
package/dist/react/Category.js
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
4
3
|
import * as CoreCategory from './core/Category.js';
|
|
5
4
|
import { CategoryServiceDefinition, } from '../services/category-service.js';
|
|
6
5
|
import { useService } from '@wix/services-manager-react';
|
|
7
|
-
import {
|
|
6
|
+
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
8
7
|
var TestIds;
|
|
9
8
|
(function (TestIds) {
|
|
10
9
|
TestIds["categoryItem"] = "category-item";
|
|
@@ -76,19 +75,18 @@ export const Trigger = React.forwardRef((props, ref) => {
|
|
|
76
75
|
const categoryService = useService(CategoryServiceDefinition);
|
|
77
76
|
const category = categoryService.category.get();
|
|
78
77
|
const isSelected = categoryService.isSelected.get();
|
|
78
|
+
const setIsSelected = (isSelected) => categoryService.isSelected.set(isSelected);
|
|
79
79
|
const handleSelect = () => {
|
|
80
80
|
if (onSelect) {
|
|
81
81
|
onSelect(category);
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
})
|
|
91
|
-
: category.name }));
|
|
84
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, onClick: handleSelect, "data-testid": TestIds.categoryTrigger, "data-selected": isSelected ? 'true' : 'false', customElement: children, customElementProps: {
|
|
85
|
+
category,
|
|
86
|
+
isSelected,
|
|
87
|
+
onSelect: handleSelect,
|
|
88
|
+
setIsSelected,
|
|
89
|
+
}, content: category.name, children: _jsx("button", { children: category.name }) }));
|
|
92
90
|
});
|
|
93
91
|
/**
|
|
94
92
|
* Displays the category name or label.
|
|
@@ -121,10 +119,7 @@ export const Label = React.forwardRef((props, ref) => {
|
|
|
121
119
|
const category = categoryService.category.get();
|
|
122
120
|
const isSelected = categoryService.isSelected.get();
|
|
123
121
|
return (_jsx(CoreCategory.Name, { children: ({ name }) => {
|
|
124
|
-
|
|
125
|
-
return (_jsx(Comp, { ref: ref, className: className, "data-testid": TestIds.categoryLabel, "data-selected": isSelected ? 'true' : 'false', children: asChild && children
|
|
126
|
-
? renderChildren({ children, props: { name, category }, ref })
|
|
127
|
-
: name }));
|
|
122
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.categoryLabel, "data-selected": isSelected ? 'true' : 'false', customElement: children, customElementProps: { name, category }, content: name, children: _jsx("span", { children: name }) }));
|
|
128
123
|
} }));
|
|
129
124
|
});
|
|
130
125
|
/**
|
|
@@ -158,10 +153,7 @@ export const ID = React.forwardRef((props, ref) => {
|
|
|
158
153
|
const category = categoryService.category.get();
|
|
159
154
|
const isSelected = categoryService.isSelected.get();
|
|
160
155
|
const id = category._id || '';
|
|
161
|
-
|
|
162
|
-
return (_jsx(Comp, { ref: ref, className: className || 'sr-only', "data-testid": TestIds.categoryId, "data-selected": isSelected ? 'true' : 'false', children: asChild && children
|
|
163
|
-
? renderChildren({ children, props: { id, category }, ref })
|
|
164
|
-
: id }));
|
|
156
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className || 'sr-only', "data-testid": TestIds.categoryId, "data-selected": isSelected ? 'true' : 'false', customElement: children, customElementProps: { id, category }, content: id, children: _jsx("span", { children: id }) }));
|
|
165
157
|
});
|
|
166
158
|
/**
|
|
167
159
|
* Provides access to the full category data for advanced use cases.
|
|
@@ -190,8 +182,5 @@ export const Raw = React.forwardRef((props, ref) => {
|
|
|
190
182
|
const categoryService = useService(CategoryServiceDefinition);
|
|
191
183
|
const category = categoryService.category.get();
|
|
192
184
|
const isSelected = categoryService.isSelected.get();
|
|
193
|
-
|
|
194
|
-
return (_jsx(Comp, { ref: ref, className: className || 'sr-only', "data-testid": TestIds.categoryRaw, "data-selected": isSelected ? 'true' : 'false', children: asChild && children
|
|
195
|
-
? renderChildren({ children, props: { category, isSelected }, ref })
|
|
196
|
-
: JSON.stringify(category) }));
|
|
185
|
+
return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className || 'sr-only', "data-testid": TestIds.categoryRaw, "data-selected": isSelected ? 'true' : 'false', customElement: children, customElementProps: { category, isSelected }, children: _jsx("span", { children: JSON.stringify(category) }) }));
|
|
197
186
|
});
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
4
3
|
import * as CoreCategoryList from './core/CategoryList.js';
|
|
5
4
|
import * as Category from './Category.js';
|
|
5
|
+
import { AsChildSlot } from '@wix/headless-utils/react';
|
|
6
6
|
var TestIds;
|
|
7
7
|
(function (TestIds) {
|
|
8
8
|
TestIds["categoryListRoot"] = "category-list";
|
|
@@ -56,8 +56,7 @@ export function Root(props) {
|
|
|
56
56
|
*/
|
|
57
57
|
export const Loading = React.forwardRef((props, ref) => {
|
|
58
58
|
const { asChild, children, className } = props;
|
|
59
|
-
|
|
60
|
-
return (_jsx(CoreCategoryList.Loading, { children: _jsx(Comp, { className: className, ref: ref, children: "Loading..." }) }));
|
|
59
|
+
return (_jsx(CoreCategoryList.Loading, { children: _jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, customElement: children, children: _jsx("h1", { children: "Loading..." }) }) }));
|
|
61
60
|
});
|
|
62
61
|
/**
|
|
63
62
|
* Repeats for each category in the list, providing individual category context.
|
package/dist/react/Product.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { V3Product } from '@wix/auto_sdk_stores_products-v-3';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { type AsChildProps } from '../utils/index.js';
|
|
4
3
|
import { AsContent } from './types.js';
|
|
5
4
|
/**
|
|
6
5
|
* Context for sharing variant options state between components
|
|
@@ -56,9 +55,15 @@ export declare function Root(props: ProductRootProps): React.ReactNode;
|
|
|
56
55
|
/**
|
|
57
56
|
* Props for Product Name component
|
|
58
57
|
*/
|
|
59
|
-
export interface NameProps
|
|
60
|
-
|
|
61
|
-
|
|
58
|
+
export interface NameProps {
|
|
59
|
+
/** Whether to render as a child component */
|
|
60
|
+
asChild?: boolean;
|
|
61
|
+
/** Custom render function when using asChild */
|
|
62
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLElement, {
|
|
63
|
+
name: string;
|
|
64
|
+
}> | React.ForwardRefExoticComponent<any>;
|
|
65
|
+
/** CSS classes to apply to the default element */
|
|
66
|
+
className?: string;
|
|
62
67
|
}
|
|
63
68
|
/**
|
|
64
69
|
* Displays the product name with customizable rendering following the documented API.
|
|
@@ -88,9 +93,15 @@ export declare const Name: React.ForwardRefExoticComponent<NameProps & React.Ref
|
|
|
88
93
|
/**
|
|
89
94
|
* Props for Product Description component
|
|
90
95
|
*/
|
|
91
|
-
export interface DescriptionProps
|
|
92
|
-
|
|
93
|
-
|
|
96
|
+
export interface DescriptionProps {
|
|
97
|
+
/** Whether to render as a child component */
|
|
98
|
+
asChild?: boolean;
|
|
99
|
+
/** Custom render function when using asChild */
|
|
100
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLElement, {
|
|
101
|
+
description: string;
|
|
102
|
+
}> | React.ForwardRefExoticComponent<any>;
|
|
103
|
+
/** CSS classes to apply to the default element */
|
|
104
|
+
className?: string;
|
|
94
105
|
/** Format of the description content */
|
|
95
106
|
as?: `${AsContent}`;
|
|
96
107
|
}
|
|
@@ -121,10 +132,16 @@ export declare const Description: React.ForwardRefExoticComponent<DescriptionPro
|
|
|
121
132
|
/**
|
|
122
133
|
* Props for Product Price component
|
|
123
134
|
*/
|
|
124
|
-
export interface PriceProps
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
135
|
+
export interface PriceProps {
|
|
136
|
+
/** Whether to render as a child component */
|
|
137
|
+
asChild?: boolean;
|
|
138
|
+
/** Custom render function when using asChild */
|
|
139
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLElement, {
|
|
140
|
+
price: string;
|
|
141
|
+
formattedPrice: string;
|
|
142
|
+
}> | React.ForwardRefExoticComponent<any>;
|
|
143
|
+
/** CSS classes to apply to the default element */
|
|
144
|
+
className?: string;
|
|
128
145
|
}
|
|
129
146
|
/**
|
|
130
147
|
* Displays the current product price with customizable rendering following the documented API.
|
|
@@ -154,10 +171,16 @@ export declare const Price: React.ForwardRefExoticComponent<PriceProps & React.R
|
|
|
154
171
|
/**
|
|
155
172
|
* Props for Product CompareAtPrice component
|
|
156
173
|
*/
|
|
157
|
-
export interface CompareAtPriceProps
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
174
|
+
export interface CompareAtPriceProps {
|
|
175
|
+
/** Whether to render as a child component */
|
|
176
|
+
asChild?: boolean;
|
|
177
|
+
/** Custom render function when using asChild */
|
|
178
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLElement, {
|
|
179
|
+
price: string;
|
|
180
|
+
formattedPrice: string;
|
|
181
|
+
}> | React.ForwardRefExoticComponent<any>;
|
|
182
|
+
/** CSS classes to apply to the default element */
|
|
183
|
+
className?: string;
|
|
161
184
|
}
|
|
162
185
|
/**
|
|
163
186
|
* Displays the compare-at (original) price when on sale with customizable rendering following the documented API.
|
|
@@ -192,9 +215,15 @@ export declare const CompareAtPrice: React.ForwardRefExoticComponent<CompareAtPr
|
|
|
192
215
|
* Props for Slug component
|
|
193
216
|
* @interface SlugProps
|
|
194
217
|
*/
|
|
195
|
-
export interface SlugProps
|
|
196
|
-
|
|
197
|
-
|
|
218
|
+
export interface SlugProps {
|
|
219
|
+
/** Whether to render as a child component */
|
|
220
|
+
asChild?: boolean;
|
|
221
|
+
/** Custom render function when using asChild */
|
|
222
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLElement, {
|
|
223
|
+
slug: string;
|
|
224
|
+
}> | React.ForwardRefExoticComponent<any>;
|
|
225
|
+
/** CSS classes to apply to the default element */
|
|
226
|
+
className?: string;
|
|
198
227
|
}
|
|
199
228
|
/**
|
|
200
229
|
* Product Slug component that displays the product's slug
|
|
@@ -222,9 +251,15 @@ export declare const Slug: React.ForwardRefExoticComponent<SlugProps & React.Ref
|
|
|
222
251
|
/**
|
|
223
252
|
* Props for Product Raw component
|
|
224
253
|
*/
|
|
225
|
-
export interface RawProps
|
|
226
|
-
|
|
227
|
-
|
|
254
|
+
export interface RawProps {
|
|
255
|
+
/** Whether to render as a child component */
|
|
256
|
+
asChild?: boolean;
|
|
257
|
+
/** Custom render function when using asChild */
|
|
258
|
+
children?: React.ReactNode | React.ForwardRefRenderFunction<HTMLElement, {
|
|
259
|
+
product: V3Product;
|
|
260
|
+
}> | React.ForwardRefExoticComponent<any>;
|
|
261
|
+
/** CSS classes to apply to the default element */
|
|
262
|
+
className?: string;
|
|
228
263
|
}
|
|
229
264
|
/**
|
|
230
265
|
* Provides access to the raw product data for advanced use cases.
|
|
@@ -249,9 +284,13 @@ export declare const Raw: React.ForwardRefExoticComponent<RawProps & React.RefAt
|
|
|
249
284
|
/**
|
|
250
285
|
* Props for Product Variants container
|
|
251
286
|
*/
|
|
252
|
-
export interface VariantsProps
|
|
253
|
-
|
|
254
|
-
|
|
287
|
+
export interface VariantsProps {
|
|
288
|
+
/** Whether to render as a child component */
|
|
289
|
+
asChild?: boolean;
|
|
290
|
+
/** Custom render function when using asChild */
|
|
291
|
+
children: React.ReactNode;
|
|
292
|
+
/** CSS classes to apply to the default element */
|
|
293
|
+
className?: string;
|
|
255
294
|
}
|
|
256
295
|
/**
|
|
257
296
|
* Container for product variant selection system.
|
|
@@ -331,7 +370,7 @@ export interface VariantOptionsProps {
|
|
|
331
370
|
* </Product.VariantOptions>
|
|
332
371
|
* ```
|
|
333
372
|
*/
|
|
334
|
-
export declare const VariantOptions: React.ForwardRefExoticComponent<VariantOptionsProps & React.RefAttributes<
|
|
373
|
+
export declare const VariantOptions: React.ForwardRefExoticComponent<VariantOptionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
335
374
|
/**
|
|
336
375
|
* Props for Product VariantOptionRepeater component
|
|
337
376
|
*/
|
|
@@ -347,9 +386,13 @@ export declare const VariantOptionRepeater: React.ForwardRefExoticComponent<Vari
|
|
|
347
386
|
/**
|
|
348
387
|
* Props for Product Modifiers container
|
|
349
388
|
*/
|
|
350
|
-
export interface ModifiersProps
|
|
351
|
-
|
|
352
|
-
|
|
389
|
+
export interface ModifiersProps {
|
|
390
|
+
/** Whether to render as a child component */
|
|
391
|
+
asChild?: boolean;
|
|
392
|
+
/** Custom render function when using asChild */
|
|
393
|
+
children: React.ReactNode;
|
|
394
|
+
/** CSS classes to apply to the default element */
|
|
395
|
+
className?: string;
|
|
353
396
|
}
|
|
354
397
|
/**
|
|
355
398
|
* Container for product modifier system.
|
|
@@ -432,7 +475,7 @@ export interface ModifierOptionsProps {
|
|
|
432
475
|
* </Product.ModifierOptions>
|
|
433
476
|
* ```
|
|
434
477
|
*/
|
|
435
|
-
export declare const ModifierOptions: React.ForwardRefExoticComponent<ModifierOptionsProps & React.RefAttributes<
|
|
478
|
+
export declare const ModifierOptions: React.ForwardRefExoticComponent<ModifierOptionsProps & React.RefAttributes<HTMLDivElement>>;
|
|
436
479
|
/**
|
|
437
480
|
* Props for Product ModifierOptionRepeater component
|
|
438
481
|
*/
|
|
@@ -485,7 +528,7 @@ export interface ProductMediaGalleryProps {
|
|
|
485
528
|
* </Product.MediaGallery>
|
|
486
529
|
* ```
|
|
487
530
|
*/
|
|
488
|
-
export declare const ProductMediaGallery: React.ForwardRefExoticComponent<ProductMediaGalleryProps & React.RefAttributes<
|
|
531
|
+
export declare const ProductMediaGallery: React.ForwardRefExoticComponent<ProductMediaGalleryProps & React.RefAttributes<HTMLDivElement>>;
|
|
489
532
|
/**
|
|
490
533
|
* Alias for ProductMediaGallery to match the documented API
|
|
491
534
|
*/
|