import{r as i,h as t,a as s}from"./p-9add63ef.js";import{c as e}from"./p-e2e1fe1f.js";import{z as l}from"./p-e677365e.js";import"./p-401e165e.js";const n="";const d=n;const o=class{constructor(t){i(this,t);this.heading=undefined;this.editLink=undefined;this.customer=undefined;this.loading=undefined;this.error=undefined;this.countryChoices=undefined}componentWillLoad(){this.initCountryChoices()}async initCountryChoices(){this.countryChoices=await e()}renderContent(){var i,s,e,n,d,o,r,a;if(this.loading){return this.renderLoading()}if(!this.customer){return this.renderEmpty()}return t("sc-card",{"no-padding":true},t("sc-stacked-list",null,!!((i=this===null||this===void 0?void 0:this.customer)===null||i===void 0?void 0:i.name)&&t("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},t("div",null,t("strong",null,wp.i18n.__("Billing Name","surecart"))),t("div",null,(s=this.customer)===null||s===void 0?void 0:s.name),t("div",null)),!!((e=this===null||this===void 0?void 0:this.customer)===null||e===void 0?void 0:e.email)&&t("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},t("div",null,t("strong",null,wp.i18n.__("Billing Email","surecart"))),t("div",null,(n=this.customer)===null||n===void 0?void 0:n.email),t("div",null)),!!Object.keys(((d=this===null||this===void 0?void 0:this.customer)===null||d===void 0?void 0:d.shipping_address_display)||{}).length&&this.renderAddress(wp.i18n.__("Shipping Address","surecart"),this.customer.shipping_address_display),!!Object.keys(((o=this.customer)===null||o===void 0?void 0:o.billing_address_display)||{}).length&&this.renderAddress(wp.i18n.__("Billing Address","surecart"),this.customer.billing_address_display),!!((r=this===null||this===void 0?void 0:this.customer)===null||r===void 0?void 0:r.phone)&&t("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},t("div",null,t("strong",null,wp.i18n.__("Phone","surecart"))),t("div",null,(a=this.customer)===null||a===void 0?void 0:a.phone),t("div",null)),(()=>{var i,s,e,n;const{number_type:d,number:o}=((i=this.customer)===null||i===void 0?void 0:i.tax_identifier)||{};if(!o||!d)return;const r=((s=l===null||l===void 0?void 0:l[d])===null||s===void 0?void 0:s.label)||wp.i18n.__("Tax Id","surecart");const a=((n=(e=this.customer)===null||e===void 0?void 0:e.tax_identifier)===null||n===void 0?void 0:n[`valid_${d}`])===false;return t("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},t("div",null,t("strong",null,r)),t("div",null,o," ",a&&t("sc-tag",{type:"warning"},wp.i18n.__("Invalid","surecart"))),t("div",null))})()))}renderAddress(i="Address",s){return t("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},t("div",null,t("strong",null,i)),t("div",{style:{whiteSpace:"pre-line"}},s),t("div",null))}renderEmpty(){return t("div",null,t("sc-divider",{style:{"--spacing":"0"}}),t("slot",{name:"empty"},t("sc-empty",{icon:"user"},wp.i18n.__("You don't have any billing information.","surecart"))))}renderLoading(){return t("sc-card",{"no-padding":true},t("sc-stacked-list",null,t("sc-stacked-list-row",{style:{"--columns":"2"},"mobile-size":0},t("div",{style:{padding:"0.5em"}},t("sc-skeleton",{style:{width:"30%",marginBottom:"0.75em"}}),t("sc-skeleton",{style:{width:"20%",marginBottom:"0.75em"}}),t("sc-skeleton",{style:{width:"40%"}})))))}render(){var i,s,e;return t("sc-dashboard-module",{key:"63caee7f93ad72506397ab931ba1dd95e71fd1dc",exportparts:"base, heading, heading-text, heading-title, heading-description",class:"customer-details",error:this.error},t("span",{key:"d65cac3e91aa87b9327b2355117d765723b9baa4",slot:"heading"},this.heading||wp.i18n.__("Billing Details","surecart")," ",!!((i=this===null||this===void 0?void 0:this.customer)===null||i===void 0?void 0:i.id)&&!((s=this===null||this===void 0?void 0:this.customer)===null||s===void 0?void 0:s.live_mode)&&t("sc-tag",{key:"985e52e0f5a7590185e82d92b3bb712d3468b6a5",exportparts:"base:test-tag__base, content:test-tag__content",type:"warning",size:"small"},wp.i18n.__("Test","surecart"))),!!this.editLink&&!!((e=this.customer)===null||e===void 0?void 0:e.id)&&t("sc-button",{key:"df1f88c88b4ff45a697019e838588021644754b2",exportparts:"base:button__base, label:button__label, prefix:button__prefix",type:"link",href:this.editLink,slot:"end"},t("sc-icon",{key:"d57ec3293f02603a45605081bf15dee656c879b2",name:"edit-3",slot:"prefix"}),wp.i18n.__("Update","surecart")),this.renderContent())}get el(){return s(this)}};o.style=d;export{o as sc_customer_details};
//# sourceMappingURL=p-7f8829a9.entry.js.map