import { WithChildrenProp } from '@codecademy/gamut'; import { ReactNode } from 'react'; import { AppHeaderAction, AppHeaderClickHandler, AppHeaderItemWithHref, AppHeaderSearch } from '..'; import { CourseDifficulty } from '../ContentGroupBaseCard/types'; import { AppHeaderNotificationSettings } from '../Notifications/types'; type RenderProfile = { desktop: () => ReactNode; mobile: () => ReactNode; }; export type NavigationMenuFormattedLabel = Record<'openMenuTip' | 'closeMenuTip' | 'siteNavigation', string>; export type ResourceDropdownFormattedLabel = { title?: string; workspaces?: string; docs?: string; articles?: string; }; type localizedLabels = { enterpriseFormattedHomeLabel?: string; resourcesDropdown?: ResourceDropdownFormattedLabel; navigationMenuFormattedLabel?: NavigationMenuFormattedLabel; }; interface BaseHeader extends WithChildrenProp, AppHeaderAction { /** A method to be called on click/activating a header item */ action: AppHeaderClickHandler; /** A method to be called only on click/activating a *link* header item */ onLinkAction?: AppHeaderClickHandler; className?: string; hidePricing?: boolean; hideHeaderLinksInChromeless?: boolean; hideHeaderResourcesDropdown?: boolean; hideEnterpriseHeader?: boolean; localizedLabels?: localizedLabels; search: AppHeaderSearch; isInRevampedBlpExperimentVariant?: boolean; dynamicData?: GlobalHeaderDynamicData | null; dynamicDataLoading?: boolean; } export type User = { avatar: string; displayName: string; enterpriseUrl?: string; isAdmin?: boolean; isBusinessAdmin?: boolean; isBusinessSsoUser?: boolean; isCoach?: boolean; isCustomerSupport?: boolean; isAccountManager?: boolean; isPaused?: boolean; isPlusUser?: boolean; isBusinessUser?: boolean; inBusinessTrial?: boolean; isSkillsoftUser?: boolean; hasBusinessSubscription?: boolean; hasCoachingSubscription?: boolean; proCheckoutUrl?: string; showProUpgrade?: boolean; hideCareerPaths?: boolean; enrolledInTwoOrMoreContainers?: boolean; }; type LoggedInHeader = BaseHeader & { notifications: AppHeaderNotificationSettings; renderProfile?: RenderProfile; user: User; }; export type AnonHeaderVariant = 'landing' | 'login' | 'signup'; export type AnonHeader = BaseHeader & { redirectParam?: string; type: 'anon'; variant?: AnonHeaderVariant; user?: User; }; export type FreeHeader = LoggedInHeader & { type: 'free'; }; export type ProHeader = LoggedInHeader & { type: 'pro'; }; export type TeamsHeader = LoggedInHeader & { type: 'teams'; }; export type EnterpriseHeader = BaseHeader & { type: 'enterprise'; user: User; }; export type LoadingHeader = BaseHeader & { type: 'loading'; }; export type SimpleHeader = BaseHeader & { type: 'simple'; }; export type SimpleBootcampHeader = BaseHeader & { type: 'bootcamp'; bootcampSlug: string; }; export type PromotedPath = { title: string; urlPath: string; difficulty: CourseDifficulty | null; durationHours: number | null; }; export type GlobalHeaderDynamicData = { catalogDropdown: { banner: { text: string; href: string; }; skillPaths: { totalSkillPathCount: number; promotedSkillPaths: PromotedPath[]; }; careerPaths: { totalCareerPathCount: number; promotedCareerPaths: PromotedPath[]; }; certificationPaths: { totalCertificationPathCount: number; }; }; }; export {};