import{r as i,h as t,a as e}from"./p-e97fde0a.js";import{c as s}from"./p-2805073a.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 s()}renderContent(){var i,e,s,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,(e=this.customer)===null||e===void 0?void 0:e.name),t("div",null)),!!((s=this===null||this===void 0?void 0:this.customer)===null||s===void 0?void 0:s.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,e,s,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=((e=l===null||l===void 0?void 0:l[d])===null||e===void 0?void 0:e.label)||wp.i18n.__("Tax Id","surecart");const a=((n=(s=this.customer)===null||s===void 0?void 0:s.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",e){return t("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},t("div",null,t("strong",null,i)),t("div",{style:{whiteSpace:"pre-line"}},e),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,e,s;return t("sc-dashboard-module",{key:"a514e9234af42e95fdfb6105d047c29eeff1244b",exportparts:"base, heading, heading-text, heading-title, heading-description",class:"customer-details",error:this.error},t("span",{key:"af71f4a7af9394bbf4367a887e6beb8a7598c811",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)&&!((e=this===null||this===void 0?void 0:this.customer)===null||e===void 0?void 0:e.live_mode)&&t("sc-tag",{key:"f79b4f6b857bfaa4a1e2085439922c1dc0df1fe4",exportparts:"base:test-tag__base, content:test-tag__content",type:"warning",size:"small"},wp.i18n.__("Test","surecart"))),!!this.editLink&&!!((s=this.customer)===null||s===void 0?void 0:s.id)&&t("sc-button",{key:"9c669eed67d09e7fa1548642473fd6b831a865e1",exportparts:"base:button__base, label:button__label, prefix:button__prefix",type:"link",href:this.editLink,slot:"end"},t("sc-icon",{key:"b585de92303db3ee3f3ceb12435408bed218342f",name:"edit-3",slot:"prefix"}),wp.i18n.__("Update","surecart")),this.renderContent())}get el(){return e(this)}};o.style=d;export{o as sc_customer_details};
//# sourceMappingURL=p-daecd83f.entry.js.map