Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
return await wrapPromise(async ({ expect, expectError, avoid }) => {
window.navigator.mockUserAgent = ANDROID_CHROME_USER_AGENT;
window.xprops.enableNativeCheckout = true;
window.xprops.platform = PLATFORM.MOBILE;
delete window.xprops.onClick;
const sessionToken = uniqueID();
const firebaseScripts = mockFirebaseScripts();
const gqlMock = getGraphQLApiMock({
extraHandler: expect('firebaseGQLCall', ({ data }) => {
if (!data.query.includes('query GetFireBaseSessionToken')) {
return;
}
if (!data.variables.sessionUID) {
throw new Error(`Expected sessionUID to be passed`);
}
return await wrapPromise(async ({ expect, avoid }) => {
window.navigator.mockUserAgent = IOS_SAFARI_USER_AGENT;
window.xprops.enableNativeCheckout = true;
window.xprops.platform = PLATFORM.MOBILE;
delete window.xprops.onClick;
const sessionToken = uniqueID();
const firebaseScripts = mockFirebaseScripts();
const gqlMock = getGraphQLApiMock({
extraHandler: expect('firebaseGQLCall', ({ data }) => {
if (!data.query.includes('query GetFireBaseSessionToken')) {
return;
}
if (!data.variables.sessionUID) {
throw new Error(`Expected sessionUID to be passed`);
}
export function getVenmoConfig() : FundingSourceConfig {
return {
...DEFAULT_FUNDING_CONFIG,
platforms: [
PLATFORM.MOBILE
],
layouts: [
BUTTON_LAYOUT.HORIZONTAL,
BUTTON_LAYOUT.VERTICAL
],
Logo: ({ logoColor, optional }) => VenmoLogo({ logoColor, optional }),
colors: [
BUTTON_COLOR.BLUE,
BUTTON_COLOR.SILVER,
BUTTON_COLOR.BLACK,
BUTTON_COLOR.WHITE
],
function isNativeEligible({ props, config, serviceData } : { props : Props, config : Config, serviceData : ServiceData }) : boolean {
const { platform, onShippingChange, createBillingAgreement, createSubscription } = props;
const { firebase: firebaseConfig } = config;
const { eligibility } = serviceData;
if (platform !== PLATFORM.MOBILE) {
return false;
}
if (onShippingChange) {
return false;
}
if (createBillingAgreement || createSubscription) {
return false;
}
if (!supportsPopups()) {
return false;
}
if (!firebaseConfig) {
colors : $ReadOnlyArray<$Values>,
secondaryColors : { [$Values] : $Values },
secondaryVaultColors : { [$Values] : $Values },
logoColors : { [$Values] : $Values },
shapes : $ReadOnlyArray<$Values>
|};
export const DEFAULT_FUNDING_CONFIG : FundingSourceConfig = {
layouts: [
BUTTON_LAYOUT.VERTICAL
],
platforms: [
PLATFORM.DESKTOP,
PLATFORM.MOBILE
],
handleClick: false,
colors: [
BUTTON_COLOR.SILVER,
BUTTON_COLOR.BLACK,
BUTTON_COLOR.WHITE
],
logoColors: {
[ BUTTON_COLOR.BLACK ]: LOGO_COLOR.WHITE
},
shapes: [
BUTTON_SHAPE.PILL,