@codecademy/brand 2.5.0-alpha.975930aaa2.0 → 2.5.0-alpha.ad2b33dddb.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 (32) hide show
  1. package/dist/AppHeader/AppHeaderElements/AppHeaderLinkSections/index.js +0 -0
  2. package/dist/Banner/index.d.ts +0 -10
  3. package/dist/Banner/index.js +3 -24
  4. package/dist/CareerPathCard/index.d.ts +1 -4
  5. package/dist/CareerPathCard/index.js +7 -15
  6. package/dist/CertificationPathCard/index.d.ts +1 -4
  7. package/dist/CertificationPathCard/index.js +9 -17
  8. package/dist/ContentGroupBaseCard/index.d.ts +3 -5
  9. package/dist/ContentGroupBaseCard/index.js +72 -129
  10. package/dist/ContentGroupBaseCard/shared.js +23 -29
  11. package/dist/CourseCard/index.d.ts +1 -4
  12. package/dist/CourseCard/index.js +11 -15
  13. package/dist/GlobalPage/index.d.ts +2 -2
  14. package/dist/GlobalPage/index.js +2 -2
  15. package/dist/Recurly/context/recurly/index.js +1 -1
  16. package/dist/Recurly/context/recurly/loadRecurly.d.ts +1 -1
  17. package/dist/Recurly/context/recurly/loadRecurly.js +2 -2
  18. package/dist/Recurly/context/recurly/w.d.ts +1 -1
  19. package/dist/Recurly/context/recurly/w.js +1 -1
  20. package/dist/SkillPathCard/index.d.ts +1 -4
  21. package/dist/SkillPathCard/index.js +7 -15
  22. package/dist/stories/Molecules/ContentGroupBaseCard.stories.js +1 -3
  23. package/dist/stories/Molecules/CurriculumCards/CareerPathCard.stories.js +1 -3
  24. package/dist/stories/Molecules/CurriculumCards/CertificationPathCard.stories.js +1 -3
  25. package/dist/stories/Molecules/CurriculumCards/CourseCard.stories.js +1 -3
  26. package/dist/stories/Molecules/CurriculumCards/SkillPathCard.stories.js +1 -3
  27. package/dist/stories/Molecules/EnhancedBanner.stories.d.ts +3 -3
  28. package/dist/stories/Molecules/EnhancedBanner.stories.js +2 -12
  29. package/package.json +1 -1
  30. package/dist/Recurly/context/elements/index.test.js +0 -88
  31. package/dist/Recurly/context/recurly/index.test.js +0 -63
  32. package/dist/Recurly/context/recurly/loadRecurly.test.js +0 -57
@@ -4,7 +4,7 @@ import { CertificateIcon, UnlockIcon } from '@codecademy/gamut-icons';
4
4
  import { CheckerDense } from '@codecademy/gamut-patterns';
5
5
  import { css } from '@codecademy/gamut-styles';
6
6
  import pluralize from 'pluralize';
7
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
8
8
  const DottedLine = /*#__PURE__*/_styled(CheckerDense, {
9
9
  target: "e16fp6ou0",
10
10
  label: "DottedLine"
@@ -13,7 +13,7 @@ const DottedLine = /*#__PURE__*/_styled(CheckerDense, {
13
13
  display: 'flex',
14
14
  position: 'absolute',
15
15
  marginTop: '-1px'
16
- }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9Db250ZW50R3JvdXBCYXNlQ2FyZC9zaGFyZWQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9tQiIsImZpbGUiOiIuLi8uLi9zcmMvQ29udGVudEdyb3VwQmFzZUNhcmQvc2hhcmVkLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEJveCwgRmxleEJveCwgVGV4dCB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0JztcbmltcG9ydCB7IENlcnRpZmljYXRlSWNvbiwgVW5sb2NrSWNvbiB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LWljb25zJztcbmltcG9ydCB7IENoZWNrZXJEZW5zZSB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LXBhdHRlcm5zJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LXN0e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gICAgICAgIEluY2x1ZGVzeycgJ31cbiAgICAgICAgPGI+XG4gICAgICAgICAge2NvdW50fSB7bGFiZWx9XG4gICAgICAgIDwvYj5cbiAgICAgIDwvVGV4dD5cbiAgICA8L0JveD5cbiAgKTtcbn07XG4iXX0= */");
16
+ }), process.env.NODE_ENV === "production" ? "" : "/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9Db250ZW50R3JvdXBCYXNlQ2FyZC9zaGFyZWQudHN4Il0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQU9tQiIsImZpbGUiOiIuLi8uLi9zcmMvQ29udGVudEdyb3VwQmFzZUNhcmQvc2hhcmVkLnRzeCIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEJveCwgRmxleEJveCwgVGV4dCB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0JztcbmltcG9ydCB7IENlcnRpZmljYXRlSWNvbiwgVW5sb2NrSWNvbiB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LWljb25zJztcbmltcG9ydCB7IENoZWNrZXJEZW5zZSB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LXBhdHRlcm5zJztcbmltcG9ydCB7IGNzcyB9IGZyb20gJ0Bjb2RlY2FkZW15L2dhbXV0LXN0eWxlcyc7XG5pbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XG5pbXBvcnQgcGx1cmFsaXplIGZyb20gJ3BsdXJhbGl6ZSc7XG5cbmNvbnN0IERvdHRlZExpbmUgPSBzdHlsZWQoQ2hlY2tlckRlbnNlKShcbiAgY3NzKHtcbiAgICBoZWlnaHQ6ICcxcHgnLFxuICAgIGRpc3BsYXk6ICdmbGV4JyxcbiAgICBwb3NpdGlvbjogJ2Fic29sdXRlJyxcbiAgICBtYXJnaW5Ub3A6ICctMXB4JyxcbiAgfSlcbik7XG5cbmV4c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PlxuICAgICAgPEZsZXhCb3ggYWxpZ25JdGVtcz1cImNlbnRlclwiPlxuICAgICAgICA8RmxleEJveCBwcj17NH0+XG4gICAgICAgICAgPFVubG9ja0ljb24gLz5cbiAgICAgICAgPC9GbGV4Qm94PlxuICAgICAgICA8VGV4dCB2YXJpYW50PVwicC1zbWFsbFwiIHBsPXs0fT5cbiAgICAgICAgICBTdGFydCBjb3Vyc2Ugd2l0aCB5b3VyIEJhc2ljIHBsYW5cbiAgICAgICAgPC9UZXh0PlxuICAgICAgPC9GbGV4Qm94PlxuICAgIDwvPlxuICApO1xufTtcblxuZXhwb3J0IGNvbnN0IENvdXJzZUNvdW50Q29tcG9uZW50OiBSZWFjdC5GQzx7IGNvdW50OiBudW1iZXIgfT4gPSAoe1xuICBjb3VudCxcbn0pID0+IHtcbiAgY29uc3QgbGFiZWwgPSBwbHVyYWxpemUoJ0NvdXJzZXMnLCBjb3VudCk7XG5cbiAgcmV0dXJuIChcbiAgICA8VGV4dCB2YXJpYW50PVwicC1zbWFsbFwiIGFyaWEtbGFiZWw9e2BJbmNsdWRlcyAke2NvdW50fSAke2xhYmVsfWB9PlxuICAgICAgSW5jbHVkZXN7JyAnfVxuICAgICAgPGI+XG4gICAgICAgIHtjb3VudH0ge2xhYmVsfVxuICAgICAgPC9iPlxuICAgIDwvVGV4dD5cbiAgKTtcbn07XG4iXX0= */");
17
17
  export const Divider = () => {
18
18
  return (
19
19
  /*#__PURE__*/
@@ -22,7 +22,6 @@ export const Divider = () => {
22
22
  py: 4,
23
23
  height: 0,
24
24
  position: "relative",
25
- "aria-hidden": true,
26
25
  children: /*#__PURE__*/_jsx(DottedLine, {})
27
26
  })
28
27
  );
@@ -31,52 +30,47 @@ export const CertificateComponent = ({
31
30
  professionalCert
32
31
  }) => {
33
32
  const certificateType = professionalCert ? `Professional Certification` : `Certificate`;
34
- return /*#__PURE__*/_jsxs(Box, {
35
- as: "li",
36
- children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(FlexBox, {
33
+ return /*#__PURE__*/_jsx(_Fragment, {
34
+ children: /*#__PURE__*/_jsxs(FlexBox, {
37
35
  alignItems: "center",
38
- children: [/*#__PURE__*/_jsx(CertificateIcon, {}), /*#__PURE__*/_jsx(Text, {
39
- screenreader: true,
40
- children: `With ${certificateType}`
36
+ children: [/*#__PURE__*/_jsx(FlexBox, {
37
+ pr: 4,
38
+ children: /*#__PURE__*/_jsx(CertificateIcon, {})
41
39
  }), /*#__PURE__*/_jsxs(Text, {
42
40
  variant: "p-small",
43
- pl: 8,
44
- "aria-hidden": true,
41
+ pl: 4,
42
+ "aria-label": `With ${certificateType}`,
45
43
  children: ["With ", /*#__PURE__*/_jsx("b", {
46
44
  children: certificateType
47
45
  })]
48
46
  })]
49
- })]
47
+ })
50
48
  });
51
49
  };
52
50
  export const FreeModuleComponent = () => {
53
- return /*#__PURE__*/_jsxs(Box, {
54
- as: "li",
55
- children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsxs(FlexBox, {
51
+ return /*#__PURE__*/_jsx(_Fragment, {
52
+ children: /*#__PURE__*/_jsxs(FlexBox, {
56
53
  alignItems: "center",
57
- children: [/*#__PURE__*/_jsx(UnlockIcon, {}), /*#__PURE__*/_jsx(Text, {
54
+ children: [/*#__PURE__*/_jsx(FlexBox, {
55
+ pr: 4,
56
+ children: /*#__PURE__*/_jsx(UnlockIcon, {})
57
+ }), /*#__PURE__*/_jsx(Text, {
58
58
  variant: "p-small",
59
- pl: 8,
59
+ pl: 4,
60
60
  children: "Start course with your Basic plan"
61
61
  })]
62
- })]
62
+ })
63
63
  });
64
64
  };
65
65
  export const CourseCountComponent = ({
66
66
  count
67
67
  }) => {
68
68
  const label = pluralize('Courses', count);
69
- return /*#__PURE__*/_jsxs(Box, {
70
- as: "li",
71
- children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(Text, {
72
- screenreader: true,
73
- children: `Includes ${count} ${label}`
74
- }), /*#__PURE__*/_jsxs(Text, {
75
- variant: "p-small",
76
- "aria-hidden": true,
77
- children: ["Includes", ' ', /*#__PURE__*/_jsxs("b", {
78
- children: [count, " ", label]
79
- })]
69
+ return /*#__PURE__*/_jsxs(Text, {
70
+ variant: "p-small",
71
+ "aria-label": `Includes ${count} ${label}`,
72
+ children: ["Includes", ' ', /*#__PURE__*/_jsxs("b", {
73
+ children: [count, " ", label]
80
74
  })]
81
75
  });
82
76
  };
@@ -16,8 +16,5 @@ export type CourseCardProps = {
16
16
  isInOpenFirstModuleVariant?: boolean;
17
17
  header?: React.ReactNode;
18
18
  footer?: React.ReactNode;
19
- openInNewTab?: boolean;
20
- href: string;
21
- onClick: () => void;
22
19
  };
23
- export declare const CourseCard: import("react").ForwardRefExoticComponent<CourseCardProps & import("react").RefAttributes<HTMLAnchorElement>>;
20
+ export declare const CourseCard: React.FC<CourseCardProps>;
@@ -1,8 +1,7 @@
1
- import { forwardRef } from 'react';
2
1
  import { ContentGroupBaseCard } from '../ContentGroupBaseCard';
3
- import { CertificateComponent, FreeModuleComponent } from '../ContentGroupBaseCard/shared';
4
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
5
- export const CourseCard = /*#__PURE__*/forwardRef(({
2
+ import { CertificateComponent, Divider, FreeModuleComponent } from '../ContentGroupBaseCard/shared';
3
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
4
+ export const CourseCard = ({
6
5
  title,
7
6
  lessonCount,
8
7
  contentModuleIds,
@@ -17,11 +16,8 @@ export const CourseCard = /*#__PURE__*/forwardRef(({
17
16
  isProUser = false,
18
17
  isInOpenFirstModuleVariant = false,
19
18
  header,
20
- footer,
21
- openInNewTab = false,
22
- href,
23
- onClick
24
- }, ref) => {
19
+ footer
20
+ }) => {
25
21
  // only show certificates for pro exclusive courses, since only pro users can do pro courses & only pro users can gain certificates
26
22
  // edge case here: pro users who are logged in wont be able to tell - from the card - that a free course can grant them a cert as well
27
23
  const showCertificate = grantsCertificate && pro;
@@ -42,10 +38,10 @@ export const CourseCard = /*#__PURE__*/forwardRef(({
42
38
  timeToComplete: timeToComplete,
43
39
  header: header,
44
40
  footer: footer,
45
- openInNewTab: openInNewTab,
46
- href: href,
47
- onClick: onClick,
48
- ref: ref,
49
- children: [showFreeFirstModule && /*#__PURE__*/_jsx(FreeModuleComponent, {}), showCertificate && /*#__PURE__*/_jsx(CertificateComponent, {})]
41
+ children: [showFreeFirstModule && /*#__PURE__*/_jsxs(_Fragment, {
42
+ children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(FreeModuleComponent, {})]
43
+ }), showCertificate && /*#__PURE__*/_jsxs(_Fragment, {
44
+ children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(CertificateComponent, {})]
45
+ })]
50
46
  });
51
- });
47
+ };
@@ -1,6 +1,6 @@
1
1
  import { ModalProps, WithChildrenProp } from '@codecademy/gamut';
2
2
  import * as React from 'react';
3
- import { BannerProps } from '../Banner';
3
+ import { EnhancedBannerProps } from '../Banner/EnhancedBanner';
4
4
  import { GlobalFooterProps } from '../GlobalFooter';
5
5
  import { GlobalHeaderProps } from '../GlobalHeader';
6
6
  export type GlobalPageBackgroundColor = 'beige' | 'background' | 'background-contrast' | 'navy' | 'paleBlue' | 'paleGreen' | 'palePink' | 'paleYellow' | 'white';
@@ -9,7 +9,7 @@ export interface GlobalPageProps extends WithChildrenProp {
9
9
  /**
10
10
  * Props directly passed to the Banner.
11
11
  */
12
- banner?: BannerProps;
12
+ banner?: EnhancedBannerProps;
13
13
  /**
14
14
  * Element type to render around the children.
15
15
  */
@@ -2,7 +2,7 @@ import { AppWrapper, Modal, SkipToContent, SkipToContentTarget } from '@codecade
2
2
  import { Background } from '@codecademy/gamut-styles';
3
3
  import { forwardRef } from 'react';
4
4
  import * as React from 'react';
5
- import { Banner } from '../Banner';
5
+ import { EnhancedBanner } from '../Banner/EnhancedBanner';
6
6
  import { GlobalFooter } from '../GlobalFooter';
7
7
  import { GlobalHeader } from '../GlobalHeader';
8
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
@@ -35,7 +35,7 @@ export const GlobalPage = ({
35
35
  minHeight: "100vh",
36
36
  children: [/*#__PURE__*/_jsx(SkipToContent, {
37
37
  contentId: skipToContentId || defaultSkipToContentId
38
- }), banner && /*#__PURE__*/_jsx(Banner, {
38
+ }), banner && /*#__PURE__*/_jsx(EnhancedBanner, {
39
39
  ...banner
40
40
  }), !header.hideEnterpriseHeader && /*#__PURE__*/_jsx(GlobalHeader, {
41
41
  ...header
@@ -16,7 +16,7 @@ export function RecurlyProvider({
16
16
  }) {
17
17
  const [recurly, setRecurly] = useState(undefined);
18
18
  useEffect(() => {
19
- loadRecurly(config).then(setRecurly);
19
+ loadRecurly(config)?.then(setRecurly);
20
20
  // Exclude `config` dependency as it should be treated as static.
21
21
  // eslint-disable-next-line react-hooks/exhaustive-deps
22
22
  }, []);
@@ -3,4 +3,4 @@ export type RecurlyConfig = {
3
3
  publicKey: string;
4
4
  required: string[];
5
5
  };
6
- export declare function loadRecurly(config: RecurlyConfig): Promise<Recurly>;
6
+ export declare function loadRecurly(config: RecurlyConfig): Promise<Recurly> | undefined;
@@ -1,6 +1,6 @@
1
1
  import { w } from './w';
2
2
  export function loadRecurly(config) {
3
- if (!w._recurlyPromise) {
3
+ if (w && w._recurlyPromise) {
4
4
  w._recurlyPromise = new Promise(resolve => {
5
5
  const script = w.document.createElement('script');
6
6
  script.src = 'https://js.recurly.com/v4/recurly.js';
@@ -18,5 +18,5 @@ export function loadRecurly(config) {
18
18
  w.document.head.appendChild(script);
19
19
  });
20
20
  }
21
- return w._recurlyPromise;
21
+ return w?._recurlyPromise;
22
22
  }
@@ -10,5 +10,5 @@ export type W = {
10
10
  _recurlyPromise?: Promise<Recurly>;
11
11
  document: Doc;
12
12
  };
13
- export declare const w: W;
13
+ export declare const w: W | undefined;
14
14
  export {};
@@ -1,4 +1,4 @@
1
1
  // By importing/exporting w as a window object, we can easily mock it in tests.
2
2
 
3
3
  // Exported for easy mocking
4
- export const w = window;
4
+ export const w = typeof window === 'undefined' ? undefined : window;
@@ -13,8 +13,5 @@ export interface SkillPathCardProps {
13
13
  timeToComplete?: number | null;
14
14
  header?: React.ReactNode;
15
15
  footer?: React.ReactNode;
16
- openInNewTab?: boolean;
17
- href: string;
18
- onClick: () => void;
19
16
  }
20
- export declare const SkillPathCard: import("react").ForwardRefExoticComponent<SkillPathCardProps & import("react").RefAttributes<HTMLAnchorElement>>;
17
+ export declare const SkillPathCard: React.FC<SkillPathCardProps>;
@@ -1,9 +1,8 @@
1
- import { forwardRef } from 'react';
2
1
  import { ContentGroupBaseCard } from '../ContentGroupBaseCard';
3
2
  import { getPathImageUrl } from '../ContentGroupBaseCard/helpers';
4
- import { CertificateComponent, CourseCountComponent } from '../ContentGroupBaseCard/shared';
3
+ import { CertificateComponent, CourseCountComponent, Divider } from '../ContentGroupBaseCard/shared';
5
4
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
- export const SkillPathCard = /*#__PURE__*/forwardRef(({
5
+ export const SkillPathCard = ({
7
6
  title,
8
7
  shortDescription,
9
8
  difficulty,
@@ -15,11 +14,8 @@ export const SkillPathCard = /*#__PURE__*/forwardRef(({
15
14
  isFullSize = false,
16
15
  timeToComplete,
17
16
  header,
18
- footer,
19
- openInNewTab = false,
20
- href,
21
- onClick
22
- }, ref) => {
17
+ footer
18
+ }) => {
23
19
  return /*#__PURE__*/_jsxs(ContentGroupBaseCard, {
24
20
  headerBackgroundColor: "blue-100",
25
21
  headerText: "Skill path",
@@ -35,12 +31,8 @@ export const SkillPathCard = /*#__PURE__*/forwardRef(({
35
31
  timeToComplete: timeToComplete,
36
32
  header: header,
37
33
  footer: footer,
38
- openInNewTab: openInNewTab,
39
- href: href,
40
- onClick: onClick,
41
- ref: ref,
42
- children: [/*#__PURE__*/_jsx(CourseCountComponent, {
34
+ children: [/*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(CourseCountComponent, {
43
35
  count: courseCount
44
- }), /*#__PURE__*/_jsx(CertificateComponent, {})]
36
+ }), /*#__PURE__*/_jsx(Divider, {}), /*#__PURE__*/_jsx(CertificateComponent, {})]
45
37
  });
46
- });
38
+ };
@@ -8,9 +8,7 @@ const meta = {
8
8
  headerBackgroundColor: 'pink',
9
9
  headerText: 'Course',
10
10
  title: 'Python 101',
11
- numLessons: 20,
12
- href: '/learn/python-101',
13
- onClick: () => {}
11
+ numLessons: 20
14
12
  }
15
13
  };
16
14
  export default meta;
@@ -9,9 +9,7 @@ const meta = {
9
9
  difficulty: CourseDifficulty.Beginner,
10
10
  title: 'Python 101',
11
11
  imageUrl: 'https://static-assets.codecademy.com/components/curriculum/path/front-end-engineer-career-path/curriculum-card.svg',
12
- timeToComplete: 15,
13
- href: '/learn/paths/python-101',
14
- onClick: () => {}
12
+ timeToComplete: 15
15
13
  }
16
14
  };
17
15
  export default meta;
@@ -7,9 +7,7 @@ const meta = {
7
7
  title: 'CLF-C02: AWS Certified Cloud Practitioner',
8
8
  courseCount: 16,
9
9
  shortDescription: 'Master AWS Cloud fundamentals, security, and migration strategies to prepare for the AWS Certified Cloud Practitioner exam (CLF-C02) and enhance your cloud skills.',
10
- difficulty: CourseDifficulty.Beginner,
11
- href: '/learn/ext-paths/certification-prep-clf-c02',
12
- onClick: () => {}
10
+ difficulty: CourseDifficulty.Beginner
13
11
  }
14
12
  };
15
13
  export default meta;
@@ -9,9 +9,7 @@ const meta = {
9
9
  pro: false,
10
10
  shortDescription: 'Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.',
11
11
  difficulty: CourseDifficulty.Beginner,
12
- timeToComplete: 3,
13
- href: '/learn/javascript',
14
- onClick: () => {}
12
+ timeToComplete: 3
15
13
  }
16
14
  };
17
15
  export default meta;
@@ -9,9 +9,7 @@ const meta = {
9
9
  shortDescription: 'Web applications are constantly under threat. Authentication and authorization, protected data, and secure code will protect your web app.',
10
10
  difficulty: CourseDifficulty.Intermediate,
11
11
  imageUrl: 'https://static-assets.codecademy.com/components/curriculum/path/securing-express-applications/curriculum-card.svg',
12
- timeToComplete: 10,
13
- href: '/learn/paths/securing-express-applications',
14
- onClick: () => {}
12
+ timeToComplete: 10
15
13
  }
16
14
  };
17
15
  export default meta;
@@ -1,8 +1,8 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react';
2
- import { Banner } from '../../index';
3
- declare const meta: Meta<typeof Banner>;
2
+ import { EnhancedBanner } from '../../Banner/EnhancedBanner';
3
+ declare const meta: Meta<typeof EnhancedBanner>;
4
4
  export default meta;
5
- type Story = StoryObj<typeof Banner>;
5
+ type Story = StoryObj<typeof EnhancedBanner>;
6
6
  export declare const WithCountdownTimer: Story;
7
7
  export declare const WithoutCountdownTimer: Story;
8
8
  export declare const YellowVariant: Story;
@@ -1,8 +1,8 @@
1
1
  import { action } from '@storybook/addon-actions';
2
- import { Banner } from '../../index';
2
+ import { EnhancedBanner } from '../../Banner/EnhancedBanner';
3
3
  const meta = {
4
4
  title: 'Molecules/Enhanced Banner',
5
- component: Banner,
5
+ component: EnhancedBanner,
6
6
  argTypes: {
7
7
  header: {
8
8
  control: 'text',
@@ -25,15 +25,6 @@ const meta = {
25
25
  control: 'text',
26
26
  description: 'ISO date string for countdown timer (e.g., "2024-12-31T23:59:59Z")'
27
27
  },
28
- isInEnhancedBannerVariant: {
29
- control: 'boolean',
30
- description: 'Enable enhanced banner features',
31
- table: {
32
- defaultValue: {
33
- summary: 'true'
34
- }
35
- }
36
- },
37
28
  onClose: {
38
29
  action: 'closed',
39
30
  description: 'Callback when banner is closed'
@@ -48,7 +39,6 @@ const meta = {
48
39
  }
49
40
  },
50
41
  args: {
51
- isInEnhancedBannerVariant: true,
52
42
  variant: 'navy',
53
43
  onClose: action('banner-closed'),
54
44
  onCtaClick: action('cta-clicked'),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecademy/brand",
3
3
  "description": "Brand component library for Codecademy",
4
- "version": "2.5.0-alpha.975930aaa2.0",
4
+ "version": "2.5.0-alpha.ad2b33dddb.0",
5
5
  "author": "Codecademy Engineering <dev@codecademy.com>",
6
6
  "dependencies": {
7
7
  "@emotion/is-prop-valid": "^1.2.1",
@@ -1,88 +0,0 @@
1
- import { setupRtl } from '@codecademy/gamut-tests';
2
- import { RecurlyProvider } from '../recurly';
3
- import { Elements, useElements } from '.';
4
- import { jsx as _jsx } from "react/jsx-runtime";
5
- let mockRecurlyPromise;
6
- jest.mock('../recurly/loadRecurly', () => ({
7
- loadRecurly: () => mockRecurlyPromise
8
- }));
9
- const renderView = setupRtl(({
10
- children
11
- }) => children);
12
- const jsEventLoop = () => new Promise(r => setTimeout(r, 0));
13
- describe('Elements', () => {
14
- it('should show content before recurly loads', () => {
15
- mockRecurlyPromise = new Promise(() => {
16
- // never resolve
17
- });
18
- const {
19
- view
20
- } = renderView({
21
- children: /*#__PURE__*/_jsx(RecurlyProvider, {
22
- publicKey: "testKey",
23
- required: ['cvv', 'postal_code'],
24
- children: /*#__PURE__*/_jsx(Elements, {
25
- children: "test-content"
26
- })
27
- })
28
- });
29
- expect(view.getByText('test-content')).toBeInTheDocument();
30
- });
31
- it('should call Elements on recurly', async () => {
32
- const mockRecurly = {
33
- Elements: jest.fn()
34
- };
35
- mockRecurlyPromise = Promise.resolve(mockRecurly);
36
- renderView({
37
- children: /*#__PURE__*/_jsx(RecurlyProvider, {
38
- publicKey: "testKey",
39
- required: ['cvv', 'postal_code'],
40
- children: /*#__PURE__*/_jsx(Elements, {})
41
- })
42
- });
43
- await jsEventLoop(); // one for the Provider's useEffect to run
44
- await jsEventLoop(); // one for the subsequent re-render where useMemo runs
45
- expect(mockRecurly.Elements).toHaveBeenCalled();
46
- });
47
- });
48
- describe('useElements', () => {
49
- const Consumer = () => {
50
- try {
51
- const elements = useElements();
52
- return /*#__PURE__*/_jsx("div", {
53
- children: typeof elements
54
- });
55
- } catch {
56
- return /*#__PURE__*/_jsx("div", {
57
- children: "error"
58
- });
59
- }
60
- };
61
- it('throws an error when used without a Elements provider', () => {
62
- const {
63
- view
64
- } = renderView({
65
- children: /*#__PURE__*/_jsx(Consumer, {})
66
- });
67
- expect(view.getByText('error')).toBeInTheDocument();
68
- });
69
- it('returns null initially, then an Elements instance once Recurly loads', async () => {
70
- const mockRecurly = {
71
- Elements: () => ({})
72
- };
73
- mockRecurlyPromise = Promise.resolve(mockRecurly);
74
- const {
75
- view
76
- } = renderView({
77
- children: /*#__PURE__*/_jsx(RecurlyProvider, {
78
- publicKey: "testKey",
79
- required: ['cvv', 'postal_code'],
80
- children: /*#__PURE__*/_jsx(Elements, {
81
- children: /*#__PURE__*/_jsx(Consumer, {})
82
- })
83
- })
84
- });
85
- expect(view.getByText('undefined')).toBeInTheDocument();
86
- expect(await view.findByText('object')).toBeInTheDocument();
87
- });
88
- });
@@ -1,63 +0,0 @@
1
- import { setupRtl } from '@codecademy/gamut-tests';
2
- import { RecurlyProvider, useRecurly } from '.';
3
- import { jsx as _jsx } from "react/jsx-runtime";
4
- let mockRecurlyPromise;
5
- jest.mock('./loadRecurly', () => ({
6
- loadRecurly: () => mockRecurlyPromise
7
- }));
8
- describe('RecurlyProvider', () => {
9
- const renderView = setupRtl(RecurlyProvider);
10
- it('should show content before recurly loads', () => {
11
- mockRecurlyPromise = new Promise(() => {
12
- // never resolve
13
- });
14
- const {
15
- view
16
- } = renderView({
17
- publicKey: 'testKey',
18
- required: ['cvv', 'postal_code'],
19
- children: 'test-content'
20
- });
21
- expect(view.getByText('test-content')).toBeInTheDocument();
22
- });
23
- });
24
- describe('useRecurly', () => {
25
- const renderView = setupRtl(({
26
- children
27
- }) => children);
28
- const Consumer = () => {
29
- try {
30
- const recurly = useRecurly();
31
- return /*#__PURE__*/_jsx("div", {
32
- children: typeof recurly
33
- });
34
- } catch {
35
- return /*#__PURE__*/_jsx("div", {
36
- children: "error"
37
- });
38
- }
39
- };
40
- it('throws an error when used without a RecurlyProvider', () => {
41
- mockRecurlyPromise = Promise.resolve({});
42
- const {
43
- view
44
- } = renderView({
45
- children: /*#__PURE__*/_jsx(Consumer, {})
46
- });
47
- expect(view.getByText('error')).toBeInTheDocument();
48
- });
49
- it('returns undefined and then an instance when used inside a RecurlyProvider', async () => {
50
- mockRecurlyPromise = Promise.resolve({});
51
- const {
52
- view
53
- } = renderView({
54
- children: /*#__PURE__*/_jsx(RecurlyProvider, {
55
- publicKey: "testKey",
56
- required: ['cvv', 'postal_code'],
57
- children: /*#__PURE__*/_jsx(Consumer, {})
58
- })
59
- });
60
- expect(view.getByText('undefined')).toBeInTheDocument();
61
- expect(await view.findByText('object')).toBeInTheDocument();
62
- });
63
- });
@@ -1,57 +0,0 @@
1
- import { loadRecurly } from './loadRecurly';
2
- const w = {};
3
- jest.mock('./w', () => ({
4
- w
5
- }));
6
- const mockConfig = {
7
- publicKey: 'test-public-key',
8
- required: ['field1', 'field2']
9
- };
10
- describe('loadRecurly', () => {
11
- let mockScript;
12
- let mockRecurly;
13
- beforeEach(() => {
14
- mockScript = {
15
- src: '',
16
- async: false,
17
- onload: null
18
- };
19
- mockRecurly = {
20
- configure: jest.fn()
21
- };
22
- w.recurly = undefined;
23
- w._recurlyPromise = undefined;
24
- w.document = {
25
- createElement: jest.fn().mockReturnValue(mockScript),
26
- head: {
27
- appendChild: jest.fn()
28
- }
29
- };
30
- });
31
- it('should create a script, load recurly, and configure it', async () => {
32
- const promise = loadRecurly(mockConfig);
33
- expect(w.document.createElement).toHaveBeenCalledWith('script');
34
- expect(mockScript.src).toBe('https://js.recurly.com/v4/recurly.js');
35
- expect(mockScript.async).toBe(true);
36
- expect(w.document.head.appendChild).toHaveBeenCalledWith(mockScript);
37
- expect(mockScript.onload).toBeDefined();
38
- w.recurly = mockRecurly;
39
- mockScript.onload?.(new Event('load'));
40
- await promise;
41
- expect(mockRecurly.configure).toHaveBeenCalledWith(mockConfig);
42
- });
43
- it('should only create one script element when called multiple times', async () => {
44
- const promises = [loadRecurly(mockConfig), loadRecurly(mockConfig), loadRecurly(mockConfig)];
45
- w.recurly = mockRecurly;
46
- mockScript.onload?.(new Event('load'));
47
-
48
- // Should always return the same promise instance
49
- expect(promises[0]).toBe(promises[1]);
50
- expect(promises[1]).toBe(promises[2]);
51
- await Promise.all(promises);
52
-
53
- // Should only create one script element
54
- expect(w.document.createElement).toHaveBeenCalledTimes(1);
55
- expect(w.document.head.appendChild).toHaveBeenCalledTimes(1);
56
- });
57
- });