Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
label
}
}
});
}
for (const fundingSource of Object.values(FUNDING)) {
buttonConfigs.push({
fundingEligibility: {
paypal: {
eligible: true
},
// $FlowFixMe
[ fundingSource ]: {
eligible: true,
vendors: fundingSource === FUNDING.CARD
? {
visa: {
eligible: true
},
amex: {
eligible: true
},
mastercard: {
eligible: true
}
}
: null
}
},
rememberedFunding: fundingSource === FUNDING.VENMO
// $FlowFixMe
if (locale) {
const [ lang, country ] = locale.split('_');
return { lang, country };
}
for (const { country, lang } of getBrowserLocales()) {
// $FlowFixMe
if (COUNTRY_LANGS.hasOwnProperty(country) && COUNTRY_LANGS[country].indexOf(lang) !== -1) {
// $FlowFixMe
return { country, lang };
}
}
for (const { country } of getBrowserLocales()) {
// $FlowFixMe
if (COUNTRY_LANGS.hasOwnProperty(country)) {
// $FlowFixMe
return { country, lang: COUNTRY_LANGS[country][0] };
}
}
return {
lang: LANG.EN,
country: COUNTRY.US
};
}
export function getLocale() : LocaleType {
const locale = getSDKQueryParam(SDK_QUERY_KEYS.LOCALE);
if (locale) {
const [ lang, country ] = locale.split('_');
return { lang, country };
}
for (const { country, lang } of getBrowserLocales()) {
// $FlowFixMe
if (COUNTRY_LANGS.hasOwnProperty(country) && COUNTRY_LANGS[country].indexOf(lang) !== -1) {
// $FlowFixMe
return { country, lang };
}
}
for (const { country } of getBrowserLocales()) {
// $FlowFixMe
if (COUNTRY_LANGS.hasOwnProperty(country)) {
// $FlowFixMe
return { country, lang: COUNTRY_LANGS[country][0] };
}
}
return {
lang: LANG.EN,
country: COUNTRY.US
/* @flow */
import { FUNDING } from '@paypal/sdk-constants/src';
import { CLASS, ATTRIBUTE } from '../../../constants';
export const labelStyle = `
.${ CLASS.BUTTON }[${ ATTRIBUTE.FUNDING_SOURCE }=${ FUNDING.CARD }]:not(.${ CLASS.VAULT }) {
border-radius: 0 !important;
}
.${ CLASS.BUTTON } .${ CLASS.VAULT_LABEL } {
max-width: 60%;
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}
`;
}).then((payload) => {
// does contingency flow give a payload?
logger.track({
comp: 'hostedpayment',
// risk_correlation_id: 'TODO',
card_brand: payload && payload.payment_source && payload.payment_source.card.card_type,
api_integration_type: 'PAYPALSDK',
product_identifier: 'PAYPAL_FOR_MARKETPLACES',
[FPTI_KEY.STATE]: 'CARD_PAYMENT_FORM',
[FPTI_KEY.TRANSITION]: 'process_card_payment',
hosted_payment_session_cre_dt: (new Date()).toString(),
hosted_payment_session_cre_ts_epoch: Date.now().toString()
});
logger.flush();
return {
card: payload.payment_source.card,
liabilityShifted: payload.success,
orderId
};
});
});
|};
export const DEFAULT_STYLE = {
LAYOUT: BUTTON_LAYOUT.VERTICAL,
COLOR: BUTTON_COLOR.GOLD,
SHAPE: BUTTON_SHAPE.RECT
};
export const DEFAULT_PROPS = {
LOCALE: {
country: COUNTRY.US,
lang: LANG.EN
},
COMMIT: COMMIT.TRUE,
VAULT: VAULT.FALSE,
INTENT: INTENT.CAPTURE,
ENV: ENV.PRODUCTION,
PLATFORM: PLATFORM.DESKTOP
};
// $FlowFixMe
export function normalizeButtonStyle(style : ButtonStyleInputs) : ButtonStyle {
if (!style) {
throw new Error(`Expected props.style to be set`);
}
const {
label,
layout = DEFAULT_STYLE.LAYOUT,
color = DEFAULT_STYLE.COLOR,
shape = DEFAULT_STYLE.SHAPE,
|};
export const DEFAULT_STYLE = {
LAYOUT: BUTTON_LAYOUT.VERTICAL,
COLOR: BUTTON_COLOR.GOLD,
SHAPE: BUTTON_SHAPE.RECT
};
export const DEFAULT_PROPS = {
LOCALE: {
country: COUNTRY.US,
lang: LANG.EN
},
COMMIT: COMMIT.TRUE,
VAULT: VAULT.FALSE,
INTENT: INTENT.CAPTURE,
ENV: ENV.PRODUCTION,
PLATFORM: PLATFORM.DESKTOP
};
// $FlowFixMe
export function normalizeButtonStyle(style : ButtonStyleInputs) : ButtonStyle {
if (!style) {
throw new Error(`Expected props.style to be set`);
}
const {
label,
layout = DEFAULT_STYLE.LAYOUT,
color = DEFAULT_STYLE.COLOR,
shape = DEFAULT_STYLE.SHAPE,
clientAccessToken? : string,
csp? : {
nonce? : string
},
cardButtonExperiment? : boolean
|};
export const DEFAULT_STYLE = {
LAYOUT: BUTTON_LAYOUT.VERTICAL,
COLOR: BUTTON_COLOR.GOLD,
SHAPE: BUTTON_SHAPE.RECT
};
export const DEFAULT_PROPS = {
LOCALE: {
country: COUNTRY.US,
lang: LANG.EN
},
COMMIT: COMMIT.TRUE,
VAULT: VAULT.FALSE,
INTENT: INTENT.CAPTURE,
ENV: ENV.PRODUCTION,
PLATFORM: PLATFORM.DESKTOP
};
// $FlowFixMe
export function normalizeButtonStyle(style : ButtonStyleInputs) : ButtonStyle {
if (!style) {
throw new Error(`Expected props.style to be set`);
}
clientAccessToken? : string,
csp? : {
nonce? : string
},
content? : { [string] : string }
|};
export const DEFAULT_STYLE = {
LAYOUT: BUTTON_LAYOUT.VERTICAL,
COLOR: BUTTON_COLOR.GOLD,
SHAPE: BUTTON_SHAPE.RECT
};
export const DEFAULT_PROPS = {
LOCALE: {
country: COUNTRY.US,
lang: LANG.EN
},
COMMIT: COMMIT.TRUE,
VAULT: VAULT.FALSE,
INTENT: INTENT.CAPTURE,
ENV: ENV.PRODUCTION,
PLATFORM: PLATFORM.DESKTOP
};
// $FlowFixMe
export function normalizeButtonStyle(style : ButtonStyleInputs) : ButtonStyle {
if (!style) {
throw new Error(`Expected props.style to be set`);
}
// $FlowFixMe
return { country, lang };
}
}
for (const { country } of getBrowserLocales()) {
// $FlowFixMe
if (COUNTRY_LANGS.hasOwnProperty(country)) {
// $FlowFixMe
return { country, lang: COUNTRY_LANGS[country][0] };
}
}
return {
lang: LANG.EN,
country: COUNTRY.US
};
}