@@ -157,6 +157,7 @@ type BuildPolicyDataOptions = {
157157 shouldAddOnboardingTasks ?: boolean ;
158158 companySize ?: OnboardingCompanySize ;
159159 userReportedIntegration ?: OnboardingAccounting ;
160+ isAnnualSubscription ?: boolean ;
160161 featuresMap ?: Feature [ ] ;
161162 lastUsedPaymentMethod ?: LastPaymentMethodType ;
162163} ;
@@ -1850,8 +1851,9 @@ function buildOptimisticDistanceRateCustomUnits(reportCurrency?: string): Optimi
18501851 * @param [makeMeAdmin] leave the calling account as an admin on the policy
18511852 * @param [currency] Optional, selected currency for the workspace
18521853 * @param [file], avatar file for workspace
1854+ * @param [isAnnualSubscription] Optional, does user have an annual subscription
18531855 */
1854- function createDraftInitialWorkspace ( policyOwnerEmail = '' , policyName = '' , policyID = generatePolicyID ( ) , makeMeAdmin = false , currency = '' , file ?: File ) {
1856+ function createDraftInitialWorkspace ( policyOwnerEmail = '' , policyName = '' , policyID = generatePolicyID ( ) , makeMeAdmin = false , currency = '' , file ?: File , isAnnualSubscription = false ) {
18551857 const workspaceName = policyName || generateDefaultWorkspaceName ( policyOwnerEmail ) ;
18561858 const { customUnits, outputCurrency} = buildOptimisticDistanceRateCustomUnits ( currency ) ;
18571859 const shouldEnableWorkflowsByDefault =
@@ -1863,15 +1865,15 @@ function createDraftInitialWorkspace(policyOwnerEmail = '', policyName = '', pol
18631865 key : `${ ONYXKEYS . COLLECTION . POLICY_DRAFTS } ${ policyID } ` ,
18641866 value : {
18651867 id : policyID ,
1866- type : CONST . POLICY . TYPE . TEAM ,
1868+ type : isAnnualSubscription ? CONST . POLICY . TYPE . CORPORATE : CONST . POLICY . TYPE . TEAM ,
18671869 name : workspaceName ,
18681870 role : CONST . POLICY . ROLE . ADMIN ,
18691871 owner : sessionEmail ,
18701872 ownerAccountID : sessionAccountID ,
18711873 isPolicyExpenseChatEnabled : true ,
18721874 areCategoriesEnabled : true ,
18731875 approver : sessionEmail ,
1874- areCompanyCardsEnabled : true ,
1876+ areCompanyCardsEnabled : ! isAnnualSubscription ,
18751877 areExpensifyCardsEnabled : false ,
18761878 outputCurrency,
18771879 pendingAction : CONST . RED_BRICK_ROAD_PENDING_ACTION . ADD ,
@@ -1936,6 +1938,7 @@ function buildPolicyData(options: BuildPolicyDataOptions = {}) {
19361938 shouldAddOnboardingTasks = true ,
19371939 companySize,
19381940 userReportedIntegration,
1941+ isAnnualSubscription = false ,
19391942 featuresMap,
19401943 lastUsedPaymentMethod,
19411944 } = options ;
@@ -1969,7 +1972,7 @@ function buildPolicyData(options: BuildPolicyDataOptions = {}) {
19691972 // Determine workspace type based on selected features or user reported integration
19701973 const isCorporateFeature = featuresMap ?. some ( ( feature ) => ! feature . enabledByDefault && feature . enabled && feature . requiresUpdate ) ?? false ;
19711974 const isCorporateIntegration = userReportedIntegration && ( CONST . POLICY . CONNECTIONS . CORPORATE as readonly string [ ] ) . includes ( userReportedIntegration ) ;
1972- const workspaceType = isCorporateFeature || isCorporateIntegration ? CONST . POLICY . TYPE . CORPORATE : CONST . POLICY . TYPE . TEAM ;
1975+ const workspaceType = isCorporateFeature || ! ! isCorporateIntegration || isAnnualSubscription ? CONST . POLICY . TYPE . CORPORATE : CONST . POLICY . TYPE . TEAM ;
19731976
19741977 // WARNING: The data below should be kept in sync with the API so we create the policy with the correct configuration.
19751978 const optimisticData : OnyxUpdate [ ] = [
@@ -1996,7 +1999,7 @@ function buildPolicyData(options: BuildPolicyDataOptions = {}) {
19961999 } ,
19972000 customUnits,
19982001 areCategoriesEnabled : true ,
1999- areCompanyCardsEnabled : true ,
2002+ areCompanyCardsEnabled : workspaceType === CONST . POLICY . TYPE . TEAM ,
20002003 areTagsEnabled : false ,
20012004 areDistanceRatesEnabled : false ,
20022005 areWorkflowsEnabled : shouldEnableWorkflowsByDefault ,
0 commit comments