FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
components
Edit File: sc-customer-details2.js
import{proxyCustomElement,HTMLElement,h}from"@stencil/core/internal/client";import{c as countryChoices}from"./address.js";import{z as zones}from"./tax.js";import{d as defineCustomElement$c}from"./sc-alert2.js";import{d as defineCustomElement$b}from"./sc-button2.js";import{d as defineCustomElement$a}from"./sc-card2.js";import{d as defineCustomElement$9}from"./sc-dashboard-module2.js";import{d as defineCustomElement$8}from"./sc-divider2.js";import{d as defineCustomElement$7}from"./sc-empty2.js";import{d as defineCustomElement$6}from"./sc-icon2.js";import{d as defineCustomElement$5}from"./sc-skeleton2.js";import{d as defineCustomElement$4}from"./sc-spinner2.js";import{d as defineCustomElement$3}from"./sc-stacked-list2.js";import{d as defineCustomElement$2}from"./sc-stacked-list-row2.js";import{d as defineCustomElement$1}from"./sc-tag2.js";const scCustomerDetailsCss="",ScCustomerDetailsStyle0="",ScCustomerDetails=proxyCustomElement(class extends HTMLElement{constructor(){super(),this.__registerHost(),this.__attachShadow(),this.heading=void 0,this.editLink=void 0,this.customer=void 0,this.loading=void 0,this.error=void 0,this.countryChoices=void 0}componentWillLoad(){this.initCountryChoices()}async initCountryChoices(){this.countryChoices=await countryChoices()}renderContent(){var e,s,t,i,n,o,l,d;return this.loading?this.renderLoading():this.customer?h("sc-card",{"no-padding":!0},h("sc-stacked-list",null,!!(null===(e=null==this?void 0:this.customer)||void 0===e?void 0:e.name)&&h("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},h("div",null,h("strong",null,wp.i18n.__("Billing Name","surecart"))),h("div",null,null===(s=this.customer)||void 0===s?void 0:s.name),h("div",null)),!!(null===(t=null==this?void 0:this.customer)||void 0===t?void 0:t.email)&&h("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},h("div",null,h("strong",null,wp.i18n.__("Billing Email","surecart"))),h("div",null,null===(i=this.customer)||void 0===i?void 0:i.email),h("div",null)),!!Object.keys((null===(n=null==this?void 0:this.customer)||void 0===n?void 0:n.shipping_address_display)||{}).length&&this.renderAddress(wp.i18n.__("Shipping Address","surecart"),this.customer.shipping_address_display),!!Object.keys((null===(o=this.customer)||void 0===o?void 0:o.billing_address_display)||{}).length&&this.renderAddress(wp.i18n.__("Billing Address","surecart"),this.customer.billing_address_display),!!(null===(l=null==this?void 0:this.customer)||void 0===l?void 0:l.phone)&&h("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},h("div",null,h("strong",null,wp.i18n.__("Phone","surecart"))),h("div",null,null===(d=this.customer)||void 0===d?void 0:d.phone),h("div",null)),(()=>{var e,s,t,i;const{number_type:n,number:o}=(null===(e=this.customer)||void 0===e?void 0:e.tax_identifier)||{};if(!o||!n)return;const l=(null===(s=null==zones?void 0:zones[n])||void 0===s?void 0:s.label)||wp.i18n.__("Tax Id","surecart"),d=!1===(null===(i=null===(t=this.customer)||void 0===t?void 0:t.tax_identifier)||void 0===i?void 0:i[`valid_${n}`]);return h("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},h("div",null,h("strong",null,l)),h("div",null,o," ",d&&h("sc-tag",{type:"warning"},wp.i18n.__("Invalid","surecart"))),h("div",null))})())):this.renderEmpty()}renderAddress(e="Address",s){return h("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},h("div",null,h("strong",null,e)),h("div",{style:{whiteSpace:"pre-line"}},s),h("div",null))}renderEmpty(){return h("div",null,h("sc-divider",{style:{"--spacing":"0"}}),h("slot",{name:"empty"},h("sc-empty",{icon:"user"},wp.i18n.__("You don't have any billing information.","surecart"))))}renderLoading(){return h("sc-card",{"no-padding":!0},h("sc-stacked-list",null,h("sc-stacked-list-row",{style:{"--columns":"2"},"mobile-size":0},h("div",{style:{padding:"0.5em"}},h("sc-skeleton",{style:{width:"30%",marginBottom:"0.75em"}}),h("sc-skeleton",{style:{width:"20%",marginBottom:"0.75em"}}),h("sc-skeleton",{style:{width:"40%"}})))))}render(){var e,s,t;return h("sc-dashboard-module",{key:"a514e9234af42e95fdfb6105d047c29eeff1244b",exportparts:"base, heading, heading-text, heading-title, heading-description",class:"customer-details",error:this.error},h("span",{key:"af71f4a7af9394bbf4367a887e6beb8a7598c811",slot:"heading"},this.heading||wp.i18n.__("Billing Details","surecart")," ",!!(null===(e=null==this?void 0:this.customer)||void 0===e?void 0:e.id)&&!(null===(s=null==this?void 0:this.customer)||void 0===s?void 0:s.live_mode)&&h("sc-tag",{key:"f79b4f6b857bfaa4a1e2085439922c1dc0df1fe4",exportparts:"base:test-tag__base, content:test-tag__content",type:"warning",size:"small"},wp.i18n.__("Test","surecart"))),!!this.editLink&&!!(null===(t=this.customer)||void 0===t?void 0:t.id)&&h("sc-button",{key:"9c669eed67d09e7fa1548642473fd6b831a865e1",exportparts:"base:button__base, label:button__label, prefix:button__prefix",type:"link",href:this.editLink,slot:"end"},h("sc-icon",{key:"b585de92303db3ee3f3ceb12435408bed218342f",name:"edit-3",slot:"prefix"}),wp.i18n.__("Update","surecart")),this.renderContent())}get el(){return this}static get style(){return""}},[1,"sc-customer-details",{heading:[1],editLink:[1,"edit-link"],customer:[16],loading:[4],error:[1],countryChoices:[32]}]);function defineCustomElement(){"undefined"!=typeof customElements&&["sc-customer-details","sc-alert","sc-button","sc-card","sc-dashboard-module","sc-divider","sc-empty","sc-icon","sc-skeleton","sc-spinner","sc-stacked-list","sc-stacked-list-row","sc-tag"].forEach((e=>{switch(e){case"sc-customer-details":customElements.get(e)||customElements.define(e,ScCustomerDetails);break;case"sc-alert":customElements.get(e)||defineCustomElement$c();break;case"sc-button":customElements.get(e)||defineCustomElement$b();break;case"sc-card":customElements.get(e)||defineCustomElement$a();break;case"sc-dashboard-module":customElements.get(e)||defineCustomElement$9();break;case"sc-divider":customElements.get(e)||defineCustomElement$8();break;case"sc-empty":customElements.get(e)||defineCustomElement$7();break;case"sc-icon":customElements.get(e)||defineCustomElement$6();break;case"sc-skeleton":customElements.get(e)||defineCustomElement$5();break;case"sc-spinner":customElements.get(e)||defineCustomElement$4();break;case"sc-stacked-list":customElements.get(e)||defineCustomElement$3();break;case"sc-stacked-list-row":customElements.get(e)||defineCustomElement$2();break;case"sc-tag":customElements.get(e)||defineCustomElement$1()}}))}export{ScCustomerDetails as S,defineCustomElement as d};
Save
Back