FileMaster
Search
Toggle Dark Mode
Home
/
.
/
wp-content
/
plugins
/
surecart
/
dist
Edit File: 5585.js
"use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[5585],{4805:function(e,t,r){r.d(t,{a:function(){return l},b:function(){return u},g:function(){return d}});var n=r(4467),o=r(3453);function i(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 a(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?i(Object(r),!0).forEach((function(t){(0,n.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):i(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,i=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return i=e.done,e},e:function(e){a=!0,o=e},f:function(){try{i||null==r.return||r.return()}finally{if(a)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 i=t,a=(0,o.A)(i,2),s=a[0],u=a[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),i=n[0],c=n[1],s=void 0===c?"":c;return i&&function(e,t,r){for(var n=t.length,o=n-1,i=0;i<n;i++){var c=t[i];!c&&Array.isArray(e)&&(c=e.length.toString()),c=["__proto__","constructor","prototype"].includes(c)?c.toUpperCase():c;var s=!isNaN(Number(t[i+1]));e[c]=i===o?r:e[c]||(s?[]:{}),Array.isArray(e[c])&&!s&&(e[c]=a({},e[c])),e=e[c]}}(e,i.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)}},8803:function(e,t,r){r.d(t,{a:function(){return J},h:function(){return X}});var n=r(9394),o=r(467),i=r(45),a=r(3453),c=r(4467),s=r(9280),u=r.n(s),p=r(4805),d=r(3506),l=["rest_route"],f=["path","url"],h=["url","path","data","parse"];function v(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 w(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?v(Object(r),!0).forEach((function(t){(0,c.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):v(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t){return void 0!==(0,d.g)(e,t)}function b(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 y=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(w(w({},e),{},{path:o}))};function m(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var _=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},j=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},P=function(){var e=(0,o.A)(u().mark((function e(t,r){var n,o,a,c,s,d;return u().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(j(t)){e.next=4;break}return e.abrupt("return",r(t));case 4:return e.next=6,J(w(w({},(l={per_page:100},void 0,void 0,h=(u=t).path,v=u.url,w(w({},(0,i.A)(u,f)),{},{url:v&&(0,p.a)(v,l),path:h&&(0,p.a)(h,l)}))),{},{parse:!1}));case 6:return n=e.sent,e.next=9,_(n);case 9:if(o=e.sent,Array.isArray(o)){e.next=12;break}return e.abrupt("return",o);case 12:if(a=O(n)){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,J(w(w({},t),{},{path:void 0,url:a,parse:!1}));case 19:return s=e.sent,e.next=22,_(s);case 22:d=e.sent,c=c.concat(d),a=O(s),e.next=16;break;case 27:return e.abrupt("return",c);case 28:case"end":return e.stop()}var u,l,h,v}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),k=new Set(["PATCH","PUT","DELETE"]),x=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 A(e,t)}))};function A(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 S,T,D,E,I,C,M,N={Accept:"application/json, */*;q=0.1"},q={credentials:"include"},R=[function(e,t){return"string"!=typeof e.url||g(e.url,"_locale")||(e.url=(0,p.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||g(e.path,"_locale")||(e.path=(0,p.a)(e.path,{_locale:"user"})),t(e)},y,function(e,t){var r=e.method,n=void 0===r?"GET":r;return k.has(n.toUpperCase())&&(e=w(w({},e),{},{headers:w(w({},e.headers),{},{"X-HTTP-Method-Override":n,"Content-Type":"application/json"}),method:"POST"})),t(e)},P],U=function(e){if(e.status>=200&&e.status<300)return e;throw e},L=function(e){var t=e.url,r=e.path,n=e.data,o=e.parse,a=void 0===o||o,c=(0,i.A)(e,h),s=e.body,u=e.headers;return u=w(w({},N),u),n&&(s=JSON.stringify(n),u["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,w(w(w({},q),c),{},{body:s,headers:u})).then((function(e){return Promise.resolve(e).then(U).catch((function(e){return A(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 J(e){return R.reduceRight((function(e,t){return function(r){return t(r,e)}}),L)(e).catch((function(t){return"rest_cookie_invalid_nonce"!==t.code?Promise.reject(t):window.fetch(J.nonceEndpoint).then(U).then((function(e){return e.text()})).then((function(t){return J.nonceMiddleware.nonce=t,J(e)}))}))}J.use=function(e){R.unshift(e)},J.setFetchHandler=function(e){L=e},J.createNonceMiddleware=function(e){var t=function e(t,r){var n=t.headers,o=void 0===n?{}:n;for(var i in o)if("x-wp-nonce"===i.toLowerCase()&&o[i]===e.nonce)return r(t);return r(w(w({},t),{},{headers:w(w({},o),{},{"X-WP-Nonce":e.nonce})}))};return t.nonce=e,t},J.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[b(r),n]})));return function(e,r){var n=e.parse,o=void 0===n||n,a=e.path;if(!a&&e.url){var c=(0,p.g)(e.url),s=c.rest_route,u=(0,i.A)(c,l);"string"==typeof s&&(a=(0,p.a)(s,u))}if("string"!=typeof a)return r(e);var d=e.method||"GET",f=b(a);if("GET"===d&&t[f]){var h=t[f];return delete t[f],m(h,!!o)}if("OPTIONS"===d&&t[d]&&t[d][f]){var v=t[d][f];return delete t[d][f],m(v,!!o)}return r(e)}},J.createRootURLMiddleware=function(e){return function(t,r){return y(t,(function(t){var n,o=t.url,i=t.path;return"string"==typeof i&&(n=e,-1!==e.indexOf("?")&&(i=i.replace("?","&")),i=i.replace(/^\//,""),"string"==typeof n&&-1!==n.indexOf("?")&&(i=i.replace("?","&")),o=n+i),r(w(w({},t),{},{url:o}))}))}},J.fetchAllMiddleware=P,J.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(w(w({},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)})):A(t,e.parse)})).then((function(t){return x(t,e.parse)}))},J.createThemePreviewMiddleware=function(e){return function(t,r){if("string"==typeof t.url){var n=(0,d.g)(t.url,"wp_theme_preview");void 0===n?t.url=(0,p.a)(t.url,{wp_theme_preview:e}):""===n&&(t.url=(0,d.r)(t.url,"wp_theme_preview"))}if("string"==typeof t.path){var o=(0,d.g)(t.path,"wp_theme_preview");void 0===o?t.path=(0,p.a)(t.path,{wp_theme_preview:e}):""===o&&(t.path=(0,d.r)(t.path,"wp_theme_preview"))}return r(t)}},J.fetchAllMiddleware=null,J.use(J.createRootURLMiddleware((null===(T=null===(S=null===window||void 0===window?void 0:window.parent)||void 0===S?void 0:S.scData)||void 0===T?void 0:T.root_url)||(null===(D=null===window||void 0===window?void 0:window.scData)||void 0===D?void 0:D.root_url))),(null===(E=null===window||void 0===window?void 0:window.scData)||void 0===E?void 0:E.nonce)&&(J.nonceMiddleware=J.createNonceMiddleware(null===(I=null===window||void 0===window?void 0:window.scData)||void 0===I?void 0:I.nonce),J.use(J.nonceMiddleware)),(null===(C=null===window||void 0===window?void 0:window.scData)||void 0===C?void 0:C.nonce_endpoint)&&(J.nonceEndpoint=null===(M=null===window||void 0===window?void 0:window.scData)||void 0===M?void 0:M.nonce_endpoint),J.use((function(e,t){return e.path=(0,p.a)(e.path,{t:Date.now()}),t(e)})),J.use((function(e,t){return e.path=(0,p.a)(e.path,w({},!!(0,d.g)(window.location.href,"currency")&&{currency:(0,d.g)(window.location.href,"currency")})),t(e)})),J.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 */ 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,n.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,n.A)(e.additional_errors||[])),e.message=wp.i18n.__("We were not able to process this order","surecart")),Promise.reject(e)})),r}));var W=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}))},X=function(){var e=(0,o.A)(u().mark((function e(t){var r;return u().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,W(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(J.nonceEndpoint).then((function(e){if(e.status>=200&&e.status<300)return e;throw e})).then((function(e){return e.text()})).then((function(e){J.nonceMiddleware.nonce=e})));case 6:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}()},2942: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)}},3506:function(e,t,r){r.d(t,{g:function(){return o},r:function(){return i}});var n=r(4805);function o(e,t){return(0,n.g)(e)[t]}function i(e){var t=e.indexOf("?");if(-1===t)return e;for(var r=(0,n.g)(e),o=e.substr(0,t),i=arguments.length,a=new Array(i>1?i-1:0),c=1;c<i;c++)a[c-1]=arguments[c];a.forEach((function(e){return delete r[e]}));var s=(0,n.b)(r);return s?o+"?"+s:o}},5585:function(e,t,r){r.r(t),r.d(t,{sc_dashboard_downloads_list:function(){return v}});var n=r(4467),o=r(467),i=r(3029),a=r(2901),c=r(9280),s=r.n(c),u=r(1346),p=r(8803),d=r(2942),l=r(4805);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,a.A)((function e(t){(0,i.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,d.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,p.a)({path:(0,l.a)("surecart/v1/purchases/",h({expand:["product","product.downloads","download.media"],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:"c0dd0e760d5cf286e50a4e31e9dce207556da2b0",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:"02b04ae7544a1ef891780953d8b07bb01acdd068",slot:"heading"},(0,u.h)("slot",{key:"03745b18a6a5f656d4d3eb268969ac08b42fdd99",name:"heading"},this.heading||wp.i18n.__("Downloads","surecart"))),(0,u.h)("sc-pagination",{key:"8ca0f52229ada26f1b3c495fb1a30cc0e9f1d54b",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}"}}]);
Save
Back