Skip to content

Commit

Permalink
STTYPES-15 Provide TS definitions for claiming feature in the stripes…
Browse files Browse the repository at this point in the history
…-acq-components lib
  • Loading branch information
usavkov-epam committed Dec 17, 2024
1 parent 5b24b65 commit 235eaef
Show file tree
Hide file tree
Showing 19 changed files with 80 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
export const useRecordsSelect: any;
interface useRecordsSelectReturn<T> {
allRecordsSelected: boolean;
selectedRecordsMap: Record<string, T>;
selectedRecordsLength: number;
toggleSelectAll: () => void;
selectRecord: (record: T) => void;
isRecordSelected: ({ item: T });
}

export declare function useRecordsSelect<T = unknown & { id: string }>({ records }: { records: T[] }): useRecordsSelectReturn<T>;
1 change: 1 addition & 0 deletions acq-components/lib/FindRecords/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from './FindRecords';
export { useRecordsSelect } from './hooks';
1 change: 1 addition & 0 deletions acq-components/lib/claiming/components/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './menu-items';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface DelayClaimActionMenuItemProps {
disabled?: boolean;
onClick: (e?: Event) => void;
}

export declare function DelayClaimActionMenuItem(props: DelayClaimActionMenuItemProps): any;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DelayClaimActionMenuItem } from './DelayClaimActionMenuItem';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface MarkUnreceivableActionMenuItemProps {
disabled?: boolean;
onClick: (e?: Event) => void;
}

export declare function MarkUnreceivableActionMenuItem(props: MarkUnreceivableActionMenuItemProps): any;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { MarkUnreceivableActionMenuItem } from './MarkUnreceivableActionMenuItem';
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
interface SendClaimActionMenuItemProps {
disabled?: boolean;
onClick: (e?: Event) => void;
}

export declare function SendClaimActionMenuItem(props: SendClaimActionMenuItemProps): any;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SendClaimActionMenuItem } from './SendClaimActionMenuItem';
3 changes: 3 additions & 0 deletions acq-components/lib/claiming/components/menu-items/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export { DelayClaimActionMenuItem } from './DelayClaimActionMenuItem';
export { MarkUnreceivableActionMenuItem } from './MarkUnreceivableActionMenuItem';
export { SendClaimActionMenuItem } from './SendClaimActionMenuItem';
1 change: 1 addition & 0 deletions acq-components/lib/claiming/hooks/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useClaimsSend } from './useClaimsSend';
1 change: 1 addition & 0 deletions acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useClaimsSend } from './useClaimsSend';
25 changes: 25 additions & 0 deletions acq-components/lib/claiming/hooks/useClaimsSend/useClaimsSend.d.ts
Original file line number Diff line number Diff line change
@@ -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<SendClaimsResponse>;
}

export declare function useClaimsSend(): useClaimsSendReturn;
2 changes: 2 additions & 0 deletions acq-components/lib/claiming/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './components';
export * from './hooks';
1 change: 1 addition & 0 deletions acq-components/lib/hooks/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { usePiecesStatusBatchUpdate } from './usePiecesStatusBatchUpdate';

Check failure on line 1 in acq-components/lib/hooks/usePiecesStatusBatchUpdate/index.d.ts

View workflow job for this annotation

GitHub Actions / ui / Run Jest tests / Run Jest tests

Cannot find module './usePiecesStatusBatchUpdate' or its corresponding type declarations.
11 changes: 10 additions & 1 deletion acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
export const useShowCallout: any;
import { CalloutContextType } from '../../../../core';

type ShowCalloutFnArgs = Omit<Parameters<CalloutContextType['sendCallout']>[0], 'message'> & {
message?: string,
messageId?: string,
};

type ShowCalloutFn = (args: ShowCalloutFnArgs) => void;

export declare function useShowCallout(): ShowCalloutFn;
1 change: 1 addition & 0 deletions acq-components/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

0 comments on commit 235eaef

Please sign in to comment.