diff --git a/CHANGELOG.md b/CHANGELOG.md index d00aae2..c0c81d8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,8 @@ ## 2.3.0 in progress -[[STTYPES-13](https://folio-org.atlassian.net/browse/STTYPES-13)] Add actual types for `acq-components`, `components`, `core` and `smart-components`. +[STTYPES-13](https://folio-org.atlassian.net/browse/STTYPES-13) Add actual types for `acq-components`, `components`, `core` and `smart-components`. +[STTYPES-15](https://folio-org.atlassian.net/browse/STTYPES-15) Provide TS definitions for claiming feature in the `stripes-acq-components` library. ## [2.2.0](https://github.com/folio-org/stripes-types/tree/v2.2.0) (2024-10-11) diff --git a/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts b/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts index c2cb70c..ebe6c12 100644 --- a/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts +++ b/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts @@ -1 +1,10 @@ -export const useRecordsSelect: any; +interface useRecordsSelectReturn { + allRecordsSelected: boolean; + selectedRecordsMap: Record; + selectedRecordsLength: number; + toggleSelectAll: () => void; + selectRecord: (record: T) => void; + isRecordSelected: ({ item: T }); +} + +export declare function useRecordsSelect({ records }: { records: T[] }): useRecordsSelectReturn; diff --git a/acq-components/lib/FindRecords/index.d.ts b/acq-components/lib/FindRecords/index.d.ts index 4fb1a2d..57e12b8 100644 --- a/acq-components/lib/FindRecords/index.d.ts +++ b/acq-components/lib/FindRecords/index.d.ts @@ -1 +1,2 @@ export * from './FindRecords'; +export { useRecordsSelect } from './hooks'; diff --git a/acq-components/lib/claiming/components/index.d.ts b/acq-components/lib/claiming/components/index.d.ts new file mode 100644 index 0000000..7c64335 --- /dev/null +++ b/acq-components/lib/claiming/components/index.d.ts @@ -0,0 +1 @@ +export * from './menu-items'; diff --git a/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/DelayClaimActionMenuItem.d.ts b/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/DelayClaimActionMenuItem.d.ts new file mode 100644 index 0000000..8f5ee50 --- /dev/null +++ b/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/DelayClaimActionMenuItem.d.ts @@ -0,0 +1,6 @@ +interface DelayClaimActionMenuItemProps { + disabled?: boolean; + onClick: (e?: Event) => void; +} + +export declare function DelayClaimActionMenuItem(props: DelayClaimActionMenuItemProps): any; diff --git a/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/index.d.ts b/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/index.d.ts new file mode 100644 index 0000000..283eb6a --- /dev/null +++ b/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/index.d.ts @@ -0,0 +1 @@ +export { DelayClaimActionMenuItem } from './DelayClaimActionMenuItem'; diff --git a/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/MarkUnreceivableActionMenuItem.d.ts b/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/MarkUnreceivableActionMenuItem.d.ts new file mode 100644 index 0000000..e5dda01 --- /dev/null +++ b/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/MarkUnreceivableActionMenuItem.d.ts @@ -0,0 +1,6 @@ +interface MarkUnreceivableActionMenuItemProps { + disabled?: boolean; + onClick: (e?: Event) => void; +} + +export declare function MarkUnreceivableActionMenuItem(props: MarkUnreceivableActionMenuItemProps): any; diff --git a/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/index.d.ts b/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/index.d.ts new file mode 100644 index 0000000..3951ec2 --- /dev/null +++ b/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/index.d.ts @@ -0,0 +1 @@ +export { MarkUnreceivableActionMenuItem } from './MarkUnreceivableActionMenuItem'; diff --git a/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/SendClaimActionMenuItem.d.ts b/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/SendClaimActionMenuItem.d.ts new file mode 100644 index 0000000..7a32718 --- /dev/null +++ b/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/SendClaimActionMenuItem.d.ts @@ -0,0 +1,6 @@ +interface SendClaimActionMenuItemProps { + disabled?: boolean; + onClick: (e?: Event) => void; +} + +export declare function SendClaimActionMenuItem(props: SendClaimActionMenuItemProps): any; diff --git a/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/index.d.ts b/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/index.d.ts new file mode 100644 index 0000000..fefefcb --- /dev/null +++ b/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/index.d.ts @@ -0,0 +1 @@ +export { SendClaimActionMenuItem } from './SendClaimActionMenuItem'; diff --git a/acq-components/lib/claiming/components/menu-items/index.d.ts b/acq-components/lib/claiming/components/menu-items/index.d.ts new file mode 100644 index 0000000..5705724 --- /dev/null +++ b/acq-components/lib/claiming/components/menu-items/index.d.ts @@ -0,0 +1,3 @@ +export { DelayClaimActionMenuItem } from './DelayClaimActionMenuItem'; +export { MarkUnreceivableActionMenuItem } from './MarkUnreceivableActionMenuItem'; +export { SendClaimActionMenuItem } from './SendClaimActionMenuItem'; diff --git a/acq-components/lib/claiming/hooks/index.d.ts b/acq-components/lib/claiming/hooks/index.d.ts new file mode 100644 index 0000000..d9d4766 --- /dev/null +++ b/acq-components/lib/claiming/hooks/index.d.ts @@ -0,0 +1 @@ +export { useClaimsSend } from './useClaimsSend'; diff --git a/acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts b/acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts new file mode 100644 index 0000000..d9d4766 --- /dev/null +++ b/acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts @@ -0,0 +1 @@ +export { useClaimsSend } from './useClaimsSend'; diff --git a/acq-components/lib/claiming/hooks/useClaimsSend/useClaimsSend.d.ts b/acq-components/lib/claiming/hooks/useClaimsSend/useClaimsSend.d.ts new file mode 100644 index 0000000..f42f4bd --- /dev/null +++ b/acq-components/lib/claiming/hooks/useClaimsSend/useClaimsSend.d.ts @@ -0,0 +1,25 @@ +interface SendClaimsData { + claimingPieceIds: string[]; +} + +export interface ClaimingResult { + pieceId: string; + type: 'success' | 'failure'; + error?: { + code?: string; + message: string; + type?: string; + }; +} + +export interface SendClaimsResponse { + claimingPieceResults: ClaimingResult[]; + totalRecords: number; +} + +interface useClaimsSendReturn { + isLoading: boolean; + sendClaims: ({ data }: { data: SendClaimsData }) => Promise; +} + +export declare function useClaimsSend(): useClaimsSendReturn; diff --git a/acq-components/lib/claiming/index.d.ts b/acq-components/lib/claiming/index.d.ts new file mode 100644 index 0000000..f76fd6f --- /dev/null +++ b/acq-components/lib/claiming/index.d.ts @@ -0,0 +1,2 @@ +export * from './components'; +export * from './hooks'; diff --git a/acq-components/lib/hooks/index.d.ts b/acq-components/lib/hooks/index.d.ts index e0eb648..3cf7022 100644 --- a/acq-components/lib/hooks/index.d.ts +++ b/acq-components/lib/hooks/index.d.ts @@ -15,6 +15,7 @@ export * from './useLocations'; export * from './useModalToggle'; export * from './useOrganization'; export * from './usePaneFocus'; +export * from './usePiecesStatusBatchUpdate'; export * from './useShowCallout'; export * from './useToggle'; export * from './useTranslatedCategories'; diff --git a/acq-components/lib/hooks/usePiecesStatusBatchUpdate/index.d.ts b/acq-components/lib/hooks/usePiecesStatusBatchUpdate/index.d.ts new file mode 100644 index 0000000..47b5c69 --- /dev/null +++ b/acq-components/lib/hooks/usePiecesStatusBatchUpdate/index.d.ts @@ -0,0 +1 @@ +export { usePiecesStatusBatchUpdate } from './usePiecesStatusBatchUpdate'; diff --git a/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts b/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts index 6df7ce6..b9207d1 100644 --- a/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts +++ b/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts @@ -1 +1,10 @@ -export const useShowCallout: any; +import { CalloutContextType } from '../../../../core'; + +type ShowCalloutFnArgs = Omit[0], 'message'> & { + message?: string, + messageId?: string, +}; + +type ShowCalloutFn = (args: ShowCalloutFnArgs) => void; + +export declare function useShowCallout(): ShowCalloutFn; diff --git a/acq-components/lib/index.d.ts b/acq-components/lib/index.d.ts index e6967ab..c2e5905 100644 --- a/acq-components/lib/index.d.ts +++ b/acq-components/lib/index.d.ts @@ -9,6 +9,7 @@ export * from './AcqUnits'; export * from './AmountWithCurrencyField'; export * from './apiHooks'; export * from './BooleanFilter'; +export * from './claiming'; export * from './constants'; export * from './ContributorDetails'; export * from './CountryFilter';