@gem-sdk/components 4.0.0-staging.1177 → 4.0.0-staging.1180

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.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),core=require("@gem-sdk/core");const NoDataState=({title:e,description:t,elementType:r,builderAttrs:s,descriptionActions:n,primaryBtnTitle:i,secondaryBtnTitle:p,primaryBtnCb:l,secondaryBtnCb:c,additionalMedia:o,customClass:a,icon:d=!0,rawMode:g,children:u})=>{let x=React.useRef(null),m=core.useEditorMode(),[b,f]=React.useState("row"),j=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-product",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},h=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-article",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},C=()=>{if("edit"!==m)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:s?.["data-uid"]??s?.uid,value:!0,tag:s?.["data-component-tag"]??s?.tag}});window.dispatchEvent(e)},w={syncProduct:j,syncArticle:h};return React.useEffect(()=>{let e=new ResizeObserver(()=>{let e=x.current?x.current?.offsetWidth:0;f(e>272?"row":"column")});return x.current&&e.observe(x.current),()=>{e?.disconnect()}},[]),jsxRuntime.jsxs("div",{...s,ref:x,className:core.cls("gp-font-[Inter] gp-bg-white gp-border gp-border-dashed gp-border-box gp-rounded-lg gp-flex gp-flex-col",g?"gp-p-0":"gp-p-2"),onClick:C,children:[jsxRuntime.jsxs("div",{className:core.cls("gp-w-full gp-h-full gp-rounded-lg gp-flex gp-p-2 gp-gap-2","primary"===r?"gp-bg-[#FFF1DF]":"",g?"gp-justify-center":"",a||""),style:{flexDirection:b},children:[d&&!g&&jsxRuntime.jsx("div",{className:core.cls("gp-w-[28px] gp-h-[28px] gp-min-w-[28px] gp-flex gp-items-center gp-justify-center gp-rounded-[8px]","primary"===r?"":"gp-bg-[#FDB913]"),children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",fill:"primary"===r?"#916A00":"#212121"})]})}),jsxRuntime.jsxs("div",{className:"gp-flex-col gp-flex gp-justify-between",children:[e&&jsxRuntime.jsx("p",{className:core.cls("gp-text-[#916A00] gp-text-[13px] gp-font-semibold"),dangerouslySetInnerHTML:{__html:e}}),t&&jsxRuntime.jsxs("p",{className:core.cls(g?"gp-mb-0":"gp-mb-[4px]","primary"===r?"gp-text-[#916A00] gp-text-[13px]":"gp-text-[#212121] gp-text-[12px]"),children:[t," ",n?.map((e,t)=>{let r=t?"or":"",s="string"==typeof e.callback?w?.[e.callback]:e.callback;return jsxRuntime.jsxs("span",{children:[" ",r," ",jsxRuntime.jsx("span",{role:"presentation",className:"gp-underline gp-cursor-pointer gp-leading-5",onClick:s,children:e.text})]},`description-action-${t}`)})]}),(i||p)&&jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-wrap gp-gap-2 gp-rounded-4 gp-border-box",children:[jsxRuntime.jsx("button",{onClick:l,className:"w-h-7 gp-bg-[#212121] gp-rounded-8 gp-p-2 gp-text-xs hover:gp-bg-[#3b3b3b] gp-text-white gp-rounded-lg",children:i}),jsxRuntime.jsx("button",{onClick:c,className:"w-h-7 gp-bg-white gp-text-[#212121] hover:gp-bg-[#f6f6f6] gp-text-xs gp-p-2 gp-rounded-lg",children:p})]})]})]}),o&&jsxRuntime.jsx("div",{className:"gp-w-full",dangerouslySetInnerHTML:{__html:o}}),core.filterToolbarPreview(u,!0)]})};exports.default=NoDataState;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),core=require("@gem-sdk/core");const NoDataState=({title:e,description:t,elementType:r,builderAttrs:n,descriptionActions:s,primaryBtnTitle:l,secondaryBtnTitle:p,primaryBtnCb:i,secondaryBtnCb:c,additionalMedia:o,customClass:a,icon:d=!0,rawMode:g,children:u})=>{let x=React.useRef(null),{isEditMode:m,isPreviewSharePageMode:b}=core.useRenderMode(),[f,j]=React.useState("row"),h=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-product",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},C=()=>{let e=x.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-article",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},w=()=>{if(m)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:n?.["data-uid"]??n?.uid,value:!0,tag:n?.["data-component-tag"]??n?.tag}});window.dispatchEvent(e)},R={syncProduct:h,syncArticle:C};return(React.useEffect(()=>{let e=new ResizeObserver(()=>{let e=x.current?x.current?.offsetWidth:0;j(e>272?"row":"column")});return x.current&&e.observe(x.current),()=>{e?.disconnect()}},[]),b)?null:jsxRuntime.jsxs("div",{...n,ref:x,className:core.cls("gp-font-[Inter] gp-bg-white gp-border gp-border-dashed gp-border-box gp-rounded-lg gp-flex gp-flex-col",g?"gp-p-0":"gp-p-2"),onClick:w,children:[jsxRuntime.jsxs("div",{className:core.cls("gp-w-full gp-h-full gp-rounded-lg gp-flex gp-p-2 gp-gap-2","primary"===r?"gp-bg-[#FFF1DF]":"",g?"gp-justify-center":"",a||""),style:{flexDirection:f},children:[d&&!g&&jsxRuntime.jsx("div",{className:core.cls("gp-w-[28px] gp-h-[28px] gp-min-w-[28px] gp-flex gp-items-center gp-justify-center gp-rounded-[8px]","primary"===r?"":"gp-bg-[#FDB913]"),children:jsxRuntime.jsxs("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[jsxRuntime.jsx("path",{d:"M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"primary"===r?"#916A00":"#212121"}),jsxRuntime.jsx("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",fill:"primary"===r?"#916A00":"#212121"})]})}),jsxRuntime.jsxs("div",{className:"gp-flex-col gp-flex gp-justify-between",children:[e&&jsxRuntime.jsx("p",{className:core.cls("gp-text-[#916A00] gp-text-[13px] gp-font-semibold"),dangerouslySetInnerHTML:{__html:e}}),t&&jsxRuntime.jsxs("p",{className:core.cls(g?"gp-mb-0":"gp-mb-[4px]","primary"===r?"gp-text-[#916A00] gp-text-[13px]":"gp-text-[#212121] gp-text-[12px]"),children:[t," ",s?.map((e,t)=>{let r=t?"or":"",n="string"==typeof e.callback?R?.[e.callback]:e.callback;return jsxRuntime.jsxs("span",{children:[" ",r," ",jsxRuntime.jsx("span",{role:"presentation",className:"gp-underline gp-cursor-pointer gp-leading-5",onClick:n,children:e.text})]},`description-action-${t}`)})]}),(l||p)&&jsxRuntime.jsxs("div",{className:"gp-flex gp-flex-wrap gp-gap-2 gp-rounded-4 gp-border-box",children:[jsxRuntime.jsx("button",{onClick:i,className:"w-h-7 gp-bg-[#212121] gp-rounded-8 gp-p-2 gp-text-xs hover:gp-bg-[#3b3b3b] gp-text-white gp-rounded-lg",children:l}),jsxRuntime.jsx("button",{onClick:c,className:"w-h-7 gp-bg-white gp-text-[#212121] hover:gp-bg-[#f6f6f6] gp-text-xs gp-p-2 gp-rounded-lg",children:p})]})]})]}),o&&jsxRuntime.jsx("div",{className:"gp-w-full",dangerouslySetInnerHTML:{__html:o}}),core.filterToolbarPreview(u,!0)]})};exports.default=NoDataState;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),NoDataState=require("../../../common/components/NoDataState.js"),system=require("@gem-sdk/system"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),useProductBundleDataState=require("./hooks/useProductBundleDataState.js"),useProductBundleDiscountState=require("./hooks/useProductBundleDiscountState.js"),ProductBundleDiscountChildrenItem=require("./ProductBundleDiscountChildrenItem.js");const ProductBundleDiscount=({builderAttrs:e,style:t,children:s,setting:u,styles:n,advanced:l})=>{let r=core.useEditorMode(),{isSelected:i,setSelected:d}=useProductBundleDiscountState.default(u),{emitRedirectSetupPage:a,redirectGuideline:c,svg:o}=useProductBundleDataState.default(),m=system.createClass(classes.getContainerClasses(u,l?.cssClass)),y=system.createClass(classes.getNoDiscountClasses),j=system.createStyle(styles.getSizeSettings(n)?.gap),S=system.createStyle(styles.getContainerStyles(j,n,t));if(!u?.bundleItems?.length&&"edit"===r)return jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:a},{text:"read guideline",callback:c}],additionalMedia:o});let D=(e,t)=>{if(u?.hideNoDiscountItem&&e?.discountType==="no_discount")return null;let l=s?.[t];if(React.isValidElement(l))return jsxRuntime.jsx(ProductBundleDiscountChildrenItem.default,{index:t,childItem:l,setting:u,styles:n,isSelected:i(t),setSelected:d,bundleItem:e},t)};return jsxRuntime.jsxs("div",{...e,className:m,style:S,children:[system.If(core.isEmptyChildren(s)||u?.bundleItems?.length==0,jsxRuntime.jsx("div",{className:y,children:"This product has no bundle discount"})),u?.bundleItems?.map((e,t)=>D(e,t))]})};exports.default=ProductBundleDiscount;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),NoDataState=require("../../../common/components/NoDataState.js"),system=require("@gem-sdk/system"),styles=require("./common/styles.js"),classes=require("./common/classes.js"),useProductBundleDataState=require("./hooks/useProductBundleDataState.js"),useProductBundleDiscountState=require("./hooks/useProductBundleDiscountState.js"),ProductBundleDiscountChildrenItem=require("./ProductBundleDiscountChildrenItem.js");const ProductBundleDiscount=({builderAttrs:e,style:t,children:s,setting:u,styles:n,advanced:l})=>{let{isEditMode:r,isPreviewSharePageMode:i}=core.useRenderMode(),{isSelected:d,setSelected:a}=useProductBundleDiscountState.default(u),{emitRedirectSetupPage:c,redirectGuideline:o,svg:m}=useProductBundleDataState.default(),y=system.createClass(classes.getContainerClasses(u,l?.cssClass)),j=system.createClass(classes.getNoDiscountClasses),S=system.createStyle(styles.getSizeSettings(n)?.gap),D=system.createStyle(styles.getContainerStyles(S,n,t));if(!u?.bundleItems?.length&&r)return jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:c},{text:"read guideline",callback:o}],additionalMedia:m});let h=(e,t)=>{if(u?.hideNoDiscountItem&&e?.discountType==="no_discount")return null;let l=s?.[t];if(React.isValidElement(l))return jsxRuntime.jsx(ProductBundleDiscountChildrenItem.default,{index:t,childItem:l,setting:u,styles:n,isSelected:d(t),setSelected:a,bundleItem:e},t)},x=(core.isEmptyChildren(s)||u?.bundleItems?.length==0)&&!i;return jsxRuntime.jsxs("div",{...e,className:y,style:D,children:[system.If(x,jsxRuntime.jsx("div",{className:j,children:"This product has no bundle discount"})),u?.bundleItems?.map((e,t)=>h(e,t))]})};exports.default=ProductBundleDiscount;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as p,useEffect as n}from"react";import{useEditorMode as l,cls as i,filterToolbarPreview as g}from"@gem-sdk/core";let NoDataState=({title:a,description:d,elementType:o,builderAttrs:c,descriptionActions:s,primaryBtnTitle:u,secondaryBtnTitle:m,primaryBtnCb:b,secondaryBtnCb:f,additionalMedia:x,customClass:h,icon:C=!0,rawMode:w,children:v})=>{let y=r(null),N=l(),[k,A]=p("row"),E=()=>{let e=y.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-product",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},L=()=>{let e=y.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-article",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},M=()=>{if("edit"!==N)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:c?.["data-uid"]??c?.uid,value:!0,tag:c?.["data-component-tag"]??c?.tag}});window.dispatchEvent(e)},D={syncProduct:E,syncArticle:L};return n(()=>{let e=new ResizeObserver(()=>{let e=y.current?y.current?.offsetWidth:0;A(e>272?"row":"column")});return y.current&&e.observe(y.current),()=>{e?.disconnect()}},[]),e("div",{...c,ref:y,className:i("gp-font-[Inter] gp-bg-white gp-border gp-border-dashed gp-border-box gp-rounded-lg gp-flex gp-flex-col",w?"gp-p-0":"gp-p-2"),onClick:M,children:[e("div",{className:i("gp-w-full gp-h-full gp-rounded-lg gp-flex gp-p-2 gp-gap-2","primary"===o?"gp-bg-[#FFF1DF]":"",w?"gp-justify-center":"",h||""),style:{flexDirection:k},children:[C&&!w&&t("div",{className:i("gp-w-[28px] gp-h-[28px] gp-min-w-[28px] gp-flex gp-items-center gp-justify-center gp-rounded-[8px]","primary"===o?"":"gp-bg-[#FDB913]"),children:e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",fill:"primary"===o?"#916A00":"#212121"}),t("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"primary"===o?"#916A00":"#212121"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",fill:"primary"===o?"#916A00":"#212121"})]})}),e("div",{className:"gp-flex-col gp-flex gp-justify-between",children:[a&&t("p",{className:i("gp-text-[#916A00] gp-text-[13px] gp-font-semibold"),dangerouslySetInnerHTML:{__html:a}}),d&&e("p",{className:i(w?"gp-mb-0":"gp-mb-[4px]","primary"===o?"gp-text-[#916A00] gp-text-[13px]":"gp-text-[#212121] gp-text-[12px]"),children:[d," ",s?.map((r,p)=>{let n=p?"or":"",l="string"==typeof r.callback?D?.[r.callback]:r.callback;return e("span",{children:[" ",n," ",t("span",{role:"presentation",className:"gp-underline gp-cursor-pointer gp-leading-5",onClick:l,children:r.text})]},`description-action-${p}`)})]}),(u||m)&&e("div",{className:"gp-flex gp-flex-wrap gp-gap-2 gp-rounded-4 gp-border-box",children:[t("button",{onClick:b,className:"w-h-7 gp-bg-[#212121] gp-rounded-8 gp-p-2 gp-text-xs hover:gp-bg-[#3b3b3b] gp-text-white gp-rounded-lg",children:u}),t("button",{onClick:f,className:"w-h-7 gp-bg-white gp-text-[#212121] hover:gp-bg-[#f6f6f6] gp-text-xs gp-p-2 gp-rounded-lg",children:m})]})]})]}),x&&t("div",{className:"gp-w-full",dangerouslySetInnerHTML:{__html:x}}),g(v,!0)]})};export{NoDataState as default};
1
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useRef as r,useState as p,useEffect as l}from"react";import{useRenderMode as n,cls as i,filterToolbarPreview as g}from"@gem-sdk/core";let NoDataState=({title:a,description:d,elementType:o,builderAttrs:c,descriptionActions:s,primaryBtnTitle:u,secondaryBtnTitle:m,primaryBtnCb:b,secondaryBtnCb:f,additionalMedia:x,customClass:h,icon:C=!0,rawMode:w,children:v})=>{let y=r(null),{isEditMode:N,isPreviewSharePageMode:k}=n(),[A,E]=p("row"),L=()=>{let e=y.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-product",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},M=()=>{let e=y.current?.closest('[data-component-type="component"]')?.getAttribute("data-uid");if(!e)return;let t=new CustomEvent("editor:sync-article",{bubbles:!0,detail:{uid:e}});window.dispatchEvent(t)},D=()=>{if(N)return;let e=new CustomEvent("editor:product-source-no-data-warning",{bubbles:!0,detail:{uid:c?.["data-uid"]??c?.uid,value:!0,tag:c?.["data-component-tag"]??c?.tag}});window.dispatchEvent(e)},F={syncProduct:L,syncArticle:M};return(l(()=>{let e=new ResizeObserver(()=>{let e=y.current?y.current?.offsetWidth:0;E(e>272?"row":"column")});return y.current&&e.observe(y.current),()=>{e?.disconnect()}},[]),k)?null:e("div",{...c,ref:y,className:i("gp-font-[Inter] gp-bg-white gp-border gp-border-dashed gp-border-box gp-rounded-lg gp-flex gp-flex-col",w?"gp-p-0":"gp-p-2"),onClick:D,children:[e("div",{className:i("gp-w-full gp-h-full gp-rounded-lg gp-flex gp-p-2 gp-gap-2","primary"===o?"gp-bg-[#FFF1DF]":"",w?"gp-justify-center":"",h||""),style:{flexDirection:A},children:[C&&!w&&t("div",{className:i("gp-w-[28px] gp-h-[28px] gp-min-w-[28px] gp-flex gp-items-center gp-justify-center gp-rounded-[8px]","primary"===o?"":"gp-bg-[#FDB913]"),children:e("svg",{width:"20",height:"20",viewBox:"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("path",{d:"M9.99997 6.75C10.4142 6.75 10.75 7.08579 10.75 7.5V11C10.75 11.4142 10.4142 11.75 9.99997 11.75C9.58576 11.75 9.24997 11.4142 9.24997 11V7.5C9.24997 7.08579 9.58576 6.75 9.99997 6.75Z",fill:"primary"===o?"#916A00":"#212121"}),t("path",{d:"M11 13.5C11 14.0523 10.5523 14.5 10 14.5C9.44775 14.5 9.00003 14.0523 9.00003 13.5C9.00003 12.9477 9.44775 12.5 10 12.5C10.5523 12.5 11 12.9477 11 13.5Z",fill:"primary"===o?"#916A00":"#212121"}),t("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M10.0001 3.5C8.95474 3.5 8.21619 4.20232 7.84765 4.94672C7.65568 5.33448 6.75987 7.0441 5.84308 8.79353L5.81534 8.84646C4.92293 10.5493 4.01717 12.2777 3.80719 12.702C3.43513 13.4537 3.32934 14.4519 3.89956 15.316C4.46914 16.1791 5.44225 16.5 6.3636 16.5L13.6364 16.5C14.5577 16.5 15.5309 16.1791 16.1005 15.316C16.6707 14.4519 16.5649 13.4537 16.1928 12.702C15.9832 12.2784 15.08 10.555 14.189 8.85476L14.1569 8.79352C13.24 7.044 12.3443 5.33454 12.1525 4.94693C11.784 4.20242 11.0455 3.5 10.0001 3.5ZM9.19193 5.61225C9.59608 4.79592 10.4041 4.79592 10.8081 5.61225C11.0102 6.02061 11.9201 7.75686 12.8297 9.49243C13.7383 11.2262 14.6466 12.9594 14.8485 13.3673C15.2525 14.1837 14.8485 15 13.6364 15L6.3636 15C5.15153 15 4.74749 14.1837 5.15153 13.3673C5.35379 12.9587 6.26471 11.2205 7.17483 9.4838C8.08286 7.75111 8.99008 6.01994 9.19193 5.61225Z",fill:"primary"===o?"#916A00":"#212121"})]})}),e("div",{className:"gp-flex-col gp-flex gp-justify-between",children:[a&&t("p",{className:i("gp-text-[#916A00] gp-text-[13px] gp-font-semibold"),dangerouslySetInnerHTML:{__html:a}}),d&&e("p",{className:i(w?"gp-mb-0":"gp-mb-[4px]","primary"===o?"gp-text-[#916A00] gp-text-[13px]":"gp-text-[#212121] gp-text-[12px]"),children:[d," ",s?.map((r,p)=>{let l=p?"or":"",n="string"==typeof r.callback?F?.[r.callback]:r.callback;return e("span",{children:[" ",l," ",t("span",{role:"presentation",className:"gp-underline gp-cursor-pointer gp-leading-5",onClick:n,children:r.text})]},`description-action-${p}`)})]}),(u||m)&&e("div",{className:"gp-flex gp-flex-wrap gp-gap-2 gp-rounded-4 gp-border-box",children:[t("button",{onClick:b,className:"w-h-7 gp-bg-[#212121] gp-rounded-8 gp-p-2 gp-text-xs hover:gp-bg-[#3b3b3b] gp-text-white gp-rounded-lg",children:u}),t("button",{onClick:f,className:"w-h-7 gp-bg-white gp-text-[#212121] hover:gp-bg-[#f6f6f6] gp-text-xs gp-p-2 gp-rounded-lg",children:m})]})]})]}),x&&t("div",{className:"gp-w-full",dangerouslySetInnerHTML:{__html:x}}),g(v,!0)]})};export{NoDataState as default};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEditorMode as o,isEmptyChildren as s}from"@gem-sdk/core";import{isValidElement as n}from"react";import i from"../../../common/components/NoDataState.js";import{createClass as r,createStyle as d,If as m}from"@gem-sdk/system";import{getSizeSettings as l,getContainerStyles as c}from"./common/styles.js";import{getContainerClasses as u,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:b,style:y,children:I,setting:g,styles:j,advanced:D})=>{let k=o(),{isSelected:S,setSelected:x}=f(g),{emitRedirectSetupPage:B,redirectGuideline:P,svg:N}=p(),T=r(u(g,D?.cssClass)),v=r(a),A=d(l(j)?.gap),C=d(c(A,j,y));if(!g?.bundleItems?.length&&"edit"===k)return e(i,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:B},{text:"read guideline",callback:P}],additionalMedia:N});let q=(t,o)=>{if(g?.hideNoDiscountItem&&t?.discountType==="no_discount")return null;let s=I?.[o];if(n(s))return e(h,{index:o,childItem:s,setting:g,styles:j,isSelected:S(o),setSelected:x,bundleItem:t},o)};return t("div",{...b,className:T,style:C,children:[m(s(I)||g?.bundleItems?.length==0,e("div",{className:v,children:"This product has no bundle discount"})),g?.bundleItems?.map((e,t)=>q(e,t))]})};export{ProductBundleDiscount as default};
2
+ import{jsx as e,jsxs as t}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 d,If as m}from"@gem-sdk/system";import{getSizeSettings as l,getContainerStyles as c}from"./common/styles.js";import{getContainerClasses as u,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:b,style:y,children:I,setting:g,styles:j,advanced:D})=>{let{isEditMode:k,isPreviewSharePageMode:S}=o(),{isSelected:x,setSelected:B}=f(g),{emitRedirectSetupPage:P,redirectGuideline:N,svg:T}=p(),v=i(u(g,D?.cssClass)),A=i(a),C=d(l(j)?.gap),q=d(c(C,j,y));if(!g?.bundleItems?.length&&k)return e(r,{elementType:"secondary",description:"Increase AOV with bundle quantity.",descriptionActions:[{text:"Setup bundle discount",callback:P},{text:"read guideline",callback:N}],additionalMedia:T});let w=(t,o)=>{if(g?.hideNoDiscountItem&&t?.discountType==="no_discount")return null;let s=I?.[o];if(n(s))return e(h,{index:o,childItem:s,setting:g,styles:j,isSelected:x(o),setSelected:B,bundleItem:t},o)},M=(s(I)||g?.bundleItems?.length==0)&&!S;return t("div",{...b,className:v,style:q,children:[m(M,e("div",{className:A,children:"This product has no bundle discount"})),g?.bundleItems?.map((e,t)=>w(e,t))]})};export{ProductBundleDiscount as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "4.0.0-staging.1177",
3
+ "version": "4.0.0-staging.1180",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "4.0.0-staging.1177",
28
+ "@gem-sdk/core": "4.0.0-staging.1179",
29
29
  "@gem-sdk/styles": "3.1.0-staging.1137",
30
30
  "@gem-sdk/system": "3.1.0-staging.1137",
31
31
  "tsup": "^8.5.0",