@wix/headless-stores 0.0.77 → 0.0.78

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 (39) hide show
  1. package/cjs/dist/react/Category.d.ts +4 -8
  2. package/cjs/dist/react/Category.js +35 -29
  3. package/cjs/dist/react/CategoryList.d.ts +3 -2
  4. package/cjs/dist/react/CategoryList.js +4 -3
  5. package/cjs/dist/react/ProductList.d.ts +1 -1
  6. package/cjs/dist/react/ProductList.js +1 -1
  7. package/cjs/dist/react/core/CategoryList.d.ts +11 -5
  8. package/cjs/dist/react/core/CategoryList.js +9 -4
  9. package/cjs/dist/react/core/ProductListFilters.d.ts +1 -1
  10. package/cjs/dist/react/index.d.ts +0 -1
  11. package/cjs/dist/react/index.js +0 -1
  12. package/cjs/dist/services/categories-list-service.d.ts +2 -1
  13. package/cjs/dist/services/index.d.ts +0 -1
  14. package/cjs/dist/services/index.js +0 -1
  15. package/cjs/dist/services/products-list-service.d.ts +2 -1
  16. package/dist/react/Category.d.ts +4 -8
  17. package/dist/react/Category.js +35 -29
  18. package/dist/react/CategoryList.d.ts +3 -2
  19. package/dist/react/CategoryList.js +4 -3
  20. package/dist/react/ProductList.d.ts +1 -1
  21. package/dist/react/ProductList.js +1 -1
  22. package/dist/react/core/CategoryList.d.ts +11 -5
  23. package/dist/react/core/CategoryList.js +9 -4
  24. package/dist/react/core/ProductListFilters.d.ts +1 -1
  25. package/dist/react/index.d.ts +0 -1
  26. package/dist/react/index.js +0 -1
  27. package/dist/services/categories-list-service.d.ts +2 -1
  28. package/dist/services/index.d.ts +0 -1
  29. package/dist/services/index.js +0 -1
  30. package/dist/services/products-list-service.d.ts +2 -1
  31. package/package.json +1 -1
  32. package/cjs/dist/react/core/Category.d.ts +0 -98
  33. package/cjs/dist/react/core/Category.js +0 -81
  34. package/cjs/dist/services/category-service.d.ts +0 -161
  35. package/cjs/dist/services/category-service.js +0 -149
  36. package/dist/react/core/Category.d.ts +0 -98
  37. package/dist/react/core/Category.js +0 -81
  38. package/dist/services/category-service.d.ts +0 -161
  39. package/dist/services/category-service.js +0 -149
@@ -1,17 +1,13 @@
1
1
  import React from 'react';
2
- import { type Category } from '../services/category-service.js';
3
- import { type CategoryServiceConfig } from '../services/category-service.js';
2
+ import { categories } from '@wix/categories';
4
3
  import { AsChildChildren } from '@wix/headless-utils/react';
4
+ export type Category = categories.Category;
5
5
  /**
6
6
  * Props for Category.Root component
7
7
  */
8
8
  export interface CategoryRootProps {
9
- /** Category object to initialize the service with */
10
- category?: Category;
11
- /** Configuration for the category service */
12
- categoryServiceConfig?: CategoryServiceConfig;
13
- /** Whether the category is currently selected */
14
- isSelected?: boolean;
9
+ /** Category data */
10
+ category: Category;
15
11
  /** Child components */
16
12
  children: React.ReactNode;
17
13
  }
@@ -1,9 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import * as CoreCategory from './core/Category.js';
4
- import { CategoryServiceDefinition, } from '../services/category-service.js';
5
- import { useService } from '@wix/services-manager-react';
6
3
  import { AsChildSlot } from '@wix/headless-utils/react';
4
+ import { CategoryFilter, } from './core/ProductListFilters.js';
5
+ const CategoryContext = React.createContext(null);
6
+ function useCategoryContext() {
7
+ const context = React.useContext(CategoryContext);
8
+ if (!context) {
9
+ throw new Error('useCategoryContext must be used within a Category.Root component');
10
+ }
11
+ return context;
12
+ }
7
13
  var TestIds;
8
14
  (function (TestIds) {
9
15
  TestIds["categoryItem"] = "category-item";
@@ -31,15 +37,18 @@ var TestIds;
31
37
  * ```
32
38
  */
33
39
  export function Root(props) {
34
- const { category, categoryServiceConfig, isSelected, children } = props;
35
- if (!category && !categoryServiceConfig) {
36
- throw new Error('Category.Root: category or categoryServiceConfig is required');
37
- }
38
- const serviceConfig = categoryServiceConfig || {
39
- category: category,
40
- isSelected,
41
- };
42
- return (_jsx(CoreCategory.Root, { categoryServiceConfig: serviceConfig, children: children }));
40
+ const { category, children } = props;
41
+ return (_jsx(CategoryFilter, { children: ({ selectedCategory, setSelectedCategory }) => {
42
+ // Determine if this category is selected by comparing with selectedCategory
43
+ const isSelected = selectedCategory?._id === category._id;
44
+ const contextValue = {
45
+ category,
46
+ isSelected,
47
+ selectedCategory,
48
+ setSelectedCategory,
49
+ };
50
+ return (_jsx(CategoryContext.Provider, { value: contextValue, children: children }));
51
+ } }));
43
52
  }
44
53
  /**
45
54
  * Interactive element for selecting or triggering category actions.
@@ -72,11 +81,17 @@ export function Root(props) {
72
81
  */
73
82
  export const Trigger = React.forwardRef((props, ref) => {
74
83
  const { asChild, children, onSelect, className } = props;
75
- const categoryService = useService(CategoryServiceDefinition);
76
- const category = categoryService.category.get();
77
- const isSelected = categoryService.isSelected.get();
78
- const setIsSelected = (isSelected) => categoryService.isSelected.set(isSelected);
84
+ const { category, isSelected, setSelectedCategory } = useCategoryContext();
79
85
  const handleSelect = () => {
86
+ // Use CategoryFilter's setSelectedCategory function
87
+ if (isSelected) {
88
+ // Deselect by passing null
89
+ setSelectedCategory(null);
90
+ }
91
+ else {
92
+ // Select this category
93
+ setSelectedCategory(category);
94
+ }
80
95
  if (onSelect) {
81
96
  onSelect(category);
82
97
  }
@@ -85,7 +100,6 @@ export const Trigger = React.forwardRef((props, ref) => {
85
100
  category,
86
101
  isSelected,
87
102
  onSelect: handleSelect,
88
- setIsSelected,
89
103
  }, content: category.name, children: _jsx("button", { children: category.name }) }));
90
104
  });
91
105
  /**
@@ -115,12 +129,8 @@ export const Trigger = React.forwardRef((props, ref) => {
115
129
  */
116
130
  export const Label = React.forwardRef((props, ref) => {
117
131
  const { asChild, children, className } = props;
118
- const categoryService = useService(CategoryServiceDefinition);
119
- const category = categoryService.category.get();
120
- const isSelected = categoryService.isSelected.get();
121
- return (_jsx(CoreCategory.Name, { children: ({ 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 }) }));
123
- } }));
132
+ const { category, isSelected } = useCategoryContext();
133
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.categoryLabel, "data-selected": isSelected ? 'true' : 'false', customElement: children, customElementProps: { name: category.name, category }, content: category.name, children: _jsx("span", { children: category.name }) }));
124
134
  });
125
135
  /**
126
136
  * Provides access to the category ID for advanced use cases.
@@ -149,9 +159,7 @@ export const Label = React.forwardRef((props, ref) => {
149
159
  */
150
160
  export const ID = React.forwardRef((props, ref) => {
151
161
  const { asChild, children, className } = props;
152
- const categoryService = useService(CategoryServiceDefinition);
153
- const category = categoryService.category.get();
154
- const isSelected = categoryService.isSelected.get();
162
+ const { category, isSelected } = useCategoryContext();
155
163
  const id = category._id || '';
156
164
  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 }) }));
157
165
  });
@@ -179,8 +187,6 @@ export const ID = React.forwardRef((props, ref) => {
179
187
  */
180
188
  export const Raw = React.forwardRef((props, ref) => {
181
189
  const { asChild, children, className } = props;
182
- const categoryService = useService(CategoryServiceDefinition);
183
- const category = categoryService.category.get();
184
- const isSelected = categoryService.isSelected.get();
190
+ const { category, isSelected } = useCategoryContext();
185
191
  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) }) }));
186
192
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type Category as CategoryType } from '../services/category-service.js';
2
+ import { type Category as CategoryType } from './Category.js';
3
3
  import { type CategoriesListServiceConfig } from '../services/categories-list-service.js';
4
4
  /**
5
5
  * Props for CategoryList.Root component
@@ -41,6 +41,7 @@ export interface CategoryListCategoryRepeaterProps {
41
41
  /**
42
42
  * Root container that provides category list context to all child components.
43
43
  * This component sets up the necessary services for managing categories list state.
44
+ * Automatically connects to ProductList filtering when available.
44
45
  *
45
46
  * @order 1
46
47
  * @component
@@ -100,4 +101,4 @@ export declare const Loading: React.ForwardRefExoticComponent<CategoryListLoadin
100
101
  * }
101
102
  * ```
102
103
  */
103
- export declare const CategoryRepeater: React.ForwardRefExoticComponent<CategoryListCategoryRepeaterProps & React.RefAttributes<HTMLDivElement>>;
104
+ export declare function CategoryRepeater(props: CategoryListCategoryRepeaterProps): import("react/jsx-runtime").JSX.Element;
@@ -11,6 +11,7 @@ var TestIds;
11
11
  /**
12
12
  * Root container that provides category list context to all child components.
13
13
  * This component sets up the necessary services for managing categories list state.
14
+ * Automatically connects to ProductList filtering when available.
14
15
  *
15
16
  * @order 1
16
17
  * @component
@@ -78,11 +79,11 @@ export const Loading = React.forwardRef((props, ref) => {
78
79
  * }
79
80
  * ```
80
81
  */
81
- export const CategoryRepeater = React.forwardRef((props) => {
82
+ export function CategoryRepeater(props) {
82
83
  // const { children, asChild = false, className } = props;
83
84
  const { children } = props;
84
85
  // Note: maxDepth is not implemented yet as it depends on category hierarchy structure
85
86
  return (_jsx(CoreCategoryList.ItemContent, { children: ({ category }) => {
86
- return (_jsx(Category.Root, { categoryServiceConfig: { category }, children: children }, category._id));
87
+ return (_jsx(Category.Root, { category: category, children: children }, category._id));
87
88
  } }));
88
- });
89
+ }
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import type { ProductsListServiceConfig } from '../services/products-list-service.js';
5
5
  import { productsV3 } from '@wix/stores';
6
6
  import { AsChildChildren } from '@wix/headless-utils/react';
7
- export { Filter, CategoryFilter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
7
+ export { Filter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
8
8
  /**
9
9
  * Props for the ProductList root component following the documented API
10
10
  */
@@ -8,7 +8,7 @@ import * as CoreProductListPagination from './core/ProductListPagination.js';
8
8
  import { ProductListSort as ProductListSortPrimitive } from './core/ProductListSort.js';
9
9
  import * as Product from './Product.js';
10
10
  import { AsChildSlot } from '@wix/headless-utils/react';
11
- export { Filter, CategoryFilter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
11
+ export { Filter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
12
12
  var TestIds;
13
13
  (function (TestIds) {
14
14
  TestIds["productListRoot"] = "product-list-root";
@@ -1,5 +1,7 @@
1
+ import React from 'react';
1
2
  import { type CategoriesListServiceConfig } from '../../services/categories-list-service.js';
2
- import { type Category } from '../../services/category-service.js';
3
+ import { categories } from '@wix/categories';
4
+ export type Category = categories.Category;
3
5
  export interface RootProps {
4
6
  children: React.ReactNode;
5
7
  categoriesListConfig: CategoriesListServiceConfig;
@@ -7,6 +9,7 @@ export interface RootProps {
7
9
  /**
8
10
  * Root component that provides the CategoryList service context to its children.
9
11
  * This component sets up the necessary services for managing categories list state.
12
+ * Optionally connects to ProductList filtering when connectToProductFilter is enabled.
10
13
  *
11
14
  * @order 1
12
15
  * @component
@@ -16,7 +19,10 @@ export interface RootProps {
16
19
  *
17
20
  * function CategoriesPage() {
18
21
  * return (
19
- * <CategoryList.Root categoriesListConfig={{ collectionId: 'my-collection' }}>
22
+ * <CategoryList.Root
23
+ * categoriesListConfig={{ categories: myCategories }}
24
+ * connectToProductFilter={true}
25
+ * >
20
26
  * <CategoryList.ItemContent>
21
27
  * {({ category }) => (
22
28
  * <div key={category._id}>
@@ -65,7 +71,7 @@ export interface EmptyStateRenderProps {
65
71
  * }
66
72
  * ```
67
73
  */
68
- export declare function EmptyState(props: EmptyStateProps): import("react").ReactNode;
74
+ export declare function EmptyState(props: EmptyStateProps): React.ReactNode;
69
75
  /**
70
76
  * Props for Loading headless component
71
77
  */
@@ -101,7 +107,7 @@ export interface LoadingRenderProps {
101
107
  * }
102
108
  * ```
103
109
  */
104
- export declare function Loading(props: LoadingProps): import("react").ReactNode;
110
+ export declare function Loading(props: LoadingProps): React.ReactNode;
105
111
  /**
106
112
  * Props for Error headless component
107
113
  */
@@ -142,7 +148,7 @@ export interface ErrorRenderProps {
142
148
  * }
143
149
  * ```
144
150
  */
145
- export declare function Error(props: ErrorProps): import("react").ReactNode;
151
+ export declare function Error(props: ErrorProps): React.ReactNode;
146
152
  /**
147
153
  * Props for ItemContent headless component
148
154
  */
@@ -1,11 +1,12 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
+ import React from 'react';
2
3
  import { useService, WixServices } from '@wix/services-manager-react';
3
4
  import { createServicesMap } from '@wix/services-manager';
4
5
  import { CategoriesListService, CategoriesListServiceDefinition, } from '../../services/categories-list-service.js';
5
- import { Root as CategoryRoot } from './Category.js';
6
6
  /**
7
7
  * Root component that provides the CategoryList service context to its children.
8
8
  * This component sets up the necessary services for managing categories list state.
9
+ * Optionally connects to ProductList filtering when connectToProductFilter is enabled.
9
10
  *
10
11
  * @order 1
11
12
  * @component
@@ -15,7 +16,10 @@ import { Root as CategoryRoot } from './Category.js';
15
16
  *
16
17
  * function CategoriesPage() {
17
18
  * return (
18
- * <CategoryList.Root categoriesListConfig={{ collectionId: 'my-collection' }}>
19
+ * <CategoryList.Root
20
+ * categoriesListConfig={{ categories: myCategories }}
21
+ * connectToProductFilter={true}
22
+ * >
19
23
  * <CategoryList.ItemContent>
20
24
  * {({ category }) => (
21
25
  * <div key={category._id}>
@@ -29,7 +33,8 @@ import { Root as CategoryRoot } from './Category.js';
29
33
  * ```
30
34
  */
31
35
  export function Root(props) {
32
- return (_jsx(WixServices, { servicesMap: createServicesMap().addService(CategoriesListServiceDefinition, CategoriesListService, props.categoriesListConfig), children: props.children }));
36
+ const { categoriesListConfig, children } = props;
37
+ return (_jsx(WixServices, { servicesMap: createServicesMap().addService(CategoriesListServiceDefinition, CategoriesListService, categoriesListConfig), children: children }));
33
38
  }
34
39
  /**
35
40
  * Component that renders content when the categories list is empty.
@@ -166,7 +171,7 @@ export function ItemContent(props) {
166
171
  if (isLoading.get() || error.get() || categoriesValue.length === 0) {
167
172
  return null;
168
173
  }
169
- return categoriesValue.map((category) => (_jsx(CategoryRoot, { categoryServiceConfig: { category }, children: typeof props.children === 'function'
174
+ return categoriesValue.map((category) => (_jsx(React.Fragment, { children: typeof props.children === 'function'
170
175
  ? props.children({
171
176
  category,
172
177
  })
@@ -50,7 +50,7 @@ export interface ResetTriggerRenderProps {
50
50
  export declare function ResetTrigger(props: ResetTriggerProps): ReactNode;
51
51
  export interface CategoryFilterRenderProps {
52
52
  selectedCategory: Category | null;
53
- setSelectedCategory: (category: Category) => void;
53
+ setSelectedCategory: (category: Category | null) => void;
54
54
  }
55
55
  export interface CategoryFilterProps {
56
56
  /** Content to display (can be a render function receiving category data or ReactNode) */
@@ -1,5 +1,4 @@
1
1
  export * as CategoryListCore from './core/CategoryList.js';
2
- export * as CategoryCore from './core/Category.js';
3
2
  export * as ProductCore from './core/Product.js';
4
3
  export * as ProductModifiers from './core/ProductModifiers.js';
5
4
  export * as ProductListCore from './core/ProductList.js';
@@ -1,5 +1,4 @@
1
1
  export * as CategoryListCore from './core/CategoryList.js';
2
- export * as CategoryCore from './core/Category.js';
3
2
  export * as ProductCore from './core/Product.js';
4
3
  export * as ProductModifiers from './core/ProductModifiers.js';
5
4
  export * as ProductListCore from './core/ProductList.js';
@@ -1,5 +1,6 @@
1
1
  import { type Signal } from '@wix/services-definitions/core-services/signals';
2
- import { type Category } from './category-service.js';
2
+ import { categories } from '@wix/categories';
3
+ export type Category = categories.Category;
3
4
  /**
4
5
  * Configuration interface for the Categories List service.
5
6
  * Contains the initial categories data that will be loaded into the service.
@@ -1,4 +1,3 @@
1
- export { CategoryService, CategoryServiceDefinition, loadCategoryServiceConfig, CategoryServiceConfig, Category, } from './category-service.js';
2
1
  export { CategoriesListService, CategoriesListServiceDefinition, loadCategoriesListServiceConfig, CategoriesListServiceConfig, } from './categories-list-service.js';
3
2
  export { ProductModifiersService, ProductModifiersServiceDefinition, } from './product-modifiers-service.js';
4
3
  export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from './product-service.js';
@@ -1,4 +1,3 @@
1
- export { CategoryService, CategoryServiceDefinition, loadCategoryServiceConfig, } from './category-service.js';
2
1
  export { CategoriesListService, CategoriesListServiceDefinition, loadCategoriesListServiceConfig, } from './categories-list-service.js';
3
2
  export { ProductModifiersService, ProductModifiersServiceDefinition, } from './product-modifiers-service.js';
4
3
  export { ProductService, ProductServiceDefinition, loadProductServiceConfig, } from './product-service.js';
@@ -1,6 +1,7 @@
1
1
  import { type Signal, type ReadOnlySignal } from '@wix/services-definitions/core-services/signals';
2
2
  import { customizationsV3, productsV3 } from '@wix/stores';
3
- import { type Category } from './category-service.js';
3
+ import { categories } from '@wix/categories';
4
+ type Category = categories.Category;
4
5
  export declare const DEFAULT_QUERY_LIMIT = 100;
5
6
  import { SortType } from './../enums/sort-enums.js';
6
7
  export { SortType } from './../enums/sort-enums.js';
@@ -1,17 +1,13 @@
1
1
  import React from 'react';
2
- import { type Category } from '../services/category-service.js';
3
- import { type CategoryServiceConfig } from '../services/category-service.js';
2
+ import { categories } from '@wix/categories';
4
3
  import { AsChildChildren } from '@wix/headless-utils/react';
4
+ export type Category = categories.Category;
5
5
  /**
6
6
  * Props for Category.Root component
7
7
  */
8
8
  export interface CategoryRootProps {
9
- /** Category object to initialize the service with */
10
- category?: Category;
11
- /** Configuration for the category service */
12
- categoryServiceConfig?: CategoryServiceConfig;
13
- /** Whether the category is currently selected */
14
- isSelected?: boolean;
9
+ /** Category data */
10
+ category: Category;
15
11
  /** Child components */
16
12
  children: React.ReactNode;
17
13
  }
@@ -1,9 +1,15 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
2
  import React from 'react';
3
- import * as CoreCategory from './core/Category.js';
4
- import { CategoryServiceDefinition, } from '../services/category-service.js';
5
- import { useService } from '@wix/services-manager-react';
6
3
  import { AsChildSlot } from '@wix/headless-utils/react';
4
+ import { CategoryFilter, } from './core/ProductListFilters.js';
5
+ const CategoryContext = React.createContext(null);
6
+ function useCategoryContext() {
7
+ const context = React.useContext(CategoryContext);
8
+ if (!context) {
9
+ throw new Error('useCategoryContext must be used within a Category.Root component');
10
+ }
11
+ return context;
12
+ }
7
13
  var TestIds;
8
14
  (function (TestIds) {
9
15
  TestIds["categoryItem"] = "category-item";
@@ -31,15 +37,18 @@ var TestIds;
31
37
  * ```
32
38
  */
33
39
  export function Root(props) {
34
- const { category, categoryServiceConfig, isSelected, children } = props;
35
- if (!category && !categoryServiceConfig) {
36
- throw new Error('Category.Root: category or categoryServiceConfig is required');
37
- }
38
- const serviceConfig = categoryServiceConfig || {
39
- category: category,
40
- isSelected,
41
- };
42
- return (_jsx(CoreCategory.Root, { categoryServiceConfig: serviceConfig, children: children }));
40
+ const { category, children } = props;
41
+ return (_jsx(CategoryFilter, { children: ({ selectedCategory, setSelectedCategory }) => {
42
+ // Determine if this category is selected by comparing with selectedCategory
43
+ const isSelected = selectedCategory?._id === category._id;
44
+ const contextValue = {
45
+ category,
46
+ isSelected,
47
+ selectedCategory,
48
+ setSelectedCategory,
49
+ };
50
+ return (_jsx(CategoryContext.Provider, { value: contextValue, children: children }));
51
+ } }));
43
52
  }
44
53
  /**
45
54
  * Interactive element for selecting or triggering category actions.
@@ -72,11 +81,17 @@ export function Root(props) {
72
81
  */
73
82
  export const Trigger = React.forwardRef((props, ref) => {
74
83
  const { asChild, children, onSelect, className } = props;
75
- const categoryService = useService(CategoryServiceDefinition);
76
- const category = categoryService.category.get();
77
- const isSelected = categoryService.isSelected.get();
78
- const setIsSelected = (isSelected) => categoryService.isSelected.set(isSelected);
84
+ const { category, isSelected, setSelectedCategory } = useCategoryContext();
79
85
  const handleSelect = () => {
86
+ // Use CategoryFilter's setSelectedCategory function
87
+ if (isSelected) {
88
+ // Deselect by passing null
89
+ setSelectedCategory(null);
90
+ }
91
+ else {
92
+ // Select this category
93
+ setSelectedCategory(category);
94
+ }
80
95
  if (onSelect) {
81
96
  onSelect(category);
82
97
  }
@@ -85,7 +100,6 @@ export const Trigger = React.forwardRef((props, ref) => {
85
100
  category,
86
101
  isSelected,
87
102
  onSelect: handleSelect,
88
- setIsSelected,
89
103
  }, content: category.name, children: _jsx("button", { children: category.name }) }));
90
104
  });
91
105
  /**
@@ -115,12 +129,8 @@ export const Trigger = React.forwardRef((props, ref) => {
115
129
  */
116
130
  export const Label = React.forwardRef((props, ref) => {
117
131
  const { asChild, children, className } = props;
118
- const categoryService = useService(CategoryServiceDefinition);
119
- const category = categoryService.category.get();
120
- const isSelected = categoryService.isSelected.get();
121
- return (_jsx(CoreCategory.Name, { children: ({ 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 }) }));
123
- } }));
132
+ const { category, isSelected } = useCategoryContext();
133
+ return (_jsx(AsChildSlot, { ref: ref, asChild: asChild, className: className, "data-testid": TestIds.categoryLabel, "data-selected": isSelected ? 'true' : 'false', customElement: children, customElementProps: { name: category.name, category }, content: category.name, children: _jsx("span", { children: category.name }) }));
124
134
  });
125
135
  /**
126
136
  * Provides access to the category ID for advanced use cases.
@@ -149,9 +159,7 @@ export const Label = React.forwardRef((props, ref) => {
149
159
  */
150
160
  export const ID = React.forwardRef((props, ref) => {
151
161
  const { asChild, children, className } = props;
152
- const categoryService = useService(CategoryServiceDefinition);
153
- const category = categoryService.category.get();
154
- const isSelected = categoryService.isSelected.get();
162
+ const { category, isSelected } = useCategoryContext();
155
163
  const id = category._id || '';
156
164
  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 }) }));
157
165
  });
@@ -179,8 +187,6 @@ export const ID = React.forwardRef((props, ref) => {
179
187
  */
180
188
  export const Raw = React.forwardRef((props, ref) => {
181
189
  const { asChild, children, className } = props;
182
- const categoryService = useService(CategoryServiceDefinition);
183
- const category = categoryService.category.get();
184
- const isSelected = categoryService.isSelected.get();
190
+ const { category, isSelected } = useCategoryContext();
185
191
  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) }) }));
186
192
  });
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { type Category as CategoryType } from '../services/category-service.js';
2
+ import { type Category as CategoryType } from './Category.js';
3
3
  import { type CategoriesListServiceConfig } from '../services/categories-list-service.js';
4
4
  /**
5
5
  * Props for CategoryList.Root component
@@ -41,6 +41,7 @@ export interface CategoryListCategoryRepeaterProps {
41
41
  /**
42
42
  * Root container that provides category list context to all child components.
43
43
  * This component sets up the necessary services for managing categories list state.
44
+ * Automatically connects to ProductList filtering when available.
44
45
  *
45
46
  * @order 1
46
47
  * @component
@@ -100,4 +101,4 @@ export declare const Loading: React.ForwardRefExoticComponent<CategoryListLoadin
100
101
  * }
101
102
  * ```
102
103
  */
103
- export declare const CategoryRepeater: React.ForwardRefExoticComponent<CategoryListCategoryRepeaterProps & React.RefAttributes<HTMLDivElement>>;
104
+ export declare function CategoryRepeater(props: CategoryListCategoryRepeaterProps): import("react/jsx-runtime").JSX.Element;
@@ -11,6 +11,7 @@ var TestIds;
11
11
  /**
12
12
  * Root container that provides category list context to all child components.
13
13
  * This component sets up the necessary services for managing categories list state.
14
+ * Automatically connects to ProductList filtering when available.
14
15
  *
15
16
  * @order 1
16
17
  * @component
@@ -78,11 +79,11 @@ export const Loading = React.forwardRef((props, ref) => {
78
79
  * }
79
80
  * ```
80
81
  */
81
- export const CategoryRepeater = React.forwardRef((props) => {
82
+ export function CategoryRepeater(props) {
82
83
  // const { children, asChild = false, className } = props;
83
84
  const { children } = props;
84
85
  // Note: maxDepth is not implemented yet as it depends on category hierarchy structure
85
86
  return (_jsx(CoreCategoryList.ItemContent, { children: ({ category }) => {
86
- return (_jsx(Category.Root, { categoryServiceConfig: { category }, children: children }, category._id));
87
+ return (_jsx(Category.Root, { category: category, children: children }, category._id));
87
88
  } }));
88
- });
89
+ }
@@ -4,7 +4,7 @@ import React from 'react';
4
4
  import type { ProductsListServiceConfig } from '../services/products-list-service.js';
5
5
  import { productsV3 } from '@wix/stores';
6
6
  import { AsChildChildren } from '@wix/headless-utils/react';
7
- export { Filter, CategoryFilter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
7
+ export { Filter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
8
8
  /**
9
9
  * Props for the ProductList root component following the documented API
10
10
  */
@@ -8,7 +8,7 @@ import * as CoreProductListPagination from './core/ProductListPagination.js';
8
8
  import { ProductListSort as ProductListSortPrimitive } from './core/ProductListSort.js';
9
9
  import * as Product from './Product.js';
10
10
  import { AsChildSlot } from '@wix/headless-utils/react';
11
- export { Filter, CategoryFilter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
11
+ export { Filter, ResetTrigger as FilterResetTrigger, } from './core/ProductListFilters.js';
12
12
  var TestIds;
13
13
  (function (TestIds) {
14
14
  TestIds["productListRoot"] = "product-list-root";
@@ -1,5 +1,7 @@
1
+ import React from 'react';
1
2
  import { type CategoriesListServiceConfig } from '../../services/categories-list-service.js';
2
- import { type Category } from '../../services/category-service.js';
3
+ import { categories } from '@wix/categories';
4
+ export type Category = categories.Category;
3
5
  export interface RootProps {
4
6
  children: React.ReactNode;
5
7
  categoriesListConfig: CategoriesListServiceConfig;
@@ -7,6 +9,7 @@ export interface RootProps {
7
9
  /**
8
10
  * Root component that provides the CategoryList service context to its children.
9
11
  * This component sets up the necessary services for managing categories list state.
12
+ * Optionally connects to ProductList filtering when connectToProductFilter is enabled.
10
13
  *
11
14
  * @order 1
12
15
  * @component
@@ -16,7 +19,10 @@ export interface RootProps {
16
19
  *
17
20
  * function CategoriesPage() {
18
21
  * return (
19
- * <CategoryList.Root categoriesListConfig={{ collectionId: 'my-collection' }}>
22
+ * <CategoryList.Root
23
+ * categoriesListConfig={{ categories: myCategories }}
24
+ * connectToProductFilter={true}
25
+ * >
20
26
  * <CategoryList.ItemContent>
21
27
  * {({ category }) => (
22
28
  * <div key={category._id}>
@@ -65,7 +71,7 @@ export interface EmptyStateRenderProps {
65
71
  * }
66
72
  * ```
67
73
  */
68
- export declare function EmptyState(props: EmptyStateProps): import("react").ReactNode;
74
+ export declare function EmptyState(props: EmptyStateProps): React.ReactNode;
69
75
  /**
70
76
  * Props for Loading headless component
71
77
  */
@@ -101,7 +107,7 @@ export interface LoadingRenderProps {
101
107
  * }
102
108
  * ```
103
109
  */
104
- export declare function Loading(props: LoadingProps): import("react").ReactNode;
110
+ export declare function Loading(props: LoadingProps): React.ReactNode;
105
111
  /**
106
112
  * Props for Error headless component
107
113
  */
@@ -142,7 +148,7 @@ export interface ErrorRenderProps {
142
148
  * }
143
149
  * ```
144
150
  */
145
- export declare function Error(props: ErrorProps): import("react").ReactNode;
151
+ export declare function Error(props: ErrorProps): React.ReactNode;
146
152
  /**
147
153
  * Props for ItemContent headless component
148
154
  */