admin
3 days ago
blocks
3 days ago
components
3 days ago
icon-assets
2 months ago
scripts
1 year ago
store
1 week ago
styles
1 year ago
templates
1 week ago
vendor
1 week ago
1012.js
1 week ago
1013.js
1 week ago
1071.js
3 days ago
1222.js
3 days ago
1279.js
3 days ago
1331.js
3 days ago
1375.js
3 days ago
1418.js
3 days ago
1437.js
3 days ago
1467.js
3 days ago
1542.js
3 days ago
1545.js
3 days ago
1567.js
3 days ago
1712.js
3 days ago
1782.js
3 days ago
1834.js
3 days ago
1897.js
3 days ago
1935.js
3 days ago
1936.js
3 days ago
1972.js
1 week ago
2023.js
3 days ago
2039.js
3 days ago
2074.js
3 days ago
2107.js
3 days ago
2120.js
1 week ago
216.js
3 days ago
2161.js
3 days ago
2176.js
3 days ago
2179.js
3 days ago
2262.js
3 days ago
2321.js
1 week ago
2368.js
3 days ago
2393.js
1 week ago
2459.js
3 days ago
2487.js
3 days ago
2518.js
3 days ago
2655.js
3 days ago
2837.js
3 days ago
2850.js
3 days ago
2865.js
3 days ago
2878.js
3 days ago
2885.js
3 days ago
2894.js
3 days ago
294.js
3 days ago
2940.js
3 days ago
2948.js
3 days ago
3015.js
3 days ago
3074.js
1 week ago
3093.js
1 week ago
3163.js
3 days ago
321.js
3 days ago
3291.js
1 week ago
3328.js
3 days ago
3346.js
3 days ago
3396.js
3 days ago
3419.js
3 days ago
348.js
3 days ago
3590.js
1 week ago
366.js
3 days ago
3684.js
1 week ago
3787.js
3 days ago
3789.js
3 days ago
3829.js
3 days ago
3877.js
3 days ago
3928.js
1 week ago
393.js
3 days ago
3998.js
1 week ago
4006.js
3 days ago
4009.js
1 week ago
4086.js
3 days ago
4127.js
3 days ago
4179.js
3 days ago
4264.js
1 week ago
4276.js
1 week ago
4372.js
3 days ago
4495.js
3 days ago
4498.js
3 days ago
4527.js
3 days ago
4612.js
1 week ago
4691.js
3 days ago
475.js
3 days ago
4869.js
3 days ago
4910.js
3 days ago
4917.js
3 days ago
515.js
3 days ago
5167.js
3 days ago
5223.js
3 days ago
5230.js
1 week ago
5235.js
3 days ago
5254.js
3 days ago
5360.js
3 days ago
5397.js
3 days ago
5426.js
3 days ago
5471.js
3 days ago
5503.js
3 days ago
5558.js
3 days ago
5585.js
3 days ago
5593.js
3 days ago
5611.js
3 days ago
5668.js
3 days ago
5703.js
3 days ago
5733.js
3 days ago
5812.js
3 days ago
5825.js
3 days ago
5908.js
3 days ago
6000.js
3 days ago
6008.js
3 days ago
6021.js
3 days ago
6034.js
1 week ago
6087.js
3 days ago
610.js
3 days ago
614.js
3 days ago
6241.js
1 week ago
6274.js
1 week ago
6325.js
3 days ago
6387.js
3 days ago
6453.js
1 week ago
648.js
3 days ago
6653.js
3 days ago
6755.js
3 days ago
6756.js
3 days ago
686.js
3 days ago
6886.js
3 days ago
6912.js
3 days ago
6932.js
3 days ago
698.js
1 week ago
713.js
3 days ago
7245.js
3 days ago
7254.js
3 days ago
7272.js
3 days ago
7291.js
1 week ago
7313.js
3 days ago
7349.js
3 days ago
7354.js
3 days ago
7435.js
3 days ago
7481.js
3 days ago
75.js
1 week ago
7513.js
3 days ago
758.js
3 days ago
7581.js
1 week ago
7624.js
3 days ago
7854.js
3 days ago
7893.js
1 week ago
8017.js
3 days ago
8053.js
3 days ago
8084.js
1 week ago
8110.js
1 week ago
8148.js
3 days ago
8207.js
3 days ago
8229.js
3 days ago
8270.js
3 days ago
829.js
3 days ago
8360.js
3 days ago
8371.js
3 days ago
839.js
3 days ago
8516.js
3 days ago
854.js
3 days ago
8566.js
3 days ago
8676.js
3 days ago
868.js
1 week ago
8695.js
3 days ago
8702.js
3 days ago
8739.js
3 days ago
8804.js
3 days ago
8820.js
3 days ago
8839.js
3 days ago
889.js
3 days ago
8923.js
3 days ago
8925.js
3 days ago
8935.js
1 week ago
8942.js
3 days ago
8979.js
3 days ago
9008.js
3 days ago
9010.js
1 week ago
9017.js
3 days ago
9023.js
3 days ago
903.js
1 week ago
9049.js
3 days ago
9063.js
3 days ago
9093.js
1 week ago
9140.js
3 days ago
9173.js
1 week ago
9210.js
3 days ago
9367.js
3 days ago
9372.js
3 days ago
9389.js
3 days ago
9433.js
3 days ago
9459.js
3 days ago
9537.js
3 days ago
9555.js
3 days ago
9640.js
3 days ago
9643.js
3 days ago
965.js
3 days ago
9687.js
3 days ago
9688.js
3 days ago
9691.js
3 days ago
9797.js
3 days ago
9804.js
3 days ago
9812.js
1 week ago
9846.js
3 days ago
9881.js
3 days ago
9969.js
3 days ago
sc-bundles-bulk-delete.js
3 days ago
sc-bundles-detail.js
3 days ago
sc-product-collections-detail.js
3 days ago
sc-product-groups-detail.js
1 week ago
sc-products-detail.js
3 days ago
sc-reviews-detail.js
1 week ago
style-rtl.css
1 week ago
style.css
1 week ago
5585.js
2 lines
| 1 | "use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[5585],{34805:function(e,t,r){r.d(t,{a:function(){return l},b:function(){return u},g:function(){return d}});var n=r(64467),o=r(3453);function a(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function i(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?a(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):a(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function c(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return s(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?s(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var _n=0,n=function(){};return{s:n,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:n}}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 o,a=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){i=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(i)throw o}}}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function u(e){for(var t,r="",n=Object.entries(e);t=n.shift();){var a=t,i=(0,o.A)(a,2),s=i[0],u=i[1];if(Array.isArray(u)||u&&u.constructor===Object){var p,d=c(Object.entries(u).reverse());try{for(d.s();!(p=d.n()).done;){var l=(0,o.A)(p.value,2),f=l[0],h=l[1];n.unshift(["".concat(s,"[").concat(f,"]"),h])}}catch(e){d.e(e)}finally{d.f()}}else void 0!==u&&(null===u&&(u=""),r+="&"+[s,u].map(encodeURIComponent).join("="))}return r.substr(1)}function p(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 r=t.split("=").filter(Boolean).map(p),n=(0,o.A)(r,2),a=n[0],c=n[1],s=void 0===c?"":c;return a&&function(e,t,r){for(var n=t.length,o=n-1,a=0;a<n;a++){var c=t[a];!c&&Array.isArray(e)&&(c=e.length.toString()),c=["__proto__","constructor","prototype"].includes(c)?c.toUpperCase():c;var s=!isNaN(Number(t[a+1]));e[c]=a===o?r:e[c]||(s?[]:{}),Array.isArray(e[c])&&!s&&(e[c]=i({},e[c])),e=e[c]}}(e,a.replace(/\]/g,"").split("["),s),e}),Object.create(null))}function l(){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 r=e,n=e.indexOf("?");return-1!==n&&(t=Object.assign(d(e),t),r=r.substr(0,n)),r+"?"+u(t)}},78095:function(e,t,r){r.d(t,{h:function(){return O}});var n,o,a,i,c,s,u,p=r(10467),d=r(89394),l=r(64467),f=r(89280),h=r.n(f),v=r(96030),w=r(34805),g=r(53506);function b(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}var y=(null===(o=null===(n=null===window||void 0===window?void 0:window.parent)||void 0===n?void 0:n.scData)||void 0===o?void 0:o.root_url)||(null===(a=null===window||void 0===window?void 0:window.scData)||void 0===a?void 0:a.root_url);y&&(v.a.fetchAllMiddleware=null,v.a.use(v.a.createRootURLMiddleware(y)),(null===(i=null===window||void 0===window?void 0:window.scData)||void 0===i?void 0:i.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,t){return e.path=(0,w.a)(e.path,{t:Date.now()}),t(e)})),v.a.use((function(e,t){return e.path=(0,w.a)(e.path,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?b(Object(r),!0).forEach((function(t){(0,l.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):b(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},!!(0,g.g)(window.location.href,"currency")&&{currency:(0,g.g)(window.location.href,"currency")})),t(e)})),v.a.use((function(e,t){var r=t(e);return r.catch((function(e){var t;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===(t=null==e?void 0:e.additional_errors)||void 0===t?void 0:t.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)})),r})));var m=function(e){var t={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 t;return e.json().catch((function(){throw t}))},O=function(){var e=(0,p.A)(h().mark((function e(t){var r;return h().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m(t);case 2:if("rest_cookie_invalid_nonce"===(r=e.sent).code){e.next=5;break}throw r;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,t,r){r.d(t,{a:function(){return I}});var n=r(10467),o=r(80045),a=r(3453),i=r(64467),c=r(89280),s=r.n(c),u=r(34805),p=r(53506),d=["rest_route"],l=["path","url"],f=["url","path","data","parse"];function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function v(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach((function(t){(0,i.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function w(e,t){return void 0!==(0,p.g)(e,t)}function g(e){var t=e.split("?"),r=t[1],n=t[0];return r?n+"?"+r.split("&").map((function(e){return e.split("=")})).map((function(e){return e.map(decodeURIComponent)})).sort((function(e,t){return e[0].localeCompare(t[0])})).map((function(e){return e.map(encodeURIComponent)})).map((function(e){return e.join("=")})).join("&"):n}var b=function(e,t){var r,n,o=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(r=e.namespace.replace(/^\/|\/$/g,""),o=(n=e.endpoint.replace(/^\//,""))?r+"/"+n:r),delete e.namespace,delete e.endpoint,t(v(v({},e),{},{path:o}))};function y(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var m=function(e){return e.json?e.json():Promise.reject(e)},O=function(e){return function(e){if(!e)return{};var t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}}(e.headers.get("link")).next},_=function(e){var t=!!e.path&&-1!==e.path.indexOf("per_page=-1"),r=!!e.url&&-1!==e.url.indexOf("per_page=-1");return t||r},j=function(){var e=(0,n.A)(s().mark((function e(t,r){var n,a,i,c,p,d;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==t.parse){e.next=2;break}return e.abrupt("return",r(t));case 2:if(_(t)){e.next=4;break}return e.abrupt("return",r(t));case 4:return e.next=6,I(v(v({},(f={per_page:100},void 0,void 0,h=(s=t).path,w=s.url,v(v({},(0,o.A)(s,l)),{},{url:w&&(0,u.a)(w,f),path:h&&(0,u.a)(h,f)}))),{},{parse:!1}));case 6:return n=e.sent,e.next=9,m(n);case 9:if(a=e.sent,Array.isArray(a)){e.next=12;break}return e.abrupt("return",a);case 12:if(i=O(n)){e.next=15;break}return e.abrupt("return",a);case 15:c=[].concat(a);case 16:if(!i){e.next=27;break}return e.next=19,I(v(v({},t),{},{path:void 0,url:i,parse:!1}));case 19:return p=e.sent,e.next=22,m(p);case 22:d=e.sent,c=c.concat(d),i=O(p),e.next=16;break;case 27:return e.abrupt("return",c);case 28:case"end":return e.stop()}var s,f,h,w}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),P=new Set(["PATCH","PUT","DELETE"]),k=function(e){var t=!(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,t)).catch((function(e){return x(e,t)}))};function x(e){if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1])throw e;return function(e){var t={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!e||!e.json)throw t;return e.json().catch((function(){throw t}))}(e).then((function(e){var t={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw e||t}))}var A={Accept:"application/json, */*;q=0.1"},S={credentials:"include"},D=[function(e,t){return"string"!=typeof e.url||w(e.url,"_locale")||(e.url=(0,u.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||w(e.path,"_locale")||(e.path=(0,u.a)(e.path,{_locale:"user"})),t(e)},b,function(e,t){var r=e.method,n=void 0===r?"GET":r;return P.has(n.toUpperCase())&&(e=v(v({},e),{},{headers:v(v({},e.headers),{},{"X-HTTP-Method-Override":n,"Content-Type":"application/json"}),method:"POST"})),t(e)},j],E=function(e){if(e.status>=200&&e.status<300)return e;throw e},T=function(e){var t=e.url,r=e.path,n=e.data,a=e.parse,i=void 0===a||a,c=(0,o.A)(e,f),s=e.body,u=e.headers;return u=v(v({},A),u),n&&(s=JSON.stringify(n),u["Content-Type"]="application/json"),window.fetch(t||r||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,i)})).then((function(e){return k(e,i)}))}),(function(e){if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function I(e){return D.reduceRight((function(e,t){return function(r){return t(r,e)}}),T)(e).catch((function(t){return"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(I.nonceEndpoint).then(E).then((function(e){return e.text()})).then((function(t){return I.nonceMiddleware.nonce=t,I(e)}))}))}I.use=function(e){D.unshift(e)},I.setFetchHandler=function(e){T=e},I.createNonceMiddleware=function(e){var t=function e(t,r){var n=t.headers,o=void 0===n?{}:n;for(var a in o)if("x-wp-nonce"===a.toLowerCase()&&o[a]===e.nonce)return r(t);return r(v(v({},t),{},{headers:v(v({},o),{},{"X-WP-Nonce":e.nonce})}))};return t.nonce=e,t},I.createPreloadingMiddleware=function(e){var t=Object.fromEntries(Object.entries(e).map((function(e){var t=(0,a.A)(e,2),r=t[0],n=t[1];return[g(r),n]})));return function(e,r){var n=e.parse,a=void 0===n||n,i=e.path;if(!i&&e.url){var c=(0,u.g)(e.url),s=c.rest_route,p=(0,o.A)(c,d);"string"==typeof s&&(i=(0,u.a)(s,p))}if("string"!=typeof i)return r(e);var l=e.method||"GET",f=g(i);if("GET"===l&&t[f]){var h=t[f];return delete t[f],y(h,!!a)}if("OPTIONS"===l&&t[l]&&t[l][f]){var v=t[l][f];return delete t[l][f],y(v,!!a)}return r(e)}},I.createRootURLMiddleware=function(e){return function(t,r){return b(t,(function(t){var n,o=t.url,a=t.path;return"string"==typeof a&&(n=e,-1!==e.indexOf("?")&&(a=a.replace("?","&")),a=a.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(a=a.replace("?","&")),o=n+a),r(v(v({},t),{},{url:o}))}))}},I.fetchAllMiddleware=j,I.mediaUploadMiddleware=function(e,t){if(!function(e){var t=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&t}(e))return t(e);var r=0,n=function e(n){return r++,t({path:"/wp/v2/media/".concat(n,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return r<5?e(n):(t({path:"/wp/v2/media/".concat(n,"?force=true"),method:"DELETE"}),Promise.reject())}))};return t(v(v({},e),{},{parse:!1})).catch((function(t){var r=t.headers.get("x-wp-upload-attachment-id");return t.status>=500&&t.status<600&&r?n(r).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(t)})):x(t,e.parse)})).then((function(t){return k(t,e.parse)}))},I.createThemePreviewMiddleware=function(e){return function(t,r){if("string"==typeof t.url){var n=(0,p.g)(t.url,"wp_theme_preview");void 0===n?t.url=(0,u.a)(t.url,{wp_theme_preview:e}):""===n&&(t.url=(0,p.r)(t.url,"wp_theme_preview"))}if("string"==typeof t.path){var o=(0,p.g)(t.path,"wp_theme_preview");void 0===o?t.path=(0,u.a)(t.path,{wp_theme_preview:e}):""===o&&(t.path=(0,p.r)(t.path,"wp_theme_preview"))}return r(t)}}},92942:function(e,t,r){r.d(t,{o:function(){return n}});var n=function(e,t){new window.IntersectionObserver((function(e,r){e[0].intersectionRatio>0&&(t(),r.unobserve(e[0].target))})).observe(e)}},53506:function(e,t,r){r.d(t,{g:function(){return o},r:function(){return a}});var n=r(34805);function o(e,t){return(0,n.g)(e)[t]}function a(e){var t=e.indexOf("?");if(-1===t)return e;for(var r=(0,n.g)(e),o=e.substr(0,t),a=arguments.length,i=new Array(a>1?a-1:0),c=1;c<a;c++)i[c-1]=arguments[c];i.forEach((function(e){return delete r[e]}));var s=(0,n.b)(r);return s?o+"?"+s:o}},15585:function(e,t,r){r.r(t),r.d(t,{sc_dashboard_downloads_list:function(){return v}});var n=r(64467),o=r(10467),a=r(23029),i=r(92901),c=r(89280),s=r.n(c),u=r(27364),p=(r(78095),r(92942)),d=r(34805),l=r(96030);function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,n)}return r}function h(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var v=function(){return(0,i.A)((function e(t){(0,a.A)(this,e),(0,u.r)(this,t),this.query={page:1,per_page:10},this.allLink=void 0,this.heading=void 0,this.isCustomer=void 0,this.requestNonce=void 0,this.purchases=[],this.loading=void 0,this.busy=void 0,this.error=void 0,this.pagination={total:0,total_pages:0}}),[{key:"componentWillLoad",value:function(){var e=this;(0,p.o)(this.el,(function(){e.initialFetch()}))}},{key:"initialFetch",value:(r=(0,o.A)(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isCustomer){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.loading=!0,e.next=6,this.getItems();case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),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 12:return e.prev=12,this.loading=!1,e.finish(12);case 15:case"end":return e.stop()}}),e,this,[[2,8,12,15]])}))),function(){return r.apply(this,arguments)})},{key:"fetchItems",value:(t=(0,o.A)(s().mark((function e(){return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.isCustomer){e.next=2;break}return e.abrupt("return");case 2:return e.prev=2,this.busy=!0,e.next=6,this.getItems();case 6:e.next=12;break;case 8:e.prev=8,e.t0=e.catch(2),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 12:return e.prev=12,this.busy=!1,e.finish(12);case 15:case"end":return e.stop()}}),e,this,[[2,8,12,15]])}))),function(){return t.apply(this,arguments)})},{key:"getItems",value:(e=(0,o.A)(s().mark((function e(){var t;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,(0,l.a)({path:(0,d.a)("surecart/v1/purchases/",h({expand:["product","product.downloads","download.media","variant","variant.downloads"],downloadable:!0,revoked:!1},this.query)),parse:!1});case 2:return e.next=4,e.sent;case 4:return t=e.sent,this.pagination={total:parseInt(t.headers.get("X-WP-Total")),total_pages:parseInt(t.headers.get("X-WP-TotalPages"))},e.next=8,t.json();case 8:return this.purchases=e.sent,e.abrupt("return",this.purchases);case 10:case"end":return e.stop()}}),e,this)}))),function(){return e.apply(this,arguments)})},{key:"nextPage",value:function(){this.query.page=this.query.page+1,this.fetchItems()}},{key:"prevPage",value:function(){this.query.page=this.query.page-1,this.fetchItems()}},{key:"render",value:function(){var e,t=this;return(0,u.h)("sc-purchase-downloads-list",{key:"3bb1a1329d2e0460e1ff45b0dc0e3955a2d4573d",heading:this.heading,allLink:this.allLink&&this.pagination.total_pages>1?this.allLink:"",loading:this.loading,busy:this.busy,requestNonce:this.requestNonce,error:this.error,purchases:this.purchases},(0,u.h)("span",{key:"3f708a92e3438c8f42d8ad74d884e8927def8b44",slot:"heading"},(0,u.h)("slot",{key:"0e1f87089c189ed7f7bccd019487f920600d7ec0",name:"heading"},this.heading||wp.i18n.__("Downloads","surecart"))),(0,u.h)("sc-pagination",{key:"e8364cd14d2c640ebf5b9a525e2bb43080bd58dc",slot:"after",page:this.query.page,perPage:this.query.per_page,total:this.pagination.total,totalPages:this.pagination.total_pages,totalShowing:null===(e=null==this?void 0:this.purchases)||void 0===e?void 0:e.length,onScNextPage:function(){return t.nextPage()},onScPrevPage:function(){return t.prevPage()}}))}},{key:"el",get:function(){return(0,u.a)(this)}}]);var e,t,r}();v.style=":host{display:block}.download__details{opacity:0.75}"}}]); |