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
1375.js
2 lines
| 1 | "use strict";(self.webpackChunk_surecart_surecart=self.webpackChunk_surecart_surecart||[]).push([[1375],{34805:function(e,t,r){r.d(t,{a:function(){return p},b:function(){return u},g:function(){return l}});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 d,l=c(Object.entries(u).reverse());try{for(l.s();!(d=l.n()).done;){var p=(0,o.A)(d.value,2),f=p[0],h=p[1];n.unshift(["".concat(s,"[").concat(f,"]"),h])}}catch(e){l.e(e)}finally{l.f()}}else void 0!==u&&(null===u&&(u=""),r+="&"+[s,u].map(encodeURIComponent).join("="))}return r.substr(1)}function d(e){try{return decodeURIComponent(e)}catch(t){return e}}function l(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(d),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 p(){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(l(e),t),r=r.substr(0,n)),r+"?"+u(t)}},78095:function(e,t,r){r.d(t,{h:function(){return _}});var n,o,a,i,c,s,u,d=r(10467),l=r(89394),p=r(64467),f=r(89280),h=r.n(f),v=r(96030),y=r(34805),m=r(53506);function w(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 b=(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);b&&(v.a.fetchAllMiddleware=null,v.a.use(v.a.createRootURLMiddleware(b)),(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,y.a)(e.path,{t:Date.now()}),t(e)})),v.a.use((function(e,t){return e.path=(0,y.a)(e.path,function(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?w(Object(r),!0).forEach((function(t){(0,p.A)(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):w(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}({},!!(0,m.g)(window.location.href,"currency")&&{currency:(0,m.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,l.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,l.A)(e.additional_errors||[])),e.message=wp.i18n.__("We were not able to process this order","surecart")),Promise.reject(e)})),r})));var g=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}))},_=function(){var e=(0,d.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,g(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 D}});var n=r(10467),o=r(80045),a=r(3453),i=r(64467),c=r(89280),s=r.n(c),u=r(34805),d=r(53506),l=["rest_route"],p=["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 y(e,t){return void 0!==(0,d.g)(e,t)}function m(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 w=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 b(e,t){return Promise.resolve(t?e.body:new window.Response(JSON.stringify(e.body),{status:200,statusText:"OK",headers:e.headers}))}var g=function(e){return e.json?e.json():Promise.reject(e)},_=function(e){return function(e){if(!e)return{};var t=e.match(/<([^>]+)>; rel="next"/);return t?{next:t[1]}:{}}(e.headers.get("link")).next},O=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,d,l;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(O(t)){e.next=4;break}return e.abrupt("return",r(t));case 4:return e.next=6,D(v(v({},(f={per_page:100},void 0,void 0,h=(s=t).path,y=s.url,v(v({},(0,o.A)(s,p)),{},{url:y&&(0,u.a)(y,f),path:h&&(0,u.a)(h,f)}))),{},{parse:!1}));case 6:return n=e.sent,e.next=9,g(n);case 9:if(a=e.sent,Array.isArray(a)){e.next=12;break}return e.abrupt("return",a);case 12:if(i=_(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,D(v(v({},t),{},{path:void 0,url:i,parse:!1}));case 19:return d=e.sent,e.next=22,g(d);case 22:l=e.sent,c=c.concat(l),i=_(d),e.next=16;break;case 27:return e.abrupt("return",c);case 28:case"end":return e.stop()}var s,f,h,y}),e)})));return function(_x,t){return e.apply(this,arguments)}}(),k=new Set(["PATCH","PUT","DELETE"]),P=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 S(e,t)}))};function S(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 x={Accept:"application/json, */*;q=0.1"},A={credentials:"include"},E=[function(e,t){return"string"!=typeof e.url||y(e.url,"_locale")||(e.url=(0,u.a)(e.url,{_locale:"user"})),"string"!=typeof e.path||y(e.path,"_locale")||(e.path=(0,u.a)(e.path,{_locale:"user"})),t(e)},w,function(e,t){var r=e.method,n=void 0===r?"GET":r;return k.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],I=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({},x),u),n&&(s=JSON.stringify(n),u["Content-Type"]="application/json"),window.fetch(t||r||window.location.href,v(v(v({},A),c),{},{body:s,headers:u})).then((function(e){return Promise.resolve(e).then(I).catch((function(e){return S(e,i)})).then((function(e){return P(e,i)}))}),(function(e){if(e&&"AbortError"===e.name)throw e;throw{code:"fetch_error",message:wp.i18n.__("You are probably offline.")}}))};function D(e){return E.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(D.nonceEndpoint).then(I).then((function(e){return e.text()})).then((function(t){return D.nonceMiddleware.nonce=t,D(e)}))}))}D.use=function(e){E.unshift(e)},D.setFetchHandler=function(e){T=e},D.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},D.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[m(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,d=(0,o.A)(c,l);"string"==typeof s&&(i=(0,u.a)(s,d))}if("string"!=typeof i)return r(e);var p=e.method||"GET",f=m(i);if("GET"===p&&t[f]){var h=t[f];return delete t[f],b(h,!!a)}if("OPTIONS"===p&&t[p]&&t[p][f]){var v=t[p][f];return delete t[p][f],b(v,!!a)}return r(e)}},D.createRootURLMiddleware=function(e){return function(t,r){return w(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}))}))}},D.fetchAllMiddleware=j,D.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)})):S(t,e.parse)})).then((function(t){return P(t,e.parse)}))},D.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,u.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,u.a)(t.path,{wp_theme_preview:e}):""===o&&(t.path=(0,d.r)(t.path,"wp_theme_preview"))}return r(t)}}},1546:function(e,t,r){r.d(t,{p:function(){return f}});var n={};function o(e){return o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},o(e)}Object.defineProperty(n,"__esModule",{value:!0});var a,i="https://js.stripe.com/v3",c=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,s="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",u=null,d=function(e){var t="invalid load parameters; expected object of shape\n\n {advancedFraudSignals: boolean}\n\nbut received\n\n ".concat(JSON.stringify(e),"\n");if(null===e||"object"!==o(e))throw new Error(t);if(1===Object.keys(e).length&&"boolean"==typeof e.advancedFraudSignals)return e;throw new Error(t)},l=!1,p=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];l=!0;var n,o=Date.now();return(n=a,null!==u||(u=new Promise((function(e,t){if("undefined"!=typeof window&&"undefined"!=typeof document)if(window.Stripe&&n&&console.warn(s),window.Stripe)e(window.Stripe);else try{var r=function(){for(var e=document.querySelectorAll('script[src^="'.concat(i,'"]')),t=0;t<e.length;t++){var r=e[t];if(c.test(r.src))return r}return null}();r&&n?console.warn(s):r||(r=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",r=document.createElement("script");r.src="".concat(i).concat(t);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r}(n)),r.addEventListener("load",(function(){window.Stripe?e(window.Stripe):t(new Error("Stripe.js not available"))})),r.addEventListener("error",(function(){t(new Error("Failed to load Stripe.js"))}))}catch(e){return void t(e)}else e(null)}))),u).then((function(e){return function(e,t,r){if(null===e)return null;var n=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.54.2",startTime:t})}(n,r),n}(e,t,o)}))};p.setLoadParameters=function(e){if(l&&a){var t=d(e);if(Object.keys(t).reduce((function(t,r){var n;return t&&e[r]===(null===(n=a)||void 0===n?void 0:n[r])}),!0))return}if(l)throw new Error("You cannot change load parameters after calling loadStripe");a=d(e)},n.loadStripe=p;var f=n},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}},81375:function(e,t,r){r.r(t),r.d(t,{sc_stripe_add_method:function(){return p}});var n=r(10467),o=r(23029),a=r(92901),i=r(89280),c=r.n(i),s=r(27364),u=r(1546),d=(r(78095),r(34805)),l=r(96030),p=function(){return(0,a.A)((function e(t){(0,o.A)(this,e),(0,s.r)(this,t),this.liveMode=!0,this.customerId=void 0,this.successUrl=void 0,this.loading=void 0,this.loaded=void 0,this.error=void 0,this.paymentIntent=void 0}),[{key:"componentWillLoad",value:function(){this.createPaymentIntent()}},{key:"handlePaymentIntentCreate",value:(r=(0,n.A)(c().mark((function e(){var t,r,n,o,a,i,s,d,l,p,f,h,v,y,m,w,b,g,_,O=this;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if((null===(n=null===(r=null===(t=this.paymentIntent)||void 0===t?void 0:t.processor_data)||void 0===r?void 0:r.stripe)||void 0===n?void 0:n.publishable_key)&&(null===(i=null===(a=null===(o=this.paymentIntent)||void 0===o?void 0:o.processor_data)||void 0===a?void 0:a.stripe)||void 0===i?void 0:i.account_id)){e.next=2;break}return e.abrupt("return");case 2:if(this.stripe){e.next=13;break}return e.prev=3,e.next=6,u.p.loadStripe(null===(l=null===(d=null===(s=this.paymentIntent)||void 0===s?void 0:s.processor_data)||void 0===d?void 0:d.stripe)||void 0===l?void 0:l.publishable_key,{stripeAccount:null===(h=null===(f=null===(p=this.paymentIntent)||void 0===p?void 0:p.processor_data)||void 0===f?void 0:f.stripe)||void 0===h?void 0:h.account_id});case 6:this.stripe=e.sent,e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(3),this.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Stripe could not be loaded","surecart"),e.abrupt("return");case 13:if((null===(m=null===(y=null===(v=this.paymentIntent)||void 0===v?void 0:v.processor_data)||void 0===y?void 0:y.stripe)||void 0===m?void 0:m.client_secret)&&this.container){e.next=16;break}return console.warn("do not have client secret or container"),e.abrupt("return");case 16:_=getComputedStyle(document.body),this.elements=this.stripe.elements({clientSecret:null===(g=null===(b=null===(w=this.paymentIntent)||void 0===w?void 0:w.processor_data)||void 0===b?void 0:b.stripe)||void 0===g?void 0:g.client_secret,appearance:{variables:{colorPrimary:_.getPropertyValue("--sc-color-primary-500"),colorText:_.getPropertyValue("--sc-input-label-color"),borderRadius:_.getPropertyValue("--sc-input-border-radius-medium"),colorBackground:_.getPropertyValue("--sc-input-background-color"),fontSizeBase:_.getPropertyValue("--sc-input-font-size-medium")},rules:{".Input":{border:_.getPropertyValue("--sc-input-border")},".Input::placeholder":{color:_.getPropertyValue("--sc-input-placeholder-color")}}}}),this.elements.create("payment",{wallets:{applePay:"never",googlePay:"never"}}).mount(".sc-payment-element-container"),this.element=this.elements.getElement("payment"),this.element.on("ready",(function(){return O.loaded=!0}));case 21:case"end":return e.stop()}}),e,this,[[3,9]])}))),function(){return r.apply(this,arguments)})},{key:"createPaymentIntent",value:(t=(0,n.A)(c().mark((function e(){return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,this.loading=!0,this.error="",e.next=5,(0,l.a)({method:"POST",path:"surecart/v1/payment_intents",data:{processor_type:"stripe",live_mode:this.liveMode,customer_id:this.customerId,refresh_status:!0}});case 5:this.paymentIntent=e.sent,e.next=11;break;case 8:e.prev=8,e.t0=e.catch(0),this.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Something went wrong","surecart");case 11:return e.prev=11,this.loading=!1,e.finish(11);case 14:case"end":return e.stop()}}),e,this,[[0,8,11,14]])}))),function(){return t.apply(this,arguments)})},{key:"handleSubmit",value:(e=(0,n.A)(c().mark((function e(t){var r,n;return c().wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return t.preventDefault(),this.loading=!0,e.prev=2,e.next=5,this.stripe.confirmSetup({elements:this.elements,confirmParams:{return_url:(0,d.a)(this.successUrl,{payment_intent:null===(r=this.paymentIntent)||void 0===r?void 0:r.id})},redirect:"always"});case 5:if(!(null==(n=e.sent)?void 0:n.error)){e.next=9;break}throw this.error=n.error.message,n.error;case 9:e.next=16;break;case 11:e.prev=11,e.t0=e.catch(2),console.error(e.t0),this.error=(null===e.t0||void 0===e.t0?void 0:e.t0.message)||wp.i18n.__("Something went wrong","surecart"),this.loading=!1;case 16:case"end":return e.stop()}}),e,this,[[2,11]])}))),function(_x){return e.apply(this,arguments)})},{key:"render",value:function(){var e=this;return(0,s.h)("sc-form",{key:"b0f9a274a3eb5d188ba18bb97f28f5694b574c4f",onScFormSubmit:function(t){return e.handleSubmit(t)}},this.error&&(0,s.h)("sc-alert",{key:"eb4b91f93c6a8e5089cc83ce1afe74d33ce48d2c",open:!!this.error,type:"danger"},(0,s.h)("span",{key:"0aab644ead23292b91fad4e5cd227d6dd66c0e3d",slot:"title"},wp.i18n.__("Error","surecart")),this.error),(0,s.h)("div",{key:"29051e5d81cd01ed30aa1fc83b36d467b3518646",class:"loader",hidden:this.loaded},(0,s.h)("div",{key:"3978f7590da8bdbd5578a0559e4ff2c80b474256",class:"loader__row"},(0,s.h)("div",{key:"89190a4b868b05cc36459a022e67a4b70e4b224d",style:{width:"50%"}},(0,s.h)("sc-skeleton",{key:"ce36584c4be74739e08ec6a1667802540e043422",style:{width:"50%",marginBottom:"0.5em"}}),(0,s.h)("sc-skeleton",{key:"9c1be32660378e8fb94a0475a75e9afb2cafad2a"})),(0,s.h)("div",{key:"94adb61d7e1c1d642d838fb85a760249cc144acc",style:{flex:"1"}},(0,s.h)("sc-skeleton",{key:"5260519f8fb46249ba60b6d8aa9c4bcd8b7abc33",style:{width:"50%",marginBottom:"0.5em"}}),(0,s.h)("sc-skeleton",{key:"0becdaaf876a24aa4484ea9337b259dd0873dbed"})),(0,s.h)("div",{key:"df039de80e3ac0a87fd985e78fb1ae9650fdad07",style:{flex:"1"}},(0,s.h)("sc-skeleton",{key:"a11d49a2183028e26c56bff62922cf75edecb9e4",style:{width:"50%",marginBottom:"0.5em"}}),(0,s.h)("sc-skeleton",{key:"b40882770815b2652c7bf60caa5a66f8e99edda7"}))),(0,s.h)("div",{key:"709fc27ddbd10c163f86aa3ed99236aa2417f589",class:"loader__details"},(0,s.h)("sc-skeleton",{key:"b4ec5b7fbccac54f53ac82a048bd161fdd25ce14",style:{height:"1rem"}}),(0,s.h)("sc-skeleton",{key:"a6610359b86a450cc430278f26325fa81052733f",style:{height:"1rem",width:"30%"}}))),(0,s.h)("div",{key:"4fe3fb97194731af33c6f0ff38fec3a8229b9964",hidden:!this.loaded,class:"sc-payment-element-container",ref:function(t){return e.container=t}}),(0,s.h)("sc-button",{key:"895717d2ec8b644be617571ec12063af46f2d6c2",type:"primary",submit:!0,full:!0,loading:this.loading},wp.i18n.__("Save Payment Method","surecart")))}}],[{key:"watchers",get:function(){return{paymentIntent:["handlePaymentIntentCreate"]}}}]);var e,t,r}();p.style="sc-stripe-add-method{display:block}sc-stripe-add-method [hidden]{display:none}.loader{display:grid;height:128px;gap:2em}.loader__row{display:flex;align-items:flex-start;justify-content:space-between;gap:1em}.loader__details{display:grid;gap:0.5em}"}}]); |