@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,22 @@
|
|
|
1
|
+
// ***********************************************************
|
|
2
|
+
// This example support/index.js is processed and
|
|
3
|
+
// loaded automatically before your test files.
|
|
4
|
+
//
|
|
5
|
+
// This is a great place to put global configuration and
|
|
6
|
+
// behavior that modifies Cypress.
|
|
7
|
+
//
|
|
8
|
+
// You can change the location of this file or turn off
|
|
9
|
+
// automatically serving support files with the
|
|
10
|
+
// 'supportFile' configuration option.
|
|
11
|
+
//
|
|
12
|
+
// You can read more here:
|
|
13
|
+
// https://on.cypress.io/configuration
|
|
14
|
+
// ***********************************************************
|
|
15
|
+
|
|
16
|
+
// Import commands.js using ES2015 syntax:
|
|
17
|
+
import './commands'
|
|
18
|
+
import 'cypress-axe'
|
|
19
|
+
import '@percy/cypress';
|
|
20
|
+
|
|
21
|
+
// Alternatively you can use CommonJS syntax:
|
|
22
|
+
// require('./commands')
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// All accounts are created in staging environment
|
|
2
|
+
export const userMap = {
|
|
3
|
+
default: {
|
|
4
|
+
username: 'render.e2e.default@yopmail.com', // Sun
|
|
5
|
+
password: 'Ad45p0-swq151@',
|
|
6
|
+
},
|
|
7
|
+
noSub: {
|
|
8
|
+
username: 'render.e2e.no-sub@yopmail.com', // Sun
|
|
9
|
+
password: 'Ad45p0-swq151@',
|
|
10
|
+
},
|
|
11
|
+
expiredSub: {
|
|
12
|
+
username: 'tim.newsuk3@yopmail.com', // Sun
|
|
13
|
+
password: 'Ad45p0-swq151@',
|
|
14
|
+
},
|
|
15
|
+
withSub: {
|
|
16
|
+
username: 'render-e2e-subscription@yopmail.com', // Sun
|
|
17
|
+
password: 'Testing123$',
|
|
18
|
+
},
|
|
19
|
+
paypalSub: {
|
|
20
|
+
username: 'render-paypal-payment@yopmail.com', // Sun
|
|
21
|
+
password: 'testing123',
|
|
22
|
+
},
|
|
23
|
+
tnl: {
|
|
24
|
+
username: 'cmp1aug2022printstag@yopmail.com', //Print user
|
|
25
|
+
password: 'Password123',
|
|
26
|
+
},
|
|
27
|
+
digitalCard: {
|
|
28
|
+
//dtc=false
|
|
29
|
+
username: 'cmp-digi-card-20-09-22@yopmail.com',
|
|
30
|
+
password: 'Password123',
|
|
31
|
+
},
|
|
32
|
+
digitalDirectDebit: {
|
|
33
|
+
//dtc=false
|
|
34
|
+
username: 'cmp-digi-direct-20-09-22@yopmail.com',
|
|
35
|
+
password: 'Password123',
|
|
36
|
+
},
|
|
37
|
+
print: {
|
|
38
|
+
//dtc=true
|
|
39
|
+
username: 'cmp-dtc-card-20-09-22@yopmail.com',
|
|
40
|
+
password: 'Password123',
|
|
41
|
+
},
|
|
42
|
+
printVouchers: {
|
|
43
|
+
//dtc=false
|
|
44
|
+
username: 'cmp-test-direct-20-09-22@yopmail.com',
|
|
45
|
+
password: 'Password123',
|
|
46
|
+
},
|
|
47
|
+
digiprint: {
|
|
48
|
+
//dtc=true
|
|
49
|
+
username: 'digi-print.dtc.test@yopmail.com',
|
|
50
|
+
password: 'Password123',
|
|
51
|
+
},
|
|
52
|
+
digiprintVouchers: {
|
|
53
|
+
//dtc=false
|
|
54
|
+
username: 'digi-print-card-15-11-22@yopmail.com',
|
|
55
|
+
password: 'Password123',
|
|
56
|
+
},
|
|
57
|
+
}
|
|
58
|
+
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
describe('Visual regression for print and digi_print subscriptions', () => {
|
|
2
|
+
it('should show sections for print user subscriptions', () => {
|
|
3
|
+
cy.GetTnlAcsSession('print')
|
|
4
|
+
cy.mockConsentAndVisit('/account/subscription-and-billing')
|
|
5
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
6
|
+
cy.wait(1000)
|
|
7
|
+
cy.percySnapshot('Subscription and Billing page for print subscriptions')
|
|
8
|
+
})
|
|
9
|
+
})
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const pages = [
|
|
2
|
+
{ url: '/account', pageName: 'Personal Details' },
|
|
3
|
+
{ url: '/account/edit/name', pageName: 'Name form' },
|
|
4
|
+
{ url: '/account/edit/email', pageName: 'Email form' },
|
|
5
|
+
{ url: '/account/edit/password', pageName: 'Password from' },
|
|
6
|
+
{ url: '/account/edit/mobile', pageName: 'Mobile phone from' },
|
|
7
|
+
{ url: '/account/edit/address', pageName: 'Address form' },
|
|
8
|
+
{ url: '/account/cancellation', pageName: 'Cancel reason' },
|
|
9
|
+
{
|
|
10
|
+
url: '/account/subscription-and-billing',
|
|
11
|
+
pageName: 'Subscription and Billing',
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
url: '/account/newsletters-and-alerts',
|
|
15
|
+
pageName: 'Newsletters and Alerts',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
url: '/account/edit/commenting-notifications',
|
|
19
|
+
pageName: 'Commenting Notifications form',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
url: '/account/edit/delivery-instructions',
|
|
23
|
+
pageName: 'delivery instructions form',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
url: '/account/holiday-stop',
|
|
27
|
+
pageName: 'Holiday Stops',
|
|
28
|
+
},
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
describe('Visual regression', () => {
|
|
32
|
+
pages.forEach(({ url, pageName }) => {
|
|
33
|
+
it(`should pass regression: ${pageName}`, () => {
|
|
34
|
+
cy.mockConsentAndVisit(url)
|
|
35
|
+
// eslint-disable-next-line cypress/no-unnecessary-waiting
|
|
36
|
+
cy.wait(1000)
|
|
37
|
+
cy.percySnapshot(`${pageName} page`)
|
|
38
|
+
})
|
|
39
|
+
})
|
|
40
|
+
})
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { defineConfig } from 'cypress'
|
|
2
|
+
import { loadEnvConfig } from '@next/env'
|
|
3
|
+
|
|
4
|
+
export default defineConfig({
|
|
5
|
+
video: false,
|
|
6
|
+
screenshotOnRunFailure: true,
|
|
7
|
+
defaultCommandTimeout: 50000,
|
|
8
|
+
chromeWebSecurity: false,
|
|
9
|
+
retries: 1,
|
|
10
|
+
env: {
|
|
11
|
+
E2E_BASE_URL: 'http://localhost:3000/api/account',
|
|
12
|
+
ACCOUNT_PROVIDER_GRAPHQL_URL:
|
|
13
|
+
'https://main-graphql.staging.newsapis.co.uk/graphql',
|
|
14
|
+
ACCOUNT_PROVIDER_COOKIE_NAME: 'acs_ngn',
|
|
15
|
+
},
|
|
16
|
+
e2e: {
|
|
17
|
+
setupNodeEvents(on, config) {
|
|
18
|
+
const projectDir = process.cwd()
|
|
19
|
+
loadEnvConfig(projectDir)
|
|
20
|
+
|
|
21
|
+
on('task', {
|
|
22
|
+
log(message) {
|
|
23
|
+
console.log(message)
|
|
24
|
+
return null
|
|
25
|
+
},
|
|
26
|
+
table(message) {
|
|
27
|
+
console.table(message)
|
|
28
|
+
return null
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
return config
|
|
33
|
+
},
|
|
34
|
+
baseUrl: 'http://localhost:3000',
|
|
35
|
+
specPattern: './cypress/e2e/**/*.cy.{js,jsx,ts,tsx}',
|
|
36
|
+
excludeSpecPattern: './cypress/e2e/checkout/*.cy.{js,jsx,ts,tsx}',
|
|
37
|
+
},
|
|
38
|
+
})
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import fetch from 'cross-fetch'
|
|
2
|
+
import { fetchUser } from '../getUser'
|
|
3
|
+
|
|
4
|
+
jest.mock('cross-fetch', () => jest.fn().mockImplementation(() => {}))
|
|
5
|
+
|
|
6
|
+
describe('getUser function', () => {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
jest.clearAllMocks()
|
|
9
|
+
})
|
|
10
|
+
it("should call console.error with 'Bad response from server' when Response.status >= 400", async () => {
|
|
11
|
+
jest.spyOn(console, 'error')
|
|
12
|
+
;(fetch as jest.Mock).mockImplementation(() =>
|
|
13
|
+
Promise.resolve({ status: 500 })
|
|
14
|
+
)
|
|
15
|
+
await fetchUser(
|
|
16
|
+
{ Cookie: 'test' },
|
|
17
|
+
'http://localhost:3000/api/account/query'
|
|
18
|
+
)
|
|
19
|
+
expect(console.error).toHaveBeenCalledWith('Bad response from server')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('should call response.json() when Response.status is < 400', async () => {
|
|
23
|
+
const mockJson = jest.fn()
|
|
24
|
+
;(fetch as jest.Mock).mockImplementation(() =>
|
|
25
|
+
Promise.resolve({ status: 200, json: mockJson })
|
|
26
|
+
)
|
|
27
|
+
await fetchUser(
|
|
28
|
+
{ Cookie: 'test' },
|
|
29
|
+
'http://localhost:3000/api/account/query'
|
|
30
|
+
)
|
|
31
|
+
expect(mockJson).toHaveBeenCalled()
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
it('should return null if no cookie', async () => {
|
|
35
|
+
const mockJson = jest.fn()
|
|
36
|
+
;(fetch as jest.Mock).mockImplementation(() =>
|
|
37
|
+
Promise.resolve({ status: 200, json: mockJson })
|
|
38
|
+
)
|
|
39
|
+
await fetchUser(
|
|
40
|
+
"I'm not a cookie",
|
|
41
|
+
'http://localhost:3000/api/account/query'
|
|
42
|
+
)
|
|
43
|
+
expect(mockJson).not.toHaveBeenCalled()
|
|
44
|
+
})
|
|
45
|
+
})
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { replaceConsoleWithLogger } from '../logger'
|
|
2
|
+
|
|
3
|
+
describe('logger', () => {
|
|
4
|
+
const { window } = global
|
|
5
|
+
|
|
6
|
+
const loggerMock = {
|
|
7
|
+
debug: jest.fn(),
|
|
8
|
+
warn: jest.fn(),
|
|
9
|
+
info: jest.fn(),
|
|
10
|
+
error: jest.fn(),
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
beforeEach(() => {
|
|
14
|
+
delete global.window
|
|
15
|
+
jest.resetAllMocks()
|
|
16
|
+
})
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
global.window = window
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('should not replace console.log with Wintson', () => {
|
|
22
|
+
const replaceConsole = replaceConsoleWithLogger(loggerMock, 'false')
|
|
23
|
+
replaceConsole()
|
|
24
|
+
console.log('test')
|
|
25
|
+
expect(loggerMock.info).not.toBeCalledWith('test')
|
|
26
|
+
})
|
|
27
|
+
|
|
28
|
+
it('should replace console.log with Wintson', () => {
|
|
29
|
+
const replaceConsole = replaceConsoleWithLogger(loggerMock, 'true')
|
|
30
|
+
replaceConsole()
|
|
31
|
+
console.log('test')
|
|
32
|
+
expect(loggerMock.info).toBeCalledWith('test')
|
|
33
|
+
})
|
|
34
|
+
|
|
35
|
+
it('should replace console.info with Wintson', () => {
|
|
36
|
+
const replaceConsole = replaceConsoleWithLogger(loggerMock, 'true')
|
|
37
|
+
replaceConsole()
|
|
38
|
+
console.info('test')
|
|
39
|
+
expect(loggerMock.info).toBeCalledWith('test')
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
it('should replace console.warn with Wintson', () => {
|
|
43
|
+
const replaceConsole = replaceConsoleWithLogger(loggerMock, 'true')
|
|
44
|
+
replaceConsole()
|
|
45
|
+
console.warn('test')
|
|
46
|
+
expect(loggerMock.warn).toBeCalledWith('test')
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
it('should replace console.error with Wintson', () => {
|
|
50
|
+
const replaceConsole = replaceConsoleWithLogger(loggerMock, 'true')
|
|
51
|
+
replaceConsole()
|
|
52
|
+
console.error('test')
|
|
53
|
+
expect(loggerMock.error).toBeCalledWith('test')
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
it('should replace console.debug with Wintson', () => {
|
|
57
|
+
const replaceConsole = replaceConsoleWithLogger(loggerMock, 'true')
|
|
58
|
+
replaceConsole()
|
|
59
|
+
console.debug('test')
|
|
60
|
+
expect(loggerMock.debug).toBeCalledWith('test')
|
|
61
|
+
})
|
|
62
|
+
})
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { useThemeDropdownObject } from '../useThemeDropdownObject'
|
|
2
|
+
|
|
3
|
+
jest.mock('react', () => ({
|
|
4
|
+
...jest.requireActual('react'),
|
|
5
|
+
useState: jest.fn().mockReturnValue([false, {}]),
|
|
6
|
+
}))
|
|
7
|
+
|
|
8
|
+
describe('createThemeDropdownObject', () => {
|
|
9
|
+
const setTheme = jest.fn()
|
|
10
|
+
test('should return themeDropdownObject', () => {
|
|
11
|
+
const themeDropdownObject = useThemeDropdownObject(setTheme)
|
|
12
|
+
expect(themeDropdownObject).toEqual({
|
|
13
|
+
clientHeaderImages: {
|
|
14
|
+
'The-Sun': 'display-personalDetails-header-sun.svg',
|
|
15
|
+
'Virgin-Radio': 'display-personalDetails-header-vr.svg',
|
|
16
|
+
'The-Times': 'display-personalDetails-header-times.svg',
|
|
17
|
+
},
|
|
18
|
+
clientNavigationLogos: {
|
|
19
|
+
'The-Sun': {
|
|
20
|
+
src: '/assets/navigationPrimary-brandMark-sun.svg',
|
|
21
|
+
width: '140px',
|
|
22
|
+
height: '48px',
|
|
23
|
+
top: '0',
|
|
24
|
+
},
|
|
25
|
+
'Virgin-Radio': {
|
|
26
|
+
src: '/assets/navigationPrimary-brandMark-vr.svg',
|
|
27
|
+
width: '150px',
|
|
28
|
+
height: '41px',
|
|
29
|
+
top: '0',
|
|
30
|
+
},
|
|
31
|
+
'The-Times': {
|
|
32
|
+
src: '/assets/navigationPrimary-brandMark-times.svg',
|
|
33
|
+
width: '150px',
|
|
34
|
+
height: '40px',
|
|
35
|
+
top: '0',
|
|
36
|
+
},
|
|
37
|
+
TLS: {
|
|
38
|
+
height: '40px',
|
|
39
|
+
src: '/assets/tls-logo-white.svg',
|
|
40
|
+
top: '0',
|
|
41
|
+
width: '150px',
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
options: expect.any(Object),
|
|
45
|
+
themeDropdownOpen: false,
|
|
46
|
+
dropdown: expect.any(Function),
|
|
47
|
+
})
|
|
48
|
+
})
|
|
49
|
+
})
|
package/helpers/a11y.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import fetch from 'cross-fetch'
|
|
2
|
+
import { UserData } from '@newskit-render/my-account'
|
|
3
|
+
import { MainAcsCookie } from '@newskit-render/api'
|
|
4
|
+
|
|
5
|
+
interface UserHeaders {
|
|
6
|
+
[key: string]: string
|
|
7
|
+
}
|
|
8
|
+
interface UserConfig {
|
|
9
|
+
method: string
|
|
10
|
+
headers: UserHeaders
|
|
11
|
+
body: string
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const userConfig = (acsCookie: { Cookie: string }): UserConfig => ({
|
|
15
|
+
method: 'POST',
|
|
16
|
+
headers: {
|
|
17
|
+
'Content-Type': 'application/json',
|
|
18
|
+
...acsCookie,
|
|
19
|
+
},
|
|
20
|
+
body: JSON.stringify({ queryFragment: 'UserPaymentInfo' }),
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
export const fetchUser = async (
|
|
24
|
+
acsCookie: MainAcsCookie,
|
|
25
|
+
url: string
|
|
26
|
+
): Promise<UserData | null> => {
|
|
27
|
+
if (typeof acsCookie === 'object') {
|
|
28
|
+
const response = await fetch(url, userConfig(acsCookie))
|
|
29
|
+
|
|
30
|
+
if (response.status >= 400) {
|
|
31
|
+
console.error('Bad response from server')
|
|
32
|
+
return null
|
|
33
|
+
}
|
|
34
|
+
return (await response.json()) as UserData
|
|
35
|
+
}
|
|
36
|
+
return null
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const getYear = () => new Date().getFullYear()
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
utag: Record<string, TealiumData>
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
interface TealiumData {
|
|
7
|
+
data: Record<string, string>
|
|
8
|
+
}
|
|
9
|
+
export enum ContentType {
|
|
10
|
+
article,
|
|
11
|
+
post,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type RadioPost = {
|
|
15
|
+
id: number
|
|
16
|
+
type: ContentType
|
|
17
|
+
headline: string
|
|
18
|
+
body: Array<Object>
|
|
19
|
+
dateCreated: string
|
|
20
|
+
datePublished: string
|
|
21
|
+
dateUpdated?: string
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type RadioPosts = Array<RadioPost>
|
|
25
|
+
|
|
26
|
+
export type Layout = 'vertical' | 'horizontal' | 'horizontal-reverse'
|
|
27
|
+
|
|
28
|
+
export type TeaserSummary = {
|
|
29
|
+
children?: {
|
|
30
|
+
text: string
|
|
31
|
+
}[]
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export type TeaserCategory = {
|
|
35
|
+
slug: string
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export type ArticleTeaser = {
|
|
39
|
+
id?: string
|
|
40
|
+
slug?: string
|
|
41
|
+
categories?: TeaserCategory[]
|
|
42
|
+
topics?: {
|
|
43
|
+
name: string
|
|
44
|
+
slug: string
|
|
45
|
+
}[]
|
|
46
|
+
kicker?: string
|
|
47
|
+
headline?: string
|
|
48
|
+
media?: Media
|
|
49
|
+
summary?: TeaserSummary
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export type ArticleBlock = {
|
|
53
|
+
type: string
|
|
54
|
+
article: ArticleTeaser
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export type VideoBrightcoveBlock = {
|
|
58
|
+
accountId: string
|
|
59
|
+
id: string
|
|
60
|
+
playerId: string
|
|
61
|
+
type: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export type ExternalReferenceBlock = {
|
|
65
|
+
author: {
|
|
66
|
+
id: string
|
|
67
|
+
type: string
|
|
68
|
+
}
|
|
69
|
+
headline: string
|
|
70
|
+
image: {
|
|
71
|
+
alt: string
|
|
72
|
+
caption: string
|
|
73
|
+
credit: string
|
|
74
|
+
type: string
|
|
75
|
+
url: string
|
|
76
|
+
}
|
|
77
|
+
label: string
|
|
78
|
+
type: string
|
|
79
|
+
url: string
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export type SliceBlock =
|
|
83
|
+
| ArticleBlock
|
|
84
|
+
| VideoBrightcoveBlock
|
|
85
|
+
| ExternalReferenceBlock
|
|
86
|
+
|
|
87
|
+
export type ArticleSlice = {
|
|
88
|
+
name: string
|
|
89
|
+
type: string
|
|
90
|
+
children: SliceBlock[]
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export type TopicAuthorSlice = {
|
|
94
|
+
type: string
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
export type CollectionSlice = ArticleSlice | TopicAuthorSlice
|
|
98
|
+
|
|
99
|
+
export type CollectionBlock = {
|
|
100
|
+
id: string
|
|
101
|
+
type: string
|
|
102
|
+
title?: string
|
|
103
|
+
link?: {
|
|
104
|
+
url: string
|
|
105
|
+
text?: string
|
|
106
|
+
}
|
|
107
|
+
children: CollectionSlice[]
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type ImageBlock = {
|
|
111
|
+
type: string
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export type TweetBlock = {
|
|
115
|
+
type: string
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export type PageBlock =
|
|
119
|
+
| CollectionBlock
|
|
120
|
+
| ImageBlock
|
|
121
|
+
| TweetBlock
|
|
122
|
+
| ParagraphBlock
|
|
123
|
+
|
|
124
|
+
export type Page = {
|
|
125
|
+
id: string
|
|
126
|
+
title: string
|
|
127
|
+
slug: string
|
|
128
|
+
body: PageBlock[]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export type Media = Image | Video
|
|
132
|
+
|
|
133
|
+
export type Image = {
|
|
134
|
+
crops: ImageCrop[]
|
|
135
|
+
crop?: ImageCrop
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export type Video = {
|
|
139
|
+
videoId: string
|
|
140
|
+
accountId?: string
|
|
141
|
+
posterImage?: Image
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type ImageCrop = {
|
|
145
|
+
url?: string
|
|
146
|
+
alt?: string
|
|
147
|
+
aspectRatio?: string
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export type Byline = AuthorByline | TextByline
|
|
151
|
+
|
|
152
|
+
export type AuthorByline = {
|
|
153
|
+
type: string
|
|
154
|
+
slug: string
|
|
155
|
+
name: string
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
export type TextByline = {
|
|
159
|
+
type: string
|
|
160
|
+
value: string
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
export type Slug = string & { _: 'Slug' }
|
|
164
|
+
export type URL = string & { _: 'Url' }
|
|
165
|
+
|
|
166
|
+
export type Topic = {
|
|
167
|
+
name: string
|
|
168
|
+
slug?: string
|
|
169
|
+
link?: URL
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
export type ParagraphBlock = {
|
|
173
|
+
type?: string
|
|
174
|
+
children: ArticleParagraphChildren[]
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
export type ArticleParagraphChildren = ArticleText | ArticleHyperlink
|
|
178
|
+
|
|
179
|
+
export type ArticleText = {
|
|
180
|
+
text: string
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
export type ArticleHyperlink = {
|
|
184
|
+
url: string
|
|
185
|
+
text?: string
|
|
186
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import winston, { Logger } from 'winston'
|
|
2
|
+
import newrelicFormatter from '@newrelic/winston-enricher'
|
|
3
|
+
|
|
4
|
+
const newrelicWinstonFormatter = newrelicFormatter(winston)
|
|
5
|
+
|
|
6
|
+
export const getWinstonLogger = (winstonLogLevel?: string): Logger =>
|
|
7
|
+
winston.createLogger({
|
|
8
|
+
level: winstonLogLevel || 'info',
|
|
9
|
+
format: winston.format.json(),
|
|
10
|
+
transports: [
|
|
11
|
+
new winston.transports.Console({
|
|
12
|
+
format: winston.format.combine(
|
|
13
|
+
winston.format.timestamp({ format: 'DD-MM-YYYY T hh:mm:ss.sss A' }),
|
|
14
|
+
winston.format.json(),
|
|
15
|
+
newrelicWinstonFormatter()
|
|
16
|
+
),
|
|
17
|
+
}),
|
|
18
|
+
],
|
|
19
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import newrelic from 'newrelic'
|
|
2
|
+
import { winstonEnabled, winstonLogLevel } from '../../config'
|
|
3
|
+
import { getWinstonLogger } from './getWinstonLogger'
|
|
4
|
+
import { replaceConsoleWithLogger } from './replaceConsoleWithLogger'
|
|
5
|
+
|
|
6
|
+
const logger = getWinstonLogger(winstonLogLevel)
|
|
7
|
+
const replaceConsole = replaceConsoleWithLogger(logger, winstonEnabled)
|
|
8
|
+
|
|
9
|
+
const replaceConsoleAndSetTransactionName = (transactionName: string) => {
|
|
10
|
+
replaceConsole()
|
|
11
|
+
|
|
12
|
+
newrelic.setTransactionName(transactionName)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export {
|
|
16
|
+
logger,
|
|
17
|
+
replaceConsoleWithLogger,
|
|
18
|
+
replaceConsole,
|
|
19
|
+
replaceConsoleAndSetTransactionName,
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Logger } from 'winston'
|
|
2
|
+
|
|
3
|
+
export const replaceConsoleWithLogger =
|
|
4
|
+
(logger: Logger, winstonEnabled?: string) => () => {
|
|
5
|
+
if (winstonEnabled === 'true') {
|
|
6
|
+
console.log = (...message: any[]) => logger.info.call(logger, ...message)
|
|
7
|
+
console.info = (...message: any[]) => logger.info.call(logger, ...message)
|
|
8
|
+
console.warn = (...message: any[]) => logger.warn.call(logger, ...message)
|
|
9
|
+
console.error = (...message: any[]) =>
|
|
10
|
+
logger.error.call(logger, ...message)
|
|
11
|
+
console.debug = (...message: any[]) =>
|
|
12
|
+
logger.debug.call(logger, ...message)
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
const imagePlaceholderHref = (res) =>
|
|
2
|
+
`https://plchldr.co/i/${res}?bg=F0F0F0&fc=111111&text=IMG`
|
|
3
|
+
|
|
4
|
+
export const highlights = [
|
|
5
|
+
// this should be returned form API when available
|
|
6
|
+
{
|
|
7
|
+
title: 'Test Box',
|
|
8
|
+
href: imagePlaceholderHref('50x50'),
|
|
9
|
+
},
|
|
10
|
+
{
|
|
11
|
+
title: 'Prince Harry',
|
|
12
|
+
href: imagePlaceholderHref('50x50'),
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
title: 'Meghan Markle',
|
|
16
|
+
href: imagePlaceholderHref('50x50'),
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: 'Royal Family',
|
|
20
|
+
href: imagePlaceholderHref('50x50'),
|
|
21
|
+
},
|
|
22
|
+
]
|
|
23
|
+
|
|
24
|
+
export const relatedArticles = [
|
|
25
|
+
// this should be returned form API when available
|
|
26
|
+
{
|
|
27
|
+
title: 'Prince Harry',
|
|
28
|
+
tag: 'NEWS',
|
|
29
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
30
|
+
href: imagePlaceholderHref('70x50'),
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
title: 'Meghan Markle',
|
|
34
|
+
tag: 'SPORT',
|
|
35
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
36
|
+
href: imagePlaceholderHref('70x50'),
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
title: 'Royal Family',
|
|
40
|
+
tag: 'CULTURE',
|
|
41
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
42
|
+
href: imagePlaceholderHref('70x50'),
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
title: 'Royal',
|
|
46
|
+
tag: 'CORONAVIRUS',
|
|
47
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut a sodales leo. Cras egestas nisl libero, vitae viverra justo gravida quis.',
|
|
48
|
+
href: imagePlaceholderHref('70x50'),
|
|
49
|
+
},
|
|
50
|
+
]
|