Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | 8x 8x 8x 8x 18x 8x 14x 2x 12x 4x 8x 1x | import { Checkout, Customer } from '@bigcommerce/checkout-sdk'; import { every } from 'lodash'; import { SUPPORTED_METHODS } from './CheckoutButtonList'; const SUPPORTED_SIGNOUT_METHODS = [ 'amazon', 'amazonpay', ]; export const isSupportedSignoutMethod = (methodId: string): boolean => { return SUPPORTED_SIGNOUT_METHODS.indexOf(methodId) > -1; }; export default function canSignOut(customer: Customer, checkout: Checkout, methodId: string): boolean { if (isSupportedSignoutMethod(methodId)) { return true; } if (customer.isGuest) { return false; } // Return false if payment method offers its own checkout button return every(checkout.payments, payment => SUPPORTED_METHODS.indexOf(payment.providerId) === -1 ); } |