admin
3 days ago
blocks
3 days ago
components
3 days ago
icon-assets
1 week ago
scripts
1 year ago
store
1 month ago
styles
1 year ago
templates
1 month ago
vendor
1 month ago
1012.js
1 month ago
1013.js
1 month ago
1071.js
1 month ago
1222.js
1 month ago
1279.js
3 days ago
1331.js
1 week ago
1375.js
1 month ago
1418.js
1 month ago
1437.js
1 week ago
1467.js
1 month ago
1542.js
2 weeks ago
1545.js
1 week ago
1567.js
2 weeks ago
1712.js
2 weeks ago
1782.js
1 month ago
1834.js
1 month ago
1897.js
1 month ago
1935.js
1 month ago
1936.js
1 week ago
1972.js
1 month ago
2023.js
1 month ago
2039.js
1 week ago
2074.js
1 month ago
2107.js
2 weeks ago
2120.js
1 month ago
216.js
1 week ago
2161.js
1 month ago
2176.js
3 days ago
2179.js
1 month ago
219.js
1 week ago
2262.js
2 weeks ago
2321.js
1 week ago
2368.js
2 weeks ago
2393.js
1 month ago
2459.js
1 week ago
2487.js
1 month ago
2518.js
1 month ago
2655.js
1 month ago
2837.js
2 weeks ago
2850.js
2 weeks ago
2865.js
1 month ago
2878.js
2 weeks ago
2885.js
1 month ago
2894.js
1 month ago
294.js
1 month ago
2940.js
1 week ago
2948.js
1 month ago
3015.js
1 month ago
3074.js
1 month ago
3093.js
1 week ago
321.js
1 month ago
3291.js
1 month ago
3328.js
1 month ago
3346.js
2 weeks ago
3396.js
1 month ago
3419.js
1 month ago
348.js
2 weeks ago
3590.js
1 month ago
366.js
2 weeks ago
3684.js
1 month ago
3787.js
1 month ago
3789.js
1 month ago
3829.js
1 month ago
3877.js
2 weeks ago
3928.js
1 month ago
393.js
2 weeks ago
3998.js
2 weeks ago
4006.js
1 month ago
4009.js
1 month ago
4086.js
1 month ago
4127.js
1 month ago
4179.js
1 month ago
4264.js
1 month ago
4276.js
1 month ago
4372.js
2 weeks ago
4495.js
1 month ago
4498.js
1 month ago
4527.js
1 month ago
4612.js
1 month ago
4691.js
3 days ago
475.js
1 month ago
4869.js
1 month ago
4910.js
1 month ago
4917.js
1 month ago
515.js
2 weeks ago
5167.js
1 week ago
5223.js
1 week ago
5230.js
1 month ago
5235.js
1 week ago
5254.js
1 month ago
5360.js
1 month ago
5397.js
1 month ago
5426.js
1 week ago
5471.js
2 weeks ago
5503.js
1 month ago
5558.js
1 week ago
5585.js
1 month ago
5593.js
1 month ago
5611.js
2 weeks ago
5668.js
2 weeks ago
5703.js
1 month ago
5733.js
1 month ago
5812.js
1 month ago
5825.js
1 month ago
5908.js
1 week ago
6000.js
1 month ago
6008.js
1 month ago
6021.js
1 month ago
6034.js
1 month ago
6087.js
1 month ago
610.js
2 weeks ago
614.js
1 month ago
6241.js
1 month ago
6274.js
1 week ago
6325.js
1 month ago
6387.js
1 month ago
6453.js
1 month ago
648.js
2 weeks ago
6597.js
1 week ago
6653.js
1 month ago
6755.js
1 month ago
6756.js
1 month ago
686.js
1 month ago
6886.js
2 weeks ago
6912.js
2 weeks ago
6932.js
2 weeks ago
698.js
1 month ago
713.js
2 weeks ago
7245.js
2 weeks ago
7254.js
2 weeks ago
7272.js
1 week ago
7291.js
2 weeks ago
7313.js
1 month ago
7349.js
1 month ago
7435.js
2 weeks ago
7481.js
1 week ago
75.js
1 month ago
7513.js
1 month ago
758.js
1 month ago
7581.js
1 month ago
7624.js
1 month ago
7854.js
1 month ago
7893.js
1 month ago
8017.js
1 month ago
8053.js
2 weeks ago
8084.js
1 month ago
8110.js
1 month ago
8148.js
1 month ago
8207.js
1 month ago
8229.js
1 month ago
8270.js
2 weeks ago
829.js
2 weeks ago
8360.js
1 month ago
8371.js
1 week ago
839.js
1 month ago
8516.js
1 month ago
854.js
2 weeks ago
8566.js
1 month ago
8676.js
1 month ago
868.js
2 weeks ago
8695.js
2 weeks ago
8702.js
1 week ago
8739.js
1 month ago
8804.js
3 days ago
8820.js
1 week ago
8839.js
1 month ago
889.js
1 month ago
8923.js
2 weeks ago
8925.js
1 month ago
8935.js
1 month ago
8942.js
2 weeks ago
8979.js
1 month ago
9008.js
2 weeks ago
9010.js
1 month ago
9017.js
1 month ago
9023.js
2 weeks ago
903.js
1 month ago
9049.js
2 weeks ago
9063.js
2 weeks ago
9093.js
1 month ago
9140.js
2 weeks ago
9173.js
1 month ago
9210.js
1 month ago
9367.js
2 weeks ago
9372.js
1 month ago
9389.js
1 week ago
9433.js
2 weeks ago
9459.js
1 month ago
9537.js
1 week ago
9555.js
1 week ago
9640.js
1 month ago
9643.js
1 month ago
965.js
1 month ago
9687.js
2 weeks ago
9688.js
1 month ago
9691.js
2 weeks ago
9797.js
1 month ago
9804.js
1 month ago
9812.js
1 month ago
9846.js
1 month ago
9881.js
1 month ago
9969.js
2 weeks ago
sc-bundles-bulk-delete.js
1 month ago
sc-bundles-detail.js
3 days ago
sc-product-collections-detail.js
1 month ago
sc-product-groups-detail.js
1 month ago
sc-products-detail.js
3 days ago
sc-reviews-detail.js
3 days ago
style-rtl.css
1 month ago
style.css
1 month ago
2321.js
2 lines
| 1 | "use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[2321],{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 c(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 s(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)?s(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 s(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),s=a[0],u=a[1];if(Array.isArray(u)||u&&u.constructor===Object){var l,d=c(Object.entries(u).reverse());try{for(d.s();!(l=d.n()).done;){var p=(0,i.A)(l.value,2),f=p[0],h=p[1];r.unshift(["".concat(s,"[").concat(f,"]"),h])}}catch(e){d.e(e)}finally{d.f()}}else void 0!==u&&(null===u&&(u=""),t+="&"+[s,u].map(encodeURIComponent).join("="))}return t.substr(1)}function l(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(l),r=(0,i.A)(t,2),o=r[0],c=r[1],s=void 0===c?"":c;return o&&function(e,n,t){for(var r=n.length,i=r-1,o=0;o<r;o++){var c=n[o];!c&&Array.isArray(e)&&(c=e.length.toString()),c=["__proto__","constructor","prototype"].includes(c)?c.toUpperCase():c;var s=!isNaN(Number(n[o+1]));e[c]=o===i?t:e[c]||(s?[]:{}),Array.isArray(e[c])&&!s&&(e[c]=a({},e[c])),e=e[c]}}(e,o.replace(/\]/g,"").split("["),s),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 y}});var r,i,o,a,c,s,u,l=t(10467),d=t(89394),p=t(64467),f=t(89280),h=t.n(f),v=t(96030),m=t(34805),w=t(53506);function g(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 _=(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);_&&(v.a.fetchAllMiddleware=null,v.a.use(v.a.createRootURLMiddleware(_)),(null===(a=null===window||void 0===window?void 0:window.scData)||void 0===a?void 0:a.nonce)&&(v.a.nonceMiddleware=v.a.createNonceMiddleware(null===(c=null===window||void 0===window?void 0:window.scData)||void 0===c?void 0:c.nonce),v.a.use(v.a.nonceMiddleware)),(null===(s=null===window||void 0===window?void 0:window.scData)||void 0===s?void 0:s.nonce_endpoint)&&(v.a.nonceEndpoint=null===(u=null===window||void 0===window?void 0:window.scData)||void 0===u?void 0:u.nonce_endpoint),v.a.use((function(e,n){return e.path=(0,m.a)(e.path,{t:Date.now()}),n(e)})),v.a.use((function(e,n){return e.path=(0,m.a)(e.path,function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?g(Object(t),!0).forEach((function(n){(0,p.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):g(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},!!(0,w.g)(window.location.href,"currency")&&{currency:(0,w.g)(window.location.href,"currency")})),n(e)})),v.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 */ |
| 2 | 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 b=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}))},y=function(){var e=(0,l.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,b(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(v.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){v.a.nonceMiddleware.nonce=e})));case 6:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}()},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),c=t(89280),s=t.n(c),u=t(34805),l=t(53506),d=["rest_route"],p=["path","url"],f=["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 v(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 m(e,n){return void 0!==(0,l.g)(e,n)}function w(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 g=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(v(v({},e),{},{path:i}))};function _(e,n){return Promise.resolve(n?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var b=function(e){return e.json?e.json():Promise.reject(e)},y=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},j=function(){var e=(0,r.A)(s().mark((function e(n,t){var r,o,a,c,l,d;return s().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(v(v({},(f={per_page:100},void 0,void 0,h=(s=n).path,m=s.url,v(v({},(0,i.A)(s,p)),{},{url:m&&(0,u.a)(m,f),path:h&&(0,u.a)(h,f)}))),{},{parse:!1}));case 6:return r=e.sent,e.next=9,b(r);case 9:if(o=e.sent,Array.isArray(o)){e.next=12;break}return e.abrupt("return",o);case 12:if(a=y(r)){e.next=15;break}return e.abrupt("return",o);case 15:c=[].concat(o);case 16:if(!a){e.next=27;break}return e.next=19,M(v(v({},n),{},{path:void 0,url:a,parse:!1}));case 19:return l=e.sent,e.next=22,b(l);case 22:d=e.sent,c=c.concat(d),a=y(l),e.next=16;break;case 27:return e.abrupt("return",c);case 28:case"end":return e.stop()}var s,f,h,m}),e)})));return function(_x,n){return e.apply(this,arguments)}}(),k=new Set(["PATCH","PUT","DELETE"]),P=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 x(e,n)}))};function x(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"},S={credentials:"include"},D=[function(e,n){return"string"!=typeof e.url||m(e.url,"_locale")||(e.url=(0,u.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||m(e.path,"_locale")||(e.path=(0,u.a)(e.path,{_locale:"user"})),n(e)},g,function(e,n){var t=e.method,r=void 0===t?"GET":t;return k.has(r.toUpperCase())&&(e=v(v({},e),{},{headers:v(v({},e.headers),{},{"X-HTTP-Method-Override":r,"Content-Type":"application/json"}),method:"POST"})),n(e)},j],E=function(e){if(e.status>=200&&e.status<300)return e;throw e},T=function(e){var n=e.url,t=e.path,r=e.data,o=e.parse,a=void 0===o||o,c=(0,i.A)(e,f),s=e.body,u=e.headers;return u=v(v({},A),u),r&&(s=JSON.stringify(r),u["Content-Type"]="application/json"),window.fetch(n||t||window.location.href,v(v(v({},S),c),{},{body:s,headers:u})).then((function(e){return Promise.resolve(e).then(E).catch((function(e){return x(e,a)})).then((function(e){return P(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 D.reduceRight((function(e,n){return function(t){return n(t,e)}}),T)(e).catch((function(n){return"rest_cookie_invalid_nonce"!==n.code?Promise.reject(n):window.fetch(M.nonceEndpoint).then(E).then((function(e){return e.text()})).then((function(n){return M.nonceMiddleware.nonce=n,M(e)}))}))}M.use=function(e){D.unshift(e)},M.setFetchHandler=function(e){T=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(v(v({},n),{},{headers:v(v({},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[w(t),r]})));return function(e,t){var r=e.parse,o=void 0===r||r,a=e.path;if(!a&&e.url){var c=(0,u.g)(e.url),s=c.rest_route,l=(0,i.A)(c,d);"string"==typeof s&&(a=(0,u.a)(s,l))}if("string"!=typeof a)return t(e);var p=e.method||"GET",f=w(a);if("GET"===p&&n[f]){var h=n[f];return delete n[f],_(h,!!o)}if("OPTIONS"===p&&n[p]&&n[p][f]){var v=n[p][f];return delete n[p][f],_(v,!!o)}return t(e)}},M.createRootURLMiddleware=function(e){return function(n,t){return g(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(v(v({},n),{},{url:i}))}))}},M.fetchAllMiddleware=j,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(v(v({},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)})):x(n,e.parse)})).then((function(n){return P(n,e.parse)}))},M.createThemePreviewMiddleware=function(e){return function(n,t){if("string"==typeof n.url){var r=(0,l.g)(n.url,"wp_theme_preview");void 0===r?n.url=(0,u.a)(n.url,{wp_theme_preview:e}):""===r&&(n.url=(0,l.r)(n.url,"wp_theme_preview"))}if("string"==typeof n.path){var i=(0,l.g)(n.path,"wp_theme_preview");void 0===i?n.path=(0,u.a)(n.path,{wp_theme_preview:e}):""===i&&(n.path=(0,l.r)(n.path,"wp_theme_preview"))}return t(n)}}},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),c=1;c<o;c++)a[c-1]=arguments[c];a.forEach((function(e){return delete t[e]}));var s=(0,r.b)(t);return s?i+"?"+s:i}},12321:function(e,n,t){t.r(n),t.d(n,{sc_fulfillments:function(){return f}});var r=t(64467),i=t(10467),o=t(23029),a=t(92901),c=t(89280),s=t.n(c),u=t(27364),l=(t(78095),t(34805)),d=t(96030);function p(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 f=function(){return(0,a.A)((function e(n){(0,o.A)(this,e),(0,u.r)(this,n),this.orderId=void 0,this.heading=void 0,this.showPreShipmentNotice=!0,this.fulfillments=void 0,this.awaitingFulfillment=!1,this.loading=void 0,this.busy=void 0,this.error=void 0}),[{key:"componentDidLoad",value:function(){this.fetch()}},{key:"fetch",value:(n=(0,i.A)(s().mark((function e(){var n;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.busy=!0,e.next=4,(0,d.a)({path:(0,l.a)("surecart/v1/fulfillments",{expand:["trackings","shipments","fulfillment_items","fulfillment_item.line_item","line_item.price","price.product"],order_ids:[this.orderId],shipment_status:["shipped","delivered","in_transit","label_purchased","unshipped","returned","failed"]})});case 4:if(n=e.sent,this.fulfillments=n.filter((function(e){var n;return"unshipped"!==(null==e?void 0:e.shipment_status)||((null===(n=null==e?void 0:e.shipments)||void 0===n?void 0:n.data)||[]).some((function(e){return"voided"===(null==e?void 0:e.status)}))})),this.fulfillments.length||!this.showPreShipmentNotice){e.next=9;break}return e.next=9,this.checkAwaitingFulfillment();case 9:e.next=15;break;case 11:e.prev=11,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 15:return e.prev=15,this.busy=!1,e.finish(15);case 18:case"end":return e.stop()}}),e,this,[[0,11,15,18]])}))),function(){return n.apply(this,arguments)})},{key:"checkAwaitingFulfillment",value:(e=(0,i.A)(s().mark((function e(){var n,t,r,i;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,(0,d.a)({path:(0,l.a)("surecart/v1/orders/".concat(this.orderId),{expand:["checkout","checkout.line_items","line_item.price","price.product"]})});case 3:r=e.sent,i=((null===(t=null===(n=null==r?void 0:r.checkout)||void 0===n?void 0:n.line_items)||void 0===t?void 0:t.data)||[]).some((function(e){var n,t;return!!(null===(t=null===(n=null==e?void 0:e.price)||void 0===n?void 0:n.product)||void 0===t?void 0:t.shipping_enabled)})),this.awaitingFulfillment=i&&["paid","processing"].includes(null==r?void 0:r.status),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),console.error(e.t0);case 11:case"end":return e.stop()}}),e,this,[[0,8]])}))),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:"renderOrderReceived",value:function(){return(0,u.h)("sc-spacing",{style:{"--spacing":"var(--sc-spacing-large)"}},(0,u.h)("sc-dashboard-module",null,(0,u.h)("span",{slot:"heading"},this.heading||wp.i18n.__("Shipment","surecart")),(0,u.h)("sc-card",{noPadding:!0},(0,u.h)("sc-stacked-list",null,(0,u.h)("sc-stacked-list-row",null,(0,u.h)("div",{class:"fulfillment__header"},(0,u.h)("sc-tag",{type:"info"},wp.i18n.__("Order Received","surecart")),(0,u.h)("div",null,wp.i18n.__("Your item will ship soon.","surecart"))))))))}},{key:"render",value:function(){var e,n;return this.loading||!(null===(e=this.fulfillments)||void 0===e?void 0:e.length)?this.awaitingFulfillment&&this.showPreShipmentNotice?this.renderOrderReceived():(0,u.h)(u.H,{style:{display:"none"}}):(0,u.h)("sc-spacing",{style:{"--spacing":"var(--sc-spacing-large)"}},(0,u.h)("sc-dashboard-module",{error:this.error},(0,u.h)("span",{slot:"heading"},this.heading||wp.i18n._n("Shipment","Shipments",null===(n=this.fulfillments)||void 0===n?void 0:n.length,"surecart")),this.fulfillments.map((function(e){var n,t,i,o=(null===(n=null==e?void 0:e.shipments)||void 0===n?void 0:n.data)||[],a=o.find((function(e){return"purchased"===(null==e?void 0:e.status)}))||o.find((function(e){return"voided"!==(null==e?void 0:e.status)}))||o[0],c="purchased"===(null==a?void 0:a.status)&&!!(null==a?void 0:a.tracking_number),s=c?[{number:a.tracking_number,url:a.tracking_url}]:(null===(t=null==e?void 0:e.trackings)||void 0===t?void 0:t.data)||[];return(0,u.h)("sc-card",{noPadding:!0},(0,u.h)("sc-stacked-list",null,(0,u.h)("sc-stacked-list-row",null,(0,u.h)("div",{class:"fulfillment__header"},(0,u.h)("sc-fulfillment-shipping-status-badge",{status:"voided"===(null==a?void 0:a.status)?"voided":e.shipment_status,context:"customer"}),(0,u.h)("div",{class:"fulfillment__number"},"#",null==e?void 0:e.number))),!!s.length&&(0,u.h)("sc-stacked-list-row",null,(0,u.h)("div",{class:"trackings"},(0,u.h)("sc-icon",{name:"truck"}),(0,u.h)("div",{class:"trackings__details"},(0,u.h)("div",{class:"trackings__title"},c&&(null==a?void 0:a.carrier)?wp.i18n.sprintf(wp.i18n.__("Tracking number via %s","surecart"),a.carrier):wp.i18n._n("Tracking number","Tracking numbers",s.length,"surecart")),(0,u.h)("div",{class:"trackings__list"},s.map((function(e){var n=e.number,t=e.url;return(0,u.h)("a",{href:t,target:"_blank",rel:"noopener noreferrer"},n)})))))),((null===(i=null==e?void 0:e.fulfillment_items)||void 0===i?void 0:i.data)||[]).map((function(e){var n,t,i,o,a,c,s,l,d,f,h,v,m=e.id,w=e.line_item,g=e.quantity;return(0,u.h)("sc-stacked-list-row",{key:m,style:{"--columns":"2"}},(0,u.h)("div",null,(0,u.h)("div",{class:"line_item__info"},(0,u.h)("div",{class:"line_item__image"},!!(null===(t=null===(n=null==w?void 0:w.price)||void 0===n?void 0:n.product)||void 0===t?void 0:t.line_item_image)&&(0,u.h)("img",function(e){for(var n=1;n<arguments.length;n++){var t=null!=arguments[n]?arguments[n]:{};n%2?p(Object(t),!0).forEach((function(n){(0,r.A)(e,n,t[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):p(Object(t)).forEach((function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(t,n))}))}return e}({},null===(o=null===(i=null==w?void 0:w.price)||void 0===i?void 0:i.product)||void 0===o?void 0:o.line_item_image))),(0,u.h)("div",{class:"line_item__text"},(0,u.h)("div",null,null===(c=null===(a=null==w?void 0:w.price)||void 0===a?void 0:a.product)||void 0===c?void 0:c.name),(0,u.h)("div",null,!!(null===(l=null===(s=null==w?void 0:w.price)||void 0===s?void 0:s.product)||void 0===l?void 0:l.weight)&&(0,u.h)("sc-format-number",{type:"unit",value:null===(f=null===(d=null==w?void 0:w.price)||void 0===d?void 0:d.product)||void 0===f?void 0:f.weight,unit:null===(v=null===(h=null==w?void 0:w.price)||void 0===h?void 0:h.product)||void 0===v?void 0:v.weight_unit}))))),(0,u.h)("span",null,wp.i18n.sprintf(wp.i18n.__("Qty: %d","surecart"),g||0)))}))))}))))}},{key:"el",get:function(){return(0,u.a)(this)}}]);var e,n}();f.style=".fulfillment{display:grid;gap:var(--sc-spacing-x-large)}.fulfillment__number{font-weight:bold}.fulfillment__header{display:flex;align-items:center;gap:var(--sc-spacing-medium)}sc-card{--sc-card-padding:var(--sc-spacing-x-large)}.trackings{display:flex;gap:0.75em;color:var(--sc-line-item-title-color, var(--sc-input-label-color))}.trackings__title{line-height:var(--sc-line-height-dense);font-weight:var(--sc-font-weight-bold)}.trackings sc-icon{opacity:0.5;font-size:22px}.line_items{display:grid;gap:var(--sc-spacing-large)}.line_item__info{display:flex;gap:var(--sc-spacing-medium);align-items:center}.line_item__image img{width:var(--sc-product-line-item-image-size, 4em);height:var(--sc-product-line-item-image-size, 4em);object-fit:cover;border-radius:4px;border:solid 1px var(--sc-input-border-color, var(--sc-input-border));display:block;box-shadow:var(--sc-input-box-shadow)}"}}]); |