@gem-sdk/components 12.0.0-dev.94 → 12.0.0-dev.95
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var React=require("react"),core=require("@gem-sdk/core"),index=require("../../../constants/index.js"),useSellingPlanOptions=require("./useSellingPlanOptions.js");const useSubscriptionVisibility=({setting:
|
|
1
|
+
"use strict";var React=require("react"),core=require("@gem-sdk/core"),index=require("../../../constants/index.js"),useSellingPlanOptions=require("./useSellingPlanOptions.js");const useSubscriptionVisibility=({setting:e})=>{let i=core.useProductStore(e=>e.setSubscriptionSellingType),n=core.useProductStore(e=>e.subscriptionSellingType),s=useSellingPlanOptions.useSellingPlanOptions(e),u=core.useProduct(),t=u?.requiresSellingPlan,r=n===index.SubscriptionEnum.ONE_TIME?index.SubscriptionEnum.ONE_TIME:index.SubscriptionEnum.SUBSCRIPTION;React.useEffect(()=>{n||(e?.sellingType===index.SubscriptionEnum.ONE_TIME?i(index.SubscriptionEnum.ONE_TIME):i(e?.sellingType??index.SubscriptionEnum.SUBSCRIPTION))},[i,e?.sellingType,n]);let l=!t,o=e?.sellingType===index.SubscriptionEnum.SUBSCRIPTION&&(!s||0===s.length),c=e?.sellingType===index.SubscriptionEnum.ONE_TIME&&(t||!s||0===s.length);return{selectedType:r,shouldShowRadio:l,isOneTimeHidden:c,hasNoSellingPlanOptions:o,setSubscriptionSellingType:i}};exports.useSubscriptionVisibility=useSubscriptionVisibility;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useEffect as e}from"react";import{useProductStore as i,useProduct as l}from"@gem-sdk/core";import{SubscriptionEnum as s}from"../../../constants/index.js";import{useSellingPlanOptions as n}from"./useSellingPlanOptions.js";let useSubscriptionVisibility=({setting:t})=>{let r=i(e=>e.setSubscriptionSellingType),p=i(e=>e.subscriptionSellingType),o=n(t),T=l(),S=T?.requiresSellingPlan,g=p===s.ONE_TIME?s.ONE_TIME:s.SUBSCRIPTION;e(()=>{p||(t?.sellingType===s.ONE_TIME?r(s.ONE_TIME):r(t?.sellingType??s.SUBSCRIPTION))},[r,t?.sellingType,p]);let I=!S,E=t?.sellingType===s.SUBSCRIPTION&&(!o||0===o.length),m=t?.sellingType===s.ONE_TIME&&S;return{selectedType:g,shouldShowRadio:I,isOneTimeHidden:m,hasNoSellingPlanOptions:E,setSubscriptionSellingType:r}};export{useSubscriptionVisibility};
|
|
1
|
+
import{useEffect as e}from"react";import{useProductStore as i,useProduct as l}from"@gem-sdk/core";import{SubscriptionEnum as s}from"../../../constants/index.js";import{useSellingPlanOptions as n}from"./useSellingPlanOptions.js";let useSubscriptionVisibility=({setting:t})=>{let r=i(e=>e.setSubscriptionSellingType),p=i(e=>e.subscriptionSellingType),o=n(t),T=l(),S=T?.requiresSellingPlan,g=p===s.ONE_TIME?s.ONE_TIME:s.SUBSCRIPTION;e(()=>{p||(t?.sellingType===s.ONE_TIME?r(s.ONE_TIME):r(t?.sellingType??s.SUBSCRIPTION))},[r,t?.sellingType,p]);let I=!S,E=t?.sellingType===s.SUBSCRIPTION&&(!o||0===o.length),m=t?.sellingType===s.ONE_TIME&&(S||!o||0===o.length);return{selectedType:g,shouldShowRadio:I,isOneTimeHidden:m,hasNoSellingPlanOptions:E,setSubscriptionSellingType:r}};export{useSubscriptionVisibility};
|