{"version":3,"sources":["components/BillingAgreement/lib/constants.js","lib/contingencyResolver.js","components/CheckoutButton/query.gql.js","components/GiveAtCheckout/Mutation/query.gql.js","components/CheckoutButton/utils.js","components/CheckoutButton/Button.js","lib/creditButtonHelper.js","components/SplitTender/utils.js"],"names":["DISABLE_MERCHANT_FOR_STICKY_BA","ENTERPRISE_CONSENT_CODES","RT_FLOWS","CHANNEL_INITIATED_BILLING","MERCHANT_INITIATED_BILLING","MERCHANT_INITIATED_SINGLE_BILLING","CHANNEL_INITIATED_BILLING_SINGLE_AGREEMENT","SIMPLIFIED_CONTENT_COUNTRIES","CONSENT_KEYS_WITH_SECONDARY","contingencyResolver","contingencyFlow","paymentContingencies","confirmCreditCardCvvData","sepaMandateAcceptanceNeeded","threeDomainSecure","threeDSContingencyData","needConsentForBankAccountInfoRetrieval","needRealTimeBalanceForBankAccount","strongCustomerAuthenticationRequired","selectedFundingOption","selectedFundingOptionId","currencyCode","creditFinancingOption","inClearCreditOptionFlow","hasGPLFundingInstrument","contingencyLogger","noop","contextId","action","logger","fpti","SCA_CONTINGENCY_PAYLOAD","isObject","encryptedId","CVV_CONTINGENCY_PAYLOAD","currency_code","THREE_DS_PAYLOAD","resolution","paymentCard","id","from","to","selected_funding_option_id","SEPA_CONTINGENCY_PAYLOAD","fi_id","isPayNowUserActionFlow","CPA_PAYLOAD","selectedFundingOptionFinancingCode","fundingInstrument","creditFields","creditOffer","financingCode","CLEAR_CREDIT_OPTION_PAYLOAD","credit_option_financing_code","selected_fi_financing_code","definitions","names","filter","definition","kind","name","value","CHECKOUT_BUTTON_QUERY","FundingOptionFragment","CreditOfferFragment","PaymentContingenciesFragment","approvePaymentMutation","approveSuggestedDonationMutation","resolveContingencies","approveMemberPaymentVariables","updateFeatures","visible","data","showWidget","token","getToken","status","CHECKOUT_BUTTON_STATES","PENDING","inContingencyFlow","logApprovePayment","cartTotal","cryptocurrencyHoldingDetails","cryptocurrencyQuote","currencyValue","errorCode","fundingMethodType","isGplOffer","preferredShippingAddressId","rewardsPayload","secondaryFundingOptionIds","selectedAddressId","selectedInstallmentOption","selectedPlan","selectedTab","setStickyFiRequired","shouldHideCart","userId","viewName","selectedFundingInstrument","splitBalancePlan","getSplitBalancePlan","getSplitBalanceFundingSourceFromPlan","splitBalanceFiId","splitBalanceFiType","type","fiId","length","fiType","get","fiName","rewards","chosenFundingOption","getFptiFundingOptionType","cryptocurrencyPayloadItems","isCryptoFundingInstrument","cart_show_amt","undefined","amount","cart_show_curr","asset_price_with_spread","assetPrice","asset_price_wo_spread","fixed_fee_amt","fee_amt","fulfil_amt","fulfil_qty","quantity","asset_symbol","symbol","order_fiat_amt","order_by","op_nm","TRANSITION_PAYLOAD","int_err_code","buyer_country","getCountry","set_sticky_fi_required","currencyConversionFpti","fi_type","fi_name","chosen_funding_option","funding_method_type","shipping_id","preferrred_shipping_address","installment_option","term","rewardsFpti","rewardAmount","button_type","entry_point","view_name","cal","transition","LOG_TRANSITIONS","PROCESS_REVIEW","window","PAYPAL","analytics","instance","recordClick","page","link","fltk","cust","amt","ccpg","curr","CheckoutButton","className","useQuery","variables","threeDsExperienceVars","creditPpcOffersGqlParams","fetchPolicy","useButtonFeature","checkoutButtonLabelOverride","checkoutButtonStatus","checkoutSessionType","creditOfferAsFI_DE","fundingOptions","giveAtCheckoutNonProfitId","giveAtCheckoutOpted","hasPPCreditInstallments","inOpenBankingFlow","installments","isDonation","isDonationEligible","isIncentivePresent","isOpenBankingEnabled","merchantName","previousCheckoutButtonStatus","scaCompleted","shareAddressWithDonatee","splitTenderData","userAction","validShippingMethod","payLaterContext","usePayLaterContext","payContext","usePayContext","getQuote","useCryptoQuoteContext","payState","balanceId","continueButtonAction","creditFIOption","preferredFundingOptionId","usePayAfterDelivery","useSplitBalance","defaultPreferredFi","billingAgreement","isBillingAgreement","getIsPayNowUserActionFlow","useIsButtonDisabled","loading","Boolean","checkoutSession","isButtonDisabled","setIsButtonDisabled","isCryptoFI","isInstallmentsFeatureEnabled","eligible","enabled","installmentsFeatureData","availableInstallments","findInstallmentsInPlan","getSelectedInstallmentOption","useViewName","useCart","total","shouldUseGplButtonText","useGplButtonTextOnFinalRyi","useButtonLogging","mapCreditPPCOffer","creditPPCOffers","onClickCreditOffer","useOnClickCreditOffer","creditButtonText","isPpcFi","isPaypalCreditFundingInstrument","isPpcReuse","isPPCReuse","isInstallment","isInstallmentCreditType","content","OfferType","payLaterState","checkoutButtonText","uiElements","creditFI","payButtonText","continueButtonText","getContent","getCreditCheckoutButtonData","approvePayment","useMutation","approveDonation","approvePaymentSplitTender","SPLIT_TENDER_APPROVE_MUTATION","handleGiveAtCheckout","GAC_PAYLOAD","gac_npid","then","info","catch","error","approveMemberPayment","isAutoResolved","checkoutButtonStartTime","Date","now","defaultSelectedFI","getDefaultSelectedFundingInstrument","isDefaultFISelected","is_default_fi_selected","isOfferSelected","params","euat","redirectToLogin","updateFeature","display","message","getSelectedFundingSource","fi","plan","shouldOpenInstallmentInterstitial","Array","isArray","creditOfferType","shouldRedirectToCyco","creditType","isCreditWithAdditionalData","isCryptoAbleToCoverTransaction","handleInsufficientBalanceError","isPpcOfferAcq","processPpcOffer","openSelectInstallmentsInterstitial","fId","isInstallmentSelected","selectedInstallmentMap","isIframe","fallback","reason","preAuthorizationRequired","preAuthorizationData","rewardSelected","authType","isPreAuthRequired","REVIEW_CPA_PAYLOAD","client_epoch_ts","getPreAuthorizationRequired","handleMultiOfferContinueButtonAction","processGplOffer","hasOnlyIncentives","isSingleFundingOptionByType","getFundingSourceFromPlanByType","getSecondaryFundingOptionIds","checkRealTimeBalance","clearCreditFinancingOption","approvePaymentVariables","parseFloat","currency","installmentToInstallmentsInput","cryptocurrencyQuoteId","update","store","approveMemberPaymentResult","buyer","paymentState","state","hasPaymentContingencies","some","contingency","ERROR_PAYLOAD","code","CheckoutError","Error","buyer_id","completedPaymentInfo","returnToMerchantAfterApprove","approveMemberPaymentResultPayload","useEffect","RESOLVED","flow","buttonText","isDECreditOfferAsFiSelected","isString","getPadPlan","number","getPadNumberOfDelayedDays","includes","isGPLFundingInstrument","cryptoName","label","payNowContent","continueContent","getButtonText","data-testid","toLowerCase","data-disabled","onClick","isSplitReady","errorsOccurrenceCount","splitFundingOptions","_splitFundingOptions","selectedSplitFundingInstruments","selectedBackupFundingInstrument","_types","PAYPAL_BALANCE","CREDIT_CARD","BANK_ACCOUNT","PAYPAL_CREDIT","getSplitOptionsAndBackup","fundingOption","map","instrument","isPrimaryInstrument","fundingInstrumentType","toNumber","logApprovePaymentPrepare","showSplitTenderError","approveMemberPaymentWithSplitFundingOptions","logApprovePaymentProcess","shipping_address_id","preferred_shipping_address","logApprovePaymentError","resetSplitTenderData","userCanSplit","showSplitContinue","showSplitExperience","getEligibleForPrimaryFiIdList","isEligibleForPrimaryInstrument","isSplitTenderActive","SplitTenderGate","experiment","resolvedTreatment","find","backupFi"],"mappings":"4FAAA,0KAAO,IAAMA,EAAiC,CAC5C,gBACA,gBACA,gBACA,iBAOWC,EAA2B,CAAC,OAAQ,cAAe,cAAe,eAElEC,EAAW,CACtBC,0BAA2B,4BAC3BC,2BAA4B,6BAC5BC,kCAAmC,oCACnCC,2CAA4C,8CAIjCC,EAA+B,GAE/BC,EAA8B,CACzC,iDACA,mD,kCCzBF,qDAmBaC,EAAsB,SAAC,GAgBxB,IAAD,YACLC,EADK,aAAP,GAAO,MAfTC,qBAeS,gBAPL,GAOK,GAdPC,gCAcO,MAdoB,GAcpB,MAbPC,mCAaO,MAbuB,GAavB,MAZPC,yBAYO,MAZa,GAYb,MAXPC,8BAWO,MAXkB,GAWlB,MAVPC,8CAUO,MAVkC,GAUlC,MATPC,yCASO,MAT6B,GAS7B,MARPC,4CAQO,MARgC,GAQhC,EANTC,EAMS,EANTA,sBACAC,EAKS,EALTA,wBACAC,EAIS,EAJTA,aACAC,EAGS,EAHTA,sBACAC,EAES,EAFTA,wBACAC,EACS,EADTA,wBAGIC,EAAoBC,IAGxB,OAAIR,QAAJ,IAAIA,KAAsCS,YACxCjB,EAA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oBiC,MAAK,qBAAGtW,KAAgBwU,KAE7D,OAAK+B,EAKC,GAAN,OAAWhC,EAAX,kBAAiDgC,EAAjD,CAA2DjV,MAAO,MAHzDiT","file":"js/@/components/CheckoutButton/Button~21833f8f.830896ed.js","sourcesContent":["export const DISABLE_MERCHANT_FOR_STICKY_BA = [\n '7PCCZSK8KNQNC',\n 'HPA2FSJN9ZPRL',\n 'A2ZWHC6LATX5A',\n 'BJKZYSCVQDBAU',\n];\n\n/**\n * this object contains consent_code requires enterprise agreements\n * otherwise flow fallback to regular billing agreements\n */\nexport const ENTERPRISE_CONSENT_CODES = ['eBay', 'facebookp2p', 'fbInstagram', 'paymentusUS'];\n\nexport const RT_FLOWS = {\n CHANNEL_INITIATED_BILLING: 'CHANNEL_INITIATED_BILLING',\n MERCHANT_INITIATED_BILLING: 'MERCHANT_INITIATED_BILLING',\n MERCHANT_INITIATED_SINGLE_BILLING: 'MERCHANT_INITIATED_SINGLE_BILLING',\n CHANNEL_INITIATED_BILLING_SINGLE_AGREEMENT: 'CHANNEL_INITIATED_BILLING_SINGLE_AGREEMENT',\n};\n\n//For these countries, we will use simplified content even for non credit flows.\nexport const SIMPLIFIED_CONTENT_COUNTRIES = [];\n\nexport const CONSENT_KEYS_WITH_SECONDARY = [\n 'billingAgreement.memberAgreementMibCreditOffer',\n 'billingAgreement.memberAgreementCibCreditOffer',\n];\n","import { logger } from '@paypalcorp/c3-util-logger';\nimport { isObject, noop } from '@paypalcorp/c3-util-lang';\nimport {\n CVV_CONTINGENCY_PAYLOAD,\n THREE_DS_PAYLOAD,\n SEPA_CONTINGENCY_PAYLOAD,\n CPA_PAYLOAD,\n SCA_CONTINGENCY_PAYLOAD,\n CLEAR_CREDIT_OPTION_PAYLOAD,\n} from '@paypalcorp/c3-util-logger';\n\n/**\n * @param {Object} option\n * @param {Object} option.paymentContingencies | CheckoutSession.paymentContingencies\n * @param {String} option.selectedFundingOptionId | Selected funding instrument id\n * @returns {Object} Return the contingencyFlow and its associated contingencyLogger function\n * @example\n * const { contingencyFlow, contingencyLogger } = contingencyResolver({ ... });\n */\nexport const contingencyResolver = ({\n paymentContingencies: {\n confirmCreditCardCvvData = {},\n sepaMandateAcceptanceNeeded = {},\n threeDomainSecure = {}, // 3DS (1.0)\n threeDSContingencyData = {}, // 3DS (2.0)\n needConsentForBankAccountInfoRetrieval = {},\n needRealTimeBalanceForBankAccount = {},\n strongCustomerAuthenticationRequired = {},\n } = {},\n selectedFundingOption,\n selectedFundingOptionId,\n currencyCode,\n creditFinancingOption,\n inClearCreditOptionFlow,\n hasGPLFundingInstrument,\n} = {}) => {\n let contingencyFlow;\n let contingencyLogger = noop;\n\n // Resolve sca contingency\n if (strongCustomerAuthenticationRequired?.contextId) {\n contingencyFlow = 'REVIEW_BEFORE_LOGIN';\n contingencyLogger = ({ action = 'renderReviewBeforeLogin' } = {}) =>\n logger.fpti(action, SCA_CONTINGENCY_PAYLOAD({ action }));\n }\n\n // Resolve cvv contingency\n if (\n selectedFundingOptionId &&\n isObject(confirmCreditCardCvvData) &&\n confirmCreditCardCvvData.encryptedId === selectedFundingOptionId\n ) {\n contingencyFlow = 'CVV_CONFIRMATION';\n contingencyLogger = ({ action = 'renderCvv' } = {}) =>\n logger.fpti(action, CVV_CONTINGENCY_PAYLOAD({ action, currency_code: currencyCode }));\n }\n\n // Resolve 3DS (1.0) contingency use case\n if (\n selectedFundingOptionId &&\n isObject(threeDomainSecure) &&\n threeDomainSecure.encryptedId === selectedFundingOptionId\n ) {\n contingencyFlow = 'THREE_DS_CONFIRMATION';\n contingencyLogger = ({ action = 'renderThreeDS' } = {}) =>\n logger.fpti(action, THREE_DS_PAYLOAD({ action, currency_code: currencyCode }));\n }\n\n // Resolve 3DS (2.0) contingency use case\n if (\n selectedFundingOptionId &&\n isObject(threeDSContingencyData) &&\n threeDSContingencyData.resolution &&\n selectedFundingOptionId === threeDSContingencyData.resolution?.paymentCard?.id\n ) {\n contingencyFlow = 'THREE_DS_TWO_CONFIRMATION';\n contingencyLogger = ({ action = 'prepareThreeDs_v2' } = {}) =>\n logger.fpti(action, {\n from: 'review',\n to: 'render_threeds_v2',\n currency_code: currencyCode,\n selected_funding_option_id: selectedFundingOptionId,\n });\n }\n\n // Resolve SEPA mandate contingency\n if (\n selectedFundingOptionId &&\n isObject(sepaMandateAcceptanceNeeded) &&\n sepaMandateAcceptanceNeeded.id === selectedFundingOptionId\n ) {\n contingencyFlow = 'SEPA_CONFIRMATION';\n contingencyLogger = ({ action = 'renderSepa' } = {}) =>\n logger.fpti(\n action,\n SEPA_CONTINGENCY_PAYLOAD({\n action,\n currency_code: currencyCode,\n fi_id: selectedFundingOptionId,\n })\n );\n }\n\n // Resolve Open OpenBanking needConsentForBankAccountInfoRetrieval contingency\n if (\n selectedFundingOptionId &&\n isObject(needConsentForBankAccountInfoRetrieval) &&\n needConsentForBankAccountInfoRetrieval.encryptedId === selectedFundingOptionId\n ) {\n contingencyFlow = 'OPEN_BANKING';\n contingencyLogger = ({ action = 'prepareRtb', isPayNowUserActionFlow } = {}) =>\n logger.fpti(\n 'NEED_CONSENT_INTERSTITIAL_RENDER',\n CPA_PAYLOAD({ action, fi_id: selectedFundingOptionId, isPayNowUserActionFlow })\n );\n }\n\n // Resolve Open OpenBanking needRealTimeBalanceForBankAccount contingency\n if (\n selectedFundingOptionId &&\n isObject(needRealTimeBalanceForBankAccount) &&\n needRealTimeBalanceForBankAccount.encryptedId === selectedFundingOptionId\n ) {\n contingencyFlow = 'NEED_RTB';\n contingencyLogger = ({ action = 'prepareRtbCheck' } = {}) =>\n logger.fpti(\n 'NEED_REAL_TIME_BALANCE',\n CPA_PAYLOAD({ action, fi_id: selectedFundingOptionId })\n );\n }\n\n // Clear credit financing option if financingCode of\n // selectedFI does not match the one in CheckoutSession\n const selectedFundingOptionFinancingCode =\n selectedFundingOption?.fundingInstrument?.creditFields?.creditOffer?.financingCode ?? null;\n\n if (\n !inClearCreditOptionFlow &&\n creditFinancingOption?.financingCode &&\n selectedFundingOptionFinancingCode !== creditFinancingOption?.financingCode &&\n hasGPLFundingInstrument\n ) {\n contingencyFlow = 'CLEAR_CREDIT_OPTION';\n contingencyLogger = ({ action = 'processClearCreditOption' } = {}) =>\n logger.fpti(\n action,\n CLEAR_CREDIT_OPTION_PAYLOAD({\n action,\n fi_id: selectedFundingOptionId,\n credit_option_financing_code: creditFinancingOption?.financingCode,\n selected_fi_financing_code: selectedFundingOptionFinancingCode,\n })\n );\n }\n\n return {\n contingencyFlow,\n contingencyLogger,\n };\n};\n","import gql from 'graphql-tag';\nimport {\n FundingOptionFragment,\n PaymentContingenciesFragment,\n} from '@paypalcorp/c3-graphql-fragments';\nimport { CreditOfferFragment } from '@/components/CreditOffer';\n\nexport const CHECKOUT_BUTTON_QUERY = gql`\n ${FundingOptionFragment}\n ${CreditOfferFragment}\n ${PaymentContingenciesFragment}\n query CheckoutButton(\n $areCookiesDisabled: Boolean\n $experiences: [ThreeDSPaymentExperience]\n $isIframe: Boolean\n $token: String!\n ) {\n checkoutSession(token: $token) {\n cart {\n amounts {\n total {\n currencyValue\n currencyCode\n }\n }\n category\n }\n fundingOptions(returnAllPlans: true, groupSourcesOnType: INCENTIVE) {\n ...FundingOptionFragment\n }\n creditPPCOffers(areCookiesDisabled: $areCookiesDisabled, isIframe: $isIframe) {\n ...CreditOfferFragment\n }\n flags {\n hasPPCreditInstallments\n hideShipping\n isIncentivePresent\n isOptionallyShareAddress\n }\n merchant {\n name\n }\n paymentContingencies {\n ...PaymentContingenciesFragment\n threeDomainSecure(experiences: $experiences) {\n ...ThreeDomainSecureFields\n }\n }\n creditFinancingOption {\n creditType\n financingCode\n }\n userAction\n checkoutSessionType\n buyer {\n userId\n }\n }\n }\n`;\n\nexport const approvePaymentMutation = gql`\n ${PaymentContingenciesFragment}\n mutation approveMemberPayment(\n $token: String!\n $selectedAddressId: String\n $preferredShippingAddressId: String\n $selectedFundingOptionId: String!\n $preferredFundingOptionId: String\n $secondaryFundingOptionIds: [String!]\n $selectedInstallmentOption: InstallmentsInput\n $rewards: RewardsInput\n $preAuthorizationRequired: Boolean\n $fundingMethodType: FundingInstrumentMethodType\n $shareAddressWithDonatee: Boolean\n $setStickyFiRequired: Boolean\n $scaCompleted: Boolean!\n $experiences: [ThreeDSPaymentExperience]\n $cryptocurrencyQuoteId: String\n ) {\n approveMemberPayment(\n token: $token\n selectedAddressId: $selectedAddressId\n preferredShippingAddressId: $preferredShippingAddressId\n primaryFundingOptionId: $selectedFundingOptionId\n preferredFundingOptionId: $preferredFundingOptionId\n secondaryFundingOptionIds: $secondaryFundingOptionIds\n selectedInstallmentOption: $selectedInstallmentOption\n rewards: $rewards\n preAuthorizationRequired: $preAuthorizationRequired\n fundingMethodType: $fundingMethodType\n shareAddressWithDonatee: $shareAddressWithDonatee\n setStickyFiRequired: $setStickyFiRequired\n strongCustomerAuthenticationCompleted: $scaCompleted\n cryptocurrencyQuoteId: $cryptocurrencyQuoteId\n ) {\n state\n buyer {\n userId\n email {\n stringValue\n }\n name {\n fullName\n }\n }\n cart {\n intent\n paymentId\n billingToken\n returnUrl {\n href\n pathname\n }\n cancelUrl {\n href\n pathname\n }\n intent\n items {\n quantity\n name\n sku\n unitPrice {\n currencyValue\n }\n itemOptionSelections {\n name\n description\n }\n }\n amounts {\n subtotal {\n currencyCode\n currencyFormat\n }\n tax {\n currencyCode\n currencyFormat\n }\n shipping {\n currencyCode\n currencyFormat\n }\n insurance {\n currencyCode\n currencyFormat\n }\n handlingFee {\n currencyCode\n currencyFormat\n }\n total {\n currencyCode\n currencyFormat\n }\n discount {\n currencyCode\n currencyFormat\n }\n }\n }\n paymentContingencies {\n ...PaymentContingenciesFragment\n threeDomainSecure(experiences: $experiences) {\n ...ThreeDomainSecureFields\n }\n }\n completedPaymentInfo {\n transactionId\n transactionState\n softDescriptor\n postbackData\n }\n merchant {\n preferences {\n autoReturnToMerchant\n enablePaymentDataTransfer\n returnUrl\n }\n }\n }\n }\n`;\n","import gql from 'graphql-tag';\n\nexport const approveSuggestedDonationMutation = gql`\n mutation approveSuggestedDonation($token: String!) {\n approveSuggestedDonation(token: $token)\n }\n`;\n","import get from 'dlv';\nimport {\n LOG_TRANSITIONS,\n logger,\n REVIEW_CPA_PAYLOAD,\n TRANSITION_PAYLOAD,\n} from '@paypalcorp/c3-util-logger';\nimport { currencyConversionFpti } from '@/components/CurrencyConversion/fpti';\nimport { rewardsFpti } from '@/components/Rewards/utilities';\nimport getContent from '@/lib/content';\nimport { getFptiFundingOptionType } from '@/lib/fpti';\nimport { getCountry, getToken } from '@paypalcorp/c3-shared-globals';\nimport { isString } from '@paypalcorp/c3-util-lang';\nimport {\n getFundingSourceFromPlanByType,\n getSplitBalanceFundingSourceFromPlan,\n getSplitBalancePlan,\n isCryptoFundingInstrument,\n isSingleFundingOptionByType,\n updateFeatures,\n getPadPlan,\n getPadNumberOfDelayedDays,\n} from '@paypalcorp/c3-util-store';\nimport { CHECKOUT_BUTTON_STATES } from './constants';\nimport { SIMPLIFIED_CONTENT_COUNTRIES } from '../BillingAgreement/lib/constants.js';\nimport { isCreditWithAdditionalData, isGPLFundingInstrument } from '@/lib/creditInstallmentsHelper';\n\n/**\n * Get if pre auth is required\n * @param {Object} rewardsPayload rewards data\n * @param {Object} preAuthorizationData preauth data\n * @param {Boolean} isPayNowUserActionFlow if we're in the Pay Now state\n */\nexport function getPreAuthorizationRequired(\n rewardsPayload,\n preAuthorizationData,\n isPayNowUserActionFlow\n) {\n /**\n * Establish rewards to determine for preAuth Requirement\n *\n * NOTE:\n * Currently, Rewards in planning does not come with preAuth. this could\n * eventually change as preAuth's could soon be coming back from planning\n * as `true` even with Rewards.\n *\n * For now, preAuth should be false when there's a reward\n */\n if (rewardsPayload.rewardSelected) {\n return false;\n }\n\n if (preAuthorizationData) {\n const { authType } = preAuthorizationData;\n const isPreAuthRequired = authType === 'FULL' || authType === 'PARTIAL';\n\n if (isPreAuthRequired) {\n logger.fpti(\n 'CPA_REVIEW',\n REVIEW_CPA_PAYLOAD({\n action: 'preparePreAuth',\n client_epoch_ts: Date.now(),\n isPayNowUserActionFlow,\n })\n );\n }\n return isPreAuthRequired;\n }\n\n return false;\n}\n\n/**\n * Get the secondary funding option IDs\n * @param {Array} fundingOptions funding options\n * @param {Boolean} isIncentivePresent if an incentive is shown\n * @param {Object} selectedPlan the selected plan\n * @param {Boolean} useSplitBalance if we're using split balance\n * @param {Array} allBalanceIds the balance IDs from split balance\n */\nexport function getSecondaryFundingOptionIds(\n fundingOptions,\n isIncentivePresent,\n selectedPlan,\n useSplitBalance,\n balanceId\n) {\n const secondaryFundingOptionIds = useSplitBalance ? [balanceId] : [];\n const hasOnlyIncentives = isSingleFundingOptionByType({ fundingOptions, type: 'INCENTIVE' });\n\n if (isIncentivePresent && !hasOnlyIncentives) {\n const { fundingInstrument: { id } = {} } = getFundingSourceFromPlanByType({\n plan: selectedPlan,\n type: 'INCENTIVE',\n });\n\n return [...secondaryFundingOptionIds, id].filter(Boolean);\n }\n\n return secondaryFundingOptionIds;\n}\n\n/**\n * Get the Checkout Button text\n */\nexport function getButtonText({\n availableInstallments,\n checkoutButtonLabelOverride,\n creditOfferAsFI_DE = {},\n creditButtonText,\n isDonation,\n isPayNowUserActionFlow,\n selectedInstallmentOption,\n billingAgreement,\n selectedFundingOption,\n usePayAfterDelivery,\n}) {\n const setStickyFiRequired = !isCreditWithAdditionalData(\n selectedFundingOption?.fundingInstrument?.name || '',\n selectedFundingOption?.fundingInstrument?.type || ''\n );\n\n if (creditButtonText) {\n if (!billingAgreement || setStickyFiRequired) {\n return creditButtonText;\n }\n }\n\n const { data: { isDECreditOfferAsFiSelected, continueButtonText } = {} } = creditOfferAsFI_DE;\n\n if (isDECreditOfferAsFiSelected) {\n return continueButtonText;\n }\n\n if (checkoutButtonLabelOverride && isString(checkoutButtonLabelOverride)) {\n return checkoutButtonLabelOverride;\n }\n\n if (Boolean(availableInstallments) && !Boolean(selectedInstallmentOption)) {\n return getContent('installments.selectButtonText');\n }\n\n if (Boolean(getPadPlan(selectedFundingOption)) && usePayAfterDelivery) {\n return getContent('checkoutButton.continueWithPad', {\n number: getPadNumberOfDelayedDays(selectedFundingOption),\n });\n }\n\n if (\n billingAgreement &&\n // Don't show \"Agree & Continue\" for certain countries or GPL products\n !SIMPLIFIED_CONTENT_COUNTRIES.includes(getCountry()) &&\n !isGPLFundingInstrument(selectedFundingOption?.fundingInstrument)\n ) {\n return isPayNowUserActionFlow\n ? getContent('checkoutButton.ba.agreePayNow')\n : getContent('checkoutButton.ba.agreeContinue');\n }\n\n if (isDonation) {\n return isPayNowUserActionFlow\n ? getContent('checkoutButton.donateNow')\n : getContent('checkoutButton.continue');\n }\n\n if (isCryptoFundingInstrument(selectedFundingOption?.fundingInstrument)) {\n const cryptoName = selectedFundingOption?.fundingInstrument?.label;\n\n return getContent('crypto.sellAndContinue', {\n cryptoName,\n });\n }\n\n const payNowContent = getContent('checkoutButton.payNow');\n const continueContent = getContent('checkoutButton.continue');\n return isPayNowUserActionFlow ? payNowContent : continueContent;\n}\n\n/**\n * Resolve any payment related contingency before triggering the `approvePayment` mutation\n * @param {String} contingencyFlow the contingency flow to go thru\n * @param {Object} approveMemberPaymentVariables approve payment payload\n * @param {Function} contingencyLogger log contingency to FPTI\n */\nexport function resolveContingencies(contingencyFlow, approveMemberPaymentVariables) {\n return updateFeatures([\n {\n id: contingencyFlow,\n visible: true,\n data: {\n ...(contingencyFlow === 'REVIEW_BEFORE_LOGIN' ? { showWidget: true } : {}),\n approveMemberPaymentVariables: { token: getToken(), ...approveMemberPaymentVariables },\n },\n },\n // Set `CHECKOUT_BUTTON` status to `PENDING`\n {\n id: 'CHECKOUT_BUTTON',\n data: { status: CHECKOUT_BUTTON_STATES.PENDING, inContingencyFlow: true },\n },\n ]);\n}\n\n/**\n * Log data when approving the payment\n * @param {Object} data data to log\n */\nexport function logApprovePayment({\n cartTotal,\n cryptocurrencyHoldingDetails,\n cryptocurrencyQuote,\n currencyCode,\n currencyValue,\n errorCode,\n fundingMethodType,\n isGplOffer = false,\n preferredShippingAddressId = '',\n rewardsPayload,\n secondaryFundingOptionIds,\n selectedAddressId,\n selectedFundingOption,\n selectedFundingOptionId,\n selectedInstallmentOption,\n selectedPlan,\n selectedTab,\n setStickyFiRequired,\n shouldHideCart,\n userId,\n viewName,\n} = {}) {\n /*\n * We need to retrieve fi_id and fi_type correctly when we have SPLIT BALANCE and\n * concatenate those values in csv format for better logging. Otherwise,\n * we just display Id and Type from main FI.\n *\n * Example Split Balance:\n * fi_type:CREDIT_CARD,PAYPAL_BALANCE\n * fi_id:CC-YP9NVE23DZS44,BALANCEUSD\n *\n * Example 1 FI selected:\n * fi_type:CREDIT_CARD\n * fi_id:CC-YP9NVE23DZS44\n */\n const selectedFundingInstrument = selectedFundingOption?.fundingInstrument;\n const splitBalancePlan = getSplitBalancePlan(selectedFundingOption) || {};\n const { fundingInstrument: { id: splitBalanceFiId, type: splitBalanceFiType } = {} } =\n getSplitBalanceFundingSourceFromPlan(splitBalancePlan) || {};\n const fiId =\n secondaryFundingOptionIds?.length > 0 && splitBalanceFiId\n ? `${selectedFundingOptionId}, ${splitBalanceFiId}`\n : selectedFundingOptionId;\n const fiType =\n secondaryFundingOptionIds?.length > 0 && splitBalanceFiType\n ? `${get(selectedFundingOption, 'fundingInstrument.type')}, ${splitBalanceFiType}`\n : get(selectedFundingOption, 'fundingInstrument.type');\n const fiName = get(selectedFundingOption, 'fundingInstrument.name');\n const { fundingInstrument: { rewards } = {} } = selectedFundingOption || {};\n const chosenFundingOption = getFptiFundingOptionType(selectedFundingInstrument);\n const cryptocurrencyPayloadItems = isCryptoFundingInstrument(selectedFundingInstrument)\n ? {\n cart_show_amt: !shouldHideCart ? cartTotal?.amount : undefined,\n cart_show_curr: !shouldHideCart ? cartTotal?.currencyCode : undefined,\n asset_price_with_spread: cryptocurrencyQuote?.assetPrice?.currencyValue,\n asset_price_wo_spread: cryptocurrencyQuote?.assetPrice?.currencyValue,\n // Currently there are no fees for pay with crypto in checkout\n fixed_fee_amt: 0,\n fee_amt: 0,\n fulfil_amt: cartTotal?.amount,\n fulfil_qty: cryptocurrencyQuote?.quantity,\n asset_symbol: cryptocurrencyHoldingDetails?.symbol,\n order_fiat_amt: cartTotal?.amount,\n order_by: 'FIAT_VALUE',\n op_nm: 'crypto_sell_with_xo',\n }\n : {};\n\n logger.fpti(\n 'approvePayment',\n TRANSITION_PAYLOAD({\n from: 'REVIEW',\n to: 'process_review',\n int_err_code: errorCode,\n currency_code: currencyCode,\n buyer_country: getCountry(),\n set_sticky_fi_required: setStickyFiRequired,\n ...currencyConversionFpti({ selectedPlan, action: 'process_review' }),\n fi_id: fiId,\n fi_type: fiType,\n fi_name: fiName,\n chosen_funding_option: chosenFundingOption,\n funding_method_type: fundingMethodType,\n ...{\n shipping_id: selectedAddressId,\n preferrred_shipping_address: preferredShippingAddressId === selectedAddressId ? 1 : 0,\n },\n installment_option: selectedInstallmentOption ? selectedInstallmentOption.term : undefined,\n ...rewardsFpti(rewards, rewardsPayload?.rewardAmount),\n button_type: isGplOffer ? 'pay_in_four' : 'regular',\n entry_point: selectedTab,\n view_name: viewName,\n ...cryptocurrencyPayloadItems,\n })\n );\n logger.cal.transition(LOG_TRANSITIONS.PROCESS_REVIEW);\n if (!errorCode) {\n if (window.PAYPAL?.analytics?.instance) {\n window.PAYPAL.analytics.instance.recordClick({\n data: {\n page: 'main:xo:lite:hermione:member:review',\n link: 'process_review',\n fltk: getToken(),\n cust: userId,\n amt: currencyValue,\n ccpg: getCountry(),\n curr: currencyCode,\n chosen_funding_option: chosenFundingOption,\n },\n });\n }\n }\n}\n","import React, { useEffect } from 'react';\nimport { useQuery, useMutation } from '@apollo/react-hooks';\nimport { useCryptoQuoteContext } from '@paypalcorp/c3-context-providers';\nimport { usePayLaterContext, usePayContext } from '@/components/ContextProviders';\nimport { isCreditWithAdditionalData } from '@/lib/creditInstallmentsHelper';\n\nimport {\n logger,\n ERROR_PAYLOAD,\n GAC_PAYLOAD,\n REVIEW_CPA_PAYLOAD,\n TRANSITION_PAYLOAD,\n} from '@paypalcorp/c3-util-logger';\nimport { getCountry, getToken } from '@paypalcorp/c3-shared-globals';\nimport { isIframe } from '@paypalcorp/c3-util-browser';\nimport {\n updateFeature,\n getSelectedFundingSource,\n getDefaultSelectedFundingInstrument,\n isCryptoFundingInstrument,\n} from '@paypalcorp/c3-util-store';\nimport CheckoutError from '@/lib/checkoutError';\nimport { useViewName } from '@/lib/fpti';\nimport { isPaypalCreditFundingInstrument, params, isInstallmentCreditType } from '@/lib/utils';\nimport { fallback, redirectToLogin, returnToMerchantAfterApprove } from '@/lib/redirects';\nimport { contingencyResolver } from '@/lib/contingencyResolver';\nimport { getIsPayNowUserActionFlow } from '@/lib/userAction';\nimport getCreditCheckoutButtonData from '@/lib/creditButtonHelper';\nimport { checkRealTimeBalance } from '@/lib/fiBalance';\n\nimport { CHECKOUT_BUTTON_STATES } from './constants';\nimport { approvePaymentMutation } from './query.gql';\nimport {\n handleInsufficientBalanceError,\n isCryptoAbleToCoverTransaction,\n} from '@/components/Crypto';\nimport { approveSuggestedDonationMutation } from '@/components/GiveAtCheckout/Mutation/query.gql';\nimport { useButtonFeature, useIsButtonDisabled, useButtonLogging } from './hooks';\nimport {\n getPreAuthorizationRequired,\n getSecondaryFundingOptionIds,\n getButtonText,\n resolveContingencies,\n logApprovePayment,\n} from './utils';\nimport { Button } from '@paypalcorp/pp-react-buttons';\nimport {\n findInstallmentsInPlan,\n getSelectedInstallmentOption,\n installmentToInstallmentsInput,\n openSelectInstallmentsInterstitial,\n} from '@/components/Installments/utilities';\nimport { isBillingAgreement } from '@/lib/checkoutSession';\nimport { useCart } from '@/components/Cart/hooks';\nimport { mapCreditPPCOffer } from '@/components/CreditOffer/utils';\nimport { useOnClickCreditOffer } from '@/components/CreditOffer/hooks';\nimport { CHECKOUT_BUTTON_QUERY } from './query.gql';\nimport { SPLIT_TENDER_APPROVE_MUTATION } from '@/components/SplitTender/query.gql';\nimport { toNumber } from '@paypalcorp/c3-util-lang';\nimport {\n approvePaymentPrepare as logApprovePaymentPrepare,\n approvePaymentProcess as logApprovePaymentProcess,\n approvePaymentError as logApprovePaymentError,\n} from '@/components/SplitTender/logging';\nimport { getSplitOptionsAndBackup } from '@/components/SplitTender/utils';\nimport getContent from '@/lib/content';\nimport { creditPpcOffersGqlParams, clearCreditFinancingOption } from '@/lib/credit';\nimport { threeDsExperienceVars } from '@paypalcorp/c3-util-threed-ds';\nimport { useGplButtonTextOnFinalRyi } from '@/components/PayLater/Multi/hooks';\nimport { handleMultiOfferContinueButtonAction } from '@/components/PayLater/Multi/utils';\n\nexport default function CheckoutButton({ className }) {\n const { data } = useQuery(CHECKOUT_BUTTON_QUERY, {\n variables: {\n ...threeDsExperienceVars({ token: getToken() }),\n ...creditPpcOffersGqlParams(),\n },\n fetchPolicy: 'cache-only',\n });\n const {\n checkoutButtonLabelOverride,\n checkoutButtonStatus,\n checkoutSessionType,\n creditFinancingOption,\n creditOfferAsFI_DE,\n currencyCode,\n currencyValue,\n fundingOptions,\n giveAtCheckoutNonProfitId,\n giveAtCheckoutOpted,\n hasPPCreditInstallments,\n inContingencyFlow,\n inOpenBankingFlow,\n inClearCreditOptionFlow,\n installments,\n isDonation,\n isDonationEligible,\n isIncentivePresent,\n isOpenBankingEnabled,\n merchantName,\n paymentContingencies,\n preferredShippingAddressId,\n previousCheckoutButtonStatus,\n rewardsPayload,\n scaCompleted,\n selectedAddressId,\n shareAddressWithDonatee,\n splitTenderData,\n userAction,\n userId,\n validShippingMethod,\n } = useButtonFeature(data);\n const payLaterContext = usePayLaterContext();\n const payContext = usePayContext();\n const { getQuote } = useCryptoQuoteContext();\n const {\n balanceId,\n continueButtonAction,\n creditFIOption,\n preferredFundingOptionId,\n selectedFundingOptionId,\n selectedTab,\n usePayAfterDelivery,\n useSplitBalance,\n } = payContext.payState;\n const {\n selectedFundingOption,\n selectedPlan,\n defaultPreferredFi,\n hasGPLFundingInstrument,\n } = payContext;\n const selectedFundingInstrument = selectedFundingOption?.fundingInstrument;\n const billingAgreement = isBillingAgreement(checkoutSessionType);\n const isPayNowUserActionFlow = getIsPayNowUserActionFlow(userAction);\n const [isButtonDisabled, setIsButtonDisabled] = useIsButtonDisabled({\n // cache-only queries resolve immediately even if there's no data\n // so check for the presence of the data we are expecting instead\n loading: !Boolean(data?.checkoutSession),\n inContingencyFlow,\n });\n const isCryptoFI = isCryptoFundingInstrument(selectedFundingInstrument);\n const cryptocurrencyHoldingDetails = selectedFundingInstrument?.cryptocurrencyHoldingDetails;\n const isInstallmentsFeatureEnabled = installments.eligible && installments.enabled;\n const installmentsFeatureData = installments?.data;\n const availableInstallments = isInstallmentsFeatureEnabled\n ? findInstallmentsInPlan(selectedFundingOptionId, selectedPlan)\n : null;\n const selectedInstallmentOption = isInstallmentsFeatureEnabled\n ? getSelectedInstallmentOption(selectedFundingOptionId, installmentsFeatureData)\n : null;\n const viewName = useViewName();\n const { shouldHideCart, total: cartTotal } = useCart();\n const shouldUseGplButtonText = useGplButtonTextOnFinalRyi(creditFIOption);\n // We will attempt to get the crypto quote from context. It is possible that this\n // will fail and we will either get nothing, or an expired quote ID. In these cases we\n // should defer to approveMemberPayment for error handling.\n const cryptocurrencyQuote = isCryptoFI ? getQuote(cryptocurrencyHoldingDetails?.symbol) : null;\n\n useButtonLogging({\n checkoutSession: data?.checkoutSession,\n currencyCode,\n defaultPreferredFi,\n isButtonDisabled,\n isPayNowUserActionFlow,\n selectedFundingOption,\n selectedPlan,\n });\n\n const creditOffer =\n mapCreditPPCOffer({ creditPPCOffers: data?.checkoutSession?.creditPPCOffers }) || {};\n const { onClickCreditOffer } = useOnClickCreditOffer({\n creditOffer,\n });\n\n const { creditButtonText } = getCreditCheckoutButtonData({\n creditFIOption,\n creditOfferAsFI_DE,\n isPayNowUserActionFlow,\n payLaterContext,\n payContext,\n selectedFundingOptionId,\n shouldUseGplButtonText,\n creditOffer,\n });\n\n const [approvePayment] = useMutation(approvePaymentMutation, {\n variables: threeDsExperienceVars(),\n });\n\n const [approveDonation] = useMutation(approveSuggestedDonationMutation);\n const [approvePaymentSplitTender] = useMutation(SPLIT_TENDER_APPROVE_MUTATION);\n\n const handleGiveAtCheckout = () => {\n if (giveAtCheckoutOpted) {\n logger.fpti(\n 'GIVE_AT_CHECKOUT',\n GAC_PAYLOAD({ action: 'processGAC', gac_npid: giveAtCheckoutNonProfitId })\n );\n\n return approveDonation({ variables: { token: getToken() } })\n .then(() => logger.cal.info('APPROVE_SUGGESTED_DONATION_CALL_SUCCESS'))\n .catch((error) => logger.cal.error('APPROVE_SUGGESTED_DONATION_ERROR', error));\n }\n };\n\n function approveMemberPaymentSplitTender() {\n const {\n errorsOccurrenceCount = 0,\n splitFundingOptions: _splitFundingOptions = [],\n selectedSplitFundingInstruments = [],\n selectedBackupFundingInstrument,\n } = splitTenderData;\n const _types = {\n PAYPAL_BALANCE: 'BALANCE',\n CREDIT_CARD: 'CARD',\n BANK_ACCOUNT: 'BANK',\n PAYPAL_CREDIT: 'CREDIT',\n };\n\n if (!validShippingMethod) {\n return;\n }\n\n const instrumentsInSplit = getSplitOptionsAndBackup({\n splitFundingOptions: _splitFundingOptions,\n selectedSplitFundingInstruments,\n selectedBackupFundingInstrument,\n });\n\n const splitFundingOptions = instrumentsInSplit\n .filter((fundingOption) => {\n const { value } = fundingOption;\n return value !== null;\n })\n .map((instrument) => {\n const {\n value: currencyValue,\n fundingInstrument: { id, type },\n } = instrument;\n const fundingInstrumentType = _types[type] || type;\n const isPrimaryInstrument = selectedBackupFundingInstrument === id;\n return {\n fundingInstrumentType,\n id,\n amount: {\n currencyCode, // ! TODO - currently only USD is supported\n currencyValue: toNumber(currencyValue),\n },\n isPrimaryInstrument,\n };\n });\n logApprovePaymentPrepare(splitFundingOptions);\n\n // Clear any Split tender alert errors before users try to proceed to the merchant\n updateFeature('SPLIT_TENDER_GATE', {\n data: {\n showSplitTenderError: false,\n },\n });\n\n approvePaymentSplitTender({\n variables: {\n token: getToken(),\n splitFundingOptions,\n selectedAddressId,\n preferredShippingAddressId,\n },\n update: async (\n store,\n {\n data: {\n approveMemberPaymentWithSplitFundingOptions: approveMemberPaymentResultPayload,\n } = {},\n } = {}\n ) => {\n logApprovePaymentProcess(splitFundingOptions, currencyCode, getCountry(), {\n shipping_address_id: selectedAddressId,\n preferred_shipping_address: preferredShippingAddressId === selectedAddressId,\n });\n await handleGiveAtCheckout();\n returnToMerchantAfterApprove({\n approveMemberPaymentResultPayload,\n currencyCode, // TODO\n merchantName,\n });\n },\n }).catch((error) => {\n // The general `temporary` rule is that we're going to allow users to try submitting their order three times per session,\n // if for some reason all of the attempts resulted with an error, then we're going to disable the Split experience for now.\n // Note that this is a temporary solution since we do not know what all of the error types that PAPS returns are.\n updateFeature('SPLIT_TENDER_GATE', {\n data: {\n showSplitTenderError: true,\n errorsOccurrenceCount: errorsOccurrenceCount + 1,\n },\n });\n\n // ! TODO preAuthorizationRequired\n logApprovePaymentError(error);\n });\n }\n\n function approveMemberPayment({ isAutoResolved }) {\n const checkoutButtonStartTime = Date.now();\n\n const defaultSelectedFI = fundingOptions\n ? getDefaultSelectedFundingInstrument(fundingOptions)\n : {};\n const isDefaultFISelected = defaultSelectedFI?.id === selectedFundingOptionId;\n logger.fpti(\n 'reviewButtonClick',\n TRANSITION_PAYLOAD({\n from: 'REVIEW',\n to: 'process_review_click',\n is_default_fi_selected: isDefaultFISelected,\n fi_id: selectedFundingOptionId,\n })\n );\n\n // redirect to login if euat user chooses to pay with gpl or ppc\n if (payLaterContext?.isOfferSelected && params().euat) {\n return redirectToLogin('EUAT_LOGIN');\n }\n\n if (!selectedFundingOptionId && !payLaterContext?.isOfferSelected) {\n updateFeature('REVIEW_PAGE_ALERT', {\n visible: true,\n data: {\n type: 'info',\n display: true,\n message: getContent('paymentOptions.noSelectedFiErrorMessage'),\n },\n });\n\n // log that no option was selected when trying to continue\n logApprovePayment({\n currencyCode,\n errorCode: 'NO_SELECTED_OPTION',\n selectedFundingOption,\n selectedFundingOptionId,\n selectedInstallmentOption,\n selectedPlan,\n selectedTab,\n viewName,\n });\n\n return;\n }\n\n if ((isButtonDisabled && !isAutoResolved) || !validShippingMethod) {\n return;\n }\n\n const { fundingMethodType } = getSelectedFundingSource({\n fi: selectedFundingOption,\n plan: selectedPlan,\n });\n const shouldOpenInstallmentInterstitial =\n Array.isArray(availableInstallments) &&\n availableInstallments.length > 0 &&\n !Boolean(selectedInstallmentOption);\n\n const creditOfferType = creditOffer?.content?.OfferType;\n const shouldRedirectToCyco =\n (hasPPCreditInstallments || isInstallmentCreditType(creditOfferType)) &&\n creditFinancingOption?.creditType === undefined &&\n isPaypalCreditFundingInstrument(selectedFundingOption);\n\n const { name: fiName = '', type: fiType = '' } = selectedFundingOption?.fundingInstrument || {};\n const setStickyFiRequired = !isCreditWithAdditionalData(fiName, fiType);\n\n // If we are attempting to approve payment with a crypto funding instrument\n // we must first check if the instrument has enough currency to cover the txn.\n // If not we should show a error message and prevent continuing\n if (\n isCryptoFI &&\n !isCryptoAbleToCoverTransaction(cryptocurrencyHoldingDetails, cryptocurrencyQuote)\n ) {\n logger.cal.info('CRYPTO_ERROR_LESS_BALANCE');\n\n handleInsufficientBalanceError();\n\n return;\n }\n\n if (payLaterContext.isPpcOfferAcq) {\n return payLaterContext.processPpcOffer();\n }\n\n if (shouldRedirectToCyco) {\n return onClickCreditOffer();\n }\n\n if (payLaterContext.isGplOffer && continueButtonAction) {\n return continueButtonAction();\n }\n\n // For LATAM installments if we have not selected an installment term for\n // the selected FI we need to redirect the user to the select installment\n // interstitial instead of approving the payment.\n if (isInstallmentsFeatureEnabled && shouldOpenInstallmentInterstitial) {\n logger.cal.info(\n `INSTALLMENTS_OPEN_INTERSTITIAL_FROM_CHECKOUT_BUTTON_${getCountry()}_${currencyCode}`\n );\n\n openSelectInstallmentsInterstitial({\n availableInstallments: availableInstallments,\n fId: selectedFundingOptionId,\n isInstallmentSelected: false,\n selectedInstallmentMap: installmentsFeatureData?.selectedInstallmentMap,\n });\n\n return;\n }\n\n const { contingencyFlow, contingencyLogger } = contingencyResolver({\n currencyCode,\n paymentContingencies,\n selectedFundingOption,\n selectedFundingOptionId,\n creditFinancingOption,\n inClearCreditOptionFlow,\n hasGPLFundingInstrument,\n });\n\n if (isIframe() && contingencyFlow === 'OPEN_BANKING') {\n return fallback({ reason: 'moneynodewebRedirection' });\n }\n\n const preAuthorizationRequired = getPreAuthorizationRequired(\n rewardsPayload,\n selectedPlan.preAuthorizationData,\n isPayNowUserActionFlow\n );\n\n // This criteria applies when a multi-installment GPL offer has been approved\n // and the \"change\" link is clicked from the specialized RYI.\n if (payLaterContext.isGplOffer && hasGPLFundingInstrument) {\n return handleMultiOfferContinueButtonAction(payLaterContext, selectedAddressId);\n }\n\n // We should probably be using contingencyFlow here instead 🤔\n // We should launchCap when the GPL offer is selected and the Credit FI option is selected\n // to make sure CAP is not launched when GPL FI is selected on return/specialized RYI page\n if (payLaterContext.isGplOffer) {\n logger.cal.info(`CAP_CPL_START_TIME:`, `Checkout button click timestamp ${checkoutButtonStartTime}`);\n updateFeature('CREDIT_APPLY_PORTABLE', {\n visible: false,\n data: { checkoutButtonStartTime },\n });\n return payLaterContext.processGplOffer(selectedAddressId);\n }\n\n // Enable the Checkout button if all contingencies are resolved\n if (!contingencyFlow) {\n updateFeature('CHECKOUT_BUTTON', { data: { inContingencyFlow: false } });\n }\n\n const secondaryFundingOptionIds = getSecondaryFundingOptionIds(\n fundingOptions,\n isIncentivePresent,\n selectedPlan,\n useSplitBalance,\n balanceId\n );\n\n // Resolve any payment related contingency before triggering the `approvePayment` mutation\n // Note: when contingency flow is in Open Banking but Elmo is accidentally ramped to CONTROL\n // Open Banking interstitial will be disabled based on the Elmo settings\n // In that case we shall not proceed with Open Banking flow\n // but try to proceed with transaction directly even it may throw errors\n if (\n checkoutButtonStatus !== CHECKOUT_BUTTON_STATES.PENDING &&\n contingencyFlow &&\n !(contingencyFlow === 'OPEN_BANKING' && !isOpenBankingEnabled)\n ) {\n // Trigger fpti event\n contingencyLogger();\n\n // NEED_RTB - Need Real Time Balance Check for OpenBanking flow\n if (contingencyFlow === 'NEED_RTB') {\n return checkRealTimeBalance(selectedFundingOptionId);\n }\n\n if (contingencyFlow === 'CLEAR_CREDIT_OPTION') {\n return clearCreditFinancingOption();\n }\n\n resolveContingencies(contingencyFlow, {\n fundingMethodType,\n preAuthorizationRequired,\n preferredFundingOptionId,\n secondaryFundingOptionIds,\n selectedAddressId,\n selectedFundingOptionId,\n });\n\n return;\n }\n\n logApprovePayment({\n cartTotal,\n cryptocurrencyQuote,\n cryptocurrencyHoldingDetails,\n currencyCode,\n currencyValue,\n fundingMethodType,\n isDonationEligible,\n isGplOffer: payLaterContext.isGplOffer,\n preferredShippingAddressId,\n rewardsPayload,\n secondaryFundingOptionIds,\n selectedAddressId,\n selectedFundingOption,\n selectedFundingOptionId,\n selectedInstallmentOption,\n selectedPlan,\n selectedTab,\n setStickyFiRequired,\n shareAddressWithDonatee,\n shouldHideCart,\n userId,\n viewName,\n });\n\n const approvePaymentVariables = {\n token: getToken(),\n selectedAddressId,\n preferredShippingAddressId,\n preferredFundingOptionId,\n selectedFundingOptionId,\n secondaryFundingOptionIds,\n preAuthorizationRequired,\n fundingMethodType,\n scaCompleted,\n rewards: rewardsPayload.rewardSelected\n ? {\n id: rewardsPayload.rewardSelected,\n amount: `${parseFloat(rewardsPayload.rewardAmount)}`,\n currency: currencyCode,\n }\n : undefined,\n selectedInstallmentOption: selectedInstallmentOption\n ? installmentToInstallmentsInput(selectedInstallmentOption)\n : undefined,\n shareAddressWithDonatee: isDonationEligible ? shareAddressWithDonatee : undefined,\n setStickyFiRequired,\n cryptocurrencyQuoteId: isCryptoFI ? cryptocurrencyQuote?.id : undefined,\n };\n\n logger.cal.info('PREPARE_APPROVE_PAYMENT_MUTATION', {\n variables: {\n ...approvePaymentVariables,\n },\n });\n\n approvePayment({\n variables: approvePaymentVariables,\n update: async (\n store,\n { data: { approveMemberPayment: approveMemberPaymentResult } = {} } = {}\n ) => {\n const { buyer: { userId } = {}, paymentContingencies = {}, state: paymentState } =\n approveMemberPaymentResult || {};\n\n // don't disable submit button so users can still click continue if there are any\n // payment related contingencies returned from `approvePayment()` mutation\n const hasPaymentContingencies = [\n 'confirmCreditCardCvvData',\n 'threeDomainSecure', // 3DS (1.0) transactional contingency\n 'threeDSContingencyData', // 3DS (2.0) transactional contingency\n 'sepaMandateAcceptanceNeeded',\n 'needConsentForBankAccountInfoRetrieval',\n 'needRealTimeBalanceForBankAccount',\n 'strongCustomerAuthenticationRequired',\n ].some((contingency) => Boolean(paymentContingencies[contingency]));\n setIsButtonDisabled(!hasPaymentContingencies);\n\n // Check paymentContingencies based on success mutation\n const { contingencyFlow, contingencyLogger } = contingencyResolver({\n currencyCode,\n paymentContingencies,\n selectedFundingOption,\n selectedFundingOptionId,\n creditFinancingOption,\n inClearCreditOptionFlow,\n hasGPLFundingInstrument,\n });\n\n // if `approvePayment()` mutation returns any checkoutSession related paymentContingencies\n // such as cvv or 3DS we will handle it here\n if (checkoutButtonStatus !== CHECKOUT_BUTTON_STATES.PENDING && contingencyFlow) {\n // Trigger fpti event\n contingencyLogger();\n\n // when User Changed the FI which has NEED_RTB contingency\n // Need to trigger Real Time Balance Check for OpenBanking flow\n if (contingencyFlow === 'NEED_RTB') {\n return checkRealTimeBalance(selectedFundingOptionId);\n }\n\n return resolveContingencies(contingencyFlow, {\n fundingMethodType,\n preAuthorizationRequired,\n preferredFundingOptionId,\n secondaryFundingOptionIds,\n selectedAddressId,\n selectedFundingOptionId,\n });\n }\n\n // NOTE: this is where we check unknown contingencies that hermione client\n // can't handle & we will fallback to hermesnodeweb to continue\n if (paymentState === 'NON_PAYABLE') {\n logger.fpti(`approvePaymentError`, ERROR_PAYLOAD({ code: 'GQLError' }));\n return CheckoutError({ error: new Error('APPROVE_FAILED_NON_PAYABLE') });\n }\n\n if (preAuthorizationRequired) {\n logger.fpti(\n 'CPA_REVIEW',\n REVIEW_CPA_PAYLOAD({\n action: 'processPreAuth',\n client_epoch_ts: Date.now(),\n buyer_id: userId,\n })\n );\n }\n\n await handleGiveAtCheckout();\n\n if (!contingencyFlow) {\n if (approveMemberPaymentResult.completedPaymentInfo) {\n updateFeature('WPS_DONE_PAGE', {\n visible: true,\n });\n return;\n }\n returnToMerchantAfterApprove({\n approveMemberPaymentResultPayload: approveMemberPaymentResult,\n currencyCode,\n merchantName,\n });\n }\n },\n }).catch((error) => {\n if (preAuthorizationRequired) {\n logger.fpti(\n 'CPA_REVIEW',\n REVIEW_CPA_PAYLOAD({\n action: 'processPreAuth',\n client_epoch_ts: Date.now(),\n })\n );\n }\n\n logger.fpti(`approvePaymentError`, ERROR_PAYLOAD({ code: 'GQLError' }));\n });\n }\n\n // Automatically resume to to `approvePayment()` mutation when there are\n // no more payment related contingencies need to be handled\n useEffect(() => {\n if (\n selectedFundingOptionId &&\n checkoutButtonStatus === CHECKOUT_BUTTON_STATES.RESOLVED &&\n (checkoutButtonStatus !== previousCheckoutButtonStatus || inOpenBankingFlow)\n ) {\n if (inOpenBankingFlow) {\n updateFeature('CHECKOUT_BUTTON', { data: { flow: null } });\n }\n const { fundingMethodType } = getSelectedFundingSource({\n fi: selectedFundingOption,\n plan: selectedPlan,\n });\n if (fundingMethodType === 'ECHECK') {\n logger.fpti(\n 'reviewECheck',\n TRANSITION_PAYLOAD({\n from: 'REVIEW',\n to: 'process_review_echeck',\n fi_id: selectedFundingOptionId,\n })\n );\n } else {\n approveMemberPayment({ isAutoResolved: true });\n }\n }\n // ? we don't necessarily need to depend on `approveMemberPayment` changing\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [\n checkoutButtonStatus,\n inOpenBankingFlow,\n previousCheckoutButtonStatus,\n selectedFundingOptionId,\n ]);\n\n const buttonText = getButtonText({\n availableInstallments,\n billingAgreement,\n checkoutButtonLabelOverride,\n creditButtonText,\n creditOfferAsFI_DE,\n isDonation,\n isPayNowUserActionFlow,\n selectedFundingOption,\n selectedInstallmentOption,\n usePayAfterDelivery,\n });\n\n return (\n \n {buttonText}\n \n );\n}\n","import get from 'dlv';\nimport { isInstallmentCreditType } from '@/lib/utils';\nimport { isPaypalCreditFundingInstrument } from '@/lib/utils';\nimport getContent from '@/lib/content';\n\nexport default function getCreditCheckoutButtonData({\n creditOfferAsFI_DE = {},\n creditFIOption,\n isPayNowUserActionFlow,\n selectedFundingOptionId,\n payLaterContext,\n payContext,\n creditOffer,\n shouldUseGplButtonText,\n}) {\n const isPpcFi = isPaypalCreditFundingInstrument(payContext.selectedFundingOption);\n const isPpcReuse = payContext?.payState?.isPPCReuse;\n const isInstallment = isInstallmentCreditType(creditOffer?.content?.OfferType);\n \n if (payLaterContext.payLaterState.checkoutButtonText) {\n return {\n creditButtonText: payLaterContext.payLaterState.checkoutButtonText,\n };\n } else if (shouldUseGplButtonText) {\n return {\n creditButtonText:\n creditFIOption?.fundingInstrument?.creditFields?.creditOffer?.uiElements?.creditFI\n ?.payButtonText,\n };\n } else if (\n selectedFundingOptionId === get(creditFIOption, 'id', -1) &&\n creditFIOption.fundingInstrument.creditFields !== null\n ) {\n return {\n creditButtonText: isPayNowUserActionFlow\n ? creditFIOption.fundingInstrument.creditFields.creditOffer.uiElements.creditFI\n .payButtonText\n : creditFIOption.fundingInstrument.creditFields.creditOffer.uiElements.creditFI\n .continueButtonText,\n };\n } else if (get(creditOfferAsFI_DE, 'data.isSelected')) {\n return {\n creditButtonText: get(creditOfferAsFI_DE, 'data.continueButtonText'),\n };\n } else if (isPpcFi && isPpcReuse && isInstallment) {\n return {\n creditButtonText: getContent('checkoutButton.continue'),\n };\n }\n return {\n creditButtonText: '',\n };\n}\n","import { updateFeature } from '@paypalcorp/c3-util-store';\n\n/**\n * Method created to reset split tender related data\n */\nexport const resetSplitTenderData = () => {\n updateFeature('SPLIT_TENDER_GATE', {\n data: {\n userCanSplit: false,\n isSplitReady: false,\n showSplitContinue: false,\n showSplitExperience: false,\n selectedBackupFundingInstrument: undefined,\n selectedSplitFundingInstruments: undefined,\n },\n });\n};\n\n/**\n * Method responsible for returning a list of fi ids that a elegible\n * for being a backup/primary fi.\n */\nexport const getEligibleForPrimaryFiIdList = (splitFundingOptions) => {\n return splitFundingOptions\n .filter((fundingOption) => fundingOption.isEligibleForPrimaryInstrument)\n .map((fundingOption) => fundingOption.id);\n};\n\nexport const isSplitTenderActive = (SplitTenderGate) => {\n return SplitTenderGate?.experiment?.resolvedTreatment === 'TREATMENT_1';\n};\n\nexport const getSplitOptionsAndBackup = ({\n splitFundingOptions,\n selectedSplitFundingInstruments,\n selectedBackupFundingInstrument,\n}) => {\n const backupIsOneOfSelected = !!selectedSplitFundingInstruments.find(\n ({ id }) => id === selectedBackupFundingInstrument\n );\n\n if (backupIsOneOfSelected) {\n return selectedSplitFundingInstruments;\n }\n\n const backupFi = splitFundingOptions.find(({ id }) => id === selectedBackupFundingInstrument);\n\n if (!backupFi) {\n // This should never happen.\n return selectedSplitFundingInstruments;\n }\n\n return [...selectedSplitFundingInstruments, { ...backupFi, value: 0 }];\n};\n"],"sourceRoot":""}