@wix/headless-stores 0.0.56 → 0.0.57
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 +3 -32
- package/cjs/dist/react/core/SelectedVariant.js +2 -2
- 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 +3 -32
- package/dist/react/core/SelectedVariant.js +2 -2
- package/dist/utils/renderChildren.d.ts +2 -1
- package/dist/utils/renderChildren.js +5 -2
- package/package.json +4 -3
|
@@ -3,7 +3,7 @@ import { useService, WixServices } from '@wix/services-manager-react';
|
|
|
3
3
|
import { SelectedVariantServiceDefinition, SelectedVariantService, } from '../../services/selected-variant-service.js';
|
|
4
4
|
import { ProductModifiersServiceDefinition } from '../../services/product-modifiers-service.js';
|
|
5
5
|
import { createServicesMap } from '@wix/services-manager';
|
|
6
|
-
import {
|
|
6
|
+
import { CheckoutCore } from '@wix/headless-ecom/react';
|
|
7
7
|
import { CheckoutServiceDefinition, CurrentCartServiceDefinition, } from '@wix/headless-ecom/services';
|
|
8
8
|
/**
|
|
9
9
|
* Root component that provides the SelectedVariant service context to its children.
|
|
@@ -254,7 +254,7 @@ export function Actions(props) {
|
|
|
254
254
|
error,
|
|
255
255
|
};
|
|
256
256
|
if (checkoutService) {
|
|
257
|
-
return (_jsx(
|
|
257
|
+
return (_jsx(CheckoutCore.Trigger, { children: ({ createCheckout, isLoading: checkoutLoading, error: checkoutError, }) => props.children({
|
|
258
258
|
...commonProps,
|
|
259
259
|
isLoading: isLoading || checkoutLoading,
|
|
260
260
|
error: error || checkoutError,
|
|
@@ -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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-stores",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.57",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"scripts": {
|
|
6
6
|
"prebuild": "cd ../media && yarn build && cd ../ecom && yarn build",
|
|
@@ -62,8 +62,9 @@
|
|
|
62
62
|
"@wix/auto_sdk_stores_read-only-variants-v-3": "^1.0.23",
|
|
63
63
|
"@wix/ecom": "^1.0.1278",
|
|
64
64
|
"@wix/essentials": "^0.1.24",
|
|
65
|
-
"@wix/headless-ecom": "
|
|
66
|
-
"@wix/headless-media": "
|
|
65
|
+
"@wix/headless-ecom": "workspace:*",
|
|
66
|
+
"@wix/headless-media": "workspace:*",
|
|
67
|
+
"@wix/headless-utils": "workspace:*",
|
|
67
68
|
"@wix/redirects": "^1.0.83",
|
|
68
69
|
"@wix/services-definitions": "^0.1.4",
|
|
69
70
|
"@wix/services-manager-react": "^0.1.26"
|