From dd237cf9a1260fb37d2ca24c34b1597d30d13c04 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 17 Mar 2025 23:34:31 +0100 Subject: [PATCH 1/4] Update the policy creation flow to enable company cards by default --- Mobile-Expensify | 2 +- src/libs/actions/Policy/Policy.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Mobile-Expensify b/Mobile-Expensify index eab4bfbe52c8..1f1c233f53e0 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit eab4bfbe52c80c780cfdd9fe828f211723044d8a +Subproject commit 1f1c233f53e03d601039a5ed41ca84ee9ae8a1e8 diff --git a/src/libs/actions/Policy/Policy.ts b/src/libs/actions/Policy/Policy.ts index 14ed72f8ca6b..ca859c5a79bb 100644 --- a/src/libs/actions/Policy/Policy.ts +++ b/src/libs/actions/Policy/Policy.ts @@ -1731,6 +1731,8 @@ function createDraftInitialWorkspace(policyOwnerEmail = '', policyName = '', pol ownerAccountID: sessionAccountID, isPolicyExpenseChatEnabled: true, areCategoriesEnabled: true, + areCompanyCardsEnabled: true, + areExpensifyCardsEnabled: false, outputCurrency, pendingAction: CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD, customUnits, @@ -1836,11 +1838,13 @@ function buildPolicyData( }, customUnits, areCategoriesEnabled: true, + areCompanyCardsEnabled: true, areTagsEnabled: false, areDistanceRatesEnabled: false, areWorkflowsEnabled: shouldEnableWorkflowsByDefault, areReportFieldsEnabled: false, areConnectionsEnabled: false, + areExpensifyCardsEnabled: false, employeeList: { [sessionEmail]: { role: CONST.POLICY.ROLE.ADMIN, @@ -2167,11 +2171,13 @@ function createDraftWorkspace(policyOwnerEmail = '', makeMeAdmin = false, policy }, customUnits, areCategoriesEnabled: true, + areCompanyCardsEnabled: true, areTagsEnabled: false, areDistanceRatesEnabled: false, areWorkflowsEnabled: false, areReportFieldsEnabled: false, areConnectionsEnabled: false, + areExpensifyCardsEnabled: false, employeeList: { [sessionEmail]: { role: CONST.POLICY.ROLE.ADMIN, @@ -2480,11 +2486,13 @@ function createWorkspaceFromIOUPayment(iouReport: OnyxEntry): WorkspaceF }, customUnits, areCategoriesEnabled: true, + areCompanyCardsEnabled: true, areTagsEnabled: false, areDistanceRatesEnabled: false, areWorkflowsEnabled: false, areReportFieldsEnabled: false, areConnectionsEnabled: false, + areExpensifyCardsEnabled: false, employeeList: { [sessionEmail]: { role: CONST.POLICY.ROLE.ADMIN, From abf598d97f929ca1de528542bbb9dc43da305572 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Mon, 17 Mar 2025 23:58:16 +0100 Subject: [PATCH 2/4] Make sure to disable the button to add a feed if workspaceAccountID is not available --- src/components/FeatureList.tsx | 5 +++++ .../companyCards/WorkspaceCompanyCardPageEmptyState.tsx | 2 ++ 2 files changed, 7 insertions(+) diff --git a/src/components/FeatureList.tsx b/src/components/FeatureList.tsx index 179eee2d5810..e41bec8de702 100644 --- a/src/components/FeatureList.tsx +++ b/src/components/FeatureList.tsx @@ -56,6 +56,9 @@ type FeatureListProps = { /** Custom content to display in the footer */ footer?: ReactNode; + + /** Whether the button should be disabled */ + isButtonDisabled?: boolean; }; function FeatureList({ @@ -72,6 +75,7 @@ function FeatureList({ titleStyles, contentPaddingOnLargeScreens, footer, + isButtonDisabled = false, }: FeatureListProps) { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -117,6 +121,7 @@ function FeatureList({ accessibilityLabel={ctaAccessibilityLabel} style={styles.w100} success + isDisabled={false} large /> )} diff --git a/src/pages/workspace/companyCards/WorkspaceCompanyCardPageEmptyState.tsx b/src/pages/workspace/companyCards/WorkspaceCompanyCardPageEmptyState.tsx index bbb77685c2f8..ca610fa126ed 100644 --- a/src/pages/workspace/companyCards/WorkspaceCompanyCardPageEmptyState.tsx +++ b/src/pages/workspace/companyCards/WorkspaceCompanyCardPageEmptyState.tsx @@ -42,6 +42,7 @@ function WorkspaceCompanyCardPageEmptyState({policy}: WithPolicyAndFullscreenLoa const [isNoDelegateAccessMenuVisible, setIsNoDelegateAccessMenuVisible] = useState(false); const [allWorkspaceCards] = useOnyx(ONYXKEYS.COLLECTION.WORKSPACE_CARDS_LIST); const shouldShowExpensifyCardPromotionBanner = !hasIssuedExpensifyCard(policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID, allWorkspaceCards); + const workspaceAccountID = policy?.workspaceAccountID ?? CONST.DEFAULT_NUMBER_ID; const handleCtaPress = useCallback(() => { if (!policy?.id) { @@ -70,6 +71,7 @@ function WorkspaceCompanyCardPageEmptyState({policy}: WithPolicyAndFullscreenLoa illustrationStyle={styles.emptyStateCardIllustration} illustrationContainerStyle={[styles.emptyStateCardIllustrationContainer, styles.justifyContentStart]} titleStyles={styles.textHeadlineH1} + isButtonDisabled={workspaceAccountID > CONST.DEFAULT_NUMBER_ID} /> Date: Tue, 18 Mar 2025 00:00:31 +0100 Subject: [PATCH 3/4] Make sure the button is disabled --- src/components/FeatureList.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/FeatureList.tsx b/src/components/FeatureList.tsx index e41bec8de702..e68b5c360582 100644 --- a/src/components/FeatureList.tsx +++ b/src/components/FeatureList.tsx @@ -121,7 +121,7 @@ function FeatureList({ accessibilityLabel={ctaAccessibilityLabel} style={styles.w100} success - isDisabled={false} + isDisabled={isButtonDisabled} large /> )} From c2c93a5b6f9570dbbb41d95f157a015110df7eb2 Mon Sep 17 00:00:00 2001 From: Vit Horacek Date: Tue, 18 Mar 2025 00:01:29 +0100 Subject: [PATCH 4/4] Update the submodule --- Mobile-Expensify | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Mobile-Expensify b/Mobile-Expensify index 1f1c233f53e0..eab4bfbe52c8 160000 --- a/Mobile-Expensify +++ b/Mobile-Expensify @@ -1 +1 @@ -Subproject commit 1f1c233f53e03d601039a5ed41ca84ee9ae8a1e8 +Subproject commit eab4bfbe52c80c780cfdd9fe828f211723044d8a