Skip to content

Commit

Permalink
Fix tests and pass all data to prepareOnboardingOptimisticData
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejkustra committed Nov 6, 2024
1 parent 5278d20 commit d0f451a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/libs/actions/IOU.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7648,7 +7648,7 @@ function cancelPayment(expenseReport: OnyxEntry<OnyxTypes.Report>, chatReport: O
function completePaymentOnboarding(paymentSelected: ValueOf<typeof CONST.PAYMENT_SELECTED>) {
const isInviteOnboardingComplete = introSelected?.isInviteOnboardingComplete ?? false;

if (isInviteOnboardingComplete ?? !introSelected?.choice) {
if (isInviteOnboardingComplete || !introSelected?.choice) {
return;
}

Expand All @@ -7657,12 +7657,12 @@ function completePaymentOnboarding(paymentSelected: ValueOf<typeof CONST.PAYMENT
const personalDetailsListValues = Object.values(OptionsListUtils.getPersonalDetailsForAccountIDs(session?.accountID ? [session.accountID] : [], personalDetailsList));
const personalDetails = personalDetailsListValues.at(0);

let onboardingPurpose = introSelected.choice;
if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.IOU.PAYMENT_SELECTED.BBA) {
let onboardingPurpose = introSelected?.choice;
if (introSelected?.inviteType === CONST.ONBOARDING_INVITE_TYPES.IOU && paymentSelected === CONST.IOU.PAYMENT_SELECTED.BBA) {
onboardingPurpose = CONST.ONBOARDING_CHOICES.MANAGE_TEAM;
}

if (introSelected.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.IOU.PAYMENT_SELECTED.BBA) {
if (introSelected?.inviteType === CONST.ONBOARDING_INVITE_TYPES.INVOICE && paymentSelected !== CONST.IOU.PAYMENT_SELECTED.BBA) {
onboardingPurpose = CONST.ONBOARDING_CHOICES.CHAT_SPLIT;
}

Expand Down
9 changes: 7 additions & 2 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3460,7 +3460,6 @@ function prepareOnboardingOptimisticData(
data: ValueOf<typeof CONST.ONBOARDING_MESSAGES>,
adminsChatReportID?: string,
onboardingPolicyID?: string,
companySize?: OnboardingCompanySize,
userReportedIntegration?: OnboardingAccounting,
) {
// If the user has the "combinedTrackSubmit" beta enabled we'll show different tasks for track and submit expense.
Expand Down Expand Up @@ -3886,7 +3885,13 @@ function completeOnboarding(
companySize?: OnboardingCompanySize,
userReportedIntegration?: OnboardingAccounting,
) {
const {optimisticData, successData, failureData, guidedSetupData, actorAccountID} = prepareOnboardingOptimisticData(engagementChoice, data, adminsChatReportID, onboardingPolicyID);
const {optimisticData, successData, failureData, guidedSetupData, actorAccountID} = prepareOnboardingOptimisticData(
engagementChoice,
data,
adminsChatReportID,
onboardingPolicyID,
userReportedIntegration,
);

const parameters: CompleteGuidedSetupParams = {
engagementChoice,
Expand Down

0 comments on commit d0f451a

Please sign in to comment.