FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
components
Edit File: sc-product-price.js
import{proxyCustomElement,HTMLElement,h,Host}from"@stencil/core/internal/client";import{s as state}from"./watchers.js";import"./watchers2.js";import{s as state$1}from"./store.js";import{d as defineCustomElement$5}from"./sc-format-number2.js";import{d as defineCustomElement$4}from"./sc-price2.js";import{d as defineCustomElement$3}from"./sc-tag2.js";import{d as defineCustomElement$2}from"./sc-visually-hidden2.js";const scProductPriceCss=":host{display:block}",ScProductPriceStyle0=scProductPriceCss,ScProductPrice$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.prices=void 0,this.saleText=void 0,this.productId=void 0}renderRange(){var e;return null===(e=state[this.productId])||void 0===e?void 0:e.range_display_amount}renderVariantPrice(e){var t,s;const i=null===(s=null===(t=state[this.productId])||void 0===t?void 0:t.variants)||void 0===s?void 0:s.find((t=>(null==t?void 0:t.id)===(null==e?void 0:e.id)));return this.renderPrice(state[this.productId].selectedPrice,i)}renderPrice(e,t=null){var s,i,o,r,n,l;const d=null!==(i=null!==(s=null==t?void 0:t.display_amount)&&void 0!==s?s:null==e?void 0:e.display_amount)&&void 0!==i?i:"",u=(null===(o=null==state$1?void 0:state$1.line_item)||void 0===o?void 0:o.subtotal_with_upsell_discount_amount)||(null==e?void 0:e.amount),c=(null===(r=null==state$1?void 0:state$1.line_item)||void 0===r?void 0:r.subtotal_with_upsell_discount_display_amount)||d,a=(null===(n=null==state$1?void 0:state$1.line_item)||void 0===n?void 0:n.subtotal_amount)||(null==e?void 0:e.scratch_amount),m=(null===(l=null==state$1?void 0:state$1.line_item)||void 0===l?void 0:l.subtotal_display_amount)||(null==e?void 0:e.scratch_display_amount);return h("sc-price",{currency:null==e?void 0:e.currency,amount:u,displayAmount:c,scratchAmount:a,scratchDisplayAmount:m,saleText:this.saleText,adHoc:null==e?void 0:e.ad_hoc,trialDurationDays:null==e?void 0:e.trial_duration_days,setupFeeText:null==e?void 0:e.setup_fee_text,setupFeeAmount:(null==e?void 0:e.setup_fee_enabled)?null==e?void 0:e.setup_fee_amount:null,setupFeeName:(null==e?void 0:e.setup_fee_enabled)?null==e?void 0:e.setup_fee_name:null,recurringPeriodCount:null==e?void 0:e.recurring_period_count,recurringInterval:null==e?void 0:e.recurring_interval,recurringIntervalCount:null==e?void 0:e.recurring_interval_count})}render(){return h(Host,{key:"f60b38c183a708193b1df4b1b601e33d0bfeedd9",role:"paragraph"},(()=>{var e,t,s,i,o;return(null===(e=state[this.productId])||void 0===e?void 0:e.selectedVariant)?this.renderVariantPrice(null===(t=state[this.productId])||void 0===t?void 0:t.selectedVariant):(null===(s=state[this.productId])||void 0===s?void 0:s.selectedPrice)?this.renderPrice(state[this.productId].selectedPrice):(null===(o=null===(i=state[this.productId])||void 0===i?void 0:i.prices)||void 0===o?void 0:o.length)?this.renderRange():h("slot",null)})())}static get style(){return ScProductPriceStyle0}},[1,"sc-product-price",{prices:[16],saleText:[1,"sale-text"],productId:[1,"product-id"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-product-price","sc-format-number","sc-price","sc-tag","sc-visually-hidden"].forEach((e=>{switch(e){case"sc-product-price":customElements.get(e)||customElements.define(e,ScProductPrice$1);break;case"sc-format-number":customElements.get(e)||defineCustomElement$5();break;case"sc-price":customElements.get(e)||defineCustomElement$4();break;case"sc-tag":customElements.get(e)||defineCustomElement$3();break;case"sc-visually-hidden":customElements.get(e)||defineCustomElement$2()}}))}const ScProductPrice=ScProductPrice$1,defineCustomElement=defineCustomElement$1;export{ScProductPrice,defineCustomElement};
Save
Back