Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 0 additions & 1 deletion src/CONST/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,6 @@ const CONST = {
BETAS: {
ALL: 'all',
ASAP_SUBMIT: 'asapSubmit',
CUSTOM_AGENT: 'customAgent',
DEFAULT_ROOMS: 'defaultRooms',
PREVENT_SPOTNANA_TRAVEL: 'preventSpotnanaTravel',
REPORT_FIELDS_FEATURE: 'reportFieldsFeature',
Expand Down
46 changes: 19 additions & 27 deletions src/components/AIFeaturesPromoModal.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
import useThemeStyles from '@hooks/useThemeStyles';

import {dismissProductTraining} from '@libs/actions/Welcome';
Expand All @@ -21,9 +20,6 @@ import Text from './Text';
function AIFeaturesPromoModal() {
const {translate} = useLocalize();
const styles = useThemeStyles();
const {isBetaEnabled} = usePermissions();
const canUseCustomAgent = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);

const customAgentPromoTitle = (
<View style={[styles.dFlex, styles.flexRow]}>
<Text style={[styles.textHeadlineH1, styles.mb2]}>{translate('aiFeaturesPromoModal.customAgents.title')}</Text>
Expand Down Expand Up @@ -98,32 +94,28 @@ function AIFeaturesPromoModal() {
</FeatureTraining.BodyText>
<FeatureTraining.ButtonRow>
<FeatureTraining.BackButton style={styles.flex1} />
<FeatureTraining.ConfirmButton style={styles.flex1}>
{canUseCustomAgent ? translate('common.next') : translate('aiFeaturesPromoModal.confirmText')}
</FeatureTraining.ConfirmButton>
<FeatureTraining.ConfirmButton style={styles.flex1}>{translate('common.next')}</FeatureTraining.ConfirmButton>
</FeatureTraining.ButtonRow>
</FeatureTraining.Body>
</FeatureTraining.Page>
<FeatureTraining.Page>
<FeatureTraining.Illustration
animation={LottieAnimations.CustomAgents}
outerContainerStyle={styles.p0}
aspectRatio={illustrationAspectRatio}
/>
<FeatureTraining.Body>
<FeatureTraining.BodyText style={styles.mb4}>
<FeatureTraining.Subtitle>{subtitle}</FeatureTraining.Subtitle>
<FeatureTraining.Title>{customAgentPromoTitle}</FeatureTraining.Title>
<FeatureTraining.Description shouldRenderHTML>{translate('aiFeaturesPromoModal.customAgents.description')}</FeatureTraining.Description>
</FeatureTraining.BodyText>
<FeatureTraining.ButtonRow>
<FeatureTraining.BackButton style={styles.flex1} />
<FeatureTraining.ConfirmButton style={styles.flex1}>{translate('aiFeaturesPromoModal.confirmText')}</FeatureTraining.ConfirmButton>
</FeatureTraining.ButtonRow>
</FeatureTraining.Body>
</FeatureTraining.Page>
{canUseCustomAgent && (
<FeatureTraining.Page>
<FeatureTraining.Illustration
animation={LottieAnimations.CustomAgents}
outerContainerStyle={styles.p0}
aspectRatio={illustrationAspectRatio}
/>
<FeatureTraining.Body>
<FeatureTraining.BodyText style={styles.mb4}>
<FeatureTraining.Subtitle>{subtitle}</FeatureTraining.Subtitle>
<FeatureTraining.Title>{customAgentPromoTitle}</FeatureTraining.Title>
<FeatureTraining.Description shouldRenderHTML>{translate('aiFeaturesPromoModal.customAgents.description')}</FeatureTraining.Description>
</FeatureTraining.BodyText>
<FeatureTraining.ButtonRow>
<FeatureTraining.BackButton style={styles.flex1} />
<FeatureTraining.ConfirmButton style={styles.flex1}>{translate('aiFeaturesPromoModal.confirmText')}</FeatureTraining.ConfirmButton>
</FeatureTraining.ButtonRow>
</FeatureTraining.Body>
</FeatureTraining.Page>
)}
</FeatureTraining.Carousel>
</CenteredModalLayout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ function ProductMarketingWindowManager({topmostRouteName}: ProductMarketingWindo
const illustrationNames = announcement ? [announcement.admin.visual, announcement.member?.visual].flatMap((visual) => (visual?.type === 'illustration' ? [visual.name] : [])) : [];
const illustrations = useMemoizedLazyIllustrations(illustrationNames);
const variant = getProductMarketingAnnouncementVariant(announcement, !!targetAdminPolicyID, lastDismissedMarketingWindow);
const isMemberVariantUnavailable = variant === announcement?.member && !isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);
const isVendorMatchingBetaEnabled = isBetaEnabled(CONST.BETAS.VENDOR_MATCHING);
const shouldPrefetchTargetPolicyConnections = isVendorMatchingBetaEnabled && !!targetAdminPolicyID && targetAdminPolicyID !== activePolicyID;
const {isFetchNeeded, isLoadingFetchedFlag, hasBeenFetched} = usePolicyConnectionsPrefetch(targetAdminPolicy, shouldPrefetchTargetPolicyConnections);
Expand Down Expand Up @@ -120,7 +119,6 @@ function ProductMarketingWindowManager({topmostRouteName}: ProductMarketingWindo
if (
!announcement ||
!variant ||
isMemberVariantUnavailable ||
isLoading ||
isProductMarketingWindowCovered ||
isAnonymousSession ||
Expand Down
14 changes: 1 addition & 13 deletions src/pages/settings/Agents/AgentsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import useLocalize from '@hooks/useLocalize';
import useMobileSelectionMode from '@hooks/useMobileSelectionMode';
import useNetwork from '@hooks/useNetwork';
import useOnyx from '@hooks/useOnyx';
import usePermissions from '@hooks/usePermissions';
import usePrevious from '@hooks/usePrevious';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useRuleBotGuardModal from '@hooks/useRuleBotGuardModal';
Expand All @@ -34,8 +33,6 @@ import {getRuleBotEnforcedPolicy} from '@libs/AgentRulesUtils';
import {getLatestError} from '@libs/ErrorUtils';
import Navigation from '@libs/Navigation/Navigation';

import NotFoundPage from '@pages/ErrorPage/NotFoundPage';

import {clearAgentDeleteError, clearAgentError, clearAgentUpdateError, deleteAgent, openAgentsPage} from '@userActions/Agent';

import CONST from '@src/CONST';
Expand All @@ -56,8 +53,6 @@ function AgentsPage() {
const icons = useMemoizedLazyExpensifyIcons(['Plus', 'Trashcan']);
const chatWithAgent = useChatWithAgent();
const switchToDelegator = useSwitchToDelegator();
const {isBetaEnabled} = usePermissions();
const isCustomAgentEnabled = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);
const {showConfirmModal} = useConfirmModal();
const showRuleBotGuardModal = useRuleBotGuardModal();
const [selectedAgents, setSelectedAgents] = useState<string[]>([]);
Expand All @@ -70,11 +65,8 @@ function AgentsPage() {
const canSelectMultiple = shouldUseNarrowLayout ? isMobileSelectionModeEnabled : true;

useEffect(() => {
if (!isCustomAgentEnabled) {
return;
}
openAgentsPage();
}, [isCustomAgentEnabled]);
}, []);

const handleErrorClose = (pendingAction: PendingAction | null | undefined, accountID: number) => {
if (pendingAction === CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD) {
Expand Down Expand Up @@ -249,10 +241,6 @@ function AgentsPage() {
</>
);

if (!isCustomAgentEnabled) {
return <NotFoundPage />;
}

return (
<ScreenWrapper
enableEdgeToEdgeBottomSafeAreaPadding
Expand Down
4 changes: 1 addition & 3 deletions src/pages/settings/useSettingsNavigationMenuData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import useIsAgentAccount from '@hooks/useIsAgentAccount';
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
import useOnyx from '@hooks/useOnyx';
import usePermissions from '@hooks/usePermissions';
import useSubscriptionPlan from '@hooks/useSubscriptionPlan';

import Navigation from '@libs/Navigation/Navigation';
Expand Down Expand Up @@ -103,7 +102,6 @@ function useSettingsNavigationMenuData(): {accountMenuItemsData: MenuSection; ge
const icons = useMemoizedLazyExpensifyIcons(['Bot', 'Gear', 'Profile', 'Heart', 'Info', 'QuestionMark', 'Lightbulb', 'Lock', 'Users', 'CreditCard', 'Wallet', 'Bolt']);
const [amountOwed = 0] = useOnyx(ONYXKEYS.NVP_PRIVATE_AMOUNT_OWED);
const subscriptionPlan = useSubscriptionPlan();
const {isBetaEnabled} = usePermissions();
const isAgentAccount = useIsAgentAccount();

const accountItems: MenuData[] = [
Expand Down Expand Up @@ -151,7 +149,7 @@ function useSettingsNavigationMenuData(): {accountMenuItemsData: MenuSection; ge
},
];

if (!isAgentAccount && isBetaEnabled(CONST.BETAS.CUSTOM_AGENT)) {
if (!isAgentAccount) {
Comment thread
puneetlath marked this conversation as resolved.
const rulesIndex = accountItems.findIndex((item) => item.screenName === SCREENS.SETTINGS.RULES.ROOT);
accountItems.splice(rulesIndex + 1, 0, {
translationKey: 'agentsPage.title',
Expand Down
2 changes: 0 additions & 2 deletions src/pages/workspace/rules/AgentRules/AddAgentRulePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ function AddAgentRulePage({
const styles = useThemeStyles();
const {isOffline} = useNetwork();
const {isBetaEnabled} = usePermissions();
const isCustomAgentEnabled = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);
const isRulesRevampEnabled = isBetaEnabled(CONST.BETAS.RULES_REVAMP);
const policy = usePolicy(policyID);
const linkPressedRef = useRef(false);
Expand Down Expand Up @@ -208,7 +207,6 @@ function AddAgentRulePage({
return (
<AccessOrNotFoundWrapper
policyID={policyID}
shouldBeBlocked={!isCustomAgentEnabled}
featureName={CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID, CONST.POLICY.ACCESS_VARIANTS.CONTROL]}
>
Expand Down
2 changes: 0 additions & 2 deletions src/pages/workspace/rules/AgentRules/EditAgentRulePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ function EditAgentRulePage({
const {translate} = useLocalize();
const styles = useThemeStyles();
const {isBetaEnabled} = usePermissions();
const isCustomAgentEnabled = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);
const isRulesRevampEnabled = isBetaEnabled(CONST.BETAS.RULES_REVAMP);
const shouldUseExpandedRevampFormLayout = useShouldUseExpandedRevampFormLayout();
const policy = usePolicy(policyID);
Expand Down Expand Up @@ -105,7 +104,6 @@ function EditAgentRulePage({
return (
<AccessOrNotFoundWrapper
policyID={policyID}
shouldBeBlocked={!isCustomAgentEnabled}
featureName={CONST.POLICY.MORE_FEATURES.ARE_RULES_ENABLED}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID, CONST.POLICY.ACCESS_VARIANTS.CONTROL]}
>
Expand Down
15 changes: 6 additions & 9 deletions src/pages/workspace/rules/PolicyRulesPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ function PolicyRulesPage(props: PolicyRulesPageProps) {
const {canWrite: canWriteRules, showReadOnlyModal, withReadOnlyFallback} = usePolicyFeatureWriteAccess(policy, CONST.POLICY.POLICY_FEATURE.RULES);
const {isBetaEnabled} = usePermissions();
const isRulesRevampEnabled = isBetaEnabled(CONST.BETAS.RULES_REVAMP);
const isCustomAgentBetaEnabled = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);
const [isAgentsRulesBannerDismissed = false] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, {selector: agentsRulesBannerDismissedSelector});

const fetchRules = useCallback(() => {
Expand Down Expand Up @@ -115,7 +114,7 @@ function PolicyRulesPage(props: PolicyRulesPageProps) {
>
{shouldDisplayButtonsInSeparateLine && <View style={[styles.pl5, styles.pr5]}>{headerButtons}</View>}
<View style={[styles.mt3, shouldUseNarrowLayout ? styles.workspaceSectionMobile : styles.workspaceSection]}>
{isCustomAgentBetaEnabled && !isAgentsRulesBannerDismissed && (
{!isAgentsRulesBannerDismissed && (
<AgentPromotionalBanner
title={translate('workspace.rules.agentsPromoBanner.title')}
subtitle={translate('workspace.rules.agentsPromoBanner.subtitle')}
Expand Down Expand Up @@ -150,13 +149,11 @@ function PolicyRulesPage(props: PolicyRulesPageProps) {
showReadOnlyModal={showReadOnlyModal}
/>
)}
{isCustomAgentBetaEnabled && (
<AgentRulesSection
policyID={policyID}
canWriteRules={canWriteRules}
showReadOnlyModal={showReadOnlyModal}
/>
)}
<AgentRulesSection
policyID={policyID}
canWriteRules={canWriteRules}
showReadOnlyModal={showReadOnlyModal}
/>
</View>
</WorkspacePageWithSections>
</AccessOrNotFoundWrapper>
Expand Down
17 changes: 6 additions & 11 deletions src/pages/workspace/rules/PolicyRulesPageRevamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,14 @@ function PolicyRulesPageRevamp({route}: PolicyRulesPageRevampProps) {
const {canWrite: canWriteRules, showReadOnlyModal} = usePolicyFeatureWriteAccess(policy, CONST.POLICY.POLICY_FEATURE.RULES);
const {isBetaEnabled} = usePermissions();
const isRulesRevampEnabled = isBetaEnabled(CONST.BETAS.RULES_REVAMP);
const isCustomAgentBetaEnabled = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);
const isMobileSelectionModeEnabled = useMobileSelectionMode();
const shouldDisplayButtonsInSeparateLine = useShouldDisplayButtonsInSeparateLine();
const [isAgentsRulesBannerDismissed = false] = useOnyx(ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, {selector: agentsRulesBannerDismissedSelector});

const [lastSelectedTab] = useOnyx(`${ONYXKEYS.COLLECTION.SELECTED_TAB}${CONST.TAB.RULES_TAB_TYPE}`);
const lastSelectedTabStr = lastSelectedTab as string | undefined;
const resolvedTab: RulesTab = lastSelectedTabStr && isRulesTab(lastSelectedTabStr) ? lastSelectedTabStr : RULES_TAB.GENERAL;
const activeTab: RulesTab = resolvedTab === RULES_TAB.AGENTS && !isCustomAgentBetaEnabled ? RULES_TAB.GENERAL : resolvedTab;
const activeTab = resolvedTab;
const [selectedRuleKeysByTab, setSelectedRuleKeysByTab] = useState<Partial<Record<TableSelectionTab, string[]>>>({});

const {showConfirmModal} = useConfirmModal();
Expand Down Expand Up @@ -240,15 +239,11 @@ function PolicyRulesPageRevamp({route}: PolicyRulesPageRevampProps) {
title: translate('workspace.rules.tabs.flagForReview'),
icon: icons.Flag,
},
...(isCustomAgentBetaEnabled
? [
{
key: RULES_TAB.AGENTS,
title: translate('workspace.rules.tabs.agents'),
icon: icons.Bot,
},
]
: []),
{
key: RULES_TAB.AGENTS,
title: translate('workspace.rules.tabs.agents'),
icon: icons.Bot,
},
];

const rulesUpgradeAlias = CONST.UPGRADE_FEATURE_INTRO_MAPPING.rules.alias;
Expand Down
23 changes: 9 additions & 14 deletions src/pages/workspace/rules/RulesNewPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ function RulesNewPage({route}: RulesNewPageProps) {
const styles = useThemeStyles();
const {isBetaEnabled} = usePermissions();
const isRulesRevampEnabled = isBetaEnabled(CONST.BETAS.RULES_REVAMP);
const isCustomAgentBetaEnabled = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);
const illustrations = useMemoizedLazyIllustrations(['CardReaderAlt', 'Flag', 'CheckboxText', 'ReportReceipt', 'AiBot']);
const isCategoryScopedCreate = route.name === SCREENS.WORKSPACE.DYNAMIC_CATEGORY_RULES_NEW || !!categoryName;

Expand Down Expand Up @@ -96,19 +95,15 @@ function RulesNewPage({route}: RulesNewPageProps) {
sentryLabel: CONST.SENTRY_LABEL.WORKSPACE.RULES.NEW_RULE_MENU_ITEM_APPLY_EXPENSE_DEFAULTS,
isWorkspaceOnly: true,
},
...(isCustomAgentBetaEnabled
? [
{
key: 'createAgentRule',
icon: illustrations.AiBot,
title: translate('workspace.rules.newRule.createAgentRule'),
description: translate('workspace.rules.newRule.createAgentRuleDescription'),
onPress: () => Navigation.navigate(ROUTES.RULES_AGENT_NEW.getRoute(policyID)),
sentryLabel: CONST.SENTRY_LABEL.WORKSPACE.RULES.NEW_RULE_MENU_ITEM_CREATE_AGENT_RULE,
isWorkspaceOnly: true,
} satisfies NewRuleOption,
]
: []),
{
key: 'createAgentRule',
icon: illustrations.AiBot,
title: translate('workspace.rules.newRule.createAgentRule'),
description: translate('workspace.rules.newRule.createAgentRuleDescription'),
onPress: () => Navigation.navigate(ROUTES.RULES_AGENT_NEW.getRoute(policyID)),
sentryLabel: CONST.SENTRY_LABEL.WORKSPACE.RULES.NEW_RULE_MENU_ITEM_CREATE_AGENT_RULE,
isWorkspaceOnly: true,
},
];

const visibleNewRuleOptions = isCategoryScopedCreate ? newRuleOptions.filter((option) => !option.isWorkspaceOnly) : newRuleOptions;
Expand Down
5 changes: 1 addition & 4 deletions src/pages/workspace/rules/tabs/RulesGeneralTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import AgentPromotionalBanner from '@components/AgentPromotionalBanner';
import ScrollView from '@components/ScrollView';

import useLocalize from '@hooks/useLocalize';
import usePermissions from '@hooks/usePermissions';
import useResponsiveLayout from '@hooks/useResponsiveLayout';
import useThemeStyles from '@hooks/useThemeStyles';

Expand All @@ -29,8 +28,6 @@ function RulesGeneralTab({policyID, canWriteRules, isAgentsRulesBannerDismissed,
const {translate} = useLocalize();
const styles = useThemeStyles();
const {shouldUseNarrowLayout} = useResponsiveLayout();
const {isBetaEnabled} = usePermissions();
const isCustomAgentBetaEnabled = isBetaEnabled(CONST.BETAS.CUSTOM_AGENT);

// The tab owns the scroll so the selector scrolls with the content, matching the table tabs where it is the list's
// header. The page's buttons sit above this and stay pinned.
Expand All @@ -47,7 +44,7 @@ function RulesGeneralTab({policyID, canWriteRules, isAgentsRulesBannerDismissed,
policyID={policyID}
canWriteRules={canWriteRules}
/>
{isCustomAgentBetaEnabled && !isAgentsRulesBannerDismissed && (
{!isAgentsRulesBannerDismissed && (
<AgentPromotionalBanner
title={translate('workspace.rules.agentsPromoBanner.title')}
subtitle={translate('workspace.rules.agentsPromoBanner.subtitle')}
Expand Down
Loading
Loading