JezK
Edit File: 9372.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[9372],{34805:function(e,n,t){t.d(n,{a:function(){return p},b:function(){return u},g:function(){return d}});var r=t(64467),i=t(3453);function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){(0,r.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function l(e,n){var t="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!t){if(Array.isArray(e)||(t=function(e,n){if(e){if("string"==typeof e)return c(e,n);var t={}.toString.call(e).slice(8,-1);return"Object"===t&&e.constructor&&(t=e.constructor.name),"Map"===t||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?c(e,n):void 0}}(e))||n&&e&&"number"==typeof e.length){t&&(e=t);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,a=!1;return{s:function(){t=t.call(e)},n:function(){var e=t.next();return o=e.done,e},e:function(e){a=!0,i=e},f:function(){try{o||null==t.return||t.return()}finally{if(a)throw i}}}}function c(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=Array(n);t<n;t++)r[t]=e[t];return r}function u(e){for(var n,t="",r=Object.entries(e);n=r.shift();){var o=n,a=(0,i.A)(o,2),c=a[0],u=a[1];if(Array.isArray(u)||u&&u.constructor===Object){var s,d=l(Object.entries(u).reverse());try{for(d.s();!(s=d.n()).done;){var p=(0,i.A)(s.value,2),v=p[0],h=p[1];r.unshift(["".concat(c,"[").concat(v,"]"),h])}}catch(e){d.e(e)}finally{d.f()}}else void 0!==u&&(null===u&&(u=""),t+="&"+[c,u].map(encodeURIComponent).join("="))}return t.substr(1)}function s(e){try{return decodeURIComponent(e)}catch(n){return e}}function d(e){return(function(e){var n;try{n=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(n)return n}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,n){var t=n.split("=").filter(Boolean).map(s),r=(0,i.A)(t,2),o=r[0],l=r[1],c=void 0===l?"":l;return o&&function(e,n,t){for(var r=n.length,i=r-1,o=0;o<r;o++){var l=n[o];!l&&Array.isArray(e)&&(l=e.length.toString()),l=["__proto__","constructor","prototype"].includes(l)?l.toUpperCase():l;var c=!isNaN(Number(n[o+1]));e[l]=o===i?t:e[l]||(c?[]:{}),Array.isArray(e[l])&&!c&&(e[l]=a({},e[l])),e=e[l]}}(e,o.replace(/\]/g,"").split("["),c),e}),Object.create(null))}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",n=arguments.length>1?arguments[1]:void 0;if(!n||!Object.keys(n).length)return e;var t=e,r=e.indexOf("?");return-1!==r&&(n=Object.assign(d(e),n),t=t.substr(0,r)),t+"?"+u(n)}},78095:function(e,n,t){t.d(n,{h:function(){return b}});var r,i,o,a,l,c,u,s=t(10467),d=t(89394),p=t(64467),v=t(89280),h=t.n(v),f=t(96030),_=t(34805),m=t(53506);function w(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}var y=(null===(i=null===(r=null===window||void 0===window?void 0:window.parent)||void 0===r?void 0:r.scData)||void 0===i?void 0:i.root_url)||(null===(o=null===window||void 0===window?void 0:window.scData)||void 0===o?void 0:o.root_url);y&&(f.a.fetchAllMiddleware=null,f.a.use(f.a.createRootURLMiddleware(y)),(null===(a=null===window||void 0===window?void 0:window.scData)||void 0===a?void 0:a.nonce)&&(f.a.nonceMiddleware=f.a.createNonceMiddleware(null===(l=null===window||void 0===window?void 0:window.scData)||void 0===l?void 0:l.nonce),f.a.use(f.a.nonceMiddleware)),(null===(c=null===window||void 0===window?void 0:window.scData)||void 0===c?void 0:c.nonce_endpoint)&&(f.a.nonceEndpoint=null===(u=null===window||void 0===window?void 0:window.scData)||void 0===u?void 0:u.nonce_endpoint),f.a.use((function(e,n){return e.path=(0,_.a)(e.path,{t:Date.now()}),n(e)})),f.a.use((function(e,n){return e.path=(0,_.a)(e.path,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?w(Object(t),!0).forEach((function(n){(0,p.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):w(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},!!(0,m.g)(window.location.href,"currency")&&{currency:(0,m.g)(window.location.href,"currency")})),n(e)})),f.a.use((function(e,n){var t=n(e);return t.catch((function(e){var n;return"invalid_json"===e.code&&(e.message=wp.i18n.__("The response is not a valid JSON response.","surecart"),e.additional_errors=[{code:"invalid_json",message:wp.i18n.sprintf(/* translators: %s: URL to debug settings page */ wp.i18n.__("Please ensure that your site is not in debug mode as this may interfere with API responses. %s","surecart"),'<a href="'.concat("https://surecart.com/docs/is-not-a-valid-json-response/",'" target="_blank" rel="noopener noreferrer">').concat(wp.i18n.__("More Information","surecart"),"</a>"))}]),"checkout.finalize_error"===e.code&&(e.additional_errors=[].concat((0,d.A)((null===(n=null==e?void 0:e.additional_errors)||void 0===n?void 0:n.length)?[]:[{code:"checkout.finalize_error",message:e.message}]),(0,d.A)(e.additional_errors||[])),e.message=wp.i18n.__("We were not able to process this order","surecart")),Promise.reject(e)})),t})));var g=function(e){var n={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.","surecart")};if((null==e?void 0:e.code)&&(null==e?void 0:e.message))throw e;if(!e||!e.json)throw n;return e.json().catch((function(){throw n}))},b=function(){var e=(0,s.A)(h().mark((function e(n){var t;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,g(n);case 2:if("rest_cookie_invalid_nonce"===(t=e.sent).code){e.next=5;break}throw t;case 5:return e.abrupt("return",window.fetch(f.a.nonceEndpoint).then((function(e){if(e.status>=200&&e.status<300)return e;throw e})).then((function(e){return e.text()})).then((function(e){f.a.nonceMiddleware.nonce=e})));case 6:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}()},86485:function(e,n,t){t.d(n,{a:function(){return d},b:function(){return v},c:function(){return p},d:function(){return c},e:function(){return s},g:function(){return u},i:function(){return h}});var r=t(64467),i=t(89394);function o(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function a(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?o(Object(t),!0).forEach((function(n){(0,r.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):o(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}var l=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return(0,i.A)(e).sort((function(e,n){var t,r;return(null!==(t=null==e?void 0:e.position)&&void 0!==t?t:0)-(null!==(r=null==n?void 0:n.position)&&void 0!==r?r:0)}))},c=function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=Math.max(Number(n)||1,1),r=Math.max(Number(null==e?void 0:e.quantity)||1,1);return Math.max(Math.round(r/t),1)},u=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,t=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r=((arguments.length>3&&void 0!==arguments[3]?arguments[3]:"·")||"·").trim()||"·";return(e||[]).map((function(e){var i,o=((null==e?void 0:e.variant_options)||[]).filter(Boolean),a=o.length?o.join(" ".concat(r," ")):((null==e?void 0:e.variant_display_options)||"").trim();if(!t&&!a)return null;var l=null===(i=null==e?void 0:e.price)||void 0===i?void 0:i.product,u=(null==l?void 0:l.name)||"";if(!u)return null;var s=c(e,n);return{id:null==e?void 0:e.id,name:u,variants:a,qty:s}})).filter(Boolean)},s=function(){return l(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).map((function(e){var n=null==e?void 0:e.component_product,t=(null==n?void 0:n.name)||"",r=Math.max(Number(null==e?void 0:e.quantity)||1,1);return t?{id:null==e?void 0:e.id,name:t,variants:"",qty:r}:null})).filter(Boolean)},d=function(){var e=[],n=[],t={};return((arguments.length>0&&void 0!==arguments[0]?arguments[0]:[])||[]).forEach((function(r){var i,o;if(!(null==r?void 0:r.component_line_item)){var a=null===(i=null==r?void 0:r.price)||void 0===i?void 0:i.product;if(null==a?void 0:a.bundle)return n.push(r),void(t[r.id]=l((null===(o=null==r?void 0:r.component_line_items)||void 0===o?void 0:o.data)||[]));e.push(r)}})),{regular:e,bundleParents:n,componentsByParent:t}},p=function(e){return((null==e?void 0:e.data)||[]).filter((function(e){return!(null==e?void 0:e.component_line_item)})).map((function(e){var n;return a(a({},(null==e?void 0:e.id)?{id:e.id}:{}),{},{price_id:e.price.id,quantity:e.quantity,variant_id:null===(n=e.variant)||void 0===n?void 0:n.id})}))},v=function(e,n){return((null==e?void 0:e.data)||[]).find((function(e){return e.price.id===n}))},h=function(e,n){var t;return!!((null==(t=null==n?void 0:n.line_items)?void 0:t.data)||[]).map((function(e){return e.price.id})).find((function(n){return(null==e?void 0:e.id)===n}))}},96030:function(e,n,t){t.d(n,{a:function(){return M}});var r=t(10467),i=t(80045),o=t(3453),a=t(64467),l=t(89280),c=t.n(l),u=t(34805),s=t(53506),d=["rest_route"],p=["path","url"],v=["url","path","data","parse"];function h(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable}))),t.push.apply(t,r)}return t}function f(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?h(Object(t),!0).forEach((function(n){(0,a.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}function _(e,n){return void 0!==(0,s.g)(e,n)}function m(e){var n=e.split("?"),t=n[1],r=n[0];return t?r+"?"+t.split("&").map((function(e){return e.split("=")})).map((function(e){return e.map(decodeURIComponent)})).sort((function(e,n){return e[0].localeCompare(n[0])})).map((function(e){return e.map(encodeURIComponent)})).map((function(e){return e.join("=")})).join("&"):r}var w=function(e,n){var t,r,i=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(t=e.namespace.replace(/^\/|\/$/g,""),i=(r=e.endpoint.replace(/^\//,""))?t+"/"+r:t),delete e.namespace,delete e.endpoint,n(f(f({},e),{},{path:i}))};function y(e,n){return Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var g=function(e){return e.json?e.json():Promise.reject(e)},b=function(e){return function(e){if(!e)return{};var n=e.match(/<([^>]+)>; rel="next"/);return n?{next:n[1]}:{}}(e.headers.get("link")).next},O=function(e){var n=!!e.path&&-1!==e.path.indexOf("per_page=-1"),t=!!e.url&&-1!==e.url.indexOf("per_page=-1");return n||t},k=function(){var e=(0,r.A)(c().mark((function e(n,t){var r,o,a,l,s,d;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==n.parse){e.next=2;break}return e.abrupt("return",t(n));case 2:if(O(n)){e.next=4;break}return e.abrupt("return",t(n));case 4:return e.next=6,M(f(f({},(v={per_page:100},void 0,void 0,h=(c=n).path,_=c.url,f(f({},(0,i.A)(c,p)),{},{url:_&&(0,u.a)(_,v),path:h&&(0,u.a)(h,v)}))),{},{parse:!1}));case 6:return r=e.sent,e.next=9,g(r);case 9:if(o=e.sent,Array.isArray(o)){e.next=12;break}return e.abrupt("return",o);case 12:if(a=b(r)){e.next=15;break}return e.abrupt("return",o);case 15:l=[].concat(o);case 16:if(!a){e.next=27;break}return e.next=19,M(f(f({},n),{},{path:void 0,url:a,parse:!1}));case 19:return s=e.sent,e.next=22,g(s);case 22:d=e.sent,l=l.concat(d),a=b(s),e.next=16;break;case 27:return e.abrupt("return",l);case 28:case"end":return e.stop()}var c,v,h,_}),e)})));return function(_x,n){return e.apply(this,arguments)}}(),j=new Set(["PATCH","PUT","DELETE"]),x=function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];return Promise.resolve(function(e){return arguments.length>1&&void 0!==arguments[1]&&!arguments[1]?e:204===e.status?null:e.json?e.json():Promise.reject(e)}(e,n)).catch((function(e){return P(e,n)}))};function P(e){if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1])throw e;return function(e){var n={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!e||!e.json)throw n;return e.json().catch((function(){throw n}))}(e).then((function(e){var n={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw e||n}))}var A={Accept:"application/json, */*;q=0.1"},D={credentials:"include"},T=[function(e,n){return"string"!=typeof e.url||_(e.url,"_locale")||(e.url=(0,u.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||_(e.path,"_locale")||(e.path=(0,u.a)(e.path,{_locale:"user"})),n(e)},w,function(e,n){var t=e.method,r=void 0===t?"GET":t;return j.has(r.toUpperCase())&&(e=f(f({},e),{},{headers:f(f({},e.headers),{},{"X-HTTP-Method-Override":r,"Content-Type":"application/json"}),method:"POST"})),n(e)},k],S=function(e){if(e.status>=200&&e.status<300)return e;throw e},E=function(e){var n=e.url,t=e.path,r=e.data,o=e.parse,a=void 0===o||o,l=(0,i.A)(e,v),c=e.body,u=e.headers;return u=f(f({},A),u),r&&(c=JSON.stringify(r),u["Content-Type"]="application/json"),window.fetch(n||t||window.location.href,f(f(f({},D),l),{},{body:c,headers:u})).then((function(e){return Promise.resolve(e).then(S).catch((function(e){return P(e,a)})).then((function(e){return x(e,a)}))}),(function(e){if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function M(e){return T.reduceRight((function(e,n){return function(t){return n(t,e)}}),E)(e).catch((function(n){return"rest_cookie_invalid_nonce"!==n.code?Promise.reject(n):window.fetch(M.nonceEndpoint).then(S).then((function(e){return e.text()})).then((function(n){return M.nonceMiddleware.nonce=n,M(e)}))}))}M.use=function(e){T.unshift(e)},M.setFetchHandler=function(e){E=e},M.createNonceMiddleware=function(e){var n=function e(n,t){var r=n.headers,i=void 0===r?{}:r;for(var o in i)if("x-wp-nonce"===o.toLowerCase()&&i[o]===e.nonce)return t(n);return t(f(f({},n),{},{headers:f(f({},i),{},{"X-WP-Nonce":e.nonce})}))};return n.nonce=e,n},M.createPreloadingMiddleware=function(e){var n=Object.fromEntries(Object.entries(e).map((function(e){var n=(0,o.A)(e,2),t=n[0],r=n[1];return[m(t),r]})));return function(e,t){var r=e.parse,o=void 0===r||r,a=e.path;if(!a&&e.url){var l=(0,u.g)(e.url),c=l.rest_route,s=(0,i.A)(l,d);"string"==typeof c&&(a=(0,u.a)(c,s))}if("string"!=typeof a)return t(e);var p=e.method||"GET",v=m(a);if("GET"===p&&n[v]){var h=n[v];return delete n[v],y(h,!!o)}if("OPTIONS"===p&&n[p]&&n[p][v]){var f=n[p][v];return delete n[p][v],y(f,!!o)}return t(e)}},M.createRootURLMiddleware=function(e){return function(n,t){return w(n,(function(n){var r,i=n.url,o=n.path;return"string"==typeof o&&(r=e,-1!==e.indexOf("?")&&(o=o.replace("?","&")),o=o.replace(/^\//,""),"string"==typeof r&&-1!==r.indexOf("?")&&(o=o.replace("?","&")),i=r+o),t(f(f({},n),{},{url:i}))}))}},M.fetchAllMiddleware=k,M.mediaUploadMiddleware=function(e,n){if(!function(e){var n=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&n}(e))return n(e);var t=0,r=function e(r){return t++,n({path:"/wp/v2/media/".concat(r,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return t<5?e(r):(n({path:"/wp/v2/media/".concat(r,"?force=true"),method:"DELETE"}),Promise.reject())}))};return n(f(f({},e),{},{parse:!1})).catch((function(n){var t=n.headers.get("x-wp-upload-attachment-id");return n.status>=500&&n.status<600&&t?r(t).catch((function(){return!1!==e.parse?Promise.reject({code:"post_process",message:wp.i18n.__("Media upload failed. If this is a photo or a large image, please scale it down and try again.")}):Promise.reject(n)})):P(n,e.parse)})).then((function(n){return x(n,e.parse)}))},M.createThemePreviewMiddleware=function(e){return function(n,t){if("string"==typeof n.url){var r=(0,s.g)(n.url,"wp_theme_preview");void 0===r?n.url=(0,u.a)(n.url,{wp_theme_preview:e}):""===r&&(n.url=(0,s.r)(n.url,"wp_theme_preview"))}if("string"==typeof n.path){var i=(0,s.g)(n.path,"wp_theme_preview");void 0===i?n.path=(0,u.a)(n.path,{wp_theme_preview:e}):""===i&&(n.path=(0,s.r)(n.path,"wp_theme_preview"))}return t(n)}}},92942:function(e,n,t){t.d(n,{o:function(){return r}});var r=function(e,n){new window.IntersectionObserver((function(e,t){e[0].intersectionRatio>0&&(n(),t.unobserve(e[0].target))})).observe(e)}},53506:function(e,n,t){t.d(n,{g:function(){return i},r:function(){return o}});var r=t(34805);function i(e,n){return(0,r.g)(e)[n]}function o(e){var n=e.indexOf("?");if(-1===n)return e;for(var t=(0,r.g)(e),i=e.substr(0,n),o=arguments.length,a=new Array(o>1?o-1:0),l=1;l<o;l++)a[l-1]=arguments[l];a.forEach((function(e){return delete t[e]}));var c=(0,r.b)(t);return c?i+"?"+c:i}},69372:function(e,n,t){t.r(n),t.d(n,{sc_order:function(){return f}});var r=t(89394),i=t(10467),o=t(23029),a=t(92901),l=t(89280),c=t.n(l),u=t(27364),s=(t(78095),t(92942)),d=t(18674),p=t(86485),v=t(34805),h=t(96030),f=function(){return(0,a.A)((function e(n){(0,o.A)(this,e),(0,u.r)(this,n),this.orderId=void 0,this.customerIds=void 0,this.heading=void 0,this.order=void 0,this.purchases=void 0,this.loading=void 0,this.busy=void 0,this.error=void 0}),[{key:"componentDidLoad",value:function(){var e=this;(0,s.o)(this.el,(function(){e.fetchOrder(),e.fetchDownloads()}))}},{key:"fetchOrder",value:(t=(0,i.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.loading=!0,e.next=4,this.getOrder();case 4:e.next=10;break;case 6:e.prev=6,e.t0=e.catch(0),console.error(this.error),this.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Something went wrong","surecart");case 10:return e.prev=10,this.loading=!1,e.finish(10);case 13:case"end":return e.stop()}}),e,this,[[0,6,10,13]])}))),function(){return t.apply(this,arguments)})},{key:"fetchDownloads",value:(n=(0,i.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.busy=!0,e.next=4,(0,h.a)({path:(0,v.a)("surecart/v1/purchases",{expand:["product","product.downloads","download.media"],order_ids:[this.orderId],customer_ids:this.customerIds,downloadable:!0,revoked:!1})});case 4:this.purchases=e.sent,e.next=11;break;case 7:e.prev=7,e.t0=e.catch(0),console.error(this.error),this.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Something went wrong","surecart");case 11:return e.prev=11,this.busy=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,this,[[0,7,11,14]])}))),function(){return n.apply(this,arguments)})},{key:"getOrder",value:(e=(0,i.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,h.a)({path:(0,v.a)("surecart/v1/orders/".concat(this.orderId),{expand:["checkout","checkout.checkout_fees","checkout.shipping_fees","checkout.line_items","line_item.price","line_item.fees","line_item.variant","line_item.component_line_items","variant.image","price.product","checkout.manual_payment_method","checkout.payment_method","checkout.selected_shipping_choice","shipping_choice.shipping_method","payment_method.card","payment_method.payment_instrument","payment_method.paypal_account","payment_method.bank_account","checkout.discount","discount.promotion","checkout.charge"]})});case 2:this.order=e.sent;case 3:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"renderLoading",value:function(){return(0,u.h)("sc-flex",{flexDirection:"column",style:{gap:"1em"}},(0,u.h)("sc-skeleton",{style:{width:"20%",display:"inline-block"}}),(0,u.h)("sc-skeleton",{style:{width:"60%",display:"inline-block"}}),(0,u.h)("sc-skeleton",{style:{width:"40%",display:"inline-block"}}))}},{key:"renderCheckoutFees",value:function(e){var n,t,r,i;return(null===(t=null===(n=null==e?void 0:e.checkout_fees)||void 0===n?void 0:n.data)||void 0===t?void 0:t.length)?(0,u.h)(u.F,null,null===(i=null===(r=null==e?void 0:e.checkout_fees)||void 0===r?void 0:r.data)||void 0===i?void 0:i.map((function(e){return(0,u.h)("sc-line-item",{key:e.id},(0,u.h)("span",{slot:"description"},e.description),(0,u.h)("span",{slot:"price"},e.display_amount))}))):null}},{key:"renderShippingFees",value:function(e){var n,t,r,i;return(null===(t=null===(n=null==e?void 0:e.shipping_fees)||void 0===n?void 0:n.data)||void 0===t?void 0:t.length)?(0,u.h)(u.F,null,null===(i=null===(r=null==e?void 0:e.shipping_fees)||void 0===r?void 0:r.data)||void 0===i?void 0:i.map((function(e){return(0,u.h)("sc-line-item",{key:e.id},(0,u.h)("span",{slot:"description"},e.description),(0,u.h)("span",{slot:"price"},e.display_amount))}))):null}},{key:"renderEmpty",value:function(){return(0,u.h)("sc-empty",{icon:"shopping-bag"},wp.i18n.__("Order not found.","surecart"))}},{key:"renderContent",value:function(){var e,n,t,i,o,a,l,c;if(this.loading)return this.renderLoading();if(!(null===(e=this.order)||void 0===e?void 0:e.id))return this.renderEmpty();var s=null===(n=this.order)||void 0===n?void 0:n.checkout,v=null===(t=null==s?void 0:s.selected_shipping_choice)||void 0===t?void 0:t.shipping_method,h=null==v?void 0:v.name,f=(null===(i=null==s?void 0:s.line_items)||void 0===i?void 0:i.data)||[],_=(0,p.a)(f),m=_.regular,w=_.bundleParents,y=_.componentsByParent,g=[].concat((0,r.A)(w),(0,r.A)(m));return(0,u.h)(u.F,null,g.map((function(e){var n,t,r,i,o,a,l=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.product,c=!!(null==l?void 0:l.bundle);return(0,u.h)("sc-product-line-item",{key:e.id,image:null==e?void 0:e.image,name:null==l?void 0:l.name,price:null===(t=null==e?void 0:e.price)||void 0===t?void 0:t.name,variant:null==e?void 0:e.variant_display_options,editable:!1,removable:!1,quantity:e.quantity,note:null==e?void 0:e.display_note,amount:e.subtotal_display_amount,trial:null===(r=null==e?void 0:e.price)||void 0===r?void 0:r.trial_text,interval:"".concat(null===(i=null==e?void 0:e.price)||void 0===i?void 0:i.short_interval_text," ").concat(null===(o=null==e?void 0:e.price)||void 0===o?void 0:o.short_interval_count_text),scratch:null==e?void 0:e.scratch_display_amount,purchasableStatus:null==e?void 0:e.purchasable_status_display,fees:null===(a=null==e?void 0:e.fees)||void 0===a?void 0:a.data,reviewButtonLink:(null==l?void 0:l.review_url)||"",bundleComponents:c&&y[e.id]||[]})})),(null==s?void 0:s.subtotal_amount)!==(null==s?void 0:s.total_amount)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("Subtotal","surecart")),(0,u.h)("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==s?void 0:s.subtotal_display_amount)),this.renderCheckoutFees(s),!!(null==s?void 0:s.trial_amount)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("Trial","surecart")),(0,u.h)("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==s?void 0:s.trial_display_amount)),!!(null==s?void 0:s.discounts)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("Discounts","surecart")),(0,u.h)("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==s?void 0:s.discounts_display)),!!(null===(a=null===(o=null==s?void 0:s.discount)||void 0===o?void 0:o.promotion)||void 0===a?void 0:a.code)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("Discount","surecart"),(0,u.h)("br",null),(0,u.h)("sc-tag",{type:"success"},wp.i18n.__("Coupon:","surecart")," ",null===(c=null===(l=null==s?void 0:s.discount)||void 0===l?void 0:l.promotion)||void 0===c?void 0:c.code)),(0,u.h)("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==s?void 0:s.discounts_display_amount)),!!(null==s?void 0:s.shipping_amount)&&(0,u.h)(u.F,null,(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},"".concat(wp.i18n.__("Shipping","surecart")," ").concat(h?"(".concat(h,")"):"")),(0,u.h)("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==s?void 0:s.shipping_display_amount)),this.renderShippingFees(s)),!!(null==s?void 0:s.tax_amount)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},"".concat((0,d.f)(null==s?void 0:s.tax_label,"estimated"===(null==s?void 0:s.tax_status))," (").concat(null==s?void 0:s.tax_percent,"%)")),(0,u.h)("span",{slot:"price"},null==s?void 0:s.tax_display_amount),!!(null==s?void 0:s.tax_inclusive_amount)&&(0,u.h)("span",{slot:"price-description"},"(".concat(wp.i18n.__("included","surecart"),")"))),(0,u.h)("sc-divider",{style:{"--spacing":"var(--sc-spacing-x-small)"}}),(0,u.h)("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},(0,u.h)("span",{slot:"title"},wp.i18n.__("Total","surecart")),(0,u.h)("span",{slot:"price"},null==s?void 0:s.total_display_amount),(0,u.h)("span",{slot:"currency"},null==s?void 0:s.currency)),!!(null==s?void 0:s.proration_amount)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("Proration","surecart")),(0,u.h)("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==s?void 0:s.proration_display_amount)),!!(null==s?void 0:s.applied_balance_amount)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("Applied Balance","surecart")),(0,u.h)("span",{style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"},slot:"price"},null==s?void 0:s.applied_balance_display_amount)),!!(null==s?void 0:s.credited_balance_amount)&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("Credited Balance","surecart")),(0,u.h)("span",{slot:"price",style:{"font-weight":"var(--sc-font-weight-semibold)",color:"var(--sc-color-gray-800)"}},null==s?void 0:s.credited_balance_display_amount)),(null==s?void 0:s.amount_due)!==(null==s?void 0:s.total_amount)&&(0,u.h)("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},(0,u.h)("span",{slot:"title"},wp.i18n.__("Amount Due","surecart")),(0,u.h)("span",{slot:"price"},null==s?void 0:s.amount_due_display_amount),(0,u.h)("span",{slot:"currency"},null==s?void 0:s.currency)),(0,u.h)("sc-divider",{style:{"--spacing":"var(--sc-spacing-x-small)"}}),!!(null==s?void 0:s.paid_amount)&&(0,u.h)("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},(0,u.h)("span",{slot:"title"},wp.i18n.__("Paid","surecart")),(0,u.h)("span",{slot:"price"},null==s?void 0:s.paid_display_amount),(0,u.h)("span",{slot:"currency"},null==s?void 0:s.currency)),!!(null==s?void 0:s.refunded_amount)&&(0,u.h)(u.F,null,(0,u.h)("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},(0,u.h)("span",{slot:"description"},wp.i18n.__("Refunded","surecart")),(0,u.h)("span",{slot:"price"},null==s?void 0:s.refunded_display_amount)),(0,u.h)("sc-line-item",{style:{width:"100%","--price-size":"var(--sc-font-size-x-large)"}},(0,u.h)("span",{slot:"title"},wp.i18n.__("Net Payment","surecart")),(0,u.h)("span",{slot:"price"},null==s?void 0:s.net_paid_display_amount))),(null==s?void 0:s.tax_reverse_charged_amount)>0&&(0,u.h)("sc-line-item",null,(0,u.h)("span",{slot:"description"},wp.i18n.__("*Tax to be paid on reverse charge basis","surecart"))))}},{key:"render",value:function(){var e,n,t,r,i,o,a,l=null===(e=null==this?void 0:this.order)||void 0===e?void 0:e.checkout,c=null==l?void 0:l.manual_payment_method;return(0,u.h)("sc-spacing",{key:"0a1b06d09903d4b6a91e0806b8dd5d5d180510ec",style:{"--spacing":"var(--sc-spacing-large)"}},(0,u.h)("sc-dashboard-module",{key:"fce8d83bd6dbc50abf0bf35863d2209cb71ba107",error:this.error},(0,u.h)("span",{key:"05864e94000c9b6e375158457841c70c36a9fbeb",slot:"heading"},this.loading?(0,u.h)("sc-skeleton",{style:{width:"120px"}}):"#".concat(null===(n=null==this?void 0:this.order)||void 0===n?void 0:n.number)),!this.loading&&!(null==l?void 0:l.live_mode)&&(0,u.h)("sc-tag",{key:"fedef7cab61a712d7da08084572a71e09f79a4e1",type:"warning",slot:"end"},wp.i18n.__("Test Mode","surecart")),!!(null==c?void 0:c.name)&&!!(null==c?void 0:c.instructions)&&(0,u.h)("sc-order-manual-instructions",{key:"1dffc79c90db374bba647d4c43a0b4c004cccd99",manualPaymentTitle:null==c?void 0:c.name,manualPaymentInstructions:null==c?void 0:c.instructions}),(0,u.h)("sc-card",{key:"87db652b8edddfe0bba2b2197ebdc3aa502e2e4a","no-padding":!this.loading},this.loading?this.renderLoading():(0,u.h)(u.F,null,(0,u.h)("sc-stacked-list",null,(0,u.h)("sc-stacked-list-row",{style:{"--columns":"2"}},(0,u.h)("div",null,wp.i18n.__("Order Status","surecart")),(0,u.h)("sc-order-status-badge",{status:null===(t=null==this?void 0:this.order)||void 0===t?void 0:t.status})),(0,u.h)("sc-stacked-list-row",{style:{"--columns":"2"}},(0,u.h)("div",null,wp.i18n.__("Date","surecart")),(0,u.h)("span",null,null===(r=this.order)||void 0===r?void 0:r.created_at_date)),(0,u.h)("sc-stacked-list-row",{style:{"--columns":"2"}},(0,u.h)("div",null,wp.i18n.__("Payment Method","surecart")),(0,u.h)("sc-payment-method",{paymentMethod:null==l?void 0:l.payment_method})),(0,u.h)("div",{class:"order__row"},this.renderContent()))))),(null===(i=this.order)||void 0===i?void 0:i.statement_url)&&(0,u.h)("sc-button",{key:"698e2077d22e73405ab5708044ea5729586de16e",type:"primary",href:null===(o=this.order)||void 0===o?void 0:o.statement_url,target:"_blank"},(0,u.h)("sc-icon",{key:"19df078e7ddfb703e777a048f71f585a017a5965",name:"inbox",slot:"prefix"}),wp.i18n.__("Download Receipt/Invoice","surecart")),!!(null===(a=this.purchases)||void 0===a?void 0:a.length)&&(0,u.h)("sc-purchase-downloads-list",{key:"71451899b596e60d8ba7bfbf4e108d5a6567d84b",heading:wp.i18n.__("Downloads","surecart"),purchases:this.purchases}))}},{key:"el",get:function(){return(0,u.a)(this)}}]);var e,n,t}();f.style=":host{display:block}.order__row{padding:var(--sc-spacing-large);display:grid;gap:var(--sc-spacing-small)}"},18674:function(e,n,t){t.d(n,{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 n=arguments.length>1&&void 0!==arguments[1]&&arguments[1]?wp.i18n.__("Estimated Tax","surecart"):wp.i18n.__("Tax","surecart");return e?"".concat(n,": ").concat(e):n}}}]);