@codecademy/brand 3.0.0-alpha.da574fc3ea.0 → 3.1.0-alpha.02a4ffb480.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogDropdown/index.js +10 -6
  2. package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogSectionVariant/NavPanels.d.ts +10 -4
  3. package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogSectionVariant/NavPanels.js +250 -76
  4. package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogSectionVariant/NavSection.js +15 -7
  5. package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogSectionVariant/consts.d.ts +3 -1
  6. package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogSectionVariant/consts.js +11 -2
  7. package/dist/AppHeader/AppHeaderElements/AppHeaderCatalogSectionVariant/index.js +58 -26
  8. package/dist/AppHeader/AppHeaderElements/AppHeaderDietCard/index.d.ts +10 -0
  9. package/dist/AppHeader/AppHeaderElements/AppHeaderDietCard/index.js +82 -0
  10. package/dist/AppHeader/AppHeaderElements/AppHeaderDropdownProvider/index.d.ts +1 -0
  11. package/dist/AppHeader/AppHeaderElements/AppHeaderDropdownProvider/index.js +5 -2
  12. package/dist/AppHeaderMobile/AppHeaderCatalogSectonVariantMobile/index.d.ts +4 -0
  13. package/dist/AppHeaderMobile/AppHeaderCatalogSectonVariantMobile/index.js +63 -0
  14. package/dist/AppHeaderMobile/AppHeaderMainMenuMobile/index.js +34 -14
  15. package/dist/AppHeaderMobile/AppHeaderSubMenuMobile/index.js +12 -5
  16. package/dist/GlobalHeader/GlobalHeaderItems.d.ts +2 -0
  17. package/dist/GlobalHeader/GlobalHeaderItems.js +18 -1
  18. package/dist/GlobalHeader/GlobalHeaderVariants.d.ts +2 -2
  19. package/dist/GlobalHeader/GlobalHeaderVariants.js +39 -17
  20. package/dist/GlobalHeader/index.d.ts +1 -0
  21. package/dist/GlobalHeader/index.js +46 -42
  22. package/dist/GlobalHeader/types.d.ts +1 -0
  23. package/dist/LearningOutcomeFlyout/LearningOutcomeCardList.d.ts +2 -1
  24. package/dist/LearningOutcomeFlyout/LearningOutcomeCardList.js +26 -7
  25. package/dist/LearningOutcomeFlyout/index.d.ts +5 -47
  26. package/dist/LearningOutcomeFlyout/index.js +32 -21
  27. package/dist/LearningOutcomeFlyout/types.d.ts +49 -0
  28. package/dist/LearningOutcomeFlyout/types.js +5 -0
  29. package/dist/index.d.ts +0 -1
  30. package/dist/index.js +0 -1
  31. package/dist/stories/Molecules/LearningOutcomeFlyout.stories.js +8 -4
  32. package/package.json +1 -1
  33. package/dist/CourseRecommendationsLink/index.d.ts +0 -3
  34. package/dist/CourseRecommendationsLink/index.js +0 -27
@@ -1,4 +1,8 @@
1
- import { addPayment, bootcampCta, businessSolutions, catalogDropdown, communityDropdown, enterpriseLogo, freeProfile, liveLearningHub, loading, login, logo, myHome, myPercipioHome, pricingDropdown, proProfile, resourcesDropdown, signUp, simpleResourcesDropdown, tryProForFree, unpausePro, upgradePlan, upgradeToPro } from './GlobalHeaderItems';
1
+ import { addPayment, bootcampCta, businessSolutions, catalogDropdown, communityDropdown, enterpriseLogo, freeProfile, liveLearningHub, loading, login, logo, myHome, myPercipioHome, pricingDropdown, proProfile, requestTeamsDemo, resourcesDropdown, signUp, signUpTextButton, simpleResourcesDropdown, tryProForFree, unpausePro, upgradePlan, upgradeToPro } from './GlobalHeaderItems';
2
+ const isBusinessPage = isBlpHeroExperimentVariant => {
3
+ if (typeof window === 'undefined') return false;
4
+ return window.location.pathname === '/business' && Boolean(isBlpHeroExperimentVariant);
5
+ };
2
6
  const transformSimpleResourcesDropdownlabels = resourcesLabel => ({
3
7
  ...simpleResourcesDropdown,
4
8
  text: resourcesLabel?.title || simpleResourcesDropdown.text,
@@ -7,36 +11,54 @@ const transformSimpleResourcesDropdownlabels = resourcesLabel => ({
7
11
  text: resourcesLabel?.[item.id] || item.text
8
12
  }))
9
13
  });
10
- const anonHeaderItems = (renderLogin, renderSignUp, hidePricing, user) => {
14
+ const anonHeaderItems = (renderLogin, renderSignUp, hidePricing, user, isBlpHeroExperimentVariant) => {
11
15
  const specialLogo = {
12
16
  ...logo,
13
17
  checkMini: true
14
18
  };
15
19
  const leftItems = [specialLogo, catalogDropdown(user?.hideCareerPaths), resourcesDropdown(), communityDropdown(), ...(hidePricing ? [] : [pricingDropdown]), liveLearningHub, businessSolutions];
16
20
  const rightItems = [];
17
- if (renderLogin) {
18
- rightItems.push(login);
19
- }
20
- if (renderSignUp) {
21
- rightItems.push(signUp);
21
+ if (isBusinessPage(isBlpHeroExperimentVariant)) {
22
+ if (renderSignUp) {
23
+ rightItems.push(signUpTextButton);
24
+ }
25
+ if (renderLogin) {
26
+ rightItems.push(requestTeamsDemo);
27
+ }
28
+ } else {
29
+ if (renderLogin) {
30
+ rightItems.push(login);
31
+ }
32
+ if (renderSignUp) {
33
+ rightItems.push(signUp);
34
+ }
22
35
  }
23
36
  return {
24
37
  left: leftItems,
25
38
  right: rightItems
26
39
  };
27
40
  };
28
- const anonMobileHeaderItems = (renderLogin, renderSignUp, hidePricing, user) => {
41
+ const anonMobileHeaderItems = (renderLogin, renderSignUp, hidePricing, user, isBlpHeroExperimentVariant) => {
29
42
  const specialLogo = {
30
43
  ...logo,
31
44
  checkMini: true
32
45
  };
33
46
  const leftItems = [specialLogo];
34
47
  const rightItems = [];
35
- if (renderLogin) {
36
- rightItems.push(login);
37
- }
38
- if (renderSignUp) {
39
- rightItems.push(signUp);
48
+ if (isBusinessPage(isBlpHeroExperimentVariant)) {
49
+ if (renderSignUp) {
50
+ rightItems.push(signUpTextButton);
51
+ }
52
+ if (renderLogin) {
53
+ rightItems.push(requestTeamsDemo);
54
+ }
55
+ } else {
56
+ if (renderLogin) {
57
+ rightItems.push(login);
58
+ }
59
+ if (renderSignUp) {
60
+ rightItems.push(signUp);
61
+ }
40
62
  }
41
63
  const mainMenuItems = [catalogDropdown(user?.hideCareerPaths), resourcesDropdown(), communityDropdown(), ...(hidePricing ? [] : [pricingDropdown]), liveLearningHub, businessSolutions];
42
64
  return {
@@ -45,11 +67,11 @@ const anonMobileHeaderItems = (renderLogin, renderSignUp, hidePricing, user) =>
45
67
  mainMenu: mainMenuItems
46
68
  };
47
69
  };
48
- export const anonDefaultHeaderItems = (hidePricing, user) => {
49
- return anonHeaderItems(true, true, hidePricing, user);
70
+ export const anonDefaultHeaderItems = (hidePricing, user, isBlpHeroExperimentVariant) => {
71
+ return anonHeaderItems(true, true, hidePricing, user, isBlpHeroExperimentVariant);
50
72
  };
51
- export const anonDefaultMobileHeaderItems = (hidePricing, user) => {
52
- return anonMobileHeaderItems(true, true, hidePricing, user);
73
+ export const anonDefaultMobileHeaderItems = (hidePricing, user, isBlpHeroExperimentVariant) => {
74
+ return anonMobileHeaderItems(true, true, hidePricing, user, isBlpHeroExperimentVariant);
53
75
  };
54
76
  export const anonLandingHeaderItems = (hidePricing, user) => {
55
77
  return anonHeaderItems(true, false, hidePricing, user);
@@ -7,5 +7,6 @@ export declare const HeaderQuizContext: React.Context<{
7
7
  showSortingQuiz?: boolean;
8
8
  }>;
9
9
  export declare const GlobalNavRedesignContext: React.Context<boolean>;
10
+ export declare const BlpHeroExperimentContext: React.Context<boolean>;
10
11
  export type GlobalHeaderProps = AnonHeader | FreeHeader | ProHeader | EnterpriseHeader | TeamsHeader | LoadingHeader | SimpleHeader | SimpleBootcampHeader;
11
12
  export declare const GlobalHeader: React.FC<GlobalHeaderProps>;
@@ -13,6 +13,7 @@ export const HeaderQuizContext = /*#__PURE__*/React.createContext({
13
13
  showSortingQuiz: false
14
14
  });
15
15
  export const GlobalNavRedesignContext = /*#__PURE__*/React.createContext(false);
16
+ export const BlpHeroExperimentContext = /*#__PURE__*/React.createContext(false);
16
17
 
17
18
  // Overloading getAppHeaderItems function to return different types based on mobile parameter
18
19
 
@@ -30,7 +31,7 @@ function getAppHeaderItems(props, mobile) {
30
31
  case 'signup':
31
32
  return mobile ? anonSignupMobileHeaderItems(hidePricing, props.user) : anonSignupHeaderItems(hidePricing, props.user);
32
33
  default:
33
- return mobile ? anonDefaultMobileHeaderItems(hidePricing, props.user) : anonDefaultHeaderItems(hidePricing, props.user);
34
+ return mobile ? anonDefaultMobileHeaderItems(hidePricing, props.user, props.isBlpHeroExperimentVariant) : anonDefaultHeaderItems(hidePricing, props.user, props.isBlpHeroExperimentVariant);
34
35
  }
35
36
  case 'enterprise':
36
37
  return mobile ? enterpriseMobileHeaderItems(props.user, props) : enterpriseHeaderItems(props.user, props);
@@ -68,47 +69,50 @@ export const GlobalHeader = props => {
68
69
  },
69
70
  children: /*#__PURE__*/_jsx(GlobalNavRedesignContext.Provider, {
70
71
  value: !!props.displayGlobalNavRedesign,
71
- children: /*#__PURE__*/_jsx(GlobalHeaderItemClickContext.Provider, {
72
- value: {
73
- globalHeaderItemClick: combinedAction
74
- },
75
- children: /*#__PURE__*/_jsxs(Box, {
76
- as: "header",
77
- position: "sticky",
78
- top: 0,
79
- zIndex: theme.elements.headerZ,
80
- overflow: {
81
- _: 'hidden',
82
- sm: 'visible'
83
- } // Prevent tooltip overflow on mobile
84
- ,
85
- children: [/*#__PURE__*/_jsx(AppHeader, {
86
- action: combinedAction,
87
- items: getAppHeaderItems(props, false),
88
- search: props.search,
89
- ...(props.type === 'anon' ? {
90
- redirectParam: props.redirectParam
91
- } : hideNotification ? {} : {
92
- notifications: props.notifications
93
- }),
94
- hideRightButtonDefaults: hideNotification,
95
- isAnon: props.type === 'anon',
96
- isTeams: props.type === 'teams',
97
- type: hideNotification ? 'enterprise' : 'standard'
98
- }), /*#__PURE__*/_jsx(AppHeaderMobile, {
99
- action: combinedAction,
100
- items: getAppHeaderItems(props, true),
101
- ...(props.type === 'anon' || hideNotification ? {} : {
102
- notifications: props.notifications
103
- }),
104
- search: props.search,
105
- redirectParam: props.type === 'anon' ? props.redirectParam : undefined,
106
- isEnterprise: props.type === 'enterprise',
107
- isAnon: props.type === 'anon',
108
- isSimple: props.type === 'simple',
109
- hideRightMenuButton: props.type === 'simple' || props.type === 'loading',
110
- navigationMenuFormattedLabel: props?.localizedLabels?.navigationMenuFormattedLabel
111
- }), props.children]
72
+ children: /*#__PURE__*/_jsx(BlpHeroExperimentContext.Provider, {
73
+ value: !!props.isBlpHeroExperimentVariant,
74
+ children: /*#__PURE__*/_jsx(GlobalHeaderItemClickContext.Provider, {
75
+ value: {
76
+ globalHeaderItemClick: combinedAction
77
+ },
78
+ children: /*#__PURE__*/_jsxs(Box, {
79
+ as: "header",
80
+ position: "sticky",
81
+ top: 0,
82
+ zIndex: theme.elements.headerZ,
83
+ overflow: {
84
+ _: 'hidden',
85
+ sm: 'visible'
86
+ } // Prevent tooltip overflow on mobile
87
+ ,
88
+ children: [/*#__PURE__*/_jsx(AppHeader, {
89
+ action: combinedAction,
90
+ items: getAppHeaderItems(props, false),
91
+ search: props.search,
92
+ ...(props.type === 'anon' ? {
93
+ redirectParam: props.redirectParam
94
+ } : hideNotification ? {} : {
95
+ notifications: props.notifications
96
+ }),
97
+ hideRightButtonDefaults: hideNotification,
98
+ isAnon: props.type === 'anon',
99
+ isTeams: props.type === 'teams',
100
+ type: hideNotification ? 'enterprise' : 'standard'
101
+ }), /*#__PURE__*/_jsx(AppHeaderMobile, {
102
+ action: combinedAction,
103
+ items: getAppHeaderItems(props, true),
104
+ ...(props.type === 'anon' || hideNotification ? {} : {
105
+ notifications: props.notifications
106
+ }),
107
+ search: props.search,
108
+ redirectParam: props.type === 'anon' ? props.redirectParam : undefined,
109
+ isEnterprise: props.type === 'enterprise',
110
+ isAnon: props.type === 'anon',
111
+ isSimple: props.type === 'simple',
112
+ hideRightMenuButton: props.type === 'simple' || props.type === 'loading',
113
+ navigationMenuFormattedLabel: props?.localizedLabels?.navigationMenuFormattedLabel
114
+ }), props.children]
115
+ })
112
116
  })
113
117
  })
114
118
  })
@@ -31,6 +31,7 @@ interface BaseHeader extends WithChildrenProp, AppHeaderAction {
31
31
  localizedLabels?: localizedLabels;
32
32
  search: AppHeaderSearch;
33
33
  displayGlobalNavRedesign?: boolean;
34
+ isBlpHeroExperimentVariant?: boolean;
34
35
  }
35
36
  export type User = {
36
37
  avatar: string;
@@ -1,6 +1,7 @@
1
- import { ParentLearningOutcome } from '../LearningOutcomeFlyout';
1
+ import { ParentLearningOutcome } from './types';
2
2
  interface LearningOutcomeCardListProps {
3
3
  learningOutcomes: ParentLearningOutcome[];
4
+ onClick?: (misc: Record<string, string>) => void;
4
5
  }
5
6
  export declare const LearningOutcomeCardList: React.FC<LearningOutcomeCardListProps>;
6
7
  export {};
@@ -1,8 +1,10 @@
1
- import { FlexBox } from '@codecademy/gamut';
1
+ import { Anchor, Box, FlexBox } from '@codecademy/gamut';
2
2
  import { LearningOutcomeCard } from '../LearningOutcomeCard';
3
+ import { getLearningOutcomePath, miscTrackingData } from '.';
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
4
5
  export const LearningOutcomeCardList = ({
5
- learningOutcomes
6
+ learningOutcomes,
7
+ onClick
6
8
  }) => {
7
9
  return /*#__PURE__*/_jsx(FlexBox, {
8
10
  as: "ul",
@@ -14,10 +16,27 @@ export const LearningOutcomeCardList = ({
14
16
  id,
15
17
  level,
16
18
  outcome
17
- }) => /*#__PURE__*/_jsx(LearningOutcomeCard, {
18
- as: "li",
19
- level: level,
20
- outcome: outcome
21
- }, id))
19
+ }) => {
20
+ const trackingData = miscTrackingData(level, id, undefined, outcome);
21
+ return /*#__PURE__*/_jsx(Box, {
22
+ as: "li",
23
+ listStyle: "none",
24
+ m: 0,
25
+ p: 0,
26
+ width: "100%",
27
+ children: /*#__PURE__*/_jsx(Anchor, {
28
+ href: getLearningOutcomePath(id),
29
+ onClick: () => onClick?.(trackingData),
30
+ target: "_blank",
31
+ variant: "interface",
32
+ width: "100%",
33
+ children: /*#__PURE__*/_jsx(LearningOutcomeCard, {
34
+ level: level,
35
+ outcome: outcome,
36
+ isInteractive: true
37
+ })
38
+ })
39
+ }, id);
40
+ })
22
41
  });
23
42
  };
@@ -1,50 +1,8 @@
1
1
  import { LearningOutcomeLevels } from '../LearningOutcomeBadges';
2
- export declare enum SkillClassification {
3
- Language = "language",
4
- Subject = "subject"
5
- }
6
- interface LearningOutcomeSkill {
7
- id: string;
8
- slug: string;
9
- title?: string | null;
10
- classification?: SkillClassification | null;
11
- }
12
- export interface ParentLearningOutcome {
13
- id: string;
14
- outcome: string;
15
- level: number | null | undefined;
16
- }
17
- export interface LearningOutcomeDetailsProps {
18
- level: LearningOutcomeLevels;
19
- outcome: string;
20
- percentComplete: number | undefined | null;
21
- highestScore: number | undefined | null;
22
- highestScoreAchievedAt: string | undefined | null;
23
- latestScore: number | undefined | null;
24
- latestScoreAchievedAt: string | undefined | null;
25
- parentLOs?: ParentLearningOutcome[];
26
- skills?: LearningOutcomeSkill[] | null;
27
- childLearningOutcomes?: {
28
- id: string;
29
- outcome: string;
30
- percentComplete?: number | undefined | null;
31
- progress?: {
32
- latestScore?: number | null;
33
- covered: boolean | undefined | null;
34
- coveredAt?: string | null;
35
- highestScore?: number | null;
36
- };
37
- }[];
38
- }
39
- interface LearningOutcomeFlyoutProps {
40
- expanded: boolean;
41
- onClose: () => void;
42
- learningOutcome: LearningOutcomeDetailsProps;
43
- learningOutcomeHref: string;
44
- learningOutcomeOnClick?: () => void;
45
- skillTagOnClick?: (skillSlug: string) => void;
46
- childLearningOutcomeOnClick?: () => void;
47
- }
2
+ import { LearningOutcomeFlyoutProps, LearningOutcomeSkill } from './types';
48
3
  export declare const sortSkillsByClassification: (skills?: LearningOutcomeSkill[] | null) => LearningOutcomeSkill[];
4
+ export declare const getLearningOutcomePath: (id?: string) => string;
5
+ export declare const miscTrackingData: (level?: LearningOutcomeLevels | null, id?: string, latestScore?: number | null, outcome?: string) => {
6
+ misc: string;
7
+ };
49
8
  export declare const LearningOutcomeFlyout: React.FC<LearningOutcomeFlyoutProps>;
50
- export {};