| 1 |
(()=>{"use strict";var e={20:(e,r,t)=>{var s=t(609),n=Symbol.for("react.element"),i=Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,a=s.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,c={key:!0,ref:!0,__self:!0,__source:!0};function p(e,r,t){var s,i={},p=null,l=null;for(s in void 0!==t&&(p=""+t),void 0!==r.key&&(p=""+r.key),void 0!==r.ref&&(l=r.ref),r)o.call(r,s)&&!c.hasOwnProperty(s)&&(i[s]=r[s]);if(e&&e.defaultProps)for(s in r=e.defaultProps)void 0===i[s]&&(i[s]=r[s]);return{$$typeof:n,type:e,key:p,ref:l,props:i,_owner:a.current}}r.Fragment=i,r.jsx=p,r.jsxs=p},609:e=>{e.exports=window.React},848:(e,r,t)=>{e.exports=t(20)}},r={};const t=window.wc.blocksCheckout,s=window.wc.blocksComponents,n=window.wp.i18n,i=window.wp.plugins,o=window.wc.priceFormat;var a=function t(s){var n=r[s];if(void 0!==n)return n.exports;var i=r[s]={exports:{}};return e[s](i,i.exports,t),i.exports}(848);(0,t.registerCheckoutFilters)("sdevs-subscription",{cartItemPrice:(e,r,t,s)=>{const{sdevs_subscription:i}=r,{cartItem:o}=t,{totals:a}=o;if(void 0===a)return e;if("0"===a.line_total)return`<price/> ${(0,n.__)("Due Today","subscription")}`;if(i&&i.type){const e=i.type.charAt(0).toUpperCase()+i.type.slice(1),r=parseInt(i.max_no_payment,10),t=!isNaN(r)&&r>0?` x ${r}`:"";return`<price/> / ${i.time&&i.time>1?" "+i.time+"-":""}${e}${t}`}return e},subtotalPriceFormat:(e,r,t,s)=>{const{sdevs_subscription:i}=r,{sdevs_subscription:o}=r;if(i&&i.type){const e=i.type.charAt(0).toUpperCase()+i.type.slice(1),r=parseInt(i.max_no_payment,10),t=!isNaN(r)&&r>0?` x ${r}`:"",s=i.time&&i.time>1?i.time+"-":"";return"<price/> "+(0,n.__)("Every","subscription")+" "+s+e+t}return e}});const c=({cart:e,extensions:r})=>{if(0===Object.keys(r).length)return;const{cartTotals:i}=e,{sdevs_subscription:c}=r;if(0===c.length)return;const p=(0,o.getCurrencyFromPriceResponse)(i),l=Math.pow(10,p.minorUnit);return(0,a.jsx)(t.TotalsItem,{className:"wc-block-components-totals-footer-item",label:(0,n.__)("Recurring totals","subscription"),description:(0,a.jsx)("div",{style:{display:"grid"},children:c.map(e=>{const r=e.type.charAt(0).toUpperCase()+e.type.slice(1);return(0,a.jsxs)("div",{style:{margin:"20px 0",float:"right"},children:[(0,a.jsxs)("div",{style:{fontSize:"18px"},children:[(0,a.jsx)(s.FormattedMonetaryAmount,{currency:p,value:Math.round(e.price*l)}),(0,a.jsxs)("span",{class:"wpsubs-subscription-timing",children:[" / ",e.time&&e.time>1?e.time+"-"+r+" ":r]})]}),(0,a.jsx)("small",{children:e.description}),"yes"===e.can_user_cancel&&(""===e.max_no_payment||0===parseInt(e.max_no_payment))&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("br",{}),(0,a.jsxs)("small",{children:[(0,n.__)("You can cancel subscription at any time!","subscription")," "]})]}),parseInt(e.max_no_payment)>0&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("br",{}),(0,a.jsx)("small",{children:(0,n.sprintf)( |
| 4 |
(0,n.__)("This subscription will be billed in %1$s installments, for a total of %2$s.","subscription"),e.max_no_payment,(0,o.formatPrice)(Math.round(e.price*l*parseInt(e.max_no_payment)),{currency:p.code,currency_symbol:p.symbol,decimal_separator:p.decimalSeparator,thousand_separator:p.thousandSeparator,precision:p.minorUnit,price_format:p.priceFormat}))})]})]})})})})};(0,i.registerPlugin)("sdevs-subscription",{render:()=>(0,a.jsx)(t.ExperimentalOrderMeta,{children:(0,a.jsx)(c,{})}),scope:"woocommerce-checkout"})})(); |