diff --git a/src/languages/en.ts b/src/languages/en.ts index 381ea9f063f1..7088d9df8a51 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3815,6 +3815,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 accounting software? ', connectionName: ({connectionName}: ConnectionNameParams) => { switch (connectionName) { case CONST.POLICY.CONNECTIONS.NAME.QBO: diff --git a/src/languages/es.ts b/src/languages/es.ts index 0777a66a8cc1..47e11bf716ac 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3823,6 +3823,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 de contabilidad? ', connectionName: ({connectionName}: ConnectionNameParams) => { switch (connectionName) { case CONST.POLICY.CONNECTIONS.NAME.QBO: diff --git a/src/libs/API/parameters/GetAssignedSupportDataParams.ts b/src/libs/API/parameters/GetAssignedSupportDataParams.ts new file mode 100644 index 000000000000..dcdc4bf99b0c --- /dev/null +++ b/src/libs/API/parameters/GetAssignedSupportDataParams.ts @@ -0,0 +1,5 @@ +type GetAssignedSupportDataParams = { + policyID: string; +}; + +export default GetAssignedSupportDataParams; diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index 837fc9189e56..c89f98825eed 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -282,6 +282,7 @@ export type {default as ExportReportCSVParams} from './ExportReportCSVParams'; export type {default as UpdateExpensifyCardLimitParams} from './UpdateExpensifyCardLimitParams'; export type {CreateWorkspaceApprovalParams, UpdateWorkspaceApprovalParams, RemoveWorkspaceApprovalParams} from './WorkspaceApprovalParams'; export type {default as StartIssueNewCardFlowParams} from './StartIssueNewCardFlowParams'; +export type {default as GetAssignedSupportDataParams} from './GetAssignedSupportDataParams'; export type {default as ConnectAsDelegateParams} from './ConnectAsDelegateParams'; export type {default as SetPolicyRulesEnabledParams} from './SetPolicyRulesEnabledParams'; export type {default as SetPolicyDefaultReportTitleParams} from './SetPolicyDefaultReportTitle'; diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index e7df0cc6a282..f632abd13105 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -951,6 +951,7 @@ const READ_COMMANDS = { OPEN_DRAFT_DISTANCE_EXPENSE: 'OpenDraftDistanceExpense', START_ISSUE_NEW_CARD_FLOW: 'StartIssueNewCardFlow', OPEN_CARD_DETAILS_PAGE: 'OpenCardDetailsPage', + GET_ASSIGNED_SUPPORT_DATA: 'GetAssignedSupportData', } as const; type ReadCommand = ValueOf; @@ -1013,6 +1014,7 @@ type ReadCommandParameters = { [READ_COMMANDS.OPEN_DRAFT_DISTANCE_EXPENSE]: null; [READ_COMMANDS.START_ISSUE_NEW_CARD_FLOW]: Parameters.StartIssueNewCardFlowParams; [READ_COMMANDS.OPEN_CARD_DETAILS_PAGE]: Parameters.OpenCardDetailsPageParams; + [READ_COMMANDS.GET_ASSIGNED_SUPPORT_DATA]: Parameters.GetAssignedSupportDataParams; }; const SIDE_EFFECT_REQUEST_COMMANDS = { diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 8ec6deb78f42..25f50519ff14 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -24,6 +24,7 @@ import type { EnablePolicyReportFieldsParams, EnablePolicyTaxesParams, EnablePolicyWorkflowsParams, + GetAssignedSupportDataParams, LeavePolicyParams, OpenDraftWorkspaceRequestParams, OpenPolicyEditCardLimitTypePageParams, @@ -4602,6 +4603,13 @@ function updateInvoiceCompanyWebsite(policyID: string, companyWebsite: string) { API.write(WRITE_COMMANDS.UPDATE_INVOICE_COMPANY_WEBSITE, parameters, {optimisticData, successData, failureData}); } +function getAssignedSupportData(policyID: string) { + const parameters: GetAssignedSupportDataParams = { + policyID, + }; + API.read(READ_COMMANDS.GET_ASSIGNED_SUPPORT_DATA, parameters); +} + export { leaveWorkspace, addBillingCardAndRequestPolicyOwnerChange, @@ -4697,6 +4705,7 @@ export { verifySetupIntentAndRequestPolicyOwnerChange, updateInvoiceCompanyName, updateInvoiceCompanyWebsite, + getAssignedSupportData, }; export type {NewCustomUnit}; diff --git a/src/libs/actions/Report.ts b/src/libs/actions/Report.ts index 442b5dc45200..06e339ea1696 100644 --- a/src/libs/actions/Report.ts +++ b/src/libs/actions/Report.ts @@ -4445,6 +4445,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; +} function setDeleteTransactionNavigateBackUrl(url: string) { Onyx.set(ONYXKEYS.NVP_DELETE_TRANSACTION_NAVIGATE_BACK_URL, url); @@ -4543,6 +4546,7 @@ export { updateReportName, updateRoomVisibility, updateWriteCapability, + getConciergeReportID, setDeleteTransactionNavigateBackUrl, clearDeleteTransactionNavigateBackUrl, }; diff --git a/src/pages/workspace/accounting/PolicyAccountingPage.tsx b/src/pages/workspace/accounting/PolicyAccountingPage.tsx index 7aef46167d5d..f10d200b24d1 100644 --- a/src/pages/workspace/accounting/PolicyAccountingPage.tsx +++ b/src/pages/workspace/accounting/PolicyAccountingPage.tsx @@ -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'; @@ -28,6 +29,8 @@ 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 {getAssignedSupportData} from '@libs/actions/Policy/Policy'; +import {getConciergeReportID} from '@libs/actions/Report'; import * as PolicyUtils from '@libs/PolicyUtils'; import { areSettingsInErrorFields, @@ -75,7 +78,8 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { const [datetimeToRelative, setDateTimeToRelative] = useState(''); const threeDotsMenuContainerRef = useRef(null); const {startIntegrationFlow, popoverAnchorRefs} = useAccountingContext(); - + const [account] = useOnyx(ONYXKEYS.ACCOUNT); + const {isLargeScreenWidth} = useResponsiveLayout(); const route = useRoute(); const params = route.params as RouteParams | undefined; const newConnectionName = params?.newConnectionName; @@ -172,6 +176,13 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) { setDateTimeToRelative(''); }, [getDatetimeToRelative, successfulDate]); + useEffect(() => { + if (!policyID) { + return; + } + getAssignedSupportData(policyID); + }, [policyID]); + const integrationSpecificMenuItems = useMemo(() => { const sageIntacctEntityList = policy?.connections?.intacct?.data?.entities ?? []; const netSuiteSubsidiaryList = policy?.connections?.netsuite?.options?.data?.subsidiaryList ?? []; @@ -459,6 +470,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 ( )} + {!!account?.guideDetails?.email && ( + + + + {translate('workspace.accounting.needAnotherAccounting')} + Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chatReportID ?? ''))}>{chatTextLink} + + + )} diff --git a/src/types/onyx/Account.ts b/src/types/onyx/Account.ts index ea084b532793..33a593ca2b10 100644 --- a/src/types/onyx/Account.ts +++ b/src/types/onyx/Account.ts @@ -101,6 +101,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; @@ -157,6 +166,14 @@ type Account = { /** Indicates SMS delivery failure status and associated information */ smsDeliveryFailureStatus?: SMSDeliveryFailureStatus; + + /** The guide details of the account */ + guideDetails?: { + /** The email of the guide details */ + email: string; + /** The calendar link of the guide details */ + calendarLink: string; + }; }; export default Account;