// @ts-nocheck import React from 'react'; import styled from 'styled-components'; import { Button, Classes, Intent, Menu, MenuItem, Popover, Tag, Text, Tooltip, } from '@blueprintjs/core'; import { Box, Card, Group, Stack } from '@/components'; import { StripeLogo } from '@/icons/StripeLogo'; import { usePaymentMethodsBoot } from './PreferencesPaymentMethodsBoot'; import { DialogsName } from '@/constants/dialogs'; import { useAlertActions, useDialogActions, useDrawerActions, } from '@/hooks/state'; import { DRAWERS } from '@/constants/drawers'; import { MoreIcon } from '@/icons/More'; import { STRIPE_PRICING_LINK } from './constants'; export function StripePaymentMethod() { const { openDialog } = useDialogActions(); const { openDrawer } = useDrawerActions(); const { openAlert } = useAlertActions(); const { paymentMethodsState } = usePaymentMethodsBoot(); const stripeState = paymentMethodsState?.stripe; const isAccountCreated = stripeState?.isStripeAccountCreated; const isPaymentEnabled = stripeState?.isStripePaymentEnabled; const isPayoutEnabled = stripeState?.isStripePayoutEnabled; const isStripeEnabled = stripeState?.isStripeEnabled; const stripePaymentMethodId = stripeState?.stripePaymentMethodId; const isStripeServerConfigured = stripeState?.isStripeServerConfigured; // Handle Stripe setup button click. const handleSetUpBtnClick = () => { openDialog(DialogsName.StripeSetup); }; // Handle edit button click. const handleEditBtnClick = () => { openDrawer(DRAWERS.STRIPE_PAYMENT_INTEGRATION_EDIT, { stripePaymentMethodId: stripePaymentMethodId, }); }; // Handle delete connection button click. const handleDeleteConnectionClick = () => { openAlert('delete-stripe-payment-method', { paymentMethodId: stripePaymentMethodId, }); }; return ( {isStripeEnabled && ( Active )} {!isPaymentEnabled && isAccountCreated && ( Payment Not Enabled )} {!isPayoutEnabled && isAccountCreated && ( Payout Not Enabled )} {isAccountCreated && ( )} {!isAccountCreated && ( )} {isAccountCreated && ( } >