diff --git a/src/libs/API/parameters/OpenPolicyMoreFeaturesPageParams.ts b/src/libs/API/parameters/OpenPolicyMoreFeaturesPageParams.ts new file mode 100644 index 000000000000..30e8f1b36ca0 --- /dev/null +++ b/src/libs/API/parameters/OpenPolicyMoreFeaturesPageParams.ts @@ -0,0 +1,5 @@ +type OpenPolicyMoreFeaturesPageParams = { + policyID: string; +}; + +export default OpenPolicyMoreFeaturesPageParams; diff --git a/src/libs/API/parameters/index.ts b/src/libs/API/parameters/index.ts index 1cf59f0eafea..b594e555518a 100644 --- a/src/libs/API/parameters/index.ts +++ b/src/libs/API/parameters/index.ts @@ -174,4 +174,5 @@ export type {default as DeclineJoinRequestParams} from './DeclineJoinRequest'; export type {default as JoinPolicyInviteLinkParams} from './JoinPolicyInviteLink'; export type {default as OpenPolicyWorkflowsPageParams} from './OpenPolicyWorkflowsPageParams'; export type {default as OpenPolicyDistanceRatesPageParams} from './OpenPolicyDistanceRatesPageParams'; +export type {default as OpenPolicyMoreFeaturesPageParams} from './OpenPolicyMoreFeaturesPageParams'; export type {default as CreatePolicyTagsParams} from './CreatePolicyTagsParams'; diff --git a/src/libs/API/types.ts b/src/libs/API/types.ts index fa110933c18a..24237dbb48bc 100644 --- a/src/libs/API/types.ts +++ b/src/libs/API/types.ts @@ -380,6 +380,7 @@ const READ_COMMANDS = { OPEN_DRAFT_WORKSPACE_REQUEST: 'OpenDraftWorkspaceRequest', OPEN_POLICY_WORKFLOWS_PAGE: 'OpenPolicyWorkflowsPage', OPEN_POLICY_DISTANCE_RATES_PAGE: 'OpenPolicyDistanceRatesPage', + OPEN_POLICY_MORE_FEATURES_PAGE: 'OpenPolicyMoreFeaturesPage', } as const; type ReadCommand = ValueOf; @@ -418,6 +419,7 @@ type ReadCommandParameters = { [READ_COMMANDS.OPEN_DRAFT_WORKSPACE_REQUEST]: Parameters.OpenDraftWorkspaceRequestParams; [READ_COMMANDS.OPEN_POLICY_WORKFLOWS_PAGE]: Parameters.OpenPolicyWorkflowsPageParams; [READ_COMMANDS.OPEN_POLICY_DISTANCE_RATES_PAGE]: Parameters.OpenPolicyDistanceRatesPageParams; + [READ_COMMANDS.OPEN_POLICY_MORE_FEATURES_PAGE]: Parameters.OpenPolicyMoreFeaturesPageParams; }; const SIDE_EFFECT_REQUEST_COMMANDS = { diff --git a/src/libs/actions/Policy.ts b/src/libs/actions/Policy.ts index 68ed15ece9a9..652de8aedf7d 100644 --- a/src/libs/actions/Policy.ts +++ b/src/libs/actions/Policy.ts @@ -25,6 +25,7 @@ import type { OpenDraftWorkspaceRequestParams, OpenPolicyCategoriesPageParams, OpenPolicyDistanceRatesPageParams, + OpenPolicyMoreFeaturesPageParams, OpenPolicyTagsPageParams, OpenPolicyWorkflowsPageParams, OpenWorkspaceInvitePageParams, @@ -3492,6 +3493,12 @@ function setPolicyRequiresTag(policyID: string, requiresTag: boolean) { API.write(WRITE_COMMANDS.SET_POLICY_REQUIRES_TAG, parameters, onyxData); } +function openPolicyMoreFeaturesPage(policyID: string) { + const params: OpenPolicyMoreFeaturesPageParams = {policyID}; + + API.read(READ_COMMANDS.OPEN_POLICY_MORE_FEATURES_PAGE, params); +} + export { removeMembers, updateWorkspaceMembersRole, @@ -3561,6 +3568,7 @@ export { enablePolicyTaxes, enablePolicyWorkflows, openPolicyDistanceRatesPage, + openPolicyMoreFeaturesPage, createPolicyTag, clearWorkspaceReimbursementErrors, deleteWorkspaceCategories, diff --git a/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx b/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx index 000ba0db7bc7..457c96ac2fd7 100644 --- a/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx +++ b/src/pages/workspace/WorkspaceMoreFeaturesPage.tsx @@ -1,5 +1,5 @@ import type {StackScreenProps} from '@react-navigation/stack'; -import React, {useCallback} from 'react'; +import React, {useCallback, useEffect} from 'react'; import {View} from 'react-native'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import * as Illustrations from '@components/Icon/Illustrations'; @@ -7,6 +7,7 @@ import ScreenWrapper from '@components/ScreenWrapper'; import ScrollView from '@components/ScrollView'; import Section from '@components/Section'; import useLocalize from '@hooks/useLocalize'; +import useNetwork from '@hooks/useNetwork'; import useThemeStyles from '@hooks/useThemeStyles'; import useWindowDimensions from '@hooks/useWindowDimensions'; import type {WorkspacesCentralPaneNavigatorParamList} from '@libs/Navigation/types'; @@ -141,6 +142,17 @@ function WorkspaceMoreFeaturesPage({policy, route}: WorkspaceMoreFeaturesPagePro [isSmallScreenWidth, styles, renderItem, translate], ); + function fetchFeatures() { + Policy.openPolicyMoreFeaturesPage(route.params.policyID); + } + + useNetwork({onReconnect: fetchFeatures}); + + useEffect(() => { + fetchFeatures(); + // eslint-disable-next-line react-hooks/exhaustive-deps + }, []); + return (