@city-of-helsinki/react-helsinki-headless-cms 3.0.0-rc.1 → 3.0.0-rc.2
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/dist/LICENSE +21 -0
- package/dist/README.md +442 -0
- package/dist/__generated__-mcycL1jB.d.ts +7192 -0
- package/dist/apollo.d.ts +168 -0
- package/dist/apollo.js +194 -0
- package/dist/apollo.js.map +1 -0
- package/dist/archiveSearchPageContent.module-DmpLBZP5.js +4078 -0
- package/dist/archiveSearchPageContent.module-DmpLBZP5.js.map +1 -0
- package/dist/cjs/apollo.js +227 -0
- package/dist/cjs/apollo.js.map +1 -0
- package/dist/cjs/archiveSearchPageContent.module-Hcb4WVMf.js +4143 -0
- package/dist/cjs/archiveSearchPageContent.module-Hcb4WVMf.js.map +1 -0
- package/dist/cjs/defaultConfig-dV2AVA5S.js +19908 -0
- package/dist/cjs/defaultConfig-dV2AVA5S.js.map +1 -0
- package/dist/cjs/index-Eg-NhhyT.js +799 -0
- package/dist/cjs/index-Eg-NhhyT.js.map +1 -0
- package/dist/cjs/index.js +439 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/jest-setup.d.ts +1 -0
- package/dist/cjs/nextjs.js +74 -0
- package/dist/cjs/nextjs.js.map +1 -0
- package/dist/cjs/src/apollo/apollo-custom-template.stories.d.ts +12 -0
- package/dist/cjs/src/apollo/apollo.stories.d.ts +24 -0
- package/dist/cjs/src/apollo/index.d.ts +17 -0
- package/dist/cjs/src/apollo/navigation/Navigation.d.ts +13 -0
- package/dist/cjs/src/apollo/navigation/__tests__/Navigation.test.d.ts +1 -0
- package/dist/cjs/src/apollo/notification/Notification.d.ts +4 -0
- package/dist/cjs/src/apollo/notification/__tests__/Notification.test.d.ts +1 -0
- package/dist/cjs/src/apollo/page/ApolloPageContextProvider.d.ts +5 -0
- package/dist/cjs/src/apollo/page/Page.d.ts +14 -0
- package/dist/cjs/src/apollo/page/apolloPageContext.d.ts +13 -0
- package/dist/cjs/src/apollo/page/useApolloPageContext.d.ts +4 -0
- package/dist/cjs/src/apollo/pageContent/PageContent.d.ts +9 -0
- package/dist/cjs/src/apollo/pageWithTemplateContent/PageWithTemplateContent.d.ts +14 -0
- package/dist/cjs/src/common/components/container/Container.d.ts +13 -0
- package/dist/cjs/src/common/components/grid/Grid.d.ts +16 -0
- package/dist/cjs/src/common/components/grid/Grid.stories.d.ts +8 -0
- package/dist/cjs/src/common/components/htmlToReact/HtmlToReact.d.ts +38 -0
- package/dist/cjs/src/common/components/htmlToReact/HtmlToReact.stories.d.ts +13 -0
- package/dist/cjs/src/common/components/htmlToReact/__tests__/HtmlToReact.tests.d.ts +1 -0
- package/dist/cjs/src/common/components/htmlToReact/replaceComponents/DefaultH2.d.ts +4 -0
- package/dist/cjs/src/common/components/htmlToReact/replaceComponents/DefaultP.d.ts +4 -0
- package/dist/cjs/src/common/components/htmlToReact/replaceComponents/IframeForEmbeddedMedia.d.ts +6 -0
- package/dist/cjs/src/common/components/htmlToReact/replaceComponents/index.d.ts +3 -0
- package/dist/cjs/src/common/components/icons/index.d.ts +5 -0
- package/dist/cjs/src/common/components/list/List.d.ts +13 -0
- package/dist/cjs/src/common/components/list/List.stories.d.ts +13 -0
- package/dist/cjs/src/common/components/tag/Tag.d.ts +26 -0
- package/dist/cjs/src/common/components/tag/Tag.stories.d.ts +80 -0
- package/dist/cjs/src/common/components/tag/__tests__/Tag.test.d.ts +1 -0
- package/dist/cjs/src/common/components/tag/tagThemes.d.ts +3 -0
- package/dist/cjs/src/common/components/text/Text.d.ts +27 -0
- package/dist/cjs/src/common/components/text/Text.stories.d.ts +14 -0
- package/dist/cjs/src/common/constants.d.ts +2 -0
- package/dist/cjs/src/common/eventsService/__generated__.d.ts +1420 -0
- package/dist/cjs/src/common/eventsService/events.d.ts +12 -0
- package/dist/cjs/src/common/eventsService/types.d.ts +2 -0
- package/dist/cjs/src/common/eventsService/utils.d.ts +7 -0
- package/dist/cjs/src/common/headlessService/__generated__.d.ts +20878 -0
- package/dist/cjs/src/common/headlessService/article.d.ts +7 -0
- package/dist/cjs/src/common/headlessService/articles.d.ts +17 -0
- package/dist/cjs/src/common/headlessService/categories.d.ts +13 -0
- package/dist/cjs/src/common/headlessService/category.d.ts +9 -0
- package/dist/cjs/src/common/headlessService/constants.d.ts +7 -0
- package/dist/cjs/src/common/headlessService/landingPage.d.ts +9 -0
- package/dist/cjs/src/common/headlessService/languages.d.ts +8 -0
- package/dist/cjs/src/common/headlessService/makeQueryWithApolloClientFromConfig.d.ts +12 -0
- package/dist/cjs/src/common/headlessService/menu.d.ts +10 -0
- package/dist/cjs/src/common/headlessService/notification.d.ts +7 -0
- package/dist/cjs/src/common/headlessService/page.d.ts +8 -0
- package/dist/cjs/src/common/headlessService/pageByTemplate.d.ts +9 -0
- package/dist/cjs/src/common/headlessService/pages.d.ts +13 -0
- package/dist/cjs/src/common/headlessService/tag.d.ts +9 -0
- package/dist/cjs/src/common/headlessService/tags.d.ts +13 -0
- package/dist/cjs/src/common/headlessService/types.d.ts +17 -0
- package/dist/cjs/src/common/headlessService/utils.d.ts +909 -0
- package/dist/cjs/src/common/utils/customRender.d.ts +4 -0
- package/dist/cjs/src/common/utils/dates.d.ts +20 -0
- package/dist/cjs/src/common/utils/getIsValidHttpUrl.d.ts +5 -0
- package/dist/cjs/src/common/utils/hash.d.ts +1 -0
- package/dist/cjs/src/common/utils/makeLocaleStorageValue.d.ts +6 -0
- package/dist/cjs/src/common/utils/testImage.d.ts +9 -0
- package/dist/cjs/src/common/venuesService/__generated__.d.ts +254 -0
- package/dist/cjs/src/common/venuesService/makeQueryWithVenuesApolloClientFromConfig.d.ts +7 -0
- package/dist/cjs/src/common/venuesService/types.d.ts +2 -0
- package/dist/cjs/src/constants.d.ts +5 -0
- package/dist/cjs/src/core/archiveSearchPage/ArchivePageMeta.d.ts +13 -0
- package/dist/cjs/src/core/archiveSearchPage/ArchiveSearchPage.d.ts +16 -0
- package/dist/cjs/src/core/archiveSearchPage/ArchiveSearchPage.stories.d.ts +50 -0
- package/dist/cjs/src/core/archiveSearchPageContent/ArchiveSearchPageContent.d.ts +92 -0
- package/dist/cjs/src/core/button/LoadingButton.d.ts +8 -0
- package/dist/cjs/src/core/card/Card.d.ts +102 -0
- package/dist/cjs/src/core/card/Card.stories.d.ts +99 -0
- package/dist/cjs/src/core/card/LargeCard.d.ts +68 -0
- package/dist/cjs/src/core/card/LargeCard.stories.d.ts +16 -0
- package/dist/cjs/src/core/cardsList/CardsList.d.ts +16 -0
- package/dist/cjs/src/core/cardsList/CardsList.stories.d.ts +22 -0
- package/dist/cjs/src/core/carousel/Carousel.d.ts +3 -0
- package/dist/cjs/src/core/carousel/Carousel.stories.d.ts +34 -0
- package/dist/cjs/src/core/carousel/__tests__/Carousel.test.d.ts +1 -0
- package/dist/cjs/src/core/carousel/components/CarouselSlideButton.d.ts +3 -0
- package/dist/cjs/src/core/carousel/components/CarouselSlider.d.ts +3 -0
- package/dist/cjs/src/core/carousel/components/CarouselSliderDot.d.ts +2 -0
- package/dist/cjs/src/core/carousel/components/CarouselSliderPage.d.ts +5 -0
- package/dist/cjs/src/core/carousel/components/__tests__/CarouselSlideButton.test.d.ts +1 -0
- package/dist/cjs/src/core/carousel/components/__tests__/CarouselSlider.test.d.ts +1 -0
- package/dist/cjs/src/core/carousel/components/__tests__/CarouselSliderDot.test.d.ts +1 -0
- package/dist/cjs/src/core/carousel/components/__tests__/CarouselSliderPage.test.d.ts +1 -0
- package/dist/cjs/src/core/carousel/constants.d.ts +20 -0
- package/dist/cjs/src/core/carousel/context/CarouselContext.d.ts +4 -0
- package/dist/cjs/src/core/carousel/context/CarouselContextProvider.d.ts +7 -0
- package/dist/cjs/src/core/carousel/types.d.ts +147 -0
- package/dist/cjs/src/core/carousel/utils/utils.d.ts +27 -0
- package/dist/cjs/src/core/collection/Collection.d.ts +102 -0
- package/dist/cjs/src/core/collection/Collection.stories.d.ts +48 -0
- package/dist/cjs/src/core/collection/__tests__/Collection.test.d.ts +1 -0
- package/dist/cjs/src/core/collection/constants.d.ts +1 -0
- package/dist/cjs/src/core/collection/types.d.ts +28 -0
- package/dist/cjs/src/core/collection/utils.d.ts +36 -0
- package/dist/cjs/src/core/configProvider/ConfigProvider.d.ts +13 -0
- package/dist/cjs/src/core/configProvider/configContext.d.ts +130 -0
- package/dist/cjs/src/core/configProvider/defaultConfig.d.ts +61 -0
- package/dist/cjs/src/core/configProvider/useApolloClientFromConfig.d.ts +1 -0
- package/dist/cjs/src/core/configProvider/useConfig.d.ts +2 -0
- package/dist/cjs/src/core/configProvider/useEventsApolloClientFromConfig.d.ts +1 -0
- package/dist/cjs/src/core/configProvider/useHeadlessCmsLink.d.ts +2 -0
- package/dist/cjs/src/core/configProvider/useVenuesApolloClientFromConfig.d.ts +1 -0
- package/dist/cjs/src/core/contentContainer/ContentContainer.d.ts +12 -0
- package/dist/cjs/src/core/contentContainer/ContentContainer.stories.d.ts +8 -0
- package/dist/cjs/src/core/hero/Hero.d.ts +33 -0
- package/dist/cjs/src/core/hero/Hero.stories.d.ts +23 -0
- package/dist/cjs/src/core/hooks/useResolveImageUrl.d.ts +6 -0
- package/dist/cjs/src/core/image/BackgroundImage.d.ts +20 -0
- package/dist/cjs/src/core/image/Image.d.ts +24 -0
- package/dist/cjs/src/core/image/__tests__/BackgroundImage.test.d.ts +1 -0
- package/dist/cjs/src/core/image/__tests__/Image.test.d.ts +1 -0
- package/dist/cjs/src/core/imageGallery/ImageGallery.d.ts +25 -0
- package/dist/cjs/src/core/imageGallery/ImageGalleryContext.d.ts +32 -0
- package/dist/cjs/src/core/imageGallery/ImageGalleryProvider.d.ts +10 -0
- package/dist/cjs/src/core/imageGallery/ImageItem.d.ts +26 -0
- package/dist/cjs/src/core/imageGallery/ImagesGrid.d.ts +26 -0
- package/dist/cjs/src/core/imageGallery/Lightbox.d.ts +24 -0
- package/dist/cjs/src/core/imageGallery/types.d.ts +6 -0
- package/dist/cjs/src/core/imageGallery/useImageGalleryContext.d.ts +1 -0
- package/dist/cjs/src/core/index.d.ts +43 -0
- package/dist/cjs/src/core/language/__tests__/languageSorter.test.d.ts +1 -0
- package/dist/cjs/src/core/language/constants.d.ts +6 -0
- package/dist/cjs/src/core/language/findLanguage.d.ts +10 -0
- package/dist/cjs/src/core/language/index.d.ts +6 -0
- package/dist/cjs/src/core/language/languageSorter.d.ts +4 -0
- package/dist/cjs/src/core/language/toPrimaryLanguageOption.d.ts +5 -0
- package/dist/cjs/src/core/language/typeGuards.d.ts +3 -0
- package/dist/cjs/src/core/language/types.d.ts +5 -0
- package/dist/cjs/src/core/link/Link.d.ts +44 -0
- package/dist/cjs/src/core/link/Link.stories.d.ts +33 -0
- package/dist/cjs/src/core/link/LinkBase.d.ts +106 -0
- package/dist/cjs/src/core/link/SecondaryLink.d.ts +3 -0
- package/dist/cjs/src/core/link/__tests__/Link.test.d.ts +1 -0
- package/dist/cjs/src/core/linkBox/Link.stories.d.ts +23 -0
- package/dist/cjs/src/core/linkBox/LinkBox.d.ts +20 -0
- package/dist/cjs/src/core/navigation/Navigation.d.ts +15 -0
- package/dist/cjs/src/core/notification/Notification.d.ts +9 -0
- package/dist/cjs/src/core/notification/__tests__/Notification.test.d.ts +1 -0
- package/dist/cjs/src/core/notification/utils/getIsNotificationActive.d.ts +2 -0
- package/dist/cjs/src/core/notification/utils/getNotificationHash.d.ts +2 -0
- package/dist/cjs/src/core/page/Page.d.ts +9 -0
- package/dist/cjs/src/core/page/Page.stories.d.ts +40 -0
- package/dist/cjs/src/core/pageContent/PageContent.d.ts +11 -0
- package/dist/cjs/src/core/pageContent/PageContent.stories.d.ts +1146 -0
- package/dist/cjs/src/core/pageContent/PageContentBreadcrumb.d.ts +5 -0
- package/dist/cjs/src/core/pageContent/PageContentLayout.d.ts +16 -0
- package/dist/cjs/src/core/pageContent/PageMainContent.d.ts +11 -0
- package/dist/cjs/src/core/pageContent/__tests__/Page.test.d.ts +1 -0
- package/dist/cjs/src/core/pageContent/meta/PageMeta.d.ts +9 -0
- package/dist/cjs/src/core/pageContent/sidebarContent/SidebarCardsList.d.ts +5 -0
- package/dist/cjs/src/core/pageContent/sidebarContent/SidebarContent.d.ts +15 -0
- package/dist/cjs/src/core/pageContent/sidebarContent/SidebarContentCard.d.ts +12 -0
- package/dist/cjs/src/core/pageContent/sidebarContent/SidebarContentLinkList.d.ts +5 -0
- package/dist/cjs/src/core/pageContent/sidebarContent/SidebarPostListItem.d.ts +8 -0
- package/dist/cjs/src/core/pageContent/sidebarContent/__tests__/SidebarContent.test.d.ts +1 -0
- package/dist/cjs/src/core/pageContent/types.d.ts +36 -0
- package/dist/cjs/src/core/pageContent/utils.d.ts +28 -0
- package/dist/cjs/src/core/pageContextProvider/PageContext.d.ts +6 -0
- package/dist/cjs/src/core/pageContextProvider/PageContextProvider.d.ts +6 -0
- package/dist/cjs/src/core/pageContextProvider/__tests__/PageContextProvider.test.d.ts +1 -0
- package/dist/cjs/src/core/pageContextProvider/usePageContext.d.ts +1 -0
- package/dist/cjs/src/core/pageModules/CardModule/CardModule.d.ts +3 -0
- package/dist/cjs/src/core/pageModules/CardModule/CardModule.stories.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/CardsModule/CardsModule.d.ts +17 -0
- package/dist/cjs/src/core/pageModules/CardsModule/CardsModule.stories.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/CardsModule/Icon.d.ts +6 -0
- package/dist/cjs/src/core/pageModules/CardsModule/SimpleCard.d.ts +13 -0
- package/dist/cjs/src/core/pageModules/ContentModule/ContentModule.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/ContentModule/ContentModule.stories.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/ImageGalleryModule/ImageGalleryModule.d.ts +3 -0
- package/dist/cjs/src/core/pageModules/ImageGalleryModule/ImageGalleryModule.stories.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/SocialMediaFeedModule/SocialMediaFeedModule.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/SocialMediaFeedModule/SocialMediaFeedModule.stories.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/StepsModule/StepsModule.d.ts +14 -0
- package/dist/cjs/src/core/pageModules/StepsModule/StepsModule.stories.d.ts +7 -0
- package/dist/cjs/src/core/pageModules/constants.d.ts +1 -0
- package/dist/cjs/src/core/pageSection/PageSection.d.ts +32 -0
- package/dist/cjs/src/core/pageSection/PageSection.stories.d.ts +7 -0
- package/dist/cjs/src/core/pageSection/__tests__/PageSection.test.d.ts +1 -0
- package/dist/cjs/src/core/storyContainer/StoryContainer.d.ts +6 -0
- package/dist/cjs/src/core/translation/__tests__/getTranslationWithFallback.test.d.ts +1 -0
- package/dist/cjs/src/core/translation/constants.d.ts +12 -0
- package/dist/cjs/src/core/translation/getTranslationWithFallback.d.ts +4 -0
- package/dist/cjs/src/core/translation/types.d.ts +8 -0
- package/dist/cjs/src/core/translation/useTranslationWithFallback.d.ts +4 -0
- package/dist/cjs/src/core/utils/__tests__/findAllElementsOfType.test.d.ts +1 -0
- package/dist/cjs/src/core/utils/__tests__/getChildrenByType.test.d.ts +1 -0
- package/dist/cjs/src/core/utils/__tests__/recursiveMap.test.d.ts +1 -0
- package/dist/cjs/src/core/utils/createHashKey.d.ts +1 -0
- package/dist/cjs/src/core/utils/findAllElementsOfType.d.ts +5 -0
- package/dist/cjs/src/core/utils/getChildrenByType.d.ts +18 -0
- package/dist/cjs/src/core/utils/isTrustedOrigin.d.ts +1 -0
- package/dist/cjs/src/core/utils/recursiveMap.d.ts +15 -0
- package/dist/cjs/src/core/utils/string.d.ts +27 -0
- package/dist/cjs/src/core/utils/validateTrustedOriginsFormat.d.ts +1 -0
- package/dist/cjs/src/linkedEvents/utils/normalizeKey.d.ts +10 -0
- package/dist/cjs/src/linkedEvents/utils/normalizeKeys.d.ts +28 -0
- package/dist/cjs/src/mocks/handlers.d.ts +1 -0
- package/dist/cjs/src/mocks/queries/cms/languages.d.ts +1 -0
- package/dist/cjs/src/mocks/queries/cms/menu.d.ts +1 -0
- package/dist/cjs/src/mocks/queries/cms/notification.d.ts +1 -0
- package/dist/cjs/src/mocks/queries/cms/page.d.ts +1 -0
- package/dist/cjs/src/mocks/queries/linkedEvents/eventList.d.ts +242 -0
- package/dist/cjs/src/mocks/queries/linkedEvents/eventsByIds.d.ts +224 -0
- package/dist/cjs/src/mocks/responses/linkedEvents/eventMocks.d.ts +1112 -0
- package/dist/cjs/src/mocks/server.d.ts +1 -0
- package/dist/cjs/src/nextjs/getLanguageStaticProps.d.ts +3 -0
- package/dist/cjs/src/nextjs/getMenuStaticProps.d.ts +7 -0
- package/dist/cjs/src/nextjs/getPageStaticProps.d.ts +7 -0
- package/dist/cjs/src/nextjs/index.d.ts +3 -0
- package/dist/cjs/src/storybook-common/HelmetWrapper.d.ts +4 -0
- package/dist/cjs/src/storybook-common/constants.d.ts +9 -0
- package/dist/cjs/src/storybook-common/useCmsEndpointConfig.d.ts +3 -0
- package/dist/cjs/src/tests/apolloConfig.d.ts +2 -0
- package/dist/cjs/src/tests/hideConsoleMessages.d.ts +11 -0
- package/dist/configContext-BjJVyERb.d.ts +791 -0
- package/dist/defaultConfig-B0wJw6Kr.js +19810 -0
- package/dist/defaultConfig-B0wJw6Kr.js.map +1 -0
- package/dist/index-B0pDvzoV.js +2 -0
- package/dist/index-B0pDvzoV.js.map +1 -0
- package/dist/index.d.ts +1432 -0
- package/dist/index.js +333 -0
- package/dist/index.js.map +1 -0
- package/dist/jest-setup.d.ts +1 -0
- package/dist/nextjs.d.ts +17 -0
- package/dist/nextjs.js +70 -0
- package/dist/nextjs.js.map +1 -0
- package/dist/package.json +182 -0
- package/dist/src/apollo/apollo-custom-template.stories.d.ts +12 -0
- package/dist/src/apollo/apollo.stories.d.ts +24 -0
- package/dist/src/apollo/index.d.ts +17 -0
- package/dist/src/apollo/navigation/Navigation.d.ts +13 -0
- package/dist/src/apollo/navigation/__tests__/Navigation.test.d.ts +1 -0
- package/dist/src/apollo/notification/Notification.d.ts +4 -0
- package/dist/src/apollo/notification/__tests__/Notification.test.d.ts +1 -0
- package/dist/src/apollo/page/ApolloPageContextProvider.d.ts +5 -0
- package/dist/src/apollo/page/Page.d.ts +14 -0
- package/dist/src/apollo/page/apolloPageContext.d.ts +13 -0
- package/dist/src/apollo/page/useApolloPageContext.d.ts +4 -0
- package/dist/src/apollo/pageContent/PageContent.d.ts +9 -0
- package/dist/src/apollo/pageWithTemplateContent/PageWithTemplateContent.d.ts +14 -0
- package/dist/src/common/components/container/Container.d.ts +13 -0
- package/dist/src/common/components/grid/Grid.d.ts +16 -0
- package/dist/src/common/components/grid/Grid.stories.d.ts +8 -0
- package/dist/src/common/components/htmlToReact/HtmlToReact.d.ts +38 -0
- package/dist/src/common/components/htmlToReact/HtmlToReact.stories.d.ts +13 -0
- package/dist/src/common/components/htmlToReact/__tests__/HtmlToReact.tests.d.ts +1 -0
- package/dist/src/common/components/htmlToReact/replaceComponents/DefaultH2.d.ts +4 -0
- package/dist/src/common/components/htmlToReact/replaceComponents/DefaultP.d.ts +4 -0
- package/dist/src/common/components/htmlToReact/replaceComponents/IframeForEmbeddedMedia.d.ts +6 -0
- package/dist/src/common/components/htmlToReact/replaceComponents/index.d.ts +3 -0
- package/dist/src/common/components/icons/index.d.ts +5 -0
- package/dist/src/common/components/list/List.d.ts +13 -0
- package/dist/src/common/components/list/List.stories.d.ts +13 -0
- package/dist/src/common/components/tag/Tag.d.ts +26 -0
- package/dist/src/common/components/tag/Tag.stories.d.ts +80 -0
- package/dist/src/common/components/tag/__tests__/Tag.test.d.ts +1 -0
- package/dist/src/common/components/tag/tagThemes.d.ts +3 -0
- package/dist/src/common/components/text/Text.d.ts +27 -0
- package/dist/src/common/components/text/Text.stories.d.ts +14 -0
- package/dist/src/common/constants.d.ts +2 -0
- package/dist/src/common/eventsService/__generated__.d.ts +1420 -0
- package/dist/src/common/eventsService/events.d.ts +12 -0
- package/dist/src/common/eventsService/types.d.ts +2 -0
- package/dist/src/common/eventsService/utils.d.ts +7 -0
- package/dist/src/common/headlessService/__generated__.d.ts +20878 -0
- package/dist/src/common/headlessService/article.d.ts +7 -0
- package/dist/src/common/headlessService/articles.d.ts +17 -0
- package/dist/src/common/headlessService/categories.d.ts +13 -0
- package/dist/src/common/headlessService/category.d.ts +9 -0
- package/dist/src/common/headlessService/constants.d.ts +7 -0
- package/dist/src/common/headlessService/landingPage.d.ts +9 -0
- package/dist/src/common/headlessService/languages.d.ts +8 -0
- package/dist/src/common/headlessService/makeQueryWithApolloClientFromConfig.d.ts +12 -0
- package/dist/src/common/headlessService/menu.d.ts +10 -0
- package/dist/src/common/headlessService/notification.d.ts +7 -0
- package/dist/src/common/headlessService/page.d.ts +8 -0
- package/dist/src/common/headlessService/pageByTemplate.d.ts +9 -0
- package/dist/src/common/headlessService/pages.d.ts +13 -0
- package/dist/src/common/headlessService/tag.d.ts +9 -0
- package/dist/src/common/headlessService/tags.d.ts +13 -0
- package/dist/src/common/headlessService/types.d.ts +17 -0
- package/dist/src/common/headlessService/utils.d.ts +909 -0
- package/dist/src/common/utils/customRender.d.ts +4 -0
- package/dist/src/common/utils/dates.d.ts +20 -0
- package/dist/src/common/utils/getIsValidHttpUrl.d.ts +5 -0
- package/dist/src/common/utils/hash.d.ts +1 -0
- package/dist/src/common/utils/makeLocaleStorageValue.d.ts +6 -0
- package/dist/src/common/utils/testImage.d.ts +9 -0
- package/dist/src/common/venuesService/__generated__.d.ts +254 -0
- package/dist/src/common/venuesService/makeQueryWithVenuesApolloClientFromConfig.d.ts +7 -0
- package/dist/src/common/venuesService/types.d.ts +2 -0
- package/dist/src/constants.d.ts +5 -0
- package/dist/src/core/archiveSearchPage/ArchivePageMeta.d.ts +13 -0
- package/dist/src/core/archiveSearchPage/ArchiveSearchPage.d.ts +16 -0
- package/dist/src/core/archiveSearchPage/ArchiveSearchPage.stories.d.ts +50 -0
- package/dist/src/core/archiveSearchPageContent/ArchiveSearchPageContent.d.ts +92 -0
- package/dist/src/core/button/LoadingButton.d.ts +8 -0
- package/dist/src/core/card/Card.d.ts +102 -0
- package/dist/src/core/card/Card.stories.d.ts +99 -0
- package/dist/src/core/card/LargeCard.d.ts +68 -0
- package/dist/src/core/card/LargeCard.stories.d.ts +16 -0
- package/dist/src/core/cardsList/CardsList.d.ts +16 -0
- package/dist/src/core/cardsList/CardsList.stories.d.ts +22 -0
- package/dist/src/core/carousel/Carousel.d.ts +3 -0
- package/dist/src/core/carousel/Carousel.stories.d.ts +34 -0
- package/dist/src/core/carousel/__tests__/Carousel.test.d.ts +1 -0
- package/dist/src/core/carousel/components/CarouselSlideButton.d.ts +3 -0
- package/dist/src/core/carousel/components/CarouselSlider.d.ts +3 -0
- package/dist/src/core/carousel/components/CarouselSliderDot.d.ts +2 -0
- package/dist/src/core/carousel/components/CarouselSliderPage.d.ts +5 -0
- package/dist/src/core/carousel/components/__tests__/CarouselSlideButton.test.d.ts +1 -0
- package/dist/src/core/carousel/components/__tests__/CarouselSlider.test.d.ts +1 -0
- package/dist/src/core/carousel/components/__tests__/CarouselSliderDot.test.d.ts +1 -0
- package/dist/src/core/carousel/components/__tests__/CarouselSliderPage.test.d.ts +1 -0
- package/dist/src/core/carousel/constants.d.ts +20 -0
- package/dist/src/core/carousel/context/CarouselContext.d.ts +4 -0
- package/dist/src/core/carousel/context/CarouselContextProvider.d.ts +7 -0
- package/dist/src/core/carousel/types.d.ts +147 -0
- package/dist/src/core/carousel/utils/utils.d.ts +27 -0
- package/dist/src/core/collection/Collection.d.ts +102 -0
- package/dist/src/core/collection/Collection.stories.d.ts +48 -0
- package/dist/src/core/collection/__tests__/Collection.test.d.ts +1 -0
- package/dist/src/core/collection/constants.d.ts +1 -0
- package/dist/src/core/collection/types.d.ts +28 -0
- package/dist/src/core/collection/utils.d.ts +36 -0
- package/dist/src/core/configProvider/ConfigProvider.d.ts +13 -0
- package/dist/src/core/configProvider/configContext.d.ts +130 -0
- package/dist/src/core/configProvider/defaultConfig.d.ts +61 -0
- package/dist/src/core/configProvider/useApolloClientFromConfig.d.ts +1 -0
- package/dist/src/core/configProvider/useConfig.d.ts +2 -0
- package/dist/src/core/configProvider/useEventsApolloClientFromConfig.d.ts +1 -0
- package/dist/src/core/configProvider/useHeadlessCmsLink.d.ts +2 -0
- package/dist/src/core/configProvider/useVenuesApolloClientFromConfig.d.ts +1 -0
- package/dist/src/core/contentContainer/ContentContainer.d.ts +12 -0
- package/dist/src/core/contentContainer/ContentContainer.stories.d.ts +8 -0
- package/dist/src/core/hero/Hero.d.ts +33 -0
- package/dist/src/core/hero/Hero.stories.d.ts +23 -0
- package/dist/src/core/hooks/useResolveImageUrl.d.ts +6 -0
- package/dist/src/core/image/BackgroundImage.d.ts +20 -0
- package/dist/src/core/image/Image.d.ts +24 -0
- package/dist/src/core/image/__tests__/BackgroundImage.test.d.ts +1 -0
- package/dist/src/core/image/__tests__/Image.test.d.ts +1 -0
- package/dist/src/core/imageGallery/ImageGallery.d.ts +25 -0
- package/dist/src/core/imageGallery/ImageGalleryContext.d.ts +32 -0
- package/dist/src/core/imageGallery/ImageGalleryProvider.d.ts +10 -0
- package/dist/src/core/imageGallery/ImageItem.d.ts +26 -0
- package/dist/src/core/imageGallery/ImagesGrid.d.ts +26 -0
- package/dist/src/core/imageGallery/Lightbox.d.ts +24 -0
- package/dist/src/core/imageGallery/types.d.ts +6 -0
- package/dist/src/core/imageGallery/useImageGalleryContext.d.ts +1 -0
- package/dist/src/core/index.d.ts +43 -0
- package/dist/src/core/language/__tests__/languageSorter.test.d.ts +1 -0
- package/dist/src/core/language/constants.d.ts +6 -0
- package/dist/src/core/language/findLanguage.d.ts +10 -0
- package/dist/src/core/language/index.d.ts +6 -0
- package/dist/src/core/language/languageSorter.d.ts +4 -0
- package/dist/src/core/language/toPrimaryLanguageOption.d.ts +5 -0
- package/dist/src/core/language/typeGuards.d.ts +3 -0
- package/dist/src/core/language/types.d.ts +5 -0
- package/dist/src/core/link/Link.d.ts +44 -0
- package/dist/src/core/link/Link.stories.d.ts +33 -0
- package/dist/src/core/link/LinkBase.d.ts +106 -0
- package/dist/src/core/link/SecondaryLink.d.ts +3 -0
- package/dist/src/core/link/__tests__/Link.test.d.ts +1 -0
- package/dist/src/core/linkBox/Link.stories.d.ts +23 -0
- package/dist/src/core/linkBox/LinkBox.d.ts +20 -0
- package/dist/src/core/navigation/Navigation.d.ts +15 -0
- package/dist/src/core/notification/Notification.d.ts +9 -0
- package/dist/src/core/notification/__tests__/Notification.test.d.ts +1 -0
- package/dist/src/core/notification/utils/getIsNotificationActive.d.ts +2 -0
- package/dist/src/core/notification/utils/getNotificationHash.d.ts +2 -0
- package/dist/src/core/page/Page.d.ts +9 -0
- package/dist/src/core/page/Page.stories.d.ts +40 -0
- package/dist/src/core/pageContent/PageContent.d.ts +11 -0
- package/dist/src/core/pageContent/PageContent.stories.d.ts +1146 -0
- package/dist/src/core/pageContent/PageContentBreadcrumb.d.ts +5 -0
- package/dist/src/core/pageContent/PageContentLayout.d.ts +16 -0
- package/dist/src/core/pageContent/PageMainContent.d.ts +11 -0
- package/dist/src/core/pageContent/__tests__/Page.test.d.ts +1 -0
- package/dist/src/core/pageContent/meta/PageMeta.d.ts +9 -0
- package/dist/src/core/pageContent/sidebarContent/SidebarCardsList.d.ts +5 -0
- package/dist/src/core/pageContent/sidebarContent/SidebarContent.d.ts +15 -0
- package/dist/src/core/pageContent/sidebarContent/SidebarContentCard.d.ts +12 -0
- package/dist/src/core/pageContent/sidebarContent/SidebarContentLinkList.d.ts +5 -0
- package/dist/src/core/pageContent/sidebarContent/SidebarPostListItem.d.ts +8 -0
- package/dist/src/core/pageContent/sidebarContent/__tests__/SidebarContent.test.d.ts +1 -0
- package/dist/src/core/pageContent/types.d.ts +36 -0
- package/dist/src/core/pageContent/utils.d.ts +28 -0
- package/dist/src/core/pageContextProvider/PageContext.d.ts +6 -0
- package/dist/src/core/pageContextProvider/PageContextProvider.d.ts +6 -0
- package/dist/src/core/pageContextProvider/__tests__/PageContextProvider.test.d.ts +1 -0
- package/dist/src/core/pageContextProvider/usePageContext.d.ts +1 -0
- package/dist/src/core/pageModules/CardModule/CardModule.d.ts +3 -0
- package/dist/src/core/pageModules/CardModule/CardModule.stories.d.ts +7 -0
- package/dist/src/core/pageModules/CardsModule/CardsModule.d.ts +17 -0
- package/dist/src/core/pageModules/CardsModule/CardsModule.stories.d.ts +7 -0
- package/dist/src/core/pageModules/CardsModule/Icon.d.ts +6 -0
- package/dist/src/core/pageModules/CardsModule/SimpleCard.d.ts +13 -0
- package/dist/src/core/pageModules/ContentModule/ContentModule.d.ts +7 -0
- package/dist/src/core/pageModules/ContentModule/ContentModule.stories.d.ts +7 -0
- package/dist/src/core/pageModules/ImageGalleryModule/ImageGalleryModule.d.ts +3 -0
- package/dist/src/core/pageModules/ImageGalleryModule/ImageGalleryModule.stories.d.ts +7 -0
- package/dist/src/core/pageModules/SocialMediaFeedModule/SocialMediaFeedModule.d.ts +7 -0
- package/dist/src/core/pageModules/SocialMediaFeedModule/SocialMediaFeedModule.stories.d.ts +7 -0
- package/dist/src/core/pageModules/StepsModule/StepsModule.d.ts +14 -0
- package/dist/src/core/pageModules/StepsModule/StepsModule.stories.d.ts +7 -0
- package/dist/src/core/pageModules/constants.d.ts +1 -0
- package/dist/src/core/pageSection/PageSection.d.ts +32 -0
- package/dist/src/core/pageSection/PageSection.stories.d.ts +7 -0
- package/dist/src/core/pageSection/__tests__/PageSection.test.d.ts +1 -0
- package/dist/src/core/storyContainer/StoryContainer.d.ts +6 -0
- package/dist/src/core/translation/__tests__/getTranslationWithFallback.test.d.ts +1 -0
- package/dist/src/core/translation/constants.d.ts +12 -0
- package/dist/src/core/translation/getTranslationWithFallback.d.ts +4 -0
- package/dist/src/core/translation/types.d.ts +8 -0
- package/dist/src/core/translation/useTranslationWithFallback.d.ts +4 -0
- package/dist/src/core/utils/__tests__/findAllElementsOfType.test.d.ts +1 -0
- package/dist/src/core/utils/__tests__/getChildrenByType.test.d.ts +1 -0
- package/dist/src/core/utils/__tests__/recursiveMap.test.d.ts +1 -0
- package/dist/src/core/utils/createHashKey.d.ts +1 -0
- package/dist/src/core/utils/findAllElementsOfType.d.ts +5 -0
- package/dist/src/core/utils/getChildrenByType.d.ts +18 -0
- package/dist/src/core/utils/isTrustedOrigin.d.ts +1 -0
- package/dist/src/core/utils/recursiveMap.d.ts +15 -0
- package/dist/src/core/utils/string.d.ts +27 -0
- package/dist/src/core/utils/validateTrustedOriginsFormat.d.ts +1 -0
- package/dist/src/linkedEvents/utils/normalizeKey.d.ts +10 -0
- package/dist/src/linkedEvents/utils/normalizeKeys.d.ts +28 -0
- package/dist/src/mocks/handlers.d.ts +1 -0
- package/dist/src/mocks/queries/cms/languages.d.ts +1 -0
- package/dist/src/mocks/queries/cms/menu.d.ts +1 -0
- package/dist/src/mocks/queries/cms/notification.d.ts +1 -0
- package/dist/src/mocks/queries/cms/page.d.ts +1 -0
- package/dist/src/mocks/queries/linkedEvents/eventList.d.ts +242 -0
- package/dist/src/mocks/queries/linkedEvents/eventsByIds.d.ts +224 -0
- package/dist/src/mocks/responses/linkedEvents/eventMocks.d.ts +1112 -0
- package/dist/src/mocks/server.d.ts +1 -0
- package/dist/src/nextjs/getLanguageStaticProps.d.ts +3 -0
- package/dist/src/nextjs/getMenuStaticProps.d.ts +7 -0
- package/dist/src/nextjs/getPageStaticProps.d.ts +7 -0
- package/dist/src/nextjs/index.d.ts +3 -0
- package/dist/src/storybook-common/HelmetWrapper.d.ts +4 -0
- package/dist/src/storybook-common/constants.d.ts +9 -0
- package/dist/src/storybook-common/useCmsEndpointConfig.d.ts +3 -0
- package/dist/src/tests/apolloConfig.d.ts +2 -0
- package/dist/src/tests/hideConsoleMessages.d.ts +11 -0
- package/package.json +1 -1
package/dist/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 City of Helsinki
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,442 @@
|
|
|
1
|
+
# React Helsinki Headless CMS
|
|
2
|
+
|
|
3
|
+
React UI component library to visualize [Headless CMS](https://github.com/City-of-Helsinki/headless-cms)
|
|
4
|
+
data using [Helsinki Design System](https://github.com/City-of-Helsinki/helsinki-design-system).
|
|
5
|
+
|
|
6
|
+
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
|
7
|
+
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
|
8
|
+
|
|
9
|
+
- [Introduction](#introduction)
|
|
10
|
+
- [The known clients that are using this library](#the-known-clients-that-are-using-this-library)
|
|
11
|
+
- [Installation](#installation)
|
|
12
|
+
- [Development](#development)
|
|
13
|
+
- [When to develop](#when-to-develop)
|
|
14
|
+
- [Available scripts](#available-scripts)
|
|
15
|
+
- [Development environments](#development-environments)
|
|
16
|
+
- [Module structure](#module-structure)
|
|
17
|
+
- [Husky Git Hooks](#husky-git-hooks)
|
|
18
|
+
- [Pre-commit Hook](#pre-commit-hook)
|
|
19
|
+
- [Commit-msg Hook](#commit-msg-hook)
|
|
20
|
+
- [CI](#ci)
|
|
21
|
+
- [CD](#cd)
|
|
22
|
+
- [Storybook](#storybook)
|
|
23
|
+
- [Apollo](#apollo)
|
|
24
|
+
- [NextJS](#nextjs)
|
|
25
|
+
- [Build](#build)
|
|
26
|
+
- [Use as a application dependency](#use-as-a-application-dependency)
|
|
27
|
+
- [Folder-based links](#folder-based-links)
|
|
28
|
+
- [Tarball-based links](#tarball-based-links)
|
|
29
|
+
- [Use portals (with monorepos and Yarn)](#use-portals-with-monorepos-and-yarn)
|
|
30
|
+
- [Testing](#testing)
|
|
31
|
+
- [Testing in IDE terminal](#testing-in-ide-terminal)
|
|
32
|
+
- [Usage](#usage)
|
|
33
|
+
- [Releases, changelogs and deployments](#releases-changelogs-and-deployments)
|
|
34
|
+
- [Conventional Commits](#conventional-commits)
|
|
35
|
+
- [Releasable units](#releasable-units)
|
|
36
|
+
- [Configuration](#configuration)
|
|
37
|
+
- [Troubleshooting release-please](#troubleshooting-release-please)
|
|
38
|
+
- [Fix merge conflicts by running release-please -action manually](#fix-merge-conflicts-by-running-release-please--action-manually)
|
|
39
|
+
- [Deployments](#deployments)
|
|
40
|
+
- [Publishing new versions manually without release-please](#publishing-new-versions-manually-without-release-please)
|
|
41
|
+
- [Known issues](#known-issues)
|
|
42
|
+
- [Contributing](#contributing)
|
|
43
|
+
- [Issues](#issues)
|
|
44
|
+
- [License](#license)
|
|
45
|
+
|
|
46
|
+
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
|
47
|
+
|
|
48
|
+
## Introduction
|
|
49
|
+
|
|
50
|
+
React Helsinki Headless CMS is a highly customized component library based on [HDS](https://github.com/City-of-Helsinki/helsinki-design-system). It is designed for City of Helsinki web applications using preconfigured WordPress Headless CMS environments. This library provides a set of unified visual components for Pages, Articles, and Article Archives.
|
|
51
|
+
|
|
52
|
+
[](https://www.npmjs.com/package/@city-of-helsinki/react-helsinki-headless-cms)
|
|
53
|
+
[](https://opensource.org/licenses/MIT)
|
|
54
|
+
|
|
55
|
+
It provides:
|
|
56
|
+
|
|
57
|
+
1. Unified designs for pages, layouts, and custom components across multiple applications.
|
|
58
|
+
2. Ability to pass app-specific configurations, such as translations and themes.
|
|
59
|
+
3. A set of components for visually presenting data from WordPress content modules and features.
|
|
60
|
+
4. A set of utilities, type and constants required for components implementation.
|
|
61
|
+
5. Support for required Apollo providers, such as linked events and venue search.
|
|
62
|
+
|
|
63
|
+
**Note:** This library does not inject the Helsinki Grotesk font for you; you must add it yourself.
|
|
64
|
+
|
|
65
|
+
**Note:** This library uses HDS design tokens through the SCSS interface so that mismatched design token versions do not lead to unexpected results.
|
|
66
|
+
|
|
67
|
+
### The known clients that are using this library
|
|
68
|
+
|
|
69
|
+
- The city of Helsinki Events: https://tapahtumat.hel.fi | https://github.com/City-of-Helsinki/events-helsinki-monorepo
|
|
70
|
+
- The city of Helsinki Hobbies: https://harrastukset.hel.fi | https://github.com/City-of-Helsinki/events-helsinki-monorepo
|
|
71
|
+
- The city of Helsinki Sports: https://liikunta.hel.fi | https://github.com/City-of-Helsinki/events-helsinki-monorepo
|
|
72
|
+
- The city of Helsinki Kultus: https://kultus.fi | https://github.com/City-of-Helsinki/palvelutarjotin-ui
|
|
73
|
+
- The city of Helsinki Culture Kids: https://kummilapset.hel.fi/ | https://github.com/City-of-Helsinki/kukkuu-ui
|
|
74
|
+
|
|
75
|
+
## Installation
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
yarn add @city-of-helsinki/react-helsinki-headless-cms
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
**NOTE: The library is for general use and should not be developed for a single application environment only!** Check [the known clients](#the-known-clients-that-are-using-this-library)
|
|
84
|
+
|
|
85
|
+
### When to develop
|
|
86
|
+
|
|
87
|
+
The general requirements for new Component development:
|
|
88
|
+
|
|
89
|
+
1. The new Component must be connected to an instance of the WordPress Headless CMS.
|
|
90
|
+
2. The Wordpress Headless CMS environment has new Component compatible architecture, features and data structure (component library is heavily dependent on the GraphQL schemas).
|
|
91
|
+
3. The new Component is not presented in [HDS](https://github.com/City-of-Helsinki/helsinki-design-system) or HDS cannot fully fulfill the specifications.
|
|
92
|
+
4. The new Component exists in HDS backlog, however, still it is not released by HDS team. In that case, HCRC new Component can be implemented and later must be replaced with HDS component when one is available.
|
|
93
|
+
5. New Component can be reused across multiple applications.
|
|
94
|
+
|
|
95
|
+
### Available scripts
|
|
96
|
+
|
|
97
|
+
| Name | Purpose | Useful Options |
|
|
98
|
+
| ----------------------- | -------------------------------------------------------------------------------------------------------- | ----------------------------- |
|
|
99
|
+
| `yarn dev` | Starts storybook environment that can be used for developing components. | |
|
|
100
|
+
| `yarn typecheck` | Runs the ts type check in the project components. | |
|
|
101
|
+
| `yarn lint` | Lints the application to be according to quality standards (eslint) and formatting standards (prettier). | `--fix`: fix fixable problems |
|
|
102
|
+
| `yarn test` | Runs tests with jest. | `--watch`: enable watch mode |
|
|
103
|
+
| `yarn test-storybook` | Runs storybook accessibility tests jest. | |
|
|
104
|
+
| `yarn build` | Builds application with rollup. | |
|
|
105
|
+
| `yarn docker:dev` | Runs the application with docker with Development target environment. | |
|
|
106
|
+
| `yarn docker:prod` | Runs the application with docker with Production target environment. | |
|
|
107
|
+
| `yarn docker:down` | Shuts down the docker environment. | |
|
|
108
|
+
| `yarn generate:graphql` | Generates / updates GraphQL schema for the project. | |
|
|
109
|
+
|
|
110
|
+
**NOTE: To manually publish a new version to the NPM, you will need the credentials that can be found from the City of Helsinki Culture and Leisure's Vault-service.**
|
|
111
|
+
|
|
112
|
+
### Development environments
|
|
113
|
+
|
|
114
|
+
You can use docker local environment for development:
|
|
115
|
+
|
|
116
|
+
`docker compose up --build` when using Docker
|
|
117
|
+
|
|
118
|
+
`podman compose up --build` when using Podman
|
|
119
|
+
|
|
120
|
+
Alternatively, the local environment can be used:
|
|
121
|
+
|
|
122
|
+
`yarn dev`
|
|
123
|
+
|
|
124
|
+
### Module structure
|
|
125
|
+
|
|
126
|
+
This library consists of three modules.
|
|
127
|
+
|
|
128
|
+
- Core module that includes data naive components.
|
|
129
|
+
- Apollo module that wraps core module components with logic that is able to fetch data with the help of an `ApolloClient` instance.
|
|
130
|
+
- Nextjs module that provides utilities when working with `Nextjs` and `Apollo`.
|
|
131
|
+
|
|
132
|
+
### Husky Git Hooks
|
|
133
|
+
|
|
134
|
+
This project uses [Husky](https://typicode.github.io/husky/#/) to manage Git hooks. Husky is configured to run specific scripts before committing changes to ensure code quality and consistency.
|
|
135
|
+
|
|
136
|
+
#### Pre-commit Hook
|
|
137
|
+
|
|
138
|
+
The pre-commit hook is configured to run the following commands:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
yarn doctoc .
|
|
142
|
+
yarn lint-staged --relative
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
- `yarn doctoc .`: This command updates the table of contents in your markdown files.
|
|
146
|
+
- `yarn lint-staged --relative`: This command runs linting on staged files to ensure they meet the project's coding standards. The lint-staged configuration can be found from [package.json](./package.json).
|
|
147
|
+
- Using `--relative` flag to reduce command line length,
|
|
148
|
+
as the combined length of all the absolute paths for a large commit can get quite long
|
|
149
|
+
|
|
150
|
+
> NOTE: `doctoc` and `husky` does not work seamlessly together, since the `doctoc` does update the TOCs of the markdown files, but does not reject the pre-commit hook execution, and only leaves the refactored files as unstaged in Git.
|
|
151
|
+
|
|
152
|
+
#### Commit-msg Hook
|
|
153
|
+
|
|
154
|
+
The commit-msg hook is configured to run the following command:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
npx --no-install commitlint --edit "$1"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
- `npx --no-install commitlint --edit "$1"`: This command uses [Commitlint](https://commitlint.js.org/#/) to lint commit messages based on the project's commit message conventions. This repo follows the [Conventional Commits](#conventional-commits).
|
|
161
|
+
|
|
162
|
+
### CI
|
|
163
|
+
|
|
164
|
+
Checks
|
|
165
|
+
|
|
166
|
+
- Tests pass
|
|
167
|
+
- Lint pass
|
|
168
|
+
- Build completes
|
|
169
|
+
- Type check pass
|
|
170
|
+
|
|
171
|
+
### CD
|
|
172
|
+
|
|
173
|
+
On additions to main, a canary version gets published to npm.
|
|
174
|
+
|
|
175
|
+
On a new release, a new version is released to npm.
|
|
176
|
+
|
|
177
|
+
### Storybook
|
|
178
|
+
|
|
179
|
+
Storybook is a frontend workshop for building UI components and pages in isolation https://storybook.js.org/. The Storybook can be used to develop and to test the components, but also to document the components and their features.
|
|
180
|
+
|
|
181
|
+
The project is using the Storybook 10.
|
|
182
|
+
|
|
183
|
+
**NOTE: Storybook version 10 may require the `playwright-chromium` installation.**
|
|
184
|
+
|
|
185
|
+
The `yarn dev` command will start `storybook` in port `6006`. When you make changes in `src`, they'll be automatically updated to `storybook`.
|
|
186
|
+
|
|
187
|
+
### Apollo
|
|
188
|
+
|
|
189
|
+
This can handle data queries for you if you are using a supported library to fetch your data.
|
|
190
|
+
|
|
191
|
+
By importing data dependent components from `@city-of-helsinki/react-helsinki-headless-cms/apollo`, this library will request the data for you.
|
|
192
|
+
|
|
193
|
+
**Note:** An Apollo client linked to a graphql endpoint with a supported schema (headless CMS) must be provided in the `apolloClient` field of the `config` object.
|
|
194
|
+
|
|
195
|
+
**Simplified example**
|
|
196
|
+
|
|
197
|
+
```tsx
|
|
198
|
+
import { Page } from '@city-of-helsinki/react-helsinki-headless-cms/apollo';
|
|
199
|
+
import { Navigation } from '@city-of-helsinki/react-helsinki-headless-cms/apollo';
|
|
200
|
+
|
|
201
|
+
<ConfigProvider
|
|
202
|
+
config={{
|
|
203
|
+
// ...
|
|
204
|
+
apolloClient: client, // A client for the CMS
|
|
205
|
+
eventsApolloClient: client, // A client to connect a events datasource (the LinkedEvents)
|
|
206
|
+
venuesApolloClient: 'disabled', // A client to connect a venue datasource (the Servicemap / "TPREK")
|
|
207
|
+
// ...
|
|
208
|
+
}}
|
|
209
|
+
>
|
|
210
|
+
<Page
|
|
211
|
+
uri="/en/url"
|
|
212
|
+
navigation={<Navigation menuName="Name of menu in headless CMS" />}
|
|
213
|
+
/>
|
|
214
|
+
</ConfigProvider>;
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### NextJS
|
|
218
|
+
|
|
219
|
+
We provide utilities for fetching headless data for NextJs in `@city-of-helsinki/react-helsinki-headless-cms/nextjs`. These can be used when generating static pages.
|
|
220
|
+
|
|
221
|
+
### Build
|
|
222
|
+
|
|
223
|
+
This project uses `rollup` for its final bundle.
|
|
224
|
+
|
|
225
|
+
**NOTE: Check the [known issues](#known-issues)!!**
|
|
226
|
+
|
|
227
|
+
### Use as a application dependency
|
|
228
|
+
|
|
229
|
+
**NOTE: After any changes done to the React Helsinki Headless CMS -library, remember to build again!**
|
|
230
|
+
|
|
231
|
+
#### Folder-based links
|
|
232
|
+
|
|
233
|
+
The easiest way to test the React Helsinki Headless CMS -library is to install it as a dependency of an application by using a local relative path:
|
|
234
|
+
|
|
235
|
+
- https://docs.npmjs.com/cli/v9/configuring-npm/package-json#local-paths
|
|
236
|
+
- https://yarnpkg.com/protocol/file
|
|
237
|
+
|
|
238
|
+
The steps to use the local relative path as a dependency:
|
|
239
|
+
|
|
240
|
+
1. Build the React Helsinki Headless CMS -library with `yarn build`. You should now have a `/dist` -folder that contains the built library package.
|
|
241
|
+
2. Add the `/dist`-directory as a dependency. Remember to use the right relative local path:
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
{
|
|
245
|
+
"dependencies": {
|
|
246
|
+
"@city-of-helsinki/react-helsinki-headless-cms": "file:../react-helsinki-headless-cms/dist"
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
#### Tarball-based links
|
|
252
|
+
|
|
253
|
+
When file: points to a .tgz file, Yarn will transparently let you require files from within the archive. For the node_modules linker, it means that the archive will be unpacked into the generated node_modules folder.
|
|
254
|
+
|
|
255
|
+
You can create a tarball by first building the package and then calling `pack`
|
|
256
|
+
|
|
257
|
+
1. `yarn build`
|
|
258
|
+
2. `yarn pack`
|
|
259
|
+
|
|
260
|
+
The steps to use the local tarball as a dependency:
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
{
|
|
264
|
+
"dependencies": {
|
|
265
|
+
"@city-of-helsinki/react-helsinki-headless-cms": "file:../react-helsinki-headless-cms-v2.1.0.tgz"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
#### Use portals (with monorepos and Yarn)
|
|
271
|
+
|
|
272
|
+
> See more: https://yarnpkg.com/protocol/portal
|
|
273
|
+
|
|
274
|
+
The `portal:` protocol is similar to the `link:` protocol (it must be a relative path to a folder which will be made available without copies), but the target is assumed to be a package instead.
|
|
275
|
+
|
|
276
|
+
The `portal:` protocol is specifically designed for linking local directories (often containing extracted tarballs) into the dependency graph while maintaining correct resolution and deduplication logic.
|
|
277
|
+
|
|
278
|
+
**Portals vs links**: Links have to operate under the assumption that their target folder may not exist until the install is finished; this prevents them from reading the content of the folder, including any package.json files, and in turn preventing them from listing dependencies. Portals, on the other hand, must exist at resolution time or an error is thrown. This lets them read the content of the package.json file and be treated like any other package in the dependency tree - except that its content will be made directly available to the user, rather than copied like file: would do.
|
|
279
|
+
|
|
280
|
+
**How to Use portal: for a Tarball**
|
|
281
|
+
|
|
282
|
+
1. Extract the Tarball: The portal: protocol requires a folder. You must first extract your `.tgz` archive (e.g., `city-of-helsinki-react-helsinki-headless-cms-v2.1.0.tgz`) into a temporary staging folder (e.g., `./.hcrc-dev`). The temporary staging folder should be in same directory as the consuming app's `package.json` file, since the `portal:` protocol is relative to the `package.json` file.
|
|
283
|
+
2. Update `package.json`: In the consuming app's `package.json`, reference the extracted folder using the portal: protocol:
|
|
284
|
+
|
|
285
|
+
**⚠️ Security Tip:** Don't forget to add /.hcrc-dev to your .gitignore so you don't accidentally commit the extracted library code to your repository.
|
|
286
|
+
|
|
287
|
+
```JSON
|
|
288
|
+
"dependencies": {
|
|
289
|
+
"@city-of-helsinki/react-helsinki-headless-cms": "portal:../../.hcrc-dev/package"
|
|
290
|
+
}
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
3. Clean and Install: *If you have a conflicting dependency* in the root `package.json`, delete it and run yarn install from the monorepo root.
|
|
294
|
+
|
|
295
|
+
## Testing
|
|
296
|
+
|
|
297
|
+
With new features introduced in Storybook version 7, this library is configured with `@storybook/addon-a11y` Axe Accessibility Plugin.
|
|
298
|
+
|
|
299
|
+
The test could be run from the Storybook UI (Accessibility tab of the Story) or using the script.
|
|
300
|
+
|
|
301
|
+
### Testing in IDE terminal
|
|
302
|
+
|
|
303
|
+
```bash
|
|
304
|
+
yarn test-storybook
|
|
305
|
+
```
|
|
306
|
+
|
|
307
|
+
After executing the script, you will get the Axe Accessibility testing report in the terminal window.
|
|
308
|
+
The number of tests are dynamic per component and decided by Axe plugin logic.
|
|
309
|
+
|
|
310
|
+
## Usage
|
|
311
|
+
|
|
312
|
+
`App.tsx`
|
|
313
|
+
|
|
314
|
+
```tsx
|
|
315
|
+
// ...
|
|
316
|
+
import {
|
|
317
|
+
Page,
|
|
318
|
+
PageContent,
|
|
319
|
+
ConfigProvider,
|
|
320
|
+
defaultConfig,
|
|
321
|
+
} from "@city-of-helsinki/react-helsinki-headless-cms";
|
|
322
|
+
|
|
323
|
+
function App() {
|
|
324
|
+
const page = ...;
|
|
325
|
+
|
|
326
|
+
return (
|
|
327
|
+
<ConfigProvider config={defaultConfig}>
|
|
328
|
+
<Page
|
|
329
|
+
navigation={
|
|
330
|
+
<Navigation
|
|
331
|
+
languages={...}
|
|
332
|
+
menu={...}
|
|
333
|
+
onTitleClick={() => ...}
|
|
334
|
+
getUrlForLanguage={(language, currentLanguage) => new URL(...)
|
|
335
|
+
}
|
|
336
|
+
/>
|
|
337
|
+
}
|
|
338
|
+
content={<PageContent page={page} breadcrumbs={[...]} />}
|
|
339
|
+
footer={...}
|
|
340
|
+
/>
|
|
341
|
+
</ConfigProvider>
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
## Releases, changelogs and deployments
|
|
349
|
+
|
|
350
|
+
The used environments are listed in [Service environments](#service-environments).
|
|
351
|
+
|
|
352
|
+
The application uses automatic semantic versions and is released using [Release Please](https://github.com/googleapis/release-please).
|
|
353
|
+
|
|
354
|
+
> Release Please is a GitHub Action that automates releases for you. It will create a GitHub release and a GitHub Pull Request with a changelog based on conventional commits.
|
|
355
|
+
|
|
356
|
+
Each time you merge a "normal" pull request, the release-please-action will create or update a "Release PR" with the changelog and the version bump related to the changes (they're named like `release-please--branches--master--components--react-helsinki-headless-cms`).
|
|
357
|
+
|
|
358
|
+
To create a new release for an app, this release PR is merged, which creates a new release with release notes and a new tag. This tag will be picked by Azure pipeline and trigger a new deployment to staging. From there, the release needs to be manually released to production.
|
|
359
|
+
|
|
360
|
+
When merging release PRs, make sure to use the "Rebase and merge" (or "Squash and merge") option, so that Github doesn't create a merge commit. All the commits must follow the conventional commits format. This is important, because the release-please-action does not work correctly with merge commits (there's an open issue you can track: [Chronological commit sorting means that merged PRs can be ignored ](https://github.com/googleapis/release-please/issues/1533)).
|
|
361
|
+
|
|
362
|
+
See [Release Please Implementation Design](https://github.com/googleapis/release-please/blob/main/docs/design.md) for more details.
|
|
363
|
+
|
|
364
|
+
And all docs are available here: [release-please docs](https://github.com/googleapis/release-please/tree/main/docs).
|
|
365
|
+
|
|
366
|
+
### Conventional Commits
|
|
367
|
+
|
|
368
|
+
Use [Conventional Commits](https://www.conventionalcommits.org/) to ensure that the changelogs are generated correctly.
|
|
369
|
+
|
|
370
|
+
### Releasable units
|
|
371
|
+
|
|
372
|
+
Release please goes through commits and tries to find "releasable units" using commit messages as guidance - it will then add these units to their respective release PR's and figures out the version number from the types: `fix` for patch, `feat` for minor, `feat!` for major. None of the other types will be included in the changelog. So, you can use for example `chore` or `refactor` to do work that does not need to be included in the changelog and won't bump the version.
|
|
373
|
+
|
|
374
|
+
### Configuration
|
|
375
|
+
|
|
376
|
+
The release-please workflow is located in the [release-please.yml](./.github/workflows/release-please.yml) file.
|
|
377
|
+
|
|
378
|
+
The configuration for release-please is located in the [release-please-config.json](./release-please-config.json) file.
|
|
379
|
+
See all the options here: [release-please docs](https://github.com/googleapis/release-please/blob/main/docs/manifest-releaser.md).
|
|
380
|
+
|
|
381
|
+
The manifest file is located in the [release-please-manifest.json](./.release-please-manifest.json) file.
|
|
382
|
+
|
|
383
|
+
When adding a new app, add it to both the [release-please-config.json](./release-please-config.json) and [release-please-manifest.json](./.release-please-manifest.json) file with the current version of the app. After this, release-please will keep track of versions with [release-please-manifest.json](./.release-please-manifest.json).
|
|
384
|
+
|
|
385
|
+
### Troubleshooting release-please
|
|
386
|
+
|
|
387
|
+
If you were expecting a new release PR to be created or old one to be updated, but nothing happened, there's probably one of the older release PR's in pending state or action didn't run.
|
|
388
|
+
|
|
389
|
+
1. Check if the release action ran for the last merge to main. If it didn't, run the action manually with a label.
|
|
390
|
+
2. Check if there's any open release PR. If there is, the work is now included on this one (this is the normal scenario).
|
|
391
|
+
3. If you do not see any open release PR related to the work, check if any of the closed PR's are labeled with `autorelease: pending` - ie. someone might have closed a release PR manually. Change the closed PR's label to `autorelease: tagged`. Then go and re-run the last merge workflow to trigger the release action - a new release PR should now appear.
|
|
392
|
+
4. Finally check the output of the release action. Sometimes the bot can't parse the commit message and there is a notification about this in the action log. If this happens, it won't include the work in the commit either. You can fix this by changing the commit message to follow the [Conventional Commits](https://www.conventionalcommits.org/) format and rerun the action.
|
|
393
|
+
|
|
394
|
+
**Important!** If you have closed a release PR manually, you need to change the label of closed release PR to `autorelease: tagged`. Otherwise, the release action will not create a new release PR.
|
|
395
|
+
|
|
396
|
+
**Important!** Extra label will force release-please to re-generate PR's. This is done when action is run manually with prlabel -option
|
|
397
|
+
|
|
398
|
+
Sometimes there might be a merge conflict in release PR - this should resolve itself on the next push to main. It is possible run release-please action manually with label, it should recreate the PR's. You can also resolve it manually, by updating the [release-please-manifest.json](./.release-please-manifest.json) file.
|
|
399
|
+
|
|
400
|
+
#### Fix merge conflicts by running release-please -action manually
|
|
401
|
+
|
|
402
|
+
1. Open [release-please github action](https://github.com/City-of-Helsinki/react-helsinki-headless-cms/actions/workflows/release-please.yml)
|
|
403
|
+
2. Click **Run workflow**
|
|
404
|
+
3. Check Branch is **master**
|
|
405
|
+
4. Leave label field empty. New label is not needed to fix merge issues
|
|
406
|
+
5. Click **Run workflow** -button
|
|
407
|
+
|
|
408
|
+
There's also a CLI for debugging and manually running releases available for release-please: [release-please-cli](https://github.com/googleapis/release-please/blob/main/docs/cli.md)
|
|
409
|
+
|
|
410
|
+
### Deployments
|
|
411
|
+
|
|
412
|
+
When a Release-Please pull request is merged and a version tag is created (or a proper tag name for a commit is manually created), this tag will be picked by Azure pipeline, which then triggers a new deployment to staging. From there, the deployment needs to be manually approved to allow it to proceed to the production environment.
|
|
413
|
+
|
|
414
|
+
The tag name is defined in the [azure-pipelines-release.yml](./azure-pipelines-release.yml).
|
|
415
|
+
|
|
416
|
+
#### Publishing new versions manually without release-please
|
|
417
|
+
|
|
418
|
+
For canary release the naming convention is `x.y.z-canary-[gitcommithash]`. Running `yarn publish` should ask for version number too, but a `version` property in `package.json` sets the version number.
|
|
419
|
+
|
|
420
|
+
1. Build package with `yarn build`
|
|
421
|
+
2. Publish package `yarn publish`
|
|
422
|
+
|
|
423
|
+
**Note:** A local tarball of built package can be created with `yarn pack`. Just remember to build first.
|
|
424
|
+
|
|
425
|
+
**Note:** There is an a known issue with publishing using Windows environment. If you have a Windows machine use Docker container to publish the package.An Apollo client linked to a graphql endpoint with a supported schema (headless CMS) must be provided in the `apolloClient` field of the `config` object.
|
|
426
|
+
|
|
427
|
+
## Known issues
|
|
428
|
+
|
|
429
|
+
- Jest has difficulties loading this library. When this library is required in a test file, it's possible that some imports are cjs and some are esm. These two variants do not share a react context which can result in `useConfig` calls that return an empty config object even though `<ConfigProvider>` is declared correctly. I.e. `<ConfigProvider>` sets values for `context1` and `useConfig` reads `context2`.
|
|
430
|
+
- Some of the built packages created with `yarn build` does some issues with some types. This leads to a situation where the application that uses the library cannot read all the exported types. Especially the exported enums inside a built package might be handled incorrectly (https://github.com/rollup/rollup/issues/4291), but there are other type related issues also, but not on every built package.
|
|
431
|
+
|
|
432
|
+
## Contributing
|
|
433
|
+
|
|
434
|
+
Read the [contributing guide](./CONTRIBUTING.md) to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes.
|
|
435
|
+
|
|
436
|
+
## Issues
|
|
437
|
+
|
|
438
|
+
If you notice a bug or want to request a feature, please [submit an issue](https://github.com/City-of-Helsinki/react-helsinki-headless-cms/issues) to our GitHub repository.
|
|
439
|
+
|
|
440
|
+
## License
|
|
441
|
+
|
|
442
|
+
[MIT](./LICENSE)
|