From 235eaefb7ad79d654bfaed0df2560d4172e8b47d Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Tue, 17 Dec 2024 11:31:27 +0400 Subject: [PATCH 1/6] STTYPES-15 Provide TS definitions for claiming feature in the stripes-acq-components lib --- CHANGELOG.md | 3 ++- .../useRecordsSelect/useRecordsSelect.d.ts | 11 +++++++- acq-components/lib/FindRecords/index.d.ts | 1 + .../lib/claiming/components/index.d.ts | 1 + .../DelayClaimActionMenuItem.d.ts | 6 +++++ .../DelayClaimActionMenuItem/index.d.ts | 1 + .../MarkUnreceivableActionMenuItem.d.ts | 6 +++++ .../MarkUnreceivableActionMenuItem/index.d.ts | 1 + .../SendClaimActionMenuItem.d.ts | 6 +++++ .../SendClaimActionMenuItem/index.d.ts | 1 + .../claiming/components/menu-items/index.d.ts | 3 +++ acq-components/lib/claiming/hooks/index.d.ts | 1 + .../claiming/hooks/useClaimsSend/index.d.ts | 1 + .../hooks/useClaimsSend/useClaimsSend.d.ts | 25 +++++++++++++++++++ acq-components/lib/claiming/index.d.ts | 2 ++ acq-components/lib/hooks/index.d.ts | 1 + .../usePiecesStatusBatchUpdate/index.d.ts | 1 + .../hooks/useShowCallout/useShowCallout.d.ts | 11 +++++++- acq-components/lib/index.d.ts | 1 + 19 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 acq-components/lib/claiming/components/index.d.ts create mode 100644 acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/DelayClaimActionMenuItem.d.ts create mode 100644 acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/index.d.ts create mode 100644 acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/MarkUnreceivableActionMenuItem.d.ts create mode 100644 acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/index.d.ts create mode 100644 acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/SendClaimActionMenuItem.d.ts create mode 100644 acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/index.d.ts create mode 100644 acq-components/lib/claiming/components/menu-items/index.d.ts create mode 100644 acq-components/lib/claiming/hooks/index.d.ts create mode 100644 acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts create mode 100644 acq-components/lib/claiming/hooks/useClaimsSend/useClaimsSend.d.ts create mode 100644 acq-components/lib/claiming/index.d.ts create mode 100644 acq-components/lib/hooks/usePiecesStatusBatchUpdate/index.d.ts 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'; From 1a79e2b526fa60a02c63e831d92bb1d015f2aef7 Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Wed, 18 Dec 2024 11:34:11 +0400 Subject: [PATCH 2/6] modals and selection typings --- .../useRecordsSelect/useRecordsSelect.d.ts | 7 ++++--- .../lib/claiming/components/index.d.ts | 1 + .../DelayClaimsModal/DelayClaimsModal.d.ts | 20 ++++++++++++++++++ .../modals/DelayClaimsModal/index.d.ts | 1 + .../SendClaimsModal/SendClaimsModal.d.ts | 19 +++++++++++++++++ .../modals/SendClaimsModal/index.d.ts | 1 + .../lib/claiming/components/modals/index.d.ts | 2 ++ acq-components/lib/claiming/hooks/index.d.ts | 3 ++- .../claiming/hooks/useClaimsDelay/index.d.ts | 1 + .../hooks/useClaimsDelay/useClaimsDelay.d.ts | 14 +++++++++++++ .../claiming/hooks/useClaimsSend/index.d.ts | 2 +- .../hooks/useClaimsSend/useClaimsSend.d.ts | 7 +++++-- acq-components/lib/claiming/index.d.ts | 1 + .../utils/getClaimingIntervalFromDate.d.ts | 3 +++ acq-components/lib/claiming/utils/index.d.ts | 1 + .../usePiecesStatusBatchUpdate.d.ts | 21 +++++++++++++++++++ final-form/index.d.ts | 2 +- final-form/lib/stripesFinalForm.d.ts | 2 ++ 18 files changed, 100 insertions(+), 8 deletions(-) create mode 100644 acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts create mode 100644 acq-components/lib/claiming/components/modals/DelayClaimsModal/index.d.ts create mode 100644 acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts create mode 100644 acq-components/lib/claiming/components/modals/SendClaimsModal/index.d.ts create mode 100644 acq-components/lib/claiming/components/modals/index.d.ts create mode 100644 acq-components/lib/claiming/hooks/useClaimsDelay/index.d.ts create mode 100644 acq-components/lib/claiming/hooks/useClaimsDelay/useClaimsDelay.d.ts create mode 100644 acq-components/lib/claiming/utils/getClaimingIntervalFromDate.d.ts create mode 100644 acq-components/lib/claiming/utils/index.d.ts create mode 100644 acq-components/lib/hooks/usePiecesStatusBatchUpdate/usePiecesStatusBatchUpdate.d.ts diff --git a/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts b/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts index ebe6c12..01ecfbf 100644 --- a/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts +++ b/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts @@ -1,10 +1,11 @@ interface useRecordsSelectReturn { allRecordsSelected: boolean; - selectedRecordsMap: Record; + isRecordSelected: ({ item: T }); + resetSelectedRecords: () => void; selectedRecordsLength: number; - toggleSelectAll: () => void; + selectedRecordsMap: Record; selectRecord: (record: T) => void; - isRecordSelected: ({ item: T }); + toggleSelectAll: () => void; } export declare function useRecordsSelect({ records }: { records: T[] }): useRecordsSelectReturn; diff --git a/acq-components/lib/claiming/components/index.d.ts b/acq-components/lib/claiming/components/index.d.ts index 7c64335..2393817 100644 --- a/acq-components/lib/claiming/components/index.d.ts +++ b/acq-components/lib/claiming/components/index.d.ts @@ -1 +1,2 @@ export * from './menu-items'; +export * from './modals'; diff --git a/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts b/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts new file mode 100644 index 0000000..f85b14f --- /dev/null +++ b/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts @@ -0,0 +1,20 @@ +import React from 'react'; +import { + FormProps, + FormRenderProps, +} from 'react-final-form'; + + +interface DelayClaimsModalOwnProps { + claimsCount: number; + disabled: boolean; + onCancel: () => void; + open: boolean; +} + +type DelayClaimsModalProps> = + DelayClaimsModalOwnProps & + Pick, 'onSubmit'> & + Partial>; + +export declare const DelayClaimsModal: >(props: DelayClaimsModalProps) => React.JSX.Element; diff --git a/acq-components/lib/claiming/components/modals/DelayClaimsModal/index.d.ts b/acq-components/lib/claiming/components/modals/DelayClaimsModal/index.d.ts new file mode 100644 index 0000000..8eee29a --- /dev/null +++ b/acq-components/lib/claiming/components/modals/DelayClaimsModal/index.d.ts @@ -0,0 +1 @@ +export { DelayClaimsModal } from './DelayClaimsModal'; diff --git a/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts b/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts new file mode 100644 index 0000000..ba1cc3f --- /dev/null +++ b/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts @@ -0,0 +1,19 @@ +import React from 'react'; +import { + FormProps, + FormRenderProps, +} from 'react-final-form'; + +interface SendClaimsModalOwnProps { + claimsCount: number; + disabled: boolean; + onCancel: () => void; + open: boolean; +} + +type SendClaimsModalProps> = + SendClaimsModalOwnProps & + Pick, 'onSubmit'> & + Partial>; + +export declare const SendClaimsModal: >(props: SendClaimsModalProps) => React.JSX.Element; diff --git a/acq-components/lib/claiming/components/modals/SendClaimsModal/index.d.ts b/acq-components/lib/claiming/components/modals/SendClaimsModal/index.d.ts new file mode 100644 index 0000000..75e258b --- /dev/null +++ b/acq-components/lib/claiming/components/modals/SendClaimsModal/index.d.ts @@ -0,0 +1 @@ +export { SendClaimsModal } from './SendClaimsModal'; diff --git a/acq-components/lib/claiming/components/modals/index.d.ts b/acq-components/lib/claiming/components/modals/index.d.ts new file mode 100644 index 0000000..d030454 --- /dev/null +++ b/acq-components/lib/claiming/components/modals/index.d.ts @@ -0,0 +1,2 @@ +export { DelayClaimsModal } from './DelayClaimsModal'; +export { SendClaimsModal } from './SendClaimsModal'; diff --git a/acq-components/lib/claiming/hooks/index.d.ts b/acq-components/lib/claiming/hooks/index.d.ts index d9d4766..7bdca91 100644 --- a/acq-components/lib/claiming/hooks/index.d.ts +++ b/acq-components/lib/claiming/hooks/index.d.ts @@ -1 +1,2 @@ -export { useClaimsSend } from './useClaimsSend'; +export { useClaimsDelay } from './useClaimsDelay'; +export { ClaimingPieceResult, useClaimsSend } from './useClaimsSend'; diff --git a/acq-components/lib/claiming/hooks/useClaimsDelay/index.d.ts b/acq-components/lib/claiming/hooks/useClaimsDelay/index.d.ts new file mode 100644 index 0000000..0be7a56 --- /dev/null +++ b/acq-components/lib/claiming/hooks/useClaimsDelay/index.d.ts @@ -0,0 +1 @@ +export { useClaimsDelay } from './useClaimsDelay'; diff --git a/acq-components/lib/claiming/hooks/useClaimsDelay/useClaimsDelay.d.ts b/acq-components/lib/claiming/hooks/useClaimsDelay/useClaimsDelay.d.ts new file mode 100644 index 0000000..63aea18 --- /dev/null +++ b/acq-components/lib/claiming/hooks/useClaimsDelay/useClaimsDelay.d.ts @@ -0,0 +1,14 @@ +import { usePiecesStatusBatchUpdate } from '../../../hooks'; + +interface useClaimsDelayReturn { + isLoading: boolean; + delayClaims: ({ + claimingInterval, + pieceIds, + }: { + claimingInterval: number, + pieceIds: string[], + }) => Promise>; +} + +export declare function useClaimsDelay(): useClaimsDelayReturn; diff --git a/acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts b/acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts index d9d4766..dfba283 100644 --- a/acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts +++ b/acq-components/lib/claiming/hooks/useClaimsSend/index.d.ts @@ -1 +1 @@ -export { useClaimsSend } from './useClaimsSend'; +export { ClaimingPieceResult, 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 index f42f4bd..e5a2c8e 100644 --- a/acq-components/lib/claiming/hooks/useClaimsSend/useClaimsSend.d.ts +++ b/acq-components/lib/claiming/hooks/useClaimsSend/useClaimsSend.d.ts @@ -1,8 +1,11 @@ interface SendClaimsData { claimingPieceIds: string[]; + claimingInterval: number; + internalNote?: string; + externalNote?: string; } -export interface ClaimingResult { +export interface ClaimingPieceResult { pieceId: string; type: 'success' | 'failure'; error?: { @@ -13,7 +16,7 @@ export interface ClaimingResult { } export interface SendClaimsResponse { - claimingPieceResults: ClaimingResult[]; + claimingPieceResults: ClaimingPieceResult[]; totalRecords: number; } diff --git a/acq-components/lib/claiming/index.d.ts b/acq-components/lib/claiming/index.d.ts index f76fd6f..c55977d 100644 --- a/acq-components/lib/claiming/index.d.ts +++ b/acq-components/lib/claiming/index.d.ts @@ -1,2 +1,3 @@ export * from './components'; export * from './hooks'; +export * from './utils'; diff --git a/acq-components/lib/claiming/utils/getClaimingIntervalFromDate.d.ts b/acq-components/lib/claiming/utils/getClaimingIntervalFromDate.d.ts new file mode 100644 index 0000000..3f8e1fe --- /dev/null +++ b/acq-components/lib/claiming/utils/getClaimingIntervalFromDate.d.ts @@ -0,0 +1,3 @@ +import dayjs from 'dayjs'; + +export declare function getClaimingIntervalFromDate(date: dayjs.ConfigType): number; diff --git a/acq-components/lib/claiming/utils/index.d.ts b/acq-components/lib/claiming/utils/index.d.ts new file mode 100644 index 0000000..6d40c1d --- /dev/null +++ b/acq-components/lib/claiming/utils/index.d.ts @@ -0,0 +1 @@ +export { getClaimingIntervalFromDate } from './getClaimingIntervalFromDate'; diff --git a/acq-components/lib/hooks/usePiecesStatusBatchUpdate/usePiecesStatusBatchUpdate.d.ts b/acq-components/lib/hooks/usePiecesStatusBatchUpdate/usePiecesStatusBatchUpdate.d.ts new file mode 100644 index 0000000..9007895 --- /dev/null +++ b/acq-components/lib/hooks/usePiecesStatusBatchUpdate/usePiecesStatusBatchUpdate.d.ts @@ -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; +} + +export declare function usePiecesStatusBatchUpdate(): usePiecesStatusBatchUpdateReturn; diff --git a/final-form/index.d.ts b/final-form/index.d.ts index 08cae63..3272aa7 100644 --- a/final-form/index.d.ts +++ b/final-form/index.d.ts @@ -1,2 +1,2 @@ // targeted to stripes-final-form v7.0.0 -export { default } from './lib/stripesFinalForm'; +export { default, FormProps, FormRenderProps } from './lib/stripesFinalForm'; diff --git a/final-form/lib/stripesFinalForm.d.ts b/final-form/lib/stripesFinalForm.d.ts index 0b5f435..e610058 100644 --- a/final-form/lib/stripesFinalForm.d.ts +++ b/final-form/lib/stripesFinalForm.d.ts @@ -29,3 +29,5 @@ export default function stripesFinalForm< ): ( Component: ComponentType & ComponentProps> ) => ComponentType, extractedProps>>; + +export type { FormProps, FormRenderProps } from 'react-final-form'; From becee82e655079cf08e43ecf81ae01b88a3e0f17 Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Wed, 18 Dec 2024 11:52:52 +0400 Subject: [PATCH 3/6] add messages for modals props --- .../components/modals/DelayClaimsModal/DelayClaimsModal.d.ts | 1 + .../components/modals/SendClaimsModal/SendClaimsModal.d.ts | 1 + 2 files changed, 2 insertions(+) diff --git a/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts b/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts index f85b14f..2399c64 100644 --- a/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts +++ b/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts @@ -8,6 +8,7 @@ import { interface DelayClaimsModalOwnProps { claimsCount: number; disabled: boolean; + message?: React.JSX.Element, onCancel: () => void; open: boolean; } diff --git a/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts b/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts index ba1cc3f..436471d 100644 --- a/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts +++ b/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts @@ -7,6 +7,7 @@ import { interface SendClaimsModalOwnProps { claimsCount: number; disabled: boolean; + message?: React.JSX.Element, onCancel: () => void; open: boolean; } From 6c6570b4a5aec2138fd1dadf12fd4f16c59550cf Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Wed, 18 Dec 2024 12:23:33 +0400 Subject: [PATCH 4/6] update types --- .../DelayClaimActionMenuItem/DelayClaimActionMenuItem.d.ts | 2 +- .../MarkUnreceivableActionMenuItem.d.ts | 2 +- .../SendClaimActionMenuItem/SendClaimActionMenuItem.d.ts | 2 +- .../components/modals/DelayClaimsModal/DelayClaimsModal.d.ts | 1 - .../components/modals/SendClaimsModal/SendClaimsModal.d.ts | 1 - 5 files changed, 3 insertions(+), 5 deletions(-) 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 index 8f5ee50..51a2b6b 100644 --- a/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/DelayClaimActionMenuItem.d.ts +++ b/acq-components/lib/claiming/components/menu-items/DelayClaimActionMenuItem/DelayClaimActionMenuItem.d.ts @@ -3,4 +3,4 @@ interface DelayClaimActionMenuItemProps { onClick: (e?: Event) => void; } -export declare function DelayClaimActionMenuItem(props: DelayClaimActionMenuItemProps): any; +export declare function DelayClaimActionMenuItem(props: DelayClaimActionMenuItemProps): React.JSX.Element; 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 index e5dda01..02a9e25 100644 --- a/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/MarkUnreceivableActionMenuItem.d.ts +++ b/acq-components/lib/claiming/components/menu-items/MarkUnreceivableActionMenuItem/MarkUnreceivableActionMenuItem.d.ts @@ -3,4 +3,4 @@ interface MarkUnreceivableActionMenuItemProps { onClick: (e?: Event) => void; } -export declare function MarkUnreceivableActionMenuItem(props: MarkUnreceivableActionMenuItemProps): any; +export declare function MarkUnreceivableActionMenuItem(props: MarkUnreceivableActionMenuItemProps): React.JSX.Element; 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 index 7a32718..477ccdf 100644 --- a/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/SendClaimActionMenuItem.d.ts +++ b/acq-components/lib/claiming/components/menu-items/SendClaimActionMenuItem/SendClaimActionMenuItem.d.ts @@ -3,4 +3,4 @@ interface SendClaimActionMenuItemProps { onClick: (e?: Event) => void; } -export declare function SendClaimActionMenuItem(props: SendClaimActionMenuItemProps): any; +export declare function SendClaimActionMenuItem(props: SendClaimActionMenuItemProps): React.JSX.Element; diff --git a/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts b/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts index 2399c64..1ea1c02 100644 --- a/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts +++ b/acq-components/lib/claiming/components/modals/DelayClaimsModal/DelayClaimsModal.d.ts @@ -1,4 +1,3 @@ -import React from 'react'; import { FormProps, FormRenderProps, diff --git a/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts b/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts index 436471d..0094330 100644 --- a/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts +++ b/acq-components/lib/claiming/components/modals/SendClaimsModal/SendClaimsModal.d.ts @@ -1,4 +1,3 @@ -import React from 'react'; import { FormProps, FormRenderProps, From edfe0d48b1e199280db0a1fd46f9d6057cd73eec Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Wed, 18 Dec 2024 19:23:53 +0400 Subject: [PATCH 5/6] update interface --- .../hooks/useRecordsSelect/useRecordsSelect.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts b/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts index 01ecfbf..ea390d1 100644 --- a/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts +++ b/acq-components/lib/FindRecords/hooks/useRecordsSelect/useRecordsSelect.d.ts @@ -1,7 +1,15 @@ interface useRecordsSelectReturn { allRecordsSelected: boolean; isRecordSelected: ({ item: T }); - resetSelectedRecords: () => void; + 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; selectRecord: (record: T) => void; From 3e91a831217e32993869863e26cb985409e5aa70 Mon Sep 17 00:00:00 2001 From: Yury Saukou Date: Fri, 20 Dec 2024 12:35:02 +0400 Subject: [PATCH 6/6] update acq types --- acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts | 3 ++- .../lib/utils/errorHandling/ResponseErrorsContainer.d.ts | 2 +- acq-components/lib/utils/errorHandling/index.d.ts | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts b/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts index b9207d1..94cc24c 100644 --- a/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts +++ b/acq-components/lib/hooks/useShowCallout/useShowCallout.d.ts @@ -1,8 +1,9 @@ import { CalloutContextType } from '../../../../core'; type ShowCalloutFnArgs = Omit[0], 'message'> & { - message?: string, + message?: string | React.ReactNode, messageId?: string, + values?: Record, }; type ShowCalloutFn = (args: ShowCalloutFnArgs) => void; diff --git a/acq-components/lib/utils/errorHandling/ResponseErrorsContainer.d.ts b/acq-components/lib/utils/errorHandling/ResponseErrorsContainer.d.ts index 3c9df18..aca8ec9 100644 --- a/acq-components/lib/utils/errorHandling/ResponseErrorsContainer.d.ts +++ b/acq-components/lib/utils/errorHandling/ResponseErrorsContainer.d.ts @@ -7,7 +7,7 @@ export interface ResponseErrorsContainerBody { } export interface ErrorHandlingStrategy { - handle(errors: ResponseErrorsContainer): void; + handle(errors: ResponseErrorsContainer): void | Promise; } /** diff --git a/acq-components/lib/utils/errorHandling/index.d.ts b/acq-components/lib/utils/errorHandling/index.d.ts index 872c1c8..82b4eb6 100644 --- a/acq-components/lib/utils/errorHandling/index.d.ts +++ b/acq-components/lib/utils/errorHandling/index.d.ts @@ -1 +1,4 @@ -export { ResponseErrorsContainer } from './ResponseErrorsContainer'; +export { + ErrorHandlingStrategy, + ResponseErrorsContainer, +} from './ResponseErrorsContainer';