@wix/headless-stores 0.0.29 → 0.0.30
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.
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ProductsListServiceConfig } from "../services/products-list-service.js";
|
|
2
2
|
import { productsV3 } from "@wix/stores";
|
|
3
3
|
export interface RootProps {
|
|
4
|
+
/** Child components that will have access to the ProductsList service */
|
|
4
5
|
children: React.ReactNode;
|
|
6
|
+
/** Configuration for the ProductsList service */
|
|
5
7
|
productsListConfig: ProductsListServiceConfig;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
@@ -9,13 +11,10 @@ export interface RootProps {
|
|
|
9
11
|
* This component sets up the necessary services for managing products list state.
|
|
10
12
|
*
|
|
11
13
|
* @component
|
|
12
|
-
* @param props - Component props
|
|
13
|
-
* @param props.children - Child components that will have access to the ProductsList service
|
|
14
|
-
* @param props.productsListConfig - Configuration for the ProductsList service
|
|
15
|
-
* @returns JSX element wrapping children with ProductsList service context
|
|
16
14
|
*/
|
|
17
15
|
export declare function Root(props: RootProps): React.ReactNode;
|
|
18
16
|
export interface EmptyStateProps {
|
|
17
|
+
/** Content to display when products list is empty (can be a render function or ReactNode) */
|
|
19
18
|
children: (props: EmptyStateRenderProps) => React.ReactNode;
|
|
20
19
|
}
|
|
21
20
|
export interface EmptyStateRenderProps {
|
|
@@ -25,12 +24,10 @@ export interface EmptyStateRenderProps {
|
|
|
25
24
|
* Only displays its children when there are no products, no loading state, and no errors.
|
|
26
25
|
*
|
|
27
26
|
* @component
|
|
28
|
-
* @param props - Component props
|
|
29
|
-
* @param props.children - Content to display when products list is empty (can be a render function or ReactNode)
|
|
30
|
-
* @returns JSX element or null based on products list state
|
|
31
27
|
*/
|
|
32
28
|
export declare function EmptyState(props: EmptyStateProps): React.ReactNode;
|
|
33
29
|
export interface LoadingProps {
|
|
30
|
+
/** Content to display during loading (can be a render function or ReactNode) */
|
|
34
31
|
children: (props: LoadingRenderProps) => React.ReactNode;
|
|
35
32
|
}
|
|
36
33
|
export interface LoadingRenderProps {
|
|
@@ -40,15 +37,13 @@ export interface LoadingRenderProps {
|
|
|
40
37
|
* Only displays its children when the products list is currently loading.
|
|
41
38
|
*
|
|
42
39
|
* @component
|
|
43
|
-
* @param props - Component props
|
|
44
|
-
* @param props.children - Content to display during loading (can be a render function or ReactNode)
|
|
45
|
-
* @returns JSX element or null based on loading state
|
|
46
40
|
*/
|
|
47
41
|
export declare function Loading(props: LoadingProps): React.ReactNode;
|
|
48
42
|
export interface ErrorRenderProps {
|
|
49
43
|
error: string | null;
|
|
50
44
|
}
|
|
51
45
|
export interface ErrorProps {
|
|
46
|
+
/** Content to display during error state (can be a render function or ReactNode) */
|
|
52
47
|
children: (props: ErrorRenderProps) => React.ReactNode;
|
|
53
48
|
}
|
|
54
49
|
/**
|
|
@@ -56,15 +51,13 @@ export interface ErrorProps {
|
|
|
56
51
|
* Only displays its children when an error has occurred.
|
|
57
52
|
*
|
|
58
53
|
* @component
|
|
59
|
-
* @param props - Component props
|
|
60
|
-
* @param props.children - Content to display during error state (can be a render function or ReactNode)
|
|
61
|
-
* @returns JSX element or null based on error state
|
|
62
54
|
*/
|
|
63
55
|
export declare function Error(props: ErrorProps): React.ReactNode;
|
|
64
56
|
export interface ItemContentRenderProps {
|
|
65
57
|
product: productsV3.V3Product;
|
|
66
58
|
}
|
|
67
59
|
export interface ItemContentProps {
|
|
60
|
+
/** Content to display for each product (can be a render function receiving product data or ReactNode) */
|
|
68
61
|
children: (props: ItemContentRenderProps) => React.ReactNode;
|
|
69
62
|
}
|
|
70
63
|
/**
|
|
@@ -73,8 +66,5 @@ export interface ItemContentProps {
|
|
|
73
66
|
* Only renders when products are successfully loaded (not loading, no error, and has products).
|
|
74
67
|
*
|
|
75
68
|
* @component
|
|
76
|
-
* @param props - Component props
|
|
77
|
-
* @param props.children - Content to display for each product (can be a render function receiving product data or ReactNode)
|
|
78
|
-
* @returns Array of JSX elements for each product or null if no products to display
|
|
79
69
|
*/
|
|
80
70
|
export declare function ItemContent(props: ItemContentProps): React.ReactNode;
|
|
@@ -8,10 +8,6 @@ import { ProductService, ProductServiceDefinition, } from "@wix/headless-stores/
|
|
|
8
8
|
* This component sets up the necessary services for managing products list state.
|
|
9
9
|
*
|
|
10
10
|
* @component
|
|
11
|
-
* @param props - Component props
|
|
12
|
-
* @param props.children - Child components that will have access to the ProductsList service
|
|
13
|
-
* @param props.productsListConfig - Configuration for the ProductsList service
|
|
14
|
-
* @returns JSX element wrapping children with ProductsList service context
|
|
15
11
|
*/
|
|
16
12
|
export function Root(props) {
|
|
17
13
|
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ProductsListServiceDefinition, ProductListService, props.productsListConfig), children: props.children }));
|
|
@@ -21,9 +17,6 @@ export function Root(props) {
|
|
|
21
17
|
* Only displays its children when there are no products, no loading state, and no errors.
|
|
22
18
|
*
|
|
23
19
|
* @component
|
|
24
|
-
* @param props - Component props
|
|
25
|
-
* @param props.children - Content to display when products list is empty (can be a render function or ReactNode)
|
|
26
|
-
* @returns JSX element or null based on products list state
|
|
27
20
|
*/
|
|
28
21
|
export function EmptyState(props) {
|
|
29
22
|
const { isLoading, error, products } = useService(ProductsListServiceDefinition);
|
|
@@ -42,9 +35,6 @@ export function EmptyState(props) {
|
|
|
42
35
|
* Only displays its children when the products list is currently loading.
|
|
43
36
|
*
|
|
44
37
|
* @component
|
|
45
|
-
* @param props - Component props
|
|
46
|
-
* @param props.children - Content to display during loading (can be a render function or ReactNode)
|
|
47
|
-
* @returns JSX element or null based on loading state
|
|
48
38
|
*/
|
|
49
39
|
export function Loading(props) {
|
|
50
40
|
const { isLoading } = useService(ProductsListServiceDefinition);
|
|
@@ -62,9 +52,6 @@ export function Loading(props) {
|
|
|
62
52
|
* Only displays its children when an error has occurred.
|
|
63
53
|
*
|
|
64
54
|
* @component
|
|
65
|
-
* @param props - Component props
|
|
66
|
-
* @param props.children - Content to display during error state (can be a render function or ReactNode)
|
|
67
|
-
* @returns JSX element or null based on error state
|
|
68
55
|
*/
|
|
69
56
|
export function Error(props) {
|
|
70
57
|
const { error } = useService(ProductsListServiceDefinition);
|
|
@@ -82,9 +69,6 @@ export function Error(props) {
|
|
|
82
69
|
* Only renders when products are successfully loaded (not loading, no error, and has products).
|
|
83
70
|
*
|
|
84
71
|
* @component
|
|
85
|
-
* @param props - Component props
|
|
86
|
-
* @param props.children - Content to display for each product (can be a render function receiving product data or ReactNode)
|
|
87
|
-
* @returns Array of JSX elements for each product or null if no products to display
|
|
88
72
|
*/
|
|
89
73
|
export function ItemContent(props) {
|
|
90
74
|
const { products, isLoading, error } = useService(ProductsListServiceDefinition);
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { type ProductsListServiceConfig } from "../services/products-list-service.js";
|
|
2
2
|
import { productsV3 } from "@wix/stores";
|
|
3
3
|
export interface RootProps {
|
|
4
|
+
/** Child components that will have access to the ProductsList service */
|
|
4
5
|
children: React.ReactNode;
|
|
6
|
+
/** Configuration for the ProductsList service */
|
|
5
7
|
productsListConfig: ProductsListServiceConfig;
|
|
6
8
|
}
|
|
7
9
|
/**
|
|
@@ -9,13 +11,10 @@ export interface RootProps {
|
|
|
9
11
|
* This component sets up the necessary services for managing products list state.
|
|
10
12
|
*
|
|
11
13
|
* @component
|
|
12
|
-
* @param props - Component props
|
|
13
|
-
* @param props.children - Child components that will have access to the ProductsList service
|
|
14
|
-
* @param props.productsListConfig - Configuration for the ProductsList service
|
|
15
|
-
* @returns JSX element wrapping children with ProductsList service context
|
|
16
14
|
*/
|
|
17
15
|
export declare function Root(props: RootProps): React.ReactNode;
|
|
18
16
|
export interface EmptyStateProps {
|
|
17
|
+
/** Content to display when products list is empty (can be a render function or ReactNode) */
|
|
19
18
|
children: (props: EmptyStateRenderProps) => React.ReactNode;
|
|
20
19
|
}
|
|
21
20
|
export interface EmptyStateRenderProps {
|
|
@@ -25,12 +24,10 @@ export interface EmptyStateRenderProps {
|
|
|
25
24
|
* Only displays its children when there are no products, no loading state, and no errors.
|
|
26
25
|
*
|
|
27
26
|
* @component
|
|
28
|
-
* @param props - Component props
|
|
29
|
-
* @param props.children - Content to display when products list is empty (can be a render function or ReactNode)
|
|
30
|
-
* @returns JSX element or null based on products list state
|
|
31
27
|
*/
|
|
32
28
|
export declare function EmptyState(props: EmptyStateProps): React.ReactNode;
|
|
33
29
|
export interface LoadingProps {
|
|
30
|
+
/** Content to display during loading (can be a render function or ReactNode) */
|
|
34
31
|
children: (props: LoadingRenderProps) => React.ReactNode;
|
|
35
32
|
}
|
|
36
33
|
export interface LoadingRenderProps {
|
|
@@ -40,15 +37,13 @@ export interface LoadingRenderProps {
|
|
|
40
37
|
* Only displays its children when the products list is currently loading.
|
|
41
38
|
*
|
|
42
39
|
* @component
|
|
43
|
-
* @param props - Component props
|
|
44
|
-
* @param props.children - Content to display during loading (can be a render function or ReactNode)
|
|
45
|
-
* @returns JSX element or null based on loading state
|
|
46
40
|
*/
|
|
47
41
|
export declare function Loading(props: LoadingProps): React.ReactNode;
|
|
48
42
|
export interface ErrorRenderProps {
|
|
49
43
|
error: string | null;
|
|
50
44
|
}
|
|
51
45
|
export interface ErrorProps {
|
|
46
|
+
/** Content to display during error state (can be a render function or ReactNode) */
|
|
52
47
|
children: (props: ErrorRenderProps) => React.ReactNode;
|
|
53
48
|
}
|
|
54
49
|
/**
|
|
@@ -56,15 +51,13 @@ export interface ErrorProps {
|
|
|
56
51
|
* Only displays its children when an error has occurred.
|
|
57
52
|
*
|
|
58
53
|
* @component
|
|
59
|
-
* @param props - Component props
|
|
60
|
-
* @param props.children - Content to display during error state (can be a render function or ReactNode)
|
|
61
|
-
* @returns JSX element or null based on error state
|
|
62
54
|
*/
|
|
63
55
|
export declare function Error(props: ErrorProps): React.ReactNode;
|
|
64
56
|
export interface ItemContentRenderProps {
|
|
65
57
|
product: productsV3.V3Product;
|
|
66
58
|
}
|
|
67
59
|
export interface ItemContentProps {
|
|
60
|
+
/** Content to display for each product (can be a render function receiving product data or ReactNode) */
|
|
68
61
|
children: (props: ItemContentRenderProps) => React.ReactNode;
|
|
69
62
|
}
|
|
70
63
|
/**
|
|
@@ -73,8 +66,5 @@ export interface ItemContentProps {
|
|
|
73
66
|
* Only renders when products are successfully loaded (not loading, no error, and has products).
|
|
74
67
|
*
|
|
75
68
|
* @component
|
|
76
|
-
* @param props - Component props
|
|
77
|
-
* @param props.children - Content to display for each product (can be a render function receiving product data or ReactNode)
|
|
78
|
-
* @returns Array of JSX elements for each product or null if no products to display
|
|
79
69
|
*/
|
|
80
70
|
export declare function ItemContent(props: ItemContentProps): React.ReactNode;
|
|
@@ -8,10 +8,6 @@ import { ProductService, ProductServiceDefinition, } from "@wix/headless-stores/
|
|
|
8
8
|
* This component sets up the necessary services for managing products list state.
|
|
9
9
|
*
|
|
10
10
|
* @component
|
|
11
|
-
* @param props - Component props
|
|
12
|
-
* @param props.children - Child components that will have access to the ProductsList service
|
|
13
|
-
* @param props.productsListConfig - Configuration for the ProductsList service
|
|
14
|
-
* @returns JSX element wrapping children with ProductsList service context
|
|
15
11
|
*/
|
|
16
12
|
export function Root(props) {
|
|
17
13
|
return (_jsx(WixServices, { servicesMap: createServicesMap().addService(ProductsListServiceDefinition, ProductListService, props.productsListConfig), children: props.children }));
|
|
@@ -21,9 +17,6 @@ export function Root(props) {
|
|
|
21
17
|
* Only displays its children when there are no products, no loading state, and no errors.
|
|
22
18
|
*
|
|
23
19
|
* @component
|
|
24
|
-
* @param props - Component props
|
|
25
|
-
* @param props.children - Content to display when products list is empty (can be a render function or ReactNode)
|
|
26
|
-
* @returns JSX element or null based on products list state
|
|
27
20
|
*/
|
|
28
21
|
export function EmptyState(props) {
|
|
29
22
|
const { isLoading, error, products } = useService(ProductsListServiceDefinition);
|
|
@@ -42,9 +35,6 @@ export function EmptyState(props) {
|
|
|
42
35
|
* Only displays its children when the products list is currently loading.
|
|
43
36
|
*
|
|
44
37
|
* @component
|
|
45
|
-
* @param props - Component props
|
|
46
|
-
* @param props.children - Content to display during loading (can be a render function or ReactNode)
|
|
47
|
-
* @returns JSX element or null based on loading state
|
|
48
38
|
*/
|
|
49
39
|
export function Loading(props) {
|
|
50
40
|
const { isLoading } = useService(ProductsListServiceDefinition);
|
|
@@ -62,9 +52,6 @@ export function Loading(props) {
|
|
|
62
52
|
* Only displays its children when an error has occurred.
|
|
63
53
|
*
|
|
64
54
|
* @component
|
|
65
|
-
* @param props - Component props
|
|
66
|
-
* @param props.children - Content to display during error state (can be a render function or ReactNode)
|
|
67
|
-
* @returns JSX element or null based on error state
|
|
68
55
|
*/
|
|
69
56
|
export function Error(props) {
|
|
70
57
|
const { error } = useService(ProductsListServiceDefinition);
|
|
@@ -82,9 +69,6 @@ export function Error(props) {
|
|
|
82
69
|
* Only renders when products are successfully loaded (not loading, no error, and has products).
|
|
83
70
|
*
|
|
84
71
|
* @component
|
|
85
|
-
* @param props - Component props
|
|
86
|
-
* @param props.children - Content to display for each product (can be a render function receiving product data or ReactNode)
|
|
87
|
-
* @returns Array of JSX elements for each product or null if no products to display
|
|
88
72
|
*/
|
|
89
73
|
export function ItemContent(props) {
|
|
90
74
|
const { products, isLoading, error } = useService(ProductsListServiceDefinition);
|