@gem-sdk/components 2.0.0-dev.433 → 2.0.0-dev.434
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.
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
6
6
|
var jsxRuntime = require('react/jsx-runtime');
|
|
7
7
|
var core = require('@gem-sdk/core');
|
|
8
8
|
var React = require('react');
|
|
9
|
-
var Loading = require('../../../../common/components/Loading.js');
|
|
10
9
|
var NoDataState = require('../../../../common/components/NoDataState.js');
|
|
11
10
|
var system = require('@gem-sdk/system');
|
|
12
11
|
var styles = require('../common/styles.js');
|
|
@@ -17,19 +16,13 @@ var ProductBundleDiscountChildrenItem = require('./ProductBundleDiscountChildren
|
|
|
17
16
|
|
|
18
17
|
const ProductBundleDiscount = ({ builderAttrs, style, children, setting, styles: styles$1, advanced })=>{
|
|
19
18
|
const mode = core.useEditorMode();
|
|
20
|
-
const {
|
|
19
|
+
const { isSelected, setSelected } = useProductBundleDiscountState.default(setting);
|
|
21
20
|
const { emitRedirectSetupPage, redirectGuideline, svg } = useProductBundleDataState.default();
|
|
22
21
|
const composeContainerClasses = system.createClass(classes.getContainerClasses(setting, advanced?.cssClass));
|
|
23
22
|
const composeNoDiscountClasses = system.createClass(classes.getNoDiscountClasses);
|
|
24
23
|
const composeSizeStyles = system.createStyle(styles.getSizeSettings(styles$1)?.gap);
|
|
25
24
|
const composeContainerStyles = system.createStyle(styles.getContainerStyles(composeSizeStyles, styles$1, style));
|
|
26
|
-
if (!setting?.bundleItems) {
|
|
27
|
-
return timer >= 10 ? /*#__PURE__*/ jsxRuntime.jsx("div", {
|
|
28
|
-
className: composeNoDiscountClasses,
|
|
29
|
-
children: "This product has no bundle discount"
|
|
30
|
-
}) : /*#__PURE__*/ jsxRuntime.jsx(Loading.default, {});
|
|
31
|
-
}
|
|
32
|
-
if (!setting.bundleItems.length && mode === 'edit') {
|
|
25
|
+
if (!setting?.bundleItems?.length && mode === 'edit') {
|
|
33
26
|
return /*#__PURE__*/ jsxRuntime.jsx(NoDataState.default, {
|
|
34
27
|
elementType: "secondary",
|
|
35
28
|
description: "Increase AOV with bundle quantity.",
|
|
@@ -47,7 +40,7 @@ const ProductBundleDiscount = ({ builderAttrs, style, children, setting, styles:
|
|
|
47
40
|
});
|
|
48
41
|
}
|
|
49
42
|
const renderBundleItem = (item, i)=>{
|
|
50
|
-
if (setting
|
|
43
|
+
if (setting?.hideNoDiscountItem && item?.discountType === 'no_discount') {
|
|
51
44
|
return null;
|
|
52
45
|
}
|
|
53
46
|
const childItem = children?.[i];
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
3
|
import { useEditorMode, isEmptyChildren } from '@gem-sdk/core';
|
|
4
4
|
import { isValidElement } from 'react';
|
|
5
|
-
import Loading from '../../../../common/components/Loading.js';
|
|
6
5
|
import NoDataState from '../../../../common/components/NoDataState.js';
|
|
7
6
|
import { createClass, createStyle, If } from '@gem-sdk/system';
|
|
8
7
|
import { getSizeSettings, getContainerStyles } from '../common/styles.js';
|
|
@@ -13,19 +12,13 @@ import ProductBundleDiscountChildrenItem from './ProductBundleDiscountChildrenIt
|
|
|
13
12
|
|
|
14
13
|
const ProductBundleDiscount = ({ builderAttrs, style, children, setting, styles, advanced })=>{
|
|
15
14
|
const mode = useEditorMode();
|
|
16
|
-
const {
|
|
15
|
+
const { isSelected, setSelected } = useProductBundleDiscountState(setting);
|
|
17
16
|
const { emitRedirectSetupPage, redirectGuideline, svg } = useProductBundleDataState();
|
|
18
17
|
const composeContainerClasses = createClass(getContainerClasses(setting, advanced?.cssClass));
|
|
19
18
|
const composeNoDiscountClasses = createClass(getNoDiscountClasses);
|
|
20
19
|
const composeSizeStyles = createStyle(getSizeSettings(styles)?.gap);
|
|
21
20
|
const composeContainerStyles = createStyle(getContainerStyles(composeSizeStyles, styles, style));
|
|
22
|
-
if (!setting?.bundleItems) {
|
|
23
|
-
return timer >= 10 ? /*#__PURE__*/ jsx("div", {
|
|
24
|
-
className: composeNoDiscountClasses,
|
|
25
|
-
children: "This product has no bundle discount"
|
|
26
|
-
}) : /*#__PURE__*/ jsx(Loading, {});
|
|
27
|
-
}
|
|
28
|
-
if (!setting.bundleItems.length && mode === 'edit') {
|
|
21
|
+
if (!setting?.bundleItems?.length && mode === 'edit') {
|
|
29
22
|
return /*#__PURE__*/ jsx(NoDataState, {
|
|
30
23
|
elementType: "secondary",
|
|
31
24
|
description: "Increase AOV with bundle quantity.",
|
|
@@ -43,7 +36,7 @@ const ProductBundleDiscount = ({ builderAttrs, style, children, setting, styles,
|
|
|
43
36
|
});
|
|
44
37
|
}
|
|
45
38
|
const renderBundleItem = (item, i)=>{
|
|
46
|
-
if (setting
|
|
39
|
+
if (setting?.hideNoDiscountItem && item?.discountType === 'no_discount') {
|
|
47
40
|
return null;
|
|
48
41
|
}
|
|
49
42
|
const childItem = children?.[i];
|