{"version":3,"sources":["lib/fraudNet.js","shared/components/SpinnerOverlay/styles.css","lib/content.js","shared/components/Spinner/styles.css","lib/cplUtils.js","shared/components/EmptyLoader/index.js","components/Feature/index.js","components/CheckoutButton/constants.js","authStates.js","shared/components/Spinner/index.js","shared/components/SpinnerOverlay/index.js","components/Disclaimer/CPADisclaimer/query.gql.js","lib/utils.js","components/SharedCard/constants.js","lib/apolloCache.js","lib/invalidateCheckoutSessionPlan.js","lib/preRenderSteps.js","AppBootstrap.js","AppIndex.js","lib/fiBalance/checkFIBalance.js","lib/fiBalance/index.js","lib/configureApolloClient.js","features.js","components/Spinner/ReturnToMerchantSpinner/index.js","components/Feature/FeatureContainer.js","components/Feature/AnimatedContainer.js","lib/windowEligibility.js","App.js","components/ErrorBoundary/ErrorBoundary.js","components/ErrorBoundary/index.js","polyfills.js","lib/redirects.js","index.js","preInit.js","App.global.css","components/Spinner/DefaultSpinner/index.js","components/Spinner/index.js","lib/lazyLoad.js","components/Feature/hooks.js","lib/contingencies.js","lib/apolloLinks/spinnerLink.js","lib/apolloLinks/instrumentationLink.js","lib/apolloLinks/authLink.js","lib/checkoutError.js"],"names":["APP_NAME","getClientMetadataID","defaultID","urlParams","params","window","xprops","clientMetadataID","initFraudNet","token","getToken","fraudNetEndpoint","deployEnv","fraudNetConfig","userToken","sourceId","endpoint","addCrossOrigin","production","typingSpeed","delegate","fields","id","min","type","fraudNet","logger","cal","info","e","message","module","exports","IGNORE_MISSING_CONTENT_KEYS","shouldIgnoreLoggingMissingContentKeys","key","find","ignoreKey","test","args","result","i18n","apply","String","replace","getCountry","getLocale","PAGE","REVIEW","ECONSENT","ADD_FI","ADD_SHIPPING_ADDRESS","_store","triggerInitialCPLEvent","hasContingencies","triggerCPLLatencyMetricsFPTI","page","timeToInteract","logCPLPhase","cplPhases","comp","rest","query","chunk","serverSideCplMetrics","getGlobals","forEach","toLowerCase","start","tt","populateServerSideCplMetrics","visibilityEvents","hidden","visible","Date","now","timeTaken","populateVisibilityMetrics","cplLatencyMetrics","state_name","transition_name","page_name","cpl_comp_metrics","JSON","stringify","cpl_query_metrics","cpl_chunk_metrics","total_page_load_time","fpti","updateTriggerInitialCPLEvent","state","shouldTriggerInitialCPLEvent","updateHasContingencies","getTimeToInteract","cpl","logPerformance","action","uicomp","uitype","EmptyLoader","resolveWrappedComponentByExperiment","wrappedComponent","experimentResult","prop","mapContingencies","contingencies","reduce","map","obj","data","mapFeature","feature","mapFeatures","features","mapQueriesData","queries","Object","keys","nullToUndefined","push","getQueriesByFetchPolicy","fetchPolicy","negation","filter","q","resolveLazyFeatureComponent","WrappedComponent","finalData","LoadingComponent","ErrorComponent","country","Feature","FeatureComponents","ResolvedWrappedComponent","isObject","experiment","getResolvedTreatment","wrappersByExperiment","experiments","wrappersByCountry","countrySpecific","countrySpecificWrapper","resolveWrappedComponent","lazyComponent","loading","error","config","interstitialOptions","interstitial","shouldAutoDisplayComponent","shouldLoadFeatureComponent","shouldLoadFeatureInstance","withoutLoadingState","subscribeTo","animateOptions","shouldKeepLoadingStateOnError","subscribeToContingencies","Composed","props","cacheOnlyGqlQueries","cacheOnlyGqlQueryResult","useGqlNetworkQuery","featuresQueryResult","mapFeaturesQueryResult","useFeatureQuery","f","getFeatureById","contingenciesQueryResult","contingency","indexOf","mapContingenciesQueryResult","useContingencyQuery","networkGqlQueries","networkGqlQueryResult","skip","enabled","queriesResult","isGqlLoading","some","getIsGqlQueriesLoading","isGqlDataResolved","length","isUndefined","getIsGqlDataResolved","hasError","getIsGqlHasError","getShouldLoadLoadingComponent","allQueryData","customProps","shouldLoadFeature","isFunction","Boolean","getShouldLoadFeatureComponent","autoDisplay","isControl","getShouldAutoDisplayComponent","disableInitialCPLEvent","shouldLoadInstance","getShouldLoadFeatureInstance","onBeforeCloseFn","showCloseBtnFunc","showCloseBtn","headerTitleFunc","headerTitle","typeFunc","resolveInterstitialOptions","FeatureComponent","FeatureContainer","render","this","React","PureComponent","getIsRememberedAuthState","getAuthState","getIsUserOneTouchLogin","getClaims","includes","getIsUserSkipFacebookLogin","code","getIsUserDeviceTokenImplicitLogin","Spinner","className","styles","SpinnerImage","SpinnerLoader","SpinnerOverlay","children","extraMessage","data-testid","tabIndex","role","cx","SpinnerMessage","SpinnerContent","CPA_DISCLAIMER_QUERY","definitions","names","definition","kind","name","value","FundingOptionFragment","isIframe","_isViewportSmall","_getDeviceAndNetworkInfo","_isIframe","isPopup","_isPopup","_resetParams","_params","isIncontext","isLegacyIncontext","isNewIncontext","postToMerchantForOldIncontext","msg","flush","opener","navigator","userAgent","match","postMessage","bridge","frames","PayPalBridge","returnToParent","err","stack","toString","warn","isVzeroIntegration","incontext","nolegacy","setDestination","featureId","BrowserStorage","set","clearDestination","remove","isDestination","destination","memoized","storageDestination","get","split","destFeatureId","reset","getProtocolType","url","urlType","deepLinkRegex","RegExp","nonStandardRegex","standardRegex","relativePathRegex","isDeepLink","isNonStandard","isStandard","isRelativePath","isInstallmentCreditType","creditOfferType","isPaypalCreditFundingInstrument","selectedFundingOption","fundingInstrument","getCreditFundingInstrument","fundingOptions","item","getGplOffer","creditAsFIOffers","offer","product","presentmentType","gplAmountDueTodayDetails","installmentsSchedules","gplAmountDueToday","downPayment","installmentsSchedule","paymentType","totalPayment","dueDate","getContent","SHARED_CARD_CONTINGENCIES","apolloInMemoryCache","options","InMemoryCache","dataIdFromObject","object","__typename","addressId","defaultDataIdFromObject","INVALIDATE_CHECKOUT_SESSION_PLAN_MUTATION","invalidateCheckoutSessionPlanIfNeeded","invalidateCheckoutSessionPlan","client","getClient","mutate","mutation","variables","catch","Promise","resolve","executePreRenderSteps","getIsResolveThreeDS","initAppQuery","AppBootstrap","ready","componentDidMount","then","formFactor","logPerformanceNow","integrationType","windowName","networkAndDeviceData","getDeviceAndNetworkInfo","appPerformanceEvents","paypal","allowIframe","top","location","href","redirectGenericError","setTimeout","accessToken","newAccessToken","globals","user","updateGlobals","access_token","getAccessToken","onAuth","checkFIBalanceStep","transition","LOG_TRANSITIONS","BOOTSTRAP","setState","checkoutSession","cancelUrl","cartTotal","merchantId","onInit","operation","landingUrl","initIncontextFromData","currencyCode","currencyValue","mrid","curr","amt","attachPaJsFpti","TRANSACTION_DETAILS","Component","nonce","AppIndex","createCache","stylisPlugins","getDirectionality","stylisRTL","App","CLEAR_REAL_TIME_BALANCE_CONTINGENCY","PaymentContingenciesFragment","checkRealTimeBalance","bankId","threeDsExperienceVars","context","skipFallback","checkFIBalance","updateFeature","clearRealTimeBalanceContingency","hasFI","fi","status","CHECKOUT_BUTTON_STATES","RESOLVED","flow","blackListedFI","createClient","queryEndpoint","auth","enableBatching","enableRetry","cache","mockLink","schemaLink","setFeatures","continueButtonAction","undefined","creditFIOption","forceRadioButton","preferredFundingOptionId","selectedFundingOptionId","usePayAfterDelivery","useSplitBalance","isEnabledForCountry","ElmoExperiment","initWithDefaultTreatment","rewardAmount","rewardCurrency","rewardSelected","TREATMENTS","TREATMENT_1","updateCardNotification","address","card","display","getCredit","isCreditSecondButton","SPINNER_TYPES","DEFAULT","checkoutButtonLabelOverride","inContingencyFlow","showDescriptor","creditOfferLabel","continueButtonText","isChangeShippingLinkClicked","userSelectedAddressId","toggle","shareAddressWithDonatee","IS_STICKY_ENABLED","selected","normalizedAddress","originalAddress","giveAtCheckoutOpted","giveAtCheckoutNonProfitId","landingPage","treatments","isCapOpen","selectedCRCOfferID","isGPLFi","bankData","hideDeclineNotification","addBankAsDebit","isSplitReady","userCanSplit","showSplitContinue","showSplitExperience","isNewCard","fundingInstrumentId","phone","number","countryCode","eConsentTriggerRefresh","acknowledged","fundingInstrumentIdToSelect","euat","hash","substr","headers","httpLink","createHttpLink","uri","credentials","batchLink","BatchHttpLink","planningBatchLink","splitLink","getContext","planningBatch","errorLink","onError","desc","graphQLErrors","networkError","response","operationName","forward","errorCodes","Set","statusCode","Array","from","join","HANDLED_CONTINGENCIES","getIsLinkAndPay","isContingency","contingencyCode","errorData","updateContingency","resolution","process","ERROR_PAYLOAD","source","currency_code","newUser","GLOBAL_CONTINGENCIES_HANDLERS","CheckoutError","redirectToLogin","retryLink","RetryLink","delay","initial","max","jitter","attempts","count","skipRetry","batching","retry","apolloCache","apolloClient","ApolloClient","link","apolloLinks","instrumentationLink","spinnerLink","authLink","ApolloLink","getLinks","resolvers","writeData","defaultApolloCacheState","setClient","ReturnToMerchantSpinner","TREATMENT_2","TREATMENT_3","LazyInterstitialContainer","prevProps","propValue","eligible","logExperiment","eligibility","setEnablement","shouldLoadFeaturePayload","onShouldLoadFeatureChange","autoDisplayPayload","onAutoDisplayChange","setEnablementPayload","payload","componentDidUpdate","prevState","snapshot","callOnPropChange","renderWrappedComponent","isLoading","renderInterstitial","renderWithAnimateHeight","animateOpacity","animateContainerClass","animateHeight","Fragment","AnimatedContainer","attributes","useState","shouldRender","setRender","useEffect","duration","isTesting","height","style","overflow","onAnimationEnd","windowEligible","reason","eligibleForHermione","incontextUnsupportedMessenger","experience","messenger","isPartnerIntegration","isCreditApplyReturnFlow","success","isSkipFacebookLoginFlow","isNewContext","isLegacyContext","ppFrameRedirect","btQueryParams","bt_int_type","webview","isWebView","eligibility_reason","windowEligibility","Hermione","ThreeDSFullPageApp","LinkPayApp","hot","ErrorBoundary","Element","prototype","matches","msMatchesSelector","webkitMatchesSelector","closest","s","el","document","documentElement","contains","parentElement","parentNode","nodeType","setPrototypeOf","__proto__","tslib","require","hoistNonReactStatics","__extends","target","Number","isNaN","getIntegrationPayload","sdkMeta","xComponent","xcomponent","BLACKLISTED_REDIRECT_QUERY_PARAMS","flushLogsAndRedirect","redirect","logName","logPayload","doRedirect","redirected","mapCheckoutJsContext","returnUrl","billingToken","intent","orderID","payerID","userId","paymentToken","paymentID","paymentId","returnCancel","merchantName","errorCode","native_xo","reconstructReturnUrl","RETURN_PAYLOAD","onCancel","updateParent","returnToMerchantAfterApprove","approveMemberPaymentResultPayload","buyer","cart","RETURN_TO_MERCHANT","updatedReturnUrl","onAuthorize","vzero","getConnectURL","connectURL","assign","spinnerType","rejectOnTimeout","payment_id","return_url","updated_return_url","merchant_name","returnAuthorize","queryParams","btoa","cancelLink","genericErrorUrl","buildURL","paramKeys","blacklistedKey","redirectToOpenBanking","encryptedId","openBankingUrl","paypalRedirect","windowOpen","redirectToNegativeBalanceRecovery","negativeBalanceRecoveryUrl","negativeBalanceRecoveryEndpoint","ctx","ulClientRedirect","ulAsLandingUrl","pathname","redirectToLogout","extraParams","logoutUrl","redirectedToAuthChallenge","redirectToAuthChallenge","stepupContext","lite","atoSuccess","returnUri","authEndPoint","authNodeWebEndpoint","authchallengeEndpoint","authChallengeUrl","redirectToRiskyLogin","baseUrl","host","hashUrl","defaultRemoved","hermesUrl","blacklistRegex","reject","isUnsafeRedirect","Error","inputUrl","open","fallback","previousParams","previousQueryString","newParams","fallbackUrl","isVzero","redirectUri","redirect_uri","fromNative","invalidIntegrationType","native","payer_id","opType","return_uri","finalReturnUrl","reconstruct_return_url","redirectOnThreeDSFailed","originApp","threeDSFailed","THREE_DS_PAYLOAD","redirectUrl","redirectToSameLocationWithNewParam","newUrl","__webpack_nonce__","MockedMode","lazy","INIT","initialData","initGlobals","content","ecToken","initContent","init","loggerEndpoint","externalName","internalName","experienceName","context_type","common","integration_type","configureApolloClient","MockedModeLoader","Application","ReactDOM","getIsMockedMode","Suspense","getElementById","startApp","settings","debug","DefaultSpinner","contentKey","SpinnerPortal","createPortal","body","SpinnerComponent","THREE_DS_PROCESSING","PROCESS_CARD","PROCESS_INCENTIVE","useFeature","lazyLoadChunkWithRetry","fn","retriesLeft","interval","console","reload","dynamicImport","LoaderComponent","LazyComponent","forwardRef","ref","idx","getOperationName","useQuery","errorPolicy","getSingleFeatureQuery","getContingenciesQuery","useContingency","VERIFY_USER_IDENTITY","step_up_context","PAYER_ACTION_REQUIRED","cause","resolutionName","PAYER_AUTHENTICATION_REQUIRED","fromLite","ulClientKey","LINK_AND_PAY_TOKENS_MISMATCH","hermes","PAYER_INVALID_FOR_PAYMENT","TRANSACTION_REFUSED","operationType","getOperationType","THREE_DS_START","THREE_DS_PROCESS","THREEE_DS_END","triggerToggleSpinner","Observable","observer","subscription","subscribe","next","complete","bind","unsubscribe","logFlushed","payloadResolvers","is_gambling","addToPayload","TRANSITION_PAYLOAD","to","logPayloadIfReady","k","resolveAndLog","resolvedValue","request","setContext","prevContext","oldAccessToken","LOG_PREFIX","attemptRedirect","fallbackSettings","getFallback","fallbackTriggered","redirectOnError","checkoutError","parsedError","details","parseError","timestamp"],"mappings":"4FAAA,sGAKMA,EAAW,gCAEJC,EAAsB,SAACC,GAClC,IAAMC,EAAYC,mBAElB,OAAIC,OAAOC,QAAUD,OAAOC,OAAOC,iBAC1BF,OAAOC,OAAOC,iBACZJ,EAAU,sBACZA,EAAU,sBAEVD,GAIEM,EAAe,SAAC,GAAmE,IAAD,aAAP,GAAO,MAAhEC,aAAgE,MAAxDC,cAAwD,EAA5CC,EAA4C,EAA5CA,iBAA4C,IAA1BC,UAC7DC,EAAiB,CACrBC,UAAWL,EACXM,SAAUf,EACVgB,SAAUL,EACVM,qBAL2F,MAAd,GAAc,GAKjEC,WAC1BC,YAAa,CAKXC,UAAU,EASVC,OAAQ,CAEN,CAAEC,GAAI,UAAWC,IAAK,GACtB,CAAED,GAAI,cAAeC,IAAK,GAC1B,CAAED,GAAI,aAAcC,IAAK,GACzB,CAAED,GAAI,aAAcC,IAAK,GACzB,CAAED,GAAI,kBAAmBC,IAAK,KAGhCC,KAAMxB,IAMV,IAEEyB,YAASZ,GACTa,SAAOC,IAAIC,KAAK,gBAAiBf,GACjC,MAAOgB,GACPH,SAAOC,IAAIC,KAAK,wBAAyB,CAAEE,QAASD,GAAKA,EAAEC,a,oBC1D/DC,EAAOC,QAAU,CAAC,eAAiB,sCAAsC,eAAiB,sCAAsC,eAAiB,sCAAsC,eAAiB,sCAAsC,eAAiB,sCAAsC,eAAiB,wC,oECIhTC,EAA8B,CAAC,kBAE/BC,EAAwC,SAACC,GAAD,OAC5CF,EAA4BG,MAAK,SAACC,GAAD,OAAeA,EAAUC,KAAK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AW,IAAD,EACYA,GAAS,GAAzCkW,EADoB,EACpBA,cAAeC,EADK,EACLA,aACvB,OAAID,GAAiBA,EAAc9T,OAC1B,CACLvJ,QAAyC,MAAhCqd,EAAc,GAAGO,WAAjB,4BACTA,WAAYP,EAAc,GAAGO,WAC7B4V,QAASnW,EAAcxY,KAAI,qBAAG7E,WAAuB6O,YAGrDyO,EACK,CACLtd,QAAQ,kBACR4d,WAAYN,EAAaM,WACzB4V,QAASlW,EAAatd,SAGtBmH,aAAiBokB,MACZ,CACLvrB,QAASmH,EAAMnH,QACfwzB,QAASrsB,EAAMyH,OAIZ,CAAE5O,QAAQ,gBAuBKyzB,CAAWtsB,GAC/BmsB,EAActzB,QAAUuzB,EAAYvzB,QACpCszB,EAAcE,QAAUD,EAAYC,QAGtC,IAAIxV,IAAsBtS,SAAS4nB,EAAcE,SAAjD,CAIA,IAAMvQ,EAASqQ,EAActzB,QAEnBwtB,EACNrrB,cADF2S,KAAQ0Y,QAGV5tB,SAAOC,IAAIsH,MAAX,kBAAmC8b,EAAnC,iBACKqQ,EADL,CAEEI,UAAW9wB,KAAKC,MAChBlE,MAAO6uB,KAGTyF,EAAgBhQ,Q","file":"js/main~06837ae4.f0163706.js","sourcesContent":["import { fraudNet } from '@paypalcorp/c3-init-fraudnet';\nimport { logger } from '@paypalcorp/c3-util-logger';\nimport { getToken } from '@paypalcorp/c3-shared-globals';\nimport { params } from '@paypalcorp/c3-util-browser';\n\nconst APP_NAME = 'CHECKOUTUINODEWEB_MEMBER_LITE';\n\nexport const getClientMetadataID = (defaultID) => {\n const urlParams = params();\n\n if (window.xprops && window.xprops.clientMetadataID) {\n return window.xprops.clientMetadataID;\n } else if (urlParams['client-metadata-id']) {\n return urlParams['client-metadata-id'];\n } else {\n return defaultID;\n }\n};\n\nexport const initFraudNet = ({ token = getToken(), fraudNetEndpoint, deployEnv = {} } = {}) => {\n const fraudNetConfig = {\n userToken: token,\n sourceId: APP_NAME,\n endpoint: fraudNetEndpoint,\n addCrossOrigin: deployEnv.production,\n typingSpeed: {\n /**\n * Allows for FraudNet to track dynamically rendered fields by delegating the event listener\n * to the body instead of attaching it to individual field.\n */\n delegate: true,\n\n /**\n * List of required fields that can be rendered. This list should include\n * all fields that are required for only certain flows, e.g. fields that\n * are only rendered in certain situations. We filter out pre-filled\n * fields so that FraudNet doesn't mistakenly tag them as suspicious due\n * to being programmatically filled.\n */\n fields: [\n // From addCard/updateCard and addShipping interstitials\n { id: 'country', min: 2 },\n { id: 'ccFirstName', min: 5 },\n { id: 'ccLastName', min: 5 },\n { id: 'cardNumber', min: 8 },\n { id: 'billingDropdown', min: 10 },\n ],\n // Should be the same as `sourceId`\n type: APP_NAME,\n },\n };\n\n // Wrapping this in a try/catch because in the past we have seen occasional\n // errors with fraudnet being initialized which was blowing up the app\n try {\n // `fraudNet()` is located in checkoutuinodeweb/shared directory\n fraudNet(fraudNetConfig);\n logger.cal.info('FRAUDNET_INIT', fraudNetConfig);\n } catch (e) {\n logger.cal.info('FRAUDNET_INIT_FAILURE', { message: e && e.message });\n }\n};\n","// extracted by extract-css-chunks-webpack-plugin\nmodule.exports = {\"SpinnerOverlay\":\"SpinnerOverlay_SpinnerOverlay_3KudG\",\"spinnerOverlay\":\"SpinnerOverlay_SpinnerOverlay_3KudG\",\"SpinnerMessage\":\"SpinnerOverlay_SpinnerMessage_1BLVf\",\"spinnerMessage\":\"SpinnerOverlay_SpinnerMessage_1BLVf\",\"SpinnerContent\":\"SpinnerOverlay_SpinnerContent_15n8d\",\"spinnerContent\":\"SpinnerOverlay_SpinnerContent_15n8d\"};","import i18n from 'pp-react-l10n';\n\nimport { getCountry, getLocale } from '@paypalcorp/c3-shared-globals';\nimport { logger } from '@paypalcorp/c3-util-logger';\n\nconst IGNORE_MISSING_CONTENT_KEYS = [/^fsMappings.+$/];\n\nconst shouldIgnoreLoggingMissingContentKeys = (key) =>\n IGNORE_MISSING_CONTENT_KEYS.find((ignoreKey) => ignoreKey.test(key));\n\n/**\n * Wrapper with ability to check for undefined content\n */\nexport default (...args) => {\n const key = args[0];\n const result = i18n.apply(this, args);\n\n if (String(result) === `{${key}}`) {\n if (!shouldIgnoreLoggingMissingContentKeys(key)) {\n logger.cal.info(`CONTENT_MISSING_${key.replace(/ /g, '_')}_${getCountry()}_${getLocale()}`);\n }\n\n return null;\n }\n\n return result;\n};\n","// extracted by extract-css-chunks-webpack-plugin\nmodule.exports = {\"Spinner\":\"Spinner_Spinner_1fJo0\",\"spinner\":\"Spinner_Spinner_1fJo0\",\"SpinnerImage\":\"Spinner_SpinnerImage_3lAAj\",\"spinnerImage\":\"Spinner_SpinnerImage_3lAAj\",\"SpinnerLoader\":\"Spinner_SpinnerLoader_1FmJE\",\"spinnerLoader\":\"Spinner_SpinnerLoader_1FmJE\",\"rotation-ltr\":\"Spinner_rotation-ltr_1zwLK\",\"rotationLtr\":\"Spinner_rotation-ltr_1zwLK\",\"rotation-rtl\":\"Spinner_rotation-rtl_-DHPE\",\"rotationRtl\":\"Spinner_rotation-rtl_-DHPE\"};","import { logger } from '@paypalcorp/c3-util-logger';\nimport { getTimeToInteract } from '@paypalcorp/c3-util-browser';\nimport { getGlobals } from '@paypalcorp/c3-shared-globals'\nexport const PAGE = {\n REVIEW: 'review',\n ECONSENT: 'econsent',\n ADD_FI: 'addFi',\n ADD_SHIPPING_ADDRESS: 'addShipping',\n};\n\nconst _store = {\n triggerInitialCPLEvent: true,\n hasContingencies: false,\n};\n\n/**\n * Populate the server side cpl metics as part of client side fpti payload.\n *\n * @param {Object} comp\n */\nconst populateServerSideCplMetrics = (comp) => {\n const keys = ['INITIAL_DATA']; // Can be moved to config/constants if we need to expand list\n const { serverSideCplMetrics } = getGlobals();\n if (serverSideCplMetrics) {\n keys.forEach(key => {\n comp[`SERVER_${key}`.toLowerCase()] = {\n start: serverSideCplMetrics[`${key}_TIME`],\n tt: serverSideCplMetrics[`${key}_TIME_TAKEN`]\n }\n });\n }\n}\n\n/**\n * Populate time spent out of focus as part of cpl.\n * The longer the tab is out-of-focus the slower it becomes.\n *\n * @param {*} comp\n */\nconst populateVisibilityMetrics = (comp) => {\n if (window.visibilityEvents) {\n const hidden = window.visibilityEvents.hidden;\n const visible = window.visibilityEvents.visible || Date.now();\n if (hidden) {\n const timeTaken = visible - hidden;\n comp['visibilitychange'] = {\n start: hidden,\n tt: timeTaken\n }\n }\n }\n}\n\nconst triggerCPLLatencyMetricsFPTI = (page, timeToInteract) => {\n window.logCPLPhase('component_load_time');\n const { comp, query, chunk, ...rest } = window?.cplPhases || {};\n\n populateServerSideCplMetrics(comp);\n populateVisibilityMetrics(comp);\n const cplLatencyMetrics = {\n state_name: 'CPL_LATENCY_METRICS',\n transition_name: `prepare_${page}`,\n page_name: `main:xo:lite:hermione:member:${page}`,\n cpl_comp_metrics: JSON.stringify(window?.cplPhases?.comp || {}),\n cpl_query_metrics: JSON.stringify(window?.cplPhases?.query || {}),\n cpl_chunk_metrics: JSON.stringify(window?.cplPhases?.chunk || {}),\n ...rest,\n total_page_load_time: timeToInteract,\n };\n\n logger.fpti('CPL_LATENCY_METRICS', cplLatencyMetrics);\n};\n\nexport const updateTriggerInitialCPLEvent = (state) => {\n logger.cal.info(`CPL_UPDATE_TRIGGER_INITIAL_CPL_EVENT_TO_${state}`);\n _store.triggerInitialCPLEvent = state;\n};\n\nexport const shouldTriggerInitialCPLEvent = () => {\n return _store.triggerInitialCPLEvent;\n};\n\nexport const updateHasContingencies = (state) => {\n logger.cal.info(`CPL_UPDATE_HAS_CONTINGENCIES_TO_${state}`);\n _store.hasContingencies = state;\n};\n\nexport const hasContingencies = () => {\n return _store.hasContingencies;\n};\n\nexport const triggerInitialCPLEvent = (page = '') => {\n if (shouldTriggerInitialCPLEvent()) {\n /* \n Dont trigger review page event incase of contingencies, since event\n for those scenarios will be triggered from corresponding components\n */\n if (page === PAGE.REVIEW && hasContingencies()) {\n logger.cal.info(`CPL_DISABLE_CALL_BECAUSE_OF_CONTINGENCIES_FROM_${page}_PAGE`);\n } else {\n const timeToInteract = getTimeToInteract();\n logger.cpl.logPerformance({\n action: `${page}_page_loaded`,\n uicomp: `custom-${page}`,\n uitype: 'page',\n page: `main:xo:lite:hermione:member:custom-${page}`,\n timeToInteract,\n });\n logger.cal.info(`CPL_CALL_TRIGGERED_FROM_${page}_PAGE`);\n // Set the flag to false so that CPL call is not triggered again\n updateTriggerInitialCPLEvent(false);\n // Trigger FPTI event to capture the time spent on different phases.\n triggerCPLLatencyMetricsFPTI(page, timeToInteract);\n }\n }\n};\n","import React from 'react';\n\n// react-universal-component shows a default 'Loading ...' message with query components.\n// use this empty tag to prevent the default behavior\nexport default function EmptyLoader() {\n return ;\n}\n","import React from 'react';\n\nimport { getCountry } from '@paypalcorp/c3-shared-globals';\nimport { isObject, isFunction, nullToUndefined, isUndefined } from '@paypalcorp/c3-util-lang';\nimport EmptyLoader from '@/shared/components/EmptyLoader';\nimport { useGqlNetworkQuery, useFeatureQuery, useContingencyQuery } from './hooks';\nimport { FeatureContainer } from './FeatureContainer';\nimport { lazyComponent } from '@/lib/lazyLoad';\nimport { shouldTriggerInitialCPLEvent, updateHasContingencies } from '@/lib/cplUtils';\n\n// resolve feature's lazy component based on experiment result\nconst resolveWrappedComponentByExperiment = (wrappedComponent, experimentResult) => {\n if (wrappedComponent[experimentResult]) {\n return wrappedComponent[experimentResult];\n } else {\n for (let prop in wrappedComponent) {\n return wrappedComponent[prop];\n }\n }\n};\n\n/**\n * resolve feature's lazy component based on\n *\n * - experiment\n * - countrySpecific\n *\n * Examples:\n *\n * 1. When experiments object is provided\n * ({\n * experiments: {\n * TREATMENT_1: () => import('./Footer'),\n * TREATMENT_2: () => import('./FooterB'),\n * TREATMENT_3: () => import('./FooterC'),\n * }\n * })\n *\n * 2. When countrySpecific object is provided\n * ({\n * countrySpecific: {\n * US: () => import('./Footer'),\n * GB: () => import('./FooterB'),\n * AU: () => import('./FooterC'),\n * }\n * })\n *\n * 3. When countrySpecific object has nested experiments\n * ({\n * countrySpecific: {\n * US: {\n * experiments: {\n * TREATMENT_1: () => import('./Footer'),\n * TREATMENT_2: () => import('./FooterB'),\n * TREATMENT_3: () => import('./FooterC'),\n * },\n * },\n * GB: () => import('./FooterB'),\n * AU: () => import('./FooterC'),\n * }\n * })\n/*/\nconst resolveWrappedComponent = (wrappedComponent, finalData, country) => {\n if (isObject(wrappedComponent)) {\n const { feature: { experiment } = {} } = finalData;\n const experimentResult = experiment && experiment.getResolvedTreatment();\n\n const wrappersByExperiment = wrappedComponent.experiments;\n const wrappersByCountry = wrappedComponent.countrySpecific;\n\n if (wrappersByExperiment) {\n return resolveWrappedComponentByExperiment(wrappersByExperiment, experimentResult);\n } else if (wrappersByCountry) {\n const countrySpecificWrapper = wrappersByCountry[country] || wrappersByCountry['US'];\n\n if (isObject(countrySpecificWrapper)) {\n if (countrySpecificWrapper.experiments) {\n return resolveWrappedComponentByExperiment(\n countrySpecificWrapper.experiments,\n experimentResult\n );\n }\n } else {\n return countrySpecificWrapper;\n }\n }\n }\n return wrappedComponent;\n};\n\nconst getIsGqlQueriesLoading = (queries) => {\n return Object.keys(queries).some((key) => {\n return queries[key].loading;\n });\n};\n\nconst getIsGqlDataResolved = (queries) => {\n return !Object.keys(queries).some((key) => {\n return Object.keys(queries[key].data || {}).length === 0 && isUndefined(queries[key].error);\n });\n};\n\nconst getIsGqlHasError = (queries) => {\n return Object.keys(queries).some((key) => {\n return queries[key].error;\n });\n};\n\nconst mapContingencies = (contingencies = []) => {\n return contingencies.reduce((map, obj) => {\n map[obj.id] = obj;\n map[obj.id].data = obj.data || {};\n return map;\n }, {});\n};\n\nconst mapFeature = (feature = {}) => {\n return {\n ...feature,\n data: feature.data || {},\n };\n};\n\nconst mapFeatures = (features = []) => {\n return features.reduce((map, obj) => {\n map[obj.id] = obj;\n map[obj.id].data = obj.data || {};\n return map;\n }, {});\n};\n\nconst mapQueriesData = (queries) => {\n const result = [];\n\n Object.keys(queries).forEach((key) => {\n if (!queries[key].data) {\n queries[key].data = {};\n }\n queries[key].data = nullToUndefined(queries[key].data);\n result.push(queries[key]);\n });\n\n return result;\n};\n\nconst getShouldLoadFeatureComponent = ({ shouldLoadFeatureComponent, finalData }) => {\n if (!isFunction(shouldLoadFeatureComponent)) {\n return true;\n }\n\n return Boolean(shouldLoadFeatureComponent(finalData));\n};\n\nconst getShouldAutoDisplayComponent = ({\n shouldAutoDisplayComponent,\n finalData,\n shouldLoadFeature,\n}) => {\n const { experiment } = finalData.feature;\n\n // no point of executing shouldAutoDisplayComponent if feature is not eligible or experiment is in control\n if (\n !isFunction(shouldAutoDisplayComponent) ||\n !shouldLoadFeature ||\n (experiment && experiment.isControl())\n ) {\n return false;\n }\n\n return shouldAutoDisplayComponent(finalData);\n};\n\nconst getShouldLoadLoadingComponent = ({\n withoutLoadingState,\n isGqlLoading,\n shouldLoadFeatureComponent,\n LoadingComponent,\n}) => {\n return !withoutLoadingState && isGqlLoading && shouldLoadFeatureComponent && LoadingComponent;\n};\n\nconst getShouldLoadFeatureInstance = ({\n shouldLoadFeatureInstance,\n finalData,\n shouldLoadFeature,\n}) => {\n if (!shouldLoadFeature || !isFunction(shouldLoadFeatureInstance)) {\n return true;\n }\n\n return Boolean(shouldLoadFeatureInstance(finalData));\n};\n\nconst getQueriesByFetchPolicy = ({ queries, fetchPolicy, negation = false }) => {\n return queries.filter((q) =>\n negation ? q.fetchPolicy !== fetchPolicy : q.fetchPolicy === fetchPolicy\n );\n};\n\nconst mapFeaturesQueryResult = (featuresQueryResult) => {\n const features = [];\n\n Object.keys(featuresQueryResult).forEach((key) => {\n if (featuresQueryResult[key].data) {\n features.push(featuresQueryResult[key].data.feature);\n } else {\n features.push({\n id: key,\n });\n }\n });\n\n return features;\n};\n\nconst mapContingenciesQueryResult = ({ contingenciesQueryResult, subscribeToContingencies }) => {\n const { contingencies = [] } = contingenciesQueryResult;\n\n if (subscribeToContingencies) {\n return contingencies.filter(\n (contingency) => subscribeToContingencies.indexOf(contingency.id) >= 0\n );\n }\n\n return contingencies;\n};\n\nconst getFeatureById = ({ id, features }) => {\n return features.find((f) => f.id === id) || {};\n};\n\nconst resolveInterstitialOptions = ({ interstitialOptions, finalData }) => {\n // Use `onBeforeCloseFn` and pass finalData down to it\n if (isFunction(interstitialOptions.onBeforeCloseFn)) {\n const { onBeforeCloseFn } = interstitialOptions;\n interstitialOptions.onBeforeCloseFn = () => onBeforeCloseFn(finalData);\n }\n // Use `showCloseBtnFunc` to determine to show `showCloseBtn`\n if (isFunction(interstitialOptions.showCloseBtnFunc)) {\n interstitialOptions.showCloseBtn = interstitialOptions.showCloseBtnFunc(finalData);\n }\n // Some titles depend on the finalData in order to select which title to use. So we need to pass in finalData\n // to headerTitleFunc in order to be able to get the correct title.\n if (isFunction(interstitialOptions.headerTitleFunc)) {\n interstitialOptions.headerTitle = interstitialOptions.headerTitleFunc(finalData);\n }\n\n // Use `typeFunc` to determine `type` conditionally.\n if (isFunction(interstitialOptions.typeFunc)) {\n interstitialOptions.type = interstitialOptions.typeFunc(finalData);\n }\n\n return interstitialOptions;\n};\n\nconst resolveLazyFeatureComponent = ({\n id,\n WrappedComponent,\n finalData,\n LoadingComponent,\n ErrorComponent,\n country,\n}) => {\n if (!Feature.FeatureComponents[id]) {\n const ResolvedWrappedComponent = resolveWrappedComponent(WrappedComponent, finalData, country);\n\n Feature.FeatureComponents[id] = lazyComponent(ResolvedWrappedComponent, {\n id,\n loading: LoadingComponent,\n error: ErrorComponent || LoadingComponent,\n });\n }\n return Feature.FeatureComponents[id];\n};\n\nconst disableInitialCPLEvent = ({\n interstitial = false,\n autoDisplay = false,\n contingencies = [],\n}) => {\n // Auto displaying interstitial feature when contingencies are available would not allow\n // review page to be rendered first. So in these cases hasContingencies flag should be set.\n if (interstitial && autoDisplay && contingencies.length > 0 && shouldTriggerInitialCPLEvent()) {\n updateHasContingencies(true);\n }\n};\n\n/**\n * Feature component to standardize component writing\n * See: https://github.paypal.com/Checkout-R/checkoutuinodeweb/pull/719\n *\n * @param {Object} config | Feature configuration object that must be passed.\n * @param {String} config.id | feature id\n * @param {Boolean} config.interstitial | if feature has to be rendered as interstitial\n * @param {Object} config.interstitialOptions | interstitial options such as\n * @param {Function} config.interstitialOptions.payload | The payload function for FPTI\n * @param {Boolean} config.interstitialOptions.showCloseBtn | true / false (to show or hide close button)\n * @param {Boolean} config.interstitialOptions.hideHeaderBorder | Boolean to exclude InterstitialHeader (defaults to true)\n * @param {Function} config.interstitialOptions.showCloseBtnFunc | Function to dynamically determine `showCloseBtn` flag or not\n * @param {Function} config.interstitialOptions.onBeforeCloseFn | `onBeforeCloseFn` to be passed to `InterstitialContainerComponent` to trigger any actions before Interstitial is closed\n * @param {String} config.interstitialOptions.type | The type of interstitial (one of `full`, `tall`, `compact`, `modal`)\n * @param {Function} config.interstitialOptions.headerTitleFunc | Function used to get the header title.\n * @param {String} config.interstitialOptions.interstitialStyleOverrides | Classnames with which to override base interstitial styles\n * @param {String} config.interstitialOptions.interstitialWrapperStyleOverrides | Classnames with which to override interstitial wrapper styles\n * @param {String} config.interstitialOptions.interstitialInnerContainerStyleOverrides | Classnames with which to override a interstitials inner container styles\n * @param {String} config.interstitialOptions.overlayClassNames | Classnames with which to override overlay styles\n * @param {Array} config.queries | Array of all graphql queries\n * @param {Array} config.contingencies | Array of contingencies which are going to be injected into the feature component\n * @param {Function} config.LoadingComponent | Loading component\n * @param {Function} config.ErrorComponent | Error component\n * @param {Array} config.subscribeTo | Array of all features (ids) your component needs to subscribe to\n * @param {Object} config.animateOptions | options for showing feature with animations, includes such params:\n * - animateHeight: enable / disable animation\n * - animateContainerClass: class to pass for animation container\n * - animateOpacity: animate opacity or not\n * @param {Boolean} config.shouldKeepLoadingStateOnError | if we need to show loading state forever in case of error\n * @param {Function} config.shouldAutoDisplayComponent | function which needs to return true or false if you want to show feature automatically after hiding it by default\n * @param {Function} config.shouldLoadFeatureComponent | function which needs to return true or false if feature component should be loaded at all\n * @param {Function} config.shouldLoadFeatureInstance | function which needs to return true or false if feature component instance should be loaded or not (e.g when you render feature in 2 places and you want to hide one and show another)\n * @param {Boolean} config.withoutLoadingState | if feature component needs to render immediately and not wait for GQL queries calls to be completed\n */\nexport const Feature = (config) => {\n let {\n id,\n interstitialOptions = {},\n interstitial,\n shouldAutoDisplayComponent,\n shouldLoadFeatureComponent,\n shouldLoadFeatureInstance,\n queries = [],\n LoadingComponent = EmptyLoader,\n ErrorComponent,\n withoutLoadingState,\n subscribeTo = [],\n animateOptions = {},\n shouldKeepLoadingStateOnError,\n contingencies: subscribeToContingencies,\n } = config;\n\n return (WrappedComponent) => {\n Feature.FeatureComponents[id] = null;\n\n const Composed = (props) => {\n // order of hooks below is important (don't modify it without a good reason)\n // basically there are use cases when features are not getting re rendered with latest data\n // or cache-only queries results are resolving with empty data\n\n // first - fire cache-only gql queries\n const cacheOnlyGqlQueries = getQueriesByFetchPolicy({ queries, fetchPolicy: 'cache-only' });\n const cacheOnlyGqlQueryResult = useGqlNetworkQuery({ queries: cacheOnlyGqlQueries });\n\n // second - fire local gql query (queries) to fetch features\n const featuresQueryResult = useFeatureQuery([id, ...subscribeTo]);\n const features = mapFeaturesQueryResult(featuresQueryResult);\n const feature = getFeatureById({ id, features });\n\n // third - fire local gql query to fetch contingencies\n const contingenciesQueryResult = useContingencyQuery(id);\n const contingencies = mapContingenciesQueryResult({\n contingenciesQueryResult,\n subscribeToContingencies,\n });\n\n // fourth - fire network gql queries\n const networkGqlQueries = getQueriesByFetchPolicy({\n queries,\n fetchPolicy: 'cache-only',\n negation: true,\n });\n\n const networkGqlQueryResult = useGqlNetworkQuery({\n queries: networkGqlQueries,\n skip: !feature.enabled,\n });\n\n // no need to do any calculations below if feature is not enabled\n if (!feature.enabled) {\n return null;\n }\n\n const queriesResult = { ...networkGqlQueryResult, ...cacheOnlyGqlQueryResult };\n const isGqlLoading = getIsGqlQueriesLoading(queriesResult);\n const isGqlDataResolved = getIsGqlDataResolved(queriesResult);\n const hasError = getIsGqlHasError(queriesResult);\n const ShouldLoadLoadingComponent = getShouldLoadLoadingComponent({\n withoutLoadingState,\n isGqlLoading,\n shouldLoadFeatureComponent,\n LoadingComponent,\n });\n\n if (ShouldLoadLoadingComponent) {\n return ;\n }\n\n const finalData = {\n allQueryData: mapQueriesData(queriesResult),\n feature: mapFeature(feature),\n features: mapFeatures(features),\n loading: isGqlLoading,\n contingencies: mapContingencies(contingencies),\n customProps: props.customProps,\n };\n const { experiment, visible } = finalData.feature;\n\n const shouldLoadFeature = getShouldLoadFeatureComponent({\n shouldLoadFeatureComponent,\n finalData,\n });\n\n const autoDisplay = getShouldAutoDisplayComponent({\n shouldAutoDisplayComponent,\n finalData,\n shouldLoadFeature,\n });\n\n // disable initial cpl event if conditions satify\n disableInitialCPLEvent({ interstitial, autoDisplay, contingencies });\n\n const shouldLoadInstance = getShouldLoadFeatureInstance({\n shouldLoadFeatureInstance,\n finalData,\n shouldLoadFeature,\n });\n\n const shouldResolveInterstitialOptions =\n !isGqlLoading &&\n interstitial &&\n shouldLoadFeature &&\n visible &&\n !(experiment && experiment.isControl());\n\n if (shouldResolveInterstitialOptions) {\n interstitialOptions = resolveInterstitialOptions({ interstitialOptions, finalData });\n }\n\n const FeatureComponent = resolveLazyFeatureComponent({\n id,\n WrappedComponent,\n finalData,\n LoadingComponent,\n ErrorComponent,\n country: getCountry(),\n });\n\n return (\n \n );\n };\n\n // Wrapper class to pass props which are passed directly to the feature component during render time\n class ComposedFeature extends React.PureComponent {\n render() {\n return ;\n }\n }\n return ComposedFeature;\n };\n};\n\nFeature.FeatureComponents = {};\n\nexport default Feature;\n","export { IS_STICKY_ENABLED, CHECKOUT_BUTTON_STATES } from '@paypalcorp/c3-util-store';\n","import { getAuthState, getClaims } from '@paypalcorp/c3-shared-globals';\nimport { params } from '@paypalcorp/c3-util-browser';\n\n/**\n * Check if current logged in user has a `REMEMBERED` auth state\n * @returns {Boolean}\n */\nexport const getIsRememberedAuthState = () => getAuthState() === 'REMEMBERED';\n\n/**\n * Checking current user is logged in via one touched by ensuring current user:\n * auth_state: `REMEMBERED`\n * auth_claims: `DEVICE_TOKEN`\n *\n * Checking `DEVICE_TOKEN` is needed because partner integration (`PARTNER_ASSERTION`) can also\n * have `REMEMBERED` as the user's authState but this will not be considered as a oneTouch\n * @returns {Boolean}\n */\nexport const getIsUserOneTouchLogin = () => {\n return getIsRememberedAuthState() && getClaims().includes('DEVICE_TOKEN');\n};\n\n/**\n * Checking current user is `SkipFacebookLogin` by ensuring current user:\n * auth_state: `REMEMBERED`\n * auth_claims: `PARTNER_ASSERTION`\n * query param `code` must be present in order to be considered from Facebook\n * @returns {Boolean}\n */\nexport const getIsUserSkipFacebookLogin = () => {\n return (\n getIsRememberedAuthState() &&\n getClaims().includes('PARTNER_ASSERTION') &&\n Boolean(params().code)\n );\n};\n\n/**\n * Checking if current logged user is via user device token remembered login or not by ensuring:\n * auth_state: `REMEMBERED`\n * auth_claims: `USER_DEVICE_TOKEN_IMPLICIT`\n * @returns {Boolean}\n */\nexport const getIsUserDeviceTokenImplicitLogin = () => {\n return getIsRememberedAuthState() && getClaims().includes('USER_DEVICE_TOKEN_IMPLICIT');\n};\n","import React from 'react';\nimport styles from './styles.css';\n\nconst Spinner = () => (\n
\n
\n
\n
\n);\n\nexport default Spinner;\n","import React from 'react';\nimport PropTypes from 'prop-types';\nimport Spinner from '../Spinner';\nimport cx from 'classnames';\n\nimport styles from './styles.css';\n\nconst SpinnerOverlay = ({ children, extraMessage }) => (\n
\n \n {children && (\n \n {children}\n

\n )}\n {extraMessage && (\n

\n {extraMessage}\n

\n )}\n
\n);\n\nSpinnerOverlay.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n};\n\nexport default SpinnerOverlay;\n","import gql from 'graphql-tag';\nimport { FundingOptionFragment } from '@paypalcorp/c3-graphql-fragments';\n\nexport const CPA_DISCLAIMER_QUERY = gql`\n ${FundingOptionFragment}\n query CPADisclaimerQuery($token: String!) {\n checkoutSession(token: $token) {\n merchant {\n name\n }\n fundingOptions(returnAllPlans: true, groupSourcesOnType: INCENTIVE) {\n ...FundingOptionFragment\n }\n userAction\n checkoutSessionType\n }\n }\n`;\n","import {\n getDeviceAndNetworkInfo as _getDeviceAndNetworkInfo,\n isIframe as _isIframe,\n isPopup as _isPopup,\n isViewportSmall as _isViewportSmall,\n LocalStorage as BrowserStorage,\n params as _params,\n resetParams as _resetParams,\n} from '@paypalcorp/c3-util-browser';\nimport { getToken } from '@paypalcorp/c3-shared-globals';\nimport get from 'dlv';\nimport getContent from '@/lib/content';\nimport { logger } from '@paypalcorp/c3-util-logger';\n\nexport const isViewportSmall = _isViewportSmall;\nexport const getDeviceAndNetworkInfo = _getDeviceAndNetworkInfo;\nexport const isIframe = _isIframe;\nexport const isPopup = _isPopup;\nexport const resetParams = _resetParams;\nexport const params = _params;\n\nexport function isIncontext() {\n return isLegacyIncontext() || isNewIncontext();\n}\n\n// for old incontext integrations - send post message\nexport const postToMerchantForOldIncontext = (msg) => {\n if (!isLegacyIncontext()) {\n return false;\n }\n\n try {\n logger.cal.info('attempting_old_incontext_postmessage');\n logger.cal.flush();\n msg = JSON.stringify(msg);\n // If we are not in IE, attempt to send a postMessage\n if (\n window.opener &&\n (window.navigator.userAgent.match(/edge/i) ||\n (window.opener.postMessage && !window.navigator.userAgent.match(/msie|trident/i)))\n ) {\n logger.cal.flush();\n window.opener.postMessage(msg, '*');\n logger.cal.info('old_incontext_postmessage_success_non_ie_success');\n return true;\n }\n // Otherwise, attempt to send a message through the iframe bridge\n const bridge =\n window.opener &&\n window.opener.frames &&\n window.opener.frames.length &&\n window.opener.frames.PayPalBridge;\n\n if (bridge && bridge.returnToParent) {\n logger.cal.flush();\n bridge.returnToParent(msg);\n logger.cal.info('old_incontext_bridgemessage_iframe_success');\n return true;\n }\n\n logger.cal.info('old_incontext_postmessage_incompatible_user_agent', {\n userAgent: window.navigator && window.navigator.userAgent,\n });\n } catch (err) {\n logger.cal.error('old_incontext_postmessage_error', {\n error: err.stack || err.toString(),\n });\n }\n\n logger.cal.warn('old_incontext_postmessage_failure');\n return false;\n};\n\n// check if it's new incontext integration\nexport const isNewIncontext = () => {\n return window.xprops && (isPopup() || isIframe());\n};\n\n/**\n * Check if it's old incontext integration which includes checking old checkout.js\n * integrations and vzero (Braintree) integration\n * @returns {Boolean}\n */\nexport const isLegacyIncontext = () => {\n if (window.xprops || isVzeroIntegration()) {\n return false;\n }\n\n return (\n (window.name &&\n (window.name.indexOf('PPFrame') === 0 ||\n window.name.indexOf('xcomponent__ppcheckout') === 0) &&\n isPopup()) ||\n params().incontext === '1' ||\n isIframe()\n );\n};\n\n/**\n * Check if it's a vzero (Braintree) integration based off window.name and\n * query params\n * @returns {Boolean}\n */\nexport const isVzeroIntegration = () => {\n return (\n window.name === 'PPFrameRedirect' ||\n params().nolegacy === '1' ||\n // TODO: Switch this to using CheckoutSessionFlags.isVZeroIntegration instead, as it's unclear what this\n // name represents and whether it's used for other reasons\n window.name.indexOf('braintreepaypallanding') === 0\n );\n};\n\n/**\n * Set the destination to the current feature (scoped to the current token)\n * before redirecting the user away from the app.\n *\n * Call isDestination() in your shouldAutoDisplayComponent feature hook\n * (along with any necessary eligibility logic) to automatically make your\n * feature visible when the user returns to the app.\n *\n * @param {String} featureId Feature ID\n */\nexport const setDestination = (featureId) => {\n // Scope to the token so stale values are ignored\n BrowserStorage.set('lastAttemptedDestination', `${getToken()}:${featureId}`);\n};\n\n/**\n * Clear the destination after it's no longer necessary to make the feature visible after returning.\n */\nexport const clearDestination = () => {\n BrowserStorage.remove('lastAttemptedDestination');\n};\n\n/**\n * Determine if the current feature was previously set as the destination.\n * Automatically cleans up stale values. See: setDestination\n *\n * @param {String} featureId Feature ID\n * @returns {Boolean}\n */\nexport const isDestination = (() => {\n let destination = null;\n\n function memoized(featureId) {\n if (destination) {\n if (destination?.token !== getToken()) {\n // Clean up stale values\n logger.cal.info('CLEANUP_STALE_MEMOIZED_DESTINATION');\n destination = null;\n return false;\n }\n\n // Use the memozied value\n return destination?.featureId === featureId;\n }\n\n const storageDestination = BrowserStorage.get('lastAttemptedDestination');\n\n if (!storageDestination) {\n // Short-circuit if key is not present\n return false;\n }\n\n const [token, destFeatureId] = storageDestination.split(':');\n\n if (token !== getToken()) {\n // Clean up stale values\n logger.cal.info('CLEANUP_STALE_STORAGE_DESTINATION');\n clearDestination();\n return false;\n }\n\n if (destFeatureId === featureId) {\n clearDestination();\n destination = { token, featureId: destFeatureId };\n return true;\n }\n\n return false;\n }\n\n memoized.reset = () => {\n destination = null;\n };\n\n return memoized;\n})();\n\n/**\n * Check url protocols against known patterns.\n * Generally, urls can only fall under one of the defined protocols.\n * @param {String} url a url\n * @param {String} urlType the type of url like `returnUrl` or `cancelUrl`\n */\nexport const getProtocolType = (url = '', urlType = 'default') => {\n try {\n const deepLinkRegex = new RegExp('^(?!(undefined|http|https|ftp|mailto|tel|file)).*:', 'g');\n const nonStandardRegex = new RegExp('^s*(ftp|mailto|tel|file):', 'g');\n const standardRegex = new RegExp('^s*(https?|s?):', 'g');\n const relativePathRegex = new RegExp('^(/).*', 'g');\n\n const result = {\n isDeepLink: deepLinkRegex.test(url),\n isNonStandard: nonStandardRegex.test(url),\n isStandard: standardRegex.test(url),\n isRelativePath: relativePathRegex.test(url),\n };\n\n logger.cal.info(`UrlProtocolType-${urlType}`, result);\n\n return result;\n } catch (err) {\n logger.cal.info(`UrlProtocolType-${urlType}-error`, err);\n\n return {};\n }\n};\n\nexport const isInstallmentCreditType = (creditOfferType) => {\n return ['PALA', 'INST', 'EZP'].includes(creditOfferType);\n};\n\nexport const isPaypalCreditFundingInstrument = (selectedFundingOption) => {\n return (\n selectedFundingOption?.fundingInstrument?.name === 'BILL_ME_LATER' &&\n selectedFundingOption?.fundingInstrument?.type === 'PAYPAL_CREDIT'\n );\n};\n\nexport function getCreditFundingInstrument(fundingOptions) {\n return fundingOptions?.find((item) => {\n return (\n item.fundingInstrument.name === 'BILL_ME_LATER' &&\n item.fundingInstrument.type === 'PAYPAL_CREDIT'\n );\n });\n}\n\nexport function getGplOffer(creditAsFIOffers) {\n return creditAsFIOffers.filter(\n (offer) => offer.product === 'GPL' && offer.presentmentType === 'Radio'\n );\n}\n\nexport function gplAmountDueTodayDetails(fundingInstrument) {\n const installmentsSchedules = get(\n fundingInstrument,\n 'creditFields.creditOffer.creditPayLater.installmentsSchedule'\n );\n\n if (!installmentsSchedules) {\n return;\n }\n\n let gplAmountDueToday;\n\n const downPayment = installmentsSchedules.find(\n (installmentsSchedule) => installmentsSchedule.paymentType === 'DOWN_PAYMENT'\n );\n if (!downPayment) {\n gplAmountDueToday = get(\n fundingInstrument,\n 'creditFields.creditOffer.creditPayLater.noDownPaymentAmt'\n );\n } else {\n gplAmountDueToday = downPayment.totalPayment;\n }\n\n gplAmountDueToday.dueDate = getContent('gplFIDisplay.dueToday');\n\n return gplAmountDueToday;\n}\n","// SharedCard component contingencies\n\nexport const SHARED_CARD_CONTINGENCIES = [\n // following contingency is thrown from FI when user tries to add a card that belongs to other user\n 'SHARED_INSTRUMENT_CONSENT_REQUIRED',\n // following contingency is thrown from FI when consent is given by user to send his details to card owner\n 'ORIGINAL_USER_CHECK_PENDING',\n];\n","import { InMemoryCache, defaultDataIdFromObject } from 'apollo-cache-inmemory';\n\nexport const apolloInMemoryCache = (options = {}) =>\n new InMemoryCache({\n dataIdFromObject: (object) => {\n if (object.__typename) {\n switch (object.__typename) {\n case 'CheckoutSession':\n case 'PaymentContingencies':\n return `${object.__typename}`;\n case 'CheckoutBillingAddress':\n case 'CheckoutShippingAddress':\n return `${object.__typename}.${object.addressId}`;\n }\n }\n return defaultDataIdFromObject(object);\n },\n ...options,\n });\n","import { logger } from '@paypalcorp/c3-util-logger';\nimport { getClient, getToken } from '@paypalcorp/c3-shared-globals';\nimport gql from 'graphql-tag';\n\n/*\n * This mutation is used to invalidate the current Planning of the Checkout Session.\n * So that the next time when we query for any planning data, the replanning is triggered.\n * In hermione, the planning is queried with `PAY_WITH` Query.\n */\nexport const INVALIDATE_CHECKOUT_SESSION_PLAN_MUTATION = gql`\n mutation InvalidateCheckoutSessionPlan($token: String!) {\n invalidateCheckoutSessionPlan(token: $token)\n }\n`;\n\nexport default function invalidateCheckoutSessionPlan() {\n const client = getClient();\n const token = getToken();\n return client\n .mutate({\n mutation: INVALIDATE_CHECKOUT_SESSION_PLAN_MUTATION,\n variables: {\n token,\n },\n })\n .catch((error) => {\n logger.cal.info(`INVALIDATE_CHECKOUT_SESSION_PLAN_MUTATION_FAILURE`, { ...error });\n });\n}\n","import { params } from '@paypalcorp/c3-util-browser';\nimport invalidateCheckoutSessionPlan from '@/lib/invalidateCheckoutSessionPlan';\nimport { getIsResolveThreeDS } from '@paypalcorp/c3-shared-globals';\n\n/*\n * Checks if the checkoutSession Plan needs to be invalidated\n * & if needed, it calls the invalidateCheckoutSessionPlan mutation\n */\nconst invalidateCheckoutSessionPlanIfNeeded = () => {\n const shouldInvalidateCheckoutSessionPlan = !!params().invalidateCheckoutSessionPlan;\n\n if (shouldInvalidateCheckoutSessionPlan) {\n return invalidateCheckoutSessionPlan();\n }\n return Promise.resolve();\n};\n\n/*\n * The Idea is to chain multiple promises like\n * const executePreRenderSteps = () => (\n * invalidateCheckoutSessionIfNeeded()\n * .then(doSomethingElse)\n * .then(otherNeededSteps)\n * )\n */\nconst executePreRenderSteps = () => {\n if (getIsResolveThreeDS()) {\n return Promise.resolve();\n }\n return invalidateCheckoutSessionPlanIfNeeded();\n};\n\nexport { executePreRenderSteps };\n","import React from 'react';\nimport gql from 'graphql-tag';\nimport { Query } from '@apollo/react-components';\n\nimport { logger } from '@paypalcorp/c3-util-logger';\nimport { TRANSACTION_DETAILS } from '@paypalcorp/c3-util-logger';\nimport { getDeviceAndNetworkInfo, isIframe, isPopup } from '@paypalcorp/c3-util-browser';\n\nimport {\n isIncontext,\n isLegacyIncontext,\n isNewIncontext,\n isVzeroIntegration,\n postToMerchantForOldIncontext,\n} from '@/lib/utils';\nimport { isFunction } from '@paypalcorp/c3-util-lang';\nimport { redirectGenericError } from '@/lib/redirects';\nimport { LOG_TRANSITIONS } from '@paypalcorp/c3-util-logger';\nimport get from 'dlv';\nimport { executePreRenderSteps } from '@/lib/preRenderSteps';\nimport { getAccessToken, getGlobals, getToken, updateGlobals } from '@paypalcorp/c3-shared-globals';\nimport { checkFIBalanceStep } from '@/lib/fiBalance';\n\nexport const initAppQuery = gql`\n query InitAppQuery($token: String!) {\n checkoutSession(token: $token) {\n cart {\n cancelUrl {\n href\n }\n amounts {\n total {\n currencyValue\n currencyCode\n currencySymbol\n }\n }\n description\n }\n merchant {\n merchantId\n name\n }\n }\n }\n`;\n\n// To be called before any app logic\nfunction initApp() {\n return Promise.resolve()\n .then(function logIntegration() {\n let formFactor;\n window.logPerformanceNow('TimeToFrameworkEnd'); // The time taken to finish bootstrapping the framework.\n if (isPopup()) {\n formFactor = 'POPUP';\n } else if (isIframe()) {\n formFactor = 'IFRAME';\n } else {\n formFactor = 'FULLPAGE';\n }\n\n const integrationType = isIncontext() ? 'INCONTEXT' : 'FULLPAGE';\n\n logger.cal.info(`integration_type_${integrationType}`, {\n formFactor,\n xprops: Boolean(window.xprops),\n windowName: window.name,\n });\n\n if (isNewIncontext()) {\n logger.cal.info(`new_incontext`);\n } else if (isLegacyIncontext()) {\n logger.cal.info(`old_incontext`);\n }\n })\n .then(function logStart() {\n // This event was originally meant to mark the beginning of\n // client side logs on checkout. We might want updated\n // names for checkoutlite. Keeping logs as CAL for now.\n // Equivalent for :-\n // state_name: 'client_middleware'\n // transition_name: 'process_app_start_design'\n const networkAndDeviceData = getDeviceAndNetworkInfo();\n logger.cal.info('NETWORK_DEVICE_DATA', networkAndDeviceData);\n logger.cal.info('APP_PERFORMANCE_EVENTS', window.appPerformanceEvents);\n })\n .then(function checkFramebust() {\n if (\n isIframe() &&\n !isVzeroIntegration() &&\n !(window.paypal && isFunction(window.paypal.allowIframe) && window.paypal.allowIframe())\n ) {\n logger.cal.info('frame_bust_disallowed_iframe');\n\n try {\n window.top.location = window.location.href;\n } catch (err) {\n logger.cal.error('frame_bust_failed', err);\n redirectGenericError({ code: 'FRAME_BUST_FAILED' });\n }\n\n setTimeout(() => {\n logger.cal.error('frame_bust_did_not_redirect_after_2s');\n redirectGenericError({ code: 'FRAME_BUST_FAILED_REDIRECT' });\n }, 2000);\n }\n })\n .then(function setupAccessToken() {\n if (window.xprops && isFunction(window.xprops.accessToken)) {\n return window.xprops.accessToken().then((newAccessToken) => {\n const globals = getGlobals();\n const { user } = globals;\n\n updateGlobals({\n ...globals,\n user: {\n ...user,\n access_token: newAccessToken,\n },\n });\n logger.cal.info('hermione_using_provided_xprops_access_token', { newAccessToken });\n });\n }\n\n return Promise.resolve();\n })\n .then(function callAccessToken() {\n const accessToken = getAccessToken();\n\n if (window.xprops && isFunction(window.xprops.onAuth)) {\n return accessToken\n ? window.xprops.onAuth({ accessToken })\n : logger.cal.info('hermione_xprops_on_auth_invalid_access_token');\n }\n\n return Promise.resolve();\n })\n .then(executePreRenderSteps)\n .then(checkFIBalanceStep)\n .catch((err) => {\n logger.cal.error('INCONTEXT_INIT_ERROR', err);\n return;\n });\n}\n\n// Incontext init logic that requires some API data\nfunction initIncontextFromData({ cancelUrl, merchantId, token } = {}) {\n if (window.xprops && isFunction(window.xprops.onInit)) {\n logger.cal.info('INCONTEXT_XPROPS_INIT', {\n token,\n cancelUrl,\n merchantId,\n });\n return window.xprops.onInit({ token, cancelUrl, merchantId });\n }\n\n // TODO: needs to check `secureWindowmsg` from hermesnodeweb\n // https://github.paypal.com/Checkout-R/hermesnodeweb/blob/develop/public/js/lib/miniBrowser.js#L294\n const msg = {\n operation: 'init',\n cancelUrl: cancelUrl,\n landingUrl: window.location && window.location.href,\n };\n\n postToMerchantForOldIncontext(msg);\n\n return Promise.resolve();\n}\n\n// add extra things to pa.js analytics\nfunction attachPaJsFpti({ merchantId, cartTotal } = {}) {\n const { currencyCode, currencyValue } = cartTotal;\n if (window.fpti) {\n window.fpti.mrid = merchantId;\n window.fpti.curr = currencyCode;\n window.fpti.amt = currencyValue;\n }\n}\n\n/**\n * Bootstrap the app. Runs things that only need to be run once, at startup time.\n */\nclass AppBootstrap extends React.Component {\n constructor(props) {\n super(props);\n\n this.state = {\n ready: false,\n };\n }\n\n componentDidMount() {\n initApp().then(() => {\n logger.cal.transition(LOG_TRANSITIONS.BOOTSTRAP);\n this.setState({ ready: true });\n });\n }\n\n render() {\n const token = getToken();\n if (!this.state.ready) {\n return
;\n }\n\n return (\n \n {({ loading, data, error }) => {\n if (!loading && data && !error) {\n const checkoutSession = data.checkoutSession;\n\n const cancelUrl = get(checkoutSession, 'cart.cancelUrl.href');\n const cartTotal = get(checkoutSession, 'cart.amounts.total', {});\n const merchantId = get(checkoutSession, 'merchant.merchantId');\n\n initIncontextFromData({\n token,\n cancelUrl,\n merchantId,\n });\n\n attachPaJsFpti({ merchantId, cartTotal });\n\n logger.fpti('TRANSACTION_DETAILS', TRANSACTION_DETAILS(checkoutSession));\n }\n\n return this.props.children;\n }}\n \n );\n }\n}\n\nexport default AppBootstrap;\n","import React from 'react';\nimport { CacheProvider } from '@emotion/core';\nimport createCache from '@emotion/cache';\nimport stylisRTL from 'stylis-plugin-rtl';\nimport { getGlobals, getDirectionality } from '@paypalcorp/c3-shared-globals';\nimport App from './App';\nimport AppBootstrap from './AppBootstrap';\nimport { InterstitialManager } from '@paypalcorp/c3-component-interstitial';\n\nconst { nonce } = getGlobals();\n\nexport const AppIndex = () => {\n return (\n
\n \n \n \n \n \n \n \n
\n );\n};\n","import { getClient, getToken } from '@paypalcorp/c3-shared-globals';\nimport gql from 'graphql-tag';\nimport {\n FundingOptionFragment,\n PaymentContingenciesFragment,\n} from '@paypalcorp/c3-graphql-fragments';\nimport { threeDsExperienceVars } from '@paypalcorp/c3-util-threed-ds';\n\nexport const CLEAR_REAL_TIME_BALANCE_CONTINGENCY = gql`\n ${FundingOptionFragment}\n ${PaymentContingenciesFragment}\n mutation clearRealTimeBalanceContingency(\n $bankId: String!\n $experiences: [ThreeDSPaymentExperience]\n $token: String!\n $error: String\n ) {\n clearRealTimeBalanceContingency(token: $token, bankId: $bankId, error: $error) {\n fundingOptions(returnAllPlans: true, groupSourcesOnType: INCENTIVE) {\n ...FundingOptionFragment\n }\n paymentContingencies {\n ...PaymentContingenciesFragment\n threeDomainSecure(experiences: $experiences) {\n ...ThreeDomainSecureFields\n }\n }\n }\n }\n`;\n\nexport const checkFIBalance = (bankId, error) => {\n const client = getClient();\n const token = getToken();\n return client.mutate({\n mutation: CLEAR_REAL_TIME_BALANCE_CONTINGENCY,\n variables: threeDsExperienceVars({\n token,\n bankId,\n error,\n }),\n context: { skipFallback: true },\n });\n};\n","import { checkFIBalance } from './checkFIBalance';\nimport { params } from '@paypalcorp/c3-util-browser';\nimport { updateFeature } from '@paypalcorp/c3-util-store';\nimport { CHECKOUT_BUTTON_STATES } from '@/components/CheckoutButton/constants';\nimport { logger } from '@paypalcorp/c3-util-logger';\n\n//Checks the current balance of the Bank account when MoneyNodeweb action is return, id holds the Bank id selected by the user.\n//Once the RealTimeBalance contingency is cleared the CHECKOUT_BUTTON_STATES is set to resolved for completing the transaction\nconst checkFIBalanceStep = () => {\n const { action = '', id = '', error = '' } = params();\n if (action === 'return') {\n logger.cal.info('OPEN_BANKING_MNW_RETURN');\n if (error) {\n logger.cal.info('OPEN_BANKING_MNW_RETURNED_ERROR');\n }\n return checkRealTimeBalance(id, error);\n } else if (action === 'cancel') {\n if (error) {\n logger.cal.info('OPEN_BANKING_MNW_USER_CLOSE_MODAL_ERROR');\n return checkRealTimeBalance(id, error);\n }\n logger.cal.info('OPEN_BANKING_MNW_CANCEL');\n return Promise.resolve();\n }\n};\n\nexport const checkRealTimeBalance = (id, error) => {\n return checkFIBalance(id, error).then(({ data }) => {\n updateFeature('SPINNER', { visible: true });\n const { clearRealTimeBalanceContingency: { fundingOptions = [] } = {} } = data || {};\n const hasFI = fundingOptions.find((fi) => {\n return fi.id === id;\n });\n\n if (hasFI && Object.keys(hasFI).length) {\n updateFeature('CHECKOUT_BUTTON', {\n data: {\n status: CHECKOUT_BUTTON_STATES.RESOLVED,\n flow: 'OPEN_BANKING',\n },\n });\n } else {\n updateFeature('SPINNER', { visible: false }).then(\n updateFeature('OPEN_BANKING', {\n data: { blackListedFI: id },\n })\n );\n }\n });\n};\n\nexport { checkFIBalanceStep };\n","import { onError } from 'apollo-link-error';\nimport { ApolloClient } from 'apollo-client';\nimport { RetryLink } from 'apollo-link-retry';\nimport { ApolloLink, split } from 'apollo-link';\nimport { createHttpLink } from 'apollo-link-http';\nimport { BatchHttpLink } from 'apollo-link-batch-http';\nimport { logger } from '@paypalcorp/c3-util-logger';\nimport get from 'dlv';\nimport { params } from '@paypalcorp/c3-util-browser';\nimport { ERROR_PAYLOAD } from '@paypalcorp/c3-util-logger';\nimport { redirectToLogin } from '@/lib/redirects';\nimport { getGlobals, getCredit, getIsLinkAndPay, setClient } from '@paypalcorp/c3-shared-globals';\nimport { instrumentationLink, loggerLink, spinnerLink, authLink } from '@/lib/apolloLinks';\nimport { defaultApolloCacheState, resolvers, updateContingency } from '@paypalcorp/c3-util-store';\nimport { GLOBAL_CONTINGENCIES_HANDLERS, HANDLED_CONTINGENCIES } from '@/lib/contingencies';\n\nimport { getClientMetadataID } from './fraudNet';\nimport CheckoutError from './checkoutError';\nimport { apolloInMemoryCache } from './apolloCache';\nimport { initFeatures } from '@/features';\n\nconst createClient = ({\n token,\n queryEndpoint,\n auth,\n enableBatching = true,\n enableRetry = false,\n cache,\n mockLink,\n schemaLink,\n}) => {\n initFeatures();\n const { user } = getGlobals();\n const { euat } = params();\n let accessToken = user.auth && user.auth.access_token;\n\n if (euat && euat === '1') {\n accessToken = window.location.hash.substr(1);\n }\n\n const headers = {\n 'x-app-name': 'checkoutuinodeweb_hermione',\n 'x-paypal-internal-euat': accessToken,\n 'paypal-client-metadata-id': getClientMetadataID(token),\n };\n\n const httpLink = new createHttpLink({\n uri: queryEndpoint,\n credentials: 'include',\n headers,\n });\n\n const batchLink = new BatchHttpLink({\n uri: queryEndpoint,\n credentials: 'include',\n headers,\n // batchMax: 10, // number of items to batch (default is 10)\n // batchInterval: 10 // ms interval at which to batch (default is 10)\n });\n\n const planningBatchLink = new BatchHttpLink({\n uri: queryEndpoint,\n credentials: 'include',\n headers,\n });\n\n // splitLink allows forking of which link to use based on some parameter. Here\n // we tell Apollo to use batch queries if `planningBatch: true` is present on\n // context. Other queries get passed to the normal batchLink\n const splitLink = split(\n ({ getContext }) => getContext().planningBatch,\n planningBatchLink,\n batchLink\n );\n\n const errorLink = onError(\n ({ operation, graphQLErrors, networkError, response = {}, forward }) => {\n const { operationName, variables, getContext } = operation;\n const { skipFallback = false } = getContext();\n let desc;\n let code;\n\n if (graphQLErrors && graphQLErrors.length) {\n const errorCodes = new Set(graphQLErrors.map(({ message }) => message));\n desc = graphQLErrors[0].statusCode === 200 ? `gqlContingency` : `gqlServiceError`;\n code = Array.from(errorCodes).join('');\n logger.cal.error(`APOLLO_${operationName}_GQLError_${code}`, {\n token,\n });\n\n // Link and pay does not require to handle any contingencies\n if (HANDLED_CONTINGENCIES.includes(code) && !getIsLinkAndPay()) {\n graphQLErrors.forEach(\n ({ contingency: isContingency, message: contingencyCode, errorData = {} } = {}) => {\n // TODO (Jay): ensure only save data once and execute contingency once\n isContingency &&\n updateContingency(\n contingencyCode,\n errorData.resolution || { data: errorData } // 3DS (2.0) contingency data structure is a little bit different than our current standard contingency\n ).then(() => {\n logger.cal.info(`HANDLE_${contingencyCode}_CONTINGENCY`);\n });\n }\n );\n }\n } else if (networkError) {\n const { statusCode } = networkError;\n // Helps to debug unhelpful mocking / mutation errors by showing how a\n // mutation was called. This should be moved somewhere else, like creating\n // a new \"test link\", or by adding more logging options for testing.\n if (process.env.NODE_ENV === 'development' || process.env.NODE_ENV === 'test') {\n console.error(`Error calling ${operationName} with:`, JSON.stringify(variables, null, 2));\n }\n desc = 'gqlNetworkError';\n code = statusCode;\n logger.cal.error(`APOLLO_${operationName}_NetworkError_${statusCode}`, { token });\n } else {\n desc = 'gqlUnknownError';\n code = 'UNKNOWN';\n logger.cal.error(`APOLLO_UNKNOWN_ERROR`, { token });\n }\n\n // Log apollo related error to FPTI\n logger.fpti(\n 'APOLLO_ERROR',\n ERROR_PAYLOAD({\n desc,\n code,\n source: operationName,\n currency_code: get(response.data, 'checkoutSession.cart.amounts.total.currencyCode'),\n })\n );\n\n // 401 is expected for new user\n if (code === 401 && !getCredit().newUser) {\n redirectToLogin();\n return;\n }\n\n // Ensure mutation operations to fallback to Hermes in case of encountering\n // any GraphQL and Network errors\n // On top of the above mutation operations, we also need to ensure global contingency\n // handlings do not trigger any fallbacks (See above `CONTINGENCIES` for the list of global\n // contingency currently Hermione is trying to handle)\n if (GLOBAL_CONTINGENCIES_HANDLERS[code]) {\n logger.cal.info(`APOLLO_${operationName}_CONTINGENCY_GLOBAL_HANDLER`);\n GLOBAL_CONTINGENCIES_HANDLERS[code](graphQLErrors.find((err) => err.message === code));\n return;\n } else if ((HANDLED_CONTINGENCIES.includes(code) && !getIsLinkAndPay()) || skipFallback) {\n logger.cal.info(`APOLLO_${operationName}_SKIP_HERMES_FALLBACK`);\n return;\n }\n\n // Remove when appropriate. See comment for function above\n CheckoutError({\n message: desc,\n error: {\n graphQLErrors,\n networkError,\n },\n });\n }\n );\n\n // RetryLink is only triggered for network errors. Make 4 attempts,\n // otherwise throw an error to trigger the global error handler and\n // fallback to Hermes. If no error is thrown, then the timeout is not\n // handled and UI is broken.\n const retryLink = new RetryLink({\n delay: {\n initial: 1500,\n max: 1500,\n jitter: false, // jitter needs to be set to false in order to retry as a `BATCH`\n },\n attempts: (count, { operationName, getContext }, error) => {\n const { skipRetry = false } = getContext();\n\n if (error && error.statusCode === 401) {\n logger.cal.error(`APOLLO_RETRY_401`, {\n message: error.message,\n });\n return false;\n }\n\n if (error && count < 5 && !skipRetry) {\n logger.cal.error(`APOLLO_RETRY_${operationName}`, {\n message: error.message,\n });\n return true;\n }\n\n logger.cal.error(`APOLLO_RETRY_FAILURE_${operationName}`, {\n message: error.message,\n });\n return false;\n },\n });\n\n // Order is important. Must end with a \"terminating link\", such as httpLink\n // https://www.apollographql.com/docs/link/overview.html#terminating\n const getLinks = () => {\n const apolloLinks = [instrumentationLink, errorLink, spinnerLink()];\n\n if (process.env.NODE_ENV === 'development') {\n apolloLinks.unshift(loggerLink());\n }\n\n if (!schemaLink && !mockLink && enableRetry) {\n apolloLinks.push(retryLink);\n }\n if (schemaLink) {\n apolloLinks.push(schemaLink);\n } else {\n apolloLinks.push(authLink(headers)); // Refresh access token based in global variables\n if (enableBatching) {\n apolloLinks.push(splitLink);\n } else {\n apolloLinks.push(httpLink);\n }\n }\n return ApolloLink.from(apolloLinks);\n };\n\n logger.cal.info(`AUTH_STATE_${auth.state}`, { token, auth });\n logger.cal.info('APOLLO_CREATE_CLIENT', {\n token,\n uri: queryEndpoint,\n batching: enableBatching,\n retry: enableRetry,\n });\n\n const apolloCache = cache || apolloInMemoryCache();\n\n const apolloClient = new ApolloClient({\n cache: apolloCache,\n link: getLinks(),\n resolvers: resolvers,\n });\n\n apolloCache.writeData({ data: defaultApolloCacheState() });\n\n setClient(apolloClient);\n return apolloClient;\n};\n\nexport default createClient;\n","import { getToken, getCredit } from '@paypalcorp/c3-shared-globals';\nimport { ElmoExperiment } from '@paypalcorp/c3-util-elmo-experiment';\nimport {\n IS_STICKY_ENABLED,\n isEnabledForCountry,\n setFeatures,\n SPINNER_TYPES,\n} from '@paypalcorp/c3-util-store';\n\nexport const initFeatures = () =>\n setFeatures([\n /**\n * NOTE:\n * `NOT_IN_USE` must ALWAYS be first.\n * All new features must be after `NOT_IN_USE`\n */\n {\n id: 'NOT_IN_USE',\n enabled: false,\n experiment: null,\n },\n {\n id: 'PAY_WITH',\n enabled: true,\n visible: true,\n data: {\n continueButtonAction: undefined,\n creditFIOption: undefined,\n forceRadioButton: false,\n preferredFundingOptionId: undefined,\n selectedFundingOptionId: undefined,\n usePayAfterDelivery: false,\n useSplitBalance: false,\n },\n },\n {\n id: 'THREE_DS_FULL_PAGE_RESOLVER', // Currently feature is only for IN due to RuPay fullPage redirect instead of iframe\n enabled: isEnabledForCountry(['IN']),\n visible: true,\n },\n {\n id: 'REWARDS_DISPLAY',\n enabled: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n visible: true,\n data: {\n rewardAmount: undefined,\n rewardCurrency: undefined,\n rewardSelected: undefined,\n },\n },\n {\n id: 'REWARDS_INTERSTITIAL',\n enabled: true,\n visible: false,\n },\n {\n id: 'INSTALLMENTS_DISPLAY',\n enabled: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n visible: true,\n },\n {\n id: 'SELECT_INSTALLMENTS_INTERSTITIAL',\n enabled: true,\n visible: false,\n },\n {\n id: 'ECONSENT',\n enabled: isEnabledForCountry(['US']),\n },\n {\n id: 'ADD_FI',\n enabled: true,\n visible: false,\n experiment: ElmoExperiment.initWithDefaultTreatment(ElmoExperiment.TREATMENTS.TREATMENT_1),\n data: {\n updateCardNotification: false,\n fi: undefined,\n },\n },\n {\n id: 'ADD_CARD',\n enabled: true,\n visible: true,\n data: {\n address: undefined,\n card: undefined,\n token: getToken(),\n user: undefined,\n },\n },\n {\n id: 'ADD_BANK',\n enabled: true,\n visible: true,\n data: {},\n },\n {\n id: 'ADD_BANK_DISCLAIMER',\n enabled: true,\n visible: true,\n },\n {\n id: 'ADD_CARD_ONLY',\n enabled: !isEnabledForCountry(['DE']),\n visible: true,\n },\n {\n id: 'ADD_BANK_OR_CARD',\n enabled: isEnabledForCountry(['DE']),\n visible: true,\n },\n {\n id: 'CREDIT_CARD_FORM',\n enabled: true,\n visible: true,\n },\n {\n id: 'ADD_FI_LINK',\n enabled: true,\n visible: true,\n },\n {\n id: 'THREE_DS_CONFIRMATION', // 3DS (1.0) flow\n enabled: true,\n },\n {\n id: 'THREE_DS_TWO_CONFIRMATION', // 3DS (2.0) flow\n enabled: true,\n },\n {\n id: 'ADD_SHIPPING_LINK',\n enabled: true,\n visible: true,\n },\n {\n id: 'ADD_SHIPPING',\n enabled: true,\n },\n {\n id: 'SELECT_SHIPPING',\n enabled: true,\n visible: false,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'CART',\n enabled: true,\n },\n {\n id: 'CART_DROPDOWN',\n enabled: true,\n },\n {\n id: 'PERSONALIZED_BANNER',\n enabled: true,\n visible: true,\n },\n {\n id: 'FI_ATTRIBUTION',\n enabled: true,\n visible: true,\n },\n {\n id: 'HEADER',\n enabled: true,\n visible: true,\n },\n {\n id: 'MERCHANT_LOGO',\n enabled: true,\n visible: true,\n },\n {\n id: 'DONATION_PAYPAL_CONFIRMED_CHARITY',\n enabled: isEnabledForCountry(['US']),\n visible: true,\n },\n {\n id: 'PAGE_ALERT',\n enabled: true,\n data: {\n display: false, // ? not sure why we have this when it already has `visible`\n message: undefined,\n type: 'info',\n },\n },\n {\n id: 'REVIEW_PAGE_ALERT',\n enabled: true,\n visible: true,\n data: {\n display: false, // ? not sure why we have this when it already has `visible`\n message: undefined,\n type: 'info',\n },\n },\n {\n id: 'SPINNER',\n enabled: true,\n visible: getCredit().isCreditSecondButton,\n data: { type: SPINNER_TYPES.DEFAULT },\n },\n {\n id: 'RETURN_TO_MERCHANT_SPINNER',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(ElmoExperiment.TREATMENTS.TREATMENT_1),\n },\n {\n id: 'CHECKOUT_BUTTON',\n enabled: true,\n visible: true,\n data: {\n status: 'INITIAL',\n checkoutButtonLabelOverride: undefined,\n inContingencyFlow: false,\n flow: undefined,\n },\n },\n {\n id: 'CHECKOUT_BUTTON_CONTAINER',\n enabled: true,\n visible: true,\n },\n {\n id: 'DECLINE_NOTIFICATION',\n enabled: true,\n visible: true,\n },\n {\n id: 'DECLINE_NOTIFICATION_NEW',\n enabled: true,\n visible: true,\n },\n {\n id: 'OPEN_BANKING_NOTIFICATION',\n enabled: true,\n visible: true,\n },\n {\n id: 'DISCLAIMER',\n enabled: true,\n visible: true,\n data: { showDescriptor: false },\n },\n {\n id: 'DISCLAIMER_AU',\n enabled: isEnabledForCountry(['AU']),\n visible: true,\n },\n {\n id: 'DISCLAIMER_CPA',\n enabled: true,\n visible: true,\n },\n {\n id: 'CIP_DISCLAIMER', // CIP: Customer Identification Program for AU\n enabled: isEnabledForCountry(['AU']),\n visible: true,\n },\n {\n id: 'APAC_DISCLAIMER', // Legal disclaimer for APAC countries\n enabled: isEnabledForCountry([\n 'BN',\n 'BT',\n 'FJ',\n 'FM',\n 'ID',\n 'JP',\n 'KH',\n 'KI',\n 'KR',\n 'LA',\n 'LK',\n 'HK',\n 'MH',\n 'MN',\n 'MV',\n 'MY',\n 'NF',\n 'NP',\n 'NR',\n 'NU',\n 'NZ',\n 'PG',\n 'PH',\n 'PN',\n 'PW',\n 'SB',\n 'SG',\n 'TO',\n 'TV',\n 'TH',\n 'VN',\n 'VU',\n 'WS',\n ]),\n visible: true,\n },\n {\n id: 'DISCLAIMER_CPA_ABOVE_CONTINUE',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'BILLING_ADDRESS_CONSENT_DISCLAIMER',\n enabled: true,\n visible: true,\n },\n {\n id: 'FOOTER',\n enabled: true,\n visible: true,\n },\n {\n id: 'CREDIT_OFFER',\n enabled: isEnabledForCountry(['US', 'GB']),\n visible: true,\n data: { creditOfferLabel: undefined },\n },\n {\n id: 'CREDIT_OFFER_AS_FI_DE',\n enabled: isEnabledForCountry(['DE']),\n visible: true,\n data: {\n continueButtonText: undefined,\n creditOfferLabel: undefined,\n presentmentType: undefined,\n },\n },\n {\n id: 'CREDIT_OFFER_AS_FI',\n enabled: isEnabledForCountry(['FR', 'MQ', 'GP', 'GF', 'RE', 'GB', 'US']), // MQ, GP, GF, and RE are the territories in FR\n visible: true,\n },\n {\n id: 'CREDIT_CROSS_CURRENCY_INFO',\n enabled: isEnabledForCountry(['FR', 'MQ', 'GP', 'GF', 'RE', 'GB', 'US']), // MQ, GP, GF, and RE are the territories in FR\n visible: true,\n },\n {\n id: 'REPRESENTATIVE_EXAMPLE',\n enabled: isEnabledForCountry(['DE']),\n },\n {\n id: 'REPRESENTATIVE_EXAMPLE_ICON',\n enabled: isEnabledForCountry(['DE']),\n visible: true,\n },\n {\n id: 'CREDIT_CROSS_CURRENCY_INFO_BANNER',\n enabled: isEnabledForCountry(['GB']),\n visible: true,\n },\n {\n id: 'SHIP_TO',\n enabled: true,\n visible: true,\n data: {\n isChangeShippingLinkClicked: false,\n userSelectedAddressId: undefined,\n toggle: false,\n },\n },\n {\n id: 'DONATION_SHARE_ADDRESS',\n enabled: true,\n visible: true,\n data: {\n shareAddressWithDonatee: false,\n },\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'SHOW_MORE_FUNDING_OPTIONS',\n enabled: !IS_STICKY_ENABLED,\n visible: true,\n },\n\n {\n id: 'SPLIT_BALANCE',\n enabled: true,\n visible: true,\n data: {\n selected: true,\n },\n },\n {\n id: 'SHARED_CARD_CONSENT_PAGE',\n enabled: true,\n },\n {\n id: 'SHARED_CARD_CONSENT_WAIT_PAGE',\n enabled: true,\n },\n {\n id: 'ADD_NORMALIZED_ADDRESS',\n enabled: isEnabledForCountry(['AU', 'BR']),\n data: {\n normalizedAddress: undefined,\n originalAddress: undefined,\n },\n },\n {\n id: 'CURRENCY_CONVERSION',\n enabled: true,\n },\n {\n id: 'CURRENCY_CONVERSION_OPTION',\n enabled: true,\n visible: true,\n },\n {\n id: 'CURRENCY_CONVERSION_LINK',\n enabled: true,\n visible: true,\n },\n {\n id: 'CURRENCY_CONVERSION_FEE_DISCLOSURE',\n enabled: !isEnabledForCountry([\n 'AT',\n 'BE',\n 'BG',\n 'CY',\n 'CZ',\n 'DE',\n 'DK',\n 'EE',\n 'ES',\n 'FI',\n 'FR',\n 'GB',\n 'GG',\n 'GI',\n 'GR',\n 'HR',\n 'HU',\n 'IM',\n 'IT',\n 'JE',\n 'LT',\n 'LU',\n 'LV',\n 'MT',\n 'NL',\n 'PL',\n 'PT',\n 'RO',\n 'SE',\n 'SI',\n 'SK',\n 'SM',\n 'VA',\n 'YT',\n ]),\n visible: true,\n },\n {\n id: 'AUTH_SETTLE_COMPLIANCE_CONTENT',\n enabled: true,\n visible: true, // TODO: turn to `false` to save some bundle size :)\n },\n {\n id: 'CURRENCY_CONVERSION_CONTENT_BR',\n enabled: isEnabledForCountry(['BR']),\n visible: true,\n },\n {\n id: 'CURRENCY_CONVERSION_SHEET',\n enabled: true,\n },\n {\n id: 'CVV_CONFIRMATION',\n enabled: true,\n },\n {\n id: 'DISCLAIMER_IN',\n enabled: isEnabledForCountry(['IN']),\n visible: true, // TODO: turn it `false` to save some bundle size :)\n },\n {\n id: 'CREDIT_EXAMPLE_TEXT',\n enabled: isEnabledForCountry(['GB']),\n visible: true,\n },\n {\n id: 'CREDIT_FI_LABEL',\n enabled: true,\n visible: true,\n },\n {\n id: 'PAY_AFTER_DELIVERY',\n enabled: true,\n visible: true,\n },\n {\n id: 'PAY_AFTER_DELIVERY_FI_SUBTEXT',\n enabled: true,\n visible: true,\n },\n {\n id: 'POLICY_AGREEMENT',\n enabled: isEnabledForCountry(['JP']),\n visible: true,\n },\n {\n id: 'INCENTIVES',\n enabled: true,\n visible: true,\n },\n {\n id: 'GIVE_AT_CHECKOUT',\n enabled: isEnabledForCountry(['US', 'GB', 'CA', 'AU', 'IE', 'DE', 'IT']),\n visible: true,\n data: {\n giveAtCheckoutOpted: false,\n giveAtCheckoutNonProfitId: undefined,\n },\n },\n {\n id: 'DOLPHIN_BANNER',\n enabled: true,\n visible: true,\n },\n {\n id: 'DOLPHIN_INTERSTITIAL',\n enabled: true,\n },\n {\n id: 'SELECT_FI',\n enabled: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n data: { landingPage: undefined },\n },\n {\n id: 'SELECT_FI_LINK',\n enabled: true,\n visible: true,\n },\n {\n id: 'SELECT_FI_ADD_FI_LINK',\n enabled: true,\n visible: true,\n },\n {\n id: 'SELECT_CREDIT_CARD_TYPE',\n enabled: true,\n visible: true,\n },\n {\n id: 'SELECT_COMBO_CARD_TYPE',\n enabled: isEnabledForCountry(['BR']),\n visible: true,\n data: { treatments: [] },\n },\n {\n id: 'SUPPORTED_FUNDING_SOURCE_ICONS',\n enabled: !isEnabledForCountry(['FR', 'IT', 'ES']),\n visible: true,\n },\n {\n id: 'SUPPORTED_FUNDING_SOURCE_ICONS_BR',\n enabled: isEnabledForCountry(['BR']),\n visible: true,\n },\n {\n id: 'DATE_OF_BIRTH',\n enabled: true,\n visible: true,\n },\n {\n id: 'LINK_AND_PAY',\n enabled: true,\n visible: true,\n data: { selectedFundingOptionId: undefined },\n },\n {\n id: 'LINK_AND_PAY_INCENTIVE',\n enabled: true,\n visible: true,\n },\n {\n id: 'LINK_AND_PAY_DISCLAIMER',\n enabled: true,\n visible: true,\n },\n {\n id: 'CREDIT_APPLY_PORTABLE',\n enabled: true,\n data: {\n isCapOpen: false,\n selectedCRCOfferID: undefined,\n },\n },\n {\n id: 'CREDIT_SINGLE_FI_DISPLAY',\n enabled: true,\n data: { isGPLFi: false },\n },\n {\n id: 'CANCEL_LINK',\n enabled: true,\n visible: true,\n },\n {\n id: 'SEPA_CONFIRMATION',\n enabled: true,\n data: { bankData: undefined },\n },\n {\n id: 'FI_PAYER_DISCLAIMER',\n enabled: true,\n visible: true,\n },\n {\n id: 'OPEN_BANKING',\n enabled: true,\n visible: false,\n data: {\n blackListedFI: undefined,\n hideDeclineNotification: false,\n },\n experiment: ElmoExperiment.initWithDefaultTreatment(ElmoExperiment.TREATMENTS.TREATMENT_1),\n },\n {\n id: 'BACKUP_FUNDING_DISCLAIMER',\n enabled: true,\n visible: true,\n },\n {\n id: 'BACKUP_FI',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(ElmoExperiment.TREATMENTS.TREATMENT_1),\n },\n {\n id: 'BILLING_AGREEMENT',\n enabled: true,\n // experiment: ElmoExperiment.initWithDefaultTreatment(ElmoExperiment.TREATMENTS.CONTROL),\n visible: true,\n },\n {\n id: 'BANK_AS_DEBIT',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n data: {\n addBankAsDebit: false,\n },\n },\n {\n id: 'PPC_INSTALLMENTS',\n enabled: isEnabledForCountry(['US', 'GB', 'DE']),\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'PPC_SECOND_BUTTON',\n enabled: isEnabledForCountry(['US', 'GB']),\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'BANK_AS_DEBIT_DISALLOWED',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'ADD_FI_CHOICE_LIST',\n enabled: true,\n visible: true,\n },\n {\n id: 'SPLIT_TENDER_GATE',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n data: {\n isSplitReady: false,\n userCanSplit: false,\n showSplitContinue: false,\n showSplitExperience: false,\n },\n },\n {\n id: 'PAY_WITH_SPLIT_TENDER',\n enabled: true,\n visible: true,\n },\n {\n id: 'ADD_POTENTIAL_CARD',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'OTP_CONFIRMATION',\n enabled: true,\n data: {\n isNewCard: false,\n fundingInstrumentId: null,\n phone: {\n number: null,\n countryCode: null,\n },\n },\n },\n {\n id: 'SPLIT_TENDER_BACKUP',\n enabled: true,\n visible: false,\n },\n {\n id: 'SPLIT_TENDER_PAY_WITH',\n enabled: true,\n visible: false,\n },\n {\n id: 'REDIRECT_TO_CREDIT',\n enabled: true,\n visible: true,\n data: {\n eConsentTriggerRefresh: false,\n },\n },\n {\n id: 'RETURN_FROM_CREDIT',\n enabled: true,\n visible: true,\n },\n {\n id: 'PAY_LATER',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'PPC_REDIRECT',\n enabled: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'PAYMENT_OPTIONS',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'TABBED_PAYMENT_OPTIONS',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'UPSTREAM_PRESENTMENT',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'UPSTREAM_TABS',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'BNPL_STACKED_BUBBLE',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'BNPL_TABBED_BUBBLE',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'CAP_AUTO_OPEN',\n enabled: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'RESTRICTED_ACCOUNT',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'CBT_DECLINE_NOTIFICATION',\n enabled: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'WPS_DONE_PAGE',\n enabled: true,\n visible: false,\n },\n {\n id: 'REVIEW_BEFORE_LOGIN',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'TRUSTED_BENEFICIARY_OPT_IN',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'CRYPTO_DISPLAY',\n enabled: true,\n visible: true,\n experiment: ElmoExperiment.initWithDefaultTreatment(),\n },\n {\n id: 'CRYPTO_TERMS',\n enabled: true,\n visible: false,\n data: {\n acknowledged: false,\n fundingInstrumentIdToSelect: '',\n },\n },\n ]);\n","import Feature from '@/components/Feature';\nimport { CPA_DISCLAIMER_QUERY } from '@/components/Disclaimer/CPADisclaimer/query.gql';\nimport { getToken } from '@paypalcorp/c3-shared-globals';\n\nconst ReturnToMerchantSpinner = Feature({\n id: 'RETURN_TO_MERCHANT_SPINNER',\n queries: [\n { query: CPA_DISCLAIMER_QUERY, variables: { token: getToken() }, fetchPolicy: 'cache-only' },\n ],\n})({\n experiments: {\n TREATMENT_1: () => import('./ReturnToMerchantSpinnerControl'),\n TREATMENT_2: () => import('./ReturnToMerchantSpinnerPreAuthCard'),\n TREATMENT_3: () => import('./ReturnToMerchantSpinnerCompletePayment'),\n },\n});\n\nexport default ReturnToMerchantSpinner;\n","import React from 'react';\n// something with the exports from @/store/index causes Feature to be undefined. Guessing\n// there are multiple methods exporting the same name and jest gives really bad errors.\nimport { updateFeature } from '@paypalcorp/c3-util-store';\nimport { logger } from '@paypalcorp/c3-util-logger';\nimport AnimatedContainer from './AnimatedContainer';\nimport { lazyComponent } from '@/lib/lazyLoad';\n\nconst LazyInterstitialContainer = lazyComponent(\n () => import('@paypalcorp/c3-component-interstitial'),\n {\n id: 'INTERSTITIAL',\n loading: () => ,\n }\n);\n\n/**\n * Container which wraps every feature and decides:\n * - how feature will be rendered (animated / interstitial / inline / hidden )\n * - manages auto showing / hiding feature\n * - logs experiment data\n */\nexport class FeatureContainer extends React.Component {\n // helper to call a function when prop's boolean value is changed\n callOnPropChange = (prevProps, prop, f) => {\n const propValue = this.props[prop];\n\n if (!prevProps[prop] && propValue) {\n return f(true);\n } else if (prevProps[prop] && !propValue) {\n return f(false);\n }\n return {};\n };\n\n // check if feature needs to be disabled or enabled dynamically\n setEnablement() {\n const {\n data: {\n feature: { experiment },\n },\n id,\n isGqlDataResolved,\n } = this.props;\n\n // wait until gql data is resolved before turning off the feature to get eligibility being logged\n if (isGqlDataResolved && experiment && experiment.isControl()) {\n logger.cal.info(`FEATURE_${id}_DISABLED_DUE_ELMO_CONTROL`);\n\n return {\n enabled: false,\n };\n }\n return {};\n }\n\n // toggle \"visible\" prop of the feature\n onAutoDisplayChange = (value) => {\n const { id } = this.props;\n\n logger.cal.info(`FEATURE_${id}_AUTO_VISIBILITY_${value}`);\n\n return {\n visible: value,\n };\n };\n\n // do things based on \"shouldLoadFeature\" prop\n onShouldLoadFeatureChange = (value) => {\n const {\n data: {\n feature: { experiment, eligible },\n },\n id,\n isGqlDataResolved,\n } = this.props;\n\n // until gql data is resolved we should not touch things\n if (!isGqlDataResolved) {\n return {};\n }\n\n if (experiment) {\n experiment.logExperiment({\n logger: logger.fpti,\n featureId: id,\n eligibility: value,\n });\n }\n\n if (value !== eligible) {\n return { eligible: value };\n }\n\n return {};\n };\n\n componentDidMount() {\n const { shouldLoadFeature, autoDisplay, id } = this.props;\n const shouldLoadFeaturePayload = this.onShouldLoadFeatureChange(shouldLoadFeature);\n\n let autoDisplayPayload = {};\n\n if (autoDisplay) {\n autoDisplayPayload = this.onAutoDisplayChange(autoDisplay);\n }\n const setEnablementPayload = this.setEnablement();\n\n const payload = {\n ...autoDisplayPayload,\n ...shouldLoadFeaturePayload,\n ...setEnablementPayload,\n };\n\n if (Object.keys(payload).length !== 0) updateFeature(id, payload);\n }\n\n componentDidUpdate(prevProps, prevState, snapshot) {\n const { shouldLoadFeature, isGqlDataResolved, id } = this.props;\n\n let shouldLoadFeaturePayload = {};\n\n const autoDisplayPayload = this.callOnPropChange(\n prevProps,\n 'autoDisplay',\n this.onAutoDisplayChange\n );\n\n if (!prevProps.isGqlDataResolved && isGqlDataResolved) {\n shouldLoadFeaturePayload = this.onShouldLoadFeatureChange(shouldLoadFeature);\n } else {\n shouldLoadFeaturePayload = this.callOnPropChange(\n prevProps,\n 'shouldLoadFeature',\n this.onShouldLoadFeatureChange\n );\n }\n const setEnablementPayload = this.setEnablement();\n\n const payload = {\n ...autoDisplayPayload,\n ...shouldLoadFeaturePayload,\n ...setEnablementPayload,\n };\n\n if (Object.keys(payload).length !== 0) {\n updateFeature(id, payload);\n }\n }\n\n renderWrappedComponent() {\n const { data, loading, FeatureComponent, shouldKeepLoadingStateOnError, hasError } = this.props;\n\n return (\n \n );\n }\n\n renderInterstitial() {\n let { id, interstitialOptions = {} } = this.props;\n\n return (\n \n {this.renderWrappedComponent(true)}\n \n );\n }\n\n renderWithAnimateHeight() {\n let {\n id,\n data: { feature },\n shouldLoadFeature = true,\n animateOptions: { animateOpacity, animateContainerClass },\n } = this.props;\n\n return (\n \n {this.renderWrappedComponent()}\n \n );\n }\n\n render() {\n let {\n data: {\n feature: { experiment, visible },\n },\n interstitial,\n animateOptions: { animateHeight },\n shouldLoadFeature = true,\n shouldLoadInstance,\n } = this.props;\n\n // render empty fragment if feature in the control experiment\n if (!shouldLoadInstance || (experiment && experiment.isControl())) {\n return ;\n }\n\n if (interstitial) {\n return shouldLoadFeature && visible && this.renderInterstitial();\n }\n\n if (animateHeight) {\n return this.renderWithAnimateHeight();\n }\n\n return shouldLoadFeature && visible && this.renderWrappedComponent();\n }\n}\n","import React, { useState, useEffect } from 'react';\nimport AnimateHeight from 'react-animate-height';\nimport { isTesting } from '@paypalcorp/c3-shared-globals';\n\nconst AnimatedContainer = ({ visible, children, ...attributes }) => {\n let [shouldRender, setRender] = useState(visible);\n\n useEffect(() => {\n if (visible) {\n setRender(visible);\n }\n }, [visible, setRender]);\n\n return (\n {\n if (!visible) {\n setRender(false);\n }\n }}\n >\n {visible || shouldRender ? children : }\n \n );\n};\n\nexport default AnimatedContainer;\n","import { logger } from '@paypalcorp/c3-util-logger';\nimport { isNewIncontext, isLegacyIncontext, isVzeroIntegration } from '@/lib/utils';\nimport { isIframe, isPopup, isWebView, params } from '@paypalcorp/c3-util-browser';\nimport { getIsUserSkipFacebookLogin } from '@/authStates';\n\n/**\n * Eligibility check for things that cannot be checked on the server-side (ie. window properties)\n * This should not be dependent on any GQL queries, so we can fallback immediately and not worry about\n * having simultaneous requests touching the checkout session.\n *\n * Checks for:\n * 1. legacy in-context integrations\n * 2. iframes\n */\nexport default function windowEligible() {\n let eligibleForHermione = false;\n let reason;\n\n const incontextUnsupportedMessenger =\n window.xprops && window.xprops.experience && window.xprops.experience.messenger;\n\n // Note that this is only part of the check for partner integration - there's some API data in xo-landing-router not being checked here that determines if this is a partner integration or not\n const isPartnerIntegration = isVzeroIntegration();\n // Handling for PPC application return flow is not handled - see https://github.paypal.com/Checkout-R/checkoutuinodeweb/issues/620\n const isCreditApplyReturnFlow = params().success && params().key;\n const isSkipFacebookLoginFlow = getIsUserSkipFacebookLogin();\n\n if (incontextUnsupportedMessenger) {\n reason = 'incontext_unsupported_fb_messenger';\n eligibleForHermione = false;\n } else if (isPartnerIntegration) {\n // Partner integration needs some extra handling - https://github.paypal.com/Checkout-R/checkoutuinodeweb/issues/525\n logger.cal.info('PARTNER_VZERO_INTEGRATION', {\n isIframe: isIframe(),\n isPopup: isPopup(),\n isNewContext: isNewIncontext(),\n isLegacyContext: isLegacyIncontext(),\n nolegacy: params().nolegacy === '1',\n ppFrameRedirect: window.name === 'PPFrameRedirect',\n windowName: window.name,\n btQueryParams: params().bt_int_type,\n });\n\n eligibleForHermione = true;\n reason = `supported_vzero_integration${\n isIframe() ? '_iframe' : isPopup() ? '_popup' : '_fullpage'\n }`;\n } else if (isSkipFacebookLoginFlow) {\n logger.cal.info('SKIP_FACEBOOK_LOGIN', {\n isNewContext: isNewIncontext(),\n isLegacyContext: isLegacyIncontext(),\n webview: isWebView(navigator && navigator.userAgent),\n userAgent: navigator && navigator.userAgent,\n });\n eligibleForHermione = true;\n reason = 'supported_skip_facebook_login';\n } else if (isCreditApplyReturnFlow) {\n reason = 'ppc_apply_flow';\n eligibleForHermione = true;\n } else {\n eligibleForHermione = true;\n reason = 'supported_features';\n }\n\n const eligibility_reason = `xolite_window_${\n eligibleForHermione ? 'eligible' : 'ineligible'\n }_${reason}`;\n logger.cal.info(`${eligibility_reason}`);\n\n return {\n windowEligibility: eligibleForHermione,\n reason,\n };\n}\n","import { hot } from 'react-hot-loader/root';\nimport React from 'react';\nimport { getIsResolveThreeDS, getIsLinkAndPay } from '@paypalcorp/c3-shared-globals';\nimport { lazyComponent } from '@/lib/lazyLoad';\n\nimport './App.global.css';\n\nconst Hermione = lazyComponent(() => import('./experiences/Hermione'), {\n id: 'HERMIONE',\n loading: () => <>,\n});\n\nconst ThreeDSFullPageApp = lazyComponent(() => import('./experiences/ThreeDSFullPage'), {\n id: 'THREE_DS_FLL_PAGE',\n loading: () => <>,\n});\n\nconst LinkPayApp = lazyComponent(() => import('./experiences/LinkPay'), {\n id: 'LINK_PAY_APP',\n loading: () => <>,\n});\n\nconst ResolveApp = () => {\n if (getIsResolveThreeDS()) {\n return ;\n } else if (getIsLinkAndPay()) {\n return ;\n }\n return ;\n};\n\nexport default hot(ResolveApp);\n","import React from 'react';\n\n/**\n * in prod don't use React's ErrorBoundary, here is why:\n *\n * 1. Stack traces are not optimal, there is no file provided where the error occured\n * which means we can't use source maps to parse stack traces in CAL\n * 2. Error boundaries do not catch all errors (e.g errors in event handlers, in asynchronous code)\n * 3. Since we have already window.onerror functionality (in index.html) to catch any unhandled errors - Errorboundary becomes a second\n * place where some errors can be caught, but not all errors. Basically it becomes confusing when we have 2 places to catch unhandled errors and\n * 2 places where we do fallbacks for such errors.\n * 4. Error boundaries are good to catch errors anywhere in child component tree, log those errors, and display a fallback UI, which we don't so\n * simply because we need to fallback.\n * 5. ErrorBoundaries in prod works differently vs in dev. In prod window.onerror will be skipped, in dev it won't be skipped.\n *\n */\nlet ErrorBoundary = (props) => {\n return props.children;\n};\n\nif (process.env.NODE_ENV === 'development') {\n const { DevErrorBoundary } = require('./DevErrorBoundary');\n\n ErrorBoundary = (props) => {\n return ;\n };\n}\n\nexport default ErrorBoundary;\n","import ErrorBoundary from './ErrorBoundary';\nexport default ErrorBoundary;\n","import 'regenerator-runtime';\n// Using inidividual polyfills as required results in a much smaller bundle\nimport 'whatwg-fetch';\nimport 'core-js/features/promise';\n\n// needed for Apollo Client\nimport 'core-js/features/map';\nimport 'core-js/features/set';\nimport 'core-js/features/weak-map';\n\n// Array polyfills\nimport 'core-js/features/array/find';\nimport 'core-js/features/array/some';\nimport 'core-js/features/array/includes';\n\n// symbol is needed for addCard FR\nimport 'core-js/es/symbol';\n\n// needed for IE 10 and older browsers\nimport 'core-js/features/array/from';\n\n// Object polyfills\nimport 'core-js/features/object/assign';\nimport 'core-js/features/object/values';\nimport 'core-js/features/object/entries';\n\n// String polyfills\nimport 'core-js/features/string/includes';\n\n// https://developer.mozilla.org/en-US/docs/Web/API/Element/closest#Polyfill\nif (!Element.prototype.matches) {\n Element.prototype.matches =\n Element.prototype.msMatchesSelector || Element.prototype.webkitMatchesSelector;\n}\n\nif (!Element.prototype.closest) {\n Element.prototype.closest = function (s) {\n var el = this;\n if (!document.documentElement.contains(el)) return null;\n do {\n if (el.matches(s)) return el;\n el = el.parentElement || el.parentNode;\n } while (el !== null && el.nodeType === 1);\n return null;\n };\n}\n\n// Since IE10 doesn't support neither \"Object.setPrototypeOf\" nor \"__proto__\"\n// we need to monkey patch tslib which is used in Apollo client for extending zen-observable\n// by copying static class methods which are getting missed\nif (!(Object.setPrototypeOf || {}.__proto__)) {\n var tslib = require('tslib');\n var hoistNonReactStatics = require('hoist-non-react-statics');\n var __extends = tslib.__extends;\n tslib.__extends = function (target, source) {\n // Invoke the original method\n __extends.apply(this, [target, source]);\n hoistNonReactStatics(target, source);\n };\n}\n\n// Number.isNaN polyfill (not supported in all IE)\nNumber.isNaN =\n Number.isNaN ||\n function (value) {\n return value !== value;\n };\n","import { logger } from '@paypalcorp/c3-util-logger';\nimport { updateFeature } from '@paypalcorp/c3-util-store';\nimport stringify from 'qs/lib/stringify';\nimport { isFunction } from '@paypalcorp/c3-util-lang';\nimport { SPINNER_TYPES } from '@/components/Spinner';\nimport { RETURN_PAYLOAD, ERROR_PAYLOAD, THREE_DS_PAYLOAD } from '@paypalcorp/c3-util-logger';\nimport {\n setDestination,\n getProtocolType,\n isVzeroIntegration,\n postToMerchantForOldIncontext,\n} from '@/lib/utils';\nimport { params } from '@paypalcorp/c3-util-browser';\nimport { instrumentationLink } from '@/lib/apolloLinks';\nimport { getToken, getGlobals, getIsResolveThreeDS } from '@paypalcorp/c3-shared-globals';\n\nconst getIntegrationPayload = () => ({\n sdkMeta: params().sdkMeta,\n xComponent: params().xcomponent,\n});\n\n// If we do an internal redirect from hermesnodeweb to checkoutuinodeweb, we'll keep some URL params that can cause trouble with routing.\nconst BLACKLISTED_REDIRECT_QUERY_PARAMS = [\n 'cmd', // cmd=_express-checkout causes request to be routed to xorouternodeweb instead of hermesnodeweb\n // remove Link and Pay related params (on any fallback / redirect we don't want the experience to load again)\n 'exp_flow',\n 'linkPay',\n 'euat',\n];\n\n// Force to proceed redirect without logs being flush\nconst REDIRECT_TIMEOUT = 1000;\n\n/**\n * Force our logs to be flushed before triggering our cb function\n * By default we'll wait 1000 ms otherwise trigger cb without logs being flushed\n * @param {Object} context\n * @param {Function} context.redirect | Redirect cb fn to be invoked after logs being flushed\n * @param {Object} context.payload | The payload for callback\n * @param {Object} context.options | Options object to determine whehter current cb has been invoked or not\n * @param {String} context.logName | The name of the integration type\n */\nconst flushLogsAndRedirect = ({\n redirect = () => Promise.resolve(),\n payload = {},\n options = {},\n logName = 'FLUSH_LOGS',\n} = {}) => {\n instrumentationLink.logPayload();\n\n const doRedirect = () => {\n if (!options.redirected) {\n options.redirected = true;\n return redirect(payload);\n }\n return Promise.resolve();\n };\n\n // if flush takes too long, proceed with redirect anyways\n setTimeout(() => doRedirect(), REDIRECT_TIMEOUT);\n\n // flush logs before calling our redirect fn\n return logger.cal\n .flush()\n .then(() => doRedirect())\n .catch((err) => {\n logger.cal.info(`${logName}_ERROR`, { error: err.stack || err.toString() });\n return doRedirect();\n });\n};\n\n/**\n * Context containing all the necessary information needed to redirect back to the merchant site. Handles incontext and full page redirects.\n * @typedef {Object} ReturnContext\n * @property {Object} context - Context needed to properly redirect back to merchant site.\n * @property {string} context.returnUrl - URL for return to merchant after success. Query: checkoutSession.cart.returnUrl.href\n * @property {string} context.cancelUrl - URL for return to merchant after cancel. Query: checkoutSession.cart.cancelUrl.href\n * @property {string} context.token - EC token for transaction. Query: checkoutSession.cart.cartId\n * @property {string} context.intent - Intent of transaction. Query: checkoutSession.cart.intent\n * @property {string} [context.userId] - Payer ID of the buyer. Required for onAuthorize - is otherwise optional. Query: checkoutSession.buyer.userId\n * @property {string} [context.billingToken] - BA token, if applicable. Query: checkoutSession.cart.billingToken\n * @property {string} [context.paymentId] - Payment ID of the transaction. Probably only present if created via the payments API? Query: checkoutSession.cart.paymentId\n */\nconst mapCheckoutJsContext = ({\n returnUrl,\n cancelUrl,\n token = getToken(),\n billingToken,\n intent,\n userId,\n paymentId,\n} = {}) => ({\n // See https://github.com/paypal/paypal-checkout/blob/v5/docs/implement-checkout.md for what these values map to\n returnUrl,\n cancelUrl,\n billingToken,\n orderID: token, // From our perspective, orderID and token are the same\n payerID: userId,\n paymentToken: token,\n paymentID: paymentId,\n intent: intent && intent.toLowerCase(), // to match Hermes format\n});\n\n/**\n * Return to the merchant when the user wants to cancel out of the checkout flow\n * @param {ReturnContext} context\n */\nexport const returnCancel = (context) => {\n const { cancelUrl: url, currencyCode, merchantName } = context;\n const errorCode = 'CANCEL_RETURN_MERCHANT_ERROR';\n\n // reconstruct url when user comes from native experience\n let cancelUrl = params().native_xo ? reconstructReturnUrl({ url }) : url;\n\n logger.fpti(\n 'CANCEL_RETURN_TO_MERCHANT',\n RETURN_PAYLOAD({ action: 'cancel', currency_code: currencyCode, cancelUrl })\n );\n\n if (window.xprops && isFunction(window.xprops.onCancel)) {\n if (!isFunction(window.xprops.onCancel)) {\n logger.cal.warn('MERCHANT_ON_CANCEL_INTEGRATION_ERROR', {\n currencyCode,\n merchantName,\n cancelUrl,\n token: getToken(),\n ...getIntegrationPayload(),\n });\n }\n\n const payload = mapCheckoutJsContext(context);\n\n logger.cal.info('INCONTEXT_XPROPS_CANCEL', payload);\n\n // Redirect after logs flush\n return flushLogsAndRedirect({\n redirect: window.xprops.onCancel,\n payload,\n logName: 'INCONTEXT_XPROPS_ON_CANCEL_',\n options: { redirected: false },\n });\n }\n\n // for old checkout.js integration send post message\n if (\n cancelUrl &&\n postToMerchantForOldIncontext({\n operation: 'cancel_to_merchant',\n returnUrl: cancelUrl,\n updateParent: true,\n })\n ) {\n return;\n }\n\n // This value comes directly from the Checkout Session via GraphQL.\n // Shouldn't require any encoding.\n return redirect(cancelUrl)\n .then(() => {\n // if the return URL is a deeplink URL, then we should show\n // the page with a `Return to merchant` button so that the user can click on it to redirect\n if (getProtocolType(cancelUrl, 'cancelUrl').isDeepLink) {\n const reason = 'CANCEL_RETURN_TO_MERCHANT_DEEPLINK';\n\n logger.cal.info(reason, { url: cancelUrl });\n logger.fpti(reason, RETURN_PAYLOAD({ action: 'cancel', cancelUrl }));\n\n return redirectGenericError({ code: reason, returnUrl: cancelUrl, merchantName });\n }\n })\n .catch(() => {\n logger.fpti(errorCode, ERROR_PAYLOAD({ code: errorCode, cancelUrl, merchantName }));\n return redirectGenericError({ code: errorCode, returnUrl: cancelUrl, merchantName });\n });\n};\n\n/**\n * Return to the merchant when the user has approved the payment for checkout\n * @param {ReturnContext} context\n */\nexport const returnAuthorize = (context) => {\n const errorCode = 'RETURN_TO_MERCHANT_TIMEOUT';\n const { returnUrl, currencyCode, merchantName, paymentId } = context || {};\n\n logger.fpti(\n 'SUCCESS_RETURN_TO_MERCHANT',\n RETURN_PAYLOAD({ action: 'backToMerchant', currency_code: currencyCode, returnUrl, paymentId })\n );\n\n const updatedReturnUrl = reconstructReturnUrl({\n ...context,\n url: returnUrl,\n });\n\n // for new checkout.js integration call `onAuthorize` callback\n if (window.xprops) {\n if (!isFunction(window.xprops.onAuthorize)) {\n logger.cal.warn('MERCHANT_ON_AUTHORIZE_INTEGRATION_ERROR', {\n returnUrl,\n currencyCode,\n merchantName,\n vzero: isVzeroIntegration(),\n token: getToken(),\n ...getIntegrationPayload(),\n });\n }\n\n const payload = mapCheckoutJsContext({\n ...context,\n returnUrl: updatedReturnUrl,\n });\n\n if (window.xprops.getConnectURL) {\n logger.cal.info('INCONTEXT_XPROPS_CONNECT_REDIRECT');\n\n return window.xprops\n .getConnectURL({ payerID: payload.payerID })\n .then((connectURL) => {\n return flushLogsAndRedirect({\n logName: 'INCONTEXT_XPROPS_EBAY_CONNECT',\n redirect: () => {\n window.location.assign(connectURL);\n },\n });\n })\n .catch((err) => {\n logger.cal.error('INCONTEXT_XPROPS_CONNECT_ERROR', {\n err: err.stack || err.toString(),\n });\n\n return flushLogsAndRedirect({\n redirect: window.xprops.onAuthorize,\n payload,\n logName: 'INCONTEXT_XPROPS_ON_AUTHORIZE_',\n options: { redirected: false },\n });\n });\n }\n\n logger.cal.info('INCONTEXT_XPROPS_AUTHORIZE', payload);\n\n return flushLogsAndRedirect({\n redirect: window.xprops.onAuthorize,\n payload,\n logName: 'INCONTEXT_XPROPS_ON_AUTHORIZE_',\n options: { redirected: false },\n });\n }\n\n // for old checkout.js integration send post message\n if (\n updatedReturnUrl &&\n postToMerchantForOldIncontext({\n operation: 'return_to_merchant',\n returnUrl: updatedReturnUrl, // proper redirectUrl for vzero & native integrations\n updateParent: true,\n })\n ) {\n return;\n }\n\n return redirect(updatedReturnUrl, {\n spinnerType: SPINNER_TYPES.RETURN_TO_MERCHANT,\n rejectOnTimeout: 15000,\n replace: getIsResolveThreeDS(), // replace only for full-page 3DS case\n })\n .then(() => {\n // if the return URL is a deeplink URL, then we should show\n // the page with a `Return to merchant` button so that the user can click on it to redirect\n if (getProtocolType(updatedReturnUrl, 'returnUrl').isDeepLink) {\n const reason = 'SUCCESS_RETURN_TO_MERCHANT_DEEPLINK';\n\n logger.cal.info(reason, { url: returnUrl });\n logger.fpti(\n reason,\n RETURN_PAYLOAD({\n action: 'backToMerchant',\n payment_id: paymentId,\n return_url: returnUrl,\n updated_return_url: updatedReturnUrl,\n })\n );\n\n return redirectGenericError({ code: reason, returnUrl: updatedReturnUrl, merchantName });\n }\n })\n .catch(() => {\n logger.fpti(\n errorCode,\n ERROR_PAYLOAD({\n code: errorCode,\n merchant_name: merchantName,\n return_url: returnUrl,\n updated_return_url: updatedReturnUrl,\n })\n );\n return redirectGenericError({ code: errorCode, returnUrl: updatedReturnUrl, merchantName });\n });\n};\n\n/**\n * Return to Merchant on ApprovePayment Success\n *\n * @param approveMemberPaymentResultPayload - ApproveMemberPayment Mutation result\n * @param currencyCode - CurrencyCode for FPTI logging\n * @param merchantName - Merchant's brand name\n */\nexport const returnToMerchantAfterApprove = ({\n approveMemberPaymentResultPayload,\n currencyCode,\n merchantName,\n} = {}) => {\n const { buyer: { userId } = {}, cart: { returnUrl = {}, intent, paymentId, billingToken } = {} } =\n approveMemberPaymentResultPayload || {};\n return (\n updateFeature('SPINNER', {\n visible: true,\n data: { type: SPINNER_TYPES.RETURN_TO_MERCHANT },\n }) &&\n returnAuthorize({\n token: getToken(),\n userId,\n intent,\n returnUrl: (returnUrl && returnUrl.href) || '',\n paymentId,\n billingToken,\n currencyCode,\n merchantName,\n })\n );\n};\n\n/**\n * Redirect to the generic error page on checkoutuinodeweb, using the error code and cancelUrl provided\n *\n * @param code - Reason of redirect\n * @param returnUrl - Merchant's return url\n * @param merchantName - Merchant's brand name\n */\nexport const redirectGenericError = ({\n code = 'DEFAULT',\n returnUrl = '',\n merchantName = '',\n replace = false,\n} = {}) => {\n const baseUrl = '/checkoutweb/genericError';\n const queryParams = {\n code: btoa(code),\n cancelLink: returnUrl,\n merchantName: merchantName,\n };\n\n const genericErrorUrl = buildURL(baseUrl, queryParams);\n\n logger.cal.info(`REDIRECT_TO_GENERIC_ERROR_${code}`);\n return redirect(genericErrorUrl, { replace });\n};\n\n/**\n * Construct url with params\n *\n * @param {String} url\n * @param {Object} params\n */\nexport const buildURL = (url, params) => {\n const paramKeys = Object.keys(params || {});\n\n if (JSON.stringify(params) === '{}') {\n return url;\n }\n\n if (!paramKeys.length) {\n return url;\n }\n\n BLACKLISTED_REDIRECT_QUERY_PARAMS.forEach((blacklistedKey) => delete params[blacklistedKey]);\n\n if (url.indexOf('?') === -1) {\n url += '?';\n } else {\n url += '&';\n }\n\n url += stringify(params);\n\n return url;\n};\n\nexport function redirectToOpenBanking(encryptedId) {\n logger.cal.info('HERMIONE_REDIRECT_TO_OPEN_BANKING');\n const queryParams = Object.assign({}, params(), { id: encryptedId });\n ['cmd'].forEach((key) => {\n delete queryParams[key];\n });\n const openBankingUrl = buildURL(`/checkoutweb/openBanking/`, queryParams);\n return redirect(openBankingUrl);\n}\n\nexport function paypalRedirect(url) {\n return redirect(buildURL(url), { windowOpen: true });\n}\n\n/*\n * Redirect the user to Negative Balance App in Moneynodeweb\n */\nexport function redirectToNegativeBalanceRecovery() {\n const negativeBalanceRecoveryUrl = buildURL(getGlobals().uri.negativeBalanceRecoveryEndpoint);\n\n logger.cal.info('REDIRECT_TO_NEGATIVE_BALANCE_RECOVERY', {\n url: negativeBalanceRecoveryUrl,\n });\n\n return redirect(negativeBalanceRecoveryUrl);\n}\n\n/**\n *\n * @param {String} reason\n * @param {Object} ctx\n */\nexport function redirectToLogin(reason = 'GENERIC_ERROR', ctx) {\n const queryParams = Object.assign({}, params(), { ulClientRedirect: reason }, ctx);\n\n ['ul', 'ulReturn', 'returnToLiteUri'].forEach(function (key) {\n delete queryParams[key];\n });\n\n const ulAsLandingUrl = buildURL(window.location.pathname, queryParams);\n\n logger.cal.info(`REDIRECT_TO_UL_${reason}`, { url: ulAsLandingUrl });\n\n return redirect(ulAsLandingUrl);\n}\n\nexport function redirectToLogout(reason, extraParams = {}) {\n const baseUrl = '/checkoutweb/logout';\n const queryParams = {\n ...params(),\n ...extraParams,\n reason,\n };\n\n const logoutUrl = buildURL(baseUrl, queryParams);\n\n return redirect(logoutUrl);\n}\n\nlet redirectedToAuthChallenge = false;\n\nexport const resetAuthChallengeRedirect = () => {\n redirectedToAuthChallenge = false;\n};\n\n/**\n * Given a stepUpContext, builds the URL to redirect to the auth challenge app.\n * This is if the user needs additional confirmation before being allowed to complete the transaction.\n * @param {string} stepupContext - Code from a step up contingency like `VERIFY_USER_IDENTITY`, to be passed to authchallengenodeweb\n * */\nexport function redirectToAuthChallenge(stepupContext) {\n if (redirectedToAuthChallenge) {\n return;\n }\n\n redirectedToAuthChallenge = true;\n\n const queryParams = {\n ...params(),\n lite: 1,\n invalidateCheckoutSessionPlan: true, // We need to force replan on return to lite\n atoSuccess: 'true',\n };\n\n delete queryParams['returnToLiteUri'];\n\n const path = 'webapps/hermes'; // Relative pathname for redirect. Do not add a leading slash, as it causes some URLs to fail validation.\n const returnUri = buildURL(path, queryParams);\n // having it as backward compatible until all changes rollout, will clean authchallenge part post rollout\n const authEndPoint =\n getGlobals().uri.authNodeWebEndpoint || getGlobals().uri.authchallengeEndpoint;\n const authChallengeUrl = buildURL(authEndPoint, {\n stepupContext,\n returnUri,\n });\n\n logger.cal.info('REDIRECT_TO_AUTHCHALLENGE', { url: authChallengeUrl });\n\n redirect(authChallengeUrl);\n}\n\n/**\n * For all risky login related use case (one touch), we'll need to go via Hermes due to context\n * sharing between `xo-landing-router` and Unified login\n *\n * @param {Object} config | redirectToRiskyLogin config object\n * @param {String} config.reason | Reason for redirecting to risky login\n * @param {String} config.destination | Destination page after coming back from risky login\n * @param {Object} config.extraParams | Additional risky login params\n * @returns {Promise} Redirect to Hermesnodeweb for risky login\n */\nexport function redirectToRiskyLogin({ reason = '', destination = '', extraParams = {} } = {}) {\n return Promise.resolve()\n .then(() => destination && setDestination(destination))\n .then(() => {\n const isLocalhost = window.location.host.includes('localhost');\n const baseUrl = isLocalhost\n ? 'https://www.msmaster.qa.paypal.com/webapps/hermes?ul=landing'\n : '/webapps/hermes?ul=landing';\n const queryParams = {\n ...params(),\n ...extraParams,\n reason,\n };\n\n // hashUrl handler can be removed after ADD_BANK_LINK is removed\n const hashUrl = extraParams.hashUrl;\n const defaultRemoved = ['ul', 'ulReturn', 'reason', 'returnToLiteUri'];\n // `hashUrl` means we will be fallback to Hermes, hence `lite` can't present\n if (hashUrl) {\n defaultRemoved.push(...['lite', 'hashUrl']);\n } else {\n defaultRemoved.push(...['hermes']);\n }\n\n defaultRemoved.forEach((key) => {\n delete queryParams[key];\n });\n\n let hermesUrl = buildURL(baseUrl, queryParams);\n if (hashUrl) {\n hermesUrl += hashUrl;\n }\n\n logger.cal.info(`REDIRECT_TO_HERMES_RISKY_LOGIN_${reason}`, { url: hermesUrl });\n redirect(hermesUrl);\n })\n .catch((e) => logger.info.cal('REDIRECT_TO_RISKY_LOGIN_ERROR', { message: e && e.message }));\n}\n\nconst isUnsafeRedirect = (url) =>\n url.toLowerCase().replace(/\\s/g, '').indexOf('javascript:') !== -1; // eslint-disable-line no-script-url\n\nconst blacklist = ['password', 'pr_password'];\nconst blacklistRegex = new RegExp(`(${blacklist.join('|')})=([^&]*)`, 'g');\n\nconst sanitizeUrlForLogging = (inputUrl) =>\n inputUrl.replace(blacklistRegex, (match, key, value) => `${key}=**`);\n\n/**\n * Redirect to the provided url.\n * Also triggers spinner and flushes logs\n * If rejectOnTimeout is specified, reject promise after given timeout\n * @param {String} url\n * @param {Object} param1\n */\nexport const redirect = (\n url = '',\n { replace, windowOpen, spinnerType = SPINNER_TYPES.DEFAULT, rejectOnTimeout } = {}\n) => {\n return new Promise((resolve, reject) => {\n if (isUnsafeRedirect(url)) {\n logger.cal.info('HERMIONE_UNSAFE_REDIRECT', { url });\n throw new Error(`HERMIONE_UNSAFE_REDIRECT ${url}`);\n }\n\n logger.cal.info('REDIRECT', { url: sanitizeUrlForLogging(url) });\n\n const redirectBack = () => {\n if (replace) {\n resolve(window.location.replace(url));\n } else if (windowOpen) {\n resolve(window.open(url));\n } else {\n resolve(window.location.assign(url));\n }\n };\n const options = { redirected: false };\n\n if (!windowOpen) {\n updateFeature('SPINNER', { visible: true, data: { type: spinnerType } });\n }\n\n // Redirect after logs flush\n flushLogsAndRedirect({\n redirect: redirectBack,\n payload: undefined,\n logName: 'BACK_TO_MERCHANT_REDIRECT',\n options,\n });\n\n if (rejectOnTimeout) {\n setTimeout(() => {\n options.redirected = true;\n reject();\n }, rejectOnTimeout);\n }\n });\n};\n\n/**\n * trigger fallback with some reason\n */\nexport function fallback({ reason }) {\n const baseUrl = '/checkoutweb/fallback';\n const previousParams = Object.assign({}, params());\n\n BLACKLISTED_REDIRECT_QUERY_PARAMS.forEach(\n (blacklistedKey) => delete previousParams[blacklistedKey]\n );\n const previousQueryString = stringify(previousParams);\n\n const newParams = {\n token: getToken(),\n reason: reason,\n query: previousQueryString,\n };\n\n const fallbackUrl = buildURL(baseUrl, newParams);\n\n return redirect(fallbackUrl, { replace: true });\n}\n\n/**\n * Reconstruct returnUrl for native & partner integrations for incontext integations\n *\n * @param {Object} options | The options object\n * @param {string} options.url - can be either return/cancel url\n * @param {string} options.intent\n * @param {string} options.paymentId\n * @param {Object} options.xparms - xparams object\n * @param {Object} options.urlParams - EC token for transaction. Query: checkoutSession.cart.cartId\n * @param {boolean} options.isVzero - Boolean flag to indicate current integration is vzero\n * @param {string} options.fromNative - Boolean flag to indicate current integration is native\n * @returns {string} Construct the correct url for native & partner integrations for incontext integration\n */\nexport const reconstructReturnUrl = ({\n url = '',\n intent = '',\n userId = '',\n paymentId = '',\n returnUrl = '',\n isVzero = isVzeroIntegration(),\n redirectUri = params().redirect_uri || '',\n fromNative = Boolean(params().native_xo),\n invalidIntegrationType = Boolean(redirectUri) && (isVzero || fromNative),\n} = {}) => {\n const urlParams = {};\n const payload = {\n url,\n vzero: isVzero,\n native: fromNative,\n return_url: returnUrl,\n redirect_uri: redirectUri,\n ...(paymentId && { payment_id: paymentId }),\n };\n\n // NOTE: for v2 order transacitons (incontext), `returnUrl` will be `null` from approveMemberPayment\n // mutation since both `returnUrl` and `cancelUrl` are being handled by window.xprops\n if (!url && !redirectUri && returnUrl) {\n return returnUrl;\n }\n\n // TODO: can be removed after investigation\n if (!url.includes('paymentId') && paymentId) {\n logger.cal.warn('MISSING_PAYMENT_ID_FROM_URL', payload);\n }\n\n // By default `redirect_uri` should ONLY be honored by either\n // native or partner (ex, vzero) integrations\n if (!invalidIntegrationType) {\n logger.cal.info('INVALID_INTEGRATION_TYPE_FOR_RECONSTRUCT_URL', payload);\n return returnUrl;\n }\n\n // TODO: can be removed after investigation\n const { isDeepLink: isNativeRedirectUri } = getProtocolType(redirectUri, 'redirect_uri');\n if (!isNativeRedirectUri) {\n logger.cal.warn('INVALID_REDIRECT_URI', payload);\n }\n\n // TODO: can be removed after investigation\n if (!redirectUri.includes('token')) {\n redirectUri += `?token=${getToken()}`;\n logger.cal.warn('MISSING_TOKEN_FROM_REDIRECT_URI', payload);\n }\n\n // TODO: can be removed after investigation\n if (!redirectUri.includes('PayerID') && userId) {\n redirectUri += `&PayerID=${userId}`;\n logger.cal.warn('MISSING_PAYER_ID_FROM_REDIRECT_URI', {\n ...payload,\n payer_id: userId,\n });\n }\n\n // TODO: can be removed after investigation\n if (!redirectUri.includes('paymentId') && paymentId) {\n // NOTE: double check to ensure `paymentId` is present & not duplicagted\n urlParams.paymentId = paymentId;\n logger.cal.warn('MISSING_PAYMENT_ID_FROM_URL', { payment_id: paymentId });\n }\n\n urlParams.intent = intent && intent.toLowerCase();\n urlParams.opType = 'payment';\n urlParams.return_uri = `${url}${paymentId ? `&paymentId=${paymentId}` : ''}`;\n const finalReturnUrl = buildURL(redirectUri, urlParams);\n\n logger.cal.info('RECONSTRUCT_RETURN_URL', {\n ...payload,\n reconstruct_return_url: finalReturnUrl,\n });\n return finalReturnUrl;\n};\n\n/**\n * Redirect back to checkoutlite on 3DS approve failure\n */\nexport function redirectOnThreeDSFailed({ message = '' }) {\n const { originApp = 'hermione' } = params();\n\n const baseUrl = '/checkoutweb';\n const newParams = Object.assign({}, params(), {\n threeDSFailed: true,\n });\n\n logger.fpti(\n 'errorThreeDSContingency',\n THREE_DS_PAYLOAD({\n action: 'errorThreeDSContingency',\n message,\n originApp,\n })\n );\n\n // For Link and Pay, we'd only get the sticky FI associated with the BA.\n // On 3ds error, we need to list the other FIs and this requires re-planning\n // and hence falling back to hermes\n if (originApp === 'link_and_pay') {\n return fallback({ reason: 'failed3DS' });\n }\n\n const redirectUrl = buildURL(baseUrl, newParams);\n\n redirect(redirectUrl, { replace: true });\n}\n\n/**\n * Redirect to the same page and pass in new/updated params\n *\n * @param {Object} _params - New/Updated parameters object\n * @param {String} returnUrl - New refresh return url with new/updated parameter\n */\nexport const redirectToSameLocationWithNewParam = (newParams = {}) => {\n const baseUrl = window.location.pathname;\n const queryParams = {\n ...params(),\n ...newParams,\n };\n\n const newUrl = buildURL(baseUrl, queryParams);\n\n return redirect(newUrl);\n};\n","import './preInit';\nimport React from 'react';\nimport ReactDOM from 'react-dom';\nimport { ApolloProvider } from '@apollo/react-components';\nimport { init as initContent } from 'pp-react-l10n';\nimport ErrorBoundary from '@/components/ErrorBoundary';\nimport { LOG_TRANSITIONS, logger } from '@paypalcorp/c3-util-logger';\nimport { params } from '@paypalcorp/c3-util-browser';\nimport { getGlobals, getIsMockedMode, initGlobals } from '@paypalcorp/c3-shared-globals';\nimport { isIncontext } from '@/lib/utils';\nimport CheckoutError from '@/lib/checkoutError';\nimport windowEligible from '@/lib/windowEligibility';\nimport configureApolloClient from '@/lib/configureApolloClient';\nimport { getClientMetadataID, initFraudNet } from '@/lib/fraudNet';\nimport { AppIndex } from './AppIndex';\n\n__webpack_nonce__ = getGlobals().nonce; // eslint-disable-line\n\nconst MockedMode = React.lazy(() => import('./MockedMode'));\n\nlogger.cal.transition(LOG_TRANSITIONS.INIT);\n\nconst initialData = initGlobals();\nconst { user = {}, uri, content, deployEnv = {} } = initialData;\n// eslint-disable-next-line i18n-scan/no-country-dependency\nconst integrationType = user.ecToken && /^EC-[\\w]+/.test(user.ecToken) ? 'EC' : 'WPS';\n\nif (params().euat === '1') {\n user.auth.access_token = window.location.hash.substr(1);\n}\n\ninitContent({ content });\n\nif (!user.ecToken) {\n CheckoutError({ message: 'ec_token_is_missing' });\n}\n\n// get common FPTI keys\nconst commonKeys = {};\n\n// Initialize CAL and FPTI Logger\nlogger.init(\n {\n token: user.ecToken,\n loggerEndpoint: uri.loggerEndpoint,\n incontext: isIncontext(),\n externalName: 'checkoutuinodeweb',\n internalName: 'HERMIONE',\n experienceName: 'checkoutlite',\n context_type: `${integrationType}-token`,\n common: commonKeys,\n },\n {},\n {\n common: {\n integration_type: integrationType,\n context_type: `${integrationType}-token`,\n 'x-paypal-fpti': {\n context_type: `${integrationType}-token`,\n },\n },\n }\n);\n\n// initialize apollo client\nconst client = configureApolloClient({\n queryEndpoint: uri.queryEndpoint,\n token: user.ecToken,\n auth: user.auth || {},\n enableRetry: true,\n});\n\ninitFraudNet({\n token: getClientMetadataID(user.ecToken),\n fraudNetEndpoint: uri.fraudNetEndpoint,\n deployEnv,\n});\nconst MockedModeLoader = () =>
Loading Use cases viewer...
;\n\nconst render = (Application) => {\n ReactDOM.render(\n \n \n {!getIsMockedMode() ? (\n \n ) : (\n }>\n \n \n )}\n \n ,\n document.getElementById('root')\n );\n};\n\nfunction startApp() {\n const { windowEligibility, reason = 'unknown' } = windowEligible();\n if (!windowEligibility) {\n CheckoutError({ message: `window_ineligible_${reason}` });\n // Don't render the app, as it can potentially cause problems if we start setting up the checkout session here and on Hermes\n return;\n }\n\n if (process.env.NODE_ENV === 'development') {\n // initialize react-axe a11y auditing\n // https://github.com/dequelabs/react-axe\n // it slows UI drastically\n if (params().enableAllyChecks) {\n const axe = require('react-axe');\n setTimeout(() => axe(React, ReactDOM, 1000), 10000);\n }\n }\n\n render(AppIndex);\n}\n\nstartApp();\n","import { settings } from 'emeth';\nsettings.debug = false;\nsettings.warn = () => {};\n","// extracted by extract-css-chunks-webpack-plugin\nmodule.exports = {\"font-family\":\"'PayPalSansBig-Regular', Helvetica Neue, HelveticaNeue, helvetica, arial, sans-serif\",\"fontFamily\":\"'PayPalSansBig-Regular', Helvetica Neue, HelveticaNeue, helvetica, arial, sans-serif\",\"ppui-coachtip-background-color\":\"#2c2e2f\",\"ppuiCoachtipBackgroundColor\":\"#2c2e2f\",\"ppui-coachtip-text-color\":\"#fff\",\"ppuiCoachtipTextColor\":\"#fff\",\"ppui-color-blue-300\":\"#bfdbee\",\"ppuiColorBlue300\":\"#bfdbee\",\"ppui-font-family-500\":\"'PayPalSansBig-Medium'\",\"ppuiFontFamily500\":\"'PayPalSansBig-Medium'\",\"ppui-color-blue-600\":\"#0070ba\",\"ppuiColorBlue600\":\"#0070ba\",\"ppui-color-blue-800\":\"#003087\",\"ppuiColorBlue800\":\"#003087\",\"ppui-font-size-md\":\"0.9375rem\",\"ppuiFontSizeMd\":\"0.9375rem\",\"ppui-font-size-xl-2\":\"1.5rem\",\"ppuiFontSizeXl2\":\"1.5rem\",\"ppui-font-weight-light\":\"300\",\"ppuiFontWeightLight\":\"300\",\"ppui-font-weight-normal\":\"500\",\"ppuiFontWeightNormal\":\"500\",\"ppui-line-height-sm\":\"1.125rem\",\"ppuiLineHeightSm\":\"1.125rem\",\"ppui-spacing-lg\":\"0.75rem\",\"ppuiSpacingLg\":\"0.75rem\"};","import React from 'react';\nimport PropTypes from 'prop-types';\nimport SpinnerOverlay from '@/shared/components/SpinnerOverlay';\nimport getContent from '@/lib/content';\n\nexport default function DefaultSpinner({ contentKey } = {}) {\n return {getContent(contentKey)};\n}\n\nDefaultSpinner.propTypes = {\n contentKey: PropTypes.string.isRequired,\n};\n","import React from 'react';\nimport { createPortal } from 'react-dom';\nimport { useFeature } from '@/components/Feature/hooks';\nimport { SPINNER_TYPES } from './constants';\nimport DefaultSpinner from './DefaultSpinner';\nimport ReturnToMerchantSpinner from './ReturnToMerchantSpinner';\n\nconst SpinnerPortal = (props) => {\n return
{createPortal(props.children, document.body)}
;\n};\n\nconst SpinnerComponent = ({ spinnerType = SPINNER_TYPES.DEFAULT }) => {\n switch (spinnerType) {\n case SPINNER_TYPES.THREE_DS_PROCESSING: {\n return ;\n }\n case SPINNER_TYPES.RETURN_TO_MERCHANT: {\n return ;\n }\n case SPINNER_TYPES.PROCESS_CARD: {\n return ;\n }\n case SPINNER_TYPES.PROCESS_INCENTIVE: {\n return ;\n }\n default:\n return ;\n }\n};\n\nexport default () => {\n const { enabled, visible, data } = useFeature('SPINNER');\n\n if (!enabled || !visible) {\n return null;\n }\n\n return (\n \n \n \n );\n};\n\nexport { SPINNER_TYPES };\n","import React, { lazy, Suspense, useEffect } from 'react';\nimport { logger } from '@paypalcorp/c3-util-logger';\n\n/**\n * resolve dynamic chunk with an ability to retry if failed\n */\nexport const lazyLoadChunkWithRetry = ({ fn, retriesLeft = 5, interval = 1500, id }) => {\n return new Promise((resolve, reject) => {\n window.logCPLPhase(id, 'chunk', true);\n fn()\n .then((result) => {\n logger.cal.info(`CHUNK_${id}_LOADED`);\n window.logCPLPhase(id, 'chunk');\n if (result == null) {\n console.warn(`could not load %s`, id);\n }\n resolve(result);\n })\n .catch((error) => {\n setTimeout(() => {\n if (retriesLeft === 1) {\n // reject('maximum retries exceeded');\n reject(error);\n return;\n }\n logger.cal.info(`CHUNK_${id}_RETRY`);\n // Passing on \"reject\" is the important part\n lazyLoadChunkWithRetry({ fn, retriesLeft: retriesLeft - 1, interval, id }).then(\n resolve,\n reject\n );\n }, interval);\n });\n }).catch(() => {\n logger.cal.error(`CHUNK_${id}_FAILED`);\n window.location.reload();\n\n // TODO: discuss this approach to show an alert and reload the page\n // if (window.confirm(getContent('offline.message') || 'You are offline. Press OK to reload')) {\n // window.location.reload();\n // }\n });\n};\n\n/**\n * dynamically lazy load component using React.lazy && React.Suspense\n * with an ability to preload the chunk\n */\nexport const lazyComponent = (\n dynamicImport,\n { id, loading: LoaderComponent, error: ErrorComponent }\n) => {\n const LazyComponent = lazy(() => lazyLoadChunkWithRetry({ fn: dynamicImport, id }));\n const ComponentWithSuspense = React.forwardRef((props, ref) => {\n useEffect(() => {\n dynamicImport().then().catch();\n }, []);\n\n if (props.isLoading) {\n return LoaderComponent ? : null;\n }\n\n if (props.error) {\n return ErrorComponent ? : null;\n }\n\n return (\n : null}>\n \n \n );\n });\n return ComponentWithSuspense;\n};\n","import { useQuery } from '@apollo/react-hooks';\nimport { logger } from '@paypalcorp/c3-util-logger';\nimport { getSingleFeatureQuery, getContingenciesQuery } from '@paypalcorp/c3-util-store';\nimport { getOperationName } from '@paypalcorp/c3-util-graphql';\n\n/**\n * Execute feature queries\n * TODO: don't ignore rules of hooks\n * @param {Array} queries queries to execute\n * @param {Boolean} skip if the query should be skipped entirely\n * @returns array of feature data\n */\nexport function useGqlNetworkQuery({ queries, skip = false }) {\n return queries.reduce((map, { query, variables, fetchPolicy, context } = {}, idx) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n map[`${getOperationName(query)}_${idx}`] = useQuery(query, {\n variables,\n fetchPolicy,\n context,\n errorPolicy: 'ignore',\n skip,\n });\n\n return map;\n }, {});\n}\n\n/**\n * Query features from local state\n * TODO: don't ignore rules of hooks\n * @param {Array} features feature IDs\n * @returns array of local feature state\n */\nexport function useFeatureQuery(features) {\n return features.reduce((map, featureId) => {\n // eslint-disable-next-line react-hooks/rules-of-hooks\n map[`${featureId}`] = useQuery(getSingleFeatureQuery, { variables: { id: featureId } });\n\n return map;\n }, {});\n}\n\nexport function useContingencyQuery(id) {\n const { data = {}, error } = useQuery(getContingenciesQuery, { variables: { id } });\n\n if (error) {\n logger.cal.error('ERROR_EXECUTING_CONTINGENCY_QUERY', { error, query: getContingenciesQuery });\n }\n\n return data;\n}\n\n/**\n * Query for a contingency\n * @param {String} id Contingency ID\n */\nexport function useContingency(id) {\n const { contingencies = [] } = useContingencyQuery(id) || {};\n return contingencies.find((contingency) => contingency.id === id) ?? null;\n}\n\n/**\n * Hook to query for a Feature, which includes\n * - it's ID\n * - if it's enabled\n * - if it's visible\n * - its data\n * - and more!! 😮\n * Initial feature config is defined in `/src/store/features.js`\n * @param {String} id Feature ID\n */\nexport function useFeature(id) {\n const { data: { feature = {} } = {} } = useQuery(getSingleFeatureQuery, {\n variables: { id },\n });\n\n return (\n feature || {\n enabled: false,\n visible: false,\n data: {},\n }\n );\n}\n","import {\n fallback,\n redirectToLogout,\n redirectGenericError,\n redirectToRiskyLogin,\n redirectToAuthChallenge,\n redirectToNegativeBalanceRecovery,\n} from '@/lib/redirects';\nimport { isIframe } from '@paypalcorp/c3-util-browser';\nimport { isObject } from '@paypalcorp/c3-util-lang';\nimport { SHARED_CARD_CONTINGENCIES } from '@/components/SharedCard/constants';\nimport { logger } from '@paypalcorp/c3-util-logger';\n\n// This is a list of current contingency Hermione is currently aware of and will be\n// handling corresponding contingency accordingly with its own set of handlers\nexport const HANDLED_CONTINGENCIES = [\n 'NEED_CREDIT_CARD',\n 'EXPIRED_CREDIT_CARD',\n 'NEED_CREDIT_CARD_OR_BANK_ACCOUNT',\n 'SEPA_ACCEPT_CONTINGENCY',\n 'CC_AUTHORIZATION_DECLINED',\n 'ALLOWED_CARD_TYPES_COULD_NOT_BE_RETRIEVED', // handle `GET_SUPPORTED_CARDS_QUERY` contingency\n 'NEED_SHIPPING_ADDRESS', // handle `NEED_DOMESTIC_SHIPPING_ADDRESS_TO_PAY` contingency\n 'NEED_PRIMARY_ADDRESS', // handle `NEED_PRIMARY_ADDRESS` contingency for addressless user during CBT flow\n 'BANK_LOGIN_CREDENTIALS_INVALID', // handles when users provides invalid credentials in OpenBanking\n 'FETCH_BANK_BALANCE_TIME_OUT',\n 'INITIATE_OTP_CONTINGENCY',\n 'PAYER_CANNOT_PAY',\n 'PAYER_ACCOUNT_RESTRICTED',\n 'FI_CONFIRMATION_CONTINGENCY', // handle 3DS (2.0) contingency for addCard use case so no fallback\n 'CC_PROCESSOR_DECLINED', \n ...SHARED_CARD_CONTINGENCIES, // shared card related contingenciesptest\n];\n\nexport const GLOBAL_CONTINGENCIES_HANDLERS = {\n // Step up auth contingency during the planning step - user is logged in, but risk determines that user may have\n // suspicious activity around payments. To resolve, user must provide secondary authentication, such as completing\n // SMS verification.\n VERIFY_USER_IDENTITY({ errorData = {} }) {\n // step_up_context is a mandatory param from planning response , check before redirecting\n if (errorData.step_up_context) {\n return redirectToAuthChallenge(errorData.step_up_context);\n } else {\n return redirectGenericError();\n }\n },\n // Payer Action Required is a contingency in which Buyer's action is required.\n // It contains {String} cause which tells why the contingency is thrown\n // It contains {Object} resolution, which contains details on how to resolve the contingency\n // Currently its only being thrown for Negative Balance Recovery Contingency & contingencies not mapped in xo-janus\n // Refer: https://github.paypal.com/Checkout/xo-janus/blob/master/lib/payService/transportMapper.js#L29 - {function checkContingency}\n PAYER_ACTION_REQUIRED({ message, errorData = {} }) {\n const { cause, resolution: { name: resolutionName } = {} } = errorData;\n\n /*\n * Added isIframe check because MoneyNodeWeb which handles Negative Balance Recovery\n * return html with `x-frame-opts: sameorigin` which prevents loading the page in Iframe flows.\n * Currently, we fallback to hermes if we receive NBR contingency in Iframe flow.\n * TODO: Remove the isIframe check here & find a solution for consumer apps to work in Checkout's Iframe flow.\n */\n if (\n cause === 'NEED_NEGATIVE_BALANCE_RECOVERY' &&\n resolutionName === 'PAYER_TO_CLEAR_NEGATIVE_BALANCE' &&\n !isIframe()\n ) {\n return redirectToNegativeBalanceRecovery();\n } else {\n // reason: \"PAYER_ACTION_REQUIRED|NEED_NEGATIVE_BALANCE_RECOVERY|PAYER_TO_CLEAR_NEGATIVE_BALANCE\"\n return fallback({\n reason: `${message}|${cause}|${resolutionName}`,\n });\n }\n },\n // Payer Authentication Required throws when an action needs more permissions than the user currently has.\n // This can happen when a One Touch user tries to change something, such as adding an address (merchant override).\n // Solution is to make the user log in\n PAYER_AUTHENTICATION_REQUIRED({ message, errorData = {} } = {}) {\n logger.cal.info(`HANDLE_${message}`, {\n message,\n cause: errorData.cause,\n ...(isObject(errorData.resolution) && {\n resolution: errorData.resolution.name,\n }),\n });\n\n redirectToRiskyLogin({\n reason: message,\n extraParams: {\n lite: 1,\n fromLite: 1,\n invalidateCheckoutSessionPlan: true,\n ulClientKey: 'riskyLoginShippingPassed',\n ulClientRedirect: 'insufficientPermission',\n },\n });\n },\n\n // For Link and Pay transaction, if a user is 'skip logged in',\n // the user cannot perform transactions for any other EC-Token\n // other than which the user was skip logged in for.\n LINK_AND_PAY_TOKENS_MISMATCH({ errorData = {} }) {\n return redirectToLogout('LINK_AND_PAY_TOKENS_MISMATCH', {\n hermes: 1,\n fromLite: 1,\n });\n },\n\n // Payer Invalid for Payment is thrown for Link and Pay experience in\n // under the following scenario:\n // If a User A (logged in/ one touched) requests for Link and Pay\n // transaction for a billingAgreement setup for User B, PAPS throws\n // error PAYER_INVALID_FOR_PAYMENT. So we logout User A.\n // ***\n // If this contingency is thrown for other cases, we might have to handle\n // it using cause/resolution if passed\n PAYER_INVALID_FOR_PAYMENT({ errorData = {} }) {\n return redirectToLogout('PAYER_INVALID_FOR_PAYMENT', {\n hermes: 1,\n fromLite: 1,\n });\n },\n\n TRANSACTION_REFUSED() {\n return redirectGenericError({ code: 'PAYMENT_DENIED', replace: true });\n },\n};\n","import { ApolloLink, Observable } from 'apollo-link';\n\nimport { logger } from '@paypalcorp/c3-util-logger';\nimport { getOperationType } from '@paypalcorp/c3-util-graphql';\nimport { updateFeature } from '@paypalcorp/c3-util-store';\nimport { SPINNER_TYPES } from '@/components/Spinner';\n\n/**\n * @description `apolloSpinner` is a non-terminating link to show / hide spinners for Mutation graphql calls\n *\n * @returns {Observable} | Returns an Observable of an execution result\n */\nexport const spinnerLink = () => {\n return new ApolloLink((operation, forward) => {\n const { operationName } = operation;\n const operationType = getOperationType(operation);\n let spinnerType = SPINNER_TYPES.DEFAULT;\n\n if (operationName === 'AddCreditCard') {\n spinnerType = SPINNER_TYPES.PROCESS_CARD;\n }\n\n if (operationName === 'approveIncentivePayment') {\n spinnerType = SPINNER_TYPES.PROCESS_INCENTIVE;\n }\n\n if (operationName === 'GetThreeDsJwtQuery') {\n spinnerType = SPINNER_TYPES.THREE_DS_START;\n }\n\n if (\n operationName === 'ThreeDsLookUpMutation' ||\n operationName === 'ThreedsCreateConfirmationMutation'\n ) {\n spinnerType = SPINNER_TYPES.THREE_DS_PROCESS;\n }\n\n if (\n operationName === 'ThreeDsAuthenticateMutation' ||\n operationName === 'ThreedsUpdateConfirmationMutation'\n ) {\n spinnerType = SPINNER_TYPES.THREEE_DS_END;\n }\n\n const triggerToggleSpinner = (visible) => {\n updateFeature('SPINNER', { visible, data: { type: spinnerType } });\n };\n\n if (\n operationType === 'mutation' ||\n (operationType === 'query' && operationName === 'GetThreeDsJwtQuery')\n ) {\n triggerToggleSpinner(true);\n logger.cal.info(`SHOW_SPINNER_${operationName}`);\n }\n\n return new Observable((observer) => {\n const subscription = forward(operation);\n if (subscription) {\n // check if forward returns null or not\n return subscription.subscribe({\n next: (result) => {\n if (operationType === 'mutation' || operationType === 'query') {\n triggerToggleSpinner(false);\n logger.cal.info(`HIDE_SPINNER_${operationName}`);\n }\n\n observer.next(result);\n },\n error: (error) => {\n const statusCode = error && error.statusCode;\n\n if (statusCode === 401) {\n triggerToggleSpinner(true);\n logger.cal.info(`SHOW_SPINNER_401_${operationName}`);\n } else {\n triggerToggleSpinner(false);\n logger.cal.info(`HIDE_SPINNER_NETWORK_ERROR_${statusCode}_${operationName}`);\n }\n observer.error(error);\n },\n complete: observer.complete.bind(observer),\n });\n }\n return () => {\n // clean up\n if (subscription) subscription.unsubscribe();\n };\n });\n });\n};\n","import { ApolloLink, Observable } from 'apollo-link';\nimport { isUndefined } from '@paypalcorp/c3-util-lang';\nimport get from 'dlv';\nimport { logger } from '@paypalcorp/c3-util-logger';\nimport { TRANSITION_PAYLOAD } from '@paypalcorp/c3-util-logger';\n\n/**\n * It's a stateful link and centralized place to log gql data into cal / fpti\n *\n * It auto logs payload to cal / fpti once all resolvers return non undefined values\n * If some of the fields were not resolved by end of the user session - manually flush them before user redirect via\n *\n * ```\n * import { instrumentationLink } from '@/lib/apolloLinks';\n *\n * instrumentationLink.logPayload();\n * ```\n */\nclass InstrumentationLink extends ApolloLink {\n constructor() {\n super();\n this.logFlushed = false;\n this.payload = {};\n\n this.payloadResolvers = {\n is_gambling: (result) => get(result, 'data.checkoutSession.merchant.isGambling'),\n };\n\n Object.keys(this.payloadResolvers).forEach((key) => {\n this.payload[key] = undefined;\n });\n }\n\n addToPayload(key, value) {\n if (!isUndefined(value)) {\n this.payload[key] = value;\n }\n }\n\n logPayload() {\n // make sure log is fired once to prevent duplicate logs\n if (!this.logFlushed) {\n Object.keys(this.payload).forEach((key) => {\n const value = this.payload[key];\n\n if (typeof value === 'boolean') {\n this.payload[key] = value ? 1 : 0;\n }\n });\n\n logger.fpti(\n 'flow_params',\n TRANSITION_PAYLOAD({\n from: 'flow_params',\n to: 'process_flow_params',\n ...this.payload,\n })\n );\n\n this.logFlushed = true;\n }\n }\n\n logPayloadIfReady() {\n const isReadyToFlush = !Object.keys(this.payload).some((k) => isUndefined(this.payload[k]));\n\n if (!isReadyToFlush) {\n return;\n }\n\n this.logPayload();\n }\n\n resolveAndLog(result, operationName) {\n window.logCPLPhase(operationName, 'query');\n try {\n Object.keys(this.payloadResolvers).forEach((key) => {\n const resolvedValue = this.payloadResolvers[key](result);\n this.addToPayload(key, resolvedValue);\n });\n\n this.logPayloadIfReady();\n } catch (err) {\n logger.cal.info('instrumentation_link_error', { error: err.stack || err.toString() });\n }\n }\n\n request(operation, forward) {\n window.logCPLPhase(operation.operationName, 'query', true);\n return new Observable((observer) => {\n const subscription = forward(operation);\n\n if (subscription) {\n return subscription.subscribe({\n next: (result) => {\n this.resolveAndLog(result, operation.operationName);\n observer.next(result);\n },\n error: (error) => {\n observer.error(error);\n },\n complete: observer.complete.bind(observer),\n });\n }\n return () => {\n // clean up\n if (subscription) subscription.unsubscribe();\n };\n });\n }\n}\n\nexport const instrumentationLink = new InstrumentationLink();\n","import { ApolloLink } from 'apollo-link';\nimport { getAccessToken } from '@paypalcorp/c3-shared-globals';\nimport { params } from '@paypalcorp/c3-util-browser';\nimport { logger } from '@paypalcorp/c3-util-logger';\n\n/**\n * Avoid using auth related identifers\n * for client side logging\n * example:\n * - 'AUTH'\n * - 'ACCESS_TOKEN'\n */\nconst LOG_PREFIX = 'AT_CHANGE';\n\n/**\n * Refresh access token being sent for each\n * request with latest value from globals.\n *\n * @param {*} headers\n * @returns\n */\nexport const authLink = (headers) => {\n return new ApolloLink((operation, forward) => {\n const accessToken = getAccessToken();\n operation.setContext((prevContext) => {\n const oldAccessToken = headers['x-paypal-internal-euat'];\n const newAccessToken = params().euat === '1' ? window.location.hash.substr(1) : accessToken;\n logger.cal.info(`${LOG_PREFIX}_${oldAccessToken !== newAccessToken}`);\n headers['x-paypal-internal-euat'] = newAccessToken;\n return {\n headers,\n };\n });\n return forward(operation);\n });\n};\n","import { logger } from '@paypalcorp/c3-util-logger';\nimport { getGlobals, getFallback } from '@paypalcorp/c3-shared-globals';\nimport { HANDLED_CONTINGENCIES } from '@/lib/contingencies';\nimport { fallback } from '@/lib/redirects';\n\nexport const attemptRedirect = (reason = 'error') => {\n // This is temporary until we can get CORS enabled on Akamai, and ErrorBoundaries\n // are released in Preact: https://github.com/developit/preact/pull/819\n\n const fallbackSettings = getFallback();\n\n try {\n throw Error();\n } catch (e) {\n // if we're running tests, we should always call `fallback()` because\n // sometimes `window.fallbackTriggered` is already `true` when running a test\n if (\n process.env.NODE_ENV === 'test' ||\n (!window.fallbackTriggered && fallbackSettings.redirectOnError)\n ) {\n window.fallbackTriggered = true;\n fallback({ reason });\n }\n }\n};\n\n/**\n * Takes a GraphQL error and formats it for logging\n * @param {object} error | A GraphQL error object\n * @returns {object} A formatted object to use for error logging\n */\nconst parseError = (error) => {\n const { graphQLErrors, networkError } = error || {};\n if (graphQLErrors && graphQLErrors.length) {\n return {\n message: graphQLErrors[0].statusCode === 200 ? `gqlContingency` : `gqlError`,\n statusCode: graphQLErrors[0].statusCode,\n details: graphQLErrors.map(({ message }) => message).toString(),\n };\n }\n if (networkError) {\n return {\n message: `gqlNetworkError`,\n statusCode: networkError.statusCode,\n details: networkError.message,\n };\n }\n if (error instanceof Error) {\n return {\n message: error.message,\n details: error.stack,\n };\n }\n\n return { message: `unknownError` };\n};\n/**\n * Ideally we could use Error Boundaries, but Preact does not currently support them\n * (coming soon -- the PR is merged, waiting for new release). This will log checkout\n * errors and ineligible traffic to separate them from generic JS errors.\n *\n * @param {object} obj | Args object\n * @param {string} obj.message | A formatted message to use for error logging\n * @param {object} obj.error | An error object to use for a new `Error` instance\n * @returns {void} Nothing is returned, but does cause a redirect if enabled\n */\n\nconst CheckoutError = ({ message, error }) => {\n // do not fallback for 401 errors.\n // Currently for approvePaymentMutation we are still falling back because `CheckoutError` is getting executed on each GQL error.\n if (error && error.networkError && error.networkError.statusCode === 401) {\n return;\n }\n\n const checkoutError = new Error(error || message || 'undefined');\n checkoutError.type = 'checkout';\n if (error) {\n const parsedError = parseError(error);\n checkoutError.message = parsedError.message;\n checkoutError.details = parsedError.details;\n }\n\n if (HANDLED_CONTINGENCIES.includes(checkoutError.details)) {\n return;\n }\n\n const reason = checkoutError.message;\n const {\n user: { ecToken },\n } = getGlobals();\n\n logger.cal.error(`CHECKOUT_ERROR_${reason}`, {\n ...checkoutError,\n timestamp: Date.now(),\n token: ecToken,\n });\n\n attemptRedirect(reason);\n};\n\nexport default CheckoutError;\n"],"sourceRoot":""}