@quintype/arrow 3.54.1-debug-full-bleed.4 → 3.54.1-version-upgrade.1
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/.babelrc +12 -0
- package/.circleci/config.yml +43 -0
- package/.eslintrc.json +35 -0
- package/.prettierrc +6 -0
- package/.storybook/addons.js +4 -0
- package/.storybook/main.js +7 -0
- package/.storybook/preview.js +3 -0
- package/.storybook/webpack.config.js +8 -0
- package/.stylelintrc +10 -0
- package/.vscode/extensions.json +16 -0
- package/.vscode/settings.json +12 -0
- package/CHANGELOG.md +2578 -0
- package/__mocks__/fileMock.js +1 -0
- package/__mocks__/styleMock.js +1 -0
- package/assets/stylesheets/mixins.scss +35 -0
- package/assets/stylesheets/reset.scss +148 -0
- package/assets/stylesheets/viewports.m.css +3 -0
- package/bin-dev-scripts/prepublish.sh +11 -0
- package/bin-dev-scripts/sync-to.sh +13 -0
- package/jest.config.json +14 -0
- package/package.json +138 -1
- package/publish +24 -0
- package/rollup.js +202 -0
- package/setupTests.js +3 -0
- package/src/components/Atoms/AdPlaceholder/ads.m.css +13 -0
- package/src/components/Atoms/AdPlaceholder/index.js +25 -0
- package/src/components/Atoms/AudioPlayer/PlayerBase.js +150 -0
- package/src/components/Atoms/AudioPlayer/PlayerControls.js +155 -0
- package/src/components/Atoms/AudioPlayer/ProgressBar.js +24 -0
- package/src/components/Atoms/AudioPlayer/audio.m.css +201 -0
- package/src/components/Atoms/AudioPlayer/index.js +59 -0
- package/src/components/Atoms/AudioPlayer/progressbar.m.css +48 -0
- package/src/components/Atoms/Author/README.md +19 -0
- package/src/components/Atoms/Author/author.m.css +62 -0
- package/src/components/Atoms/Author/index.js +112 -0
- package/src/components/Atoms/Author/stories.js +23 -0
- package/src/components/Atoms/AuthorCard/README.md +55 -0
- package/src/components/Atoms/AuthorCard/author-card.m.css +224 -0
- package/src/components/Atoms/AuthorCard/author-card.test.js +97 -0
- package/src/components/Atoms/AuthorCard/index.js +312 -0
- package/src/components/Atoms/AuthorCard/stories.js +164 -0
- package/src/components/Atoms/AuthorImage/README.md +31 -0
- package/src/components/Atoms/AuthorImage/author-image.m.css +53 -0
- package/src/components/Atoms/AuthorImage/index.js +62 -0
- package/src/components/Atoms/AuthorImage/stories.js +20 -0
- package/src/components/Atoms/AuthorWithTimestamp/README.md +12 -0
- package/src/components/Atoms/AuthorWithTimestamp/author-with-timestamp.m.css +40 -0
- package/src/components/Atoms/AuthorWithTimestamp/index.js +115 -0
- package/src/components/Atoms/AuthorWithTimestamp/stories.js +27 -0
- package/src/components/Atoms/BulletPoint/README.md +9 -0
- package/src/components/Atoms/BulletPoint/bullet-point.m.css +25 -0
- package/src/components/Atoms/BulletPoint/index.js +19 -0
- package/src/components/Atoms/BulletPoint/stories.js +6 -0
- package/src/components/Atoms/CaptionAttribution/README.md +15 -0
- package/src/components/Atoms/CaptionAttribution/caption-attribution.m.css +40 -0
- package/src/components/Atoms/CaptionAttribution/caption-attribution.test.js +29 -0
- package/src/components/Atoms/CaptionAttribution/index.js +40 -0
- package/src/components/Atoms/CaptionAttribution/stories.js +40 -0
- package/src/components/Atoms/CollectionName/README.md +11 -0
- package/src/components/Atoms/CollectionName/collection-name.m.css +106 -0
- package/src/components/Atoms/CollectionName/index.js +147 -0
- package/src/components/Atoms/CollectionName/stories.js +52 -0
- package/src/components/Atoms/Divider/__snapshots__/divider.test.js.snap +18 -0
- package/src/components/Atoms/Divider/divider.m.css +6 -0
- package/src/components/Atoms/Divider/divider.test.js +10 -0
- package/src/components/Atoms/Divider/index.js +20 -0
- package/src/components/Atoms/Dot/dot.js +20 -0
- package/src/components/Atoms/Dot/dot.m.css +6 -0
- package/src/components/Atoms/ExtendedLoadMore/README.md +9 -0
- package/src/components/Atoms/ExtendedLoadMore/__snapshots__/extended-load-more.test.js.snap +11 -0
- package/src/components/Atoms/ExtendedLoadMore/extended-load-more.test.js +19 -0
- package/src/components/Atoms/ExtendedLoadMore/index.js +114 -0
- package/src/components/Atoms/FallbackImage/fallback.m.css +33 -0
- package/src/components/Atoms/FallbackImage/index.js +39 -0
- package/src/components/Atoms/Headline/README.md +7 -0
- package/src/components/Atoms/Headline/headline.m.css +67 -0
- package/src/components/Atoms/Headline/index.js +112 -0
- package/src/components/Atoms/Headline/stories.js +52 -0
- package/src/components/Atoms/HeroImage/README.md +13 -0
- package/src/components/Atoms/HeroImage/hero-image.m.css +99 -0
- package/src/components/Atoms/HeroImage/index.js +293 -0
- package/src/components/Atoms/HeroImage/stories.js +22 -0
- package/src/components/Atoms/Hyperlink/hyperlink.m.css +10 -0
- package/src/components/Atoms/Hyperlink/index.js +24 -0
- package/src/components/Atoms/LoadMoreTarget/index.js +30 -0
- package/src/components/Atoms/LoadMoreTarget/load-more-target.m.css +7 -0
- package/src/components/Atoms/Loadmore/README.md +0 -0
- package/src/components/Atoms/Loadmore/__snapshots__/load-more.test.js.snap +25 -0
- package/src/components/Atoms/Loadmore/index.js +54 -0
- package/src/components/Atoms/Loadmore/load-more.m.css +23 -0
- package/src/components/Atoms/Loadmore/load-more.test.js +30 -0
- package/src/components/Atoms/Loadmore/stories.js +17 -0
- package/src/components/Atoms/MagazineCoverImage/README.md +21 -0
- package/src/components/Atoms/MagazineCoverImage/index.js +73 -0
- package/src/components/Atoms/MagazineCoverImage/magazine-cover-image.m.css +24 -0
- package/src/components/Atoms/MagazineCoverImage/stories.js +21 -0
- package/src/components/Atoms/PremiumStoryIcon/index.js +27 -0
- package/src/components/Atoms/PublishDetail/README.md +15 -0
- package/src/components/Atoms/PublishDetail/index.js +105 -0
- package/src/components/Atoms/PublishDetail/publish-details.m.css +53 -0
- package/src/components/Atoms/PublishDetail/publish-details.test.js +35 -0
- package/src/components/Atoms/PublishDetail/stories.js +22 -0
- package/src/components/Atoms/ReadTime/README.md +13 -0
- package/src/components/Atoms/ReadTime/index.js +59 -0
- package/src/components/Atoms/ReadTime/read-time.m.css +25 -0
- package/src/components/Atoms/ReadTime/read-time.test.js +27 -0
- package/src/components/Atoms/ReadTime/stories.js +19 -0
- package/src/components/Atoms/ResponsiveImg/index.js +174 -0
- package/src/components/Atoms/ScrollSnap/SliderArrow/index.js +67 -0
- package/src/components/Atoms/ScrollSnap/SliderArrow/slider-arrow.m.css +45 -0
- package/src/components/Atoms/ScrollSnap/SliderIndicator/index.js +41 -0
- package/src/components/Atoms/ScrollSnap/SliderIndicator/slider-indicator.m.css +71 -0
- package/src/components/Atoms/ScrollSnap/index.js +179 -0
- package/src/components/Atoms/ScrollSnap/scroll-snap.m.css +26 -0
- package/src/components/Atoms/SectionTag/README.md +11 -0
- package/src/components/Atoms/SectionTag/index.js +74 -0
- package/src/components/Atoms/SectionTag/section.m.css +53 -0
- package/src/components/Atoms/SectionTag/stories.js +26 -0
- package/src/components/Atoms/SocialSharePopup/README.md +25 -0
- package/src/components/Atoms/SocialSharePopup/__snapshots__/social-share-popup.test.js.snap +259 -0
- package/src/components/Atoms/SocialSharePopup/index.js +122 -0
- package/src/components/Atoms/SocialSharePopup/social-share-popup.m.css +287 -0
- package/src/components/Atoms/SocialSharePopup/social-share-popup.test.js +101 -0
- package/src/components/Atoms/SocialSharePopup/stories.js +19 -0
- package/src/components/Atoms/SponsoredLabel/index.js +52 -0
- package/src/components/Atoms/SponsoredLabel/sponsored-lable.m.css +17 -0
- package/src/components/Atoms/StoryDemarcationIcon/index.js +127 -0
- package/src/components/Atoms/StoryElements/AISummary/ai-icons.js +51 -0
- package/src/components/Atoms/StoryElements/AISummary/ai-summary.m.css +106 -0
- package/src/components/Atoms/StoryElements/AISummary/index.js +206 -0
- package/src/components/Atoms/StoryElements/AISummary/stories.js +27 -0
- package/src/components/Atoms/StoryElements/AlsoRead/README.md +49 -0
- package/src/components/Atoms/StoryElements/AlsoRead/also-read.m.css +133 -0
- package/src/components/Atoms/StoryElements/AlsoRead/also-read.test.js +83 -0
- package/src/components/Atoms/StoryElements/AlsoRead/index.js +126 -0
- package/src/components/Atoms/StoryElements/AlsoRead/stories.js +40 -0
- package/src/components/Atoms/StoryElements/Attachment/README.md +21 -0
- package/src/components/Atoms/StoryElements/Attachment/__snapshots__/attachment.test.js.snap +47 -0
- package/src/components/Atoms/StoryElements/Attachment/attachment.m.css +127 -0
- package/src/components/Atoms/StoryElements/Attachment/attachment.test.js +39 -0
- package/src/components/Atoms/StoryElements/Attachment/index.js +63 -0
- package/src/components/Atoms/StoryElements/Attachment/stories.js +48 -0
- package/src/components/Atoms/StoryElements/BigFact/README.md +9 -0
- package/src/components/Atoms/StoryElements/BigFact/big-fact.m.css +41 -0
- package/src/components/Atoms/StoryElements/BigFact/big-fact.test.js +21 -0
- package/src/components/Atoms/StoryElements/BigFact/index.js +33 -0
- package/src/components/Atoms/StoryElements/BigFact/stories.js +9 -0
- package/src/components/Atoms/StoryElements/BlockQuote/README.md +49 -0
- package/src/components/Atoms/StoryElements/BlockQuote/Svg/curve.js +27 -0
- package/src/components/Atoms/StoryElements/BlockQuote/Svg/edge.js +27 -0
- package/src/components/Atoms/StoryElements/BlockQuote/Svg/icon.m.css +11 -0
- package/src/components/Atoms/StoryElements/BlockQuote/block-quote.m.css +170 -0
- package/src/components/Atoms/StoryElements/BlockQuote/block-quote.test.js +48 -0
- package/src/components/Atoms/StoryElements/BlockQuote/index.js +82 -0
- package/src/components/Atoms/StoryElements/BlockQuote/stories.js +35 -0
- package/src/components/Atoms/StoryElements/Blurb/README.md +43 -0
- package/src/components/Atoms/StoryElements/Blurb/blurb.m.css +56 -0
- package/src/components/Atoms/StoryElements/Blurb/blurb.test.js +71 -0
- package/src/components/Atoms/StoryElements/Blurb/index.js +50 -0
- package/src/components/Atoms/StoryElements/Blurb/stories.js +28 -0
- package/src/components/Atoms/StoryElements/Image/README.md +13 -0
- package/src/components/Atoms/StoryElements/Image/image.m.css +21 -0
- package/src/components/Atoms/StoryElements/Image/image.test.js +20 -0
- package/src/components/Atoms/StoryElements/Image/index.js +76 -0
- package/src/components/Atoms/StoryElements/Image/stories.js +25 -0
- package/src/components/Atoms/StoryElements/ImageSlideshow/README.md +13 -0
- package/src/components/Atoms/StoryElements/ImageSlideshow/image-slideshow.m.css +63 -0
- package/src/components/Atoms/StoryElements/ImageSlideshow/index.js +101 -0
- package/src/components/Atoms/StoryElements/ImageSlideshow/stories.js +34 -0
- package/src/components/Atoms/StoryElements/QuestionAnswer/README.md +56 -0
- package/src/components/Atoms/StoryElements/QuestionAnswer/index.js +150 -0
- package/src/components/Atoms/StoryElements/QuestionAnswer/question-answer.m.css +185 -0
- package/src/components/Atoms/StoryElements/QuestionAnswer/question-answer.test.js +74 -0
- package/src/components/Atoms/StoryElements/QuestionAnswer/stories.js +79 -0
- package/src/components/Atoms/StoryElements/Quote/README.md +41 -0
- package/src/components/Atoms/StoryElements/Quote/index.js +45 -0
- package/src/components/Atoms/StoryElements/Quote/quote.m.css +125 -0
- package/src/components/Atoms/StoryElements/Quote/quote.test.js +58 -0
- package/src/components/Atoms/StoryElements/Quote/stories.js +28 -0
- package/src/components/Atoms/StoryElements/Reference/README.md +9 -0
- package/src/components/Atoms/StoryElements/Reference/index.js +52 -0
- package/src/components/Atoms/StoryElements/Reference/reference.m.css +42 -0
- package/src/components/Atoms/StoryElements/Reference/reference.test.js +28 -0
- package/src/components/Atoms/StoryElements/Reference/stories.js +18 -0
- package/src/components/Atoms/StoryElements/StoryElement/README.md +10 -0
- package/src/components/Atoms/StoryElements/StoryElement/index.js +35 -0
- package/src/components/Atoms/StoryElements/StoryElement/stories.js +20 -0
- package/src/components/Atoms/StoryElements/StoryElement/storyElement.m.css +23 -0
- package/src/components/Atoms/StoryElements/StoryElement/storyelement.test.js +13 -0
- package/src/components/Atoms/StoryElements/Summary/README.md +56 -0
- package/src/components/Atoms/StoryElements/Summary/index.js +67 -0
- package/src/components/Atoms/StoryElements/Summary/stories.js +33 -0
- package/src/components/Atoms/StoryElements/Summary/summary.m.css +169 -0
- package/src/components/Atoms/StoryElements/Summary/summary.test.js +50 -0
- package/src/components/Atoms/StoryElements/Text/README.md +32 -0
- package/src/components/Atoms/StoryElements/Text/index.js +40 -0
- package/src/components/Atoms/StoryElements/Text/stories.js +32 -0
- package/src/components/Atoms/StoryElements/Text/text.m.css +88 -0
- package/src/components/Atoms/StoryElements/Text/text.test.js +42 -0
- package/src/components/Atoms/StoryElements/Video/README.md +9 -0
- package/src/components/Atoms/StoryElements/Video/index.js +46 -0
- package/src/components/Atoms/StoryElements/Video/stories.js +24 -0
- package/src/components/Atoms/StoryElements/Video/video.m.css +142 -0
- package/src/components/Atoms/StoryElements/Video/video.test.js +19 -0
- package/src/components/Atoms/StoryElements/imageGallery/README.md +18 -0
- package/src/components/Atoms/StoryElements/imageGallery/image-gallery.m.css +52 -0
- package/src/components/Atoms/StoryElements/imageGallery/image-gallery.test.js +19 -0
- package/src/components/Atoms/StoryElements/imageGallery/index.js +79 -0
- package/src/components/Atoms/StoryElements/imageGallery/stories.js +23 -0
- package/src/components/Atoms/StoryElements/withElementWrapper.js +13 -0
- package/src/components/Atoms/StoryElements/withElementWrapper.test.js +31 -0
- package/src/components/Atoms/StoryHeadline/index.js +56 -0
- package/src/components/Atoms/StoryHeadline/story-headline.m.css +36 -0
- package/src/components/Atoms/StoryReview/README.md +9 -0
- package/src/components/Atoms/StoryReview/index.js +39 -0
- package/src/components/Atoms/StoryReview/stories.js +8 -0
- package/src/components/Atoms/StoryReview/story-review.m.css +34 -0
- package/src/components/Atoms/StoryTags/README.md +9 -0
- package/src/components/Atoms/StoryTags/index.js +33 -0
- package/src/components/Atoms/StoryTags/stories.js +25 -0
- package/src/components/Atoms/StoryTags/story-tags.test.js +18 -0
- package/src/components/Atoms/StoryTags/tags.m.css +42 -0
- package/src/components/Atoms/Subheadline/README.md +17 -0
- package/src/components/Atoms/Subheadline/index.js +54 -0
- package/src/components/Atoms/Subheadline/stories.js +12 -0
- package/src/components/Atoms/Subheadline/subheadline.m.css +17 -0
- package/src/components/Atoms/TimeStamp/README.md +9 -0
- package/src/components/Atoms/TimeStamp/index.js +83 -0
- package/src/components/Atoms/TimeStamp/stories.js +9 -0
- package/src/components/Atoms/TimeStamp/timestamp.m.css +21 -0
- package/src/components/Fixture/config.json +2703 -0
- package/src/components/Fixture/dummy-collection.js +2790 -0
- package/src/components/Fixture/dummyStory.js +2368 -0
- package/src/components/Fixture/index.js +425 -0
- package/src/components/Fixture/slot-config.js +29 -0
- package/src/components/Fixture/timezone.js +1 -0
- package/src/components/Molecules/FollowUs/README.md +17 -0
- package/src/components/Molecules/FollowUs/follow-us.m.css +99 -0
- package/src/components/Molecules/FollowUs/index.js +97 -0
- package/src/components/Molecules/FollowUs/stories.js +9 -0
- package/src/components/Molecules/FullScreenImages/fullscreenimages.scss +56 -0
- package/src/components/Molecules/FullScreenImages/index.js +98 -0
- package/src/components/Molecules/KeyEvents/README.md +21 -0
- package/src/components/Molecules/KeyEvents/index.js +132 -0
- package/src/components/Molecules/KeyEvents/key-events.m.css +103 -0
- package/src/components/Molecules/KeyEvents/stories.js +28 -0
- package/src/components/Molecules/PageIntroductionCard/README.md +25 -0
- package/src/components/Molecules/PageIntroductionCard/index.js +50 -0
- package/src/components/Molecules/PageIntroductionCard/page-intro-card.m.css +61 -0
- package/src/components/Molecules/PageIntroductionCard/stories.js +16 -0
- package/src/components/Molecules/PortraitStoryCard/README.md +10 -0
- package/src/components/Molecules/PortraitStoryCard/index.js +54 -0
- package/src/components/Molecules/PortraitStoryCard/portrait-story-card.m.css +42 -0
- package/src/components/Molecules/PortraitStoryCard/stories.js +24 -0
- package/src/components/Molecules/SliderHorizontalCard/README.md +14 -0
- package/src/components/Molecules/SliderHorizontalCard/index.js +44 -0
- package/src/components/Molecules/SliderHorizontalCard/slider-horizontal-card.m.css +42 -0
- package/src/components/Molecules/SliderHorizontalCard/stories.js +30 -0
- package/src/components/Molecules/SocialShareTemplate/README.md +118 -0
- package/src/components/Molecules/SocialShareTemplate/__snapshots__/social-share-template.test.js.snap +285 -0
- package/src/components/Molecules/SocialShareTemplate/index.js +299 -0
- package/src/components/Molecules/SocialShareTemplate/social-share-data.js +205 -0
- package/src/components/Molecules/SocialShareTemplate/social-share-template.m.css +340 -0
- package/src/components/Molecules/SocialShareTemplate/social-share-template.test.js +147 -0
- package/src/components/Molecules/SocialShareTemplate/stories.js +45 -0
- package/src/components/Molecules/StoryCard/README.md +75 -0
- package/src/components/Molecules/StoryCard/READMEBGIMAGE.md +25 -0
- package/src/components/Molecules/StoryCard/READMEBORDER.md +61 -0
- package/src/components/Molecules/StoryCard/index.js +248 -0
- package/src/components/Molecules/StoryCard/stories.js +223 -0
- package/src/components/Molecules/StoryCard/storycard.m.css +197 -0
- package/src/components/Molecules/StoryCardWithBulletPoint/README.md +9 -0
- package/src/components/Molecules/StoryCardWithBulletPoint/index.js +33 -0
- package/src/components/Molecules/StoryCardWithBulletPoint/stories.js +31 -0
- package/src/components/Molecules/StoryCardWithBulletPoint/story-card-with-bullet-point.m.css +7 -0
- package/src/components/Molecules/StoryElementCard/README.md +9 -0
- package/src/components/Molecules/StoryElementCard/index.js +511 -0
- package/src/components/Molecules/StoryElementCard/stories.js +27 -0
- package/src/components/Molecules/StoryElementCard/story-element-card.m.css +102 -0
- package/src/components/Molecules/StorycardContent/README.md +34 -0
- package/src/components/Molecules/StorycardContent/index.js +85 -0
- package/src/components/Molecules/StorycardContent/stories.js +39 -0
- package/src/components/Molecules/StorycardContent/storycardContent.m.css +27 -0
- package/src/components/Rows/AlternateCollectionFilter/README.md +38 -0
- package/src/components/Rows/AlternateCollectionFilter/alternate-collection-filter.m.css +254 -0
- package/src/components/Rows/AlternateCollectionFilter/index.js +179 -0
- package/src/components/Rows/AlternateCollectionFilter/stories.js +74 -0
- package/src/components/Rows/AsideCollection/README.md +27 -0
- package/src/components/Rows/AsideCollection/aside-collection.m.css +125 -0
- package/src/components/Rows/AsideCollection/aside-collection.test.js +34 -0
- package/src/components/Rows/AsideCollection/index.js +247 -0
- package/src/components/Rows/AsideCollection/stories.js +52 -0
- package/src/components/Rows/AstrologyCollection/README.md +40 -0
- package/src/components/Rows/AstrologyCollection/astrology-collection.m.css +173 -0
- package/src/components/Rows/AstrologyCollection/index.js +176 -0
- package/src/components/Rows/AstrologyCollection/stories.js +60 -0
- package/src/components/Rows/AuthorIntroductionCard/README.md +43 -0
- package/src/components/Rows/AuthorIntroductionCard/author-intro.m.css +334 -0
- package/src/components/Rows/AuthorIntroductionCard/author-intro.test.js +106 -0
- package/src/components/Rows/AuthorIntroductionCard/index.js +126 -0
- package/src/components/Rows/AuthorIntroductionCard/stories.js +43 -0
- package/src/components/Rows/AuthorsList/README.md +24 -0
- package/src/components/Rows/AuthorsList/author-list.test.js +50 -0
- package/src/components/Rows/AuthorsList/authors-list.m.css +22 -0
- package/src/components/Rows/AuthorsList/index.js +48 -0
- package/src/components/Rows/AuthorsList/stories.js +61 -0
- package/src/components/Rows/CollectionFilter/README.md +39 -0
- package/src/components/Rows/CollectionFilter/collection-filter.m.css +213 -0
- package/src/components/Rows/CollectionFilter/index.js +240 -0
- package/src/components/Rows/CollectionFilter/stories.js +77 -0
- package/src/components/Rows/ElevenStories/11-stories.m.css +85 -0
- package/src/components/Rows/ElevenStories/README.md +39 -0
- package/src/components/Rows/ElevenStories/index.js +338 -0
- package/src/components/Rows/ElevenStories/stories.js +70 -0
- package/src/components/Rows/FourColFiveStories/README.md +37 -0
- package/src/components/Rows/FourColFiveStories/four-col-five-stories.m.css +115 -0
- package/src/components/Rows/FourColFiveStories/index.js +170 -0
- package/src/components/Rows/FourColFiveStories/stories.js +68 -0
- package/src/components/Rows/FourColGrid/README.md +39 -0
- package/src/components/Rows/FourColGrid/four-col.m.css +50 -0
- package/src/components/Rows/FourColGrid/index.js +164 -0
- package/src/components/Rows/FourColGrid/stories.js +66 -0
- package/src/components/Rows/FourColPortraitStories/README.md +38 -0
- package/src/components/Rows/FourColPortraitStories/four-col-portrait-stories.m.css +45 -0
- package/src/components/Rows/FourColPortraitStories/index.js +149 -0
- package/src/components/Rows/FourColPortraitStories/stories.js +66 -0
- package/src/components/Rows/FourColSixteenStories/README.md +35 -0
- package/src/components/Rows/FourColSixteenStories/four-col-sixteen-stories.m.css +165 -0
- package/src/components/Rows/FourColSixteenStories/index.js +136 -0
- package/src/components/Rows/FourColSixteenStories/stories.js +47 -0
- package/src/components/Rows/FourColTwelveStory/README.md +39 -0
- package/src/components/Rows/FourColTwelveStory/four-col-twelve-story.m.css +80 -0
- package/src/components/Rows/FourColTwelveStory/index.js +175 -0
- package/src/components/Rows/FourColTwelveStory/stories.js +117 -0
- package/src/components/Rows/FourStorySlider/README.md +45 -0
- package/src/components/Rows/FourStorySlider/four-story-slider.m.css +78 -0
- package/src/components/Rows/FourStorySlider/index.js +128 -0
- package/src/components/Rows/FourStorySlider/stories.js +117 -0
- package/src/components/Rows/FourStorySliderPortrait/README.md +45 -0
- package/src/components/Rows/FourStorySliderPortrait/four-story-slider-portrait.m.css +272 -0
- package/src/components/Rows/FourStorySliderPortrait/index.js +128 -0
- package/src/components/Rows/FourStorySliderPortrait/stories.js +117 -0
- package/src/components/Rows/FourTabbedBigStorySlider/README.md +39 -0
- package/src/components/Rows/FourTabbedBigStorySlider/four-tabbed-big-story-slider.m.css +265 -0
- package/src/components/Rows/FourTabbedBigStorySlider/index.js +159 -0
- package/src/components/Rows/FourTabbedBigStorySlider/stories.js +63 -0
- package/src/components/Rows/FullScreenSlider/README.md +46 -0
- package/src/components/Rows/FullScreenSlider/full-screen-slider.m.css +162 -0
- package/src/components/Rows/FullScreenSlider/index.js +122 -0
- package/src/components/Rows/FullScreenSlider/stories.js +115 -0
- package/src/components/Rows/HalfScreenSlider/README.md +43 -0
- package/src/components/Rows/HalfScreenSlider/half-screen-slider.m.css +80 -0
- package/src/components/Rows/HalfScreenSlider/index.js +112 -0
- package/src/components/Rows/HalfScreenSlider/stories.js +115 -0
- package/src/components/Rows/IntroductionCard/README.md +11 -0
- package/src/components/Rows/IntroductionCard/index.js +72 -0
- package/src/components/Rows/IntroductionCard/intro-card.module.css +102 -0
- package/src/components/Rows/IntroductionCard/stories.js +32 -0
- package/src/components/Rows/ListComponent/README.md +48 -0
- package/src/components/Rows/ListComponent/index.js +149 -0
- package/src/components/Rows/ListComponent/list-component.m.css +65 -0
- package/src/components/Rows/ListComponent/stories.js +63 -0
- package/src/components/Rows/Listicles/README.md +32 -0
- package/src/components/Rows/Listicles/index.js +162 -0
- package/src/components/Rows/Listicles/listicles.m.css +149 -0
- package/src/components/Rows/Listicles/stories.js +66 -0
- package/src/components/Rows/MagazineEditions/README.md +21 -0
- package/src/components/Rows/MagazineEditions/index.js +96 -0
- package/src/components/Rows/MagazineEditions/magazine-editions.m.css +50 -0
- package/src/components/Rows/MagazineEditions/magazine-editions.test.js +33 -0
- package/src/components/Rows/MagazineEditions/stories.js +45 -0
- package/src/components/Rows/MagazineHeaderCard/README.md +21 -0
- package/src/components/Rows/MagazineHeaderCard/index.js +77 -0
- package/src/components/Rows/MagazineHeaderCard/magazine-cards.m.css +107 -0
- package/src/components/Rows/MagazineHeaderCard/stories.js +36 -0
- package/src/components/Rows/MagazineWidget/README.md +21 -0
- package/src/components/Rows/MagazineWidget/index.js +132 -0
- package/src/components/Rows/MagazineWidget/stories.js +43 -0
- package/src/components/Rows/OneColStoryList/README.md +48 -0
- package/src/components/Rows/OneColStoryList/index.js +217 -0
- package/src/components/Rows/OneColStoryList/one-col-story-list.m.css +91 -0
- package/src/components/Rows/OneColStoryList/stories.js +61 -0
- package/src/components/Rows/OpinionCollection/README.md +36 -0
- package/src/components/Rows/OpinionCollection/index.js +156 -0
- package/src/components/Rows/OpinionCollection/opinion-collection.m.css +210 -0
- package/src/components/Rows/OpinionCollection/stories.js +82 -0
- package/src/components/Rows/SixColSixStories/README.md +39 -0
- package/src/components/Rows/SixColSixStories/index.js +182 -0
- package/src/components/Rows/SixColSixStories/six-col-six-stories.m.css +92 -0
- package/src/components/Rows/SixColSixStories/stories.js +76 -0
- package/src/components/Rows/StoryTemplates/EventStoryTemplates/CustomAttributes/custom-attributes.m.css +78 -0
- package/src/components/Rows/StoryTemplates/EventStoryTemplates/CustomAttributes/index.js +103 -0
- package/src/components/Rows/StoryTemplates/EventStoryTemplates/event-story.m.css +138 -0
- package/src/components/Rows/StoryTemplates/EventStoryTemplates/index.js +56 -0
- package/src/components/Rows/StoryTemplates/EventStoryTemplates/stories.js +78 -0
- package/src/components/Rows/StoryTemplates/EventStoryTemplates/template.js +169 -0
- package/src/components/Rows/StoryTemplates/ListicleStoryTemplates/README.md +19 -0
- package/src/components/Rows/StoryTemplates/ListicleStoryTemplates/__snapshots__/listicle-story.test.js.snap +841 -0
- package/src/components/Rows/StoryTemplates/ListicleStoryTemplates/index.js +477 -0
- package/src/components/Rows/StoryTemplates/ListicleStoryTemplates/listicle-story.m.css +285 -0
- package/src/components/Rows/StoryTemplates/ListicleStoryTemplates/listicle-story.test.js +47 -0
- package/src/components/Rows/StoryTemplates/ListicleStoryTemplates/listicleUtils.js +16 -0
- package/src/components/Rows/StoryTemplates/ListicleStoryTemplates/stories.js +125 -0
- package/src/components/Rows/StoryTemplates/LiveBlogStoryTemplates/README.md +25 -0
- package/src/components/Rows/StoryTemplates/LiveBlogStoryTemplates/index.js +74 -0
- package/src/components/Rows/StoryTemplates/LiveBlogStoryTemplates/live-blog.m.css +320 -0
- package/src/components/Rows/StoryTemplates/LiveBlogStoryTemplates/stories.js +114 -0
- package/src/components/Rows/StoryTemplates/LiveBlogStoryTemplates/templates.js +449 -0
- package/src/components/Rows/StoryTemplates/PhotoStoryTemplates/index.js +381 -0
- package/src/components/Rows/StoryTemplates/PhotoStoryTemplates/photo-story.test.js +144 -0
- package/src/components/Rows/StoryTemplates/PhotoStoryTemplates/photo.m.css +199 -0
- package/src/components/Rows/StoryTemplates/PhotoStoryTemplates/stories.js +117 -0
- package/src/components/Rows/StoryTemplates/Snapshot/README.md +9 -0
- package/src/components/Rows/StoryTemplates/Snapshot/index.js +103 -0
- package/src/components/Rows/StoryTemplates/Snapshot/snapshot.m.css +88 -0
- package/src/components/Rows/StoryTemplates/Snapshot/stories.js +95 -0
- package/src/components/Rows/StoryTemplates/TextStoryTemplates/README.md +49 -0
- package/src/components/Rows/StoryTemplates/TextStoryTemplates/index.js +100 -0
- package/src/components/Rows/StoryTemplates/TextStoryTemplates/stories.js +120 -0
- package/src/components/Rows/StoryTemplates/TextStoryTemplates/templates.js +413 -0
- package/src/components/Rows/StoryTemplates/TextStoryTemplates/text-story.m.css +496 -0
- package/src/components/Rows/StoryTemplates/TextStoryTemplates/text-story.test.js +222 -0
- package/src/components/Rows/StoryTemplates/VideoStoryTemplates/README.md +31 -0
- package/src/components/Rows/StoryTemplates/VideoStoryTemplates/index.js +294 -0
- package/src/components/Rows/StoryTemplates/VideoStoryTemplates/stories.js +217 -0
- package/src/components/Rows/StoryTemplates/VideoStoryTemplates/video-story.m.css +185 -0
- package/src/components/Rows/ThreeColFlexStories/README.md +38 -0
- package/src/components/Rows/ThreeColFlexStories/index.js +217 -0
- package/src/components/Rows/ThreeColFlexStories/stories.js +73 -0
- package/src/components/Rows/ThreeColFlexStories/three-col-flex-stories.m.css +58 -0
- package/src/components/Rows/ThreeColFourteenStory/README.md +28 -0
- package/src/components/Rows/ThreeColFourteenStory/index.js +131 -0
- package/src/components/Rows/ThreeColFourteenStory/stories.js +60 -0
- package/src/components/Rows/ThreeColFourteenStory/three-col-fourteen-story.m.css +51 -0
- package/src/components/Rows/ThreeColGrid/README.md +36 -0
- package/src/components/Rows/ThreeColGrid/index.js +177 -0
- package/src/components/Rows/ThreeColGrid/stories.js +70 -0
- package/src/components/Rows/ThreeColGrid/three-col.m.css +43 -0
- package/src/components/Rows/ThreeColSevenStory/README.md +36 -0
- package/src/components/Rows/ThreeColSevenStory/index.js +242 -0
- package/src/components/Rows/ThreeColSevenStory/stories.js +103 -0
- package/src/components/Rows/ThreeColSevenStory/three-col-seven-story.m.css +44 -0
- package/src/components/Rows/ThreeColSixStories/README.md +40 -0
- package/src/components/Rows/ThreeColSixStories/index.js +183 -0
- package/src/components/Rows/ThreeColSixStories/stories.js +73 -0
- package/src/components/Rows/ThreeColSixStories/three-col-six-stories.m.css +32 -0
- package/src/components/Rows/ThreeColTwelveStories/README.md +41 -0
- package/src/components/Rows/ThreeColTwelveStories/index.js +153 -0
- package/src/components/Rows/ThreeColTwelveStories/stories.js +51 -0
- package/src/components/Rows/ThreeColTwelveStories/three-col-twelve-stories.m.css +105 -0
- package/src/components/Rows/TwoColFourStory/README.md +33 -0
- package/src/components/Rows/TwoColFourStory/index.js +162 -0
- package/src/components/Rows/TwoColFourStory/stories.js +68 -0
- package/src/components/Rows/TwoColFourStory/two-col-four-story.m.css +66 -0
- package/src/components/Rows/TwoColFourStoryHighlight/README.md +35 -0
- package/src/components/Rows/TwoColFourStoryHighlight/index.js +138 -0
- package/src/components/Rows/TwoColFourStoryHighlight/stories.js +48 -0
- package/src/components/Rows/TwoColFourStoryHighlight/two-col-four-story-highlight.m.css +116 -0
- package/src/components/Rows/TwoColSevenStories/README.md +37 -0
- package/src/components/Rows/TwoColSevenStories/index.js +150 -0
- package/src/components/Rows/TwoColSevenStories/stories.js +100 -0
- package/src/components/Rows/TwoColSevenStories/two-col-seven-stories.m.css +182 -0
- package/src/components/Rows/TwoColSixStories/README.md +36 -0
- package/src/components/Rows/TwoColSixStories/index.js +140 -0
- package/src/components/Rows/TwoColSixStories/stories.js +67 -0
- package/src/components/Rows/TwoColSixStories/two-col-six-stories.m.css +174 -0
- package/src/components/Rows/TwoColTenStoriesSidebar/README.md +34 -0
- package/src/components/Rows/TwoColTenStoriesSidebar/index.js +193 -0
- package/src/components/Rows/TwoColTenStoriesSidebar/stories.js +45 -0
- package/src/components/Rows/TwoColTenStoriesSidebar/two-col-ten-stories-sidebar.m.css +64 -0
- package/src/components/Rows/TwoColThreeStory/README.md +40 -0
- package/src/components/Rows/TwoColThreeStory/index.js +155 -0
- package/src/components/Rows/TwoColThreeStory/stories.js +68 -0
- package/src/components/Rows/TwoColThreeStory/two-col-three-story.m.css +36 -0
- package/src/components/SharedContext.js +13 -0
- package/src/components/Svgs/Loading/loading.js +133 -0
- package/src/components/Svgs/Loading/loading.m.css +6 -0
- package/src/components/Svgs/SocialIcons/circular-color/copylink.js +22 -0
- package/src/components/Svgs/SocialIcons/circular-color/email.js +16 -0
- package/src/components/Svgs/SocialIcons/circular-color/facebook.js +23 -0
- package/src/components/Svgs/SocialIcons/circular-color/instagram.js +24 -0
- package/src/components/Svgs/SocialIcons/circular-color/jio.js +30 -0
- package/src/components/Svgs/SocialIcons/circular-color/linkedin.js +16 -0
- package/src/components/Svgs/SocialIcons/circular-color/pinterest.js +16 -0
- package/src/components/Svgs/SocialIcons/circular-color/reddit.js +27 -0
- package/src/components/Svgs/SocialIcons/circular-color/telegram.js +16 -0
- package/src/components/Svgs/SocialIcons/circular-color/tiktok.js +40 -0
- package/src/components/Svgs/SocialIcons/circular-color/twitter.js +22 -0
- package/src/components/Svgs/SocialIcons/circular-color/whatsapp.js +18 -0
- package/src/components/Svgs/SocialIcons/circular-color/youtube.js +16 -0
- package/src/components/Svgs/SocialIcons/circular-plain/copylink.js +19 -0
- package/src/components/Svgs/SocialIcons/circular-plain/email.js +19 -0
- package/src/components/Svgs/SocialIcons/circular-plain/facebook.js +29 -0
- package/src/components/Svgs/SocialIcons/circular-plain/instagram.js +21 -0
- package/src/components/Svgs/SocialIcons/circular-plain/linkedin.js +21 -0
- package/src/components/Svgs/SocialIcons/circular-plain/reddit.js +33 -0
- package/src/components/Svgs/SocialIcons/circular-plain/telegram.js +22 -0
- package/src/components/Svgs/SocialIcons/circular-plain/twitter.js +21 -0
- package/src/components/Svgs/SocialIcons/circular-plain/whatsapp.js +23 -0
- package/src/components/Svgs/SocialIcons/circular-plain/youtube.js +17 -0
- package/src/components/Svgs/SocialIcons/plain/copylink.js +17 -0
- package/src/components/Svgs/SocialIcons/plain/email.js +23 -0
- package/src/components/Svgs/SocialIcons/plain/facebook.js +21 -0
- package/src/components/Svgs/SocialIcons/plain/google-news.js +26 -0
- package/src/components/Svgs/SocialIcons/plain/instagram.js +17 -0
- package/src/components/Svgs/SocialIcons/plain/linkedin.js +17 -0
- package/src/components/Svgs/SocialIcons/plain/pinterest.js +19 -0
- package/src/components/Svgs/SocialIcons/plain/reddit.js +25 -0
- package/src/components/Svgs/SocialIcons/plain/twitter.js +17 -0
- package/src/components/Svgs/SocialIcons/plain/whatsapp.js +19 -0
- package/src/components/Svgs/SocialIcons/plain/youtube.js +17 -0
- package/src/components/Svgs/SocialIcons/square/copylink.js +19 -0
- package/src/components/Svgs/SocialIcons/square/email.js +13 -0
- package/src/components/Svgs/SocialIcons/square/facebook.js +20 -0
- package/src/components/Svgs/SocialIcons/square/instagram.js +17 -0
- package/src/components/Svgs/SocialIcons/square/linkedin.js +13 -0
- package/src/components/Svgs/SocialIcons/square/reddit.js +24 -0
- package/src/components/Svgs/SocialIcons/square/telegram.js +13 -0
- package/src/components/Svgs/SocialIcons/square/twitter.js +19 -0
- package/src/components/Svgs/SocialIcons/square/whatsapp.js +15 -0
- package/src/components/Svgs/SocialIcons/square/youtube.js +13 -0
- package/src/components/Svgs/TTS-Icons/AudioSpeakerIcon.js +14 -0
- package/src/components/Svgs/TTS-Icons/BackwardIconSvg.js +13 -0
- package/src/components/Svgs/TTS-Icons/ClosePlayerIconSvg.js +13 -0
- package/src/components/Svgs/TTS-Icons/ForwordIconSvg.js +13 -0
- package/src/components/Svgs/TTS-Icons/PauseIconSvg.js +13 -0
- package/src/components/Svgs/TTS-Icons/PlayIconSvg.js +15 -0
- package/src/components/Svgs/TTS-Icons/ReplayIcon.js +16 -0
- package/src/components/Svgs/back-arrow.js +22 -0
- package/src/components/Svgs/calender.js +20 -0
- package/src/components/Svgs/caret-right.svg +3 -0
- package/src/components/Svgs/clock-icon.js +17 -0
- package/src/components/Svgs/close-icon.js +15 -0
- package/src/components/Svgs/crown.js +31 -0
- package/src/components/Svgs/fallbackImage.js +42 -0
- package/src/components/Svgs/hyperlink.js +17 -0
- package/src/components/Svgs/key.js +33 -0
- package/src/components/Svgs/large-share-icon.js +64 -0
- package/src/components/Svgs/left-arrow.js +17 -0
- package/src/components/Svgs/liveicon.js +14 -0
- package/src/components/Svgs/location.js +19 -0
- package/src/components/Svgs/lock.js +31 -0
- package/src/components/Svgs/photo-icons.js +84 -0
- package/src/components/Svgs/right-arrow.js +17 -0
- package/src/components/Svgs/share-icon.js +66 -0
- package/src/components/Svgs/star.js +33 -0
- package/src/components/Svgs/user-fallback-icon.js +19 -0
- package/src/components/Svgs/video-icons.js +104 -0
- package/src/components/Svgs/visual-story-icons.js +77 -0
- package/src/components/Typography/README.md +7 -0
- package/src/components/Typography/index.js +47 -0
- package/src/components/Typography/stories.js +10 -0
- package/src/components/Typography/style.m.css +11 -0
- package/src/constants.js +2 -0
- package/src/entry-points.js +373 -0
- package/src/guide/stories.js +18 -0
- package/src/hydration-component/index.js +37 -0
- package/src/hydration-component/useNearScreen.js +56 -0
- package/src/index.js +99 -0
- package/src/utils/copy-link.js +37 -0
- package/src/utils/dateFnsLocales.js +9 -0
- package/src/utils/img-size-utils.js +102 -0
- package/src/utils/testing-utils.js +8 -0
- package/src/utils/utils.js +615 -0
- package/src/utils/utils.test.js +108 -0
- package/storybook/index.js +83 -0
- package/AlsoRead/styles.arrow.css +0 -1
- package/AlternateCollectionFilter/styles.arrow.css +0 -1
- package/AsideCollection/styles.arrow.css +0 -1
- package/AstrologyCollection/styles.arrow.css +0 -1
- package/Attachment/styles.arrow.css +0 -1
- package/Author/styles.arrow.css +0 -1
- package/AuthorIntroductionCard/styles.arrow.css +0 -1
- package/AuthorWithTime/styles.arrow.css +0 -1
- package/AuthorsList/styles.arrow.css +0 -1
- package/BigFact/styles.arrow.css +0 -1
- package/BlockQuote/styles.arrow.css +0 -1
- package/Blurb/styles.arrow.css +0 -1
- package/CollectionFilter/styles.arrow.css +0 -1
- package/CollectionName/styles.arrow.css +0 -1
- package/ElevenStories/styles.arrow.css +0 -1
- package/EventStoryTemplate/styles.arrow.css +0 -1
- package/FollowUs/styles.arrow.css +0 -1
- package/FourColFiveStories/styles.arrow.css +0 -1
- package/FourColGrid/styles.arrow.css +0 -1
- package/FourColPortraitStories/styles.arrow.css +0 -1
- package/FourColSixteenStories/styles.arrow.css +0 -1
- package/FourColTwelveStories/styles.arrow.css +0 -1
- package/FourStorySlider/styles.arrow.css +0 -1
- package/FourStorySliderPortrait/styles.arrow.css +0 -1
- package/FourTabbedBigStorySlider/styles.arrow.css +0 -1
- package/FullScreenSlider/styles.arrow.css +0 -1
- package/HalfScreenSlider/styles.arrow.css +0 -1
- package/Headline/styles.arrow.css +0 -1
- package/HeroImage/styles.arrow.css +0 -1
- package/Image/styles.arrow.css +0 -1
- package/ImageGallery/styles.arrow.css +0 -1
- package/ImageSlideshow/styles.arrow.css +0 -1
- package/IntroductionCard/styles.arrow.css +0 -1
- package/KeyEvents/styles.arrow.css +0 -1
- package/ListComponent/styles.arrow.css +0 -1
- package/ListicleStoryTemplate/styles.arrow.css +0 -1
- package/Listicles/styles.arrow.css +0 -1
- package/LiveBlogStoryTemplate/styles.arrow.css +0 -1
- package/LoadmoreButton/styles.arrow.css +0 -1
- package/MagazineEditions/styles.arrow.css +0 -1
- package/MagazineHeaderCard/styles.arrow.css +0 -1
- package/MagazineWidget/styles.arrow.css +0 -1
- package/OneColStoryList/styles.arrow.css +0 -1
- package/OpinionCollection/styles.arrow.css +0 -1
- package/PageIntroductionCard/styles.arrow.css +0 -1
- package/PhotoStoryTemplate/styles.arrow.css +0 -1
- package/PublishDetails/styles.arrow.css +0 -1
- package/QuestionAnswer/styles.arrow.css +0 -1
- package/Quote/styles.arrow.css +0 -1
- package/Reference/styles.arrow.css +0 -1
- package/ScrollSnap/styles.arrow.css +0 -1
- package/SectionTag/styles.arrow.css +0 -1
- package/SixColSixStories/styles.arrow.css +0 -1
- package/Snapshot/styles.arrow.css +0 -1
- package/SocialShareTemplate/styles.arrow.css +0 -1
- package/StoryCard/styles.arrow.css +0 -1
- package/StoryCollection/styles.arrow.css +0 -1
- package/StoryElement/styles.arrow.css +0 -1
- package/StoryElementCard/styles.arrow.css +0 -1
- package/StorycardContent/styles.arrow.css +0 -1
- package/Subheadline/styles.arrow.css +0 -1
- package/Summary/styles.arrow.css +0 -1
- package/Text/styles.arrow.css +0 -1
- package/TextStoryTemplate/styles.arrow.css +0 -1
- package/ThreeColFlexStories/styles.arrow.css +0 -1
- package/ThreeColFourteenStories/styles.arrow.css +0 -1
- package/ThreeColGrid/styles.arrow.css +0 -1
- package/ThreeColSevenStory/styles.arrow.css +0 -1
- package/ThreeColSixStories/styles.arrow.css +0 -1
- package/ThreeColTwelveStories/styles.arrow.css +0 -1
- package/TimeStamp/styles.arrow.css +0 -1
- package/TwoColFourStories/styles.arrow.css +0 -1
- package/TwoColFourStoryHighlight/styles.arrow.css +0 -1
- package/TwoColSevenStories/styles.arrow.css +0 -1
- package/TwoColSixStories/styles.arrow.css +0 -1
- package/TwoColTenStoriesSidebar/styles.arrow.css +0 -1
- package/TwoColThreeStories/styles.arrow.css +0 -1
- package/Video/styles.arrow.css +0 -1
- package/VideoStoryTemplate/styles.arrow.css +0 -1
- package/cjs/index.js +0 -1
- package/esm/index.js +0 -1
- /package/{app.scss → assets/stylesheets/app.scss} +0 -0
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import get from "lodash/get";
|
|
2
|
+
import camelCase from "lodash.camelcase";
|
|
3
|
+
import kebabCase from "lodash.kebabcase";
|
|
4
|
+
import PropTypes from "prop-types";
|
|
5
|
+
import upperCase from "lodash/upperCase";
|
|
6
|
+
import Timeago from "react-timeago";
|
|
7
|
+
import React from "react";
|
|
8
|
+
import lowerCase from "lodash/lowerCase";
|
|
9
|
+
import format from "date-fns-tz/format";
|
|
10
|
+
import utcToZonedTime from "date-fns-tz/utcToZonedTime";
|
|
11
|
+
import { Dot } from "../components/Atoms/Dot/dot";
|
|
12
|
+
import { Divider } from "../components/Atoms/Divider/";
|
|
13
|
+
import { STORY_TEMPLATES } from "../constants";
|
|
14
|
+
import formatDistanceToNowStrict from "date-fns/formatDistanceToNowStrict";
|
|
15
|
+
import { useSelector } from "react-redux";
|
|
16
|
+
import { timeZoneData } from "../components/Fixture/timezone";
|
|
17
|
+
import { LOCALES } from "./dateFnsLocales";
|
|
18
|
+
|
|
19
|
+
const canUseDOM = !!(typeof window !== "undefined" && window.document && window.document.createElement);
|
|
20
|
+
|
|
21
|
+
export const sharePageUrl = canUseDOM && window.location.href;
|
|
22
|
+
|
|
23
|
+
export function truncate(string = "", limit = 60, ellipsis = true) {
|
|
24
|
+
const putEllipsis = ellipsis ? " ..." : "";
|
|
25
|
+
return typeof string === "string" && string.length > limit ? string.substring(0, limit) + putEllipsis : string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const timestampToFormat = (
|
|
29
|
+
value,
|
|
30
|
+
unit,
|
|
31
|
+
suffix,
|
|
32
|
+
timestamp,
|
|
33
|
+
config = {},
|
|
34
|
+
languageCode = "en-IN",
|
|
35
|
+
enableTimeZoneAbbr = false,
|
|
36
|
+
timezone
|
|
37
|
+
) => {
|
|
38
|
+
const {
|
|
39
|
+
showTime = false,
|
|
40
|
+
isTimeFirst = false,
|
|
41
|
+
isUpperCase = false,
|
|
42
|
+
disableMeridiem = false,
|
|
43
|
+
dateFormat,
|
|
44
|
+
localizedMeridiem,
|
|
45
|
+
localizedMonths,
|
|
46
|
+
direction = "ltr"
|
|
47
|
+
} = config;
|
|
48
|
+
const monthList = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"];
|
|
49
|
+
const dateTime = new Date(timestamp);
|
|
50
|
+
let date;
|
|
51
|
+
let month;
|
|
52
|
+
let year;
|
|
53
|
+
|
|
54
|
+
if (enableTimeZoneAbbr) {
|
|
55
|
+
const zonedTime = timezone && utcToZonedTime(dateTime, timezone);
|
|
56
|
+
const formatZonedTime = zonedTime && format(zonedTime, "yyyy-MM-dd HH:mm:ss zzz", { timeZone: timezone });
|
|
57
|
+
const [datePart] = formatZonedTime.split(" ");
|
|
58
|
+
const [zonedYear, zonedMonth, zonedDate] = datePart.split("-");
|
|
59
|
+
date = zonedDate;
|
|
60
|
+
month = monthList[parseInt(zonedMonth, 10) - 1];
|
|
61
|
+
year = zonedYear;
|
|
62
|
+
} else {
|
|
63
|
+
date = dateTime
|
|
64
|
+
.getDate()
|
|
65
|
+
.toString()
|
|
66
|
+
.padStart(2, 0);
|
|
67
|
+
month = monthList[dateTime.getMonth()];
|
|
68
|
+
year = dateTime.getFullYear();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
let localizedMonth = month;
|
|
72
|
+
|
|
73
|
+
if (isUpperCase) {
|
|
74
|
+
localizedMonth = upperCase(month);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
const rtlWithoutCustomLabels = direction === "rtl" && !localizedMeridiem && !localizedMonths;
|
|
78
|
+
|
|
79
|
+
const timeWithLocalizedMeridiem = formatAMPM(
|
|
80
|
+
timestamp,
|
|
81
|
+
languageCode,
|
|
82
|
+
config,
|
|
83
|
+
isTimeFirst,
|
|
84
|
+
timezone,
|
|
85
|
+
enableTimeZoneAbbr
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
let timetoShow = "";
|
|
89
|
+
let rtlTimetoShow = "";
|
|
90
|
+
|
|
91
|
+
if (showTime) {
|
|
92
|
+
timetoShow = `, ${timeWithLocalizedMeridiem}`;
|
|
93
|
+
if (isTimeFirst && rtlWithoutCustomLabels) {
|
|
94
|
+
rtlTimetoShow = `${timeWithLocalizedMeridiem}`;
|
|
95
|
+
} else rtlTimetoShow = `${timeWithLocalizedMeridiem} ,`;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
if (localizedMonths) {
|
|
99
|
+
localizedMonth = get(localizedMonths, [lowerCase(month)]) || month;
|
|
100
|
+
}
|
|
101
|
+
const localizedDate = date.toLocaleString(languageCode);
|
|
102
|
+
const localizedYear = year.toLocaleString(languageCode).replace(/,/g, "");
|
|
103
|
+
|
|
104
|
+
if (disableMeridiem) {
|
|
105
|
+
return `${localizedMonth} ${localizedDate}, ${localizedYear}`;
|
|
106
|
+
} else if (isTimeFirst) {
|
|
107
|
+
if (rtlWithoutCustomLabels) {
|
|
108
|
+
return `${localizedYear} ${localizedMonth} ${localizedDate}, ${rtlTimetoShow}`;
|
|
109
|
+
}
|
|
110
|
+
return `${timeWithLocalizedMeridiem}, ${localizedDate} ${localizedMonth} ${localizedYear}`;
|
|
111
|
+
} else if (dateFormat === "mon-dd-yyyy") {
|
|
112
|
+
if (rtlWithoutCustomLabels) {
|
|
113
|
+
return `${rtlTimetoShow}${localizedYear} ,${localizedDate} ${localizedMonth}`;
|
|
114
|
+
}
|
|
115
|
+
return `${localizedMonth} ${localizedDate}, ${localizedYear}${timetoShow}`;
|
|
116
|
+
} else {
|
|
117
|
+
if (rtlWithoutCustomLabels) {
|
|
118
|
+
return `${rtlTimetoShow}${localizedYear} ${localizedMonth} ${localizedDate}`;
|
|
119
|
+
}
|
|
120
|
+
return `${localizedDate} ${localizedMonth} ${localizedYear}${timetoShow}`;
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export function automaticTimeTranslation({ date, languageCode }) {
|
|
125
|
+
const dateToFormat = new Date(date);
|
|
126
|
+
const locale = LOCALES[languageCode] || LOCALES["enUS"];
|
|
127
|
+
const timeDistance = formatDistanceToNowStrict(dateToFormat, {
|
|
128
|
+
locale,
|
|
129
|
+
addSuffix: true,
|
|
130
|
+
includeSeconds: true
|
|
131
|
+
});
|
|
132
|
+
return timeDistance;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export function formatter(value, unit, suffix, date, config = {}, languageCode, isLocalizedNumber) {
|
|
136
|
+
const showDateForUnits = ["day", "week", "month", "year"];
|
|
137
|
+
// suffix here refers to ago
|
|
138
|
+
// unit here refers to seconds, minute, minutes,...
|
|
139
|
+
const localizedSuffix = get(config, ["localizedPublishTime", suffix]) || suffix;
|
|
140
|
+
let localizedUnitOfTime;
|
|
141
|
+
|
|
142
|
+
const localeDateLanguageCode = isLocalizedNumber ? languageCode : "en";
|
|
143
|
+
|
|
144
|
+
const timeFormatObj = {
|
|
145
|
+
time: value.toLocaleString(localeDateLanguageCode),
|
|
146
|
+
unit: localizedUnitOfTime,
|
|
147
|
+
ago: localizedSuffix,
|
|
148
|
+
since: get(config, ["localizedPublishTime", "since"]) || "since"
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
// The time appears in this format that is the reason its a string value
|
|
152
|
+
const timeAgoFormat = "time unit ago";
|
|
153
|
+
|
|
154
|
+
const getFormattedDate = (timeFormat) => {
|
|
155
|
+
const timeStr = timeAgoFormat.replace(/time|unit|ago|since/gi, (item) => timeFormat[item]);
|
|
156
|
+
return timeStr;
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
// checking for localized values
|
|
160
|
+
const localizedValues = get(config, ["localizedPublishTime"], {});
|
|
161
|
+
|
|
162
|
+
const keysToCheck = ["ago", "seconds", "minute", "minutes", "hour", "hours"];
|
|
163
|
+
const isLocalizedValues = !keysToCheck.some((key) => localizedValues[key]);
|
|
164
|
+
|
|
165
|
+
// custom labels toggle is disabled and label values are not present
|
|
166
|
+
const isNotLocalized = !config.enableLocalization && !isLocalizedValues;
|
|
167
|
+
|
|
168
|
+
// custom labels toggle is disabled and label values are present
|
|
169
|
+
const isNotLocalizedButHasLocalizedValues = !config.enableLocalization && isLocalizedValues;
|
|
170
|
+
|
|
171
|
+
// custom labels toggle is enabled and label values are present
|
|
172
|
+
const isLocalizedAndHasLocalizedValues = config.enableLocalization && isLocalizedValues;
|
|
173
|
+
|
|
174
|
+
// showing automatic time translation from date-fns library based on the localized values
|
|
175
|
+
const showTimeTranslation =
|
|
176
|
+
config.enableTimeTranslation &&
|
|
177
|
+
(isNotLocalized || isNotLocalizedButHasLocalizedValues || isLocalizedAndHasLocalizedValues);
|
|
178
|
+
|
|
179
|
+
// This condition passes when unit is either day/week/month/year. eg: 4 months ago
|
|
180
|
+
if ((unit === "hour" && value > 23) || showDateForUnits.indexOf(unit) !== -1) {
|
|
181
|
+
return timestampToFormat(value, unit, suffix, date, config, localeDateLanguageCode, isLocalizedNumber);
|
|
182
|
+
}
|
|
183
|
+
// Primary unit is a unit in singular form like second/ minute /hour
|
|
184
|
+
const primaryUnit = get(config, ["localizedPublishTime", unit]) || unit;
|
|
185
|
+
|
|
186
|
+
// Secondary unit is a unit in plural form like seconds/ minutes/ hours
|
|
187
|
+
const secondaryUnit = get(config, ["localizedPublishTime", `${unit}s`]) || `${unit}s`;
|
|
188
|
+
|
|
189
|
+
// Checking to show unit in singular form or plural form
|
|
190
|
+
// Value is the numeric value of time. Eg: In 1 hour ago, 1 is the value.
|
|
191
|
+
localizedUnitOfTime = value > 1 ? secondaryUnit : primaryUnit;
|
|
192
|
+
timeFormatObj["unit"] = localizedUnitOfTime;
|
|
193
|
+
|
|
194
|
+
return showTimeTranslation ? automaticTimeTranslation({ date, languageCode }) : getFormattedDate(timeFormatObj);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
function formatAMPM(timestamp, languageCode, config, isTimeFirst, timezone, enableTimeZoneAbbr = false) {
|
|
198
|
+
const { timeFormat = "12hours", localizedZeroToPad, direction = "ltr", localizedMonths, localizedMeridiem } = config;
|
|
199
|
+
const dateTime = new Date(timestamp);
|
|
200
|
+
let hours;
|
|
201
|
+
let minutes;
|
|
202
|
+
if (enableTimeZoneAbbr) {
|
|
203
|
+
const zonedTime = timezone && utcToZonedTime(dateTime, timezone);
|
|
204
|
+
const formatZonedTime = zonedTime && format(zonedTime, "yyyy-MM-dd HH:mm:ss zzz", { timeZone: timezone });
|
|
205
|
+
const timePart = formatZonedTime.split(" ")[1];
|
|
206
|
+
[hours, minutes] = timePart.split(":");
|
|
207
|
+
} else {
|
|
208
|
+
hours = dateTime.getHours();
|
|
209
|
+
minutes = dateTime.getMinutes();
|
|
210
|
+
const padZero = typeof languageCode === "string" && languageCode.startsWith("en") ? "0" : localizedZeroToPad;
|
|
211
|
+
minutes = minutes < 10 ? padZero + minutes.toLocaleString(languageCode) : minutes.toLocaleString(languageCode);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
if (timeFormat === "24hours") {
|
|
215
|
+
// 'en-GB' formats the time in 24-hours format
|
|
216
|
+
if (enableTimeZoneAbbr) {
|
|
217
|
+
return `${hours}:${minutes}`;
|
|
218
|
+
}
|
|
219
|
+
return dateTime.toLocaleTimeString("en-GB", {
|
|
220
|
+
hour: "2-digit",
|
|
221
|
+
minute: "2-digit"
|
|
222
|
+
});
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
const ampm = hours >= 12 ? "pm" : "am";
|
|
226
|
+
hours = hours % 12;
|
|
227
|
+
hours = hours || 12;
|
|
228
|
+
let updatedAmPm = ampm.toLocaleString(languageCode);
|
|
229
|
+
|
|
230
|
+
if (localizedMeridiem) {
|
|
231
|
+
const { am = "am", pm = "pm" } = localizedMeridiem;
|
|
232
|
+
updatedAmPm = ampm.toLocaleString(languageCode) === "am" ? am || "am" : pm || "pm";
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
if (direction === "rtl" && !localizedMeridiem && !localizedMonths) {
|
|
236
|
+
if (isTimeFirst) {
|
|
237
|
+
const strTime = hours.toLocaleString(languageCode) + ":" + minutes + " " + updatedAmPm;
|
|
238
|
+
return strTime;
|
|
239
|
+
}
|
|
240
|
+
const strTime = updatedAmPm + " " + hours.toLocaleString(languageCode) + ":" + minutes;
|
|
241
|
+
return strTime;
|
|
242
|
+
}
|
|
243
|
+
const strTime = hours.toLocaleString(languageCode) + ":" + minutes + " " + updatedAmPm;
|
|
244
|
+
return strTime;
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export const hexToRGB = (hex) => {
|
|
248
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
249
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
250
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
251
|
+
return { r, g, b };
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
export const getLuminanceOfColor = (hex) => {
|
|
255
|
+
const { r, g, b } = hexToRGB(hex);
|
|
256
|
+
return r * 0.299 + g * 0.587 + b * 0.114;
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
export const rgbToHex = (color = "rgba(255, 255, 255, 0)") => {
|
|
260
|
+
let rgba = color.match(/^rgba?[\s+]?\([\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?,[\s+]?(\d+)[\s+]?/i);
|
|
261
|
+
return rgba && rgba.length === 4
|
|
262
|
+
? "#" +
|
|
263
|
+
("0" + parseInt(rgba[1], 10).toString(16)).slice(-2) +
|
|
264
|
+
("0" + parseInt(rgba[2], 10).toString(16)).slice(-2) +
|
|
265
|
+
("0" + parseInt(rgba[3], 10).toString(16)).slice(-2)
|
|
266
|
+
: color;
|
|
267
|
+
};
|
|
268
|
+
|
|
269
|
+
const clientWidths = {
|
|
270
|
+
mobile: 767,
|
|
271
|
+
tablet: 1024
|
|
272
|
+
};
|
|
273
|
+
|
|
274
|
+
export const clientWidth = (device) => {
|
|
275
|
+
const foundDeviceWidth = get(clientWidths, device);
|
|
276
|
+
if (foundDeviceWidth) {
|
|
277
|
+
return get(global, "document.documentElement.clientWidth") <= foundDeviceWidth;
|
|
278
|
+
}
|
|
279
|
+
return false;
|
|
280
|
+
};
|
|
281
|
+
|
|
282
|
+
export const getTextColor = (theme = "rgb(255,255,255)") => {
|
|
283
|
+
const isRegexCheck = /^#([A-Fa-f0-9]{6}|[A-Fa-f0-9]{3})$/.test(theme);
|
|
284
|
+
const getHexValue = !isRegexCheck ? rgbToHex(theme) : theme;
|
|
285
|
+
const textColor = getLuminanceOfColor(getHexValue) < 155 ? "light" : "dark";
|
|
286
|
+
return textColor;
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
export function getNumberOfStoriesToShow(numberOfStoriesToShow) {
|
|
290
|
+
return numberOfStoriesToShow ? parseInt(numberOfStoriesToShow) : 1;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export const getSlot = (type, component, storyCallback, collectionCallback) => {
|
|
294
|
+
switch (type) {
|
|
295
|
+
case "story":
|
|
296
|
+
return storyCallback();
|
|
297
|
+
case "collection":
|
|
298
|
+
return collectionCallback();
|
|
299
|
+
default:
|
|
300
|
+
return component ? component() : null;
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
|
|
304
|
+
export const getSlug = (collection, config = {}) => {
|
|
305
|
+
const { magazineSlug = "", isArchivePage = false, "sketches-host": sketchesHost } = config;
|
|
306
|
+
if (isArchivePage) {
|
|
307
|
+
return getPath(sketchesHost, `/magazine/archive/${magazineSlug}`);
|
|
308
|
+
}
|
|
309
|
+
if (magazineSlug) {
|
|
310
|
+
return getPath(sketchesHost, `/magazine/${magazineSlug}/${collection.slug}`);
|
|
311
|
+
}
|
|
312
|
+
const isSection = collection.template === "section";
|
|
313
|
+
if (isSection) {
|
|
314
|
+
const sectionId = get(collection, ["metadata", "section", "0", "id"], "");
|
|
315
|
+
const { sections } = config;
|
|
316
|
+
const section = sections && sections.find((section) => section.id === sectionId);
|
|
317
|
+
return section ? section["section-url"] : getPath(sketchesHost, "/");
|
|
318
|
+
}
|
|
319
|
+
return getPath(sketchesHost, `/collection/${collection.slug}`);
|
|
320
|
+
};
|
|
321
|
+
|
|
322
|
+
export function isExternalStory(story = {}) {
|
|
323
|
+
const { "story-template": storyTemplate = "", metadata = {} } = story;
|
|
324
|
+
return storyTemplate === "news-elsewhere" ? get(metadata, ["reference-url"], "") : "";
|
|
325
|
+
}
|
|
326
|
+
|
|
327
|
+
// Adds target='_blank' attribute to anchor tags if not present
|
|
328
|
+
export const updateContentLinks = (content) => {
|
|
329
|
+
let updatedContent = content;
|
|
330
|
+
const anchorTagsList = content.match(/(<a).*?(>)/g);
|
|
331
|
+
anchorTagsList &&
|
|
332
|
+
anchorTagsList.forEach((anchorTag) => {
|
|
333
|
+
const isTargetPresent = /target=/g.test(anchorTag);
|
|
334
|
+
if (!isTargetPresent) {
|
|
335
|
+
updatedContent = updatedContent.replace(
|
|
336
|
+
anchorTag,
|
|
337
|
+
`<a aria-label='content' target='_blank'${anchorTag.substring(2)}`
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
return updatedContent;
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
export const isEmpty = (value) => {
|
|
345
|
+
return (
|
|
346
|
+
value == null || // From standard.js: Always use === - but value == null is allowed to check null || undefined
|
|
347
|
+
(typeof value === "object" && Object.entries(value).length === 0 && value.constructor === Object) ||
|
|
348
|
+
(typeof value === "string" && value.trim().length === 0)
|
|
349
|
+
);
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
export const shapeConfig = PropTypes.shape({
|
|
353
|
+
"sketches-host": PropTypes.string,
|
|
354
|
+
"cdn-name": PropTypes.string,
|
|
355
|
+
"cdn-image": PropTypes.string
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
export const shapeStory = PropTypes.shape({
|
|
359
|
+
headline: PropTypes.string,
|
|
360
|
+
"last-published-at": PropTypes.number,
|
|
361
|
+
subheadline: PropTypes.string
|
|
362
|
+
});
|
|
363
|
+
|
|
364
|
+
export const getStoryUrl = (story, defaultValue = "", queryParam = {}) => {
|
|
365
|
+
const param = new URLSearchParams(queryParam);
|
|
366
|
+
const searchParam = param.toString();
|
|
367
|
+
if (get(story, ["story-template"]) === "news-elsewhere") {
|
|
368
|
+
const referenceUrl = get(story, ["metadata", "reference-url"], "");
|
|
369
|
+
return searchParam ? `${referenceUrl}?${searchParam}` : referenceUrl;
|
|
370
|
+
}
|
|
371
|
+
const storyUrl = story.url || defaultValue;
|
|
372
|
+
return searchParam ? `${storyUrl}?${searchParam}` : storyUrl;
|
|
373
|
+
};
|
|
374
|
+
|
|
375
|
+
export const detectComponent = (component, adComponent, widgetComp) => {
|
|
376
|
+
const { type } = component;
|
|
377
|
+
switch (type) {
|
|
378
|
+
case "ad":
|
|
379
|
+
return adComponent(component);
|
|
380
|
+
case "widget":
|
|
381
|
+
return widgetComp(component);
|
|
382
|
+
default:
|
|
383
|
+
return null;
|
|
384
|
+
}
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
export const facebookMobileVideoResizeFix = () => {
|
|
388
|
+
if (typeof window !== "undefined" && window.matchMedia && window.matchMedia("(max-width: 767px)").matches) {
|
|
389
|
+
const applyFixAfterTime = 3000;
|
|
390
|
+
const aspectRatioAdjustmentFactor = 0.7;
|
|
391
|
+
setTimeout(() => {
|
|
392
|
+
document
|
|
393
|
+
.querySelectorAll(".story-element-jsembed.story-element-jsembed-facebook-post span")
|
|
394
|
+
.forEach((element) => {
|
|
395
|
+
if (!element.classList.contains("fixed-mobile-fb-video")) {
|
|
396
|
+
element.style.height = `${Math.ceil(element.offsetHeight * aspectRatioAdjustmentFactor)}px`;
|
|
397
|
+
element.classList.add("fixed-mobile-fb-video");
|
|
398
|
+
}
|
|
399
|
+
});
|
|
400
|
+
}, applyFixAfterTime);
|
|
401
|
+
}
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
export const navigateTo = (dispatch, url = "") => {
|
|
405
|
+
global.app.navigateToPage(dispatch, url);
|
|
406
|
+
};
|
|
407
|
+
|
|
408
|
+
export const generateNavigateSlug = (collection = {}, config = {}, customUrlPath) => {
|
|
409
|
+
const { "sketches-host": sketchesHost } = config;
|
|
410
|
+
if (customUrlPath) {
|
|
411
|
+
return customUrlPath;
|
|
412
|
+
}
|
|
413
|
+
const { magazineSlug = "", isArchivePage = false } = config;
|
|
414
|
+
if (isArchivePage) {
|
|
415
|
+
return getPath(sketchesHost, `/magazine/archive/${magazineSlug}`);
|
|
416
|
+
}
|
|
417
|
+
if (magazineSlug) {
|
|
418
|
+
return getPath(sketchesHost, `/magazine/${magazineSlug}/${collection.slug}`);
|
|
419
|
+
}
|
|
420
|
+
if (collection) {
|
|
421
|
+
return getSlug(collection, config);
|
|
422
|
+
}
|
|
423
|
+
return getPath(sketchesHost, "/");
|
|
424
|
+
};
|
|
425
|
+
|
|
426
|
+
export const getCollectionData = async (collectionSlug, mountAtPrefix = "") => {
|
|
427
|
+
try {
|
|
428
|
+
const result = await (await fetch(
|
|
429
|
+
`${mountAtPrefix}/api/v1/collections/${collectionSlug}?item-type=story&limit=6`
|
|
430
|
+
)).json();
|
|
431
|
+
return result;
|
|
432
|
+
} catch (err) {
|
|
433
|
+
// eslint-disable-next-line no-console
|
|
434
|
+
console.error(err);
|
|
435
|
+
}
|
|
436
|
+
};
|
|
437
|
+
|
|
438
|
+
export function getAuthorTwitterUrl(author) {
|
|
439
|
+
const twitterUrl = get(author, ["social", "twitter", "url"], null);
|
|
440
|
+
const twitterHandle = get(author, ["social", "twitter", "handle"], null);
|
|
441
|
+
|
|
442
|
+
if (!author) return "";
|
|
443
|
+
|
|
444
|
+
if (twitterUrl) {
|
|
445
|
+
return twitterUrl;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
if (twitterHandle && twitterHandle.startsWith("@")) {
|
|
449
|
+
return `https://www.twitter.com/${twitterHandle.slice(1)}`;
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
if (twitterHandle) {
|
|
453
|
+
return `https://www.twitter.com/${twitterHandle}`;
|
|
454
|
+
}
|
|
455
|
+
|
|
456
|
+
return "";
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
export const getTimeStamp = ({
|
|
460
|
+
date,
|
|
461
|
+
formatter,
|
|
462
|
+
config = {},
|
|
463
|
+
languageCode,
|
|
464
|
+
isLocalizedNumber,
|
|
465
|
+
template,
|
|
466
|
+
timezone = null
|
|
467
|
+
}) => {
|
|
468
|
+
const isRelatedCollection = get(config, ["isRelatedCollection"], false);
|
|
469
|
+
if (timezone && template === "story") {
|
|
470
|
+
const { enableTimeZoneAbbr = false } = useSelector((state) =>
|
|
471
|
+
get(state, ["qt", "config", "pagebuilder-config", "general"], {})
|
|
472
|
+
);
|
|
473
|
+
const zonedTime = timezone && utcToZonedTime(date, timezone);
|
|
474
|
+
const formatZonedTime = zonedTime && format(zonedTime, "yyyy-MM-dd HH:mm:ss zzz", { timeZone: timezone });
|
|
475
|
+
|
|
476
|
+
const localeDateLanguageCode = isLocalizedNumber ? languageCode : "en";
|
|
477
|
+
const timeStamp = timestampToFormat("", "", "", date, config, localeDateLanguageCode, enableTimeZoneAbbr, timezone);
|
|
478
|
+
if (enableTimeZoneAbbr) {
|
|
479
|
+
const timeZone = timeZoneData?.find((tz) => tz.name === timezone);
|
|
480
|
+
const timeZoneAbbr = timeZone?.abbreviation || "";
|
|
481
|
+
|
|
482
|
+
return (
|
|
483
|
+
<time dateTime={formatZonedTime}>
|
|
484
|
+
{timeStamp} {timeZoneAbbr}
|
|
485
|
+
</time>
|
|
486
|
+
);
|
|
487
|
+
} else {
|
|
488
|
+
return <time dateTime={formatZonedTime}>{timeStamp}</time>;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
return (
|
|
493
|
+
<Timeago
|
|
494
|
+
date={date}
|
|
495
|
+
component={isRelatedCollection ? "div" : "time"}
|
|
496
|
+
className="arr__timeago"
|
|
497
|
+
formatter={(value, unit, suffix, date) => {
|
|
498
|
+
return formatter(value, unit, suffix, date, config, languageCode, isLocalizedNumber);
|
|
499
|
+
}}
|
|
500
|
+
/>
|
|
501
|
+
);
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
export function removeHtmlTags(str) {
|
|
505
|
+
if (str === null || str === "") return false;
|
|
506
|
+
else str = str.toString();
|
|
507
|
+
|
|
508
|
+
return str.replace(/(<([^>]+)>)/gi, "");
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
export const getSeparator = (separator, textColor) => {
|
|
512
|
+
if (separator === "divider") {
|
|
513
|
+
return <Divider color={textColor} />;
|
|
514
|
+
}
|
|
515
|
+
return <Dot color={textColor} />;
|
|
516
|
+
};
|
|
517
|
+
|
|
518
|
+
export function getStoryTemplate(story, config) {
|
|
519
|
+
const { "story-template": storyTemplate } = story;
|
|
520
|
+
const isCustomStory = !STORY_TEMPLATES.includes(storyTemplate);
|
|
521
|
+
const customStoryTemplate =
|
|
522
|
+
isCustomStory && get(config, ["customStory", `${camelCase(storyTemplate)}-story`, "storyType"], "text");
|
|
523
|
+
return isCustomStory ? kebabCase(customStoryTemplate) : storyTemplate;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
export function getTimeStampConfig(qtConfig) {
|
|
527
|
+
const { dateFormat = "dd-mon-yyyy", localization = {}, timeFormat } = get(
|
|
528
|
+
qtConfig,
|
|
529
|
+
["pagebuilder-config", "general"],
|
|
530
|
+
{}
|
|
531
|
+
);
|
|
532
|
+
const { enableLocalization = false, localizedElements = {} } = localization;
|
|
533
|
+
|
|
534
|
+
const timeStampConfig = {
|
|
535
|
+
isUpperCase: false,
|
|
536
|
+
disableMeridiem: false,
|
|
537
|
+
dateFormat,
|
|
538
|
+
timeFormat,
|
|
539
|
+
localizedMonths: enableLocalization && get(localizedElements, ["months"]),
|
|
540
|
+
localizedMeridiem: enableLocalization && get(localizedElements, ["meridiem"], {}),
|
|
541
|
+
enableLocalization
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
return timeStampConfig;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
export const getTheme = (config, layout, enableDarkModePreview) => {
|
|
548
|
+
// Just add other layouts to suuport the border theme color calculations
|
|
549
|
+
const cardColorLayouts = ["sixColSixStories"];
|
|
550
|
+
// Check if layout is in cardColorLayouts, config.showCardBgColor is true, and config.border equals "aroundBorder"
|
|
551
|
+
if (cardColorLayouts.includes(layout) && config.showCardBgColor && config.border === "aroundBorder") {
|
|
552
|
+
// Choose between darkCardBgColor or cardBgColor based on enableDarkModePreview, fallback to config.theme
|
|
553
|
+
return enableDarkModePreview ? config.darkCardBgColor || config.theme : config.cardBgColor || config.theme;
|
|
554
|
+
}
|
|
555
|
+
// Return default theme if conditions are not met
|
|
556
|
+
return config.theme;
|
|
557
|
+
};
|
|
558
|
+
|
|
559
|
+
export function getIconColor(background) {
|
|
560
|
+
const iconColor = getTextColor(background) === "light" ? "#ffffff" : "#333333";
|
|
561
|
+
return iconColor;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
export const getPath = (sketchesHost, relativePath) => {
|
|
565
|
+
try {
|
|
566
|
+
const { pathname } = new URL(sketchesHost);
|
|
567
|
+
if (pathname && pathname !== "/") {
|
|
568
|
+
return `${sketchesHost}${relativePath}`;
|
|
569
|
+
}
|
|
570
|
+
return relativePath;
|
|
571
|
+
} catch (err) {
|
|
572
|
+
console.log("Sketches host path error ---> ", err);
|
|
573
|
+
return relativePath;
|
|
574
|
+
}
|
|
575
|
+
};
|
|
576
|
+
|
|
577
|
+
export function infiniteStoryCards(infiniteScrollStyle) {
|
|
578
|
+
return infiniteScrollStyle === "read-more";
|
|
579
|
+
}
|
|
580
|
+
|
|
581
|
+
export function infiniteScrollDisabled(infiniteScrollType) {
|
|
582
|
+
if (!infiniteScrollType) return true;
|
|
583
|
+
return infiniteScrollType === "disabled";
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
export function isFallbackImgShown(isStoryPageImage, story, infiniteScrollType, infiniteScrollStyle) {
|
|
587
|
+
if (!isStoryPageImage) return true;
|
|
588
|
+
if (story?.firstStory) return false;
|
|
589
|
+
if (infiniteScrollDisabled(infiniteScrollType)) return false;
|
|
590
|
+
if (!infiniteScrollDisabled(infiniteScrollType) && !infiniteStoryCards(infiniteScrollStyle)) return false;
|
|
591
|
+
return true;
|
|
592
|
+
}
|
|
593
|
+
|
|
594
|
+
export function shouldShowAltImg(infiniteScrollType, infiniteScrollStyle, story) {
|
|
595
|
+
return !infiniteScrollDisabled(infiniteScrollType) && infiniteStoryCards(infiniteScrollStyle) && !story?.firstStory;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
export function toRelativeUrl(absoluteUrl) {
|
|
599
|
+
try {
|
|
600
|
+
const url = new URL(absoluteUrl);
|
|
601
|
+
return url.pathname + url.search + url.hash;
|
|
602
|
+
} catch (error) {
|
|
603
|
+
console.error("Invalid URL:", error);
|
|
604
|
+
return null;
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
|
|
608
|
+
export function shouldEnableTTS({ isPbTTSEnabled, audioS3key, storyAccess, languageDirection, isPbStoryView }) {
|
|
609
|
+
if (languageDirection === "rtl") return false; // rtl not yet implemented
|
|
610
|
+
if (!(isPbTTSEnabled && audioS3key)) return false; // either of pb or bold toggles disabled
|
|
611
|
+
if (storyAccess && storyAccess?.accessGranted) return true; // premium story with access granted
|
|
612
|
+
if (!storyAccess) return true; // free story
|
|
613
|
+
if (isPbStoryView) return true; // PB UI shouldn't depend on premium or free story
|
|
614
|
+
return false;
|
|
615
|
+
}
|