How to use @paypal/sdk-constants - 10 common examples

To help you get started, we’ve selected a few @paypal/sdk-constants examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github paypal / paypal-checkout-components / test / screenshot / config.js View on Github external
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
github paypal / paypal-sdk-client / src / script.js View on Github external
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
    };
}
github paypal / paypal-sdk-client / src / script.js View on Github external
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
github paypal / paypal-checkout-components / src / ui / buttons / styles / labels.js View on Github external
/* @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;
    }
`;
github paypal / paypal-card-components / src / component.js View on Github external
}).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
        };
      });
    });
github paypal / paypal-checkout-components / src / zoid / buttons / props.js View on Github external
|};

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,
github paypal / paypal-checkout-components / src / zoid / buttons / props.js View on Github external
|};

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,
github paypal / paypal-checkout-components / src / zoid / buttons / props.js View on Github external
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`);
    }
github paypal / paypal-checkout-components / src / zoid / buttons / props.js View on Github external
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`);
    }
github paypal / paypal-sdk-client / src / script.js View on Github external
// $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
    };
}