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
5 changes: 5 additions & 0 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -922,7 +922,7 @@
const parsedReportActionMessageCache: Record<string, string> = {};

let conciergeReportID: OnyxEntry<string>;
Onyx.connect({

Check warning on line 925 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
key: ONYXKEYS.CONCIERGE_REPORT_ID,
callback: (value) => {
conciergeReportID = value;
Expand All @@ -930,7 +930,7 @@
});

const defaultAvatarBuildingIconTestID = 'SvgDefaultAvatarBuilding Icon';
Onyx.connect({

Check warning on line 933 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
key: ONYXKEYS.SESSION,
callback: (value) => {
// When signed out, val is undefined
Expand All @@ -948,7 +948,7 @@
let allPersonalDetails: OnyxEntry<PersonalDetailsList>;
let allPersonalDetailLogins: string[];
let currentUserPersonalDetails: OnyxEntry<PersonalDetails>;
Onyx.connect({

Check warning on line 951 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
key: ONYXKEYS.PERSONAL_DETAILS_LIST,
callback: (value) => {
if (currentUserAccountID) {
Expand All @@ -960,14 +960,14 @@
});

let allReportsDraft: OnyxCollection<Report>;
Onyx.connect({

Check warning on line 963 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
key: ONYXKEYS.COLLECTION.REPORT_DRAFT,
waitForCollectionCallback: true,
callback: (value) => (allReportsDraft = value),
});

let allPolicies: OnyxCollection<Policy>;
Onyx.connect({

Check warning on line 970 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
key: ONYXKEYS.COLLECTION.POLICY,
waitForCollectionCallback: true,
callback: (value) => (allPolicies = value),
Expand All @@ -975,7 +975,7 @@

let allReports: OnyxCollection<Report>;
let reportsByPolicyID: ReportByPolicyMap;
Onyx.connect({

Check warning on line 978 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
key: ONYXKEYS.COLLECTION.REPORT,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -1016,14 +1016,14 @@
});

let allBetas: OnyxEntry<Beta[]>;
Onyx.connect({

Check warning on line 1019 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
key: ONYXKEYS.BETAS,
callback: (value) => (allBetas = value),
});

let allTransactions: OnyxCollection<Transaction> = {};
let reportsTransactions: Record<string, Transaction[]> = {};
Onyx.connect({

Check warning on line 1026 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
key: ONYXKEYS.COLLECTION.TRANSACTION,
waitForCollectionCallback: true,
callback: (value) => {
Expand All @@ -1049,7 +1049,7 @@
});

let allReportActions: OnyxCollection<ReportActions>;
Onyx.connect({

Check warning on line 1052 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
key: ONYXKEYS.COLLECTION.REPORT_ACTIONS,
waitForCollectionCallback: true,
callback: (actions) => {
Expand All @@ -1062,7 +1062,7 @@

let allReportMetadata: OnyxCollection<ReportMetadata>;
const allReportMetadataKeyValue: Record<string, ReportMetadata> = {};
Onyx.connect({

Check warning on line 1065 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
key: ONYXKEYS.COLLECTION.REPORT_METADATA,
waitForCollectionCallback: true,
callback: (value) => {
Expand Down Expand Up @@ -10372,6 +10372,7 @@
wasInvited?: boolean,
companySize?: OnboardingCompanySize,
selectedInterestedFeatures: string[] = [],
isInvitedAccountant?: boolean,
) {
if (engagementChoice === CONST.ONBOARDING_CHOICES.PERSONAL_SPEND) {
// eslint-disable-next-line no-param-reassign
Expand Down Expand Up @@ -10525,6 +10526,10 @@
isTaskAutoCompleted = true;
}

if (task.type === CONST.ONBOARDING_TASK_TYPE.INVITE_ACCOUNTANT && isInvitedAccountant) {
isTaskAutoCompleted = true;
}

const completedTaskReportAction = isTaskAutoCompleted
? buildOptimisticTaskReportAction(currentTask.reportID, CONST.REPORT.ACTIONS.TYPE.TASK_COMPLETED, 'marked as complete', actorAccountID, 2)
: null;
Expand Down
3 changes: 3 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4260,6 +4260,7 @@ function completeOnboarding({
wasInvited,
selectedInterestedFeatures = [],
shouldSkipTestDriveModal,
isInvitedAccountant,
}: {
engagementChoice: OnboardingPurpose;
onboardingMessage: OnboardingMessage;
Expand All @@ -4273,6 +4274,7 @@ function completeOnboarding({
wasInvited?: boolean;
selectedInterestedFeatures?: string[];
shouldSkipTestDriveModal?: boolean;
isInvitedAccountant?: boolean;
}) {
const onboardingData = prepareOnboardingOnyxData(
introSelected,
Expand All @@ -4284,6 +4286,7 @@ function completeOnboarding({
wasInvited,
companySize,
selectedInterestedFeatures,
isInvitedAccountant,
);
if (!onboardingData) {
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,39 +221,43 @@ function BaseOnboardingWorkspaceInvite({shouldUseNativeStyles}: BaseOnboardingWo
setSelectedOptions(newSelectedOptions);
};

const completeOnboarding = useCallback(() => {
completeOnboardingReport({
engagementChoice: CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE,
onboardingMessage: onboardingMessages[CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE],
firstName: currentUserPersonalDetails.firstName,
lastName: currentUserPersonalDetails.lastName,
adminsChatReportID: onboardingAdminsChatReportID,
onboardingPolicyID,
shouldSkipTestDriveModal: !!onboardingPolicyID && !onboardingAdminsChatReportID,
});

setOnboardingAdminsChatReportID();
setOnboardingPolicyID();
const completeOnboarding = useCallback(
(isInvitedAccountant: boolean) => {
completeOnboardingReport({
engagementChoice: CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE,
onboardingMessage: onboardingMessages[CONST.ONBOARDING_CHOICES.TRACK_WORKSPACE],
firstName: currentUserPersonalDetails.firstName,
lastName: currentUserPersonalDetails.lastName,
adminsChatReportID: onboardingAdminsChatReportID,
onboardingPolicyID,
shouldSkipTestDriveModal: !!onboardingPolicyID && !onboardingAdminsChatReportID,
isInvitedAccountant,
});

navigateAfterOnboardingWithMicrotaskQueue(
isSmallScreenWidth,
isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS),
onboardingPolicyID,
setOnboardingAdminsChatReportID();
setOnboardingPolicyID();

navigateAfterOnboardingWithMicrotaskQueue(
isSmallScreenWidth,
isBetaEnabled(CONST.BETAS.DEFAULT_ROOMS),
onboardingPolicyID,
onboardingAdminsChatReportID,
// Onboarding tasks would show in Concierge instead of admins room for testing accounts, we should open where onboarding tasks are located
// See https://github.com/Expensify/App/issues/57167 for more details
(session?.email ?? '').includes('+'),
);
},
[
currentUserPersonalDetails.firstName,
onboardingMessages,
currentUserPersonalDetails.lastName,
onboardingAdminsChatReportID,
// Onboarding tasks would show in Concierge instead of admins room for testing accounts, we should open where onboarding tasks are located
// See https://github.com/Expensify/App/issues/57167 for more details
(session?.email ?? '').includes('+'),
);
}, [
currentUserPersonalDetails.firstName,
onboardingMessages,
currentUserPersonalDetails.lastName,
onboardingAdminsChatReportID,
onboardingPolicyID,
isSmallScreenWidth,
isBetaEnabled,
session?.email,
]);
onboardingPolicyID,
isSmallScreenWidth,
isBetaEnabled,
session?.email,
],
);

const inviteUser = useCallback(() => {
let isValid = true;
Expand All @@ -277,7 +281,7 @@ function BaseOnboardingWorkspaceInvite({shouldUseNativeStyles}: BaseOnboardingWo
});
const policyMemberAccountIDs = Object.values(getMemberAccountIDsForWorkspace(policy?.employeeList, false, false));
addMembersToWorkspace(invitedEmailsToAccountIDs, `${welcomeNoteSubject}\n\n${welcomeNote}`, onboardingPolicyID, policyMemberAccountIDs, CONST.POLICY.ROLE.USER, formatPhoneNumber);
completeOnboarding();
completeOnboarding(true);
}, [completeOnboarding, onboardingPolicyID, policy?.employeeList, selectedOptions, welcomeNote, welcomeNoteSubject, formatPhoneNumber]);

useEffect(() => {
Expand Down Expand Up @@ -305,7 +309,7 @@ function BaseOnboardingWorkspaceInvite({shouldUseNativeStyles}: BaseOnboardingWo
<Button
large
text={translate('common.skip')}
onPress={() => completeOnboarding()}
onPress={() => completeOnboarding(false)}
/>
</View>
<View>
Expand Down
Loading