import{r as i,h as t,a as e}from"./p-9add63ef.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:"6c4ed0e50eb503bd3b651352373c4770098d2727",exportparts:"base, heading, heading-text, heading-title, heading-description",class:"customer-details",error:this.error},t("span",{key:"06be86e2495d986e1c6bb9fecba37484a81ebe95",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:"dc880ee57b15e49af7763b9fdcaf282e317dabe6",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:"f68431352dc7ca451db7fa17f38a5836fd7cdf4a",exportparts:"base:button__base, label:button__label, prefix:button__prefix",type:"link",href:this.editLink,slot:"end"},t("sc-icon",{key:"8a73384efa15666601c18bbd1d2e2eccd2365d3a",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-0e5bcad5.entry.js.map