JezK
Edit File: getters-9cfeb0de.js
import{s as sortByArray}from"./util-dfbf863e.js";import{c as createStore}from"./index-18f5a1bc.js";import{g as getSerializedState}from"./utils-f84b2118.js";import{s as state$1}from"./mutations-9ffd30f4.js";import{s as state$2}from"./watchers-c7bbc6b2.js";const{processors:processors}=getSerializedState(),{state:state,onChange:onChange,on:on,dispose:dispose}=createStore({processors:[],methods:[],manualPaymentMethods:[],disabled:{processors:[]},sortOrder:{processors:["stripe","paystack","paypal","mollie","mock"],manualPaymentMethods:[],paymentMethods:{mollie:["creditcard","paypal"],razorpay:["card","upi"]}},instances:{stripe:void 0},config:{stripe:{paymentElement:!1}},...processors},((e,s)=>JSON.stringify(e)!==JSON.stringify(s))),METHOD_AWARE_PROCESSORS=["mollie","razorpay"],isMethodAwareProcessor=e=>!!e&&METHOD_AWARE_PROCESSORS.includes(e),availableProcessors=()=>sortByArray(state.processors,"processor_type",state.sortOrder.processors).filter((e=>(null==e?void 0:e.live_mode)===("live"===(null==state$1?void 0:state$1.mode)))).filter((e=>!(state.disabled.processors||[]).includes(e.processor_type))).filter((e=>{var s;return!(null===(s=null==state$1?void 0:state$1.checkout)||void 0===s?void 0:s.reusable_payment_method_required)||!!(null==e?void 0:e.recurring_enabled)})).filter(((e,s,o)=>!o.some((e=>"mollie"===e.processor_type))||"mollie"===e.processor_type||"mock"===e.processor_type)),getProcessorByType=e=>availableProcessors().find((({processor_type:s})=>s===e)),getAvailableProcessor=e=>availableProcessors().find((({processor_type:s})=>s===e)),processorSupportsCurrentCurrency=e=>{var s,o;return!!e&&(null!==(s=e.supported_currencies)&&void 0!==s?s:[]).includes(null===(o=null===window||void 0===window?void 0:window.scData)||void 0===o?void 0:o.currency)},hasOtherAvailableCreditCardProcessor=e=>availableProcessors().some((({processor_type:s})=>s!==e&&"paypal"!==s&&"mock"!==s)),availableManualPaymentMethods=()=>sortByArray(state.manualPaymentMethods,"id",state.sortOrder.manualPaymentMethods).filter((e=>!(state.disabled.processors||[]).includes(null==e?void 0:e.id))).filter((e=>{var s;return!(null===(s=null==state$1?void 0:state$1.checkout)||void 0===s?void 0:s.reusable_payment_method_required)||!!(null==e?void 0:e.reusable)})),availableMethodTypes=()=>{const e=null==state$2?void 0:state$2.id,s=isMethodAwareProcessor(e)?state.sortOrder.paymentMethods[e]:[];return sortByArray(state.methods,"id",s||[]).filter((e=>{var s,o;return"applepay"!==e.id||(null===window||void 0===window?void 0:window.ApplePaySession)&&(null===(o=null===(s=null===window||void 0===window?void 0:window.ApplePaySession)||void 0===s?void 0:s.canMakePayments)||void 0===o?void 0:o.call(s))}))},availableProcessorChoices=()=>[...availableProcessors(),...availableManualPaymentMethods()],hasMultipleProcessorChoices=()=>{var e;return(null===(e=availableProcessorChoices())||void 0===e?void 0:e.length)>1},availableMethodChoices=()=>[...availableMethodTypes(),...availableManualPaymentMethods(),getProcessorByType("mock")].filter(Boolean),hasMultipleMethodChoices=()=>{var e;return(null===(e=availableMethodChoices())||void 0===e?void 0:e.length)>1};export{availableProcessors as a,availableManualPaymentMethods as b,availableMethodTypes as c,hasMultipleProcessorChoices as d,hasMultipleMethodChoices as e,getAvailableProcessor as f,getProcessorByType as g,hasOtherAvailableCreditCardProcessor as h,isMethodAwareProcessor as i,onChange as o,processorSupportsCurrentCurrency as p,state as s};