Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 17 additions & 4 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,7 @@
backToReport?: string;
isASAPSubmitBetaEnabled: boolean;
transactionViolations: OnyxCollection<OnyxTypes.TransactionViolation[]>;
quickAction: OnyxEntry<OnyxTypes.QuickAction>;
};

type CreateSplitsTransactionParams = Omit<BaseTransactionParams, 'customUnitRateID'> & {
Expand All @@ -627,6 +628,7 @@
policyRecentlyUsedCategories?: OnyxEntry<OnyxTypes.RecentlyUsedCategories>;
isASAPSubmitBetaEnabled: boolean;
transactionViolations: OnyxCollection<OnyxTypes.TransactionViolation[]>;
quickAction: OnyxEntry<OnyxTypes.QuickAction>;
};

type TrackExpenseTransactionParams = {
Expand Down Expand Up @@ -736,7 +738,7 @@
};

let allPersonalDetails: OnyxTypes.PersonalDetailsList = {};
// eslint-disable-next-line @typescript-eslint/no-deprecated

Check warning on line 741 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
Expand All @@ -760,6 +762,7 @@
taxAmount: number;
shouldPlaySound?: boolean;
policyRecentlyUsedCategories?: OnyxEntry<OnyxTypes.RecentlyUsedCategories>;
quickAction: OnyxEntry<OnyxTypes.QuickAction>;
};

type UpdateSplitTransactionsParams = {
Expand Down Expand Up @@ -829,7 +832,7 @@
hash?: number;
};

let allTransactions: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};

Check warning on line 835 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
// eslint-disable-next-line @typescript-eslint/no-deprecated
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION,
Expand All @@ -843,7 +846,7 @@
allTransactions = value;
},
});

Check warning on line 849 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
let allTransactionDrafts: NonNullable<OnyxCollection<OnyxTypes.Transaction>> = {};
// eslint-disable-next-line @typescript-eslint/no-deprecated
Onyx.connect({
Expand All @@ -852,7 +855,7 @@
callback: (value) => {
allTransactionDrafts = value ?? {};
},
});

Check warning on line 858 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

let allTransactionViolations: NonNullable<OnyxCollection<OnyxTypes.TransactionViolations>> = {};
// eslint-disable-next-line @typescript-eslint/no-deprecated
Expand All @@ -866,7 +869,7 @@
}

allTransactionViolations = value;
},

Check warning on line 872 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
});

let allNextSteps: NonNullable<OnyxCollection<OnyxTypes.ReportNextStepDeprecated>> = {};
Expand All @@ -875,7 +878,7 @@
key: ONYXKEYS.COLLECTION.NEXT_STEP,
waitForCollectionCallback: true,
callback: (value) => {
allNextSteps = value ?? {};

Check warning on line 881 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
},
});

Expand All @@ -894,14 +897,14 @@

allPolicies[key] = val;
},
});

Check warning on line 900 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function

// TODO: remove `allRecentlyUsedTags` from this file (https://github.com/Expensify/App/issues/71491)
// `allRecentlyUsedTags` was moved here temporarily from `src/libs/actions/Policy/Tag.ts` during the `Deprecate Onyx.connect` refactor.
// All uses of this variable should be replaced with `useOnyx`.
let allRecentlyUsedTags: OnyxCollection<RecentlyUsedTags> = {};
// eslint-disable-next-line @typescript-eslint/no-deprecated
Onyx.connect({

Check warning on line 907 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
key: ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS,
waitForCollectionCallback: true,
callback: (val) => (allRecentlyUsedTags = val),
Expand All @@ -910,7 +913,7 @@
let allReports: OnyxCollection<OnyxTypes.Report>;
// eslint-disable-next-line @typescript-eslint/no-deprecated
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,

Check warning on line 916 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
waitForCollectionCallback: true,
callback: (value) => {
allReports = value;
Expand All @@ -920,7 +923,7 @@
let allReportNameValuePairs: OnyxCollection<OnyxTypes.ReportNameValuePairs>;
// eslint-disable-next-line @typescript-eslint/no-deprecated
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS,

Check warning on line 926 in src/libs/actions/IOU.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Onyx.connect() is deprecated. Use useOnyx() hook instead and pass the data as parameters to a pure function
waitForCollectionCallback: true,
callback: (value) => {
allReportNameValuePairs = value;
Expand Down Expand Up @@ -6975,6 +6978,7 @@
policyRecentlyUsedCategories,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
}: CreateSplitsAndOnyxDataParams): SplitsAndOnyxData {
const currentUserEmailForIOUSplit = addSMSDomainIfPhoneNumber(currentUserLogin);
const participantAccountIDs = participants.map((participant) => Number(participant.accountID));
Expand Down Expand Up @@ -7057,7 +7061,7 @@
value: {
action: iouRequestType === CONST.IOU.REQUEST_TYPE.DISTANCE ? CONST.QUICK_ACTIONS.SPLIT_DISTANCE : CONST.QUICK_ACTIONS.SPLIT_MANUAL,
chatReportID: splitChatReport.reportID,
isFirstQuickAction: isEmptyObject(deprecatedQuickAction),
isFirstQuickAction: isEmptyObject(quickAction),
},
},
existingSplitChatReport
Expand Down Expand Up @@ -7141,7 +7145,7 @@
{
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
value: deprecatedQuickAction ?? null,
value: quickAction ?? null,
},
];

Expand Down Expand Up @@ -7465,6 +7469,7 @@
policyRecentlyUsedCategories?: OnyxEntry<OnyxTypes.RecentlyUsedCategories>;
isASAPSubmitBetaEnabled: boolean;
transactionViolations: OnyxCollection<OnyxTypes.TransactionViolation[]>;
quickAction: OnyxEntry<OnyxTypes.QuickAction>;
};

/**
Expand Down Expand Up @@ -7492,6 +7497,7 @@
policyRecentlyUsedCategories,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
}: SplitBillActionsParams) {
const parsedComment = getParsedComment(comment);
const {splitData, splits, onyxData} = createSplitsAndOnyxData({
Expand All @@ -7517,6 +7523,7 @@
policyRecentlyUsedCategories,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});

const parameters: SplitBillParams = {
Expand Down Expand Up @@ -7575,6 +7582,7 @@
policyRecentlyUsedCategories,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
}: SplitBillActionsParams) {
const parsedComment = getParsedComment(comment);
const {splitData, splits, onyxData} = createSplitsAndOnyxData({
Expand All @@ -7600,6 +7608,7 @@
},
policyRecentlyUsedCategories,
transactionViolations,
quickAction,
});

const parameters: SplitBillParams = {
Expand Down Expand Up @@ -7654,6 +7663,7 @@
taxAmount = 0,
shouldPlaySound = true,
policyRecentlyUsedCategories,
quickAction,
}: StartSplitBilActionParams) {
const currentUserEmailForIOUSplit = addSMSDomainIfPhoneNumber(currentUserLogin);
const participantAccountIDs = participants.map((participant) => Number(participant.accountID));
Expand Down Expand Up @@ -7718,7 +7728,7 @@
value: {
action: CONST.QUICK_ACTIONS.SPLIT_SCAN,
chatReportID: splitChatReport.reportID,
isFirstQuickAction: isEmptyObject(deprecatedQuickAction),
isFirstQuickAction: isEmptyObject(quickAction),
},
},
existingSplitChatReport
Expand Down Expand Up @@ -7800,7 +7810,7 @@
{
onyxMethod: Onyx.METHOD.SET,
key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE,
value: deprecatedQuickAction ?? null,
value: quickAction ?? null,
},
];

Expand All @@ -7818,6 +7828,7 @@
currency,
taxCode,
taxAmount,
quickAction,
};

if (existingSplitChatReport) {
Expand Down Expand Up @@ -8309,6 +8320,7 @@
backToReport,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
} = distanceRequestInformation;
const {policy, policyCategories, policyTagList, policyRecentlyUsedCategories} = policyParams;
const parsedComment = getParsedComment(transactionParams.comment);
Expand Down Expand Up @@ -8377,6 +8389,7 @@
policyRecentlyUsedCategories,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});
onyxData = splitOnyxData;

Expand Down
20 changes: 13 additions & 7 deletions src/pages/iou/request/step/IOURequestStepConfirmation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,7 @@ function IOURequestStepConfirmation({
backToReport,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});
},
[
Expand All @@ -824,6 +825,7 @@ function IOURequestStepConfirmation({
backToReport,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
Comment thread
parasharrajat marked this conversation as resolved.
],
);

Expand Down Expand Up @@ -888,6 +890,7 @@ function IOURequestStepConfirmation({
taxAmount: transactionTaxAmount,
shouldPlaySound: index === transactions.length - 1,
policyRecentlyUsedCategories,
quickAction,
});
}
}
Expand Down Expand Up @@ -919,6 +922,7 @@ function IOURequestStepConfirmation({
policyRecentlyUsedCategories,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});
}
return;
Expand Down Expand Up @@ -947,6 +951,7 @@ function IOURequestStepConfirmation({
policyRecentlyUsedCategories,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});
}
return;
Expand Down Expand Up @@ -1063,9 +1068,9 @@ function IOURequestStepConfirmation({
[
iouType,
transaction,
transactions,
isDistanceRequest,
isMovingTransactionFromTrackExpense,
isUnreported,
receiptFiles,
isCategorizingTrackExpense,
isSharingTrackExpense,
Expand All @@ -1074,21 +1079,22 @@ function IOURequestStepConfirmation({
createDistanceRequest,
currentUserPersonalDetails.login,
currentUserPersonalDetails.accountID,
transactions,
report,
transactionTaxCode,
transactionTaxAmount,
policyRecentlyUsedCategories,
quickAction,
isASAPSubmitBetaEnabled,
transactionViolations,
receiverParticipantAccountID,
existingInvoiceReport,
policy,
policyTags,
policyCategories,
policyRecentlyUsedCategories,
trackExpense,
userLocation,
submitPerDiemExpense,
existingInvoiceReport,
isUnreported,
isASAPSubmitBetaEnabled,
receiverParticipantAccountID,
transactionViolations,
],
);

Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/step/IOURequestStepDistance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ function IOURequestStepDistance({
const defaultExpensePolicy = useDefaultExpensePolicy();
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`, {canBeMissing: false});
const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES, {canBeMissing: true});
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
const [optimisticWaypoints, setOptimisticWaypoints] = useState<WaypointCollection | null>(null);
const waypoints = useMemo(
() =>
Expand Down Expand Up @@ -379,6 +380,7 @@ function IOURequestStepDistance({
backToReport,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});
return;
}
Expand Down Expand Up @@ -446,6 +448,7 @@ function IOURequestStepDistance({
reportID,
transactionViolations,
currentUserPersonalDetails.accountID,
quickAction,
]);

const getError = () => {
Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/step/IOURequestStepDistanceManual.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function IOURequestStepDistanceManual({
const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES, {canBeMissing: true});
const [reportAttributesDerived] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {canBeMissing: true, selector: reportsSelector});
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true});
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});

const isEditing = action === CONST.IOU.ACTION.EDIT;
const isCreatingNewRequest = !(backTo || isEditing);
Expand Down Expand Up @@ -249,6 +250,7 @@ function IOURequestStepDistanceManual({
backToReport,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});
return;
}
Expand Down Expand Up @@ -314,6 +316,7 @@ function IOURequestStepDistanceManual({
personalPolicy?.autoReporting,
transactionViolations,
currentUserPersonalDetails.accountID,
quickAction,
],
);

Expand Down
3 changes: 3 additions & 0 deletions src/pages/iou/request/step/IOURequestStepDistanceMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ function IOURequestStepDistanceMap({
const defaultExpensePolicy = useDefaultExpensePolicy();
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${transactionID}`, {canBeMissing: false});
const [lastSelectedDistanceRates] = useOnyx(ONYXKEYS.NVP_LAST_SELECTED_DISTANCE_RATES, {canBeMissing: true});
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
const [transactionViolations] = useOnyx(ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS, {canBeMissing: true});
const [optimisticWaypoints, setOptimisticWaypoints] = useState<WaypointCollection | null>(null);
const waypoints = useMemo(
Expand Down Expand Up @@ -381,6 +382,7 @@ function IOURequestStepDistanceMap({
backToReport,
isASAPSubmitBetaEnabled,
transactionViolations,
quickAction,
});
return;
}
Expand Down Expand Up @@ -448,6 +450,7 @@ function IOURequestStepDistanceMap({
reportID,
transactionViolations,
currentUserPersonalDetails.accountID,
quickAction,
]);

const getError = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ function IOURequestStepScan({
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${initialTransactionID}`, {canBeMissing: true});
const defaultExpensePolicy = useDefaultExpensePolicy();
const [dismissedProductTraining] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, {canBeMissing: true});
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
const [reportAttributesDerived] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {canBeMissing: true, selector: reportsSelector});
const lazyIllustrations = useMemoizedLazyIllustrations(['MultiScan', 'Hand', 'Shutter']);
const lazyIcons = useMemoizedLazyExpensifyIcons(['Bolt', 'Gallery', 'ReceiptMultiple', 'boltSlash']);
Expand Down Expand Up @@ -440,6 +441,7 @@ function IOURequestStepScan({
currency: initialTransaction?.currency ?? 'USD',
taxCode: transactionTaxCode,
taxAmount: transactionTaxAmount,
Comment thread
parasharrajat marked this conversation as resolved.
quickAction,
});
return;
}
Expand Down Expand Up @@ -531,21 +533,22 @@ function IOURequestStepScan({
initialTransaction?.reportID,
reportNameValuePairs,
iouType,
personalPolicy?.autoReporting,
defaultExpensePolicy,
report,
initialTransactionID,
navigateToConfirmationPage,
currentUserPersonalDetails.accountID,
currentUserPersonalDetails?.login,
shouldSkipConfirmation,
personalDetails,
reportAttributesDerived,
createTransaction,
currentUserPersonalDetails?.login,
currentUserPersonalDetails.accountID,
reportID,
transactionTaxCode,
transactionTaxAmount,
quickAction,
policy,
personalPolicy?.autoReporting,
selfDMReportID,
],
);
Expand Down
9 changes: 6 additions & 3 deletions src/pages/iou/request/step/IOURequestStepScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ function IOURequestStepScan({
const [skipConfirmation] = useOnyx(`${ONYXKEYS.COLLECTION.SKIP_CONFIRMATION}${initialTransactionID}`, {canBeMissing: true});
const defaultExpensePolicy = useDefaultExpensePolicy();
const [dismissedProductTraining] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, {canBeMissing: true});
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, {canBeMissing: true});
const [reportAttributesDerived] = useOnyx(ONYXKEYS.DERIVED.REPORT_ATTRIBUTES, {canBeMissing: true, selector: reportsSelector});
const lazyIllustrations = useMemoizedLazyIllustrations(['MultiScan', 'Hand', 'ReceiptUpload', 'Shutter']);
const lazyIcons = useMemoizedLazyExpensifyIcons(['Bolt', 'Gallery', 'ReceiptMultiple', 'boltSlash', 'ReplaceReceipt', 'SmartScan']);
Expand Down Expand Up @@ -500,6 +501,7 @@ function IOURequestStepScan({
currency: initialTransaction?.currency ?? 'USD',
taxCode: transactionTaxCode,
taxAmount: transactionTaxAmount,
Comment thread
parasharrajat marked this conversation as resolved.
quickAction,
});
return;
}
Expand Down Expand Up @@ -590,21 +592,22 @@ function IOURequestStepScan({
initialTransaction?.reportID,
reportNameValuePairs,
iouType,
personalPolicy?.autoReporting,
defaultExpensePolicy,
report,
initialTransactionID,
navigateToConfirmationPage,
currentUserPersonalDetails.accountID,
currentUserPersonalDetails?.login,
shouldSkipConfirmation,
personalDetails,
reportAttributesDerived,
createTransaction,
currentUserPersonalDetails?.login,
currentUserPersonalDetails.accountID,
reportID,
transactionTaxCode,
transactionTaxAmount,
quickAction,
policy,
personalPolicy?.autoReporting,
selfDMReportID,
],
);
Expand Down
Loading
Loading