Skip to content
Open
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
2 changes: 2 additions & 0 deletions src/components/MoneyRequestHeaderSecondaryActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
const [quickAction] = useOnyx(ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE);
const [isSelfTourViewed = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);

// Custom hooks
const defaultExpensePolicy = useDefaultExpensePolicy();
Expand Down Expand Up @@ -234,6 +235,7 @@ function MoneyRequestHeaderSecondaryActions({reportID, onBackButtonPress}: Money
personalDetails,
recentWaypoints,
targetPolicyTags,
conciergeReportID,
});
}
};
Expand Down
2 changes: 2 additions & 0 deletions src/hooks/useBulkDuplicateAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ function useBulkDuplicateAction({selectedTransactionsKeys, allTransactions, allR
const [betas] = useOnyx(ONYXKEYS.BETAS);
const [personalDetails] = useOnyx(ONYXKEYS.PERSONAL_DETAILS_LIST);
const [recentWaypoints] = useOnyx(ONYXKEYS.NVP_RECENT_WAYPOINTS);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
const [targetPolicyCategories] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${defaultExpensePolicy?.id}`);
const [targetPolicyTags] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_TAGS}${defaultExpensePolicy?.id}`);

Expand Down Expand Up @@ -78,6 +79,7 @@ function useBulkDuplicateAction({selectedTransactionsKeys, allTransactions, allR
draftTransactionIDs,
betas,
recentWaypoints,
conciergeReportID,
});

if (onAfterDuplicate) {
Expand Down
3 changes: 3 additions & 0 deletions src/hooks/useExpenseActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
const [introSelected] = useOnyx(ONYXKEYS.NVP_INTRO_SELECTED);
const [isSelfTourViewed = false] = useOnyx(ONYXKEYS.NVP_ONBOARDING, {selector: hasSeenTourSelector});
const [bankAccountList] = useOnyx(ONYXKEYS.BANK_ACCOUNT_LIST);
const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);

// Billing keys
const [ownerBillingGracePeriodEnd] = useOnyx(ONYXKEYS.NVP_PRIVATE_OWNER_BILLING_GRACE_PERIOD_END);
Expand Down Expand Up @@ -253,6 +254,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
personalDetails,
recentWaypoints,
targetPolicyTags,
conciergeReportID,
});
}
};
Expand Down Expand Up @@ -398,6 +400,7 @@ function useExpenseActions({reportID, isReportInSearch = false, backTo, onDuplic
transactionViolations: allTransactionViolations,
translate,
recentWaypoints: recentWaypoints ?? [],
conciergeReportID,
});
});
},
Expand Down
5 changes: 3 additions & 2 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1037,7 +1037,7 @@

let conciergeReportIDOnyxConnect: OnyxEntry<string>;
Onyx.connect({
key: ONYXKEYS.CONCIERGE_REPORT_ID,

Check warning on line 1040 in src/libs/ReportUtils.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
callback: (value) => {
conciergeReportIDOnyxConnect = value;
},
Expand All @@ -1045,7 +1045,7 @@

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({
key: ONYXKEYS.SESSION,

Check warning on line 1048 in src/libs/ReportUtils.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
callback: (value) => {
// When signed out, val is undefined
if (!value) {
Expand All @@ -1063,7 +1063,7 @@
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({
key: ONYXKEYS.PERSONAL_DETAILS_LIST,

Check warning on line 1066 in src/libs/ReportUtils.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
callback: (value) => {
if (deprecatedCurrentUserAccountID) {
currentUserPersonalDetails = value?.[deprecatedCurrentUserAccountID] ?? undefined;
Expand All @@ -1075,7 +1075,7 @@

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,

Check warning on line 1078 in src/libs/ReportUtils.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) => (allReportsDraft = value),
});
Expand All @@ -1083,7 +1083,7 @@
let allPolicies: OnyxCollection<Policy>;
let policiesArray: Policy[] = [];
Onyx.connect({
key: ONYXKEYS.COLLECTION.POLICY,

Check warning on line 1086 in src/libs/ReportUtils.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) => {
allPolicies = value;
Expand All @@ -1093,7 +1093,7 @@

let allPolicyDrafts: OnyxCollection<Policy>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.POLICY_DRAFTS,

Check warning on line 1096 in src/libs/ReportUtils.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) => (allPolicyDrafts = value),
});
Expand All @@ -1101,7 +1101,7 @@
let deprecatedAllReports: OnyxCollection<Report>;
let deprecatedReportsByPolicyID: ReportByPolicyMap;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT,

Check warning on line 1104 in src/libs/ReportUtils.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) => {
deprecatedAllReports = value;
Expand Down Expand Up @@ -1137,14 +1137,14 @@

let betaConfiguration: OnyxEntry<BetaConfiguration> = {};
Onyx.connect({
key: ONYXKEYS.BETA_CONFIGURATION,

Check warning on line 1140 in src/libs/ReportUtils.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
callback: (value) => (betaConfiguration = value ?? {}),
});

let deprecatedAllTransactions: OnyxCollection<Transaction> = {};
let deprecatedReportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({
key: ONYXKEYS.COLLECTION.TRANSACTION,

Check warning on line 1147 in src/libs/ReportUtils.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) => {
if (!value) {
Expand All @@ -1170,7 +1170,7 @@

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,

Check warning on line 1173 in src/libs/ReportUtils.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: (actions) => {
if (!actions) {
Expand Down Expand Up @@ -7590,10 +7590,11 @@
transaction: OnyxInputOrEntry<Transaction> = null,
childReportID?: string,
reportActionID?: string,
// TODO: conciergeReportID will be required eventually. Ref: https://github.com/Expensify/App/issues/66411
conciergeReportID?: string | undefined,
): ReportAction<typeof CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW> {
const hasReceipt = hasReceiptTransactionUtils(transaction);
// TODO: We'll pass the conciergeReportID in the next PR. Ref: https://github.com/Expensify/App/issues/66411
const message = getReportPreviewMessage(iouReport, undefined);
const message = getReportPreviewMessage(iouReport, conciergeReportID);
const created = DateUtils.getDBTime();
const reportActorAccountID = (isInvoiceReport(iouReport) || isExpenseReport(iouReport) ? iouReport?.ownerAccountID : iouReport?.managerID) ?? -1;
const delegateAccountDetails = getPersonalDetailByEmail(delegateEmail);
Expand Down
12 changes: 12 additions & 0 deletions src/libs/actions/IOU/Duplicate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,7 @@ function createExpenseByType({
customUnitPolicyID,
personalDetails,
recentWaypoints,
conciergeReportID,
}: {
transactionType: string;
params: RequestMoneyInformation;
Expand All @@ -587,6 +588,7 @@ function createExpenseByType({
customUnitPolicyID?: string;
personalDetails: OnyxEntry<OnyxTypes.PersonalDetailsList>;
recentWaypoints: OnyxEntry<OnyxTypes.RecentWaypoint[]>;
conciergeReportID: string | undefined;
}) {
switch (transactionType) {
case CONST.SEARCH.TRANSACTION_TYPE.DISTANCE: {
Expand Down Expand Up @@ -630,6 +632,7 @@ function createExpenseByType({
},
hasViolations: false,
customUnitPolicyID,
conciergeReportID,
};
return submitPerDiemExpense(perDiemParams);
}
Expand Down Expand Up @@ -660,6 +663,7 @@ type DuplicateExpenseTransactionParams = {
targetPolicyTags: OnyxEntry<OnyxTypes.PolicyTagLists>;
shouldPlaySound?: boolean;
shouldDeferAutoSubmit?: boolean;
conciergeReportID: string | undefined;
existingIOUReport?: OnyxEntry<OnyxTypes.Report>;
optimisticReportPreviewActionID?: string;
};
Expand All @@ -686,6 +690,7 @@ function duplicateExpenseTransaction({
targetPolicyTags,
shouldPlaySound = true,
shouldDeferAutoSubmit = false,
conciergeReportID,
existingIOUReport,
optimisticReportPreviewActionID: externalReportPreviewActionID,
}: DuplicateExpenseTransactionParams) {
Expand Down Expand Up @@ -788,6 +793,7 @@ function duplicateExpenseTransaction({
customUnitPolicyID,
personalDetails,
recentWaypoints,
conciergeReportID,
});
}

Expand All @@ -810,6 +816,7 @@ type DuplicateReportParams = {
transactionViolations: OnyxCollection<OnyxTypes.TransactionViolation[]>;
translate: LocalizedTranslate;
recentWaypoints: OnyxEntry<OnyxTypes.RecentWaypoint[]>;
conciergeReportID: string | undefined;
};

function duplicateReport({
Expand All @@ -831,6 +838,7 @@ function duplicateReport({
transactionViolations,
translate,
recentWaypoints,
conciergeReportID,
}: DuplicateReportParams) {
if (!targetPolicy || !parentChatReport) {
return;
Expand Down Expand Up @@ -931,6 +939,7 @@ function duplicateReport({
customUnitPolicyID: targetPolicy?.id,
personalDetails,
recentWaypoints,
conciergeReportID,
});

if (result?.iouReport) {
Expand Down Expand Up @@ -960,6 +969,7 @@ type BulkDuplicateExpensesParams = {
draftTransactionIDs: string[];
betas: OnyxEntry<OnyxTypes.Beta[]>;
recentWaypoints: OnyxEntry<OnyxTypes.RecentWaypoint[]>;
conciergeReportID: string | undefined;
};

function bulkDuplicateExpenses({
Expand All @@ -981,6 +991,7 @@ function bulkDuplicateExpenses({
draftTransactionIDs,
betas,
recentWaypoints,
conciergeReportID,
}: BulkDuplicateExpensesParams) {
const transactionsToDuplicate = transactionIDs.map((id) => allTransactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`]).filter((t): t is OnyxTypes.Transaction => !!t);

Expand Down Expand Up @@ -1033,6 +1044,7 @@ function bulkDuplicateExpenses({
targetPolicyTags,
shouldPlaySound: false,
shouldDeferAutoSubmit: !isLastExpense,
conciergeReportID,
existingIOUReport: optimisticIOUReport,
optimisticReportPreviewActionID: sharedReportPreviewActionID,
});
Expand Down
7 changes: 6 additions & 1 deletion src/libs/actions/IOU/PerDiem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ type RecentlyUsedParams = {
};

type PerDiemExpenseInformation = {
conciergeReportID: string | undefined;
report: OnyxEntry<OnyxTypes.Report>;
participantParams: RequestMoneyParticipantParams;
policyParams?: BasePolicyParams;
Expand All @@ -238,6 +239,7 @@ type PerDiemExpenseInformation = {
};

type PerDiemExpenseInformationParams = {
conciergeReportID: string | undefined;
parentChatReport: OnyxEntry<OnyxTypes.Report>;
transactionParams: PerDiemExpenseTransactionParams;
participantParams: RequestMoneyParticipantParams;
Expand Down Expand Up @@ -287,6 +289,7 @@ type PerDiemExpenseInformationForSelfDMResult = {
*/
function getPerDiemExpenseInformation(perDiemExpenseInformation: PerDiemExpenseInformationParams): MoneyRequestInformation {
const {
conciergeReportID,
parentChatReport,
transactionParams,
participantParams,
Expand Down Expand Up @@ -454,7 +457,7 @@ function getPerDiemExpenseInformation(perDiemExpenseInformation: PerDiemExpenseI
if (reportPreviewAction) {
reportPreviewAction = updateReportPreview(iouReport, reportPreviewAction, false, comment, optimisticTransaction);
} else {
reportPreviewAction = buildOptimisticReportPreview(chatReport, iouReport, comment, optimisticTransaction, undefined, optimisticReportPreviewActionID);
reportPreviewAction = buildOptimisticReportPreview(chatReport, iouReport, comment, optimisticTransaction, undefined, optimisticReportPreviewActionID, conciergeReportID);
chatReport.lastVisibleActionCreated = reportPreviewAction.created;

// Generated ReportPreview action is a parent report action of the iou report.
Expand Down Expand Up @@ -877,6 +880,7 @@ function getPerDiemExpenseInformationForSelfDM(perDiemExpenseInformation: PerDie
*/
function submitPerDiemExpense(submitPerDiemExpenseInformation: PerDiemExpenseInformation) {
const {
conciergeReportID,
report,
participantParams,
policyParams = {},
Expand Down Expand Up @@ -929,6 +933,7 @@ function submitPerDiemExpense(submitPerDiemExpenseInformation: PerDiemExpenseInf
billable,
reimbursable,
} = getPerDiemExpenseInformation({
conciergeReportID,
parentChatReport: currentChatReport,
participantParams,
policyParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ function useExpenseSubmission(params: UseExpenseSubmissionParams) {
const [gpsDraftDetails] = useOnyx(ONYXKEYS.GPS_DRAFT_DETAILS);
const [recentWaypoints] = useOnyx(ONYXKEYS.NVP_RECENT_WAYPOINTS);
const [delegateEmail] = useOnyx(ONYXKEYS.ACCOUNT, {selector: delegateEmailSelector});

const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID);
// Onboarding task data
const {
taskReport: viewTourTaskReport,
Expand Down Expand Up @@ -432,6 +432,7 @@ function useExpenseSubmission(params: UseExpenseSubmissionParams) {
betas,
personalDetails,
optimisticChatReportID,
conciergeReportID,
});
if (shouldHandleNav && result && activeReportID) {
navigateAfterExpenseCreate({
Expand Down
Loading
Loading