Skip to content

Commit

Permalink
Add onCreate receivable event to componentSettings
Browse files Browse the repository at this point in the history
  • Loading branch information
marcperezmonite committed Feb 18, 2025
1 parent 1fb5949 commit f2f8d38
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ const ReceivablesBase = () => {
setIsCreateInvoiceDialogOpen(false);
setActiveTab(ReceivablesTableTabEnum.Invoices);
openInvoiceModal(receivableId);
componentSettings?.receivables?.onCreate?.(receivableId);
}}
/>
</Dialog>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ export interface MoniteReceivablesTableProps {
* By default, the component will display tabs for Invoices, Quotes, and Credit Notes.
*/
tabs?: Array<MoniteReceivablesTab>;

/**
* The event handler for the creation of a new invoice
*
@param {string} receivableId - The ID of the receivable that was created.
*/
onCreate?: (receivableId: string) => void;
}

export enum ReceivablesTableTabEnum {
Expand Down
1 change: 1 addition & 0 deletions packages/sdk-react/src/core/componentSettings/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const getDefaultComponentSettings = (
label: FINANCING_LABEL,
},
],
onCreate: componentSettings?.receivables?.onCreate,
},
tags: {
pageSizeOptions:
Expand Down

0 comments on commit f2f8d38

Please sign in to comment.