(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[2427,4284],{22427:(e,t,n)=>{"use strict";n.r(t),n.d(t,{loadStripe:()=>h});var r,o="https:/https://www.ukmeds.co.uk/js.stripe.com/v3",u=/^https:\/\https://www.ukmeds.co.uk/js\.stripe\.com\/v3\/?(\?.*)?$/,c=function(){for(var e=document.querySelectorAll('script[src^="'.concat(o,'"]')),t=0;t element.");return r.appendChild(n),n},s=function(e,t){e&&e._registerWrapper&&e._registerWrapper({name:"stripe-js",version:"2.4.0",startTime:t})},a=null,l=null,p=null,f=function(e,t,n){if(null===e)return null;var r=e.apply(void 0,t);return s(r,n),r},d=!1,m=function(){return r?r:r=(null!==a?a:(a=new Promise(function(e,t){if("undefined"==typeof window||"undefined"==typeof document)return void e(null);if(window.Stripe,window.Stripe)return void e(window.Stripe);try{var n,r=c();r?r&&null!==p&&null!==l&&(r.removeEventListener("load",p),r.removeEventListener("error",l),null==(n=r.parentNode)||n.removeChild(r),r=i(null)):r=i(null),p=function(){window.Stripe?e(window.Stripe):t(Error("Stripe.js not available"))},l=function(){t(Error("Failed to load Stripe.js"))},r.addEventListener("load",p),r.addEventListener("error",l)}catch(e){t(e);return}})).catch(function(e){return a=null,Promise.reject(e)})).catch(function(e){return r=null,Promise.reject(e)})};Promise.resolve().then(function(){return m()}).catch(function(e){d||console.warn(e)});var h=function(){for(var e=arguments.length,t=Array(e),n=0;ne.length)&&(t=e.length);for(var n=0,r=Array(t);n1&&void 0!==arguments[1]?arguments[1]:b;if(null===e||v(e)&&"function"==typeof e.elements&&"function"==typeof e.createToken&&"function"==typeof e.createPaymentMethod&&"function"==typeof e.confirmCardPayment)return e;throw Error(t)},S=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b;if(v(e)&&"function"==typeof e.then)return{tag:"async",stripePromise:Promise.resolve(e).then(function(e){return k(e,t)})};var n=k(e,t);return null===n?{tag:"empty"}:{tag:"sync",stripe:n}},w=function(e){e&&e._registerWrapper&&e.registerAppInfo&&(e._registerWrapper({name:"react-stripe-js",version:"2.8.1"}),e.registerAppInfo({name:"react-stripe-js",version:"2.8.1",url:"https://stripe.com/docs/stripe-js/react"}))},P=t.createContext(null);P.displayName="ElementsContext";var j=function(e,t){if(!e)throw Error("Could not find Elements context; You need to wrap the part of your app that ".concat(t," in an provider."));return e},O=function(e){var n=e.stripe,r=e.options,o=e.children,u=t.useMemo(function(){return S(n)},[n]),i=c(t.useState(function(){return{stripe:"sync"===u.tag?u.stripe:null,elements:"sync"===u.tag?u.stripe.elements(r):null}}),2),s=i[0],a=i[1];t.useEffect(function(){var e=!0,t=function(e){a(function(t){return t.stripe?t:{stripe:e,elements:e.elements(r)}})};return"async"!==u.tag||s.stripe?"sync"!==u.tag||s.stripe||t(u.stripe):u.stripePromise.then(function(n){n&&e&&t(n)}),function(){e=!1}},[u,s,r]);var l=y(n);t.useEffect(function(){null!==l&&l!==n&&console.warn("Unsupported prop change on Elements: You cannot change the `stripe` prop after setting it.")},[l,n]);var p=y(r);return t.useEffect(function(){if(s.elements){var e=E(r,p,["clientSecret","fonts"]);e&&s.elements.update(e)}},[r,p,s.elements]),t.useEffect(function(){w(s.stripe)},[s.stripe]),t.createElement(P.Provider,{value:s},o)};O.propTypes={stripe:m.any,options:m.object};var x=function(e){return j(t.useContext(P),e)},A=function(e){return(0,e.children)(x("mounts "))};A.propTypes={children:m.func.isRequired};var R=["on","session"],N=t.createContext(null);N.displayName="CustomCheckoutSdkContext";var _=function(e,t){if(!e)throw Error("Could not find CustomCheckoutProvider context; You need to wrap the part of your app that ".concat(t," in an provider."));return e},I=t.createContext(null);I.displayName="CustomCheckoutContext";var L=function(e,t){if(!e)return null;e.on,e.session;var n=function(e,t){if(null==e)return{};var n,r,o=function(e,t){if(null==e)return{};var n,r,o={},u=Object.keys(e);for(r=0;r=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var u=Object.getOwnPropertySymbols(e);for(r=0;r=0)&&Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}(e,R);return t?r(r({},n),t):r(r({},n),e.session())},T=function(e){var n=e.stripe,r=e.options,o=e.children,u=t.useMemo(function(){return S(n,"Invalid prop `stripe` supplied to `CustomCheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},[n]),i=c(t.useState(null),2),s=i[0],a=i[1],l=c(t.useState(function(){return{stripe:"sync"===u.tag?u.stripe:null,customCheckoutSdk:null}}),2),p=l[0],f=l[1],d=function(e,t){f(function(n){return n.stripe&&n.customCheckoutSdk?n:{stripe:e,customCheckoutSdk:t}})},m=t.useRef(!1);t.useEffect(function(){var e=!0;return"async"!==u.tag||p.stripe?"sync"===u.tag&&u.stripe&&!m.current&&(m.current=!0,u.stripe.initCustomCheckout(r).then(function(e){e&&(d(u.stripe,e),e.on("change",a))})):u.stripePromise.then(function(t){t&&e&&!m.current&&(m.current=!0,t.initCustomCheckout(r).then(function(e){e&&(d(t,e),e.on("change",a))}))}),function(){e=!1}},[u,p,r,a]);var h=y(n);t.useEffect(function(){null!==h&&h!==n&&console.warn("Unsupported prop change on CustomCheckoutProvider: You cannot change the `stripe` prop after setting it.")},[h,n]);var C=y(r);t.useEffect(function(){if(p.customCheckoutSdk){!r.clientSecret||v(C)||g(r.clientSecret,C.clientSecret)||console.warn("Unsupported prop change: options.client_secret is not a mutable property.");var e,t,n=null==C||null==(e=C.elementsOptions)?void 0:e.appearance,o=null==r||null==(t=r.elementsOptions)?void 0:t.appearance;o&&!g(o,n)&&p.customCheckoutSdk.changeAppearance(o)}},[r,C,p.customCheckoutSdk]),t.useEffect(function(){w(p.stripe)},[p.stripe]);var E=t.useMemo(function(){return L(p.customCheckoutSdk,s)},[p.customCheckoutSdk,s]);return p.customCheckoutSdk?t.createElement(N.Provider,{value:p},t.createElement(I.Provider,{value:E},o)):null};T.propTypes={stripe:m.any,options:m.shape({clientSecret:m.string.isRequired,elementsOptions:m.object}).isRequired};var U=function(e){var n=t.useContext(N),r=t.useContext(P);if(n&&r)throw Error("You cannot wrap the part of your app that ".concat(e," in both and providers."));return n?_(n,e):j(r,e)},B=function(e,n){var r="".concat(e.charAt(0).toUpperCase()+e.slice(1),"Element"),o=n?function(e){U("mounts <".concat(r,">"));var n=e.id,o=e.className;return t.createElement("div",{id:n,className:o})}:function(n){var o,u=n.id,i=n.className,s=n.options,a=void 0===s?{}:s,l=n.onBlur,p=n.onFocus,f=n.onReady,d=n.onChange,m=n.onEscape,v=n.onClick,C=n.onLoadError,g=n.onLoaderStart,b=n.onNetworksChange,k=n.onConfirm,S=n.onCancel,w=n.onShippingAddressChange,P=n.onShippingRateChange,j=U("mounts <".concat(r,">")),O="elements"in j?j.elements:null,x="customCheckoutSdk"in j?j.customCheckoutSdk:null,A=c(t.useState(null),2),R=A[0],N=A[1],_=t.useRef(null),I=t.useRef(null);h(R,"blur",l),h(R,"focus",p),h(R,"escape",m),h(R,"click",v),h(R,"loaderror",C),h(R,"loaderstart",g),h(R,"networkschange",b),h(R,"confirm",k),h(R,"cancel",S),h(R,"shippingaddresschange",w),h(R,"shippingratechange",P),h(R,"change",d),f&&(o="expressCheckout"===e?f:function(){f(R)}),h(R,"ready",o),t.useLayoutEffect(function(){if(null===_.current&&null!==I.current&&(O||x)){var t=null;x?t=x.createElement(e,a):O&&(t=O.create(e,a)),_.current=t,N(t),t&&t.mount(I.current)}},[O,x,a]);var L=y(a);return t.useEffect(function(){if(_.current){var e=E(a,L,["paymentRequest"]);e&&"update"in _.current&&_.current.update(e)}},[a,L]),t.useLayoutEffect(function(){return function(){if(_.current&&"function"==typeof _.current.destroy)try{_.current.destroy(),_.current=null}catch(e){}}},[]),t.createElement("div",{id:u,className:i,ref:I})};return o.propTypes={id:m.string,className:m.string,onChange:m.func,onBlur:m.func,onFocus:m.func,onReady:m.func,onEscape:m.func,onClick:m.func,onLoadError:m.func,onLoaderStart:m.func,onNetworksChange:m.func,onConfirm:m.func,onCancel:m.func,onShippingAddressChange:m.func,onShippingRateChange:m.func,options:m.object},o.displayName=r,o.__elementType=e,o},M="undefined"==typeof window,Y=t.createContext(null);Y.displayName="EmbeddedCheckoutProviderContext";var D=function(){var e=t.useContext(Y);if(!e)throw Error(" must be used within ");return e},W=M?function(e){var n=e.id,r=e.className;return D(),t.createElement("div",{id:n,className:r})}:function(e){var n=e.id,r=e.className,o=D().embeddedCheckout,u=t.useRef(!1),c=t.useRef(null);return t.useLayoutEffect(function(){return!u.current&&o&&null!==c.current&&(o.mount(c.current),u.current=!0),function(){if(u.current&&o)try{o.unmount(),u.current=!1}catch(e){}}},[o]),t.createElement("div",{ref:c,id:n,className:r})},q=B("auBankAccount",M),F=B("card",M),$=B("cardNumber",M),H=B("cardExpiry",M),V=B("cardCvc",M),z=B("fpxBank",M),G=B("iban",M),J=B("idealBank",M),K=B("p24Bank",M),Q=B("epsBank",M),X=B("payment",M),Z=B("expressCheckout",M),ee=B("currencySelector",M),et=B("paymentRequestButton",M),en=B("linkAuthentication",M),er=B("address",M),eo=B("shippingAddress",M),eu=B("paymentMethodMessaging",M),ec=B("affirmMessage",M),ei=B("afterpayClearpayMessage",M);e.AddressElement=er,e.AffirmMessageElement=ec,e.AfterpayClearpayMessageElement=ei,e.AuBankAccountElement=q,e.CardCvcElement=V,e.CardElement=F,e.CardExpiryElement=H,e.CardNumberElement=$,e.CurrencySelectorElement=ee,e.CustomCheckoutProvider=T,e.Elements=O,e.ElementsConsumer=A,e.EmbeddedCheckout=W,e.EmbeddedCheckoutProvider=function(e){var n=e.stripe,r=e.options,o=e.children,u=t.useMemo(function(){return S(n,"Invalid prop `stripe` supplied to `EmbeddedCheckoutProvider`. We recommend using the `loadStripe` utility from `@stripe/stripe-js`. See https://stripe.com/docs/stripe-js/react#elements-props-stripe for details.")},[n]),i=t.useRef(null),s=t.useRef(null),a=c(t.useState({embeddedCheckout:null}),2),l=a[0],p=a[1];t.useEffect(function(){if(!s.current&&!i.current){var e=function(e){s.current||i.current||(s.current=e,i.current=s.current.initEmbeddedCheckout(r).then(function(e){p({embeddedCheckout:e})}))};"async"===u.tag&&!s.current&&(r.clientSecret||r.fetchClientSecret)?u.stripePromise.then(function(t){t&&e(t)}):"sync"===u.tag&&!s.current&&(r.clientSecret||r.fetchClientSecret)&&e(u.stripe)}},[u,r,l,s]),t.useEffect(function(){return function(){l.embeddedCheckout?(i.current=null,l.embeddedCheckout.destroy()):i.current&&i.current.then(function(){i.current=null,l.embeddedCheckout&&l.embeddedCheckout.destroy()})}},[l.embeddedCheckout]),t.useEffect(function(){w(s)},[s]);var f=y(n);t.useEffect(function(){null!==f&&f!==n&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the `stripe` prop after setting it.")},[f,n]);var d=y(r);return t.useEffect(function(){if(null!=d){if(null==r)return void console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot unset options after setting them.");void 0===r.clientSecret&&void 0===r.fetchClientSecret&&console.warn("Invalid props passed to EmbeddedCheckoutProvider: You must provide one of either `options.fetchClientSecret` or `options.clientSecret`."),null!=d.clientSecret&&r.clientSecret!==d.clientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the client secret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),null!=d.fetchClientSecret&&r.fetchClientSecret!==d.fetchClientSecret&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change fetchClientSecret after setting it. Unmount and create a new instance of EmbeddedCheckoutProvider instead."),null!=d.onComplete&&r.onComplete!==d.onComplete&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onComplete option after setting it."),null!=d.onShippingDetailsChange&&r.onShippingDetailsChange!==d.onShippingDetailsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onShippingDetailsChange option after setting it."),null!=d.onLineItemsChange&&r.onLineItemsChange!==d.onLineItemsChange&&console.warn("Unsupported prop change on EmbeddedCheckoutProvider: You cannot change the onLineItemsChange option after setting it.")}},[d,r]),t.createElement(Y.Provider,{value:l},o)},e.EpsBankElement=Q,e.ExpressCheckoutElement=Z,e.FpxBankElement=z,e.IbanElement=G,e.IdealBankElement=J,e.LinkAuthenticationElement=en,e.P24BankElement=K,e.PaymentElement=X,e.PaymentMethodMessagingElement=eu,e.PaymentRequestButtonElement=et,e.ShippingAddressElement=eo,e.useCustomCheckout=function(){_(t.useContext(N),"calls useCustomCheckout()");var e=t.useContext(I);if(!e)throw Error("Could not find CustomCheckout Context; You need to wrap the part of your app that calls useCustomCheckout() in an provider.");return e},e.useElements=function(){return x("calls useElements()").elements},e.useStripe=function(){return U("calls useStripe()").stripe}})(t,n(14232))}}]);