FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
components
Edit File: sc-product-price-choices.js
import{proxyCustomElement,HTMLElement,h,Fragment,Host}from"@stencil/core/internal/client";import{i as intervalString}from"./price.js";import{j as availablePrices,s as state,b as setProduct}from"./watchers.js";import{d as defineCustomElement$8}from"./sc-choice-container2.js";import{d as defineCustomElement$7}from"./sc-choices2.js";import{d as defineCustomElement$6}from"./sc-form-control2.js";import{d as defineCustomElement$5}from"./sc-format-number2.js";import{d as defineCustomElement$4}from"./sc-price-choice-container2.js";import{d as defineCustomElement$3}from"./sc-skeleton2.js";import{d as defineCustomElement$2}from"./sc-visually-hidden2.js";const scProductPriceChoicesCss=":host{display:block;text-align:left;position:relative;z-index:1}",ScProductPriceChoicesStyle0=scProductPriceChoicesCss,ScProductPriceChoices$1=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.label=void 0,this.showPrice=void 0,this.productId=void 0}renderPrice(e){return h(Fragment,null,h("sc-format-number",{type:"currency",value:e.amount,currency:e.currency}),h("span",{slot:"per"},intervalString(e,{labels:{interval:wp.i18n.__("Every","surecart"),period:wp.i18n.__("for","surecart"),once:wp.i18n.__("Once","surecart")},showOnce:!0})))}render(){const e=availablePrices(this.productId);return(null==e?void 0:e.length)<2?h(Host,{style:{display:"none"}}):h("sc-choices",{label:this.label,required:!0,style:{"--sc-input-required-indicator":" "}},(e||[]).map((e=>{var t,c,s,o;return h("sc-price-choice-container",{label:(null==e?void 0:e.name)||(null===(c=null===(t=state[this.productId])||void 0===t?void 0:t.product)||void 0===c?void 0:c.name),showPrice:!!this.showPrice,price:e,checked:(null===(o=null===(s=state[this.productId])||void 0===s?void 0:s.selectedPrice)||void 0===o?void 0:o.id)===(null==e?void 0:e.id),onScChange:t=>{t.target.checked&&setProduct(this.productId,{selectedPrice:e})}})})))}static get style(){return ScProductPriceChoicesStyle0}},[1,"sc-product-price-choices",{label:[1],showPrice:[4,"show-price"],productId:[1,"product-id"]}]);function defineCustomElement$1(){"undefined"!=typeof customElements&&["sc-product-price-choices","sc-choice-container","sc-choices","sc-form-control","sc-format-number","sc-price-choice-container","sc-skeleton","sc-visually-hidden"].forEach((e=>{switch(e){case"sc-product-price-choices":customElements.get(e)||customElements.define(e,ScProductPriceChoices$1);break;case"sc-choice-container":customElements.get(e)||defineCustomElement$8();break;case"sc-choices":customElements.get(e)||defineCustomElement$7();break;case"sc-form-control":customElements.get(e)||defineCustomElement$6();break;case"sc-format-number":customElements.get(e)||defineCustomElement$5();break;case"sc-price-choice-container":customElements.get(e)||defineCustomElement$4();break;case"sc-skeleton":customElements.get(e)||defineCustomElement$3();break;case"sc-visually-hidden":customElements.get(e)||defineCustomElement$2()}}))}const ScProductPriceChoices=ScProductPriceChoices$1,defineCustomElement=defineCustomElement$1;export{ScProductPriceChoices,defineCustomElement};
Save
Back