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 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 4x 4x 4x 4x 4x 4x 4x 65x 65x 1x 64x 1x 63x 2x 61x 1x 60x 1x 59x 59x 1x 58x 1x 57x 1x 56x 1x 55x 1x 54x 1x 53x 4x 65x 65x 65x 65x 65x 65x 65x 65x 65x 65x 119x 119x 119x 119x 119x 119x 119x | import React, { memo, Fragment, FunctionComponent } from 'react'; import { withCheckout } from '../checkout'; import { TranslatedString } from '../locale'; import { Button, ButtonSize, ButtonVariant } from '../ui/button'; import { IconBolt } from '../ui/icon'; import { PaymentMethodId, PaymentMethodType } from './paymentMethod'; interface PaymentSubmitButtonTextProps { methodGateway?: string; methodId?: string; methodType?: string; methodName?: string; initialisationStrategyType?: string; isPpsdkEnabled?: boolean; } const providersWithCustomClasses = [PaymentMethodId.Bolt]; const PaymentSubmitButtonText: FunctionComponent<PaymentSubmitButtonTextProps> = memo(({ methodId, methodName, methodType, methodGateway, isPpsdkEnabled = false, initialisationStrategyType }) => { if (isPpsdkEnabled && methodName && initialisationStrategyType === 'NONE') { return <TranslatedString data={ { methodName } } id="payment.ppsdk_continue_action" />; } if (methodId === PaymentMethodId.Amazon) { return <TranslatedString id="payment.amazon_continue_action" />; } if (methodId === PaymentMethodId.AmazonPay) { return <TranslatedString id="payment.amazonpay_continue_action" />; } if (methodId === PaymentMethodId.Bolt) { return (<Fragment> <IconBolt additionalClassName="payment-submit-button-bolt-icon" /> <TranslatedString id="payment.bolt_continue_action" /> </Fragment>); } if (methodGateway === PaymentMethodId.Barclaycard) { return <TranslatedString id="payment.barclaycard_continue_action" />; } Iif (methodGateway === PaymentMethodId.BlueSnapV2) { return <TranslatedString id="payment.bluesnap_v2_continue_action" />; } if (methodType === PaymentMethodType.VisaCheckout) { return <TranslatedString id="payment.visa_checkout_continue_action" />; } if (methodType === PaymentMethodType.Chasepay) { return <TranslatedString id="payment.chasepay_continue_action" />; } if (methodType === PaymentMethodType.Paypal) { return <TranslatedString id="payment.paypal_continue_action" />; } if (methodType === PaymentMethodType.PaypalCredit) { return <TranslatedString id="payment.paypal_credit_continue_action" />; } if (methodId === PaymentMethodId.Quadpay) { return <TranslatedString id="payment.quadpay_continue_action" />; } if (methodId === PaymentMethodId.Zip) { return <TranslatedString id="payment.zip_continue_action" />; } return <TranslatedString id="payment.place_order_action" />; }); export interface PaymentSubmitButtonProps { methodGateway?: string; methodId?: string; methodName?: string; methodType?: string; isDisabled?: boolean; initialisationStrategyType?: string; } interface WithCheckoutPaymentSubmitButtonProps { isInitializing?: boolean; isSubmitting?: boolean; isPpsdkEnabled: boolean; } const PaymentSubmitButton: FunctionComponent<PaymentSubmitButtonProps & WithCheckoutPaymentSubmitButtonProps> = ({ isDisabled, isInitializing, isSubmitting, methodGateway, methodId, methodName, methodType, isPpsdkEnabled, initialisationStrategyType, }) => ( <Button className={ providersWithCustomClasses.includes(methodId as PaymentMethodId) ? `payment-submit-button-${methodId}` : undefined } disabled={ isInitializing || isSubmitting || isDisabled } id="checkout-payment-continue" isFullWidth isLoading={ isSubmitting } size={ ButtonSize.Large } type="submit" variant={ ButtonVariant.Action } > <PaymentSubmitButtonText initialisationStrategyType={ initialisationStrategyType } isPpsdkEnabled={ isPpsdkEnabled } methodGateway={ methodGateway } methodId={ methodId } methodName={ methodName } methodType={ methodType } /> </Button> ); export default withCheckout(({ checkoutState, checkoutService }) => { const { statuses: { isInitializingCustomer, isInitializingPayment, isSubmittingOrder, }, } = checkoutState; const isPpsdkEnabled = Boolean( checkoutService.getState() .data.getConfig() ?.checkoutSettings.features['PAYMENTS-6806.enable_ppsdk_strategy'] ); return { isInitializing: isInitializingCustomer() || isInitializingPayment(), isSubmitting: isSubmittingOrder(), isPpsdkEnabled, }; })(memo(PaymentSubmitButton)); |