Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TS migration] Migrate 'IOU.js' lib to TypeScript #34092

Merged
merged 97 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
996ee26
Migrate Onyx.connect methods to TS
VickyStash Dec 28, 2023
b7af44a
Migrate simple functions
VickyStash Dec 28, 2023
519852e
Migrate startMoneyRequest_temporaryForRefactor and resetMoneyRequestI…
VickyStash Dec 28, 2023
e5f8cc3
Migrate buildOnyxDataForMoneyRequest function
VickyStash Dec 28, 2023
98a1e6b
Migrate getMoneyRequestInformation function
VickyStash Dec 28, 2023
19035e5
Fix failing Money request
VickyStash Dec 28, 2023
ad41a60
Migrate createDistanceRequest and requestMoney functions
VickyStash Dec 28, 2023
578cc50
Migrate startSplitBill function
VickyStash Dec 29, 2023
7b55077
Merge branch 'main' into ts-migration/iou
VickyStash Dec 29, 2023
8f0418d
Replace Split type with Participant
VickyStash Dec 29, 2023
417e173
Migrate completeSplitBill function
VickyStash Dec 29, 2023
6c962b3
Merge branch 'main' into ts-migration/iou
VickyStash Jan 2, 2024
ecdd7dd
Migrate getIOUReportID, navigateToNextPage and setMoneyRequestPartici…
VickyStash Jan 2, 2024
016c19e
Migrate approveMoneyRequest, submitReport, detachReceipt, replaceRece…
VickyStash Jan 2, 2024
012cd76
Migrate createSplitsAndOnyxData function
VickyStash Jan 2, 2024
041bde6
Merge branch 'main' into ts-migration/iou
VickyStash Jan 4, 2024
4711e1c
Migrate getReceiptError function; fix type imports after merging main
VickyStash Jan 4, 2024
372785b
Migrate splitBill and splitBillAndOpenReport functions
VickyStash Jan 4, 2024
4e7fab0
Migrate getUpdateMoneyRequestParams function
VickyStash Jan 4, 2024
cdcb7d5
Migrate updateMoneyRequestDate, updateDistanceRequest, editMoneyReque…
VickyStash Jan 4, 2024
c71ae90
Migrate setDraftSplitTransaction, editRegularMoneyRequest functions
VickyStash Jan 4, 2024
9aad84a
Migrate getSendMoneyParams function
VickyStash Jan 4, 2024
6357670
Migrate deleteMoneyRequest function
VickyStash Jan 8, 2024
992fdea
Migrate getPayMoneyRequestParams and payMoneyRequest functions
VickyStash Jan 8, 2024
6f658cd
Get rid of lodashGet and underscore usage
VickyStash Jan 8, 2024
4c7928b
Fix TS errors
VickyStash Jan 8, 2024
490f208
Merge branch 'main' into ts-migration/iou
VickyStash Jan 8, 2024
e60ebaa
TS fixes after merging main
VickyStash Jan 8, 2024
36420a7
Lint fixes
VickyStash Jan 8, 2024
d082cd4
Minor code improvements
VickyStash Jan 8, 2024
a21c11e
Merge branch 'main' into ts-migration/iou
VickyStash Jan 9, 2024
a8a7d64
TS updates after merging main
VickyStash Jan 9, 2024
fb6a0ad
Update updateIOUOwnerAndTotal function typing to get rid of assertions
VickyStash Jan 9, 2024
659f236
Get rid of nullable assertions in onyx update data
VickyStash Jan 9, 2024
5944ec6
Remove assertions, update buildOnyxDataForMoneyRequest typing
VickyStash Jan 9, 2024
c51b798
Add Split type
VickyStash Jan 9, 2024
a1eeacd
Add type params comments
VickyStash Jan 9, 2024
992e61d
ReportUtils file updates
VickyStash Jan 9, 2024
a488df6
Update receipt source type
VickyStash Jan 9, 2024
bd80055
Update errors types
VickyStash Jan 9, 2024
55d7cf0
Minor code improvements
VickyStash Jan 9, 2024
1ca2021
Merge branch 'main' into ts-migration/iou
VickyStash Jan 10, 2024
c059ca3
Remove TransactionDraft type, update deleteMoneyRequest typing after …
VickyStash Jan 10, 2024
ebfb6b9
Update createdChatReportActionID and createdIOUReportActionID type, u…
VickyStash Jan 10, 2024
185f26b
Minor code improvements
VickyStash Jan 10, 2024
e634a45
Merge branch 'main' into ts-migration/iou
VickyStash Jan 11, 2024
1af5ac6
Update replaceReceipt typing after merging main
VickyStash Jan 11, 2024
3495d18
Merge branch 'main' into ts-migration/iou
VickyStash Jan 12, 2024
d2d5d46
Onyx values type updates, minor code improvements
VickyStash Jan 12, 2024
038f646
Get rid of undefined checks
VickyStash Jan 12, 2024
dfbd3c3
Merge branch 'main' into ts-migration/iou
VickyStash Jan 15, 2024
9c838f9
Merge branch 'main' into ts-migration/iou
VickyStash Jan 15, 2024
679ce09
Migrate new cancelPayment function
VickyStash Jan 15, 2024
b85408f
Code improvement
VickyStash Jan 15, 2024
b8aedfc
Update getMoneyRequestInformation params order
VickyStash Jan 16, 2024
e48583d
Merge branch 'main' into ts-migration/iou
VickyStash Jan 16, 2024
7e7d697
Migrate to TS new parts of the code
VickyStash Jan 16, 2024
ff6fc29
Minor code improvements
VickyStash Jan 16, 2024
60a01e6
Merge branch 'main' into ts-migration/iou
VickyStash Jan 17, 2024
1297072
TS fixes after merging main
VickyStash Jan 17, 2024
1621e4b
Reuse existing types instead of creating new one
VickyStash Jan 17, 2024
5e48ce9
Code improvements
VickyStash Jan 17, 2024
c218af5
Update comments to go in one line
VickyStash Jan 17, 2024
ad37579
Merge branch 'main' into ts-migration/iou
VickyStash Jan 17, 2024
7043ef4
Remove not necessary anymore TODO
VickyStash Jan 17, 2024
c8afe19
Update Receipt source type, turn MERGE into SET
VickyStash Jan 17, 2024
8a8cd8d
Merge branch 'main' into ts-migration/iou
VickyStash Jan 18, 2024
9ba4d40
Remove unnecessary TODOs from IOU file
VickyStash Jan 18, 2024
76bb116
Merge branch 'main' into ts-migration/iou
VickyStash Jan 19, 2024
1bc5ac3
Merge branch 'main' into ts-migration/iou
VickyStash Jan 22, 2024
0b5eccd
Minor code improvements
VickyStash Jan 22, 2024
010769f
Merge branch 'main' into ts-migration/iou
VickyStash Jan 23, 2024
74eb199
Fix TS issues in the new part of code
VickyStash Jan 23, 2024
a3d4f7c
Merge branch 'main' into ts-migration/iou
VickyStash Jan 26, 2024
2dd0a90
Merge branch 'main' into ts-migration/iou
VickyStash Jan 29, 2024
4be927f
Migrate new functions to TS, move api typing to api folder
VickyStash Jan 29, 2024
1d18bea
Fix TS issues
VickyStash Jan 29, 2024
f6cef24
Update typing to fix ts errors
VickyStash Jan 29, 2024
e8ab203
Merge branch 'main' into ts-migration/iou
VickyStash Jan 30, 2024
93dd12a
TS fixes after merging main
VickyStash Jan 30, 2024
f78414e
Minor code improvement
VickyStash Jan 30, 2024
6de028e
Merge branch 'main' into ts-migration/iou
VickyStash Jan 30, 2024
b33dae6
Fix TS issues after merging main
VickyStash Jan 30, 2024
b97d482
Merge branch 'main' into ts-migration/iou
VickyStash Jan 31, 2024
1b2d85f
Merge branch 'main' into ts-migration/iou
VickyStash Feb 1, 2024
fe8ca0a
Apply TS fixes to the new code updates
VickyStash Feb 1, 2024
f533ee1
Update moneyRequestReportID default value
VickyStash Feb 2, 2024
39bc7f1
Merge branch 'main' into ts-migration/iou
VickyStash Feb 2, 2024
c2b9fc7
Minor TS fix
VickyStash Feb 2, 2024
a9a4018
Merge branch 'main' into ts-migration/iou
VickyStash Feb 2, 2024
54d0edf
Merge branch 'main' into ts-migration/iou
VickyStash Feb 2, 2024
59262ed
Merge branch 'main' into ts-migration/iou
VickyStash Feb 3, 2024
c445c5e
Lint fix
VickyStash Feb 3, 2024
de69ae8
Update comments
VickyStash Feb 3, 2024
a7b8fc1
Merge branch 'main' into ts-migration/iou
VickyStash Feb 5, 2024
88d805d
Get rid of removed screen type
VickyStash Feb 5, 2024
5359633
Merge branch 'main' into ts-migration/iou
VickyStash Feb 5, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/ONYXKEYS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -480,9 +480,9 @@ type OnyxValues = {
[ONYXKEYS.COLLECTION.TRANSACTION]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.TRANSACTION_DRAFT]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS]: OnyxTypes.TransactionViolations;
VickyStash marked this conversation as resolved.
Show resolved Hide resolved
[ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT]: OnyxTypes.Transaction;
[ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS]: OnyxTypes.RecentlyUsedTags;
[ONYXKEYS.COLLECTION.SELECTED_TAB]: string;
[ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS]: OnyxTypes.TransactionViolation[];
[ONYXKEYS.COLLECTION.PRIVATE_NOTES_DRAFT]: string;
[ONYXKEYS.COLLECTION.NEXT_STEP]: OnyxTypes.ReportNextStep;

Expand Down
2 changes: 1 addition & 1 deletion src/components/AttachmentModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ function AttachmentModal({
* Detach the receipt and close the modal.
*/
const deleteAndCloseModal = useCallback(() => {
IOU.detachReceipt(transaction?.transactionID);
IOU.detachReceipt(transaction?.transactionID ?? '');
setIsDeleteReceiptConfirmModalVisible(false);
Navigation.dismissModal(report?.reportID);
}, [transaction, report]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormAlertWithSubmitButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import FormAlertWrapper from './FormAlertWrapper';

type FormAlertWithSubmitButtonProps = {
/** Error message to display above button */
message?: string;
message?: string | null;

/** Whether the button is disabled */
isDisabled?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion src/components/FormAlertWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ type FormAlertWrapperProps = {
isMessageHtml?: boolean;

/** Error message to display above button */
message?: string;
message?: string | null;

/** Props to detect online status */
network: Network;
Expand Down
11 changes: 5 additions & 6 deletions src/components/OfflineWithFeedback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,6 @@ type OfflineWithFeedbackProps = ChildrenProps & {

type StrikethroughProps = Partial<ChildrenProps> & {style: Array<ViewStyle | TextStyle | ImageStyle>};

function omitBy<T>(obj: Record<string, T> | undefined | null, predicate: (value: T) => boolean) {
// eslint-disable-next-line @typescript-eslint/naming-convention, @typescript-eslint/no-unused-vars
return Object.fromEntries(Object.entries(obj ?? {}).filter(([_, value]) => !predicate(value)));
}

function OfflineWithFeedback({
pendingAction,
canDismissError = true,
Expand All @@ -84,8 +79,12 @@ function OfflineWithFeedback({
const {isOffline} = useNetwork();

const hasErrors = !isEmptyObject(errors ?? {});

// Some errors have a null message. This is used to apply opacity only and to avoid showing redundant messages.
const errorMessages = omitBy(errors, (e: string | ReceiptError) => e === null);
const errorEntries = Object.entries(errors ?? {});
const filteredErrorEntries = errorEntries.filter((errorEntry): errorEntry is [string, string | ReceiptError] => errorEntry[1] !== null);
const errorMessages = Object.fromEntries(filteredErrorEntries);

const hasErrorMessages = !isEmptyObject(errorMessages);
const isOfflinePendingAction = !!isOffline && !!pendingAction;
const isUpdateOrDeleteError = hasErrors && (pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE || pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE);
Expand Down
2 changes: 2 additions & 0 deletions src/components/TextInput/BaseTextInput/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ function BaseTextInput(

const hasLabel = Boolean(label?.length);
const isReadOnly = inputProps.readOnly ?? inputProps.disabled;
// Disabling this line for safeness as nullish coalescing works only if the value is undefined or null, and errorText can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const inputHelpText = errorText || hint;
const placeholderValue = !!prefixCharacter || isFocused || !hasLabel || (hasLabel && forceActiveLabel) ? placeholder : undefined;
const maxHeight = StyleSheet.flatten(containerStyles)?.maxHeight;
Expand Down
2 changes: 2 additions & 0 deletions src/components/TextInput/BaseTextInput/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ function BaseTextInput(

const hasLabel = Boolean(label?.length);
const isReadOnly = inputProps.readOnly ?? inputProps.disabled;
// Disabling this line for safeness as nullish coalescing works only if the value is undefined or null, and errorText can be an empty string
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
const inputHelpText = errorText || hint;
const newPlaceholder = !!prefixCharacter || isFocused || !hasLabel || (hasLabel && forceActiveLabel) ? placeholder : undefined;
const maxHeight = StyleSheet.flatten(containerStyles).maxHeight;
Expand Down
6 changes: 6 additions & 0 deletions src/libs/API/parameters/ApproveMoneyRequestParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type ApproveMoneyRequestParams = {
reportID: string;
approvedReportActionID: string;
};

export default ApproveMoneyRequestParams;
13 changes: 13 additions & 0 deletions src/libs/API/parameters/CompleteSplitBillParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type CompleteSplitBillParams = {
transactionID: string;
amount?: number;
currency?: string;
created?: string;
merchant?: string;
comment?: string;
category?: string;
tag?: string;
splits: string;
};

export default CompleteSplitBillParams;
17 changes: 17 additions & 0 deletions src/libs/API/parameters/CreateDistanceRequestParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
type CreateDistanceRequestParams = {
comment: string;
iouReportID: string;
chatReportID: string;
transactionID: string;
reportActionID: string;
createdChatReportActionID: string;
createdIOUReportActionID: string;
reportPreviewReportActionID: string;
waypoints: string;
created: string;
category?: string;
tag?: string;
billable?: boolean;
};

export default CreateDistanceRequestParams;
6 changes: 6 additions & 0 deletions src/libs/API/parameters/DeleteMoneyRequestParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type DeleteMoneyRequestParams = {
transactionID: string;
reportActionID: string;
};

export default DeleteMoneyRequestParams;
5 changes: 5 additions & 0 deletions src/libs/API/parameters/DetachReceiptParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type DetachReceiptParams = {
transactionID: string;
};

export default DetachReceiptParams;
14 changes: 14 additions & 0 deletions src/libs/API/parameters/EditMoneyRequestParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
type EditMoneyRequestParams = {
transactionID: string;
reportActionID: string;
created?: string;
amount?: number;
currency?: string;
comment?: string;
merchant?: string;
category?: string;
billable?: boolean;
tag?: string;
};

export default EditMoneyRequestParams;
11 changes: 11 additions & 0 deletions src/libs/API/parameters/PayMoneyRequestParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import type CONST from '@src/CONST';
import type DeepValueOf from '@src/types/utils/DeepValueOf';

type PayMoneyRequestParams = {
iouReportID: string;
chatReportID: string;
reportActionID: string;
paymentMethodType: DeepValueOf<typeof CONST.IOU.PAYMENT_TYPE>;
};

export default PayMoneyRequestParams;
6 changes: 6 additions & 0 deletions src/libs/API/parameters/ReplaceReceiptParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
type ReplaceReceiptParams = {
transactionID: string;
receipt: File;
};

export default ReplaceReceiptParams;
29 changes: 29 additions & 0 deletions src/libs/API/parameters/RequestMoneyParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import type {ValueOf} from 'type-fest';
import type CONST from '@src/CONST';
import type {Receipt} from '@src/types/onyx/Transaction';

type RequestMoneyParams = {
debtorEmail: string;
debtorAccountID: number;
amount: number;
currency: string;
comment: string;
created: string;
merchant: string;
iouReportID: string;
chatReportID: string;
transactionID: string;
reportActionID: string;
createdChatReportActionID: string;
createdIOUReportActionID: string;
reportPreviewReportActionID: string;
receipt: Receipt;
receiptState?: ValueOf<typeof CONST.IOU.RECEIPT_STATE>;
category?: string;
tag?: string;
taxCode: string;
taxAmount: number;
billable?: boolean;
};

export default RequestMoneyParams;
15 changes: 15 additions & 0 deletions src/libs/API/parameters/SendMoneyParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type CONST from '@src/CONST';
import type DeepValueOf from '@src/types/utils/DeepValueOf';

type SendMoneyParams = {
iouReportID: string;
chatReportID: string;
reportActionID: string;
paymentMethodType: DeepValueOf<typeof CONST.IOU.PAYMENT_TYPE>;
transactionID: string;
newIOUReportDetails: string;
createdReportActionID: string;
reportPreviewReportActionID: string;
};

export default SendMoneyParams;
17 changes: 17 additions & 0 deletions src/libs/API/parameters/SplitBillParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
type SplitBillParams = {
reportID: string;
amount: number;
splits: string;
comment: string;
currency: string;
merchant: string;
category: string;
tag: string;
billable: boolean;
transactionID: string;
reportActionID: string;
createdReportActionID?: string;
policyID?: string;
};

export default SplitBillParams;
17 changes: 17 additions & 0 deletions src/libs/API/parameters/StartSplitBillParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import type {Receipt} from '@src/types/onyx/Transaction';

type StartSplitBillParams = {
chatReportID: string;
reportActionID: string;
transactionID: string;
splits: string;
receipt: Receipt;
comment: string;
category: string;
tag: string;
isFromGroupDM: boolean;
createdReportActionID?: string;
billable: boolean;
};

export default StartSplitBillParams;
7 changes: 7 additions & 0 deletions src/libs/API/parameters/SubmitReportParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type SubmitReportParams = {
reportID: string;
managerAccountID?: number;
reportActionID: string;
};

export default SubmitReportParams;
9 changes: 9 additions & 0 deletions src/libs/API/parameters/UpdateMoneyRequestParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import type {TransactionDetails} from '@libs/ReportUtils';

type UpdateMoneyRequestParams = Partial<TransactionDetails> & {
reportID?: string;
transactionID: string;
reportActionID?: string;
};

export default UpdateMoneyRequestParams;
14 changes: 14 additions & 0 deletions src/libs/API/parameters/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,17 @@ export type {default as CompleteEngagementModalParams} from './CompleteEngagemen
export type {default as SetNameValuePairParams} from './SetNameValuePairParams';
export type {default as SetReportFieldParams} from './SetReportFieldParams';
export type {default as SetReportNameParams} from './SetReportNameParams';
export type {default as CompleteSplitBillParams} from './CompleteSplitBillParams';
export type {default as UpdateMoneyRequestParams} from './UpdateMoneyRequestParams';
export type {default as RequestMoneyParams} from './RequestMoneyParams';
export type {default as SplitBillParams} from './SplitBillParams';
export type {default as DeleteMoneyRequestParams} from './DeleteMoneyRequestParams';
export type {default as CreateDistanceRequestParams} from './CreateDistanceRequestParams';
export type {default as StartSplitBillParams} from './StartSplitBillParams';
export type {default as SendMoneyParams} from './SendMoneyParams';
export type {default as ApproveMoneyRequestParams} from './ApproveMoneyRequestParams';
export type {default as EditMoneyRequestParams} from './EditMoneyRequestParams';
export type {default as ReplaceReceiptParams} from './ReplaceReceiptParams';
export type {default as SubmitReportParams} from './SubmitReportParams';
export type {default as DetachReceiptParams} from './DetachReceiptParams';
export type {default as PayMoneyRequestParams} from './PayMoneyRequestParams';
50 changes: 50 additions & 0 deletions src/libs/API/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,31 @@ const WRITE_COMMANDS = {
SET_NAME_VALUE_PAIR: 'SetNameValuePair',
SET_REPORT_FIELD: 'Report_SetFields',
SET_REPORT_NAME: 'RenameReport',
COMPLETE_SPLIT_BILL: 'CompleteSplitBill',
UPDATE_MONEY_REQUEST_DATE: 'UpdateMoneyRequestDate',
UPDATE_MONEY_REQUEST_BILLABLE: 'UpdateMoneyRequestBillable',
UPDATE_MONEY_REQUEST_MERCHANT: 'UpdateMoneyRequestMerchant',
UPDATE_MONEY_REQUEST_TAG: 'UpdateMoneyRequestTag',
UPDATE_MONEY_REQUEST_DISTANCE: 'UpdateMoneyRequestDistance',
UPDATE_MONEY_REQUEST_CATEGORY: 'UpdateMoneyRequestCategory',
UPDATE_MONEY_REQUEST_DESCRIPTION: 'UpdateMoneyRequestDescription',
UPDATE_MONEY_REQUEST_AMOUNT_AND_CURRENCY: 'UpdateMoneyRequestAmountAndCurrency',
UPDATE_DISTANCE_REQUEST: 'UpdateDistanceRequest',
REQUEST_MONEY: 'RequestMoney',
SPLIT_BILL: 'SplitBill',
SPLIT_BILL_AND_OPEN_REPORT: 'SplitBillAndOpenReport',
DELETE_MONEY_REQUEST: 'DeleteMoneyRequest',
CREATE_DISTANCE_REQUEST: 'CreateDistanceRequest',
START_SPLIT_BILL: 'StartSplitBill',
SEND_MONEY_ELSEWHERE: 'SendMoneyElsewhere',
SEND_MONEY_WITH_WALLET: 'SendMoneyWithWallet',
APPROVE_MONEY_REQUEST: 'ApproveMoneyRequest',
EDIT_MONEY_REQUEST: 'EditMoneyRequest',
REPLACE_RECEIPT: 'ReplaceReceipt',
SUBMIT_REPORT: 'SubmitReport',
DETACH_RECEIPT: 'DetachReceipt',
PAY_MONEY_REQUEST_WITH_WALLET: 'PayMoneyRequestWithWallet',
PAY_MONEY_REQUEST: 'PayMoneyRequest',
} as const;

type WriteCommand = ValueOf<typeof WRITE_COMMANDS>;
Expand Down Expand Up @@ -229,6 +254,31 @@ type WriteCommandParameters = {
[WRITE_COMMANDS.SET_NAME_VALUE_PAIR]: Parameters.SetNameValuePairParams;
[WRITE_COMMANDS.SET_REPORT_FIELD]: Parameters.SetReportFieldParams;
[WRITE_COMMANDS.SET_REPORT_NAME]: Parameters.SetReportNameParams;
[WRITE_COMMANDS.COMPLETE_SPLIT_BILL]: Parameters.CompleteSplitBillParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DATE]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_MERCHANT]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_BILLABLE]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_TAG]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DISTANCE]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_CATEGORY]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_DESCRIPTION]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_DISTANCE_REQUEST]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.UPDATE_MONEY_REQUEST_AMOUNT_AND_CURRENCY]: Parameters.UpdateMoneyRequestParams;
[WRITE_COMMANDS.REQUEST_MONEY]: Parameters.RequestMoneyParams;
[WRITE_COMMANDS.SPLIT_BILL]: Parameters.SplitBillParams;
[WRITE_COMMANDS.SPLIT_BILL_AND_OPEN_REPORT]: Parameters.SplitBillParams;
[WRITE_COMMANDS.DELETE_MONEY_REQUEST]: Parameters.DeleteMoneyRequestParams;
[WRITE_COMMANDS.CREATE_DISTANCE_REQUEST]: Parameters.CreateDistanceRequestParams;
[WRITE_COMMANDS.START_SPLIT_BILL]: Parameters.StartSplitBillParams;
[WRITE_COMMANDS.SEND_MONEY_ELSEWHERE]: Parameters.SendMoneyParams;
[WRITE_COMMANDS.SEND_MONEY_WITH_WALLET]: Parameters.SendMoneyParams;
[WRITE_COMMANDS.APPROVE_MONEY_REQUEST]: Parameters.ApproveMoneyRequestParams;
[WRITE_COMMANDS.EDIT_MONEY_REQUEST]: Parameters.EditMoneyRequestParams;
[WRITE_COMMANDS.REPLACE_RECEIPT]: Parameters.ReplaceReceiptParams;
[WRITE_COMMANDS.SUBMIT_REPORT]: Parameters.SubmitReportParams;
[WRITE_COMMANDS.DETACH_RECEIPT]: Parameters.DetachReceiptParams;
[WRITE_COMMANDS.PAY_MONEY_REQUEST_WITH_WALLET]: Parameters.PayMoneyRequestParams;
[WRITE_COMMANDS.PAY_MONEY_REQUEST]: Parameters.PayMoneyRequestParams;
};

const READ_COMMANDS = {
Expand Down
Loading
Loading