@gem-sdk/components 5.0.6 → 5.0.8
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/dist/cjs/product/components/product-bundle/ProductBundleDiscount.js +1 -1
- package/dist/cjs/product/components/product-bundle/hooks/useProductBundleDataState.js +81 -23
- package/dist/esm/product/components/product-bundle/ProductBundleDiscount.js +1 -1
- package/dist/esm/product/components/product-bundle/hooks/useProductBundleDataState.js +81 -23
- package/package.json +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{jsx as
|
|
2
|
+
import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useRenderMode as o,isEmptyChildren as s}from"@gem-sdk/core";import{isValidElement as n}from"react";import r from"../../../common/components/NoDataState.js";import{createClass as i,createStyle as l,If as d}from"@gem-sdk/system";import{getSizeSettings as m,getContainerStyles as u}from"./common/styles.js";import{getContainerClasses as c,getNoDiscountClasses as a}from"./common/classes.js";import p from"./hooks/useProductBundleDataState.js";import f from"./hooks/useProductBundleDiscountState.js";import h from"./ProductBundleDiscountChildrenItem.js";let ProductBundleDiscount=({builderAttrs:y,style:b,children:I,setting:g,styles:j,advanced:D})=>{let{isEditMode:k,isPreviewSharePageMode:S}=o(),{isSelected:x,setSelected:B}=f(g),{emitRedirectSetupPage:P,redirectGuideline:N,svgVertical:T,svgHorizontal:v}=p(),A=i(c(g,D?.cssClass)),C=i(a),q=l(m(j)?.gap),w=l(u(q,j,b));if(!g?.bundleItems?.length&&k)return t(r,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:P},{text:"read guideline",callback:N}],additionalMedia:g?.layout=="horizontal-layout"?v:T});let z=(e,o)=>{if(g?.hideNoDiscountItem&&e?.discountType==="no_discount")return null;let s=I?.[o];if(n(s))return t(h,{index:o,childItem:s,setting:g,styles:j,isSelected:x(o),setSelected:B,bundleItem:e},o)},M=(s(I)||g?.bundleItems?.length==0)&&!S;return e("div",{...y,className:A,style:w,children:[d(M,t("div",{className:C,children:"This product has no bundle discount"})),g?.bundleItems?.map((t,e)=>z(t,e))]})};export{ProductBundleDiscount as default};
|