<commit_before>import React from 'react';
import { PAYMENT_METHOD_TYPE, PAYMENT_METHOD_TYPES } from '@proton/shared/lib/constants';
import { c } from 'ttag';
import { SubscriptionCheckResponse } from '@proton/shared/lib/interfaces';

import { PrimaryButton, PayPalButton } from '@proton/components';
import { SignupPayPal } from './interfaces';

interface Props {
    className?: string;
    paypal: SignupPayPal;
    canPay: boolean;
    loading: boolean;
    method?: PAYMENT_METHOD_TYPE;
    checkResult?: SubscriptionCheckResponse;
}

const CheckoutButton = ({ className, paypal, canPay, loading, method, checkResult }: Props) => {
    if (method === PAYMENT_METHOD_TYPES.PAYPAL) {
        return (
            <PayPalButton
                paypal={paypal}
                flow="signup"
                color="norm"
                className={className}
                amount={checkResult ? checkResult.AmountDue : 0}
            >{c('Action').t`Pay`}</PayPalButton>
        );
    }

    if (checkResult && !checkResult.AmountDue) {
        return (
            <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action')
                .t`Confirm`}</PrimaryButton>
        );
    }

    return (
        <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action')
            .t`Pay`}</PrimaryButton>
    );
};

export default CheckoutButton;
<commit_msg>Use StyledPayPalButton on signup checkout<commit_after>import React from 'react';
import { PAYMENT_METHOD_TYPE, PAYMENT_METHOD_TYPES } from '@proton/shared/lib/constants';
import { c } from 'ttag';
import { SubscriptionCheckResponse } from '@proton/shared/lib/interfaces';

import { PrimaryButton, StyledPayPalButton } from '@proton/components';
import { SignupPayPal } from './interfaces';

interface Props {
    className?: string;
    paypal: SignupPayPal;
    canPay: boolean;
    loading: boolean;
    method?: PAYMENT_METHOD_TYPE;
    checkResult?: SubscriptionCheckResponse;
}

const CheckoutButton = ({ className, paypal, canPay, loading, method, checkResult }: Props) => {
    if (method === PAYMENT_METHOD_TYPES.PAYPAL) {
        return (
            <StyledPayPalButton
                paypal={paypal}
                flow="signup"
                className={className}
                amount={checkResult ? checkResult.AmountDue : 0}
            />
        );
    }

    if (checkResult && !checkResult.AmountDue) {
        return (
            <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action')
                .t`Confirm`}</PrimaryButton>
        );
    }

    return (
        <PrimaryButton className={className} loading={loading} disabled={!canPay} type="submit">{c('Action')
            .t`Pay`}</PrimaryButton>
    );
};

export default CheckoutButton;

{'fraction_non_alphanumeric': 0.1276595744680851, 'fraction_numerical': 0.0006975933031042902, 'mean_word_length': 2.9449793672627234, 'pattern_counts': {'":': 0, '<': 14, '<?xml version=': 0, '>': 16, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5447007', 'n_tokens_mistral': 841, 'n_tokens_neox': 817, 'n_words': 166}