import { FetchState, FetchStateAndError, FetchedState, ID } from '../../commonStateTypes/common'; import { MonthYearPeriod } from '../../commonStateTypes/timePeriod'; import { ZeniAPIStatus } from '../../responsePayload'; import { AccountingMethod } from '../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardSelectorTypes'; import { AverageMonthsCount, TimeSpanIdForAverage } from '../../view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState'; import { ZeniDate } from '../../zeniDayJS'; import ZeniUrl from '../../zeniUrl'; import { MasterTOSInfo, UserReimbursementInfo } from '../company/companyStateTypes'; import { SubscriptionSummary } from '../subscription/subscriptionSummary/subscriptionSummaryState'; import { InvitationStatus } from '../userRole/userRoleState'; import { UserRoleType } from '../userRole/userRoleType'; import { AuthProvider, ExternalSupportedTool } from './tenantTypes'; export interface TenantExternalConnections { accounting: Connection[]; deleteConnectionState: FetchState; email: Connection[]; fetchState: FetchState; payments: Connection[]; revenue: Connection[]; saveAPIKeyConnectionState: FetchState; saveConnectionState: FetchState; saveConnectorCredentialsErrorBySlug: Partial>; saveConnectorCredentialsStateBySlug: Partial>; saveOAuthConnectionState: FetchState; deleteConnectionError?: ZeniAPIStatus; error?: ZeniAPIStatus; saveAPIKeyConnectionError?: ZeniAPIStatus; saveOAuthConnectionError?: ZeniAPIStatus; } export interface TenantState extends FetchedState { accountLocked: boolean; activeTenantFetchState: FetchStateAndError; excludedResourcesByTenant: Record; externalConnectionsByTenant: Record; magicLinkSignInFetchState: FetchStateAndError; onboardingTenantsById: Record; resendVerifyDeviceOTPFetchState: FetchStateAndError; sendEmailMagicLinkFetchState: FetchStateAndError; signInState: FetchState; subscriptionSummaryByTenant: Record; tenantIds: ID[]; tenantsById: Record; verifyDeviceFetchState: FetchStateAndError; accountLockTime?: ZeniDate; accountUnlockTime?: ZeniDate; currentTenantId?: ID; loggedInUser?: LoggedInUser; magicLinkCodeVerifier?: string; magicLinkEmail?: string; otpChallenge?: string; sessionExpiresAt?: string; twoFAPhoneNumber?: string; } export interface TenantProductSettings { isBankingEnabled: boolean; isBookkeepingEnabled: boolean; isCardsEnabled: boolean; isCfoEnabled: boolean; isOtherProductsEnabled: boolean; isPayrollEnabled: boolean; isSpendManagementEnabled: boolean; isTaxEnabled: boolean; isTreasuryEnabled: boolean; } export interface Tenant { accountingClassIDs: ID[]; capitalizableAccountOverrides: Record | null; capitalizableAccounts: CapitalizableAccounts | null; capitalizationOnboardingDismissedAccounts: Record | null; capitalizationOnboardingShownForFixedAsset: boolean; capitalizationOnboardingShownForPrepaid: boolean; chargebeeId: ID; companyId: ID; companyName: string; createTime: ZeniDate; invitationStatus: InvitationStatus; inviteAcceptTime: ZeniDate; inviteCreateTime: ZeniDate; inviterEmail: string; inviterUserId: ID; isAccountingClassesEnabled: boolean; isAccountingProjectsEnabled: boolean; isCustomerCreated: boolean; isEmailGroupCreated: boolean; isOnboardingCompleted: boolean; isTreasuryPromoIntroClosedByOutsideClick: boolean; isTreasuryPromoVideoPlayed: boolean; isTreasuryPromoVideoRemindMeLaterClicked: boolean; isZeni: boolean; loginCounterForTreasuryPromoVideo: number; netBurnSettings: { accountingMethod: AccountingMethod; numberOfMonthsForAverage: AverageMonthsCount; timeSpanIdForAverage: TimeSpanIdForAverage; }; productSettings: TenantProductSettings; qboRealmId: ID; tenantEmailDomain: string; tenantId: ID; updateTime: ZeniDate; userLastCheckInTime: ZeniDate; userRole: UserRoleType[]; userRoleId: ID; bookCloseDate?: ZeniDate; hubSpotId?: ID; masterTOSInfo?: MasterTOSInfo; receiptsEmail?: string; rewardsLastViewedTime?: ZeniDate; userReimbursementInfo?: UserReimbursementInfo; zeniBookCloseDate?: ZeniDate; zeniBookCloseMonthAndYear?: MonthYearPeriod; } export type CapitalizableClassificationType = 'prepaid' | 'fixed_asset'; export type CapitalizableMatchPattern = 'LABEL' | 'TYPE_SUBTYPE_AND_JE_HISTORY' | 'TYPE_ONLY'; export type CapitalizableThresholdSource = 'LEARNED'; export interface CapitalizableAccount { accountId: string; classificationType: CapitalizableClassificationType; matchPattern: CapitalizableMatchPattern; sampleCount: number; thresholdSource: CapitalizableThresholdSource | null; thresholdValue: number | null; } export interface CapitalizableAccounts { accounts: CapitalizableAccount[]; computedAt: ZeniDate; } export interface LoggedInUser { userId: ID; authProvider?: AuthProvider; firstName?: string; lastName?: string; phoneNumber?: string; photo?: ZeniUrl; userEmail?: string; userEmailDomain?: string; zeniSessionId?: ID; } export interface RoleResource { createTime: ZeniDate; isExclude: boolean; isZeni: boolean; resource: string; resourceVersion: number; roleResourceId: ID; updateTime: ZeniDate; } export interface Connection { companyId: ID; connectionDisplayName: string; connectionDisplayType: string; connectionId: ID; connectionName: string; connectionType: string; createTime: ZeniDate; isValid: boolean; updateTime: ZeniDate; userId: ID; authorizationCode?: ID; realmId?: ID; }