D7net
Home
Console
Upload
information
Create File
Create Folder
About
Tools
:
/
home
/
diafdxji
/
shihty.com
/
wp-content
/
plugins
/
surecart
/
dist
/
components
/
surecart
/
Filename :
p-41d38143.entry.js
back
Copy
import{r as e,h as i}from"./p-e97fde0a.js";import{a as s}from"./p-dd3464cd.js";import{a}from"./p-401e165e.js";import"./p-d3366af3.js";const n=":host{display:block;position:relative}.customer-edit{display:grid;gap:0.75em}";const t=n;const c=class{constructor(i){e(this,i);this.heading=undefined;this.customer=undefined;this.successUrl=undefined;this.loading=undefined;this.error=undefined}async handleSubmit(e){var i,n;this.loading=true;try{const{email:n,first_name:t,last_name:c,phone:d,billing_matches_shipping:l,shipping_name:o,shipping_city:b,"tax_identifier.number_type":r,"tax_identifier.number":p,shipping_country:u,shipping_line_1:f,shipping_line_2:h,shipping_postal_code:_,shipping_state:m,billing_name:g,billing_city:y,billing_country:v,billing_line_1:k,billing_line_2:w,billing_postal_code:x,billing_state:S}=await e.target.getFormJson();this.customer.billing_address={name:g,city:y,country:v,line_1:k,line_2:w,postal_code:x,state:S};this.customer.shipping_address={name:o,city:b,country:u,line_1:f,line_2:h,postal_code:_,state:m};await s({path:a(`surecart/v1/customers/${(i=this.customer)===null||i===void 0?void 0:i.id}`,{expand:["tax_identifier"]}),method:"PATCH",data:{email:n,first_name:t,last_name:c,phone:d,billing_matches_shipping:l===true||l==="on",shipping_address:this.customer.shipping_address,billing_address:this.customer.billing_address,...p&&r?{tax_identifier:{number:p,number_type:r}}:{}}});if(this.successUrl){window.location.assign(this.successUrl)}else{this.loading=false}}catch(e){this.error=((n=e===null||e===void 0?void 0:e.additional_errors)===null||n===void 0?void 0:n.length)?e.additional_errors.map((e=>e.message)).join(", "):(e===null||e===void 0?void 0:e.message)||wp.i18n.__("Something went wrong","surecart");this.loading=false}}render(){var e,s,a,n,t,c,d,l,o,b,r,p;return i("sc-dashboard-module",{key:"50a0f05ef8c3a694f09af1380f67b18db37bf290",class:"customer-edit",error:this.error},i("span",{key:"a03e32c285789a7ad7273eceaa140ab56b8a6bd1",slot:"heading"},this.heading||wp.i18n.__("Update Billing Details","surecart")," ",!((e=this===null||this===void 0?void 0:this.customer)===null||e===void 0?void 0:e.live_mode)&&i("sc-tag",{key:"f53c0d5317f1bd183a177fa4a58ec6b2bde36466",type:"warning",size:"small"},wp.i18n.__("Test","surecart"))),i("sc-card",{key:"31365b55929e639438d1b02b7335b04f07c37e43"},i("sc-form",{key:"fedd827b6ed0444658c16a0de1394bc9148b6b6e",onScFormSubmit:e=>this.handleSubmit(e)},i("sc-columns",{key:"322482d531929fb5885e5da050a4df2f2db8aaa9",style:{"--sc-column-spacing":"var(--sc-spacing-medium)"}},i("sc-column",{key:"ec727fcf9bf9e5acaf9b631bc48c2634cbaf6a55"},i("sc-input",{key:"730d0c5a1fff3c1781dbe48c51ec2919e78a52d0",label:wp.i18n.__("First Name","surecart"),name:"first_name",value:(s=this.customer)===null||s===void 0?void 0:s.first_name})),i("sc-column",{key:"812b14c6bc83c2c6ecba1161a304d34e2e4275cc"},i("sc-input",{key:"71f628885d3667ccb40ec25b507b9f4783195ec2",label:wp.i18n.__("Last Name","surecart"),name:"last_name",value:(a=this.customer)===null||a===void 0?void 0:a.last_name}))),i("sc-column",{key:"46bf26b00ea973581dc34d33ac2c90c1d9bc312c"},i("sc-phone-input",{key:"8d1d62b00eeae8a730b74e8c0e9b651429e2a1cd",label:wp.i18n.__("Phone","surecart"),name:"phone",value:(n=this.customer)===null||n===void 0?void 0:n.phone})),i("sc-flex",{key:"3f38bda8057f880223ea6074cd4bebbb75047aba",style:{"--sc-flex-column-gap":"var(--sc-spacing-medium)"},flexDirection:"column"},i("div",{key:"0e837b5f8a0560e88af86efdb66f2516e71e14a8"},i("sc-address",{key:"acb5234c1294d8dceef9ce7f1fbfd719ba7892b3",label:wp.i18n.__("Shipping Address","surecart"),showName:true,address:{...(t=this.customer)===null||t===void 0?void 0:t.shipping_address},showLine2:true,required:false,names:{name:"shipping_name",country:"shipping_country",line_1:"shipping_line_1",line_2:"shipping_line_2",city:"shipping_city",postal_code:"shipping_postal_code",state:"shipping_state"}})),i("div",{key:"3045ff9ef89c487202e524317ec7616109436f04"},i("sc-checkbox",{key:"38663949f86f83365da483352c04e0c43a60d0f0",name:"billing_matches_shipping",checked:(c=this.customer)===null||c===void 0?void 0:c.billing_matches_shipping,onScChange:e=>{this.customer={...this.customer,billing_matches_shipping:e.target.checked}},value:"on"},wp.i18n.__("Billing address is same as shipping","surecart"))),i("div",{key:"8bce5d13b46bc487b40e302c15ecd3f600c14efc",style:{display:((d=this.customer)===null||d===void 0?void 0:d.billing_matches_shipping)?"none":"block"}},i("sc-address",{key:"7cbf701fab7757cb6e2c40e5b37c85df39fb62ef",label:wp.i18n.__("Billing Address","surecart"),showName:true,address:{...(l=this.customer)===null||l===void 0?void 0:l.billing_address},showLine2:true,names:{name:"billing_name",country:"billing_country",line_1:"billing_line_1",line_2:"billing_line_2",city:"billing_city",postal_code:"billing_postal_code",state:"billing_state"},required:true})),i("sc-tax-id-input",{key:"537d77f2be0c5944bee6d3bbe6b700701e55968b",show:true,number:(b=(o=this.customer)===null||o===void 0?void 0:o.tax_identifier)===null||b===void 0?void 0:b.number,type:(p=(r=this.customer)===null||r===void 0?void 0:r.tax_identifier)===null||p===void 0?void 0:p.number_type})),i("div",{key:"30afb5edcb2744c43cd55aee4ac4f434923dcd69"},i("sc-button",{key:"daee0f508c2ee4eb9113d07edf55a0d7b247fd6b",type:"primary",full:true,submit:true},wp.i18n.__("Save","surecart"))))),this.loading&&i("sc-block-ui",{key:"38197469b1452ce0cce6d7a679675430cf252bd6",spinner:true}))}};c.style=t;export{c as sc_customer_edit}; //# sourceMappingURL=p-41d38143.entry.js.map