Skip to content

Add Chat with setup specialist to the accounting page. #52803

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

Merged
merged 18 commits into from
Dec 11, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
4 changes: 4 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3789,6 +3789,10 @@ const translations = {
xero: 'Xero',
netsuite: 'NetSuite',
intacct: 'Sage Intacct',
talkYourOnboardingSpecialist: 'Chat with your setup specialist.',
talkYourAccountManager: 'Chat with your account manager.',
talkToConcierge: 'Chat with Concierge.',
needAnotherAccounting: 'Need another software? ',
connectionName: ({connectionName}: ConnectionNameParams) => {
switch (connectionName) {
case CONST.POLICY.CONNECTIONS.NAME.QBO:
Expand Down
4 changes: 4 additions & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3796,6 +3796,10 @@ const translations = {
xero: 'Xero',
netsuite: 'NetSuite',
intacct: 'Sage Intacct',
talkYourOnboardingSpecialist: 'Chatea con tu especialista asignado.',
talkYourAccountManager: 'Chatea con tu gestor de cuenta.',
talkToConcierge: 'Chatear con Concierge.',
needAnotherAccounting: '¿Necesitas otro software? ',
connectionName: ({connectionName}: ConnectionNameParams) => {
switch (connectionName) {
case CONST.POLICY.CONNECTIONS.NAME.QBO:
Expand Down
4 changes: 4 additions & 0 deletions src/libs/actions/Report.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4347,6 +4347,9 @@ function exportReportToCSV({reportID, transactionIDList}: ExportReportCSVParams,

fileDownload(ApiUtils.getCommandURL({command: WRITE_COMMANDS.EXPORT_REPORT_TO_CSV}), 'Expensify.csv', '', false, formData, CONST.NETWORK.METHOD.POST, onDownloadFailed);
}
function getConciergeReportID() {
return conciergeChatReportID;
}

export type {Video};

Expand Down Expand Up @@ -4437,4 +4440,5 @@ export {
updateReportName,
updateRoomVisibility,
updateWriteCapability,
getConciergeReportID,
};
33 changes: 32 additions & 1 deletion src/pages/workspace/accounting/PolicyAccountingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import CollapsibleSection from '@components/CollapsibleSection';
import ConfirmModal from '@components/ConfirmModal';
import FormHelpMessage from '@components/FormHelpMessage';
import HeaderWithBackButton from '@components/HeaderWithBackButton';
import Icon from '@components/Icon';
import * as Expensicons from '@components/Icon/Expensicons';
import * as Illustrations from '@components/Icon/Illustrations';
import MenuItem from '@components/MenuItem';
Expand All @@ -28,6 +29,7 @@ import useTheme from '@hooks/useTheme';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import {isAuthenticationError, isConnectionInProgress, isConnectionUnverified, removePolicyConnection, syncConnection} from '@libs/actions/connections';
import {getConciergeReportID} from '@libs/actions/Report';
import * as PolicyUtils from '@libs/PolicyUtils';
import {
areSettingsInErrorFields,
Expand Down Expand Up @@ -74,7 +76,9 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
const [datetimeToRelative, setDateTimeToRelative] = useState('');
const threeDotsMenuContainerRef = useRef<View>(null);
const {startIntegrationFlow, popoverAnchorRefs} = useAccountingContext();

const [account] = useOnyx(ONYXKEYS.ACCOUNT);
// eslint-disable-next-line rulesdir/prefer-shouldUseNarrowLayout-instead-of-isSmallScreenWidth
const {isSmallScreenWidth, isMediumScreenWidth} = useResponsiveLayout();
const route = useRoute();
const params = route.params as RouteParams | undefined;
const newConnectionName = params?.newConnectionName;
Expand Down Expand Up @@ -456,6 +460,20 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
popoverAnchorRefs,
]);

const [chatTextLink, chatReportID] = useMemo(() => {
// If they have an onboarding specialist assigned display the following and link to the #admins room with the setup specialist.
if (account?.adminsRoomReportID) {
return [translate('workspace.accounting.talkYourOnboardingSpecialist'), account?.adminsRoomReportID];
}

// If not, if they have an account manager assigned display the following and link to the DM with their account manager.
if (account?.accountManagerAccountID) {
return [translate('workspace.accounting.talkYourAccountManager'), account?.accountManagerReportID];
}
// Else, display the following and link to their Concierge DM.
return [translate('workspace.accounting.talkToConcierge'), getConciergeReportID()];
}, [account, translate]);

return (
<AccessOrNotFoundWrapper
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
Expand Down Expand Up @@ -543,6 +561,19 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
/>
</CollapsibleSection>
)}
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mt2]}>
<Icon
src={Expensicons.QuestionMark}
width={20}
height={20}
fill={theme.icon}
additionalStyles={styles.mr3}
/>
<View style={[isSmallScreenWidth || isMediumScreenWidth ? styles.flexColumn : styles.flexRow]}>
<Text>{translate('workspace.accounting.needAnotherAccounting')}</Text>
<TextLink onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chatReportID ?? ''))}>{chatTextLink}</TextLink>
</View>
</View>
</Section>
</View>
</ScrollView>
Expand Down
9 changes: 9 additions & 0 deletions src/types/onyx/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,15 @@ type Account = {
/** The primaryLogin associated with the account */
primaryLogin?: string;

/** The Report ID of the admins room */
adminsRoomReportID?: string;

/** The Account ID of the account manager */
accountManagerAccountID?: string;

/** The Report ID of the account manager */
accountManagerReportID?: string;

/** The message to be displayed when code requested */
message?: string;

Expand Down
Loading