@newskit-render/core 0.0.0-d55b7d88
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.
- package/.ci/trigger-circleci-workflow.sh +37 -0
- package/.eslintignore +23 -0
- package/.eslintrc +74 -0
- package/.prettierignore +19 -0
- package/.prettierrc +7 -0
- package/CHANGELOG.md +7638 -0
- package/Dockerfile +14 -0
- package/Dockerfile.withNewRelic +15 -0
- package/README.md +274 -0
- package/__tests__/pages/__snapshots__/brightcove.test.tsx.snap +20 -0
- package/__tests__/pages/__snapshots__/home.test.tsx.snap +1195 -0
- package/__tests__/pages/brightcove.test.tsx +34 -0
- package/__tests__/pages/empty.test.tsx +10 -0
- package/__tests__/pages/home.test.tsx +16 -0
- package/app-context/InstrumentationContextProvider.tsx +36 -0
- package/assets/fontFamily.ts +416 -0
- package/assets/fonts/Graphik-Black-App.ttf +0 -0
- package/assets/fonts/Graphik-BlackItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Bold-App.ttf +0 -0
- package/assets/fonts/Graphik-BoldItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Extralight-App.ttf +0 -0
- package/assets/fonts/Graphik-ExtralightItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Light-App.ttf +0 -0
- package/assets/fonts/Graphik-LightItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Medium-App.ttf +0 -0
- package/assets/fonts/Graphik-Medium-Web.woff2 +0 -0
- package/assets/fonts/Graphik-MediumItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Regular-App.ttf +0 -0
- package/assets/fonts/Graphik-Regular-Web.woff2 +0 -0
- package/assets/fonts/Graphik-RegularItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Semibold-App.ttf +0 -0
- package/assets/fonts/Graphik-Semibold-Web.woff2 +0 -0
- package/assets/fonts/Graphik-SemiboldItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Super-App.ttf +0 -0
- package/assets/fonts/Graphik-SuperItalic-App.ttf +0 -0
- package/assets/fonts/Graphik-Thin-App.ttf +0 -0
- package/assets/fonts/Graphik-ThinItalic-App.ttf +0 -0
- package/assets/fonts/Montserrat-Black.ttf +0 -0
- package/assets/fonts/Montserrat-BlackItalic.ttf +0 -0
- package/assets/fonts/Montserrat-Bold.ttf +0 -0
- package/assets/fonts/Montserrat-BoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraBold.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraLight.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
- package/assets/fonts/Montserrat-Italic.ttf +0 -0
- package/assets/fonts/Montserrat-Light.ttf +0 -0
- package/assets/fonts/Montserrat-LightItalic.ttf +0 -0
- package/assets/fonts/Montserrat-Medium.ttf +0 -0
- package/assets/fonts/Montserrat-MediumItalic.ttf +0 -0
- package/assets/fonts/Montserrat-Regular.ttf +0 -0
- package/assets/fonts/Montserrat-SemiBold.ttf +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-Thin.ttf +0 -0
- package/assets/fonts/Montserrat-ThinItalic.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Black-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-BlackItalic-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Bold-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Bold-Web.woff2 +0 -0
- package/assets/fonts/PublicoHeadline-BoldItalic-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Extrabold-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-ExtraboldItalic-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Italic-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Light-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-LightItalic-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Medium-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-MediumItalic-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Roman-App.ttf +0 -0
- package/assets/fonts/PublicoHeadline-Roman-Web.woff2 +0 -0
- package/assets/fonts/PublicoText-Bold-App.ttf +0 -0
- package/assets/fonts/PublicoText-BoldItalic-App.ttf +0 -0
- package/assets/fonts/PublicoText-Italic-App.ttf +0 -0
- package/assets/fonts/PublicoText-Italic-Web.woff2 +0 -0
- package/assets/fonts/PublicoText-Roman-App.ttf +0 -0
- package/assets/fonts/PublicoText-Roman-Web.woff2 +0 -0
- package/assets/fonts/PublicoText-Semibold-App.ttf +0 -0
- package/assets/fonts/PublicoText-SemiboldItalic-App.ttf +0 -0
- package/assets/fonts/Roboto-Bold.ttf +0 -0
- package/assets/fonts/Roboto-Light.ttf +0 -0
- package/assets/fonts/Roboto-Medium.ttf +0 -0
- package/assets/fonts/Roboto-Regular.ttf +0 -0
- package/assets/fonts/TheSun-Bold.ttf +0 -0
- package/assets/fonts/TheSun-BoldItalic.ttf +0 -0
- package/assets/fonts/TheSun-HeavyCondensed.ttf +0 -0
- package/assets/fonts/TheSun-HeavyNarrow.ttf +0 -0
- package/assets/fonts/TheSun-Italic.ttf +0 -0
- package/assets/fonts/TheSun-Medium.ttf +0 -0
- package/assets/fonts/TheSun-MediumItalic.ttf +0 -0
- package/assets/fonts/TheSun-Regular.ttf +0 -0
- package/assets/fonts/TimesDigital-Bold.ttf +0 -0
- package/assets/fonts/TimesDigital-BoldItalic.ttf +0 -0
- package/assets/fonts/TimesDigital-BoldSC.ttf +0 -0
- package/assets/fonts/TimesDigital-Italic.ttf +0 -0
- package/assets/fonts/TimesDigital-Regular.ttf +0 -0
- package/assets/fonts/TimesDigital-RegularSC.ttf +0 -0
- package/assets/fonts/TimesDigitalW04-Bold.ttf +0 -0
- package/assets/fonts/TimesDigitalW04-BoldItalic.ttf +0 -0
- package/assets/fonts/TimesDigitalW04-BoldSC.ttf +0 -0
- package/assets/fonts/TimesDigitalW04-Italic.ttf +0 -0
- package/assets/fonts/TimesDigitalW04-Regular.ttf +0 -0
- package/assets/fonts/TimesDigitalW04-RegularSC.ttf +0 -0
- package/assets/fonts/TimesModern-Regular.otf +0 -0
- package/assets/fonts/attribuitions.mdx +35 -0
- package/assets/fonts/bitter-medium.woff +0 -0
- package/assets/fonts/bitter-medium.woff2 +0 -0
- package/assets/fonts/bitter-mediumitalic.woff +0 -0
- package/assets/fonts/bitter-mediumitalic.woff2 +0 -0
- package/assets/fonts/bitter-regular.woff +0 -0
- package/assets/fonts/bitter-regular.woff2 +0 -0
- package/assets/fonts/bitter-semibold.woff +0 -0
- package/assets/fonts/bitter-semibold.woff2 +0 -0
- package/assets/fonts/dmmono-medium.woff +0 -0
- package/assets/fonts/dmmono-medium.woff2 +0 -0
- package/assets/fonts/dmsans-bold-webfont.woff +0 -0
- package/assets/fonts/dmsans-bold-webfont.woff2 +0 -0
- package/assets/fonts/dmsans-bolditalic-webfont.woff +0 -0
- package/assets/fonts/dmsans-bolditalic-webfont.woff2 +0 -0
- package/assets/fonts/dmsans-italic-webfont.woff +0 -0
- package/assets/fonts/dmsans-italic-webfont.woff2 +0 -0
- package/assets/fonts/dmsans-medium-webfont.woff +0 -0
- package/assets/fonts/dmsans-medium-webfont.woff2 +0 -0
- package/assets/fonts/dmsans-mediumitalic-webfont.woff +0 -0
- package/assets/fonts/dmsans-mediumitalic-webfont.woff2 +0 -0
- package/assets/fonts/dmsans-regular-webfont.woff +0 -0
- package/assets/fonts/dmsans-regular-webfont.woff2 +0 -0
- package/assets/fonts/notosans-bold-webfont.woff +0 -0
- package/assets/fonts/notosans-bold-webfont.woff2 +0 -0
- package/assets/fonts/notosans-italic-webfont.woff +0 -0
- package/assets/fonts/notosans-italic-webfont.woff2 +0 -0
- package/assets/fonts/notosans-medium-webfont.woff +0 -0
- package/assets/fonts/notosans-medium-webfont.woff2 +0 -0
- package/assets/fonts/notosans-regular-webfont.woff +0 -0
- package/assets/fonts/notosans-regular-webfont.woff2 +0 -0
- package/assets/fonts/poppins-bold-webfont.woff +0 -0
- package/assets/fonts/poppins-bold-webfont.woff2 +0 -0
- package/assets/fonts/poppins-bolditalic-webfont.woff +0 -0
- package/assets/fonts/poppins-bolditalic-webfont.woff2 +0 -0
- package/assets/fonts/poppins-extrabold-webfont.woff +0 -0
- package/assets/fonts/poppins-extrabold-webfont.woff2 +0 -0
- package/assets/fonts/poppins-extrabolditalic-webfont.woff +0 -0
- package/assets/fonts/poppins-extrabolditalic-webfont.woff2 +0 -0
- package/assets/fonts/poppins-italic-webfont.woff +0 -0
- package/assets/fonts/poppins-italic-webfont.woff2 +0 -0
- package/assets/fonts/poppins-light-webfont.woff +0 -0
- package/assets/fonts/poppins-light-webfont.woff2 +0 -0
- package/assets/fonts/poppins-lightitalic-webfont.woff +0 -0
- package/assets/fonts/poppins-lightitalic-webfont.woff2 +0 -0
- package/assets/fonts/poppins-medium-webfont.woff +0 -0
- package/assets/fonts/poppins-medium-webfont.woff2 +0 -0
- package/assets/fonts/poppins-mediumitalic-webfont.woff +0 -0
- package/assets/fonts/poppins-mediumitalic-webfont.woff2 +0 -0
- package/assets/fonts/poppins-regular-webfont.woff +0 -0
- package/assets/fonts/poppins-regular-webfont.woff2 +0 -0
- package/assets/fonts/poppins-semibold-webfont.woff +0 -0
- package/assets/fonts/poppins-semibold-webfont.woff2 +0 -0
- package/assets/fonts/poppins-semibolditalic-webfont.woff +0 -0
- package/assets/fonts/poppins-semibolditalic-webfont.woff2 +0 -0
- package/assets/fonts/source-serif-pro-600.woff +0 -0
- package/assets/fonts/source-serif-pro-600.woff2 +0 -0
- package/assets/fonts/source-serif-pro-600italic.woff +0 -0
- package/assets/fonts/source-serif-pro-600italic.woff2 +0 -0
- package/assets/fonts/source-serif-pro-700.woff +0 -0
- package/assets/fonts/source-serif-pro-700.woff2 +0 -0
- package/assets/fonts/source-serif-pro-700italic.woff +0 -0
- package/assets/fonts/source-serif-pro-700italic.woff2 +0 -0
- package/assets/fonts/source-serif-pro-italic.woff +0 -0
- package/assets/fonts/source-serif-pro-italic.woff2 +0 -0
- package/assets/fonts/source-serif-pro-regular.woff +0 -0
- package/assets/fonts/source-serif-pro-regular.woff2 +0 -0
- package/components/AccountDropdown/AccountDropdown.tsx +65 -0
- package/components/AccountDropdown/__tests__/AcountDropdown.test.tsx +83 -0
- package/components/AccountDropdown/accounts.ts +47 -0
- package/components/AccountDropdown/index.tsx +2 -0
- package/components/AccountDropdown/utils.ts +21 -0
- package/components/ErrorPage/ErrorPage.tsx +135 -0
- package/components/ad/index.tsx +35 -0
- package/components/article/Highlights.tsx +77 -0
- package/components/article/MetaBox.tsx +50 -0
- package/components/article/RelatedArticles.tsx +53 -0
- package/components/article/RelatedTopics.tsx +59 -0
- package/components/article/ShareBarComponent.tsx +53 -0
- package/components/article/__tests__/__snapshots__/index.test.tsx.snap +1568 -0
- package/components/article/__tests__/index.test.tsx +171 -0
- package/components/article/__tests__/mocks.ts +105 -0
- package/components/article/index.tsx +320 -0
- package/components/common/BackToHomepage.tsx +37 -0
- package/components/common/NavLink.tsx +26 -0
- package/components/common/NewskitLogo.tsx +52 -0
- package/components/common/NewskitLogoShort.tsx +48 -0
- package/components/common/SectionTitleBar.tsx +57 -0
- package/components/common/ShareButton.tsx +18 -0
- package/components/common/ViewMoreButton.tsx +20 -0
- package/components/common/iconNavLink/IconNavLink.tsx +70 -0
- package/components/common/iconNavLink/__tests__/IconNavLink.test.tsx +35 -0
- package/components/common/iconNavLink/index.ts +3 -0
- package/components/common/iconNavLink/types.ts +24 -0
- package/components/common/icons/IconAccount.tsx +13 -0
- package/components/common/icons/IconFilledTwitter.tsx +14 -0
- package/components/common/icons/StyledIconFilledChevronRight.tsx +12 -0
- package/components/footer/__snapshots__/index.test.tsx.snap +192 -0
- package/components/footer/index.test.tsx +13 -0
- package/components/footer/index.tsx +151 -0
- package/components/header/banner-messages.ts +39 -0
- package/components/header/index.tsx +52 -0
- package/components/header/navigation-links.ts +20 -0
- package/components/layout/Gutter.tsx +11 -0
- package/components/layout/LayoutTemplate.tsx +26 -0
- package/components/layout/MainGrid.tsx +66 -0
- package/components/layout/index.tsx +3 -0
- package/components/layout/layoutTypes.ts +13 -0
- package/components/section/ArticleSlice.tsx +35 -0
- package/components/section/CollectionBlock.tsx +54 -0
- package/components/section/SectionContext.tsx +9 -0
- package/components/section/__tests__/ArticleSlice.test.tsx +128 -0
- package/components/section/__tests__/CollectionBlock.test.tsx +83 -0
- package/components/section/__tests__/pageBlock.test.tsx +24 -0
- package/components/section/__tests__/sectionUtils.test.ts +94 -0
- package/components/section/index.tsx +39 -0
- package/components/section/layouts/Block.tsx +79 -0
- package/components/section/layouts/FallBack.tsx +24 -0
- package/components/section/layouts/Lead.tsx +43 -0
- package/components/section/layouts/Rows.tsx +82 -0
- package/components/section/layouts/SectionTitle.tsx +57 -0
- package/components/section/layouts/__tests__/Lead.test.tsx +37 -0
- package/components/section/layouts/__tests__/Rows.test.tsx +40 -0
- package/components/section/layouts/__tests__/SectionTitle.test.tsx +37 -0
- package/components/section/layouts/__tests__/__snapshots__/Lead.test.tsx.snap +180 -0
- package/components/section/layouts/__tests__/__snapshots__/SectionTitle.test.tsx.snap +354 -0
- package/components/section/layouts/gridUtils.ts +21 -0
- package/components/section/layouts/index.tsx +4 -0
- package/components/section/layouts/types.ts +13 -0
- package/components/section/pageBlock.tsx +23 -0
- package/components/section/sectionUtils.ts +61 -0
- package/components/teaser/index.test.tsx +50 -0
- package/components/teaser/index.tsx +64 -0
- package/components/teaser/teaserVariants.ts +33 -0
- package/components/teaser/variant-types.ts +49 -0
- package/components/teaser/variants/featureVariant.ts +42 -0
- package/components/teaser/variants/horizontal.ts +14 -0
- package/components/teaser/variants/titleTeaserVariant.ts +32 -0
- package/components/teaser/variants/titleVertical.ts +24 -0
- package/components/utils/index.test.ts +12 -0
- package/components/utils/index.ts +6 -0
- package/config/__tests__/index.test.ts +54 -0
- package/config/environment.ts +80 -0
- package/config/index.ts +2 -0
- package/config/multiTenancy.ts +11 -0
- package/constants/index.ts +2 -0
- package/context/app-context/AppContext.test.tsx +56 -0
- package/context/app-context/holidayStopListContextOverrides.ts +18 -0
- package/context/app-context/index.tsx +34 -0
- package/context/app-context/paymentMethodContext.tsx +70 -0
- package/context/index.tsx +2 -0
- package/context/multi-tenancy/MultiTenancy.test.tsx +48 -0
- package/context/multi-tenancy/index.tsx +32 -0
- package/css/index.ts +15 -0
- package/cypress/axe/terminal-log.js +19 -0
- package/cypress/config/visual.config.ts +11 -0
- package/cypress/config/visual.skip.config.ts +10 -0
- package/cypress/e2e/account/accessibility.cy.js +88 -0
- package/cypress/e2e/account/banners.cy.js +169 -0
- package/cypress/e2e/account/cancellation.cy.js +219 -0
- package/cypress/e2e/account/holiday-stops.cy.js +109 -0
- package/cypress/e2e/account/main-api.cy.js +102 -0
- package/cypress/e2e/account/newsletters-and-alerts.cy.js +149 -0
- package/cypress/e2e/account/newsletters-page.cy.js +69 -0
- package/cypress/e2e/account/payment-page.cy.js +98 -0
- package/cypress/e2e/account/personal-details.cy.js +1161 -0
- package/cypress/e2e/account/subscription-and-billing.cy.js +434 -0
- package/cypress/e2e/checkout/account-creation.cy.js +8 -0
- package/cypress/e2e/checkout/payment-details.cy.js +19 -0
- package/cypress/e2e/core/home-page.cy.js +6 -0
- package/cypress/e2e/help-hub/accessibility.cy.js +35 -0
- package/cypress/e2e/help-hub/article-page.cy.js +115 -0
- package/cypress/e2e/help-hub/landing-page.cy.js +94 -0
- package/cypress/e2e/help-hub/result-page.cy.js +117 -0
- package/cypress/fixtures/empty.html +10 -0
- package/cypress/fixtures/example.json +5 -0
- package/cypress/fixtures/holiday-stops.json +40 -0
- package/cypress/fixtures/paymentFailure.js +24 -0
- package/cypress/fixtures/testDates.js +26 -0
- package/cypress/support/commands.js +125 -0
- package/cypress/support/consentValues.js +5839 -0
- package/cypress/support/e2e.js +22 -0
- package/cypress/support/users.js +58 -0
- package/cypress/visual/account/print-visual-regression.cy.js +9 -0
- package/cypress/visual/account/visual-regression.cy.js +40 -0
- package/cypress/visual/empty/empty.cy.js +5 -0
- package/cypress.config.ts +38 -0
- package/helpers/__tests__/getUser.test.ts +45 -0
- package/helpers/__tests__/logger.test.ts +62 -0
- package/helpers/__tests__/useThemeDropdownObject.test.ts +49 -0
- package/helpers/a11y.ts +7 -0
- package/helpers/addCacheHeaders.ts +8 -0
- package/helpers/getUser.ts +37 -0
- package/helpers/getYear.ts +1 -0
- package/helpers/global-types.ts +186 -0
- package/helpers/logger/getWinstonLogger.ts +19 -0
- package/helpers/logger/index.ts +20 -0
- package/helpers/logger/replaceConsoleWithLogger.ts +14 -0
- package/helpers/mocks/articleMock.ts +50 -0
- package/helpers/mocks/getPageMock.ts +369 -0
- package/helpers/mocks/getRadioPostMock.ts +71 -0
- package/helpers/mocks/getRadioPostsMock.ts +26 -0
- package/helpers/mocks/getRecommendationsMock.ts +20 -0
- package/helpers/mocks/index.ts +7 -0
- package/helpers/multiTenancy.ts +19 -0
- package/helpers/setupTests.ts +5 -0
- package/helpers/test-utils.tsx +33 -0
- package/helpers/useThemeDropdownObject.tsx +73 -0
- package/infrastructure/.circleci/config.yml +1187 -0
- package/infrastructure/INFRASTRUCTURE.md +142 -0
- package/infrastructure/build_and_deploy.png +0 -0
- package/infrastructure/helm/Chart.yaml +21 -0
- package/infrastructure/helm/templates/_helpers.tpl +87 -0
- package/infrastructure/helm/templates/deployment.yaml +45 -0
- package/infrastructure/helm/templates/horizontalpodautoscaler.yaml +21 -0
- package/infrastructure/helm/templates/ingress.yaml +31 -0
- package/infrastructure/helm/templates/networkpolicy.yaml +26 -0
- package/infrastructure/helm/templates/secret.yaml +12 -0
- package/infrastructure/helm/templates/service.yaml +15 -0
- package/infrastructure/helm/values-dev.yaml +39 -0
- package/infrastructure/helm/values-local.yaml +30 -0
- package/infrastructure/helm/values-pr.yaml +40 -0
- package/infrastructure/helm/values-prod.yaml +39 -0
- package/infrastructure/helm/values-staging.yaml +39 -0
- package/infrastructure/helm/values.yaml +44 -0
- package/infrastructure/pull_request.png +0 -0
- package/infrastructure/release-documentation-cli.config.json +18 -0
- package/infrastructure/remove_pr.png +0 -0
- package/infrastructure/terraform-ecr/dev.tfvars +3 -0
- package/infrastructure/terraform-ecr/ecr.tf +69 -0
- package/infrastructure/terraform-ecr/main.tf +3 -0
- package/infrastructure/terraform-ecr/variables.tf +19 -0
- package/infrastructure/terraform-ecr/versions.tf +12 -0
- package/infrastructure/terraform-newrelic/alerts.tf +290 -0
- package/infrastructure/terraform-newrelic/dashboards.tf +347 -0
- package/infrastructure/terraform-newrelic/dev.tfvars +3 -0
- package/infrastructure/terraform-newrelic/lighthouse-script-dev.js +53 -0
- package/infrastructure/terraform-newrelic/lighthouse-script-prod.js +54 -0
- package/infrastructure/terraform-newrelic/lighthouse-script-stage.js +54 -0
- package/infrastructure/terraform-newrelic/main.tf +11 -0
- package/infrastructure/terraform-newrelic/monitors.tf +11 -0
- package/infrastructure/terraform-newrelic/prod.tfvars +3 -0
- package/infrastructure/terraform-newrelic/staging.tfvars +3 -0
- package/infrastructure/terraform-newrelic/variables.tf +33 -0
- package/infrastructure/terraform-newrelic/versions.tf +18 -0
- package/jest.config.js +40 -0
- package/jest.config.pact.js +18 -0
- package/newrelic.js +86 -0
- package/next-env.d.ts +5 -0
- package/next.config.js +95 -0
- package/package.json +127 -0
- package/pages/_app.tsx +117 -0
- package/pages/_document.tsx +112 -0
- package/pages/_error.tsx +68 -0
- package/pages/account/add/[field].tsx +34 -0
- package/pages/account/cancellation/index.tsx +22 -0
- package/pages/account/delete/confirm/index.tsx +16 -0
- package/pages/account/delete/error/index.tsx +16 -0
- package/pages/account/delete/index.tsx +16 -0
- package/pages/account/delete/success/index.tsx +16 -0
- package/pages/account/dream-team/index.tsx +19 -0
- package/pages/account/edit/[field].tsx +45 -0
- package/pages/account/family/index.tsx +19 -0
- package/pages/account/holiday-stop/index.tsx +19 -0
- package/pages/account/holiday-stop/previous-holiday-stops.tsx +19 -0
- package/pages/account/holiday-stop/upcoming-holiday-stops.tsx +19 -0
- package/pages/account/index.tsx +33 -0
- package/pages/account/newsletters/index.tsx +19 -0
- package/pages/account/newsletters-and-alerts/index.tsx +24 -0
- package/pages/account/payment/[paymentMethod].tsx +37 -0
- package/pages/account/payment/index.tsx +23 -0
- package/pages/account/payment-methods/index.tsx +21 -0
- package/pages/account/subscription-and-billing/index.tsx +29 -0
- package/pages/api/account/get-session/index.ts +33 -0
- package/pages/api/account/invoice/index.ts +35 -0
- package/pages/api/account/mutate/index.ts +8 -0
- package/pages/api/account/query/index.ts +7 -0
- package/pages/api/auth/[...nextauth].ts +11 -0
- package/pages/api/competitions-sitemap.ts +19 -0
- package/pages/api/feed.ts +23 -0
- package/pages/api/health-check.ts +7 -0
- package/pages/api/news-sitemap.ts +18 -0
- package/pages/api/pages-sitemap.ts +27 -0
- package/pages/api/robots.ts +19 -0
- package/pages/api/sitemap.ts +24 -0
- package/pages/checkout/account-creation/index.tsx +13 -0
- package/pages/checkout/payment-details/index.tsx +10 -0
- package/pages/empty.tsx +6 -0
- package/pages/help-hub/article/[title]/index.tsx +25 -0
- package/pages/help-hub/error.tsx +23 -0
- package/pages/help-hub/index.tsx +51 -0
- package/pages/help-hub/results.tsx +25 -0
- package/pages/index.tsx +19 -0
- package/pages/player/brightcove.tsx +19 -0
- package/pages/rss/create/index.tsx +18 -0
- package/pages/rss/feed/[feedId]/index.tsx +21 -0
- package/pages/rss/index.tsx +18 -0
- package/public/ads.min.js +8175 -0
- package/public/assets/display-base-header.svg +25 -0
- package/public/assets/display-personalDetails-header-sun.svg +55 -0
- package/public/assets/display-personalDetails-header-times.svg +90 -0
- package/public/assets/display-personalDetails-header-vr.svg +46 -0
- package/public/assets/dream-team.svg +10 -0
- package/public/assets/navigationPrimary-brandMark-sun.svg +9 -0
- package/public/assets/navigationPrimary-brandMark-times.svg +18 -0
- package/public/assets/navigationPrimary-brandMark-vr.svg +10 -0
- package/public/assets/newsletters/bestoftimes-101.png +0 -0
- package/public/assets/newsletters/books-115.png +0 -0
- package/public/assets/newsletters/environment-140.png +0 -0
- package/public/assets/newsletters/fashion-108.png +0 -0
- package/public/assets/newsletters/food-106.png +0 -0
- package/public/assets/newsletters/football-111.png +0 -0
- package/public/assets/newsletters/ireland-152.png +0 -0
- package/public/assets/newsletters/law-121.png +0 -0
- package/public/assets/newsletters/money-107.png +0 -0
- package/public/assets/newsletters/moneymentor-150.png +0 -0
- package/public/assets/newsletters/placeholder.png +0 -0
- package/public/assets/newsletters/politics-119.png +0 -0
- package/public/assets/newsletters/property-113.png +0 -0
- package/public/assets/newsletters/puzzles-125.png +0 -0
- package/public/assets/newsletters/scotland-134.png +0 -0
- package/public/assets/newsletters/theatre-127.png +0 -0
- package/public/assets/newsletters/travel-149.png +0 -0
- package/public/assets/newsletters/tv-133.png +0 -0
- package/public/assets/newsletters/us-153.png +0 -0
- package/public/assets/no-subscription.svg +15 -0
- package/public/assets/pending-activation.svg +16 -0
- package/public/assets/personal-details-header.svg +91 -0
- package/public/assets/plchldr150x100.png +0 -0
- package/public/assets/previous-subscription.svg +15 -0
- package/public/assets/primary-navigation-logo-white.svg +6 -0
- package/public/assets/primary-navigation-logo.svg +6 -0
- package/public/assets/tls-logo-white.svg +3 -0
- package/public/favicon.ico +0 -0
- package/public/icon.png +0 -0
- package/public/prebid.min.js +1 -0
- package/queries/getPage.ts +100 -0
- package/queries/getRadioPost.ts +61 -0
- package/queries/getRadioPosts.ts +16 -0
- package/queries/getUserSubscription.ts +9 -0
- package/queries/index.ts +3 -0
- package/scripts/k8s-local.sh +137 -0
- package/scripts/nr-exports.sh +7 -0
- package/temp/_app.tsx +15 -0
- package/temp/_document.tsx +61 -0
- package/temp/app-context-test.tsx +51 -0
- package/temp/app-context.tsx +25 -0
- package/temp/config-index.ts +1 -0
- package/temp/context-index.tsx +1 -0
- package/temp/header.tsx +45 -0
- package/temp/next.config.js +56 -0
- package/tsconfig.json +51 -0
- package/tsconfig.test.json +6 -0
- package/validation/index.tsx +24 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
|
+
import {
|
|
3
|
+
styled,
|
|
4
|
+
getColorCssFromTheme,
|
|
5
|
+
Cell,
|
|
6
|
+
getMediaQueryFromTheme,
|
|
7
|
+
getSizingCssFromTheme,
|
|
8
|
+
Paragraph,
|
|
9
|
+
Divider,
|
|
10
|
+
Block,
|
|
11
|
+
} from 'newskit'
|
|
12
|
+
import { Image } from '@newskit-render/shared-components'
|
|
13
|
+
import { MainGrid } from '../layout/MainGrid'
|
|
14
|
+
import NewsKitLogoShort from '../common/NewskitLogoShort'
|
|
15
|
+
import NavLink from '../common/NavLink'
|
|
16
|
+
import { AppContext } from '../../context'
|
|
17
|
+
import { getYear } from '../../helpers/getYear'
|
|
18
|
+
|
|
19
|
+
const StyledFooter = styled.div`
|
|
20
|
+
${getColorCssFromTheme('backgroundColor', 'neutral100')};
|
|
21
|
+
width: 100%;
|
|
22
|
+
bottom: 0;
|
|
23
|
+
display: block;
|
|
24
|
+
${getSizingCssFromTheme('padding', 'sizing030')} 0;
|
|
25
|
+
`
|
|
26
|
+
|
|
27
|
+
const Navigation = styled.div`
|
|
28
|
+
display: flex;
|
|
29
|
+
flex-flow: row wrap;
|
|
30
|
+
justify-content: space-between;
|
|
31
|
+
flex-direction: column;
|
|
32
|
+
${getSizingCssFromTheme('marginBottom', 'sizing050')};
|
|
33
|
+
|
|
34
|
+
${getMediaQueryFromTheme('md')} {
|
|
35
|
+
justify-content: flex-start;
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
}
|
|
38
|
+
`
|
|
39
|
+
|
|
40
|
+
const clientNavigationLogos = {
|
|
41
|
+
'The-Sun': { src: 'navigationPrimary-brandMark-sun.svg', width: 'initial' },
|
|
42
|
+
'Virgin-Radio': {
|
|
43
|
+
src: 'navigationPrimary-brandMark-vr.svg',
|
|
44
|
+
width: 'initial',
|
|
45
|
+
},
|
|
46
|
+
'The-Times': {
|
|
47
|
+
src: 'navigationPrimary-brandMark-times.svg',
|
|
48
|
+
width: 'initial',
|
|
49
|
+
},
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const NavButton = ({
|
|
53
|
+
buttonText,
|
|
54
|
+
href,
|
|
55
|
+
ariaLabel,
|
|
56
|
+
}: {
|
|
57
|
+
buttonText: string
|
|
58
|
+
href: string
|
|
59
|
+
isLast?: boolean
|
|
60
|
+
ariaLabel?: string
|
|
61
|
+
}) => (
|
|
62
|
+
<Block
|
|
63
|
+
as="span"
|
|
64
|
+
spaceInline={{
|
|
65
|
+
xs: 'space000',
|
|
66
|
+
md: 'space090',
|
|
67
|
+
}}
|
|
68
|
+
marginBlockEnd="space040"
|
|
69
|
+
>
|
|
70
|
+
<NavLink href={href} ariaLabel={ariaLabel} buttonText={buttonText} />
|
|
71
|
+
</Block>
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
const Footer = () => {
|
|
75
|
+
const { theme } = useContext(AppContext)
|
|
76
|
+
return (
|
|
77
|
+
<StyledFooter>
|
|
78
|
+
<MainGrid>
|
|
79
|
+
<Cell xs={12}>
|
|
80
|
+
<Block marginBlockEnd="space030">
|
|
81
|
+
{!clientNavigationLogos[theme.name] ? (
|
|
82
|
+
<NewsKitLogoShort color="white" size="sizing120" />
|
|
83
|
+
) : (
|
|
84
|
+
<Image
|
|
85
|
+
alt=""
|
|
86
|
+
src={`/assets/${clientNavigationLogos[theme.name].src}`}
|
|
87
|
+
width={clientNavigationLogos[theme.name].width}
|
|
88
|
+
/>
|
|
89
|
+
)}
|
|
90
|
+
</Block>
|
|
91
|
+
<Block marginBlockEnd="space030">
|
|
92
|
+
<Divider
|
|
93
|
+
overrides={{
|
|
94
|
+
stylePreset: 'dividerFooterHorizontal',
|
|
95
|
+
}}
|
|
96
|
+
/>
|
|
97
|
+
</Block>
|
|
98
|
+
<Navigation>
|
|
99
|
+
<NavButton
|
|
100
|
+
buttonText="NavLink One"
|
|
101
|
+
href="/link-one"
|
|
102
|
+
ariaLabel="NavLink One"
|
|
103
|
+
/>
|
|
104
|
+
<NavButton
|
|
105
|
+
buttonText="NavLink Two"
|
|
106
|
+
href="/link-two"
|
|
107
|
+
ariaLabel="NavLink Two"
|
|
108
|
+
/>
|
|
109
|
+
<NavButton
|
|
110
|
+
buttonText="NavLink Three"
|
|
111
|
+
href="/link-three"
|
|
112
|
+
ariaLabel="NavLink Three"
|
|
113
|
+
/>
|
|
114
|
+
<NavButton
|
|
115
|
+
buttonText="NavLink Four"
|
|
116
|
+
href="/link-four"
|
|
117
|
+
ariaLabel="NavLink Four"
|
|
118
|
+
/>
|
|
119
|
+
<NavButton
|
|
120
|
+
buttonText="NavLink Five"
|
|
121
|
+
href="/link-five"
|
|
122
|
+
ariaLabel="NavLink Five"
|
|
123
|
+
/>
|
|
124
|
+
<NavButton
|
|
125
|
+
buttonText="NavLink Six"
|
|
126
|
+
href="/link-six"
|
|
127
|
+
ariaLabel="NavLink Six"
|
|
128
|
+
/>
|
|
129
|
+
</Navigation>
|
|
130
|
+
<Block marginBlockEnd="space030">
|
|
131
|
+
<Divider
|
|
132
|
+
overrides={{
|
|
133
|
+
stylePreset: 'dividerFooterHorizontal',
|
|
134
|
+
}}
|
|
135
|
+
/>
|
|
136
|
+
</Block>
|
|
137
|
+
<Paragraph
|
|
138
|
+
overrides={{
|
|
139
|
+
typographyPreset: 'utilityMeta020',
|
|
140
|
+
stylePreset: 'inkSubtle',
|
|
141
|
+
}}
|
|
142
|
+
>
|
|
143
|
+
{`Copyright © ${getYear()} News Corp. All rights reserved.`}
|
|
144
|
+
</Paragraph>
|
|
145
|
+
</Cell>
|
|
146
|
+
</MainGrid>
|
|
147
|
+
</StyledFooter>
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export default Footer
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export const pastDueBanner = {
|
|
2
|
+
firstNotice: {
|
|
3
|
+
title: "We haven't been able to take payment",
|
|
4
|
+
text: 'You may need to update your payment details to keep your subscription.',
|
|
5
|
+
button: 'Update payment details',
|
|
6
|
+
},
|
|
7
|
+
secondNotice: {
|
|
8
|
+
title: 'Act now to keep your subscription',
|
|
9
|
+
text: 'We’ve tried several times, but haven’t been able to take payment. Please update your payment details to keep your subscription.',
|
|
10
|
+
button: 'Update payment details',
|
|
11
|
+
},
|
|
12
|
+
terminated: {
|
|
13
|
+
title: 'Your subscription has been terminated',
|
|
14
|
+
phoneNumber: 'XXXX-XXX-XXXX',
|
|
15
|
+
text: 'We didn’t receive payment for your subscription. To reactivate it, please call ##PHONE_NUMBER##.',
|
|
16
|
+
dismissDays: 7,
|
|
17
|
+
},
|
|
18
|
+
cancelled: {
|
|
19
|
+
title: 'Your subscription has been cancelled.',
|
|
20
|
+
phoneNumber: 'XXXX-XXX-XXXX',
|
|
21
|
+
text: 'You’ll no longer have access to subscription benefits. To re-activate call ##PHONE_NUMBER##.',
|
|
22
|
+
dismissDays: 7,
|
|
23
|
+
},
|
|
24
|
+
toBeCancelled: {
|
|
25
|
+
title: 'Your subscription will end soon.',
|
|
26
|
+
phoneNumber: 'XXXX-XXX-XXXX',
|
|
27
|
+
text: 'You have cancelled your subscription and will lose access to all benefits on ##DATE##. To re-activate your subscription call ##PHONE_NUMBER##.',
|
|
28
|
+
},
|
|
29
|
+
toBeCancelledWithRefund: {
|
|
30
|
+
title: 'Your subscription will end soon.',
|
|
31
|
+
phoneNumber: '0800 xxxx xxxxx',
|
|
32
|
+
text: 'We have successfully cancelled your subscription and will be processing your refund shortly. If you have any question please call ##PHONE_NUMBER##.',
|
|
33
|
+
dismissDays: 7,
|
|
34
|
+
},
|
|
35
|
+
treshold: {
|
|
36
|
+
firstNotice: 26,
|
|
37
|
+
secondNotice: 30,
|
|
38
|
+
},
|
|
39
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React, { useContext } from 'react'
|
|
2
|
+
import { styled, Block } from 'newskit'
|
|
3
|
+
import { UserData } from '@newskit-render/my-account'
|
|
4
|
+
import {
|
|
5
|
+
PastDueBannerExternal,
|
|
6
|
+
NavigationPrimary,
|
|
7
|
+
} from '@newskit-render/shared-components'
|
|
8
|
+
|
|
9
|
+
import { AppContext } from '../../context'
|
|
10
|
+
import { useThemeDropdownObject } from '../../helpers/useThemeDropdownObject'
|
|
11
|
+
import { sectionLinks } from './navigation-links'
|
|
12
|
+
import { pastDueBanner } from './banner-messages'
|
|
13
|
+
|
|
14
|
+
export const headerSize = 'sizing100'
|
|
15
|
+
|
|
16
|
+
const BannerContainer = styled(Block)`
|
|
17
|
+
position: sticky;
|
|
18
|
+
top: 0;
|
|
19
|
+
z-index: 1;
|
|
20
|
+
`
|
|
21
|
+
|
|
22
|
+
const Header: React.FC<{ user: UserData }> = ({ user }) => {
|
|
23
|
+
const navigationPrimary = {
|
|
24
|
+
logoSrc: '/assets/primary-navigation-logo-white.svg',
|
|
25
|
+
nav: sectionLinks,
|
|
26
|
+
loggedInUser: !!user,
|
|
27
|
+
gridOverrides: {
|
|
28
|
+
width: '100%',
|
|
29
|
+
marginInline: 'auto',
|
|
30
|
+
},
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const { theme, setTheme } = useContext(AppContext)
|
|
34
|
+
const themeDropdownObject = useThemeDropdownObject(setTheme)
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<>
|
|
38
|
+
<NavigationPrimary
|
|
39
|
+
{...navigationPrimary}
|
|
40
|
+
customTheme={theme}
|
|
41
|
+
themeDropdownObject={themeDropdownObject}
|
|
42
|
+
/>
|
|
43
|
+
<PastDueBannerExternal
|
|
44
|
+
pastDueBanner={pastDueBanner}
|
|
45
|
+
user={user}
|
|
46
|
+
wrapper={BannerContainer}
|
|
47
|
+
/>
|
|
48
|
+
</>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export default Header
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const sectionLinks = [
|
|
2
|
+
{
|
|
3
|
+
text: 'Section One',
|
|
4
|
+
link: '/section-one',
|
|
5
|
+
icon: null,
|
|
6
|
+
ariaLabel: 'Section One Link',
|
|
7
|
+
},
|
|
8
|
+
{
|
|
9
|
+
text: 'Section Two',
|
|
10
|
+
link: '/section-two',
|
|
11
|
+
icon: null,
|
|
12
|
+
ariaLabel: 'Section Two Link',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
text: 'Section Three',
|
|
16
|
+
link: '/section-three',
|
|
17
|
+
icon: null,
|
|
18
|
+
ariaLabel: 'Section Three Link',
|
|
19
|
+
},
|
|
20
|
+
]
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import React, { ReactNode } from 'react'
|
|
2
|
+
import { styled, getColorCssFromTheme, getMediaQueryFromTheme } from 'newskit'
|
|
3
|
+
|
|
4
|
+
const Wrapper = styled.div`
|
|
5
|
+
${getMediaQueryFromTheme('xs')} {
|
|
6
|
+
${getColorCssFromTheme('backgroundColor', 'interfaceBackground')};
|
|
7
|
+
}
|
|
8
|
+
`
|
|
9
|
+
export const Gutter: React.FC<{ children: ReactNode }> = ({ children }) => (
|
|
10
|
+
<Wrapper>{children}</Wrapper>
|
|
11
|
+
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { UserData } from '@newskit-render/my-account'
|
|
3
|
+
import { Cell } from 'newskit'
|
|
4
|
+
import Header from '../header'
|
|
5
|
+
import Footer from '../footer'
|
|
6
|
+
import { Gutter } from './Gutter'
|
|
7
|
+
import { LayoutProps } from './layoutTypes'
|
|
8
|
+
import { MainGrid } from './MainGrid'
|
|
9
|
+
|
|
10
|
+
const LayoutTemplate: React.FC<LayoutProps> = ({
|
|
11
|
+
children,
|
|
12
|
+
user,
|
|
13
|
+
...mainGridProps
|
|
14
|
+
}) => (
|
|
15
|
+
<>
|
|
16
|
+
<Header user={user as UserData} />
|
|
17
|
+
<Gutter>
|
|
18
|
+
<MainGrid {...mainGridProps}>
|
|
19
|
+
<Cell xs={12}>{children}</Cell>
|
|
20
|
+
</MainGrid>
|
|
21
|
+
</Gutter>
|
|
22
|
+
<Footer />
|
|
23
|
+
</>
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
export default LayoutTemplate
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
Grid,
|
|
4
|
+
Cell,
|
|
5
|
+
styled,
|
|
6
|
+
getColorCssFromTheme,
|
|
7
|
+
GridProps,
|
|
8
|
+
Block,
|
|
9
|
+
} from 'newskit'
|
|
10
|
+
import { LayoutProps } from './layoutTypes'
|
|
11
|
+
|
|
12
|
+
type StyledGridProps = GridProps & {
|
|
13
|
+
backgroundColor?: string
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const StyledGrid = styled(Grid)<StyledGridProps>`
|
|
17
|
+
${({ backgroundColor, theme }) =>
|
|
18
|
+
`${getColorCssFromTheme(
|
|
19
|
+
'backgroundColor',
|
|
20
|
+
backgroundColor as string
|
|
21
|
+
)({ theme })}`}
|
|
22
|
+
`
|
|
23
|
+
|
|
24
|
+
export const MainGrid: React.FC<LayoutProps> = ({
|
|
25
|
+
children,
|
|
26
|
+
backgroundColor,
|
|
27
|
+
withTopOffset,
|
|
28
|
+
withBottomOffset,
|
|
29
|
+
gridOverride,
|
|
30
|
+
dataTestId,
|
|
31
|
+
}) => {
|
|
32
|
+
const gridProps = gridOverride || {
|
|
33
|
+
mdMargin: 'space050',
|
|
34
|
+
xsColumnGutter: 'space040',
|
|
35
|
+
xsRowGutter: 'space000',
|
|
36
|
+
xsMargin: 'space040',
|
|
37
|
+
}
|
|
38
|
+
return (
|
|
39
|
+
<StyledGrid
|
|
40
|
+
data-testid={dataTestId || 'PageLayout'}
|
|
41
|
+
backgroundColor={backgroundColor}
|
|
42
|
+
{...gridProps}
|
|
43
|
+
>
|
|
44
|
+
{withTopOffset && (
|
|
45
|
+
<Cell xs={12}>
|
|
46
|
+
<Block
|
|
47
|
+
marginBlockEnd={{
|
|
48
|
+
xs: 'space070',
|
|
49
|
+
lg: 'space080',
|
|
50
|
+
}}
|
|
51
|
+
/>
|
|
52
|
+
</Cell>
|
|
53
|
+
)}
|
|
54
|
+
{children}
|
|
55
|
+
{withBottomOffset && (
|
|
56
|
+
<Cell xs={12}>
|
|
57
|
+
<Block
|
|
58
|
+
marginBlockEnd={{
|
|
59
|
+
xs: 'space090',
|
|
60
|
+
}}
|
|
61
|
+
/>
|
|
62
|
+
</Cell>
|
|
63
|
+
)}
|
|
64
|
+
</StyledGrid>
|
|
65
|
+
)
|
|
66
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { GridProps } from 'newskit'
|
|
3
|
+
import { UserData } from '@newskit-render/my-account'
|
|
4
|
+
|
|
5
|
+
export type LayoutProps = {
|
|
6
|
+
children: React.ReactNode
|
|
7
|
+
backgroundColor?: string
|
|
8
|
+
withTopOffset?: boolean
|
|
9
|
+
withBottomOffset?: boolean
|
|
10
|
+
gridOverride?: GridProps
|
|
11
|
+
dataTestId?: string
|
|
12
|
+
user?: UserData
|
|
13
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Block } from 'newskit'
|
|
3
|
+
import { ArticleSlice as Slice } from '../../helpers/global-types'
|
|
4
|
+
import { Lead, LeadFullWidth, FallBack } from './layouts'
|
|
5
|
+
import { Row3, BasicRow } from './layouts/Rows'
|
|
6
|
+
|
|
7
|
+
const sliceBlockBuilder = (slice: Slice) => {
|
|
8
|
+
const sliceTypes = {
|
|
9
|
+
LEAD_1_FULL_WIDTH: <LeadFullWidth slice={slice} />,
|
|
10
|
+
SUPPLEMENT_LEAD_AND_4_STACK: <Lead slice={slice} />,
|
|
11
|
+
SECONDARY_2_AND_2: (
|
|
12
|
+
<BasicRow slice={slice} colums={{ xs: '1fr', md: '1fr 1fr' }} />
|
|
13
|
+
),
|
|
14
|
+
SECONDARY_3: <Row3 slice={slice} />,
|
|
15
|
+
SECONDARY_4: (
|
|
16
|
+
<BasicRow
|
|
17
|
+
slice={slice}
|
|
18
|
+
colums={{ xs: '1fr', md: '1fr 1fr', lg: '1fr 1fr 1fr 1fr' }}
|
|
19
|
+
variant="horizontal"
|
|
20
|
+
/>
|
|
21
|
+
),
|
|
22
|
+
default: <FallBack slice={slice} />,
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return sliceTypes[slice.name] || sliceTypes.default
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const ArticleSlice: React.FC<{ slice: Slice }> = ({ slice }) => (
|
|
29
|
+
<>
|
|
30
|
+
{sliceBlockBuilder(slice)}
|
|
31
|
+
<Block marginBlockEnd="space070" />
|
|
32
|
+
</>
|
|
33
|
+
)
|
|
34
|
+
|
|
35
|
+
export default ArticleSlice
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import {
|
|
3
|
+
CollectionBlock as Collection,
|
|
4
|
+
ArticleSlice as Slice,
|
|
5
|
+
} from '../../helpers/global-types'
|
|
6
|
+
import ArticleSlice from './ArticleSlice'
|
|
7
|
+
import { SectionTitle } from './layouts'
|
|
8
|
+
import { SectionContext } from './SectionContext'
|
|
9
|
+
|
|
10
|
+
const collectionSliceOptions = (type: string) => {
|
|
11
|
+
const sliceTypes = {
|
|
12
|
+
slice: (slice: Slice, i: number) => <ArticleSlice slice={slice} key={i} />,
|
|
13
|
+
'topic-author-slice': () => null,
|
|
14
|
+
default: () => null,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return sliceTypes[type] || sliceTypes.default
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type CollectionBlockProps = {
|
|
21
|
+
collection: Collection
|
|
22
|
+
index: number
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const CollectionBlock: React.FC<CollectionBlockProps> = ({
|
|
26
|
+
collection,
|
|
27
|
+
index,
|
|
28
|
+
}) => {
|
|
29
|
+
const sectionURL = collection?.link?.url || '/uncategorized'
|
|
30
|
+
const titleBarColors = ['', 'teal050', 'purple050', 'neutral050']
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<>
|
|
34
|
+
{index !== 0 && (
|
|
35
|
+
<SectionContext.Consumer>
|
|
36
|
+
{({ isIndexPage }) =>
|
|
37
|
+
!isIndexPage && (
|
|
38
|
+
<SectionTitle
|
|
39
|
+
title={collection.title}
|
|
40
|
+
sectionURL={sectionURL}
|
|
41
|
+
titleBarColour={titleBarColors[index]}
|
|
42
|
+
/>
|
|
43
|
+
)
|
|
44
|
+
}
|
|
45
|
+
</SectionContext.Consumer>
|
|
46
|
+
)}
|
|
47
|
+
{collection.children.map((slice, i) =>
|
|
48
|
+
collectionSliceOptions(slice.type)(slice, i)
|
|
49
|
+
)}
|
|
50
|
+
</>
|
|
51
|
+
)
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
export default CollectionBlock
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { renderWithTheme } from '../../../helpers/test-utils'
|
|
3
|
+
import ArticleSlice from '../ArticleSlice'
|
|
4
|
+
import { getPageMock } from '../../../helpers/mocks'
|
|
5
|
+
import { SectionContext } from '../SectionContext'
|
|
6
|
+
import { ArticleSlice as ArticleSliceType } from '../../../helpers/global-types'
|
|
7
|
+
|
|
8
|
+
describe('ArticleSlice', () => {
|
|
9
|
+
test('Handled SUPPLEMENT_LEAD_AND_4_STACK article-block', () => {
|
|
10
|
+
const { getByTestId, getAllByTestId, getAllByRole } = renderWithTheme(
|
|
11
|
+
ArticleSlice,
|
|
12
|
+
{
|
|
13
|
+
slice: getPageMock.page.body[0].children[0] as ArticleSliceType,
|
|
14
|
+
}
|
|
15
|
+
)
|
|
16
|
+
expect(getByTestId('SUPPLEMENT_LEAD_AND_4_STACK-Grid')).toBeInTheDocument()
|
|
17
|
+
expect(getByTestId('featureVerticalCell')).toBeInTheDocument()
|
|
18
|
+
expect(getAllByTestId(/titleVerticalCell-/).length).toEqual(2)
|
|
19
|
+
expect(getAllByRole('link').length).toEqual(3)
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
test('Handle SECONDARY_4 article-block Homepage', () => {
|
|
23
|
+
const { getByTestId, getAllByTestId, getAllByRole } = renderWithTheme(
|
|
24
|
+
ArticleSlice,
|
|
25
|
+
{
|
|
26
|
+
slice: getPageMock.page.body[0].children[1] as ArticleSliceType,
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
expect(getByTestId('SECONDARY_4-Grid')).toBeInTheDocument()
|
|
30
|
+
expect(getAllByTestId(/titleTeaserVertical-/).length).toEqual(4)
|
|
31
|
+
expect(getAllByRole('link').length).toEqual(4)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('Handle SECONDARY_4 article-block Index Page', () => {
|
|
35
|
+
const { getByTestId, getAllByTestId, getAllByRole } = renderWithTheme(
|
|
36
|
+
SectionContext.Provider,
|
|
37
|
+
{
|
|
38
|
+
value: {
|
|
39
|
+
isIndexPage: true,
|
|
40
|
+
},
|
|
41
|
+
children: (
|
|
42
|
+
<ArticleSlice
|
|
43
|
+
slice={getPageMock.page.body[0].children[1] as ArticleSliceType}
|
|
44
|
+
/>
|
|
45
|
+
),
|
|
46
|
+
}
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
expect(getByTestId('SECONDARY_4-Grid')).toBeInTheDocument()
|
|
50
|
+
expect(getAllByTestId(/titleTeaserVertical-/).length).toEqual(4)
|
|
51
|
+
expect(getAllByRole('link').length).toEqual(4)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
test('Handle SECONDARY_2_AND_2 article-block Homepage', () => {
|
|
55
|
+
const { getByTestId, getAllByTestId, getAllByRole } = renderWithTheme(
|
|
56
|
+
ArticleSlice,
|
|
57
|
+
{
|
|
58
|
+
slice: getPageMock.page.body[0].children[5] as ArticleSliceType,
|
|
59
|
+
}
|
|
60
|
+
)
|
|
61
|
+
|
|
62
|
+
expect(getByTestId('SECONDARY_2_AND_2-Grid')).toBeInTheDocument()
|
|
63
|
+
expect(getAllByTestId(/titleTeaserVertical-/).length).toEqual(2)
|
|
64
|
+
expect(getAllByRole('link').length).toEqual(2)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
test('Handle SECONDARY_2_AND_2 article-block Index Page', () => {
|
|
68
|
+
const { getByTestId, getAllByTestId, getAllByRole } = renderWithTheme(
|
|
69
|
+
SectionContext.Provider,
|
|
70
|
+
{
|
|
71
|
+
value: {
|
|
72
|
+
isIndexPage: true,
|
|
73
|
+
},
|
|
74
|
+
children: (
|
|
75
|
+
<ArticleSlice
|
|
76
|
+
slice={getPageMock.page.body[0].children[5] as ArticleSliceType}
|
|
77
|
+
/>
|
|
78
|
+
),
|
|
79
|
+
}
|
|
80
|
+
)
|
|
81
|
+
|
|
82
|
+
expect(getByTestId('SECONDARY_2_AND_2-Grid')).toBeInTheDocument()
|
|
83
|
+
expect(getAllByTestId(/titleTeaserVertical-/).length).toEqual(2)
|
|
84
|
+
expect(getAllByRole('link').length).toEqual(2)
|
|
85
|
+
})
|
|
86
|
+
|
|
87
|
+
test('Unhandled article-block', () => {
|
|
88
|
+
const { getByText } = renderWithTheme(ArticleSlice, {
|
|
89
|
+
slice: getPageMock.page.body[0].children[2] as ArticleSliceType,
|
|
90
|
+
})
|
|
91
|
+
expect(getByText('Layout: LEAD_1_AND_1')).toBeInTheDocument()
|
|
92
|
+
expect(getByText('test headline').closest('a')).toHaveAttribute(
|
|
93
|
+
'href',
|
|
94
|
+
'catagory-one/demo-1/test-headline'
|
|
95
|
+
)
|
|
96
|
+
expect(getByText('test headline 2').closest('a')).toHaveAttribute(
|
|
97
|
+
'href',
|
|
98
|
+
'catagory-two/demo-2/test-headline-2'
|
|
99
|
+
)
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
test('Unhandled Layout other blocks', () => {
|
|
103
|
+
const { getByText } = renderWithTheme(ArticleSlice, {
|
|
104
|
+
slice: getPageMock.page.body[0].children[3] as ArticleSliceType,
|
|
105
|
+
})
|
|
106
|
+
|
|
107
|
+
expect(getByText('Layout: LEAD_1_AND_1')).toBeInTheDocument()
|
|
108
|
+
expect(getByText('TODO - External Reference')).toBeInTheDocument()
|
|
109
|
+
expect(getByText('TODO - Video')).toBeInTheDocument()
|
|
110
|
+
expect(getByText('Unknown slice block - something')).toBeInTheDocument()
|
|
111
|
+
})
|
|
112
|
+
|
|
113
|
+
test('Handled Layout other blocks', () => {
|
|
114
|
+
const { getByText, getByTestId, getAllByTestId } = renderWithTheme(
|
|
115
|
+
ArticleSlice,
|
|
116
|
+
{
|
|
117
|
+
slice: getPageMock.page.body[0].children[4] as ArticleSliceType,
|
|
118
|
+
}
|
|
119
|
+
)
|
|
120
|
+
|
|
121
|
+
expect(getByTestId('SUPPLEMENT_LEAD_AND_4_STACK-Grid')).toBeInTheDocument()
|
|
122
|
+
expect(getByTestId('featureVerticalCell')).toBeInTheDocument()
|
|
123
|
+
expect(getAllByTestId(/titleVerticalCell-/).length).toEqual(2)
|
|
124
|
+
expect(getByText('TODO - External Reference')).toBeInTheDocument()
|
|
125
|
+
expect(getByText('TODO - Video')).toBeInTheDocument()
|
|
126
|
+
expect(getByText('Unknown slice block - something')).toBeInTheDocument()
|
|
127
|
+
})
|
|
128
|
+
})
|