WooCommerce Stripe Payment Gateway - Version 5.2.1

Version Description

  • 2021-06-10 =

  • Fix - Remove calls to has_block() since it breaks compatibility with older versions of WordPress.

  • Tweak - Use the same JavaScript configurations for the Block-based and Shortcode-based checkout flows.

Download this release

Release Info

Developer woothemes
Plugin Icon 128x128 WooCommerce Stripe Payment Gateway
Version 5.2.1
Comparing to
See all releases

Code changes from version 5.2.0 to 5.2.1

build/index.asset.php CHANGED
@@ -1 +1 @@
1
- <?php return array('dependencies' => array('jquery', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => '70bf8f00a445ed6d4cd6dfa3cc471382');
1
+ <?php return array('dependencies' => array('jquery', 'react', 'wc-blocks-registry', 'wc-settings', 'wp-element', 'wp-i18n', 'wp-polyfill'), 'version' => 'ccaf1e67048f27c39a114cc00e2ef70a');
build/index.js CHANGED
@@ -1 +1 @@
1
- !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(13),o=n(14),i=n(15),c=n(17);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||c()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){!function(e,t){"use strict";function n(e){return(n="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})(e)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(){}function i(){}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,i.resetWarningCache=o;var c=function(e,t){return function(e){e.exports=function(){function e(e,t,n,r,o,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}()}(t={exports:{}}),t.exports}(),a=function(e){return null!==e&&"object"===n(e)},s=function e(t,n){if(!a(t)||!a(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var o="[object Object]"===Object.prototype.toString.call(t);if(o!==("[object Object]"===Object.prototype.toString.call(n)))return!1;if(!o&&!r)return!1;var i=Object.keys(t),c=Object.keys(n);if(i.length!==c.length)return!1;for(var s={},u=0;u<i.length;u+=1)s[i[u]]=!0;for(var l=0;l<c.length;l+=1)s[c[l]]=!0;var p=Object.keys(s);if(p.length!==i.length)return!1;var d=t,f=n;return p.every((function(t){return e(d[t],f[t])}))},u=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},l=function(e){if(null===e||a(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},p=t.createContext(null);p.displayName="ElementsContext";var d=function(e){var n,o,i=e.stripe,c=e.options,d=e.children,f=t.useRef(!1),m=t.useRef(!0),y=t.useMemo((function(){return function(e){if(function(e){return a(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(l)};var t=l(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}}(i)}),[i]),v=(n=t.useState((function(){return{stripe:null,elements:null}})),o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(_n=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==c.return||c.return()}finally{if(r)throw o}}return n}}(n,o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.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)?r(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),b=v[0],_=v[1],g=u(i),h=u(c);return null!==g&&(g!==i&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),s(c,h)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),f.current||("sync"===y.tag&&(f.current=!0,_({stripe:y.stripe,elements:y.stripe.elements(c)})),"async"===y.tag&&(f.current=!0,y.stripePromise.then((function(e){e&&m.current&&_({stripe:e,elements:e.elements(c)})})))),t.useEffect((function(){return function(){m.current=!1}}),[]),t.useEffect((function(){var e=b.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.2.2"})}),[b.stripe]),t.createElement(p.Provider,{value:b},d)};d.propTypes={stripe:c.any,options:c.object};var f=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(p),e)},m=function(e){return(0,e.children)(f("mounts <ElementsConsumer>"))};m.propTypes={children:c.func.isRequired};var y=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},v=function(e){return a(e)?(e.paymentRequest,function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,["paymentRequest"])):{}},b=function(){},_=function(e,n){var r,o="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),i=n?function(e){f("mounts <".concat(o,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,i=n.className,c=n.options,a=void 0===c?{}:c,u=n.onBlur,l=void 0===u?b:u,p=n.onFocus,d=void 0===p?b:p,m=n.onReady,_=void 0===m?b:m,g=n.onChange,h=void 0===g?b:g,w=n.onEscape,O=void 0===w?b:w,E=n.onClick,j=void 0===E?b:E,C=f("mounts <".concat(o,">")).elements,x=t.useRef(null),S=t.useRef(null),R=y(_),P=y(l),T=y(d),k=y(j),A=y(h),I=y(O);t.useLayoutEffect((function(){if(null==x.current&&C&&null!=S.current){var t=C.create(e,a);x.current=t,t.mount(S.current),t.on("ready",(function(){return R(t)})),t.on("change",A),t.on("blur",P),t.on("focus",T),t.on("escape",I),t.on("click",k)}}));var M=t.useRef(a);return t.useEffect((function(){M.current&&M.current.paymentRequest!==a.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=v(a);0===Object.keys(e).length||s(e,v(M.current))||x.current&&(x.current.update(e),M.current=a)}),[a]),t.useLayoutEffect((function(){return function(){x.current&&x.current.destroy()}}),[]),t.createElement("div",{id:r,className:i,ref:S})};return i.propTypes={id:c.string,className:c.string,onChange:c.func,onBlur:c.func,onFocus:c.func,onReady:c.func,onClick:c.func,options:c.object},i.displayName=o,i.__elementType=e,i},g="undefined"==typeof window,h=_("auBankAccount",g),w=_("card",g),O=_("cardNumber",g),E=_("cardExpiry",g),j=_("cardCvc",g),C=_("fpxBank",g),x=_("iban",g),S=_("idealBank",g),R=_("paymentRequestButton",g);e.AuBankAccountElement=h,e.CardCvcElement=j,e.CardElement=w,e.CardExpiryElement=E,e.CardNumberElement=O,e.Elements=d,e.ElementsConsumer=m,e.FpxBankElement=C,e.IbanElement=x,e.IdealBankElement=S,e.PaymentRequestButtonElement=R,e.useElements=function(){return f("calls useElements()").elements},e.useStripe=function(){return f("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(19))},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.jQuery},function(e,t){function n(e,t,n,r,o,i,c){try{var a=e[i](c),s=a.value}catch(e){return void n(e)}a.done?t(s):Promise.resolve(s).then(r,o)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var c=e.apply(t,r);function a(e){n(c,o,i,a,s,"next",e)}function s(e){n(c,o,i,a,s,"throw",e)}a(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(18);e.exports=function(e,t){if(null==e)return{};var n,o,i=r(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)n=c[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(_n=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==c.return||c.return()}finally{if(r)throw o}}return n}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(16);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.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)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.React},function(e,t,n){"use strict";n.r(t);var r=n(10),o=n(11),i=n.n(o),c=n(3),a=n.n(c),s=n(8),u=n.n(s),l=n(0),p=n(1),d=n(2),f=n.n(d),m=n(9),y={INVALID_EMAIL:"email_invalid",INVALID_REQUEST:"invalid_request_error",API_CONNECTION:"api_connection_error",API_ERROR:"api_error",AUTHENTICATION_ERROR:"authentication_error",RATE_LIMIT_ERROR:"rate_limit_error",CARD_ERROR:"card_error",VALIDATION_ERROR:"validation_error"},v=function(){var e=Object(m.getSetting)("stripe_data",null);if(!e)throw new Error("Stripe initialization data is not available");return e},b=function(e){return[y.INVALID_REQUEST,y.API_CONNECTION,y.API_ERROR,y.AUTHENTICATION_ERROR,y.RATE_LIMIT_ERROR].includes(e)},_=function(e){var t;return(t={},f()(t,"invalid_number",Object(p.__)("The card number is not a valid credit card number.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_month",Object(p.__)("The card expiration month is invalid.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_year",Object(p.__)("The card expiration year is invalid.","woocommerce-gateway-stripe")),f()(t,"invalid_cvc",Object(p.__)("The card security code is invalid.","woocommerce-gateway-stripe")),f()(t,"incorrect_number",Object(p.__)("The card number is incorrect.","woocommerce-gateway-stripe")),f()(t,"incomplete_number",Object(p.__)("The card number is incomplete.","woocommerce-gateway-stripe")),f()(t,"incomplete_cvc",Object(p.__)("The card security code is incomplete.","woocommerce-gateway-stripe")),f()(t,"incomplete_expiry",Object(p.__)("The card expiration date is incomplete.","woocommerce-gateway-stripe")),f()(t,"expired_card",Object(p.__)("The card has expired.","woocommerce-gateway-stripe")),f()(t,"incorrect_cvc",Object(p.__)("The card security code is incorrect.","woocommerce-gateway-stripe")),f()(t,"incorrect_zip",Object(p.__)("The card zip code failed validation.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_year_past",Object(p.__)("The card expiration year is in the past","woocommerce-gateway-stripe")),f()(t,"card_declined",Object(p.__)("The card was declined.","woocommerce-gateway-stripe")),f()(t,"missing",Object(p.__)("There is no card on a customer that is being charged.","woocommerce-gateway-stripe")),f()(t,"processing_error",Object(p.__)("An error occurred while processing the card.","woocommerce-gateway-stripe")),t)[e]||null},g=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";switch(e){case y.INVALID_EMAIL:return Object(p.__)("Invalid email address, please correct and try again.","woocommerce-gateway-stripe");case b(e):return Object(p.__)("Unable to process this payment, please try again or use alternative method.","woocommerce-gateway-stripe");case y.CARD_ERROR:return _(t);case y.VALIDATION_ERROR:return""}return null},h="https://js.stripe.com/v3",w=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,O="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",E=null,j=function(e,t,n){if(null===e)return null;var r=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.11.0",startTime:t})}(r,n),r},C=Promise.resolve().then((function(){return e=null,null!==E?E:E=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(O),window.Stripe)t(window.Stripe);else try{var r=function(){for(var e=document.querySelectorAll('script[src^="'.concat(h,'"]')),t=0;t<e.length;t++){var n=e[t];if(w.test(n.src))return n}return null}();r&&e?console.warn(O):r||(r=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(h).concat(t);var r=document.head||document.body;if(!r)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(n),n}(e)),r.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),r.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}));var e})),x=!1;C.catch((function(e){x||console.warn(e)}));var S=function(){return new Promise((function(e){try{var t,n,r=null!==(t=null===(n=v())||void 0===n?void 0:n.stripeLocale)&&void 0!==t?t:"auto";e(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];x=!0;var r=Date.now();return C.then((function(e){return j(e,t,r)}))}(function(){var e=v().publicKey;if(!e)throw new Error("There is no api key available for stripe. Make sure it is available on the wc.stripe_data.stripe.key property.");return e}(),{locale:r}))}catch(t){e({error:t})}}))},R=n(4),P=n(7),T=n.n(P),k=n(5),A=n.n(k),I=function(e){var t=e.stripe,n=e.paymentDetails,r=e.errorContext,o=e.errorType,i={type:e.successType};if(!n.setup_intent&&!n.payment_intent_secret)return!0;var c=!!n.setupIntent,a=n.verification_endpoint,s=c?n.setup_intent:n.payment_intent_secret;return t[c?"confirmCardSetup":"confirmCardPayment"](s).then((function(e){if(e.error)throw e.error;var t=e[c?"setupIntent":"paymentIntent"];return"requires_capture"!==t.status&&"succeeded"!==t.status||(i.redirectUrl=a),i})).catch((function(e){return i.type=o,i.message=e.message,i.retry=!0,i.messageContext=r,window.fetch(a+"&is_ajax"),i}))},M=function(e,t,n,r){Object(l.useEffect)((function(){var o=t(function(){var t=T()(A.a.mark((function t(o){var i,c,a;return A.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=o.processingResponse,c=i.paymentDetails||{},t.next=4,I({stripe:e,paymentDetails:c,errorContext:r.noticeContexts.PAYMENTS,errorType:r.responseTypes.ERROR,successType:r.responseTypes.SUCCESS});case 4:return(a=t.sent).type===r.responseTypes.ERROR&&a.retry&&n(""),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}());return function(){return o()}}),[t,r.noticeContexts.PAYMENTS,r.responseTypes.ERROR,r.responseTypes.SUCCESS,n,e])},N=function(){},q=function(e){var t=e.eventRegistration,n=e.emitResponse,r=Object(R.useStripe)(),o=t.onCheckoutAfterProcessingWithSuccess;return M(r,o,N,n),null},L=n(12),D=n.n(L);function B(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function U(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?B(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):B(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var F={style:{base:{iconColor:"#666EE8",color:"#31325F",fontSize:function(e,t,n){var r={};if("object"===("undefined"==typeof document?"undefined":D()(document))&&"function"==typeof document.querySelector&&"function"==typeof window.getComputedStyle){var o=document.querySelector(".wc-block-checkout");o&&(r=window.getComputedStyle(o))}return r.fontSize||"16px"}(),lineHeight:1.375,"::placeholder":{color:"#fff"}}},classes:{focus:"focused",empty:"empty",invalid:"has-error"}},V=function(e){var t=Object(l.useState)(!1),n=a()(t,2),r=n[0],o=n[1],i=Object(l.useState)(U(U({},F),e)),c=a()(i,2),s=c[0],u=c[1],p=Object(l.useState)(""),d=a()(p,2),f=d[0],m=d[1];return Object(l.useEffect)((function(){var e=r?"#CFD7E0":"#fff";u((function(t){var n=void 0!==t.showIcon?{showIcon:r}:{};return U(U({},t),{},{style:U(U({},t.style),{},{base:U(U({},t.style.base),{},{"::placeholder":{color:e}})})},n)}))}),[r]),{options:s,onActive:Object(l.useCallback)((function(e){o(!e||function(e){return!e})}),[o]),error:f,setError:m}};function H(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function W(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?H(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):H(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var Y,z,Z,$,Q=function(e){var t=e.inputErrorComponent,n=e.onChange,r=Object(l.useState)(!0),o=a()(r,2),i=o[0],c=o[1],s=V({hidePostalCode:!0}),u=s.options,d=s.onActive,f=s.error,m=s.setError;return Object(l.createElement)(l.Fragment,null,Object(l.createElement)("div",{className:"wc-block-gateway-container wc-inline-card-element"},Object(l.createElement)(R.CardElement,{id:"wc-stripe-inline-card-element",className:"wc-block-gateway-input",options:u,onBlur:function(){return d(i)},onFocus:function(){return d(i)},onChange:function(e){e.error?m(e.error.message):m(""),c(e.empty),n(e)}}),Object(l.createElement)("label",{htmlFor:"wc-stripe-inline-card-element"},Object(p.__)("Credit Card Information","woocommerce-gateway-stripe"))),Object(l.createElement)(t,{errorMessage:f}))},G=function(e){var t=e.onChange,n=e.inputErrorComponent,r=Object(l.useState)({cardNumber:!0,cardExpiry:!0,cardCvc:!0}),o=a()(r,2),i=o[0],c=o[1],s=V({showIcon:!1}),u=s.options,d=s.onActive,m=s.error,y=s.setError,v=V(),b=v.options,_=v.onActive,g=v.error,h=v.setError,w=V(),O=w.options,E=w.onActive,j=w.error,C=w.setError,x=function(e,n){return function(r){r.error?e(r.error.message):e(""),c(W(W({},i),{},f()({},n,r.empty))),t(r)}};return Object(l.createElement)("div",{className:"wc-block-card-elements"},Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-number-element"},Object(l.createElement)(R.CardNumberElement,{onChange:x(y,"cardNumber"),options:u,className:"wc-block-gateway-input",id:"wc-stripe-card-number-element",onFocus:function(){return d(i.cardNumber)},onBlur:function(){return d(i.cardNumber)}}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-number-element"},Object(p.__)("Card Number","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:m})),Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-expiry-element"},Object(l.createElement)(R.CardExpiryElement,{onChange:x(h,"cardExpiry"),options:b,className:"wc-block-gateway-input",onFocus:function(){return _(i.cardExpiry)},onBlur:function(){return _(i.cardExpiry)},id:"wc-stripe-card-expiry-element"}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-expiry-element"},Object(p.__)("Expiry Date","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:g})),Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-cvc-element"},Object(l.createElement)(R.CardCvcElement,{onChange:x(C,"cardCvc"),options:O,className:"wc-block-gateway-input",onFocus:function(){return E(i.cardCvc)},onBlur:function(){return E(i.cardCvc)},id:"wc-stripe-card-code-element"}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-code-element"},Object(p.__)("CVV/CVC","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:j})))},K=function(){return Object.entries(v().icons).map((function(e){var t=a()(e,2),n=t[0],r=t[1];return{id:n,src:r.src,alt:r.alt}}))},J=function(e){var t=e.billing,n=e.eventRegistration,r=e.emitResponse,o=e.components,i=o.ValidationInputError,c=o.PaymentMethodIcons,s=Object(l.useState)(""),u=a()(s,2),p=u[0],d=u[1],f=Object(R.useStripe)(),m=function(e,t,n,r,o,i){var c=Object(l.useState)(""),s=a()(c,2),u=s[0],p=s[1],d=Object(l.useCallback)((function(e){var t,n=e.error.type,r=e.error.code||"",o=null!==(t=g(n,r))&&void 0!==t?t:e.error.message;return p(o),o}),[]),f=e.onCheckoutAfterProcessingWithSuccess,m=e.onPaymentProcessing,b=e.onCheckoutAfterProcessingWithError;return M(i,f,r,o),function(e,t,n,r,o,i,c,a){var s=Object(R.useElements)();Object(l.useEffect)((function(){var u=function(){var e=T()(A.a.mark((function e(t){var r;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=v().inline_cc_form?R.CardElement:R.CardNumberElement,e.next=3,n.createSource(null==s?void 0:s.getElement(r),{type:"card",owner:t});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}(),l=a(function(){var n=T()(A.a.mark((function n(){var a,s,l,p,d;return A.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,l=r.billingData,!t){n.next=4;break}return n.abrupt("return",{type:o.responseTypes.ERROR,message:t});case 4:if(""===i){n.next=6;break}return n.abrupt("return",{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{paymentMethod:"stripe",paymentRequestType:"cc",stripe_source:i},billingData:l}});case 6:return p={address:{line1:l.address_1,line2:l.address_2,city:l.city,state:l.state,postal_code:l.postcode,country:l.country}},l.phone&&(p.phone=l.phone),l.email&&(p.email=l.email),(l.first_name||l.last_name)&&(p.name="".concat(l.first_name," ").concat(l.last_name)),n.next=12,u(p);case 12:if(!(d=n.sent).error){n.next=15;break}return n.abrupt("return",{type:o.responseTypes.ERROR,message:e(d)});case 15:if(d.source&&d.source.id){n.next=17;break}throw new Error(g(y.API_ERROR));case 17:return c(d.source.id),n.abrupt("return",{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{stripe_source:d.source.id,billing_email:p.email,billing_first_name:null!==(a=null==l?void 0:l.first_name)&&void 0!==a?a:"",billing_last_name:null!==(s=null==l?void 0:l.last_name)&&void 0!==s?s:"",paymentMethod:"stripe",paymentRequestType:"cc"},billingData:l}});case 21:return n.prev=21,n.t0=n.catch(0),n.abrupt("return",{type:o.responseTypes.ERROR,message:n.t0});case 24:case"end":return n.stop()}}),n,null,[[0,21]])})));return function(){return n.apply(this,arguments)}}());return function(){l()}}),[a,r.billingData,n,i,c,e,t,o.noticeContexts.PAYMENTS,o.responseTypes.ERROR,o.responseTypes.SUCCESS,s])}(d,u,i,t,o,n,r,m),Object(l.useEffect)((function(){var e=b((function(e){var t,n=e.processingResponse;return null==n||null===(t=n.paymentDetails)||void 0===t||!t.errorMessage||{type:o.responseTypes.ERROR,message:n.paymentDetails.errorMessage,messageContext:o.noticeContexts.PAYMENTS}}));return function(){e()}}),[b,o.noticeContexts.PAYMENTS,o.responseTypes.ERROR]),d}(n,t,p,d,r,f),b=function(e){e.error&&m(e),d("")},_=K(),h=v().inline_cc_form?Object(l.createElement)(Q,{onChange:b,inputErrorComponent:i}):Object(l.createElement)(G,{onChange:b,inputErrorComponent:i});return Object(l.createElement)(l.Fragment,null,h,c&&_.length&&Object(l.createElement)(c,{icons:_,align:"left"}))},X=function(e){var t=e.stripe;return Object(l.createElement)(R.Elements,{stripe:t},Object(l.createElement)(J,e))},ee=S(),te=function(e){var t=e.RenderedComponent,n=u()(e,["RenderedComponent"]),r=Object(l.useState)(""),o=a()(r,2),c=o[0],s=o[1];return Object(l.useEffect)((function(){Promise.resolve(ee).then((function(e){var t=e.error;t&&s(t.message)}))}),[s]),Object(l.useEffect)((function(){if(c)throw new Error(c)}),[c]),Object(l.createElement)(t,i()({stripe:ee},n))},ne=K(),re={name:"stripe",label:Object(l.createElement)((function(e){var t=e.components.PaymentMethodLabel,n=v().title?v().title:Object(p.__)("Credit / Debit Card","woocommerce-gateway-stripe");return Object(l.createElement)(t,{text:n})}),null),content:Object(l.createElement)(te,{RenderedComponent:X}),edit:Object(l.createElement)(te,{RenderedComponent:X}),savedTokenComponent:Object(l.createElement)(te,{RenderedComponent:function(e){var t=e.stripe,n=u()(e,["stripe"]);return Object(l.createElement)(R.Elements,{stripe:t},Object(l.createElement)(q,n))}}),icons:ne,canMakePayment:function(){return ee},ariaLabel:Object(p.__)("Stripe Credit Card payment method","woocommerce-gateway-stripe"),supports:{showSavedCards:null!==(Y=v().showSavedCards)&&void 0!==Y&&Y,showSaveOption:null!==(z=v().showSaveOption)&&void 0!==z&&z,features:null!==(Z=null===($=v())||void 0===$?void 0:$.supports)&&void 0!==Z?Z:[]}},oe=function(e){var t,n=e.onButtonClicked,r=null===(t=v())||void 0===t?void 0:t.button,o=r.theme,i=void 0===o?"dark":o,c=r.locale,s=void 0===c?"en":c,u=r.height,p=void 0===u?"44":u,d=wc_stripe_payment_request_params.button.branded_type,f=["short","long"].includes(d)?d:"long",m=function(e,t,n){var r="long"===e?"https://www.gstatic.com/instantbuy/svg/".concat(t,"/").concat(n,".svg"):"https://www.gstatic.com/instantbuy/svg/".concat(t,"_gpay.svg"),o=Object(l.useState)(r),i=a()(o,2),c=i[0],s=i[1];return Object(l.useEffect)((function(){var e=document.createElement("img");e.addEventListener("error",(function(){s("https://www.gstatic.com/instantbuy/svg/".concat(t,"/en.svg"))})),e.src=c}),[c,t]),c}(f,"dark"===i?"dark":"light",s);return Object(l.createElement)("button",{type:"button",id:"wc-stripe-branded-button","aria-label":"Google Pay",className:"gpay-button ".concat(i," ").concat(f),style:{backgroundImage:"url(".concat(m,")"),height:p+"px"},onClick:n})},ie=function(e){var t=e.onButtonClicked,n=v().button,r=n.theme,o=void 0===r?"dark":r,i=n.height,c=void 0===i?"44":i,a=n.customLabel,s=void 0===a?Object(p.__)("Buy now","woocommerce-gateway-stripe"):a;return Object(l.createElement)("button",{type:"button",id:"wc-stripe-custom-button",className:"button ".concat(o," is-active"),style:{height:c+"px"},onClick:t},s)},ce=n(6),ae=n.n(ce);function se(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var ue,le,pe=function(e){return wc_stripe_payment_request_params.ajax_url.toString().replace("%%endpoint%%","wc_stripe_"+e)},de=function(e){var t,n;(t=e.shippingOption,n={security:wc_stripe_payment_request_params.nonce.update_shipping,shipping_method:[t.id],is_product_page:wc_stripe_payment_request_params.is_product_page},ae.a.ajax({type:"POST",data:n,url:pe("update_shipping_method")})).then((function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})}))},fe=function(e,t){Object(l.useEffect)((function(){var n=null==e?void 0:e.on("shippingaddresschange",function(e){return function(t){(function(e,t){var n=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?se(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):se(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({security:wc_stripe_payment_request_params.nonce.shipping,payment_request_type:t,is_product_page:wc_stripe_payment_request_params.is_product_page},function(e){return{country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:void 0===e.addressLine[0]?"":e.addressLine[0],address_2:void 0===e.addressLine[1]?"":e.addressLine[1]}}(e));return ae.a.ajax({type:"POST",data:n,url:pe("get_shipping_options")})})(t.shippingAddress,e).then((function(e){t.updateWith({status:e.result,shippingOptions:e.shipping_options,total:e.total,displayItems:e.displayItems})}))}}(t));return function(){null==n||n.removeAllListeners()}}),[e,t])},me=function(e,t,n,r){Object(l.useEffect)((function(){var o=null==t?void 0:t.on("source",function(e,t,n){return function(r){var o,i,c,a,s,u;"yes"===(null===(o=wc_stripe_payment_request_params)||void 0===o||null===(i=o.stripe)||void 0===i?void 0:i.allow_prepaid_card)||"prepaid"!==(null==r||null===(c=r.source)||void 0===c||null===(a=c.card)||void 0===a?void 0:a.funding)?function(e,t){var n=function(e,t){var n,r,o,i,c,a,s,u,l,p,d,f,m,y,v,b,_,g,h,w,O,E,j,C,x,S,R,P,T=e.source,k=null==T||null===(n=T.owner)||void 0===n?void 0:n.email,A=null==T||null===(r=T.owner)||void 0===r?void 0:r.phone,I=null==T||null===(o=T.owner)||void 0===o?void 0:o.address,M=null==T||null===(i=T.owner)||void 0===i?void 0:i.name,N=null==e?void 0:e.shippingAddress,q={_wpnonce:wc_stripe_payment_request_params.nonce.checkout,billing_first_name:null!==(c=null==M||null===(a=M.split(" "))||void 0===a||null===(s=a.slice(0,1))||void 0===s?void 0:s.join(" "))&&void 0!==c?c:"",billing_last_name:null!==(u=null==M||null===(l=M.split(" "))||void 0===l||null===(p=l.slice(1))||void 0===p?void 0:p.join(" "))&&void 0!==u?u:"",billing_company:"",billing_email:null!=k?k:null==e?void 0:e.payerEmail,billing_phone:null!=A?A:null==e||null===(d=e.payerPhone)||void 0===d?void 0:d.replace("/[() -]/g",""),billing_country:null!==(f=null==I?void 0:I.country)&&void 0!==f?f:"",billing_address_1:null!==(m=null==I?void 0:I.line1)&&void 0!==m?m:"",billing_address_2:null!==(y=null==I?void 0:I.line2)&&void 0!==y?y:"",billing_city:null!==(v=null==I?void 0:I.city)&&void 0!==v?v:"",billing_state:null!==(b=null==I?void 0:I.state)&&void 0!==b?b:"",billing_postcode:null!==(_=null==I?void 0:I.postal_code)&&void 0!==_?_:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null==e||null===(g=e.shippingOption)||void 0===g?void 0:g.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:T.id,payment_request_type:t};return N&&(q.shipping_first_name=null==N||null===(h=N.recipient)||void 0===h||null===(w=h.split(" "))||void 0===w||null===(O=w.slice(0,1))||void 0===O?void 0:O.join(" "),q.shipping_last_name=null==N||null===(E=N.recipient)||void 0===E||null===(j=E.split(" "))||void 0===j||null===(C=j.slice(1))||void 0===C?void 0:C.join(" "),q.shipping_company=null==N?void 0:N.organization,q.shipping_country=null==N?void 0:N.country,q.shipping_address_1=null!==(x=null==N||null===(S=N.addressLine)||void 0===S?void 0:S[0])&&void 0!==x?x:"",q.shipping_address_2=null!==(R=null==N||null===(P=N.addressLine)||void 0===P?void 0:P[1])&&void 0!==R?R:"",q.shipping_city=null==N?void 0:N.city,q.shipping_state=null==N?void 0:N.region,q.shipping_postcode=null==N?void 0:N.postalCode),q}(e,t);return ae.a.ajax({type:"POST",data:n,dataType:"json",url:pe("create_order")})}(r,t).then(function(e,t,n){return function(r){if("success"===r.result){t.complete("success");var o=function(e){var t=e.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);if(t&&!(t.length<4))return{type:t[1],clientSecret:t[2],redirectUrl:decodeURIComponent(t[3])}}(r.redirect);if(!o||o.length<4)return void(window.location=r.redirect);var i=o.type,c=o.clientSecret,a=o.redirectUrl;(function(e,t,n){return"si"===t?e.handleCardSetup(n):e.handleCardPayment(n)})(e,i,c).then(function(e,t){return function(n){if(n.error)throw n.error;var r=function(e,t){return"si"===t?e.setupIntent:e.paymentIntent}(n,t);(function(e){return"requires_capture"===e.status}(r)||function(e){return"succeeded"===e.status}(r))&&(window.location=e)}}(a,i)).catch((function(e){n(e.message),ae.a.get(a+"&is_ajax")}))}else{var s,u;t.complete("fail");var l=document.createElement("div");l.innerHTML=r.messages;var p=null!==(s=null==l||null===(u=l.firstChild)||void 0===u?void 0:u.textContent)&&void 0!==s?s:"";n(p)}}}(e,r,n)):n(null===(s=wc_stripe_payment_request_params)||void 0===s||null===(u=s.i18n)||void 0===u?void 0:u.no_prepaid_card)}}(e,n,r));return function(){null==o||o.removeAllListeners()}}),[e,t,n,r])},ye=function(e){var t=e.billing,n=e.shippingData,r=e.onClick,o=e.onClose,i=e.setExpressPaymentError,c=Object(R.useStripe)(),s=function(e,t,n){var r=Object(l.useState)(null),o=a()(r,2),i=o[0],c=o[1],s=Object(l.useState)(null),u=a()(s,2),p=u[0],d=u[1];return Object(l.useEffect)((function(){var t;e&&!i&&(t={security:wc_stripe_payment_request_params.nonce.payment},ae.a.ajax({type:"POST",data:t,url:pe("get_cart_details")})).then((function(t){var n=function(e,t){var n={total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:wc_stripe_payment_request_params.checkout.needs_payer_phone,requestShipping:!!t.shipping_required,displayItems:t.order_data.displayItems};return"PR"===n.country&&(n.country="US"),e.paymentRequest(n)}(e,t);n.canMakePayment().then((function(e){e&&(c(n),e.applePay?d("apple_pay"):e.googlePay?d("google_pay"):d("payment_request_api"))}))}))}),[i,e]),Object(l.useEffect)((function(){c(null)}),[t,n.cartTotal,n.cartTotalItems,n.currency.code]),[i,p]}(c,n.needsShipping,t),u=a()(s,2),p=u[0],d=u[1];fe(p,d),function(e,t){Object(l.useEffect)((function(){var t=null==e?void 0:e.on("shippingoptionchange",de);return function(){null==t||t.removeAllListeners()}}),[e,t])}(p,d),me(c,p,d,i);var f=function(e,t){return Object(l.useCallback)((function(){e(""),t()}),[e,t])}(i,r);!function(e,t){Object(l.useEffect)((function(){null==e||e.on("cancel",(function(){t()}))}),[e,t])}(p,o);var m=v().button,y=m.type,b=void 0===y?"default":y,_=m.theme,g=void 0===_?"dark":_,h=m.height,w={paymentRequestButton:{type:b,theme:g,height:"".concat(void 0===h?"48":h,"px")}},O=wc_stripe_payment_request_params.button.is_branded,E=wc_stripe_payment_request_params.button.branded_type,j=wc_stripe_payment_request_params.button.is_custom;if(!p)return null;var C,x,S,P=function(){f(),p.show()};return j?Object(l.createElement)(ie,{onButtonClicked:P}):O&&(C=window.navigator.userAgent.toLowerCase(),S=(x=/chrome/.test(C)&&!/edge|edg|opr|brave\//.test(C)&&"Google Inc."===window.navigator.vendor)&&window.navigator.brave,x&&!S)?Object(l.createElement)(oe,{onButtonClicked:P}):(O&&(w.paymentRequestButton.type="long"===E?"buy":"default"),Object(l.createElement)(R.PaymentRequestButtonElement,{onClick:f,options:{style:w,paymentRequest:p}}))},ve=S(),be={name:"payment_request",content:Object(l.createElement)((function(e){var t=e.stripe;return Object(l.createElement)(R.Elements,{stripe:t},Object(l.createElement)(ye,e))}),{stripe:ve}),edit:Object(l.createElement)((function(){return Object(l.createElement)("img",{src:"data:image/svg+xml,%3Csvg width='264' height='48' viewBox='0 0 264 48' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='264' height='48' rx='3' fill='black'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M125.114 16.6407C125.682 15.93 126.067 14.9756 125.966 14C125.135 14.0415 124.121 14.549 123.533 15.2602C123.006 15.8693 122.539 16.8641 122.661 17.7983C123.594 17.8797 124.526 17.3317 125.114 16.6407Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M125.955 17.982C124.601 17.9011 123.448 18.7518 122.801 18.7518C122.154 18.7518 121.163 18.0224 120.092 18.0421C118.696 18.0629 117.402 18.8524 116.694 20.1079C115.238 22.6196 116.31 26.3453 117.726 28.3909C118.414 29.4028 119.242 30.5174 120.334 30.4769C121.366 30.4365 121.77 29.8087 123.024 29.8087C124.277 29.8087 124.641 30.4769 125.733 30.4567C126.865 30.4365 127.573 29.4443 128.261 28.4313C129.049 27.2779 129.373 26.1639 129.393 26.1027C129.373 26.0825 127.209 25.2515 127.189 22.7606C127.169 20.6751 128.888 19.6834 128.969 19.6217C127.998 18.1847 126.481 18.0224 125.955 17.982Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M136.131 23.1804H138.834C140.886 23.1804 142.053 22.0752 142.053 20.1592C142.053 18.2432 140.886 17.1478 138.845 17.1478H136.131V23.1804ZM139.466 15.1582C142.411 15.1582 144.461 17.1903 144.461 20.1483C144.461 23.1172 142.369 25.1596 139.392 25.1596H136.131V30.3498H133.775V15.1582H139.466Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152.198 26.224V25.3712L149.579 25.5397C148.106 25.6341 147.339 26.182 147.339 27.14C147.339 28.0664 148.138 28.6667 149.39 28.6667C150.988 28.6667 152.198 27.6449 152.198 26.224ZM145.046 27.2032C145.046 25.2551 146.529 24.1395 149.263 23.971L152.198 23.7922V22.9498C152.198 21.7181 151.388 21.0442 149.947 21.0442C148.758 21.0442 147.896 21.6548 147.717 22.5916H145.592C145.656 20.6232 147.507 19.1914 150.01 19.1914C152.703 19.1914 154.459 20.602 154.459 22.7917V30.351H152.282V28.5298H152.229C151.609 29.719 150.241 30.4666 148.758 30.4666C146.571 30.4666 145.046 29.1612 145.046 27.2032Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M156.461 34.4145V32.5934C156.608 32.6141 156.965 32.6354 157.155 32.6354C158.196 32.6354 158.785 32.1932 159.142 31.0564L159.353 30.3824L155.366 19.3281H157.827L160.604 28.298H160.657L163.434 19.3281H165.832L161.698 30.9402C160.752 33.6038 159.668 34.4778 157.376 34.4778C157.197 34.4778 156.618 34.4565 156.461 34.4145Z' fill='white'/%3E%3C/svg%3E%0A",alt:""})}),null),canMakePayment:function(e){var t,n;return!(null===(t=null===(n=v())||void 0===n?void 0:n.isAdmin)||void 0===t||!t)||"undefined"!=typeof wc_stripe_payment_request_params&&S().then((function(t){var n,r,o,i,c;return t.paymentRequest({total:{label:"Total",amount:parseInt(null!==(n=null==e||null===(r=e.cartTotals)||void 0===r?void 0:r.total_price)&&void 0!==n?n:0,10),pending:!0},country:null===(o=Object(m.getSetting)("baseLocation",{}))||void 0===o?void 0:o.country,currency:null==e||null===(i=e.cartTotals)||void 0===i||null===(c=i.currency_code)||void 0===c?void 0:c.toLowerCase()}).canMakePayment()}))},paymentMethodId:"stripe",supports:{features:null!==(ue=null===(le=v())||void 0===le?void 0:le.supports)&&void 0!==ue?ue:[]}};Object(r.registerPaymentMethod)(re),Object(r.registerExpressPaymentMethod)(be)}]);
1
+ !function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=20)}([function(e,t){e.exports=window.wp.element},function(e,t){e.exports=window.wp.i18n},function(e,t){e.exports=function(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(13),o=n(14),i=n(15),c=n(17);e.exports=function(e,t){return r(e)||o(e,t)||i(e,t)||c()},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){!function(e,t){"use strict";function n(e){return(n="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})(e)}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(){}function i(){}t=t&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t,i.resetWarningCache=o;var c=function(e,t){return function(e){e.exports=function(){function e(e,t,n,r,o,i){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==i){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function t(){return e}e.isRequired=e;var n={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:i,resetWarningCache:o};return n.PropTypes=n,n}()}(t={exports:{}}),t.exports}(),a=function(e){return null!==e&&"object"===n(e)},u=function e(t,n){if(!a(t)||!a(n))return t===n;var r=Array.isArray(t);if(r!==Array.isArray(n))return!1;var o="[object Object]"===Object.prototype.toString.call(t);if(o!==("[object Object]"===Object.prototype.toString.call(n)))return!1;if(!o&&!r)return!1;var i=Object.keys(t),c=Object.keys(n);if(i.length!==c.length)return!1;for(var u={},s=0;s<i.length;s+=1)u[i[s]]=!0;for(var l=0;l<c.length;l+=1)u[c[l]]=!0;var p=Object.keys(u);if(p.length!==i.length)return!1;var d=t,f=n;return p.every((function(t){return e(d[t],f[t])}))},s=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),n.current},l=function(e){if(null===e||a(t=e)&&"function"==typeof t.elements&&"function"==typeof t.createToken&&"function"==typeof t.createPaymentMethod&&"function"==typeof t.confirmCardPayment)return e;var t;throw new Error("Invalid prop `stripe` supplied to `Elements`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},p=t.createContext(null);p.displayName="ElementsContext";var d=function(e){var n,o,i=e.stripe,c=e.options,d=e.children,f=t.useRef(!1),m=t.useRef(!0),v=t.useMemo((function(){return function(e){if(function(e){return a(e)&&"function"==typeof e.then}(e))return{tag:"async",stripePromise:Promise.resolve(e).then(l)};var t=l(e);return null===t?{tag:"empty"}:{tag:"sync",stripe:t}}(i)}),[i]),y=(n=t.useState((function(){return{stripe:null,elements:null}})),o=2,function(e){if(Array.isArray(e))return e}(n)||function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(_n=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==c.return||c.return()}finally{if(r)throw o}}return n}}(n,o)||function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.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)?r(e,t):void 0}}(n,o)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()),b=y[0],g=y[1],h=s(i),_=s(c);return null!==h&&(h!==i&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it."),u(c,_)||console.warn("Unsupported prop change on Elements: You cannot change the `options` prop after setting the `stripe` prop.")),f.current||("sync"===v.tag&&(f.current=!0,g({stripe:v.stripe,elements:v.stripe.elements(c)})),"async"===v.tag&&(f.current=!0,v.stripePromise.then((function(e){e&&m.current&&g({stripe:e,elements:e.elements(c)})})))),t.useEffect((function(){return function(){m.current=!1}}),[]),t.useEffect((function(){var e=b.stripe;e&&e._registerWrapper&&e._registerWrapper({name:"react-stripe-js",version:"1.2.2"})}),[b.stripe]),t.createElement(p.Provider,{value:b},d)};d.propTypes={stripe:c.any,options:c.object};var f=function(e){return function(e,t){if(!e)throw new Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an <Elements> provider."));return e}(t.useContext(p),e)},m=function(e){return(0,e.children)(f("mounts <ElementsConsumer>"))};m.propTypes={children:c.func.isRequired};var v=function(e){var n=t.useRef(e);return t.useEffect((function(){n.current=e}),[e]),function(){n.current&&n.current.apply(n,arguments)}},y=function(e){return a(e)?(e.paymentRequest,function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,["paymentRequest"])):{}},b=function(){},g=function(e,n){var r,o="".concat((r=e).charAt(0).toUpperCase()+r.slice(1),"Element"),i=n?function(e){f("mounts <".concat(o,">"));var n=e.id,r=e.className;return t.createElement("div",{id:n,className:r})}:function(n){var r=n.id,i=n.className,c=n.options,a=void 0===c?{}:c,s=n.onBlur,l=void 0===s?b:s,p=n.onFocus,d=void 0===p?b:p,m=n.onReady,g=void 0===m?b:m,h=n.onChange,_=void 0===h?b:h,w=n.onEscape,O=void 0===w?b:w,E=n.onClick,j=void 0===E?b:E,C=f("mounts <".concat(o,">")).elements,x=t.useRef(null),S=t.useRef(null),R=v(g),P=v(l),T=v(d),k=v(j),I=v(_),A=v(O);t.useLayoutEffect((function(){if(null==x.current&&C&&null!=S.current){var t=C.create(e,a);x.current=t,t.mount(S.current),t.on("ready",(function(){return R(t)})),t.on("change",I),t.on("blur",P),t.on("focus",T),t.on("escape",A),t.on("click",k)}}));var M=t.useRef(a);return t.useEffect((function(){M.current&&M.current.paymentRequest!==a.paymentRequest&&console.warn("Unsupported prop change: options.paymentRequest is not a customizable property.");var e=y(a);0===Object.keys(e).length||u(e,y(M.current))||x.current&&(x.current.update(e),M.current=a)}),[a]),t.useLayoutEffect((function(){return function(){x.current&&x.current.destroy()}}),[]),t.createElement("div",{id:r,className:i,ref:S})};return i.propTypes={id:c.string,className:c.string,onChange:c.func,onBlur:c.func,onFocus:c.func,onReady:c.func,onClick:c.func,options:c.object},i.displayName=o,i.__elementType=e,i},h="undefined"==typeof window,_=g("auBankAccount",h),w=g("card",h),O=g("cardNumber",h),E=g("cardExpiry",h),j=g("cardCvc",h),C=g("fpxBank",h),x=g("iban",h),S=g("idealBank",h),R=g("paymentRequestButton",h);e.AuBankAccountElement=_,e.CardCvcElement=j,e.CardElement=w,e.CardExpiryElement=E,e.CardNumberElement=O,e.Elements=d,e.ElementsConsumer=m,e.FpxBankElement=C,e.IbanElement=x,e.IdealBankElement=S,e.PaymentRequestButtonElement=R,e.useElements=function(){return f("calls useElements()").elements},e.useStripe=function(){return f("calls useStripe()").stripe},Object.defineProperty(e,"__esModule",{value:!0})}(t,n(19))},function(e,t){e.exports=window.regeneratorRuntime},function(e,t){e.exports=window.jQuery},function(e,t){function n(e,t,n,r,o,i,c){try{var a=e[i](c),u=a.value}catch(e){return void n(e)}a.done?t(u):Promise.resolve(u).then(r,o)}e.exports=function(e){return function(){var t=this,r=arguments;return new Promise((function(o,i){var c=e.apply(t,r);function a(e){n(c,o,i,a,u,"next",e)}function u(e){n(c,o,i,a,u,"throw",e)}a(void 0)}))}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(18);e.exports=function(e,t){if(null==e)return{};var n,o,i=r(e,t);if(Object.getOwnPropertySymbols){var c=Object.getOwnPropertySymbols(e);for(o=0;o<c.length;o++)n=c[o],t.indexOf(n)>=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.wc.wcSettings},function(e,t){e.exports=window.wc.wcBlocksRegistry},function(e,t){function n(){return e.exports=n=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},e.exports.default=e.exports,e.exports.__esModule=!0,n.apply(this,arguments)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){function n(t){return"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?(e.exports=n=function(e){return typeof e},e.exports.default=e.exports,e.exports.__esModule=!0):(e.exports=n=function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e.exports.default=e.exports,e.exports.__esModule=!0),n(t)}e.exports=n,e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e){if(Array.isArray(e))return e},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if("undefined"!=typeof Symbol&&Symbol.iterator in Object(e)){var n=[],_n=!0,r=!1,o=void 0;try{for(var i,c=e[Symbol.iterator]();!(_n=(i=c.next()).done)&&(n.push(i.value),!t||n.length!==t);_n=!0);}catch(e){r=!0,o=e}finally{try{_n||null==c.return||c.return()}finally{if(r)throw o}}return n}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t,n){var r=n(16);e.exports=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.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)?r(e,t):void 0}},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=function(e,t){if(null==e)return{};var n,r,o={},i=Object.keys(e);for(r=0;r<i.length;r++)n=i[r],t.indexOf(n)>=0||(o[n]=e[n]);return o},e.exports.default=e.exports,e.exports.__esModule=!0},function(e,t){e.exports=window.React},function(e,t,n){"use strict";n.r(t);var r=n(10),o=n(11),i=n.n(o),c=n(3),a=n.n(c),u=n(8),s=n.n(u),l=n(0),p=n(1),d=n(2),f=n.n(d),m=n(9),v={INVALID_EMAIL:"email_invalid",INVALID_REQUEST:"invalid_request_error",API_CONNECTION:"api_connection_error",API_ERROR:"api_error",AUTHENTICATION_ERROR:"authentication_error",RATE_LIMIT_ERROR:"rate_limit_error",CARD_ERROR:"card_error",VALIDATION_ERROR:"validation_error"},y=function(){var e=Object(m.getSetting)("stripe_data",null);if(!e)throw new Error("Stripe initialization data is not available");return e},b=function(e,t){var n,r,o={total:t.order_data.total,currency:t.order_data.currency,country:t.order_data.country_code,requestPayerName:!0,requestPayerEmail:!0,requestPayerPhone:null===(n=y())||void 0===n||null===(r=n.checkout)||void 0===r?void 0:r.needs_payer_phone,requestShipping:!!t.shipping_required,displayItems:t.order_data.displayItems};return"PR"===o.country&&(o.country="US"),e.paymentRequest(o)},g=function(e){return[v.INVALID_REQUEST,v.API_CONNECTION,v.API_ERROR,v.AUTHENTICATION_ERROR,v.RATE_LIMIT_ERROR].includes(e)},h=function(e){var t;return(t={},f()(t,"invalid_number",Object(p.__)("The card number is not a valid credit card number.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_month",Object(p.__)("The card expiration month is invalid.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_year",Object(p.__)("The card expiration year is invalid.","woocommerce-gateway-stripe")),f()(t,"invalid_cvc",Object(p.__)("The card security code is invalid.","woocommerce-gateway-stripe")),f()(t,"incorrect_number",Object(p.__)("The card number is incorrect.","woocommerce-gateway-stripe")),f()(t,"incomplete_number",Object(p.__)("The card number is incomplete.","woocommerce-gateway-stripe")),f()(t,"incomplete_cvc",Object(p.__)("The card security code is incomplete.","woocommerce-gateway-stripe")),f()(t,"incomplete_expiry",Object(p.__)("The card expiration date is incomplete.","woocommerce-gateway-stripe")),f()(t,"expired_card",Object(p.__)("The card has expired.","woocommerce-gateway-stripe")),f()(t,"incorrect_cvc",Object(p.__)("The card security code is incorrect.","woocommerce-gateway-stripe")),f()(t,"incorrect_zip",Object(p.__)("The card zip code failed validation.","woocommerce-gateway-stripe")),f()(t,"invalid_expiry_year_past",Object(p.__)("The card expiration year is in the past","woocommerce-gateway-stripe")),f()(t,"card_declined",Object(p.__)("The card was declined.","woocommerce-gateway-stripe")),f()(t,"missing",Object(p.__)("There is no card on a customer that is being charged.","woocommerce-gateway-stripe")),f()(t,"processing_error",Object(p.__)("An error occurred while processing the card.","woocommerce-gateway-stripe")),t)[e]||null},_=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";switch(e){case v.INVALID_EMAIL:return Object(p.__)("Invalid email address, please correct and try again.","woocommerce-gateway-stripe");case g(e):return Object(p.__)("Unable to process this payment, please try again or use alternative method.","woocommerce-gateway-stripe");case v.CARD_ERROR:return h(t);case v.VALIDATION_ERROR:return""}return null},w="https://js.stripe.com/v3",O=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,E="loadStripe.setLoadParameters was called but an existing Stripe.js script already exists in the document; existing script parameters will be used",j=null,C=function(e,t,n){if(null===e)return null;var r=e.apply(void 0,t);return function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"1.11.0",startTime:t})}(r,n),r},x=Promise.resolve().then((function(){return e=null,null!==j?j:j=new Promise((function(t,n){if("undefined"!=typeof window)if(window.Stripe&&e&&console.warn(E),window.Stripe)t(window.Stripe);else try{var r=function(){for(var e=document.querySelectorAll('script[src^="'.concat(w,'"]')),t=0;t<e.length;t++){var n=e[t];if(O.test(n.src))return n}return null}();r&&e?console.warn(E):r||(r=function(e){var t=e&&!e.advancedFraudSignals?"?advancedFraudSignals=false":"",n=document.createElement("script");n.src="".concat(w).concat(t);var r=document.head||document.body;if(!r)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return r.appendChild(n),n}(e)),r.addEventListener("load",(function(){window.Stripe?t(window.Stripe):n(new Error("Stripe.js not available"))})),r.addEventListener("error",(function(){n(new Error("Failed to load Stripe.js"))}))}catch(e){return void n(e)}else t(null)}));var e})),S=!1;x.catch((function(e){S||console.warn(e)}));var R=function(){return new Promise((function(e){try{var t,n,r=null!==(t=null===(n=y())||void 0===n?void 0:n.stripe_locale)&&void 0!==t?t:"auto";e(function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];S=!0;var r=Date.now();return x.then((function(e){return C(e,t,r)}))}(function(){var e,t=null===(e=y())||void 0===e?void 0:e.key;if(!t)throw new Error("There is no api key available for stripe. Make sure it is available on the wc.stripe_data.stripe.key property.");return t}(),{locale:r}))}catch(t){e({error:t})}}))},P=n(4),T=n(7),k=n.n(T),I=n(5),A=n.n(I),M=function(e){var t=e.stripe,n=e.paymentDetails,r=e.errorContext,o=e.errorType,i={type:e.successType};if(!n.setup_intent&&!n.payment_intent_secret)return!0;var c=!!n.setupIntent,a=n.verification_endpoint,u=c?n.setup_intent:n.payment_intent_secret;return t[c?"confirmCardSetup":"confirmCardPayment"](u).then((function(e){if(e.error)throw e.error;var t=e[c?"setupIntent":"paymentIntent"];return"requires_capture"!==t.status&&"succeeded"!==t.status||(i.redirectUrl=a),i})).catch((function(e){return i.type=o,i.message=e.message,i.retry=!0,i.messageContext=r,window.fetch(a+"&is_ajax"),i}))},N=function(e,t,n,r){Object(l.useEffect)((function(){var o=t(function(){var t=k()(A.a.mark((function t(o){var i,c,a;return A.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=o.processingResponse,c=i.paymentDetails||{},t.next=4,M({stripe:e,paymentDetails:c,errorContext:r.noticeContexts.PAYMENTS,errorType:r.responseTypes.ERROR,successType:r.responseTypes.SUCCESS});case 4:return(a=t.sent).type===r.responseTypes.ERROR&&a.retry&&n(""),t.abrupt("return",a);case 7:case"end":return t.stop()}}),t)})));return function(_x){return t.apply(this,arguments)}}());return function(){return o()}}),[t,r.noticeContexts.PAYMENTS,r.responseTypes.ERROR,r.responseTypes.SUCCESS,n,e])},L=function(){},D=function(e){var t=e.eventRegistration,n=e.emitResponse,r=Object(P.useStripe)(),o=t.onCheckoutAfterProcessingWithSuccess;return N(r,o,L,n),null},q=n(12),B=n.n(q);function U(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function F(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?U(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):U(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var V={style:{base:{iconColor:"#666EE8",color:"#31325F",fontSize:function(e,t,n){var r={};if("object"===("undefined"==typeof document?"undefined":B()(document))&&"function"==typeof document.querySelector&&"function"==typeof window.getComputedStyle){var o=document.querySelector(".wc-block-checkout");o&&(r=window.getComputedStyle(o))}return r.fontSize||"16px"}(),lineHeight:1.375,"::placeholder":{color:"#fff"}}},classes:{focus:"focused",empty:"empty",invalid:"has-error"}},H=function(e){var t=Object(l.useState)(!1),n=a()(t,2),r=n[0],o=n[1],i=Object(l.useState)(F(F({},V),e)),c=a()(i,2),u=c[0],s=c[1],p=Object(l.useState)(""),d=a()(p,2),f=d[0],m=d[1];return Object(l.useEffect)((function(){var e=r?"#CFD7E0":"#fff";s((function(t){var n=void 0!==t.showIcon?{showIcon:r}:{};return F(F({},t),{},{style:F(F({},t.style),{},{base:F(F({},t.style.base),{},{"::placeholder":{color:e}})})},n)}))}),[r]),{options:u,onActive:Object(l.useCallback)((function(e){o(!e||function(e){return!e})}),[o]),error:f,setError:m}};function W(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}function Y(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?W(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):W(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}var z,Z,$,Q,G,J,K=function(e){var t=e.inputErrorComponent,n=e.onChange,r=Object(l.useState)(!0),o=a()(r,2),i=o[0],c=o[1],u=H({hidePostalCode:!0}),s=u.options,d=u.onActive,f=u.error,m=u.setError;return Object(l.createElement)(l.Fragment,null,Object(l.createElement)("div",{className:"wc-block-gateway-container wc-inline-card-element"},Object(l.createElement)(P.CardElement,{id:"wc-stripe-inline-card-element",className:"wc-block-gateway-input",options:s,onBlur:function(){return d(i)},onFocus:function(){return d(i)},onChange:function(e){e.error?m(e.error.message):m(""),c(e.empty),n(e)}}),Object(l.createElement)("label",{htmlFor:"wc-stripe-inline-card-element"},Object(p.__)("Credit Card Information","woocommerce-gateway-stripe"))),Object(l.createElement)(t,{errorMessage:f}))},X=function(e){var t=e.onChange,n=e.inputErrorComponent,r=Object(l.useState)({cardNumber:!0,cardExpiry:!0,cardCvc:!0}),o=a()(r,2),i=o[0],c=o[1],u=H({showIcon:!1}),s=u.options,d=u.onActive,m=u.error,v=u.setError,y=H(),b=y.options,g=y.onActive,h=y.error,_=y.setError,w=H(),O=w.options,E=w.onActive,j=w.error,C=w.setError,x=function(e,n){return function(r){r.error?e(r.error.message):e(""),c(Y(Y({},i),{},f()({},n,r.empty))),t(r)}};return Object(l.createElement)("div",{className:"wc-block-card-elements"},Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-number-element"},Object(l.createElement)(P.CardNumberElement,{onChange:x(v,"cardNumber"),options:s,className:"wc-block-gateway-input",id:"wc-stripe-card-number-element",onFocus:function(){return d(i.cardNumber)},onBlur:function(){return d(i.cardNumber)}}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-number-element"},Object(p.__)("Card Number","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:m})),Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-expiry-element"},Object(l.createElement)(P.CardExpiryElement,{onChange:x(_,"cardExpiry"),options:b,className:"wc-block-gateway-input",onFocus:function(){return g(i.cardExpiry)},onBlur:function(){return g(i.cardExpiry)},id:"wc-stripe-card-expiry-element"}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-expiry-element"},Object(p.__)("Expiry Date","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:h})),Object(l.createElement)("div",{className:"wc-block-gateway-container wc-card-cvc-element"},Object(l.createElement)(P.CardCvcElement,{onChange:x(C,"cardCvc"),options:O,className:"wc-block-gateway-input",onFocus:function(){return E(i.cardCvc)},onBlur:function(){return E(i.cardCvc)},id:"wc-stripe-card-code-element"}),Object(l.createElement)("label",{htmlFor:"wc-stripe-card-code-element"},Object(p.__)("CVV/CVC","woocommerce-gateway-stripe")),Object(l.createElement)(n,{errorMessage:j})))},ee=function(){var e,t;return Object.entries(null!==(e=null===(t=y())||void 0===t?void 0:t.icons)&&void 0!==e?e:{}).map((function(e){var t=a()(e,2),n=t[0],r=t[1];return{id:n,src:r.src,alt:r.alt}}))},te=function(e){var t,n=e.billing,r=e.eventRegistration,o=e.emitResponse,i=e.components,c=i.ValidationInputError,u=i.PaymentMethodIcons,s=Object(l.useState)(""),p=a()(s,2),d=p[0],f=p[1],m=Object(P.useStripe)(),b=function(e,t,n,r,o,i){var c=Object(l.useState)(""),u=a()(c,2),s=u[0],p=u[1],d=Object(l.useCallback)((function(e){var t,n=e.error.type,r=e.error.code||"",o=null!==(t=_(n,r))&&void 0!==t?t:e.error.message;return p(o),o}),[]),f=e.onCheckoutAfterProcessingWithSuccess,m=e.onPaymentProcessing,b=e.onCheckoutAfterProcessingWithError;return N(i,f,r,o),function(e,t,n,r,o,i,c,a){var u=Object(P.useElements)();Object(l.useEffect)((function(){var s=function(){var e=k()(A.a.mark((function e(t){var r,o;return A.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return o="yes"===(null===(r=y())||void 0===r?void 0:r.inline_cc_form)?P.CardElement:P.CardNumberElement,e.next=3,n.createSource(null==u?void 0:u.getElement(o),{type:"card",owner:t});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}}),e)})));return function(_x){return e.apply(this,arguments)}}(),l=a(function(){var n=k()(A.a.mark((function n(){var a,u,l,p,d;return A.a.wrap((function(n){for(;;)switch(n.prev=n.next){case 0:if(n.prev=0,l=r.billingData,!t){n.next=4;break}return n.abrupt("return",{type:o.responseTypes.ERROR,message:t});case 4:if(""===i){n.next=6;break}return n.abrupt("return",{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{paymentMethod:"stripe",paymentRequestType:"cc",stripe_source:i},billingData:l}});case 6:return p={address:{line1:l.address_1,line2:l.address_2,city:l.city,state:l.state,postal_code:l.postcode,country:l.country}},l.phone&&(p.phone=l.phone),l.email&&(p.email=l.email),(l.first_name||l.last_name)&&(p.name="".concat(l.first_name," ").concat(l.last_name)),n.next=12,s(p);case 12:if(!(d=n.sent).error){n.next=15;break}return n.abrupt("return",{type:o.responseTypes.ERROR,message:e(d)});case 15:if(d.source&&d.source.id){n.next=17;break}throw new Error(_(v.API_ERROR));case 17:return c(d.source.id),n.abrupt("return",{type:o.responseTypes.SUCCESS,meta:{paymentMethodData:{stripe_source:d.source.id,billing_email:p.email,billing_first_name:null!==(a=null==l?void 0:l.first_name)&&void 0!==a?a:"",billing_last_name:null!==(u=null==l?void 0:l.last_name)&&void 0!==u?u:"",paymentMethod:"stripe",paymentRequestType:"cc"},billingData:l}});case 21:return n.prev=21,n.t0=n.catch(0),n.abrupt("return",{type:o.responseTypes.ERROR,message:n.t0});case 24:case"end":return n.stop()}}),n,null,[[0,21]])})));return function(){return n.apply(this,arguments)}}());return function(){l()}}),[a,r.billingData,n,i,c,e,t,o.noticeContexts.PAYMENTS,o.responseTypes.ERROR,o.responseTypes.SUCCESS,u])}(d,s,i,t,o,n,r,m),Object(l.useEffect)((function(){var e=b((function(e){var t,n=e.processingResponse;return null==n||null===(t=n.paymentDetails)||void 0===t||!t.errorMessage||{type:o.responseTypes.ERROR,message:n.paymentDetails.errorMessage,messageContext:o.noticeContexts.PAYMENTS}}));return function(){e()}}),[b,o.noticeContexts.PAYMENTS,o.responseTypes.ERROR]),d}(r,n,d,f,o,m),g=function(e){e.error&&b(e),f("")},h=ee(),w="yes"===(null===(t=y())||void 0===t?void 0:t.inline_cc_form)?Object(l.createElement)(K,{onChange:g,inputErrorComponent:c}):Object(l.createElement)(X,{onChange:g,inputErrorComponent:c});return Object(l.createElement)(l.Fragment,null,w,u&&h.length&&Object(l.createElement)(u,{icons:h,align:"left"}))},ne=function(e){var t=e.stripe;return Object(l.createElement)(P.Elements,{stripe:t},Object(l.createElement)(te,e))},re=R(),oe=function(e){var t=e.RenderedComponent,n=s()(e,["RenderedComponent"]),r=Object(l.useState)(""),o=a()(r,2),c=o[0],u=o[1];return Object(l.useEffect)((function(){Promise.resolve(re).then((function(e){var t=e.error;t&&u(t.message)}))}),[u]),Object(l.useEffect)((function(){if(c)throw new Error(c)}),[c]),Object(l.createElement)(t,i()({stripe:re},n))},ie=ee(),ce={name:"stripe",label:Object(l.createElement)((function(e){var t,n,r=e.components.PaymentMethodLabel,o=null!==(t=null===(n=y())||void 0===n?void 0:n.title)&&void 0!==t?t:Object(p.__)("Credit / Debit Card","woocommerce-gateway-stripe");return Object(l.createElement)(r,{text:o})}),null),content:Object(l.createElement)(oe,{RenderedComponent:ne}),edit:Object(l.createElement)(oe,{RenderedComponent:ne}),savedTokenComponent:Object(l.createElement)(oe,{RenderedComponent:function(e){var t=e.stripe,n=s()(e,["stripe"]);return Object(l.createElement)(P.Elements,{stripe:t},Object(l.createElement)(D,n))}}),icons:ie,canMakePayment:function(){return re},ariaLabel:Object(p.__)("Stripe Credit Card payment method","woocommerce-gateway-stripe"),supports:{showSavedCards:null!==(z=null===(Z=y())||void 0===Z?void 0:Z.showSavedCards)&&void 0!==z&&z,showSaveOption:null!==($=null===(Q=y())||void 0===Q?void 0:Q.showSaveOption)&&void 0!==$&&$,features:null!==(G=null===(J=y())||void 0===J?void 0:J.supports)&&void 0!==G?G:[]}},ae=function(e){var t,n,r=e.onButtonClicked,o=null===(t=y())||void 0===t?void 0:t.button,i=o.theme,c=void 0===i?"dark":i,u=o.locale,s=void 0===u?"en":u,p=o.height,d=void 0===p?"44":p,f=(null===(n=y())||void 0===n?void 0:n.button).branded_type,m=["short","long"].includes(f)?f:"long",v=function(e,t,n){var r="long"===e?"https://www.gstatic.com/instantbuy/svg/".concat(t,"/").concat(n,".svg"):"https://www.gstatic.com/instantbuy/svg/".concat(t,"_gpay.svg"),o=Object(l.useState)(r),i=a()(o,2),c=i[0],u=i[1];return Object(l.useEffect)((function(){var e=document.createElement("img");e.addEventListener("error",(function(){u("https://www.gstatic.com/instantbuy/svg/".concat(t,"/en.svg"))})),e.src=c}),[c,t]),c}(m,"dark"===c?"dark":"light",s);return Object(l.createElement)("button",{type:"button",id:"wc-stripe-branded-button","aria-label":"Google Pay",className:"gpay-button ".concat(c," ").concat(m),style:{backgroundImage:"url(".concat(v,")"),height:d+"px"},onClick:r})},ue=function(e){var t,n=e.onButtonClicked,r=null===(t=y())||void 0===t?void 0:t.button,o=r.theme,i=void 0===o?"dark":o,c=r.height,a=void 0===c?"44":c,u=r.customLabel,s=void 0===u?Object(p.__)("Buy now","woocommerce-gateway-stripe"):u;return Object(l.createElement)("button",{type:"button",id:"wc-stripe-custom-button",className:"button ".concat(i," is-active"),style:{height:a+"px"},onClick:n},s)},se=n(6),le=n.n(se);function pe(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);t&&(r=r.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,r)}return n}var de,fe,me=function(e){var t,n,r;return null===(t=y())||void 0===t||null===(n=t.ajax_url)||void 0===n||null===(r=n.toString())||void 0===r?void 0:r.replace("%%endpoint%%","wc_stripe_"+e)},ve=function(e){var t,n,r,o,i;(t=e.shippingOption,i={security:null===(n=y())||void 0===n||null===(r=n.nonce)||void 0===r?void 0:r.update_shipping,shipping_method:[t.id],is_product_page:null===(o=y())||void 0===o?void 0:o.is_product_page},le.a.ajax({type:"POST",data:i,url:me("update_shipping_method")})).then((function(t){"success"===t.result&&e.updateWith({status:"success",total:t.total,displayItems:t.displayItems}),"fail"===t.result&&e.updateWith({status:"fail"})}))},ye=function(e,t){Object(l.useEffect)((function(){var n=null==e?void 0:e.on("shippingaddresschange",function(e){return function(t){(function(e,t){var n,r,o,i=function(e){for(var t=1;t<arguments.length;t++){var n=null!=arguments[t]?arguments[t]:{};t%2?pe(Object(n),!0).forEach((function(t){f()(e,t,n[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):pe(Object(n)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))}))}return e}({security:null===(n=y())||void 0===n||null===(r=n.nonce)||void 0===r?void 0:r.shipping,payment_request_type:t,is_product_page:null===(o=y())||void 0===o?void 0:o.is_product_page},function(e){return{country:e.country,state:e.region,postcode:e.postalCode,city:e.city,address:void 0===e.addressLine[0]?"":e.addressLine[0],address_2:void 0===e.addressLine[1]?"":e.addressLine[1]}}(e));return le.a.ajax({type:"POST",data:i,url:me("get_shipping_options")})})(t.shippingAddress,e).then((function(e){t.updateWith({status:e.result,shippingOptions:e.shipping_options,total:e.total,displayItems:e.displayItems})}))}}(t));return function(){null==n||n.removeAllListeners()}}),[e,t])},be=function(e,t,n,r){Object(l.useEffect)((function(){var o=null==t?void 0:t.on("source",function(e,t,n){return function(r){var o,i,c,a,u,s;"yes"===(null===(o=y())||void 0===o||null===(i=o.stripe)||void 0===i?void 0:i.allow_prepaid_card)||"prepaid"!==(null==r||null===(c=r.source)||void 0===c||null===(a=c.card)||void 0===a?void 0:a.funding)?function(e,t){var n=function(e,t){var n,r,o,i,c,a,u,s,l,p,d,f,m,v,b,g,h,_,w,O,E,j,C,x,S,R,P,T,k,I,A=e.source,M=null==A||null===(n=A.owner)||void 0===n?void 0:n.email,N=null==A||null===(r=A.owner)||void 0===r?void 0:r.phone,L=null==A||null===(o=A.owner)||void 0===o?void 0:o.address,D=null==A||null===(i=A.owner)||void 0===i?void 0:i.name,q=null==e?void 0:e.shippingAddress,B={_wpnonce:null===(c=y())||void 0===c||null===(a=c.nonce)||void 0===a?void 0:a.checkout,billing_first_name:null!==(u=null==D||null===(s=D.split(" "))||void 0===s||null===(l=s.slice(0,1))||void 0===l?void 0:l.join(" "))&&void 0!==u?u:"",billing_last_name:null!==(p=null==D||null===(d=D.split(" "))||void 0===d||null===(f=d.slice(1))||void 0===f?void 0:f.join(" "))&&void 0!==p?p:"",billing_company:"",billing_email:null!=M?M:null==e?void 0:e.payerEmail,billing_phone:null!=N?N:null==e||null===(m=e.payerPhone)||void 0===m?void 0:m.replace("/[() -]/g",""),billing_country:null!==(v=null==L?void 0:L.country)&&void 0!==v?v:"",billing_address_1:null!==(b=null==L?void 0:L.line1)&&void 0!==b?b:"",billing_address_2:null!==(g=null==L?void 0:L.line2)&&void 0!==g?g:"",billing_city:null!==(h=null==L?void 0:L.city)&&void 0!==h?h:"",billing_state:null!==(_=null==L?void 0:L.state)&&void 0!==_?_:"",billing_postcode:null!==(w=null==L?void 0:L.postal_code)&&void 0!==w?w:"",shipping_first_name:"",shipping_last_name:"",shipping_company:"",shipping_country:"",shipping_address_1:"",shipping_address_2:"",shipping_city:"",shipping_state:"",shipping_postcode:"",shipping_method:[null==e||null===(O=e.shippingOption)||void 0===O?void 0:O.id],order_comments:"",payment_method:"stripe",ship_to_different_address:1,terms:1,stripe_source:A.id,payment_request_type:t};return q&&(B.shipping_first_name=null==q||null===(E=q.recipient)||void 0===E||null===(j=E.split(" "))||void 0===j||null===(C=j.slice(0,1))||void 0===C?void 0:C.join(" "),B.shipping_last_name=null==q||null===(x=q.recipient)||void 0===x||null===(S=x.split(" "))||void 0===S||null===(R=S.slice(1))||void 0===R?void 0:R.join(" "),B.shipping_company=null==q?void 0:q.organization,B.shipping_country=null==q?void 0:q.country,B.shipping_address_1=null!==(P=null==q||null===(T=q.addressLine)||void 0===T?void 0:T[0])&&void 0!==P?P:"",B.shipping_address_2=null!==(k=null==q||null===(I=q.addressLine)||void 0===I?void 0:I[1])&&void 0!==k?k:"",B.shipping_city=null==q?void 0:q.city,B.shipping_state=null==q?void 0:q.region,B.shipping_postcode=null==q?void 0:q.postalCode),B}(e,t);return le.a.ajax({type:"POST",data:n,dataType:"json",url:me("create_order")})}(r,t).then(function(e,t,n){return function(r){if("success"===r.result){t.complete("success");var o=function(e){var t=e.match(/^#?confirm-(pi|si)-([^:]+):(.+)$/);if(t&&!(t.length<4))return{type:t[1],clientSecret:t[2],redirectUrl:decodeURIComponent(t[3])}}(r.redirect);if(!o||o.length<4)return void(window.location=r.redirect);var i=o.type,c=o.clientSecret,a=o.redirectUrl;(function(e,t,n){return"si"===t?e.handleCardSetup(n):e.handleCardPayment(n)})(e,i,c).then(function(e,t){return function(n){if(n.error)throw n.error;var r=function(e,t){return"si"===t?e.setupIntent:e.paymentIntent}(n,t);(function(e){return"requires_capture"===e.status}(r)||function(e){return"succeeded"===e.status}(r))&&(window.location=e)}}(a,i)).catch((function(e){n(e.message),le.a.get(a+"&is_ajax")}))}else{var u,s;t.complete("fail");var l=document.createElement("div");l.innerHTML=r.messages;var p=null!==(u=null==l||null===(s=l.firstChild)||void 0===s?void 0:s.textContent)&&void 0!==u?u:"";n(p)}}}(e,r,n)):n(null===(u=y())||void 0===u||null===(s=u.i18n)||void 0===s?void 0:s.no_prepaid_card)}}(e,n,r));return function(){null==o||o.removeAllListeners()}}),[e,t,n,r])},ge=function(e){var t,n,r,o,i,c,u,s=e.billing,p=e.shippingData,d=e.onClick,f=e.onClose,m=e.setExpressPaymentError,v=Object(P.useStripe)(),g=function(e,t,n){var r=Object(l.useState)(null),o=a()(r,2),i=o[0],c=o[1],u=Object(l.useState)(null),s=a()(u,2),p=s[0],d=s[1];return Object(l.useEffect)((function(){var t,n,r;e&&!i&&(r={security:null===(t=y())||void 0===t||null===(n=t.nonce)||void 0===n?void 0:n.payment},le.a.ajax({type:"POST",data:r,url:me("get_cart_details")})).then((function(t){var n=b(e,t);n.canMakePayment().then((function(e){e&&(c(n),e.applePay?d("apple_pay"):e.googlePay?d("google_pay"):d("payment_request_api"))}))}))}),[i,e]),Object(l.useEffect)((function(){c(null)}),[t,n.cartTotal,n.cartTotalItems,n.currency.code]),[i,p]}(v,p.needsShipping,s),h=a()(g,2),_=h[0],w=h[1];ye(_,w),function(e,t){Object(l.useEffect)((function(){var t=null==e?void 0:e.on("shippingoptionchange",ve);return function(){null==t||t.removeAllListeners()}}),[e,t])}(_,w),be(v,_,w,m);var O=function(e,t){return Object(l.useCallback)((function(){e(""),t()}),[e,t])}(m,d);!function(e,t){Object(l.useEffect)((function(){null==e||e.on("cancel",(function(){t()}))}),[e,t])}(_,f);var E=null===(t=y())||void 0===t?void 0:t.button,j=E.type,C=void 0===j?"default":j,x=E.theme,S=void 0===x?"dark":x,R=E.height,T={paymentRequestButton:{type:C,theme:S,height:"".concat(void 0===R?"48":R,"px")}},k=null===(n=y())||void 0===n||null===(r=n.button)||void 0===r?void 0:r.is_branded,I=null===(o=y())||void 0===o||null===(i=o.button)||void 0===i?void 0:i.branded_type,A=null===(c=y())||void 0===c||null===(u=c.button)||void 0===u?void 0:u.is_custom;if(!_)return null;var M,N,L,D=function(){O(),_.show()};return A?Object(l.createElement)(ue,{onButtonClicked:D}):k&&(M=window.navigator.userAgent.toLowerCase(),L=(N=/chrome/.test(M)&&!/edge|edg|opr|brave\//.test(M)&&"Google Inc."===window.navigator.vendor)&&window.navigator.brave,N&&!L)?Object(l.createElement)(ae,{onButtonClicked:D}):(k&&(T.paymentRequestButton.type="long"===I?"buy":"default"),Object(l.createElement)(P.PaymentRequestButtonElement,{onClick:O,options:{style:T,paymentRequest:_}}))},he=R(),_e={name:"payment_request",content:Object(l.createElement)((function(e){var t=e.stripe;return Object(l.createElement)(P.Elements,{stripe:t},Object(l.createElement)(ge,e))}),{stripe:he}),edit:Object(l.createElement)((function(){return Object(l.createElement)("img",{src:"data:image/svg+xml,%3Csvg width='264' height='48' viewBox='0 0 264 48' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect width='264' height='48' rx='3' fill='black'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M125.114 16.6407C125.682 15.93 126.067 14.9756 125.966 14C125.135 14.0415 124.121 14.549 123.533 15.2602C123.006 15.8693 122.539 16.8641 122.661 17.7983C123.594 17.8797 124.526 17.3317 125.114 16.6407Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M125.955 17.982C124.601 17.9011 123.448 18.7518 122.801 18.7518C122.154 18.7518 121.163 18.0224 120.092 18.0421C118.696 18.0629 117.402 18.8524 116.694 20.1079C115.238 22.6196 116.31 26.3453 117.726 28.3909C118.414 29.4028 119.242 30.5174 120.334 30.4769C121.366 30.4365 121.77 29.8087 123.024 29.8087C124.277 29.8087 124.641 30.4769 125.733 30.4567C126.865 30.4365 127.573 29.4443 128.261 28.4313C129.049 27.2779 129.373 26.1639 129.393 26.1027C129.373 26.0825 127.209 25.2515 127.189 22.7606C127.169 20.6751 128.888 19.6834 128.969 19.6217C127.998 18.1847 126.481 18.0224 125.955 17.982Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M136.131 23.1804H138.834C140.886 23.1804 142.053 22.0752 142.053 20.1592C142.053 18.2432 140.886 17.1478 138.845 17.1478H136.131V23.1804ZM139.466 15.1582C142.411 15.1582 144.461 17.1903 144.461 20.1483C144.461 23.1172 142.369 25.1596 139.392 25.1596H136.131V30.3498H133.775V15.1582H139.466Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152.198 26.224V25.3712L149.579 25.5397C148.106 25.6341 147.339 26.182 147.339 27.14C147.339 28.0664 148.138 28.6667 149.39 28.6667C150.988 28.6667 152.198 27.6449 152.198 26.224ZM145.046 27.2032C145.046 25.2551 146.529 24.1395 149.263 23.971L152.198 23.7922V22.9498C152.198 21.7181 151.388 21.0442 149.947 21.0442C148.758 21.0442 147.896 21.6548 147.717 22.5916H145.592C145.656 20.6232 147.507 19.1914 150.01 19.1914C152.703 19.1914 154.459 20.602 154.459 22.7917V30.351H152.282V28.5298H152.229C151.609 29.719 150.241 30.4666 148.758 30.4666C146.571 30.4666 145.046 29.1612 145.046 27.2032Z' fill='white'/%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M156.461 34.4145V32.5934C156.608 32.6141 156.965 32.6354 157.155 32.6354C158.196 32.6354 158.785 32.1932 159.142 31.0564L159.353 30.3824L155.366 19.3281H157.827L160.604 28.298H160.657L163.434 19.3281H165.832L161.698 30.9402C160.752 33.6038 159.668 34.4778 157.376 34.4778C157.197 34.4778 156.618 34.4565 156.461 34.4145Z' fill='white'/%3E%3C/svg%3E%0A",alt:""})}),null),canMakePayment:function(e){var t,n;return!(null===(t=null===(n=y())||void 0===n?void 0:n.isAdmin)||void 0===t||!t)||R().then((function(t){var n,r,o,i,c,a={order_data:{total:{label:"Total",amount:parseInt(null!==(n=null==e||null===(r=e.cartTotals)||void 0===r?void 0:r.total_price)&&void 0!==n?n:0,10),pending:!0},currency:null==e||null===(o=e.cartTotals)||void 0===o||null===(i=o.currency_code)||void 0===i?void 0:i.toLowerCase(),country_code:null===(c=Object(m.getSetting)("baseLocation",{}))||void 0===c?void 0:c.country,displayItems:[]},shipping_required:!1};return b(t,a).canMakePayment()}))},paymentMethodId:"stripe",supports:{features:null!==(de=null===(fe=y())||void 0===fe?void 0:fe.supports)&&void 0!==de?de:[]}};Object(r.registerPaymentMethod)(ce),Object(r.registerExpressPaymentMethod)(_e)}]);
changelog.txt CHANGED
@@ -1,5 +1,9 @@
1
  *** Changelog ***
2
 
 
 
 
 
3
  = 5.2.0 - 2021-05-19 =
4
  * Fix - Use `get_parent` method to avoid accessing `order` subscription property directly.
5
  * Fix - Orders won't transition to 'Refunded' state if refund can't be created.
1
  *** Changelog ***
2
 
3
+ = 5.2.1 - 2021-06-10 =
4
+ * Fix - Remove calls to `has_block()` since it breaks compatibility with older versions of WordPress.
5
+ * Tweak - Use the same JavaScript configurations for the Block-based and Shortcode-based checkout flows.
6
+
7
  = 5.2.0 - 2021-05-19 =
8
  * Fix - Use `get_parent` method to avoid accessing `order` subscription property directly.
9
  * Fix - Orders won't transition to 'Refunded' state if refund can't be created.
includes/class-wc-gateway-stripe.php CHANGED
@@ -361,54 +361,12 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
361
  }
362
 
363
  /**
364
- * Payment_scripts function.
365
- *
366
- * Outputs scripts used for stripe payment
367
  *
368
- * @since 3.1.0
369
- * @version 4.0.0
370
  */
371
- public function payment_scripts() {
372
  global $wp;
373
- if (
374
- ! is_product()
375
- && ! is_cart()
376
- && ! is_checkout()
377
- && ! isset( $_GET['pay_for_order'] ) // wpcs: csrf ok.
378
- && ! is_add_payment_method_page()
379
- && ! isset( $_GET['change_payment_method'] ) // wpcs: csrf ok.
380
- && ! ( ! empty( get_query_var( 'view-subscription' ) ) && is_callable( 'WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled' ) && WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled() )
381
- || ( is_order_received_page() )
382
- ) {
383
- return;
384
- }
385
-
386
- // If Stripe is not enabled bail.
387
- if ( 'no' === $this->enabled ) {
388
- return;
389
- }
390
-
391
- // If keys are not set bail.
392
- if ( ! $this->are_keys_set() ) {
393
- WC_Stripe_Logger::log( 'Keys are not set correctly.' );
394
- return;
395
- }
396
-
397
- // If no SSL bail.
398
- if ( ! $this->testmode && ! is_ssl() ) {
399
- WC_Stripe_Logger::log( 'Stripe live mode requires SSL.' );
400
- return;
401
- }
402
-
403
- $current_theme = wp_get_theme();
404
-
405
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
406
-
407
- wp_register_style( 'stripe_styles', plugins_url( 'assets/css/stripe-styles.css', WC_STRIPE_MAIN_FILE ), [], WC_STRIPE_VERSION );
408
- wp_enqueue_style( 'stripe_styles' );
409
-
410
- wp_register_script( 'stripe', 'https://js.stripe.com/v3/', '', '3.0', true );
411
- wp_register_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), [ 'jquery-payment', 'stripe' ], WC_STRIPE_VERSION, true );
412
 
413
  $stripe_params = [
414
  'key' => $this->publishable_key,
@@ -468,7 +426,60 @@ class WC_Gateway_Stripe extends WC_Stripe_Payment_Gateway {
468
  // Merge localized messages to be use in JS.
469
  $stripe_params = array_merge( $stripe_params, WC_Stripe_Helper::get_localized_messages() );
470
 
471
- wp_localize_script( 'woocommerce_stripe', 'wc_stripe_params', apply_filters( 'wc_stripe_params', $stripe_params ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
472
 
473
  $this->tokenization_script();
474
  wp_enqueue_script( 'woocommerce_stripe' );
361
  }
362
 
363
  /**
364
+ * Returns the JavaScript configuration object used on the product, cart, and checkout pages.
 
 
365
  *
366
+ * @return array The configuration object to be loaded to JS.
 
367
  */
368
+ public function javascript_params() {
369
  global $wp;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
370
 
371
  $stripe_params = [
372
  'key' => $this->publishable_key,
426
  // Merge localized messages to be use in JS.
427
  $stripe_params = array_merge( $stripe_params, WC_Stripe_Helper::get_localized_messages() );
428
 
429
+ return $stripe_params;
430
+ }
431
+
432
+ /**
433
+ * Payment_scripts function.
434
+ *
435
+ * Outputs scripts used for stripe payment
436
+ *
437
+ * @since 3.1.0
438
+ * @version 4.0.0
439
+ */
440
+ public function payment_scripts() {
441
+ if (
442
+ ! is_product()
443
+ && ! WC_Stripe_Helper::has_cart_or_checkout_shortcode_on_current_page()
444
+ && ! isset( $_GET['pay_for_order'] ) // wpcs: csrf ok.
445
+ && ! is_add_payment_method_page()
446
+ && ! isset( $_GET['change_payment_method'] ) // wpcs: csrf ok.
447
+ && ! ( ! empty( get_query_var( 'view-subscription' ) ) && is_callable( 'WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled' ) && WCS_Early_Renewal_Manager::is_early_renewal_via_modal_enabled() )
448
+ || ( is_order_received_page() )
449
+ ) {
450
+ return;
451
+ }
452
+
453
+ // If Stripe is not enabled bail.
454
+ if ( 'no' === $this->enabled ) {
455
+ return;
456
+ }
457
+
458
+ // If keys are not set bail.
459
+ if ( ! $this->are_keys_set() ) {
460
+ WC_Stripe_Logger::log( 'Keys are not set correctly.' );
461
+ return;
462
+ }
463
+
464
+ // If no SSL bail.
465
+ if ( ! $this->testmode && ! is_ssl() ) {
466
+ WC_Stripe_Logger::log( 'Stripe live mode requires SSL.' );
467
+ return;
468
+ }
469
+
470
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
471
+
472
+ wp_register_style( 'stripe_styles', plugins_url( 'assets/css/stripe-styles.css', WC_STRIPE_MAIN_FILE ), [], WC_STRIPE_VERSION );
473
+ wp_enqueue_style( 'stripe_styles' );
474
+
475
+ wp_register_script( 'stripe', 'https://js.stripe.com/v3/', '', '3.0', true );
476
+ wp_register_script( 'woocommerce_stripe', plugins_url( 'assets/js/stripe' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), [ 'jquery-payment', 'stripe' ], WC_STRIPE_VERSION, true );
477
+
478
+ wp_localize_script(
479
+ 'woocommerce_stripe',
480
+ 'wc_stripe_params',
481
+ apply_filters( 'wc_stripe_params', $this->javascript_params() )
482
+ );
483
 
484
  $this->tokenization_script();
485
  wp_enqueue_script( 'woocommerce_stripe' );
includes/class-wc-stripe-blocks-support.php CHANGED
@@ -18,12 +18,24 @@ final class WC_Stripe_Blocks_Support extends AbstractPaymentMethodType {
18
  */
19
  protected $name = 'stripe';
20
 
 
 
 
 
 
 
 
 
21
  /**
22
  * Constructor
 
 
 
23
  */
24
- public function __construct() {
25
  add_action( 'woocommerce_rest_checkout_process_payment_with_context', [ $this, 'add_payment_request_order_meta' ], 8, 2 );
26
  add_action( 'woocommerce_rest_checkout_process_payment_with_context', [ $this, 'add_stripe_intents' ], 9999, 2 );
 
27
  }
28
 
29
  /**
@@ -81,26 +93,55 @@ final class WC_Stripe_Blocks_Support extends AbstractPaymentMethodType {
81
  * @return array
82
  */
83
  public function get_payment_method_data() {
84
- return [
85
- 'stripeTotalLabel' => $this->get_total_label(),
86
- 'publicKey' => $this->get_publishable_key(),
87
- 'allowPrepaidCard' => $this->get_allow_prepaid_card(),
88
- 'title' => $this->get_title(),
89
- 'button' => [
90
- 'type' => $this->get_button_type(),
91
- 'theme' => $this->get_button_theme(),
92
- 'height' => $this->get_button_height(),
93
- 'locale' => $this->get_button_locale(),
94
- 'customLabel' => isset( $this->settings['payment_request_button_label'] ) ? $this->settings['payment_request_button_label'] : 'Buy now',
95
- ],
96
- 'inline_cc_form' => $this->get_inline_cc_form(),
97
- 'icons' => $this->get_icons(),
98
- 'showSavedCards' => $this->get_show_saved_cards(),
99
- 'showSaveOption' => $this->get_show_save_option(),
100
- 'supports' => $this->get_supported_features(),
101
- 'stripeLocale' => WC_Stripe_Helper::convert_wc_locale_to_stripe_locale( get_locale() ),
102
- 'isAdmin' => is_admin(),
103
- ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
104
  }
105
 
106
  /**
@@ -126,35 +167,6 @@ final class WC_Stripe_Blocks_Support extends AbstractPaymentMethodType {
126
  return apply_filters( 'wc_stripe_display_save_payment_method_checkbox', filter_var( $saved_cards, FILTER_VALIDATE_BOOLEAN ) );
127
  }
128
 
129
- /**
130
- * Returns the label to use accompanying the total in the stripe statement.
131
- *
132
- * @return string Statement descriptor.
133
- */
134
- private function get_total_label() {
135
- return ! empty( $this->settings['statement_descriptor'] ) ? WC_Stripe_Helper::clean_statement_descriptor( $this->settings['statement_descriptor'] ) : '';
136
- }
137
-
138
- /**
139
- * Returns the publishable api key for the Stripe service.
140
- *
141
- * @return string Public api key.
142
- */
143
- private function get_publishable_key() {
144
- $test_mode = ( ! empty( $this->settings['testmode'] ) && 'yes' === $this->settings['testmode'] );
145
- $setting_key = $test_mode ? 'test_publishable_key' : 'publishable_key';
146
- return ! empty( $this->settings[ $setting_key ] ) ? $this->settings[ $setting_key ] : '';
147
- }
148
-
149
- /**
150
- * Returns whether to allow prepaid cards for payments.
151
- *
152
- * @return bool True means to allow prepaid card (default).
153
- */
154
- private function get_allow_prepaid_card() {
155
- return apply_filters( 'wc_stripe_allow_prepaid_card', true );
156
- }
157
-
158
  /**
159
  * Returns the title string to use in the UI (customisable via admin settings screen).
160
  *
@@ -164,51 +176,6 @@ final class WC_Stripe_Blocks_Support extends AbstractPaymentMethodType {
164
  return isset( $this->settings['title'] ) ? $this->settings['title'] : __( 'Credit / Debit Card', 'woocommerce-gateway-stripe' );
165
  }
166
 
167
- /**
168
- * Return the button type for the payment button.
169
- *
170
- * @return string Defaults to 'default'.
171
- */
172
- private function get_button_type() {
173
- return isset( $this->settings['payment_request_button_type'] ) ? $this->settings['payment_request_button_type'] : 'default';
174
- }
175
-
176
- /**
177
- * Return the theme to use for the payment button.
178
- *
179
- * @return string Defaults to 'dark'.
180
- */
181
- private function get_button_theme() {
182
- return isset( $this->settings['payment_request_button_theme'] ) ? $this->settings['payment_request_button_theme'] : 'dark';
183
- }
184
-
185
- /**
186
- * Return the height for the payment button.
187
- *
188
- * @return string A pixel value for the height (defaults to '64').
189
- */
190
- private function get_button_height() {
191
- return isset( $this->settings['payment_request_button_height'] ) ? str_replace( 'px', '', $this->settings['payment_request_button_height'] ) : '64';
192
- }
193
-
194
- /**
195
- * Return the inline cc option.
196
- *
197
- * @return boolean True if the inline CC form option is enabled.
198
- */
199
- private function get_inline_cc_form() {
200
- return isset( $this->settings['inline_cc_form'] ) && 'yes' === $this->settings['inline_cc_form'];
201
- }
202
-
203
- /**
204
- * Return the locale for the payment button.
205
- *
206
- * @return string Defaults to en_US.
207
- */
208
- private function get_button_locale() {
209
- return apply_filters( 'wc_stripe_payment_request_button_locale', substr( get_locale(), 0, 2 ) );
210
- }
211
-
212
  /**
213
  * Return the icons urls.
214
  *
@@ -331,7 +298,11 @@ final class WC_Stripe_Blocks_Support extends AbstractPaymentMethodType {
331
  * @return string[]
332
  */
333
  public function get_supported_features() {
334
- $gateway = new WC_Gateway_Stripe();
335
- return array_filter( $gateway->supports, [ $gateway, 'supports' ] );
 
 
 
 
336
  }
337
  }
18
  */
19
  protected $name = 'stripe';
20
 
21
+ /**
22
+ * The Payment Request configuration class used for Shortcode PRBs. We use it here to retrieve
23
+ * the same configurations.
24
+ *
25
+ * @var WC_Stripe_Payment_Request
26
+ */
27
+ private $payment_request_configuration;
28
+
29
  /**
30
  * Constructor
31
+ *
32
+ * @param WC_Stripe_Payment_Request The Stripe Payment Request configuration used for Payment
33
+ * Request buttons.
34
  */
35
+ public function __construct( $payment_request_configuration = null ) {
36
  add_action( 'woocommerce_rest_checkout_process_payment_with_context', [ $this, 'add_payment_request_order_meta' ], 8, 2 );
37
  add_action( 'woocommerce_rest_checkout_process_payment_with_context', [ $this, 'add_stripe_intents' ], 9999, 2 );
38
+ $this->payment_request_configuration = null !== $payment_request_configuration ? $payment_request_configuration : new WC_Stripe_Payment_Request();
39
  }
40
 
41
  /**
93
  * @return array
94
  */
95
  public function get_payment_method_data() {
96
+ // We need to call array_merge_recursive so the blocks 'button' setting doesn't overwrite
97
+ // what's provided from the gateway or payment request configuration.
98
+ return array_merge_recursive(
99
+ $this->get_gateway_javascript_params(),
100
+ $this->get_payment_request_javascript_params(),
101
+ // Blocks-specific options
102
+ [
103
+ 'title' => $this->get_title(),
104
+ 'icons' => $this->get_icons(),
105
+ 'supports' => $this->get_supported_features(),
106
+ 'showSavedCards' => $this->get_show_saved_cards(),
107
+ 'showSaveOption' => $this->get_show_save_option(),
108
+ 'isAdmin' => is_admin(),
109
+ 'button' => [
110
+ 'customLabel' => $this->payment_request_configuration->get_button_label(),
111
+ ],
112
+ ]
113
+ );
114
+ }
115
+
116
+ /**
117
+ * Returns the Stripe Payment Gateway JavaScript configuration object.
118
+ *
119
+ * @return array the JS configuration from the Stripe Payment Gateway.
120
+ */
121
+ private function get_gateway_javascript_params() {
122
+ $js_configuration = [];
123
+
124
+ $gateways = WC()->payment_gateways->get_available_payment_gateways();
125
+ if ( isset( $gateways['stripe'] ) ) {
126
+ $js_configuration = $gateways['stripe']->javascript_params();
127
+ }
128
+
129
+ return apply_filters(
130
+ 'wc_stripe_params',
131
+ $js_configuration
132
+ );
133
+ }
134
+
135
+ /**
136
+ * Returns the Stripe Payment Request JavaScript configuration object.
137
+ *
138
+ * @return array the JS configuration for Stripe Payment Requests.
139
+ */
140
+ private function get_payment_request_javascript_params() {
141
+ return apply_filters(
142
+ 'wc_stripe_payment_request_params',
143
+ $this->payment_request_configuration->javascript_params()
144
+ );
145
  }
146
 
147
  /**
167
  return apply_filters( 'wc_stripe_display_save_payment_method_checkbox', filter_var( $saved_cards, FILTER_VALIDATE_BOOLEAN ) );
168
  }
169
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  /**
171
  * Returns the title string to use in the UI (customisable via admin settings screen).
172
  *
176
  return isset( $this->settings['title'] ) ? $this->settings['title'] : __( 'Credit / Debit Card', 'woocommerce-gateway-stripe' );
177
  }
178
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
179
  /**
180
  * Return the icons urls.
181
  *
298
  * @return string[]
299
  */
300
  public function get_supported_features() {
301
+ $gateways = WC()->payment_gateways->get_available_payment_gateways();
302
+ if ( isset( $gateways['stripe'] ) ) {
303
+ $gateway = $gateways['stripe'];
304
+ return array_filter( $gateway->supports, [ $gateway, 'supports' ] );
305
+ }
306
+ return [];
307
  }
308
  }
includes/class-wc-stripe-helper.php CHANGED
@@ -597,4 +597,15 @@ class WC_Stripe_Helper {
597
  // Default to 'auto' so Stripe.js uses the browser locale.
598
  return 'auto';
599
  }
 
 
 
 
 
 
 
 
 
 
 
600
  }
597
  // Default to 'auto' so Stripe.js uses the browser locale.
598
  return 'auto';
599
  }
600
+
601
+ /**
602
+ * Checks if this page contains a cart or checkout shortcode.
603
+ *
604
+ * @since 5.2.1
605
+ * @return boolean
606
+ */
607
+ public static function has_cart_or_checkout_shortcode_on_current_page() {
608
+ return wc_post_content_has_shortcode( 'woocommerce_cart' )
609
+ || wc_post_content_has_shortcode( 'woocommerce_checkout' );
610
+ }
611
  }
includes/payment-methods/class-wc-stripe-payment-request.php CHANGED
@@ -542,16 +542,6 @@ class WC_Stripe_Payment_Request {
542
  return true;
543
  }
544
 
545
- /**
546
- * Checks if this page contains a cart or checkout block.
547
- *
548
- * @since 5.2.0
549
- * @return boolean
550
- */
551
- public function is_block() {
552
- return has_block( 'woocommerce/cart' ) || has_block( 'woocommerce/checkout' );
553
- }
554
-
555
  /**
556
  * Checks if this is a product page or content contains a product_page shortcode.
557
  *
@@ -588,38 +578,12 @@ class WC_Stripe_Payment_Request {
588
  }
589
 
590
  /**
591
- * Load public scripts and styles.
592
  *
593
- * @since 3.1.0
594
- * @version 5.2.0
595
  */
596
- public function scripts() {
597
- // If keys are not set bail.
598
- if ( ! $this->are_keys_set() ) {
599
- WC_Stripe_Logger::log( 'Keys are not set correctly.' );
600
- return;
601
- }
602
-
603
- // If no SSL bail.
604
- if ( ! $this->testmode && ! is_ssl() ) {
605
- WC_Stripe_Logger::log( 'Stripe Payment Request live mode requires SSL.' );
606
- return;
607
- }
608
-
609
- // If page is not supported, bail.
610
- if ( ! $this->is_block() && ! $this->is_product() && ! is_cart() && ! is_checkout() && ! isset( $_GET['pay_for_order'] ) ) {
611
- return;
612
- }
613
-
614
- if ( $this->is_product() && ! $this->should_show_payment_button_on_product_page() ) {
615
- return;
616
- } elseif ( ! $this->should_show_payment_button_on_cart() ) {
617
- return;
618
- }
619
-
620
- $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
621
-
622
- $stripe_params = [
623
  'ajax_url' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
624
  'stripe' => [
625
  'key' => $this->publishable_key,
@@ -661,11 +625,55 @@ class WC_Stripe_Payment_Request {
661
  'is_product_page' => $this->is_product(),
662
  'product' => $this->get_product_data(),
663
  ];
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
664
 
665
  wp_register_script( 'stripe', 'https://js.stripe.com/v3/', '', '3.0', true );
666
  wp_register_script( 'wc_stripe_payment_request', plugins_url( 'assets/js/stripe-payment-request' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), [ 'jquery', 'stripe' ], WC_STRIPE_VERSION, true );
667
 
668
- wp_localize_script( 'wc_stripe_payment_request', 'wc_stripe_payment_request_params', apply_filters( 'wc_stripe_payment_request_params', $stripe_params ) );
 
 
 
 
 
 
 
669
 
670
  wp_enqueue_script( 'wc_stripe_payment_request' );
671
 
@@ -1554,5 +1562,3 @@ class WC_Stripe_Payment_Request {
1554
  ];
1555
  }
1556
  }
1557
-
1558
- new WC_Stripe_Payment_Request();
542
  return true;
543
  }
544
 
 
 
 
 
 
 
 
 
 
 
545
  /**
546
  * Checks if this is a product page or content contains a product_page shortcode.
547
  *
578
  }
579
 
580
  /**
581
+ * Returns the JavaScript configuration object used for any pages with a payment request button.
582
  *
583
+ * @return array The settings used for the payment request button in JavaScript.
 
584
  */
585
+ public function javascript_params() {
586
+ return [
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
587
  'ajax_url' => WC_AJAX::get_endpoint( '%%endpoint%%' ),
588
  'stripe' => [
589
  'key' => $this->publishable_key,
625
  'is_product_page' => $this->is_product(),
626
  'product' => $this->get_product_data(),
627
  ];
628
+ }
629
+
630
+ /**
631
+ * Load public scripts and styles.
632
+ *
633
+ * @since 3.1.0
634
+ * @version 5.2.0
635
+ */
636
+ public function scripts() {
637
+ // If keys are not set bail.
638
+ if ( ! $this->are_keys_set() ) {
639
+ WC_Stripe_Logger::log( 'Keys are not set correctly.' );
640
+ return;
641
+ }
642
+
643
+ // If no SSL bail.
644
+ if ( ! $this->testmode && ! is_ssl() ) {
645
+ WC_Stripe_Logger::log( 'Stripe Payment Request live mode requires SSL.' );
646
+ return;
647
+ }
648
+
649
+ // If page is not supported, bail.
650
+ if (
651
+ ! $this->is_product()
652
+ && ! WC_Stripe_Helper::has_cart_or_checkout_shortcode_on_current_page()
653
+ && ! isset( $_GET['pay_for_order'] )
654
+ ) {
655
+ return;
656
+ }
657
+
658
+ if ( $this->is_product() && ! $this->should_show_payment_button_on_product_page() ) {
659
+ return;
660
+ } elseif ( ! $this->should_show_payment_button_on_cart() ) {
661
+ return;
662
+ }
663
+
664
+ $suffix = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
665
 
666
  wp_register_script( 'stripe', 'https://js.stripe.com/v3/', '', '3.0', true );
667
  wp_register_script( 'wc_stripe_payment_request', plugins_url( 'assets/js/stripe-payment-request' . $suffix . '.js', WC_STRIPE_MAIN_FILE ), [ 'jquery', 'stripe' ], WC_STRIPE_VERSION, true );
668
 
669
+ wp_localize_script(
670
+ 'wc_stripe_payment_request',
671
+ 'wc_stripe_payment_request_params',
672
+ apply_filters(
673
+ 'wc_stripe_payment_request_params',
674
+ $this->javascript_params()
675
+ )
676
+ );
677
 
678
  wp_enqueue_script( 'wc_stripe_payment_request' );
679
 
1562
  ];
1563
  }
1564
  }
 
 
languages/woocommerce-gateway-stripe.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: WooCommerce Stripe Gateway 5.2.0\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
- "POT-Creation-Date: 2021-05-19 17:02:17+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -64,7 +64,7 @@ msgid "Stripe charge complete (Charge ID: %s)"
64
  msgstr ""
65
 
66
  #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:467
67
- #: includes/class-wc-gateway-stripe.php:504
68
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:187
69
  msgid "Payment processing failed. Please retry."
70
  msgstr ""
@@ -934,57 +934,57 @@ msgid ""
934
  "correct the site's time."
935
  msgstr ""
936
 
937
- #: includes/class-wc-gateway-stripe.php:415
938
  msgid "Please accept the terms and conditions first"
939
  msgstr ""
940
 
941
- #: includes/class-wc-gateway-stripe.php:416
942
  msgid "Please fill in required checkout fields first"
943
  msgstr ""
944
 
945
- #: includes/class-wc-gateway-stripe.php:446
946
- #: includes/class-wc-gateway-stripe.php:491
947
  msgid ""
948
  "Sorry, we're not accepting prepaid cards at this time. Your credit card has "
949
  "not been charged. Please try with alternative payment method."
950
  msgstr ""
951
 
952
- #: includes/class-wc-gateway-stripe.php:447
953
  msgid "Please enter your IBAN account name."
954
  msgstr ""
955
 
956
- #: includes/class-wc-gateway-stripe.php:448
957
  msgid "Please enter your IBAN account number."
958
  msgstr ""
959
 
960
- #: includes/class-wc-gateway-stripe.php:449
961
  msgid "We couldn't initiate the payment. Please try again."
962
  msgstr ""
963
 
964
- #: includes/class-wc-gateway-stripe.php:460
965
  msgid "Billing First Name and Last Name are required."
966
  msgstr ""
967
 
968
- #: includes/class-wc-gateway-stripe.php:760
969
  #. translators: error message
970
  msgid "This represents the fee Stripe collects for the transaction."
971
  msgstr ""
972
 
973
- #: includes/class-wc-gateway-stripe.php:761
974
  msgid "Stripe Fee:"
975
  msgstr ""
976
 
977
- #: includes/class-wc-gateway-stripe.php:797
978
  msgid ""
979
  "This represents the net total that will be credited to your Stripe bank "
980
  "account. This may be in the currency that is set in your Stripe account."
981
  msgstr ""
982
 
983
- #: includes/class-wc-gateway-stripe.php:798
984
  msgid "Stripe Payout:"
985
  msgstr ""
986
 
987
- #: includes/class-wc-gateway-stripe.php:861
988
  #: includes/class-wc-stripe-order-handler.php:159
989
  #: includes/class-wc-stripe-webhook-handler.php:264
990
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:287
@@ -995,7 +995,7 @@ msgid ""
995
  "later."
996
  msgstr ""
997
 
998
- #: includes/class-wc-gateway-stripe.php:914
999
  msgid ""
1000
  "Almost there!\n"
1001
  "\n"
@@ -1003,54 +1003,54 @@ msgid ""
1003
  "done is for you to authorize the payment with your bank."
1004
  msgstr ""
1005
 
1006
- #: includes/class-wc-gateway-stripe.php:936
1007
  #. translators: %s is the order Id
1008
  msgid "Payment Intent not found for order #%s"
1009
  msgstr ""
1010
 
1011
- #: includes/class-wc-gateway-stripe.php:1167
1012
  #: includes/class-wc-stripe-webhook-handler.php:768
1013
  #: includes/class-wc-stripe-webhook-handler.php:813
1014
  #. translators: 1) The error message that was received from Stripe.
1015
  msgid "Stripe SCA authentication failed. Reason: %s"
1016
  msgstr ""
1017
 
1018
- #: includes/class-wc-gateway-stripe.php:1168
1019
  msgid "Stripe SCA authentication failed."
1020
  msgstr ""
1021
 
1022
- #: includes/class-wc-gateway-stripe.php:1225
1023
  msgid ""
1024
  "The \"Live Publishable Key\" should start with \"pk_live\", enter the "
1025
  "correct key."
1026
  msgstr ""
1027
 
1028
- #: includes/class-wc-gateway-stripe.php:1233
1029
  msgid ""
1030
  "The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
1031
  "the correct key."
1032
  msgstr ""
1033
 
1034
- #: includes/class-wc-gateway-stripe.php:1241
1035
  msgid ""
1036
  "The \"Test Publishable Key\" should start with \"pk_test\", enter the "
1037
  "correct key."
1038
  msgstr ""
1039
 
1040
- #: includes/class-wc-gateway-stripe.php:1249
1041
  msgid ""
1042
  "The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
1043
  "the correct key."
1044
  msgstr ""
1045
 
1046
- #: includes/class-wc-gateway-stripe.php:1289
1047
  #. translators: %1, %2, %3, and %4 are all HTML markup tags
1048
  msgid ""
1049
  "%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection "
1050
  "to Stripe.%4$s"
1051
  msgstr ""
1052
 
1053
- #: includes/class-wc-gateway-stripe.php:1301
1054
  #. translators: %1, %2 and %3 are all HTML markup tags
1055
  msgid ""
1056
  "%1$sSetup or link an existing Stripe account.%2$s By clicking this button "
@@ -1058,7 +1058,7 @@ msgid ""
1058
  "account keys below."
1059
  msgstr ""
1060
 
1061
- #: includes/class-wc-gateway-stripe.php:1307
1062
  msgid "Manually enter Stripe keys below."
1063
  msgstr ""
1064
 
@@ -1108,31 +1108,31 @@ msgid ""
1108
  "be enabled to see recorded logs."
1109
  msgstr ""
1110
 
1111
- #: includes/class-wc-stripe-blocks-support.php:164
1112
  msgid "Credit / Debit Card"
1113
  msgstr ""
1114
 
1115
- #: includes/class-wc-stripe-blocks-support.php:221
1116
  msgid "Visa"
1117
  msgstr ""
1118
 
1119
- #: includes/class-wc-stripe-blocks-support.php:225
1120
  msgid "American Express"
1121
  msgstr ""
1122
 
1123
- #: includes/class-wc-stripe-blocks-support.php:229
1124
  msgid "Mastercard"
1125
  msgstr ""
1126
 
1127
- #: includes/class-wc-stripe-blocks-support.php:236
1128
  msgid "Discover"
1129
  msgstr ""
1130
 
1131
- #: includes/class-wc-stripe-blocks-support.php:240
1132
  msgid "JCB"
1133
  msgstr ""
1134
 
1135
- #: includes/class-wc-stripe-blocks-support.php:244
1136
  msgid "Diners"
1137
  msgstr ""
1138
 
@@ -1626,7 +1626,7 @@ msgid "You are not authorized to clear Stripe account keys."
1626
  msgstr ""
1627
 
1628
  #: includes/payment-methods/class-wc-gateway-stripe-alipay.php:61
1629
- #: woocommerce-gateway-stripe.php:307
1630
  msgid "Stripe Alipay"
1631
  msgstr ""
1632
 
@@ -1655,27 +1655,27 @@ msgid "Add Payment"
1655
  msgstr ""
1656
 
1657
  #: includes/payment-methods/class-wc-gateway-stripe-bancontact.php:61
1658
- #: woocommerce-gateway-stripe.php:301
1659
  msgid "Stripe Bancontact"
1660
  msgstr ""
1661
 
1662
  #: includes/payment-methods/class-wc-gateway-stripe-eps.php:61
1663
- #: woocommerce-gateway-stripe.php:304
1664
  msgid "Stripe EPS"
1665
  msgstr ""
1666
 
1667
  #: includes/payment-methods/class-wc-gateway-stripe-giropay.php:61
1668
- #: woocommerce-gateway-stripe.php:303
1669
  msgid "Stripe Giropay"
1670
  msgstr ""
1671
 
1672
  #: includes/payment-methods/class-wc-gateway-stripe-ideal.php:61
1673
- #: woocommerce-gateway-stripe.php:305
1674
  msgid "Stripe iDeal"
1675
  msgstr ""
1676
 
1677
  #: includes/payment-methods/class-wc-gateway-stripe-multibanco.php:61
1678
- #: woocommerce-gateway-stripe.php:309
1679
  msgid "Stripe Multibanco"
1680
  msgstr ""
1681
 
@@ -1704,12 +1704,12 @@ msgid "Awaiting Multibanco payment"
1704
  msgstr ""
1705
 
1706
  #: includes/payment-methods/class-wc-gateway-stripe-p24.php:61
1707
- #: woocommerce-gateway-stripe.php:306
1708
  msgid "Stripe P24"
1709
  msgstr ""
1710
 
1711
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:76
1712
- #: woocommerce-gateway-stripe.php:308
1713
  msgid "Stripe SEPA Direct Debit"
1714
  msgstr ""
1715
 
@@ -1736,58 +1736,58 @@ msgid ""
1736
  msgstr ""
1737
 
1738
  #: includes/payment-methods/class-wc-gateway-stripe-sofort.php:61
1739
- #: woocommerce-gateway-stripe.php:302
1740
  msgid "Stripe SOFORT"
1741
  msgstr ""
1742
 
1743
  #: includes/payment-methods/class-wc-stripe-payment-request.php:362
1744
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1084
1745
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1514
1746
  msgid "Tax"
1747
  msgstr ""
1748
 
1749
  #: includes/payment-methods/class-wc-stripe-payment-request.php:370
1750
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1092
1751
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1521
1752
  msgid "Shipping"
1753
  msgstr ""
1754
 
1755
  #: includes/payment-methods/class-wc-stripe-payment-request.php:377
1756
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1099
1757
  msgid "Pending"
1758
  msgstr ""
1759
 
1760
- #: includes/payment-methods/class-wc-stripe-payment-request.php:639
1761
  msgid "Sorry, we're not accepting prepaid cards at this time."
1762
  msgstr ""
1763
 
1764
- #: includes/payment-methods/class-wc-stripe-payment-request.php:641
1765
  #. translators: Do not translate the [option] placeholder
1766
  msgid "Unknown shipping option \"[option]\"."
1767
  msgstr ""
1768
 
1769
- #: includes/payment-methods/class-wc-stripe-payment-request.php:740
1770
  msgid "OR"
1771
  msgstr ""
1772
 
1773
- #: includes/payment-methods/class-wc-stripe-payment-request.php:933
1774
- #: includes/payment-methods/class-wc-stripe-payment-request.php:946
1775
  msgid "Unable to find shipping method for address."
1776
  msgstr ""
1777
 
1778
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1046
1779
  #. translators: %d is the product Id
1780
  msgid "Product with the ID (%d) cannot be found."
1781
  msgstr ""
1782
 
1783
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1067
1784
  #. translators: 1: product name 2: quantity in stock
1785
  msgid ""
1786
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1787
  "enough stock (%2$s remaining)."
1788
  msgstr ""
1789
 
1790
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1339
1791
  #. translators: %s: country.
1792
  msgid ""
1793
  "The Payment Request button is not supported in %s because some required "
@@ -1795,11 +1795,11 @@ msgid ""
1795
  "again."
1796
  msgstr ""
1797
 
1798
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1355
1799
  msgid "Empty cart"
1800
  msgstr ""
1801
 
1802
- #: includes/payment-methods/class-wc-stripe-payment-request.php:1528
1803
  msgid "Discount"
1804
  msgstr ""
1805
 
@@ -1842,23 +1842,23 @@ msgid ""
1842
  "WooCommerce %2$s is no longer supported."
1843
  msgstr ""
1844
 
1845
- #: woocommerce-gateway-stripe.php:231
1846
  msgid "Settings"
1847
  msgstr ""
1848
 
1849
- #: woocommerce-gateway-stripe.php:247
1850
  msgid "View Documentation"
1851
  msgstr ""
1852
 
1853
- #: woocommerce-gateway-stripe.php:247
1854
  msgid "Docs"
1855
  msgstr ""
1856
 
1857
- #: woocommerce-gateway-stripe.php:248
1858
  msgid "Open a support request at WooCommerce.com"
1859
  msgstr ""
1860
 
1861
- #: woocommerce-gateway-stripe.php:248
1862
  msgid "Support"
1863
  msgstr ""
1864
 
2
  # This file is distributed under the same license as the WooCommerce Stripe Gateway package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: WooCommerce Stripe Gateway 5.2.1\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/woocommerce-gateway-stripe\n"
8
+ "POT-Creation-Date: 2021-06-10 19:04:19+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
64
  msgstr ""
65
 
66
  #: includes/abstracts/abstract-wc-stripe-payment-gateway.php:467
67
+ #: includes/class-wc-gateway-stripe.php:515
68
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:187
69
  msgid "Payment processing failed. Please retry."
70
  msgstr ""
934
  "correct the site's time."
935
  msgstr ""
936
 
937
+ #: includes/class-wc-gateway-stripe.php:373
938
  msgid "Please accept the terms and conditions first"
939
  msgstr ""
940
 
941
+ #: includes/class-wc-gateway-stripe.php:374
942
  msgid "Please fill in required checkout fields first"
943
  msgstr ""
944
 
945
+ #: includes/class-wc-gateway-stripe.php:404
946
+ #: includes/class-wc-gateway-stripe.php:502
947
  msgid ""
948
  "Sorry, we're not accepting prepaid cards at this time. Your credit card has "
949
  "not been charged. Please try with alternative payment method."
950
  msgstr ""
951
 
952
+ #: includes/class-wc-gateway-stripe.php:405
953
  msgid "Please enter your IBAN account name."
954
  msgstr ""
955
 
956
+ #: includes/class-wc-gateway-stripe.php:406
957
  msgid "Please enter your IBAN account number."
958
  msgstr ""
959
 
960
+ #: includes/class-wc-gateway-stripe.php:407
961
  msgid "We couldn't initiate the payment. Please try again."
962
  msgstr ""
963
 
964
+ #: includes/class-wc-gateway-stripe.php:418
965
  msgid "Billing First Name and Last Name are required."
966
  msgstr ""
967
 
968
+ #: includes/class-wc-gateway-stripe.php:771
969
  #. translators: error message
970
  msgid "This represents the fee Stripe collects for the transaction."
971
  msgstr ""
972
 
973
+ #: includes/class-wc-gateway-stripe.php:772
974
  msgid "Stripe Fee:"
975
  msgstr ""
976
 
977
+ #: includes/class-wc-gateway-stripe.php:808
978
  msgid ""
979
  "This represents the net total that will be credited to your Stripe bank "
980
  "account. This may be in the currency that is set in your Stripe account."
981
  msgstr ""
982
 
983
+ #: includes/class-wc-gateway-stripe.php:809
984
  msgid "Stripe Payout:"
985
  msgstr ""
986
 
987
+ #: includes/class-wc-gateway-stripe.php:872
988
  #: includes/class-wc-stripe-order-handler.php:159
989
  #: includes/class-wc-stripe-webhook-handler.php:264
990
  #: includes/compat/class-wc-stripe-sepa-subs-compat.php:287
995
  "later."
996
  msgstr ""
997
 
998
+ #: includes/class-wc-gateway-stripe.php:925
999
  msgid ""
1000
  "Almost there!\n"
1001
  "\n"
1003
  "done is for you to authorize the payment with your bank."
1004
  msgstr ""
1005
 
1006
+ #: includes/class-wc-gateway-stripe.php:947
1007
  #. translators: %s is the order Id
1008
  msgid "Payment Intent not found for order #%s"
1009
  msgstr ""
1010
 
1011
+ #: includes/class-wc-gateway-stripe.php:1178
1012
  #: includes/class-wc-stripe-webhook-handler.php:768
1013
  #: includes/class-wc-stripe-webhook-handler.php:813
1014
  #. translators: 1) The error message that was received from Stripe.
1015
  msgid "Stripe SCA authentication failed. Reason: %s"
1016
  msgstr ""
1017
 
1018
+ #: includes/class-wc-gateway-stripe.php:1179
1019
  msgid "Stripe SCA authentication failed."
1020
  msgstr ""
1021
 
1022
+ #: includes/class-wc-gateway-stripe.php:1236
1023
  msgid ""
1024
  "The \"Live Publishable Key\" should start with \"pk_live\", enter the "
1025
  "correct key."
1026
  msgstr ""
1027
 
1028
+ #: includes/class-wc-gateway-stripe.php:1244
1029
  msgid ""
1030
  "The \"Live Secret Key\" should start with \"sk_live\" or \"rk_live\", enter "
1031
  "the correct key."
1032
  msgstr ""
1033
 
1034
+ #: includes/class-wc-gateway-stripe.php:1252
1035
  msgid ""
1036
  "The \"Test Publishable Key\" should start with \"pk_test\", enter the "
1037
  "correct key."
1038
  msgstr ""
1039
 
1040
+ #: includes/class-wc-gateway-stripe.php:1260
1041
  msgid ""
1042
  "The \"Test Secret Key\" should start with \"sk_test\" or \"rk_test\", enter "
1043
  "the correct key."
1044
  msgstr ""
1045
 
1046
+ #: includes/class-wc-gateway-stripe.php:1300
1047
  #. translators: %1, %2, %3, and %4 are all HTML markup tags
1048
  msgid ""
1049
  "%1$sClear all Stripe account keys.%2$s %3$sThis will disable any connection "
1050
  "to Stripe.%4$s"
1051
  msgstr ""
1052
 
1053
+ #: includes/class-wc-gateway-stripe.php:1312
1054
  #. translators: %1, %2 and %3 are all HTML markup tags
1055
  msgid ""
1056
  "%1$sSetup or link an existing Stripe account.%2$s By clicking this button "
1058
  "account keys below."
1059
  msgstr ""
1060
 
1061
+ #: includes/class-wc-gateway-stripe.php:1318
1062
  msgid "Manually enter Stripe keys below."
1063
  msgstr ""
1064
 
1108
  "be enabled to see recorded logs."
1109
  msgstr ""
1110
 
1111
+ #: includes/class-wc-stripe-blocks-support.php:176
1112
  msgid "Credit / Debit Card"
1113
  msgstr ""
1114
 
1115
+ #: includes/class-wc-stripe-blocks-support.php:188
1116
  msgid "Visa"
1117
  msgstr ""
1118
 
1119
+ #: includes/class-wc-stripe-blocks-support.php:192
1120
  msgid "American Express"
1121
  msgstr ""
1122
 
1123
+ #: includes/class-wc-stripe-blocks-support.php:196
1124
  msgid "Mastercard"
1125
  msgstr ""
1126
 
1127
+ #: includes/class-wc-stripe-blocks-support.php:203
1128
  msgid "Discover"
1129
  msgstr ""
1130
 
1131
+ #: includes/class-wc-stripe-blocks-support.php:207
1132
  msgid "JCB"
1133
  msgstr ""
1134
 
1135
+ #: includes/class-wc-stripe-blocks-support.php:211
1136
  msgid "Diners"
1137
  msgstr ""
1138
 
1626
  msgstr ""
1627
 
1628
  #: includes/payment-methods/class-wc-gateway-stripe-alipay.php:61
1629
+ #: woocommerce-gateway-stripe.php:315
1630
  msgid "Stripe Alipay"
1631
  msgstr ""
1632
 
1655
  msgstr ""
1656
 
1657
  #: includes/payment-methods/class-wc-gateway-stripe-bancontact.php:61
1658
+ #: woocommerce-gateway-stripe.php:309
1659
  msgid "Stripe Bancontact"
1660
  msgstr ""
1661
 
1662
  #: includes/payment-methods/class-wc-gateway-stripe-eps.php:61
1663
+ #: woocommerce-gateway-stripe.php:312
1664
  msgid "Stripe EPS"
1665
  msgstr ""
1666
 
1667
  #: includes/payment-methods/class-wc-gateway-stripe-giropay.php:61
1668
+ #: woocommerce-gateway-stripe.php:311
1669
  msgid "Stripe Giropay"
1670
  msgstr ""
1671
 
1672
  #: includes/payment-methods/class-wc-gateway-stripe-ideal.php:61
1673
+ #: woocommerce-gateway-stripe.php:313
1674
  msgid "Stripe iDeal"
1675
  msgstr ""
1676
 
1677
  #: includes/payment-methods/class-wc-gateway-stripe-multibanco.php:61
1678
+ #: woocommerce-gateway-stripe.php:317
1679
  msgid "Stripe Multibanco"
1680
  msgstr ""
1681
 
1704
  msgstr ""
1705
 
1706
  #: includes/payment-methods/class-wc-gateway-stripe-p24.php:61
1707
+ #: woocommerce-gateway-stripe.php:314
1708
  msgid "Stripe P24"
1709
  msgstr ""
1710
 
1711
  #: includes/payment-methods/class-wc-gateway-stripe-sepa.php:76
1712
+ #: woocommerce-gateway-stripe.php:316
1713
  msgid "Stripe SEPA Direct Debit"
1714
  msgstr ""
1715
 
1736
  msgstr ""
1737
 
1738
  #: includes/payment-methods/class-wc-gateway-stripe-sofort.php:61
1739
+ #: woocommerce-gateway-stripe.php:310
1740
  msgid "Stripe SOFORT"
1741
  msgstr ""
1742
 
1743
  #: includes/payment-methods/class-wc-stripe-payment-request.php:362
1744
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1092
1745
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1522
1746
  msgid "Tax"
1747
  msgstr ""
1748
 
1749
  #: includes/payment-methods/class-wc-stripe-payment-request.php:370
1750
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1100
1751
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1529
1752
  msgid "Shipping"
1753
  msgstr ""
1754
 
1755
  #: includes/payment-methods/class-wc-stripe-payment-request.php:377
1756
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1107
1757
  msgid "Pending"
1758
  msgstr ""
1759
 
1760
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:603
1761
  msgid "Sorry, we're not accepting prepaid cards at this time."
1762
  msgstr ""
1763
 
1764
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:605
1765
  #. translators: Do not translate the [option] placeholder
1766
  msgid "Unknown shipping option \"[option]\"."
1767
  msgstr ""
1768
 
1769
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:748
1770
  msgid "OR"
1771
  msgstr ""
1772
 
1773
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:941
1774
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:954
1775
  msgid "Unable to find shipping method for address."
1776
  msgstr ""
1777
 
1778
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1054
1779
  #. translators: %d is the product Id
1780
  msgid "Product with the ID (%d) cannot be found."
1781
  msgstr ""
1782
 
1783
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1075
1784
  #. translators: 1: product name 2: quantity in stock
1785
  msgid ""
1786
  "You cannot add that amount of \"%1$s\"; to the cart because there is not "
1787
  "enough stock (%2$s remaining)."
1788
  msgstr ""
1789
 
1790
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1347
1791
  #. translators: %s: country.
1792
  msgid ""
1793
  "The Payment Request button is not supported in %s because some required "
1795
  "again."
1796
  msgstr ""
1797
 
1798
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1363
1799
  msgid "Empty cart"
1800
  msgstr ""
1801
 
1802
+ #: includes/payment-methods/class-wc-stripe-payment-request.php:1536
1803
  msgid "Discount"
1804
  msgstr ""
1805
 
1842
  "WooCommerce %2$s is no longer supported."
1843
  msgstr ""
1844
 
1845
+ #: woocommerce-gateway-stripe.php:239
1846
  msgid "Settings"
1847
  msgstr ""
1848
 
1849
+ #: woocommerce-gateway-stripe.php:255
1850
  msgid "View Documentation"
1851
  msgstr ""
1852
 
1853
+ #: woocommerce-gateway-stripe.php:255
1854
  msgid "Docs"
1855
  msgstr ""
1856
 
1857
+ #: woocommerce-gateway-stripe.php:256
1858
  msgid "Open a support request at WooCommerce.com"
1859
  msgstr ""
1860
 
1861
+ #: woocommerce-gateway-stripe.php:256
1862
  msgid "Support"
1863
  msgstr ""
1864
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Tags: credit card, stripe, apple pay, payment request, google pay, sepa, sofort,
4
  Requires at least: 4.4
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
- Stable tag: 5.2.0
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
@@ -126,20 +126,8 @@ If you get stuck, you can ask for help in the Plugin Forum.
126
 
127
  == Changelog ==
128
 
129
- = 5.2.0 - 2021-05-19 =
130
-
131
- * Fix - Use `get_parent` method to avoid accessing `order` subscription property directly.
132
- * Fix - Orders won't transition to 'Refunded' state if refund can't be created.
133
- * Fix - Normalize United Kingdom and Canada postal codes for Apple Pay.
134
- * Fix - Subscription sign-up fees not included in total for Payment Request Button.
135
- * Fix - Reduce requests sent to server from stripe settings page.
136
- * Fix - Choose the appropriate version of the WooCommerce Admin Notes API based on which API is available.
137
- * Fix - Customer information is now correctly displayed in the Stripe Payments Dashboard when a new customer checks out through the WooCommerce Checkout Block.
138
- * Fix - Pass customer language/locale to Stripe upon creation or modification.
139
- * Fix - Initial price for Variable Products is now correctly shown when a Payment Request is started.
140
- * Add - Support for Credit Card payments (incl. 3DS payments) via WooCommerce Blocks; limited to WooCommerce Core product types.
141
- * Add - Support for payments (incl. 3DS payments) paid via Payment Request Buttons in WooCommerce Blocks; limited to WooCommerce Core product types.
142
- * Add - Support for custom and branded Payment Request Buttons when using the Cart and Checkout blocks.
143
- * Tweak - Should customer opt to save their card, the card is now saved after a payment has been confirmed.
144
-
145
- [See changelog for all versions](https://raw.githubusercontent.com/woocommerce/woocommerce-gateway-stripe/trunk/changelog.txt).
4
  Requires at least: 4.4
5
  Tested up to: 5.6
6
  Requires PHP: 5.6
7
+ Stable tag: 5.2.1
8
  License: GPLv3
9
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
10
  Attributions: thorsten-stripe
126
 
127
  == Changelog ==
128
 
129
+ = 5.2.1 - 2021-06-10 =
130
+
131
+ * Fix - Remove calls to `has_block()` since it breaks compatibility with older versions of WordPress.
132
+ * Tweak - Use the same JavaScript configurations for the Block-based and Shortcode-based checkout flows.
133
+
 
 
 
 
 
 
 
 
 
 
 
 
woocommerce-gateway-stripe.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
- * Version: 5.2.0
9
  * Requires at least: 4.4
10
  * Tested up to: 5.6
11
  * WC requires at least: 3.0
@@ -21,7 +21,7 @@ if ( ! defined( 'ABSPATH' ) ) {
21
  /**
22
  * Required minimums and constants
23
  */
24
- define( 'WC_STRIPE_VERSION', '5.2.0' ); // WRCS: DEFINED_VERSION.
25
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
26
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
27
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.3' );
@@ -92,6 +92,13 @@ function woocommerce_gateway_stripe() {
92
  */
93
  public $connect;
94
 
 
 
 
 
 
 
 
95
  /**
96
  * Private clone method to prevent cloning of the instance of the
97
  * *Singleton* instance.
@@ -117,8 +124,9 @@ function woocommerce_gateway_stripe() {
117
 
118
  $this->init();
119
 
120
- $this->api = new WC_Stripe_Connect_API();
121
- $this->connect = new WC_Stripe_Connect( $this->api );
 
122
 
123
  add_action( 'rest_api_init', [ $this, 'register_connect_routes' ] );
124
  }
@@ -427,7 +435,11 @@ function woocommerce_gateway_stripe_woocommerce_block_support() {
427
  $container->register(
428
  WC_Stripe_Blocks_Support::class,
429
  function() {
430
- return new WC_Stripe_Blocks_Support();
 
 
 
 
431
  }
432
  );
433
  $payment_method_registry->register(
5
  * Description: Take credit card payments on your store using Stripe.
6
  * Author: WooCommerce
7
  * Author URI: https://woocommerce.com/
8
+ * Version: 5.2.1
9
  * Requires at least: 4.4
10
  * Tested up to: 5.6
11
  * WC requires at least: 3.0
21
  /**
22
  * Required minimums and constants
23
  */
24
+ define( 'WC_STRIPE_VERSION', '5.2.1' ); // WRCS: DEFINED_VERSION.
25
  define( 'WC_STRIPE_MIN_PHP_VER', '5.6.0' );
26
  define( 'WC_STRIPE_MIN_WC_VER', '3.0' );
27
  define( 'WC_STRIPE_FUTURE_MIN_WC_VER', '3.3' );
92
  */
93
  public $connect;
94
 
95
+ /**
96
+ * Stripe Payment Request configurations.
97
+ *
98
+ * @var WC_Stripe_Payment_Request
99
+ */
100
+ public $payment_request_configuration;
101
+
102
  /**
103
  * Private clone method to prevent cloning of the instance of the
104
  * *Singleton* instance.
124
 
125
  $this->init();
126
 
127
+ $this->api = new WC_Stripe_Connect_API();
128
+ $this->connect = new WC_Stripe_Connect( $this->api );
129
+ $this->payment_request_configuration = new WC_Stripe_Payment_Request();
130
 
131
  add_action( 'rest_api_init', [ $this, 'register_connect_routes' ] );
132
  }
435
  $container->register(
436
  WC_Stripe_Blocks_Support::class,
437
  function() {
438
+ if ( class_exists( 'WC_Stripe' ) ) {
439
+ return new WC_Stripe_Blocks_Support( WC_Stripe::get_instance()->payment_request_configuration );
440
+ } else {
441
+ return new WC_Stripe_Blocks_Support();
442
+ }
443
  }
444
  );
445
  $payment_method_registry->register(