1 import { c } from 'ttag';
3 import type { ButtonProps } from '@proton/atoms';
4 import { Button } from '@proton/atoms';
5 import type { PaypalProcessorHook } from '@proton/components/payments/react-extensions/usePaypal';
6 import type { PaymentMethodFlows } from '@proton/payments';
7 import { type Currency } from '@proton/payments';
9 export type PayPalButtonProps = ButtonProps & {
11 flow?: PaymentMethodFlows;
12 prefetchToken?: boolean;
14 paypal: PaypalProcessorHook;
17 export const PayPalButton = ({
23 disabled: disabledProp,
27 }: PayPalButtonProps) => {
28 const disabled = disabledProp || paypal.disabled;
30 if (paypal.verifyingToken) {
31 return <Button loading {...rest}>{c('Action').t`Loading verification`}</Button>;
34 if (paypal.verificationError) {
37 onClick={paypal.fetchPaymentToken}
39 loading={paypal.processingToken}
41 >{c('Action').t`Retry`}</Button>
46 <Button loading={paypal.processingToken || loading} disabled={disabled} onClick={onClick} {...rest}>
52 export default PayPalButton;