Skip to content

Commit dac90e1

Browse files
authored
Merge pull request #52803 from nkdengineer/fix/51487
Add Chat with setup specialist to the accounting page.
2 parents f8f12c2 + bbb44e6 commit dac90e1

File tree

9 files changed

+87
-1
lines changed

9 files changed

+87
-1
lines changed

src/languages/en.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3815,6 +3815,10 @@ const translations = {
38153815
xero: 'Xero',
38163816
netsuite: 'NetSuite',
38173817
intacct: 'Sage Intacct',
3818+
talkYourOnboardingSpecialist: 'Chat with your setup specialist.',
3819+
talkYourAccountManager: 'Chat with your account manager.',
3820+
talkToConcierge: 'Chat with Concierge.',
3821+
needAnotherAccounting: 'Need another accounting software? ',
38183822
connectionName: ({connectionName}: ConnectionNameParams) => {
38193823
switch (connectionName) {
38203824
case CONST.POLICY.CONNECTIONS.NAME.QBO:

src/languages/es.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3823,6 +3823,10 @@ const translations = {
38233823
xero: 'Xero',
38243824
netsuite: 'NetSuite',
38253825
intacct: 'Sage Intacct',
3826+
talkYourOnboardingSpecialist: 'Chatea con tu especialista asignado.',
3827+
talkYourAccountManager: 'Chatea con tu gestor de cuenta.',
3828+
talkToConcierge: 'Chatear con Concierge.',
3829+
needAnotherAccounting: '¿Necesitas otro software de contabilidad? ',
38263830
connectionName: ({connectionName}: ConnectionNameParams) => {
38273831
switch (connectionName) {
38283832
case CONST.POLICY.CONNECTIONS.NAME.QBO:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
type GetAssignedSupportDataParams = {
2+
policyID: string;
3+
};
4+
5+
export default GetAssignedSupportDataParams;

src/libs/API/parameters/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ export type {default as ExportReportCSVParams} from './ExportReportCSVParams';
282282
export type {default as UpdateExpensifyCardLimitParams} from './UpdateExpensifyCardLimitParams';
283283
export type {CreateWorkspaceApprovalParams, UpdateWorkspaceApprovalParams, RemoveWorkspaceApprovalParams} from './WorkspaceApprovalParams';
284284
export type {default as StartIssueNewCardFlowParams} from './StartIssueNewCardFlowParams';
285+
export type {default as GetAssignedSupportDataParams} from './GetAssignedSupportDataParams';
285286
export type {default as ConnectAsDelegateParams} from './ConnectAsDelegateParams';
286287
export type {default as SetPolicyRulesEnabledParams} from './SetPolicyRulesEnabledParams';
287288
export type {default as SetPolicyDefaultReportTitleParams} from './SetPolicyDefaultReportTitle';

src/libs/API/types.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -951,6 +951,7 @@ const READ_COMMANDS = {
951951
OPEN_DRAFT_DISTANCE_EXPENSE: 'OpenDraftDistanceExpense',
952952
START_ISSUE_NEW_CARD_FLOW: 'StartIssueNewCardFlow',
953953
OPEN_CARD_DETAILS_PAGE: 'OpenCardDetailsPage',
954+
GET_ASSIGNED_SUPPORT_DATA: 'GetAssignedSupportData',
954955
} as const;
955956

956957
type ReadCommand = ValueOf<typeof READ_COMMANDS>;
@@ -1013,6 +1014,7 @@ type ReadCommandParameters = {
10131014
[READ_COMMANDS.OPEN_DRAFT_DISTANCE_EXPENSE]: null;
10141015
[READ_COMMANDS.START_ISSUE_NEW_CARD_FLOW]: Parameters.StartIssueNewCardFlowParams;
10151016
[READ_COMMANDS.OPEN_CARD_DETAILS_PAGE]: Parameters.OpenCardDetailsPageParams;
1017+
[READ_COMMANDS.GET_ASSIGNED_SUPPORT_DATA]: Parameters.GetAssignedSupportDataParams;
10161018
};
10171019

10181020
const SIDE_EFFECT_REQUEST_COMMANDS = {

src/libs/actions/Policy/Policy.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import type {
2424
EnablePolicyReportFieldsParams,
2525
EnablePolicyTaxesParams,
2626
EnablePolicyWorkflowsParams,
27+
GetAssignedSupportDataParams,
2728
LeavePolicyParams,
2829
OpenDraftWorkspaceRequestParams,
2930
OpenPolicyEditCardLimitTypePageParams,
@@ -4602,6 +4603,13 @@ function updateInvoiceCompanyWebsite(policyID: string, companyWebsite: string) {
46024603
API.write(WRITE_COMMANDS.UPDATE_INVOICE_COMPANY_WEBSITE, parameters, {optimisticData, successData, failureData});
46034604
}
46044605

4606+
function getAssignedSupportData(policyID: string) {
4607+
const parameters: GetAssignedSupportDataParams = {
4608+
policyID,
4609+
};
4610+
API.read(READ_COMMANDS.GET_ASSIGNED_SUPPORT_DATA, parameters);
4611+
}
4612+
46054613
export {
46064614
leaveWorkspace,
46074615
addBillingCardAndRequestPolicyOwnerChange,
@@ -4697,6 +4705,7 @@ export {
46974705
verifySetupIntentAndRequestPolicyOwnerChange,
46984706
updateInvoiceCompanyName,
46994707
updateInvoiceCompanyWebsite,
4708+
getAssignedSupportData,
47004709
};
47014710

47024711
export type {NewCustomUnit};

src/libs/actions/Report.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4445,6 +4445,9 @@ function exportReportToCSV({reportID, transactionIDList}: ExportReportCSVParams,
44454445

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

44494452
function setDeleteTransactionNavigateBackUrl(url: string) {
44504453
Onyx.set(ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL, url);
@@ -4543,6 +4546,7 @@ export {
45434546
updateReportName,
45444547
updateRoomVisibility,
45454548
updateWriteCapability,
4549+
getConciergeReportID,
45464550
setDeleteTransactionNavigateBackUrl,
45474551
clearDeleteTransactionNavigateBackUrl,
45484552
};

src/pages/workspace/accounting/PolicyAccountingPage.tsx

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import CollapsibleSection from '@components/CollapsibleSection';
77
import ConfirmModal from '@components/ConfirmModal';
88
import FormHelpMessage from '@components/FormHelpMessage';
99
import HeaderWithBackButton from '@components/HeaderWithBackButton';
10+
import Icon from '@components/Icon';
1011
import * as Expensicons from '@components/Icon/Expensicons';
1112
import * as Illustrations from '@components/Icon/Illustrations';
1213
import MenuItem from '@components/MenuItem';
@@ -28,6 +29,8 @@ import useTheme from '@hooks/useTheme';
2829
import useThemeStyles from '@hooks/useThemeStyles';
2930
import useWindowDimensions from '@hooks/useWindowDimensions';
3031
import {isAuthenticationError, isConnectionInProgress, isConnectionUnverified, removePolicyConnection, syncConnection} from '@libs/actions/connections';
32+
import {getAssignedSupportData} from '@libs/actions/Policy/Policy';
33+
import {getConciergeReportID} from '@libs/actions/Report';
3134
import * as PolicyUtils from '@libs/PolicyUtils';
3235
import {
3336
areSettingsInErrorFields,
@@ -75,7 +78,8 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
7578
const [datetimeToRelative, setDateTimeToRelative] = useState('');
7679
const threeDotsMenuContainerRef = useRef<View>(null);
7780
const {startIntegrationFlow, popoverAnchorRefs} = useAccountingContext();
78-
81+
const [account] = useOnyx(ONYXKEYS.ACCOUNT);
82+
const {isLargeScreenWidth} = useResponsiveLayout();
7983
const route = useRoute();
8084
const params = route.params as RouteParams | undefined;
8185
const newConnectionName = params?.newConnectionName;
@@ -172,6 +176,13 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
172176
setDateTimeToRelative('');
173177
}, [getDatetimeToRelative, successfulDate]);
174178

179+
useEffect(() => {
180+
if (!policyID) {
181+
return;
182+
}
183+
getAssignedSupportData(policyID);
184+
}, [policyID]);
185+
175186
const integrationSpecificMenuItems = useMemo(() => {
176187
const sageIntacctEntityList = policy?.connections?.intacct?.data?.entities ?? [];
177188
const netSuiteSubsidiaryList = policy?.connections?.netsuite?.options?.data?.subsidiaryList ?? [];
@@ -459,6 +470,20 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
459470
popoverAnchorRefs,
460471
]);
461472

473+
const [chatTextLink, chatReportID] = useMemo(() => {
474+
// If they have an onboarding specialist assigned display the following and link to the #admins room with the setup specialist.
475+
if (account?.adminsRoomReportID) {
476+
return [translate('workspace.accounting.talkYourOnboardingSpecialist'), account?.adminsRoomReportID];
477+
}
478+
479+
// If not, if they have an account manager assigned display the following and link to the DM with their account manager.
480+
if (account?.accountManagerAccountID) {
481+
return [translate('workspace.accounting.talkYourAccountManager'), account?.accountManagerReportID];
482+
}
483+
// Else, display the following and link to their Concierge DM.
484+
return [translate('workspace.accounting.talkToConcierge'), getConciergeReportID()];
485+
}, [account, translate]);
486+
462487
return (
463488
<AccessOrNotFoundWrapper
464489
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
@@ -546,6 +571,21 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
546571
/>
547572
</CollapsibleSection>
548573
)}
574+
{!!account?.guideDetails?.email && (
575+
<View style={[styles.flexRow, styles.alignItemsCenter, styles.mt7]}>
576+
<Icon
577+
src={Expensicons.QuestionMark}
578+
width={20}
579+
height={20}
580+
fill={theme.icon}
581+
additionalStyles={styles.mr3}
582+
/>
583+
<View style={[!isLargeScreenWidth ? styles.flexColumn : styles.flexRow]}>
584+
<Text style={styles.textSupporting}>{translate('workspace.accounting.needAnotherAccounting')}</Text>
585+
<TextLink onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chatReportID ?? ''))}>{chatTextLink}</TextLink>
586+
</View>
587+
</View>
588+
)}
549589
</Section>
550590
</View>
551591
</ScrollView>

src/types/onyx/Account.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,15 @@ type Account = {
101101
/** The primaryLogin associated with the account */
102102
primaryLogin?: string;
103103

104+
/** The Report ID of the admins room */
105+
adminsRoomReportID?: string;
106+
107+
/** The Account ID of the account manager */
108+
accountManagerAccountID?: string;
109+
110+
/** The Report ID of the account manager */
111+
accountManagerReportID?: string;
112+
104113
/** The message to be displayed when code requested */
105114
message?: string;
106115

@@ -157,6 +166,14 @@ type Account = {
157166

158167
/** Indicates SMS delivery failure status and associated information */
159168
smsDeliveryFailureStatus?: SMSDeliveryFailureStatus;
169+
170+
/** The guide details of the account */
171+
guideDetails?: {
172+
/** The email of the guide details */
173+
email: string;
174+
/** The calendar link of the guide details */
175+
calendarLink: string;
176+
};
160177
};
161178

162179
export default Account;

0 commit comments

Comments
 (0)