@@ -346,6 +346,10 @@ type OpenReportActionParams = {
346346 // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424
347347 isSelfTourViewed ?: boolean ;
348348
349+ /** Whether the user has completed the guided setup flow */
350+ // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424
351+ hasCompletedGuidedSetupFlow ?: boolean ;
352+
349353 /** Beta features list */
350354 betas : OnyxEntry < Beta [ ] > ;
351355} ;
@@ -1366,9 +1370,11 @@ function getGuidedSetupDataForOpenReport(
13661370 betas : OnyxEntry < Beta [ ] > ,
13671371 // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424
13681372 isSelfTourViewed ?: boolean ,
1373+ // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424
1374+ hasCompletedGuidedSetupFlow ?: boolean ,
13691375) : GuidedSetupDataForOpenReport | undefined {
13701376 const isInviteOnboardingComplete = introSelected ?. isInviteOnboardingComplete ?? false ;
1371- const isOnboardingCompleted = onboarding ?. hasCompletedGuidedSetupFlow ?? false ;
1377+ const isOnboardingCompleted = hasCompletedGuidedSetupFlow ?? onboarding ?. hasCompletedGuidedSetupFlow ?? false ;
13721378
13731379 // Some cases we can have two open report requests with guide setup data because isInviteOnboardingComplete is not updated completely.
13741380 // Then we need to check the list request and prevent the guided setup data from being duplicated.
@@ -1401,6 +1407,7 @@ function getGuidedSetupDataForOpenReport(
14011407 onboardingMessage,
14021408 companySize : introSelected ?. companySize as OnboardingCompanySize ,
14031409 isSelfTourViewed,
1410+ hasCompletedGuidedSetupFlow,
14041411 betas,
14051412 } ) ;
14061413
@@ -1448,6 +1455,7 @@ function openReport(params: OpenReportActionParams) {
14481455 currentUserLogin,
14491456 currentUserAccountID,
14501457 isSelfTourViewed,
1458+ hasCompletedGuidedSetupFlow,
14511459 betas,
14521460 } = params ;
14531461 if ( ! reportID ) {
@@ -1678,7 +1686,7 @@ function openReport(params: OpenReportActionParams) {
16781686 } ) ;
16791687 }
16801688
1681- const guidedSetup = getGuidedSetupDataForOpenReport ( introSelected , betas , isSelfTourViewed ) ;
1689+ const guidedSetup = getGuidedSetupDataForOpenReport ( introSelected , betas , isSelfTourViewed , hasCompletedGuidedSetupFlow ) ;
16821690 if ( guidedSetup ) {
16831691 optimisticData . push ( ...guidedSetup . optimisticData ) ;
16841692 successData . push ( ...guidedSetup . successData ) ;
@@ -2093,18 +2101,59 @@ function getOptimisticChatReport(accountID: number, currentUserAccountID: number
20932101 } ) ;
20942102}
20952103
2096- function createTransactionThreadReport (
2097- introSelected : OnyxEntry < IntroSelected > ,
2098- currentUserLogin : string ,
2099- currentUserAccountID : number ,
2100- betas : OnyxEntry < Beta [ ] > ,
2101- iouReport ?: OnyxEntry < Report > ,
2102- iouReportAction ?: OnyxEntry < ReportAction > ,
2103- transaction ?: Transaction ,
2104- transactionViolations ?: TransactionViolations ,
2104+ type CreateTransactionThreadReportParams = {
2105+ /** The intro selected by the user */
2106+ introSelected : OnyxEntry < IntroSelected > ;
2107+
2108+ /** The current user's login */
2109+ currentUserLogin : string ;
2110+
2111+ /** The current user's account ID */
2112+ currentUserAccountID : number ;
2113+
2114+ /** Beta features list */
2115+ betas : OnyxEntry < Beta [ ] > ;
2116+
2117+ /** The IOU report that the transaction thread is being created from */
2118+ iouReport ?: OnyxEntry < Report > ;
2119+
2120+ /** The IOU report action that the transaction thread is being created from */
2121+ iouReportAction ?: OnyxEntry < ReportAction > ;
2122+
2123+ /** The transaction object for legacy transactions that don't have a transaction thread or money request preview yet */
2124+ transaction ?: Transaction ;
2125+
2126+ /** The violations for the transaction, if any */
2127+ transactionViolations ?: TransactionViolations ;
2128+
21052129 // TODO: personalDetails should be a required field in follow-up PRs https://github.com/Expensify/App/issues/73656
2106- personalDetails ?: OnyxEntry < PersonalDetailsList > ,
2107- ) : OptimisticChatReport | undefined {
2130+ /** The personal details of the participants */
2131+ personalDetails ?: OnyxEntry < PersonalDetailsList > ;
2132+
2133+ /** Whether the user has seen the self tour */
2134+ // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424
2135+ isSelfTourViewed ?: boolean ;
2136+
2137+ /** Whether the user has completed the guided setup flow */
2138+ // TODO: This will be required eventually. Refactor issue: https://github.com/Expensify/App/issues/66424
2139+ hasCompletedGuidedSetupFlow ?: boolean ;
2140+ } ;
2141+
2142+ function createTransactionThreadReport ( params : CreateTransactionThreadReportParams ) : OptimisticChatReport | undefined {
2143+ const {
2144+ introSelected,
2145+ currentUserLogin,
2146+ currentUserAccountID,
2147+ betas,
2148+ iouReport,
2149+ iouReportAction,
2150+ transaction,
2151+ transactionViolations,
2152+ personalDetails,
2153+ isSelfTourViewed,
2154+ hasCompletedGuidedSetupFlow,
2155+ } = params ;
2156+
21082157 // Determine if we need selfDM report (for track expenses or unreported transactions)
21092158 const isTrackExpense = ! iouReport && ReportActionsUtils . isTrackExpenseAction ( iouReportAction ) ;
21102159 const isUnreportedTransaction = transaction ?. reportID === CONST . REPORT . UNREPORTED_REPORT_ID ;
@@ -2159,6 +2208,8 @@ function createTransactionThreadReport(
21592208 optimisticSelfDMReport,
21602209 currentUserLogin,
21612210 currentUserAccountID,
2211+ isSelfTourViewed,
2212+ hasCompletedGuidedSetupFlow,
21622213 betas,
21632214 } ) ;
21642215 return optimisticTransactionThread ;
@@ -7797,7 +7848,7 @@ function clearConciergeThinkingKickoff() {
77977848 Onyx . set ( ONYXKEYS . CONCIERGE_THINKING_KICKOFF , null ) ;
77987849}
77997850
7800- export type { Video , GuidedSetupData , TaskForParameters , IntroSelected , OpenReportActionParams , ParticipantInfo } ;
7851+ export type { Video , GuidedSetupData , TaskForParameters , IntroSelected , OpenReportActionParams , ParticipantInfo , CreateTransactionThreadReportParams } ;
78017852
78027853export {
78037854 addAttachmentWithComment ,
0 commit comments