@mjhls/mjh-framework 1.0.98 → 1.0.99-0.next12

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.
Files changed (356) hide show
  1. package/README.md +168 -172
  2. package/dist/cjs/AD.js +32 -0
  3. package/dist/cjs/AD300x250.js +95 -0
  4. package/dist/cjs/AD300x250x600.js +112 -0
  5. package/dist/cjs/AD728x90.js +109 -0
  6. package/dist/cjs/ADFloatingFooter.js +143 -0
  7. package/dist/cjs/ADFooter.js +53 -0
  8. package/dist/cjs/ADGutter.js +115 -0
  9. package/dist/cjs/ADInfeed-cf54cb8a.js +66 -0
  10. package/dist/cjs/ADSkyscraper.js +117 -0
  11. package/dist/cjs/ADSponsoredResources.js +114 -0
  12. package/dist/cjs/ADWebcast.js +119 -0
  13. package/dist/cjs/ADWelcome.js +166 -0
  14. package/dist/cjs/ADlgInfeed-d06624d8.js +60 -0
  15. package/dist/cjs/AccordionPanel.js +94 -0
  16. package/dist/cjs/AdSlot.js +251 -0
  17. package/dist/cjs/AdSlotsProvider.js +183 -0
  18. package/dist/cjs/AlgoliaSearch.js +195 -0
  19. package/dist/cjs/AlphabeticList.js +135 -0
  20. package/dist/cjs/ArticleCarousel.js +46 -0
  21. package/dist/cjs/ArticleProgramLandingPage.js +184 -0
  22. package/dist/cjs/ArticleSeriesLandingPage.js +162 -0
  23. package/dist/cjs/ArticleSeriesListing.js +315 -0
  24. package/dist/cjs/AuthWrapper.js +720 -0
  25. package/dist/cjs/AuthorComponent-39b37d84.js +96 -0
  26. package/dist/cjs/Beam.js +350 -0
  27. package/dist/cjs/BlockContent-36e54d77.js +916 -0
  28. package/dist/cjs/Breadcrumbs.js +107 -0
  29. package/dist/cjs/CMEDeck.js +443 -0
  30. package/dist/cjs/Column1.js +39 -0
  31. package/dist/cjs/Column2.js +75 -0
  32. package/dist/cjs/Column3.js +144 -0
  33. package/dist/cjs/ConferenceArticleCard.js +93 -0
  34. package/dist/cjs/ConferenceBanner-6c9e718a.js +24 -0
  35. package/dist/cjs/ContentCardPaginated.js +417 -0
  36. package/dist/cjs/DeckContent.js +507 -0
  37. package/dist/cjs/DeckQueue.js +403 -0
  38. package/dist/cjs/DeckQueuePaginated.js +348 -0
  39. package/dist/cjs/Dfp-94f8ccdf.js +103 -0
  40. package/dist/cjs/EventsDeck.js +857 -0
  41. package/dist/cjs/ExternalResources.js +217 -0
  42. package/dist/cjs/Feature.js +129 -0
  43. package/dist/cjs/ForbesHero.js +137 -0
  44. package/dist/cjs/GridContent.js +828 -0
  45. package/dist/cjs/GridContentPaginated.js +704 -0
  46. package/dist/cjs/GridHero.js +147 -0
  47. package/dist/cjs/GroupDeck.js +314 -0
  48. package/dist/cjs/HamMagazine.js +602 -0
  49. package/dist/cjs/Header.js +39 -0
  50. package/dist/cjs/HealthCareProfessionalModal.js +78 -0
  51. package/dist/cjs/Hero.js +48 -0
  52. package/dist/cjs/HighlightenVideo.js +69 -0
  53. package/dist/cjs/HorizontalArticleListing.js +165 -0
  54. package/dist/cjs/HorizontalHero.js +111 -0
  55. package/dist/cjs/ImageSlider-a7fb6218.js +182 -0
  56. package/dist/cjs/IssueContentDeck.js +241 -0
  57. package/dist/cjs/IssueDeck.js +268 -0
  58. package/dist/cjs/IssueLanding.js +172 -0
  59. package/dist/cjs/KMTracker.js +27 -0
  60. package/dist/cjs/LeftNav.js +145 -0
  61. package/dist/cjs/MasterDeck.js +555 -0
  62. package/dist/cjs/MasterDeckPaginated.js +469 -0
  63. package/dist/cjs/MediaSeriesCard-36eab8b7.js +9502 -0
  64. package/dist/cjs/MediaSeriesLanding.js +503 -0
  65. package/dist/cjs/MediaSeriesLandingPaginated.js +529 -0
  66. package/dist/cjs/NavDvm.js +245 -0
  67. package/dist/cjs/NavFooter-3dcd99a8.js +66 -0
  68. package/dist/cjs/NavMagazine.js +595 -0
  69. package/dist/cjs/NavNative.js +861 -0
  70. package/dist/cjs/OncliveHero.js +79 -0
  71. package/dist/cjs/OncliveLargeHero.js +241 -0
  72. package/dist/cjs/PageFilter.js +72 -0
  73. package/dist/cjs/Pagination-1e0d5f1d.js +90 -0
  74. package/dist/cjs/PartnerDetailListing.js +326 -0
  75. package/dist/cjs/PartnerDetailListingPaginated.js +318 -0
  76. package/dist/cjs/PdfDownload.js +28 -0
  77. package/dist/cjs/PixelTracking.js +165 -0
  78. package/dist/cjs/PopUpModal.js +58 -0
  79. package/dist/cjs/PtceDeck.js +149 -0
  80. package/dist/cjs/PubSection.js +120 -0
  81. package/dist/cjs/PubToc.js +87 -0
  82. package/dist/cjs/PublicationDeck.js +183 -0
  83. package/dist/cjs/PublicationFeature-be5f3503.js +130 -0
  84. package/dist/cjs/PublicationLanding.js +853 -0
  85. package/dist/cjs/QueueDeckExpanded.js +1540 -0
  86. package/dist/cjs/QueueDeckExpandedPaginated.js +1388 -0
  87. package/dist/cjs/RecentNews.js +91 -0
  88. package/dist/cjs/RelatedContent.js +114 -0
  89. package/dist/cjs/RelatedTopicsDropdown.js +90 -0
  90. package/dist/cjs/RolesDeck.js +94 -0
  91. package/dist/cjs/Schema.js +101 -0
  92. package/dist/cjs/Search.js +66 -0
  93. package/dist/cjs/Segment.js +403 -0
  94. package/dist/cjs/SeriesListingDeck.js +248 -0
  95. package/dist/cjs/SeriesSlider-b94f1dd5.js +332 -0
  96. package/dist/cjs/SetCookie.js +10 -0
  97. package/dist/cjs/SideFooter.js +151 -0
  98. package/dist/cjs/SocialIcons.js +103 -0
  99. package/dist/cjs/SocialSearchComponent-b7faaedc.js +213 -0
  100. package/dist/cjs/SocialShare.js +74 -0
  101. package/dist/cjs/TaxonomyCard.js +253 -0
  102. package/dist/cjs/TaxonomyDescription.js +205 -0
  103. package/dist/cjs/TemplateNormal.js +204 -0
  104. package/dist/cjs/ThumbnailCard.js +59 -0
  105. package/dist/cjs/Ustream.js +156 -0
  106. package/dist/cjs/VerticalHero.js +74 -0
  107. package/dist/cjs/VideoProgramLandingPage.js +260 -0
  108. package/dist/cjs/VideoSeriesCard.js +88 -0
  109. package/dist/cjs/VideoSeriesFilter.js +128 -0
  110. package/dist/cjs/VideoSeriesLandingPage.js +178 -0
  111. package/dist/cjs/VideoSeriesListing.js +422 -0
  112. package/dist/cjs/View.js +2601 -0
  113. package/dist/cjs/YahooHero.js +126 -0
  114. package/dist/cjs/YoutubeGroup.js +371 -0
  115. package/dist/cjs/_commonjsHelpers-06173234.js +25 -0
  116. package/dist/cjs/_is-array-54228b29.js +74 -0
  117. package/dist/cjs/_iter-detect-b1df62f0.js +52 -0
  118. package/dist/cjs/_library-dd23b178.js +5 -0
  119. package/dist/cjs/_object-pie-083f2dd6.js +16 -0
  120. package/dist/cjs/_object-sap-d1978572.js +16 -0
  121. package/dist/cjs/_object-to-array-ce86cae7.js +25 -0
  122. package/dist/cjs/asyncToGenerator-77821af0.js +1395 -0
  123. package/dist/cjs/brightcove-react-player-loader.es-a195642e.js +2232 -0
  124. package/dist/cjs/core.get-iterator-method-5643aa10.js +584 -0
  125. package/dist/cjs/debounce-d4a2369b.js +216 -0
  126. package/dist/cjs/define-property-e8404b64.js +20 -0
  127. package/dist/cjs/defineProperty-9673846a.js +34 -0
  128. package/dist/cjs/entities-3f9d0f2f.js +506 -0
  129. package/dist/cjs/eq-5fc26c07.js +79 -0
  130. package/dist/cjs/extends-7c86182f.js +87 -0
  131. package/dist/cjs/faundadb.js +644 -0
  132. package/dist/cjs/get-5839e5b5.js +920 -0
  133. package/dist/cjs/getContentCategory-f38a4c00.js +11 -0
  134. package/dist/cjs/getKeywords.js +46 -0
  135. package/dist/cjs/getPtceActivities.js +89 -0
  136. package/dist/cjs/getQuery.js +28 -0
  137. package/dist/cjs/getRelatedArticle.js +747 -0
  138. package/dist/cjs/getRootDocGroup.js +62 -0
  139. package/dist/cjs/getSerializers.js +64 -0
  140. package/dist/cjs/getSeriesDetail.js +40 -0
  141. package/dist/cjs/getTargeting-4439c99d.js +164 -0
  142. package/dist/cjs/getTargeting.js +13 -0
  143. package/dist/cjs/iconBase-be4097c0.js +106 -0
  144. package/dist/cjs/index-0e4427c8.js +1683 -0
  145. package/dist/cjs/index-187c967e.js +54 -0
  146. package/dist/cjs/index-7361fa72.js +11305 -0
  147. package/dist/cjs/index-eadd5035.js +613 -0
  148. package/dist/cjs/index-efca863c.js +556 -0
  149. package/dist/cjs/index-f86bb269.js +1571 -0
  150. package/dist/cjs/index.es-f3e47207.js +445 -0
  151. package/dist/cjs/index.esm-2bb721c8.js +96 -0
  152. package/dist/cjs/index.esm-c1e16606.js +13 -0
  153. package/dist/cjs/index.esm-d51c9ac6.js +25 -0
  154. package/dist/cjs/index.esm-d81454e7.js +19 -0
  155. package/dist/cjs/index.js +635 -0
  156. package/dist/cjs/inherits-de66ea16.js +188 -0
  157. package/dist/cjs/isSymbol-03abbdf0.js +209 -0
  158. package/dist/cjs/js.cookie-a511c430.js +160 -0
  159. package/dist/cjs/keys-e982b3fa.js +25 -0
  160. package/dist/cjs/lodash-f0783643.js +17195 -0
  161. package/dist/cjs/main-f1c77adb.js +973 -0
  162. package/dist/cjs/moment-aca40de1.js +5669 -0
  163. package/dist/cjs/react-social-icons-af932527.js +616 -0
  164. package/dist/cjs/slicedToArray-067dd3bc.js +95 -0
  165. package/dist/cjs/smoothscroll-99df7f93.js +438 -0
  166. package/dist/cjs/stringify-f7a37a8d.js +17 -0
  167. package/dist/cjs/style-inject.es-dcee06b6.js +30 -0
  168. package/dist/cjs/timeDifferenceCalc.js +39 -0
  169. package/dist/cjs/toConsumableArray-d7797c2b.js +74 -0
  170. package/dist/cjs/toNumber-5e1fac58.js +104 -0
  171. package/dist/cjs/typeof-567e31ff.js +382 -0
  172. package/dist/cjs/urlFor.js +65 -0
  173. package/dist/cjs/urlForFile-29d3815a.js +24 -0
  174. package/dist/cjs/ustream-api-3819e4aa.js +106 -0
  175. package/dist/cjs/visibility-sensor-eb2c5b69.js +597 -0
  176. package/dist/cjs/web.dom.iterable-d98303e0.js +50 -0
  177. package/dist/esm/AD.js +26 -0
  178. package/dist/esm/AD300x250.js +89 -0
  179. package/dist/esm/AD300x250x600.js +106 -0
  180. package/dist/esm/AD728x90.js +103 -0
  181. package/dist/esm/ADFloatingFooter.js +137 -0
  182. package/dist/esm/ADFooter.js +47 -0
  183. package/dist/esm/ADGutter.js +109 -0
  184. package/dist/esm/ADInfeed-f684cac9.js +59 -0
  185. package/dist/esm/ADSkyscraper.js +111 -0
  186. package/dist/esm/ADSponsoredResources.js +108 -0
  187. package/dist/esm/ADWebcast.js +113 -0
  188. package/dist/esm/ADWelcome.js +160 -0
  189. package/dist/esm/ADlgInfeed-8c438cee.js +54 -0
  190. package/dist/esm/AccordionPanel.js +87 -0
  191. package/dist/esm/AdSlot.js +244 -0
  192. package/dist/esm/AdSlotsProvider.js +176 -0
  193. package/dist/esm/AlgoliaSearch.js +188 -0
  194. package/dist/esm/AlphabeticList.js +129 -0
  195. package/dist/esm/ArticleCarousel.js +40 -0
  196. package/dist/esm/ArticleProgramLandingPage.js +178 -0
  197. package/dist/esm/ArticleSeriesLandingPage.js +156 -0
  198. package/dist/esm/ArticleSeriesListing.js +308 -0
  199. package/dist/esm/AuthWrapper.js +714 -0
  200. package/dist/esm/AuthorComponent-defe68b6.js +90 -0
  201. package/dist/esm/Beam.js +348 -0
  202. package/dist/esm/BlockContent-c99c9a8d.js +909 -0
  203. package/dist/esm/Breadcrumbs.js +100 -0
  204. package/dist/esm/CMEDeck.js +437 -0
  205. package/dist/esm/Column1.js +29 -0
  206. package/dist/esm/Column2.js +65 -0
  207. package/dist/esm/Column3.js +134 -0
  208. package/dist/esm/ConferenceArticleCard.js +87 -0
  209. package/dist/esm/ConferenceBanner-8792ebd2.js +18 -0
  210. package/dist/esm/ContentCardPaginated.js +406 -0
  211. package/dist/esm/DeckContent.js +497 -0
  212. package/dist/esm/DeckQueue.js +393 -0
  213. package/dist/esm/DeckQueuePaginated.js +337 -0
  214. package/dist/esm/Dfp-4b99f79d.js +96 -0
  215. package/dist/esm/EventsDeck.js +844 -0
  216. package/dist/esm/ExternalResources.js +210 -0
  217. package/dist/esm/Feature.js +122 -0
  218. package/dist/esm/ForbesHero.js +131 -0
  219. package/dist/esm/GridContent.js +818 -0
  220. package/dist/esm/GridContentPaginated.js +693 -0
  221. package/dist/esm/GridHero.js +141 -0
  222. package/dist/esm/GroupDeck.js +308 -0
  223. package/dist/esm/HamMagazine.js +590 -0
  224. package/dist/esm/Header.js +30 -0
  225. package/dist/esm/HealthCareProfessionalModal.js +70 -0
  226. package/dist/esm/Hero.js +42 -0
  227. package/dist/esm/HighlightenVideo.js +63 -0
  228. package/dist/esm/HorizontalArticleListing.js +159 -0
  229. package/dist/esm/HorizontalHero.js +105 -0
  230. package/dist/esm/ImageSlider-eab2fe41.js +176 -0
  231. package/dist/esm/IssueContentDeck.js +231 -0
  232. package/dist/esm/IssueDeck.js +258 -0
  233. package/dist/esm/IssueLanding.js +166 -0
  234. package/dist/esm/KMTracker.js +25 -0
  235. package/dist/esm/LeftNav.js +136 -0
  236. package/dist/esm/MasterDeck.js +548 -0
  237. package/dist/esm/MasterDeckPaginated.js +461 -0
  238. package/dist/esm/MediaSeriesCard-99048e65.js +9492 -0
  239. package/dist/esm/MediaSeriesLanding.js +496 -0
  240. package/dist/esm/MediaSeriesLandingPaginated.js +522 -0
  241. package/dist/esm/NavDvm.js +233 -0
  242. package/dist/esm/NavFooter-e27bd93b.js +60 -0
  243. package/dist/esm/NavMagazine.js +583 -0
  244. package/dist/esm/NavNative.js +846 -0
  245. package/dist/esm/OncliveHero.js +73 -0
  246. package/dist/esm/OncliveLargeHero.js +235 -0
  247. package/dist/esm/PageFilter.js +66 -0
  248. package/dist/esm/Pagination-cd21f8c2.js +82 -0
  249. package/dist/esm/PartnerDetailListing.js +320 -0
  250. package/dist/esm/PartnerDetailListingPaginated.js +312 -0
  251. package/dist/esm/PdfDownload.js +22 -0
  252. package/dist/esm/PixelTracking.js +156 -0
  253. package/dist/esm/PopUpModal.js +51 -0
  254. package/dist/esm/PtceDeck.js +143 -0
  255. package/dist/esm/PubSection.js +114 -0
  256. package/dist/esm/PubToc.js +81 -0
  257. package/dist/esm/PublicationDeck.js +173 -0
  258. package/dist/esm/PublicationFeature-03500094.js +121 -0
  259. package/dist/esm/PublicationLanding.js +843 -0
  260. package/dist/esm/QueueDeckExpanded.js +1534 -0
  261. package/dist/esm/QueueDeckExpandedPaginated.js +1382 -0
  262. package/dist/esm/RecentNews.js +85 -0
  263. package/dist/esm/RelatedContent.js +108 -0
  264. package/dist/esm/RelatedTopicsDropdown.js +82 -0
  265. package/dist/esm/RolesDeck.js +84 -0
  266. package/dist/esm/Schema.js +95 -0
  267. package/dist/esm/Search.js +57 -0
  268. package/dist/esm/Segment.js +401 -0
  269. package/dist/esm/SeriesListingDeck.js +242 -0
  270. package/dist/esm/SeriesSlider-609f9d94.js +326 -0
  271. package/dist/esm/SetCookie.js +8 -0
  272. package/dist/esm/SideFooter.js +145 -0
  273. package/dist/esm/SocialIcons.js +97 -0
  274. package/dist/esm/SocialSearchComponent-1d8a9f59.js +204 -0
  275. package/dist/esm/SocialShare.js +67 -0
  276. package/dist/esm/TaxonomyCard.js +243 -0
  277. package/dist/esm/TaxonomyDescription.js +198 -0
  278. package/dist/esm/TemplateNormal.js +197 -0
  279. package/dist/esm/ThumbnailCard.js +52 -0
  280. package/dist/esm/Ustream.js +150 -0
  281. package/dist/esm/VerticalHero.js +68 -0
  282. package/dist/esm/VideoProgramLandingPage.js +251 -0
  283. package/dist/esm/VideoSeriesCard.js +82 -0
  284. package/dist/esm/VideoSeriesFilter.js +122 -0
  285. package/dist/esm/VideoSeriesLandingPage.js +172 -0
  286. package/dist/esm/VideoSeriesListing.js +415 -0
  287. package/dist/esm/View.js +2590 -0
  288. package/dist/esm/YahooHero.js +120 -0
  289. package/dist/esm/YoutubeGroup.js +365 -0
  290. package/dist/esm/_commonjsHelpers-0c4b6f40.js +19 -0
  291. package/dist/esm/_is-array-893ab020.js +71 -0
  292. package/dist/esm/_iter-detect-f089461c.js +48 -0
  293. package/dist/esm/_library-528f1934.js +3 -0
  294. package/dist/esm/_object-pie-133f504a.js +13 -0
  295. package/dist/esm/_object-sap-169d6272.js +14 -0
  296. package/dist/esm/_object-to-array-50a6b9a3.js +23 -0
  297. package/dist/esm/asyncToGenerator-9716ae8d.js +1387 -0
  298. package/dist/esm/brightcove-react-player-loader.es-57a70a56.js +2226 -0
  299. package/dist/esm/core.get-iterator-method-e903ff31.js +547 -0
  300. package/dist/esm/debounce-533d9748.js +214 -0
  301. package/dist/esm/define-property-99e66838.js +18 -0
  302. package/dist/esm/defineProperty-8fa0bc8d.js +32 -0
  303. package/dist/esm/entities-932b50cf.js +503 -0
  304. package/dist/esm/eq-bdcbf886.js +76 -0
  305. package/dist/esm/extends-dc6a71fd.js +83 -0
  306. package/dist/esm/faundadb.js +636 -0
  307. package/dist/esm/get-3c308da4.js +918 -0
  308. package/dist/esm/getContentCategory-15dcc413.js +9 -0
  309. package/dist/esm/getKeywords.js +44 -0
  310. package/dist/esm/getPtceActivities.js +87 -0
  311. package/dist/esm/getQuery.js +26 -0
  312. package/dist/esm/getRelatedArticle.js +745 -0
  313. package/dist/esm/getRootDocGroup.js +60 -0
  314. package/dist/esm/getSerializers.js +58 -0
  315. package/dist/esm/getSeriesDetail.js +38 -0
  316. package/dist/esm/getTargeting-db566006.js +161 -0
  317. package/dist/esm/getTargeting.js +7 -0
  318. package/dist/esm/iconBase-ccc56b97.js +81 -0
  319. package/dist/esm/index-0dbff1d1.js +553 -0
  320. package/dist/esm/index-5cc7b406.js +1674 -0
  321. package/dist/esm/index-755f2cc2.js +605 -0
  322. package/dist/esm/index-79cfd25c.js +1569 -0
  323. package/dist/esm/index-c60f3bb6.js +11284 -0
  324. package/dist/esm/index-c7e2ac95.js +52 -0
  325. package/dist/esm/index.es-a6137319.js +439 -0
  326. package/dist/esm/index.esm-1bd8a0a8.js +18 -0
  327. package/dist/esm/index.esm-37268dca.js +89 -0
  328. package/dist/esm/index.esm-9b042655.js +10 -0
  329. package/dist/esm/index.esm-eb1e8e80.js +14 -0
  330. package/dist/esm/index.js +529 -0
  331. package/dist/esm/inherits-8a801a18.js +179 -0
  332. package/dist/esm/isSymbol-a7e9aafe.js +203 -0
  333. package/dist/esm/js.cookie-6874175c.js +158 -0
  334. package/dist/esm/keys-425c8ab0.js +23 -0
  335. package/dist/esm/lodash-f97fd99a.js +17193 -0
  336. package/dist/esm/main-1894c974.js +961 -0
  337. package/dist/esm/moment-bc12cb97.js +5667 -0
  338. package/dist/esm/react-social-icons-9be47857.js +609 -0
  339. package/dist/esm/slicedToArray-ca2c8b8d.js +92 -0
  340. package/dist/esm/smoothscroll-fa4e3f8c.js +436 -0
  341. package/dist/esm/stringify-c21932b3.js +15 -0
  342. package/dist/esm/style-inject.es-1f59c1d0.js +28 -0
  343. package/dist/esm/timeDifferenceCalc.js +37 -0
  344. package/dist/esm/toConsumableArray-7b1c0e23.js +71 -0
  345. package/dist/esm/toNumber-5aeba6e7.js +102 -0
  346. package/dist/esm/typeof-83d9eb10.js +378 -0
  347. package/dist/esm/urlFor.js +63 -0
  348. package/dist/esm/urlForFile-413f5ddb.js +22 -0
  349. package/dist/esm/ustream-api-41166338.js +104 -0
  350. package/dist/esm/visibility-sensor-72fd8f8b.js +590 -0
  351. package/dist/esm/web.dom.iterable-fdf034f5.js +48 -0
  352. package/package.json +115 -83
  353. package/dist/index.es.js +0 -12784
  354. package/dist/index.es.js.map +0 -1
  355. package/dist/index.js +0 -12819
  356. package/dist/index.js.map +0 -1
@@ -0,0 +1,2590 @@
1
+ import { _ as _asyncToGenerator, r as regenerator, a as _Promise } from './asyncToGenerator-9716ae8d.js';
2
+ import { _ as _extends, a as _Object$assign } from './extends-dc6a71fd.js';
3
+ import { a as _getIterator, _ as _slicedToArray } from './slicedToArray-ca2c8b8d.js';
4
+ import React__default, { useState, useRef, useEffect, forwardRef } from 'react';
5
+ import Head from 'next/head';
6
+ import { useRouter } from 'next/router';
7
+ import { _ as _JSON$stringify } from './stringify-c21932b3.js';
8
+ import { _ as _toConsumableArray } from './toConsumableArray-7b1c0e23.js';
9
+ import { m as moment } from './moment-bc12cb97.js';
10
+ import { B as BlockContent } from './BlockContent-c99c9a8d.js';
11
+ import { m as main_43 } from './main-1894c974.js';
12
+ import 'react-bootstrap/Dropdown';
13
+ import Form from 'react-bootstrap/Form';
14
+ import FormControl from 'react-bootstrap/FormControl';
15
+ import Button from 'react-bootstrap/Button';
16
+ import { V as VisibilitySensor } from './visibility-sensor-72fd8f8b.js';
17
+ import SocialShare from './SocialShare.js';
18
+ import { r as renderAuthor, g as getSerializers } from './index-c60f3bb6.js';
19
+ import DFPAdSlot from './AdSlot.js';
20
+ import { S as SeriesSlider } from './SeriesSlider-609f9d94.js';
21
+ import { a as getContentPlacementUrl, g as getTargeting } from './getTargeting-db566006.js';
22
+ import getKeywords from './getKeywords.js';
23
+ import urlFor from './urlFor.js';
24
+ import { u as urlForFile } from './urlForFile-413f5ddb.js';
25
+ import { _ as _typeof } from './typeof-83d9eb10.js';
26
+ import { b as FaMinus, c as FaPlus } from './index.esm-1bd8a0a8.js';
27
+ import { s as styleInject } from './style-inject.es-1f59c1d0.js';
28
+ import './index-755f2cc2.js';
29
+ import { DiscussionEmbed } from 'disqus-react';
30
+ import Schema from './Schema.js';
31
+ import FileSaver from 'file-saver';
32
+ import { PixelTrackingArticle } from './PixelTracking.js';
33
+ import { _ as _Object$keys } from './keys-425c8ab0.js';
34
+ import { I as InfiniteScroll } from './index.es-a6137319.js';
35
+ import { l as lib_3 } from './index-5cc7b406.js';
36
+ import getRelatedArticle from './getRelatedArticle.js';
37
+ import getQuery from './getQuery.js';
38
+ import getSeriesDetail from './getSeriesDetail.js';
39
+ import './_commonjsHelpers-0c4b6f40.js';
40
+ import './core.get-iterator-method-e903ff31.js';
41
+ import './web.dom.iterable-fdf034f5.js';
42
+ import './_library-528f1934.js';
43
+ import './_iter-detect-f089461c.js';
44
+ import './_object-pie-133f504a.js';
45
+ import 'prop-types';
46
+ import './index-0dbff1d1.js';
47
+ import 'react-dom';
48
+ import 'react-share';
49
+ import 'react-bootstrap';
50
+ import './index-c7e2ac95.js';
51
+ import './Beam.js';
52
+ import './Segment.js';
53
+ import './brightcove-react-player-loader.es-57a70a56.js';
54
+ import 'react-bootstrap/Modal';
55
+ import 'react-ga';
56
+ import './GroupDeck.js';
57
+ import './smoothscroll-fa4e3f8c.js';
58
+ import './_is-array-893ab020.js';
59
+ import './_object-to-array-50a6b9a3.js';
60
+ import 'react-bootstrap/Pagination';
61
+ import './entities-932b50cf.js';
62
+ import 'react-bootstrap/Row';
63
+ import 'react-bootstrap/Col';
64
+ import './inherits-8a801a18.js';
65
+ import './_object-sap-169d6272.js';
66
+ import './define-property-99e66838.js';
67
+ import './index.esm-eb1e8e80.js';
68
+ import './iconBase-ccc56b97.js';
69
+ import 'react-bootstrap/Figure';
70
+ import 'react-bootstrap/OverlayTrigger';
71
+ import 'react-bootstrap/Tooltip';
72
+ import 'react-bootstrap/Popover';
73
+ import './debounce-533d9748.js';
74
+ import './isSymbol-a7e9aafe.js';
75
+ import './toNumber-5aeba6e7.js';
76
+
77
+ var getArticleSummary = function getArticleSummary(article) {
78
+ if (article.summary && article.summary.length > 0) {
79
+ return article.summary;
80
+ } else {
81
+ return false;
82
+ }
83
+ };
84
+
85
+ var getDocumentGroupUrl = function getDocumentGroupUrl(docGroup) {
86
+ if (!docGroup) {
87
+ return null;
88
+ }
89
+ var url = void 0;
90
+
91
+ if (docGroup.path && docGroup.path.includes('/') && (!docGroup.parent || !docGroup.parent.parent)) {
92
+ return '/' + docGroup.path;
93
+ }
94
+ // Checking if Parent has Parent
95
+ if (docGroup.path && docGroup.path.includes('/') && docGroup.parent && docGroup.parent.parent) {
96
+ if (docGroup.path.includes(docGroup.parent.identifier.current)) {
97
+ return '/' + docGroup.parent.parent.identifier.current + '/' + docGroup.path;
98
+ } else {
99
+ return '/' + docGroup.parent.parent.identifier.current + '/' + docGroup.parent.identifier.current + '/' + docGroup.path;
100
+ }
101
+ }
102
+
103
+ if (docGroup.parent) {
104
+ url = '/' + docGroup.parent.identifier.current;
105
+ if (docGroup.parent.parent && docGroup.parent.parent.name) {
106
+ url = '/' + docGroup.parent.parent.identifier.current + url;
107
+ }
108
+ }
109
+
110
+ if (!docGroup.thumbnail) ;
111
+ if (typeof url != 'undefined') {
112
+ url = url + '/' + docGroup.path;
113
+ } else {
114
+ url = '/' + docGroup.path;
115
+ }
116
+
117
+ return url;
118
+ };
119
+
120
+ var getDocumentGroupName = function getDocumentGroupName(docGroup) {
121
+ var name = void 0;
122
+ if (!docGroup) {
123
+ return null;
124
+ }
125
+
126
+ if (docGroup.parent) {
127
+ name = docGroup.parent.name;
128
+
129
+ if (docGroup.parent.parent && docGroup.parent.parent.name) {
130
+ name = docGroup.parent.parent.name + ' | ' + name;
131
+ }
132
+ }
133
+
134
+ //if (!docGroup.thumbnail) {
135
+ if (typeof name != 'undefined') {
136
+ name = name + ' | <b>' + docGroup.name + '</b>';
137
+ } else {
138
+ name = '<b>' + docGroup.name + '</b>';
139
+ }
140
+ //}
141
+
142
+ return name && typeof name != 'undefined' ? name : null;
143
+ };
144
+
145
+ var DocumentGroup = function DocumentGroup(_ref) {
146
+ var article = _ref.article,
147
+ client = _ref.client;
148
+
149
+ var mediaSeriesGroup = null;
150
+
151
+ if (article.documentGroup && article.documentGroup.isShow !== false && article.documentGroup.isSeries !== true) {
152
+ mediaSeriesGroup = article.documentGroup;
153
+ }
154
+ if (!article.documentGroup && article.documentGroupMapping) {
155
+ for (var i = 0; i < article.documentGroupMapping.length; i++) {
156
+ if (article.documentGroupMapping[i].isShow !== false && article.documentGroupMapping[i].isSeries !== true) {
157
+ mediaSeriesGroup = article.documentGroupMapping[i];
158
+ break;
159
+ }
160
+ }
161
+ }
162
+
163
+ if (!mediaSeriesGroup) {
164
+ return null;
165
+ }
166
+
167
+ var name = getDocumentGroupName(mediaSeriesGroup);
168
+ var url = getDocumentGroupUrl(mediaSeriesGroup);
169
+ var thumbnailUrl = false;
170
+
171
+ if (mediaSeriesGroup.thumbnail) {
172
+ thumbnailUrl = urlFor({ client: client, source: mediaSeriesGroup.thumbnail });
173
+ }
174
+
175
+ return React__default.createElement(
176
+ 'a',
177
+ {
178
+ href: url,
179
+ className: 'doc-group',
180
+ style: { display: 'flex', flexDirection: 'column', padding: '0 1rem', justifyContent: thumbnailUrl ? 'center' : 'flex-start', alignItems: 'center' } },
181
+ thumbnailUrl && React__default.createElement('img', { style: { maxWidth: '220px', maxHeight: '100px', marginTop: '1rem' }, src: thumbnailUrl, alt: name }),
182
+ !thumbnailUrl && React__default.createElement('p', {
183
+ style: { maxWidth: '315px', margin: '0', color: 'var(--primary)', textAlign: thumbnailUrl ? 'center' : main_43 ? 'left' : 'right', marginTop: '.25rem' },
184
+ dangerouslySetInnerHTML: { __html: name } }),
185
+ main_43 && !thumbnailUrl && React__default.createElement(
186
+ 'style',
187
+ { jsx: 'true' },
188
+ '\n a.doc-group {\n display: block !important;\n padding: 0 !important;\n }\n '
189
+ )
190
+ );
191
+ };
192
+
193
+ var findIndex = function findIndex(arr) {
194
+ var indexes = [];
195
+ if ((typeof arr === 'undefined' ? 'undefined' : _typeof(arr)) === 'object') {
196
+ var _iteratorNormalCompletion = true;
197
+ var _didIteratorError = false;
198
+ var _iteratorError = undefined;
199
+
200
+ try {
201
+ for (var _iterator = _getIterator(arr), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
202
+ var ele = _step.value;
203
+
204
+ if (ele['_type'] === 'block' && ele.children.some(function (child) {
205
+ return child.text.trim().length > 0;
206
+ }) && ele['listItem'] !== 'bullet' &&
207
+ // To skip li tags when setting contextual native ads
208
+ ele['listItem'] !== 'number' && ele['style'] === 'normal' || ele['_type'] === 'figure') {
209
+ indexes.push(arr.indexOf(ele));
210
+ }
211
+ }
212
+ } catch (err) {
213
+ _didIteratorError = true;
214
+ _iteratorError = err;
215
+ } finally {
216
+ try {
217
+ if (!_iteratorNormalCompletion && _iterator.return) {
218
+ _iterator.return();
219
+ }
220
+ } finally {
221
+ if (_didIteratorError) {
222
+ throw _iteratorError;
223
+ }
224
+ }
225
+ }
226
+ }
227
+ return indexes;
228
+ };
229
+
230
+ var ISI = function ISI(props) {
231
+ var children = props.children;
232
+
233
+ var _useState = useState(false),
234
+ _useState2 = _slicedToArray(_useState, 2),
235
+ active = _useState2[0],
236
+ setActive = _useState2[1];
237
+
238
+ var _useState3 = useState(false),
239
+ _useState4 = _slicedToArray(_useState3, 2),
240
+ bottomOfArticle = _useState4[0],
241
+ setbottomOfArticle = _useState4[1];
242
+
243
+ var isi = useRef();
244
+
245
+ useEffect(function () {
246
+ if (active) {
247
+ var offset = '5rem';
248
+ var nav = document.getElementsByTagName('header');
249
+ if (nav && nav.length > 0) {
250
+ offset = nav[0].offsetHeight + 'px';
251
+ }
252
+ isi.current.style.maxHeight = 'calc(100% - ' + offset + ')';
253
+ isi.current.style.overflowY = 'scroll';
254
+ } else {
255
+ isi.current.style.maxHeight = '';
256
+ isi.current.style.overflowY = '';
257
+ }
258
+ }, [active]);
259
+ useEffect(function () {
260
+ var detectBottomOfArticle = function detectBottomOfArticle() {
261
+ var article_body = document.getElementById('article__block');
262
+ var isi = document.getElementById('isi');
263
+ var articleBottomPosition = article_body.getBoundingClientRect().bottom - window.innerHeight;
264
+ // console.log(articleBottomPosition, bottomOfArticle)
265
+ if (articleBottomPosition < 30 && !isi.classList.contains('in-view')) {
266
+ setbottomOfArticle(true);
267
+ }
268
+ if (articleBottomPosition > 60 && isi.classList.contains('in-view')) {
269
+ setbottomOfArticle(false);
270
+ }
271
+ };
272
+ window.addEventListener('scroll', detectBottomOfArticle);
273
+ return function () {
274
+ return window.removeEventListener('scroll', detectBottomOfArticle);
275
+ };
276
+ }, []);
277
+
278
+ useEffect(function () {
279
+ var isi = document.getElementById('isi');
280
+ if (bottomOfArticle) {
281
+ toggleSticky(true);
282
+ isi.classList.add('in-view');
283
+ if (active) {
284
+ setActive(false);
285
+ }
286
+ }
287
+ if (!bottomOfArticle) {
288
+ toggleSticky(false);
289
+ isi.classList.remove('in-view');
290
+ }
291
+ }, [bottomOfArticle]);
292
+
293
+ var toggleSticky = function toggleSticky(sticky) {
294
+ var isiToggle = document.getElementById('isiToggle');
295
+ var isiContent = document.getElementById('isiContent');
296
+ var isi = document.getElementById('isi');
297
+ if (sticky) {
298
+ isi.style.bottom = '-200px';
299
+ setTimeout(function () {
300
+ isi.style.maxHeight = 'unset';
301
+ isi.style.position = 'relative';
302
+ isi.style.boxShadow = 'none';
303
+ isi.style.zIndex = '1';
304
+ isi.style.marginTop = '-25rem';
305
+ isi.style.marginBottom = '15rem';
306
+ isiToggle.style.display = 'none';
307
+ isiContent.style.padding = '0';
308
+ }, 300);
309
+ } else if (!sticky) {
310
+
311
+ isi.style.marginBottom = '0';
312
+ isi.style.maxHeight = '12rem';
313
+ isi.style.position = 'fixed';
314
+ isi.style.boxShadow = '0 0 1rem 0 rgba(0, 0, 0, 0.5)';
315
+ isi.style.zIndex = '99999';
316
+
317
+ isiToggle.style.display = 'block';
318
+ isiContent.style.padding = '1rem';
319
+ setTimeout(function () {
320
+ isi.style.bottom = '0';
321
+ isi.style.marginTop = '0';
322
+ }, 300);
323
+ }
324
+ };
325
+ return React__default.createElement(
326
+ React__default.Fragment,
327
+ null,
328
+ React__default.createElement(
329
+ 'div',
330
+ { id: 'isi', ref: isi },
331
+ React__default.createElement(
332
+ 'div',
333
+ { id: 'isiContent' },
334
+ React__default.createElement(
335
+ 'div',
336
+ { onClick: function onClick() {
337
+ return setActive(function (prev) {
338
+ return !prev;
339
+ });
340
+ }, id: 'isiToggle' },
341
+ active ? React__default.createElement(
342
+ 'p',
343
+ null,
344
+ 'Close ',
345
+ React__default.createElement(FaMinus, null)
346
+ ) : React__default.createElement(
347
+ 'p',
348
+ null,
349
+ 'See More ',
350
+ React__default.createElement(FaPlus, null)
351
+ )
352
+ ),
353
+ children
354
+ )
355
+ ),
356
+ React__default.createElement(
357
+ 'style',
358
+ { jsx: true },
359
+ '\n #isi {\n position: fixed;\n z-index: 9999999;\n bottom: 0;\n left: 0;\n max-height: 12rem;\n background-color: #ffffff;\n overflow-x: hidden;\n overflow-y: hidden;\n width: 100%;\n box-shadow: 0 0 1rem 0 rgba(0, 0, 0, 0.5);\n transition: bottom .5s ease , margin-top .3s, max-height .2s;\n }\n #isiContent {\n width: 100%;\n max-width: 1000px;\n margin-left: auto;\n margin-right: auto;\n position: relative;\n padding: 1rem;\n font-size: 1rem;\n }\n #isi::-webkit-scrollbar {\n display: none;\n }\n #isiToggle {\n position: absolute;\n top: 0;\n right: 0;\n padding: 1rem;\n font-weight: bold;\n cursor: pointer;\n font-size: 1rem;\n }\n #isiToggle p {\n margin: 0;\n }\n '
360
+ )
361
+ );
362
+ };
363
+
364
+ var css$1 = ".RelatedArticles-module_mediaContainer__10h9k {\r\n display: flex;\r\n flex-direction: row;\r\n flex-wrap: nowrap;\r\n margin: 0 -1rem;\r\n}\r\n.RelatedArticles-module_mediaCard__3wQbn {\r\n margin: 0 1rem 1rem;\r\n width: calc(33% - 1rem);\r\n display: column;\r\n flex-direction: row;\r\n margin-bottom: 0.75rem;\r\n padding-bottom: 0.75rem;\r\n border-bottom: none;\r\n}\r\n.RelatedArticles-module_mediaCard__3wQbn:last-child {\r\n border-bottom: none;\r\n}\r\n.RelatedArticles-module_cardTitle__3P-Ib {\r\n font-weight: bold;\r\n color: #252525;\r\n margin-bottom: 0.25rem;\r\n font-size: 15px;\r\n}\r\n.RelatedArticles-module_authorListing__1EFg4 span.RelatedArticles-module_text-muted__3b0zX {\r\n color: #000;\r\n font-weight: bold;\r\n}\r\n.RelatedArticles-module_cardDate__1wOR5 {\r\n color: var(--dark);\r\n display: block;\r\n background: #fff !important;\r\n margin-bottom: 0;\r\n}\r\n.RelatedArticles-module_imgWrapper__5Jx_4 {\r\n display: block;\r\n text-align: center;\r\n margin-bottom: 0.5rem;\r\n}\r\n.RelatedArticles-module_imgWrapper__5Jx_4 img {\r\n height: 135px;\r\n width: 100%;\r\n object-fit: cover;\r\n object-position: center;\r\n}\r\n@media screen and (max-width: 1064px) {\r\n}\r\n@media screen and (max-width: 968px) {\r\n .RelatedArticles-module_mediaContainer__10h9k {\r\n flex-wrap: wrap;\r\n }\r\n .RelatedArticles-module_imgWrapper__5Jx_4 {\r\n display: none;\r\n }\r\n .RelatedArticles-module_mediaCard__3wQbn {\r\n width: 100%;\r\n margin-bottom: 0.5rem;\r\n padding: 0;\r\n }\r\n .RelatedArticles-module_cardTitle__3P-Ib {\r\n font-size: 0.75rem;\r\n margin-bottom: 0;\r\n }\r\n}\r\n";
365
+ var styles$1 = { "mediaContainer": "RelatedArticles-module_mediaContainer__10h9k", "mediaCard": "RelatedArticles-module_mediaCard__3wQbn", "cardTitle": "RelatedArticles-module_cardTitle__3P-Ib", "authorListing": "RelatedArticles-module_authorListing__1EFg4", "text-muted": "RelatedArticles-module_text-muted__3b0zX", "cardDate": "RelatedArticles-module_cardDate__1wOR5", "imgWrapper": "RelatedArticles-module_imgWrapper__5Jx_4" };
366
+ styleInject(css$1);
367
+
368
+ var RelatedArticle = function RelatedArticle(_ref) {
369
+ var articles = _ref.articles,
370
+ client = _ref.client,
371
+ fallbackImage = _ref.fallbackImage,
372
+ _ref$showRelatedArtic = _ref.showRelatedArticleFallbackImage,
373
+ showRelatedArticleFallbackImage = _ref$showRelatedArtic === undefined ? true : _ref$showRelatedArtic;
374
+
375
+ if (!articles || articles.length == 0 || !articles[0]) {
376
+ return null;
377
+ }
378
+ return React__default.createElement(
379
+ 'div',
380
+ { className: styles$1.mediaContainer },
381
+ articles.map(function (article, index) {
382
+ if (article && article.url && article.url.current) {
383
+ return React__default.createElement(
384
+ 'div',
385
+ { id: 'related-card', key: index, className: styles$1.mediaCard },
386
+ React__default.createElement(
387
+ 'a',
388
+ { className: styles$1.imgWrapper, href: '/view/' + (article.url ? article.url.current : '') },
389
+ article.thumbnail ? React__default.createElement('img', {
390
+ style: { objectFit: 'cover', objectPosition: 'center' },
391
+ src: article.thumbnail && urlFor({ client: client, source: article.thumbnail.asset, imageWidth: 250 }),
392
+ alt: article.title
393
+ }) : React__default.createElement(
394
+ React__default.Fragment,
395
+ null,
396
+ fallbackImage && showRelatedArticleFallbackImage && React__default.createElement('img', { src: fallbackImage, alt: 'website logo', style: { objectFit: 'contain' } })
397
+ )
398
+ ),
399
+ React__default.createElement(
400
+ 'div',
401
+ { className: styles$1.mediaBody },
402
+ React__default.createElement(
403
+ 'a',
404
+ { href: '/view/' + (article.url ? article.url.current : '') },
405
+ React__default.createElement(
406
+ 'div',
407
+ { className: styles$1.cardTitle },
408
+ article.title
409
+ )
410
+ )
411
+ )
412
+ );
413
+ }
414
+ })
415
+ );
416
+ };
417
+
418
+ var getSocialShareDisableFlag = function getSocialShareDisableFlag(article) {
419
+ //Need to check Taxonomy, DocumentGroup, and Authors for showSocialShare
420
+ var showSocialShare = true;
421
+ if (article.showSocialShare === true) {
422
+ return showSocialShare;
423
+ }
424
+
425
+ if (article.showSocialShare === false) {
426
+ showSocialShare = false;
427
+ return showSocialShare;
428
+ }
429
+
430
+ if (article.content_placement && article.content_placement.length > 0) {
431
+ //loop through each
432
+ article.content_placement.forEach(function (category) {
433
+ if (category.showSocialShare === false) {
434
+ showSocialShare = false;
435
+ }
436
+ });
437
+ }
438
+ if (article.authorDetails && article.authorDetails.length > 0) {
439
+ article.authorDetails.forEach(function (author) {
440
+ if (author.showSocialShare === false) {
441
+ showSocialShare = false;
442
+ }
443
+ });
444
+ }
445
+ if (article.documentGroup && article.documentGroup.length > 0) {
446
+ article.documentGroup.forEach(function (docGroup) {
447
+ if (docGroup.showSocialShare === false) {
448
+ showSocialShare = false;
449
+ }
450
+ });
451
+ }
452
+ if (article.documentGroupMapping && article.documentGroupMapping.length > 0) {
453
+ article.documentGroupMapping.forEach(function (docGroup) {
454
+ if (docGroup.showSocialShare === false) {
455
+ showSocialShare = false;
456
+ }
457
+ });
458
+ }
459
+
460
+ return showSocialShare;
461
+ };
462
+
463
+ var css = ".RecommendedArticles-module_recommendTitle__2kUji {\r\n border-bottom: 2px solid var(--secondary-blue);\r\n font-size: 1.5rem;\r\n font-weight: bold;\r\n color: #0d335a;\r\n padding: 0.5rem;\r\n}\r\n.RecommendedArticles-module_recommendContainer__sZukI {\r\n display: flex;\r\n flex-direction: row;\r\n flex-wrap: wrap;\r\n margin: 0 -0.5rem;\r\n}\r\n.RecommendedArticles-module_recommendTop__1_yqw {\r\n margin: 0.5rem;\r\n width: 100%;\r\n flex-basis: 100%;\r\n display: flex;\r\n\r\n}\r\n.RecommendedArticles-module_recommendTopImg__1b9gu {\r\n min-width: 55%;\r\n width: 55%;\r\n height: 100%;\r\n}\r\n.RecommendedArticles-module_recommendTopImg__1b9gu img {\r\n width: 100%;\r\n height: 100%;\r\n object-fit: cover;\r\n}\r\n.RecommendedArticles-module_recommendTopBody__-13FI {\r\n margin-left: 1rem;\r\n line-height: 1.3;\r\n color: #121212;\r\n display: flex;\r\n flex-direction: column;\r\n}\r\n.RecommendedArticles-module_topTitle__2EafN {\r\n font-size: 25px;\r\n font-weight: bold;\r\n margin-bottom: 0.5rem;\r\n}\r\n.RecommendedArticles-module_topBody__2_VNi {\r\n font-size: 19px;\r\n margin-bottom: 0.5rem;\r\n}\r\n.RecommendedArticles-module_topLink__2RnXu {\r\n font-size: 19px;\r\n color: rgb(43, 43, 151);\r\n text-decoration: underline;\r\n margin-top: auto;\r\n}\r\n.RecommendedArticles-module_smContainer__4byBO {\r\n width: calc(25% - 1rem);\r\n margin: 0 0.5rem;\r\n}\r\n.RecommendedArticles-module_smImage__TYZGY img {\r\n width: 100%;\r\n}\r\n.RecommendedArticles-module_title__3q1ud {\r\n margin-top: 1rem;\r\n line-height: 1.2;\r\n color: #121212;\r\n}\r\n.RecommendedArticles-module_category__2jRto {\r\n text-transform: uppercase;\r\n font-size: 16px;\r\n letter-spacing: 2px;\r\n margin: 0.25rem 0;\r\n}\r\n\r\n/* media query */\r\n\r\n@media screen and (max-width: 1399px) {\r\n .RecommendedArticles-module_topTitle__2EafN {\r\n font-size: 21px;\r\n }\r\n .RecommendedArticles-module_topBody__2_VNi {\r\n font-size: 15px;\r\n }\r\n}\r\n@media screen and (max-width: 1191px) {\r\n .RecommendedArticles-module_topTitle__2EafN {\r\n font-size: 23px;\r\n }\r\n .RecommendedArticles-module_topBody__2_VNi,\r\n .RecommendedArticles-module_topLink__2RnXu {\r\n font-size: 17px;\r\n }\r\n}\r\n@media screen and (max-width: 968px) {\r\n .RecommendedArticles-module_topTitle__2EafN {\r\n font-size: 18px;\r\n }\r\n .RecommendedArticles-module_topBody__2_VNi,\r\n .RecommendedArticles-module_topLink__2RnXu {\r\n font-size: 15px;\r\n }\r\n}\r\n@media screen and (max-width: 768px) {\r\n .RecommendedArticles-module_recommendTop__1_yqw {\r\n flex-direction: column;\r\n }\r\n .RecommendedArticles-module_recommendTopImg__1b9gu,\r\n .RecommendedArticles-module_recommendTopBody__-13FI {\r\n width: 100%;\r\n margin: 0;\r\n }\r\n .RecommendedArticles-module_recommendTopBody__-13FI {\r\n margin-bottom: 1rem;\r\n }\r\n .RecommendedArticles-module_smContainer__4byBO {\r\n width: calc(50% - 1rem);\r\n }\r\n}";
464
+ var styles = { "recommendTitle": "RecommendedArticles-module_recommendTitle__2kUji", "recommendContainer": "RecommendedArticles-module_recommendContainer__sZukI", "recommendTop": "RecommendedArticles-module_recommendTop__1_yqw", "recommendTopImg": "RecommendedArticles-module_recommendTopImg__1b9gu", "recommendTopBody": "RecommendedArticles-module_recommendTopBody__-13FI", "topTitle": "RecommendedArticles-module_topTitle__2EafN", "topBody": "RecommendedArticles-module_topBody__2_VNi", "topLink": "RecommendedArticles-module_topLink__2RnXu", "smContainer": "RecommendedArticles-module_smContainer__4byBO", "smImage": "RecommendedArticles-module_smImage__TYZGY", "title": "RecommendedArticles-module_title__3q1ud", "category": "RecommendedArticles-module_category__2jRto" };
465
+ styleInject(css);
466
+
467
+ var _this$2 = undefined;
468
+
469
+ var Recommended = function Recommended(props) {
470
+ var article = props.article,
471
+ client = props.client,
472
+ _props$index = props.index,
473
+ index = _props$index === undefined ? 0 : _props$index,
474
+ cpModificationRequired = props.cpModificationRequired;
475
+
476
+ var _useState = useState(false),
477
+ _useState2 = _slicedToArray(_useState, 2),
478
+ segmentLoaded = _useState2[0],
479
+ setSegmentLoaded = _useState2[1];
480
+
481
+ var _useState3 = useState([]),
482
+ _useState4 = _slicedToArray(_useState3, 2),
483
+ articles = _useState4[0],
484
+ setArticles = _useState4[1];
485
+
486
+ var _useState5 = useState('loading'),
487
+ _useState6 = _slicedToArray(_useState5, 2),
488
+ loaded = _useState6[0],
489
+ setLoaded = _useState6[1]; //loading, loaded, failed
490
+
491
+
492
+ var starting = index * 5;
493
+ var contentMapping = {
494
+ videos: 'video',
495
+ articles: 'article',
496
+ podcasts: 'podcast'
497
+ };
498
+
499
+ var mainCategories = article.content_placement.filter(function (cp) {
500
+ return cp.usedForRecommendations === true;
501
+ }).map(function (cp) {
502
+ return cp.name;
503
+ }).sort();
504
+
505
+ useEffect(function () {
506
+ try {
507
+ if (!segmentLoaded) {
508
+ return;
509
+ }
510
+ if (mainCategories.length > 0) {
511
+ //console.log(mainCategories)
512
+ analytics.track('Article Category Viewed', {
513
+ categories: _JSON$stringify(mainCategories)
514
+ });
515
+ }
516
+
517
+ // get users traits
518
+ var getSegmentProfile = function () {
519
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
520
+ var anonymousId, response, data, addTaxonomyName, favoriteCategories, articlesCategory, videosCategory, podcastCategory, taxonomyCategories, taxonomies, articlesQuery, videosQuery, podcastQuery, params, _ref2, _ref3, _articles, videos, podcasts;
521
+
522
+ return regenerator.wrap(function _callee$(_context) {
523
+ while (1) {
524
+ switch (_context.prev = _context.next) {
525
+ case 0:
526
+ anonymousId = analytics.user().anonymousId();
527
+ _context.next = 3;
528
+ return fetch('/api/getSegmentProfile', {
529
+ method: 'POST',
530
+ body: _JSON$stringify({ anonymousId: anonymousId })
531
+ });
532
+
533
+ case 3:
534
+ response = _context.sent;
535
+ _context.next = 6;
536
+ return response.json();
537
+
538
+ case 6:
539
+ data = _context.sent;
540
+
541
+ if (!(data && data.traits && data.traits.favorite_article_category)) {
542
+ _context.next = 40;
543
+ break;
544
+ }
545
+
546
+ //console.log('%csegment user profile', 'font-size:1.5rem;color:#000000;padding:1rem;background-color:yellow;', data.traits)
547
+
548
+ addTaxonomyName = function addTaxonomyName(taxArr) {
549
+ if (!taxArr) return '';
550
+ var query = ' && ( ';
551
+ taxArr.forEach(function (item, index) {
552
+ if (index === 0) {
553
+ query = query + ('name == \'' + item + '\'');
554
+ } else {
555
+ query = query + (' || name == \'' + item + '\'');
556
+ }
557
+ });
558
+
559
+ query = query + ' )';
560
+
561
+ return query;
562
+ };
563
+
564
+ favoriteCategories = JSON.parse(data.traits.favorite_article_category);
565
+
566
+ //grab contentCategory ID
567
+
568
+ _context.next = 12;
569
+ return client.fetch("*[_type == 'contentCategory' && name == 'Articles'][0]{_id}");
570
+
571
+ case 12:
572
+ articlesCategory = _context.sent;
573
+ _context.next = 15;
574
+ return client.fetch("*[_type == 'contentCategory' && name == 'Videos'][0]{_id}");
575
+
576
+ case 15:
577
+ videosCategory = _context.sent;
578
+ _context.next = 18;
579
+ return client.fetch("*[_type == 'contentCategory' && name == 'Podcasts'][0]{_id}");
580
+
581
+ case 18:
582
+ podcastCategory = _context.sent;
583
+ _context.next = 21;
584
+ return client.fetch('*[_type == \'taxonomy\' ' + addTaxonomyName(favoriteCategories) + ']');
585
+
586
+ case 21:
587
+ taxonomyCategories = _context.sent;
588
+ taxonomies = '';
589
+
590
+ taxonomyCategories.forEach(function (taxonomy, index) {
591
+ if (index === 0) {
592
+ taxonomies = taxonomies + (' && ( references(\'' + taxonomy._id + '\')');
593
+ } else {
594
+ taxonomies = taxonomies + (' || references(\'' + taxonomy._id + '\')');
595
+ }
596
+ });
597
+ taxonomies = taxonomies + ' )';
598
+
599
+ // grab 3 articles from sanity different from the one currently being read
600
+ articlesQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + articlesCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 5) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
601
+ videosQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + videosCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 1) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
602
+ podcastQuery = '*[_type == \'article\'\n && !(_id in path("drafts.**"))\n && defined(title)\n && defined(url)\n && is_visible == true \n && passwordLock != true\n && references(\'' + podcastCategory._id + '\')\n ' + taxonomies + '\n && defined(published)\n && _id != $id\n && dateTime(published) <= dateTime(now())] | order(published desc) [' + starting + '...' + (starting + 2) + '] {\n ...,\n title,\n thumbnail,\n url,\n contentCategory->,\n published,\n }';
603
+ params = {
604
+ id: article._id
605
+ };
606
+ _context.next = 31;
607
+ return _Promise.all([client.fetch(articlesQuery, params), client.fetch(videosQuery, params), client.fetch(podcastQuery, params)]);
608
+
609
+ case 31:
610
+ _ref2 = _context.sent;
611
+ _ref3 = _slicedToArray(_ref2, 3);
612
+ _articles = _ref3[0];
613
+ videos = _ref3[1];
614
+ podcasts = _ref3[2];
615
+
616
+ if (_articles.length === 0) setLoaded('failed');
617
+ if (_articles) {
618
+ if (videos[0] && _articles[2]) {
619
+ _articles[2] = videos[0];
620
+ }
621
+ if (videos[1] && _articles[4]) {
622
+ _articles[4] = videos[1];
623
+ }
624
+ if (podcasts[0] && _articles[3]) {
625
+ _articles[3] = podcasts[0];
626
+ }
627
+ setArticles(_articles);
628
+ }
629
+ _context.next = 41;
630
+ break;
631
+
632
+ case 40:
633
+ setLoaded('failed');
634
+
635
+ case 41:
636
+ case 'end':
637
+ return _context.stop();
638
+ }
639
+ }
640
+ }, _callee, _this$2);
641
+ }));
642
+
643
+ return function getSegmentProfile() {
644
+ return _ref.apply(this, arguments);
645
+ };
646
+ }();
647
+
648
+ getSegmentProfile();
649
+ } catch (err) {
650
+ console.log(err);
651
+ setLoaded('failed');
652
+ }
653
+ }, [segmentLoaded]);
654
+
655
+ useEffect(function () {
656
+ if (articles && articles.length > 0) {
657
+ setLoaded('loaded');
658
+ }
659
+ }, [articles]);
660
+
661
+ useEffect(function () {
662
+ try {
663
+ analytics.ready(function () {
664
+ setSegmentLoaded(function () {
665
+ return 'loaded';
666
+ });
667
+ });
668
+ } catch (err) {
669
+ console.log(err);
670
+ setLoaded('failed');
671
+ }
672
+ }, []);
673
+
674
+ return React__default.createElement(
675
+ 'div',
676
+ { id: 'recommended', style: { minHeight: '150px' } },
677
+ loaded === 'loaded' && React__default.createElement(
678
+ React__default.Fragment,
679
+ null,
680
+ React__default.createElement(
681
+ 'h4',
682
+ { className: styles.recommendTitle },
683
+ 'Recommended For You'
684
+ ),
685
+ React__default.createElement(
686
+ 'div',
687
+ { className: styles.recommendContainer, id: 'recommendedContent' },
688
+ articles.map(function (article, index) {
689
+ if (index === 0) {
690
+ return React__default.createElement(
691
+ 'div',
692
+ { key: article._id + ('-' + index), className: styles.recommendTop },
693
+ React__default.createElement(
694
+ 'div',
695
+ { className: styles.recommendTopImg },
696
+ React__default.createElement(
697
+ 'a',
698
+ { href: '/view/' + article.url.current + '?utm_source=website&utm_medium=dynamic_content&utm_campaign=in_feed_unit' },
699
+ React__default.createElement('img', { src: urlFor({ source: article.thumbnail, client: client, imageHeight: 306, imageWidth: 544 }) })
700
+ )
701
+ ),
702
+ React__default.createElement(
703
+ 'div',
704
+ { className: styles.recommendTopBody },
705
+ React__default.createElement(
706
+ 'div',
707
+ { className: styles.topTitle },
708
+ article.title
709
+ ),
710
+ React__default.createElement(
711
+ 'p',
712
+ { className: styles.topBody },
713
+ article.summary
714
+ ),
715
+ React__default.createElement(
716
+ 'a',
717
+ { href: '/view/' + article.url.current + '?utm_source=website&utm_medium=dynamic_content&utm_campaign=in_feed_unit', className: styles.topLink },
718
+ '>> ',
719
+ 'Read Article'
720
+ )
721
+ )
722
+ );
723
+ } else {
724
+ return React__default.createElement(
725
+ 'div',
726
+ { key: article._id + ('-' + index), className: styles.smContainer },
727
+ React__default.createElement(
728
+ 'div',
729
+ { className: styles.category },
730
+ contentMapping[article.contentCategory.name.toLowerCase()] ? contentMapping[article.contentCategory.name.toLowerCase()] : article.contentCategory.name
731
+ ),
732
+ React__default.createElement(
733
+ 'a',
734
+ { href: '/view/' + article.url.current + '?utm_source=website&utm_medium=dynamic_content&utm_campaign=in_feed_unit' },
735
+ React__default.createElement(
736
+ 'div',
737
+ { className: styles.smImage },
738
+ React__default.createElement('img', { src: urlFor({ source: article.thumbnail, client: client, imageHeight: 270, imageWidth: 480 }) })
739
+ ),
740
+ React__default.createElement(
741
+ 'div',
742
+ { className: styles.title },
743
+ article.title
744
+ )
745
+ )
746
+ );
747
+ }
748
+ })
749
+ )
750
+ ),
751
+ loaded === 'failed' && React__default.createElement(
752
+ 'section',
753
+ { id: 'related-content-section', className: 'my-1' },
754
+ (article.relatedArticle || RelevantTopics({ article: article })) && React__default.createElement(
755
+ 'p',
756
+ { className: 'mb-0' },
757
+ React__default.createElement(
758
+ 'b',
759
+ null,
760
+ 'Related Content:'
761
+ )
762
+ ),
763
+ React__default.createElement(RelevantTopics, { article: article, cpModificationRequired: cpModificationRequired, Settings: props.Settings }),
764
+ React__default.createElement(
765
+ 'div',
766
+ { className: 'pt-2' },
767
+ React__default.createElement(RelatedArticle, {
768
+ articles: article.relatedArticle,
769
+ client: client,
770
+ fallbackImage: props.Settings.logo,
771
+ showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
772
+ })
773
+ )
774
+ )
775
+ );
776
+ };
777
+
778
+ var RelevantTopics = function RelevantTopics(props) {
779
+ var article = props.article,
780
+ cpModificationRequired = props.cpModificationRequired;
781
+ var content_placement = article.content_placement,
782
+ documentGroupMapping = article.documentGroupMapping,
783
+ issueGroup = article.issueGroup;
784
+
785
+ if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
786
+ var relatedLinks = [];
787
+ if (documentGroupMapping && documentGroupMapping.length > 0) {
788
+ documentGroupMapping.forEach(function (documentGroup) {
789
+ if (documentGroup.isShow === false || documentGroup.excludeRelatedContents) {
790
+ return null;
791
+ }
792
+ if (documentGroup.parent) {
793
+ relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{
794
+ label: documentGroup.name,
795
+ href: cpModificationRequired ? getDocumentGroupUrl(documentGroup) : documentGroup.parent.identifier && documentGroup.parent.identifier.current && !documentGroup.path.includes('/') ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path
796
+ }]);
797
+ }
798
+ });
799
+ }
800
+ if (content_placement && content_placement.length > 0) {
801
+ content_placement.filter(function (item) {
802
+ return item.path !== 'news';
803
+ }).forEach(function (cp) {
804
+ if (cp.excludeRelatedContents) {
805
+ return null;
806
+ }
807
+ var cp_url = cpModificationRequired ? getContentPlacementUrl(cp) : cp.path;
808
+ var href = '/' + cp_url;
809
+ relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
810
+ });
811
+ }
812
+ if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
813
+ var _props$Settings$issue = props.Settings.issueMapping,
814
+ issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
815
+
816
+ relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: issueMapping + '/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
817
+ }
818
+ if (relatedLinks && relatedLinks.length > 0) {
819
+ return React__default.createElement(
820
+ 'div',
821
+ null,
822
+ relatedLinks.map(function (relatedLink, index) {
823
+ if (relatedLink && relatedLink.href && relatedLink.label) {
824
+ return React__default.createElement(
825
+ 'span',
826
+ { key: relatedLink.label, className: 'related-link' },
827
+ React__default.createElement(
828
+ 'a',
829
+ { className: 'related-links', style: { color: 'blue' }, href: relatedLink.href },
830
+ relatedLink.label
831
+ ),
832
+ React__default.createElement(
833
+ 'style',
834
+ { jsx: 'true' },
835
+ '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
836
+ )
837
+ );
838
+ }
839
+ })
840
+ );
841
+ }
842
+ return null;
843
+ }
844
+ return null;
845
+ };
846
+
847
+ var checkDocGroupMappingForSeries = function checkDocGroupMappingForSeries(docGroupArray) {
848
+
849
+ for (var i = 0; i < docGroupArray.length; i++) {
850
+ if (docGroupArray[i].isSeries) {
851
+ return docGroupArray[i];
852
+ }
853
+ }
854
+
855
+ return false;
856
+ };
857
+
858
+ var Article = React__default.memo(forwardRef(function (props, ref) {
859
+ var onVote = function () {
860
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(nodeKey, selectedChoice) {
861
+ var response, result;
862
+ return regenerator.wrap(function _callee$(_context) {
863
+ while (1) {
864
+ switch (_context.prev = _context.next) {
865
+ case 0:
866
+ _context.next = 2;
867
+ return fetch('/api/polls/vote', {
868
+ method: 'POST',
869
+ headers: { 'Content-Type': 'application/json' },
870
+ body: _JSON$stringify({ articleId: props.article._id, nodeKey: nodeKey, selectedChoice: selectedChoice, body: articleBody })
871
+ });
872
+
873
+ case 2:
874
+ response = _context.sent;
875
+
876
+ if (!response.ok) {
877
+ _context.next = 11;
878
+ break;
879
+ }
880
+
881
+ _context.next = 6;
882
+ return response.json();
883
+
884
+ case 6:
885
+ result = _context.sent;
886
+
887
+ setArticleBody(result.body);
888
+
889
+ console.log('Voted successfully');
890
+ _context.next = 12;
891
+ break;
892
+
893
+ case 11:
894
+ console.log('Unable to vote!');
895
+
896
+ case 12:
897
+ case 'end':
898
+ return _context.stop();
899
+ }
900
+ }
901
+ }, _callee, this);
902
+ }));
903
+
904
+ return function onVote(_x, _x2) {
905
+ return _ref.apply(this, arguments);
906
+ };
907
+ }();
908
+
909
+ var article = props.article,
910
+ Ads = props.Ads,
911
+ showRelatedArticles = props.showRelatedArticles,
912
+ _props$hideFBShare = props.hideFBShare,
913
+ hideFBShare = _props$hideFBShare === undefined ? false : _props$hideFBShare,
914
+ _props$hidePinterestS = props.hidePinterestShare,
915
+ hidePinterestShare = _props$hidePinterestS === undefined ? false : _props$hidePinterestS,
916
+ onChangeArticle = props.onChangeArticle,
917
+ _props$showSocialShar = props.showSocialShare,
918
+ showSocialShare = _props$showSocialShar === undefined ? true : _props$showSocialShar;
919
+ var client = props.client,
920
+ pageview = props.pageview,
921
+ videoAccountIDs = props.videoAccountIDs,
922
+ drupalLeadSettings = props.drupalLeadSettings,
923
+ currentPage = props.currentPage,
924
+ _props$showAuthorDeta = props.showAuthorDetails,
925
+ showAuthorDetails = _props$showAuthorDeta === undefined ? false : _props$showAuthorDeta,
926
+ audioAutoplay = props.audioAutoplay,
927
+ _props$article = props.article,
928
+ title = _props$article.title,
929
+ _props$article$passwo = _props$article.passwordLock,
930
+ passwordLock = _props$article$passwo === undefined ? false : _props$article$passwo,
931
+ authorDetails = _props$article.authorDetails,
932
+ pageNumber = _props$article.pageNumber,
933
+ published = _props$article.published,
934
+ _props$article$showPu = _props$article.showPublished,
935
+ showPublished = _props$article$showPu === undefined ? true : _props$article$showPu,
936
+ body = _props$article.body,
937
+ thumbnail = _props$article.thumbnail,
938
+ content_placement = _props$article.content_placement,
939
+ _props$article$url = _props$article.url;
940
+ _props$article$url = _props$article$url === undefined ? {
941
+ current: ''
942
+ } : _props$article$url;
943
+ var url = _props$article$url.current,
944
+ issue = _props$article.issue,
945
+ source = _props$article.source,
946
+ documentGroupMapping = _props$article.documentGroupMapping,
947
+ issueGroup = _props$article.issueGroup,
948
+ showIsi = _props$article.showIsi,
949
+ isi = _props$article.isi,
950
+ _props$article$displa = _props$article.display_summary,
951
+ display_summary = _props$article$displa === undefined ? true : _props$article$displa,
952
+ regionalPages = props.regionalPages,
953
+ nationalPage = props.nationalPage,
954
+ ISIContent = props.ISIContent,
955
+ shareOptions = props.shareOptions,
956
+ cpModificationRequired = props.cpModificationRequired,
957
+ authorPrefix = props.authorPrefix,
958
+ _props$lgContextAd = props.lgContextAd,
959
+ lgContextAd = _props$lgContextAd === undefined ? false : _props$lgContextAd,
960
+ queueData = props.queueData,
961
+ _props$sponsoredFlag = props.sponsoredFlag,
962
+ sponsoredFlag = _props$sponsoredFlag === undefined ? false : _props$sponsoredFlag,
963
+ _props$authorImgHeigh = props.authorImgHeight,
964
+ authorImgHeight = _props$authorImgHeigh === undefined ? 270 : _props$authorImgHeigh;
965
+ props.active;
966
+ var _props$refreshFlag = props.refreshFlag,
967
+ refreshFlag = _props$refreshFlag === undefined ? false : _props$refreshFlag,
968
+ disqusConfig = props.disqusConfig,
969
+ showDisqus = props.showDisqus,
970
+ _props$downloadCitati = props.downloadCitation,
971
+ downloadCitation = _props$downloadCitati === undefined ? false : _props$downloadCitati,
972
+ _props$useSegmentReco = props.useSegmentRecommendedArticles,
973
+ useSegmentRecommendedArticles = _props$useSegmentReco === undefined ? false : _props$useSegmentReco;
974
+ var sliderData = props.sliderData;
975
+
976
+ var disableEpisodeNumber = false;
977
+ if (article && article.documentGroup && article.documentGroup.disableEpisodeNumber === true) {
978
+ disableEpisodeNumber = true;
979
+ }
980
+ var logicforDisplayingEpisodeNumber = disableEpisodeNumber ? false : true;
981
+ var targeting = getTargeting(props);
982
+ //remove slider data if toggled
983
+ if (article && article.documentGroup && article.documentGroup.hideSeriesSlider === true) {
984
+ sliderData = null;
985
+ }
986
+
987
+ //next video url
988
+ if (sliderData) {
989
+ var nextArticle = void 0;
990
+ sliderData.forEach(function (data, index) {
991
+ if (data.url.current === props.article.url.current) {
992
+ nextArticle = index + 1;
993
+ }
994
+ });
995
+
996
+ if (nextArticle && sliderData[nextArticle]) {
997
+ article.nextVideo = sliderData[nextArticle].url.current;
998
+ }
999
+ }
1000
+
1001
+ //if showSocialShare is not disabled for entire site, check article taxonomy, docgroup, authors for showSocialShare === false
1002
+ if (showSocialShare) {
1003
+ showSocialShare = getSocialShareDisableFlag(props.article);
1004
+ }
1005
+
1006
+ //If sponsored flag, disable contextual ads
1007
+ if (sponsoredFlag) {
1008
+ article.contextualVideoAD = false;
1009
+ article.contextualAD = false;
1010
+ showRelatedArticles = false;
1011
+ }
1012
+ if (article.disableRelatedContent) {
1013
+ showRelatedArticles = false;
1014
+ }
1015
+ //This was being done in ArticleQueue2 which wasnt effecting articles excluded from infinite scroll, moved inside article component
1016
+ if (!sponsoredFlag && Ads.getVideoContextualAD) {
1017
+ article.contextualVideoAD = Ads.getVideoContextualAD(getTargeting(props, 'in-context_video'));
1018
+ }
1019
+ if (!sponsoredFlag && Ads.getNativeContextualAD) {
1020
+ article.contextualAD = Ads.getNativeContextualAD(getTargeting(props, 'native-ad'));
1021
+ }
1022
+
1023
+ var _useState = useState(null),
1024
+ _useState2 = _slicedToArray(_useState, 2),
1025
+ contextualADFlag = _useState2[0],
1026
+ setContextualADFlag = _useState2[1];
1027
+ // Setting new Flag 'visibleFlag' to know when the article is visible so that new contextual ad can be appended into DOM.
1028
+
1029
+
1030
+ var _useState3 = useState(false),
1031
+ _useState4 = _slicedToArray(_useState3, 2),
1032
+ visibleFlag = _useState4[0],
1033
+ setVisibleFlag = _useState4[1];
1034
+
1035
+ var summary = getArticleSummary(props.article);
1036
+
1037
+ var _useState5 = useState(1),
1038
+ _useState6 = _slicedToArray(_useState5, 2),
1039
+ auth = _useState6[0],
1040
+ setAuth = _useState6[1];
1041
+
1042
+ var _useState7 = useState(''),
1043
+ _useState8 = _slicedToArray(_useState7, 2),
1044
+ passwordKey = _useState8[0],
1045
+ setPasswordKey = _useState8[1];
1046
+
1047
+ var _useState9 = useState(body),
1048
+ _useState10 = _slicedToArray(_useState9, 2),
1049
+ articleBody = _useState10[0],
1050
+ setArticleBody = _useState10[1];
1051
+
1052
+ var _useState11 = useState(0),
1053
+ _useState12 = _slicedToArray(_useState11, 2),
1054
+ containerHeight = _useState12[0],
1055
+ setContainerHeight = _useState12[1];
1056
+
1057
+ var _useState13 = useState(true),
1058
+ _useState14 = _slicedToArray(_useState13, 2);
1059
+ _useState14[0];
1060
+ var setPreviewAd = _useState14[1];
1061
+
1062
+ var _useState15 = useState(props.index === 0),
1063
+ _useState16 = _slicedToArray(_useState15, 2),
1064
+ isFirstArticle = _useState16[0],
1065
+ setIsFirstArticle = _useState16[1];
1066
+
1067
+ useEffect(function () {
1068
+ var path = window && window.location && window.location.search;
1069
+ // Setting flag for Ad-preview URLs
1070
+ setPreviewAd(path.split('&').some(function (param) {
1071
+ return param.includes('creativeId');
1072
+ }));
1073
+ setContainerHeight(window.innerHeight);
1074
+ }, []);
1075
+
1076
+ var isCutomPage = function isCutomPage(article) {
1077
+ var url = article.url.current;
1078
+
1079
+ if (regionalPages || nationalPage) {
1080
+ return regionalPages.includes(url) || nationalPage === url;
1081
+ } else {
1082
+ return false;
1083
+ }
1084
+ };
1085
+ var renderAuthorBiography = function renderAuthorBiography(biography) {
1086
+ if (biography) {
1087
+ return React__default.createElement(BlockContent, _extends({
1088
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, contextualADFlag),
1089
+ blocks: [biography]
1090
+ }, client.config()));
1091
+ }
1092
+ };
1093
+
1094
+ var getAbstract = function getAbstract() {
1095
+ return article.abstract && article.abstract.map(function (block) {
1096
+ if (block.children) return block.children.map(function (child) {
1097
+ if (child._type === 'span') return child.text;
1098
+ });
1099
+ }).join(' ');
1100
+ };
1101
+
1102
+ var renderIsiContent = function renderIsiContent(article) {
1103
+ var url = article.url.current;
1104
+
1105
+ if (regionalPages && ISIContent && regionalPages.includes(url)) {
1106
+ return React__default.createElement(ISIContent, null);
1107
+ } else if (nationalPage === url && ISIContent) {
1108
+ return React__default.createElement(ISIContent, { national: true });
1109
+ }
1110
+ return null;
1111
+ };
1112
+ var generateRIS = function generateRIS() {
1113
+ var fileContent = 'TY - JOUR\n';
1114
+ if (issue) {
1115
+ if (article.title) {
1116
+ fileContent += 'TI - ' + article.title + '\n'; //Title - TI
1117
+ fileContent += 'T1 - ' + article.title + '\n'; //Title - T1
1118
+ }
1119
+ if (authorDetails && authorDetails.length) {
1120
+ authorDetails.map(function (authorDetail, index) {
1121
+ return fileContent += 'AU - ' + (authorDetail.firstName && authorDetail.lastName ? authorDetail.lastName + ', ' + authorDetail.firstName : '' + authorDetail.displayName) + '\n';
1122
+ } //Author
1123
+ );
1124
+ }
1125
+ if (issue.publication && issue.publication.name) {
1126
+ fileContent += 'T2 - ' + issue.publication.name + '\n'; //Secondary Title - T2
1127
+ fileContent += 'JF - ' + issue.publication.name + '\n'; //Journal Name - JF
1128
+ }
1129
+ if (issue.name) {
1130
+ fileContent += 'T3 - ' + issue.name + '\n'; //Issue Name - T3
1131
+ }
1132
+ if (issue.abbreviatedJournal) {
1133
+ fileContent += 'JO - ' + issue.abbreviatedJournal + '\n'; //Journal Name - JO
1134
+ }
1135
+ if (article.abstract) fileContent += 'AB - ' + getAbstract() + '\n'; //Abstract - AB
1136
+ if (article.abstract) fileContent += 'N2 - ' + getAbstract() + '\n'; //Abstract - N2
1137
+ if (issue.issueNumber) fileContent += 'IS - ' + issue.issueNumber + '\n'; //Issue Number - IS
1138
+ fileContent += 'PB - MJH Life Sciences\n'; //Publisher - PB
1139
+ if (issue.year) fileContent += 'PY - ' + issue.year + '\n'; //Published Year - PY
1140
+ if (issue.volume) fileContent += 'VL - ' + issue.volume + '\n'; //Volume - VL
1141
+ if (issue.url) fileContent += 'L1 - ' + issue.url + '\n'; //Link to PDF - L1
1142
+ if (shareOptions && shareOptions.shareBaseUrl) {
1143
+ fileContent += 'L2 - ' + (shareOptions.shareBaseUrl + url) + '\n'; //Link to Full-text - L2
1144
+ fileContent += 'UR - ' + (shareOptions.shareBaseUrl + url) + '\n'; //Doc URL - UR
1145
+ }
1146
+ if (props.Website) fileContent += 'LK - https://' + props.Website.liveDomain + '\n'; //Website Link - LK
1147
+ if (issue.isbn_issn) {
1148
+ fileContent += 'SN - ' + issue.isbn_issn + '\n'; //ISSN/ISBN - TI
1149
+ }
1150
+ if (pageNumber) {
1151
+ if (pageNumber.includes('-')) {
1152
+ fileContent += 'SP - ' + pageNumber.split('-')[0] + '\n'; //Start Page - SP
1153
+ fileContent += 'EP - ' + pageNumber.split('-')[1] + '\n'; //End Page - EP
1154
+ } else {
1155
+ fileContent += 'SP - ' + pageNumber + '\n';
1156
+ }
1157
+ }
1158
+ if (article.published) fileContent += 'Y1 - ' + moment(published).format('DD-MMMM-YYYY') + '\n'; //Primary Date - Y1
1159
+ fileContent += 'Y2 - ' + moment().format('DD-MMMM-YYYY') + '\n'; //Access Date - Y2
1160
+ }
1161
+ fileContent += 'ER -\n'; //End of Record
1162
+ return fileContent;
1163
+ };
1164
+ var getAuthorList = function getAuthorList() {
1165
+ var authorList = '';
1166
+ if (authorDetails && authorDetails.length > 0) {
1167
+ authorDetails.map(function (author) {
1168
+ if (author.lastName && author.firstName) authorList += author.lastName + ',' + author.firstName + ';';else if (author.displayName) authorList += author.displayName + ';';
1169
+ });
1170
+ }
1171
+ return authorList;
1172
+ };
1173
+ var downloadRIS = function downloadRIS() {
1174
+ var fileContent = generateRIS();
1175
+ var file = new File([fileContent], 'citation-' + url + '.ris', { type: 'application/x-research-info-systems;charset=utf-8' });
1176
+ FileSaver.saveAs(file, 'citation-' + url + '.ris');
1177
+ };
1178
+
1179
+ var RelevantTopics = function RelevantTopics() {
1180
+ if (content_placement && content_placement.length > 0 || documentGroupMapping && documentGroupMapping.length > 0) {
1181
+ var relatedLinks = [];
1182
+ if (documentGroupMapping && documentGroupMapping.length > 0) {
1183
+ documentGroupMapping.forEach(function (documentGroup) {
1184
+ if (documentGroup.isShow === false || documentGroup.excludeRelatedContents) {
1185
+ return null;
1186
+ }
1187
+ if (documentGroup.parent) {
1188
+ relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{
1189
+ label: documentGroup.name,
1190
+ href: cpModificationRequired ? getDocumentGroupUrl(documentGroup) : documentGroup.parent.identifier && documentGroup.parent.identifier.current && !documentGroup.path.includes('/') ? '/' + documentGroup.parent.identifier.current + '/' + documentGroup.path : '/' + documentGroup.path
1191
+ }]);
1192
+ }
1193
+ });
1194
+ }
1195
+ if (content_placement && content_placement.length > 0) {
1196
+ content_placement.filter(function (item) {
1197
+ return item.path !== 'news';
1198
+ }).forEach(function (cp) {
1199
+ if (cp.excludeRelatedContents) {
1200
+ return null;
1201
+ }
1202
+ var cp_url = cpModificationRequired ? getContentPlacementUrl(cp) : cp.path;
1203
+ var href = '/' + cp_url;
1204
+ relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: cp.name, href: href }]);
1205
+ });
1206
+ }
1207
+ if (issueGroup && issueGroup.name && issueGroup.identifier && issueGroup.identifier.current && issueGroup.parent && issueGroup.parent.identifier && issueGroup.parent.identifier.current) {
1208
+ var _props$Settings$issue = props.Settings.issueMapping,
1209
+ issueMapping = _props$Settings$issue === undefined ? '/publications' : _props$Settings$issue;
1210
+
1211
+ relatedLinks = [].concat(_toConsumableArray(relatedLinks), [{ label: issueGroup.name, href: issueMapping + '/' + issueGroup.parent.identifier.current + '/' + issueGroup.identifier.current }]);
1212
+ }
1213
+ if (relatedLinks && relatedLinks.length > 0) {
1214
+ return React__default.createElement(
1215
+ 'div',
1216
+ null,
1217
+ relatedLinks.map(function (relatedLink, index) {
1218
+ if (relatedLink && relatedLink.href && relatedLink.label) {
1219
+ return React__default.createElement(
1220
+ 'span',
1221
+ { key: index, className: 'related-link' },
1222
+ React__default.createElement(
1223
+ 'a',
1224
+ { className: 'related-links', style: { color: 'blue' }, href: relatedLink.href },
1225
+ relatedLink.label
1226
+ ),
1227
+ React__default.createElement(
1228
+ 'style',
1229
+ { jsx: 'true' },
1230
+ '\n .related-link:not(:first-child):before {\n content: \' | \';\n }\n '
1231
+ )
1232
+ );
1233
+ }
1234
+ })
1235
+ );
1236
+ }
1237
+ return null;
1238
+ }
1239
+ return null;
1240
+ };
1241
+
1242
+ var RelatedContent = React__default.memo(function () {
1243
+ return React__default.createElement(
1244
+ 'div',
1245
+ null,
1246
+ useSegmentRecommendedArticles ? React__default.createElement(Recommended, {
1247
+ client: client,
1248
+ article: article,
1249
+ index: props.index,
1250
+ Settings: props.Settings,
1251
+ showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage,
1252
+ cpModificationRequired: cpModificationRequired
1253
+ }) : React__default.createElement(
1254
+ 'section',
1255
+ { id: 'related-content-section', className: 'my-1' },
1256
+ (article.relatedArticle || RelevantTopics()) && React__default.createElement(
1257
+ 'p',
1258
+ { className: 'mb-0' },
1259
+ React__default.createElement(
1260
+ 'b',
1261
+ null,
1262
+ 'Related Content:'
1263
+ )
1264
+ ),
1265
+ React__default.createElement(RelevantTopics, null),
1266
+ React__default.createElement(
1267
+ 'div',
1268
+ { className: 'pt-2' },
1269
+ React__default.createElement(RelatedArticle, {
1270
+ articles: article.relatedArticle,
1271
+ client: client,
1272
+ fallbackImage: props.Settings.logo,
1273
+ showRelatedArticleFallbackImage: props.showRelatedArticleFallbackImage
1274
+ })
1275
+ )
1276
+ )
1277
+ );
1278
+ });
1279
+
1280
+ var form = function form() {
1281
+ return React__default.createElement(
1282
+ React__default.Fragment,
1283
+ null,
1284
+ React__default.createElement(
1285
+ Head,
1286
+ null,
1287
+ React__default.createElement('meta', { name: 'googlebot', content: 'noindex' })
1288
+ ),
1289
+ React__default.createElement(
1290
+ 'div',
1291
+ { className: 'mt-5', style: { display: 'flex', justifyContent: 'center', alignItems: 'center' } },
1292
+ React__default.createElement(
1293
+ Form,
1294
+ {
1295
+ inline: true,
1296
+ onSubmit: function onSubmit(e) {
1297
+ e.preventDefault();
1298
+ } },
1299
+ React__default.createElement(FormControl, { type: 'text', className: 'mr-sm-2', value: passwordKey, onChange: function onChange(e) {
1300
+ return setPasswordKey(e.target.value);
1301
+ }, placeholder: 'Password' }),
1302
+ React__default.createElement(
1303
+ Button,
1304
+ {
1305
+ variant: 'primary',
1306
+ onClick: function onClick() {
1307
+ if (passwordKey === props.article.password) {
1308
+ setAuth(2);
1309
+ } else {
1310
+ alert('Incorrect Password');
1311
+ }
1312
+ } },
1313
+ 'Submit'
1314
+ )
1315
+ )
1316
+ )
1317
+ );
1318
+ };
1319
+
1320
+ var renderBlockContent = function renderBlockContent(payload, meta, authorImgHeight) {
1321
+ var _payload = payload,
1322
+ body = _payload.body;
1323
+
1324
+ var indexes = findIndex(body);
1325
+ var seriesInfo = checkIfMediaSeriesHasVideo(article);
1326
+ var isMediaSeries = false;
1327
+ if (article.documentGroup && article.documentGroup.isSeries) {
1328
+ isMediaSeries = true;
1329
+ } else if (!article.documentGroup && article.documentGroupMapping && checkDocGroupMappingForSeries(article.documentGroupMapping)) {
1330
+ isMediaSeries = true;
1331
+ }
1332
+
1333
+ if (indexes.length >= 2 && body.length > 3 && payload.contextualAD && payload.contextualVideoAD) {
1334
+ payload = _extends({}, payload, {
1335
+ contextualAD: _extends({}, payload.contextualAD, {
1336
+ slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id
1337
+ }),
1338
+ contextualVideoAD: _extends({}, payload.contextualVideoAD, {
1339
+ slotId: (payload.contextualVideoAD.slotId || 'in-context_video') + '-' + payload._id
1340
+ })
1341
+ });
1342
+ var selectedIndex = !(indexes.length % 2) ? indexes.length / 2 + 1 : Math.round(indexes.length / 2);
1343
+ if (seriesInfo.hasVideo) {
1344
+ selectedIndex = seriesInfo.videoIndex;
1345
+ }
1346
+
1347
+ var checkIsVideoAdFound = function checkIsVideoAdFound(isFound) {
1348
+ if (!isFound) {
1349
+ var parent = document.getElementById('contextual-video-ad-' + payload._id);
1350
+ parent.style.height = '0%';
1351
+ parent.style.width = '0%';
1352
+ parent.style.display = 'none';
1353
+ setContextualADFlag(false);
1354
+ } else {
1355
+ setContextualADFlag(true);
1356
+ }
1357
+ };
1358
+ return React__default.createElement(
1359
+ React__default.Fragment,
1360
+ null,
1361
+ React__default.createElement(BlockContent, _extends({
1362
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, contextualADFlag, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1363
+ blocks: [].concat(_toConsumableArray(articleBody.slice(0, selectedIndex))),
1364
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1365
+ }, client.config())),
1366
+ React__default.createElement('span', { className: 'clearfix' }),
1367
+ isMediaSeries && sliderData && seriesInfo.hasVideo && React__default.createElement(SeriesSlider, { dataset: sliderData, client: client, nowPlaying: article.title, displayEpisodeNumber: logicforDisplayingEpisodeNumber }),
1368
+ React__default.createElement(
1369
+ 'div',
1370
+ { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
1371
+ React__default.createElement(DFPAdSlot, _extends({}, payload.contextualAD, { refreshFlag: refreshFlag }))
1372
+ ),
1373
+ React__default.createElement(
1374
+ 'style',
1375
+ { jsx: 'true' },
1376
+ '\n .contextual-native-ad {\n margin-bottom: 1rem;\n }\n '
1377
+ ),
1378
+ React__default.createElement('span', { className: 'clearfix' }),
1379
+ React__default.createElement(
1380
+ 'div',
1381
+ { id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
1382
+ React__default.createElement(DFPAdSlot, _extends({}, payload.contextualVideoAD, { refreshFlag: refreshFlag, checkIsAdFound: checkIsVideoAdFound }))
1383
+ ),
1384
+ React__default.createElement(BlockContent, _extends({
1385
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, null, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1386
+ blocks: [].concat(_toConsumableArray(articleBody.slice(selectedIndex))),
1387
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1388
+ }, client.config()))
1389
+ );
1390
+ } else if (indexes.length >= 2 && body.length >= 3 && payload.contextualAD && !payload.contextualVideoAD) {
1391
+ payload = _extends({}, payload, {
1392
+ contextualAD: _extends({}, payload.contextualAD, {
1393
+ slotId: (payload.contextualAD.slotId || 'contextual_ad') + '-' + payload._id,
1394
+ className: 'ADFluid',
1395
+ // Fetching new contextual targeting based on the current active article.
1396
+ targeting: getTargeting(props, 'native-ad'),
1397
+ // Adding new ad size for large contextual ad for desktop screen width >= 1400
1398
+ sizes: lgContextAd ? [[728, 90], 'fluid', [300, 100]] : ['fluid', [300, 100]],
1399
+ sizeMapping: lgContextAd ? [{
1400
+ viewport: [1400, 0],
1401
+ sizes: [[728, 90], 'fluid', [300, 100]]
1402
+ }, { viewport: [0, 0], sizes: ['fluid', [300, 100]] }] : [{ viewport: [0, 0], sizes: ['fluid', [300, 100]] }]
1403
+ })
1404
+ });
1405
+ var _selectedIndex = !(indexes.length % 2) ? indexes.length / 2 + 1 : Math.round(indexes.length / 2);
1406
+ if (seriesInfo.hasVideo) {
1407
+ _selectedIndex = seriesInfo.videoIndex;
1408
+ }
1409
+ return React__default.createElement(
1410
+ React__default.Fragment,
1411
+ null,
1412
+ React__default.createElement(BlockContent, _extends({
1413
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, contextualADFlag, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1414
+ blocks: [].concat(_toConsumableArray(articleBody.slice(0, _selectedIndex))),
1415
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1416
+ }, client.config())),
1417
+ contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
1418
+ isMediaSeries && sliderData && seriesInfo.hasVideo && React__default.createElement(SeriesSlider, { dataset: sliderData, client: client, nowPlaying: article.title, displayEpisodeNumber: logicforDisplayingEpisodeNumber }),
1419
+ (visibleFlag || queueData && queueData.length === 1 || !props.infiniteScroll) && React__default.createElement(
1420
+ React__default.Fragment,
1421
+ null,
1422
+ React__default.createElement(
1423
+ 'div',
1424
+ { id: 'contextual-native-ad-' + payload._id, className: 'contextual-native-ad' },
1425
+ React__default.createElement(DFPAdSlot, _extends({}, payload.contextualAD, { refreshFlag: refreshFlag }))
1426
+ ),
1427
+ React__default.createElement(
1428
+ 'style',
1429
+ { jsx: 'true' },
1430
+ '\n .contextual-native-ad {\n margin-bottom: 1rem;\n }\n '
1431
+ )
1432
+ ),
1433
+ contextualADFlag && React__default.createElement('span', { className: 'clearfix' }),
1434
+ React__default.createElement(BlockContent, _extends({
1435
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, null, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1436
+ blocks: [].concat(_toConsumableArray(articleBody.slice(_selectedIndex))),
1437
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1438
+ }, client.config()))
1439
+ );
1440
+ } else if (indexes.length >= 2 && body.length > 3 && payload.contextualVideoAD && !payload.contextualAD) {
1441
+ payload = _extends({}, payload, {
1442
+ contextualVideoAD: _extends({}, payload.contextualVideoAD, {
1443
+ slotId: (payload.contextualVideoAD.slotId || 'in-context_video') + '-' + payload._id
1444
+ })
1445
+ });
1446
+ var _selectedIndex2 = !(indexes.length % 2) ? indexes.length / 2 + 1 : Math.round(indexes.length / 2);
1447
+ if (seriesInfo.hasVideo) {
1448
+ _selectedIndex2 = seriesInfo.videoIndex;
1449
+ }
1450
+ var checkIsAdFound = function checkIsAdFound(isFound) {
1451
+ if (!isFound) {
1452
+ var parent = document.getElementById('contextual-video-ad-' + payload._id);
1453
+ parent.style.height = '0%';
1454
+ parent.style.width = '0%';
1455
+ parent.style.display = 'none';
1456
+ setContextualADFlag(false);
1457
+ } else {
1458
+ if (body && body[1] && body[1]._type === 'figure') {
1459
+ setContextualADFlag(true);
1460
+ }
1461
+ }
1462
+ };
1463
+
1464
+ return React__default.createElement(
1465
+ React__default.Fragment,
1466
+ null,
1467
+ React__default.createElement(BlockContent, _extends({
1468
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, contextualADFlag, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1469
+ blocks: [].concat(_toConsumableArray(articleBody.slice(0, _selectedIndex2))),
1470
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1471
+ }, client.config())),
1472
+ React__default.createElement('span', { className: 'clearfix' }),
1473
+ isMediaSeries && sliderData && seriesInfo.hasVideo && React__default.createElement(SeriesSlider, { dataset: sliderData, client: client, nowPlaying: article.title, displayEpisodeNumber: logicforDisplayingEpisodeNumber }),
1474
+ React__default.createElement(
1475
+ 'div',
1476
+ { id: 'contextual-video-ad-' + payload._id, className: 'contextual-video-ad' },
1477
+ React__default.createElement(DFPAdSlot, _extends({}, payload.contextualVideoAD, { refreshFlag: refreshFlag, checkIsAdFound: checkIsAdFound }))
1478
+ ),
1479
+ React__default.createElement(BlockContent, _extends({
1480
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, null, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1481
+ blocks: [].concat(_toConsumableArray(articleBody.slice(_selectedIndex2))),
1482
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1483
+ }, client.config()))
1484
+ );
1485
+ } else {
1486
+ var _selectedIndex3 = !(indexes.length % 2) ? indexes.length / 2 + 1 : Math.round(indexes.length / 2);
1487
+ if (seriesInfo.hasVideo) {
1488
+ _selectedIndex3 = seriesInfo.videoIndex;
1489
+ }
1490
+
1491
+ return React__default.createElement(
1492
+ 'div',
1493
+ null,
1494
+ React__default.createElement(BlockContent, _extends({
1495
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, false, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1496
+ blocks: article.documentGroup && article.documentGroup.isSeries ? [].concat(_toConsumableArray(articleBody.slice(0, _selectedIndex3))) : articleBody,
1497
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1498
+ }, client.config())),
1499
+ isMediaSeries && sliderData && seriesInfo.hasVideo && React__default.createElement(SeriesSlider, { dataset: sliderData, client: client, nowPlaying: article.title, displayEpisodeNumber: logicforDisplayingEpisodeNumber }),
1500
+ article.documentGroup && article.documentGroup.isSeries && React__default.createElement(BlockContent, _extends({
1501
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, isMediaSeries, null, null, article.Ads, targeting, article, meta, authorPrefix, authorImgHeight, audioAutoplay),
1502
+ blocks: [].concat(_toConsumableArray(articleBody.slice(_selectedIndex3))),
1503
+ imageOptions: { w: 320, h: 240, fit: 'max' }
1504
+ }, client.config()))
1505
+ );
1506
+ }
1507
+ };
1508
+
1509
+ var checkIfVideoSeries = function checkIfVideoSeries(article) {
1510
+ if (!article || !article.body) {
1511
+ return false;
1512
+ }
1513
+
1514
+ for (var i = 0; i < article.body.length; i++) {
1515
+ var block = article.body[i];
1516
+ if (block._type === 'youtubeGallery') {
1517
+ return true;
1518
+ }
1519
+ }
1520
+
1521
+ return false;
1522
+ };
1523
+ var checkIfFormAssembly = function checkIfFormAssembly(article) {
1524
+ if (!article || !article.body) {
1525
+ return false;
1526
+ }
1527
+
1528
+ for (var i = 0; i < article.body.length; i++) {
1529
+ var block = article.body[i];
1530
+ if (block._type === 'formassembly') {
1531
+ return true;
1532
+ }
1533
+ }
1534
+ return false;
1535
+ };
1536
+ var checkIfMediaSeriesHasVideo = function checkIfMediaSeriesHasVideo(article) {
1537
+ var seriesInfo = { hasVideo: false, videoIndex: 0 };
1538
+ if (!article || !article.body) {
1539
+ return false;
1540
+ }
1541
+
1542
+ for (var i = 0; i < article.body.length; i++) {
1543
+ var block = article.body[i];
1544
+ if (block._type == 'video' || block._type == 'youtube' || block._type == 'audio') {
1545
+ seriesInfo.hasVideo = true;
1546
+ seriesInfo.videoIndex = i + 1;
1547
+ }
1548
+ }
1549
+
1550
+ return seriesInfo;
1551
+ };
1552
+
1553
+ var detail = function detail() {
1554
+ var shareVia = shareOptions.shareVia,
1555
+ shareSubject = shareOptions.shareSubject,
1556
+ twitterSiteName = shareOptions.twitterSiteName,
1557
+ shareImageDefault = shareOptions.shareImageDefault,
1558
+ shareBaseUrl = shareOptions.shareBaseUrl;
1559
+ shareOptions.shareSiteTitle;
1560
+
1561
+ var shareUrl = shareBaseUrl + props.article.url.current;
1562
+ var shareTitle = article.title;
1563
+ var shareSummary = article.summary;
1564
+ var shareImage = thumbnail && thumbnail.asset ? urlFor({ client: props.client, source: thumbnail.asset }) : shareImageDefault;
1565
+ var siteName = props.Website && props.Website.title ? props.Website.title : '';
1566
+ var shareKeywords = getKeywords(props.article).join(',');
1567
+
1568
+ var meta = {
1569
+ shareTitle: shareTitle,
1570
+ shareSiteName: props.cache.siteSettingCache.name,
1571
+ shareSummary: shareSummary,
1572
+ shareUrl: shareUrl,
1573
+ shareImage: shareImage,
1574
+ shareVia: props.Settings.title,
1575
+ shareKeywords: shareKeywords
1576
+ };
1577
+ if (!props.infiniteScroll) {
1578
+ onChangeArticle = function onChangeArticle() {
1579
+ return null;
1580
+ };
1581
+ }
1582
+ var fetchCurrentEpisode = function fetchCurrentEpisode(sliderData, article) {
1583
+ if (!sliderData) return null;
1584
+ var episode = null;
1585
+ sliderData.forEach(function (seriesArticle, index) {
1586
+ if (seriesArticle.title === article.title) {
1587
+ episode = index + 1;
1588
+ }
1589
+ });
1590
+ return episode;
1591
+ };
1592
+ // pixels from bottom of window to change trigger visibility change
1593
+ var triggerOffset = 20;
1594
+ var isVideoSeries = checkIfVideoSeries(article);
1595
+ var episodeNumber = fetchCurrentEpisode(sliderData, props.article);
1596
+ var isMediaSeries = false;
1597
+ var mediaSeriesName = '';
1598
+ var seriesInfo = checkIfMediaSeriesHasVideo(article);
1599
+ var isFormAssembly = checkIfFormAssembly(article);
1600
+
1601
+ if (article.documentGroup && article.documentGroup.isSeries) {
1602
+ isMediaSeries = true;
1603
+ mediaSeriesName = article.documentGroup.name;
1604
+ }
1605
+ if (!article.documentGroup && article.documentGroupMapping && checkDocGroupMappingForSeries(article.documentGroupMapping)) {
1606
+ isMediaSeries = true;
1607
+ mediaSeriesName = checkDocGroupMappingForSeries(article.documentGroupMapping).name;
1608
+ }
1609
+
1610
+ return React__default.createElement(
1611
+ React__default.Fragment,
1612
+ null,
1613
+ React__default.createElement(
1614
+ VisibilitySensor,
1615
+ {
1616
+ partialVisibility: true,
1617
+ offset: { bottom: triggerOffset, top: containerHeight && containerHeight },
1618
+ onChange: function onChange(isVisible) {
1619
+ if (isVisible && !isFirstArticle) {
1620
+ var pageviewProperties = _extends({}, targeting, {
1621
+ category: article && article.category ? article.category.name : ''
1622
+ });
1623
+ onChangeArticle(url, meta, pageviewProperties);
1624
+ setVisibleFlag(function () {
1625
+ return true;
1626
+ });
1627
+ }
1628
+ if (isFirstArticle) {
1629
+ setIsFirstArticle(false);
1630
+ }
1631
+ } },
1632
+ React__default.createElement(
1633
+ 'div',
1634
+ { id: 'article__block', style: { position: 'relative' }, ref: ref },
1635
+ React__default.createElement(PixelTrackingArticle, { article: article, infiniteScroll: props.infiniteScroll }),
1636
+ React__default.createElement(
1637
+ 'div',
1638
+ { className: 'video-detail', style: { marginBottom: isCutomPage(props.article) || showIsi && Array.isArray(isi) && isi.length > 0 ? '15rem' : 0 } },
1639
+ issue && React__default.createElement(
1640
+ Head,
1641
+ null,
1642
+ article.title && React__default.createElement('meta', { name: 'citation_title', content: article.title }),
1643
+ published && React__default.createElement('meta', { name: 'citation_date', content: moment(published).format('LL') }),
1644
+ issue.year && React__default.createElement('meta', { name: 'citation_year', content: issue.year }),
1645
+ issue.isbn_issn && React__default.createElement('meta', { name: 'citation_isbn', content: issue.isbn_issn }),
1646
+ article.abstract && React__default.createElement('meta', { name: 'citation_abstract', content: getAbstract() }),
1647
+ React__default.createElement('meta', { name: 'citation_author', content: getAuthorList() }),
1648
+ issue.pdf && React__default.createElement('meta', { name: 'citation_pdf_url', content: urlForFile({ asset: issue.pdf }) })
1649
+ ),
1650
+ isVideoSeries && renderBlockContent(article, meta, authorImgHeight),
1651
+ !isVideoSeries && React__default.createElement(
1652
+ 'div',
1653
+ null,
1654
+ isMediaSeries && React__default.createElement(
1655
+ 'p',
1656
+ { style: { fontSize: '14px' } },
1657
+ disableEpisodeNumber ? '' + mediaSeriesName : mediaSeriesName + ' - Episode ' + episodeNumber
1658
+ ),
1659
+ React__default.createElement(
1660
+ 'h1',
1661
+ { className: 'page-title', style: { fontSize: '1.9rem' } },
1662
+ title
1663
+ )
1664
+ ),
1665
+ React__default.createElement(
1666
+ 'div',
1667
+ { className: 'mb-3 doc-group-container', style: { display: 'flex', justifyContent: 'space-between', alignItems: 'flex-end' } },
1668
+ React__default.createElement(
1669
+ 'style',
1670
+ { jsx: 'true' },
1671
+ '\n .social-ris-container {\n display: flex;\n justify-content: space-between;\n }\n @media screen and (max-width: 468px) {\n .video-detail .doc-group-container {\n flex-direction: column;\n align-items: flex-start !important;\n }\n .video-detail .doc-group {\n margin-top: 2rem;\n width: calc(100vw - 45px);\n align-items: center;\n }\n .video-detail .doc-group img,\n .doc-group p {\n max-width: calc(100vw - 45px) !important;\n }\n .social-ris-container {\n flex-direction: column;\n }\n }\n .author-details-img {\n margin-right: 10px;\n max-height: 250px;\n min-height: 150px;\n max-width: 250px;\n min-width: 150px;\n width: 100%;\n height: 100%;\n object-fit: contain;\n }\n .author-details-img-container {\n text-align: center;\n }\n .author-details-col {\n padding-left: 25px;\n }\n .left-wrap {\n width: 100%;\n }\n '
1672
+ ),
1673
+ React__default.createElement(
1674
+ 'div',
1675
+ { className: 'left-wrap' },
1676
+ !isVideoSeries && !isFormAssembly && showPublished && React__default.createElement(
1677
+ 'div',
1678
+ null,
1679
+ React__default.createElement(
1680
+ 'time',
1681
+ {
1682
+ className: 'meta-date',
1683
+ dateTime: moment(published).utc().format(moment.HTML5_FMT.DATETIME_LOCAL_MS) },
1684
+ moment(published).format('LL')
1685
+ )
1686
+ )
1687
+ /* Show Published date */
1688
+ ,
1689
+ React__default.createElement(
1690
+ 'div',
1691
+ { className: 'mb-3' },
1692
+ !isVideoSeries && authorDetails && authorDetails.map(function (authorDetail, index) {
1693
+ return React__default.createElement(
1694
+ 'span',
1695
+ { key: index },
1696
+ renderAuthor(authorDetail.displayName, authorDetail.url, index, authorDetails.length, authorPrefix, authorDetail.biography && renderAuthorBiography(authorDetail.biography[0]), authorDetail.profileImage && urlFor({ client: props.client, source: authorDetail.profileImage, imageHeight: authorImgHeight }), showAuthorDetails)
1697
+ );
1698
+ }),
1699
+ React__default.createElement(
1700
+ 'div',
1701
+ null,
1702
+ source && React__default.createElement(
1703
+ 'p',
1704
+ {
1705
+ style: {
1706
+ display: 'inline-block',
1707
+ padding: '0 .25rem',
1708
+ color: 'var(--franchise-primary, #484848)',
1709
+ borderRadius: '2px',
1710
+ fontWeight: 'bold',
1711
+ border: '2px solid var(--franchise-primary, #484848)'
1712
+ },
1713
+ className: 'source-label' },
1714
+ source
1715
+ )
1716
+ ),
1717
+ issue && React__default.createElement(
1718
+ 'div',
1719
+ { className: 'volume-issue' },
1720
+ issue.publication && issue.publication.name && React__default.createElement(
1721
+ 'span',
1722
+ { className: 'mb-0' },
1723
+ React__default.createElement(
1724
+ 'b',
1725
+ null,
1726
+ issue.publication.name
1727
+ ),
1728
+ ',',
1729
+ ' '
1730
+ ),
1731
+ issue.name && React__default.createElement(
1732
+ 'span',
1733
+ { className: 'mb-0' },
1734
+ issue.name,
1735
+ ', '
1736
+ ),
1737
+ issue.volume && React__default.createElement(
1738
+ 'span',
1739
+ null,
1740
+ 'Volume ' + issue.volume,
1741
+ ','
1742
+ ),
1743
+ issue.issueNumber && React__default.createElement(
1744
+ 'span',
1745
+ null,
1746
+ ' Issue ' + issue.issueNumber
1747
+ )
1748
+ ),
1749
+ pageNumber && React__default.createElement(
1750
+ 'div',
1751
+ { className: 'article-pageNumber' },
1752
+ 'Pages: ' + pageNumber
1753
+ )
1754
+ ),
1755
+ React__default.createElement(
1756
+ 'div',
1757
+ { className: 'social-ris-container' },
1758
+ !isVideoSeries && showSocialShare && React__default.createElement(
1759
+ 'p',
1760
+ null,
1761
+ React__default.createElement(SocialShare, {
1762
+ shareUrl: shareUrl,
1763
+ shareTitle: shareTitle,
1764
+ shareVia: shareVia,
1765
+ shareSummary: shareSummary,
1766
+ shareSubject: shareSubject,
1767
+ shareImage: shareImage,
1768
+ size: 32,
1769
+ siteName: siteName,
1770
+ twitterSiteName: twitterSiteName,
1771
+ disableMeta: true,
1772
+ hidePinterest: hidePinterestShare,
1773
+ hideFacebook: hideFBShare
1774
+ })
1775
+ ),
1776
+ issue && downloadCitation && (!issue.hasOwnProperty('show_download_ris_button') || issue.show_download_ris_button !== false) && (!issue.publication || !issue.publication.hasOwnProperty('show_download_ris_button') || issue.publication.show_download_ris_button !== false) && React__default.createElement(
1777
+ Button,
1778
+ { className: 'ris-download-button', onClick: function onClick() {
1779
+ return downloadRIS();
1780
+ } },
1781
+ 'Download RIS'
1782
+ )
1783
+ )
1784
+ ),
1785
+ React__default.createElement(
1786
+ 'div',
1787
+ null,
1788
+ React__default.createElement(DocumentGroup, { article: props.article, client: props.client })
1789
+ )
1790
+ ),
1791
+ !isVideoSeries && summary && display_summary && React__default.createElement(
1792
+ 'p',
1793
+ null,
1794
+ React__default.createElement(
1795
+ 'em',
1796
+ null,
1797
+ summary
1798
+ )
1799
+ ),
1800
+ React__default.createElement(
1801
+ 'div',
1802
+ { className: 'ad-box', style: { textAlign: 'center' } },
1803
+ main_43 && !sponsoredFlag && props.article.Ads && props.article.Ads.length > 0 && props.article.Ads.map(function (ad, index) {
1804
+ if (index === 0) {
1805
+ return React__default.createElement(
1806
+ 'div',
1807
+ {
1808
+ key: index,
1809
+ id: 'addid-' + index,
1810
+ style: {
1811
+ display: 'flex',
1812
+ flex: '1 0 auto',
1813
+ justifyContent: 'center',
1814
+ alignItems: 'center',
1815
+ textAlign: 'center'
1816
+ } },
1817
+ ad.component
1818
+ );
1819
+ }
1820
+ })
1821
+ ),
1822
+ React__default.createElement(
1823
+ 'div',
1824
+ { className: 'block-content mt-3' },
1825
+ !isVideoSeries && renderBlockContent(article, meta),
1826
+ React__default.createElement('div', { className: 'clearfix' }),
1827
+ React__default.createElement(
1828
+ 'noscript',
1829
+ null,
1830
+ React__default.createElement(
1831
+ 'div',
1832
+ { style: { display: 'flex', justifyContent: 'center' }, className: 'series-links' },
1833
+ props.article.seriesDetail && props.article.seriesDetail.prevUrl && React__default.createElement(
1834
+ 'a',
1835
+ { className: 'mx-3', href: props.article.seriesDetail.prevUrl },
1836
+ 'Previous ',
1837
+ props.article.seriesDetail.type
1838
+ ),
1839
+ props.article.seriesDetail && props.article.seriesDetail.nextUrl && React__default.createElement(
1840
+ 'a',
1841
+ { className: 'mx-3', href: props.article.seriesDetail.nextUrl },
1842
+ 'Next ',
1843
+ props.article.seriesDetail.type
1844
+ )
1845
+ )
1846
+ ),
1847
+ React__default.createElement(
1848
+ 'div',
1849
+ { className: 'downloads-container' },
1850
+ issue && issue.pdf && React__default.createElement(
1851
+ 'a',
1852
+ { rel: 'noopener', href: urlForFile({ asset: issue.pdf }), target: '_blank', title: 'Download issue' },
1853
+ React__default.createElement('img', { style: { margin: '1rem', maxHeight: '40px', maxWidth: '40px' }, src: '/download.png', alt: 'download issue' }),
1854
+ 'Download Issue : ',
1855
+ issue.name
1856
+ )
1857
+ )
1858
+ ),
1859
+ React__default.createElement('div', { className: 'clearfix', style: { minHeight: '1px' } }),
1860
+ article.documentGroup && article.documentGroup.isSeries && sliderData && !seriesInfo.hasVideo && React__default.createElement(
1861
+ 'div',
1862
+ null,
1863
+ false ,
1864
+ React__default.createElement(SeriesSlider, { dataset: sliderData, client: client, nowPlaying: article.title, displayEpisodeNumber: logicforDisplayingEpisodeNumber })
1865
+ ),
1866
+ showRelatedArticles && !showIsi && React__default.createElement(RelatedContent, null),
1867
+ disqusConfig && showDisqus && React__default.createElement(
1868
+ 'div',
1869
+ { id: 'disqusContainer' },
1870
+ React__default.createElement(DiscussionEmbed, {
1871
+ shortname: disqusConfig.shortname,
1872
+ config: {
1873
+ url: disqusConfig.url,
1874
+ identifier: disqusConfig.identifier,
1875
+ title: disqusConfig.title
1876
+ }
1877
+ })
1878
+ )
1879
+ ),
1880
+ renderIsiContent(props.article)
1881
+ )
1882
+ ),
1883
+ showIsi && Array.isArray(isi) && isi.length > 0 && React__default.createElement(
1884
+ ISI,
1885
+ null,
1886
+ React__default.createElement(BlockContent, {
1887
+ serializers: getSerializers(client, pageview, videoAccountIDs, onVote, true, drupalLeadSettings, currentPage, false, false, null, article.Ads, targeting),
1888
+ blocks: isi
1889
+ })
1890
+ ),
1891
+ main_43 && !sponsoredFlag && props.article.Ads && props.article.Ads.length > 0 && props.article.Ads.map(function (ad, index) {
1892
+ if (index > 0) {
1893
+ return React__default.createElement(
1894
+ 'div',
1895
+ { key: index, id: 'addid-' + index },
1896
+ ad.component
1897
+ );
1898
+ }
1899
+ }),
1900
+ React__default.createElement(
1901
+ 'noscript',
1902
+ null,
1903
+ props.infiniteScroll && props.article.relatedArticle && props.article.relatedArticle[0] && props.article.relatedArticle[0].url && props.article.relatedArticle[0].url.current && React__default.createElement(
1904
+ 'div',
1905
+ { style: { textAlign: 'center' } },
1906
+ React__default.createElement(
1907
+ 'a',
1908
+ { href: '/view/' + props.article.relatedArticle[0].url.current },
1909
+ 'Related Article ',
1910
+ '>>>'
1911
+ )
1912
+ )
1913
+ ),
1914
+ props.infiniteScroll && React__default.createElement('hr', { className: 'article-seperater mb-5 mt-3' }),
1915
+ React__default.createElement(Schema, { article: props.article, Website: props.Website, client: props.client })
1916
+ );
1917
+ };
1918
+
1919
+ if (passwordLock) {
1920
+ if (auth === 2) {
1921
+ return detail();
1922
+ } else {
1923
+ return form();
1924
+ }
1925
+ } else {
1926
+ return detail();
1927
+ }
1928
+ }), function (prevProps, nextProps) {
1929
+ if (prevProps.article._id === nextProps.article._id) return true;
1930
+ return false;
1931
+ });
1932
+
1933
+ var _this$1 = undefined;
1934
+
1935
+ var ArticleQueue = function ArticleQueue(props) {
1936
+ var router = useRouter();
1937
+
1938
+ var _props$prevUrl = props.prevUrl,
1939
+ prevUrl = _props$prevUrl === undefined ? '/' : _props$prevUrl,
1940
+ Ads = props.Ads,
1941
+ _props$maxListLength = props.maxListLength,
1942
+ maxListLength = _props$maxListLength === undefined ? 10 : _props$maxListLength;
1943
+ props.sponsoredTaxonomies;
1944
+ var _props$cpModification = props.cpModificationRequired,
1945
+ cpModificationRequired = _props$cpModification === undefined ? false : _props$cpModification,
1946
+ _props$authorPrefix = props.authorPrefix,
1947
+ authorPrefix = _props$authorPrefix === undefined ? 'authors' : _props$authorPrefix,
1948
+ showRelatedArticles = props.showRelatedArticles,
1949
+ canonicalTag = props.canonicalTag,
1950
+ _props$disablePrevUrl = props.disablePrevUrlCheckContentPlacement,
1951
+ disablePrevUrlCheckContentPlacement = _props$disablePrevUrl === undefined ? false : _props$disablePrevUrl;
1952
+
1953
+ var _useState = useState(0),
1954
+ _useState2 = _slicedToArray(_useState, 2),
1955
+ containerHeight = _useState2[0],
1956
+ setContainerHeight = _useState2[1];
1957
+
1958
+ useEffect(function () {
1959
+ var checkFullScreen = function checkFullScreen() {
1960
+ if (window.innerWidth == screen.width && window.innerHeight == screen.height) {
1961
+ return true;
1962
+ } else {
1963
+ return false;
1964
+ }
1965
+ };
1966
+ setContainerHeight(function () {
1967
+ return window.innerHeight;
1968
+ });
1969
+ var handleResize = function handleResize() {
1970
+ return !checkFullScreen() && setContainerHeight(function () {
1971
+ return window.innerHeight;
1972
+ });
1973
+ };
1974
+ window.addEventListener('resize', handleResize);
1975
+ return function () {
1976
+ return window.removeEventListener('resize', handleResize);
1977
+ };
1978
+ }, []);
1979
+
1980
+ var firstArticle = function firstArticle() {
1981
+ var article = _Object$assign({}, props.article);
1982
+ var targeting = getTargeting(props);
1983
+ article.Ads = Ads.getRightItems(targeting);
1984
+ return article;
1985
+ };
1986
+
1987
+ var _useState3 = useState([firstArticle()]),
1988
+ _useState4 = _slicedToArray(_useState3, 2),
1989
+ queueData = _useState4[0],
1990
+ setQueueData = _useState4[1];
1991
+
1992
+ var _useState5 = useState(queueData[0]._id),
1993
+ _useState6 = _slicedToArray(_useState5, 2),
1994
+ active = _useState6[0],
1995
+ setActive = _useState6[1];
1996
+
1997
+ var refreshAD = function refreshAD(path) {
1998
+ var activeArticle = queueData.find(function (item) {
1999
+ return item.url.current === path;
2000
+ });
2001
+ var targeting = getTargeting({ article: activeArticle, cpModificationRequired: cpModificationRequired, position: props.position, prevUrl: prevUrl, disablePrevUrlCheckContentPlacement: disablePrevUrlCheckContentPlacement });
2002
+ if (!main_43) {
2003
+ lib_3.getGoogletag().then(function (googletag) {
2004
+ if (window.googletag && googletag.pubadsReady) {
2005
+ var slots = googletag.pubads().getSlots();
2006
+ slots.forEach(function (slot) {
2007
+ var pos = slot.getTargeting('pos');
2008
+ slot.clearTargeting();
2009
+ _Object$keys(targeting).forEach(function (key) {
2010
+ slot.setTargeting(key, targeting[key]);
2011
+ });
2012
+ slot.setTargeting('pos', pos);
2013
+ });
2014
+ lib_3.refresh();
2015
+ }
2016
+ });
2017
+ }
2018
+ //Refresh leaderboard ad on mobile
2019
+ if (main_43) {
2020
+ var leaderboardSlotId = '';
2021
+ lib_3.getGoogletag().then(function (googletag) {
2022
+ if (window.googletag && googletag.pubadsReady) {
2023
+ var slots = googletag.pubads().getSlots();
2024
+ slots.forEach(function (slot) {
2025
+ var pos = slot.getTargeting('pos');
2026
+ if (pos == 'top-mobile') {
2027
+ //gets the slotId of the leaderboard ad to refresh
2028
+ leaderboardSlotId = slot.getSlotId().getDomId();
2029
+ slot.clearTargeting();
2030
+ _Object$keys(targeting).forEach(function (key) {
2031
+ slot.setTargeting(key, targeting[key]);
2032
+ });
2033
+ slot.setTargeting('pos', pos);
2034
+ }
2035
+ });
2036
+ lib_3.refresh(leaderboardSlotId);
2037
+ }
2038
+ });
2039
+ }
2040
+ };
2041
+
2042
+ var hasVerticalScroll = function hasVerticalScroll() {
2043
+ if (window.innerHeight) {
2044
+ return document.body.offsetHeight > window.innerHeight;
2045
+ } else {
2046
+ return document.documentElement.scrollHeight > document.documentElement.offsetHeight || document.body.scrollHeight > document.body.offsetHeight;
2047
+ }
2048
+ };
2049
+
2050
+ useEffect(function () {
2051
+ // Fetching related article after component mounted if vertical scroll not found
2052
+ setTimeout(function () {
2053
+ if (!hasVerticalScroll()) {
2054
+ loadmore();
2055
+ }
2056
+ }, 1000);
2057
+ }, [queueData.length]);
2058
+
2059
+ var loadmore = function () {
2060
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee() {
2061
+ var index, article, startingIndex, endingIndex, targeting;
2062
+ return regenerator.wrap(function _callee$(_context) {
2063
+ while (1) {
2064
+ switch (_context.prev = _context.next) {
2065
+ case 0:
2066
+ if (!(queueData && queueData.length < maxListLength)) {
2067
+ _context.next = 27;
2068
+ break;
2069
+ }
2070
+
2071
+ index = queueData.length - 1;
2072
+ article = null;
2073
+ _context.prev = 3;
2074
+ _context.next = 6;
2075
+ return getRelatedArticle(null, props.client, props.article, prevUrl, index);
2076
+
2077
+ case 6:
2078
+ article = _context.sent;
2079
+ _context.next = 12;
2080
+ break;
2081
+
2082
+ case 9:
2083
+ _context.prev = 9;
2084
+ _context.t0 = _context['catch'](3);
2085
+
2086
+ console.error(_context.t0);
2087
+
2088
+ case 12:
2089
+ if (!(article && article._id)) {
2090
+ _context.next = 27;
2091
+ break;
2092
+ }
2093
+
2094
+ //query next 4 related article without repeating previous 4 related articles
2095
+ startingIndex = queueData.length + 1;
2096
+ endingIndex = startingIndex + 2;
2097
+ _context.prev = 15;
2098
+ _context.next = 18;
2099
+ return getRelatedArticle(null, props.client, props.article, prevUrl, startingIndex + '..' + endingIndex);
2100
+
2101
+ case 18:
2102
+ article.relatedArticle = _context.sent;
2103
+ _context.next = 24;
2104
+ break;
2105
+
2106
+ case 21:
2107
+ _context.prev = 21;
2108
+ _context.t1 = _context['catch'](15);
2109
+
2110
+ console.error(_context.t1);
2111
+
2112
+ case 24:
2113
+ targeting = getTargeting({ article: article, cpModificationRequired: cpModificationRequired, prevUrl: prevUrl, disablePrevUrlCheckContentPlacement: disablePrevUrlCheckContentPlacement });
2114
+
2115
+ article.Ads = Ads.getRightItems(targeting);
2116
+ setQueueData([].concat(_toConsumableArray(queueData), [article]));
2117
+
2118
+ case 27:
2119
+ case 'end':
2120
+ return _context.stop();
2121
+ }
2122
+ }
2123
+ }, _callee, _this$1, [[3, 9], [15, 21]]);
2124
+ }));
2125
+
2126
+ return function loadmore() {
2127
+ return _ref.apply(this, arguments);
2128
+ };
2129
+ }();
2130
+
2131
+ var currentPath = router && router.asPath;
2132
+ var seoLinks = props.cache.seoManager && props.cache.seoManager.filter(function (eachDocument) {
2133
+ return eachDocument.urlSeo == currentPath;
2134
+ });
2135
+
2136
+ var metaDescriptionSanity = seoLinks && seoLinks.length == 1 && seoLinks[0].metaDescription;
2137
+ var metaTitleSanity = seoLinks && seoLinks.length == 1 && seoLinks[0].metaTitle;
2138
+ // let urlSeo = seoLinks && seoLinks.length ==1 && seoLinks[0].urlSeo
2139
+
2140
+ var changeMetaFromSanity = function changeMetaFromSanity(metaDescription, metaTitle, oldMeta) {
2141
+ document.title = metaTitle;
2142
+ //this was throwing an error if there was no description, doing a check for the description meta
2143
+ if (document.querySelector('meta[name="description"]')) document.querySelector('meta[name="description"]').setAttribute('content', metaDescription);
2144
+ document.querySelector('meta[name="keywords"]').setAttribute('content', oldMeta.shareKeywords);
2145
+ document.querySelector('meta[property="og:url"]').setAttribute('content', oldMeta.shareUrl);
2146
+ document.querySelector('meta[property="og:title"]').setAttribute('content', metaTitle);
2147
+ document.querySelector('meta[property="og:site_name"]').setAttribute('content', oldMeta.shareVia);
2148
+ document.querySelector('meta[property="og:description"]').setAttribute('content', metaDescription);
2149
+ document.querySelector('meta[name="twitter:title"]').setAttribute('content', metaTitle);
2150
+ document.querySelector('meta[name="twitter:image"]').setAttribute('content', oldMeta.shareImage);
2151
+ document.querySelector('meta[name="twitter:site"]').setAttribute('content', oldMeta.shareVia);
2152
+ //this was throwing an error if there was no description, doing a check for the description meta
2153
+ if (document.querySelector('meta[name="twitter:description"]')) document.querySelector('meta[name="twitter:description"]').setAttribute('content', metaDescription);
2154
+ if (canonicalTag) {
2155
+ document.querySelector('link[rel="canonical"]').setAttribute('href', oldMeta.shareUrl);
2156
+ }
2157
+ };
2158
+
2159
+ var changeMeta = function changeMeta(meta) {
2160
+ document.title = meta.shareTitle;
2161
+ //this was throwing an error if there was no description, doing a check for the description meta
2162
+ if (document.querySelector('meta[name="description"]')) document.querySelector('meta[name="description"]').setAttribute('content', meta.shareSummary);
2163
+ document.querySelector('meta[name="keywords"]').setAttribute('content', meta.shareKeywords);
2164
+ document.querySelector('meta[property="og:url"]').setAttribute('content', meta.shareUrl);
2165
+ document.querySelector('meta[property="og:title"]').setAttribute('content', meta.shareTitle);
2166
+ document.querySelector('meta[property="og:site_name"]').setAttribute('content', meta.shareVia);
2167
+ document.querySelector('meta[property="og:description"]').setAttribute('content', meta.shareSummary);
2168
+ document.querySelector('meta[name="twitter:title"]').setAttribute('content', meta.shareTitle);
2169
+ document.querySelector('meta[name="twitter:image"]').setAttribute('content', meta.shareImage);
2170
+ document.querySelector('meta[name="twitter:site"]').setAttribute('content', meta.shareVia);
2171
+ //this was throwing an error if there was no description, doing a check for the description meta
2172
+ if (document.querySelector('meta[name="twitter:description"]')) document.querySelector('meta[name="twitter:description"]').setAttribute('content', meta.shareSummary);
2173
+ if (canonicalTag) {
2174
+ document.querySelector('link[rel="canonical"]').setAttribute('href', meta.shareUrl);
2175
+ }
2176
+ };
2177
+
2178
+ var onChangeArticle = function onChangeArticle(path, meta, pageviewProperties) {
2179
+ var newPath = '/view/' + path;
2180
+ var activeArticle = queueData.find(function (item) {
2181
+ return item.url.current === path;
2182
+ });
2183
+ setActive(function () {
2184
+ return activeArticle._id;
2185
+ });
2186
+ // Change URL and do other changes
2187
+ window.history.pushState({ page: path }, meta.shareTitle, newPath);
2188
+
2189
+ if (metaDescriptionSanity && metaTitleSanity && currentPath == newPath) {
2190
+ changeMetaFromSanity(metaDescriptionSanity, metaTitleSanity, meta);
2191
+ } else {
2192
+ changeMeta(meta);
2193
+ }
2194
+ if (props.setCustomDimensions) {
2195
+ props.setCustomDimensions(activeArticle, '200', prevUrl, '');
2196
+ }
2197
+ if (props.pageview) props.pageview(newPath, null, pageviewProperties);
2198
+ if (props.gtagSetCustomDimensions) props.gtagSetCustomDimensions(activeArticle, '200', prevUrl, '', true);
2199
+ refreshAD(path);
2200
+ };
2201
+
2202
+ return React__default.createElement(
2203
+ InfiniteScroll,
2204
+ { dataLength: queueData.length, next: loadmore, scrollThreshold: '40%', hasMore: true, style: { overflow: 'hidden' } },
2205
+ queueData.map(function (article, index) {
2206
+ return React__default.createElement(
2207
+ React__default.Fragment,
2208
+ { key: index },
2209
+ React__default.createElement(Article, _extends({}, props, {
2210
+ containerHeight: containerHeight,
2211
+ onChangeArticle: onChangeArticle,
2212
+ authorPrfix: authorPrefix,
2213
+ article: article,
2214
+ cpModificationRequired: cpModificationRequired,
2215
+ active: active === article._id
2216
+ // Passing queueData to check for single article
2217
+ , queueData: queueData,
2218
+ showRelatedArticles: showRelatedArticles,
2219
+ index: index
2220
+ }))
2221
+ );
2222
+ })
2223
+ );
2224
+ };
2225
+
2226
+ var _this = undefined;
2227
+
2228
+ var View = function View(props) {
2229
+ var router = useRouter();
2230
+ var shareOptions = props.shareOptions,
2231
+ article = props.article,
2232
+ _props$article = props.article,
2233
+ hideComments = _props$article.hideComments,
2234
+ content_placement = _props$article.content_placement,
2235
+ _props$sponsoredFlag = props.sponsoredFlag,
2236
+ sponsoredFlag = _props$sponsoredFlag === undefined ? false : _props$sponsoredFlag;
2237
+ props.sponsoredTaxonomies;
2238
+ var Ads = props.Ads,
2239
+ setCustomDimensions = props.setCustomDimensions,
2240
+ gtagSetCustomDimensions = props.gtagSetCustomDimensions,
2241
+ statusCode = props.statusCode,
2242
+ prevUrl = props.prevUrl,
2243
+ pageview = props.pageview,
2244
+ _props$showRelatedArt = props.showRelatedArticles,
2245
+ showRelatedArticles = _props$showRelatedArt === undefined ? false : _props$showRelatedArt,
2246
+ _props$canonicalTag = props.canonicalTag,
2247
+ canonicalTag = _props$canonicalTag === undefined ? true : _props$canonicalTag,
2248
+ _props$infiniteScroll = props.infiniteScrollFlag,
2249
+ infiniteScrollFlag = _props$infiniteScroll === undefined ? true : _props$infiniteScroll;
2250
+ var _props$article2 = props.article,
2251
+ _props$article2$passw = _props$article2.passwordLock,
2252
+ passwordLock = _props$article2$passw === undefined ? false : _props$article2$passw;
2253
+ _props$article2.description;
2254
+ var title = _props$article2.title,
2255
+ seriesShareOptions = _props$article2.seriesShareOptions;
2256
+
2257
+ var _useState = useState(0),
2258
+ _useState2 = _slicedToArray(_useState, 2),
2259
+ currentPage = _useState2[0],
2260
+ setCurrentPage = _useState2[1];
2261
+ // Logging GA pageview for the initial article with custom dimensions
2262
+
2263
+
2264
+ useEffect(function () {
2265
+ if (pageview && setCustomDimensions) {
2266
+ var timer = void 0;
2267
+ var pageviewProperties = _extends({}, getTargeting(props), {
2268
+ category: article && article.category ? article.category.name : ''
2269
+ });
2270
+ var waitAndExicute = function waitAndExicute() {
2271
+ if (typeof window.GA_INITIALIZED !== 'undefined') {
2272
+ setCustomDimensions(article, statusCode, prevUrl, '');
2273
+ pageview(router.asPath, null, pageviewProperties);
2274
+ } else timer = setTimeout(waitAndExicute, 1000);
2275
+ };
2276
+ waitAndExicute();
2277
+ return function () {
2278
+ clearTimeout(timer);
2279
+ };
2280
+ } else if (gtagSetCustomDimensions) {
2281
+ var _timer = void 0;
2282
+ var _waitAndExicute = function _waitAndExicute() {
2283
+ if (typeof window.GA_INITIALIZED !== 'undefined') {
2284
+ gtagSetCustomDimensions(article, statusCode, prevUrl, '', false);
2285
+ } else _timer = setTimeout(_waitAndExicute, 1000);
2286
+ };
2287
+ _waitAndExicute();
2288
+ return function () {
2289
+ clearTimeout(_timer);
2290
+ };
2291
+ }
2292
+ }, []);
2293
+
2294
+ var isVideoSeries = false;
2295
+ // check for certain serializers that need to disable infinite scroll
2296
+ var checkBodyForDisableInfiniteScroll = function checkBodyForDisableInfiniteScroll(article) {
2297
+ if (!article || !article.body) {
2298
+ return false;
2299
+ }
2300
+ for (var i = 0; i < article.body.length; i++) {
2301
+ if (article.body[i]._type === 'articleSeries' || article.body[i]._type === 'slideshows' || article.body[i]._type === 'quiz') {
2302
+ return true;
2303
+ }
2304
+ var row = article.body[i];
2305
+ if (typeof row.videos !== 'undefined') {
2306
+ isVideoSeries = true;
2307
+ return true;
2308
+ }
2309
+ }
2310
+ return false;
2311
+ };
2312
+
2313
+ var isMediaSeries = false;
2314
+
2315
+ if (article.documentGroup && article.documentGroup.isSeries) {
2316
+ isMediaSeries = true;
2317
+ }
2318
+ if (!article.documentGroup && article.documentGroupMapping && checkDocGroupMappingForSeries(article.documentGroupMapping)) {
2319
+ isMediaSeries = true;
2320
+ }
2321
+
2322
+ var disableInfiniteScroll = checkBodyForDisableInfiniteScroll(props.article);
2323
+ var commentsEnabledInTaxonomy = Array.isArray(content_placement) && content_placement.some(function (t) {
2324
+ return t.showComments === true;
2325
+ });
2326
+ var showDisqus = commentsEnabledInTaxonomy || hideComments === false;
2327
+ var needInfiniteScroll = ['Articles', 'Videos', 'Podcasts'].includes(article.category.name) && article.taxonomyMapping && article.passwordLock !== true && !disableInfiniteScroll && !article.ExcludeFromInfiniteScroll && !sponsoredFlag && infiniteScrollFlag && !article.showIsi && !isMediaSeries && !showDisqus;
2328
+
2329
+ if (['Articles', 'Videos', 'Podcasts'].includes(article.category.name)) {
2330
+ title = null;
2331
+ }
2332
+
2333
+ if (!needInfiniteScroll && !title) {
2334
+ title = props.article ? props.article.title : '';
2335
+ }
2336
+ // add mobile ads to articles not using infinite scroll
2337
+ if (!needInfiniteScroll) {
2338
+ var targeting = getTargeting(props);
2339
+ article.Ads = Ads.getRightItems(targeting);
2340
+ if (!sponsoredFlag && Ads.getVideoContextualAD) {
2341
+ article.contextualVideoAD = Ads.getVideoContextualAD(getTargeting(props, 'in-context_video'));
2342
+ }
2343
+ if (!sponsoredFlag && Ads.getNativeContextualAD) {
2344
+ article.contextualAD = Ads.getNativeContextualAD(getTargeting(props, 'native-ad'));
2345
+ }
2346
+ }
2347
+ useEffect(function () {
2348
+ router.asPath && router.asPath.length > 0 && router.asPath.includes('?') && router.asPath.split('?')[1].split('&').forEach(function (item) {
2349
+ if (item.includes('page=')) {
2350
+ setCurrentPage(item.split('=')[1]);
2351
+ } else {
2352
+ setCurrentPage(0);
2353
+ }
2354
+ });
2355
+ if (!router.asPath.includes('page=') && currentPage !== 0) {
2356
+ setCurrentPage(0);
2357
+ }
2358
+ }, [router]);
2359
+
2360
+ var meta_description = seriesShareOptions && seriesShareOptions.seriesSummary ? '' + seriesShareOptions.seriesSummary + (currentPage > 0 ? ' | Page ' + currentPage : '') : article.seo && article.seo.meta_description ? '' + article.seo.meta_description + (currentPage > 0 ? ' | Page ' + currentPage : '') : shareOptions.shareSummary ? '' + shareOptions.shareSummary + (currentPage > 0 ? ' | Page ' + currentPage : '') : '' + (currentPage > 0 ? 'Page ' + currentPage : '');
2361
+
2362
+ if (isVideoSeries) {
2363
+ meta_description = seriesShareOptions && seriesShareOptions.seriesSummary ? '' + seriesShareOptions.seriesSummary + (currentPage > 0 ? ' | Page ' + currentPage : '') : '';
2364
+ }
2365
+
2366
+ var currentPath = router && router.asPath;
2367
+ var seoLinks = props.cache.seoManager && props.cache.seoManager.filter(function (eachDocument) {
2368
+ return eachDocument.urlSeo == currentPath;
2369
+ });
2370
+
2371
+ var metaDescriptionSanity = seoLinks && seoLinks.length == 1 && seoLinks[0].metaDescription;
2372
+ var metaTitleSanity = seoLinks && seoLinks.length == 1 && seoLinks[0].metaTitle;
2373
+ return React__default.createElement(
2374
+ React__default.Fragment,
2375
+ null,
2376
+ React__default.createElement(
2377
+ Head,
2378
+ null,
2379
+ React__default.createElement(
2380
+ 'title',
2381
+ { key: 'title' },
2382
+ metaTitleSanity ? '' + metaTitleSanity + (currentPage > 0 ? ' | Page ' + currentPage : '') : seriesShareOptions && seriesShareOptions.seriesTitle ? '' + seriesShareOptions.seriesTitle + (currentPage > 0 ? ' | Page ' + currentPage : '') : article && article.seo && article.seo.seo_title ? '' + article.seo.seo_title + (currentPage > 0 ? ' | Page ' + currentPage : '') : '' + article.title + (currentPage > 0 ? ' | Page ' + currentPage : '')
2383
+ ),
2384
+ metaDescriptionSanity ? React__default.createElement('meta', { name: 'description', key: 'description', content: metaDescriptionSanity }) : meta_description && React__default.createElement('meta', { name: 'description', key: 'description', content: meta_description }),
2385
+ React__default.createElement('meta', { name: 'keywords', content: getKeywords(article).join(','), key: 'keywords' }),
2386
+ passwordLock && React__default.createElement('meta', { name: 'robots', content: 'noindex, nofollow' }),
2387
+ React__default.createElement('meta', {
2388
+ property: 'og:url',
2389
+ content: seriesShareOptions && seriesShareOptions.seriesUrl ? shareOptions.shareUrl + seriesShareOptions.seriesUrl : shareOptions.shareUrl,
2390
+ key: 'og:url'
2391
+ }),
2392
+ React__default.createElement('meta', {
2393
+ property: 'og:title',
2394
+ content: metaTitleSanity ? '' + metaTitleSanity + (currentPage > 0 ? ' | Page ' + currentPage : '') : seriesShareOptions && seriesShareOptions.seriesTitle ? '' + seriesShareOptions.seriesTitle + (currentPage > 0 ? ' | Page ' + currentPage : '') : article.seo && article.seo.seo_title ? '' + article.seo.seo_title + (currentPage > 0 ? ' | Page ' + currentPage : '') : '' + shareOptions.shareTitle + (currentPage > 0 ? ' | Page ' + currentPage : ''),
2395
+ key: 'og:title'
2396
+ }),
2397
+ React__default.createElement('meta', {
2398
+ property: 'og:image',
2399
+ content: seriesShareOptions && seriesShareOptions.seriesThumbnail ? seriesShareOptions.seriesThumbnail : shareOptions.shareImage,
2400
+ key: 'og:image'
2401
+ }),
2402
+ React__default.createElement('meta', { property: 'og:site_name', content: props.Settings.title, key: 'og:site_name' }),
2403
+ metaDescriptionSanity ? React__default.createElement('meta', { property: 'og:description', key: 'og:description', content: metaDescriptionSanity }) : meta_description && React__default.createElement('meta', { property: 'og:description', key: 'og:description', content: meta_description }),
2404
+ React__default.createElement('meta', { name: 'twitter:card', content: 'summary', key: 'twitter:card' }),
2405
+ React__default.createElement('meta', {
2406
+ name: 'twitter:title',
2407
+ content: metaTitleSanity ? '' + metaTitleSanity + (currentPage > 0 ? ' | Page ' + currentPage : '') : seriesShareOptions && seriesShareOptions.seriesTitle ? '' + seriesShareOptions.seriesTitle + (currentPage > 0 ? ' | Page ' + currentPage : '') : article.seo && article.seo.seo_title ? '' + article.seo.seo_title + (currentPage > 0 ? ' | Page ' + currentPage : '') : '' + shareOptions.shareTitle + (currentPage > 0 ? ' | Page ' + currentPage : ''),
2408
+ key: 'twitter:title'
2409
+ }),
2410
+ React__default.createElement('meta', {
2411
+ name: 'twitter:image',
2412
+ content: seriesShareOptions && seriesShareOptions.seriesThumbnail ? seriesShareOptions.seriesThumbnail : shareOptions.shareImage,
2413
+ key: 'twitter:image'
2414
+ }),
2415
+ React__default.createElement('meta', { name: 'twitter:site', content: '@' + props.Settings.title, key: 'twitter:site' }),
2416
+ metaDescriptionSanity ? React__default.createElement('meta', { name: 'twitter:description', key: 'twitter:description', content: metaDescriptionSanity }) : meta_description && React__default.createElement('meta', { name: 'twitter:description', key: 'twitter:description', content: meta_description }),
2417
+ canonicalTag && React__default.createElement('link', {
2418
+ rel: 'canonical',
2419
+ href: seriesShareOptions && seriesShareOptions.seriesUrl ? shareOptions.shareUrl + seriesShareOptions.seriesUrl : shareOptions.shareUrl,
2420
+ key: 'canonical'
2421
+ }),
2422
+ React__default.createElement(
2423
+ 'noscript',
2424
+ null,
2425
+ props.article.seriesDetail && props.article.seriesDetail.prevUrl && React__default.createElement('link', { rel: 'prev', href: props.article.seriesDetail.prevUrl }),
2426
+ props.article.seriesDetail && props.article.seriesDetail.nextUrl && React__default.createElement('link', { rel: 'next', href: props.article.seriesDetail.nextUrl })
2427
+ )
2428
+ ),
2429
+ !needInfiniteScroll ? React__default.createElement(Article, _extends({ infiniteScroll: false, showRelatedArticles: showRelatedArticles, showDisqus: showDisqus }, props)) : React__default.createElement(ArticleQueue, _extends({
2430
+ infiniteScroll: true,
2431
+ showRelatedArticles: showRelatedArticles,
2432
+ canonicalTag: canonicalTag,
2433
+ checkSponsered: true,
2434
+ Ads: props.WAds,
2435
+ onVote: function onVote() {},
2436
+ sponsoredTaxonomies: []
2437
+ }, props))
2438
+ );
2439
+ };
2440
+
2441
+ // This should be called in /view/[url] getInitialProps to fetch the article data and related articles. This will also set the sponsoredFlag to true if any taxonomies have disabled ads.
2442
+ View.returnGetInitialProps = function () {
2443
+ var _ref = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(url, prevUrl, seriesVid, client, sao) {
2444
+ var context = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : null;
2445
+
2446
+ var article, relatedArticleQuery, sliderData, statusCode, sliderArticles, _sliderArticles, _context$query$series, seriesArticle, sponsoredFlag;
2447
+
2448
+ return regenerator.wrap(function _callee$(_context) {
2449
+ while (1) {
2450
+ switch (_context.prev = _context.next) {
2451
+ case 0:
2452
+ _context.next = 2;
2453
+ return client.fetch(getQuery('article'), { url: url });
2454
+
2455
+ case 2:
2456
+ article = _context.sent;
2457
+ relatedArticleQuery = getQuery('related');
2458
+
2459
+ article.seriesDetail = getSeriesDetail(article, seriesVid);
2460
+ sliderData = [];
2461
+ statusCode = 200;
2462
+
2463
+ if (!article || !article._id || !article.body) {
2464
+ statusCode = 404;
2465
+ }
2466
+
2467
+ if (!(article.documentGroup && article.documentGroup.isSeries)) {
2468
+ _context.next = 15;
2469
+ break;
2470
+ }
2471
+
2472
+ _context.next = 11;
2473
+ return client.fetch('*[!(_id in path("drafts.**")) \n && _type == "article"\n && defined(title)\n && references(\'' + article.documentGroup._id + '\')\n && is_visible == true\n && defined(published)\n && dateTime(published) <= dateTime(now())\n ] | order(published asc) {\n title,\n thumbnail,\n url,\n published\n }');
2474
+
2475
+ case 11:
2476
+ sliderArticles = _context.sent;
2477
+
2478
+ sliderData = sliderArticles;
2479
+ _context.next = 20;
2480
+ break;
2481
+
2482
+ case 15:
2483
+ if (!(article.documentGroupMapping && article.documentGroupMapping[0] && article.documentGroupMapping[0].isSeries)) {
2484
+ _context.next = 20;
2485
+ break;
2486
+ }
2487
+
2488
+ _context.next = 18;
2489
+ return client.fetch('*[!(_id in path("drafts.**")) \n && _type == "article"\n && defined(title)\n && references(\'' + article.documentGroupMapping[0]._id + '\')\n && is_visible == true\n && defined(published)\n && dateTime(published) <= dateTime(now())\n ] | order(published asc) {\n title,\n thumbnail,\n url,\n published\n }');
2490
+
2491
+ case 18:
2492
+ _sliderArticles = _context.sent;
2493
+
2494
+ sliderData = _sliderArticles;
2495
+
2496
+ case 20:
2497
+ _context$query$series = context.query.seriesArticle, seriesArticle = _context$query$series === undefined ? false : _context$query$series;
2498
+
2499
+ if ((seriesArticle || seriesVid) && article.body) {
2500
+ article.body.map(function (block) {
2501
+ if (block._type === 'articleSeries' && block.articles && block.articles.length > 0) {
2502
+ block.articles.map(function (subArticle) {
2503
+ if (subArticle.param.current === seriesArticle) {
2504
+ var seriesShareOptions = {
2505
+ seriesUrl: '?seriesArticle=' + seriesArticle,
2506
+ seriesTitle: subArticle.title,
2507
+ seriesSummary: subArticle.summary,
2508
+ seriesThumbnail: subArticle.thumbnail && subArticle.thumbnail.asset ? urlFor({ client: client, source: subArticle.thumbnail.asset }) : null
2509
+ };
2510
+ article.seriesShareOptions = seriesShareOptions;
2511
+ }
2512
+ });
2513
+ }
2514
+ if (block._type === 'youtubeGallery' && block.videos && block.videos.length > 0) {
2515
+ block.videos.map(function (video, index) {
2516
+ if (index + 1 === Number(seriesVid)) {
2517
+ var seriesShareOptions = {
2518
+ seriesUrl: '?seriesVid=' + seriesVid,
2519
+ seriesTitle: video.title,
2520
+ seriesSummary: video.intro,
2521
+ seriesThumbnail: video.thumbnail && video.thumbnail.asset ? urlFor({ client: client, source: video.thumbnail.asset }) : null
2522
+ };
2523
+ article.seriesShareOptions = seriesShareOptions;
2524
+ }
2525
+ });
2526
+ }
2527
+ });
2528
+ }
2529
+ sponsoredFlag = false;
2530
+ // check for disableAds flag on each taxonomoy
2531
+
2532
+ if (article && article.content_placement) {
2533
+ article.content_placement.forEach(function (x) {
2534
+ if (x.disableAds) {
2535
+ sponsoredFlag = true;
2536
+ }
2537
+ });
2538
+ }
2539
+ // check for disableAds flag on content category
2540
+ if (article.category && article.category.disableAds) {
2541
+ sponsoredFlag = true;
2542
+ }
2543
+
2544
+ if (!article.disableRelatedContent) {
2545
+ _context.next = 30;
2546
+ break;
2547
+ }
2548
+
2549
+ article.relatedArticle = null;
2550
+ _context.next = 34;
2551
+ break;
2552
+
2553
+ case 30:
2554
+ if (!article) {
2555
+ _context.next = 34;
2556
+ break;
2557
+ }
2558
+
2559
+ _context.next = 33;
2560
+ return getRelatedArticle(context, client, article, prevUrl, '0..2');
2561
+
2562
+ case 33:
2563
+ article.relatedArticle = _context.sent;
2564
+
2565
+ case 34:
2566
+ return _context.abrupt('return', {
2567
+ url: url,
2568
+ sao: sao,
2569
+ statusCode: statusCode,
2570
+ prevUrl: prevUrl,
2571
+ relatedArticleQuery: relatedArticleQuery,
2572
+ article: article,
2573
+ sliderData: sliderData,
2574
+ sponsoredFlag: sponsoredFlag
2575
+ });
2576
+
2577
+ case 35:
2578
+ case 'end':
2579
+ return _context.stop();
2580
+ }
2581
+ }
2582
+ }, _callee, _this);
2583
+ }));
2584
+
2585
+ return function (_x, _x2, _x3, _x4, _x5) {
2586
+ return _ref.apply(this, arguments);
2587
+ };
2588
+ }();
2589
+
2590
+ export default View;