https://makezine.com/wp-content/plugins/shopwp-pro/dist/SellingGroups-public.6c1085b79e51642c603e.js
1"use strict";(self.webpackChunkshopwp=self.webpackChunkshopwp||[]).push([["ProductPricesSubscription-public","SellingGroups-public"],{"./npm-packages/@shopwp/components/src/products/product/buy-button/subscriptions/selling-groups/index.jsx"(e,t,s){s.r(t),s.d(t,{default:()=>h});var n=s("./npm-packages/@shopwp/common/src/utils/index.jsx"),c=s("./npm-packages/@shopwp/components/src/products/product/_state/hooks.jsx"),a=s("./npm-packages/@shopwp/components/src/products/product/pricing/subscription/index.jsx"),i=s("./npm-packages/@shopwp/components/src/products/product/buy-button/subscriptions/_state/context.js");function r(){var e=wp.element.useContext(i.D);if(!e)throw new Error("useSubscriptionsBuyButtonState must be used within the SubscriptionsBuyButtonProvider");return e}const p=function(e){var t=e.subType,s=e.text,n=e.isSelected,i=e.index,p=(0,c.k)(),o=r();return React.createElement("div",{className:"swp-selling-group-content","data-is-selected":n},React.createElement("label",{tabIndex:"0"},React.createElement("input",{type:"radio",name:o.id+"subscriptions",value:t,defaultChecked:0===i}),React.createElement("div",{className:"shopwp-radio-control"}),React.createElement("div",{className:"swp-radio-text shopwp-radio-text"},React.createElement("p",{className:"swp-radio-label"},wp.hooks.applyFilters("product.subscriptionLabel",s,p,n),n&&p.selectedVariant?":":""),React.createElement(a.default,{productState:p,subType:t,insideSubscriptionsWidget:!0}))))};var o=s("./npm-packages/@shopwp/components/src/shop/_state/hooks.js");const l=function(e){var t=e.isSelected,s=e.index,n=(0,o.T)();return React.createElement(p,{isSelected:t,subType:"onetime",text:n.t.l.oneTimePurchase,index:s})};var u=s("./node_modules/@babel/runtime/helpers/esm/slicedToArray.js"),d=s("./npm-packages/@shopwp/components/src/items/_state/settings/hooks.jsx"),m=wp.element.lazy((function(){return Promise.all([s.e("vendors-node_modules_szhsin_react-menu_dist_index_css-node_modules_szhsin_react-menu_dist_tra-1fef34"),s.e("Select-public")]).then(s.bind(s,"./npm-packages/@shopwp/components/src/select/index.jsx"))}));const b=function(e){var t=e.plans,s=wp.element,a=s.useState,i=s.Suspense,r=(0,d.s)(),p=(0,c.k)(),o=(0,c.F)(),l=wp.hooks.applyFilters("product.subscriptionPlanLabels",t.map((function(e){return"onetime"!==e.node.type&&{label:e.node.name,value:e.node.name}})).filter(Boolean)),b=a(l[0]),g=(0,u.A)(b,2),E=g[0],S=g[1];return React.createElement(i,{fallback:"Loading subscriptions ..."},React.createElement(m,{settings:r,items:l,onChange:function(e){var s=(0,n.dO)(t,e.value);S(e),s&&o({type:"SET_SELECTED_SUBSCRIPTION",payload:s})},label:!1,selectedOption:E,productState:p}))};var g=s("./npm-packages/@shopwp/components/src/products/product/buy-button/_state/hooks.jsx"),E=wp.element.lazy((function(){return Promise.resolve().then(s.bind(s,"./npm-packages/@shopwp/components/src/notice/index.jsx"))}));const S=function(){var e=wp.element.useEffect,t=r(),s=(0,o.T)(),n=(0,g.Z)();return e((function(){t.sellingPlans.length&&n({type:"SET_SUBSCRIPTIONS",payload:t.sellingPlans})}),[t.sellingPlans]),t.notice?React.createElement(E,{status:t.notice.type,className:"swp-subscription-notice"},t.notice.message):t.sellingPlans?React.createElement(b,{plans:t.sellingPlans}):React.createElement(E,{status:"info",className:"swp-subscription-notice"},s.t.w.noSubsFound)},w=function(e){var t=e.isSelected,s=e.index,n=(0,o.T)();return React.createElement(React.Fragment,null,React.createElement(p,{isSelected:t,subType:"subscription",text:n.t.l.subscription,index:s}),React.createElement(S,null))},R=function(e){var t=e.isSelected,s=e.subType,c=e.index;return React.createElement("div",{className:"swp-selling-group shopwp-selling-group","data-is-selected":t},(0,n.Ub)(s)?React.createElement(l,{isSelected:t,index:c}):React.createElement(w,{isSelected:t,index:c}))},h=function(){var e=wp.element.useEffect,t=r(),s=(0,c.F)(),a=(0,c.k)();function i(e){s({type:"SET_ACTIVE_SELLING_GROUP",payload:e}),(0,n.Ub)(e)?s({type:"SET_SELECTED_SUBSCRIPTION",payload:!1}):s({type:"SET_SELECTED_SUBSCRIPTION",payload:(0,n.hg)(a.payload)})}return e((function(){a.selectedSubscription?a.selectedSubscription.recurringDeliveries?i("subscription"):i("onetime"):t.sellingGroups.length&&i(t.sellingGroups[0].id)}),[]),React.createElement("form",{onChange:function(e){i(e.target.value)}},t.sellingGroups.map((function(e,t){return React.createElement(R,{key:e.id,subType:e.id,isSelected:a.activeSellingGroup===e.id,index:t})})))}},"./npm-packages/@shopwp/components/src/products/product/pricing/subscription/index.jsx"(e,t,s){s.r(t),s.d(t,{default:()=>r});var n=s("./npm-packages/@shopwp/components/src/price/index.jsx"),c=s("./npm-packages/@shopwp/components/src/shop/_state/hooks.js");function a(e){var t=e.productState,s=e.insideSubscriptionsWidget,a=(0,c.T)();return React.createElement(React.Fragment,null,React.createElement("p",{className:"swp-price swp-final-price".concat(s?"":" swp-price swp-product-price"),"data-is-compare-at":"false"},React.createElement(n.A,{price:t.subscriptionPricing.saved?t.subscriptionPricing.newPrice:t.subscriptionPricing.oldPrice})),t.subscriptionPricing.saved?React.createElement("p",{className:"swp-price".concat(s?"":" swp-price swp-product-price"),"data-is-compare-at":"true"},React.createElement(n.A,{price:t.subscriptionPricing.oldPrice})):null,"percent"===t.subscriptionPricing.savingsType?React.createElement("p",{className:"swp-save-inline"},"(",a.t.l.save," ",t.subscriptionPricing.saved,"%)"):"fixed"===t.subscriptionPricing.savingsType?React.createElement("p",{className:"swp-save-inline"},"(",a.t.l.save," ",React.createElement(n.A,{price:t.subscriptionPricing.saved}),")"):null)}function i(e){var t=e.productState;return e.insideSubscriptionsWidget,React.createElement(React.Fragment,null,React.createElement("p",{className:"swp-price swp-final-price"},React.createElement(n.A,{price:t.selectedVariant.price.amount})),t.selectedVariant.compareAtPrice?React.createElement("p",{className:"swp-price","data-is-compare-at":"true"},React.createElement(n.A,{price:t.selectedVariant.compareAtPrice.amount})):null)}const r=function(e){var t=e.productState,s=e.subType,n=e.insideSubscriptionsWidget;return React.createElement(React.Fragment,null,t.selectedVariant&&t.subscriptionPricing&&"subscription"===s?React.createElement(a,{productState:t,insideSubscriptionsWidget:n}):null,t.selectedVariant&&"onetime"===s?React.createElement(i,{productState:t,insideSubscriptionsWidget:n}):null)}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.