FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
Edit File: 2529.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[2529],{4805:function(e,t,n){n.d(t,{a:function(){return h},b:function(){return u},g:function(){return d}});var r=n(4467),i=n(3453);function o(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function s(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?o(Object(n),!0).forEach((function(t){(0,r.A)(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}function a(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return l(e,t);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?l(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,r=function(){};return{s:r,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:r}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,o=!0,s=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){s=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(s)throw i}}}}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function u(e){for(var t,n="",r=Object.entries(e);t=r.shift();){var o=t,s=(0,i.A)(o,2),l=s[0],u=s[1];if(Array.isArray(u)||u&&u.constructor===Object){var c,d=a(Object.entries(u).reverse());try{for(d.s();!(c=d.n()).done;){var h=(0,i.A)(c.value,2),v=h[0],p=h[1];r.unshift(["".concat(l,"[").concat(v,"]"),p])}}catch(e){d.e(e)}finally{d.f()}}else void 0!==u&&(null===u&&(u=""),n+="&"+[l,u].map(encodeURIComponent).join("="))}return n.substr(1)}function c(e){try{return decodeURIComponent(e)}catch(t){return e}}function d(e){return(function(e){var t;try{t=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(t)return t}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,t){var n=t.split("=").filter(Boolean).map(c),r=(0,i.A)(n,2),o=r[0],a=r[1],l=void 0===a?"":a;return o&&function(e,t,n){for(var r=t.length,i=r-1,o=0;o<r;o++){var a=t[o];!a&&Array.isArray(e)&&(a=e.length.toString()),a=["__proto__","constructor","prototype"].includes(a)?a.toUpperCase():a;var l=!isNaN(Number(t[o+1]));e[a]=o===i?n:e[a]||(l?[]:{}),Array.isArray(e[a])&&!l&&(e[a]=s({},e[a])),e=e[a]}}(e,o.replace(/\]/g,"").split("["),l),e}),Object.create(null))}function h(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0;if(!t||!Object.keys(t).length)return e;var n=e,r=e.indexOf("?");return-1!==r&&(t=Object.assign(d(e),t),n=n.substr(0,r)),n+"?"+u(t)}},5489:function(e,t,n){n.d(t,{c:function(){return u},g:function(){return c}});var r,i=n(467),o=n(9280),s=n.n(o),a=n(4805),l=(null===(r=window.scData)||void 0===r?void 0:r.locale)||navigator.language||(null===navigator||void 0===navigator?void 0:navigator.browserLanguage)||(navigator.languages||["en"])[0],u=function(){var e=(0,i.A)(s().mark((function e(){var t,n,r,i,o,u,c,d;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o=(0,a.a)("https://api.surecart.com/v1/public/atlas",{locale:l}),e.next=3,fetch(o);case 3:return u=e.sent,e.next=6,u.json();case 6:return c=e.sent,d=null===(t=(null==c?void 0:c.data)||[])||void 0===t?void 0:t.map((function(e){return{value:e.code,label:e.name}})),e.abrupt("return",(null===(i=null===(r=null===(n=null===window||void 0===window?void 0:window.wp)||void 0===n?void 0:n.hooks)||void 0===r?void 0:r.applyFilters)||void 0===i?void 0:i.call(r,"surecart_address_countries",d))||d);case 9:case"end":return e.stop()}}),e)})));return function(){return e.apply(this,arguments)}}(),c=function(){var e=(0,i.A)(s().mark((function e(t){var n,r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=(0,a.a)("https://api.surecart.com/v1/public/atlas/".concat(t),{locale:l}),e.next=3,fetch(n);case 3:return r=e.sent,e.next=6,r.json();case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}()},2529:function(e,t,n){n.r(t),n.d(t,{sc_customer_details:function(){return d}});var r=n(467),i=n(3029),o=n(2901),s=n(9280),a=n.n(s),l=n(1346),u=n(5489),c=n(8674),d=function(){return(0,o.A)((function e(t){(0,i.A)(this,e),(0,l.r)(this,t),this.heading=void 0,this.editLink=void 0,this.customer=void 0,this.loading=void 0,this.error=void 0,this.countryChoices=void 0}),[{key:"componentWillLoad",value:function(){this.initCountryChoices()}},{key:"initCountryChoices",value:(e=(0,r.A)(a().mark((function e(){return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,u.c)();case 2:this.countryChoices=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"renderContent",value:function(){var e,t,n,r,i,o,s,a,u=this;return this.loading?this.renderLoading():this.customer?(0,l.h)("sc-card",{"no-padding":!0},(0,l.h)("sc-stacked-list",null,!!(null===(e=null==this?void 0:this.customer)||void 0===e?void 0:e.name)&&(0,l.h)("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},(0,l.h)("div",null,(0,l.h)("strong",null,wp.i18n.__("Billing Name","surecart"))),(0,l.h)("div",null,null===(t=this.customer)||void 0===t?void 0:t.name),(0,l.h)("div",null)),!!(null===(n=null==this?void 0:this.customer)||void 0===n?void 0:n.email)&&(0,l.h)("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},(0,l.h)("div",null,(0,l.h)("strong",null,wp.i18n.__("Billing Email","surecart"))),(0,l.h)("div",null,null===(r=this.customer)||void 0===r?void 0:r.email),(0,l.h)("div",null)),!!Object.keys((null===(i=null==this?void 0:this.customer)||void 0===i?void 0:i.shipping_address_display)||{}).length&&this.renderAddress(wp.i18n.__("Shipping Address","surecart"),this.customer.shipping_address_display),!!Object.keys((null===(o=this.customer)||void 0===o?void 0:o.billing_address_display)||{}).length&&this.renderAddress(wp.i18n.__("Billing Address","surecart"),this.customer.billing_address_display),!!(null===(s=null==this?void 0:this.customer)||void 0===s?void 0:s.phone)&&(0,l.h)("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},(0,l.h)("div",null,(0,l.h)("strong",null,wp.i18n.__("Phone","surecart"))),(0,l.h)("div",null,null===(a=this.customer)||void 0===a?void 0:a.phone),(0,l.h)("div",null)),function(){var e,t,n,r,i=(null===(e=u.customer)||void 0===e?void 0:e.tax_identifier)||{},o=i.number_type,s=i.number;if(s&&o){var a=(null===(t=null===c.z||void 0===c.z?void 0:c.z[o])||void 0===t?void 0:t.label)||wp.i18n.__("Tax Id","surecart"),d=!1===(null===(r=null===(n=u.customer)||void 0===n?void 0:n.tax_identifier)||void 0===r?void 0:r["valid_".concat(o)]);return(0,l.h)("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},(0,l.h)("div",null,(0,l.h)("strong",null,a)),(0,l.h)("div",null,s," ",d&&(0,l.h)("sc-tag",{type:"warning"},wp.i18n.__("Invalid","surecart"))),(0,l.h)("div",null))}}())):this.renderEmpty()}},{key:"renderAddress",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"Address",t=arguments.length>1?arguments[1]:void 0;return(0,l.h)("sc-stacked-list-row",{style:{"--columns":"3"},mobileSize:480},(0,l.h)("div",null,(0,l.h)("strong",null,e)),(0,l.h)("div",{style:{whiteSpace:"pre-line"}},t),(0,l.h)("div",null))}},{key:"renderEmpty",value:function(){return(0,l.h)("div",null,(0,l.h)("sc-divider",{style:{"--spacing":"0"}}),(0,l.h)("slot",{name:"empty"},(0,l.h)("sc-empty",{icon:"user"},wp.i18n.__("You don't have any billing information.","surecart"))))}},{key:"renderLoading",value:function(){return(0,l.h)("sc-card",{"no-padding":!0},(0,l.h)("sc-stacked-list",null,(0,l.h)("sc-stacked-list-row",{style:{"--columns":"2"},"mobile-size":0},(0,l.h)("div",{style:{padding:"0.5em"}},(0,l.h)("sc-skeleton",{style:{width:"30%",marginBottom:"0.75em"}}),(0,l.h)("sc-skeleton",{style:{width:"20%",marginBottom:"0.75em"}}),(0,l.h)("sc-skeleton",{style:{width:"40%"}})))))}},{key:"render",value:function(){var e,t,n;return(0,l.h)("sc-dashboard-module",{key:"a514e9234af42e95fdfb6105d047c29eeff1244b",exportparts:"base, heading, heading-text, heading-title, heading-description",class:"customer-details",error:this.error},(0,l.h)("span",{key:"af71f4a7af9394bbf4367a887e6beb8a7598c811",slot:"heading"},this.heading||wp.i18n.__("Billing Details","surecart")," ",!!(null===(e=null==this?void 0:this.customer)||void 0===e?void 0:e.id)&&!(null===(t=null==this?void 0:this.customer)||void 0===t?void 0:t.live_mode)&&(0,l.h)("sc-tag",{key:"f79b4f6b857bfaa4a1e2085439922c1dc0df1fe4",exportparts:"base:test-tag__base, content:test-tag__content",type:"warning",size:"small"},wp.i18n.__("Test","surecart"))),!!this.editLink&&!!(null===(n=this.customer)||void 0===n?void 0:n.id)&&(0,l.h)("sc-button",{key:"9c669eed67d09e7fa1548642473fd6b831a865e1",exportparts:"base:button__base, label:button__label, prefix:button__prefix",type:"link",href:this.editLink,slot:"end"},(0,l.h)("sc-icon",{key:"b585de92303db3ee3f3ceb12435408bed218342f",name:"edit-3",slot:"prefix"}),wp.i18n.__("Update","surecart")),this.renderContent())}},{key:"el",get:function(){return(0,l.a)(this)}}]);var e}();d.style=""},8674:function(e,t,n){n.d(t,{f:function(){return i},z:function(){return r}});var r={ca_gst:{label:wp.i18n.__("GST Number","surecart"),label_small:wp.i18n.__("CA GST","surecart")},au_abn:{label:wp.i18n.__("ABN Number","surecart"),label_small:wp.i18n.__("AU ABN","surecart")},gb_vat:{label:wp.i18n.__("VAT Number","surecart"),label_small:wp.i18n.__("UK VAT","surecart")},eu_vat:{label:wp.i18n.__("VAT Number","surecart"),label_small:wp.i18n.__("EU VAT","surecart")},other:{label:wp.i18n.__("Tax ID","surecart"),label_small:wp.i18n.__("Other","surecart")}},i=function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?wp.i18n.__("Estimated Tax","surecart"):wp.i18n.__("Tax","surecart");return e?"".concat(t,": ").concat(e):t}}}]);
Save
Back