import{r as i,h as t,a as e}from"./p-e97fde0a.js";import{c as s}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 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:"b0973725f0d03b36814e80872cad60e3dd6e4f46",exportparts:"base, heading, heading-text, heading-title, heading-description",class:"customer-details",error:this.error},t("span",{key:"1cda61c8ce586f5e507ab4a211c00159865d6006",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:"f498ca0356308dafa51115252d182a4d4b459929",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:"8c3cee1ebc61e6c2eac1bdb87e559e30d5135095",exportparts:"base:button__base, label:button__label, prefix:button__prefix",type:"link",href:this.editLink,slot:"end"},t("sc-icon",{key:"ed17c532e9d4c4a16c7c404dc5cbd66ad6a318f8",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-3ad69693.entry.js.map