@gem-sdk/components 8.0.0-dev.124 → 8.0.0-dev.125
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/post-purchase/product/components/product-subscription/ProductSubscription.js +1 -1
- package/dist/cjs/post-purchase/product/components/product-subscription/common/classes.js +1 -1
- package/dist/cjs/post-purchase/product/components/product-subscription/common/styles.js +1 -1
- package/dist/cjs/post-purchase/product/components/product-subscription/components/SellingPlanRadio.js +1 -1
- package/dist/cjs/post-purchase/product/settings/product-subscription/configs/settings.js +1 -1
- package/dist/cjs/post-purchase/product/settings/product-subscription/configs/ui-v2.js +1 -1
- package/dist/esm/post-purchase/product/components/product-subscription/ProductSubscription.js +1 -1
- package/dist/esm/post-purchase/product/components/product-subscription/common/classes.js +1 -1
- package/dist/esm/post-purchase/product/components/product-subscription/common/styles.js +1 -1
- package/dist/esm/post-purchase/product/components/product-subscription/components/SellingPlanRadio.js +1 -1
- package/dist/esm/post-purchase/product/settings/product-subscription/configs/settings.js +1 -1
- package/dist/esm/post-purchase/product/settings/product-subscription/configs/ui-v2.js +1 -1
- package/package.json +1 -1
package/dist/cjs/post-purchase/product/components/product-subscription/ProductSubscription.js
CHANGED
|
@@ -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");const ProductSubscription=({styles:e,setting:s,builderProps:i})=>{let n=core.useProduct(),{defaultValue:l,selectedSellingPlan:t,setSelectedSellingPlan:r}=useSellingSubscription.useSellingSubscription(s),u=useSellingPlanOptions.useSellingPlanOptions(s),{selectedValue:a,handleSellingPlanChange:o}=useSellingPlanChange.useSellingPlanChange({defaultValue:l,selectedSellingPlan:t,setSelectedSellingPlan:r,sellingPlanOptions:u}),c=React.useRef(null),p=React.useId(),{selectedType:S,shouldShowRadio:d,isOneTimeHidden:m,hasNoSellingPlanOptions:g,setSubscriptionSellingType:j}=useSubscriptionVisibility.useSubscriptionVisibility({setting:s}),x=system.createStyle(styles.getSubscriptionStyles(e
|
|
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");const ProductSubscription=({styles:e,setting:s,builderProps:i})=>{let n=core.useProduct(),{defaultValue:l,selectedSellingPlan:t,setSelectedSellingPlan:r}=useSellingSubscription.useSellingSubscription(s),u=useSellingPlanOptions.useSellingPlanOptions(s),{selectedValue:a,handleSellingPlanChange:o}=useSellingPlanChange.useSellingPlanChange({defaultValue:l,selectedSellingPlan:t,setSelectedSellingPlan:r,sellingPlanOptions:u}),c=React.useRef(null),p=React.useId(),{selectedType:S,shouldShowRadio:d,isOneTimeHidden:m,hasNoSellingPlanOptions:g,setSubscriptionSellingType:j}=useSubscriptionVisibility.useSubscriptionVisibility({setting:s}),x=system.createStyle(styles.getSubscriptionStyles(e)),b=system.createStyle(styles.getSubscriptionWrapperStyles(e?.align)),R=system.createClass(classes.getWrapperClasses()),P=system.createClass(classes.getContainerClasses()),{isEditMode:y}=core.useRenderMode(),h=`product-subscription-${n?.baseID}`,O=n?.baseID,T=`subscription-type-selection-${p}`,C=s?.sellingType===index.SubscriptionEnum.ONE_TIME,I=s?.sellingType===index.SubscriptionEnum.SUBSCRIPTION;if(m||g)return y?jsxRuntime.jsx(OneTimePurchaseTooltip.OneTimePurchaseTooltip,{ref:c,setting:s}):null;let q=e=>jsxRuntime.jsx("div",{ref:c,"data-selling-type":s?.sellingType,id:h,className:R,style:b,children:e}),E=()=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:s?.sellingStyle==="radio"?jsxRuntime.jsx(SellingPlanRadio.SellingPlanRadio,{setting:s,styles:e,builderProps:i,productId:O??"",sellingPlanOptions:u,selectedValue:a,onChange:o}):jsxRuntime.jsx(SellingPlanDropdown.SellingPlanDropdown,{setting:s,sellingPlanOptions:u,selectedValue:a,onChange:o})});return q(C&&d?jsxRuntime.jsx("div",{className:P,style:x,children:jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${O}-one-time-radio`,name:T,value:index.SubscriptionEnum.ONE_TIME,checked:S===index.SubscriptionEnum.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&j(index.SubscriptionEnum.ONE_TIME)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})})}):I&&d?jsxRuntime.jsxs("div",{className:P,style:x,children:[jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${O}-subscription-radio`,name:T,value:index.SubscriptionEnum.SUBSCRIPTION,checked:S===index.SubscriptionEnum.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&j(index.SubscriptionEnum.SUBSCRIPTION)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})}),S===index.SubscriptionEnum.SUBSCRIPTION&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[jsxRuntime.jsx("div",{className:"gp-pl-7",children:E()}),jsxRuntime.jsx("div",{className:"gp-pl-7",children:jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:s,styles:e})})]})]}):jsxRuntime.jsxs("div",{className:P,style:x,children:[jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e}),E(),jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:s,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-mb-2 gp-text-xs gp-leading-[1.3]"),getSellingPlanRadioOptionsClasses=()=>core.composeClasses("gp-flex gp-flex-col
|
|
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-mb-2 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-text-light-500"),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-[24px] gp-min-w-[24px] gp-w-5 gp-h-5 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-[5px] 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 +1 @@
|
|
|
1
|
-
"use strict";var SubscriptionBgColorEnum,core=require("@gem-sdk/core"),helper=require("../../../../common/helper.js");!function(e){e.info="#f0f8ff",e.success="#E8F8EB",e.warning="#FFF8E0",e.critical="#FFEBEB",e.none="#FAFAFA"}(SubscriptionBgColorEnum||(SubscriptionBgColorEnum={}));const getSubscriptionStyles=
|
|
1
|
+
"use strict";var SubscriptionBgColorEnum,core=require("@gem-sdk/core"),helper=require("../../../../common/helper.js");!function(e){e.info="#f0f8ff",e.success="#E8F8EB",e.warning="#FFF8E0",e.critical="#FFEBEB",e.none="#FAFAFA"}(SubscriptionBgColorEnum||(SubscriptionBgColorEnum={}));const getSubscriptionStyles=e=>{let{width:t,backgroundColor:r}=e??{},o=core.makeStyle({w:t}),i=core.makeStyle({rg:"9px"}),l=r?{backgroundColor:SubscriptionBgColorEnum[r]??SubscriptionBgColorEnum.none}:{};return core.filterTruthyStyles({...o,...l,...i})},getSubscriptionWrapperStyles=e=>core.filterTruthyStyles({...core.makeStyle({jc:e??"left"})}),getSellingPlanRadioOptionsStyles=({sellingPlanItemGap:e,sellingType:t})=>{let r=helper.postPurchaseSpacing[e??"tight"]||"9px",o=core.makeStyle({rg:"subscription"===t?r:"9px"});return core.filterTruthyStyles({...o})};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"),SubscriptionRadio=require("./SubscriptionRadio.js"),classes=require("../common/classes.js");const SellingPlanRadio=({setting:s,
|
|
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 +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:"Selling plans",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:"
|
|
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:"Selling plans",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:"backgroundColor",type:"select",label:"Background Color",options:[{label:"Transparent",value:"none",icon:"gp-bg-transparent"},{label:"Red",value:"critical",icon:"gp-bg-color-red"},{label:"Blue",value:"info",icon:"gp-bg-color-blue"},{label:"Green",value:"success",icon:"gp-bg-color-green"},{label:"Yellow",value:"warning",icon:"gp-bg-color-yellow"}],default:"none"},{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
|
-
"use strict";const SettingUIV2=[{label:{en:"Selling options"},controls:[{type:"control",label:{en:"Type"},setting:{id:"sellingType"}},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitle",compoDefaultValue:"Subscribe and save up to {total_discount}",popoverLabel:{en:"Selling option title"},isHideClear:!0,controls:[{label:{en:"Content"},setting:{id:"sellingTitle"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'rtl' && sellingTitleAlign === 'left'",source:["subscriptionDetailDirection","sellingTitleAlign"]},{action:{controlId:"sellingTitleAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'ltr' && sellingTitleAlign === 'right'",source:["sellingTitleDirection","sellingTitleAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleAlign"},label:{en:"Align"}}],conditionDisplay:'sellingType === "subscription"'},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitleOneTime",compoDefaultValue:"Purchase options",popoverLabel:{en:"Selling option title"},isHideClear:!0,conditionDisplay:'sellingType === "one-time"',controls:[{label:{en:"Content"},setting:{id:"sellingTitleOneTime"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleOneTimeDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleOneTimeAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'rtl' && sellingTitleOneTimeAlign === 'left'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]},{action:{controlId:"sellingTitleOneTimeAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'ltr' && sellingTitleOneTimeAlign === 'right'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleOneTimeTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleOneTimeAlign"},label:{en:"Align"}}]}]},{label:{en:"Selling plans"},controls:[{type:"control",label:{en:"
|
|
1
|
+
"use strict";const SettingUIV2=[{label:{en:"Selling options"},controls:[{type:"control",label:{en:"Type"},setting:{id:"sellingType"}},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitle",compoDefaultValue:"Subscribe and save up to {total_discount}",popoverLabel:{en:"Selling option title"},isHideClear:!0,controls:[{label:{en:"Content"},setting:{id:"sellingTitle"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'rtl' && sellingTitleAlign === 'left'",source:["subscriptionDetailDirection","sellingTitleAlign"]},{action:{controlId:"sellingTitleAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'ltr' && sellingTitleAlign === 'right'",source:["sellingTitleDirection","sellingTitleAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleAlign"},label:{en:"Align"}}],conditionDisplay:'sellingType === "subscription"'},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitleOneTime",compoDefaultValue:"Purchase options",popoverLabel:{en:"Selling option title"},isHideClear:!0,conditionDisplay:'sellingType === "one-time"',controls:[{label:{en:"Content"},setting:{id:"sellingTitleOneTime"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleOneTimeDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleOneTimeAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'rtl' && sellingTitleOneTimeAlign === 'left'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]},{action:{controlId:"sellingTitleOneTimeAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'ltr' && sellingTitleOneTimeAlign === 'right'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleOneTimeTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleOneTimeAlign"},label:{en:"Align"}}]}]},{label:{en:"Selling plans"},controls:[{type:"control",label:{en:"Selling plans"},setting:{id:"sellingPlans"}},{type:"control",label:{en:"Label"},setting:{id:"sellingLabel"},layout:"horizontal",isHideClear:!0,conditionDisplay:'sellingType === "subscription"'},{type:"control",label:{en:"Style"},setting:{id:"sellingStyle"},layout:"horizontal"},{type:"control",label:{en:"Item gap"},setting:{id:"sellingPlanItemGap"},layout:"horizontal",conditionDisplay:"sellingStyle === 'radio'"}],conditionDisplay:'sellingType === "subscription"'},{controls:[{type:"control",label:{en:"Subscription detail"},setting:{id:"enableSubscriptionDetail"},options:{labelVariant:"primary",toggleStyle:"switch",fullWidth:!0}},{type:"combo",label:{en:"Label"},iconName:"polaris-text-block",getValueFromSettingID:"subscriptionLabel",compoDefaultValue:"Delivery every {selling_plan_delivery_frequency}, save {selling_plan_discount}",popoverLabel:{en:"Subscription detail"},isHideClear:!0,conditionDisplay:"enableSubscriptionDetail === true",controls:[{label:{en:"Content"},setting:{id:"subscriptionLabel"},layout:"vertical"}]},{type:"control",label:{en:"Direction"},setting:{id:"subscriptionDetailDirection"},conditionDisplay:"enableSubscriptionDetail === true",controlChangeTrigger:{settings:[{action:{controlId:"subscriptionDetailAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"subscriptionDetailDirection === 'rtl' && subscriptionDetailAlign === 'left'",source:["subscriptionDetailDirection","subscriptionDetailAlign"]},{action:{controlId:"subscriptionDetailAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"subscriptionDetailDirection === 'ltr' && subscriptionDetailAlign === 'right'",source:["subscriptionDetailDirection","subscriptionDetailAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"subscriptionDetailTypo"},layout:"vertical",conditionDisplay:"enableSubscriptionDetail === true"},{type:"control",setting:{id:"subscriptionDetailAlign"},label:{en:"Align"},conditionDisplay:"enableSubscriptionDetail === true"}],conditionDisplay:'sellingType === "subscription"'},{label:{en:"Size"},controls:[{type:"control",label:{en:"Width"},setting:{id:"width"},layout:"horizontal"}]},{label:{en:"Background"},controls:[{label:{en:"Color"},setting:{id:"backgroundColor"}}]},{controls:[{label:{en:"Align"},conditionEnable:"activeScreenId === 'desktop' ? !(parseInt(width) >= 100 && width?.includes(\"%\")) : (!(parseInt(width) >= 100 && width?.includes(\"%\")) && width !== 'default')",setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"}}]}];exports.SettingUIV2=SettingUIV2;
|
package/dist/esm/post-purchase/product/components/product-subscription/ProductSubscription.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as s,Fragment as
|
|
1
|
+
import{jsx as e,jsxs as s,Fragment as t}from"react/jsx-runtime";import{useProduct as i,useRenderMode as o}from"@gem-sdk/core";import{createStyle as n,createClass as l}from"@gem-sdk/system";import{useRef as r,useId as m}from"react";import{SubscriptionEnum as a}from"../../constants/index.js";import{getWrapperClasses as c,getContainerClasses as p}from"./common/classes.js";import{getSubscriptionStyles as d,getSubscriptionWrapperStyles as g}from"./common/styles.js";import{useSellingPlanChange as u}from"./hooks/useSellingPlanChange.js";import{useSellingSubscription as h}from"./hooks/useSellingSubscription.js";import{useSellingPlanOptions as S}from"./hooks/useSellingPlanOptions.js";import{useSubscriptionVisibility as f}from"./hooks/useSubscriptionVisibility.js";import{OneTimePurchaseTooltip as y}from"./components/OneTimePurchaseTooltip.js";import{SellingPlanDropdown as I}from"./components/SellingPlanDropdown.js";import{SellingPlanLabel as N}from"./components/SellingPlanLabel.js";import{SellingPlanRadio as P}from"./components/SellingPlanRadio.js";import{SubscriptionDetail as b}from"./components/SubscriptionDetail.js";import{SubscriptionRadio as j}from"./components/SubscriptionRadio.js";let ProductSubscription=({styles:T,setting:O,builderProps:k})=>{let C=i(),{defaultValue:v,selectedSellingPlan:E,setSelectedSellingPlan:R}=h(O),B=S(O),{selectedValue:U,handleSellingPlanChange:D}=u({defaultValue:v,selectedSellingPlan:E,setSelectedSellingPlan:R,sellingPlanOptions:B}),M=r(null),$=m(),{selectedType:_,shouldShowRadio:x,isOneTimeHidden:V,hasNoSellingPlanOptions:w,setSubscriptionSellingType:L}=f({setting:O}),q=n(d(T)),z=n(g(T?.align)),A=l(c()),F=l(p()),{isEditMode:G}=o(),H=`product-subscription-${C?.baseID}`,J=C?.baseID,K=`subscription-type-selection-${$}`,Q=O?.sellingType===a.ONE_TIME,W=O?.sellingType===a.SUBSCRIPTION;if(V||w)return G?e(y,{ref:M,setting:O}):null;let X=s=>e("div",{ref:M,"data-selling-type":O?.sellingType,id:H,className:A,style:z,children:s}),Y=()=>e(t,{children:O?.sellingStyle==="radio"?e(P,{setting:O,styles:T,builderProps:k,productId:J??"",sellingPlanOptions:B,selectedValue:U,onChange:D}):e(I,{setting:O,sellingPlanOptions:B,selectedValue:U,onChange:D})});return X(Q&&x?e("div",{className:F,style:q,children:e(j,{id:`${J}-one-time-radio`,name:K,value:a.ONE_TIME,checked:_===a.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&L(a.ONE_TIME)},children:e(N,{setting:O,styles:T})})}):W&&x?s("div",{className:F,style:q,children:[e(j,{id:`${J}-subscription-radio`,name:K,value:a.SUBSCRIPTION,checked:_===a.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&L(a.SUBSCRIPTION)},children:e(N,{setting:O,styles:T})}),_===a.SUBSCRIPTION&&s(t,{children:[e("div",{className:"gp-pl-7",children:Y()}),e("div",{className:"gp-pl-7",children:e(b,{setting:O,styles:T})})]})]}):s("div",{className:F,style:q,children:[e(N,{setting:O,styles:T}),Y(),e(b,{setting:O,styles:T})]}))};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-mb-2 gp-text-xs gp-leading-[1.3]"),getSellingPlanRadioOptionsClasses=()=>e("gp-flex gp-flex-col
|
|
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-mb-2 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-text-light-500"),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-[24px] gp-min-w-[24px] gp-w-5 gp-h-5 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-[5px] 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 +1 @@
|
|
|
1
|
-
var SubscriptionBgColorEnum;import{makeStyle as o,filterTruthyStyles as r}from"@gem-sdk/core";import{postPurchaseSpacing as t}from"../../../../common/helper.js";!function(o){o.info="#f0f8ff",o.success="#E8F8EB",o.warning="#FFF8E0",o.critical="#FFEBEB",o.none="#FAFAFA"}(SubscriptionBgColorEnum||(SubscriptionBgColorEnum={}));let getSubscriptionStyles=
|
|
1
|
+
var SubscriptionBgColorEnum;import{makeStyle as o,filterTruthyStyles as r}from"@gem-sdk/core";import{postPurchaseSpacing as t}from"../../../../common/helper.js";!function(o){o.info="#f0f8ff",o.success="#E8F8EB",o.warning="#FFF8E0",o.critical="#FFEBEB",o.none="#FAFAFA"}(SubscriptionBgColorEnum||(SubscriptionBgColorEnum={}));let getSubscriptionStyles=t=>{let{width:i,backgroundColor:n}=t??{},e=o({w:i}),l=o({rg:"9px"}),s=n?{backgroundColor:SubscriptionBgColorEnum[n]??SubscriptionBgColorEnum.none}:{};return r({...e,...s,...l})},getSubscriptionWrapperStyles=t=>r({...o({jc:t??"left"})}),getSellingPlanRadioOptionsStyles=({sellingPlanItemGap:i,sellingType:n})=>{let e=t[i??"tight"]||"9px",l=o({rg:"subscription"===n?e:"9px"});return r({...l})};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{SubscriptionRadio as
|
|
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 +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:"Selling plans",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:"
|
|
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:"Selling plans",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:"backgroundColor",type:"select",label:"Background Color",options:[{label:"Transparent",value:"none",icon:"gp-bg-transparent"},{label:"Red",value:"critical",icon:"gp-bg-color-red"},{label:"Blue",value:"info",icon:"gp-bg-color-blue"},{label:"Green",value:"success",icon:"gp-bg-color-green"},{label:"Yellow",value:"warning",icon:"gp-bg-color-yellow"}],default:"none"},{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 +1 @@
|
|
|
1
|
-
let SettingUIV2=[{label:{en:"Selling options"},controls:[{type:"control",label:{en:"Type"},setting:{id:"sellingType"}},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitle",compoDefaultValue:"Subscribe and save up to {total_discount}",popoverLabel:{en:"Selling option title"},isHideClear:!0,controls:[{label:{en:"Content"},setting:{id:"sellingTitle"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'rtl' && sellingTitleAlign === 'left'",source:["subscriptionDetailDirection","sellingTitleAlign"]},{action:{controlId:"sellingTitleAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'ltr' && sellingTitleAlign === 'right'",source:["sellingTitleDirection","sellingTitleAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleAlign"},label:{en:"Align"}}],conditionDisplay:'sellingType === "subscription"'},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitleOneTime",compoDefaultValue:"Purchase options",popoverLabel:{en:"Selling option title"},isHideClear:!0,conditionDisplay:'sellingType === "one-time"',controls:[{label:{en:"Content"},setting:{id:"sellingTitleOneTime"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleOneTimeDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleOneTimeAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'rtl' && sellingTitleOneTimeAlign === 'left'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]},{action:{controlId:"sellingTitleOneTimeAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'ltr' && sellingTitleOneTimeAlign === 'right'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleOneTimeTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleOneTimeAlign"},label:{en:"Align"}}]}]},{label:{en:"Selling plans"},controls:[{type:"control",label:{en:"
|
|
1
|
+
let SettingUIV2=[{label:{en:"Selling options"},controls:[{type:"control",label:{en:"Type"},setting:{id:"sellingType"}},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitle",compoDefaultValue:"Subscribe and save up to {total_discount}",popoverLabel:{en:"Selling option title"},isHideClear:!0,controls:[{label:{en:"Content"},setting:{id:"sellingTitle"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'rtl' && sellingTitleAlign === 'left'",source:["subscriptionDetailDirection","sellingTitleAlign"]},{action:{controlId:"sellingTitleAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleDirection === 'ltr' && sellingTitleAlign === 'right'",source:["sellingTitleDirection","sellingTitleAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleAlign"},label:{en:"Align"}}],conditionDisplay:'sellingType === "subscription"'},{type:"combo",label:{en:"Title"},iconName:"polaris-text-block",getValueFromSettingID:"sellingTitleOneTime",compoDefaultValue:"Purchase options",popoverLabel:{en:"Selling option title"},isHideClear:!0,conditionDisplay:'sellingType === "one-time"',controls:[{label:{en:"Content"},setting:{id:"sellingTitleOneTime"},layout:"vertical"},{type:"control",label:{en:"Direction"},setting:{id:"sellingTitleOneTimeDirection"},controlChangeTrigger:{settings:[{action:{controlId:"sellingTitleOneTimeAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'rtl' && sellingTitleOneTimeAlign === 'left'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]},{action:{controlId:"sellingTitleOneTimeAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"sellingTitleOneTimeDirection === 'ltr' && sellingTitleOneTimeAlign === 'right'",source:["sellingTitleOneTimeDirection","sellingTitleOneTimeAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"sellingTitleOneTimeTypo"},layout:"vertical"},{type:"control",setting:{id:"sellingTitleOneTimeAlign"},label:{en:"Align"}}]}]},{label:{en:"Selling plans"},controls:[{type:"control",label:{en:"Selling plans"},setting:{id:"sellingPlans"}},{type:"control",label:{en:"Label"},setting:{id:"sellingLabel"},layout:"horizontal",isHideClear:!0,conditionDisplay:'sellingType === "subscription"'},{type:"control",label:{en:"Style"},setting:{id:"sellingStyle"},layout:"horizontal"},{type:"control",label:{en:"Item gap"},setting:{id:"sellingPlanItemGap"},layout:"horizontal",conditionDisplay:"sellingStyle === 'radio'"}],conditionDisplay:'sellingType === "subscription"'},{controls:[{type:"control",label:{en:"Subscription detail"},setting:{id:"enableSubscriptionDetail"},options:{labelVariant:"primary",toggleStyle:"switch",fullWidth:!0}},{type:"combo",label:{en:"Label"},iconName:"polaris-text-block",getValueFromSettingID:"subscriptionLabel",compoDefaultValue:"Delivery every {selling_plan_delivery_frequency}, save {selling_plan_discount}",popoverLabel:{en:"Subscription detail"},isHideClear:!0,conditionDisplay:"enableSubscriptionDetail === true",controls:[{label:{en:"Content"},setting:{id:"subscriptionLabel"},layout:"vertical"}]},{type:"control",label:{en:"Direction"},setting:{id:"subscriptionDetailDirection"},conditionDisplay:"enableSubscriptionDetail === true",controlChangeTrigger:{settings:[{action:{controlId:"subscriptionDetailAlign",newValue:"right",groupType:"style",controlType:"style"},condition:"subscriptionDetailDirection === 'rtl' && subscriptionDetailAlign === 'left'",source:["subscriptionDetailDirection","subscriptionDetailAlign"]},{action:{controlId:"subscriptionDetailAlign",newValue:"left",groupType:"style",controlType:"style"},condition:"subscriptionDetailDirection === 'ltr' && subscriptionDetailAlign === 'right'",source:["subscriptionDetailDirection","subscriptionDetailAlign"]}],options:{noRecordHistory:!0}}},{type:"control",label:{en:""},setting:{id:"subscriptionDetailTypo"},layout:"vertical",conditionDisplay:"enableSubscriptionDetail === true"},{type:"control",setting:{id:"subscriptionDetailAlign"},label:{en:"Align"},conditionDisplay:"enableSubscriptionDetail === true"}],conditionDisplay:'sellingType === "subscription"'},{label:{en:"Size"},controls:[{type:"control",label:{en:"Width"},setting:{id:"width"},layout:"horizontal"}]},{label:{en:"Background"},controls:[{label:{en:"Color"},setting:{id:"backgroundColor"}}]},{controls:[{label:{en:"Align"},conditionEnable:"activeScreenId === 'desktop' ? !(parseInt(width) >= 100 && width?.includes(\"%\")) : (!(parseInt(width) >= 100 && width?.includes(\"%\")) && width !== 'default')",setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"}}]}];export{SettingUIV2};
|