@gem-sdk/components 8.0.0-dev.129 → 8.0.0-dev.130

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