@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,50 @@
|
|
|
1
|
+
import { renderWithTheme } from '../../helpers/test-utils'
|
|
2
|
+
import Teaser, { TeaserProps } from './index'
|
|
3
|
+
|
|
4
|
+
describe('Teaser', () => {
|
|
5
|
+
const getTeaserData = (variant: TeaserProps['variant']): TeaserProps => ({
|
|
6
|
+
variant,
|
|
7
|
+
media: {
|
|
8
|
+
src: 'https://plchldr.co/i/288x192?bg=F0F0F0&fc=111111&text=img',
|
|
9
|
+
alt: 'test-image',
|
|
10
|
+
},
|
|
11
|
+
title: 'Arcu risus mauris sodales penatibus.',
|
|
12
|
+
teaser:
|
|
13
|
+
'Et libero, congue at condimentum. Id lobortis urna consectetur a, scelerisque lorem amet, magnis fringilla.',
|
|
14
|
+
})
|
|
15
|
+
const imageBase64 =
|
|
16
|
+
'/_next/image?url=https%3A%2F%2Fplchldr.co%2Fi%2F288x192%3Fbg%3DF0F0F0%26fc%3D111111%26text%3Dimg&w=3840&q=75'
|
|
17
|
+
|
|
18
|
+
it('titleTeaserVertical', () => {
|
|
19
|
+
const teaserData = getTeaserData('titleTeaserVertical')
|
|
20
|
+
const { getByText, getByAltText } = renderWithTheme(Teaser, teaserData)
|
|
21
|
+
expect(getByAltText(teaserData.media.alt as string)).toHaveAttribute(
|
|
22
|
+
'src',
|
|
23
|
+
imageBase64
|
|
24
|
+
)
|
|
25
|
+
expect(getByText(teaserData.title)).toBeInTheDocument()
|
|
26
|
+
expect(getByText(teaserData.teaser as string)).toBeInTheDocument()
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('titleVertical', () => {
|
|
30
|
+
const teaserData = getTeaserData('titleVertical')
|
|
31
|
+
const { queryByText, getByAltText } = renderWithTheme(Teaser, teaserData)
|
|
32
|
+
expect(getByAltText(teaserData.media.alt as string)).toHaveAttribute(
|
|
33
|
+
'src',
|
|
34
|
+
imageBase64
|
|
35
|
+
)
|
|
36
|
+
expect(queryByText(teaserData.title)).toBeInTheDocument()
|
|
37
|
+
expect(queryByText(teaserData.teaser as string)).not.toBeInTheDocument()
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
it('featureVertical', () => {
|
|
41
|
+
const teaserData = getTeaserData('titleTeaserVertical')
|
|
42
|
+
const { getByText, getByAltText } = renderWithTheme(Teaser, teaserData)
|
|
43
|
+
expect(getByAltText(teaserData.media.alt as string)).toHaveAttribute(
|
|
44
|
+
'src',
|
|
45
|
+
imageBase64
|
|
46
|
+
)
|
|
47
|
+
expect(getByText(teaserData.title)).toBeInTheDocument()
|
|
48
|
+
expect(getByText(teaserData.teaser as string)).toBeInTheDocument()
|
|
49
|
+
})
|
|
50
|
+
})
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import { Card, Block, TextBlock, Headline } from 'newskit'
|
|
3
|
+
import { Image, getAspectRatio } from '@newskit-render/shared-components'
|
|
4
|
+
import teaserVariants, { VariantsName } from './teaserVariants'
|
|
5
|
+
|
|
6
|
+
export interface TeaserProps {
|
|
7
|
+
variant?: VariantsName
|
|
8
|
+
url?: string
|
|
9
|
+
title: string
|
|
10
|
+
teaser?: string
|
|
11
|
+
media: {
|
|
12
|
+
src: string
|
|
13
|
+
alt?: string
|
|
14
|
+
loadingAspectRatio?: string
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const Teaser: React.FC<TeaserProps> = ({
|
|
19
|
+
variant = 'base',
|
|
20
|
+
url,
|
|
21
|
+
title,
|
|
22
|
+
teaser,
|
|
23
|
+
media,
|
|
24
|
+
}) => {
|
|
25
|
+
const presets = teaserVariants[variant]
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<Card
|
|
29
|
+
layout={presets.layout}
|
|
30
|
+
href={url}
|
|
31
|
+
media={() => (
|
|
32
|
+
<Image
|
|
33
|
+
aspectRatio={getAspectRatio(media.loadingAspectRatio)}
|
|
34
|
+
src={media.src}
|
|
35
|
+
alt={media.alt}
|
|
36
|
+
/>
|
|
37
|
+
)}
|
|
38
|
+
overrides={presets.card}
|
|
39
|
+
>
|
|
40
|
+
<Block marginBlockEnd={presets.title.marginBlockEnd}>
|
|
41
|
+
<Headline
|
|
42
|
+
overrides={{
|
|
43
|
+
typographyPreset: presets.title.typographyPreset,
|
|
44
|
+
}}
|
|
45
|
+
headingAs="h3"
|
|
46
|
+
>
|
|
47
|
+
{title}
|
|
48
|
+
</Headline>
|
|
49
|
+
</Block>
|
|
50
|
+
{teaser && presets.teaser && (
|
|
51
|
+
<Block marginBlockEnd={presets.teaser.marginBlockEnd}>
|
|
52
|
+
<TextBlock
|
|
53
|
+
stylePreset={presets.teaser.stylePreset}
|
|
54
|
+
typographyPreset={presets.teaser.typographyPreset}
|
|
55
|
+
>
|
|
56
|
+
{teaser}
|
|
57
|
+
</TextBlock>
|
|
58
|
+
</Block>
|
|
59
|
+
)}
|
|
60
|
+
</Card>
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default Teaser
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import titleTeaserVertical from './variants/titleTeaserVariant'
|
|
2
|
+
import titleVertical from './variants/titleVertical'
|
|
3
|
+
import featureVertical from './variants/featureVariant'
|
|
4
|
+
import horizontal from './variants/horizontal'
|
|
5
|
+
import { VariantsObject } from './variant-types'
|
|
6
|
+
|
|
7
|
+
const base: VariantsObject = {
|
|
8
|
+
layout: 'vertical',
|
|
9
|
+
card: {},
|
|
10
|
+
media: {},
|
|
11
|
+
title: {
|
|
12
|
+
stylePreset: {},
|
|
13
|
+
typographyPreset: {},
|
|
14
|
+
marginBlockEnd: 'space020',
|
|
15
|
+
},
|
|
16
|
+
teaser: {
|
|
17
|
+
stylePreset: {},
|
|
18
|
+
typographyPreset: {},
|
|
19
|
+
marginBlockEnd: 'space020',
|
|
20
|
+
},
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const teaserVariants = {
|
|
24
|
+
base,
|
|
25
|
+
horizontal,
|
|
26
|
+
titleTeaserVertical,
|
|
27
|
+
titleVertical,
|
|
28
|
+
featureVertical,
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export default teaserVariants
|
|
32
|
+
|
|
33
|
+
export type VariantsName = keyof typeof teaserVariants
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { CardProps } from 'newskit'
|
|
2
|
+
|
|
3
|
+
export type VariantsObject = {
|
|
4
|
+
layout: CardProps['layout']
|
|
5
|
+
card?: {}
|
|
6
|
+
media?: { loadingAspectRatio?: string }
|
|
7
|
+
title: {
|
|
8
|
+
stylePreset?: string | {}
|
|
9
|
+
typographyPreset?:
|
|
10
|
+
| {
|
|
11
|
+
xl?: string
|
|
12
|
+
lg?: string
|
|
13
|
+
md?: string
|
|
14
|
+
sm?: string
|
|
15
|
+
xs?: string
|
|
16
|
+
}
|
|
17
|
+
| string
|
|
18
|
+
marginBlockEnd:
|
|
19
|
+
| {
|
|
20
|
+
xl?: string
|
|
21
|
+
lg?: string
|
|
22
|
+
md?: string
|
|
23
|
+
sm?: string
|
|
24
|
+
xs?: string
|
|
25
|
+
}
|
|
26
|
+
| string
|
|
27
|
+
}
|
|
28
|
+
teaser?: {
|
|
29
|
+
stylePreset?: string | {}
|
|
30
|
+
typographyPreset?:
|
|
31
|
+
| {
|
|
32
|
+
xl?: string
|
|
33
|
+
lg?: string
|
|
34
|
+
md?: string
|
|
35
|
+
sm?: string
|
|
36
|
+
xs?: string
|
|
37
|
+
}
|
|
38
|
+
| string
|
|
39
|
+
marginBlockEnd?:
|
|
40
|
+
| {
|
|
41
|
+
xl?: string
|
|
42
|
+
lg?: string
|
|
43
|
+
md?: string
|
|
44
|
+
sm?: string
|
|
45
|
+
xs?: string
|
|
46
|
+
}
|
|
47
|
+
| string
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { VariantsObject } from '../variant-types'
|
|
2
|
+
|
|
3
|
+
const featureVertical: VariantsObject = {
|
|
4
|
+
layout: 'vertical',
|
|
5
|
+
card: {
|
|
6
|
+
mediaContainer: {
|
|
7
|
+
spaceInline: {
|
|
8
|
+
md: 'space050',
|
|
9
|
+
xs: 'space045',
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
media: {
|
|
14
|
+
loadingAspectRatio: '16:9',
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
stylePreset: 'inkContrast',
|
|
18
|
+
typographyPreset: {
|
|
19
|
+
xl: 'editorialHeadline080',
|
|
20
|
+
md: 'editorialHeadline070',
|
|
21
|
+
xs: 'editorialHeadline040',
|
|
22
|
+
},
|
|
23
|
+
marginBlockEnd: {
|
|
24
|
+
md: 'space050',
|
|
25
|
+
xs: 'space045',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
teaser: {
|
|
29
|
+
stylePreset: 'inkContrast',
|
|
30
|
+
typographyPreset: {
|
|
31
|
+
xl: 'editorialSubheadline050',
|
|
32
|
+
md: 'editorialSubheadline040',
|
|
33
|
+
xs: 'editorialSubheadline020',
|
|
34
|
+
},
|
|
35
|
+
marginBlockEnd: {
|
|
36
|
+
md: 'space040',
|
|
37
|
+
xs: 'space030',
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export default featureVertical
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { VariantsObject } from '../variant-types'
|
|
2
|
+
|
|
3
|
+
const horizontalVariant: VariantsObject = {
|
|
4
|
+
layout: 'horizontal',
|
|
5
|
+
card: {
|
|
6
|
+
horizontalRatio: '1:1',
|
|
7
|
+
},
|
|
8
|
+
title: {
|
|
9
|
+
stylePreset: 'inkContrast',
|
|
10
|
+
marginBlockEnd: 'space020',
|
|
11
|
+
},
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export default horizontalVariant
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { VariantsObject } from '../variant-types'
|
|
2
|
+
|
|
3
|
+
const titleTeaserVertical: VariantsObject = {
|
|
4
|
+
layout: 'vertical',
|
|
5
|
+
card: {
|
|
6
|
+
mediaContainer: {
|
|
7
|
+
spaceInline: 'space045',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
media: {
|
|
11
|
+
loadingAspectRatio: '3:2',
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
stylePreset: 'inkContrast',
|
|
15
|
+
typographyPreset: {
|
|
16
|
+
xl: 'editorialHeadline040',
|
|
17
|
+
md: 'editorialHeadline030',
|
|
18
|
+
xs: 'editorialHeadline020',
|
|
19
|
+
},
|
|
20
|
+
marginBlockEnd: 'space045',
|
|
21
|
+
},
|
|
22
|
+
teaser: {
|
|
23
|
+
stylePreset: 'inkContrast',
|
|
24
|
+
typographyPreset: {
|
|
25
|
+
md: 'editorialParagraph020',
|
|
26
|
+
xs: 'editorialParagraph010',
|
|
27
|
+
},
|
|
28
|
+
marginBlockEnd: 'space030',
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export default titleTeaserVertical
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { VariantsObject } from '../variant-types'
|
|
2
|
+
|
|
3
|
+
const titleVertical: VariantsObject = {
|
|
4
|
+
layout: 'vertical',
|
|
5
|
+
card: {
|
|
6
|
+
mediaContainer: {
|
|
7
|
+
spaceInline: 'space045',
|
|
8
|
+
},
|
|
9
|
+
},
|
|
10
|
+
media: {
|
|
11
|
+
loadingAspectRatio: '16:9',
|
|
12
|
+
},
|
|
13
|
+
title: {
|
|
14
|
+
stylePreset: 'inkContrast',
|
|
15
|
+
typographyPreset: {
|
|
16
|
+
xl: 'editorialHeadline060',
|
|
17
|
+
md: 'editorialHeadline050',
|
|
18
|
+
xs: 'editorialHeadline040',
|
|
19
|
+
},
|
|
20
|
+
marginBlockEnd: 'space040',
|
|
21
|
+
},
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export default titleVertical
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { getSubStringBetween } from './index'
|
|
2
|
+
|
|
3
|
+
describe('Utils tests', () => {
|
|
4
|
+
test('getSubStringBetween', () => {
|
|
5
|
+
const testString = 'Beginning: This will be the subString :End'
|
|
6
|
+
const start = 'Beginning:'
|
|
7
|
+
const finish = ':End'
|
|
8
|
+
expect(getSubStringBetween(start, finish, testString)).toBe(
|
|
9
|
+
' This will be the subString '
|
|
10
|
+
)
|
|
11
|
+
})
|
|
12
|
+
})
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { getSanitizedConfig } from '../index'
|
|
2
|
+
|
|
3
|
+
const originalEnv = process.env
|
|
4
|
+
const { window } = global
|
|
5
|
+
|
|
6
|
+
beforeAll(() => {
|
|
7
|
+
// @ts-ignore
|
|
8
|
+
delete global.window
|
|
9
|
+
})
|
|
10
|
+
afterAll(() => {
|
|
11
|
+
global.window = window
|
|
12
|
+
})
|
|
13
|
+
describe('getSanitizedConfig', () => {
|
|
14
|
+
it('should return required config values', () => {
|
|
15
|
+
process.env = {
|
|
16
|
+
...originalEnv,
|
|
17
|
+
NEWSKIT_API_ENV_URL: 'url',
|
|
18
|
+
NEWSKIT_API_X_API_KEY: 'key',
|
|
19
|
+
OKTA_CLIENT_ID: 'oktaId',
|
|
20
|
+
OKTA_CLIENT_SECRET: 'oktasecret',
|
|
21
|
+
OKTA_DOMAIN: 'domain',
|
|
22
|
+
PUBLISHER: 'publisher',
|
|
23
|
+
ALGOLIA_APP_ID: 'algoliaAppId',
|
|
24
|
+
ALGOLIA_API_KEY: 'algoliaKey',
|
|
25
|
+
ALGOLIA_INDEX: 'algliaIndex',
|
|
26
|
+
}
|
|
27
|
+
const res = getSanitizedConfig()
|
|
28
|
+
|
|
29
|
+
expect(res).toEqual(
|
|
30
|
+
expect.objectContaining({
|
|
31
|
+
publisher: 'publisher',
|
|
32
|
+
})
|
|
33
|
+
)
|
|
34
|
+
process.env = {
|
|
35
|
+
...originalEnv,
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('should throw error when NEWSKIT_API_ENV_URL is missing', () => {
|
|
40
|
+
process.env = {
|
|
41
|
+
...originalEnv,
|
|
42
|
+
NEWSKIT_API_X_API_KEY: 'key',
|
|
43
|
+
OKTA_CLIENT_ID: 'oktaId',
|
|
44
|
+
OKTA_CLIENT_SECRET: 'oktasecret',
|
|
45
|
+
OKTA_DOMAIN: 'domain',
|
|
46
|
+
PUBLISHER: 'publisher',
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
getSanitizedConfig()
|
|
50
|
+
} catch (e) {
|
|
51
|
+
expect(e.message).toEqual('Missing key NEWSKIT_API_ENV_URL in env')
|
|
52
|
+
}
|
|
53
|
+
})
|
|
54
|
+
})
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const requiredConfigFields: string[] = [
|
|
2
|
+
'NEWSKIT_API_ENV_URL',
|
|
3
|
+
'NEWSKIT_API_X_API_KEY',
|
|
4
|
+
'OKTA_CLIENT_ID',
|
|
5
|
+
'OKTA_CLIENT_SECRET',
|
|
6
|
+
'OKTA_DOMAIN',
|
|
7
|
+
'PUBLISHER',
|
|
8
|
+
]
|
|
9
|
+
|
|
10
|
+
export const getSanitizedConfig = () => {
|
|
11
|
+
for (const key of requiredConfigFields) {
|
|
12
|
+
const value = process.env[key]
|
|
13
|
+
if (
|
|
14
|
+
typeof window == 'undefined' &&
|
|
15
|
+
(value === undefined || value.length <= 0)
|
|
16
|
+
) {
|
|
17
|
+
throw new Error(`Missing key ${key} in env`)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
oktaClientId: process.env.OKTA_CLIENT_ID as string,
|
|
22
|
+
oktaClientSecret: process.env.OKTA_CLIENT_SECRET as string,
|
|
23
|
+
oktaDomain: process.env.OKTA_DOMAIN as string,
|
|
24
|
+
newskitApiEnvUrl: process.env.NEWSKIT_API_ENV_URL as string,
|
|
25
|
+
newskitApiXApiKey: process.env.NEWSKIT_API_X_API_KEY as string,
|
|
26
|
+
optimizelysdkKey: process.env.OPTIMIZELY_SDK_KEY as string,
|
|
27
|
+
sitemapFirstPublicationDate: process.env
|
|
28
|
+
.SITEMAP_FIRST_PUBLICATION_DATE as string,
|
|
29
|
+
sitemapPublicationName: process.env.SITEMAP_PUBLICATION_NAME as string,
|
|
30
|
+
winstonEnabled: process.env.WINSTON_ENABLED as string,
|
|
31
|
+
winstonLogLevel: process.env.WINSTON_LOG_LEVEL as string,
|
|
32
|
+
experimentationWeb: process.env.EXPERIMENTATION_WEB as string,
|
|
33
|
+
sourcepointAccountId: process.env.SOURCEPOINT_ACCOUNT_ID as string,
|
|
34
|
+
sourcepointPropertyHref: process.env.SOURCEPOINT_PROPERTY_HREF as string,
|
|
35
|
+
sourcepointPropertyId: process.env.SOURCEPOINT_PROPERTY_ID as string,
|
|
36
|
+
tealiumAccountId: process.env.TEALIUM_ACCOUNT_ID as string,
|
|
37
|
+
tealiumProfileId: process.env.TEALIUM_PROFILE_ID as string,
|
|
38
|
+
tealiumEnv: process.env.TEALIUM_ENV as string,
|
|
39
|
+
twitterUsername: process.env.TWITTER_USERNAME as string,
|
|
40
|
+
gscId: process.env.GSC_ID as string,
|
|
41
|
+
publisher: process.env.PUBLISHER as string,
|
|
42
|
+
algoliaAppId: process.env.ALGOLIA_APP_ID as string,
|
|
43
|
+
algoliaApiKey: process.env.ALGOLIA_API_KEY as string,
|
|
44
|
+
algoliaIndex: process.env.ALGOLIA_INDEX as string,
|
|
45
|
+
nodeEnviroment: process.env.NODE_ENV as string,
|
|
46
|
+
acsSessionUrlTimes: process.env.ACS_SESSION_URL_TIMES as string,
|
|
47
|
+
acsSessionUrlSun: process.env.ACS_SESSION_URL_SUN as string,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
const config = getSanitizedConfig()
|
|
52
|
+
|
|
53
|
+
export const {
|
|
54
|
+
oktaClientId,
|
|
55
|
+
oktaClientSecret,
|
|
56
|
+
oktaDomain,
|
|
57
|
+
newskitApiEnvUrl,
|
|
58
|
+
newskitApiXApiKey,
|
|
59
|
+
optimizelysdkKey,
|
|
60
|
+
sitemapFirstPublicationDate,
|
|
61
|
+
sitemapPublicationName,
|
|
62
|
+
winstonEnabled,
|
|
63
|
+
winstonLogLevel,
|
|
64
|
+
experimentationWeb,
|
|
65
|
+
sourcepointAccountId,
|
|
66
|
+
sourcepointPropertyHref,
|
|
67
|
+
sourcepointPropertyId,
|
|
68
|
+
tealiumAccountId,
|
|
69
|
+
tealiumProfileId,
|
|
70
|
+
tealiumEnv,
|
|
71
|
+
twitterUsername,
|
|
72
|
+
gscId,
|
|
73
|
+
publisher,
|
|
74
|
+
algoliaAppId,
|
|
75
|
+
algoliaApiKey,
|
|
76
|
+
algoliaIndex,
|
|
77
|
+
nodeEnviroment,
|
|
78
|
+
acsSessionUrlTimes,
|
|
79
|
+
acsSessionUrlSun,
|
|
80
|
+
} = config
|
package/config/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { sharedTheme, timesTheme } from '@newskit-render/shared-components'
|
|
2
|
+
import { Publisher } from '@newskit-render/api'
|
|
3
|
+
|
|
4
|
+
export const translationsMap = {
|
|
5
|
+
[Publisher.DEMO]: {},
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export const themesMap = {
|
|
9
|
+
[Publisher.DEMO]: sharedTheme,
|
|
10
|
+
[Publisher.TIMES]: timesTheme,
|
|
11
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
// eslint-disable-next-line react/no-deprecated
|
|
3
|
+
import { render } from 'react-dom'
|
|
4
|
+
import { act } from 'react-dom/test-utils'
|
|
5
|
+
import { sharedTheme, sharedThemeDark } from '@newskit-render/shared-components'
|
|
6
|
+
import { AppContextProvider, AppContext } from '.'
|
|
7
|
+
|
|
8
|
+
const container = document.createElement('div')
|
|
9
|
+
document.body.appendChild(container)
|
|
10
|
+
|
|
11
|
+
jest.mock('../multi-tenancy', () => ({
|
|
12
|
+
useMultiTenancy: jest.fn().mockReturnValue({ tenant: 'DEMO' }),
|
|
13
|
+
}))
|
|
14
|
+
|
|
15
|
+
describe('AppContext tests', () => {
|
|
16
|
+
test('renders the content with the default theme', () => {
|
|
17
|
+
render(
|
|
18
|
+
<AppContextProvider>
|
|
19
|
+
<AppContext.Consumer>
|
|
20
|
+
{({ theme }) => <div>{JSON.stringify(theme)}</div>}
|
|
21
|
+
</AppContext.Consumer>
|
|
22
|
+
</AppContextProvider>,
|
|
23
|
+
container
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
expect(container.textContent).toBe(JSON.stringify(sharedTheme))
|
|
27
|
+
})
|
|
28
|
+
|
|
29
|
+
it('setTheme should switch the theme', () => {
|
|
30
|
+
render(
|
|
31
|
+
<AppContextProvider>
|
|
32
|
+
<AppContext.Consumer>
|
|
33
|
+
{({ theme, setTheme }) => (
|
|
34
|
+
<div>
|
|
35
|
+
<button
|
|
36
|
+
type="button"
|
|
37
|
+
aria-label="btn"
|
|
38
|
+
data-testid="button"
|
|
39
|
+
onClick={(_) => setTheme(sharedThemeDark)}
|
|
40
|
+
/>
|
|
41
|
+
{JSON.stringify(theme)}
|
|
42
|
+
</div>
|
|
43
|
+
)}
|
|
44
|
+
</AppContext.Consumer>
|
|
45
|
+
</AppContextProvider>,
|
|
46
|
+
container
|
|
47
|
+
)
|
|
48
|
+
|
|
49
|
+
const button = document.querySelector('[data-testid=button]')
|
|
50
|
+
act(() => {
|
|
51
|
+
button?.dispatchEvent(new MouseEvent('click', { bubbles: true }))
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
expect(container.textContent).toBe(JSON.stringify(sharedThemeDark))
|
|
55
|
+
})
|
|
56
|
+
})
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {
|
|
2
|
+
holidayStopContext,
|
|
3
|
+
holidayStopListContext,
|
|
4
|
+
} from '@newskit-render/my-account'
|
|
5
|
+
|
|
6
|
+
const HOLIDAY_STOP_BASE_URL = '/account/holiday-stop'
|
|
7
|
+
|
|
8
|
+
export const holidayStopListContextOverrides = {
|
|
9
|
+
...holidayStopContext,
|
|
10
|
+
...holidayStopListContext,
|
|
11
|
+
header: {
|
|
12
|
+
...holidayStopContext.header,
|
|
13
|
+
backButton: {
|
|
14
|
+
...holidayStopContext.header.backButton,
|
|
15
|
+
href: HOLIDAY_STOP_BASE_URL,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React, { useState } from 'react'
|
|
2
|
+
import { UncompiledTheme } from 'newskit'
|
|
3
|
+
import {
|
|
4
|
+
sharedTheme,
|
|
5
|
+
ThemeDropdownObject,
|
|
6
|
+
} from '@newskit-render/shared-components'
|
|
7
|
+
import { useMultiTenancy } from '../multi-tenancy'
|
|
8
|
+
import { themesMap } from '../../config'
|
|
9
|
+
import { useThemeDropdownObject } from '../../helpers/useThemeDropdownObject'
|
|
10
|
+
|
|
11
|
+
type AppContextType = {
|
|
12
|
+
theme: UncompiledTheme
|
|
13
|
+
setTheme: (T: UncompiledTheme) => void
|
|
14
|
+
themeDropdownObject: ThemeDropdownObject
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const AppContext = React.createContext({
|
|
18
|
+
theme: sharedTheme,
|
|
19
|
+
} as AppContextType)
|
|
20
|
+
|
|
21
|
+
const AppContextProvider = ({ children }: { children: JSX.Element }) => {
|
|
22
|
+
const { tenant } = useMultiTenancy()
|
|
23
|
+
const tenantTheme = themesMap[tenant]
|
|
24
|
+
const [theme, setTheme] = useState(tenantTheme)
|
|
25
|
+
const themeDropdownObject = useThemeDropdownObject(setTheme)
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<AppContext.Provider value={{ theme, setTheme, themeDropdownObject }}>
|
|
29
|
+
{children}
|
|
30
|
+
</AppContext.Provider>
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export { AppContextProvider, AppContext }
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { IconCreditCard, IconDirectDebit } from '@newskit-render/my-account'
|
|
2
|
+
const itemFilterDataPath = 'paymentFailure.active'
|
|
3
|
+
const lablIconOverrides = {
|
|
4
|
+
size: 'iconSize030',
|
|
5
|
+
stylePreset: 'inkContrast',
|
|
6
|
+
marginInlineEnd: 'space040',
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export const paymentMethodContext = {
|
|
10
|
+
items: [
|
|
11
|
+
{
|
|
12
|
+
label: 'Debit/Credit Card',
|
|
13
|
+
href: '[baseURL]/payment/credit-card',
|
|
14
|
+
default: 'Debit/Credit Card',
|
|
15
|
+
labelIcon: {
|
|
16
|
+
Icon: IconCreditCard,
|
|
17
|
+
overrides: lablIconOverrides,
|
|
18
|
+
},
|
|
19
|
+
icon: 'internal',
|
|
20
|
+
filter: {
|
|
21
|
+
dataPath: itemFilterDataPath,
|
|
22
|
+
showOnTrue: true,
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
label: 'Direct Debit',
|
|
27
|
+
href: '[baseURL]/payment/direct-debit',
|
|
28
|
+
default: 'Direct Debit',
|
|
29
|
+
labelIcon: {
|
|
30
|
+
Icon: IconDirectDebit,
|
|
31
|
+
overrides: lablIconOverrides,
|
|
32
|
+
},
|
|
33
|
+
icon: 'internal',
|
|
34
|
+
filter: {
|
|
35
|
+
dataPath: itemFilterDataPath,
|
|
36
|
+
showOnTrue: false,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
// {
|
|
40
|
+
// label: 'PayPal',
|
|
41
|
+
// href: '[baseURL]/payment-paypal',
|
|
42
|
+
// default: 'PayPal',
|
|
43
|
+
// labelIcon: {
|
|
44
|
+
// Icon: IconPaypal,
|
|
45
|
+
// overrides: lablIconOverrides,
|
|
46
|
+
// },
|
|
47
|
+
// icon: 'internal',
|
|
48
|
+
// },
|
|
49
|
+
// {
|
|
50
|
+
// label: 'ApplePay',
|
|
51
|
+
// href: '[baseURL]/payment-applepay',
|
|
52
|
+
// default: 'ApplePay',
|
|
53
|
+
// labelIcon: {
|
|
54
|
+
// Icon: IconApplePay,
|
|
55
|
+
// overrides: lablIconOverrides,
|
|
56
|
+
// },
|
|
57
|
+
// icon: 'internal',
|
|
58
|
+
// },
|
|
59
|
+
// {
|
|
60
|
+
// label: 'Google Pay',
|
|
61
|
+
// href: '[baseURL]/payment-google-pay',
|
|
62
|
+
// default: 'Google Pay',
|
|
63
|
+
// labelIcon: {
|
|
64
|
+
// Icon: IconGooglePay,
|
|
65
|
+
// overrides: lablIconOverrides,
|
|
66
|
+
// },
|
|
67
|
+
// icon: 'internal',
|
|
68
|
+
// },
|
|
69
|
+
],
|
|
70
|
+
}
|