@gem-sdk/components 12.0.0-staging.53 → 12.0.0-staging.54

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.
Files changed (16) hide show
  1. package/dist/cjs/post-purchase/product/components/product-subscription/ProductSubscription.js +1 -1
  2. package/dist/cjs/post-purchase/product/components/product-subscription/common/classes.js +1 -1
  3. package/dist/cjs/post-purchase/product/components/product-subscription/common/styles.js +1 -1
  4. package/dist/cjs/post-purchase/product/components/product-subscription/components/SellingPlanDropdown.js +1 -1
  5. package/dist/cjs/post-purchase/product/components/product-subscription/components/SellingPlanLabel.js +1 -1
  6. package/dist/cjs/post-purchase/product/components/product-subscription/components/SellingPlanRadio.js +1 -1
  7. package/dist/cjs/post-purchase/product/settings/product-subscription/configs/settings.js +1 -1
  8. package/dist/esm/post-purchase/product/components/product-subscription/ProductSubscription.js +1 -1
  9. package/dist/esm/post-purchase/product/components/product-subscription/common/classes.js +1 -1
  10. package/dist/esm/post-purchase/product/components/product-subscription/common/styles.js +1 -1
  11. package/dist/esm/post-purchase/product/components/product-subscription/components/SellingPlanDropdown.js +1 -1
  12. package/dist/esm/post-purchase/product/components/product-subscription/components/SellingPlanLabel.js +1 -1
  13. package/dist/esm/post-purchase/product/components/product-subscription/components/SellingPlanRadio.js +1 -1
  14. package/dist/esm/post-purchase/product/settings/product-subscription/configs/settings.js +1 -1
  15. package/dist/types/index.d.ts +21 -17
  16. package/package.json +1 -1
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),React=require("react"),index=require("../../constants/index.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),useSellingPlanChange=require("./hooks/useSellingPlanChange.js"),useSellingSubscription=require("./hooks/useSellingSubscription.js"),useSellingPlanOptions=require("./hooks/useSellingPlanOptions.js"),useSubscriptionVisibility=require("./hooks/useSubscriptionVisibility.js"),OneTimePurchaseTooltip=require("./components/OneTimePurchaseTooltip.js"),SellingPlanDropdown=require("./components/SellingPlanDropdown.js"),SellingPlanLabel=require("./components/SellingPlanLabel.js"),SellingPlanRadio=require("./components/SellingPlanRadio.js"),SubscriptionDetail=require("./components/SubscriptionDetail.js"),SubscriptionRadio=require("./components/SubscriptionRadio.js"),useDynamicProduct=require("../../hooks/useDynamicProduct.js");const ProductSubscription=({styles:e,setting:s,builderProps:i,builderAttrs:n,style:t,children:l})=>{let r=core.useProduct(),u=core.usePageStore(e=>e.setSubscriptionVisible),o=core.usePageStore(e=>e.getSubscriptionVisible),{defaultValue:a,selectedSellingPlan:c,setSelectedSellingPlan:d}=useSellingSubscription.useSellingSubscription(s),S=useSellingPlanOptions.useSellingPlanOptions(s),{selectedValue:p,handleSellingPlanChange:m}=useSellingPlanChange.useSellingPlanChange({defaultValue:a,selectedSellingPlan:c,setSelectedSellingPlan:d,sellingPlanOptions:S}),g=React.useRef(null),j=React.useId(),{selectedType:b,shouldShowRadio:x,isOneTimeHidden:P,hasNoSellingPlanOptions:y,setSubscriptionSellingType:R}=useSubscriptionVisibility.useSubscriptionVisibility({setting:s}),h=system.createStyle(styles.getSubscriptionStyles(e)),T=system.createStyle(styles.getSubscriptionWrapperStyles(e?.align)),O=system.createClass(classes.getWrapperClasses()),q=system.createClass(classes.getContainerClasses()),C=system.createStyle({...t}),{isEditMode:E}=core.useRenderMode(),I=`product-subscription-${r?.baseID}`,N=r?.baseID,D=`subscription-type-selection-${j}`,v=s?.sellingType===index.SubscriptionEnum.ONE_TIME,f=s?.sellingType===index.SubscriptionEnum.SUBSCRIPTION,{isDynamicProduct:k}=useDynamicProduct.useDynamicProduct();if(React.useEffect(()=>{if(!r?.id||!f)return;let e=r?.id,s=`${i?.uid}-${e}`,n=!(y||k),t=o()??{};if(!n){u({...t,[e]:(t[e]??[]).filter(e=>e!==s)});return}u({...t,[e]:[...t[e]??[],s]})},[i?.uid,o,y,k,f,r?.id,u]),P||y||k)return E?jsxRuntime.jsxs("div",{...n,style:C,children:[jsxRuntime.jsx(OneTimePurchaseTooltip.OneTimePurchaseTooltip,{ref:g,setting:s}),core.filterToolbarPreview(l,!0)]}):null;let L=e=>jsxRuntime.jsxs("div",{...n,style:C,children:[jsxRuntime.jsx("div",{ref:g,"data-selling-type":s?.sellingType,id:I,className:O,style:T,children:e}),core.filterToolbarPreview(l,!0)]}),V=()=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:s?.sellingStyle==="radio"?jsxRuntime.jsx(SellingPlanRadio.SellingPlanRadio,{setting:s,styles:e,builderProps:i,productId:N??"",sellingPlanOptions:S,selectedValue:p,onChange:m}):jsxRuntime.jsx(SellingPlanDropdown.SellingPlanDropdown,{setting:s,sellingPlanOptions:S,selectedValue:p,onChange:m})});return L(v&&x?jsxRuntime.jsx("div",{className:q,style:h,children:jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${N}-one-time-radio`,name:D,value:index.SubscriptionEnum.ONE_TIME,checked:b===index.SubscriptionEnum.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&R(index.SubscriptionEnum.ONE_TIME)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})})}):f&&x?jsxRuntime.jsxs("div",{className:q,style:h,children:[jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${N}-subscription-radio`,name:D,value:index.SubscriptionEnum.SUBSCRIPTION,checked:b===index.SubscriptionEnum.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&R(index.SubscriptionEnum.SUBSCRIPTION)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})}),b===index.SubscriptionEnum.SUBSCRIPTION&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"gp-pl-7",children:V()}),jsxRuntime.jsx("div",{className:"gp-pl-7",children:jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:s,styles:e})})]})]}):jsxRuntime.jsxs("div",{className:q,style:h,children:[jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e}),f&&V(),f&&jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:s,styles:e})]}))};exports.default=ProductSubscription;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),React=require("react"),index=require("../../constants/index.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),useSellingPlanChange=require("./hooks/useSellingPlanChange.js"),useSellingSubscription=require("./hooks/useSellingSubscription.js"),useSellingPlanOptions=require("./hooks/useSellingPlanOptions.js"),useSubscriptionVisibility=require("./hooks/useSubscriptionVisibility.js"),OneTimePurchaseTooltip=require("./components/OneTimePurchaseTooltip.js"),SellingPlanDropdown=require("./components/SellingPlanDropdown.js"),SellingPlanLabel=require("./components/SellingPlanLabel.js"),SellingPlanRadio=require("./components/SellingPlanRadio.js"),SubscriptionDetail=require("./components/SubscriptionDetail.js"),SubscriptionRadio=require("./components/SubscriptionRadio.js"),useDynamicProduct=require("../../hooks/useDynamicProduct.js");const ProductSubscription=({styles:e,setting:i,builderProps:s,builderAttrs:n,style:t,children:l})=>{let r=core.useProduct(),o=core.usePageStore(e=>e.setSubscriptionVisible),u=core.usePageStore(e=>e.getSubscriptionVisible),{defaultValue:a,selectedSellingPlan:c,setSelectedSellingPlan:d}=useSellingSubscription.useSellingSubscription(i),S=useSellingPlanOptions.useSellingPlanOptions(i),{selectedValue:p,handleSellingPlanChange:m}=useSellingPlanChange.useSellingPlanChange({defaultValue:a,selectedSellingPlan:c,setSelectedSellingPlan:d,sellingPlanOptions:S}),g=React.useRef(null),j=React.useId(),{selectedType:b,shouldShowRadio:x,isOneTimeHidden:R,hasNoSellingPlanOptions:P,setSubscriptionSellingType:y}=useSubscriptionVisibility.useSubscriptionVisibility({setting:i}),h=system.createStyle(styles.getSubscriptionStyles(e,x)),T=system.createStyle(styles.getSubscriptionWrapperStyles(e?.align)),O=system.createClass(classes.getWrapperClasses()),q=system.createClass(classes.getContainerClasses()),C=system.createStyle({...t}),{isEditMode:E}=core.useRenderMode(),I=`product-subscription-${r?.baseID}`,N=r?.baseID,D=`subscription-type-selection-${j}`,v=i?.sellingType===index.SubscriptionEnum.ONE_TIME,f=i?.sellingType===index.SubscriptionEnum.SUBSCRIPTION,{isDynamicProduct:k}=useDynamicProduct.useDynamicProduct();if(React.useEffect(()=>{if(!r?.id||!f)return;let e=r?.id,i=`${s?.uid}-${e}`,n=!(P||k),t=u()??{};if(!n){o({...t,[e]:(t[e]??[]).filter(e=>e!==i)});return}o({...t,[e]:[...t[e]??[],i]})},[s?.uid,u,P,k,f,r?.id,o]),R||P||k)return E?jsxRuntime.jsxs("div",{...n,style:C,children:[jsxRuntime.jsx(OneTimePurchaseTooltip.OneTimePurchaseTooltip,{ref:g,setting:i}),core.filterToolbarPreview(l,!0)]}):null;let w=e=>jsxRuntime.jsxs("div",{...n,style:C,children:[jsxRuntime.jsx("div",{ref:g,"data-selling-type":i?.sellingType,id:I,className:O,style:T,children:e}),core.filterToolbarPreview(l,!0)]}),L=()=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:i?.sellingStyle==="radio"?jsxRuntime.jsx(SellingPlanRadio.SellingPlanRadio,{setting:i,styles:e,builderProps:s,productId:N??"",sellingPlanOptions:S,selectedValue:p,isShowRadio:x,onChange:m}):jsxRuntime.jsx(SellingPlanDropdown.SellingPlanDropdown,{setting:i,styles:e,sellingPlanOptions:S,selectedValue:p,isShowRadio:x,onChange:m})});return w(v&&x?jsxRuntime.jsx("div",{className:q,style:h,children:jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${N}-one-time-radio`,name:D,value:index.SubscriptionEnum.ONE_TIME,checked:b===index.SubscriptionEnum.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&y(index.SubscriptionEnum.ONE_TIME)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:i,styles:e,isShowRadio:x})})}):f&&x?jsxRuntime.jsxs("div",{className:q,style:h,children:[jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${N}-subscription-radio`,name:D,value:index.SubscriptionEnum.SUBSCRIPTION,checked:b===index.SubscriptionEnum.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&y(index.SubscriptionEnum.SUBSCRIPTION)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:i,styles:e,isShowRadio:x})}),b===index.SubscriptionEnum.SUBSCRIPTION&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"gp-pl-7",children:L()}),jsxRuntime.jsx("div",{className:"gp-pl-7",children:jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:i,styles:e})})]})]}):jsxRuntime.jsxs("div",{className:q,style:h,children:[jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:i,styles:e,isShowRadio:x}),f&&L(),f&&jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:i,styles:e})]}))};exports.default=ProductSubscription;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core");const getWrapperClasses=()=>core.composeClasses("gp-flex gp-gap-x-[10px] gap-[10px]"),getContainerClasses=()=>core.composeClasses("gp-flex gp-flex-col"),getSellingPlanRadioContainerClasses=()=>core.composeClasses("gp-relative gp-flex gp-flex-col"),getSellingPlanRadioLabelClasses=()=>core.composeClasses("gp-text-xs gp-leading-[1.3]"),getSellingPlanRadioOptionsClasses=()=>core.composeClasses("gp-flex gp-flex-col"),getSellingPlanRadioOptionTextClasses=()=>core.composeClasses("gp-text-[14px] gp-leading-[1.3] gp-text-[#545454]"),getSubscriptionRadioLabelClasses=e=>{let s=e?"gp-opacity-50 gp-cursor-not-allowed":"";return core.composeClasses(`gp-flex gp-items-center gp-cursor-pointer gp-gap-2 ${s}`.trim())},getSubscriptionRadioInputClasses=()=>core.composeClasses("gp-relative gp-min-h-[18px] gp-min-w-[18px] gp-mt-[3px] gp-w-4 gp-h-4 gp-cursor-pointer gp-appearance-none gp-rounded-full gp-bg-light-100 gp-transition-all gp-border-light-500 gp-border-2 checked:gp-border-[#1879b9] checked:gp-border-[6px] checked:gp-after:gp-content-[''] checked:gp-after:gp-absolute checked:gp-after:gp-top-1/2 checked:gp-after:gp-left-1/2 checked:gp-after:gp-transform checked:gp-after:gp--translate-x-1/2 checked:gp-after:gp--translate-y-1/2 checked:gp-after:gp-h-2 checked:gp-after:gp-w-2 checked:gp-after:gp-rounded-full checked:gp-after:gp-bg-white disabled:gp-cursor-not-allowed"),getSellingPlanDropdownContainerClasses=()=>core.composeClasses("gp-relative"),getSellingPlanDropdownLabelClasses=()=>core.composeClasses("!gp-max-w-[calc(100%_-_66px)] gp-absolute gp-left-[12px] gp-top-[6px] gp-p-0 gp-text-xs gp-leading-[1.3] gp-text-[#737373] gp-transition-[top]"),getSellingPlanDropdownLabelSpanClasses=()=>core.composeClasses("gp-max-w-full"),getSellingPlanDropdownLabelInnerSpanClasses=()=>core.composeClasses("gp-block gp-overflow-hidden"),getSellingPlanDropdownSelectClasses=({isNoLabel:e=!1})=>core.composeClasses(`gp-min-h-[47px] gp-appearance-none gp-bg-transparent gp-w-full gp-whitespace-nowrap gp-rounded-[5px] gp-border gp-border-[#d9d9d9] gp-pl-[11px] gp-pr-[40px] gp-text-[14px] gp-outline-none gp-text-[#545454] gp-leading-[1.3] ${e?"gp-pt-0 gp-pb-0":"gp-pt-[21px] gp-pb-[6px]"}`),getSellingPlanDropdownOptionClasses=()=>core.composeClasses("gp-text-[14px] gp-text-black"),getSellingPlanDropdownIconContainerClasses=()=>core.composeClasses("gp-pointer-events-none gp-absolute gp-right-[2px] gp-top-[50%] gp-flex gp-h-[43%] gp-w-[40px] gp-translate-y-[-50%] gp-items-center gp-justify-center gp-border-l-[1px] gp-bg-white gp-border-[#545454]"),getSellingPlanDropdownIconClasses=()=>core.composeClasses("gp-h-[10px] gp-w-[10px]");exports.getContainerClasses=getContainerClasses,exports.getSellingPlanDropdownContainerClasses=getSellingPlanDropdownContainerClasses,exports.getSellingPlanDropdownIconClasses=getSellingPlanDropdownIconClasses,exports.getSellingPlanDropdownIconContainerClasses=getSellingPlanDropdownIconContainerClasses,exports.getSellingPlanDropdownLabelClasses=getSellingPlanDropdownLabelClasses,exports.getSellingPlanDropdownLabelInnerSpanClasses=getSellingPlanDropdownLabelInnerSpanClasses,exports.getSellingPlanDropdownLabelSpanClasses=getSellingPlanDropdownLabelSpanClasses,exports.getSellingPlanDropdownOptionClasses=getSellingPlanDropdownOptionClasses,exports.getSellingPlanDropdownSelectClasses=getSellingPlanDropdownSelectClasses,exports.getSellingPlanRadioContainerClasses=getSellingPlanRadioContainerClasses,exports.getSellingPlanRadioLabelClasses=getSellingPlanRadioLabelClasses,exports.getSellingPlanRadioOptionTextClasses=getSellingPlanRadioOptionTextClasses,exports.getSellingPlanRadioOptionsClasses=getSellingPlanRadioOptionsClasses,exports.getSubscriptionRadioInputClasses=getSubscriptionRadioInputClasses,exports.getSubscriptionRadioLabelClasses=getSubscriptionRadioLabelClasses,exports.getWrapperClasses=getWrapperClasses;
1
+ "use strict";var core=require("@gem-sdk/core");const getWrapperClasses=()=>core.composeClasses("gp-flex gp-gap-x-[10px] gap-[10px]"),getContainerClasses=()=>core.composeClasses("gp-flex gp-flex-col"),getSellingPlanRadioContainerClasses=()=>core.composeClasses("gp-relative gp-flex gp-flex-col"),getSellingPlanRadioLabelClasses=()=>core.composeClasses("gp-text-xs gp-leading-[1.3]"),getSellingPlanRadioOptionsClasses=()=>core.composeClasses("gp-flex gp-flex-col"),getSellingPlanRadioOptionTextClasses=()=>core.composeClasses("gp-text-[14px] gp-leading-[1.3] gp-text-[#545454]"),getSubscriptionRadioLabelClasses=e=>{let s=e?"gp-opacity-50 gp-cursor-not-allowed":"";return core.composeClasses(`gp-flex gp-items-center gp-cursor-pointer gp-gap-2 ${s}`.trim())},getSubscriptionRadioInputClasses=()=>core.composeClasses("gp-relative gp-min-h-[18px] gp-min-w-[18px] gp-mt-[3px] gp-w-4 gp-h-4 gp-cursor-pointer gp-appearance-none gp-rounded-full gp-bg-light-100 gp-transition-all gp-border-light-500 gp-border-2 checked:gp-border-[#1879b9] checked:gp-border-[6px] checked:gp-after:gp-content-[''] checked:gp-after:gp-absolute checked:gp-after:gp-top-1/2 checked:gp-after:gp-left-1/2 checked:gp-after:gp-transform checked:gp-after:gp--translate-x-1/2 checked:gp-after:gp--translate-y-1/2 checked:gp-after:gp-h-2 checked:gp-after:gp-w-2 checked:gp-after:gp-rounded-full checked:gp-after:gp-bg-white disabled:gp-cursor-not-allowed"),getSellingPlanDropdownContainerClasses=()=>core.composeClasses("gp-relative"),getSellingPlanDropdownLabelClasses=()=>core.composeClasses("!gp-max-w-[calc(100%_-_66px)] gp-absolute gp-left-[12px] gp-top-[6px] gp-p-0 gp-text-xs gp-leading-[1.3] gp-text-[#737373] gp-transition-[top]"),getSellingPlanDropdownLabelSpanClasses=()=>core.composeClasses("gp-max-w-full"),getSellingPlanDropdownLabelInnerSpanClasses=()=>core.composeClasses("gp-block gp-overflow-hidden gp-truncate"),getSellingPlanDropdownSelectClasses=({isNoLabel:e=!1})=>core.composeClasses(`gp-min-h-[47px] gp-appearance-none gp-bg-transparent gp-w-full gp-whitespace-nowrap gp-rounded-[5px] gp-border gp-border-[#d9d9d9] gp-pl-[11px] gp-pr-[40px] gp-text-[14px] gp-outline-none gp-text-[#545454] gp-leading-[1.3] ${e?"gp-pt-0 gp-pb-0":"gp-pt-[21px] gp-pb-[6px]"}`),getSellingPlanDropdownOptionClasses=()=>core.composeClasses("gp-text-[14px] gp-text-black"),getSellingPlanDropdownIconContainerClasses=()=>core.composeClasses("gp-pointer-events-none gp-absolute gp-right-[2px] gp-top-[50%] gp-flex gp-h-[43%] gp-w-[40px] gp-translate-y-[-50%] gp-items-center gp-justify-center gp-border-l-[1px] gp-bg-white gp-border-[#545454]"),getSellingPlanDropdownIconClasses=()=>core.composeClasses("gp-h-[10px] gp-w-[10px]");exports.getContainerClasses=getContainerClasses,exports.getSellingPlanDropdownContainerClasses=getSellingPlanDropdownContainerClasses,exports.getSellingPlanDropdownIconClasses=getSellingPlanDropdownIconClasses,exports.getSellingPlanDropdownIconContainerClasses=getSellingPlanDropdownIconContainerClasses,exports.getSellingPlanDropdownLabelClasses=getSellingPlanDropdownLabelClasses,exports.getSellingPlanDropdownLabelInnerSpanClasses=getSellingPlanDropdownLabelInnerSpanClasses,exports.getSellingPlanDropdownLabelSpanClasses=getSellingPlanDropdownLabelSpanClasses,exports.getSellingPlanDropdownOptionClasses=getSellingPlanDropdownOptionClasses,exports.getSellingPlanDropdownSelectClasses=getSellingPlanDropdownSelectClasses,exports.getSellingPlanRadioContainerClasses=getSellingPlanRadioContainerClasses,exports.getSellingPlanRadioLabelClasses=getSellingPlanRadioLabelClasses,exports.getSellingPlanRadioOptionTextClasses=getSellingPlanRadioOptionTextClasses,exports.getSellingPlanRadioOptionsClasses=getSellingPlanRadioOptionsClasses,exports.getSubscriptionRadioInputClasses=getSubscriptionRadioInputClasses,exports.getSubscriptionRadioLabelClasses=getSubscriptionRadioLabelClasses,exports.getWrapperClasses=getWrapperClasses;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core"),helper=require("../../../../common/helper.js");const getSubscriptionStyles=e=>{let{width:t}=e??{},r=core.makeStyle({w:t}),l=core.makeStyle({rg:"8px"});return core.filterTruthyStyles({...r,...l})},getSubscriptionWrapperStyles=e=>core.filterTruthyStyles({...core.makeStyle({jc:e??"left"})}),getSellingPlanRadioOptionsStyles=({sellingPlanItemGap:e,sellingType:t})=>{let r=helper.postPurchaseSpacing[e??"tight"]||"9px",l=core.makeStyle({rg:"subscription"===t?r:"9px"});return core.filterTruthyStyles({...l})};exports.getSellingPlanRadioOptionsStyles=getSellingPlanRadioOptionsStyles,exports.getSubscriptionStyles=getSubscriptionStyles,exports.getSubscriptionWrapperStyles=getSubscriptionWrapperStyles;
1
+ "use strict";var core=require("@gem-sdk/core"),helper=require("../../../../common/helper.js");const getSubscriptionStyles=(e,t)=>{let{width:r}=e??{},l=core.makeStyle({w:t?"100%":r}),s=core.makeStyle({rg:"8px"});return core.filterTruthyStyles({...l,...s})},getSubscriptionWrapperStyles=e=>core.filterTruthyStyles({...core.makeStyle({jc:e??"left"})}),getSellingPlanRadioOptionsStyles=({sellingPlanItemGap:e,sellingType:t})=>{let r=helper.postPurchaseSpacing[e??"tight"]||"9px",l=core.makeStyle({rg:"subscription"===t?r:"9px"});return core.filterTruthyStyles({...l})};exports.getSellingPlanRadioOptionsStyles=getSellingPlanRadioOptionsStyles,exports.getSubscriptionStyles=getSubscriptionStyles,exports.getSubscriptionWrapperStyles=getSubscriptionWrapperStyles;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),system=require("@gem-sdk/system"),classes=require("../common/classes.js");const SellingPlanDropdown=({setting:s,sellingPlanOptions:e,selectedValue:l,onChange:a})=>{let{sellingLabel:n}=s??{},t=system.createClass(classes.getSellingPlanDropdownContainerClasses()),r=system.createClass(classes.getSellingPlanDropdownLabelClasses()),i=system.createClass(classes.getSellingPlanDropdownLabelSpanClasses()),c=system.createClass(classes.getSellingPlanDropdownLabelInnerSpanClasses()),o=system.createClass(classes.getSellingPlanDropdownSelectClasses({isNoLabel:""===n})),m=system.createClass(classes.getSellingPlanDropdownOptionClasses()),g=system.createClass(classes.getSellingPlanDropdownIconContainerClasses()),d=system.createClass(classes.getSellingPlanDropdownIconClasses());return jsxRuntime.jsxs("div",{className:t,children:[n&&jsxRuntime.jsx("label",{htmlFor:"selling-plan-select",className:r,children:jsxRuntime.jsx("span",{className:i,children:jsxRuntime.jsx("span",{className:c,children:n})})}),jsxRuntime.jsx("select",{autoComplete:"off",name:"Select Option",className:o,value:l,onChange:s=>a(s.target.value),children:e.map(s=>jsxRuntime.jsx("option",{className:m,value:s.value,children:s.label},s.value))}),jsxRuntime.jsx("div",{className:g,children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",role:"presentation",className:d,children:jsxRuntime.jsx("path",{d:"M0 5h20L10 15"})})})]})};exports.SellingPlanDropdown=SellingPlanDropdown;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),system=require("@gem-sdk/system"),classes=require("../common/classes.js"),core=require("@gem-sdk/core");const SellingPlanDropdown=({setting:e,styles:s,sellingPlanOptions:l,selectedValue:a,onChange:n,isShowRadio:t})=>{let{sellingLabel:r}=e??{},{width:i}=s??{},o=core.makeStyle({w:t?i:void 0}),c=system.createClass(classes.getSellingPlanDropdownContainerClasses()),m=system.createClass(classes.getSellingPlanDropdownLabelClasses()),d=system.createClass(classes.getSellingPlanDropdownLabelSpanClasses()),g=system.createClass(classes.getSellingPlanDropdownLabelInnerSpanClasses()),p=system.createClass(classes.getSellingPlanDropdownSelectClasses({isNoLabel:""===r})),u=system.createClass(classes.getSellingPlanDropdownOptionClasses()),x=system.createClass(classes.getSellingPlanDropdownIconContainerClasses()),j=system.createClass(classes.getSellingPlanDropdownIconClasses());return jsxRuntime.jsxs("div",{className:c,style:{...o},children:[r&&jsxRuntime.jsx("label",{htmlFor:"selling-plan-select",className:m,children:jsxRuntime.jsx("span",{className:d,children:jsxRuntime.jsx("span",{className:g,children:r})})}),jsxRuntime.jsx("select",{autoComplete:"off",name:"Select Option",className:p,value:a,onChange:e=>n(e.target.value),children:l.map(e=>jsxRuntime.jsx("option",{className:u,value:e.value,children:e.label},e.value))}),jsxRuntime.jsx("div",{className:x,children:jsxRuntime.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",role:"presentation",className:j,children:jsxRuntime.jsx("path",{d:"M0 5h20L10 15"})})})]})};exports.SellingPlanDropdown=SellingPlanDropdown;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),Text=require("../../../../text/components/Text.js"),attrs=require("../common/attrs.js"),index=require("../../../constants/index.js");const SellingPlanLabel=({setting:e,styles:t})=>{let{sellingTitle:s,sellingTitleOneTime:n,sellingType:l}=e??{},r=l===index.SubscriptionEnum.ONE_TIME,a=r?n:s,{typo:i,textAlign:x,direction:u}=attrs.getSellingPlanLabelAttrs({styles:t,sellingType:l});return jsxRuntime.jsx(Text.default,{className:"gp-flex-1",textClassWrapper:"gp-leading-[24px]",styles:{typo:i,textAlign:x,direction:u},setting:{text:a}})};exports.SellingPlanLabel=SellingPlanLabel;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),Text=require("../../../../text/components/Text.js"),attrs=require("../common/attrs.js"),index=require("../../../constants/index.js"),core=require("@gem-sdk/core");const SellingPlanLabel=({setting:e,styles:t,isShowRadio:s})=>{let{sellingTitle:n,sellingTitleOneTime:r,sellingType:l}=e??{},{width:i}=t??{},a=core.makeStyle({w:s?i:"100%"}),x=l===index.SubscriptionEnum.ONE_TIME,u=x?r:n,{typo:m,textAlign:c,direction:g}=attrs.getSellingPlanLabelAttrs({styles:t,sellingType:l});return jsxRuntime.jsx(jsxRuntime.Fragment,{children:jsxRuntime.jsx("div",{style:{...a},children:jsxRuntime.jsx(Text.default,{className:"gp-flex-1",textClassWrapper:"gp-leading-[24px]",styles:{typo:m,textAlign:c,direction:g},setting:{text:u}})})})};exports.SellingPlanLabel=SellingPlanLabel;
@@ -1 +1 @@
1
- "use strict";var jsxRuntime=require("react/jsx-runtime"),system=require("@gem-sdk/system"),SubscriptionRadio=require("./SubscriptionRadio.js"),classes=require("../common/classes.js"),styles=require("../common/styles.js");const SellingPlanRadio=({setting:s,styles:e,productId:l,sellingPlanOptions:a,builderProps:i,selectedValue:n,onChange:t})=>{let{sellingLabel:r}=s??{},{uid:c}=i??{},o=system.createClass(classes.getSellingPlanRadioContainerClasses()),m=system.createClass(classes.getSellingPlanRadioLabelClasses()),u=system.createClass(classes.getSellingPlanRadioOptionsClasses()),d=system.createClass(classes.getSellingPlanRadioOptionTextClasses()),g=styles.getSellingPlanRadioOptionsStyles({sellingPlanItemGap:e?.sellingPlanItemGap,sellingType:s?.sellingType});return jsxRuntime.jsxs("div",{className:o,style:g,children:[r&&jsxRuntime.jsx("label",{className:m,children:r}),jsxRuntime.jsx("div",{className:u,style:g,children:a.map(s=>jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{name:`${l}-selling-plan-options-${c??""}`,value:s.value,checked:n===s.value,onChange:s=>t(s.target.value),children:jsxRuntime.jsx("span",{className:d,children:s.label})},`${l}-${s.value}-${c??""}`))})]})};exports.SellingPlanRadio=SellingPlanRadio;
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),system=require("@gem-sdk/system"),SubscriptionRadio=require("./SubscriptionRadio.js"),classes=require("../common/classes.js"),styles=require("../common/styles.js"),core=require("@gem-sdk/core");const SellingPlanRadio=({setting:e,styles:s,productId:l,sellingPlanOptions:a,builderProps:i,selectedValue:n,isShowRadio:t,onChange:r})=>{let{sellingLabel:c}=e??{},{width:o}=s??{},m=core.makeStyle({w:t?o:"100%"}),{uid:u}=i??{},d=system.createClass(classes.getSellingPlanRadioContainerClasses()),g=system.createClass(classes.getSellingPlanRadioLabelClasses()),R=system.createClass(classes.getSellingPlanRadioOptionsClasses()),p=system.createClass(classes.getSellingPlanRadioOptionTextClasses()),y=styles.getSellingPlanRadioOptionsStyles({sellingPlanItemGap:s?.sellingPlanItemGap,sellingType:e?.sellingType});return jsxRuntime.jsxs("div",{className:d,style:{...y,...m},children:[c&&jsxRuntime.jsx("label",{className:g,children:c}),jsxRuntime.jsx("div",{className:R,style:y,children:a.map(e=>jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{name:`${l}-selling-plan-options-${u??""}`,value:e.value,checked:n===e.value,onChange:e=>r(e.target.value),children:jsxRuntime.jsx("span",{className:p,children:e.label})},`${l}-${e.value}-${u??""}`))})]})};exports.SellingPlanRadio=SellingPlanRadio;
@@ -1 +1 @@
1
- "use strict";var constants=require("../../../../common/constants.js");const ProductSubscriptionSettings=[{id:"setting",controls:[{id:"sellingType",label:"Type",type:"pick-subscription",options:[{value:"one-time",label:"One-time purchase"},{value:"subscription",label:"Subscription"}],default:"subscription"},{id:"sellingPlans",label:"Source",type:"selling-plan"},{id:"sellingTitle",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Subscribe and save up to {total_discount}",suggestContents:[{message:"{total_discount}",eg:"E.g: 50%"},{message:"{offer_discount}",eg:"E.g: 20%"},{message:"{selling_plan_max_discount}",eg:"E.g: 15%"}]},{id:"sellingLabel",label:"Text",type:"input",default:"Purchase options",placeholder:"E.g. Purchase options",action:{clear:!0}},{id:"sellingTitleOneTime",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"One-time purchase",suggestContents:[]},{id:"sellingStyle",label:"Style",type:"option:illustration",default:"dropdown",options:[{label:"Dropdown",value:"dropdown",svgName:"gp-selling-plan-dropdown"},{label:"Radio",value:"radio",svgName:"gp-selling-plan-radio"}]},{id:"subscriptionLabel",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Delivery every {selling_plan_delivery_frequency}, save {selling_plan_discount}",suggestContents:[{message:"{selling_plan_delivery_frequency}",eg:"E.g: every week"},{message:"{selling_plan_discount}",eg:"E.g: 10%"},{message:"{selling_plan_billing_cycle}",eg:"E.g: every 1 month"}]},{id:"enableSubscriptionDetail",label:"Enable subscription detail",type:"toggle",default:!1}]},{id:"style",controls:[{id:"sellingTitleDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingTitleOneTimeDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"subscriptionDetailDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingPlanItemGap",type:"select",label:"Item gap",options:constants.postPurchaseSpacing,default:"tight"},{id:"sellingTitleTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"sellingTitleOneTimeTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleOneTimeAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"subscriptionDetailTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"default",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"subscriptionDetailAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,default:"100%",displayOptions:[{label:"Fit content",value:"Auto",showValue:!0},{label:"Full",value:"100%",showValue:!0}]},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],default:"left"}]}];exports.ProductSubscriptionSettings=ProductSubscriptionSettings;
1
+ "use strict";var constants=require("../../../../common/constants.js");const ProductSubscriptionSettings=[{id:"setting",controls:[{id:"sellingType",label:"Type",type:"pick-subscription",options:[{value:"one-time",label:"One-time purchase"},{value:"subscription",label:"Subscription"}],default:"subscription"},{id:"sellingPlans",label:"Source",type:"selling-plan"},{id:"sellingTitle",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Subscribe and save up to {total_discount}",suggestContents:[{message:"{total_discount}",eg:"E.g: 50%"},{message:"{offer_discount}",eg:"E.g: 20%"},{message:"{selling_plan_max_discount}",eg:"E.g: 15%"}]},{id:"sellingLabel",label:"Text",type:"input",default:"Purchase options",placeholder:"E.g. Purchase options",action:{clear:!0}},{id:"sellingTitleOneTime",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"One-time purchase",suggestContents:[]},{id:"sellingStyle",label:"Style",type:"option:illustration",default:"dropdown",options:[{label:"Dropdown",value:"dropdown",svgName:"gp-selling-plan-dropdown"},{label:"Radio",value:"radio",svgName:"gp-selling-plan-radio"}]},{id:"subscriptionLabel",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Delivery every {selling_plan_delivery_frequency}, save {selling_plan_discount}",suggestContents:[{message:"{selling_plan_delivery_frequency}",eg:"E.g: every week"},{message:"{selling_plan_discount}",eg:"E.g: 10%"},{message:"{selling_plan_billing_cycle}",eg:"E.g: every 1 month"}]},{id:"enableSubscriptionDetail",label:"Enable subscription detail",type:"toggle",default:!1}]},{id:"style",controls:[{id:"sellingTitleDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingTitleOneTimeDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"subscriptionDetailDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingPlanItemGap",type:"select",label:"Item gap",options:constants.postPurchaseSpacing,default:"tight"},{id:"sellingTitleTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"sellingTitleOneTimeTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleOneTimeAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"subscriptionDetailTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"default",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"subscriptionDetailAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,default:"100%",displayOptions:[{label:"Full",value:"100%",showValue:!0}]},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],default:"left"}]}];exports.ProductSubscriptionSettings=ProductSubscriptionSettings;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as s,Fragment as i}from"react/jsx-runtime";import{useProduct as t,usePageStore as o,useRenderMode as l,filterToolbarPreview as n}from"@gem-sdk/core";import{createStyle as r,createClass as m}from"@gem-sdk/system";import{useRef as c,useId as a,useEffect as p}from"react";import{SubscriptionEnum as d}from"../../constants/index.js";import{getWrapperClasses as u,getContainerClasses as g}from"./common/classes.js";import{getSubscriptionStyles as h,getSubscriptionWrapperStyles as f}from"./common/styles.js";import{useSellingPlanChange as S}from"./hooks/useSellingPlanChange.js";import{useSellingSubscription as y}from"./hooks/useSellingSubscription.js";import{useSellingPlanOptions as b}from"./hooks/useSellingPlanOptions.js";import{useSubscriptionVisibility as I}from"./hooks/useSubscriptionVisibility.js";import{OneTimePurchaseTooltip as N}from"./components/OneTimePurchaseTooltip.js";import{SellingPlanDropdown as P}from"./components/SellingPlanDropdown.js";import{SellingPlanLabel as j}from"./components/SellingPlanLabel.js";import{SellingPlanRadio as T}from"./components/SellingPlanRadio.js";import{SubscriptionDetail as O}from"./components/SubscriptionDetail.js";import{SubscriptionRadio as k}from"./components/SubscriptionRadio.js";import{useDynamicProduct as v}from"../../hooks/useDynamicProduct.js";let ProductSubscription=({styles:C,setting:E,builderProps:R,builderAttrs:$,style:B,children:D})=>{let U=t(),V=o(e=>e.setSubscriptionVisible),M=o(e=>e.getSubscriptionVisible),{defaultValue:_,selectedSellingPlan:x,setSelectedSellingPlan:w}=y(E),L=b(E),{selectedValue:q,handleSellingPlanChange:z}=S({defaultValue:_,selectedSellingPlan:x,setSelectedSellingPlan:w,sellingPlanOptions:L}),A=c(null),F=a(),{selectedType:G,shouldShowRadio:H,isOneTimeHidden:J,hasNoSellingPlanOptions:K,setSubscriptionSellingType:Q}=I({setting:E}),W=r(h(C)),X=r(f(C?.align)),Y=m(u()),Z=m(g()),ee=r({...B}),{isEditMode:es}=l(),ei=`product-subscription-${U?.baseID}`,et=U?.baseID,eo=`subscription-type-selection-${F}`,el=E?.sellingType===d.ONE_TIME,en=E?.sellingType===d.SUBSCRIPTION,{isDynamicProduct:er}=v();if(p(()=>{if(!U?.id||!en)return;let e=U?.id,s=`${R?.uid}-${e}`,i=!(K||er),t=M()??{};if(!i){V({...t,[e]:(t[e]??[]).filter(e=>e!==s)});return}V({...t,[e]:[...t[e]??[],s]})},[R?.uid,M,K,er,en,U?.id,V]),J||K||er)return es?e("div",{...$,style:ee,children:[s(N,{ref:A,setting:E}),n(D,!0)]}):null;let em=i=>e("div",{...$,style:ee,children:[s("div",{ref:A,"data-selling-type":E?.sellingType,id:ei,className:Y,style:X,children:i}),n(D,!0)]}),ec=()=>s(i,{children:E?.sellingStyle==="radio"?s(T,{setting:E,styles:C,builderProps:R,productId:et??"",sellingPlanOptions:L,selectedValue:q,onChange:z}):s(P,{setting:E,sellingPlanOptions:L,selectedValue:q,onChange:z})});return em(el&&H?s("div",{className:Z,style:W,children:s(k,{id:`${et}-one-time-radio`,name:eo,value:d.ONE_TIME,checked:G===d.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&Q(d.ONE_TIME)},children:s(j,{setting:E,styles:C})})}):en&&H?e("div",{className:Z,style:W,children:[s(k,{id:`${et}-subscription-radio`,name:eo,value:d.SUBSCRIPTION,checked:G===d.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&Q(d.SUBSCRIPTION)},children:s(j,{setting:E,styles:C})}),G===d.SUBSCRIPTION&&e(i,{children:[s("div",{className:"gp-pl-7",children:ec()}),s("div",{className:"gp-pl-7",children:s(O,{setting:E,styles:C})})]})]}):e("div",{className:Z,style:W,children:[s(j,{setting:E,styles:C}),en&&ec(),en&&s(O,{setting:E,styles:C})]}))};export{ProductSubscription as default};
1
+ import{jsxs as e,jsx as i,Fragment as s}from"react/jsx-runtime";import{useProduct as t,usePageStore as o,useRenderMode as l,filterToolbarPreview as n}from"@gem-sdk/core";import{createStyle as r,createClass as m}from"@gem-sdk/system";import{useRef as a,useId as c,useEffect as d}from"react";import{SubscriptionEnum as p}from"../../constants/index.js";import{getWrapperClasses as u,getContainerClasses as g}from"./common/classes.js";import{getSubscriptionStyles as h,getSubscriptionWrapperStyles as S}from"./common/styles.js";import{useSellingPlanChange as f}from"./hooks/useSellingPlanChange.js";import{useSellingSubscription as y}from"./hooks/useSellingSubscription.js";import{useSellingPlanOptions as b}from"./hooks/useSellingPlanOptions.js";import{useSubscriptionVisibility as I}from"./hooks/useSubscriptionVisibility.js";import{OneTimePurchaseTooltip as N}from"./components/OneTimePurchaseTooltip.js";import{SellingPlanDropdown as P}from"./components/SellingPlanDropdown.js";import{SellingPlanLabel as j}from"./components/SellingPlanLabel.js";import{SellingPlanRadio as T}from"./components/SellingPlanRadio.js";import{SubscriptionDetail as O}from"./components/SubscriptionDetail.js";import{SubscriptionRadio as R}from"./components/SubscriptionRadio.js";import{useDynamicProduct as k}from"../../hooks/useDynamicProduct.js";let ProductSubscription=({styles:v,setting:C,builderProps:E,builderAttrs:w,style:$,children:B})=>{let D=t(),U=o(e=>e.setSubscriptionVisible),V=o(e=>e.getSubscriptionVisible),{defaultValue:M,selectedSellingPlan:_,setSelectedSellingPlan:x}=y(C),L=b(C),{selectedValue:q,handleSellingPlanChange:z}=f({defaultValue:M,selectedSellingPlan:_,setSelectedSellingPlan:x,sellingPlanOptions:L}),A=a(null),F=c(),{selectedType:G,shouldShowRadio:H,isOneTimeHidden:J,hasNoSellingPlanOptions:K,setSubscriptionSellingType:Q}=I({setting:C}),W=r(h(v,H)),X=r(S(v?.align)),Y=m(u()),Z=m(g()),ee=r({...$}),{isEditMode:ei}=l(),es=`product-subscription-${D?.baseID}`,et=D?.baseID,eo=`subscription-type-selection-${F}`,el=C?.sellingType===p.ONE_TIME,en=C?.sellingType===p.SUBSCRIPTION,{isDynamicProduct:er}=k();if(d(()=>{if(!D?.id||!en)return;let e=D?.id,i=`${E?.uid}-${e}`,s=!(K||er),t=V()??{};if(!s){U({...t,[e]:(t[e]??[]).filter(e=>e!==i)});return}U({...t,[e]:[...t[e]??[],i]})},[E?.uid,V,K,er,en,D?.id,U]),J||K||er)return ei?e("div",{...w,style:ee,children:[i(N,{ref:A,setting:C}),n(B,!0)]}):null;let em=s=>e("div",{...w,style:ee,children:[i("div",{ref:A,"data-selling-type":C?.sellingType,id:es,className:Y,style:X,children:s}),n(B,!0)]}),ea=()=>i(s,{children:C?.sellingStyle==="radio"?i(T,{setting:C,styles:v,builderProps:E,productId:et??"",sellingPlanOptions:L,selectedValue:q,isShowRadio:H,onChange:z}):i(P,{setting:C,styles:v,sellingPlanOptions:L,selectedValue:q,isShowRadio:H,onChange:z})});return em(el&&H?i("div",{className:Z,style:W,children:i(R,{id:`${et}-one-time-radio`,name:eo,value:p.ONE_TIME,checked:G===p.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&Q(p.ONE_TIME)},children:i(j,{setting:C,styles:v,isShowRadio:H})})}):en&&H?e("div",{className:Z,style:W,children:[i(R,{id:`${et}-subscription-radio`,name:eo,value:p.SUBSCRIPTION,checked:G===p.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&Q(p.SUBSCRIPTION)},children:i(j,{setting:C,styles:v,isShowRadio:H})}),G===p.SUBSCRIPTION&&e(s,{children:[i("div",{className:"gp-pl-7",children:ea()}),i("div",{className:"gp-pl-7",children:i(O,{setting:C,styles:v})})]})]}):e("div",{className:Z,style:W,children:[i(j,{setting:C,styles:v,isShowRadio:H}),en&&ea(),en&&i(O,{setting:C,styles:v})]}))};export{ProductSubscription as default};
@@ -1 +1 @@
1
- import{composeClasses as e}from"@gem-sdk/core";let getWrapperClasses=()=>e("gp-flex gp-gap-x-[10px] gap-[10px]"),getContainerClasses=()=>e("gp-flex gp-flex-col"),getSellingPlanRadioContainerClasses=()=>e("gp-relative gp-flex gp-flex-col"),getSellingPlanRadioLabelClasses=()=>e("gp-text-xs gp-leading-[1.3]"),getSellingPlanRadioOptionsClasses=()=>e("gp-flex gp-flex-col"),getSellingPlanRadioOptionTextClasses=()=>e("gp-text-[14px] gp-leading-[1.3] gp-text-[#545454]"),getSubscriptionRadioLabelClasses=p=>{let g=p?"gp-opacity-50 gp-cursor-not-allowed":"";return e(`gp-flex gp-items-center gp-cursor-pointer gp-gap-2 ${g}`.trim())},getSubscriptionRadioInputClasses=()=>e("gp-relative gp-min-h-[18px] gp-min-w-[18px] gp-mt-[3px] gp-w-4 gp-h-4 gp-cursor-pointer gp-appearance-none gp-rounded-full gp-bg-light-100 gp-transition-all gp-border-light-500 gp-border-2 checked:gp-border-[#1879b9] checked:gp-border-[6px] checked:gp-after:gp-content-[''] checked:gp-after:gp-absolute checked:gp-after:gp-top-1/2 checked:gp-after:gp-left-1/2 checked:gp-after:gp-transform checked:gp-after:gp--translate-x-1/2 checked:gp-after:gp--translate-y-1/2 checked:gp-after:gp-h-2 checked:gp-after:gp-w-2 checked:gp-after:gp-rounded-full checked:gp-after:gp-bg-white disabled:gp-cursor-not-allowed"),getSellingPlanDropdownContainerClasses=()=>e("gp-relative"),getSellingPlanDropdownLabelClasses=()=>e("!gp-max-w-[calc(100%_-_66px)] gp-absolute gp-left-[12px] gp-top-[6px] gp-p-0 gp-text-xs gp-leading-[1.3] gp-text-[#737373] gp-transition-[top]"),getSellingPlanDropdownLabelSpanClasses=()=>e("gp-max-w-full"),getSellingPlanDropdownLabelInnerSpanClasses=()=>e("gp-block gp-overflow-hidden"),getSellingPlanDropdownSelectClasses=({isNoLabel:p=!1})=>e(`gp-min-h-[47px] gp-appearance-none gp-bg-transparent gp-w-full gp-whitespace-nowrap gp-rounded-[5px] gp-border gp-border-[#d9d9d9] gp-pl-[11px] gp-pr-[40px] gp-text-[14px] gp-outline-none gp-text-[#545454] gp-leading-[1.3] ${p?"gp-pt-0 gp-pb-0":"gp-pt-[21px] gp-pb-[6px]"}`),getSellingPlanDropdownOptionClasses=()=>e("gp-text-[14px] gp-text-black"),getSellingPlanDropdownIconContainerClasses=()=>e("gp-pointer-events-none gp-absolute gp-right-[2px] gp-top-[50%] gp-flex gp-h-[43%] gp-w-[40px] gp-translate-y-[-50%] gp-items-center gp-justify-center gp-border-l-[1px] gp-bg-white gp-border-[#545454]"),getSellingPlanDropdownIconClasses=()=>e("gp-h-[10px] gp-w-[10px]");export{getContainerClasses,getSellingPlanDropdownContainerClasses,getSellingPlanDropdownIconClasses,getSellingPlanDropdownIconContainerClasses,getSellingPlanDropdownLabelClasses,getSellingPlanDropdownLabelInnerSpanClasses,getSellingPlanDropdownLabelSpanClasses,getSellingPlanDropdownOptionClasses,getSellingPlanDropdownSelectClasses,getSellingPlanRadioContainerClasses,getSellingPlanRadioLabelClasses,getSellingPlanRadioOptionTextClasses,getSellingPlanRadioOptionsClasses,getSubscriptionRadioInputClasses,getSubscriptionRadioLabelClasses,getWrapperClasses};
1
+ import{composeClasses as e}from"@gem-sdk/core";let getWrapperClasses=()=>e("gp-flex gp-gap-x-[10px] gap-[10px]"),getContainerClasses=()=>e("gp-flex gp-flex-col"),getSellingPlanRadioContainerClasses=()=>e("gp-relative gp-flex gp-flex-col"),getSellingPlanRadioLabelClasses=()=>e("gp-text-xs gp-leading-[1.3]"),getSellingPlanRadioOptionsClasses=()=>e("gp-flex gp-flex-col"),getSellingPlanRadioOptionTextClasses=()=>e("gp-text-[14px] gp-leading-[1.3] gp-text-[#545454]"),getSubscriptionRadioLabelClasses=p=>{let g=p?"gp-opacity-50 gp-cursor-not-allowed":"";return e(`gp-flex gp-items-center gp-cursor-pointer gp-gap-2 ${g}`.trim())},getSubscriptionRadioInputClasses=()=>e("gp-relative gp-min-h-[18px] gp-min-w-[18px] gp-mt-[3px] gp-w-4 gp-h-4 gp-cursor-pointer gp-appearance-none gp-rounded-full gp-bg-light-100 gp-transition-all gp-border-light-500 gp-border-2 checked:gp-border-[#1879b9] checked:gp-border-[6px] checked:gp-after:gp-content-[''] checked:gp-after:gp-absolute checked:gp-after:gp-top-1/2 checked:gp-after:gp-left-1/2 checked:gp-after:gp-transform checked:gp-after:gp--translate-x-1/2 checked:gp-after:gp--translate-y-1/2 checked:gp-after:gp-h-2 checked:gp-after:gp-w-2 checked:gp-after:gp-rounded-full checked:gp-after:gp-bg-white disabled:gp-cursor-not-allowed"),getSellingPlanDropdownContainerClasses=()=>e("gp-relative"),getSellingPlanDropdownLabelClasses=()=>e("!gp-max-w-[calc(100%_-_66px)] gp-absolute gp-left-[12px] gp-top-[6px] gp-p-0 gp-text-xs gp-leading-[1.3] gp-text-[#737373] gp-transition-[top]"),getSellingPlanDropdownLabelSpanClasses=()=>e("gp-max-w-full"),getSellingPlanDropdownLabelInnerSpanClasses=()=>e("gp-block gp-overflow-hidden gp-truncate"),getSellingPlanDropdownSelectClasses=({isNoLabel:p=!1})=>e(`gp-min-h-[47px] gp-appearance-none gp-bg-transparent gp-w-full gp-whitespace-nowrap gp-rounded-[5px] gp-border gp-border-[#d9d9d9] gp-pl-[11px] gp-pr-[40px] gp-text-[14px] gp-outline-none gp-text-[#545454] gp-leading-[1.3] ${p?"gp-pt-0 gp-pb-0":"gp-pt-[21px] gp-pb-[6px]"}`),getSellingPlanDropdownOptionClasses=()=>e("gp-text-[14px] gp-text-black"),getSellingPlanDropdownIconContainerClasses=()=>e("gp-pointer-events-none gp-absolute gp-right-[2px] gp-top-[50%] gp-flex gp-h-[43%] gp-w-[40px] gp-translate-y-[-50%] gp-items-center gp-justify-center gp-border-l-[1px] gp-bg-white gp-border-[#545454]"),getSellingPlanDropdownIconClasses=()=>e("gp-h-[10px] gp-w-[10px]");export{getContainerClasses,getSellingPlanDropdownContainerClasses,getSellingPlanDropdownIconClasses,getSellingPlanDropdownIconContainerClasses,getSellingPlanDropdownLabelClasses,getSellingPlanDropdownLabelInnerSpanClasses,getSellingPlanDropdownLabelSpanClasses,getSellingPlanDropdownOptionClasses,getSellingPlanDropdownSelectClasses,getSellingPlanRadioContainerClasses,getSellingPlanRadioLabelClasses,getSellingPlanRadioOptionTextClasses,getSellingPlanRadioOptionsClasses,getSubscriptionRadioInputClasses,getSubscriptionRadioLabelClasses,getWrapperClasses};
@@ -1 +1 @@
1
- import{makeStyle as t,filterTruthyStyles as e}from"@gem-sdk/core";import{postPurchaseSpacing as r}from"../../../../common/helper.js";let getSubscriptionStyles=r=>{let{width:i}=r??{},p=t({w:i}),l=t({rg:"8px"});return e({...p,...l})},getSubscriptionWrapperStyles=r=>e({...t({jc:r??"left"})}),getSellingPlanRadioOptionsStyles=({sellingPlanItemGap:i,sellingType:p})=>{let l=r[i??"tight"]||"9px",o=t({rg:"subscription"===p?l:"9px"});return e({...o})};export{getSellingPlanRadioOptionsStyles,getSubscriptionStyles,getSubscriptionWrapperStyles};
1
+ import{makeStyle as t,filterTruthyStyles as e}from"@gem-sdk/core";import{postPurchaseSpacing as r}from"../../../../common/helper.js";let getSubscriptionStyles=(r,i)=>{let{width:p}=r??{},l=t({w:i?"100%":p}),o=t({rg:"8px"});return e({...l,...o})},getSubscriptionWrapperStyles=r=>e({...t({jc:r??"left"})}),getSellingPlanRadioOptionsStyles=({sellingPlanItemGap:i,sellingType:p})=>{let l=r[i??"tight"]||"9px",o=t({rg:"subscription"===p?l:"9px"});return e({...o})};export{getSellingPlanRadioOptionsStyles,getSubscriptionStyles,getSubscriptionWrapperStyles};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as l}from"react/jsx-runtime";import{createClass as a}from"@gem-sdk/system";import{getSellingPlanDropdownContainerClasses as s,getSellingPlanDropdownLabelClasses as n,getSellingPlanDropdownLabelSpanClasses as r,getSellingPlanDropdownLabelInnerSpanClasses as o,getSellingPlanDropdownSelectClasses as t,getSellingPlanDropdownOptionClasses as i,getSellingPlanDropdownIconContainerClasses as m,getSellingPlanDropdownIconClasses as c}from"../common/classes.js";let SellingPlanDropdown=({setting:d,sellingPlanOptions:p,selectedValue:h,onChange:u})=>{let{sellingLabel:v}=d??{},g=a(s()),N=a(n()),f=a(r()),w=a(o()),b=a(t({isNoLabel:""===v})),x=a(i()),S=a(m()),j=a(c());return e("div",{className:g,children:[v&&l("label",{htmlFor:"selling-plan-select",className:N,children:l("span",{className:f,children:l("span",{className:w,children:v})})}),l("select",{autoComplete:"off",name:"Select Option",className:b,value:h,onChange:e=>u(e.target.value),children:p.map(e=>l("option",{className:x,value:e.value,children:e.label},e.value))}),l("div",{className:S,children:l("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",role:"presentation",className:j,children:l("path",{d:"M0 5h20L10 15"})})})]})};export{SellingPlanDropdown};
1
+ import{jsxs as e,jsx as l}from"react/jsx-runtime";import{createClass as a}from"@gem-sdk/system";import{getSellingPlanDropdownContainerClasses as s,getSellingPlanDropdownLabelClasses as o,getSellingPlanDropdownLabelSpanClasses as r,getSellingPlanDropdownLabelInnerSpanClasses as n,getSellingPlanDropdownSelectClasses as t,getSellingPlanDropdownOptionClasses as m,getSellingPlanDropdownIconContainerClasses as i,getSellingPlanDropdownIconClasses as c}from"../common/classes.js";import{makeStyle as d}from"@gem-sdk/core";let SellingPlanDropdown=({setting:p,styles:h,sellingPlanOptions:v,selectedValue:g,onChange:u,isShowRadio:N})=>{let{sellingLabel:f}=p??{},{width:w}=h??{},b=d({w:N?w:void 0}),x=a(s()),S=a(o()),j=a(r()),k=a(n()),y=a(t({isNoLabel:""===f})),C=a(m()),D=a(i()),L=a(c());return e("div",{className:x,style:{...b},children:[f&&l("label",{htmlFor:"selling-plan-select",className:S,children:l("span",{className:j,children:l("span",{className:k,children:f})})}),l("select",{autoComplete:"off",name:"Select Option",className:y,value:g,onChange:e=>u(e.target.value),children:v.map(e=>l("option",{className:C,value:e.value,children:e.label},e.value))}),l("div",{className:D,children:l("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",focusable:"false","aria-hidden":"true",role:"presentation",className:L,children:l("path",{d:"M0 5h20L10 15"})})})]})};export{SellingPlanDropdown};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import t from"../../../../text/components/Text.js";import{getSellingPlanLabelAttrs as l}from"../common/attrs.js";import{SubscriptionEnum as r}from"../../../constants/index.js";let SellingPlanLabel=({setting:s,styles:n})=>{let{sellingTitle:o,sellingTitleOneTime:m,sellingType:a}=s??{},p=a===r.ONE_TIME,i=p?m:o,{typo:x,textAlign:g,direction:c}=l({styles:n,sellingType:a});return e(t,{className:"gp-flex-1",textClassWrapper:"gp-leading-[24px]",styles:{typo:x,textAlign:g,direction:c},setting:{text:i}})};export{SellingPlanLabel};
1
+ import{jsx as e,Fragment as t}from"react/jsx-runtime";import r from"../../../../text/components/Text.js";import{getSellingPlanLabelAttrs as l}from"../common/attrs.js";import{SubscriptionEnum as s}from"../../../constants/index.js";import{makeStyle as n}from"@gem-sdk/core";let SellingPlanLabel=({setting:o,styles:m,isShowRadio:i})=>{let{sellingTitle:p,sellingTitleOneTime:a,sellingType:c}=o??{},{width:g}=m??{},x=n({w:i?g:"100%"}),d=c===s.ONE_TIME,f=d?a:p,{typo:j,textAlign:y,direction:T}=l({styles:m,sellingType:c});return e(t,{children:e("div",{style:{...x},children:e(r,{className:"gp-flex-1",textClassWrapper:"gp-leading-[24px]",styles:{typo:j,textAlign:y,direction:T},setting:{text:f}})})})};export{SellingPlanLabel};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as l}from"react/jsx-runtime";import{createClass as a}from"@gem-sdk/system";import{SubscriptionRadio as s}from"./SubscriptionRadio.js";import{getSellingPlanRadioContainerClasses as i,getSellingPlanRadioLabelClasses as n,getSellingPlanRadioOptionsClasses as m,getSellingPlanRadioOptionTextClasses as o}from"../common/classes.js";import{getSellingPlanRadioOptionsStyles as r}from"../common/styles.js";let SellingPlanRadio=({setting:t,styles:c,productId:p,sellingPlanOptions:d,builderProps:g,selectedValue:u,onChange:h})=>{let{sellingLabel:v}=t??{},{uid:y}=g??{},f=a(i()),$=a(n()),j=a(m()),N=a(o()),P=r({sellingPlanItemGap:c?.sellingPlanItemGap,sellingType:t?.sellingType});return e("div",{className:f,style:P,children:[v&&l("label",{className:$,children:v}),l("div",{className:j,style:P,children:d.map(e=>l(s,{name:`${p}-selling-plan-options-${y??""}`,value:e.value,checked:u===e.value,onChange:e=>h(e.target.value),children:l("span",{className:N,children:e.label})},`${p}-${e.value}-${y??""}`))})]})};export{SellingPlanRadio};
1
+ import{jsxs as e,jsx as l}from"react/jsx-runtime";import{createClass as a}from"@gem-sdk/system";import{SubscriptionRadio as s}from"./SubscriptionRadio.js";import{getSellingPlanRadioContainerClasses as i,getSellingPlanRadioLabelClasses as m,getSellingPlanRadioOptionsClasses as n,getSellingPlanRadioOptionTextClasses as o}from"../common/classes.js";import{getSellingPlanRadioOptionsStyles as r}from"../common/styles.js";import{makeStyle as t}from"@gem-sdk/core";let SellingPlanRadio=({setting:c,styles:p,productId:d,sellingPlanOptions:g,builderProps:u,selectedValue:h,isShowRadio:v,onChange:f})=>{let{sellingLabel:y}=c??{},{width:$}=p??{},j=t({w:v?$:"100%"}),{uid:N}=u??{},P=a(i()),b=a(m()),k=a(n()),R=a(o()),S=r({sellingPlanItemGap:p?.sellingPlanItemGap,sellingType:c?.sellingType});return e("div",{className:P,style:{...S,...j},children:[y&&l("label",{className:b,children:y}),l("div",{className:k,style:S,children:g.map(e=>l(s,{name:`${d}-selling-plan-options-${N??""}`,value:e.value,checked:h===e.value,onChange:e=>f(e.target.value),children:l("span",{className:R,children:e.label})},`${d}-${e.value}-${N??""}`))})]})};export{SellingPlanRadio};
@@ -1 +1 @@
1
- import{postPurchaseSpacing as e}from"../../../../common/constants.js";let ProductSubscriptionSettings=[{id:"setting",controls:[{id:"sellingType",label:"Type",type:"pick-subscription",options:[{value:"one-time",label:"One-time purchase"},{value:"subscription",label:"Subscription"}],default:"subscription"},{id:"sellingPlans",label:"Source",type:"selling-plan"},{id:"sellingTitle",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Subscribe and save up to {total_discount}",suggestContents:[{message:"{total_discount}",eg:"E.g: 50%"},{message:"{offer_discount}",eg:"E.g: 20%"},{message:"{selling_plan_max_discount}",eg:"E.g: 15%"}]},{id:"sellingLabel",label:"Text",type:"input",default:"Purchase options",placeholder:"E.g. Purchase options",action:{clear:!0}},{id:"sellingTitleOneTime",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"One-time purchase",suggestContents:[]},{id:"sellingStyle",label:"Style",type:"option:illustration",default:"dropdown",options:[{label:"Dropdown",value:"dropdown",svgName:"gp-selling-plan-dropdown"},{label:"Radio",value:"radio",svgName:"gp-selling-plan-radio"}]},{id:"subscriptionLabel",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Delivery every {selling_plan_delivery_frequency}, save {selling_plan_discount}",suggestContents:[{message:"{selling_plan_delivery_frequency}",eg:"E.g: every week"},{message:"{selling_plan_discount}",eg:"E.g: 10%"},{message:"{selling_plan_billing_cycle}",eg:"E.g: every 1 month"}]},{id:"enableSubscriptionDetail",label:"Enable subscription detail",type:"toggle",default:!1}]},{id:"style",controls:[{id:"sellingTitleDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingTitleOneTimeDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"subscriptionDetailDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingPlanItemGap",type:"select",label:"Item gap",options:e,default:"tight"},{id:"sellingTitleTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"sellingTitleOneTimeTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleOneTimeAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"subscriptionDetailTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"default",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"subscriptionDetailAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,default:"100%",displayOptions:[{label:"Fit content",value:"Auto",showValue:!0},{label:"Full",value:"100%",showValue:!0}]},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],default:"left"}]}];export{ProductSubscriptionSettings};
1
+ import{postPurchaseSpacing as e}from"../../../../common/constants.js";let ProductSubscriptionSettings=[{id:"setting",controls:[{id:"sellingType",label:"Type",type:"pick-subscription",options:[{value:"one-time",label:"One-time purchase"},{value:"subscription",label:"Subscription"}],default:"subscription"},{id:"sellingPlans",label:"Source",type:"selling-plan"},{id:"sellingTitle",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Subscribe and save up to {total_discount}",suggestContents:[{message:"{total_discount}",eg:"E.g: 50%"},{message:"{offer_discount}",eg:"E.g: 20%"},{message:"{selling_plan_max_discount}",eg:"E.g: 15%"}]},{id:"sellingLabel",label:"Text",type:"input",default:"Purchase options",placeholder:"E.g. Purchase options",action:{clear:!0}},{id:"sellingTitleOneTime",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"One-time purchase",suggestContents:[]},{id:"sellingStyle",label:"Style",type:"option:illustration",default:"dropdown",options:[{label:"Dropdown",value:"dropdown",svgName:"gp-selling-plan-dropdown"},{label:"Radio",value:"radio",svgName:"gp-selling-plan-radio"}]},{id:"subscriptionLabel",label:"Text",type:"textarea",defaultRows:4,showPlusBtn:!0,autoHeight:!0,minHeight:72,default:"Delivery every {selling_plan_delivery_frequency}, save {selling_plan_discount}",suggestContents:[{message:"{selling_plan_delivery_frequency}",eg:"E.g: every week"},{message:"{selling_plan_discount}",eg:"E.g: 10%"},{message:"{selling_plan_billing_cycle}",eg:"E.g: every 1 month"}]},{id:"enableSubscriptionDetail",label:"Enable subscription detail",type:"toggle",default:!1}]},{id:"style",controls:[{id:"sellingTitleDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingTitleOneTimeDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"subscriptionDetailDirection",label:"Direction",type:"option:value",options:[{label:"LTR",value:"ltr"},{label:"RTL",value:"rtl"}],default:"ltr"},{id:"sellingPlanItemGap",type:"select",label:"Item gap",options:e,default:"tight"},{id:"sellingTitleTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"sellingTitleOneTimeTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"medium",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"sellingTitleOneTimeAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"subscriptionDetailTypo",label:"Label",type:"typography-post-purchase",default:{fontSize:"default",textColor:"default",fontWeight:"normal",textTransform:"none"}},{id:"subscriptionDetailAlign",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"text",tooltip:"Align left",iconName:"polaris-text-align-left"},{label:"Center",value:"center",type:"text",tooltip:"Align center",iconName:"polaris-text-align-center"},{label:"Right",value:"right",type:"text",tooltip:"Align right",iconName:"polaris-text-align-right"}],default:"left"},{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,default:"100%",displayOptions:[{label:"Full",value:"100%",showValue:!0}]},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],default:"left"}]}];export{ProductSubscriptionSettings};
@@ -1524,24 +1524,12 @@ type EstimateSettingProps = {
1524
1524
  typeEstimate?: string;
1525
1525
  ifOutOfStock?: string;
1526
1526
  };
1527
- type EstimateDateTranslateKeys = keyof EstimateSettingProps;
1528
- type EstimateDateProps = BasePropsWrap<{
1529
- htmlTag?: number;
1530
- text?: string;
1531
- globalSize?: ObjectDevices<SizeSettingGlobal>;
1532
- background?: ObjectDevices<BackgroundMedia>;
1533
- enableCustomText?: boolean;
1534
- customText?: string;
1535
- minEstimate?: number;
1536
- maxEstimate?: number;
1537
- estimateTime?: number;
1538
- typeFormat?: string;
1539
- customFormat?: string;
1540
- typeEstimate?: string;
1541
- ifOutOfStock?: string;
1542
- }, {
1527
+ type EstimateStyleProps = {
1543
1528
  textShadowNotState?: ShadowProps;
1544
1529
  hasTextShadowNotState?: boolean;
1530
+ /**
1531
+ * @deprecated please use `typo` instead
1532
+ */
1545
1533
  typography?: TypographySetting;
1546
1534
  typoCustom?: TypographySettingV2;
1547
1535
  typoDate?: TypographySettingV2;
@@ -1552,7 +1540,16 @@ type EstimateDateProps = BasePropsWrap<{
1552
1540
  hasTextShadow?: StateProp<boolean>;
1553
1541
  textShadow?: StateProp<ShadowProps>;
1554
1542
  align?: ObjectDevices<AlignProp>;
1555
- }> & Omit<React.ComponentPropsWithoutRef<'h1'>, 'children'> & {
1543
+ padding?: ObjectDevices<SizeSettingGlobal>;
1544
+ border?: ObjectDevices<StateProp<Border>>;
1545
+ rounded?: ObjectDevices<StateProp<CornerRadius>>;
1546
+ boxShadow?: ObjectDevices<StateProp<ShadowProps>>;
1547
+ shapeBorder?: ObjectDevices<Border>;
1548
+ shapeRounded?: ObjectDevices<CornerRadius>;
1549
+ shapeBoxShadow?: ObjectDevices<ShadowProps>;
1550
+ };
1551
+ type EstimateDateTranslateKeys = keyof EstimateSettingProps;
1552
+ type EstimateDateProps = BasePropsWrap<EstimateSettingProps, EstimateStyleProps> & Omit<React.ComponentPropsWithoutRef<'h1'>, 'children'> & {
1556
1553
  children: React.ReactNode;
1557
1554
  };
1558
1555
 
@@ -6573,6 +6570,13 @@ declare const EstimateDate$1: ({ setting, styles, builderAttrs, style, builderPr
6573
6570
  hasTextShadow?: Partial<Record<_gem_sdk_core.StateType, boolean>> | undefined;
6574
6571
  textShadow?: Partial<Record<_gem_sdk_core.StateType, _gem_sdk_core.ShadowProps>> | undefined;
6575
6572
  align?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.AlignProp>> | undefined;
6573
+ padding?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.SizeSettingGlobal>> | undefined;
6574
+ border?: Partial<Record<_gem_sdk_core.NameDevices, Partial<Record<_gem_sdk_core.StateType, _gem_sdk_core.Border>>>> | undefined;
6575
+ rounded?: Partial<Record<_gem_sdk_core.NameDevices, Partial<Record<_gem_sdk_core.StateType, _gem_sdk_core.CornerRadius>>>> | undefined;
6576
+ boxShadow?: Partial<Record<_gem_sdk_core.NameDevices, Partial<Record<_gem_sdk_core.StateType, _gem_sdk_core.ShadowProps>>>> | undefined;
6577
+ shapeBorder?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.Border>> | undefined;
6578
+ shapeRounded?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.CornerRadius>> | undefined;
6579
+ shapeBoxShadow?: Partial<Record<_gem_sdk_core.NameDevices, _gem_sdk_core.ShadowProps>> | undefined;
6576
6580
  }, Record<string, any>> & {
6577
6581
  builderAttrs?: Record<string, any> | undefined;
6578
6582
  style?: React.CSSProperties | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "12.0.0-staging.53",
3
+ "version": "12.0.0-staging.54",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",