@bunnyapp/components 1.8.0-beta.43 → 1.8.0-beta.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/dist/cjs/index.js +41 -41
  2. package/dist/cjs/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutPrice.d.ts +0 -1
  3. package/dist/cjs/types/src/components/index.d.ts +5 -2
  4. package/dist/cjs/types/src/components/tables/InfiniteTable/InfiniteResourceTable.d.ts +41 -0
  5. package/dist/cjs/types/src/components/tables/InfiniteTable/InfiniteTable.d.ts +29 -0
  6. package/dist/cjs/types/src/components/tables/InfiniteTable/InfiniteTableFooter.d.ts +9 -0
  7. package/dist/cjs/types/src/components/tables/InfiniteTable/InfiniteTableGridCell.d.ts +2 -0
  8. package/dist/cjs/types/src/components/tables/InfiniteTable/InfiniteTableHeader.d.ts +5 -0
  9. package/dist/cjs/types/src/components/tables/InfiniteTable/hooks/useAutoRowsPerPage.d.ts +11 -0
  10. package/dist/cjs/types/src/components/tables/InfiniteTable/hooks/useContainerWidth.d.ts +1 -0
  11. package/dist/cjs/types/src/components/tables/InfiniteTable/index.d.ts +4 -0
  12. package/dist/cjs/types/src/components/tables/InfiniteTable/types.d.ts +54 -0
  13. package/dist/cjs/types/src/components/tables/Invoices/Invoices.d.ts +25 -0
  14. package/dist/cjs/types/src/components/tables/Invoices/index.d.ts +1 -0
  15. package/dist/cjs/types/src/components/tables/Invoices/invoicesList/InvoiceMobileRow.d.ts +10 -0
  16. package/dist/cjs/types/src/components/tables/Invoices/invoicesList/getInvoiceColumns.d.ts +22 -0
  17. package/dist/cjs/types/src/components/tables/Quotes/Quotes.d.ts +20 -0
  18. package/dist/cjs/types/src/components/tables/Quotes/quotesList/QuoteMobileRow.d.ts +9 -0
  19. package/dist/cjs/types/src/components/tables/Quotes/quotesList/getQuoteColumns.d.ts +22 -0
  20. package/dist/cjs/types/src/components/tables/Transactions/Transactions.d.ts +26 -0
  21. package/dist/cjs/types/src/components/{Transactions → tables/Transactions}/Transactions.stories.d.ts +0 -3
  22. package/dist/cjs/types/src/components/tables/Transactions/transactionsList/TransactionDetail.d.ts +7 -0
  23. package/dist/cjs/types/src/components/tables/Transactions/transactionsList/TransactionMobileRow.d.ts +11 -0
  24. package/dist/cjs/types/src/components/tables/Transactions/transactionsList/getTransactionColumns.d.ts +16 -0
  25. package/dist/cjs/types/src/components/{Transactions → tables/Transactions}/transactionsList/utils.d.ts +1 -1
  26. package/dist/cjs/types/src/components/tables/Transactions/types.d.ts +1 -0
  27. package/dist/cjs/types/src/graphql/queries/getInvoices.d.ts +11 -0
  28. package/dist/cjs/types/src/graphql/queries/getQuotes.d.ts +8 -3
  29. package/dist/cjs/types/src/graphql/queries/getTransactions.d.ts +9 -1
  30. package/dist/cjs/types/src/graphql/queries/paginatedQuery.d.ts +22 -0
  31. package/dist/cjs/types/src/utils/QueryKeyFactory.d.ts +14 -2
  32. package/dist/esm/index.js +41 -41
  33. package/dist/esm/types/src/components/Subscriptions/Upgrade/PlanPicker/checkoutBar/CheckoutPrice.d.ts +0 -1
  34. package/dist/esm/types/src/components/index.d.ts +5 -2
  35. package/dist/esm/types/src/components/tables/InfiniteTable/InfiniteResourceTable.d.ts +41 -0
  36. package/dist/esm/types/src/components/tables/InfiniteTable/InfiniteTable.d.ts +29 -0
  37. package/dist/esm/types/src/components/tables/InfiniteTable/InfiniteTableFooter.d.ts +9 -0
  38. package/dist/esm/types/src/components/tables/InfiniteTable/InfiniteTableGridCell.d.ts +2 -0
  39. package/dist/esm/types/src/components/tables/InfiniteTable/InfiniteTableHeader.d.ts +5 -0
  40. package/dist/esm/types/src/components/tables/InfiniteTable/hooks/useAutoRowsPerPage.d.ts +11 -0
  41. package/dist/esm/types/src/components/tables/InfiniteTable/hooks/useContainerWidth.d.ts +1 -0
  42. package/dist/esm/types/src/components/tables/InfiniteTable/index.d.ts +4 -0
  43. package/dist/esm/types/src/components/tables/InfiniteTable/types.d.ts +54 -0
  44. package/dist/esm/types/src/components/tables/Invoices/Invoices.d.ts +25 -0
  45. package/dist/esm/types/src/components/tables/Invoices/index.d.ts +1 -0
  46. package/dist/esm/types/src/components/tables/Invoices/invoicesList/InvoiceMobileRow.d.ts +10 -0
  47. package/dist/esm/types/src/components/tables/Invoices/invoicesList/getInvoiceColumns.d.ts +22 -0
  48. package/dist/esm/types/src/components/tables/Quotes/Quotes.d.ts +20 -0
  49. package/dist/esm/types/src/components/tables/Quotes/quotesList/QuoteMobileRow.d.ts +9 -0
  50. package/dist/esm/types/src/components/tables/Quotes/quotesList/getQuoteColumns.d.ts +22 -0
  51. package/dist/esm/types/src/components/tables/Transactions/Transactions.d.ts +26 -0
  52. package/dist/esm/types/src/components/{Transactions → tables/Transactions}/Transactions.stories.d.ts +0 -3
  53. package/dist/esm/types/src/components/tables/Transactions/transactionsList/TransactionDetail.d.ts +7 -0
  54. package/dist/esm/types/src/components/tables/Transactions/transactionsList/TransactionMobileRow.d.ts +11 -0
  55. package/dist/esm/types/src/components/tables/Transactions/transactionsList/getTransactionColumns.d.ts +16 -0
  56. package/dist/esm/types/src/components/{Transactions → tables/Transactions}/transactionsList/utils.d.ts +1 -1
  57. package/dist/esm/types/src/components/tables/Transactions/types.d.ts +1 -0
  58. package/dist/esm/types/src/graphql/queries/getInvoices.d.ts +11 -0
  59. package/dist/esm/types/src/graphql/queries/getQuotes.d.ts +8 -3
  60. package/dist/esm/types/src/graphql/queries/getTransactions.d.ts +9 -1
  61. package/dist/esm/types/src/graphql/queries/paginatedQuery.d.ts +22 -0
  62. package/dist/esm/types/src/utils/QueryKeyFactory.d.ts +14 -2
  63. package/dist/index.d.ts +147 -72
  64. package/package.json +1 -1
  65. package/dist/cjs/types/src/components/Quotes/Quotes.d.ts +0 -38
  66. package/dist/cjs/types/src/components/Transactions/Transactions.d.ts +0 -56
  67. package/dist/cjs/types/src/components/Transactions/transactionsList/TransactionGridCell.d.ts +0 -2
  68. package/dist/cjs/types/src/components/Transactions/transactionsList/TransactionsEmptyState.d.ts +0 -2
  69. package/dist/cjs/types/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +0 -7
  70. package/dist/cjs/types/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +0 -6
  71. package/dist/cjs/types/src/contexts/TransactionsListContext.d.ts +0 -30
  72. package/dist/esm/types/src/components/Quotes/Quotes.d.ts +0 -38
  73. package/dist/esm/types/src/components/Transactions/Transactions.d.ts +0 -56
  74. package/dist/esm/types/src/components/Transactions/transactionsList/TransactionGridCell.d.ts +0 -2
  75. package/dist/esm/types/src/components/Transactions/transactionsList/TransactionsEmptyState.d.ts +0 -2
  76. package/dist/esm/types/src/components/Transactions/transactionsList/TransactionsListDesktop.d.ts +0 -7
  77. package/dist/esm/types/src/components/Transactions/transactionsList/TransactionsListMobile.d.ts +0 -6
  78. package/dist/esm/types/src/contexts/TransactionsListContext.d.ts +0 -30
  79. /package/dist/cjs/types/src/components/{Quotes → tables/Quotes}/Quotes.stories.d.ts +0 -0
  80. /package/dist/cjs/types/src/components/{Quotes → tables/Quotes}/index.d.ts +0 -0
  81. /package/dist/cjs/types/src/components/{Transactions → tables/Transactions}/index.d.ts +0 -0
  82. /package/dist/cjs/types/src/components/{Transactions → tables/Transactions}/transactionsList/TransactionDate.d.ts +0 -0
  83. /package/dist/cjs/types/src/components/{Transactions → tables/Transactions}/transactionsList/TransactionDownload.d.ts +0 -0
  84. /package/dist/cjs/types/src/components/{Transactions → tables/Transactions}/transactionsList/TransactionTitle.d.ts +0 -0
  85. /package/dist/esm/types/src/components/{Quotes → tables/Quotes}/Quotes.stories.d.ts +0 -0
  86. /package/dist/esm/types/src/components/{Quotes → tables/Quotes}/index.d.ts +0 -0
  87. /package/dist/esm/types/src/components/{Transactions → tables/Transactions}/index.d.ts +0 -0
  88. /package/dist/esm/types/src/components/{Transactions → tables/Transactions}/transactionsList/TransactionDate.d.ts +0 -0
  89. /package/dist/esm/types/src/components/{Transactions → tables/Transactions}/transactionsList/TransactionDownload.d.ts +0 -0
  90. /package/dist/esm/types/src/components/{Transactions → tables/Transactions}/transactionsList/TransactionTitle.d.ts +0 -0
@@ -2,7 +2,6 @@ import PriceList from '@/types/PriceList';
2
2
  import { FragmentOf } from 'gql.tada';
3
3
  export declare const CheckoutPrice_QuoteFragment: import("gql.tada").TadaDocumentNode<{
4
4
  periodAmount: number | null;
5
- amountDue: number | null;
6
5
  quoteChanges: {
7
6
  charges: {
8
7
  kind: "SUBSCRIBE" | "UPDATE" | "RENEW" | "REINSTATE" | "UNSUBSCRIBE" | "ADJUSTMENT" | "COUPON" | "DISCOUNT" | "PERCENTAGE_DISCOUNT" | "CREDIT" | "PRICE_UPDATE" | "QUANTITY_UPDATE" | "FREE_PERIOD_DISCOUNT" | "ACTIVATE" | null;
@@ -1,10 +1,13 @@
1
+ export { InfiniteTable } from './tables/InfiniteTable';
2
+ export type { Column, ColumnAlign, CursorPage, InfiniteTableQueryArgs } from './tables/InfiniteTable';
1
3
  export { Invoice } from './Invoice';
4
+ export { Invoices } from './tables/Invoices';
2
5
  export { Quote } from './Quote';
3
- export { Quotes } from './Quotes';
6
+ export { Quotes } from './tables/Quotes';
4
7
  export { PaymentForm } from './PaymentForm';
5
8
  export { Signup } from './Signup';
6
9
  export { default as BunnyProvider } from './BunnyProvider/BunnyProvider';
7
- export { default as Transactions } from './Transactions';
10
+ export { default as Transactions } from './tables/Transactions';
8
11
  export { Subscriptions } from './Subscriptions';
9
12
  export { BillingDetails } from './BillingDetails';
10
13
  export { Footer } from './Footer';
@@ -0,0 +1,41 @@
1
+ import { ReactNode } from 'react';
2
+ import { ShadowType } from '../../../types/shadowType';
3
+ import { Column, CursorPage, InfiniteTableQueryArgs } from './types';
4
+ export type InfiniteResourceTableDisplayOptions = {
5
+ className?: string;
6
+ style?: React.CSSProperties;
7
+ shadow?: ShadowType;
8
+ showTitle?: boolean;
9
+ title?: string;
10
+ showSearchBar?: boolean;
11
+ searchBarClassName?: string;
12
+ searchPlaceholder?: string;
13
+ useModal?: boolean;
14
+ detailWidth?: number;
15
+ };
16
+ export type InfiniteResourceTableBehaviorOptions = {
17
+ rowsPerPage?: number;
18
+ suppressDetail?: boolean;
19
+ };
20
+ type Props<T> = {
21
+ queryKey: readonly unknown[];
22
+ queryFn: (args: InfiniteTableQueryArgs) => Promise<CursorPage<T>>;
23
+ columns: Column<T>[];
24
+ getRowKey: (row: T) => string | number;
25
+ renderMobileRow?: (row: T) => ReactNode;
26
+ emptyMessage: string;
27
+ searchValue: string;
28
+ onSearchChange: (value: string) => void;
29
+ detailTitle: string | ((item: T) => string);
30
+ renderDetail: (item: T) => ReactNode;
31
+ onRowClick?: (row: T) => void;
32
+ displayOptions?: InfiniteResourceTableDisplayOptions;
33
+ behaviorOptions?: InfiniteResourceTableBehaviorOptions;
34
+ };
35
+ /**
36
+ * Shell for a paginated resource list with a search bar, title, and a
37
+ * detail drawer/modal. Owns selection state; delegates data, columns, and
38
+ * detail rendering to the caller.
39
+ */
40
+ export default function InfiniteResourceTable<T>({ queryKey, queryFn, columns, getRowKey, renderMobileRow, emptyMessage, searchValue, onSearchChange, detailTitle, renderDetail, onRowClick, displayOptions, behaviorOptions, }: Props<T>): import("react").JSX.Element;
41
+ export {};
@@ -0,0 +1,29 @@
1
+ import { ReactNode } from 'react';
2
+ import { ShadowType } from '../../../types/shadowType';
3
+ import { Column, CursorPage, InfiniteTableQueryArgs } from './types';
4
+ type Props<T> = {
5
+ /** Base cache key. `rowsPerPage` is appended automatically. */
6
+ queryKey: readonly unknown[];
7
+ /** Fetches a single page. Must return a Relay-shaped `CursorPage`. */
8
+ queryFn: (args: InfiniteTableQueryArgs) => Promise<CursorPage<T>>;
9
+ /** Extracts a stable React key from each row. */
10
+ getRowKey: (row: T) => string | number;
11
+ /** Declarative column configuration. */
12
+ columns: Column<T>[];
13
+ /** Invoked when a row is clicked. Presence enables the row-hover cursor. */
14
+ onRowClick?: (row: T) => void;
15
+ /** Fallback text shown when the current page has no rows. */
16
+ emptyMessage?: string;
17
+ /** Fully custom empty-state renderer; overrides `emptyMessage`. */
18
+ renderEmpty?: () => ReactNode;
19
+ /** Force a page size. When omitted the table auto-sizes to the viewport. Must be 1-100. */
20
+ rowsPerPage?: number;
21
+ /** Card shadow class. */
22
+ shadow?: ShadowType;
23
+ className?: string;
24
+ style?: React.CSSProperties;
25
+ /** Escape hatch: on mobile, render each row with this callback instead of the columns grid. */
26
+ renderMobileRow?: (row: T) => ReactNode;
27
+ };
28
+ declare function InfiniteTable<T>({ queryKey, queryFn, getRowKey, columns, onRowClick, emptyMessage, renderEmpty, rowsPerPage, shadow, className, style, renderMobileRow, }: Props<T>): import("react").JSX.Element;
29
+ export default InfiniteTable;
@@ -0,0 +1,9 @@
1
+ declare const InfiniteTableFooter: ({ currentPageIndex, totalPages, isFetchingNextPage, onClickPageIndex, onClickNextPage, onClickPreviousPage, }: {
2
+ currentPageIndex: number;
3
+ totalPages: number;
4
+ isFetchingNextPage?: boolean;
5
+ onClickPageIndex: (index: number) => void;
6
+ onClickNextPage: () => void;
7
+ onClickPreviousPage: () => void;
8
+ }) => import("react").JSX.Element | null;
9
+ export default InfiniteTableFooter;
@@ -0,0 +1,2 @@
1
+ declare const InfiniteTableGridCell: any;
2
+ export default InfiniteTableGridCell;
@@ -0,0 +1,5 @@
1
+ import { Column } from './types';
2
+ declare function InfiniteTableHeader<T>({ columns }: {
3
+ columns: Column<T>[];
4
+ }): import("react").JSX.Element;
5
+ export default InfiniteTableHeader;
@@ -0,0 +1,11 @@
1
+ import { RefObject } from 'react';
2
+ export declare const MAX_ROWS_PER_PAGE = 100;
3
+ /** Throws if `rowsPerPage` is outside the API's per-request range. Callers pass their component name for a clearer error. */
4
+ export declare function assertRowsPerPage(rowsPerPage: number | undefined, componentName: string): void;
5
+ /**
6
+ * Returns the number of rows the table can show without introducing an
7
+ * inner scroll bar, given the current viewport height and the card's
8
+ * position on screen. When `override` is provided, measurement is skipped
9
+ * and the override is returned directly.
10
+ */
11
+ export declare function useAutoRowsPerPage(cardRef: RefObject<HTMLElement | null>, override?: number): number;
@@ -0,0 +1 @@
1
+ export declare function useContainerWidth(): [(el: HTMLElement | null) => void, number];
@@ -0,0 +1,4 @@
1
+ export { default as InfiniteTable } from './InfiniteTable';
2
+ export { default as InfiniteResourceTable } from './InfiniteResourceTable';
3
+ export { MAX_ROWS_PER_PAGE, assertRowsPerPage } from './hooks/useAutoRowsPerPage';
4
+ export type { Column, ColumnAlign, CursorPage, InfiniteTableQueryArgs, TableBehaviorOptions, TableDisplayOptions, } from './types';
@@ -0,0 +1,54 @@
1
+ import { ReactNode } from 'react';
2
+ import { ShadowType } from '../../../types/shadowType';
3
+ export type { CursorPage } from '../../../graphql/queries/paginatedQuery';
4
+ export type ColumnAlign = 'left' | 'right';
5
+ export type Column<T> = {
6
+ /** Unique identifier for the column; also used as the React key. */
7
+ key: string;
8
+ /** Bold header text. Pass an empty string to render no label. */
9
+ label: string;
10
+ /** Cell renderer for each row. */
11
+ render: (row: T) => ReactNode;
12
+ /** Cell + header alignment. Defaults to 'left'. */
13
+ align?: ColumnAlign;
14
+ /** Explicit `grid-template-columns` segment (e.g. `'120px'`, `'auto'`). Ignored when `flex` is true. */
15
+ width?: string;
16
+ /** When true, this column takes the remaining space (`3fr`). At most one column should set this. */
17
+ flex?: boolean;
18
+ };
19
+ export type InfiniteTableQueryArgs = {
20
+ first: number;
21
+ after?: string;
22
+ };
23
+ /** Shared display options for the resource table wrappers (Invoices, Quotes, Transactions, ...). */
24
+ export type TableDisplayOptions<ColumnKey extends string> = {
25
+ /** Whether to show the search bar */
26
+ showSearchBar?: boolean;
27
+ /** Whether to show the title */
28
+ showTitle?: boolean;
29
+ /** The title to display above the list */
30
+ title?: string;
31
+ /** The columns to display */
32
+ columns?: ColumnKey[];
33
+ /** A custom class name to apply to the component */
34
+ className?: string;
35
+ /** A custom style to apply to the component */
36
+ style?: React.CSSProperties;
37
+ /** Card shadow class */
38
+ shadow?: ShadowType;
39
+ /** Whether to open the row detail in a modal instead of a drawer */
40
+ useModal?: boolean;
41
+ /** A custom class name to apply to the search bar */
42
+ searchBarClassName?: string;
43
+ /** Message to display when the list is empty */
44
+ emptyMessage?: string;
45
+ };
46
+ /** Shared behavior options for the resource table wrappers. */
47
+ export type TableBehaviorOptions = {
48
+ /** Whether to suppress the row detail drawer/modal on row click */
49
+ suppressDetail?: boolean;
50
+ /** Force a specific number of rows per page. When omitted the table
51
+ * auto-sizes based on the available viewport height. Must be between
52
+ * 1 and 100 (the API's per-request cap). */
53
+ rowsPerPage?: number;
54
+ };
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import Invoice from '@/types/Invoice';
3
+ import { TableBehaviorOptions, TableDisplayOptions } from '../InfiniteTable';
4
+ import { InvoiceColumnKey, InvoiceDateType } from './invoicesList/getInvoiceColumns';
5
+ export type InvoicesDisplayOptions = TableDisplayOptions<InvoiceColumnKey>;
6
+ export type InvoicesBehaviorOptions = TableBehaviorOptions & {
7
+ /** The type of date to display for invoices. */
8
+ invoiceDateType?: InvoiceDateType;
9
+ /** Whether to hide the payment form on invoices */
10
+ hidePaymentForm?: boolean;
11
+ };
12
+ export default function Invoices({ invoiceComponent, onInvoiceClick, filter, sort, displayOptions, behaviorOptions, }: {
13
+ /** A custom component to render instead of the default invoice component */
14
+ invoiceComponent?: React.ReactNode;
15
+ /** A function to call when an invoice is clicked */
16
+ onInvoiceClick?: (invoice: Invoice) => void;
17
+ /** Filter expression applied server-side, e.g. `"invoice.amount is 100"`.
18
+ * Docs: https://docs.bunny.com/developer/getting-started/using-filters-in-queries
19
+ */
20
+ filter?: string;
21
+ /** Sort clause applied server-side, e.g. `"createdAt DESC"` or `"amount ASC"`. */
22
+ sort?: string;
23
+ displayOptions?: InvoicesDisplayOptions;
24
+ behaviorOptions?: InvoicesBehaviorOptions;
25
+ }): React.JSX.Element;
@@ -0,0 +1 @@
1
+ export { default as Invoices } from './Invoices';
@@ -0,0 +1,10 @@
1
+ import Invoice from '@/types/Invoice';
2
+ import { InvoiceColumnKey, InvoiceDateType } from './getInvoiceColumns';
3
+ declare const InvoiceMobileRow: ({ invoice, columns, invoiceDateType, token, apiHost, }: {
4
+ invoice: Invoice;
5
+ columns: InvoiceColumnKey[];
6
+ invoiceDateType: InvoiceDateType;
7
+ token: string | undefined;
8
+ apiHost: string;
9
+ }) => import("react").JSX.Element;
10
+ export default InvoiceMobileRow;
@@ -0,0 +1,22 @@
1
+ import Invoice from '@/types/Invoice';
2
+ import { Column } from '../../InfiniteTable';
3
+ export type InvoiceColumnKey = 'date' | 'title' | 'state' | 'amount' | 'download' | 'accountName';
4
+ export type InvoiceDateType = 'createdAt' | 'issuedAt' | 'dueAt';
5
+ declare const invoiceDateToDisplay: (invoice: Invoice, dateType: InvoiceDateType) => string;
6
+ declare const InvoiceDownload: ({ invoiceId, token, apiHost, }: {
7
+ invoiceId: string;
8
+ token: string | undefined;
9
+ apiHost: string;
10
+ }) => import("react").JSX.Element;
11
+ /**
12
+ * Builds the `Column<Invoice>[]` config passed to `<InfiniteTable />` from the
13
+ * caller-facing `columns` prop of `<Invoices />`.
14
+ */
15
+ export declare function getInvoiceColumns({ columns, invoiceDateType, token, apiHost, }: {
16
+ columns: InvoiceColumnKey[];
17
+ invoiceDateType: InvoiceDateType;
18
+ token: string | undefined;
19
+ apiHost: string;
20
+ }): Column<Invoice>[];
21
+ export { InvoiceDownload, invoiceDateToDisplay };
22
+ export default getInvoiceColumns;
@@ -0,0 +1,20 @@
1
+ import { Quote } from '@/types/Quote';
2
+ import { TableBehaviorOptions, TableDisplayOptions } from '../InfiniteTable';
3
+ import { QuoteColumnKey } from './quotesList/getQuoteColumns';
4
+ export type QuotesDisplayOptions = TableDisplayOptions<QuoteColumnKey>;
5
+ export type QuotesBehaviorOptions = TableBehaviorOptions;
6
+ declare function Quotes({ renderQuote, onQuoteClick, filter, sort, displayOptions, behaviorOptions, }: {
7
+ /** Render a custom quote component. Receives the quote as a parameter. */
8
+ renderQuote?: (quote: Quote) => React.ReactNode;
9
+ /** A function to call when a quote is clicked */
10
+ onQuoteClick?: (quote: Quote) => void;
11
+ /** Filter expression applied server-side, e.g. `"quote.amount is 100"`.
12
+ * Docs: https://docs.bunny.com/developer/getting-started/using-filters-in-queries
13
+ */
14
+ filter?: string;
15
+ /** Sort clause applied server-side, e.g. `"createdAt DESC"` or `"amount ASC"`. */
16
+ sort?: string;
17
+ displayOptions?: QuotesDisplayOptions;
18
+ behaviorOptions?: QuotesBehaviorOptions;
19
+ }): import("react").JSX.Element;
20
+ export default Quotes;
@@ -0,0 +1,9 @@
1
+ import { Quote } from '@/types/Quote';
2
+ import { QuoteColumnKey } from './getQuoteColumns';
3
+ declare const QuoteMobileRow: ({ quote, columns, token, apiHost, }: {
4
+ quote: Quote;
5
+ columns: QuoteColumnKey[];
6
+ token: string | undefined;
7
+ apiHost: string;
8
+ }) => import("react").JSX.Element;
9
+ export default QuoteMobileRow;
@@ -0,0 +1,22 @@
1
+ import { Quote, QuoteState } from '@/types/Quote';
2
+ import { Column } from '../../InfiniteTable';
3
+ export type QuoteColumnKey = 'date' | 'title' | 'state' | 'amount' | 'download' | 'accountName';
4
+ declare const QuoteStateTag: ({ state }: {
5
+ state: QuoteState;
6
+ }) => import("react").JSX.Element;
7
+ declare const QuoteDownload: ({ quoteId, token, apiHost, }: {
8
+ quoteId: string;
9
+ token: string | undefined;
10
+ apiHost: string;
11
+ }) => import("react").JSX.Element;
12
+ /**
13
+ * Builds the `Column<Quote>[]` config passed to `<InfiniteTable />` from the
14
+ * caller-facing `columns` prop of `<Quotes />`.
15
+ */
16
+ export declare function getQuoteColumns({ columns, token, apiHost, }: {
17
+ columns: QuoteColumnKey[];
18
+ token: string | undefined;
19
+ apiHost: string;
20
+ }): Column<Quote>[];
21
+ export { QuoteStateTag, QuoteDownload };
22
+ export default getQuoteColumns;
@@ -0,0 +1,26 @@
1
+ import React from 'react';
2
+ import { Transaction } from '@/types/Transaction';
3
+ import { TransactionDateType } from './types';
4
+ import { TableBehaviorOptions, TableDisplayOptions } from '../InfiniteTable';
5
+ import { TransactionListColumnType } from './transactionsList/getTransactionColumns';
6
+ export type TransactionsDisplayOptions = TableDisplayOptions<TransactionListColumnType>;
7
+ export type TransactionsBehaviorOptions = TableBehaviorOptions & {
8
+ /** The type of date to display for transactions if applicable. Payments will always only show createdAt date. */
9
+ transactionDateType?: TransactionDateType;
10
+ /** Whether to hide the payment form on invoices */
11
+ hidePaymentForm?: boolean;
12
+ };
13
+ export default function Transactions({ transactionComponent, onTransactionClick, filter, sort, displayOptions, behaviorOptions, }: {
14
+ /** A custom component to render instead of the default invoice component */
15
+ transactionComponent?: React.ReactNode;
16
+ /** A function to call when a transaction is clicked */
17
+ onTransactionClick?: (transaction: Transaction) => void;
18
+ /** Filter expression applied server-side, e.g. `"transaction.amount is 100"`.
19
+ * Docs: https://docs.bunny.com/developer/getting-started/using-filters-in-queries
20
+ */
21
+ filter?: string;
22
+ /** Sort clause applied server-side, e.g. `"createdAt DESC"` or `"amount ASC"`. */
23
+ sort?: string;
24
+ displayOptions?: TransactionsDisplayOptions;
25
+ behaviorOptions?: TransactionsBehaviorOptions;
26
+ }): React.JSX.Element;
@@ -3,9 +3,6 @@ import Transactions from "./Transactions";
3
3
  declare const meta: Meta<typeof Transactions>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof meta>;
6
- export declare const basicArgs: {
7
- token: string;
8
- };
9
6
  export declare const Default: Story;
10
7
  export declare const Padding0BGRed: Story;
11
8
  export declare const NoShadow: Story;
@@ -0,0 +1,7 @@
1
+ import { Transaction } from '@/types/Transaction';
2
+ type Props = {
3
+ transaction: Transaction;
4
+ hidePaymentForm?: boolean;
5
+ };
6
+ export default function TransactionDetail({ transaction, hidePaymentForm }: Props): import("react").JSX.Element;
7
+ export {};
@@ -0,0 +1,11 @@
1
+ import { Transaction } from '@/types/Transaction';
2
+ import { TransactionDateType } from '../types';
3
+ import { TransactionListColumnType } from './getTransactionColumns';
4
+ declare const TransactionMobileRow: ({ transaction, columns, transactionDateType, token, apiHost, }: {
5
+ transaction: Transaction;
6
+ columns: TransactionListColumnType[];
7
+ transactionDateType: TransactionDateType;
8
+ token: string | undefined;
9
+ apiHost: string;
10
+ }) => import("react").JSX.Element;
11
+ export default TransactionMobileRow;
@@ -0,0 +1,16 @@
1
+ import { Transaction } from '@/types/Transaction';
2
+ import { TransactionDateType } from '../types';
3
+ import { Column } from '../../InfiniteTable';
4
+ export type TransactionListColumnType = 'date' | 'title' | 'state' | 'amount' | 'download' | 'accountName';
5
+ /**
6
+ * Builds the `Column<Transaction>[]` config passed to `<InfiniteTable />`
7
+ * from the caller-facing `columns` prop of `<Transactions />`. Preserves
8
+ * the desktop column order used by the previous implementation.
9
+ */
10
+ export declare function getTransactionColumns({ columns, transactionDateType, token, apiHost, }: {
11
+ columns: TransactionListColumnType[];
12
+ transactionDateType: TransactionDateType;
13
+ token: string | undefined;
14
+ apiHost: string;
15
+ }): Column<Transaction>[];
16
+ export default getTransactionColumns;
@@ -1,3 +1,3 @@
1
1
  import { Transaction } from '@/types/Transaction';
2
- import { TransactionDateType } from '../../../contexts/TransactionsListContext';
2
+ import { TransactionDateType } from '../types';
3
3
  export declare function transactionDateToDisplay(transaction: Transaction, transactionDateType: TransactionDateType): string;
@@ -0,0 +1 @@
1
+ export type TransactionDateType = 'createdAt' | 'issuedAt' | 'dueAt';
@@ -0,0 +1,11 @@
1
+ import Invoice from '@/types/Invoice';
2
+ import { CursorPage } from './paginatedQuery';
3
+ declare const getInvoices: (args: {
4
+ apiHost: string;
5
+ token?: string;
6
+ filter?: string;
7
+ sort?: string;
8
+ first: number;
9
+ after?: string;
10
+ }) => Promise<CursorPage<Invoice>>;
11
+ export default getInvoices;
@@ -1,6 +1,11 @@
1
- declare const getQuotes: ({ token, apiHost, filter, }: {
2
- token?: string;
1
+ import { Quote } from '@/types/Quote';
2
+ import { CursorPage } from './paginatedQuery';
3
+ declare const getQuotes: (args: {
3
4
  apiHost: string;
5
+ token?: string;
4
6
  filter?: string;
5
- }) => Promise<any>;
7
+ sort?: string;
8
+ first: number;
9
+ after?: string;
10
+ }) => Promise<CursorPage<Quote>>;
6
11
  export default getQuotes;
@@ -1,3 +1,11 @@
1
1
  import { Transaction } from '@/types/Transaction';
2
- declare const getTransactions: (filter: string, apiHost: string, token?: string) => Promise<Transaction[]>;
2
+ import { CursorPage } from './paginatedQuery';
3
+ declare const getTransactions: (args: {
4
+ apiHost: string;
5
+ token?: string;
6
+ filter?: string;
7
+ sort?: string;
8
+ first: number;
9
+ after?: string;
10
+ }) => Promise<CursorPage<Transaction>>;
3
11
  export default getTransactions;
@@ -0,0 +1,22 @@
1
+ export type CursorPage<T> = {
2
+ pageInfo: {
3
+ endCursor?: string | null;
4
+ hasNextPage: boolean;
5
+ };
6
+ totalCount?: number;
7
+ nodes: T[];
8
+ };
9
+ type PaginatedQueryArgs = {
10
+ /** GraphQL root field name, e.g. `invoices`. */
11
+ resource: string;
12
+ /** GraphQL selection set for a single node, without the surrounding braces. */
13
+ nodeSelection: string;
14
+ apiHost: string;
15
+ token?: string;
16
+ filter?: string;
17
+ sort?: string;
18
+ first: number;
19
+ after?: string;
20
+ };
21
+ declare const paginatedQuery: <T>({ resource, nodeSelection, apiHost, token, filter, sort, first, after, }: PaginatedQueryArgs) => Promise<CursorPage<T>>;
22
+ export default paginatedQuery;
@@ -66,8 +66,19 @@ interface TaxationRequiredAccountFieldsKeyParams {
66
66
  entityId?: string;
67
67
  token?: string;
68
68
  }
69
+ interface InvoicesKeyParams {
70
+ filter?: string;
71
+ sort?: string;
72
+ token?: string;
73
+ }
74
+ interface QuotesKeyParams {
75
+ filter?: string;
76
+ sort?: string;
77
+ token?: string;
78
+ }
69
79
  interface TransactionsKeyParams {
70
80
  filter?: string;
81
+ sort?: string;
71
82
  token?: string;
72
83
  }
73
84
  declare const QueryKeyFactory: {
@@ -78,7 +89,8 @@ declare const QueryKeyFactory: {
78
89
  brandingKey: (token?: string) => string[];
79
90
  calculatedPricesKey: ({ priceListId, quantity, token }: CalculatedPricesKeyParams) => (string | number)[];
80
91
  createEventsKey: ({ entityId, pluralType, token }: EventsKeyParams) => string[];
81
- quotesKey: (filter?: string, token?: string) => string[];
92
+ quotesKey: ({ filter, sort, token }?: QuotesKeyParams) => string[];
93
+ invoicesKey: ({ filter, sort, token }?: InvoicesKeyParams) => string[];
82
94
  createFormattedInvoiceKey: ({ id, token }: FormattedInvoiceKeyParams) => (string | null | undefined)[];
83
95
  createInvoiceKey: ({ id, token }: InvoiceKeyParams) => (string | undefined)[];
84
96
  createObjectKey: ({ id, objectName, token }: ObjectKeyParams) => string[];
@@ -96,7 +108,7 @@ declare const QueryKeyFactory: {
96
108
  pluginsKey: (token?: string) => string[];
97
109
  portalPreviewDataKey: ({ productId, token }: PortalPreviewDataKeyParams) => string[];
98
110
  taxationRequiredAccountFieldsKey: ({ entityId, token, }: TaxationRequiredAccountFieldsKeyParams) => string[];
99
- transactionsKey: ({ filter, token }: TransactionsKeyParams) => string[];
111
+ transactionsKey: ({ filter, sort, token }: TransactionsKeyParams) => string[];
100
112
  availableAddonPlansKey: ({ priceListId, token, }: {
101
113
  priceListId: string | undefined;
102
114
  token?: string;