@wix/headless-restaurants-olo 0.0.44 → 0.0.45
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/ItemDetails.d.ts +1 -0
- package/cjs/dist/react/ItemDetails.js +2 -1
- package/cjs/dist/react/core/ItemDetails.d.ts +1 -0
- package/cjs/dist/react/core/ItemDetails.js +1 -0
- package/cjs/dist/services/item-details-service.js +9 -9
- package/dist/react/ItemDetails.d.ts +1 -0
- package/dist/react/ItemDetails.js +2 -1
- package/dist/react/core/ItemDetails.d.ts +1 -0
- package/dist/react/core/ItemDetails.js +1 -0
- package/dist/services/item-details-service.js +9 -9
- package/package.json +2 -2
|
@@ -132,7 +132,7 @@ Variants.displayName = 'ItemDetails.Variants';
|
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
export const AddToCartButton = React.forwardRef(({ asChild, children, className, addToCartLabelMap, ...props }, ref) => {
|
|
135
|
-
return (_jsx(CoreItemDetails.LineItemComponent, { addToCartLabelMap: addToCartLabelMap, children: ({ onHandleAddToCart, buttonState, addToCartButtonDisabled, loadingState, labelText, formattedPrice, lineItem, }) => {
|
|
135
|
+
return (_jsx(CoreItemDetails.LineItemComponent, { addToCartLabelMap: addToCartLabelMap, children: ({ onHandleAddToCart, buttonState, addToCartButtonDisabled, loadingState, labelText, price, formattedPrice, lineItem, }) => {
|
|
136
136
|
const label = (_jsxs(_Fragment, { children: [_jsx("span", { children: labelText }), " ", _jsx("span", { children: " | " }), _jsx("span", { children: formattedPrice })] }));
|
|
137
137
|
return (_jsx(AsChildSlot, { asChild: asChild, className: className, customElement: children, customElementProps: {
|
|
138
138
|
buttonState,
|
|
@@ -141,6 +141,7 @@ export const AddToCartButton = React.forwardRef(({ asChild, children, className,
|
|
|
141
141
|
onHandleAddToCart,
|
|
142
142
|
label,
|
|
143
143
|
formattedPrice,
|
|
144
|
+
price,
|
|
144
145
|
}, ref: ref, ...props, children: _jsx(Commerce.Actions.AddToCart, { asChild: false, label: label, className: className, lineItems: [lineItem], ...props }) }));
|
|
145
146
|
} }));
|
|
146
147
|
});
|
|
@@ -63,17 +63,17 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
|
|
|
63
63
|
: '');
|
|
64
64
|
const priceVariants = config.item?.priceVariants || [];
|
|
65
65
|
let initialVariant;
|
|
66
|
-
if (
|
|
67
|
-
initialVariant = priceVariants.
|
|
66
|
+
if (config.editItemMode && config.editingItemValues?.selectedVariantId) {
|
|
67
|
+
initialVariant = priceVariants.find((variant) => variant._id === config.editingItemValues?.selectedVariantId);
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
initialVariant =
|
|
71
|
+
priceVariants.length > 0
|
|
72
|
+
? priceVariants.reduce((cheapest, current) => Number(current.priceInfo?.price) <
|
|
73
|
+
Number(cheapest.priceInfo?.price)
|
|
74
|
+
? current
|
|
75
|
+
: cheapest)
|
|
76
|
+
: undefined;
|
|
77
77
|
}
|
|
78
78
|
const selectedVariant = signalsService.signal(initialVariant);
|
|
79
79
|
const modifierGroups = config.item?.modifierGroups || [];
|
|
@@ -132,7 +132,7 @@ Variants.displayName = 'ItemDetails.Variants';
|
|
|
132
132
|
* ```
|
|
133
133
|
*/
|
|
134
134
|
export const AddToCartButton = React.forwardRef(({ asChild, children, className, addToCartLabelMap, ...props }, ref) => {
|
|
135
|
-
return (_jsx(CoreItemDetails.LineItemComponent, { addToCartLabelMap: addToCartLabelMap, children: ({ onHandleAddToCart, buttonState, addToCartButtonDisabled, loadingState, labelText, formattedPrice, lineItem, }) => {
|
|
135
|
+
return (_jsx(CoreItemDetails.LineItemComponent, { addToCartLabelMap: addToCartLabelMap, children: ({ onHandleAddToCart, buttonState, addToCartButtonDisabled, loadingState, labelText, price, formattedPrice, lineItem, }) => {
|
|
136
136
|
const label = (_jsxs(_Fragment, { children: [_jsx("span", { children: labelText }), " ", _jsx("span", { children: " | " }), _jsx("span", { children: formattedPrice })] }));
|
|
137
137
|
return (_jsx(AsChildSlot, { asChild: asChild, className: className, customElement: children, customElementProps: {
|
|
138
138
|
buttonState,
|
|
@@ -141,6 +141,7 @@ export const AddToCartButton = React.forwardRef(({ asChild, children, className,
|
|
|
141
141
|
onHandleAddToCart,
|
|
142
142
|
label,
|
|
143
143
|
formattedPrice,
|
|
144
|
+
price,
|
|
144
145
|
}, ref: ref, ...props, children: _jsx(Commerce.Actions.AddToCart, { asChild: false, label: label, className: className, lineItems: [lineItem], ...props }) }));
|
|
145
146
|
} }));
|
|
146
147
|
});
|
|
@@ -63,17 +63,17 @@ export const ItemService = implementService.withConfig()(ItemServiceDefinition,
|
|
|
63
63
|
: '');
|
|
64
64
|
const priceVariants = config.item?.priceVariants || [];
|
|
65
65
|
let initialVariant;
|
|
66
|
-
if (
|
|
67
|
-
initialVariant = priceVariants.
|
|
66
|
+
if (config.editItemMode && config.editingItemValues?.selectedVariantId) {
|
|
67
|
+
initialVariant = priceVariants.find((variant) => variant._id === config.editingItemValues?.selectedVariantId);
|
|
68
68
|
}
|
|
69
69
|
else {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
70
|
+
initialVariant =
|
|
71
|
+
priceVariants.length > 0
|
|
72
|
+
? priceVariants.reduce((cheapest, current) => Number(current.priceInfo?.price) <
|
|
73
|
+
Number(cheapest.priceInfo?.price)
|
|
74
|
+
? current
|
|
75
|
+
: cheapest)
|
|
76
|
+
: undefined;
|
|
77
77
|
}
|
|
78
78
|
const selectedVariant = signalsService.signal(initialVariant);
|
|
79
79
|
const modifierGroups = config.item?.modifierGroups || [];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wix/headless-restaurants-olo",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.45",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"scripts": {
|
|
@@ -78,5 +78,5 @@
|
|
|
78
78
|
"groupId": "com.wixpress.headless-components"
|
|
79
79
|
}
|
|
80
80
|
},
|
|
81
|
-
"falconPackageHash": "
|
|
81
|
+
"falconPackageHash": "fc2b5a7894052822fdee845ca019b9b8bb662c3414177a0262d70454"
|
|
82
82
|
}
|