@gem-sdk/components 2.1.27-staging.10 → 2.1.27-staging.12
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.
|
@@ -260,7 +260,7 @@ const ProductList = ({ setting, builderProps, styles, className, children, advan
|
|
|
260
260
|
endunless
|
|
261
261
|
endfor
|
|
262
262
|
endfor
|
|
263
|
-
assign products =
|
|
263
|
+
assign products = relatedListProduct | uniq
|
|
264
264
|
when 'vendor'
|
|
265
265
|
assign vendorAssignProduct = assignProduct.vendor
|
|
266
266
|
assign productFilter = allProductsPaginated | where: 'vendor', vendorAssignProduct
|
|
@@ -18,9 +18,17 @@ const ProductTag = ({ setting, styles, builderProps, ...passProps })=>{
|
|
|
18
18
|
const mode = core.useEditorMode();
|
|
19
19
|
const product = core.useProduct();
|
|
20
20
|
const currentVariant = core.useCurrentVariant();
|
|
21
|
+
const { quantity, hasUpdatePrice } = core.useQuantity();
|
|
22
|
+
const quantityProduct = React.useMemo(()=>{
|
|
23
|
+
return hasUpdatePrice && customContent?.unit !== 'percentage' ? quantity || 1 : 1;
|
|
24
|
+
}, [
|
|
25
|
+
hasUpdatePrice,
|
|
26
|
+
customContent?.unit,
|
|
27
|
+
quantity
|
|
28
|
+
]);
|
|
21
29
|
const price = currentVariant?.price ?? 0;
|
|
22
30
|
const salePrice = currentVariant?.salePrice ?? 0;
|
|
23
|
-
const priceSave = salePrice - price;
|
|
31
|
+
const priceSave = (salePrice - price) * quantityProduct;
|
|
24
32
|
const moneyFormatted = core.useFormatMoney(priceSave < 0 ? 0 : priceSave, setting?.moneyWithCurrentFormat || false);
|
|
25
33
|
const customDisplayWithUnit = React.useMemo(()=>{
|
|
26
34
|
if (!salePrice && salePrice !== 0 || !price && price !== 0) return `${customContent?.unit === 'percentage' ? '0%' : moneyFormatted}`;
|
|
@@ -256,7 +256,7 @@ const ProductList = ({ setting, builderProps, styles, className, children, advan
|
|
|
256
256
|
endunless
|
|
257
257
|
endfor
|
|
258
258
|
endfor
|
|
259
|
-
assign products =
|
|
259
|
+
assign products = relatedListProduct | uniq
|
|
260
260
|
when 'vendor'
|
|
261
261
|
assign vendorAssignProduct = assignProduct.vendor
|
|
262
262
|
assign productFilter = allProductsPaginated | where: 'vendor', vendorAssignProduct
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
2
|
-
import { useMoneyFormat, makeGlobalSize, useEditorMode, useProduct, useCurrentVariant, useFormatMoney, useProductBundleDiscount, formatMoney, getGlobalColorClass, cls, makeStyleResponsive, makeStyle, getRadiusCSSFromGlobal, getCustomRadius } from '@gem-sdk/core';
|
|
2
|
+
import { useMoneyFormat, makeGlobalSize, useEditorMode, useProduct, useCurrentVariant, useQuantity, useFormatMoney, useProductBundleDiscount, formatMoney, getGlobalColorClass, cls, makeStyleResponsive, makeStyle, getRadiusCSSFromGlobal, getCustomRadius } from '@gem-sdk/core';
|
|
3
3
|
import { useMemo } from 'react';
|
|
4
4
|
import Text from '../../text/components/Text.js';
|
|
5
5
|
import { DiscountType } from './constants/product-bundle.js';
|
|
@@ -14,9 +14,17 @@ const ProductTag = ({ setting, styles, builderProps, ...passProps })=>{
|
|
|
14
14
|
const mode = useEditorMode();
|
|
15
15
|
const product = useProduct();
|
|
16
16
|
const currentVariant = useCurrentVariant();
|
|
17
|
+
const { quantity, hasUpdatePrice } = useQuantity();
|
|
18
|
+
const quantityProduct = useMemo(()=>{
|
|
19
|
+
return hasUpdatePrice && customContent?.unit !== 'percentage' ? quantity || 1 : 1;
|
|
20
|
+
}, [
|
|
21
|
+
hasUpdatePrice,
|
|
22
|
+
customContent?.unit,
|
|
23
|
+
quantity
|
|
24
|
+
]);
|
|
17
25
|
const price = currentVariant?.price ?? 0;
|
|
18
26
|
const salePrice = currentVariant?.salePrice ?? 0;
|
|
19
|
-
const priceSave = salePrice - price;
|
|
27
|
+
const priceSave = (salePrice - price) * quantityProduct;
|
|
20
28
|
const moneyFormatted = useFormatMoney(priceSave < 0 ? 0 : priceSave, setting?.moneyWithCurrentFormat || false);
|
|
21
29
|
const customDisplayWithUnit = useMemo(()=>{
|
|
22
30
|
if (!salePrice && salePrice !== 0 || !price && price !== 0) return `${customContent?.unit === 'percentage' ? '0%' : moneyFormatted}`;
|