@mjhls/mjh-framework 1.0.850-affiliatefix-v1 → 1.0.850-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (318) hide show
  1. package/README.md +168 -168
  2. package/dist/cjs/AD.js +9 -10
  3. package/dist/cjs/AD300x250.js +30 -31
  4. package/dist/cjs/AD300x250x600.js +30 -31
  5. package/dist/cjs/AD728x90.js +33 -34
  6. package/dist/cjs/ADFloatingFooter.js +32 -33
  7. package/dist/cjs/ADFooter.js +14 -15
  8. package/dist/cjs/ADGutter.js +32 -33
  9. package/dist/cjs/{ADInfeed-859820d9.js → ADInfeed-98c71bcd.js} +13 -15
  10. package/dist/cjs/ADSkyscraper.js +32 -33
  11. package/dist/cjs/ADSponsoredResources.js +32 -33
  12. package/dist/cjs/ADWebcast.js +32 -33
  13. package/dist/cjs/ADWelcome.js +33 -34
  14. package/dist/cjs/{ADlgInfeed-da3a36a6.js → ADlgInfeed-9de32585.js} +10 -11
  15. package/dist/cjs/AccordionPanel.js +29 -31
  16. package/dist/cjs/AdSlot.js +101 -34
  17. package/dist/cjs/AdSlotsProvider.js +33 -25
  18. package/dist/cjs/AlgoliaSearch.js +1080 -1076
  19. package/dist/cjs/AlphabeticList.js +25 -26
  20. package/dist/cjs/ArticleCarousel.js +23 -24
  21. package/dist/cjs/ArticleProgramLandingPage.js +58 -60
  22. package/dist/cjs/ArticleSeriesLandingPage.js +40 -41
  23. package/dist/cjs/ArticleSeriesListing.js +61 -62
  24. package/dist/cjs/AuthWrapper.js +423 -1739
  25. package/dist/cjs/{AuthorComponent-c21aac7f.js → AuthorComponent-bb831b74.js} +13 -14
  26. package/dist/cjs/Beam.js +8 -8
  27. package/dist/cjs/{BlockContent-36e54d77.js → BlockContent-091a991f.js} +55 -56
  28. package/dist/cjs/Breadcrumbs.js +27 -29
  29. package/dist/cjs/CMEDeck.js +83 -83
  30. package/dist/cjs/Column1.js +11 -14
  31. package/dist/cjs/Column2.js +33 -36
  32. package/dist/cjs/Column3.js +59 -62
  33. package/dist/cjs/ConferenceArticleCard.js +37 -38
  34. package/dist/cjs/ConferenceBanner-4a16fddc.js +23 -0
  35. package/dist/cjs/DeckContent.js +103 -107
  36. package/dist/cjs/DeckQueue.js +90 -94
  37. package/dist/cjs/{Dfp-93399f8c.js → Dfp-26baccf1.js} +34 -35
  38. package/dist/cjs/EventsDeck.js +152 -159
  39. package/dist/cjs/ExternalResources.js +79 -81
  40. package/dist/cjs/Feature.js +24 -26
  41. package/dist/cjs/ForbesHero.js +42 -43
  42. package/dist/cjs/GridContent.js +304 -190
  43. package/dist/cjs/GridHero.js +44 -45
  44. package/dist/cjs/GroupDeck.js +59 -60
  45. package/dist/cjs/HamMagazine.js +141 -146
  46. package/dist/cjs/Header.js +12 -14
  47. package/dist/cjs/Hero.js +12 -13
  48. package/dist/cjs/HighlightenVideo.js +17 -18
  49. package/dist/cjs/HorizontalArticleListing.js +71 -73
  50. package/dist/cjs/HorizontalHero.js +25 -26
  51. package/dist/cjs/IssueContentDeck.js +73 -78
  52. package/dist/cjs/IssueDeck.js +72 -77
  53. package/dist/cjs/IssueLanding.js +92 -96
  54. package/dist/cjs/KMTracker.js +15 -15
  55. package/dist/cjs/LeftNav.js +39 -41
  56. package/dist/cjs/MasterDeck.js +80 -81
  57. package/dist/cjs/MediaSeriesLanding.js +1138 -1230
  58. package/dist/cjs/NavDvm.js +74 -79
  59. package/dist/cjs/{NavFooter-3dcd99a8.js → NavFooter-76c913e3.js} +14 -15
  60. package/dist/cjs/NavMagazine.js +148 -153
  61. package/dist/cjs/NavNative.js +145 -153
  62. package/dist/cjs/OncliveHero.js +19 -19
  63. package/dist/cjs/OncliveLargeHero.js +72 -73
  64. package/dist/cjs/PageFilter.js +14 -15
  65. package/dist/cjs/PartnerDetailListing.js +106 -115
  66. package/dist/cjs/PdfDownload.js +9 -10
  67. package/dist/cjs/PopUpModal.js +19 -21
  68. package/dist/cjs/PubSection.js +40 -43
  69. package/dist/cjs/PubToc.js +15 -16
  70. package/dist/cjs/PublicationDeck.js +62 -67
  71. package/dist/cjs/PublicationLanding.js +135 -139
  72. package/dist/cjs/QueueDeckExpanded.js +2172 -1167
  73. package/dist/cjs/RecentNews.js +22 -23
  74. package/dist/cjs/RelatedContent.js +54 -55
  75. package/dist/cjs/RelatedTopicsDropdown.js +29 -32
  76. package/dist/cjs/RolesDeck.js +27 -32
  77. package/dist/cjs/Search.js +18 -22
  78. package/dist/cjs/Segment.js +368 -343
  79. package/dist/cjs/SeriesListingDeck.js +38 -38
  80. package/dist/cjs/{SeriesSlider-34c6cc2b.js → SeriesSlider-8bbc989f.js} +39 -40
  81. package/dist/cjs/SetCookie.js +1 -1
  82. package/dist/cjs/SideFooter.js +38 -39
  83. package/dist/cjs/SocialIcons.js +9 -10
  84. package/dist/cjs/{SocialSearchComponent-948138c7.js → SocialSearchComponent-cea213aa.js} +36 -40
  85. package/dist/cjs/SocialShare.js +29 -31
  86. package/dist/cjs/TaxonomyCard.js +59 -64
  87. package/dist/cjs/TaxonomyDescription.js +54 -56
  88. package/dist/cjs/TemplateNormal.js +74 -75
  89. package/dist/cjs/ThumbnailCard.js +21 -23
  90. package/dist/cjs/Ustream.js +30 -31
  91. package/dist/cjs/VerticalHero.js +16 -17
  92. package/dist/cjs/VideoProgramLandingPage.js +73 -78
  93. package/dist/cjs/VideoSeriesCard.js +33 -34
  94. package/dist/cjs/VideoSeriesFilter.js +18 -18
  95. package/dist/cjs/VideoSeriesLandingPage.js +50 -51
  96. package/dist/cjs/VideoSeriesListing.js +82 -81
  97. package/dist/cjs/View.js +342 -266
  98. package/dist/cjs/YahooHero.js +41 -42
  99. package/dist/cjs/YoutubeGroup.js +66 -67
  100. package/dist/cjs/{_is-array-6128bd56.js → _is-array-754e012d.js} +6 -6
  101. package/dist/cjs/{_iter-detect-55a5657a.js → _iter-detect-60b2f026.js} +8 -8
  102. package/dist/cjs/{_object-pie-083f2dd6.js → _object-pie-68c5bcbc.js} +4 -4
  103. package/dist/cjs/{_object-sap-a175b4a9.js → _object-sap-5e74ba08.js} +1 -1
  104. package/dist/cjs/{_object-to-array-8fe5a54f.js → _object-to-array-5762f850.js} +2 -2
  105. package/dist/cjs/{_to-object-6de10e57.js → _to-object-329a650b.js} +8 -8
  106. package/dist/cjs/{asyncToGenerator-58c289d9.js → asyncToGenerator-140e5f89.js} +32 -32
  107. package/dist/cjs/{brightcove-react-player-loader.es-a195642e.js → brightcove-react-player-loader.es-156bd4d6.js} +9 -11
  108. package/dist/cjs/{core.get-iterator-method-f474eacc.js → core.get-iterator-method-f62321d4.js} +2 -2
  109. package/dist/cjs/{debounce-d4a2369b.js → debounce-529c8d06.js} +2 -2
  110. package/dist/cjs/{define-property-c88be878.js → define-property-f4d12f4e.js} +6 -6
  111. package/dist/cjs/{defineProperty-0cb76d99.js → defineProperty-55548b25.js} +1 -1
  112. package/dist/cjs/{entities-3f9d0f2f.js → entities-310b46ee.js} +1 -1
  113. package/dist/cjs/{eq-5fc26c07.js → eq-bb2843ed.js} +1 -1
  114. package/dist/cjs/{es6.string.iterator-c2573ffd.js → es6.string.iterator-cc0bbaa4.js} +6 -6
  115. package/dist/cjs/{extends-29bdbc6d.js → extends-0a918631.js} +7 -7
  116. package/dist/cjs/faundadb.js +327 -10
  117. package/dist/cjs/{get-5839e5b5.js → get-adbb11e3.js} +21 -21
  118. package/dist/cjs/getQuery.js +2 -2
  119. package/dist/cjs/getRelatedArticle.js +28 -445
  120. package/dist/cjs/getRootDocGroup.js +6 -6
  121. package/dist/cjs/getSerializers.js +44 -45
  122. package/dist/cjs/{getTargeting-be6168ad.js → getTargeting-f1821260.js} +26 -17
  123. package/dist/cjs/getTargeting.js +8 -8
  124. package/dist/{esm/iconBase-ccc56b97.js → cjs/iconBase-68959171.js} +8 -2
  125. package/dist/cjs/{index-f86bb269.js → index-3294d3bc.js} +45 -44
  126. package/dist/cjs/{index-060c5d65.js → index-4151deb3.js} +1615 -1009
  127. package/dist/cjs/{index-eadd5035.js → index-96b3db50.js} +15 -17
  128. package/dist/cjs/{index-fc2f1ca2.js → index-98e01cb9.js} +12 -13
  129. package/dist/cjs/{index-efca863c.js → index-be0c82be.js} +30 -36
  130. package/dist/cjs/{index-50be6759.js → index-e2e62963.js} +10 -26
  131. package/dist/cjs/{index.es-f3e47207.js → index.es-9110add6.js} +12 -31
  132. package/dist/cjs/{index.esm-2bb721c8.js → index.esm-4d410430.js} +21 -21
  133. package/dist/cjs/{index.esm-00a6aade.js → index.esm-90433435.js} +16 -7
  134. package/dist/cjs/{index.esm-c1e16606.js → index.esm-e32d3e8e.js} +7 -4
  135. package/dist/cjs/{index.esm-f27f80d9.js → index.esm-ff47db6f.js} +13 -6
  136. package/dist/cjs/index.js +158 -170
  137. package/dist/cjs/{inherits-c2065b95.js → inherits-9953db94.js} +22 -22
  138. package/dist/cjs/{isSymbol-03abbdf0.js → isSymbol-04666465.js} +15 -15
  139. package/dist/cjs/keys-a586b7a0.js +25 -0
  140. package/dist/cjs/{lodash-f0783643.js → lodash-fc2922d0.js} +31 -128
  141. package/dist/cjs/main-02daeefe.js +862 -0
  142. package/dist/cjs/{moment-aca40de1.js → moment-575fe24c.js} +9 -11
  143. package/dist/cjs/{react-social-icons-af932527.js → react-social-icons-f7f48f71.js} +27 -28
  144. package/dist/cjs/{slicedToArray-5d1bc3b3.js → slicedToArray-8f385299.js} +14 -14
  145. package/dist/cjs/{smoothscroll-99df7f93.js → smoothscroll-5054361f.js} +1 -1
  146. package/dist/cjs/stringify-7c5aff47.js +17 -0
  147. package/dist/cjs/timeDifferenceCalc.js +1 -1
  148. package/dist/cjs/{toConsumableArray-ddb70795.js → toConsumableArray-9a3476fe.js} +9 -9
  149. package/dist/cjs/{toNumber-5e1fac58.js → toNumber-36d1e7e5.js} +5 -40
  150. package/dist/cjs/{typeof-88a668c5.js → typeof-725500bc.js} +36 -36
  151. package/dist/cjs/urlFor.js +3 -3
  152. package/dist/cjs/{ustream-api-b2b9092f.js → ustream-api-d092dc31.js} +4 -4
  153. package/dist/cjs/{visibility-sensor-eb2c5b69.js → visibility-sensor-ad5e3116.js} +5 -7
  154. package/dist/cjs/{web.dom.iterable-46657b5c.js → web.dom.iterable-a0e279c1.js} +3 -3
  155. package/dist/esm/AD.js +1 -1
  156. package/dist/esm/AD300x250.js +24 -24
  157. package/dist/esm/AD300x250x600.js +24 -24
  158. package/dist/esm/AD728x90.js +27 -27
  159. package/dist/esm/ADFloatingFooter.js +23 -23
  160. package/dist/esm/ADFooter.js +6 -6
  161. package/dist/esm/ADGutter.js +23 -23
  162. package/dist/esm/{ADInfeed-4bf3b2f9.js → ADInfeed-bbdd5398.js} +6 -6
  163. package/dist/esm/ADSkyscraper.js +23 -23
  164. package/dist/esm/ADSponsoredResources.js +23 -23
  165. package/dist/esm/ADWebcast.js +23 -23
  166. package/dist/esm/ADWelcome.js +20 -20
  167. package/dist/esm/{ADlgInfeed-a3377c4a.js → ADlgInfeed-4473ee3b.js} +4 -4
  168. package/dist/esm/AccordionPanel.js +8 -8
  169. package/dist/esm/AdSlot.js +92 -24
  170. package/dist/esm/AdSlotsProvider.js +27 -17
  171. package/dist/esm/AlgoliaSearch.js +530 -525
  172. package/dist/esm/AlphabeticList.js +10 -10
  173. package/dist/esm/ArticleCarousel.js +17 -17
  174. package/dist/esm/ArticleProgramLandingPage.js +49 -50
  175. package/dist/esm/ArticleSeriesLandingPage.js +32 -32
  176. package/dist/esm/ArticleSeriesListing.js +34 -34
  177. package/dist/esm/AuthWrapper.js +396 -1711
  178. package/dist/esm/{AuthorComponent-30aeba69.js → AuthorComponent-34b16174.js} +1 -1
  179. package/dist/esm/Beam.js +8 -8
  180. package/dist/esm/{BlockContent-c99c9a8d.js → BlockContent-e9b4ddcf.js} +34 -34
  181. package/dist/esm/Breadcrumbs.js +7 -7
  182. package/dist/esm/CMEDeck.js +24 -24
  183. package/dist/esm/Column1.js +4 -4
  184. package/dist/esm/Column2.js +21 -21
  185. package/dist/esm/Column3.js +39 -39
  186. package/dist/esm/ConferenceArticleCard.js +22 -22
  187. package/dist/esm/DeckContent.js +57 -57
  188. package/dist/esm/DeckQueue.js +50 -50
  189. package/dist/esm/{Dfp-2c43d2a0.js → Dfp-b7236041.js} +15 -15
  190. package/dist/esm/EventsDeck.js +67 -67
  191. package/dist/esm/ExternalResources.js +47 -48
  192. package/dist/esm/Feature.js +4 -4
  193. package/dist/esm/ForbesHero.js +12 -12
  194. package/dist/esm/GridContent.js +200 -82
  195. package/dist/esm/GridHero.js +13 -13
  196. package/dist/esm/GroupDeck.js +14 -14
  197. package/dist/esm/HamMagazine.js +39 -39
  198. package/dist/esm/Hero.js +4 -4
  199. package/dist/esm/HighlightenVideo.js +2 -2
  200. package/dist/esm/HorizontalArticleListing.js +46 -47
  201. package/dist/esm/HorizontalHero.js +5 -5
  202. package/dist/esm/IssueContentDeck.js +27 -27
  203. package/dist/esm/IssueDeck.js +37 -37
  204. package/dist/esm/IssueLanding.js +81 -84
  205. package/dist/esm/KMTracker.js +15 -15
  206. package/dist/esm/LeftNav.js +22 -22
  207. package/dist/esm/MasterDeck.js +45 -45
  208. package/dist/esm/MediaSeriesLanding.js +662 -751
  209. package/dist/esm/NavDvm.js +16 -16
  210. package/dist/esm/NavMagazine.js +44 -44
  211. package/dist/esm/NavNative.js +49 -49
  212. package/dist/esm/OncliveHero.js +5 -4
  213. package/dist/esm/OncliveLargeHero.js +13 -13
  214. package/dist/esm/PageFilter.js +6 -6
  215. package/dist/esm/PartnerDetailListing.js +55 -63
  216. package/dist/esm/PdfDownload.js +2 -2
  217. package/dist/esm/PopUpModal.js +6 -6
  218. package/dist/esm/PubSection.js +32 -34
  219. package/dist/esm/PubToc.js +8 -8
  220. package/dist/esm/PublicationDeck.js +24 -24
  221. package/dist/esm/PublicationLanding.js +76 -76
  222. package/dist/esm/QueueDeckExpanded.js +2102 -1097
  223. package/dist/esm/RecentNews.js +4 -4
  224. package/dist/esm/RelatedContent.js +35 -35
  225. package/dist/esm/RelatedTopicsDropdown.js +10 -10
  226. package/dist/esm/RolesDeck.js +12 -12
  227. package/dist/esm/Search.js +8 -8
  228. package/dist/esm/Segment.js +368 -343
  229. package/dist/esm/SeriesListingDeck.js +20 -20
  230. package/dist/esm/{SeriesSlider-5d5c08f4.js → SeriesSlider-a866bb21.js} +14 -14
  231. package/dist/esm/SetCookie.js +1 -1
  232. package/dist/esm/SideFooter.js +17 -17
  233. package/dist/esm/{SocialSearchComponent-db963c3e.js → SocialSearchComponent-03c3e869.js} +12 -12
  234. package/dist/esm/TaxonomyCard.js +25 -25
  235. package/dist/esm/TaxonomyDescription.js +45 -46
  236. package/dist/esm/TemplateNormal.js +50 -50
  237. package/dist/esm/ThumbnailCard.js +7 -7
  238. package/dist/esm/Ustream.js +14 -14
  239. package/dist/esm/VerticalHero.js +3 -3
  240. package/dist/esm/VideoProgramLandingPage.js +53 -54
  241. package/dist/esm/VideoSeriesCard.js +14 -14
  242. package/dist/esm/VideoSeriesFilter.js +9 -9
  243. package/dist/esm/VideoSeriesLandingPage.js +38 -38
  244. package/dist/esm/VideoSeriesListing.js +39 -37
  245. package/dist/esm/View.js +173 -93
  246. package/dist/esm/YahooHero.js +15 -15
  247. package/dist/esm/YoutubeGroup.js +26 -26
  248. package/dist/esm/{_is-array-3e99e06e.js → _is-array-58e95429.js} +6 -6
  249. package/dist/esm/{_iter-detect-7e5e5ce2.js → _iter-detect-5d49a330.js} +8 -8
  250. package/dist/esm/{_object-pie-133f504a.js → _object-pie-33c40e79.js} +4 -4
  251. package/dist/esm/{_object-sap-f353c2a9.js → _object-sap-964b6feb.js} +1 -1
  252. package/dist/esm/{_object-to-array-0f197f89.js → _object-to-array-7e804fce.js} +2 -2
  253. package/dist/esm/{_to-object-b50e61c3.js → _to-object-a4107da3.js} +9 -9
  254. package/dist/esm/{asyncToGenerator-7f8f9219.js → asyncToGenerator-4877b617.js} +33 -33
  255. package/dist/esm/{brightcove-react-player-loader.es-57a70a56.js → brightcove-react-player-loader.es-83f53e4e.js} +4 -5
  256. package/dist/esm/{core.get-iterator-method-133dfacd.js → core.get-iterator-method-e1de7503.js} +2 -2
  257. package/dist/esm/{debounce-533d9748.js → debounce-9207d8ee.js} +2 -2
  258. package/dist/esm/{define-property-fe54dc9f.js → define-property-8af5f002.js} +6 -6
  259. package/dist/esm/{defineProperty-f5ff6f5a.js → defineProperty-94fd8bfc.js} +1 -1
  260. package/dist/esm/{entities-932b50cf.js → entities-7cc3bf45.js} +1 -1
  261. package/dist/esm/{eq-bdcbf886.js → eq-b470f743.js} +1 -1
  262. package/dist/esm/{es6.string.iterator-bc33758b.js → es6.string.iterator-c990c18c.js} +7 -7
  263. package/dist/esm/{extends-60e0e1c6.js → extends-6f2fcc99.js} +7 -7
  264. package/dist/esm/faundadb.js +325 -8
  265. package/dist/esm/{get-3c308da4.js → get-1e515072.js} +21 -21
  266. package/dist/esm/getQuery.js +2 -2
  267. package/dist/esm/getRelatedArticle.js +28 -445
  268. package/dist/esm/getRootDocGroup.js +6 -6
  269. package/dist/esm/getSerializers.js +44 -45
  270. package/dist/esm/{getTargeting-68291ce9.js → getTargeting-bd800589.js} +25 -16
  271. package/dist/esm/getTargeting.js +8 -8
  272. package/dist/{cjs/iconBase-be4097c0.js → esm/iconBase-602d52fe.js} +8 -33
  273. package/dist/esm/{index-f0fc23eb.js → index-41a678ea.js} +4 -4
  274. package/dist/esm/{index-755f2cc2.js → index-5f7e79e7.js} +6 -6
  275. package/dist/esm/{index-0dbff1d1.js → index-73819142.js} +30 -36
  276. package/dist/esm/{index-98ca9cec.js → index-aaa2dae0.js} +11 -26
  277. package/dist/esm/{index-01d53c17.js → index-d6dc592a.js} +1261 -648
  278. package/dist/esm/{index-79cfd25c.js → index-ef6d5dcf.js} +45 -44
  279. package/dist/esm/{index.es-a6137319.js → index.es-29c1cef5.js} +5 -23
  280. package/dist/esm/{index.esm-f6156a57.js → index.esm-29e48d38.js} +16 -7
  281. package/dist/esm/{index.esm-d4932dea.js → index.esm-cf08bf18.js} +13 -6
  282. package/dist/esm/{index.esm-9b042655.js → index.esm-f8aaeeeb.js} +7 -4
  283. package/dist/esm/{index.esm-37268dca.js → index.esm-fd746768.js} +5 -4
  284. package/dist/esm/index.js +117 -125
  285. package/dist/esm/{inherits-a41fe93f.js → inherits-cf8dde54.js} +19 -19
  286. package/dist/esm/{isSymbol-a7e9aafe.js → isSymbol-1981418f.js} +15 -15
  287. package/dist/esm/{keys-7a3adabf.js → keys-8eda7a5c.js} +6 -6
  288. package/dist/esm/{lodash-f97fd99a.js → lodash-17fdfebb.js} +31 -128
  289. package/dist/esm/main-e4a934b2.js +851 -0
  290. package/dist/esm/{moment-bc12cb97.js → moment-e2f9b20c.js} +9 -11
  291. package/dist/esm/{react-social-icons-9be47857.js → react-social-icons-a7d5c5c7.js} +16 -16
  292. package/dist/esm/{slicedToArray-be2f7a22.js → slicedToArray-641f241f.js} +14 -14
  293. package/dist/esm/{smoothscroll-fa4e3f8c.js → smoothscroll-0cd4c7a6.js} +1 -1
  294. package/dist/esm/stringify-4330ccdc.js +15 -0
  295. package/dist/esm/timeDifferenceCalc.js +1 -1
  296. package/dist/esm/{toConsumableArray-6d9a4616.js → toConsumableArray-43aa614d.js} +9 -9
  297. package/dist/esm/{toNumber-5aeba6e7.js → toNumber-2f7a84cd.js} +5 -40
  298. package/dist/esm/{typeof-a286cf0c.js → typeof-6435ba1c.js} +36 -36
  299. package/dist/esm/urlFor.js +1 -1
  300. package/dist/esm/{ustream-api-33a866b6.js → ustream-api-9a50644d.js} +4 -4
  301. package/dist/esm/{web.dom.iterable-4109ff68.js → web.dom.iterable-4439f05a.js} +3 -3
  302. package/package.json +116 -110
  303. package/dist/cjs/Auth.js +0 -3652
  304. package/dist/cjs/ConferenceBanner-6c9e718a.js +0 -24
  305. package/dist/cjs/index-bd6c9f56.js +0 -211
  306. package/dist/cjs/keys-7f2c2108.js +0 -25
  307. package/dist/cjs/main-f1c77adb.js +0 -973
  308. package/dist/cjs/md5-e1ca5797.js +0 -323
  309. package/dist/cjs/stringify-c9ac1214.js +0 -17
  310. package/dist/cjs/typeof-1358762e.js +0 -33
  311. package/dist/cjs/util-6f784d85.js +0 -576
  312. package/dist/esm/Auth.js +0 -3632
  313. package/dist/esm/index-db3bb315.js +0 -207
  314. package/dist/esm/main-d4165069.js +0 -961
  315. package/dist/esm/md5-4e42248e.js +0 -321
  316. package/dist/esm/stringify-59c8f690.js +0 -15
  317. package/dist/esm/typeof-2f07d0e8.js +0 -30
  318. package/dist/esm/util-3ab476bf.js +0 -574
@@ -1,44 +1,1101 @@
1
- import { _ as _slicedToArray } from './slicedToArray-be2f7a22.js';
2
- import { _ as _toConsumableArray } from './toConsumableArray-6d9a4616.js';
3
- import { _ as _extends } from './extends-60e0e1c6.js';
4
- import React__default, { useEffect, useState, useRef } from 'react';
5
- import { Container, Media } from 'react-bootstrap';
6
- import urlFor from './urlFor.js';
7
- import { I as InfiniteScroll } from './index.es-a6137319.js';
8
- import { m as moment } from './moment-bc12cb97.js';
9
- import { V as VisibilitySensor } from './visibility-sensor-72fd8f8b.js';
10
- import { l as lib_3 } from './index-f0fc23eb.js';
11
- import { useRouter } from 'next/router';
12
- import { L as LazyLoad } from './index-755f2cc2.js';
13
- import { m as main_43 } from './main-d4165069.js';
14
- import { c as clean_html_1 } from './entities-932b50cf.js';
15
- import { A as ADInfeed } from './ADInfeed-4bf3b2f9.js';
16
- import { A as AuthorComponent } from './AuthorComponent-30aeba69.js';
17
- import { l as lodash } from './lodash-f97fd99a.js';
18
- import { A as ADlgInfeed } from './ADlgInfeed-a3377c4a.js';
19
- import { g as getContentCategory } from './getContentCategory-15dcc413.js';
20
- import timeDifferenceCalc from './timeDifferenceCalc.js';
21
- import './_commonjsHelpers-0c4b6f40.js';
22
- import './web.dom.iterable-4109ff68.js';
23
- import './es6.string.iterator-bc33758b.js';
24
- import './_to-object-b50e61c3.js';
25
- import './core.get-iterator-method-133dfacd.js';
26
- import './_iter-detect-7e5e5ce2.js';
27
- import './_object-pie-133f504a.js';
28
- import './index-0dbff1d1.js';
29
- import 'react-dom';
1
+ import { c as createCommonjsModule, a as commonjsGlobal, u as unwrapExports } from './_commonjsHelpers-0c4b6f40.js';
2
+ import './_to-object-a4107da3.js';
3
+ import './es6.string.iterator-c990c18c.js';
4
+ import './_library-528f1934.js';
5
+ import './_iter-detect-5d49a330.js';
6
+ import { _ as _toConsumableArray } from './toConsumableArray-43aa614d.js';
7
+ import './core.get-iterator-method-e1de7503.js';
8
+ import './_object-pie-33c40e79.js';
9
+ import { _ as _extends } from './extends-6f2fcc99.js';
10
+ import './web.dom.iterable-4439f05a.js';
11
+ import React__default, { useEffect, useLayoutEffect, createContext, useContext, useRef, useDebugValue, useState, useCallback, useMemo } from 'react';
30
12
  import './events-6c3a7a63.js';
13
+ import { l as lib_3 } from './index-41a678ea.js';
31
14
  import 'prop-types';
32
15
  import 'react-bootstrap/Card';
33
- import './AdSlot.js';
34
- import './debounce-533d9748.js';
35
- import './isSymbol-a7e9aafe.js';
36
- import './toNumber-5aeba6e7.js';
37
- import './Beam.js';
38
- import './stringify-59c8f690.js';
39
- import './asyncToGenerator-7f8f9219.js';
40
- import './_library-528f1934.js';
16
+ import { m as moment } from './moment-e2f9b20c.js';
17
+ import { useRouter } from 'next/router';
18
+ import './isSymbol-1981418f.js';
19
+ import './debounce-9207d8ee.js';
20
+ import './toNumber-2f7a84cd.js';
21
+ import 'react-dom';
22
+ import './index-73819142.js';
23
+ import urlFor from './urlFor.js';
24
+ import { L as LazyLoad } from './index-5f7e79e7.js';
25
+ import { m as main_36 } from './main-e4a934b2.js';
26
+ import { c as clean_html_1 } from './entities-7cc3bf45.js';
27
+ import { _ as _slicedToArray } from './slicedToArray-641f241f.js';
28
+ import './stringify-4330ccdc.js';
29
+ import { _ as _asyncToGenerator, r as regenerator } from './asyncToGenerator-4877b617.js';
41
30
  import './Segment.js';
31
+ import './Beam.js';
32
+ import './AdSlot.js';
33
+ import { A as ADInfeed } from './ADInfeed-bbdd5398.js';
34
+ import { l as lodash } from './lodash-17fdfebb.js';
35
+ import { A as ADlgInfeed } from './ADlgInfeed-4473ee3b.js';
36
+ import { g as getContentCategory } from './getContentCategory-15dcc413.js';
37
+ import { A as AuthorComponent } from './AuthorComponent-34b16174.js';
38
+ import { Container, Media } from 'react-bootstrap';
39
+ import timeDifferenceCalc from './timeDifferenceCalc.js';
40
+
41
+ var reactPaginate = createCommonjsModule(function (module, exports) {
42
+ !function(e,a){module.exports=a(React__default);}(commonjsGlobal,(function(e){return function(e){var a={};function t(r){if(a[r])return a[r].exports;var n=a[r]={i:r,l:!1,exports:{}};return e[r].call(n.exports,n,n.exports,t),n.l=!0,n.exports}return t.m=e,t.c=a,t.d=function(e,a,r){t.o(e,a)||Object.defineProperty(e,a,{enumerable:!0,get:r});},t.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0});},t.t=function(e,a){if(1&a&&(e=t(e)),8&a)return e;if(4&a&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(t.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&a&&"string"!=typeof e)for(var n in e)t.d(r,n,function(a){return e[a]}.bind(null,n));return r},t.n=function(e){var a=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(a,"a",a),a},t.o=function(e,a){return Object.prototype.hasOwnProperty.call(e,a)},t.p="",t(t.s=4)}([function(e,a,t){e.exports=t(2)();},function(a,t){a.exports=e;},function(e,a,t){var r=t(3);function n(){}function i(){}i.resetWarningCache=n,e.exports=function(){function e(e,a,t,n,i,s){if(s!==r){var l=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw l.name="Invariant Violation",l}}function a(){return e}e.isRequired=e;var t={array:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:a,element:e,elementType:e,instanceOf:a,node:e,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:i,resetWarningCache:n};return t.PropTypes=t,t};},function(e,a,t){e.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";},function(e,a,t){t.r(a);var r=t(1),n=t.n(r),i=t(0),s=t.n(i);function l(){return (l=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);}return e}).apply(this,arguments)}var o=function(e){var a=e.pageClassName,t=e.pageLinkClassName,r=e.page,i=e.selected,s=e.activeClassName,o=e.activeLinkClassName,u=e.getEventListener,c=e.pageSelectedHandler,p=e.href,f=e.extraAriaContext,g=e.pageLabelBuilder,d=e.ariaLabel||"Page "+r+(f?" "+f:""),b=null;return i&&(b="page",d=e.ariaLabel||"Page "+r+" is your current page",a=void 0!==a?a+" "+s:s,void 0!==t?void 0!==o&&(t=t+" "+o):t=o),n.a.createElement("li",{className:a},n.a.createElement("a",l({role:"button",className:t,href:p,tabIndex:"0","aria-label":d,"aria-current":b,onKeyPress:c},u(c)),g(r)))};o.propTypes={pageSelectedHandler:s.a.func.isRequired,selected:s.a.bool.isRequired,pageClassName:s.a.string,pageLinkClassName:s.a.string,activeClassName:s.a.string,activeLinkClassName:s.a.string,extraAriaContext:s.a.string,href:s.a.string,ariaLabel:s.a.string,page:s.a.number.isRequired,getEventListener:s.a.func.isRequired,pageLabelBuilder:s.a.func.isRequired};var u=o;function c(){return (c=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);}return e}).apply(this,arguments)}var p=function(e){var a=e.breakLabel,t=e.breakClassName,r=e.breakLinkClassName,i=e.breakHandler,s=e.getEventListener,l=t||"break";return n.a.createElement("li",{className:l},n.a.createElement("a",c({className:r,role:"button",tabIndex:"0",onKeyPress:i},s(i)),a))};p.propTypes={breakLabel:s.a.oneOfType([s.a.string,s.a.node]),breakClassName:s.a.string,breakLinkClassName:s.a.string,breakHandler:s.a.func.isRequired,getEventListener:s.a.func.isRequired};var f=p;function g(e){return (g="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function d(){return (d=Object.assign||function(e){for(var a=1;a<arguments.length;a++){var t=arguments[a];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r]);}return e}).apply(this,arguments)}function b(e,a){for(var t=0;t<a.length;t++){var r=a[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r);}}function v(e,a){return (v=Object.setPrototypeOf||function(e,a){return e.__proto__=a,e})(e,a)}function m(e){var a=function(){if("undefined"==typeof Reflect||!Reflect.construct)return !1;if(Reflect.construct.sham)return !1;if("function"==typeof Proxy)return !0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],(function(){}))),!0}catch(e){return !1}}();return function(){var t,r=C(e);if(a){var n=C(this).constructor;t=Reflect.construct(r,arguments,n);}else t=r.apply(this,arguments);return h(this,t)}}function h(e,a){return !a||"object"!==g(a)&&"function"!=typeof a?y(e):a}function y(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function C(e){return (C=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function P(e,a,t){return a in e?Object.defineProperty(e,a,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[a]=t,e}var k=function(e){!function(e,a){if("function"!=typeof a&&null!==a)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(a&&a.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),a&&v(e,a);}(s,e);var a,t,i=m(s);function s(e){var a,t;return function(e,a){if(!(e instanceof a))throw new TypeError("Cannot call a class as a function")}(this,s),P(y(a=i.call(this,e)),"handlePreviousPage",(function(e){var t=a.state.selected;e.preventDefault?e.preventDefault():e.returnValue=!1,t>0&&a.handlePageSelected(t-1,e);})),P(y(a),"handleNextPage",(function(e){var t=a.state.selected,r=a.props.pageCount;e.preventDefault?e.preventDefault():e.returnValue=!1,t<r-1&&a.handlePageSelected(t+1,e);})),P(y(a),"handlePageSelected",(function(e,t){t.preventDefault?t.preventDefault():t.returnValue=!1,a.state.selected!==e?(a.setState({selected:e}),a.callCallback(e)):a.callActiveCallback(e);})),P(y(a),"getEventListener",(function(e){return P({},a.props.eventListener,e)})),P(y(a),"handleBreakClick",(function(e,t){t.preventDefault?t.preventDefault():t.returnValue=!1;var r=a.state.selected;a.handlePageSelected(r<e?a.getForwardJump():a.getBackwardJump(),t);})),P(y(a),"callCallback",(function(e){void 0!==a.props.onPageChange&&"function"==typeof a.props.onPageChange&&a.props.onPageChange({selected:e});})),P(y(a),"callActiveCallback",(function(e){void 0!==a.props.onPageActive&&"function"==typeof a.props.onPageActive&&a.props.onPageActive({selected:e});})),P(y(a),"pagination",(function(){var e=[],t=a.props,r=t.pageRangeDisplayed,i=t.pageCount,s=t.marginPagesDisplayed,l=t.breakLabel,o=t.breakClassName,u=t.breakLinkClassName,c=a.state.selected;if(i<=r)for(var p=0;p<i;p++)e.push(a.getPageElement(p));else {var g,d,b,v=r/2,m=r-v;c>i-r/2?v=r-(m=i-c):c<r/2&&(m=r-(v=c));var h=function(e){return a.getPageElement(e)};for(g=0;g<i;g++)(d=g+1)<=s||d>i-s||g>=c-v&&g<=c+m?e.push(h(g)):l&&e[e.length-1]!==b&&(b=n.a.createElement(f,{key:g,breakLabel:l,breakClassName:o,breakLinkClassName:u,breakHandler:a.handleBreakClick.bind(null,g),getEventListener:a.getEventListener}),e.push(b));}return e})),t=e.initialPage?e.initialPage:e.forcePage?e.forcePage:0,a.state={selected:t},a}return a=s,(t=[{key:"componentDidMount",value:function(){var e=this.props,a=e.initialPage,t=e.disableInitialCallback,r=e.extraAriaContext;void 0===a||t||this.callCallback(a),r&&console.warn("DEPRECATED (react-paginate): The extraAriaContext prop is deprecated. You should now use the ariaLabelBuilder instead.");}},{key:"componentDidUpdate",value:function(e){void 0!==this.props.forcePage&&this.props.forcePage!==e.forcePage&&this.setState({selected:this.props.forcePage});}},{key:"getForwardJump",value:function(){var e=this.state.selected,a=this.props,t=a.pageCount,r=e+a.pageRangeDisplayed;return r>=t?t-1:r}},{key:"getBackwardJump",value:function(){var e=this.state.selected-this.props.pageRangeDisplayed;return e<0?0:e}},{key:"hrefBuilder",value:function(e){var a=this.props,t=a.hrefBuilder,r=a.pageCount;if(t&&e!==this.state.selected&&e>=0&&e<r)return t(e+1)}},{key:"ariaLabelBuilder",value:function(e){var a=e===this.state.selected;if(this.props.ariaLabelBuilder&&e>=0&&e<this.props.pageCount){var t=this.props.ariaLabelBuilder(e+1,a);return this.props.extraAriaContext&&!a&&(t=t+" "+this.props.extraAriaContext),t}}},{key:"getPageElement",value:function(e){var a=this.state.selected,t=this.props,r=t.pageClassName,i=t.pageLinkClassName,s=t.activeClassName,l=t.activeLinkClassName,o=t.extraAriaContext,c=t.pageLabelBuilder;return n.a.createElement(u,{key:e,pageSelectedHandler:this.handlePageSelected.bind(null,e),selected:a===e,pageClassName:r,pageLinkClassName:i,activeClassName:s,activeLinkClassName:l,extraAriaContext:o,href:this.hrefBuilder(e),ariaLabel:this.ariaLabelBuilder(e),page:e+1,pageLabelBuilder:c,getEventListener:this.getEventListener})}},{key:"render",value:function(){var e=this.props,a=e.disabledClassName,t=e.pageCount,r=e.containerClassName,i=e.previousLabel,s=e.previousClassName,l=e.previousLinkClassName,o=e.previousAriaLabel,u=e.prevRel,c=e.nextLabel,p=e.nextClassName,f=e.nextLinkClassName,g=e.nextAriaLabel,b=e.nextRel,v=this.state.selected,m=s+(0===v?" ".concat(a):""),h=p+(v===t-1?" ".concat(a):""),y=0===v?"true":"false",C=v===t-1?"true":"false";return n.a.createElement("ul",{className:r},n.a.createElement("li",{className:m},n.a.createElement("a",d({className:l,href:this.hrefBuilder(v-1),tabIndex:"0",role:"button",onKeyPress:this.handlePreviousPage,"aria-disabled":y,"aria-label":o,rel:u},this.getEventListener(this.handlePreviousPage)),i)),this.pagination(),n.a.createElement("li",{className:h},n.a.createElement("a",d({className:f,href:this.hrefBuilder(v+1),tabIndex:"0",role:"button",onKeyPress:this.handleNextPage,"aria-disabled":C,"aria-label":g,rel:b},this.getEventListener(this.handleNextPage)),c)))}}])&&b(a.prototype,t),s}(r.Component);P(k,"propTypes",{pageCount:s.a.number.isRequired,pageRangeDisplayed:s.a.number.isRequired,marginPagesDisplayed:s.a.number.isRequired,previousLabel:s.a.node,previousAriaLabel:s.a.string,prevRel:s.a.string,nextLabel:s.a.node,nextAriaLabel:s.a.string,nextRel:s.a.string,breakLabel:s.a.oneOfType([s.a.string,s.a.node]),hrefBuilder:s.a.func,onPageChange:s.a.func,onPageActive:s.a.func,initialPage:s.a.number,forcePage:s.a.number,disableInitialCallback:s.a.bool,containerClassName:s.a.string,pageClassName:s.a.string,pageLinkClassName:s.a.string,pageLabelBuilder:s.a.func,activeClassName:s.a.string,activeLinkClassName:s.a.string,previousClassName:s.a.string,nextClassName:s.a.string,previousLinkClassName:s.a.string,nextLinkClassName:s.a.string,disabledClassName:s.a.string,breakClassName:s.a.string,breakLinkClassName:s.a.string,extraAriaContext:s.a.string,ariaLabelBuilder:s.a.func,eventListener:s.a.string}),P(k,"defaultProps",{pageCount:10,pageRangeDisplayed:2,marginPagesDisplayed:3,activeClassName:"selected",previousLabel:"Previous",previousClassName:"previous",previousAriaLabel:"Previous page",prevRel:"prev",nextLabel:"Next",nextClassName:"next",nextAriaLabel:"Next page",nextRel:"next",breakLabel:"...",disabledClassName:"disabled",disableInitialCallback:!1,pageLabelBuilder:function(e){return e},eventListener:"onClick"});a.default=k;}])}));
43
+
44
+ });
45
+
46
+ var ReactPaginate = unwrapExports(reactPaginate);
47
+ var reactPaginate_1 = reactPaginate.ReactPaginate;
48
+
49
+ var has = Object.prototype.hasOwnProperty;
50
+
51
+ function dequal(foo, bar) {
52
+ var ctor, len;
53
+ if (foo === bar) return true;
54
+
55
+ if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
56
+ if (ctor === Date) return foo.getTime() === bar.getTime();
57
+ if (ctor === RegExp) return foo.toString() === bar.toString();
58
+
59
+ if (ctor === Array) {
60
+ if ((len=foo.length) === bar.length) {
61
+ while (len-- && dequal(foo[len], bar[len]));
62
+ }
63
+ return len === -1;
64
+ }
65
+
66
+ if (!ctor || typeof foo === 'object') {
67
+ len = 0;
68
+ for (ctor in foo) {
69
+ if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
70
+ if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
71
+ }
72
+ return Object.keys(bar).length === len;
73
+ }
74
+ }
75
+
76
+ return foo !== foo && bar !== bar;
77
+ }
78
+
79
+ // use WeakMap to store the object->key mapping
80
+ // so the objects can be garbage collected.
81
+ // WeakMap uses a hashtable under the hood, so the lookup
82
+ // complexity is almost O(1).
83
+ var table = new WeakMap();
84
+ // counter of the key
85
+ var counter = 0;
86
+ // hashes an array of objects and returns a string
87
+ function hash(args) {
88
+ if (!args.length)
89
+ return '';
90
+ var key = 'arg';
91
+ for (var i = 0; i < args.length; ++i) {
92
+ if (args[i] === null) {
93
+ key += '@null';
94
+ continue;
95
+ }
96
+ var _hash = void 0;
97
+ if (typeof args[i] !== 'object' && typeof args[i] !== 'function') {
98
+ // need to consider the case that args[i] is a string:
99
+ // args[i] _hash
100
+ // "undefined" -> '"undefined"'
101
+ // undefined -> 'undefined'
102
+ // 123 -> '123'
103
+ // "null" -> '"null"'
104
+ if (typeof args[i] === 'string') {
105
+ _hash = '"' + args[i] + '"';
106
+ }
107
+ else {
108
+ _hash = String(args[i]);
109
+ }
110
+ }
111
+ else {
112
+ if (!table.has(args[i])) {
113
+ _hash = counter;
114
+ table.set(args[i], counter++);
115
+ }
116
+ else {
117
+ _hash = table.get(args[i]);
118
+ }
119
+ }
120
+ key += '@' + _hash;
121
+ }
122
+ return key;
123
+ }
124
+
125
+ var Cache = /** @class */ (function () {
126
+ function Cache(initialData) {
127
+ if (initialData === void 0) { initialData = {}; }
128
+ this.cache = new Map(Object.entries(initialData));
129
+ this.subs = [];
130
+ }
131
+ Cache.prototype.get = function (key) {
132
+ var _key = this.serializeKey(key)[0];
133
+ return this.cache.get(_key);
134
+ };
135
+ Cache.prototype.set = function (key, value) {
136
+ var _key = this.serializeKey(key)[0];
137
+ this.cache.set(_key, value);
138
+ this.notify();
139
+ };
140
+ Cache.prototype.keys = function () {
141
+ return Array.from(this.cache.keys());
142
+ };
143
+ Cache.prototype.has = function (key) {
144
+ var _key = this.serializeKey(key)[0];
145
+ return this.cache.has(_key);
146
+ };
147
+ Cache.prototype.clear = function () {
148
+ this.cache.clear();
149
+ this.notify();
150
+ };
151
+ Cache.prototype.delete = function (key) {
152
+ var _key = this.serializeKey(key)[0];
153
+ this.cache.delete(_key);
154
+ this.notify();
155
+ };
156
+ // TODO: introduce namespace for the cache
157
+ Cache.prototype.serializeKey = function (key) {
158
+ var args = null;
159
+ if (typeof key === 'function') {
160
+ try {
161
+ key = key();
162
+ }
163
+ catch (err) {
164
+ // dependencies not ready
165
+ key = '';
166
+ }
167
+ }
168
+ if (Array.isArray(key)) {
169
+ // args array
170
+ args = key;
171
+ key = hash(key);
172
+ }
173
+ else {
174
+ // convert null to ''
175
+ key = String(key || '');
176
+ }
177
+ var errorKey = key ? 'err@' + key : '';
178
+ var isValidatingKey = key ? 'validating@' + key : '';
179
+ return [key, args, errorKey, isValidatingKey];
180
+ };
181
+ Cache.prototype.subscribe = function (listener) {
182
+ var _this = this;
183
+ if (typeof listener !== 'function') {
184
+ throw new Error('Expected the listener to be a function.');
185
+ }
186
+ var isSubscribed = true;
187
+ this.subs.push(listener);
188
+ return function () {
189
+ if (!isSubscribed)
190
+ return;
191
+ isSubscribed = false;
192
+ var index = _this.subs.indexOf(listener);
193
+ if (index > -1) {
194
+ _this.subs[index] = _this.subs[_this.subs.length - 1];
195
+ _this.subs.length--;
196
+ }
197
+ };
198
+ };
199
+ // Notify Cache subscribers about a change in the cache
200
+ Cache.prototype.notify = function () {
201
+ for (var _i = 0, _a = this.subs; _i < _a.length; _i++) {
202
+ var listener = _a[_i];
203
+ listener();
204
+ }
205
+ };
206
+ return Cache;
207
+ }());
208
+
209
+ /**
210
+ * Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
211
+ * it's not reliable to detect if the browser is currently online or offline
212
+ * based on `navigator.onLine`.
213
+ * As a work around, we always assume it's online on first load, and change
214
+ * the status upon `online` or `offline` events.
215
+ */
216
+ var online = true;
217
+ var isOnline = function () { return online; };
218
+ var isDocumentVisible = function () {
219
+ if (typeof document !== 'undefined' &&
220
+ document.visibilityState !== undefined) {
221
+ return document.visibilityState !== 'hidden';
222
+ }
223
+ // always assume it's visible
224
+ return true;
225
+ };
226
+ var fetcher = function (url) { return fetch(url).then(function (res) { return res.json(); }); };
227
+ var registerOnFocus = function (cb) {
228
+ if (typeof window !== 'undefined' &&
229
+ window.addEventListener !== undefined &&
230
+ typeof document !== 'undefined' &&
231
+ document.addEventListener !== undefined) {
232
+ // focus revalidate
233
+ document.addEventListener('visibilitychange', function () { return cb(); }, false);
234
+ window.addEventListener('focus', function () { return cb(); }, false);
235
+ }
236
+ };
237
+ var registerOnReconnect = function (cb) {
238
+ if (typeof window !== 'undefined' && window.addEventListener !== undefined) {
239
+ // reconnect revalidate
240
+ window.addEventListener('online', function () {
241
+ online = true;
242
+ cb();
243
+ }, false);
244
+ // nothing to revalidate, just update the status
245
+ window.addEventListener('offline', function () { return (online = false); }, false);
246
+ }
247
+ };
248
+ var webPreset = {
249
+ isOnline: isOnline,
250
+ isDocumentVisible: isDocumentVisible,
251
+ fetcher: fetcher,
252
+ registerOnFocus: registerOnFocus,
253
+ registerOnReconnect: registerOnReconnect
254
+ };
255
+
256
+ var __assign = (undefined && undefined.__assign) || function () {
257
+ __assign = Object.assign || function(t) {
258
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
259
+ s = arguments[i];
260
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
261
+ t[p] = s[p];
262
+ }
263
+ return t;
264
+ };
265
+ return __assign.apply(this, arguments);
266
+ };
267
+ // cache
268
+ var cache = new Cache();
269
+ // error retry
270
+ function onErrorRetry(_, __, config, revalidate, opts) {
271
+ if (!config.isDocumentVisible()) {
272
+ // if it's hidden, stop
273
+ // it will auto revalidate when focus
274
+ return;
275
+ }
276
+ if (typeof config.errorRetryCount === 'number' &&
277
+ opts.retryCount > config.errorRetryCount) {
278
+ return;
279
+ }
280
+ // exponential backoff
281
+ var count = Math.min(opts.retryCount, 8);
282
+ var timeout = ~~((Math.random() + 0.5) * (1 << count)) * config.errorRetryInterval;
283
+ setTimeout(revalidate, timeout, opts);
284
+ }
285
+ // client side: need to adjust the config
286
+ // based on the browser status
287
+ // slow connection (<= 70Kbps)
288
+ var slowConnection = typeof window !== 'undefined' &&
289
+ // @ts-ignore
290
+ navigator['connection'] &&
291
+ // @ts-ignore
292
+ ['slow-2g', '2g'].indexOf(navigator['connection'].effectiveType) !== -1;
293
+ // config
294
+ var defaultConfig = __assign({
295
+ // events
296
+ onLoadingSlow: function () { }, onSuccess: function () { }, onError: function () { }, onErrorRetry: onErrorRetry, errorRetryInterval: (slowConnection ? 10 : 5) * 1000, focusThrottleInterval: 5 * 1000, dedupingInterval: 2 * 1000, loadingTimeout: (slowConnection ? 5 : 3) * 1000, refreshInterval: 0, revalidateOnFocus: true, revalidateOnReconnect: true, refreshWhenHidden: false, refreshWhenOffline: false, shouldRetryOnError: true, suspense: false, compare: dequal, isPaused: function () { return false; } }, webPreset);
297
+
298
+ var IS_SERVER = typeof window === 'undefined' ||
299
+ // @ts-ignore
300
+ !!(typeof Deno !== 'undefined' && Deno && Deno.version && Deno.version.deno);
301
+ // polyfill for requestAnimationFrame
302
+ var rAF = IS_SERVER
303
+ ? null
304
+ : window['requestAnimationFrame']
305
+ ? function (f) { return window['requestAnimationFrame'](f); }
306
+ : function (f) { return setTimeout(f, 1); };
307
+ // React currently throws a warning when using useLayoutEffect on the server.
308
+ // To get around it, we can conditionally useEffect on the server (no-op) and
309
+ // useLayoutEffect in the browser.
310
+ var useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;
311
+
312
+ var SWRConfigContext = createContext({});
313
+ SWRConfigContext.displayName = 'SWRConfigContext';
314
+
315
+ var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
316
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
317
+ return new (P || (P = Promise))(function (resolve, reject) {
318
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
319
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
320
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
321
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
322
+ });
323
+ };
324
+ var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
325
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
326
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
327
+ function verb(n) { return function (v) { return step([n, v]); }; }
328
+ function step(op) {
329
+ if (f) throw new TypeError("Generator is already executing.");
330
+ while (_) try {
331
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
332
+ if (y = 0, t) op = [op[0] & 2, t.value];
333
+ switch (op[0]) {
334
+ case 0: case 1: t = op; break;
335
+ case 4: _.label++; return { value: op[1], done: false };
336
+ case 5: _.label++; y = op[1]; op = [0]; continue;
337
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
338
+ default:
339
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
340
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
341
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
342
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
343
+ if (t[2]) _.ops.pop();
344
+ _.trys.pop(); continue;
345
+ }
346
+ op = body.call(thisArg, _);
347
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
348
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
349
+ }
350
+ };
351
+ // global state managers
352
+ var CONCURRENT_PROMISES = {};
353
+ var CONCURRENT_PROMISES_TS = {};
354
+ var FOCUS_REVALIDATORS = {};
355
+ var RECONNECT_REVALIDATORS = {};
356
+ var CACHE_REVALIDATORS = {};
357
+ var MUTATION_TS = {};
358
+ var MUTATION_END_TS = {};
359
+ // generate strictly increasing timestamps
360
+ var now = (function () {
361
+ var ts = 0;
362
+ return function () { return ++ts; };
363
+ })();
364
+ // setup DOM events listeners for `focus` and `reconnect` actions
365
+ if (!IS_SERVER) {
366
+ var revalidate_1 = function (revalidators) {
367
+ if (!defaultConfig.isDocumentVisible() || !defaultConfig.isOnline())
368
+ return;
369
+ for (var key in revalidators) {
370
+ if (revalidators[key][0])
371
+ revalidators[key][0]();
372
+ }
373
+ };
374
+ if (typeof defaultConfig.registerOnFocus === 'function') {
375
+ defaultConfig.registerOnFocus(function () { return revalidate_1(FOCUS_REVALIDATORS); });
376
+ }
377
+ if (typeof defaultConfig.registerOnReconnect === 'function') {
378
+ defaultConfig.registerOnReconnect(function () { return revalidate_1(RECONNECT_REVALIDATORS); });
379
+ }
380
+ }
381
+ var trigger = function (_key, shouldRevalidate) {
382
+ if (shouldRevalidate === void 0) { shouldRevalidate = true; }
383
+ // we are ignoring the second argument which correspond to the arguments
384
+ // the fetcher will receive when key is an array
385
+ var _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2], keyValidating = _a[3];
386
+ if (!key)
387
+ return Promise.resolve();
388
+ var updaters = CACHE_REVALIDATORS[key];
389
+ if (key && updaters) {
390
+ var currentData = cache.get(key);
391
+ var currentError = cache.get(keyErr);
392
+ var currentIsValidating = cache.get(keyValidating);
393
+ var promises = [];
394
+ for (var i = 0; i < updaters.length; ++i) {
395
+ promises.push(updaters[i](shouldRevalidate, currentData, currentError, currentIsValidating, i > 0));
396
+ }
397
+ // return new updated value
398
+ return Promise.all(promises).then(function () { return cache.get(key); });
399
+ }
400
+ return Promise.resolve(cache.get(key));
401
+ };
402
+ var broadcastState = function (key, data, error, isValidating) {
403
+ var updaters = CACHE_REVALIDATORS[key];
404
+ if (key && updaters) {
405
+ for (var i = 0; i < updaters.length; ++i) {
406
+ updaters[i](false, data, error, isValidating);
407
+ }
408
+ }
409
+ };
410
+ var mutate = function (_key, _data, shouldRevalidate) {
411
+ if (shouldRevalidate === void 0) { shouldRevalidate = true; }
412
+ return __awaiter(void 0, void 0, void 0, function () {
413
+ var _a, key, keyErr, beforeMutationTs, beforeConcurrentPromisesTs, data, error, isAsyncMutation, err_1, shouldAbort, updaters, promises, i;
414
+ return __generator(this, function (_b) {
415
+ switch (_b.label) {
416
+ case 0:
417
+ _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2];
418
+ if (!key)
419
+ return [2 /*return*/];
420
+ // if there is no new data to update, let's just revalidate the key
421
+ if (typeof _data === 'undefined')
422
+ return [2 /*return*/, trigger(_key, shouldRevalidate)
423
+ // update global timestamps
424
+ ];
425
+ // update global timestamps
426
+ MUTATION_TS[key] = now() - 1;
427
+ MUTATION_END_TS[key] = 0;
428
+ beforeMutationTs = MUTATION_TS[key];
429
+ beforeConcurrentPromisesTs = CONCURRENT_PROMISES_TS[key];
430
+ isAsyncMutation = false;
431
+ if (_data && typeof _data === 'function') {
432
+ // `_data` is a function, call it passing current cache value
433
+ try {
434
+ _data = _data(cache.get(key));
435
+ }
436
+ catch (err) {
437
+ // if `_data` function throws an error synchronously, it shouldn't be cached
438
+ _data = undefined;
439
+ error = err;
440
+ }
441
+ }
442
+ if (!(_data && typeof _data.then === 'function')) return [3 /*break*/, 5];
443
+ // `_data` is a promise
444
+ isAsyncMutation = true;
445
+ _b.label = 1;
446
+ case 1:
447
+ _b.trys.push([1, 3, , 4]);
448
+ return [4 /*yield*/, _data];
449
+ case 2:
450
+ data = _b.sent();
451
+ return [3 /*break*/, 4];
452
+ case 3:
453
+ err_1 = _b.sent();
454
+ error = err_1;
455
+ return [3 /*break*/, 4];
456
+ case 4: return [3 /*break*/, 6];
457
+ case 5:
458
+ data = _data;
459
+ _b.label = 6;
460
+ case 6:
461
+ shouldAbort = function () {
462
+ // check if other mutations have occurred since we've started this mutation
463
+ if (beforeMutationTs !== MUTATION_TS[key] ||
464
+ beforeConcurrentPromisesTs !== CONCURRENT_PROMISES_TS[key]) {
465
+ if (error)
466
+ throw error;
467
+ return true;
468
+ }
469
+ };
470
+ // if there's a race we don't update cache or broadcast change, just return the data
471
+ if (shouldAbort())
472
+ return [2 /*return*/, data];
473
+ if (typeof data !== 'undefined') {
474
+ // update cached data
475
+ cache.set(key, data);
476
+ }
477
+ // always update or reset the error
478
+ cache.set(keyErr, error);
479
+ // reset the timestamp to mark the mutation has ended
480
+ MUTATION_END_TS[key] = now() - 1;
481
+ if (!isAsyncMutation) {
482
+ // we skip broadcasting if there's another mutation happened synchronously
483
+ if (shouldAbort())
484
+ return [2 /*return*/, data];
485
+ }
486
+ updaters = CACHE_REVALIDATORS[key];
487
+ if (updaters) {
488
+ promises = [];
489
+ for (i = 0; i < updaters.length; ++i) {
490
+ promises.push(updaters[i](!!shouldRevalidate, data, error, undefined, i > 0));
491
+ }
492
+ // return new updated value
493
+ return [2 /*return*/, Promise.all(promises).then(function () {
494
+ if (error)
495
+ throw error;
496
+ return cache.get(key);
497
+ })];
498
+ }
499
+ // throw error or return data to be used by caller of mutate
500
+ if (error)
501
+ throw error;
502
+ return [2 /*return*/, data];
503
+ }
504
+ });
505
+ });
506
+ };
507
+ function useSWR() {
508
+ var _this = this;
509
+ var args = [];
510
+ for (var _i = 0; _i < arguments.length; _i++) {
511
+ args[_i] = arguments[_i];
512
+ }
513
+ var _key = args[0];
514
+ var config = Object.assign({}, defaultConfig, useContext(SWRConfigContext), args.length > 2
515
+ ? args[2]
516
+ : args.length === 2 && typeof args[1] === 'object'
517
+ ? args[1]
518
+ : {});
519
+ // in typescript args.length > 2 is not same as args.lenth === 3
520
+ // we do a safe type assertion here
521
+ // args.length === 3
522
+ var fn = (args.length > 2
523
+ ? args[1]
524
+ : args.length === 2 && typeof args[1] === 'function'
525
+ ? args[1]
526
+ : /**
527
+ pass fn as null will disable revalidate
528
+ https://paco.sh/blog/shared-hook-state-with-swr
529
+ */
530
+ args[1] === null
531
+ ? args[1]
532
+ : config.fetcher);
533
+ // we assume `key` as the identifier of the request
534
+ // `key` can change but `fn` shouldn't
535
+ // (because `revalidate` only depends on `key`)
536
+ // `keyErr` is the cache key for error objects
537
+ var _a = cache.serializeKey(_key), key = _a[0], fnArgs = _a[1], keyErr = _a[2], keyValidating = _a[3];
538
+ var configRef = useRef(config);
539
+ useIsomorphicLayoutEffect(function () {
540
+ configRef.current = config;
541
+ });
542
+ var willRevalidateOnMount = function () {
543
+ return (config.revalidateOnMount ||
544
+ (!config.initialData && config.revalidateOnMount === undefined));
545
+ };
546
+ var resolveData = function () {
547
+ var cachedData = cache.get(key);
548
+ return typeof cachedData === 'undefined' ? config.initialData : cachedData;
549
+ };
550
+ var resolveIsValidating = function () {
551
+ return !!cache.get(keyValidating) || (key && willRevalidateOnMount());
552
+ };
553
+ var initialData = resolveData();
554
+ var initialError = cache.get(keyErr);
555
+ var initialIsValidating = resolveIsValidating();
556
+ // if a state is accessed (data, error or isValidating),
557
+ // we add the state to dependencies so if the state is
558
+ // updated in the future, we can trigger a rerender
559
+ var stateDependencies = useRef({
560
+ data: false,
561
+ error: false,
562
+ isValidating: false
563
+ });
564
+ var stateRef = useRef({
565
+ data: initialData,
566
+ error: initialError,
567
+ isValidating: initialIsValidating
568
+ });
569
+ // display the data label in the React DevTools next to SWR hooks
570
+ useDebugValue(stateRef.current.data);
571
+ var rerender = useState({})[1];
572
+ var dispatch = useCallback(function (payload) {
573
+ var shouldUpdateState = false;
574
+ for (var k in payload) {
575
+ // @ts-ignore
576
+ if (stateRef.current[k] === payload[k]) {
577
+ continue;
578
+ }
579
+ // @ts-ignore
580
+ stateRef.current[k] = payload[k];
581
+ // @ts-ignore
582
+ if (stateDependencies.current[k]) {
583
+ shouldUpdateState = true;
584
+ }
585
+ }
586
+ if (shouldUpdateState) {
587
+ // if component is unmounted, should skip rerender
588
+ // if component is not mounted, should skip rerender
589
+ if (unmountedRef.current || !initialMountedRef.current)
590
+ return;
591
+ rerender({});
592
+ }
593
+ },
594
+ // config.suspense isn't allowed to change during the lifecycle
595
+ // eslint-disable-next-line react-hooks/exhaustive-deps
596
+ []);
597
+ // error ref inside revalidate (is last request errored?)
598
+ var unmountedRef = useRef(false);
599
+ var keyRef = useRef(key);
600
+ // check if component is mounted in suspense mode
601
+ var initialMountedRef = useRef(false);
602
+ // do unmount check for callbacks
603
+ var eventsCallback = useCallback(function (event) {
604
+ var _a;
605
+ var params = [];
606
+ for (var _i = 1; _i < arguments.length; _i++) {
607
+ params[_i - 1] = arguments[_i];
608
+ }
609
+ if (unmountedRef.current)
610
+ return;
611
+ if (!initialMountedRef.current)
612
+ return;
613
+ if (key !== keyRef.current)
614
+ return;
615
+ // @ts-ignore
616
+ (_a = configRef.current)[event].apply(_a, params);
617
+ }, [key]);
618
+ var boundMutate = useCallback(function (data, shouldRevalidate) {
619
+ return mutate(keyRef.current, data, shouldRevalidate);
620
+ }, []);
621
+ var addRevalidator = function (revalidators, callback) {
622
+ if (!revalidators[key]) {
623
+ revalidators[key] = [callback];
624
+ }
625
+ else {
626
+ revalidators[key].push(callback);
627
+ }
628
+ return function () {
629
+ var keyedRevalidators = revalidators[key];
630
+ var index = keyedRevalidators.indexOf(callback);
631
+ if (index >= 0) {
632
+ // O(1): faster than splice
633
+ keyedRevalidators[index] =
634
+ keyedRevalidators[keyedRevalidators.length - 1];
635
+ keyedRevalidators.pop();
636
+ }
637
+ };
638
+ };
639
+ // start a revalidation
640
+ var revalidate = useCallback(function (revalidateOpts) {
641
+ if (revalidateOpts === void 0) { revalidateOpts = {}; }
642
+ return __awaiter(_this, void 0, void 0, function () {
643
+ var _a, retryCount, _b, dedupe, loading, shouldDeduping, newData, startAt, newState, err_2;
644
+ return __generator(this, function (_c) {
645
+ switch (_c.label) {
646
+ case 0:
647
+ if (!key || !fn)
648
+ return [2 /*return*/, false];
649
+ if (unmountedRef.current)
650
+ return [2 /*return*/, false];
651
+ if (configRef.current.isPaused())
652
+ return [2 /*return*/, false];
653
+ _a = revalidateOpts.retryCount, retryCount = _a === void 0 ? 0 : _a, _b = revalidateOpts.dedupe, dedupe = _b === void 0 ? false : _b;
654
+ loading = true;
655
+ shouldDeduping = typeof CONCURRENT_PROMISES[key] !== 'undefined' && dedupe;
656
+ _c.label = 1;
657
+ case 1:
658
+ _c.trys.push([1, 6, , 7]);
659
+ dispatch({
660
+ isValidating: true
661
+ });
662
+ cache.set(keyValidating, true);
663
+ if (!shouldDeduping) {
664
+ // also update other hooks
665
+ broadcastState(key, stateRef.current.data, stateRef.current.error, true);
666
+ }
667
+ newData = void 0;
668
+ startAt = void 0;
669
+ if (!shouldDeduping) return [3 /*break*/, 3];
670
+ // there's already an ongoing request,
671
+ // this one needs to be deduplicated.
672
+ startAt = CONCURRENT_PROMISES_TS[key];
673
+ return [4 /*yield*/, CONCURRENT_PROMISES[key]];
674
+ case 2:
675
+ newData = _c.sent();
676
+ return [3 /*break*/, 5];
677
+ case 3:
678
+ // if no cache being rendered currently (it shows a blank page),
679
+ // we trigger the loading slow event.
680
+ if (config.loadingTimeout && !cache.get(key)) {
681
+ setTimeout(function () {
682
+ if (loading)
683
+ eventsCallback('onLoadingSlow', key, config);
684
+ }, config.loadingTimeout);
685
+ }
686
+ if (fnArgs !== null) {
687
+ CONCURRENT_PROMISES[key] = fn.apply(void 0, fnArgs);
688
+ }
689
+ else {
690
+ CONCURRENT_PROMISES[key] = fn(key);
691
+ }
692
+ CONCURRENT_PROMISES_TS[key] = startAt = now();
693
+ return [4 /*yield*/, CONCURRENT_PROMISES[key]];
694
+ case 4:
695
+ newData = _c.sent();
696
+ setTimeout(function () {
697
+ delete CONCURRENT_PROMISES[key];
698
+ delete CONCURRENT_PROMISES_TS[key];
699
+ }, config.dedupingInterval);
700
+ // trigger the success event,
701
+ // only do this for the original request.
702
+ eventsCallback('onSuccess', newData, key, config);
703
+ _c.label = 5;
704
+ case 5:
705
+ // if there're other ongoing request(s), started after the current one,
706
+ // we need to ignore the current one to avoid possible race conditions:
707
+ // req1------------------>res1 (current one)
708
+ // req2---------------->res2
709
+ // the request that fired later will always be kept.
710
+ if (CONCURRENT_PROMISES_TS[key] > startAt) {
711
+ return [2 /*return*/, false];
712
+ }
713
+ // if there're other mutations(s), overlapped with the current revalidation:
714
+ // case 1:
715
+ // req------------------>res
716
+ // mutate------>end
717
+ // case 2:
718
+ // req------------>res
719
+ // mutate------>end
720
+ // case 3:
721
+ // req------------------>res
722
+ // mutate-------...---------->
723
+ // we have to ignore the revalidation result (res) because it's no longer fresh.
724
+ // meanwhile, a new revalidation should be triggered when the mutation ends.
725
+ if (MUTATION_TS[key] &&
726
+ // case 1
727
+ (startAt <= MUTATION_TS[key] ||
728
+ // case 2
729
+ startAt <= MUTATION_END_TS[key] ||
730
+ // case 3
731
+ MUTATION_END_TS[key] === 0)) {
732
+ dispatch({ isValidating: false });
733
+ return [2 /*return*/, false];
734
+ }
735
+ cache.set(keyErr, undefined);
736
+ cache.set(keyValidating, false);
737
+ newState = {
738
+ isValidating: false
739
+ };
740
+ if (typeof stateRef.current.error !== 'undefined') {
741
+ // we don't have an error
742
+ newState.error = undefined;
743
+ }
744
+ if (!config.compare(stateRef.current.data, newData)) {
745
+ // deep compare to avoid extra re-render
746
+ // data changed
747
+ newState.data = newData;
748
+ }
749
+ if (!config.compare(cache.get(key), newData)) {
750
+ cache.set(key, newData);
751
+ }
752
+ // merge the new state
753
+ dispatch(newState);
754
+ if (!shouldDeduping) {
755
+ // also update other hooks
756
+ broadcastState(key, newData, newState.error, false);
757
+ }
758
+ return [3 /*break*/, 7];
759
+ case 6:
760
+ err_2 = _c.sent();
761
+ delete CONCURRENT_PROMISES[key];
762
+ delete CONCURRENT_PROMISES_TS[key];
763
+ if (configRef.current.isPaused()) {
764
+ dispatch({
765
+ isValidating: false
766
+ });
767
+ return [2 /*return*/, false];
768
+ }
769
+ cache.set(keyErr, err_2);
770
+ // get a new error
771
+ // don't use deep equal for errors
772
+ if (stateRef.current.error !== err_2) {
773
+ // we keep the stale data
774
+ dispatch({
775
+ isValidating: false,
776
+ error: err_2
777
+ });
778
+ if (!shouldDeduping) {
779
+ // also broadcast to update other hooks
780
+ broadcastState(key, undefined, err_2, false);
781
+ }
782
+ }
783
+ // events and retry
784
+ eventsCallback('onError', err_2, key, config);
785
+ if (config.shouldRetryOnError) {
786
+ // when retrying, we always enable deduping
787
+ eventsCallback('onErrorRetry', err_2, key, config, revalidate, {
788
+ retryCount: retryCount + 1,
789
+ dedupe: true
790
+ });
791
+ }
792
+ return [3 /*break*/, 7];
793
+ case 7:
794
+ loading = false;
795
+ return [2 /*return*/, true];
796
+ }
797
+ });
798
+ });
799
+ },
800
+ // dispatch is immutable, and `eventsCallback`, `fnArgs`, `keyErr`, and `keyValidating` are based on `key`,
801
+ // so we can them from the deps array.
802
+ //
803
+ // FIXME:
804
+ // `fn` and `config` might be changed during the lifecycle,
805
+ // but they might be changed every render like this.
806
+ // useSWR('key', () => fetch('/api/'), { suspense: true })
807
+ // So we omit the values from the deps array
808
+ // even though it might cause unexpected behaviors.
809
+ // eslint-disable-next-line react-hooks/exhaustive-deps
810
+ [key]);
811
+ // mounted (client side rendering)
812
+ useIsomorphicLayoutEffect(function () {
813
+ if (!key)
814
+ return undefined;
815
+ // after `key` updates, we need to mark it as mounted
816
+ unmountedRef.current = false;
817
+ var isUpdating = initialMountedRef.current;
818
+ initialMountedRef.current = true;
819
+ // after the component is mounted (hydrated),
820
+ // we need to update the data from the cache
821
+ // and trigger a revalidation
822
+ var currentHookData = stateRef.current.data;
823
+ var latestKeyedData = resolveData();
824
+ // update the state if the key changed (not the inital render) or cache updated
825
+ keyRef.current = key;
826
+ if (!config.compare(currentHookData, latestKeyedData)) {
827
+ dispatch({ data: latestKeyedData });
828
+ }
829
+ // revalidate with deduping
830
+ var softRevalidate = function () { return revalidate({ dedupe: true }); };
831
+ // trigger a revalidation
832
+ if (isUpdating || willRevalidateOnMount()) {
833
+ if (typeof latestKeyedData !== 'undefined' && !IS_SERVER) {
834
+ // delay revalidate if there's cache
835
+ // to not block the rendering
836
+ // @ts-ignore it's safe to use requestAnimationFrame in browser
837
+ rAF(softRevalidate);
838
+ }
839
+ else {
840
+ softRevalidate();
841
+ }
842
+ }
843
+ var pending = false;
844
+ var onFocus = function () {
845
+ if (pending || !configRef.current.revalidateOnFocus)
846
+ return;
847
+ pending = true;
848
+ softRevalidate();
849
+ setTimeout(function () { return (pending = false); }, configRef.current.focusThrottleInterval);
850
+ };
851
+ var onReconnect = function () {
852
+ if (configRef.current.revalidateOnReconnect) {
853
+ softRevalidate();
854
+ }
855
+ };
856
+ // register global cache update listener
857
+ var onUpdate = function (shouldRevalidate, updatedData, updatedError, updatedIsValidating, dedupe) {
858
+ if (shouldRevalidate === void 0) { shouldRevalidate = true; }
859
+ if (dedupe === void 0) { dedupe = true; }
860
+ // update hook state
861
+ var newState = {};
862
+ var needUpdate = false;
863
+ if (typeof updatedData !== 'undefined' &&
864
+ !config.compare(stateRef.current.data, updatedData)) {
865
+ newState.data = updatedData;
866
+ needUpdate = true;
867
+ }
868
+ // always update error
869
+ // because it can be `undefined`
870
+ if (stateRef.current.error !== updatedError) {
871
+ newState.error = updatedError;
872
+ needUpdate = true;
873
+ }
874
+ if (typeof updatedIsValidating !== 'undefined' &&
875
+ stateRef.current.isValidating !== updatedIsValidating) {
876
+ newState.isValidating = updatedIsValidating;
877
+ needUpdate = true;
878
+ }
879
+ if (needUpdate) {
880
+ dispatch(newState);
881
+ }
882
+ if (shouldRevalidate) {
883
+ if (dedupe) {
884
+ return softRevalidate();
885
+ }
886
+ else {
887
+ return revalidate();
888
+ }
889
+ }
890
+ return false;
891
+ };
892
+ var unsubFocus = addRevalidator(FOCUS_REVALIDATORS, onFocus);
893
+ var unsubReconnect = addRevalidator(RECONNECT_REVALIDATORS, onReconnect);
894
+ var unsubUpdate = addRevalidator(CACHE_REVALIDATORS, onUpdate);
895
+ return function () {
896
+ // cleanup
897
+ dispatch = function () { return null; };
898
+ // mark it as unmounted
899
+ unmountedRef.current = true;
900
+ unsubFocus();
901
+ unsubReconnect();
902
+ unsubUpdate();
903
+ };
904
+ }, [key, revalidate]);
905
+ useIsomorphicLayoutEffect(function () {
906
+ var timer = null;
907
+ var tick = function () { return __awaiter(_this, void 0, void 0, function () {
908
+ return __generator(this, function (_a) {
909
+ switch (_a.label) {
910
+ case 0:
911
+ if (!(!stateRef.current.error &&
912
+ (configRef.current.refreshWhenHidden ||
913
+ configRef.current.isDocumentVisible()) &&
914
+ (configRef.current.refreshWhenOffline || configRef.current.isOnline()))) return [3 /*break*/, 2];
915
+ // only revalidate when the page is visible
916
+ // if API request errored, we stop polling in this round
917
+ // and let the error retry function handle it
918
+ return [4 /*yield*/, revalidate({ dedupe: true })];
919
+ case 1:
920
+ // only revalidate when the page is visible
921
+ // if API request errored, we stop polling in this round
922
+ // and let the error retry function handle it
923
+ _a.sent();
924
+ _a.label = 2;
925
+ case 2:
926
+ // Read the latest refreshInterval
927
+ if (configRef.current.refreshInterval && timer) {
928
+ timer = setTimeout(tick, configRef.current.refreshInterval);
929
+ }
930
+ return [2 /*return*/];
931
+ }
932
+ });
933
+ }); };
934
+ if (configRef.current.refreshInterval) {
935
+ timer = setTimeout(tick, configRef.current.refreshInterval);
936
+ }
937
+ return function () {
938
+ if (timer) {
939
+ clearTimeout(timer);
940
+ timer = null;
941
+ }
942
+ };
943
+ }, [
944
+ config.refreshInterval,
945
+ config.refreshWhenHidden,
946
+ config.refreshWhenOffline,
947
+ revalidate
948
+ ]);
949
+ // suspense
950
+ var latestData;
951
+ var latestError;
952
+ if (config.suspense) {
953
+ // in suspense mode, we can't return empty state
954
+ // (it should be suspended)
955
+ // try to get data and error from cache
956
+ latestData = cache.get(key);
957
+ latestError = cache.get(keyErr);
958
+ if (typeof latestData === 'undefined') {
959
+ latestData = initialData;
960
+ }
961
+ if (typeof latestError === 'undefined') {
962
+ latestError = initialError;
963
+ }
964
+ if (typeof latestData === 'undefined' &&
965
+ typeof latestError === 'undefined') {
966
+ // need to start the request if it hasn't
967
+ if (!CONCURRENT_PROMISES[key]) {
968
+ // trigger revalidate immediately
969
+ // to get the promise
970
+ // in this revalidate, should not rerender
971
+ revalidate();
972
+ }
973
+ if (CONCURRENT_PROMISES[key] &&
974
+ typeof CONCURRENT_PROMISES[key].then === 'function') {
975
+ // if it is a promise
976
+ throw CONCURRENT_PROMISES[key];
977
+ }
978
+ // it's a value, return it directly (override)
979
+ latestData = CONCURRENT_PROMISES[key];
980
+ }
981
+ if (typeof latestData === 'undefined' && latestError) {
982
+ // in suspense mode, throw error if there's no content
983
+ throw latestError;
984
+ }
985
+ }
986
+ // define returned state
987
+ // can be memorized since the state is a ref
988
+ var memoizedState = useMemo(function () {
989
+ // revalidate will be deprecated in the 1.x release
990
+ // because mutate() covers the same use case of revalidate().
991
+ // This remains only for backward compatibility
992
+ var state = { revalidate: revalidate, mutate: boundMutate };
993
+ Object.defineProperties(state, {
994
+ error: {
995
+ // `key` might be changed in the upcoming hook re-render,
996
+ // but the previous state will stay
997
+ // so we need to match the latest key and data (fallback to `initialData`)
998
+ get: function () {
999
+ stateDependencies.current.error = true;
1000
+ if (config.suspense) {
1001
+ return latestError;
1002
+ }
1003
+ return keyRef.current === key ? stateRef.current.error : initialError;
1004
+ },
1005
+ enumerable: true
1006
+ },
1007
+ data: {
1008
+ get: function () {
1009
+ stateDependencies.current.data = true;
1010
+ if (config.suspense) {
1011
+ return latestData;
1012
+ }
1013
+ return keyRef.current === key ? stateRef.current.data : initialData;
1014
+ },
1015
+ enumerable: true
1016
+ },
1017
+ isValidating: {
1018
+ get: function () {
1019
+ stateDependencies.current.isValidating = true;
1020
+ return key ? stateRef.current.isValidating : false;
1021
+ },
1022
+ enumerable: true
1023
+ }
1024
+ });
1025
+ return state;
1026
+ // `config.suspense` isn't allowed to change during the lifecycle.
1027
+ // `boundMutate` is immutable, and the immutability of `revalidate` depends on `key`
1028
+ // so we can omit them from the deps array,
1029
+ // but we put it to enable react-hooks/exhaustive-deps rule.
1030
+ // `initialData` and `initialError` are not initial values
1031
+ // because they are changed during the lifecycle
1032
+ // so we should add them in the deps array.
1033
+ }, [
1034
+ revalidate,
1035
+ initialData,
1036
+ initialError,
1037
+ boundMutate,
1038
+ key,
1039
+ config.suspense,
1040
+ latestError,
1041
+ latestData
1042
+ ]);
1043
+ return memoizedState;
1044
+ }
1045
+ Object.defineProperty(SWRConfigContext.Provider, 'default', {
1046
+ value: defaultConfig
1047
+ });
1048
+ var SWRConfig = SWRConfigContext.Provider;
1049
+
1050
+ var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1051
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1052
+ return new (P || (P = Promise))(function (resolve, reject) {
1053
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1054
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1055
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1056
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
1057
+ });
1058
+ };
1059
+ var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
1060
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1061
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1062
+ function verb(n) { return function (v) { return step([n, v]); }; }
1063
+ function step(op) {
1064
+ if (f) throw new TypeError("Generator is already executing.");
1065
+ while (_) try {
1066
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1067
+ if (y = 0, t) op = [op[0] & 2, t.value];
1068
+ switch (op[0]) {
1069
+ case 0: case 1: t = op; break;
1070
+ case 4: _.label++; return { value: op[1], done: false };
1071
+ case 5: _.label++; y = op[1]; op = [0]; continue;
1072
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
1073
+ default:
1074
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1075
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1076
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1077
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1078
+ if (t[2]) _.ops.pop();
1079
+ _.trys.pop(); continue;
1080
+ }
1081
+ op = body.call(thisArg, _);
1082
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1083
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1084
+ }
1085
+ };
1086
+ var __rest = (undefined && undefined.__rest) || function (s, e) {
1087
+ var t = {};
1088
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1089
+ t[p] = s[p];
1090
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
1091
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1092
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1093
+ t[p[i]] = s[p[i]];
1094
+ }
1095
+ return t;
1096
+ };
1097
+
1098
+ var _this = undefined;
42
1099
 
43
1100
  var renderCardImage = function renderCardImage(row, client) {
44
1101
  var imageHeight = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
@@ -51,109 +1108,129 @@ var renderCardImage = function renderCardImage(row, client) {
51
1108
  return url;
52
1109
  };
53
1110
 
54
- var loadMore = function loadMore(values, setValues, itemsPerPage) {
55
- console.log('Values:::', values);
56
- setValues({
57
- page: values.page + 1,
58
- from: values.from + itemsPerPage,
59
- to: values.to + itemsPerPage
60
- });
61
- };
1111
+ // const loadMore = (values, setValues, itemsPerPage) => {
1112
+ // console.log('Values:::', values)
1113
+ // setValues({
1114
+ // page: values.page + 1,
1115
+ // from: values.from + itemsPerPage,
1116
+ // to: values.to + itemsPerPage
1117
+ // })
1118
+ // }
62
1119
 
63
- var loadData = function loadData(values, query, client, params, setData, setScrolling, setLastDataSize, pointer, pointerArray) {
64
- params = _extends({}, params, {
65
- from: values.from,
66
- to: values.to
67
- });
68
- client.fetch(query, params).then(function (dataArr) {
69
- if (pointer && pointerArray) {
70
- dataArr = dataArr[pointerArray][pointer];
71
- }
1120
+ // const loadData = (values, query, client, params, setData, setScrolling, setLastDataSize, pointer, pointerArray) => {
1121
+ // params = {
1122
+ // ...params,
1123
+ // from: values.from,
1124
+ // to: values.to
1125
+ // }
1126
+ // client.fetch(query, params).then((dataArr) => {
1127
+ // if (pointer && pointerArray) {
1128
+ // dataArr = dataArr[pointerArray][pointer]
1129
+ // }
72
1130
 
73
- if (!dataArr) {
74
- dataArr = [];
75
- }
1131
+ // if (!dataArr) {
1132
+ // dataArr = []
1133
+ // }
76
1134
 
77
- dataArr = dataArr.map(function (item) {
78
- return _extends({}, item, {
79
- pageNumber: values.page
80
- });
81
- });
1135
+ // dataArr = dataArr.map((item) => ({
1136
+ // ...item,
1137
+ // pageNumber: values.page
1138
+ // }))
82
1139
 
83
- if (dataArr.length > 0) {
84
- setData(function (prevData) {
85
- return [].concat(_toConsumableArray(prevData), _toConsumableArray(dataArr));
86
- });
87
- setLastDataSize(dataArr.length);
88
- setScrolling(true);
89
- } else {
90
- setLastDataSize(0);
91
- setScrolling(false);
92
- }
93
- });
94
- };
1140
+ // if (dataArr.length > 0) {
1141
+ // setData((prevData) => [...prevData, ...dataArr])
1142
+ // setLastDataSize(dataArr.length)
1143
+ // setScrolling(true)
1144
+ // } else {
1145
+ // setLastDataSize(0)
1146
+ // setScrolling(false)
1147
+ // }
1148
+ // })
1149
+ // }
95
1150
 
96
- var changePageNumber = function changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, itemIndex) {
97
- if (seoPaginate) {
98
- var path = router.asPath;
99
- var qrIndex = path.indexOf('?');
100
- var pathname = router.pathname;
101
- var queryString = '';
1151
+ // const changePageNumber = (pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, itemIndex) => {
1152
+ // if (seoPaginate) {
1153
+ // let path = router.asPath
1154
+ // let qrIndex = path.indexOf('?')
1155
+ // let pathname = router.pathname
1156
+ // let queryString = ''
102
1157
 
103
- if (qrIndex > 0) {
104
- path = path.substring(1, qrIndex);
1158
+ // if (qrIndex > 0) {
1159
+ // path = path.substring(1, qrIndex)
105
1160
 
106
- var partialQS = router.asPath.substring(qrIndex + 1);
107
- var partialQSArr = partialQS.split('&');
1161
+ // let partialQS = router.asPath.substring(qrIndex + 1)
1162
+ // let partialQSArr = partialQS.split('&')
108
1163
 
109
- // exclude page=xxx from query string
110
- partialQSArr.map(function (item) {
111
- var itemArr = item.split('=');
112
- var key = itemArr[0];
113
- var val = itemArr[1];
1164
+ // // exclude page=xxx from query string
1165
+ // partialQSArr.map((item) => {
1166
+ // let itemArr = item.split('=')
1167
+ // let key = itemArr[0]
1168
+ // let val = itemArr[1]
114
1169
 
115
- if (key !== 'page') {
116
- queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
117
- }
118
- });
119
- }
1170
+ // if (key !== 'page') {
1171
+ // queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val
1172
+ // }
1173
+ // })
1174
+ // }
120
1175
 
121
- if (queryString.length > 0) {
122
- path += '?' + queryString;
123
- }
1176
+ // if (queryString.length > 0) {
1177
+ // path += '?' + queryString
1178
+ // }
124
1179
 
125
- pageNumber = parseInt(pageNumber);
126
- // const index = Number(itemIndex)
127
- // const perPage = Number(itemsPerPage)
1180
+ // pageNumber = parseInt(pageNumber)
1181
+ // // const index = Number(itemIndex)
1182
+ // // const perPage = Number(itemsPerPage)
128
1183
 
129
- // pageNumber = Math.ceil((index + 1) / perPage)
1184
+ // // pageNumber = Math.ceil((index + 1) / perPage)
130
1185
 
131
- if (currentPage !== pageNumber) {
132
- lib_3.refresh();
1186
+ // if (currentPage !== pageNumber) {
1187
+ // DFPManager.refresh()
133
1188
 
134
- setCurrentPage(pageNumber);
135
- if (path[0] !== '/') {
136
- path = '/' + path;
137
- }
1189
+ // setCurrentPage(pageNumber)
1190
+ // if (path[0] !== '/') {
1191
+ // path = '/' + path
1192
+ // }
138
1193
 
139
- var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
1194
+ // let newPath = pageNumber === 1 ? `${path}` : `${path}${queryString.length > 0 ? '&' : '?'}page=${pageNumber}`
140
1195
 
141
- // if (pageview) {
142
- // pageview(newPath)
143
- // }
1196
+ // // if (pageview) {
1197
+ // // pageview(newPath)
1198
+ // // }
144
1199
 
145
- router.push(pathname, newPath, {
146
- shallow: true
147
- });
148
- }
149
- }
150
- };
1200
+ // router.push(pathname, newPath, {
1201
+ // shallow: true
1202
+ // })
1203
+ // }
1204
+ // }
1205
+ // }
151
1206
 
152
1207
  var checkExternalUrl = function checkExternalUrl(url) {
153
1208
  return new RegExp(['http', 'https'].join('|')).test(url);
154
1209
  };
155
1210
 
156
- var cardLoader = function cardLoader(data, client, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, imageMaxHeight, imageFit, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent, lgInfeedAd, showPubInfo, contentCategoryMapping, showTimeDiff, showTaxonomies, showIntro) {
1211
+ var CardLoader = function CardLoader(_ref) {
1212
+ var data = _ref.data,
1213
+ client = _ref.client,
1214
+ mapping = _ref.mapping,
1215
+ showPublished = _ref.showPublished,
1216
+ defaultImage = _ref.defaultImage,
1217
+ showAuthor = _ref.showAuthor,
1218
+ showCategory = _ref.showCategory,
1219
+ imageHeight = _ref.imageHeight,
1220
+ imageWidth = _ref.imageWidth,
1221
+ imageMaxHeight = _ref.imageMaxHeight,
1222
+ imageFit = _ref.imageFit,
1223
+ rightItems = _ref.rightItems,
1224
+ brandInsightAd = _ref.brandInsightAd,
1225
+ showBI = _ref.showBI,
1226
+ heroContent = _ref.heroContent,
1227
+ lgInfeedAd = _ref.lgInfeedAd,
1228
+ showPubInfo = _ref.showPubInfo,
1229
+ contentCategoryMapping = _ref.contentCategoryMapping,
1230
+ showTimeDiff = _ref.showTimeDiff,
1231
+ showTaxonomies = _ref.showTaxonomies,
1232
+ showIntro = _ref.showIntro;
1233
+
157
1234
  var numberOfItemsBeforeAd = 6;
158
1235
  var insertBrandInsightAd = function insertBrandInsightAd(arr, index, newElement) {
159
1236
  return [].concat(_toConsumableArray(arr.slice(0, index)), [newElement], _toConsumableArray(arr.slice(index)));
@@ -235,23 +1312,23 @@ var cardLoader = function cardLoader(data, client, mapping, values, seoPaginate,
235
1312
  }
236
1313
  }
237
1314
 
238
- // 'articleCount' is New parameter to use instead of 'index' while passing to 'changePageNumber()'
239
- // 'index' was including the indexes for infeed ads along with article count making the page number change before it reaches last article.
240
- // 'articleCount' will be the indexes of only the articles in the deck.
241
- var articleCount = -1;
242
- data = data.map(function (ele, i) {
243
- if (ele._type === 'lg-infeed') {
244
- // Setting pos as top2 for the first occurence of large infeed ad
245
- // const pos = data.indexOf(data.find((d) => d._type === 'lg-infeed')) === i ? 'top2' : `lg-infeed_${i}`
246
- return _extends({}, ele, { slotId: 'lg-infeed_' + i, targeting: _extends({}, ele.targeting, { pos: 'lg-infeed' }) });
247
- } else if (ele._type === 'article') {
248
- // incrementing 'articleCount' for each article.
249
- ++articleCount;
250
- return _extends({}, ele, { articleCount: articleCount });
251
- } else {
252
- return ele;
253
- }
254
- });
1315
+ // // 'articleCount' is New parameter to use instead of 'index' while passing to 'changePageNumber()'
1316
+ // // 'index' was including the indexes for infeed ads along with article count making the page number change before it reaches last article.
1317
+ // // 'articleCount' will be the indexes of only the articles in the deck.
1318
+ // let articleCount = -1
1319
+ // data = data.map((ele, i) => {
1320
+ // if (ele._type === 'lg-infeed') {
1321
+ // // Setting pos as top2 for the first occurence of large infeed ad
1322
+ // // const pos = data.indexOf(data.find((d) => d._type === 'lg-infeed')) === i ? 'top2' : `lg-infeed_${i}`
1323
+ // return { ...ele, slotId: `lg-infeed_${i}`, targeting: { ...ele.targeting, pos: 'lg-infeed' } }
1324
+ // } else if (ele._type === 'article') {
1325
+ // // incrementing 'articleCount' for each article.
1326
+ // ++articleCount
1327
+ // return { ...ele, articleCount: articleCount }
1328
+ // } else {
1329
+ // return ele
1330
+ // }
1331
+ // })
255
1332
 
256
1333
  var featureCount = 0;
257
1334
  return React__default.createElement(
@@ -259,360 +1336,795 @@ var cardLoader = function cardLoader(data, client, mapping, values, seoPaginate,
259
1336
  null,
260
1337
  data && data.length > 0 ? dataRemapped ? // For Javascript Enabled Cases
261
1338
  data.map(function (article, index) {
262
- var pageNumber = article.pageNumber || values.page;
263
1339
  var contentCategoryName = article.contentCategory ? article.contentCategory.name : 'Articles';
264
1340
 
265
1341
  if (article._type === 'feature') {
266
1342
  featureCount++;
267
1343
  if (article.blank || checkExternalUrl(article.url.current)) {
268
1344
  return React__default.createElement(
269
- VisibilitySensor,
1345
+ Media,
270
1346
  {
271
1347
  key: article._id ? article._id : index,
272
- partialVisibility: true,
273
- onChange: function onChange(isVisible) {
274
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage);
275
- } },
1348
+ className: 'feature-media',
1349
+ style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
1350
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
1351
+ 'a',
1352
+ { rel: 'noopener', href: article.url.current, target: '_blank', className: 'feature-wrapper' },
1353
+ React__default.createElement(
1354
+ LazyLoad,
1355
+ { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
1356
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
1357
+ ),
1358
+ article.source && React__default.createElement(
1359
+ 'div',
1360
+ { className: 'content-category-label' },
1361
+ React__default.createElement(
1362
+ 'div',
1363
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1364
+ article.source
1365
+ )
1366
+ )
1367
+ ),
276
1368
  React__default.createElement(
277
- React__default.Fragment,
1369
+ Media.Body,
278
1370
  null,
279
1371
  React__default.createElement(
280
- Media,
281
- {
282
- key: article._id ? article._id : index,
283
- className: 'feature-media',
284
- style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
285
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
286
- 'a',
287
- { rel: 'noopener', href: article.url.current, target: '_blank', className: 'feature-wrapper' },
288
- React__default.createElement(
289
- LazyLoad,
290
- { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
291
- article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
292
- ),
293
- article.source && React__default.createElement(
294
- 'div',
295
- { className: 'content-category-label' },
296
- React__default.createElement(
297
- 'div',
298
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
299
- article.source
300
- )
301
- )
302
- ),
303
- React__default.createElement(
304
- Media.Body,
305
- null,
306
- React__default.createElement(
307
- 'a',
308
- { rel: 'noopener', href: article.url.current, target: '_blank' },
309
- article.title && React__default.createElement(
310
- 'h4',
311
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
312
- article.title
313
- )
314
- ),
315
- showPublished && !showTimeDiff && article.published && React__default.createElement(
316
- 'p',
317
- { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
318
- moment(article.published).format('MMMM DD, YYYY')
319
- ),
320
- showTimeDiff && article.published && React__default.createElement(
321
- 'p',
322
- { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
323
- showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
324
- if (index > 3) {
325
- return null;
326
- }
327
- if (index === 3) {
328
- return React__default.createElement(
329
- React__default.Fragment,
330
- null,
331
- React__default.createElement(
332
- 'em',
333
- { style: { marginRight: '.5rem' } },
334
- '...'
335
- )
336
- );
337
- }
338
- return React__default.createElement(
339
- React__default.Fragment,
340
- null,
341
- React__default.createElement(
342
- 'em',
343
- null,
344
- taxonomy.name
345
- ),
346
- ' |',
347
- ' '
348
- );
349
- }),
350
- ' ',
351
- React__default.createElement(
352
- 'span',
353
- { style: { display: 'inline-block' } },
354
- timeDifferenceCalc(article.published)
355
- )
356
- ),
357
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
358
- LazyLoad,
359
- { height: 50 },
360
- React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
361
- ),
362
- !article.thumbnail && !defaultImage && article.source && React__default.createElement(
363
- 'div',
364
- { className: 'content-category-label' },
1372
+ 'a',
1373
+ { rel: 'noopener', href: article.url.current, target: '_blank' },
1374
+ article.title && React__default.createElement(
1375
+ 'h4',
1376
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
1377
+ article.title
1378
+ )
1379
+ ),
1380
+ showPublished && !showTimeDiff && article.published && React__default.createElement(
1381
+ 'p',
1382
+ { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
1383
+ moment(article.published).format('MMMM DD, YYYY')
1384
+ ),
1385
+ showTimeDiff && article.published && React__default.createElement(
1386
+ 'p',
1387
+ { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
1388
+ showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
1389
+ if (index > 3) {
1390
+ return null;
1391
+ }
1392
+ if (index === 3) {
1393
+ return React__default.createElement(
1394
+ React__default.Fragment,
1395
+ null,
1396
+ React__default.createElement(
1397
+ 'em',
1398
+ { style: { marginRight: '.5rem' } },
1399
+ '...'
1400
+ )
1401
+ );
1402
+ }
1403
+ return React__default.createElement(
1404
+ React__default.Fragment,
1405
+ null,
365
1406
  React__default.createElement(
366
- 'div',
367
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
368
- article.source
369
- )
370
- ),
371
- React__default.createElement(
372
- 'div',
373
- { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
374
- showCategory && article.contentCategory && React__default.createElement(
375
- 'p',
376
- {
377
- className: 'article-category',
378
- style: {
379
- background: '#3FB618',
380
- color: '#ffffff',
381
- marginBottom: '.25rem',
382
- display: 'inline-block',
383
- padding: '0 .25rem',
384
- fontSize: '.8rem'
385
- } },
386
- getContentCategory(article.contentCategory.name, contentCategoryMapping)
387
- ),
388
- article.issueSection && article.issueSection.name && React__default.createElement(
389
- 'p',
390
- {
391
- className: 'issueSection',
392
- style: {
393
- background: '#000000',
394
- color: '#ffffff',
395
- marginBottom: '.25rem',
396
- marginLeft: '.25rem',
397
- display: 'inline-block',
398
- padding: '0 .25rem',
399
- fontSize: '.8rem'
400
- } },
401
- article.issueSection.name
402
- )
403
- ),
404
- showPubInfo && (article.issue || article.volume) && React__default.createElement(
405
- 'div',
406
- { className: 'pubInfo' },
407
- article.volume && React__default.createElement(
408
- 'p',
409
- { className: 'qdeVolume' },
410
- article.volume
1407
+ 'em',
1408
+ null,
1409
+ taxonomy.name
411
1410
  ),
412
- article.issue && React__default.createElement(
413
- 'p',
414
- { className: 'qdeIssue' },
415
- article.issue
416
- )
417
- ),
418
- showIntro && article.summary && React__default.createElement(
419
- 'p',
420
- { className: 'pt-2 card-text' },
421
- clean_html_1(article.summary)
422
- )
1411
+ ' |',
1412
+ ' '
1413
+ );
1414
+ }),
1415
+ ' ',
1416
+ React__default.createElement(
1417
+ 'span',
1418
+ { style: { display: 'inline-block' } },
1419
+ timeDifferenceCalc(article.published)
1420
+ )
1421
+ ),
1422
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
1423
+ LazyLoad,
1424
+ { height: 50 },
1425
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
1426
+ ),
1427
+ !article.thumbnail && !defaultImage && article.source && React__default.createElement(
1428
+ 'div',
1429
+ { className: 'content-category-label' },
1430
+ React__default.createElement(
1431
+ 'div',
1432
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1433
+ article.source
1434
+ )
1435
+ ),
1436
+ React__default.createElement(
1437
+ 'div',
1438
+ { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
1439
+ showCategory && article.contentCategory && React__default.createElement(
1440
+ 'p',
1441
+ {
1442
+ className: 'article-category',
1443
+ style: {
1444
+ background: '#3FB618',
1445
+ color: '#ffffff',
1446
+ marginBottom: '.25rem',
1447
+ display: 'inline-block',
1448
+ padding: '0 .25rem',
1449
+ fontSize: '.8rem'
1450
+ } },
1451
+ getContentCategory(article.contentCategory.name, contentCategoryMapping)
1452
+ ),
1453
+ article.issueSection && article.issueSection.name && React__default.createElement(
1454
+ 'p',
1455
+ {
1456
+ className: 'issueSection',
1457
+ style: {
1458
+ background: '#000000',
1459
+ color: '#ffffff',
1460
+ marginBottom: '.25rem',
1461
+ marginLeft: '.25rem',
1462
+ display: 'inline-block',
1463
+ padding: '0 .25rem',
1464
+ fontSize: '.8rem'
1465
+ } },
1466
+ article.issueSection.name
1467
+ )
1468
+ ),
1469
+ showPubInfo && (article.issue || article.volume) && React__default.createElement(
1470
+ 'div',
1471
+ { className: 'pubInfo' },
1472
+ article.volume && React__default.createElement(
1473
+ 'p',
1474
+ { className: 'qdeVolume' },
1475
+ article.volume
1476
+ ),
1477
+ article.issue && React__default.createElement(
1478
+ 'p',
1479
+ { className: 'qdeIssue' },
1480
+ article.issue
423
1481
  )
1482
+ ),
1483
+ showIntro && article.summary && React__default.createElement(
1484
+ 'p',
1485
+ { className: 'pt-2 card-text' },
1486
+ clean_html_1(article.summary)
424
1487
  )
425
1488
  )
426
1489
  );
427
1490
  } else {
428
1491
  return React__default.createElement(
429
- VisibilitySensor,
1492
+ Media,
430
1493
  {
431
1494
  key: article._id ? article._id : index,
432
- partialVisibility: true,
433
- onChange: function onChange(isVisible) {
434
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage);
435
- } },
436
- React__default.createElement(
437
- React__default.Fragment,
438
- null,
1495
+ className: 'feature-media',
1496
+ style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
1497
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
1498
+ 'a',
1499
+ { href: article.url.current, className: 'feature-wrapper' },
439
1500
  React__default.createElement(
440
- Media,
441
- {
442
- key: article._id ? article._id : index,
443
- className: 'feature-media',
444
- style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
445
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
446
- 'a',
447
- { href: article.url.current, className: 'feature-wrapper' },
1501
+ LazyLoad,
1502
+ { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
1503
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
1504
+ ),
1505
+ article.source && React__default.createElement(
1506
+ 'div',
1507
+ { className: 'content-category-label' },
1508
+ React__default.createElement(
1509
+ 'div',
1510
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1511
+ article.source
1512
+ )
1513
+ )
1514
+ ),
1515
+ React__default.createElement(
1516
+ Media.Body,
1517
+ null,
1518
+ React__default.createElement(
1519
+ 'a',
1520
+ { href: article.url.current },
1521
+ article.title && React__default.createElement(
1522
+ 'h4',
1523
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
1524
+ article.title
1525
+ )
1526
+ ),
1527
+ showPublished && !showTimeDiff && article.published && React__default.createElement(
1528
+ 'p',
1529
+ { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
1530
+ moment(article.published).format('MMMM DD, YYYY')
1531
+ ),
1532
+ showTimeDiff && article.published && React__default.createElement(
1533
+ 'p',
1534
+ { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
1535
+ showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
1536
+ if (index > 3) {
1537
+ return null;
1538
+ }
1539
+ if (index === 3) {
1540
+ return React__default.createElement(
1541
+ React__default.Fragment,
1542
+ null,
1543
+ React__default.createElement(
1544
+ 'em',
1545
+ { style: { marginRight: '.5rem' } },
1546
+ '...'
1547
+ )
1548
+ );
1549
+ }
1550
+ if (index === 3) {
1551
+ return React__default.createElement(
1552
+ React__default.Fragment,
1553
+ null,
1554
+ React__default.createElement(
1555
+ 'em',
1556
+ { style: { marginRight: '.5rem' } },
1557
+ '...'
1558
+ )
1559
+ );
1560
+ }
1561
+ return React__default.createElement(
1562
+ React__default.Fragment,
1563
+ null,
1564
+ React__default.createElement(
1565
+ 'em',
1566
+ null,
1567
+ taxonomy.name
1568
+ ),
1569
+ ' |',
1570
+ ' '
1571
+ );
1572
+ }),
1573
+ ' ',
1574
+ React__default.createElement(
1575
+ 'span',
1576
+ { style: { display: 'inline-block' } },
1577
+ timeDifferenceCalc(article.published)
1578
+ )
1579
+ ),
1580
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
1581
+ LazyLoad,
1582
+ { height: 50 },
1583
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
1584
+ ),
1585
+ !article.thumbnail && !defaultImage && article.source && React__default.createElement(
1586
+ 'div',
1587
+ { className: 'content-category-label' },
1588
+ React__default.createElement(
1589
+ 'div',
1590
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1591
+ article.source
1592
+ )
1593
+ ),
1594
+ React__default.createElement(
1595
+ 'div',
1596
+ { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
1597
+ showCategory && article.contentCategory && React__default.createElement(
1598
+ 'p',
1599
+ {
1600
+ className: 'article-category',
1601
+ style: {
1602
+ background: '#3FB618',
1603
+ color: '#ffffff',
1604
+ marginBottom: '.25rem',
1605
+ display: 'inline-block',
1606
+ padding: '0 .25rem',
1607
+ fontSize: '.8rem'
1608
+ } },
1609
+ getContentCategory(article.contentCategory.name, contentCategoryMapping)
1610
+ ),
1611
+ article.issueSection && article.issueSection.name && React__default.createElement(
1612
+ 'p',
1613
+ {
1614
+ className: 'issueSection',
1615
+ style: {
1616
+ background: '#000000',
1617
+ color: '#ffffff',
1618
+ marginBottom: '.25rem',
1619
+ marginLeft: '.25rem',
1620
+ display: 'inline-block',
1621
+ padding: '0 .25rem',
1622
+ fontSize: '.8rem'
1623
+ } },
1624
+ article.issueSection.name
1625
+ )
1626
+ ),
1627
+ showPubInfo && (article.issue || article.volume) && React__default.createElement(
1628
+ 'div',
1629
+ { className: 'pubInfo' },
1630
+ article.volume && React__default.createElement(
1631
+ 'p',
1632
+ { className: 'qdeVolume' },
1633
+ article.volume
1634
+ ),
1635
+ article.issue && React__default.createElement(
1636
+ 'p',
1637
+ { className: 'qdeIssue' },
1638
+ article.issue
1639
+ )
1640
+ ),
1641
+ showIntro && article.summary && React__default.createElement(
1642
+ 'p',
1643
+ { className: 'pt-2 card-text' },
1644
+ clean_html_1(article.summary)
1645
+ )
1646
+ )
1647
+ );
1648
+ }
1649
+ } else if (article._type === 'lg-infeed' && article.adUnit) {
1650
+ return React__default.createElement(ADlgInfeed, _extends({ index: index }, article));
1651
+ } else if (article._type === 'brandInsightAd' && article.adUnit) {
1652
+ return React__default.createElement(ADInfeed, { index: index, infeedAd: article });
1653
+ }
1654
+ if ((brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) && (!article._type || !['lg-infeed', 'brandInsightAd'].includes(article._type))) {
1655
+ return React__default.createElement(
1656
+ React__default.Fragment,
1657
+ { key: article._id ? article._id : index },
1658
+ React__default.createElement(
1659
+ Media,
1660
+ {
1661
+ key: article._id ? article._id : index,
1662
+ style: { flexDirection: 'row', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
1663
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
1664
+ 'a',
1665
+ { href: mapping[contentCategoryName] + '/' + article.url.current, className: 'img-wrapper' },
1666
+ React__default.createElement(
1667
+ LazyLoad,
1668
+ { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
1669
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'mr-3 img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
1670
+ ),
1671
+ article.source && React__default.createElement(
1672
+ 'div',
1673
+ { className: 'content-category-label' },
1674
+ React__default.createElement(
1675
+ 'div',
1676
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1677
+ article.source
1678
+ )
1679
+ )
1680
+ ),
1681
+ React__default.createElement(
1682
+ Media.Body,
1683
+ null,
1684
+ React__default.createElement(
1685
+ 'a',
1686
+ { href: mapping[contentCategoryName] + '/' + article.url.current },
1687
+ article.title && React__default.createElement(
1688
+ 'h4',
1689
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
1690
+ article.title
1691
+ )
1692
+ ),
1693
+ showPublished && !showTimeDiff && article.published && React__default.createElement(
1694
+ 'p',
1695
+ { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
1696
+ moment(article.published).format('MMMM DD, YYYY')
1697
+ ),
1698
+ showTimeDiff && article.published && React__default.createElement(
1699
+ 'p',
1700
+ { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
1701
+ showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
1702
+ if (index > 3) {
1703
+ return null;
1704
+ }
1705
+ if (index === 3) {
1706
+ return React__default.createElement(
1707
+ React__default.Fragment,
1708
+ null,
1709
+ React__default.createElement(
1710
+ 'em',
1711
+ { style: { marginRight: '.5rem' } },
1712
+ '...'
1713
+ )
1714
+ );
1715
+ }
1716
+ return React__default.createElement(
1717
+ React__default.Fragment,
1718
+ null,
1719
+ React__default.createElement(
1720
+ 'em',
1721
+ null,
1722
+ taxonomy.name
1723
+ ),
1724
+ ' |',
1725
+ ' '
1726
+ );
1727
+ }),
1728
+ ' ',
1729
+ React__default.createElement(
1730
+ 'span',
1731
+ { style: { display: 'inline-block' } },
1732
+ timeDifferenceCalc(article.published)
1733
+ )
1734
+ ),
1735
+ React__default.createElement(
1736
+ 'div',
1737
+ { className: 'author-sec', style: { lineHeight: 1.5 } },
1738
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
1739
+ LazyLoad,
1740
+ { height: 50 },
1741
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
1742
+ )
1743
+ ),
1744
+ !article.thumbnail && !defaultImage && article.source && React__default.createElement(
1745
+ 'div',
1746
+ { className: 'content-category-label' },
1747
+ React__default.createElement(
1748
+ 'div',
1749
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1750
+ article.source
1751
+ )
1752
+ ),
1753
+ React__default.createElement(
1754
+ 'div',
1755
+ { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
1756
+ showCategory && article.contentCategory && React__default.createElement(
1757
+ 'p',
1758
+ {
1759
+ className: 'article-category',
1760
+ style: {
1761
+ background: '#3FB618',
1762
+ color: '#ffffff',
1763
+ marginBottom: '.25rem',
1764
+ display: 'inline-block',
1765
+ padding: '0 .25rem',
1766
+ fontSize: '.8rem'
1767
+ } },
1768
+ getContentCategory(article.contentCategory.name, contentCategoryMapping)
1769
+ ),
1770
+ article.issueSection && article.issueSection.name && React__default.createElement(
1771
+ 'p',
1772
+ {
1773
+ className: 'issueSection',
1774
+ style: {
1775
+ background: '#000000',
1776
+ color: '#ffffff',
1777
+ marginBottom: '.25rem',
1778
+ marginLeft: '.25rem',
1779
+ display: 'inline-block',
1780
+ padding: '0 .25rem',
1781
+ fontSize: '.8rem'
1782
+ } },
1783
+ article.issueSection.name
1784
+ )
1785
+ ),
1786
+ showPubInfo && (article.issue || article.volume) && React__default.createElement(
1787
+ 'div',
1788
+ { className: 'pubInfo' },
1789
+ article.volume && React__default.createElement(
1790
+ 'p',
1791
+ { className: 'qdeVolume' },
1792
+ article.volume
1793
+ ),
1794
+ article.issue && React__default.createElement(
1795
+ 'p',
1796
+ { className: 'qdeIssue' },
1797
+ article.issue
1798
+ )
1799
+ ),
1800
+ showIntro && article.summary && React__default.createElement(
1801
+ 'p',
1802
+ { className: 'pt-2 card-text' },
1803
+ clean_html_1(article.summary)
1804
+ )
1805
+ )
1806
+ ),
1807
+ React__default.createElement(
1808
+ 'div',
1809
+ null,
1810
+ main_36 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
1811
+ )
1812
+ );
1813
+ } else return null;
1814
+ }) :
1815
+ // For Javascript Disabled Cases
1816
+ React__default.createElement(
1817
+ 'noscript',
1818
+ null,
1819
+ data.map(function (article, index) {
1820
+ var contentCategoryName = article.contentCategory ? article.contentCategory.name : 'Articles';
1821
+
1822
+ if (article._type === 'feature') {
1823
+ featureCount++;
1824
+ if (article.blank || checkExternalUrl(article.url.current)) {
1825
+ return React__default.createElement(
1826
+ Media,
1827
+ {
1828
+ key: article._id ? article._id : index,
1829
+ className: 'feature-media',
1830
+ style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
1831
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
1832
+ 'a',
1833
+ { rel: 'noopener', href: article.url.current, target: '_blank', className: 'feature-wrapper' },
1834
+ React__default.createElement(
1835
+ LazyLoad,
1836
+ { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
1837
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
1838
+ ),
1839
+ article.source && React__default.createElement(
1840
+ 'div',
1841
+ { className: 'content-category-label' },
448
1842
  React__default.createElement(
449
- LazyLoad,
450
- { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
451
- article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
452
- ),
453
- article.source && React__default.createElement(
454
1843
  'div',
455
- { className: 'content-category-label' },
456
- React__default.createElement(
457
- 'div',
458
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
459
- article.source
460
- )
1844
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1845
+ article.source
461
1846
  )
462
- ),
1847
+ )
1848
+ ),
1849
+ React__default.createElement(
1850
+ Media.Body,
1851
+ null,
463
1852
  React__default.createElement(
464
- Media.Body,
465
- null,
1853
+ 'a',
1854
+ { rel: 'noopener', href: article.url.current, target: '_blank' },
1855
+ article.title && React__default.createElement(
1856
+ 'h4',
1857
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
1858
+ article.title
1859
+ )
1860
+ ),
1861
+ showPublished && article.published && React__default.createElement(
1862
+ 'p',
1863
+ { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
1864
+ moment(article.published).format('MMMM DD, YYYY')
1865
+ ),
1866
+ showTimeDiff && article.published && React__default.createElement(
1867
+ 'p',
1868
+ { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
1869
+ showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
1870
+ if (index > 3) {
1871
+ return null;
1872
+ }
1873
+ if (index === 3) {
1874
+ return React__default.createElement(
1875
+ React__default.Fragment,
1876
+ null,
1877
+ React__default.createElement(
1878
+ 'em',
1879
+ { style: { marginRight: '.5rem' } },
1880
+ '...'
1881
+ )
1882
+ );
1883
+ }
1884
+ return React__default.createElement(
1885
+ React__default.Fragment,
1886
+ null,
1887
+ React__default.createElement(
1888
+ 'em',
1889
+ null,
1890
+ taxonomy.name
1891
+ ),
1892
+ ' |',
1893
+ ' '
1894
+ );
1895
+ }),
1896
+ ' ',
466
1897
  React__default.createElement(
467
- 'a',
468
- { href: article.url.current },
469
- article.title && React__default.createElement(
470
- 'h4',
471
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
472
- article.title
473
- )
1898
+ 'span',
1899
+ { style: { display: 'inline-block' } },
1900
+ timeDifferenceCalc(article.published)
1901
+ )
1902
+ ),
1903
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
1904
+ LazyLoad,
1905
+ { height: 50 },
1906
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
1907
+ ),
1908
+ !article.thumbnail && !defaultImage && article.source && React__default.createElement(
1909
+ 'div',
1910
+ { className: 'content-category-label' },
1911
+ React__default.createElement(
1912
+ 'div',
1913
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1914
+ article.source
1915
+ )
1916
+ ),
1917
+ React__default.createElement(
1918
+ 'div',
1919
+ { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
1920
+ showCategory && article.contentCategory && React__default.createElement(
1921
+ 'p',
1922
+ {
1923
+ className: 'article-category',
1924
+ style: {
1925
+ background: '#3FB618',
1926
+ color: '#ffffff',
1927
+ marginBottom: '.25rem',
1928
+ display: 'inline-block',
1929
+ padding: '0 .25rem',
1930
+ fontSize: '.8rem'
1931
+ } },
1932
+ getContentCategory(article.contentCategory.name, contentCategoryMapping)
474
1933
  ),
475
- showPublished && !showTimeDiff && article.published && React__default.createElement(
1934
+ article.issueSection && article.issueSection.name && React__default.createElement(
476
1935
  'p',
477
- { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
478
- moment(article.published).format('MMMM DD, YYYY')
1936
+ {
1937
+ className: 'issueSection',
1938
+ style: {
1939
+ background: '#000000',
1940
+ color: '#ffffff',
1941
+ marginBottom: '.25rem',
1942
+ marginLeft: '.25rem',
1943
+ display: 'inline-block',
1944
+ padding: '0 .25rem',
1945
+ fontSize: '.8rem'
1946
+ } },
1947
+ article.issueSection.name
1948
+ )
1949
+ ),
1950
+ showPubInfo && (article.issue || article.volume) && React__default.createElement(
1951
+ 'div',
1952
+ { className: 'pubInfo' },
1953
+ article.volume && React__default.createElement(
1954
+ 'p',
1955
+ { className: 'qdeVolume' },
1956
+ article.volume
479
1957
  ),
480
- showTimeDiff && article.published && React__default.createElement(
1958
+ article.issue && React__default.createElement(
481
1959
  'p',
482
- { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
483
- showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
484
- if (index > 3) {
485
- return null;
486
- }
487
- if (index === 3) {
488
- return React__default.createElement(
489
- React__default.Fragment,
490
- null,
491
- React__default.createElement(
492
- 'em',
493
- { style: { marginRight: '.5rem' } },
494
- '...'
495
- )
496
- );
497
- }
498
- if (index === 3) {
499
- return React__default.createElement(
500
- React__default.Fragment,
501
- null,
502
- React__default.createElement(
503
- 'em',
504
- { style: { marginRight: '.5rem' } },
505
- '...'
506
- )
507
- );
508
- }
1960
+ { className: 'qdeIssue' },
1961
+ article.issue
1962
+ )
1963
+ ),
1964
+ showIntro && article.summary && React__default.createElement(
1965
+ 'p',
1966
+ { className: 'pt-2 card-text' },
1967
+ clean_html_1(article.summary)
1968
+ )
1969
+ )
1970
+ );
1971
+ } else {
1972
+ return React__default.createElement(
1973
+ Media,
1974
+ {
1975
+ key: article._id ? article._id : index,
1976
+ className: 'feature-media',
1977
+ style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
1978
+ (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
1979
+ 'a',
1980
+ { href: article.url.current, className: 'feature-wrapper' },
1981
+ React__default.createElement(
1982
+ LazyLoad,
1983
+ { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
1984
+ article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
1985
+ ),
1986
+ article.source && React__default.createElement(
1987
+ 'div',
1988
+ { className: 'content-category-label' },
1989
+ React__default.createElement(
1990
+ 'div',
1991
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1992
+ article.source
1993
+ )
1994
+ )
1995
+ ),
1996
+ React__default.createElement(
1997
+ Media.Body,
1998
+ null,
1999
+ React__default.createElement(
2000
+ 'a',
2001
+ { href: article.url.current },
2002
+ article.title && React__default.createElement(
2003
+ 'h4',
2004
+ { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
2005
+ article.title
2006
+ )
2007
+ ),
2008
+ showPublished && article.published && React__default.createElement(
2009
+ 'p',
2010
+ { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
2011
+ moment(article.published).format('MMMM DD, YYYY')
2012
+ ),
2013
+ showTimeDiff && article.published && React__default.createElement(
2014
+ 'p',
2015
+ { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
2016
+ showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
2017
+ if (index > 3) {
2018
+ return null;
2019
+ }
2020
+ if (index === 3) {
509
2021
  return React__default.createElement(
510
2022
  React__default.Fragment,
511
2023
  null,
512
2024
  React__default.createElement(
513
2025
  'em',
514
- null,
515
- taxonomy.name
516
- ),
517
- ' |',
518
- ' '
2026
+ { style: { marginRight: '.5rem' } },
2027
+ '...'
2028
+ )
519
2029
  );
520
- }),
521
- ' ',
522
- React__default.createElement(
523
- 'span',
524
- { style: { display: 'inline-block' } },
525
- timeDifferenceCalc(article.published)
526
- )
527
- ),
528
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
529
- LazyLoad,
530
- { height: 50 },
531
- React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
532
- ),
533
- !article.thumbnail && !defaultImage && article.source && React__default.createElement(
534
- 'div',
535
- { className: 'content-category-label' },
536
- React__default.createElement(
537
- 'div',
538
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
539
- article.source
540
- )
541
- ),
2030
+ }
2031
+ return React__default.createElement(
2032
+ React__default.Fragment,
2033
+ null,
2034
+ React__default.createElement(
2035
+ 'em',
2036
+ null,
2037
+ taxonomy.name
2038
+ ),
2039
+ ' |',
2040
+ ' '
2041
+ );
2042
+ }),
2043
+ ' ',
2044
+ React__default.createElement(
2045
+ 'span',
2046
+ { style: { display: 'inline-block' } },
2047
+ timeDifferenceCalc(article.published)
2048
+ )
2049
+ ),
2050
+ showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
2051
+ LazyLoad,
2052
+ { height: 50 },
2053
+ React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
2054
+ ),
2055
+ !article.thumbnail && !defaultImage && article.source && React__default.createElement(
2056
+ 'div',
2057
+ { className: 'content-category-label' },
542
2058
  React__default.createElement(
543
2059
  'div',
544
- { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
545
- showCategory && article.contentCategory && React__default.createElement(
546
- 'p',
547
- {
548
- className: 'article-category',
549
- style: {
550
- background: '#3FB618',
551
- color: '#ffffff',
552
- marginBottom: '.25rem',
553
- display: 'inline-block',
554
- padding: '0 .25rem',
555
- fontSize: '.8rem'
556
- } },
557
- getContentCategory(article.contentCategory.name, contentCategoryMapping)
558
- ),
559
- article.issueSection && article.issueSection.name && React__default.createElement(
560
- 'p',
561
- {
562
- className: 'issueSection',
563
- style: {
564
- background: '#000000',
565
- color: '#ffffff',
566
- marginBottom: '.25rem',
567
- marginLeft: '.25rem',
568
- display: 'inline-block',
569
- padding: '0 .25rem',
570
- fontSize: '.8rem'
571
- } },
572
- article.issueSection.name
573
- )
2060
+ { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
2061
+ article.source
2062
+ )
2063
+ ),
2064
+ React__default.createElement(
2065
+ 'div',
2066
+ { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
2067
+ showCategory && article.contentCategory && React__default.createElement(
2068
+ 'p',
2069
+ {
2070
+ className: 'article-category',
2071
+ style: {
2072
+ background: '#3FB618',
2073
+ color: '#ffffff',
2074
+ marginBottom: '.25rem',
2075
+ display: 'inline-block',
2076
+ padding: '0 .25rem',
2077
+ fontSize: '.8rem'
2078
+ } },
2079
+ getContentCategory(article.contentCategory.name, contentCategoryMapping)
574
2080
  ),
575
- showPubInfo && (article.issue || article.volume) && React__default.createElement(
576
- 'div',
577
- { className: 'pubInfo' },
578
- article.volume && React__default.createElement(
579
- 'p',
580
- { className: 'qdeVolume' },
581
- article.volume
582
- ),
583
- article.issue && React__default.createElement(
584
- 'p',
585
- { className: 'qdeIssue' },
586
- article.issue
587
- )
2081
+ article.issueSection && article.issueSection.name && React__default.createElement(
2082
+ 'p',
2083
+ {
2084
+ className: 'issueSection',
2085
+ style: {
2086
+ background: '#000000',
2087
+ color: '#ffffff',
2088
+ marginBottom: '.25rem',
2089
+ marginLeft: '.25rem',
2090
+ display: 'inline-block',
2091
+ padding: '0 .25rem',
2092
+ fontSize: '.8rem'
2093
+ } },
2094
+ article.issueSection.name
2095
+ )
2096
+ ),
2097
+ showPubInfo && (article.issue || article.volume) && React__default.createElement(
2098
+ 'div',
2099
+ { className: 'pubInfo' },
2100
+ article.volume && React__default.createElement(
2101
+ 'p',
2102
+ { className: 'qdeVolume' },
2103
+ article.volume
588
2104
  ),
589
- showIntro && article.summary && React__default.createElement(
2105
+ article.issue && React__default.createElement(
590
2106
  'p',
591
- { className: 'pt-2 card-text' },
592
- clean_html_1(article.summary)
2107
+ { className: 'qdeIssue' },
2108
+ article.issue
593
2109
  )
2110
+ ),
2111
+ showIntro && article.summary && React__default.createElement(
2112
+ 'p',
2113
+ { className: 'pt-2 card-text' },
2114
+ clean_html_1(article.summary)
594
2115
  )
595
2116
  )
596
- )
597
- );
2117
+ );
2118
+ }
2119
+ } else if (article._type === 'lg-infeed' && article.adUnit) {
2120
+ return React__default.createElement(ADlgInfeed, _extends({ index: index }, article));
2121
+ } else if (article._type === 'brandInsightAd' && article.adUnit) {
2122
+ return React__default.createElement(ADInfeed, { index: index, infeedAd: article });
598
2123
  }
599
- } else if (article._type === 'lg-infeed' && article.adUnit) {
600
- return React__default.createElement(ADlgInfeed, _extends({ index: index }, article));
601
- } else if (article._type === 'brandInsightAd' && article.adUnit) {
602
- return React__default.createElement(ADInfeed, { index: index, infeedAd: article });
603
- }
604
- if ((brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) && (!article._type || !['lg-infeed', 'brandInsightAd'].includes(article._type))) {
605
- return React__default.createElement(
606
- VisibilitySensor,
607
- {
608
- key: article._id ? article._id : index,
609
- onChange: function onChange(isVisible) {
610
- // Passing 'articleCount' instead of index because index will be including the indexes of ads whereas articleCount will be having index of artilce only.
611
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, article.articleCount ? article.articleCount : index);
612
- } },
613
- React__default.createElement(
2124
+ if ((brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) && (!article._type || !['lg-infeed', 'brandInsightAd'].includes(article._type))) {
2125
+ return React__default.createElement(
614
2126
  React__default.Fragment,
615
- null,
2127
+ { key: article._id ? article._id : index },
616
2128
  React__default.createElement(
617
2129
  Media,
618
2130
  {
@@ -648,9 +2160,9 @@ var cardLoader = function cardLoader(data, client, mapping, values, seoPaginate,
648
2160
  article.title
649
2161
  )
650
2162
  ),
651
- showPublished && !showTimeDiff && article.published && React__default.createElement(
2163
+ showPublished && article.published && React__default.createElement(
652
2164
  'p',
653
- { className: 'card-text', style: { color: 'var(--dark)', margin: '.25rem 0' } },
2165
+ { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
654
2166
  moment(article.published).format('MMMM DD, YYYY')
655
2167
  ),
656
2168
  showTimeDiff && article.published && React__default.createElement(
@@ -765,514 +2277,7 @@ var cardLoader = function cardLoader(data, client, mapping, values, seoPaginate,
765
2277
  React__default.createElement(
766
2278
  'div',
767
2279
  null,
768
- main_43 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
769
- )
770
- )
771
- );
772
- } else return null;
773
- }) :
774
- // For Javascript Disabled Cases
775
- React__default.createElement(
776
- 'noscript',
777
- null,
778
- data.map(function (article, index) {
779
- var pageNumber = article.pageNumber || values.page;
780
- var contentCategoryName = article.contentCategory ? article.contentCategory.name : 'Articles';
781
-
782
- if (article._type === 'feature') {
783
- featureCount++;
784
- if (article.blank || checkExternalUrl(article.url.current)) {
785
- return React__default.createElement(
786
- VisibilitySensor,
787
- {
788
- key: article._id ? article._id : index,
789
- partialVisibility: true,
790
- onChange: function onChange(isVisible) {
791
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage);
792
- } },
793
- React__default.createElement(
794
- React__default.Fragment,
795
- null,
796
- React__default.createElement(
797
- Media,
798
- {
799
- key: article._id ? article._id : index,
800
- className: 'feature-media',
801
- style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
802
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
803
- 'a',
804
- { rel: 'noopener', href: article.url.current, target: '_blank', className: 'feature-wrapper' },
805
- React__default.createElement(
806
- LazyLoad,
807
- { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
808
- article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
809
- ),
810
- article.source && React__default.createElement(
811
- 'div',
812
- { className: 'content-category-label' },
813
- React__default.createElement(
814
- 'div',
815
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
816
- article.source
817
- )
818
- )
819
- ),
820
- React__default.createElement(
821
- Media.Body,
822
- null,
823
- React__default.createElement(
824
- 'a',
825
- { rel: 'noopener', href: article.url.current, target: '_blank' },
826
- article.title && React__default.createElement(
827
- 'h4',
828
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
829
- article.title
830
- )
831
- ),
832
- showPublished && article.published && React__default.createElement(
833
- 'p',
834
- { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
835
- moment(article.published).format('MMMM DD, YYYY')
836
- ),
837
- showTimeDiff && article.published && React__default.createElement(
838
- 'p',
839
- { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
840
- showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
841
- if (index > 3) {
842
- return null;
843
- }
844
- if (index === 3) {
845
- return React__default.createElement(
846
- React__default.Fragment,
847
- null,
848
- React__default.createElement(
849
- 'em',
850
- { style: { marginRight: '.5rem' } },
851
- '...'
852
- )
853
- );
854
- }
855
- return React__default.createElement(
856
- React__default.Fragment,
857
- null,
858
- React__default.createElement(
859
- 'em',
860
- null,
861
- taxonomy.name
862
- ),
863
- ' |',
864
- ' '
865
- );
866
- }),
867
- ' ',
868
- React__default.createElement(
869
- 'span',
870
- { style: { display: 'inline-block' } },
871
- timeDifferenceCalc(article.published)
872
- )
873
- ),
874
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
875
- LazyLoad,
876
- { height: 50 },
877
- React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
878
- ),
879
- !article.thumbnail && !defaultImage && article.source && React__default.createElement(
880
- 'div',
881
- { className: 'content-category-label' },
882
- React__default.createElement(
883
- 'div',
884
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
885
- article.source
886
- )
887
- ),
888
- React__default.createElement(
889
- 'div',
890
- { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
891
- showCategory && article.contentCategory && React__default.createElement(
892
- 'p',
893
- {
894
- className: 'article-category',
895
- style: {
896
- background: '#3FB618',
897
- color: '#ffffff',
898
- marginBottom: '.25rem',
899
- display: 'inline-block',
900
- padding: '0 .25rem',
901
- fontSize: '.8rem'
902
- } },
903
- getContentCategory(article.contentCategory.name, contentCategoryMapping)
904
- ),
905
- article.issueSection && article.issueSection.name && React__default.createElement(
906
- 'p',
907
- {
908
- className: 'issueSection',
909
- style: {
910
- background: '#000000',
911
- color: '#ffffff',
912
- marginBottom: '.25rem',
913
- marginLeft: '.25rem',
914
- display: 'inline-block',
915
- padding: '0 .25rem',
916
- fontSize: '.8rem'
917
- } },
918
- article.issueSection.name
919
- )
920
- ),
921
- showPubInfo && (article.issue || article.volume) && React__default.createElement(
922
- 'div',
923
- { className: 'pubInfo' },
924
- article.volume && React__default.createElement(
925
- 'p',
926
- { className: 'qdeVolume' },
927
- article.volume
928
- ),
929
- article.issue && React__default.createElement(
930
- 'p',
931
- { className: 'qdeIssue' },
932
- article.issue
933
- )
934
- ),
935
- showIntro && article.summary && React__default.createElement(
936
- 'p',
937
- { className: 'pt-2 card-text' },
938
- clean_html_1(article.summary)
939
- )
940
- )
941
- )
942
- )
943
- );
944
- } else {
945
- return React__default.createElement(
946
- VisibilitySensor,
947
- {
948
- key: article._id ? article._id : index,
949
- partialVisibility: true,
950
- onChange: function onChange(isVisible) {
951
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage);
952
- } },
953
- React__default.createElement(
954
- React__default.Fragment,
955
- null,
956
- React__default.createElement(
957
- Media,
958
- {
959
- key: article._id ? article._id : index,
960
- className: 'feature-media',
961
- style: { flexDirection: 'column', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
962
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
963
- 'a',
964
- { href: article.url.current, className: 'feature-wrapper' },
965
- React__default.createElement(
966
- LazyLoad,
967
- { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
968
- article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
969
- ),
970
- article.source && React__default.createElement(
971
- 'div',
972
- { className: 'content-category-label' },
973
- React__default.createElement(
974
- 'div',
975
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
976
- article.source
977
- )
978
- )
979
- ),
980
- React__default.createElement(
981
- Media.Body,
982
- null,
983
- React__default.createElement(
984
- 'a',
985
- { href: article.url.current },
986
- article.title && React__default.createElement(
987
- 'h4',
988
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
989
- article.title
990
- )
991
- ),
992
- showPublished && article.published && React__default.createElement(
993
- 'p',
994
- { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
995
- moment(article.published).format('MMMM DD, YYYY')
996
- ),
997
- showTimeDiff && article.published && React__default.createElement(
998
- 'p',
999
- { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
1000
- showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
1001
- if (index > 3) {
1002
- return null;
1003
- }
1004
- if (index === 3) {
1005
- return React__default.createElement(
1006
- React__default.Fragment,
1007
- null,
1008
- React__default.createElement(
1009
- 'em',
1010
- { style: { marginRight: '.5rem' } },
1011
- '...'
1012
- )
1013
- );
1014
- }
1015
- return React__default.createElement(
1016
- React__default.Fragment,
1017
- null,
1018
- React__default.createElement(
1019
- 'em',
1020
- null,
1021
- taxonomy.name
1022
- ),
1023
- ' |',
1024
- ' '
1025
- );
1026
- }),
1027
- ' ',
1028
- React__default.createElement(
1029
- 'span',
1030
- { style: { display: 'inline-block' } },
1031
- timeDifferenceCalc(article.published)
1032
- )
1033
- ),
1034
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
1035
- LazyLoad,
1036
- { height: 50 },
1037
- React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
1038
- ),
1039
- !article.thumbnail && !defaultImage && article.source && React__default.createElement(
1040
- 'div',
1041
- { className: 'content-category-label' },
1042
- React__default.createElement(
1043
- 'div',
1044
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1045
- article.source
1046
- )
1047
- ),
1048
- React__default.createElement(
1049
- 'div',
1050
- { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
1051
- showCategory && article.contentCategory && React__default.createElement(
1052
- 'p',
1053
- {
1054
- className: 'article-category',
1055
- style: {
1056
- background: '#3FB618',
1057
- color: '#ffffff',
1058
- marginBottom: '.25rem',
1059
- display: 'inline-block',
1060
- padding: '0 .25rem',
1061
- fontSize: '.8rem'
1062
- } },
1063
- getContentCategory(article.contentCategory.name, contentCategoryMapping)
1064
- ),
1065
- article.issueSection && article.issueSection.name && React__default.createElement(
1066
- 'p',
1067
- {
1068
- className: 'issueSection',
1069
- style: {
1070
- background: '#000000',
1071
- color: '#ffffff',
1072
- marginBottom: '.25rem',
1073
- marginLeft: '.25rem',
1074
- display: 'inline-block',
1075
- padding: '0 .25rem',
1076
- fontSize: '.8rem'
1077
- } },
1078
- article.issueSection.name
1079
- )
1080
- ),
1081
- showPubInfo && (article.issue || article.volume) && React__default.createElement(
1082
- 'div',
1083
- { className: 'pubInfo' },
1084
- article.volume && React__default.createElement(
1085
- 'p',
1086
- { className: 'qdeVolume' },
1087
- article.volume
1088
- ),
1089
- article.issue && React__default.createElement(
1090
- 'p',
1091
- { className: 'qdeIssue' },
1092
- article.issue
1093
- )
1094
- ),
1095
- showIntro && article.summary && React__default.createElement(
1096
- 'p',
1097
- { className: 'pt-2 card-text' },
1098
- clean_html_1(article.summary)
1099
- )
1100
- )
1101
- )
1102
- )
1103
- );
1104
- }
1105
- } else if (article._type === 'lg-infeed' && article.adUnit) {
1106
- return React__default.createElement(ADlgInfeed, _extends({ index: index }, article));
1107
- } else if (article._type === 'brandInsightAd' && article.adUnit) {
1108
- return React__default.createElement(ADInfeed, { index: index, infeedAd: article });
1109
- }
1110
- if ((brandInsightAd ? index > heroContent + featureCount : index + 1 > heroContent + featureCount) && (!article._type || !['lg-infeed', 'brandInsightAd'].includes(article._type))) {
1111
- return React__default.createElement(
1112
- VisibilitySensor,
1113
- {
1114
- key: article._id ? article._id : index,
1115
- onChange: function onChange(isVisible) {
1116
- // Passing 'articleCount' instead of index because index will be including the indexes of ads whereas articleCount will be having index of artilce only.
1117
- isVisible && changePageNumber(pageNumber, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, article.articleCount ? article.articleCount : index);
1118
- } },
1119
- React__default.createElement(
1120
- React__default.Fragment,
1121
- null,
1122
- React__default.createElement(
1123
- Media,
1124
- {
1125
- key: article._id ? article._id : index,
1126
- style: { flexDirection: 'row', marginBottom: '1.25rem', paddingBottom: '1.25rem', borderBottom: '1px solid #ddd' } },
1127
- (article.thumbnail && article.thumbnail.asset || defaultImage) && React__default.createElement(
1128
- 'a',
1129
- { href: mapping[contentCategoryName] + '/' + article.url.current, className: 'img-wrapper' },
1130
- React__default.createElement(
1131
- LazyLoad,
1132
- { height: imageHeight, placeholder: React__default.createElement(ImagePlaceholder, null) },
1133
- article.thumbnail && article.thumbnail.asset ? React__default.createElement('img', { className: 'mr-3 img-fluid', src: renderCardImage(article, client, imageHeight, imageWidth, imageMaxHeight, imageFit), alt: article.title }) : article.thumbnail ? React__default.createElement('img', { src: article.thumbnail, className: 'mr-3', alt: article.title }) : React__default.createElement('img', { src: defaultImage, src2: article.thumbnail, className: 'mr-3', width: '240', height: '135', alt: article.title })
1134
- ),
1135
- article.source && React__default.createElement(
1136
- 'div',
1137
- { className: 'content-category-label' },
1138
- React__default.createElement(
1139
- 'div',
1140
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1141
- article.source
1142
- )
1143
- )
1144
- ),
1145
- React__default.createElement(
1146
- Media.Body,
1147
- null,
1148
- React__default.createElement(
1149
- 'a',
1150
- { href: mapping[contentCategoryName] + '/' + article.url.current },
1151
- article.title && React__default.createElement(
1152
- 'h4',
1153
- { className: 'card-title', style: { fontWeight: '500', color: 'var(--gray-dark)', marginBottom: '.5rem' } },
1154
- article.title
1155
- )
1156
- ),
1157
- showPublished && article.published && React__default.createElement(
1158
- 'p',
1159
- { className: 'card-text', style: { color: 'var(--dark)', marginBottom: '.25rem' } },
1160
- moment(article.published).format('MMMM DD, YYYY')
1161
- ),
1162
- showTimeDiff && article.published && React__default.createElement(
1163
- 'p',
1164
- { className: 'card-text', style: { color: '#464644', lineHeight: '1.25', fontSize: '.875rem', margin: '.25rem 0' } },
1165
- showTaxonomies && article.taxonomyMapping && article.taxonomyMapping.map(function (taxonomy, index) {
1166
- if (index > 3) {
1167
- return null;
1168
- }
1169
- if (index === 3) {
1170
- return React__default.createElement(
1171
- React__default.Fragment,
1172
- null,
1173
- React__default.createElement(
1174
- 'em',
1175
- { style: { marginRight: '.5rem' } },
1176
- '...'
1177
- )
1178
- );
1179
- }
1180
- return React__default.createElement(
1181
- React__default.Fragment,
1182
- null,
1183
- React__default.createElement(
1184
- 'em',
1185
- null,
1186
- taxonomy.name
1187
- ),
1188
- ' |',
1189
- ' '
1190
- );
1191
- }),
1192
- ' ',
1193
- React__default.createElement(
1194
- 'span',
1195
- { style: { display: 'inline-block' } },
1196
- timeDifferenceCalc(article.published)
1197
- )
1198
- ),
1199
- React__default.createElement(
1200
- 'div',
1201
- { className: 'author-sec', style: { lineHeight: 1.5 } },
1202
- showAuthor && article.authorMapping && article.authorMapping.length > 0 && React__default.createElement(
1203
- LazyLoad,
1204
- { height: 50 },
1205
- React__default.createElement(AuthorComponent, { key: index.toString(), index: index, authors: article.authorMapping })
1206
- )
1207
- ),
1208
- !article.thumbnail && !defaultImage && article.source && React__default.createElement(
1209
- 'div',
1210
- { className: 'content-category-label' },
1211
- React__default.createElement(
1212
- 'div',
1213
- { className: 'mb-1 sanityDisplayLabel displayLabelThumb' },
1214
- article.source
1215
- )
1216
- ),
1217
- React__default.createElement(
1218
- 'div',
1219
- { style: { display: 'flex', alignItems: 'center', justifyContent: 'flex-start' } },
1220
- showCategory && article.contentCategory && React__default.createElement(
1221
- 'p',
1222
- {
1223
- className: 'article-category',
1224
- style: {
1225
- background: '#3FB618',
1226
- color: '#ffffff',
1227
- marginBottom: '.25rem',
1228
- display: 'inline-block',
1229
- padding: '0 .25rem',
1230
- fontSize: '.8rem'
1231
- } },
1232
- getContentCategory(article.contentCategory.name, contentCategoryMapping)
1233
- ),
1234
- article.issueSection && article.issueSection.name && React__default.createElement(
1235
- 'p',
1236
- {
1237
- className: 'issueSection',
1238
- style: {
1239
- background: '#000000',
1240
- color: '#ffffff',
1241
- marginBottom: '.25rem',
1242
- marginLeft: '.25rem',
1243
- display: 'inline-block',
1244
- padding: '0 .25rem',
1245
- fontSize: '.8rem'
1246
- } },
1247
- article.issueSection.name
1248
- )
1249
- ),
1250
- showPubInfo && (article.issue || article.volume) && React__default.createElement(
1251
- 'div',
1252
- { className: 'pubInfo' },
1253
- article.volume && React__default.createElement(
1254
- 'p',
1255
- { className: 'qdeVolume' },
1256
- article.volume
1257
- ),
1258
- article.issue && React__default.createElement(
1259
- 'p',
1260
- { className: 'qdeIssue' },
1261
- article.issue
1262
- )
1263
- ),
1264
- showIntro && article.summary && React__default.createElement(
1265
- 'p',
1266
- { className: 'pt-2 card-text' },
1267
- clean_html_1(article.summary)
1268
- )
1269
- )
1270
- ),
1271
- React__default.createElement(
1272
- 'div',
1273
- null,
1274
- main_43 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
1275
- )
2280
+ main_36 && rightItems && (index + 1) % numberOfItemsBeforeAd === 0 && renderMobileAd(index, numberOfItemsBeforeAd, rightItems)
1276
2281
  )
1277
2282
  );
1278
2283
  } else return null;
@@ -1328,6 +2333,46 @@ var usePrevious = function usePrevious(value) {
1328
2333
  return ref.current;
1329
2334
  };
1330
2335
 
2336
+ var Pagination = function Pagination(_ref2) {
2337
+ var totalPostsCount = _ref2.totalPostsCount,
2338
+ itemsPerPage = _ref2.itemsPerPage,
2339
+ currentPage = _ref2.currentPage,
2340
+ handlePageChange = _ref2.handlePageChange,
2341
+ dataLength = _ref2.dataLength;
2342
+
2343
+ var pageCount = Math.ceil(totalPostsCount / itemsPerPage);
2344
+ return React__default.createElement(
2345
+ 'div',
2346
+ null,
2347
+ React__default.createElement(ReactPaginate, {
2348
+ pageCount: pageCount,
2349
+ marginPagesDisplayed: 1,
2350
+ pageRangeDisplayed: main_36 ? 3 : 9,
2351
+ initialPage: currentPage - 1,
2352
+ disableInitialCallback: true,
2353
+ onPageChange: function onPageChange(_ref3) {
2354
+ var selected = _ref3.selected;
2355
+ return handlePageChange(selected + 1);
2356
+ },
2357
+ hrefBuilder: function hrefBuilder(page) {
2358
+ return page === 1 ? '/' : '?page=' + page;
2359
+ },
2360
+ previousLabel: '<',
2361
+ nextLabel: '>',
2362
+ containerClassName: 'pagination-container',
2363
+ previousLinkClassName: 'previous',
2364
+ nextLinkClassName: 'next',
2365
+ disabledClassName: 'disbaled',
2366
+ activeClassName: 'active'
2367
+ }),
2368
+ React__default.createElement(
2369
+ 'style',
2370
+ { jsx: 'true' },
2371
+ '\n .pagination-container {\n list-style: none;\n display: flex;\n justify-content: center;\n margin: 3rem 0 3rem 0;\n padding-left: 0;\n }\n .pagination-container a {\n padding: 10px;\n border: 1px solid #dee2e6;\n }\n .pagination-container a:hover {\n text-decoration: none;\n background-color: #e9ecef;\n border-color: #dee2e6;\n }\n .pagination-container .active a {\n color: #fff;\n background-color: var(--primary);\n border-color: #007bff;\n }\n .pagination-container .previous a {\n border-radius: 5px 0 0 5px;\n }\n .pagination-container .next a {\n border-radius: 0 5px 5px 0;\n }\n @media only screen and (max-width: 768px) {\n .pagination-container {\n margin-bottom: 6rem;\n }\n }\n '
2372
+ )
2373
+ );
2374
+ };
2375
+
1331
2376
  var QueueDeckExpanded = function QueueDeckExpanded(props) {
1332
2377
  var router = useRouter();
1333
2378
 
@@ -1343,15 +2388,12 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
1343
2388
  }, [router]);
1344
2389
 
1345
2390
  var initialData = props.dataRecord,
2391
+ initialCurrentPage = props.currentPage,
1346
2392
  client = props.client,
1347
2393
  params = props.params,
1348
2394
  query = props.query,
1349
- autoScroll = props.autoScroll,
1350
- pointer = props.pointer,
1351
- pointerArray = props.pointerArray,
1352
2395
  mapping = props.mapping,
1353
2396
  seoPaginate = props.seoPaginate,
1354
- pageview = props.pageview,
1355
2397
  defaultImage = props.defaultImage,
1356
2398
  showAuthor = props.showAuthor,
1357
2399
  showCategory = props.showCategory,
@@ -1376,160 +2418,123 @@ var QueueDeckExpanded = function QueueDeckExpanded(props) {
1376
2418
  _props$showIntro = props.showIntro,
1377
2419
  showIntro = _props$showIntro === undefined ? true : _props$showIntro,
1378
2420
  _props$contentCategor = props.contentCategoryMapping,
1379
- contentCategoryMapping = _props$contentCategor === undefined ? [] : _props$contentCategor;
1380
- var initialCurrentPage = props.currentPage,
2421
+ contentCategoryMapping = _props$contentCategor === undefined ? [] : _props$contentCategor,
1381
2422
  showPublished = props.showPublished;
1382
2423
 
1383
- var _useState3 = useState(initialData),
2424
+ var _useState3 = useState(initialCurrentPage || 1),
1384
2425
  _useState4 = _slicedToArray(_useState3, 2),
1385
- data = _useState4[0],
1386
- setData = _useState4[1];
1387
-
1388
- var _useState5 = useState(true),
1389
- _useState6 = _slicedToArray(_useState5, 2),
1390
- scrolling = _useState6[0],
1391
- setScrolling = _useState6[1];
1392
-
1393
- var _useState7 = useState(initialCurrentPage || 1),
1394
- _useState8 = _slicedToArray(_useState7, 2),
1395
- currentPage = _useState8[0],
1396
- setCurrentPage = _useState8[1];
1397
-
1398
- var _useState9 = useState(initialData ? initialData.length : 0),
1399
- _useState10 = _slicedToArray(_useState9, 2),
1400
- lastDataSize = _useState10[0],
1401
- setLastDataSize = _useState10[1];
1402
-
1403
- var _useState11 = useState({
1404
- from: params ? params.from : 0,
1405
- to: params ? params.to : 0,
1406
- page: initialCurrentPage ? initialCurrentPage : 1
1407
- }),
1408
- _useState12 = _slicedToArray(_useState11, 2),
1409
- values = _useState12[0],
1410
- setValues = _useState12[1];
1411
-
1412
- var itemsPerPage = params && params.itemsPerPage ? params.itemsPerPage : 10;
1413
-
1414
- var prevValues = usePrevious(values);
1415
-
1416
- var renderManualPagination = function renderManualPagination(currentPage) {
1417
- if (lastDataSize < itemsPerPage) {
1418
- return null;
1419
- }
2426
+ currentPage = _useState4[0],
2427
+ setCurrentPage = _useState4[1];
1420
2428
 
1421
- return React__default.createElement(
1422
- 'div',
1423
- { className: 'd-flex justify-content-between' },
1424
- currentPage && currentPage > 1 && React__default.createElement(
1425
- 'a',
1426
- { href: '?page=' + (currentPage - 1) },
1427
- '<< Previous'
1428
- ),
1429
- React__default.createElement(
1430
- 'a',
1431
- { href: '?page=' + (currentPage + 1) },
1432
- 'Next >>'
1433
- )
1434
- );
1435
- };
2429
+ var itemsPerPage = params && params.itemsPerPage ? params.itemsPerPage : params && params.from && params.to ? params.to - params.from : 10;
1436
2430
 
1437
- // check for change in filter parameters from client side and refresh the page
1438
- useEffect(function () {
1439
- if (initialData && data !== initialData && initialData.length >= 0) {
1440
- setData(initialData);
1441
- setCurrentPage(initialCurrentPage ? initialCurrentPage : 1);
1442
- setValues({
1443
- from: params ? params.from : 0,
1444
- to: params ? params.to : 0,
1445
- page: initialCurrentPage ? initialCurrentPage : 1
1446
- });
1447
- if (initialData.length > 0) {
1448
- setScrolling(true);
1449
- }
1450
- }
1451
- }, [initialData]);
2431
+ var fetcher = function () {
2432
+ var _ref4 = _asyncToGenerator( /*#__PURE__*/regenerator.mark(function _callee(currentPage) {
2433
+ var start, params;
2434
+ return regenerator.wrap(function _callee$(_context) {
2435
+ while (1) {
2436
+ switch (_context.prev = _context.next) {
2437
+ case 0:
2438
+ start = (currentPage - 1) * itemsPerPage;
2439
+ params = _extends({}, params, {
2440
+ from: start,
2441
+ to: start + itemsPerPage
2442
+ });
2443
+ _context.next = 4;
2444
+ return client.fetch(query, params);
1452
2445
 
1453
- useEffect(function () {
1454
- if (prevValues) {
1455
- if (values.page !== prevValues.page && values.from !== prevValues.from && values.to !== prevValues.to) {
1456
- loadData(values, query, client, params, setData, setScrolling, setLastDataSize, pointer, pointerArray);
1457
- }
1458
- }
1459
- }, [values, prevValues, query, client, params, setData, setScrolling, setLastDataSize, pointer, pointerArray]);
2446
+ case 4:
2447
+ return _context.abrupt('return', _context.sent);
1460
2448
 
1461
- // useEffect(() => {
1462
- // document.addEventListener('scroll', trackScrolling)
1463
- // return () => {
1464
- // document.removeEventListener('scroll', trackScrolling)
1465
- // }
1466
- // }, [currentPage])
2449
+ case 5:
2450
+ case 'end':
2451
+ return _context.stop();
2452
+ }
2453
+ }
2454
+ }, _callee, _this);
2455
+ }));
1467
2456
 
1468
- // const trackScrolling = (current) => {
1469
- // if (window.pageYOffset === 0) {
1470
- // if (currentPage > 1) {
1471
- // changePageNumber(1, seoPaginate, pageview, router, currentPage, setCurrentPage, itemsPerPage, 1)
1472
- // }
1473
- // }
1474
- // }
2457
+ return function fetcher(_x5) {
2458
+ return _ref4.apply(this, arguments);
2459
+ };
2460
+ }();
2461
+
2462
+ var onLoadDataSuccess = function onLoadDataSuccess() {
2463
+ document.body.scrollTop = 0;
2464
+ document.documentElement.scrollTop = 0;
2465
+ seoPaginate && seoPagination(currentPage);
2466
+ lib_3.refresh();
2467
+ };
2468
+
2469
+ var _useSWR = useSWR([currentPage], fetcher, { initialData: initialData, onSuccess: onLoadDataSuccess }),
2470
+ data = _useSWR.data;
2471
+
2472
+ var handlePageChange = function handlePageChange(selectedPage) {
2473
+ setCurrentPage(selectedPage);
2474
+ };
2475
+
2476
+ var seoPagination = function seoPagination(pageNumber) {
2477
+ var path = router.asPath;
2478
+ var qrIndex = path.indexOf('?');
2479
+ var pathname = router.pathname;
2480
+ var queryString = '';
2481
+ if (qrIndex > 0) {
2482
+ path = path.substring(1, qrIndex);
2483
+ var partialQS = router.asPath.substring(qrIndex + 1);
2484
+ var partialQSArr = partialQS.split('&');
2485
+ // exclude page=xxx from query string
2486
+ partialQSArr.map(function (item) {
2487
+ var itemArr = item.split('=');
2488
+ var key = itemArr[0];
2489
+ var val = itemArr[1];
2490
+ if (key !== 'page') queryString += (queryString.length === 0 ? '' : '&') + key + '=' + val;
2491
+ });
2492
+ }
2493
+ if (queryString.length > 0) path += '?' + queryString;
2494
+ pageNumber = parseInt(pageNumber);
2495
+ if (path[0] !== '/') path = '/' + path;
2496
+ var newPath = pageNumber === 1 ? '' + path : '' + path + (queryString.length > 0 ? '&' : '?') + 'page=' + pageNumber;
2497
+ router.push(pathname, newPath, {
2498
+ shallow: true
2499
+ });
2500
+ };
1475
2501
 
1476
2502
  return React__default.createElement(
1477
2503
  'div',
1478
2504
  null,
1479
- autoScroll ? React__default.createElement(
1480
- React__default.Fragment,
1481
- null,
1482
- React__default.createElement(
1483
- InfiniteScroll,
1484
- { dataLength: data && data.length, next: function next() {
1485
- return loadMore(values, setValues, itemsPerPage);
1486
- }, hasMore: scrolling, scrollThreshold: 0.9 },
1487
- React__default.createElement(
1488
- Container,
1489
- null,
1490
- cardLoader(data, client, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, imageMaxHeight, imageFit, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent, lgInfeedAd, showPubInfo, contentCategoryMapping, showTimeDiff, showTaxonomies, showIntro)
1491
- )
1492
- ),
1493
- React__default.createElement(
1494
- 'noscript',
1495
- null,
1496
- renderManualPagination(currentPage)
1497
- )
1498
- ) : React__default.createElement(
1499
- React__default.Fragment,
2505
+ React__default.createElement(
2506
+ Container,
1500
2507
  null,
1501
- React__default.createElement(
1502
- Container,
1503
- null,
1504
- cardLoader(data, client, mapping, values, seoPaginate, pageview, router, currentPage, setCurrentPage, showPublished, defaultImage, showAuthor, showCategory, imageHeight, imageWidth, imageMaxHeight, imageFit, rightItems, brandInsightAd, showBI, itemsPerPage, heroContent, lgInfeedAd, showPubInfo, contentCategoryMapping, showTimeDiff, showTaxonomies, showIntro)
1505
- ),
1506
- React__default.createElement(
1507
- 'div',
1508
- { style: { padding: '0px 10px' } },
1509
- scrolling ? React__default.createElement(
1510
- 'button',
1511
- {
1512
- className: 'load-more-btn',
1513
- style: { margin: 'auto', width: '100%' },
1514
- onClick: function onClick(e) {
1515
- loadMore(values, setValues, itemsPerPage);
1516
- } },
1517
- 'Load More'
1518
- ) : React__default.createElement(
1519
- 'p',
1520
- { style: { textAlign: 'center' } },
1521
- React__default.createElement(
1522
- 'b',
1523
- null,
1524
- 'End of data'
1525
- )
1526
- )
1527
- ),
1528
- React__default.createElement(
1529
- 'noscript',
1530
- null,
1531
- renderManualPagination(currentPage)
1532
- )
2508
+ React__default.createElement(CardLoader, {
2509
+ data: data,
2510
+ client: client,
2511
+ mapping: mapping,
2512
+ showPublished: showPublished,
2513
+ defaultImage: defaultImage,
2514
+ showAuthor: showAuthor,
2515
+ showCategory: showCategory,
2516
+ imageHeight: imageHeight,
2517
+ imageWidth: imageWidth,
2518
+ imageMaxHeight: imageMaxHeight,
2519
+ imageFit: imageFit,
2520
+ rightItems: rightItems,
2521
+ brandInsightAd: brandInsightAd,
2522
+ showBI: showBI,
2523
+ heroContent: heroContent,
2524
+ lgInfeedAd: lgInfeedAd,
2525
+ showPubInfo: showPubInfo,
2526
+ contentCategoryMapping: contentCategoryMapping,
2527
+ showTimeDif: showTimeDiff,
2528
+ showTaxonomies: showTaxonomies,
2529
+ showIntro: showIntro
2530
+ }),
2531
+ React__default.createElement(Pagination, {
2532
+ totalPostsCount: props.totalPostsCount,
2533
+ itemsPerPage: props.params.itemsPerPage,
2534
+ currentPage: props.currentPage,
2535
+ handlePageChange: handlePageChange,
2536
+ dataLength: data.length
2537
+ })
1533
2538
  )
1534
2539
  );
1535
2540
  };