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
1012.js
4 lines
| 1 | "use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[1012],{34805:function(e,r,n){n.d(r,{a:function(){return p},b:function(){return s},g:function(){return d}});var t=n(64467),i=n(3453);function o(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function c(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?o(Object(n),!0).forEach((function(r){(0,t.A)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):o(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function u(e,r){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,r){if(e){if("string"==typeof e)return a(e,r);var n={}.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(e,r):void 0}}(e))||r&&e&&"number"==typeof e.length){n&&(e=n);var _n=0,t=function(){};return{s:t,n:function(){return _n>=e.length?{done:!0}:{done:!1,value:e[_n++]}},e:function(e){throw e},f:t}}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,c=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return o=e.done,e},e:function(e){c=!0,i=e},f:function(){try{o||null==n.return||n.return()}finally{if(c)throw i}}}}function a(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=Array(r);n<r;n++)t[n]=e[n];return t}function s(e){for(var r,n="",t=Object.entries(e);r=t.shift();){var o=r,c=(0,i.A)(o,2),a=c[0],s=c[1];if(Array.isArray(s)||s&&s.constructor===Object){var l,d=u(Object.entries(s).reverse());try{for(d.s();!(l=d.n()).done;){var p=(0,i.A)(l.value,2),h=p[0],f=p[1];t.unshift(["".concat(a,"[").concat(h,"]"),f])}}catch(e){d.e(e)}finally{d.f()}}else void 0!==s&&(null===s&&(s=""),n+="&"+[a,s].map(encodeURIComponent).join("="))}return n.substr(1)}function l(e){try{return decodeURIComponent(e)}catch(r){return e}}function d(e){return(function(e){var r;try{r=new URL(e,"http://example.com").search.substring(1)}catch(e){}if(r)return r}(e)||"").replace(/\+/g,"%20").split("&").reduce((function(e,r){var n=r.split("=").filter(Boolean).map(l),t=(0,i.A)(n,2),o=t[0],u=t[1],a=void 0===u?"":u;return o&&function(e,r,n){for(var t=r.length,i=t-1,o=0;o<t;o++){var u=r[o];!u&&Array.isArray(e)&&(u=e.length.toString()),u=["__proto__","constructor","prototype"].includes(u)?u.toUpperCase():u;var a=!isNaN(Number(r[o+1]));e[u]=o===i?n:e[u]||(a?[]:{}),Array.isArray(e[u])&&!a&&(e[u]=c({},e[u])),e=e[u]}}(e,o.replace(/\]/g,"").split("["),a),e}),Object.create(null))}function p(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",r=arguments.length>1?arguments[1]:void 0;if(!r||!Object.keys(r).length)return e;var n=e,t=e.indexOf("?");return-1!==t&&(r=Object.assign(d(e),r),n=n.substr(0,t)),n+"?"+s(r)}},90488:function(e,r,n){n.d(r,{i:function(){return o},m:function(){return i},z:function(){return t}});var t=["bif","byr","clp","djf","gnf","isk","jpy","kmf","krw","pyg","rwf","ugx","vnd","vuv","xaf","xag","xau","xba","xbb","xbc","xbd","xdr","xof","xpd","xpf","xpt","xts"],i=function(e,r){return o(r)?e:e/100},o=function(e){var r;return t.includes(null===(r=null==e?void 0:e.toLowerCase)||void 0===r?void 0:r.call(e))}},78095:function(e,r,n){n.d(r,{h:function(){return g}});var t,i,o,c,u,a,s,l=n(10467),d=n(89394),p=n(64467),h=n(89280),f=n.n(h),v=n(96030),w=n(34805),_=n(53506);function b(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}var y=(null===(i=null===(t=null===window||void 0===window?void 0:window.parent)||void 0===t?void 0:t.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&&(v.a.fetchAllMiddleware=null,v.a.use(v.a.createRootURLMiddleware(y)),(null===(c=null===window||void 0===window?void 0:window.scData)||void 0===c?void 0:c.nonce)&&(v.a.nonceMiddleware=v.a.createNonceMiddleware(null===(u=null===window||void 0===window?void 0:window.scData)||void 0===u?void 0:u.nonce),v.a.use(v.a.nonceMiddleware)),(null===(a=null===window||void 0===window?void 0:window.scData)||void 0===a?void 0:a.nonce_endpoint)&&(v.a.nonceEndpoint=null===(s=null===window||void 0===window?void 0:window.scData)||void 0===s?void 0:s.nonce_endpoint),v.a.use((function(e,r){return e.path=(0,w.a)(e.path,{t:Date.now()}),r(e)})),v.a.use((function(e,r){return e.path=(0,w.a)(e.path,function(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?b(Object(n),!0).forEach((function(r){(0,p.A)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):b(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}({},!!(0,_.g)(window.location.href,"currency")&&{currency:(0,_.g)(window.location.href,"currency")})),r(e)})),v.a.use((function(e,r){var n=r(e);return n.catch((function(e){var r;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===(r=null==e?void 0:e.additional_errors)||void 0===r?void 0:r.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)})),n})));var m=function(e){var r={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 r;return e.json().catch((function(){throw r}))},g=function(){var e=(0,l.A)(f().mark((function e(r){var n;return f().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,m(r);case 2:if("rest_cookie_invalid_nonce"===(n=e.sent).code){e.next=5;break}throw n;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,r,n){n.d(r,{a:function(){return F}});var t=n(10467),i=n(80045),o=n(3453),c=n(64467),u=n(89280),a=n.n(u),s=n(34805),l=n(53506),d=["rest_route"],p=["path","url"],h=["url","path","data","parse"];function f(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function v(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?f(Object(n),!0).forEach((function(r){(0,c.A)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):f(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}function w(e,r){return void 0!==(0,l.g)(e,r)}function _(e){var r=e.split("?"),n=r[1],t=r[0];return n?t+"?"+n.split("&").map((function(e){return e.split("=")})).map((function(e){return e.map(decodeURIComponent)})).sort((function(e,r){return e[0].localeCompare(r[0])})).map((function(e){return e.map(encodeURIComponent)})).map((function(e){return e.join("=")})).join("&"):t}var b=function(e,r){var n,t,i=e.path;return"string"==typeof e.namespace&&"string"==typeof e.endpoint&&(n=e.namespace.replace(/^\/|\/$/g,""),i=(t=e.endpoint.replace(/^\//,""))?n+"/"+t:n),delete e.namespace,delete e.endpoint,r(v(v({},e),{},{path:i}))};function y(e,r){return Promise.resolve(r?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)},g=function(e){return function(e){if(!e)return{};var r=e.match(/<([^>]+)>; rel="next"/);return r?{next:r[1]}:{}}(e.headers.get("link")).next},O=function(e){var r=!!e.path&&-1!==e.path.indexOf("per_page=-1"),n=!!e.url&&-1!==e.url.indexOf("per_page=-1");return r||n},k=function(){var e=(0,t.A)(a().mark((function e(r,n){var t,o,c,u,l,d;return a().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(!1!==r.parse){e.next=2;break}return e.abrupt("return",n(r));case 2:if(O(r)){e.next=4;break}return e.abrupt("return",n(r));case 4:return e.next=6,F(v(v({},(h={per_page:100},void 0,void 0,f=(a=r).path,w=a.url,v(v({},(0,i.A)(a,p)),{},{url:w&&(0,s.a)(w,h),path:f&&(0,s.a)(f,h)}))),{},{parse:!1}));case 6:return t=e.sent,e.next=9,m(t);case 9:if(o=e.sent,Array.isArray(o)){e.next=12;break}return e.abrupt("return",o);case 12:if(c=g(t)){e.next=15;break}return e.abrupt("return",o);case 15:u=[].concat(o);case 16:if(!c){e.next=27;break}return e.next=19,F(v(v({},r),{},{path:void 0,url:c,parse:!1}));case 19:return l=e.sent,e.next=22,m(l);case 22:d=e.sent,u=u.concat(d),c=g(l),e.next=16;break;case 27:return e.abrupt("return",u);case 28:case"end":return e.stop()}var a,h,f,w}),e)})));return function(_x,r){return e.apply(this,arguments)}}(),x=new Set(["PATCH","PUT","DELETE"]),j=function(e){var r=!(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,r)).catch((function(e){return P(e,r)}))};function P(e){if(arguments.length>1&&void 0!==arguments[1]&&!arguments[1])throw e;return function(e){var r={code:"invalid_json",message:wp.i18n.__("The response is not a valid JSON response.")};if(!e||!e.json)throw r;return e.json().catch((function(){throw r}))}(e).then((function(e){var r={code:"unknown_error",message:wp.i18n.__("An unknown error occurred.")};throw e||r}))}var A={Accept:"application/json, */*;q=0.1"},S={credentials:"include"},C=[function(e,r){return"string"!=typeof e.url||w(e.url,"_locale")||(e.url=(0,s.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||w(e.path,"_locale")||(e.path=(0,s.a)(e.path,{_locale:"user"})),r(e)},b,function(e,r){var n=e.method,t=void 0===n?"GET":n;return x.has(t.toUpperCase())&&(e=v(v({},e),{},{headers:v(v({},e.headers),{},{"X-HTTP-Method-Override":t,"Content-Type":"application/json"}),method:"POST"})),r(e)},k],D=function(e){if(e.status>=200&&e.status<300)return e;throw e},E=function(e){var r=e.url,n=e.path,t=e.data,o=e.parse,c=void 0===o||o,u=(0,i.A)(e,h),a=e.body,s=e.headers;return s=v(v({},A),s),t&&(a=JSON.stringify(t),s["Content-Type"]="application/json"),window.fetch(r||n||window.location.href,v(v(v({},S),u),{},{body:a,headers:s})).then((function(e){return Promise.resolve(e).then(D).catch((function(e){return P(e,c)})).then((function(e){return j(e,c)}))}),(function(e){if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function F(e){return C.reduceRight((function(e,r){return function(n){return r(n,e)}}),E)(e).catch((function(r){return"rest_cookie_invalid_nonce"!==r.code?Promise.reject(r):window.fetch(F.nonceEndpoint).then(D).then((function(e){return e.text()})).then((function(r){return F.nonceMiddleware.nonce=r,F(e)}))}))}F.use=function(e){C.unshift(e)},F.setFetchHandler=function(e){E=e},F.createNonceMiddleware=function(e){var r=function e(r,n){var t=r.headers,i=void 0===t?{}:t;for(var o in i)if("x-wp-nonce"===o.toLowerCase()&&i[o]===e.nonce)return n(r);return n(v(v({},r),{},{headers:v(v({},i),{},{"X-WP-Nonce":e.nonce})}))};return r.nonce=e,r},F.createPreloadingMiddleware=function(e){var r=Object.fromEntries(Object.entries(e).map((function(e){var r=(0,o.A)(e,2),n=r[0],t=r[1];return[_(n),t]})));return function(e,n){var t=e.parse,o=void 0===t||t,c=e.path;if(!c&&e.url){var u=(0,s.g)(e.url),a=u.rest_route,l=(0,i.A)(u,d);"string"==typeof a&&(c=(0,s.a)(a,l))}if("string"!=typeof c)return n(e);var p=e.method||"GET",h=_(c);if("GET"===p&&r[h]){var f=r[h];return delete r[h],y(f,!!o)}if("OPTIONS"===p&&r[p]&&r[p][h]){var v=r[p][h];return delete r[p][h],y(v,!!o)}return n(e)}},F.createRootURLMiddleware=function(e){return function(r,n){return b(r,(function(r){var t,i=r.url,o=r.path;return"string"==typeof o&&(t=e,-1!==e.indexOf("?")&&(o=o.replace("?","&")),o=o.replace(/^\//,""),"string"==typeof t&&-1!==t.indexOf("?")&&(o=o.replace("?","&")),i=t+o),n(v(v({},r),{},{url:i}))}))}},F.fetchAllMiddleware=k,F.mediaUploadMiddleware=function(e,r){if(!function(e){var r=!!e.method&&"POST"===e.method;return(!!e.path&&-1!==e.path.indexOf("/wp/v2/media")||!!e.url&&-1!==e.url.indexOf("/wp/v2/media"))&&r}(e))return r(e);var n=0,t=function e(t){return n++,r({path:"/wp/v2/media/".concat(t,"/post-process"),method:"POST",data:{action:"create-image-subsizes"},parse:!1}).catch((function(){return n<5?e(t):(r({path:"/wp/v2/media/".concat(t,"?force=true"),method:"DELETE"}),Promise.reject())}))};return r(v(v({},e),{},{parse:!1})).catch((function(r){var n=r.headers.get("x-wp-upload-attachment-id");return r.status>=500&&r.status<600&&n?t(n).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(r)})):P(r,e.parse)})).then((function(r){return j(r,e.parse)}))},F.createThemePreviewMiddleware=function(e){return function(r,n){if("string"==typeof r.url){var t=(0,l.g)(r.url,"wp_theme_preview");void 0===t?r.url=(0,s.a)(r.url,{wp_theme_preview:e}):""===t&&(r.url=(0,l.r)(r.url,"wp_theme_preview"))}if("string"==typeof r.path){var i=(0,l.g)(r.path,"wp_theme_preview");void 0===i?r.path=(0,s.a)(r.path,{wp_theme_preview:e}):""===i&&(r.path=(0,l.r)(r.path,"wp_theme_preview"))}return n(r)}}},92942:function(e,r,n){n.d(r,{o:function(){return t}});var t=function(e,r){new window.IntersectionObserver((function(e,n){e[0].intersectionRatio>0&&(r(),n.unobserve(e[0].target))})).observe(e)}},73309:function(e,r,n){n.d(r,{a:function(){return i},b:function(){return p},c:function(){return c},g:function(){return o},i:function(){return a},p:function(){return d},t:function(){return u}});var t=n(90488),i=function(e){if((null==e?void 0:e.amount_off)&&(null==e?void 0:e.currency))return o({amount:e.amount_off,currency:e.currency});if(null==e?void 0:e.percent_off){var r="".concat(0|e.percent_off,"%"); |
| 3 | // translators: %s is the discount percentage (e.g. "10%"). |
| 4 | return wp.i18n.sprintf(wp.i18n.__("%s off","surecart"),r)}return""},o=function(e){var r=e.amount,n=e.currency,i=function(e,r){return t.z.includes(r)?e:e/100}(r,n);return"".concat(new Intl.NumberFormat(void 0,{style:"currency",currency:n}).format(parseFloat(i.toFixed(2))))},c=function(){var e,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"usd";return null===(e=new Intl.NumberFormat(void 0,{style:"currency",currency:r}).formatToParts().find((function(e){return"currency"===e.type})))||void 0===e?void 0:e.value},u=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("every","surecart"),t=arguments.length>3&&void 0!==arguments[3]?arguments[3]:wp.i18n.__("once","surecart"),i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];switch(r){case"day":return"".concat(n," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d day","%d days",e,"surecart"):wp.i18n._n("day","%d days",e,"surecart"),e));case"week":return"".concat(n," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d week","%d weeks",e,"surecart"):wp.i18n._n("week","%d weeks",e,"surecart"),e));case"month":return"".concat(n," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d month","%d months",e,"surecart"):wp.i18n._n("month","%d months",e,"surecart"),e));case"year":return"".concat(n," ").concat(wp.i18n.sprintf(i?wp.i18n._n("%d year","%d years",e,"surecart"):wp.i18n._n("year","%d years",e,"surecart"),e));default:return t}},a=function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!e)return"";var n=r.showOnce,t=r.labels,i=r.abbreviate,o=(t||{}).interval,c=void 0===o?wp.i18n.__("every","surecart"):o;return"".concat(s(e,c,n?wp.i18n.__("once","surecart"):"",i)," ").concat(l(e,i))},s=function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("once","surecart"),t=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return e.recurring_interval_count&&e.recurring_interval&&1!==(null==e?void 0:e.recurring_period_count)?t?function(e,r){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:wp.i18n.__("once","surecart"),t=arguments.length>3&&void 0!==arguments[3]&&arguments[3];switch(r){case"day":return" / ".concat(wp.i18n.sprintf(t?wp.i18n._n("%d day","%d days",e,"surecart"):wp.i18n._n("day","%d days",e,"surecart"),e));case"week":return" / ".concat(wp.i18n.sprintf(t?wp.i18n._n("%d wk","%d wks",e,"surecart"):wp.i18n._n("wk","%d wks",e,"surecart"),e));case"month":return" / ".concat(wp.i18n.sprintf(t?wp.i18n._n("%d mo","%d months",e,"surecart"):wp.i18n._n("mo","%d mos",e,"surecart"),e));case"year":return" / ".concat(wp.i18n.sprintf(t?wp.i18n._n("%d yr","%d yrs",e,"surecart"):wp.i18n._n("yr","%d yrs",e,"surecart"),e));default:return n}}(e.recurring_interval_count,e.recurring_interval,n):u(e.recurring_interval_count,e.recurring_interval," ".concat(r),n):""},l=function(e){var r=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return(null==e?void 0:e.recurring_period_count)&&1!==(null==e?void 0:e.recurring_period_count)?r?"x ".concat(e.recurring_period_count):" (".concat(wp.i18n.sprintf(wp.i18n._n("%d payment","%d payments",e.recurring_period_count,"surecart"),e.recurring_period_count),")"):""},d=function(e){var r;return e?"".concat(null===(r=null==e?void 0:e.product)||void 0===r?void 0:r.name," ").concat((null==e?void 0:e.name)?"— ".concat(e.name):""):""},p=function(e){switch(e){case"invalid":return wp.i18n.__("Not valid","surecart");case"expired":return wp.i18n.__("Expired","surecart");case"gone":return wp.i18n.__("Not available","surecart");case"less_than_min_subtotal_amount":return wp.i18n.__("Minimum not met","surecart");case"greater_than_max_subtotal_amount":return wp.i18n.__("Order amount exceeds limit","surecart");case"not_applicable":return wp.i18n.__("Product(s) not eligible","surecart");case"not_applicable_to_customer":return wp.i18n.__("Not eligible","surecart");case"":return"";default:return wp.i18n.__("Not redeemable","surecart")}}},53506:function(e,r,n){n.d(r,{g:function(){return i},r:function(){return o}});var t=n(34805);function i(e,r){return(0,t.g)(e)[r]}function o(e){var r=e.indexOf("?");if(-1===r)return e;for(var n=(0,t.g)(e),i=e.substr(0,r),o=arguments.length,c=new Array(o>1?o-1:0),u=1;u<o;u++)c[u-1]=arguments[u];c.forEach((function(e){return delete n[e]}));var a=(0,t.b)(n);return a?i+"?"+a:i}},51012:function(e,r,n){n.r(r),n.d(r,{sc_subscription_switch:function(){return _}});var t=n(89394),i=n(64467),o=n(10467),c=n(23029),u=n(92901),a=n(89280),s=n.n(a),l=n(27364),d=(n(78095),n(92942)),p=n(73309),h=n(34805),f=n(96030);function v(e,r){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);r&&(t=t.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),n.push.apply(n,t)}return n}function w(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?v(Object(n),!0).forEach((function(r){(0,i.A)(e,r,n[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(n,r))}))}return e}var _=function(){return(0,u.A)((function e(r){(0,c.A)(this,e),(0,l.r)(this,r),this.query=void 0,this.heading=void 0,this.productGroupId=void 0,this.productId=void 0,this.subscription=void 0,this.filterAbove=4,this.successUrl=window.location.href,this.selectedPrice=void 0,this.products=[],this.prices=void 0,this.filter="month",this.hasFilters=void 0,this.showFilters=void 0,this.loading=void 0,this.busy=void 0,this.error=void 0}),[{key:"componentWillLoad",value:function(){var e=this;(0,d.o)(this.el,(0,o.A)(s().mark((function r(){return s().wrap((function(r){for(;;)switch(r.prev=r.next){case 0:return r.prev=0,e.loading=!0,r.next=4,Promise.all([e.getGroup(),e.getProductPrices()]);case 4:r.next=10;break;case 6:r.prev=6,r.t0=r.catch(0),console.error(r.t0),(null===r.t0||void 0===r.t0?void 0:r.t0.message)?e.error=r.t0.message:e.error=wp.i18n.__("Something went wrong","surecart");case 10:return r.prev=10,e.loading=!1,r.finish(10);case 13:case"end":return r.stop()}}),r,null,[[0,6,10,13]])})))),this.handleSubscriptionChange()}},{key:"handleProductsChange",value:function(){var e;this.prices=this.products.map((function(e){var r;return null===(r=null==e?void 0:e.prices)||void 0===r?void 0:r.data})).flat().filter((function(e,r,n){return n.findIndex((function(r){return r.id===e.id}))===r})).filter((function(e){return!(null==e?void 0:e.archived)})).filter((function(e){return e.portal_subscription_update_enabled})),this.showFilters=(null===(e=this.prices)||void 0===e?void 0:e.length)>this.filterAbove}},{key:"handlePricesChange",value:function(e,r){var n=this;!(null==r?void 0:r.length)&&(null==e?void 0:e.length)&&(this.selectedPrice=e.find((function(e){var r,t;return e.id===(null===(t=null===(r=n.subscription)||void 0===r?void 0:r.price)||void 0===t?void 0:t.id)}))),this.hasFilters=w(w({},this.hasFilters),{},{split:this.prices.some((function(e){return!!(null==e?void 0:e.recurring_period_count)&&!(null==e?void 0:e.archived)})),month:this.prices.some((function(e){return"month"===e.recurring_interval&&!(null==e?void 0:e.recurring_period_count)&&!(null==e?void 0:e.archived)})),year:this.prices.some((function(e){return"year"===e.recurring_interval&&!(null==e?void 0:e.recurring_period_count)&&!(null==e?void 0:e.archived)})),never:this.prices.some((function(e){return!("never"!==e.recurring_interval&&e.recurring_interval||(null==e?void 0:e.archived))}))})}},{key:"handleSubscriptionChange",value:function(){var e,r;this.filter=(null===(r=null===(e=this.subscription)||void 0===e?void 0:e.price)||void 0===r?void 0:r.recurring_interval)||"month"}},{key:"hasMultipleFilters",value:function(){return Object.values(this.hasFilters||{}).filter((function(e){return!!e})).length>1}},{key:"getGroup",value:(n=(0,o.A)(s().mark((function e(){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.productGroupId){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,f.a)({path:(0,h.a)("surecart/v1/products/",w({product_group_ids:[this.productGroupId],expand:["prices"]},this.query))});case 4:return e.next=6,e.sent;case 6:r=e.sent,this.products=[].concat((0,t.A)(this.products),(0,t.A)(r));case 8:case"end":return e.stop()}}),e,this)}))),function(){return n.apply(this,arguments)})},{key:"getProductPrices",value:(r=(0,o.A)(s().mark((function e(){var r;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(this.productId){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,(0,f.a)({path:(0,h.a)("surecart/v1/products/".concat(this.productId),{expand:["prices"]})});case 4:return e.next=6,e.sent;case 6:r=e.sent,this.products=[].concat((0,t.A)(this.products),[r]);case 8:case"end":return e.stop()}}),e,this)}))),function(){return r.apply(this,arguments)})},{key:"handleSubmit",value:(e=(0,o.A)(s().mark((function e(r){var n,t,i,o,c,u,a,l,d,p,f,v;return s().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.target.getFormJson();case 2:if(d=e.sent,p=d.plan,f=this.prices.find((function(e){return e.id===p})),v=null===(n=this.subscription)||void 0===n?void 0:n.price,(null==f?void 0:f.id)!==v.id||(null==f?void 0:f.ad_hoc)||(null===(i=null===(t=this.subscription)||void 0===t?void 0:t.variant_options)||void 0===i?void 0:i.length)){e.next=8;break}return e.abrupt("return");case 8:if(!(null===(c=null===(o=this.subscription)||void 0===o?void 0:o.variant_options)||void 0===c?void 0:c.length)){e.next=11;break}return this.busy=!0,e.abrupt("return",window.location.assign((0,h.a)(this.successUrl,w({action:"confirm_variation",price_id:p},!1===(null===(u=this.subscription)||void 0===u?void 0:u.live_mode)?{live_mode:!1}:{}))));case 11:if(!(null==f?void 0:f.ad_hoc)){e.next=14;break}return this.busy=!0,e.abrupt("return",window.location.assign((0,h.a)(this.successUrl,w({action:"confirm_amount",price_id:p},!1===(null===(a=this.subscription)||void 0===a?void 0:a.live_mode)?{live_mode:!1}:{}))));case 14:this.busy=!0,window.location.assign((0,h.a)(this.successUrl,w({action:"confirm",price_id:p},!1===(null===(l=this.subscription)||void 0===l?void 0:l.live_mode)?{live_mode:!1}:{})));case 16:case"end":return e.stop()}}),e,this)}))),function(_x){return e.apply(this,arguments)})},{key:"renderSwitcher",value:function(){var e=this;if(this.hasMultipleFilters()&&this.showFilters)return(0,l.h)("sc-flex",{slot:"end",class:"subscriptions-switch__switcher"},this.hasFilters.month&&(0,l.h)("sc-button",{onClick:function(){return e.filter="month"},size:"small",type:"month"===this.filter?"default":"text"},wp.i18n.__("Monthly","surecart")),this.hasFilters.week&&(0,l.h)("sc-button",{onClick:function(){return e.filter="week"},size:"small",type:"week"===this.filter?"default":"text"},wp.i18n.__("Weekly","surecart")),this.hasFilters.year&&(0,l.h)("sc-button",{onClick:function(){return e.filter="year"},size:"small",type:"year"===this.filter?"default":"text"},wp.i18n.__("Yearly","surecart")),this.hasFilters.never&&(0,l.h)("sc-button",{onClick:function(){return e.filter="never"},size:"small",type:"never"===this.filter?"default":"text"},wp.i18n.__("Lifetime","surecart")),this.hasFilters.split&&(0,l.h)("sc-button",{onClick:function(){return e.filter="split"},size:"small",type:"split"===this.filter?"default":"text"},wp.i18n.__("Payment Plan","surecart")))}},{key:"renderLoading",value:function(){return(0,l.h)("sc-choice",{name:"loading",disabled:!0},(0,l.h)("sc-skeleton",{style:{width:"60px",display:"inline-block"}}),(0,l.h)("sc-skeleton",{style:{width:"80px",display:"inline-block"},slot:"price"}),(0,l.h)("sc-skeleton",{style:{width:"120px",display:"inline-block"},slot:"description"}))}},{key:"isHidden",value:function(e){if(!this.showFilters||!this.hasMultipleFilters())return!1;var r=this.filter!==e.recurring_interval;return"never"!==this.filter||(null==e?void 0:e.recurring_interval)||(r=!1),"split"===this.filter&&(null==e?void 0:e.recurring_period_count)&&(r=!1),r}},{key:"renderContent",value:function(){var e=this;return this.loading?this.renderLoading():(0,l.h)("sc-choices",{required:!0},(0,l.h)("div",null,(this.prices||[]).filter((function(e){return!e.archived})).filter((function(r){var n;return(null==r?void 0:r.currency)===(null===(n=e.subscription)||void 0===n?void 0:n.currency)})).sort((function(e,r){return e.amount-r.amount})).map((function(r){var n,t,i=(null===(t=null===(n=e.subscription)||void 0===n?void 0:n.price)||void 0===t?void 0:t.id)===(null==r?void 0:r.id),o=e.products.find((function(e){return e.id===(null==r?void 0:r.product)}));return(0,l.h)("sc-choice",{key:null==r?void 0:r.id,checked:i,name:"plan",value:null==r?void 0:r.id,hidden:e.isHidden(r),onScChange:function(n){n.detail&&(e.selectedPrice=e.prices.find((function(e){return e.id===(null==r?void 0:r.id)})))}},(0,l.h)("div",null,(0,l.h)("strong",null,null==o?void 0:o.name," ",(null==r?void 0:r.name)&&(0,l.h)(l.F,null," — ",null==r?void 0:r.name))),(0,l.h)("div",{slot:"description"},(null==r?void 0:r.ad_hoc)?"".concat(wp.i18n.__("Custom amount","surecart")," ").concat((0,p.i)(r)):(0,l.h)(l.F,null,(0,l.h)("sc-format-number",{type:"currency",currency:(null==r?void 0:r.currency)||"usd",value:null==r?void 0:r.amount})," ",(0,p.i)(r,{showOnce:!0}))),i&&(0,l.h)("sc-tag",{type:"warning",slot:"price"},wp.i18n.__("Current Plan","surecart")))}))))}},{key:"buttonText",value:function(){var e,r,n,t,i,o,c,u,a;return(null===(r=null===(e=this.subscription)||void 0===e?void 0:e.variant_options)||void 0===r?void 0:r.length)?(null===(n=this.selectedPrice)||void 0===n?void 0:n.id)===(null===(i=null===(t=this.subscription)||void 0===t?void 0:t.price)||void 0===i?void 0:i.id)?wp.i18n.__("Update Options","surecart"):wp.i18n.__("Choose Options","surecart"):(null===(o=this.selectedPrice)||void 0===o?void 0:o.ad_hoc)?(null===(c=this.selectedPrice)||void 0===c?void 0:c.id)===(null===(a=null===(u=this.subscription)||void 0===u?void 0:u.price)||void 0===a?void 0:a.id)?wp.i18n.__("Update Amount","surecart"):wp.i18n.__("Choose Amount","surecart"):wp.i18n.__("Next","surecart")}},{key:"buttonDisabled",value:function(){var e,r,n,t,i;return!(null===(e=this.subscription)||void 0===e?void 0:e.variant_options)&&(null===(n=null===(r=this.subscription)||void 0===r?void 0:r.price)||void 0===n?void 0:n.id)===(null===(t=this.selectedPrice)||void 0===t?void 0:t.id)&&!(null===(i=this.selectedPrice)||void 0===i?void 0:i.ad_hoc)}},{key:"render",value:function(){var e,r,n,t,i,o,c=this;return!this.loading&&(null===(e=this.prices)||void 0===e?void 0:e.length)<2&&!(null===(n=null===(r=this.prices)||void 0===r?void 0:r[0])||void 0===n?void 0:n.ad_hoc)&&!(null===(i=null===(t=this.subscription)||void 0===t?void 0:t.variant_options)||void 0===i?void 0:i.length)?null:(null===(o=this.subscription)||void 0===o?void 0:o.finite)?(0,l.h)("sc-alert",{type:"info",open:!0},wp.i18n.__("To make changes to your payment plan, please contact us.","surecart")):(0,l.h)("sc-dashboard-module",{heading:this.heading||wp.i18n.__("Update Plan","surecart"),class:"subscription-switch",error:this.error},(0,l.h)("span",{slot:"end"},this.renderSwitcher()),(0,l.h)("sc-form",{class:"subscriptions-switch",onScFormSubmit:function(e){return c.handleSubmit(e)}},this.renderContent(),(0,l.h)("sc-button",{type:"primary",full:!0,submit:!0,loading:this.loading||this.busy,disabled:this.buttonDisabled()},this.buttonText()," ",(0,l.h)("sc-icon",{name:"arrow-right",slot:"suffix"})),this.busy&&(0,l.h)("sc-block-ui",{style:{zIndex:"9"}})))}},{key:"el",get:function(){return(0,l.a)(this)}}],[{key:"watchers",get:function(){return{products:["handleProductsChange"],prices:["handlePricesChange"],subscription:["handleSubscriptionChange"]}}}]);var e,r,n}();_.style=":host{display:block;position:relative}[hidden]{display:none !important}.subscriptions-switch{display:grid;gap:0.5em}.subscriptions-switch__switcher{background:rgba(0, 0, 0, 0.035);padding:2px;line-height:1;border-radius:var(--sc-border-radius-small)}"}}]); |