diff --git a/src/generated/graphql.tsx b/src/generated/graphql.tsx index 64e4e8ffa..4d8aa8560 100644 --- a/src/generated/graphql.tsx +++ b/src/generated/graphql.tsx @@ -79,6 +79,11 @@ export type AddOn = { updatedAt: Scalars['ISO8601DateTime']['output']; }; + +export type AddOnIntegrationMappingsArgs = { + integrationId?: InputMaybe; +}; + export type AddOnCollection = { __typename?: 'AddOnCollection'; collection: Array; @@ -192,6 +197,12 @@ export type BillableMetric = { weightedInterval?: Maybe; }; + +/** Base billable metric */ +export type BillableMetricIntegrationMappingsArgs = { + integrationId?: InputMaybe; +}; + export type BillableMetricCollection = { __typename?: 'BillableMetricCollection'; collection: Array; @@ -6336,15 +6347,6 @@ export type GetInvoicesListQueryVariables = Exact<{ export type GetInvoicesListQuery = { __typename?: 'Query', invoices: { __typename?: 'InvoiceCollection', metadata: { __typename?: 'CollectionMetadata', currentPage: number, totalPages: number, totalCount: number }, collection: Array<{ __typename?: 'Invoice', id: string, status: InvoiceStatusTypeEnum, paymentStatus: InvoicePaymentStatusTypeEnum, number: string, issuingDate: any, totalAmountCents: any, currency?: CurrencyEnum | null, voidable: boolean, paymentDisputeLostAt?: any | null, customer: { __typename?: 'Customer', id: string, name?: string | null, applicableTimezone: TimezoneEnum } }> } }; -export type GetCreditNotesListQueryVariables = Exact<{ - limit?: InputMaybe; - page?: InputMaybe; - searchTerm?: InputMaybe; -}>; - - -export type GetCreditNotesListQuery = { __typename?: 'Query', creditNotes: { __typename?: 'CreditNoteCollection', metadata: { __typename?: 'CollectionMetadata', currentPage: number, totalPages: number, totalCount: number }, collection: Array<{ __typename?: 'CreditNote', id: string, number: string, totalAmountCents: any, currency: CurrencyEnum, createdAt: any, canBeVoided: boolean, invoice?: { __typename?: 'Invoice', id: string, number: string, customer: { __typename?: 'Customer', id: string, applicableTimezone: TimezoneEnum, name?: string | null } } | null }> } }; - export type RetryAllInvoicePaymentsMutationVariables = Exact<{ input: RetryAllInvoicePaymentsInput; }>; @@ -15198,58 +15200,6 @@ export type GetInvoicesListQueryHookResult = ReturnType; export type GetInvoicesListSuspenseQueryHookResult = ReturnType; export type GetInvoicesListQueryResult = Apollo.QueryResult; -export const GetCreditNotesListDocument = gql` - query getCreditNotesList($limit: Int, $page: Int, $searchTerm: String) { - creditNotes(limit: $limit, page: $page, searchTerm: $searchTerm) { - metadata { - currentPage - totalPages - totalCount - } - collection { - id - ...CreditNoteForCreditNoteList - ...CreditNoteForCreditNoteListItem - } - } -} - ${CreditNoteForCreditNoteListFragmentDoc} -${CreditNoteForCreditNoteListItemFragmentDoc}`; - -/** - * __useGetCreditNotesListQuery__ - * - * To run a query within a React component, call `useGetCreditNotesListQuery` and pass it any options that fit your needs. - * When your component renders, `useGetCreditNotesListQuery` returns an object from Apollo Client that contains loading, error, and data properties - * you can use to render your UI. - * - * @param baseOptions options that will be passed into the query, supported options are listed on: https://www.apollographql.com/docs/react/api/react-hooks/#options; - * - * @example - * const { data, loading, error } = useGetCreditNotesListQuery({ - * variables: { - * limit: // value for 'limit' - * page: // value for 'page' - * searchTerm: // value for 'searchTerm' - * }, - * }); - */ -export function useGetCreditNotesListQuery(baseOptions?: Apollo.QueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useQuery(GetCreditNotesListDocument, options); - } -export function useGetCreditNotesListLazyQuery(baseOptions?: Apollo.LazyQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useLazyQuery(GetCreditNotesListDocument, options); - } -export function useGetCreditNotesListSuspenseQuery(baseOptions?: Apollo.SuspenseQueryHookOptions) { - const options = {...defaultOptions, ...baseOptions} - return Apollo.useSuspenseQuery(GetCreditNotesListDocument, options); - } -export type GetCreditNotesListQueryHookResult = ReturnType; -export type GetCreditNotesListLazyQueryHookResult = ReturnType; -export type GetCreditNotesListSuspenseQueryHookResult = ReturnType; -export type GetCreditNotesListQueryResult = Apollo.QueryResult; export const RetryAllInvoicePaymentsDocument = gql` mutation retryAllInvoicePayments($input: RetryAllInvoicePaymentsInput!) { retryAllInvoicePayments(input: $input) { diff --git a/src/pages/InvoicesPage.tsx b/src/pages/InvoicesPage.tsx index af70ca31b..1d8180469 100644 --- a/src/pages/InvoicesPage.tsx +++ b/src/pages/InvoicesPage.tsx @@ -4,7 +4,6 @@ import { generatePath, useParams, useSearchParams } from 'react-router-dom' import styled from 'styled-components' import { Button, NavigationTab, Typography } from '~/components/designSystem' -import CreditNotesList from '~/components/invoices/CreditNotesList' import { UpdateInvoicePaymentStatusDialog, UpdateInvoicePaymentStatusDialogRef, @@ -19,13 +18,10 @@ import { SearchInput } from '~/components/SearchInput' import { addToast, hasDefinedGQLError } from '~/core/apolloClient' import { INVOICES_ROUTE, INVOICES_TAB_ROUTE } from '~/core/router' import { - CreditNoteForCreditNoteListFragmentDoc, - CreditNoteForCreditNoteListItemFragmentDoc, InvoiceListItemFragmentDoc, InvoicePaymentStatusTypeEnum, InvoiceStatusTypeEnum, LagoApiError, - useGetCreditNotesListLazyQuery, useGetInvoicesListLazyQuery, useRetryAllInvoicePaymentsMutation, } from '~/generated/graphql' @@ -63,21 +59,6 @@ gql` } } - query getCreditNotesList($limit: Int, $page: Int, $searchTerm: String) { - creditNotes(limit: $limit, page: $page, searchTerm: $searchTerm) { - metadata { - currentPage - totalPages - totalCount - } - collection { - id - ...CreditNoteForCreditNoteList - ...CreditNoteForCreditNoteListItem - } - } - } - mutation retryAllInvoicePayments($input: RetryAllInvoicePaymentsInput!) { retryAllInvoicePayments(input: $input) { collection { @@ -87,8 +68,6 @@ gql` } ${InvoiceListItemFragmentDoc} - ${CreditNoteForCreditNoteListFragmentDoc} - ${CreditNoteForCreditNoteListItemFragmentDoc} ` export enum InvoiceListStatusEnum { @@ -150,30 +129,7 @@ const InvoicesPage = () => { }), }, }) - - const [ - getCreditNotes, - { - data: dataCreditNotes, - loading: loadingCreditNotes, - error: errorCreditNotes, - fetchMore: fetchMoreCreditNotes, - variables: variableCreditNotes, - }, - ] = useGetCreditNotesListLazyQuery({ - notifyOnNetworkStatusChange: true, - fetchPolicy: 'network-only', - nextFetchPolicy: 'network-only', - variables: { - limit: 20, - }, - }) - - const { debouncedSearch: invoiceDebounceSearch, isLoading: invoiceIsLoading } = - useDebouncedSearch(getInvoices, loadingInvoices) - const { debouncedSearch: creditNoteDebounceSearch, isLoading: creditNoteIsLoading } = - useDebouncedSearch(getCreditNotes, loadingCreditNotes) - + const { debouncedSearch, isLoading } = useDebouncedSearch(getInvoices, loadingInvoices) const [retryAll] = useRetryAllInvoicePaymentsMutation({ context: { silentErrorCodes: [LagoApiError.PaymentProcessorIsCurrentlyHandlingPayment] }, onCompleted({ retryAllInvoicePayments }) { @@ -215,18 +171,10 @@ const InvoicesPage = () => { - {tab === InvoiceListTabEnum.invoices ? ( - - ) : tab === InvoiceListTabEnum.creditNotes ? ( - - ) : null} - + {invoiceType === InvoiceListStatusEnum.pendingFailed && hasPermissions(['invoicesSend']) && (