Skip to content

Commit 20222e7

Browse files
authored
Merge pull request #91251 from Expensify/feat/91243-add-agent-promotion-banners-to-workspace
feat: [91243] add agent promotion banners to workspace
2 parents 558b90d + 75575dd commit 20222e7

19 files changed

Lines changed: 488 additions & 2 deletions

File tree

src/CONST/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9017,6 +9017,8 @@ const CONST = {
90179017
HAS_FILTER_NEGATION: 'hasFilterNegation',
90189018
},
90199019
CHANGE_POLICY_TRAINING_MODAL: 'changePolicyModal',
9020+
AGENTS_WORKFLOWS_BANNER: 'agentsWorkflowsBanner',
9021+
AGENTS_RULES_BANNER: 'agentsRulesBanner',
90209022
SMART_BANNER_HEIGHT: 152,
90219023

90229024
NAVIGATION_TESTS: {
@@ -9157,6 +9159,13 @@ const CONST = {
91579159
BILLING_BANNER: {
91589160
RIGHT_ICON: 'BillingBanner-RightIcon',
91599161
},
9162+
AGENTS_WORKFLOWS_BANNER: {
9163+
DISMISS: 'AgentsWorkflowsBanner-Dismiss',
9164+
},
9165+
AGENTS_RULES_BANNER: {
9166+
CTA: 'AgentsRulesBanner-CTA',
9167+
DISMISS: 'AgentsRulesBanner-Dismiss',
9168+
},
91609169
NAVIGATION_TAB_BAR: {
91619170
EXPENSIFY_LOGO: 'NavigationTabBar-ExpensifyLogo',
91629171
INBOX: 'NavigationTabBar-Inbox',
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
import React, {useMemo} from 'react';
2+
import type {StyleProp, ViewStyle} from 'react-native';
3+
import {View} from 'react-native';
4+
import {useMemoizedLazyExpensifyIcons, useMemoizedLazyIllustrations} from '@hooks/useLazyAsset';
5+
import useLocalize from '@hooks/useLocalize';
6+
import useResponsiveLayout from '@hooks/useResponsiveLayout';
7+
import useThemeStyles from '@hooks/useThemeStyles';
8+
import BillingBanner from '@pages/settings/Subscription/CardSection/BillingBanner/BillingBanner';
9+
import Badge from './Badge';
10+
import Button from './Button';
11+
import Text from './Text';
12+
13+
type AgentPromotionalBannerProps = {
14+
/** Title shown next to the bot illustration. */
15+
title: string;
16+
17+
/** Supporting copy under the title. */
18+
subtitle: string;
19+
20+
/** Called when the dismiss (X) button is pressed. */
21+
onDismiss: () => void;
22+
23+
/** Sentry label for the dismiss button. */
24+
dismissSentryLabel: string;
25+
26+
/** Optional CTA text. When omitted, the CTA is not rendered. */
27+
ctaText?: string;
28+
29+
/** Called when the CTA is pressed. Required when `ctaText` is set. */
30+
onCtaPress?: () => void;
31+
32+
/** Sentry label for the CTA. Required when `ctaText` is set. */
33+
ctaSentryLabel?: string;
34+
35+
/** Extra styles applied to the outer container. */
36+
style?: StyleProp<ViewStyle>;
37+
};
38+
39+
function AgentPromotionalBanner({title, subtitle, onDismiss, dismissSentryLabel, ctaText, onCtaPress, ctaSentryLabel, style}: AgentPromotionalBannerProps) {
40+
const styles = useThemeStyles();
41+
const {translate} = useLocalize();
42+
const {shouldUseNarrowLayout} = useResponsiveLayout();
43+
const illustrations = useMemoizedLazyIllustrations(['AiBot']);
44+
const expensifyIcons = useMemoizedLazyExpensifyIcons(['Close']);
45+
46+
const hasCta = !!ctaText && !!onCtaPress;
47+
48+
const titleNode = useMemo(
49+
() => (
50+
<View style={[styles.flexRow, styles.flexShrink1]}>
51+
<Text style={[styles.textStrong]}>
52+
{title}
53+
<Badge
54+
badgeStyles={styles.agentPromotionalBannerBadge}
55+
success
56+
isStrong
57+
isCondensed
58+
text={translate('common.new')}
59+
/>
60+
</Text>
61+
</View>
62+
),
63+
[title, styles, translate],
64+
);
65+
66+
const rightComponent = useMemo(() => {
67+
if (!hasCta) {
68+
return null;
69+
}
70+
if (shouldUseNarrowLayout) {
71+
return (
72+
<View style={[styles.flex0, styles.flexBasis100, styles.maxWidth100Percentage, styles.justifyContentCenter]}>
73+
<Button
74+
success
75+
medium
76+
text={ctaText}
77+
onPress={onCtaPress}
78+
sentryLabel={ctaSentryLabel}
79+
/>
80+
</View>
81+
);
82+
}
83+
return (
84+
<Button
85+
success
86+
small
87+
text={ctaText}
88+
onPress={onCtaPress}
89+
sentryLabel={ctaSentryLabel}
90+
/>
91+
);
92+
}, [hasCta, shouldUseNarrowLayout, ctaText, onCtaPress, ctaSentryLabel, styles]);
93+
94+
return (
95+
<View style={style}>
96+
<BillingBanner
97+
icon={illustrations.AiBot}
98+
title={titleNode}
99+
subtitle={subtitle}
100+
subtitleStyle={[styles.mt1]}
101+
style={[styles.borderRadiusComponentLarge, styles.gap4]}
102+
rightIcon={expensifyIcons.Close}
103+
onRightIconPress={onDismiss}
104+
rightIconAccessibilityLabel={translate('common.dismiss')}
105+
rightIconSentryLabel={dismissSentryLabel}
106+
rightComponent={rightComponent}
107+
/>
108+
</View>
109+
);
110+
}
111+
112+
AgentPromotionalBanner.displayName = 'AgentPromotionalBanner';
113+
114+
export default AgentPromotionalBanner;

src/languages/de.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,6 +2597,8 @@ ${amount} für ${merchant} – ${date}`,
25972597
addApprovalTip: 'Dieser Standard-Workflow gilt für alle Mitglieder, sofern kein spezifischerer Workflow vorhanden ist.',
25982598
approver: 'Genehmiger',
25992599
addApprovalsDescription: 'Zusätzliche Genehmigung einholen, bevor eine Zahlung autorisiert wird.',
2600+
automateApprovalsWithAgentsTitle: 'Genehmigungen mit Agenten automatisieren',
2601+
automateApprovalsWithAgentsSubtitle: 'Fügen Sie die untenstehende Person zum Workflow hinzu, um Genehmigungen zu automatisieren.',
26002602
makeOrTrackPaymentsTitle: 'Zahlungen',
26012603
makeOrTrackPaymentsDescription:
26022604
'Fügen Sie eine bevollmächtigte zahlende Person für in Expensify getätigte Zahlungen hinzu oder verfolgen Sie Zahlungen, die andernorts getätigt wurden.',
@@ -7013,6 +7015,11 @@ Fordern Sie Spesendetails wie Belege und Beschreibungen an, legen Sie Limits und
70137015
enableFeatureSubtitle: (featureName: string, moreFeaturesLink?: string) =>
70147016
`Gehe zu [weitere Funktionen](${moreFeaturesLink}) und aktiviere ${featureName}, um diese Funktion freizuschalten.`,
70157017
},
7018+
agentsPromoBanner: {
7019+
title: 'Sie sehen die benötigte Regel nicht? Fügen Sie eine:n Agent:in hinzu',
7020+
subtitle: 'Fügen Sie komplexe Regeln hinzu und reduzieren Sie manuelle Genehmigungen mit benutzerdefinierten Agenten.',
7021+
cta: 'Ausprobieren',
7022+
},
70167023
merchantRules: {
70177024
title: 'Händler',
70187025
subtitle: 'Legen Sie Händlerregeln fest, damit Spesen korrekt codiert ankommen und weniger Nachbearbeitung erfordern.',

src/languages/en.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2655,6 +2655,8 @@ const translations = {
26552655
addApprovalTip: 'This default workflow applies to all members, unless a more specific workflow exists.',
26562656
approver: 'Approver',
26572657
addApprovalsDescription: 'Require additional approval before authorizing a payment.',
2658+
automateApprovalsWithAgentsTitle: 'Automate approvals with agents',
2659+
automateApprovalsWithAgentsSubtitle: 'Add agent below to workflow to automate approvals.',
26582660
configureViaHR: ({provider}: {provider: string}) => `Configure via ${provider}.`,
26592661
hrApprovalWorkflowLockedPrompt: ({provider}: {provider: string}) =>
26602662
`Approvals are managed by your ${provider} integration. To update your approval workflow, head to your ${provider} connection settings.`,
@@ -7093,6 +7095,11 @@ const translations = {
70937095
unlockFeatureEnableWorkflowsSubtitle: (featureName: string) => `Add ${featureName} to unlock this feature.`,
70947096
enableFeatureSubtitle: (featureName: string, moreFeaturesLink?: string) => `Go to [more features](${moreFeaturesLink}) and enable ${featureName} to unlock this feature.`,
70957097
},
7098+
agentsPromoBanner: {
7099+
title: 'Don’t see the rule you need? Add an agent',
7100+
subtitle: 'Add complex rules and reduce manual approvals with custom agents.',
7101+
cta: 'Try it out',
7102+
},
70967103
merchantRules: {
70977104
title: 'Merchant',
70987105
subtitle: 'Set merchant rules so expenses arrive correctly coded and require less cleanup.',

src/languages/es.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2466,6 +2466,8 @@ ${amount} para ${merchant} - ${date}`,
24662466
addApprovalTip: 'Este flujo de trabajo por defecto se aplica a todos los miembros, a menos que exista un flujo de trabajo más específico.',
24672467
approver: 'Aprobador',
24682468
addApprovalsDescription: 'Requiere una aprobación adicional antes de autorizar un pago.',
2469+
automateApprovalsWithAgentsTitle: 'Automatiza las aprobaciones con agentes',
2470+
automateApprovalsWithAgentsSubtitle: 'Añade el agente de abajo al flujo de trabajo para automatizar las aprobaciones.',
24692471
configureViaHR: ({provider}: {provider: string}) => `Configurar mediante ${provider}.`,
24702472
hrApprovalWorkflowLockedPrompt: ({provider}: {provider: string}) =>
24712473
`Las aprobaciones se gestionan mediante tu integración de ${provider}. Para actualizar tu flujo de aprobación, ve a la configuración de conexión de ${provider}.`,
@@ -6928,6 +6930,11 @@ ${amount} para ${merchant} - ${date}`,
69286930
unlockFeatureEnableWorkflowsSubtitle: (featureName) => `Añade ${featureName} para desbloquear esta función.`,
69296931
enableFeatureSubtitle: (featureName, moreFeaturesLink) => `Ir a [más características](${moreFeaturesLink}) y habilita ${featureName} para desbloquear esta función.`,
69306932
},
6933+
agentsPromoBanner: {
6934+
title: '¿No ves la regla que necesitas? Añade un agente',
6935+
subtitle: 'Añade reglas complejas y reduce las aprobaciones manuales con agentes personalizados.',
6936+
cta: 'Pruébalo',
6937+
},
69316938
merchantRules: {
69326939
title: 'Comerciante',
69336940
subtitle: 'Configura las reglas de comerciante para que los gastos lleguen correctamente codificados y requieran menos limpieza.',

src/languages/fr.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2605,6 +2605,8 @@ ${amount} pour ${merchant} - ${date}`,
26052605
addApprovalTip: 'Ce workflow par défaut s’applique à tous les membres, sauf si un workflow plus spécifique existe.',
26062606
approver: 'Approbateur',
26072607
addApprovalsDescription: 'Exiger une approbation supplémentaire avant d’autoriser un paiement.',
2608+
automateApprovalsWithAgentsTitle: 'Automatisez les approbations avec des agents',
2609+
automateApprovalsWithAgentsSubtitle: 'Ajoutez l’agent ci-dessous au flux de travail pour automatiser les approbations.',
26082610
makeOrTrackPaymentsTitle: 'Paiements',
26092611
makeOrTrackPaymentsDescription: 'Ajoutez un payeur autorisé pour les paiements effectués dans Expensify ou suivez les paiements effectués ailleurs.',
26102612
customApprovalWorkflowEnabled:
@@ -7036,6 +7038,11 @@ Rendez obligatoires des informations de dépense comme les reçus et les descrip
70367038
enableFeatureSubtitle: (featureName: string, moreFeaturesLink?: string) =>
70377039
`Allez dans [plus de fonctionnalités](${moreFeaturesLink}) et activez ${featureName} pour déverrouiller cette fonctionnalité.`,
70387040
},
7041+
agentsPromoBanner: {
7042+
title: 'Vous ne voyez pas la règle dont vous avez besoin ? Ajoutez un agent',
7043+
subtitle: 'Ajoutez des règles complexes et réduisez les approbations manuelles grâce à des agents personnalisés.',
7044+
cta: 'Essayer',
7045+
},
70397046
merchantRules: {
70407047
title: 'Commerçant',
70417048
subtitle: 'Définissez les règles de commerçant pour que les dépenses arrivent correctement codées et nécessitent moins de nettoyage.',

src/languages/it.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2593,6 +2593,8 @@ ${amount} per ${merchant} - ${date}`,
25932593
addApprovalTip: 'Questo flusso di lavoro predefinito si applica a tutti i membri, a meno che non esista un flusso di lavoro più specifico.',
25942594
approver: 'Approvante',
25952595
addApprovalsDescription: 'Richiedi un’approvazione aggiuntiva prima di autorizzare un pagamento.',
2596+
automateApprovalsWithAgentsTitle: 'Automatizza le approvazioni con gli agenti',
2597+
automateApprovalsWithAgentsSubtitle: 'Aggiungi l’agente qui sotto al workflow per automatizzare le approvazioni.',
25962598
makeOrTrackPaymentsTitle: 'Pagamenti',
25972599
makeOrTrackPaymentsDescription: 'Aggiungi un pagatore autorizzato per i pagamenti effettuati in Expensify o tieni traccia dei pagamenti effettuati altrove.',
25982600
customApprovalWorkflowEnabled:
@@ -6997,6 +6999,11 @@ Richiedi dettagli sulle spese come ricevute e descrizioni, imposta limiti e valo
69976999
enableFeatureSubtitle: (featureName: string, moreFeaturesLink?: string) =>
69987000
`Vai su [altre funzionalità](${moreFeaturesLink}) e abilita ${featureName} per sbloccare questa funzione.`,
69997001
},
7002+
agentsPromoBanner: {
7003+
title: 'Non vedi la regola che ti serve? Aggiungi un agente',
7004+
subtitle: 'Aggiungi regole complesse e riduci le approvazioni manuali con agenti personalizzati.',
7005+
cta: 'Prova ora',
7006+
},
70007007
merchantRules: {
70017008
title: 'Esercente',
70027009
subtitle: 'Imposta le regole per l’esercente in modo che le spese arrivino già codificate correttamente e richiedano meno correzioni.',

src/languages/ja.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2568,6 +2568,8 @@ ${date} の ${merchant} への ${amount}`,
25682568
addApprovalTip: 'より詳細なワークフローが存在する場合を除き、このデフォルトのワークフローがすべてのメンバーに適用されます。',
25692569
approver: '承認者',
25702570
addApprovalsDescription: '支払いを承認する前に、追加の承認を必須にする。',
2571+
automateApprovalsWithAgentsTitle: '代理を使って承認を自動化する',
2572+
automateApprovalsWithAgentsSubtitle: '承認を自動化するには、以下のエージェントをワークフローに追加してください。',
25712573
makeOrTrackPaymentsTitle: '支払',
25722574
makeOrTrackPaymentsDescription: 'Expensifyでの支払いに対する承認済み支払者を追加するか、他の場所で行われた支払いを記録します。',
25732575
customApprovalWorkflowEnabled:
@@ -6919,6 +6921,11 @@ ${reportName}
69196921
enableFeatureSubtitle: (featureName: string, moreFeaturesLink?: string) =>
69206922
`[その他の機能](${moreFeaturesLink})に移動し、${featureName} を有効にしてこの機能を利用できるようにしてください。`,
69216923
},
6924+
agentsPromoBanner: {
6925+
title: '必要なルールが見つかりませんか?エージェントを追加してください',
6926+
subtitle: '複雑なルールを追加し、カスタムエージェントで手動承認を減らしましょう。',
6927+
cta: 'お試しください',
6928+
},
69226929
merchantRules: {
69236930
title: '加盟店',
69246931
subtitle: '経費が正しくコード化され、後処理が最小限で済むように、取引先ルールを設定しましょう。',

src/languages/nl.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2590,6 +2590,8 @@ ${amount} voor ${merchant} - ${date}`,
25902590
addApprovalTip: 'Deze standaardworkflow is van toepassing op alle leden, tenzij er een specifiekere workflow bestaat.',
25912591
approver: 'Fiatteur',
25922592
addApprovalsDescription: 'Extra goedkeuring vereisen voordat je een betaling autoriseert.',
2593+
automateApprovalsWithAgentsTitle: 'Automatiseer goedkeuringen met agents',
2594+
automateApprovalsWithAgentsSubtitle: 'Voeg hieronder een agent toe aan de workflow om goedkeuringen te automatiseren.',
25932595
makeOrTrackPaymentsTitle: 'Betalingen',
25942596
makeOrTrackPaymentsDescription: 'Voeg een gemachtigde betaler toe voor betalingen die in Expensify worden gedaan of volg betalingen die elders zijn gedaan.',
25952597
customApprovalWorkflowEnabled:
@@ -6973,6 +6975,11 @@ Vereis onkostendetails zoals bonnen en beschrijvingen, stel limieten en standaar
69736975
enableFeatureSubtitle: (featureName: string, moreFeaturesLink?: string) =>
69746976
`Ga naar [meer functies](${moreFeaturesLink}) en schakel ${featureName} in om deze functie te ontgrendelen.`,
69756977
},
6978+
agentsPromoBanner: {
6979+
title: 'Zie je de regel die je nodig hebt niet? Voeg een agent toe',
6980+
subtitle: 'Voeg complexe regels toe en verminder handmatige goedkeuringen met aangepaste agents.',
6981+
cta: 'Probeer het uit',
6982+
},
69766983
merchantRules: {
69776984
title: 'Handelaar',
69786985
subtitle: 'Stel de leveranciersregels in zodat onkosten correct gecodeerd binnenkomen en er minder nabewerking nodig is.',

src/languages/pl.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2586,6 +2586,8 @@ ${amount} dla ${merchant} - ${date}`,
25862586
addApprovalTip: 'Domyślny proces pracy ma zastosowanie do wszystkich członków, chyba że istnieje bardziej szczegółowy proces pracy.',
25872587
approver: 'Osoba zatwierdzająca',
25882588
addApprovalsDescription: 'Wymagaj dodatkowej akceptacji przed autoryzacją płatności.',
2589+
automateApprovalsWithAgentsTitle: 'Automatyzuj zatwierdzanie z agentami',
2590+
automateApprovalsWithAgentsSubtitle: 'Dodaj agenta poniżej do przepływu pracy, aby zautomatyzować zatwierdzanie.',
25892591
makeOrTrackPaymentsTitle: 'Płatności',
25902592
makeOrTrackPaymentsDescription: 'Dodaj upoważnionego płatnika dla płatności dokonywanych w Expensify lub śledź płatności wykonywane gdzie indziej.',
25912593
customApprovalWorkflowEnabled:
@@ -6969,6 +6971,7 @@ Wymagaj szczegółów wydatków, takich jak paragony i opisy, ustawiaj limity i
69696971
enableFeatureSubtitle: (featureName: string, moreFeaturesLink?: string) =>
69706972
`Przejdź do [więcej funkcji](${moreFeaturesLink}) i włącz ${featureName}, aby odblokować tę funkcję.`,
69716973
},
6974+
agentsPromoBanner: {title: 'Nie widzisz potrzebnej reguły? Dodaj agenta', subtitle: 'Dodaj złożone reguły i ogranicz ręczne akceptacje dzięki własnym agentom.', cta: 'Wypróbuj'},
69726975
merchantRules: {
69736976
title: 'Sprzedawca',
69746977
subtitle: 'Skonfiguruj reguły dla sprzedawców, aby wydatki trafiały z prawidłowym kodowaniem i wymagały mniej poprawek.',

0 commit comments

Comments
 (0)