@gem-sdk/components 12.0.0-dev.95 → 12.0.0-dev.96
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/hooks/useSubscriptionVisibility.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/hooks/useSubscriptionVisibility.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"),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),{defaultValue:o,selectedSellingPlan:a,setSelectedSellingPlan:c}=useSellingSubscription.useSellingSubscription(s),d=useSellingPlanOptions.useSellingPlanOptions(s),{selectedValue:S,handleSellingPlanChange:p}=useSellingPlanChange.useSellingPlanChange({defaultValue:o,selectedSellingPlan:a,setSelectedSellingPlan:c,sellingPlanOptions:d}),m=React.useRef(null),g=React.useId(),{selectedType:j,shouldShowRadio:x,isOneTimeHidden:b,hasNoSellingPlanOptions:P,setSubscriptionSellingType:y}=useSubscriptionVisibility.useSubscriptionVisibility({setting:s}),R=system.createStyle(styles.getSubscriptionStyles(e)),h=system.createStyle(styles.getSubscriptionWrapperStyles(e?.align)),T=system.createClass(classes.getWrapperClasses()),O=system.createClass(classes.getContainerClasses()),I=system.createStyle({...t}),{isEditMode:q}=core.useRenderMode(),C=`product-subscription-${r?.baseID}`,E=r?.baseID,D=`subscription-type-selection-${g}`,N=s?.sellingType===index.SubscriptionEnum.ONE_TIME,v=s?.sellingType===index.SubscriptionEnum.SUBSCRIPTION,{isDynamicProduct:k}=useDynamicProduct.useDynamicProduct();if(React.useEffect(()=>{r?.id&&v&&!q&&u({productID:r.id,isShow:!(P||k)})},[P,k,q,v,r?.id,u]),b||P||k)return q?jsxRuntime.jsxs("div",{...n,style:I,children:[jsxRuntime.jsx(OneTimePurchaseTooltip.OneTimePurchaseTooltip,{ref:m,setting:s}),core.filterToolbarPreview(l,!0)]}):null;let f=e=>jsxRuntime.jsxs("div",{...n,style:I,children:[jsxRuntime.jsx("div",{ref:m,"data-selling-type":s?.sellingType,id:C,className:T,style:h,children:e}),core.filterToolbarPreview(l,!0)]}),L=()=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:s?.sellingStyle==="radio"?jsxRuntime.jsx(SellingPlanRadio.SellingPlanRadio,{setting:s,styles:e,builderProps:i,productId:E??"",sellingPlanOptions:d,selectedValue:S,onChange:p}):jsxRuntime.jsx(SellingPlanDropdown.SellingPlanDropdown,{setting:s,sellingPlanOptions:d,selectedValue:S,onChange:p})});return f(N&&x?jsxRuntime.jsx("div",{className:O,style:R,children:jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${E}-one-time-radio`,name:D,value:index.SubscriptionEnum.ONE_TIME,checked:j===index.SubscriptionEnum.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&y(index.SubscriptionEnum.ONE_TIME)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})})}):v&&x?jsxRuntime.jsxs("div",{className:O,style:R,children:[jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${E}-subscription-radio`,name:D,value:index.SubscriptionEnum.SUBSCRIPTION,checked:j===index.SubscriptionEnum.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&y(index.SubscriptionEnum.SUBSCRIPTION)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})}),j===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:s,styles:e})})]})]}):jsxRuntime.jsxs("div",{className:O,style:R,children:[jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e}),L(),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:s,builderProps:i,builderAttrs:n,style:t,children:l})=>{let r=core.useProduct(),u=core.usePageStore(e=>e.setSubscriptionVisible),{defaultValue:o,selectedSellingPlan:a,setSelectedSellingPlan:c}=useSellingSubscription.useSellingSubscription(s),d=useSellingPlanOptions.useSellingPlanOptions(s),{selectedValue:S,handleSellingPlanChange:p}=useSellingPlanChange.useSellingPlanChange({defaultValue:o,selectedSellingPlan:a,setSelectedSellingPlan:c,sellingPlanOptions:d}),m=React.useRef(null),g=React.useId(),{selectedType:j,shouldShowRadio:x,isOneTimeHidden:b,hasNoSellingPlanOptions:P,setSubscriptionSellingType:y}=useSubscriptionVisibility.useSubscriptionVisibility({setting:s}),R=system.createStyle(styles.getSubscriptionStyles(e)),h=system.createStyle(styles.getSubscriptionWrapperStyles(e?.align)),T=system.createClass(classes.getWrapperClasses()),O=system.createClass(classes.getContainerClasses()),I=system.createStyle({...t}),{isEditMode:q}=core.useRenderMode(),C=`product-subscription-${r?.baseID}`,E=r?.baseID,D=`subscription-type-selection-${g}`,N=s?.sellingType===index.SubscriptionEnum.ONE_TIME,v=s?.sellingType===index.SubscriptionEnum.SUBSCRIPTION,{isDynamicProduct:k}=useDynamicProduct.useDynamicProduct();if(React.useEffect(()=>{r?.id&&v&&!q&&u({productID:r.id,isShow:!(P||k)})},[P,k,q,v,r?.id,u]),b||P||k)return q?jsxRuntime.jsxs("div",{...n,style:I,children:[jsxRuntime.jsx(OneTimePurchaseTooltip.OneTimePurchaseTooltip,{ref:m,setting:s}),core.filterToolbarPreview(l,!0)]}):null;let f=e=>jsxRuntime.jsxs("div",{...n,style:I,children:[jsxRuntime.jsx("div",{ref:m,"data-selling-type":s?.sellingType,id:C,className:T,style:h,children:e}),core.filterToolbarPreview(l,!0)]}),L=()=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:s?.sellingStyle==="radio"?jsxRuntime.jsx(SellingPlanRadio.SellingPlanRadio,{setting:s,styles:e,builderProps:i,productId:E??"",sellingPlanOptions:d,selectedValue:S,onChange:p}):jsxRuntime.jsx(SellingPlanDropdown.SellingPlanDropdown,{setting:s,sellingPlanOptions:d,selectedValue:S,onChange:p})});return f(N&&x?jsxRuntime.jsx("div",{className:O,style:R,children:jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${E}-one-time-radio`,name:D,value:index.SubscriptionEnum.ONE_TIME,checked:j===index.SubscriptionEnum.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&y(index.SubscriptionEnum.ONE_TIME)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})})}):v&&x?jsxRuntime.jsxs("div",{className:O,style:R,children:[jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${E}-subscription-radio`,name:D,value:index.SubscriptionEnum.SUBSCRIPTION,checked:j===index.SubscriptionEnum.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&y(index.SubscriptionEnum.SUBSCRIPTION)},children:jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e})}),j===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:s,styles:e})})]})]}):jsxRuntime.jsxs("div",{className:O,style:R,children:[jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:s,styles:e}),v&&L(),v&&jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:s,styles:e})]}))};exports.default=ProductSubscription;
|
|
@@ -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: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&&
|
|
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&&s&&s.length>0,o=e?.sellingType===index.SubscriptionEnum.SUBSCRIPTION&&(!s||0===s.length),c=e?.sellingType===index.SubscriptionEnum.ONE_TIME&&t;return{selectedType:r,shouldShowRadio:l,isOneTimeHidden:c,hasNoSellingPlanOptions:o,setSubscriptionSellingType:i}};exports.useSubscriptionVisibility=useSubscriptionVisibility;
|
package/dist/esm/post-purchase/product/components/product-subscription/ProductSubscription.js
CHANGED
|
@@ -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 g,getContainerClasses as u}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 I}from"./hooks/useSellingPlanOptions.js";import{useSubscriptionVisibility as N}from"./hooks/useSubscriptionVisibility.js";import{OneTimePurchaseTooltip as P}from"./components/OneTimePurchaseTooltip.js";import{SellingPlanDropdown as b}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:D,style:B,children:U})=>{let M=t(),V=o(e=>e.setSubscriptionVisible),{defaultValue:$,selectedSellingPlan:_,setSelectedSellingPlan:x}=y(E),w=I(E),{selectedValue:L,handleSellingPlanChange:q}=f({defaultValue:$,selectedSellingPlan:_,setSelectedSellingPlan:x,sellingPlanOptions:w}),z=c(null),A=a(),{selectedType:F,shouldShowRadio:G,isOneTimeHidden:H,hasNoSellingPlanOptions:J,setSubscriptionSellingType:K}=N({setting:E}),Q=r(h(C)),W=r(S(C?.align)),X=m(g()),Y=m(u()),Z=r({...B}),{isEditMode:ee}=l(),es=`product-subscription-${M?.baseID}`,ei=M?.baseID,et=`subscription-type-selection-${A}`,eo=E?.sellingType===d.ONE_TIME,el=E?.sellingType===d.SUBSCRIPTION,{isDynamicProduct:en}=v();if(p(()=>{M?.id&&el&&!ee&&V({productID:M.id,isShow:!(J||en)})},[J,en,ee,el,M?.id,V]),H||J||en)return ee?e("div",{...D,style:Z,children:[s(P,{ref:z,setting:E}),n(U,!0)]}):null;let er=i=>e("div",{...D,style:Z,children:[s("div",{ref:z,"data-selling-type":E?.sellingType,id:es,className:X,style:W,children:i}),n(U,!0)]}),em=()=>s(i,{children:E?.sellingStyle==="radio"?s(T,{setting:E,styles:C,builderProps:R,productId:ei??"",sellingPlanOptions:w,selectedValue:L,onChange:q}):s(b,{setting:E,sellingPlanOptions:w,selectedValue:L,onChange:q})});return er(eo&&G?s("div",{className:Y,style:Q,children:s(k,{id:`${ei}-one-time-radio`,name:et,value:d.ONE_TIME,checked:F===d.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&K(d.ONE_TIME)},children:s(j,{setting:E,styles:C})})}):el&&G?e("div",{className:Y,style:Q,children:[s(k,{id:`${ei}-subscription-radio`,name:et,value:d.SUBSCRIPTION,checked:F===d.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&K(d.SUBSCRIPTION)},children:s(j,{setting:E,styles:C})}),F===d.SUBSCRIPTION&&e(i,{children:[s("div",{className:"gp-pl-7",children:em()}),s("div",{className:"gp-pl-7",children:s(O,{setting:E,styles:C})})]})]}):e("div",{className:Y,style:Q,children:[s(j,{setting:E,styles:C}),em(),s(O,{setting:E,styles:C})]}))};export{ProductSubscription as default};
|
|
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 g,getContainerClasses as u}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 I}from"./hooks/useSellingPlanOptions.js";import{useSubscriptionVisibility as N}from"./hooks/useSubscriptionVisibility.js";import{OneTimePurchaseTooltip as P}from"./components/OneTimePurchaseTooltip.js";import{SellingPlanDropdown as b}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:D,style:B,children:U})=>{let M=t(),V=o(e=>e.setSubscriptionVisible),{defaultValue:$,selectedSellingPlan:_,setSelectedSellingPlan:x}=y(E),w=I(E),{selectedValue:L,handleSellingPlanChange:q}=f({defaultValue:$,selectedSellingPlan:_,setSelectedSellingPlan:x,sellingPlanOptions:w}),z=c(null),A=a(),{selectedType:F,shouldShowRadio:G,isOneTimeHidden:H,hasNoSellingPlanOptions:J,setSubscriptionSellingType:K}=N({setting:E}),Q=r(h(C)),W=r(S(C?.align)),X=m(g()),Y=m(u()),Z=r({...B}),{isEditMode:ee}=l(),es=`product-subscription-${M?.baseID}`,ei=M?.baseID,et=`subscription-type-selection-${A}`,eo=E?.sellingType===d.ONE_TIME,el=E?.sellingType===d.SUBSCRIPTION,{isDynamicProduct:en}=v();if(p(()=>{M?.id&&el&&!ee&&V({productID:M.id,isShow:!(J||en)})},[J,en,ee,el,M?.id,V]),H||J||en)return ee?e("div",{...D,style:Z,children:[s(P,{ref:z,setting:E}),n(U,!0)]}):null;let er=i=>e("div",{...D,style:Z,children:[s("div",{ref:z,"data-selling-type":E?.sellingType,id:es,className:X,style:W,children:i}),n(U,!0)]}),em=()=>s(i,{children:E?.sellingStyle==="radio"?s(T,{setting:E,styles:C,builderProps:R,productId:ei??"",sellingPlanOptions:w,selectedValue:L,onChange:q}):s(b,{setting:E,sellingPlanOptions:w,selectedValue:L,onChange:q})});return er(eo&&G?s("div",{className:Y,style:Q,children:s(k,{id:`${ei}-one-time-radio`,name:et,value:d.ONE_TIME,checked:F===d.ONE_TIME,className:"!gp-items-start",onChange:e=>{e.target.checked&&K(d.ONE_TIME)},children:s(j,{setting:E,styles:C})})}):el&&G?e("div",{className:Y,style:Q,children:[s(k,{id:`${ei}-subscription-radio`,name:et,value:d.SUBSCRIPTION,checked:F===d.SUBSCRIPTION,className:"!gp-items-start",onChange:e=>{e.target.checked&&K(d.SUBSCRIPTION)},children:s(j,{setting:E,styles:C})}),F===d.SUBSCRIPTION&&e(i,{children:[s("div",{className:"gp-pl-7",children:em()}),s("div",{className:"gp-pl-7",children:s(O,{setting:E,styles:C})})]})]}):e("div",{className:Y,style:Q,children:[s(j,{setting:E,styles:C}),el&&em(),el&&s(O,{setting:E,styles:C})]}))};export{ProductSubscription as default};
|
|
@@ -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&&
|
|
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&&o&&o.length>0,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};
|