Skip to content

Commit

Permalink
Merge branch 'master' into STTYPES-16
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnC-80 authored Dec 20, 2024
2 parents 2cf1316 + 49a5ddc commit 1bb661a
Show file tree
Hide file tree
Showing 33 changed files with 186 additions and 5 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 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-15](https://folio-org.atlassian.net/browse/STTYPES-15)] Provide TS definitions for claiming feature in the `stripes-acq-components` library.
* [[STTYPES-16](https://folio-org.atlassian.net/browse/STTYPES-16)] Add `pagingOffset` prop to `<MultiColumnList>` paging props.

## [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,19 @@
export const useRecordsSelect: any;
interface useRecordsSelectReturn<T> {
allRecordsSelected: boolean;
isRecordSelected: ({ item: T });
resetAllSelectedRecords: () => void;
/*
* Clear selected records with provided ids.
*/
resetSelectedRecordsByIds: (ids: string[]) => void;
/*
* Clear selected records except the ones with provided ids.
*/
resetOtherSelectedRecordsByIds: (ids: string[]) => void;
selectedRecordsLength: number;
selectedRecordsMap: Record<string, T>;
selectRecord: (record: T) => void;
toggleSelectAll: () => void;
}

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';
2 changes: 2 additions & 0 deletions acq-components/lib/claiming/components/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './menu-items';
export * from './modals';
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): React.JSX.Element;
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): React.JSX.Element;
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): React.JSX.Element;
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';
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import {
FormProps,
FormRenderProps,
} from 'react-final-form';


interface DelayClaimsModalOwnProps {
claimsCount: number;
disabled: boolean;
message?: React.JSX.Element,
onCancel: () => void;
open: boolean;
}

type DelayClaimsModalProps<FormValues = Record<string, unknown>> =
DelayClaimsModalOwnProps &
Pick<FormProps<FormValues>, 'onSubmit'> &
Partial<FormRenderProps<FormValues>>;

export declare const DelayClaimsModal: <FormValues = Record<string, unknown>>(props: DelayClaimsModalProps<FormValues>) => React.JSX.Element;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DelayClaimsModal } from './DelayClaimsModal';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import {
FormProps,
FormRenderProps,
} from 'react-final-form';

interface SendClaimsModalOwnProps {
claimsCount: number;
disabled: boolean;
message?: React.JSX.Element,
onCancel: () => void;
open: boolean;
}

type SendClaimsModalProps<FormValues = Record<string, unknown>> =
SendClaimsModalOwnProps &
Pick<FormProps<FormValues>, 'onSubmit'> &
Partial<FormRenderProps<FormValues>>;

export declare const SendClaimsModal: <FormValues = Record<string, unknown>>(props: SendClaimsModalProps<FormValues>) => React.JSX.Element;
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { SendClaimsModal } from './SendClaimsModal';
2 changes: 2 additions & 0 deletions acq-components/lib/claiming/components/modals/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { DelayClaimsModal } from './DelayClaimsModal';
export { SendClaimsModal } from './SendClaimsModal';
2 changes: 2 additions & 0 deletions acq-components/lib/claiming/hooks/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { useClaimsDelay } from './useClaimsDelay';
export { ClaimingPieceResult, useClaimsSend } from './useClaimsSend';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useClaimsDelay } from './useClaimsDelay';
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { usePiecesStatusBatchUpdate } from '../../../hooks';

interface useClaimsDelayReturn {
isLoading: boolean;
delayClaims: ({
claimingInterval,
pieceIds,
}: {
claimingInterval: number,
pieceIds: string[],
}) => Promise<ReturnType<typeof usePiecesStatusBatchUpdate>>;
}

export declare function useClaimsDelay(): useClaimsDelayReturn;
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 { ClaimingPieceResult, useClaimsSend } from './useClaimsSend';
28 changes: 28 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,28 @@
interface SendClaimsData {
claimingPieceIds: string[];
claimingInterval: number;
internalNote?: string;
externalNote?: string;
}

export interface ClaimingPieceResult {
pieceId: string;
type: 'success' | 'failure';
error?: {
code?: string;
message: string;
type?: string;
};
}

export interface SendClaimsResponse {
claimingPieceResults: ClaimingPieceResult[];
totalRecords: number;
}

interface useClaimsSendReturn {
isLoading: boolean;
sendClaims: ({ data }: { data: SendClaimsData }) => Promise<SendClaimsResponse>;
}

export declare function useClaimsSend(): useClaimsSendReturn;
3 changes: 3 additions & 0 deletions acq-components/lib/claiming/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export * from './components';
export * from './hooks';
export * from './utils';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import dayjs from 'dayjs';

export declare function getClaimingIntervalFromDate(date: dayjs.ConfigType): number;
1 change: 1 addition & 0 deletions acq-components/lib/claiming/utils/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { getClaimingIntervalFromDate } from './getClaimingIntervalFromDate';
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';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
export interface UpdatePiecesStatusData {
pieceIds: string[],
receivingStatus: ACQ.Piece.ReceivingStatus,
claimingInterval?: number,
}

interface UpdatePiecesStatusErrorResponse {
errors: Array<{
message: string;
code?: string;
}>
}

export type UpdatePiecesStatusResponse = null | UpdatePiecesStatusErrorResponse;

interface usePiecesStatusBatchUpdateReturn {
isLoading: boolean;
updatePiecesStatus: ({ data }: { data: UpdatePiecesStatusData }) => Promise<UpdatePiecesStatusResponse>;
}

export declare function usePiecesStatusBatchUpdate(): usePiecesStatusBatchUpdateReturn;
12 changes: 11 additions & 1 deletion acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,11 @@
export const useShowCallout: any;
import { CalloutContextType } from '../../../../core';

type ShowCalloutFnArgs = Omit<Parameters<CalloutContextType['sendCallout']>[0], 'message'> & {
message?: string | React.ReactNode,
messageId?: string,
values?: Record<string, 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
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export interface ResponseErrorsContainerBody {
}

export interface ErrorHandlingStrategy {
handle(errors: ResponseErrorsContainer): void;
handle(errors: ResponseErrorsContainer): void | Promise<void>;
}

/**
Expand Down
5 changes: 4 additions & 1 deletion acq-components/lib/utils/errorHandling/index.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
export { ResponseErrorsContainer } from './ResponseErrorsContainer';
export {
ErrorHandlingStrategy,
ResponseErrorsContainer,
} from './ResponseErrorsContainer';
2 changes: 1 addition & 1 deletion final-form/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// targeted to stripes-final-form v7.0.0
export { default } from './lib/stripesFinalForm';
export { default, FormProps, FormRenderProps } from './lib/stripesFinalForm';
2 changes: 2 additions & 0 deletions final-form/lib/stripesFinalForm.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,5 @@ export default function stripesFinalForm<
): (
Component: ComponentType<FormRenderProps<FormValues> & ComponentProps>
) => ComponentType<ComponentProps & Pick<FormProps<FormValues>, extractedProps>>;

export type { FormProps, FormRenderProps } from 'react-final-form';

0 comments on commit 1bb661a

Please sign in to comment.