@gem-sdk/components 12.0.0-staging.81 → 12.0.0-staging.82

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),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"),helpers=require("../../../../helpers.js");const DEFAULT_DIRECTION="ltr",ProductSubscription=({styles:e,setting:i,builderProps:s,builderAttrs:n,style:t,children:l})=>{let{isEditMode:r}=core.useRenderMode(),u=core.useProduct(),o=core.usePageStore(e=>e.setSubscriptionVisible),a=core.usePageStore(e=>e.getSubscriptionVisible),{defaultValue:c,selectedSellingPlan:d,setSelectedSellingPlan:p}=useSellingSubscription.useSellingSubscription(i),S=useSellingPlanOptions.useSellingPlanOptions(i),{selectedValue:m,handleSellingPlanChange:g}=useSellingPlanChange.useSellingPlanChange({defaultValue:c,selectedSellingPlan:d,setSelectedSellingPlan:p,sellingPlanOptions:S}),b=React.useRef(null),P=React.useId(),{selectedType:j,shouldShowRadio:x,isOneTimeHidden:y,isOnetimeOnly:R,hasNoSellingPlanOptions:h,requiresSellingPlan:T,setSubscriptionSellingType:I}=useSubscriptionVisibility.useSubscriptionVisibility({setting:i}),O=system.createStyle(styles.getSubscriptionStyles(e)),q=system.createStyle(styles.getSubscriptionWrapperStyles(e?.align)),E=system.createClass(classes.getWrapperClasses()),D=system.createClass(classes.getContainerClasses()),C=system.createStyle({...t}),f=`product-subscription-${helpers.extractProductID(u?.baseID??"")}`,N=helpers.extractProductID(u?.baseID??""),$=`subscription-type-selection-${P}`,k=i?.sellingType===index.SubscriptionEnum.ONE_TIME,v=i?.sellingType===index.SubscriptionEnum.SUBSCRIPTION,{isDynamicProduct:V}=useDynamicProduct.useDynamicProduct(),{sellingTitleDirection:_,sellingTitleOneTimeDirection:w}=e??{},M=e=>e===index.SubscriptionEnum.ONE_TIME?w??"ltr":_??"ltr";if(React.useEffect(()=>{if(!u?.id||!v)return;let e=u?.id,i=`${s?.uid}-${e}`,n=!(h||V),t=a()??{};if(!n){o({...t,[e]:(t[e]??[]).filter(e=>e!==i)});return}o({...t,[e]:[...t[e]??[],i]})},[s?.uid,a,h,V,v,u?.id,o]),y||h||V)return r?jsxRuntime.jsxs("div",{...n,style:C,children:[jsxRuntime.jsx(OneTimePurchaseTooltip.OneTimePurchaseTooltip,{ref:b,setting:i}),core.filterToolbarPreview(l,!0)]}):null;let L=e=>jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${s?.uid??""}-${N}-${e}-radio`,name:$,value:e,checked:j===e,className:"!gp-items-start",onChange:i=>{i.target.checked&&I(e)}}),U=t=>{let r=t===index.SubscriptionEnum.SUBSCRIPTION&&(j===index.SubscriptionEnum.ONE_TIME&&T||j===t);return jsxRuntime.jsxs("div",{...n,style:C,children:[jsxRuntime.jsxs("div",{ref:b,dir:M(t),"data-selling-type":i?.sellingType,id:f,className:E,style:q,children:[x&&L(t),jsxRuntime.jsxs("div",{"data-component-container":!0,className:D,style:O,children:[jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:i,styles:e,id:`label-${s?.uid??""}-${N}-${t}-radio`}),r&&jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[B(),jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:i,styles:e})]})]})]}),core.filterToolbarPreview(l,!0)]})},B=()=>jsxRuntime.jsx(jsxRuntime.Fragment,{children:i?.sellingStyle==="radio"?jsxRuntime.jsx(SellingPlanRadio.SellingPlanRadio,{setting:i,styles:e,builderProps:s,productId:N??"",sellingPlanOptions:S,selectedValue:m,onChange:g}):jsxRuntime.jsx(SellingPlanDropdown.SellingPlanDropdown,{dir:M(index.SubscriptionEnum.SUBSCRIPTION),setting:i,sellingPlanOptions:S,selectedValue:m,onChange:g})});return R&&!r?"":U(k?index.SubscriptionEnum.ONE_TIME:index.SubscriptionEnum.SUBSCRIPTION)};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"),ProductSubscriptionContent=require("./components/ProductSubscriptionContent.js"),OneTimePurchaseTooltip=require("./components/OneTimePurchaseTooltip.js"),useProductSubscriptionContentData=require("./hooks/useProductSubscriptionContentData.js");const ProductSubscription=({styles:e,setting:t,builderProps:i,builderAttrs:s,style:r,children:n})=>{let{isEditMode:o}=core.useRenderMode(),u=system.createStyle({...r}),c=useProductSubscriptionContentData.useProductSubscriptionContentData({setting:t,styles:e,builderProps:i});return c.visibility.isOneTimeHidden||c.visibility.hasNoSellingPlanOptions||c.isDynamicProduct?jsxRuntime.jsxs("div",{...s,style:u,children:[o&&jsxRuntime.jsx(OneTimePurchaseTooltip.OneTimePurchaseTooltip,{ref:c.componentRef,setting:t}),core.filterToolbarPreview(n,!0)]}):c.visibility.isOnetimeOnly&&!o?"":jsxRuntime.jsxs("div",{...s,style:u,children:[jsxRuntime.jsx("div",{ref:c.componentRef,dir:c.direction,"data-selling-type":t?.sellingType,id:c.componentId,className:c.wrapperClasses,style:c.subscriptionWrapperStyles,children:jsxRuntime.jsx(ProductSubscriptionContent.ProductSubscriptionContent,{data:c,setting:t,styles:e,builderProps:i})}),core.filterToolbarPreview(n,!0)]})};exports.default=ProductSubscription;
@@ -0,0 +1 @@
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),ProductSubscriptionOptions=require("./ProductSubscriptionOptions.js"),SellingPlanLabel=require("./SellingPlanLabel.js"),SubscriptionRadio=require("./SubscriptionRadio.js"),index=require("../../../constants/index.js"),handleContainerKeyDown=require("../helpers/handleContainerKeyDown.js");const ProductSubscriptionContent=({data:e,setting:n,styles:i,builderProps:t})=>{let{visibility:s,productId:o,renderType:r,radioGroupName:l,direction:u,containerClasses:a,subscriptionStyles:d,selectedValue:c,sellingPlanOptions:p,handleSellingPlanChange:S,onSelectType:b}=e,x=r===index.SubscriptionEnum.SUBSCRIPTION&&(s.selectedType===index.SubscriptionEnum.ONE_TIME&&s.requiresSellingPlan||s.selectedType===r);return jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[s.shouldShowRadio&&jsxRuntime.jsx(SubscriptionRadio.SubscriptionRadio,{id:`${t?.uid??""}-${o}-${r}-radio`,name:l,value:r,checked:s.selectedType===r,className:"!gp-items-start",onChange:e=>{e.target.checked&&b(r)}}),jsxRuntime.jsxs("div",{"data-component-container":!0,className:a,style:d,onClick:()=>b(r),onKeyDown:e=>handleContainerKeyDown.handleContainerKeyDown({event:e,type:r,shouldShowRadio:s.shouldShowRadio,selectedType:s.selectedType,onSelectType:b}),role:"button",tabIndex:0,children:[jsxRuntime.jsx(SellingPlanLabel.SellingPlanLabel,{setting:n,styles:i,id:`label-${t?.uid??""}-${o}-${r}-radio`}),x&&jsxRuntime.jsx(ProductSubscriptionOptions.ProductSubscriptionOptions,{direction:u,setting:n,styles:i,builderProps:t,productId:o,sellingPlanOptions:p,selectedValue:c,onSellingPlanChange:S})]})]})};exports.ProductSubscriptionContent=ProductSubscriptionContent;
@@ -0,0 +1 @@
1
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),SellingPlanDropdown=require("./SellingPlanDropdown.js"),SellingPlanRadio=require("./SellingPlanRadio.js"),SubscriptionDetail=require("./SubscriptionDetail.js");const ProductSubscriptionOptions=({direction:i,setting:n,styles:e,builderProps:l,productId:s,sellingPlanOptions:t,selectedValue:o,onSellingPlanChange:r})=>jsxRuntime.jsxs(jsxRuntime.Fragment,{children:[n?.sellingStyle==="radio"?jsxRuntime.jsx(SellingPlanRadio.SellingPlanRadio,{setting:n,styles:e,builderProps:l,productId:s,sellingPlanOptions:t,selectedValue:o,onChange:r}):jsxRuntime.jsx(SellingPlanDropdown.SellingPlanDropdown,{dir:i,setting:n,sellingPlanOptions:t,selectedValue:o,onChange:r}),jsxRuntime.jsx(SubscriptionDetail.SubscriptionDetail,{setting:n,styles:e})]});exports.ProductSubscriptionOptions=ProductSubscriptionOptions;
@@ -0,0 +1 @@
1
+ "use strict";const handleContainerKeyDown=({event:e,type:n,shouldShowRadio:t,selectedType:o,onSelectType:a})=>{("Enter"===e.key||" "===e.key)&&t&&o!==n&&(e.preventDefault(),a(n))};exports.handleContainerKeyDown=handleContainerKeyDown;
@@ -0,0 +1 @@
1
+ "use strict";var React=require("react"),core=require("@gem-sdk/core");const useCheckProductsSubscriptionExistence=({productId:e,elementUid:t,isSubscription:r,hasNoSellingPlanOptions:s,isDynamicProduct:c})=>{let i=core.usePageStore(e=>e.setSubscriptionVisible),u=core.usePageStore(e=>e.getSubscriptionVisible);React.useEffect(()=>{if(!e||!r)return;let o=`${t}-${e}`,n=!(s||c),b=u()??{};if(!n){i({...b,[e]:(b[e]??[]).filter(e=>e!==o)});return}i({...b,[e]:[...b[e]??[],o]})},[t,u,s,c,r,e,i])};exports.useCheckProductsSubscriptionExistence=useCheckProductsSubscriptionExistence;
@@ -0,0 +1 @@
1
+ "use strict";var 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"),helpers=require("../../../../../helpers.js"),useSellingPlanChange=require("./useSellingPlanChange.js"),useSellingPlanOptions=require("./useSellingPlanOptions.js"),useSellingSubscription=require("./useSellingSubscription.js"),useSubscriptionVisibility=require("./useSubscriptionVisibility.js"),useDynamicProduct=require("../../../hooks/useDynamicProduct.js"),useCheckProductsSubscriptionExistence=require("./useCheckProductsSubscriptionExistence.js");const DEFAULT_DIRECTION="ltr",useProductSubscriptionContentData=({setting:e,styles:s,builderProps:i})=>{let t=core.useProduct(),{defaultValue:n,selectedSellingPlan:r,setSelectedSellingPlan:u}=useSellingSubscription.useSellingSubscription(e),l=useSellingPlanOptions.useSellingPlanOptions(e),{selectedValue:c,handleSellingPlanChange:o}=useSellingPlanChange.useSellingPlanChange({defaultValue:n,selectedSellingPlan:r,setSelectedSellingPlan:u,sellingPlanOptions:l}),a=React.useRef(null),p=React.useId(),S=useSubscriptionVisibility.useSubscriptionVisibility({setting:e}),d=system.createStyle(styles.getSubscriptionStyles(s)),b=system.createStyle(styles.getSubscriptionWrapperStyles(s?.align)),g=system.createClass(classes.getWrapperClasses()),y=system.createClass(classes.getContainerClasses()),P=`product-subscription-${helpers.extractProductID(t?.baseID??"")}`,m=helpers.extractProductID(t?.baseID??""),C=`subscription-type-selection-${p}`,h=e?.sellingType===index.SubscriptionEnum.ONE_TIME,E=e?.sellingType===index.SubscriptionEnum.SUBSCRIPTION,I=h?index.SubscriptionEnum.ONE_TIME:index.SubscriptionEnum.SUBSCRIPTION,{isDynamicProduct:x}=useDynamicProduct.useDynamicProduct(),{sellingTitleDirection:q,sellingTitleOneTimeDirection:D}=s??{},O=I===index.SubscriptionEnum.ONE_TIME?D??"ltr":q??"ltr";useCheckProductsSubscriptionExistence.useCheckProductsSubscriptionExistence({productId:t?.id,elementUid:i?.uid,isSubscription:E,hasNoSellingPlanOptions:S.hasNoSellingPlanOptions,isDynamicProduct:x});let T=e=>{S.shouldShowRadio&&S.selectedType!==e&&S.setSubscriptionSellingType(e)};return{componentRef:a,componentId:P,wrapperClasses:g,subscriptionWrapperStyles:b,visibility:S,productId:m,renderType:I,radioGroupName:C,direction:O,containerClasses:y,subscriptionStyles:d,selectedValue:c,sellingPlanOptions:l,handleSellingPlanChange:o,onSelectType:T,isDynamicProduct:x}};exports.useProductSubscriptionContentData=useProductSubscriptionContentData;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as i,Fragment as t}from"react/jsx-runtime";import{useRenderMode as o,useProduct as s,usePageStore as r,filterToolbarPreview as n}from"@gem-sdk/core";import{createStyle as l,createClass as m}from"@gem-sdk/system";import{useRef as p,useId as c,useEffect as a}from"react";import{SubscriptionEnum as d}from"../../constants/index.js";import{getWrapperClasses as u,getContainerClasses as g}from"./common/classes.js";import{getSubscriptionStyles as f,getSubscriptionWrapperStyles as S}from"./common/styles.js";import{useSellingPlanChange as h}from"./hooks/useSellingPlanChange.js";import{useSellingSubscription as b}from"./hooks/useSellingSubscription.js";import{useSellingPlanOptions as y}from"./hooks/useSellingPlanOptions.js";import{useSubscriptionVisibility as I}from"./hooks/useSubscriptionVisibility.js";import{OneTimePurchaseTooltip as j}from"./components/OneTimePurchaseTooltip.js";import{SellingPlanDropdown as P}from"./components/SellingPlanDropdown.js";import{SellingPlanLabel as T}from"./components/SellingPlanLabel.js";import{SellingPlanRadio as O}from"./components/SellingPlanRadio.js";import{SubscriptionDetail as N}from"./components/SubscriptionDetail.js";import{SubscriptionRadio as E}from"./components/SubscriptionRadio.js";import{useDynamicProduct as $}from"../../hooks/useDynamicProduct.js";import{extractProductID as k}from"../../../../helpers.js";let DEFAULT_DIRECTION="ltr",ProductSubscription=({styles:C,setting:D,builderProps:R,builderAttrs:v,style:U,children:V})=>{let{isEditMode:_}=o(),B=s(),M=r(e=>e.setSubscriptionVisible),x=r(e=>e.getSubscriptionVisible),{defaultValue:L,selectedSellingPlan:w,setSelectedSellingPlan:A}=b(D),F=y(D),{selectedValue:q,handleSellingPlanChange:z}=h({defaultValue:L,selectedSellingPlan:w,setSelectedSellingPlan:A,sellingPlanOptions:F}),G=p(null),H=c(),{selectedType:J,shouldShowRadio:K,isOneTimeHidden:Q,isOnetimeOnly:W,hasNoSellingPlanOptions:X,requiresSellingPlan:Y,setSubscriptionSellingType:Z}=I({setting:D}),ee=l(f(C)),ei=l(S(C?.align)),et=m(u()),eo=m(g()),es=l({...U}),er=`product-subscription-${k(B?.baseID??"")}`,en=k(B?.baseID??""),el=`subscription-type-selection-${H}`,em=D?.sellingType===d.ONE_TIME,ep=D?.sellingType===d.SUBSCRIPTION,{isDynamicProduct:ec}=$(),{sellingTitleDirection:ea,sellingTitleOneTimeDirection:ed}=C??{},eu=e=>e===d.ONE_TIME?ed??"ltr":ea??"ltr";if(a(()=>{if(!B?.id||!ep)return;let e=B?.id,i=`${R?.uid}-${e}`,t=!(X||ec),o=x()??{};if(!t){M({...o,[e]:(o[e]??[]).filter(e=>e!==i)});return}M({...o,[e]:[...o[e]??[],i]})},[R?.uid,x,X,ec,ep,B?.id,M]),Q||X||ec)return _?e("div",{...v,style:es,children:[i(j,{ref:G,setting:D}),n(V,!0)]}):null;let eg=e=>i(E,{id:`${R?.uid??""}-${en}-${e}-radio`,name:el,value:e,checked:J===e,className:"!gp-items-start",onChange:i=>{i.target.checked&&Z(e)}}),ef=o=>{let s=o===d.SUBSCRIPTION&&(J===d.ONE_TIME&&Y||J===o);return e("div",{...v,style:es,children:[e("div",{ref:G,dir:eu(o),"data-selling-type":D?.sellingType,id:er,className:et,style:ei,children:[K&&eg(o),e("div",{"data-component-container":!0,className:eo,style:ee,children:[i(T,{setting:D,styles:C,id:`label-${R?.uid??""}-${en}-${o}-radio`}),s&&e(t,{children:[eS(),i(N,{setting:D,styles:C})]})]})]}),n(V,!0)]})},eS=()=>i(t,{children:D?.sellingStyle==="radio"?i(O,{setting:D,styles:C,builderProps:R,productId:en??"",sellingPlanOptions:F,selectedValue:q,onChange:z}):i(P,{dir:eu(d.SUBSCRIPTION),setting:D,sellingPlanOptions:F,selectedValue:q,onChange:z})});return W&&!_?"":ef(em?d.ONE_TIME:d.SUBSCRIPTION)};export{ProductSubscription as default};
1
+ import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useRenderMode as t,filterToolbarPreview as o}from"@gem-sdk/core";import{createStyle as s}from"@gem-sdk/system";import{ProductSubscriptionContent as r}from"./components/ProductSubscriptionContent.js";import{OneTimePurchaseTooltip as n}from"./components/OneTimePurchaseTooltip.js";import{useProductSubscriptionContentData as l}from"./hooks/useProductSubscriptionContentData.js";let ProductSubscription=({styles:m,setting:p,builderProps:c,builderAttrs:d,style:a,children:u})=>{let{isEditMode:y}=t(),f=s({...a}),b=l({setting:p,styles:m,builderProps:c});return b.visibility.isOneTimeHidden||b.visibility.hasNoSellingPlanOptions||b.isDynamicProduct?i("div",{...d,style:f,children:[y&&e(n,{ref:b.componentRef,setting:p}),o(u,!0)]}):b.visibility.isOnetimeOnly&&!y?"":i("div",{...d,style:f,children:[e("div",{ref:b.componentRef,dir:b.direction,"data-selling-type":p?.sellingType,id:b.componentId,className:b.wrapperClasses,style:b.subscriptionWrapperStyles,children:e(r,{data:b,setting:p,styles:m,builderProps:c})}),o(u,!0)]})};export{ProductSubscription as default};
@@ -0,0 +1 @@
1
+ import{jsxs as e,Fragment as t,jsx as o}from"react/jsx-runtime";import{ProductSubscriptionOptions as n}from"./ProductSubscriptionOptions.js";import{SellingPlanLabel as i}from"./SellingPlanLabel.js";import{SubscriptionRadio as l}from"./SubscriptionRadio.js";import{SubscriptionEnum as r}from"../../../constants/index.js";import{handleContainerKeyDown as s}from"../helpers/handleContainerKeyDown.js";let ProductSubscriptionContent=({data:d,setting:a,styles:c,builderProps:p})=>{let{visibility:u,productId:m,renderType:h,radioGroupName:S,direction:y,containerClasses:g,subscriptionStyles:b,selectedValue:P,sellingPlanOptions:C,handleSellingPlanChange:T,onSelectType:f}=d,j=h===r.SUBSCRIPTION&&(u.selectedType===r.ONE_TIME&&u.requiresSellingPlan||u.selectedType===h);return e(t,{children:[u.shouldShowRadio&&o(l,{id:`${p?.uid??""}-${m}-${h}-radio`,name:S,value:h,checked:u.selectedType===h,className:"!gp-items-start",onChange:e=>{e.target.checked&&f(h)}}),e("div",{"data-component-container":!0,className:g,style:b,onClick:()=>f(h),onKeyDown:e=>s({event:e,type:h,shouldShowRadio:u.shouldShowRadio,selectedType:u.selectedType,onSelectType:f}),role:"button",tabIndex:0,children:[o(i,{setting:a,styles:c,id:`label-${p?.uid??""}-${m}-${h}-radio`}),j&&o(n,{direction:y,setting:a,styles:c,builderProps:p,productId:m,sellingPlanOptions:C,selectedValue:P,onSellingPlanChange:T})]})]})};export{ProductSubscriptionContent};
@@ -0,0 +1 @@
1
+ import{jsxs as t,Fragment as i,jsx as e}from"react/jsx-runtime";import{SellingPlanDropdown as n}from"./SellingPlanDropdown.js";import{SellingPlanRadio as o}from"./SellingPlanRadio.js";import{SubscriptionDetail as l}from"./SubscriptionDetail.js";let ProductSubscriptionOptions=({direction:s,setting:r,styles:p,builderProps:a,productId:d,sellingPlanOptions:c,selectedValue:g,onSellingPlanChange:u})=>t(i,{children:[r?.sellingStyle==="radio"?e(o,{setting:r,styles:p,builderProps:a,productId:d,sellingPlanOptions:c,selectedValue:g,onChange:u}):e(n,{dir:s,setting:r,sellingPlanOptions:c,selectedValue:g,onChange:u}),e(l,{setting:r,styles:p})]});export{ProductSubscriptionOptions};
@@ -0,0 +1 @@
1
+ let handleContainerKeyDown=({event:e,type:n,shouldShowRadio:t,selectedType:a,onSelectType:o})=>{("Enter"===e.key||" "===e.key)&&t&&a!==n&&(e.preventDefault(),o(n))};export{handleContainerKeyDown};
@@ -0,0 +1 @@
1
+ import{useEffect as e}from"react";import{usePageStore as t}from"@gem-sdk/core";let useCheckProductsSubscriptionExistence=({productId:i,elementUid:r,isSubscription:s,hasNoSellingPlanOptions:c,isDynamicProduct:o})=>{let u=t(e=>e.setSubscriptionVisible),n=t(e=>e.getSubscriptionVisible);e(()=>{if(!i||!s)return;let e=`${r}-${i}`,t=!(c||o),p=n()??{};if(!t){u({...p,[i]:(p[i]??[]).filter(t=>t!==e)});return}u({...p,[i]:[...p[i]??[],e]})},[r,n,c,o,s,i,u])};export{useCheckProductsSubscriptionExistence};
@@ -0,0 +1 @@
1
+ import{useProduct as o}from"@gem-sdk/core";import{createStyle as s,createClass as t}from"@gem-sdk/system";import{useRef as e,useId as i}from"react";import{SubscriptionEnum as r}from"../../../constants/index.js";import{getWrapperClasses as n,getContainerClasses as l}from"../common/classes.js";import{getSubscriptionStyles as m,getSubscriptionWrapperStyles as p}from"../common/styles.js";import{extractProductID as u}from"../../../../../helpers.js";import{useSellingPlanChange as c}from"./useSellingPlanChange.js";import{useSellingPlanOptions as a}from"./useSellingPlanOptions.js";import{useSellingSubscription as S}from"./useSellingSubscription.js";import{useSubscriptionVisibility as d}from"./useSubscriptionVisibility.js";import{useDynamicProduct as f}from"../../../hooks/useDynamicProduct.js";import{useCheckProductsSubscriptionExistence as g}from"./useCheckProductsSubscriptionExistence.js";let DEFAULT_DIRECTION="ltr",useProductSubscriptionContentData=({setting:I,styles:b,builderProps:T})=>{let j=o(),{defaultValue:P,selectedSellingPlan:y,setSelectedSellingPlan:E}=S(I),O=a(I),{selectedValue:h,handleSellingPlanChange:N}=c({defaultValue:P,selectedSellingPlan:y,setSelectedSellingPlan:E,sellingPlanOptions:O}),C=e(null),D=i(),k=d({setting:I}),R=s(m(b)),U=s(p(b?.align)),_=t(n()),x=t(l()),M=`product-subscription-${u(j?.baseID??"")}`,B=u(j?.baseID??""),$=`subscription-type-selection-${D}`,w=I?.sellingType===r.ONE_TIME,A=I?.sellingType===r.SUBSCRIPTION,F=w?r.ONE_TIME:r.SUBSCRIPTION,{isDynamicProduct:L}=f(),{sellingTitleDirection:V,sellingTitleOneTimeDirection:q}=b??{},v=F===r.ONE_TIME?q??"ltr":V??"ltr";g({productId:j?.id,elementUid:T?.uid,isSubscription:A,hasNoSellingPlanOptions:k.hasNoSellingPlanOptions,isDynamicProduct:L});let z=o=>{k.shouldShowRadio&&k.selectedType!==o&&k.setSubscriptionSellingType(o)};return{componentRef:C,componentId:M,wrapperClasses:_,subscriptionWrapperStyles:U,visibility:k,productId:B,renderType:F,radioGroupName:$,direction:v,containerClasses:x,subscriptionStyles:R,selectedValue:h,sellingPlanOptions:O,handleSellingPlanChange:N,onSelectType:z,isDynamicProduct:L}};export{useProductSubscriptionContentData};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "12.0.0-staging.81",
3
+ "version": "12.0.0-staging.82",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",