Repository navigation
[Payment due @mkhutornyi] Add ask Concierge screen #100552
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rushatgabhane
wants to merge
180
commits into
Expensify:main
Choose a base branch
from
rushatgabhane:concierge-ask-design
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+1,604
−952
Open
Changes from all commits
Commits
Show all changes
180 commits
Select commit
Hold shift + click to select a range
cdea881
Ask Concierge design
rushatgabhane f6bb415
Fix CI failures
rushatgabhane 40ce940
Merge main
rushatgabhane 60fe442
Fix Button import
rushatgabhane 95be964
Remove quick actions
rushatgabhane a666030
Center welcome layout
rushatgabhane 7329000
Responsive column width
rushatgabhane 8260e1f
Remove top margin
rushatgabhane dbbb733
Rotate placeholder
rushatgabhane 82a7efd
Reuse existing placeholders
rushatgabhane 47eb7f4
Remove list padding
rushatgabhane 43392ff
Fix history toggle
rushatgabhane 05f6511
Fix title line height
rushatgabhane b44fa4c
Own welcome typography
rushatgabhane 25df82d
Always show toggle
rushatgabhane 405db86
Space welcome divider
rushatgabhane 6a5df9b
Fix session race
rushatgabhane ea11c45
Add placeholder rotation
rushatgabhane eca32a2
Revert "Fix session race"
rushatgabhane f68bab5
Reapply "Fix session race"
rushatgabhane c5c9975
Fix CI checks
rushatgabhane c278aec
Drop CSV placeholder
rushatgabhane 134ddab
Revert "Drop CSV placeholder"
rushatgabhane 0f7309a
Fix history toggle
rushatgabhane 75caf8d
Drop comment
rushatgabhane 3e8dfe7
Welcome instead of skeleton
rushatgabhane dbb3eee
Keep onboarding passthrough
rushatgabhane 7c9c6bd
Remove unused asset
rushatgabhane df8069e
Rename welcome component
rushatgabhane 9e7242b
Add regression test
rushatgabhane 7b057b0
Drop comments
rushatgabhane 16d4486
Drop comment
rushatgabhane 5faf565
Fix review findings
rushatgabhane c6aeb51
Test side panel button
rushatgabhane bc17861
Test toggle and empty state
rushatgabhane fa10412
Fix mock scope
rushatgabhane f693e6d
Fix toggle label source
rushatgabhane b84021c
Hide locked toggle
rushatgabhane 56522fb
Unlock history toggle
rushatgabhane 5bf9f36
Hide returns to empty state
rushatgabhane 4c25305
Restore welcome toggle
rushatgabhane a384472
Load locale in tests
rushatgabhane ca23148
Single history source
rushatgabhane ce51952
Test ask state hook
rushatgabhane 841e68a
Keep hide working
rushatgabhane 298843a
Fix CI failures
rushatgabhane b0ccfb3
Fix landscape layout
rushatgabhane c39ff93
Fix CI failures
rushatgabhane c472804
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane e88ee96
Address review feedback
rushatgabhane a0a44ba
Improve comments
rushatgabhane fd9b205
Fix welcome layout
rushatgabhane b35ad4c
Add concierge welcome tests
rushatgabhane ac2a83c
Fix lint errors
rushatgabhane 1ef742b
Dock composer bottom
rushatgabhane afa8d95
Merge remote-tracking branch 'upstream/main' into concierge-ask-design
rushatgabhane 066d51b
Mock useConciergeAskState in ReportActionsListPaddingView test
rushatgabhane e4b314e
Center welcome only on wide layout
rushatgabhane 6b32d8e
Keep welcome while question opens its thread
rushatgabhane 1ee6a03
Pad welcome description
rushatgabhane 81a90ff
Keep Concierge welcome consistent and pad welcome description
MelvinBot 6b155cc
Merge remote-tracking branch 'origin/main' into concierge-ask-design
MelvinBot 1a099e8
Address review comments on the Ask Concierge screen
rushatgabhane 0bfc66a
Merge remote-tracking branch 'upstream/main' into concierge-ask-design
rushatgabhane fcc7c62
Rename the history check to fix spellcheck
rushatgabhane 360eee2
Return a route from the useRoute mock in ReportActionsListTest
rushatgabhane f68ae5e
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane d50e8b8
Remove the conciergeRespondInThread beta
rushatgabhane 3233984
Drop the conciergeRespondInThread beta checks from the Ask Concierge …
rushatgabhane f2e0cca
Update Ask Concierge tests for the removed beta
rushatgabhane e434431
Hide the Concierge greeting in the main Concierge chat
rushatgabhane 840e6e0
Drop the beta from the Ask Concierge state doc comment
rushatgabhane ec355e8
Revert "Hide the Concierge greeting in the main Concierge chat"
rushatgabhane 616c0a6
Merge remote-tracking branch 'origin/main' into concierge-ask-design
MelvinBot 5039f13
Merge remote-tracking branch 'origin/main' into concierge-ask-design
MelvinBot 6d108a8
Update useAskConcierge tests for removed Concierge thread beta
MelvinBot 78f08c1
Show the New chat button only on Concierge chat threads
rushatgabhane 9c9df70
Keep the Concierge welcome after creating a task in the chat
rushatgabhane 8a96c8d
Revert "Show the New chat button only on Concierge chat threads"
rushatgabhane 38515ce
Merge remote-tracking branch 'origin/concierge-ask-design' into conci…
rushatgabhane 78c1e5d
Document the Concierge tests with Given, When and Then
rushatgabhane ef562c5
Keep the Concierge welcome while older messages are still unloaded
rushatgabhane f3acff1
Drop manual memoization from resetSession
rushatgabhane a71596c
Fix the grammar of the reimbursement prompt
rushatgabhane 6914c25
Show the chat history after creating a task in Concierge
rushatgabhane a1b5ff3
Merge remote-tracking branch 'origin/main' into concierge-ask-design
MelvinBot 7b28190
Show the chat history after sending several attachments to Concierge
rushatgabhane 4735764
Keep an open Concierge task on screen instead of the welcome
rushatgabhane 675535b
Hide the Ask a new question label while the composer is full size
rushatgabhane e24e81c
Start a new Concierge thread from Search while the side panel shows a…
rushatgabhane 48e768b
Merge remote-tracking branch 'upstream/main' into concierge-ask-design
rushatgabhane 20ab913
Return to the Concierge welcome when hiding history after sending sev…
rushatgabhane 9a8cf01
Use a camelCase error key in the Concierge ask state test
rushatgabhane 427f1aa
Build optimistic comments with several attachments
rushatgabhane 1c872d5
Send extra attachments in the same AddAttachment request
rushatgabhane 9c3556f
Open a Concierge thread for messages with several attachments
rushatgabhane 70bc106
Re-read every attachment file for requests queued offline
rushatgabhane 623ee00
Test that several attachments open one Concierge thread
rushatgabhane a84b7bc
Reconcile every queued attachment when editing a message
rushatgabhane ca486db
Space out file attachments in a message
rushatgabhane e87d4d0
Drop the chat history toggle for attachments that stay in the Concier…
rushatgabhane bcd753a
Revert "Use a camelCase error key in the Concierge ask state test"
rushatgabhane 1053614
Revert "Return to the Concierge welcome when hiding history after sen…
rushatgabhane 727b7bc
Read the Concierge history flag straight from the session in the list…
rushatgabhane 4f220af
Fold the side panel check into the Concierge check
rushatgabhane de7c33d
Drop the isAskConciergeEnabled alias in the header
rushatgabhane 1538cae
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane 64f75c7
Match extra attachment file keys with one shared regex
rushatgabhane 529469c
Simplify rewriting a queued request's attachments after an edit
rushatgabhane 804aff5
Fix ESLint errors in queued attachment edit handling
MelvinBot aa9baee
Merge remote-tracking branch 'upstream/main' into concierge-ask-design
rushatgabhane 7be9669
Replace the Concierge session context with a chat history context
rushatgabhane f525f7b
Stop starting and resetting a Concierge session in the main chat
rushatgabhane a1b73de
Show the main Concierge chat unfiltered once its history is expanded
rushatgabhane c4d1ff7
Decide the Concierge welcome screen without a session timestamp
rushatgabhane 5021743
Scan Concierge actions once, and only in the main Concierge chat
rushatgabhane cfa81b4
Update Concierge tests for the removed session
rushatgabhane ec221b3
Drop main Concierge chat cases from side panel and skeleton tests
rushatgabhane a7ea87c
Update the list UI test for the main Concierge chat without a session
rushatgabhane 559af84
Show the Concierge welcome even with an open task or a linked message
rushatgabhane 151db49
Close the open-report and send-message spans from the Concierge welcome
rushatgabhane c74cdf7
Keep every synced attachment when saving an edit made mid-upload
rushatgabhane 5e04cc8
Drop the unused main chat flag and old session wording
rushatgabhane 6682743
Remove unnecessary comments
rushatgabhane 98716c6
Add tests for the Concierge welcome, New chat button, and new questio…
rushatgabhane 937aafc
Match edited attachments by attachment ID
rushatgabhane a84ed29
Keep measuring sends from the Concierge welcome screen
rushatgabhane 8ab8477
Remove Concierge ask state tests that cannot fail
rushatgabhane 5862a8f
Drop a stale Concierge test and always restore the navigate spy
rushatgabhane 45dbfa0
Drop an unused test helper parameter
rushatgabhane ab2a969
Reuse the shared session account ID selector
rushatgabhane c0175cc
Restore the side panel's earlier-messages check
rushatgabhane fb0a4c4
Only scan Concierge messages where the welcome screen is decided
rushatgabhane 0cf0d7d
Fall back to matching edited attachments by position
rushatgabhane b5551af
Decide the Concierge welcome screen once in the list model
rushatgabhane 6fe2b32
Drive the Concierge welcome list test from report actions
rushatgabhane 6882047
Revert unrelated button and attachment spacing changes, drop the stat…
rushatgabhane a84b9e1
Test each Concierge welcome state on its own
rushatgabhane 13c0c1f
Type the Concierge test report actions without casts
rushatgabhane 096bbff
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane 7119b2b
Use replaceAll for local attachment references
rushatgabhane 4960ab5
Fix lint and type errors in Concierge tests
rushatgabhane 0ce7202
Render the Concierge thread header with a real parent question
rushatgabhane b11501f
Mock focus state in the ReportFooter test
rushatgabhane 97e5317
Merge remote-tracking branch 'origin/concierge-ask-design' into conci…
rushatgabhane 4ade97f
Merge remote-tracking branch 'upstream/main' into HEAD
rushatgabhane af9e242
Fix ESLint errors in Concierge tests
rushatgabhane e3f0371
Fix ESLint restricted Animated import in useShouldSuppressConciergeIn…
MelvinBot 5fa9601
Keep unread and failed Concierge messages on screen instead of the we…
rushatgabhane c3c08be
Show a task sent from Search in the expanded Concierge chat history
rushatgabhane b227fc1
Use typographic apostrophes in the French Concierge placeholders
rushatgabhane b1df0ab
Add Given/When/Then comments to the several-attachment edit tests
rushatgabhane 41971d5
Test that every attachment of an offline message is read on native
rushatgabhane c1886ca
Show the Concierge chat when opened from a link to a message
rushatgabhane 54b9bfc
Fix typecheck and ESLint errors in Concierge and prepareRequestPayloa…
MelvinBot 7d9d7b3
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane f4a7288
Hide New chat on tasks under the Concierge chat
rushatgabhane 1259a98
Revert "Hide New chat on tasks under the Concierge chat"
rushatgabhane 1eaf378
Base the Concierge unread check on the report and mark it read on Hid…
rushatgabhane c5a928f
Match kept attachments by file name when editing after a restart
rushatgabhane aae443e
Apply the selector to the Concierge report in the ReportActionsList t…
rushatgabhane ad56bb3
Type the Concierge report selector in the ReportActionsList test mock
rushatgabhane 4d2fba0
Always show the Concierge chat history toggle
rushatgabhane 2a50da7
Show the Concierge welcome after the user hides chat history
rushatgabhane 2bb6c1e
Fix types after the chat history toggle changes
rushatgabhane 61da0f8
Match same-named attachments to different synced attachments
rushatgabhane 88c74a8
Simplify same-name attachment matching
rushatgabhane 068fe8d
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane 9213648
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane 9e3c4f0
Merge remote-tracking branch 'upstream/main' into concierge-ask-design
rushatgabhane 01977a5
Merge remote-tracking branch 'origin/concierge-ask-design' into conci…
rushatgabhane 937131d
Stop exporting getUploadingAttachmentSource
rushatgabhane d268b20
Use the shared readFileAsync mock in the multi-attachment payload test
rushatgabhane 6951094
Key renamed attachment labels by a named attachment ID in tests
rushatgabhane 80afd0a
Show the Concierge welcome to users who never messaged Concierge
rushatgabhane ff1edce
Fold the Concierge welcome tests into one case
rushatgabhane 529ef45
Merge remote-tracking branch 'upstream/main' into concierge-ask-design
rushatgabhane 779dd28
Address Ask Concierge review comments
rushatgabhane 4af61f1
Merge remote-tracking branch 'upstream/main' into concierge-ask-design
rushatgabhane 904fc5c
Merge branch 'Expensify:main' into concierge-ask-design
rushatgabhane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| import type {PlatformStackRouteProp} from '@libs/Navigation/PlatformStackNavigation/types'; | ||
| import type {ReportsSplitNavigatorParamList} from '@libs/Navigation/types'; | ||
|
|
||
| import {useConciergeChatHistoryState} from '@pages/inbox/ConciergeChatHistoryContext'; | ||
|
|
||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
| import type SCREENS from '@src/SCREENS'; | ||
| import type {Report} from '@src/types/onyx'; | ||
| import type {ReportActions} from '@src/types/onyx/ReportAction'; | ||
| import {isEmptyObject} from '@src/types/utils/EmptyObject'; | ||
|
|
||
| import type {OnyxEntry} from 'react-native-onyx'; | ||
|
|
||
| import {useRoute} from '@react-navigation/native'; | ||
|
|
||
| import useCurrentUserPersonalDetails from './useCurrentUserPersonalDetails'; | ||
| import useIsAskConciergeChat from './useIsAskConciergeChat'; | ||
| import useOnyx from './useOnyx'; | ||
| import useResponsiveLayout from './useResponsiveLayout'; | ||
|
|
||
| type ConciergeAskState = { | ||
| /** Whether the earlier conversation of the Concierge chat in the Inbox is shown */ | ||
| isHistoryExpanded: boolean; | ||
|
|
||
| /** Whether to show the `Ask me anything!` welcome screen in place of the messages */ | ||
| shouldShowWelcome: boolean; | ||
|
|
||
| /** Whether the welcome screen and the composer are centered together on the screen */ | ||
| shouldCenterWelcomeWithComposer: boolean; | ||
|
|
||
| /** Whether the Concierge chat has a message from someone else that the user hasn't read */ | ||
| hasUnreadMessageFromOthers: boolean; | ||
| }; | ||
|
|
||
| function useConciergeAskState(reportID: string | undefined): ConciergeAskState { | ||
| const isAskConciergeChat = useIsAskConciergeChat(reportID); | ||
| const {shouldUseNarrowLayout} = useResponsiveLayout(); | ||
| const {showFullHistory, isHistoryCollapsedByUser} = useConciergeChatHistoryState(); | ||
| const route = useRoute<PlatformStackRouteProp<ReportsSplitNavigatorParamList, typeof SCREENS.REPORT>>(); | ||
| const {accountID: currentUserAccountID} = useCurrentUserPersonalDetails(); | ||
|
|
||
| const hasFailedSendSelector = (actions: OnyxEntry<ReportActions>) => { | ||
| if (!isAskConciergeChat || !actions) { | ||
| return false; | ||
| } | ||
|
|
||
| // A failed send stays on screen so the user can retry or dismiss it. | ||
| return Object.values(actions).some((action) => !isEmptyObject(action.errors)); | ||
| }; | ||
| const [hasFailedSend] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, { | ||
| selector: hasFailedSendSelector, | ||
| }); | ||
|
|
||
| const hasUnreadMessageFromOthersSelector = (report: OnyxEntry<Report>) => | ||
| isAskConciergeChat && !!report?.lastReadTime && (report.lastVisibleActionCreated ?? '') > report.lastReadTime && report.lastActorAccountID !== currentUserAccountID; | ||
| const [hasUnreadMessageFromOthers = false] = useOnyx(`${ONYXKEYS.COLLECTION.REPORT}${reportID}`, { | ||
| selector: hasUnreadMessageFromOthersSelector, | ||
| }); | ||
|
|
||
| const isHistoryExpanded = isAskConciergeChat && (showFullHistory || !!route.params?.reportActionID); | ||
| const shouldShowWelcome = isAskConciergeChat && !isHistoryExpanded && (isHistoryCollapsedByUser || !hasFailedSend) && !hasUnreadMessageFromOthers; | ||
|
|
||
| return { | ||
| isHistoryExpanded, | ||
| shouldShowWelcome, | ||
| shouldCenterWelcomeWithComposer: shouldShowWelcome && !shouldUseNarrowLayout, | ||
| hasUnreadMessageFromOthers, | ||
| }; | ||
| } | ||
|
|
||
| export default useConciergeAskState; |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import ONYXKEYS from '@src/ONYXKEYS'; | ||
|
|
||
| import useIsInSidePanel from './useIsInSidePanel'; | ||
| import useOnyx from './useOnyx'; | ||
|
|
||
| /** Whether the report is the Concierge chat in the Inbox */ | ||
| function useIsAskConciergeChat(reportID: string | undefined): boolean { | ||
| const isInSidePanel = useIsInSidePanel(); | ||
| const [conciergeReportID] = useOnyx(ONYXKEYS.CONCIERGE_REPORT_ID); | ||
| return !!reportID && reportID === conciergeReportID && !isInSidePanel; | ||
| } | ||
|
|
||
| export default useIsAskConciergeChat; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.