@mjhls/mjh-framework 1.0.859-beta.4 → 1.0.859-d4d-374

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 (254) hide show
  1. package/README.md +168 -168
  2. package/dist/cjs/AD.js +10 -9
  3. package/dist/cjs/AD300x250.js +10 -9
  4. package/dist/cjs/AD300x250x600.js +10 -9
  5. package/dist/cjs/AD728x90.js +11 -10
  6. package/dist/cjs/ADFloatingFooter.js +12 -11
  7. package/dist/cjs/ADFooter.js +9 -8
  8. package/dist/cjs/ADGutter.js +12 -11
  9. package/dist/cjs/{ADInfeed-98c71bcd.js → ADInfeed-799275aa.js} +11 -9
  10. package/dist/cjs/ADSkyscraper.js +12 -11
  11. package/dist/cjs/ADSponsoredResources.js +12 -11
  12. package/dist/cjs/ADWebcast.js +12 -11
  13. package/dist/cjs/ADWelcome.js +16 -15
  14. package/dist/cjs/{ADlgInfeed-9de32585.js → ADlgInfeed-591d014e.js} +7 -6
  15. package/dist/cjs/AccordionPanel.js +24 -22
  16. package/dist/cjs/AdSlot.js +14 -13
  17. package/dist/cjs/AdSlotsProvider.js +11 -902
  18. package/dist/cjs/AlgoliaSearch.js +971 -843
  19. package/dist/cjs/AlphabeticList.js +16 -15
  20. package/dist/cjs/ArticleCarousel.js +11 -10
  21. package/dist/cjs/ArticleProgramLandingPage.js +28 -27
  22. package/dist/cjs/ArticleSeriesLandingPage.js +23 -22
  23. package/dist/cjs/ArticleSeriesListing.js +40 -39
  24. package/dist/cjs/Auth.js +197 -1192
  25. package/dist/cjs/AuthWrapper.js +301 -259
  26. package/dist/cjs/{AuthorComponent-bb831b74.js → AuthorComponent-ac8972ce.js} +13 -12
  27. package/dist/cjs/{BlockContent-091a991f.js → BlockContent-8b494587.js} +25 -24
  28. package/dist/cjs/Breadcrumbs.js +23 -21
  29. package/dist/cjs/CMEDeck.js +64 -64
  30. package/dist/cjs/Column1.js +14 -11
  31. package/dist/cjs/Column2.js +22 -19
  32. package/dist/cjs/Column3.js +35 -32
  33. package/dist/cjs/ConferenceArticleCard.js +33 -32
  34. package/dist/cjs/ConferenceBanner-6c9e718a.js +24 -0
  35. package/dist/cjs/DeckContent.js +84 -80
  36. package/dist/cjs/DeckQueue.js +72 -68
  37. package/dist/cjs/{Dfp-26baccf1.js → Dfp-391fd124.js} +23 -22
  38. package/dist/cjs/EventsDeck.js +140 -133
  39. package/dist/cjs/ExternalResources.js +47 -46
  40. package/dist/cjs/Feature.js +25 -23
  41. package/dist/cjs/ForbesHero.js +35 -34
  42. package/dist/cjs/GridContent.js +208 -203
  43. package/dist/cjs/GridHero.js +36 -35
  44. package/dist/cjs/GroupDeck.js +49 -48
  45. package/dist/cjs/HamMagazine.js +130 -125
  46. package/dist/cjs/Header.js +14 -12
  47. package/dist/cjs/Hero.js +10 -9
  48. package/dist/cjs/HighlightenVideo.js +17 -16
  49. package/dist/cjs/HorizontalArticleListing.js +37 -36
  50. package/dist/cjs/HorizontalHero.js +24 -23
  51. package/dist/cjs/IssueContentDeck.js +70 -65
  52. package/dist/cjs/IssueDeck.js +65 -60
  53. package/dist/cjs/IssueLanding.js +58 -57
  54. package/dist/cjs/KMTracker.js +15 -15
  55. package/dist/cjs/LeftNav.js +22 -20
  56. package/dist/cjs/MasterDeck.js +58 -57
  57. package/dist/cjs/MediaSeriesLanding.js +843 -852
  58. package/dist/cjs/NavDvm.js +68 -63
  59. package/dist/cjs/{NavFooter-76c913e3.js → NavFooter-3dcd99a8.js} +15 -14
  60. package/dist/cjs/NavMagazine.js +131 -126
  61. package/dist/cjs/NavNative.js +125 -117
  62. package/dist/cjs/OncliveHero.js +17 -17
  63. package/dist/cjs/OncliveLargeHero.js +64 -63
  64. package/dist/cjs/PageFilter.js +9 -8
  65. package/dist/cjs/PartnerDetailListing.js +131 -3950
  66. package/dist/cjs/PdfDownload.js +9 -8
  67. package/dist/cjs/PopUpModal.js +15 -13
  68. package/dist/cjs/PubSection.js +20 -19
  69. package/dist/cjs/PubToc.js +8 -7
  70. package/dist/cjs/PublicationDeck.js +64 -59
  71. package/dist/cjs/PublicationLanding.js +113 -109
  72. package/dist/cjs/QueueDeckExpanded.js +285 -285
  73. package/dist/cjs/RecentNews.js +20 -19
  74. package/dist/cjs/RelatedContent.js +51 -50
  75. package/dist/cjs/RelatedTopicsDropdown.js +32 -29
  76. package/dist/cjs/RolesDeck.js +32 -27
  77. package/dist/cjs/Search.js +16 -12
  78. package/dist/cjs/SeriesListingDeck.js +26 -26
  79. package/dist/cjs/{SeriesSlider-8bbc989f.js → SeriesSlider-d38767ae.js} +38 -37
  80. package/dist/cjs/SideFooter.js +26 -25
  81. package/dist/cjs/SocialIcons.js +10 -9
  82. package/dist/cjs/{SocialSearchComponent-cea213aa.js → SocialSearchComponent-9a9d6f8c.js} +38 -34
  83. package/dist/cjs/SocialShare.js +31 -29
  84. package/dist/cjs/TaxonomyCard.js +59 -54
  85. package/dist/cjs/TaxonomyDescription.js +22 -21
  86. package/dist/cjs/TemplateNormal.js +35 -34
  87. package/dist/cjs/ThumbnailCard.js +19 -17
  88. package/dist/cjs/Ustream.js +22 -21
  89. package/dist/cjs/VerticalHero.js +16 -15
  90. package/dist/cjs/VideoProgramLandingPage.js +47 -43
  91. package/dist/cjs/VideoSeriesCard.js +24 -23
  92. package/dist/cjs/VideoSeriesFilter.js +9 -9
  93. package/dist/cjs/VideoSeriesLandingPage.js +28 -27
  94. package/dist/cjs/VideoSeriesListing.js +57 -56
  95. package/dist/cjs/View.js +205 -201
  96. package/dist/cjs/YahooHero.js +31 -30
  97. package/dist/cjs/YoutubeGroup.js +55 -54
  98. package/dist/cjs/{brightcove-react-player-loader.es-156bd4d6.js → brightcove-react-player-loader.es-4ba0d3d5.js} +6 -5
  99. package/dist/cjs/faundadb.js +16 -16
  100. package/dist/cjs/getRelatedArticle.js +6 -6
  101. package/dist/cjs/getRootDocGroup.js +3 -3
  102. package/dist/cjs/getSerializers.js +11 -11
  103. package/dist/cjs/{getTargeting-f1821260.js → getTargeting-21103688.js} +11 -11
  104. package/dist/cjs/getTargeting.js +1 -1
  105. package/dist/cjs/iconBase-68959171.js +0 -3
  106. package/dist/cjs/{index-d79b659e.js → index-07e2d5de.js} +960 -934
  107. package/dist/cjs/{index-98e01cb9.js → index-2cf30c83.js} +9 -8
  108. package/dist/cjs/{index-3294d3bc.js → index-5be2866f.js} +1 -1
  109. package/dist/cjs/{index-96b3db50.js → index-9d365128.js} +12 -10
  110. package/dist/cjs/{index-be0c82be.js → index-b5eb3ff8.js} +20 -19
  111. package/dist/cjs/{index-e2e62963.js → index-f0677b9d.js} +10 -0
  112. package/dist/cjs/{index.es-9110add6.js → index.es-13533f24.js} +11 -8
  113. package/dist/cjs/{index.esm-ff47db6f.js → index.esm-05850a2f.js} +5 -12
  114. package/dist/cjs/{index.esm-4d410430.js → index.esm-3ffa049c.js} +20 -20
  115. package/dist/cjs/{index.esm-e32d3e8e.js → index.esm-44f3e2d0.js} +3 -6
  116. package/dist/cjs/{index.esm-90433435.js → index.esm-974f47d9.js} +6 -15
  117. package/dist/cjs/index.js +64 -59
  118. package/dist/cjs/{inherits-1f5a1c72.js → inherits-0c7830c5.js} +3 -3
  119. package/dist/cjs/{lodash-fc2922d0.js → lodash-7fd85bcf.js} +71 -22
  120. package/dist/cjs/{main-02daeefe.js → main-11ec04d2.js} +85 -53
  121. package/dist/cjs/{md5-5039b1a6.js → md5-e1ca5797.js} +1 -1
  122. package/dist/cjs/{moment-575fe24c.js → moment-66a6a284.js} +1 -1
  123. package/dist/cjs/{react-social-icons-f7f48f71.js → react-social-icons-07939b41.js} +12 -11
  124. package/dist/cjs/timeDifferenceCalc.js +1 -1
  125. package/dist/cjs/{typeof-725500bc.js → typeof-9d7f610f.js} +1 -1
  126. package/dist/cjs/urlFor.js +3 -3
  127. package/dist/cjs/{visibility-sensor-ad5e3116.js → visibility-sensor-eb2c5b69.js} +7 -5
  128. package/dist/esm/AD.js +7 -7
  129. package/dist/esm/AD300x250.js +7 -7
  130. package/dist/esm/AD300x250x600.js +7 -7
  131. package/dist/esm/AD728x90.js +8 -8
  132. package/dist/esm/ADFloatingFooter.js +9 -9
  133. package/dist/esm/ADFooter.js +6 -6
  134. package/dist/esm/ADGutter.js +9 -9
  135. package/dist/esm/{ADInfeed-1cc9d817.js → ADInfeed-4b8902ae.js} +7 -7
  136. package/dist/esm/ADSkyscraper.js +9 -9
  137. package/dist/esm/ADSponsoredResources.js +9 -9
  138. package/dist/esm/ADWebcast.js +9 -9
  139. package/dist/esm/ADWelcome.js +13 -13
  140. package/dist/esm/{ADlgInfeed-8c4f129e.js → ADlgInfeed-5193b48f.js} +4 -4
  141. package/dist/esm/AccordionPanel.js +17 -17
  142. package/dist/esm/AdSlot.js +5 -5
  143. package/dist/esm/AdSlotsProvider.js +10 -902
  144. package/dist/esm/AlgoliaSearch.js +369 -242
  145. package/dist/esm/AlphabeticList.js +13 -13
  146. package/dist/esm/ArticleCarousel.js +8 -8
  147. package/dist/esm/ArticleProgramLandingPage.js +20 -20
  148. package/dist/esm/ArticleSeriesLandingPage.js +17 -17
  149. package/dist/esm/ArticleSeriesListing.js +36 -36
  150. package/dist/esm/Auth.js +175 -1174
  151. package/dist/esm/AuthWrapper.js +298 -257
  152. package/dist/esm/{AuthorComponent-34b16174.js → AuthorComponent-8ffd4679.js} +10 -10
  153. package/dist/esm/{BlockContent-e9b4ddcf.js → BlockContent-d05b5b23.js} +4 -4
  154. package/dist/esm/Breadcrumbs.js +11 -11
  155. package/dist/esm/CMEDeck.js +61 -61
  156. package/dist/esm/Column1.js +9 -9
  157. package/dist/esm/Column2.js +17 -17
  158. package/dist/esm/Column3.js +30 -30
  159. package/dist/esm/ConferenceArticleCard.js +30 -30
  160. package/dist/esm/{ConferenceBanner-8792ebd2.js → ConferenceBanner-9162d0ca.js} +4 -4
  161. package/dist/esm/DeckContent.js +76 -76
  162. package/dist/esm/DeckQueue.js +64 -64
  163. package/dist/esm/{Dfp-b7236041.js → Dfp-2f9796e1.js} +10 -10
  164. package/dist/esm/EventsDeck.js +109 -109
  165. package/dist/esm/ExternalResources.js +41 -41
  166. package/dist/esm/Feature.js +17 -17
  167. package/dist/esm/ForbesHero.js +28 -28
  168. package/dist/esm/GridContent.js +172 -172
  169. package/dist/esm/GridHero.js +29 -29
  170. package/dist/esm/GroupDeck.js +36 -36
  171. package/dist/esm/HamMagazine.js +100 -100
  172. package/dist/esm/Header.js +8 -8
  173. package/dist/esm/Hero.js +7 -7
  174. package/dist/esm/HighlightenVideo.js +14 -14
  175. package/dist/esm/HorizontalArticleListing.js +34 -34
  176. package/dist/esm/HorizontalHero.js +21 -21
  177. package/dist/esm/IssueContentDeck.js +53 -53
  178. package/dist/esm/IssueDeck.js +54 -54
  179. package/dist/esm/IssueLanding.js +55 -55
  180. package/dist/esm/KMTracker.js +15 -15
  181. package/dist/esm/LeftNav.js +16 -16
  182. package/dist/esm/MasterDeck.js +54 -54
  183. package/dist/esm/MediaSeriesLanding.js +560 -572
  184. package/dist/esm/NavDvm.js +46 -46
  185. package/dist/esm/{NavFooter-e27bd93b.js → NavFooter-c29526b7.js} +12 -12
  186. package/dist/esm/NavMagazine.js +103 -103
  187. package/dist/esm/NavNative.js +92 -92
  188. package/dist/esm/OncliveHero.js +14 -15
  189. package/dist/esm/OncliveLargeHero.js +52 -52
  190. package/dist/esm/PageFilter.js +6 -6
  191. package/dist/esm/PartnerDetailListing.js +76 -3895
  192. package/dist/esm/PdfDownload.js +6 -6
  193. package/dist/esm/PopUpModal.js +8 -8
  194. package/dist/esm/PubSection.js +17 -17
  195. package/dist/esm/PubToc.js +5 -5
  196. package/dist/esm/PublicationDeck.js +51 -51
  197. package/dist/esm/PublicationLanding.js +95 -95
  198. package/dist/esm/QueueDeckExpanded.js +251 -251
  199. package/dist/esm/RecentNews.js +17 -17
  200. package/dist/esm/RelatedContent.js +45 -45
  201. package/dist/esm/RelatedTopicsDropdown.js +21 -21
  202. package/dist/esm/RolesDeck.js +25 -25
  203. package/dist/esm/Search.js +7 -7
  204. package/dist/esm/SeriesListingDeck.js +20 -20
  205. package/dist/esm/{SeriesSlider-a866bb21.js → SeriesSlider-b8cc1baa.js} +28 -28
  206. package/dist/esm/SideFooter.js +21 -21
  207. package/dist/esm/SocialIcons.js +7 -7
  208. package/dist/esm/{SocialSearchComponent-03c3e869.js → SocialSearchComponent-c54d43cb.js} +28 -28
  209. package/dist/esm/SocialShare.js +25 -25
  210. package/dist/esm/TaxonomyCard.js +50 -50
  211. package/dist/esm/TaxonomyDescription.js +16 -16
  212. package/dist/esm/TemplateNormal.js +31 -31
  213. package/dist/esm/ThumbnailCard.js +10 -10
  214. package/dist/esm/Ustream.js +18 -18
  215. package/dist/esm/VerticalHero.js +13 -13
  216. package/dist/esm/VideoProgramLandingPage.js +32 -32
  217. package/dist/esm/VideoSeriesCard.js +18 -18
  218. package/dist/esm/VideoSeriesFilter.js +6 -6
  219. package/dist/esm/VideoSeriesLandingPage.js +17 -17
  220. package/dist/esm/VideoSeriesListing.js +53 -53
  221. package/dist/esm/View.js +183 -183
  222. package/dist/esm/YahooHero.js +25 -25
  223. package/dist/esm/YoutubeGroup.js +39 -39
  224. package/dist/esm/{brightcove-react-player-loader.es-83f53e4e.js → brightcove-react-player-loader.es-e1c6b0f2.js} +3 -3
  225. package/dist/esm/faundadb.js +1 -1
  226. package/dist/esm/getSerializers.js +11 -11
  227. package/dist/esm/{getTargeting-bd800589.js → getTargeting-88d69971.js} +9 -9
  228. package/dist/esm/getTargeting.js +1 -1
  229. package/dist/esm/{index-2fccaa7f.js → index-207958e3.js} +903 -887
  230. package/dist/esm/{index-73819142.js → index-51a80699.js} +20 -19
  231. package/dist/esm/{index-5f7e79e7.js → index-6c12bdd5.js} +4 -4
  232. package/dist/esm/{index-aaa2dae0.js → index-b68072f5.js} +10 -1
  233. package/dist/esm/{index-ef6d5dcf.js → index-d2f90501.js} +1 -1
  234. package/dist/esm/{index-41a678ea.js → index-f7fb1e25.js} +3 -3
  235. package/dist/esm/{index.es-29c1cef5.js → index.es-7dda2f0a.js} +8 -6
  236. package/dist/esm/{index.esm-29e48d38.js → index.esm-3fdda599.js} +6 -15
  237. package/dist/esm/{index.esm-fd746768.js → index.esm-8ee5ff72.js} +17 -18
  238. package/dist/esm/{index.esm-cf08bf18.js → index.esm-a8ff922c.js} +5 -12
  239. package/dist/esm/{index.esm-f8aaeeeb.js → index.esm-c6715e80.js} +3 -6
  240. package/dist/esm/index.js +53 -51
  241. package/dist/esm/{inherits-cf8dde54.js → inherits-75d45541.js} +1 -1
  242. package/dist/esm/{lodash-17fdfebb.js → lodash-ec8c6b48.js} +71 -22
  243. package/dist/esm/{main-e4a934b2.js → main-aef58dbc.js} +81 -50
  244. package/dist/esm/{md5-9be0e905.js → md5-4e42248e.js} +1 -1
  245. package/dist/esm/{moment-e2f9b20c.js → moment-12415288.js} +1 -1
  246. package/dist/esm/{react-social-icons-a7d5c5c7.js → react-social-icons-3822f1ce.js} +5 -5
  247. package/dist/esm/timeDifferenceCalc.js +1 -1
  248. package/dist/esm/{typeof-6435ba1c.js → typeof-af9c50d8.js} +1 -1
  249. package/dist/esm/urlFor.js +1 -1
  250. package/dist/esm/{visibility-sensor-72fd8f8b.js → visibility-sensor-f40c2564.js} +2 -2
  251. package/package.json +110 -111
  252. package/dist/cjs/ConferenceBanner-4a16fddc.js +0 -23
  253. package/dist/cjs/inherits-8d29278d.js +0 -110
  254. package/dist/esm/inherits-77d5e4fc.js +0 -101
package/dist/esm/Auth.js CHANGED
@@ -7,7 +7,7 @@ import './core.get-iterator-method-e1de7503.js';
7
7
  import './_object-pie-33c40e79.js';
8
8
  import { _ as _extends } from './extends-6f2fcc99.js';
9
9
  import './web.dom.iterable-4439f05a.js';
10
- import React__default, { useEffect, useLayoutEffect, createContext, useContext, useRef, useDebugValue, useState, useCallback, useMemo } from 'react';
10
+ import React, { useEffect, useState } from 'react';
11
11
  import Router from 'next/router';
12
12
  import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-641f241f.js';
13
13
  import { _ as _JSON$stringify } from './stringify-4330ccdc.js';
@@ -15,9 +15,10 @@ import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-fc1
15
15
  import { Col, Form, Button, Spinner } from 'react-bootstrap';
16
16
  import { u as util } from './util-7700fc59.js';
17
17
  import { s as serialize_1, p as parse_1 } from './index-db3bb315.js';
18
+ import useSWR from 'swr';
18
19
  import Local from 'passport-local';
19
20
  import mysql from 'mysql';
20
- import { m as md5 } from './md5-9be0e905.js';
21
+ import { m as md5 } from './md5-4e42248e.js';
21
22
 
22
23
  var returnFormField = function returnFormField(_ref) {
23
24
  var name = _ref.name,
@@ -56,21 +57,21 @@ var returnFormField = function returnFormField(_ref) {
56
57
  }
57
58
 
58
59
  if (type == 'text' || type == 'email' || type == 'password' || type == 'number') {
59
- return React__default.createElement(
60
+ return React.createElement(
60
61
  Form.Group,
61
62
  _extends({}, opts, { controlId: name }),
62
- React__default.createElement(
63
+ React.createElement(
63
64
  Form.Label,
64
65
  { kye: name + '_label' },
65
66
  label,
66
- required && React__default.createElement(
67
+ required && React.createElement(
67
68
  'span',
68
69
  { style: { color: 'red' } },
69
70
  '*'
70
71
  )
71
72
  ),
72
- React__default.createElement(Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
73
- React__default.createElement(
73
+ React.createElement(Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
74
+ React.createElement(
74
75
  Form.Control.Feedback,
75
76
  { key: name + '_feedback', type: 'invalid' },
76
77
  errors[name]
@@ -78,28 +79,28 @@ var returnFormField = function returnFormField(_ref) {
78
79
  );
79
80
  }
80
81
  if (type == 'select') {
81
- return React__default.createElement(
82
+ return React.createElement(
82
83
  Form.Group,
83
84
  _extends({}, opts, { key: name, controlId: name }),
84
- React__default.createElement(
85
+ React.createElement(
85
86
  Form.Label,
86
87
  { key: name + '_' + label },
87
88
  label,
88
- required && React__default.createElement(
89
+ required && React.createElement(
89
90
  'span',
90
91
  { key: name + '_required_span', style: { color: 'red' } },
91
92
  '*'
92
93
  )
93
94
  ),
94
- React__default.createElement(
95
+ React.createElement(
95
96
  Form.Control,
96
97
  { key: name + '_select', as: 'select', name: name, required: required, defaultValue: default_value },
97
- React__default.createElement('option', { value: '', key: name + '_options_empty' }),
98
+ React.createElement('option', { value: '', key: name + '_options_empty' }),
98
99
  options.map(function (option, index) {
99
100
  var value = option.value ? option.value : option;
100
101
  var label = option.label ? option.label : option;
101
102
  var key = name + '_options_' + index;
102
- return React__default.createElement(
103
+ return React.createElement(
103
104
  'option',
104
105
  { key: key, value: value },
105
106
  label
@@ -110,1080 +111,31 @@ var returnFormField = function returnFormField(_ref) {
110
111
  }
111
112
 
112
113
  if (type == 'radio' || type == 'checkbox') {
113
- return React__default.createElement(
114
+ return React.createElement(
114
115
  Form.Group,
115
116
  opts,
116
- React__default.createElement(
117
+ React.createElement(
117
118
  Form.Label,
118
119
  null,
119
120
  label,
120
- required && React__default.createElement(
121
+ required && React.createElement(
121
122
  'span',
122
123
  { style: { color: 'red' } },
123
124
  '*'
124
125
  )
125
126
  ),
126
127
  options.map(function (option, index) {
127
- return React__default.createElement(
128
+ return React.createElement(
128
129
  Form.Check,
129
130
  { type: type, key: index, required: required },
130
- React__default.createElement(Form.Check.Input, { type: type, key: type + '_' + index + '_input', defaultChecked: default_value ? default_value === option.value : false, name: name, id: name + '_' + index, value: option.value, required: required }),
131
- React__default.createElement(Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
131
+ React.createElement(Form.Check.Input, { type: type, key: type + '_' + index + '_input', defaultChecked: default_value ? default_value === option.value : false, name: name, id: name + '_' + index, value: option.value, required: required }),
132
+ React.createElement(Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
132
133
  );
133
134
  })
134
135
  );
135
136
  }
136
137
  };
137
138
 
138
- var has = Object.prototype.hasOwnProperty;
139
-
140
- function dequal(foo, bar) {
141
- var ctor, len;
142
- if (foo === bar) return true;
143
-
144
- if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
145
- if (ctor === Date) return foo.getTime() === bar.getTime();
146
- if (ctor === RegExp) return foo.toString() === bar.toString();
147
-
148
- if (ctor === Array) {
149
- if ((len=foo.length) === bar.length) {
150
- while (len-- && dequal(foo[len], bar[len]));
151
- }
152
- return len === -1;
153
- }
154
-
155
- if (!ctor || typeof foo === 'object') {
156
- len = 0;
157
- for (ctor in foo) {
158
- if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
159
- if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
160
- }
161
- return Object.keys(bar).length === len;
162
- }
163
- }
164
-
165
- return foo !== foo && bar !== bar;
166
- }
167
-
168
- // use WeakMap to store the object->key mapping
169
- // so the objects can be garbage collected.
170
- // WeakMap uses a hashtable under the hood, so the lookup
171
- // complexity is almost O(1).
172
- var table = new WeakMap();
173
- // counter of the key
174
- var counter = 0;
175
- // hashes an array of objects and returns a string
176
- function hash(args) {
177
- if (!args.length)
178
- return '';
179
- var key = 'arg';
180
- for (var i = 0; i < args.length; ++i) {
181
- if (args[i] === null) {
182
- key += '@null';
183
- continue;
184
- }
185
- var _hash = void 0;
186
- if (typeof args[i] !== 'object' && typeof args[i] !== 'function') {
187
- // need to consider the case that args[i] is a string:
188
- // args[i] _hash
189
- // "undefined" -> '"undefined"'
190
- // undefined -> 'undefined'
191
- // 123 -> '123'
192
- // "null" -> '"null"'
193
- if (typeof args[i] === 'string') {
194
- _hash = '"' + args[i] + '"';
195
- }
196
- else {
197
- _hash = String(args[i]);
198
- }
199
- }
200
- else {
201
- if (!table.has(args[i])) {
202
- _hash = counter;
203
- table.set(args[i], counter++);
204
- }
205
- else {
206
- _hash = table.get(args[i]);
207
- }
208
- }
209
- key += '@' + _hash;
210
- }
211
- return key;
212
- }
213
-
214
- var Cache = /** @class */ (function () {
215
- function Cache(initialData) {
216
- if (initialData === void 0) { initialData = {}; }
217
- this.cache = new Map(Object.entries(initialData));
218
- this.subs = [];
219
- }
220
- Cache.prototype.get = function (key) {
221
- var _key = this.serializeKey(key)[0];
222
- return this.cache.get(_key);
223
- };
224
- Cache.prototype.set = function (key, value) {
225
- var _key = this.serializeKey(key)[0];
226
- this.cache.set(_key, value);
227
- this.notify();
228
- };
229
- Cache.prototype.keys = function () {
230
- return Array.from(this.cache.keys());
231
- };
232
- Cache.prototype.has = function (key) {
233
- var _key = this.serializeKey(key)[0];
234
- return this.cache.has(_key);
235
- };
236
- Cache.prototype.clear = function () {
237
- this.cache.clear();
238
- this.notify();
239
- };
240
- Cache.prototype.delete = function (key) {
241
- var _key = this.serializeKey(key)[0];
242
- this.cache.delete(_key);
243
- this.notify();
244
- };
245
- // TODO: introduce namespace for the cache
246
- Cache.prototype.serializeKey = function (key) {
247
- var args = null;
248
- if (typeof key === 'function') {
249
- try {
250
- key = key();
251
- }
252
- catch (err) {
253
- // dependencies not ready
254
- key = '';
255
- }
256
- }
257
- if (Array.isArray(key)) {
258
- // args array
259
- args = key;
260
- key = hash(key);
261
- }
262
- else {
263
- // convert null to ''
264
- key = String(key || '');
265
- }
266
- var errorKey = key ? 'err@' + key : '';
267
- var isValidatingKey = key ? 'validating@' + key : '';
268
- return [key, args, errorKey, isValidatingKey];
269
- };
270
- Cache.prototype.subscribe = function (listener) {
271
- var _this = this;
272
- if (typeof listener !== 'function') {
273
- throw new Error('Expected the listener to be a function.');
274
- }
275
- var isSubscribed = true;
276
- this.subs.push(listener);
277
- return function () {
278
- if (!isSubscribed)
279
- return;
280
- isSubscribed = false;
281
- var index = _this.subs.indexOf(listener);
282
- if (index > -1) {
283
- _this.subs[index] = _this.subs[_this.subs.length - 1];
284
- _this.subs.length--;
285
- }
286
- };
287
- };
288
- // Notify Cache subscribers about a change in the cache
289
- Cache.prototype.notify = function () {
290
- for (var _i = 0, _a = this.subs; _i < _a.length; _i++) {
291
- var listener = _a[_i];
292
- listener();
293
- }
294
- };
295
- return Cache;
296
- }());
297
-
298
- /**
299
- * Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
300
- * it's not reliable to detect if the browser is currently online or offline
301
- * based on `navigator.onLine`.
302
- * As a work around, we always assume it's online on first load, and change
303
- * the status upon `online` or `offline` events.
304
- */
305
- var online = true;
306
- var isOnline = function () { return online; };
307
- var isDocumentVisible = function () {
308
- if (typeof document !== 'undefined' &&
309
- document.visibilityState !== undefined) {
310
- return document.visibilityState !== 'hidden';
311
- }
312
- // always assume it's visible
313
- return true;
314
- };
315
- var fetcher = function (url) { return fetch(url).then(function (res) { return res.json(); }); };
316
- var registerOnFocus = function (cb) {
317
- if (typeof window !== 'undefined' &&
318
- window.addEventListener !== undefined &&
319
- typeof document !== 'undefined' &&
320
- document.addEventListener !== undefined) {
321
- // focus revalidate
322
- document.addEventListener('visibilitychange', function () { return cb(); }, false);
323
- window.addEventListener('focus', function () { return cb(); }, false);
324
- }
325
- };
326
- var registerOnReconnect = function (cb) {
327
- if (typeof window !== 'undefined' && window.addEventListener !== undefined) {
328
- // reconnect revalidate
329
- window.addEventListener('online', function () {
330
- online = true;
331
- cb();
332
- }, false);
333
- // nothing to revalidate, just update the status
334
- window.addEventListener('offline', function () { return (online = false); }, false);
335
- }
336
- };
337
- var webPreset = {
338
- isOnline: isOnline,
339
- isDocumentVisible: isDocumentVisible,
340
- fetcher: fetcher,
341
- registerOnFocus: registerOnFocus,
342
- registerOnReconnect: registerOnReconnect
343
- };
344
-
345
- var __assign = (undefined && undefined.__assign) || function () {
346
- __assign = Object.assign || function(t) {
347
- for (var s, i = 1, n = arguments.length; i < n; i++) {
348
- s = arguments[i];
349
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
350
- t[p] = s[p];
351
- }
352
- return t;
353
- };
354
- return __assign.apply(this, arguments);
355
- };
356
- // cache
357
- var cache = new Cache();
358
- // error retry
359
- function onErrorRetry(_, __, config, revalidate, opts) {
360
- if (!config.isDocumentVisible()) {
361
- // if it's hidden, stop
362
- // it will auto revalidate when focus
363
- return;
364
- }
365
- if (typeof config.errorRetryCount === 'number' &&
366
- opts.retryCount > config.errorRetryCount) {
367
- return;
368
- }
369
- // exponential backoff
370
- var count = Math.min(opts.retryCount, 8);
371
- var timeout = ~~((Math.random() + 0.5) * (1 << count)) * config.errorRetryInterval;
372
- setTimeout(revalidate, timeout, opts);
373
- }
374
- // client side: need to adjust the config
375
- // based on the browser status
376
- // slow connection (<= 70Kbps)
377
- var slowConnection = typeof window !== 'undefined' &&
378
- // @ts-ignore
379
- navigator['connection'] &&
380
- // @ts-ignore
381
- ['slow-2g', '2g'].indexOf(navigator['connection'].effectiveType) !== -1;
382
- // config
383
- var defaultConfig = __assign({
384
- // events
385
- 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);
386
-
387
- var IS_SERVER = typeof window === 'undefined' ||
388
- // @ts-ignore
389
- !!(typeof Deno !== 'undefined' && Deno && Deno.version && Deno.version.deno);
390
- // polyfill for requestAnimationFrame
391
- var rAF = IS_SERVER
392
- ? null
393
- : window['requestAnimationFrame']
394
- ? function (f) { return window['requestAnimationFrame'](f); }
395
- : function (f) { return setTimeout(f, 1); };
396
- // React currently throws a warning when using useLayoutEffect on the server.
397
- // To get around it, we can conditionally useEffect on the server (no-op) and
398
- // useLayoutEffect in the browser.
399
- var useIsomorphicLayoutEffect = IS_SERVER ? useEffect : useLayoutEffect;
400
-
401
- var SWRConfigContext = createContext({});
402
- SWRConfigContext.displayName = 'SWRConfigContext';
403
-
404
- var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
405
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
406
- return new (P || (P = Promise))(function (resolve, reject) {
407
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
408
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
409
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
410
- step((generator = generator.apply(thisArg, _arguments || [])).next());
411
- });
412
- };
413
- var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
414
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
415
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
416
- function verb(n) { return function (v) { return step([n, v]); }; }
417
- function step(op) {
418
- if (f) throw new TypeError("Generator is already executing.");
419
- while (_) try {
420
- 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;
421
- if (y = 0, t) op = [op[0] & 2, t.value];
422
- switch (op[0]) {
423
- case 0: case 1: t = op; break;
424
- case 4: _.label++; return { value: op[1], done: false };
425
- case 5: _.label++; y = op[1]; op = [0]; continue;
426
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
427
- default:
428
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
429
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
430
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
431
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
432
- if (t[2]) _.ops.pop();
433
- _.trys.pop(); continue;
434
- }
435
- op = body.call(thisArg, _);
436
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
437
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
438
- }
439
- };
440
- // global state managers
441
- var CONCURRENT_PROMISES = {};
442
- var CONCURRENT_PROMISES_TS = {};
443
- var FOCUS_REVALIDATORS = {};
444
- var RECONNECT_REVALIDATORS = {};
445
- var CACHE_REVALIDATORS = {};
446
- var MUTATION_TS = {};
447
- var MUTATION_END_TS = {};
448
- // generate strictly increasing timestamps
449
- var now = (function () {
450
- var ts = 0;
451
- return function () { return ++ts; };
452
- })();
453
- // setup DOM events listeners for `focus` and `reconnect` actions
454
- if (!IS_SERVER) {
455
- var revalidate_1 = function (revalidators) {
456
- if (!defaultConfig.isDocumentVisible() || !defaultConfig.isOnline())
457
- return;
458
- for (var key in revalidators) {
459
- if (revalidators[key][0])
460
- revalidators[key][0]();
461
- }
462
- };
463
- if (typeof defaultConfig.registerOnFocus === 'function') {
464
- defaultConfig.registerOnFocus(function () { return revalidate_1(FOCUS_REVALIDATORS); });
465
- }
466
- if (typeof defaultConfig.registerOnReconnect === 'function') {
467
- defaultConfig.registerOnReconnect(function () { return revalidate_1(RECONNECT_REVALIDATORS); });
468
- }
469
- }
470
- var trigger = function (_key, shouldRevalidate) {
471
- if (shouldRevalidate === void 0) { shouldRevalidate = true; }
472
- // we are ignoring the second argument which correspond to the arguments
473
- // the fetcher will receive when key is an array
474
- var _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2], keyValidating = _a[3];
475
- if (!key)
476
- return Promise.resolve();
477
- var updaters = CACHE_REVALIDATORS[key];
478
- if (key && updaters) {
479
- var currentData = cache.get(key);
480
- var currentError = cache.get(keyErr);
481
- var currentIsValidating = cache.get(keyValidating);
482
- var promises = [];
483
- for (var i = 0; i < updaters.length; ++i) {
484
- promises.push(updaters[i](shouldRevalidate, currentData, currentError, currentIsValidating, i > 0));
485
- }
486
- // return new updated value
487
- return Promise.all(promises).then(function () { return cache.get(key); });
488
- }
489
- return Promise.resolve(cache.get(key));
490
- };
491
- var broadcastState = function (key, data, error, isValidating) {
492
- var updaters = CACHE_REVALIDATORS[key];
493
- if (key && updaters) {
494
- for (var i = 0; i < updaters.length; ++i) {
495
- updaters[i](false, data, error, isValidating);
496
- }
497
- }
498
- };
499
- var mutate = function (_key, _data, shouldRevalidate) {
500
- if (shouldRevalidate === void 0) { shouldRevalidate = true; }
501
- return __awaiter(void 0, void 0, void 0, function () {
502
- var _a, key, keyErr, beforeMutationTs, beforeConcurrentPromisesTs, data, error, isAsyncMutation, err_1, shouldAbort, updaters, promises, i;
503
- return __generator(this, function (_b) {
504
- switch (_b.label) {
505
- case 0:
506
- _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2];
507
- if (!key)
508
- return [2 /*return*/];
509
- // if there is no new data to update, let's just revalidate the key
510
- if (typeof _data === 'undefined')
511
- return [2 /*return*/, trigger(_key, shouldRevalidate)
512
- // update global timestamps
513
- ];
514
- // update global timestamps
515
- MUTATION_TS[key] = now() - 1;
516
- MUTATION_END_TS[key] = 0;
517
- beforeMutationTs = MUTATION_TS[key];
518
- beforeConcurrentPromisesTs = CONCURRENT_PROMISES_TS[key];
519
- isAsyncMutation = false;
520
- if (_data && typeof _data === 'function') {
521
- // `_data` is a function, call it passing current cache value
522
- try {
523
- _data = _data(cache.get(key));
524
- }
525
- catch (err) {
526
- // if `_data` function throws an error synchronously, it shouldn't be cached
527
- _data = undefined;
528
- error = err;
529
- }
530
- }
531
- if (!(_data && typeof _data.then === 'function')) return [3 /*break*/, 5];
532
- // `_data` is a promise
533
- isAsyncMutation = true;
534
- _b.label = 1;
535
- case 1:
536
- _b.trys.push([1, 3, , 4]);
537
- return [4 /*yield*/, _data];
538
- case 2:
539
- data = _b.sent();
540
- return [3 /*break*/, 4];
541
- case 3:
542
- err_1 = _b.sent();
543
- error = err_1;
544
- return [3 /*break*/, 4];
545
- case 4: return [3 /*break*/, 6];
546
- case 5:
547
- data = _data;
548
- _b.label = 6;
549
- case 6:
550
- shouldAbort = function () {
551
- // check if other mutations have occurred since we've started this mutation
552
- if (beforeMutationTs !== MUTATION_TS[key] ||
553
- beforeConcurrentPromisesTs !== CONCURRENT_PROMISES_TS[key]) {
554
- if (error)
555
- throw error;
556
- return true;
557
- }
558
- };
559
- // if there's a race we don't update cache or broadcast change, just return the data
560
- if (shouldAbort())
561
- return [2 /*return*/, data];
562
- if (typeof data !== 'undefined') {
563
- // update cached data
564
- cache.set(key, data);
565
- }
566
- // always update or reset the error
567
- cache.set(keyErr, error);
568
- // reset the timestamp to mark the mutation has ended
569
- MUTATION_END_TS[key] = now() - 1;
570
- if (!isAsyncMutation) {
571
- // we skip broadcasting if there's another mutation happened synchronously
572
- if (shouldAbort())
573
- return [2 /*return*/, data];
574
- }
575
- updaters = CACHE_REVALIDATORS[key];
576
- if (updaters) {
577
- promises = [];
578
- for (i = 0; i < updaters.length; ++i) {
579
- promises.push(updaters[i](!!shouldRevalidate, data, error, undefined, i > 0));
580
- }
581
- // return new updated value
582
- return [2 /*return*/, Promise.all(promises).then(function () {
583
- if (error)
584
- throw error;
585
- return cache.get(key);
586
- })];
587
- }
588
- // throw error or return data to be used by caller of mutate
589
- if (error)
590
- throw error;
591
- return [2 /*return*/, data];
592
- }
593
- });
594
- });
595
- };
596
- function useSWR() {
597
- var _this = this;
598
- var args = [];
599
- for (var _i = 0; _i < arguments.length; _i++) {
600
- args[_i] = arguments[_i];
601
- }
602
- var _key = args[0];
603
- var config = Object.assign({}, defaultConfig, useContext(SWRConfigContext), args.length > 2
604
- ? args[2]
605
- : args.length === 2 && typeof args[1] === 'object'
606
- ? args[1]
607
- : {});
608
- // in typescript args.length > 2 is not same as args.lenth === 3
609
- // we do a safe type assertion here
610
- // args.length === 3
611
- var fn = (args.length > 2
612
- ? args[1]
613
- : args.length === 2 && typeof args[1] === 'function'
614
- ? args[1]
615
- : /**
616
- pass fn as null will disable revalidate
617
- https://paco.sh/blog/shared-hook-state-with-swr
618
- */
619
- args[1] === null
620
- ? args[1]
621
- : config.fetcher);
622
- // we assume `key` as the identifier of the request
623
- // `key` can change but `fn` shouldn't
624
- // (because `revalidate` only depends on `key`)
625
- // `keyErr` is the cache key for error objects
626
- var _a = cache.serializeKey(_key), key = _a[0], fnArgs = _a[1], keyErr = _a[2], keyValidating = _a[3];
627
- var configRef = useRef(config);
628
- useIsomorphicLayoutEffect(function () {
629
- configRef.current = config;
630
- });
631
- var willRevalidateOnMount = function () {
632
- return (config.revalidateOnMount ||
633
- (!config.initialData && config.revalidateOnMount === undefined));
634
- };
635
- var resolveData = function () {
636
- var cachedData = cache.get(key);
637
- return typeof cachedData === 'undefined' ? config.initialData : cachedData;
638
- };
639
- var resolveIsValidating = function () {
640
- return !!cache.get(keyValidating) || (key && willRevalidateOnMount());
641
- };
642
- var initialData = resolveData();
643
- var initialError = cache.get(keyErr);
644
- var initialIsValidating = resolveIsValidating();
645
- // if a state is accessed (data, error or isValidating),
646
- // we add the state to dependencies so if the state is
647
- // updated in the future, we can trigger a rerender
648
- var stateDependencies = useRef({
649
- data: false,
650
- error: false,
651
- isValidating: false
652
- });
653
- var stateRef = useRef({
654
- data: initialData,
655
- error: initialError,
656
- isValidating: initialIsValidating
657
- });
658
- // display the data label in the React DevTools next to SWR hooks
659
- useDebugValue(stateRef.current.data);
660
- var rerender = useState({})[1];
661
- var dispatch = useCallback(function (payload) {
662
- var shouldUpdateState = false;
663
- for (var k in payload) {
664
- // @ts-ignore
665
- if (stateRef.current[k] === payload[k]) {
666
- continue;
667
- }
668
- // @ts-ignore
669
- stateRef.current[k] = payload[k];
670
- // @ts-ignore
671
- if (stateDependencies.current[k]) {
672
- shouldUpdateState = true;
673
- }
674
- }
675
- if (shouldUpdateState) {
676
- // if component is unmounted, should skip rerender
677
- // if component is not mounted, should skip rerender
678
- if (unmountedRef.current || !initialMountedRef.current)
679
- return;
680
- rerender({});
681
- }
682
- },
683
- // config.suspense isn't allowed to change during the lifecycle
684
- // eslint-disable-next-line react-hooks/exhaustive-deps
685
- []);
686
- // error ref inside revalidate (is last request errored?)
687
- var unmountedRef = useRef(false);
688
- var keyRef = useRef(key);
689
- // check if component is mounted in suspense mode
690
- var initialMountedRef = useRef(false);
691
- // do unmount check for callbacks
692
- var eventsCallback = useCallback(function (event) {
693
- var _a;
694
- var params = [];
695
- for (var _i = 1; _i < arguments.length; _i++) {
696
- params[_i - 1] = arguments[_i];
697
- }
698
- if (unmountedRef.current)
699
- return;
700
- if (!initialMountedRef.current)
701
- return;
702
- if (key !== keyRef.current)
703
- return;
704
- // @ts-ignore
705
- (_a = configRef.current)[event].apply(_a, params);
706
- }, [key]);
707
- var boundMutate = useCallback(function (data, shouldRevalidate) {
708
- return mutate(keyRef.current, data, shouldRevalidate);
709
- }, []);
710
- var addRevalidator = function (revalidators, callback) {
711
- if (!revalidators[key]) {
712
- revalidators[key] = [callback];
713
- }
714
- else {
715
- revalidators[key].push(callback);
716
- }
717
- return function () {
718
- var keyedRevalidators = revalidators[key];
719
- var index = keyedRevalidators.indexOf(callback);
720
- if (index >= 0) {
721
- // O(1): faster than splice
722
- keyedRevalidators[index] =
723
- keyedRevalidators[keyedRevalidators.length - 1];
724
- keyedRevalidators.pop();
725
- }
726
- };
727
- };
728
- // start a revalidation
729
- var revalidate = useCallback(function (revalidateOpts) {
730
- if (revalidateOpts === void 0) { revalidateOpts = {}; }
731
- return __awaiter(_this, void 0, void 0, function () {
732
- var _a, retryCount, _b, dedupe, loading, shouldDeduping, newData, startAt, newState, err_2;
733
- return __generator(this, function (_c) {
734
- switch (_c.label) {
735
- case 0:
736
- if (!key || !fn)
737
- return [2 /*return*/, false];
738
- if (unmountedRef.current)
739
- return [2 /*return*/, false];
740
- if (configRef.current.isPaused())
741
- return [2 /*return*/, false];
742
- _a = revalidateOpts.retryCount, retryCount = _a === void 0 ? 0 : _a, _b = revalidateOpts.dedupe, dedupe = _b === void 0 ? false : _b;
743
- loading = true;
744
- shouldDeduping = typeof CONCURRENT_PROMISES[key] !== 'undefined' && dedupe;
745
- _c.label = 1;
746
- case 1:
747
- _c.trys.push([1, 6, , 7]);
748
- dispatch({
749
- isValidating: true
750
- });
751
- cache.set(keyValidating, true);
752
- if (!shouldDeduping) {
753
- // also update other hooks
754
- broadcastState(key, stateRef.current.data, stateRef.current.error, true);
755
- }
756
- newData = void 0;
757
- startAt = void 0;
758
- if (!shouldDeduping) return [3 /*break*/, 3];
759
- // there's already an ongoing request,
760
- // this one needs to be deduplicated.
761
- startAt = CONCURRENT_PROMISES_TS[key];
762
- return [4 /*yield*/, CONCURRENT_PROMISES[key]];
763
- case 2:
764
- newData = _c.sent();
765
- return [3 /*break*/, 5];
766
- case 3:
767
- // if no cache being rendered currently (it shows a blank page),
768
- // we trigger the loading slow event.
769
- if (config.loadingTimeout && !cache.get(key)) {
770
- setTimeout(function () {
771
- if (loading)
772
- eventsCallback('onLoadingSlow', key, config);
773
- }, config.loadingTimeout);
774
- }
775
- if (fnArgs !== null) {
776
- CONCURRENT_PROMISES[key] = fn.apply(void 0, fnArgs);
777
- }
778
- else {
779
- CONCURRENT_PROMISES[key] = fn(key);
780
- }
781
- CONCURRENT_PROMISES_TS[key] = startAt = now();
782
- return [4 /*yield*/, CONCURRENT_PROMISES[key]];
783
- case 4:
784
- newData = _c.sent();
785
- setTimeout(function () {
786
- delete CONCURRENT_PROMISES[key];
787
- delete CONCURRENT_PROMISES_TS[key];
788
- }, config.dedupingInterval);
789
- // trigger the success event,
790
- // only do this for the original request.
791
- eventsCallback('onSuccess', newData, key, config);
792
- _c.label = 5;
793
- case 5:
794
- // if there're other ongoing request(s), started after the current one,
795
- // we need to ignore the current one to avoid possible race conditions:
796
- // req1------------------>res1 (current one)
797
- // req2---------------->res2
798
- // the request that fired later will always be kept.
799
- if (CONCURRENT_PROMISES_TS[key] > startAt) {
800
- return [2 /*return*/, false];
801
- }
802
- // if there're other mutations(s), overlapped with the current revalidation:
803
- // case 1:
804
- // req------------------>res
805
- // mutate------>end
806
- // case 2:
807
- // req------------>res
808
- // mutate------>end
809
- // case 3:
810
- // req------------------>res
811
- // mutate-------...---------->
812
- // we have to ignore the revalidation result (res) because it's no longer fresh.
813
- // meanwhile, a new revalidation should be triggered when the mutation ends.
814
- if (MUTATION_TS[key] &&
815
- // case 1
816
- (startAt <= MUTATION_TS[key] ||
817
- // case 2
818
- startAt <= MUTATION_END_TS[key] ||
819
- // case 3
820
- MUTATION_END_TS[key] === 0)) {
821
- dispatch({ isValidating: false });
822
- return [2 /*return*/, false];
823
- }
824
- cache.set(keyErr, undefined);
825
- cache.set(keyValidating, false);
826
- newState = {
827
- isValidating: false
828
- };
829
- if (typeof stateRef.current.error !== 'undefined') {
830
- // we don't have an error
831
- newState.error = undefined;
832
- }
833
- if (!config.compare(stateRef.current.data, newData)) {
834
- // deep compare to avoid extra re-render
835
- // data changed
836
- newState.data = newData;
837
- }
838
- if (!config.compare(cache.get(key), newData)) {
839
- cache.set(key, newData);
840
- }
841
- // merge the new state
842
- dispatch(newState);
843
- if (!shouldDeduping) {
844
- // also update other hooks
845
- broadcastState(key, newData, newState.error, false);
846
- }
847
- return [3 /*break*/, 7];
848
- case 6:
849
- err_2 = _c.sent();
850
- delete CONCURRENT_PROMISES[key];
851
- delete CONCURRENT_PROMISES_TS[key];
852
- if (configRef.current.isPaused()) {
853
- dispatch({
854
- isValidating: false
855
- });
856
- return [2 /*return*/, false];
857
- }
858
- cache.set(keyErr, err_2);
859
- // get a new error
860
- // don't use deep equal for errors
861
- if (stateRef.current.error !== err_2) {
862
- // we keep the stale data
863
- dispatch({
864
- isValidating: false,
865
- error: err_2
866
- });
867
- if (!shouldDeduping) {
868
- // also broadcast to update other hooks
869
- broadcastState(key, undefined, err_2, false);
870
- }
871
- }
872
- // events and retry
873
- eventsCallback('onError', err_2, key, config);
874
- if (config.shouldRetryOnError) {
875
- // when retrying, we always enable deduping
876
- eventsCallback('onErrorRetry', err_2, key, config, revalidate, {
877
- retryCount: retryCount + 1,
878
- dedupe: true
879
- });
880
- }
881
- return [3 /*break*/, 7];
882
- case 7:
883
- loading = false;
884
- return [2 /*return*/, true];
885
- }
886
- });
887
- });
888
- },
889
- // dispatch is immutable, and `eventsCallback`, `fnArgs`, `keyErr`, and `keyValidating` are based on `key`,
890
- // so we can them from the deps array.
891
- //
892
- // FIXME:
893
- // `fn` and `config` might be changed during the lifecycle,
894
- // but they might be changed every render like this.
895
- // useSWR('key', () => fetch('/api/'), { suspense: true })
896
- // So we omit the values from the deps array
897
- // even though it might cause unexpected behaviors.
898
- // eslint-disable-next-line react-hooks/exhaustive-deps
899
- [key]);
900
- // mounted (client side rendering)
901
- useIsomorphicLayoutEffect(function () {
902
- if (!key)
903
- return undefined;
904
- // after `key` updates, we need to mark it as mounted
905
- unmountedRef.current = false;
906
- var isUpdating = initialMountedRef.current;
907
- initialMountedRef.current = true;
908
- // after the component is mounted (hydrated),
909
- // we need to update the data from the cache
910
- // and trigger a revalidation
911
- var currentHookData = stateRef.current.data;
912
- var latestKeyedData = resolveData();
913
- // update the state if the key changed (not the inital render) or cache updated
914
- keyRef.current = key;
915
- if (!config.compare(currentHookData, latestKeyedData)) {
916
- dispatch({ data: latestKeyedData });
917
- }
918
- // revalidate with deduping
919
- var softRevalidate = function () { return revalidate({ dedupe: true }); };
920
- // trigger a revalidation
921
- if (isUpdating || willRevalidateOnMount()) {
922
- if (typeof latestKeyedData !== 'undefined' && !IS_SERVER) {
923
- // delay revalidate if there's cache
924
- // to not block the rendering
925
- // @ts-ignore it's safe to use requestAnimationFrame in browser
926
- rAF(softRevalidate);
927
- }
928
- else {
929
- softRevalidate();
930
- }
931
- }
932
- var pending = false;
933
- var onFocus = function () {
934
- if (pending || !configRef.current.revalidateOnFocus)
935
- return;
936
- pending = true;
937
- softRevalidate();
938
- setTimeout(function () { return (pending = false); }, configRef.current.focusThrottleInterval);
939
- };
940
- var onReconnect = function () {
941
- if (configRef.current.revalidateOnReconnect) {
942
- softRevalidate();
943
- }
944
- };
945
- // register global cache update listener
946
- var onUpdate = function (shouldRevalidate, updatedData, updatedError, updatedIsValidating, dedupe) {
947
- if (shouldRevalidate === void 0) { shouldRevalidate = true; }
948
- if (dedupe === void 0) { dedupe = true; }
949
- // update hook state
950
- var newState = {};
951
- var needUpdate = false;
952
- if (typeof updatedData !== 'undefined' &&
953
- !config.compare(stateRef.current.data, updatedData)) {
954
- newState.data = updatedData;
955
- needUpdate = true;
956
- }
957
- // always update error
958
- // because it can be `undefined`
959
- if (stateRef.current.error !== updatedError) {
960
- newState.error = updatedError;
961
- needUpdate = true;
962
- }
963
- if (typeof updatedIsValidating !== 'undefined' &&
964
- stateRef.current.isValidating !== updatedIsValidating) {
965
- newState.isValidating = updatedIsValidating;
966
- needUpdate = true;
967
- }
968
- if (needUpdate) {
969
- dispatch(newState);
970
- }
971
- if (shouldRevalidate) {
972
- if (dedupe) {
973
- return softRevalidate();
974
- }
975
- else {
976
- return revalidate();
977
- }
978
- }
979
- return false;
980
- };
981
- var unsubFocus = addRevalidator(FOCUS_REVALIDATORS, onFocus);
982
- var unsubReconnect = addRevalidator(RECONNECT_REVALIDATORS, onReconnect);
983
- var unsubUpdate = addRevalidator(CACHE_REVALIDATORS, onUpdate);
984
- return function () {
985
- // cleanup
986
- dispatch = function () { return null; };
987
- // mark it as unmounted
988
- unmountedRef.current = true;
989
- unsubFocus();
990
- unsubReconnect();
991
- unsubUpdate();
992
- };
993
- }, [key, revalidate]);
994
- useIsomorphicLayoutEffect(function () {
995
- var timer = null;
996
- var tick = function () { return __awaiter(_this, void 0, void 0, function () {
997
- return __generator(this, function (_a) {
998
- switch (_a.label) {
999
- case 0:
1000
- if (!(!stateRef.current.error &&
1001
- (configRef.current.refreshWhenHidden ||
1002
- configRef.current.isDocumentVisible()) &&
1003
- (configRef.current.refreshWhenOffline || configRef.current.isOnline()))) return [3 /*break*/, 2];
1004
- // only revalidate when the page is visible
1005
- // if API request errored, we stop polling in this round
1006
- // and let the error retry function handle it
1007
- return [4 /*yield*/, revalidate({ dedupe: true })];
1008
- case 1:
1009
- // only revalidate when the page is visible
1010
- // if API request errored, we stop polling in this round
1011
- // and let the error retry function handle it
1012
- _a.sent();
1013
- _a.label = 2;
1014
- case 2:
1015
- // Read the latest refreshInterval
1016
- if (configRef.current.refreshInterval && timer) {
1017
- timer = setTimeout(tick, configRef.current.refreshInterval);
1018
- }
1019
- return [2 /*return*/];
1020
- }
1021
- });
1022
- }); };
1023
- if (configRef.current.refreshInterval) {
1024
- timer = setTimeout(tick, configRef.current.refreshInterval);
1025
- }
1026
- return function () {
1027
- if (timer) {
1028
- clearTimeout(timer);
1029
- timer = null;
1030
- }
1031
- };
1032
- }, [
1033
- config.refreshInterval,
1034
- config.refreshWhenHidden,
1035
- config.refreshWhenOffline,
1036
- revalidate
1037
- ]);
1038
- // suspense
1039
- var latestData;
1040
- var latestError;
1041
- if (config.suspense) {
1042
- // in suspense mode, we can't return empty state
1043
- // (it should be suspended)
1044
- // try to get data and error from cache
1045
- latestData = cache.get(key);
1046
- latestError = cache.get(keyErr);
1047
- if (typeof latestData === 'undefined') {
1048
- latestData = initialData;
1049
- }
1050
- if (typeof latestError === 'undefined') {
1051
- latestError = initialError;
1052
- }
1053
- if (typeof latestData === 'undefined' &&
1054
- typeof latestError === 'undefined') {
1055
- // need to start the request if it hasn't
1056
- if (!CONCURRENT_PROMISES[key]) {
1057
- // trigger revalidate immediately
1058
- // to get the promise
1059
- // in this revalidate, should not rerender
1060
- revalidate();
1061
- }
1062
- if (CONCURRENT_PROMISES[key] &&
1063
- typeof CONCURRENT_PROMISES[key].then === 'function') {
1064
- // if it is a promise
1065
- throw CONCURRENT_PROMISES[key];
1066
- }
1067
- // it's a value, return it directly (override)
1068
- latestData = CONCURRENT_PROMISES[key];
1069
- }
1070
- if (typeof latestData === 'undefined' && latestError) {
1071
- // in suspense mode, throw error if there's no content
1072
- throw latestError;
1073
- }
1074
- }
1075
- // define returned state
1076
- // can be memorized since the state is a ref
1077
- var memoizedState = useMemo(function () {
1078
- // revalidate will be deprecated in the 1.x release
1079
- // because mutate() covers the same use case of revalidate().
1080
- // This remains only for backward compatibility
1081
- var state = { revalidate: revalidate, mutate: boundMutate };
1082
- Object.defineProperties(state, {
1083
- error: {
1084
- // `key` might be changed in the upcoming hook re-render,
1085
- // but the previous state will stay
1086
- // so we need to match the latest key and data (fallback to `initialData`)
1087
- get: function () {
1088
- stateDependencies.current.error = true;
1089
- if (config.suspense) {
1090
- return latestError;
1091
- }
1092
- return keyRef.current === key ? stateRef.current.error : initialError;
1093
- },
1094
- enumerable: true
1095
- },
1096
- data: {
1097
- get: function () {
1098
- stateDependencies.current.data = true;
1099
- if (config.suspense) {
1100
- return latestData;
1101
- }
1102
- return keyRef.current === key ? stateRef.current.data : initialData;
1103
- },
1104
- enumerable: true
1105
- },
1106
- isValidating: {
1107
- get: function () {
1108
- stateDependencies.current.isValidating = true;
1109
- return key ? stateRef.current.isValidating : false;
1110
- },
1111
- enumerable: true
1112
- }
1113
- });
1114
- return state;
1115
- // `config.suspense` isn't allowed to change during the lifecycle.
1116
- // `boundMutate` is immutable, and the immutability of `revalidate` depends on `key`
1117
- // so we can omit them from the deps array,
1118
- // but we put it to enable react-hooks/exhaustive-deps rule.
1119
- // `initialData` and `initialError` are not initial values
1120
- // because they are changed during the lifecycle
1121
- // so we should add them in the deps array.
1122
- }, [
1123
- revalidate,
1124
- initialData,
1125
- initialError,
1126
- boundMutate,
1127
- key,
1128
- config.suspense,
1129
- latestError,
1130
- latestData
1131
- ]);
1132
- return memoizedState;
1133
- }
1134
- Object.defineProperty(SWRConfigContext.Provider, 'default', {
1135
- value: defaultConfig
1136
- });
1137
- var SWRConfig = SWRConfigContext.Provider;
1138
-
1139
- var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
1140
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
1141
- return new (P || (P = Promise))(function (resolve, reject) {
1142
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
1143
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
1144
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
1145
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1146
- });
1147
- };
1148
- var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
1149
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1150
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1151
- function verb(n) { return function (v) { return step([n, v]); }; }
1152
- function step(op) {
1153
- if (f) throw new TypeError("Generator is already executing.");
1154
- while (_) try {
1155
- 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;
1156
- if (y = 0, t) op = [op[0] & 2, t.value];
1157
- switch (op[0]) {
1158
- case 0: case 1: t = op; break;
1159
- case 4: _.label++; return { value: op[1], done: false };
1160
- case 5: _.label++; y = op[1]; op = [0]; continue;
1161
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
1162
- default:
1163
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1164
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1165
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1166
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1167
- if (t[2]) _.ops.pop();
1168
- _.trys.pop(); continue;
1169
- }
1170
- op = body.call(thisArg, _);
1171
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1172
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1173
- }
1174
- };
1175
- var __rest = (undefined && undefined.__rest) || function (s, e) {
1176
- var t = {};
1177
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
1178
- t[p] = s[p];
1179
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
1180
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
1181
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
1182
- t[p[i]] = s[p[i]];
1183
- }
1184
- return t;
1185
- };
1186
-
1187
139
  var _this = undefined;
1188
140
 
1189
141
  var dataHandler = function () {
@@ -1384,43 +336,43 @@ var LoginForm = function LoginForm(props) {
1384
336
  loading = _useState4[0],
1385
337
  setLoading = _useState4[1];
1386
338
 
1387
- return React__default.createElement(
339
+ return React.createElement(
1388
340
  Form,
1389
341
  { className: 'login', onSubmit: handleSubmit },
1390
- React__default.createElement(
342
+ React.createElement(
1391
343
  'h1',
1392
344
  null,
1393
345
  'Login'
1394
346
  ),
1395
- React__default.createElement('hr', null),
347
+ React.createElement('hr', null),
1396
348
  returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
1397
349
  returnFormField({ name: 'password', label: 'Password', type: 'password', required: true }),
1398
- React__default.createElement('hr', null),
1399
- React__default.createElement(
350
+ React.createElement('hr', null),
351
+ React.createElement(
1400
352
  Form.Row,
1401
353
  null,
1402
- React__default.createElement(
354
+ React.createElement(
1403
355
  Form.Group,
1404
356
  { as: Col },
1405
- React__default.createElement(
357
+ React.createElement(
1406
358
  'a',
1407
359
  { href: '/auth/signup' },
1408
360
  'I don\'t have an account'
1409
361
  )
1410
362
  ),
1411
- React__default.createElement(
363
+ React.createElement(
1412
364
  Form.Group,
1413
365
  { as: Col, className: 'text-right' },
1414
- !loading && React__default.createElement(
366
+ !loading && React.createElement(
1415
367
  Button,
1416
368
  { type: 'submit' },
1417
369
  'Login'
1418
370
  ),
1419
- loading && React__default.createElement(
371
+ loading && React.createElement(
1420
372
  Button,
1421
373
  { variant: 'primary', disabled: true },
1422
- React__default.createElement(Spinner, { as: 'span', animation: 'border', role: 'status', 'aria-hidden': 'true', size: 'sm' }),
1423
- React__default.createElement(
374
+ React.createElement(Spinner, { as: 'span', animation: 'border', role: 'status', 'aria-hidden': 'true', size: 'sm' }),
375
+ React.createElement(
1424
376
  'span',
1425
377
  { className: 'sr-only' },
1426
378
  'Loading...'
@@ -1428,12 +380,12 @@ var LoginForm = function LoginForm(props) {
1428
380
  )
1429
381
  )
1430
382
  ),
1431
- errorMsg && React__default.createElement(
383
+ errorMsg && React.createElement(
1432
384
  'p',
1433
385
  { className: 'error' },
1434
386
  errorMsg
1435
387
  ),
1436
- React__default.createElement(
388
+ React.createElement(
1437
389
  'style',
1438
390
  { jsx: 'true'.toString() },
1439
391
  '\n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n '
@@ -1689,29 +641,29 @@ var SignupForm = function SignupForm(props) {
1689
641
  loading = _useState14[0],
1690
642
  setLoading = _useState14[1];
1691
643
 
1692
- return React__default.createElement(
644
+ return React.createElement(
1693
645
  Form,
1694
646
  { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
1695
- React__default.createElement(
647
+ React.createElement(
1696
648
  'h1',
1697
649
  null,
1698
650
  'Sign Up'
1699
651
  ),
1700
- React__default.createElement('hr', null),
652
+ React.createElement('hr', null),
1701
653
  returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
1702
- React__default.createElement(
654
+ React.createElement(
1703
655
  Form.Row,
1704
656
  null,
1705
657
  returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: Col, required: true }),
1706
658
  returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: Col, required: true })
1707
659
  ),
1708
- React__default.createElement(
660
+ React.createElement(
1709
661
  Form.Row,
1710
662
  null,
1711
663
  returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: Col, required: true }),
1712
664
  returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: Col, required: true })
1713
665
  ),
1714
- React__default.createElement(
666
+ React.createElement(
1715
667
  Form.Row,
1716
668
  null,
1717
669
  returnFormField({
@@ -1725,7 +677,7 @@ var SignupForm = function SignupForm(props) {
1725
677
  }),
1726
678
  countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: Col, options: states })
1727
679
  ),
1728
- React__default.createElement(
680
+ React.createElement(
1729
681
  Form.Row,
1730
682
  null,
1731
683
  countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: Col }),
@@ -1772,38 +724,38 @@ var SignupForm = function SignupForm(props) {
1772
724
  required: true,
1773
725
  options: [{ label: 'By registering you agree to our <a href="/terms" style="color:blue">Terms and Conditions</a> and <a href="/privacy" style="color:blue">Privacy Policy</a> and understand that you will be receiving email communications', value: 'Y' }]
1774
726
  }),
1775
- React__default.createElement('hr', null),
1776
- React__default.createElement(
727
+ React.createElement('hr', null),
728
+ React.createElement(
1777
729
  Form.Row,
1778
730
  null,
1779
- React__default.createElement(
731
+ React.createElement(
1780
732
  Form.Group,
1781
733
  { as: Col },
1782
- React__default.createElement(
734
+ React.createElement(
1783
735
  'a',
1784
736
  { href: '/auth/login' },
1785
737
  'I already have an account'
1786
738
  )
1787
739
  ),
1788
- React__default.createElement(
740
+ React.createElement(
1789
741
  Form.Group,
1790
742
  { as: Col, className: 'text-right' },
1791
- !loading && React__default.createElement(
743
+ !loading && React.createElement(
1792
744
  Button,
1793
745
  { type: 'submit' },
1794
746
  'Sign Up'
1795
747
  ),
1796
- loading && React__default.createElement(
748
+ loading && React.createElement(
1797
749
  Button,
1798
750
  { variant: 'primary', disabled: true },
1799
- React__default.createElement(Spinner, {
751
+ React.createElement(Spinner, {
1800
752
  as: 'span',
1801
753
  animation: 'border',
1802
754
  role: 'status',
1803
755
  'aria-hidden': 'true',
1804
756
  size: 'sm'
1805
757
  }),
1806
- React__default.createElement(
758
+ React.createElement(
1807
759
  'span',
1808
760
  { className: 'sr-only' },
1809
761
  'Loading...'
@@ -1811,12 +763,12 @@ var SignupForm = function SignupForm(props) {
1811
763
  )
1812
764
  )
1813
765
  ),
1814
- errorMsg && React__default.createElement(
766
+ errorMsg && React.createElement(
1815
767
  'p',
1816
768
  { className: 'error' },
1817
769
  errorMsg
1818
770
  ),
1819
- React__default.createElement(
771
+ React.createElement(
1820
772
  'style',
1821
773
  { jsx: 'true'.toString() },
1822
774
  ' \n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n '
@@ -2106,32 +1058,32 @@ var SignupForm$1 = function SignupForm(props) {
2106
1058
  loading = _useState18[0],
2107
1059
  setLoading = _useState18[1];
2108
1060
 
2109
- return React__default.createElement(
1061
+ return React.createElement(
2110
1062
  Form,
2111
1063
  { className: 'login', id: 'signupForm', onSubmit: handleSubmit },
2112
- React__default.createElement(
1064
+ React.createElement(
2113
1065
  'h1',
2114
1066
  null,
2115
1067
  'Profile'
2116
1068
  ),
2117
- React__default.createElement('hr', null),
2118
- userData ? React__default.createElement(
2119
- React__default.Fragment,
1069
+ React.createElement('hr', null),
1070
+ userData ? React.createElement(
1071
+ React.Fragment,
2120
1072
  null,
2121
1073
  returnFormField({ name: 'email', label: 'Email', type: 'email', required: true, readonly: true, default_value: userData.email }),
2122
- React__default.createElement(
1074
+ React.createElement(
2123
1075
  Form.Row,
2124
1076
  null,
2125
1077
  returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: Col, required: false }),
2126
1078
  returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: Col, required: false })
2127
1079
  ),
2128
- React__default.createElement(
1080
+ React.createElement(
2129
1081
  Form.Row,
2130
1082
  null,
2131
1083
  returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: Col, required: true, default_value: userData.shared.first_name }),
2132
1084
  returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: Col, required: true, default_value: userData.shared.last_name })
2133
1085
  ),
2134
- React__default.createElement(
1086
+ React.createElement(
2135
1087
  Form.Row,
2136
1088
  null,
2137
1089
  returnFormField({
@@ -2146,7 +1098,7 @@ var SignupForm$1 = function SignupForm(props) {
2146
1098
  }),
2147
1099
  countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: Col, options: states, default_value: userData.shared.state })
2148
1100
  ),
2149
- React__default.createElement(
1101
+ React.createElement(
2150
1102
  Form.Row,
2151
1103
  null,
2152
1104
  countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: Col, default_value: userData.shared.zip }),
@@ -2196,29 +1148,29 @@ var SignupForm$1 = function SignupForm(props) {
2196
1148
  required: true,
2197
1149
  options: [{ label: 'By registering you agree to our <a href="/terms">Terms and Conditions</a> and <a href="/privacy">Privacy Policy</a> and understand that you will be receiving email communications', value: 'Y' }]
2198
1150
  }),
2199
- React__default.createElement('hr', null),
2200
- React__default.createElement(
1151
+ React.createElement('hr', null),
1152
+ React.createElement(
2201
1153
  Form.Row,
2202
1154
  null,
2203
- React__default.createElement(
1155
+ React.createElement(
2204
1156
  Form.Group,
2205
1157
  { as: Col },
2206
- !loading && React__default.createElement(
1158
+ !loading && React.createElement(
2207
1159
  Button,
2208
1160
  { type: 'submit' },
2209
1161
  'Update'
2210
1162
  ),
2211
- loading && React__default.createElement(
1163
+ loading && React.createElement(
2212
1164
  Button,
2213
1165
  { variant: 'primary', disabled: true },
2214
- React__default.createElement(Spinner, {
1166
+ React.createElement(Spinner, {
2215
1167
  as: 'span',
2216
1168
  animation: 'border',
2217
1169
  role: 'status',
2218
1170
  'aria-hidden': 'true',
2219
1171
  size: 'sm'
2220
1172
  }),
2221
- React__default.createElement(
1173
+ React.createElement(
2222
1174
  'span',
2223
1175
  { className: 'sr-only' },
2224
1176
  'Loading...'
@@ -2226,24 +1178,24 @@ var SignupForm$1 = function SignupForm(props) {
2226
1178
  )
2227
1179
  )
2228
1180
  )
2229
- ) : React__default.createElement(Spinner, {
1181
+ ) : React.createElement(Spinner, {
2230
1182
  as: 'span',
2231
1183
  animation: 'border',
2232
1184
  role: 'status',
2233
1185
  'aria-hidden': 'true',
2234
1186
  size: 'sm'
2235
1187
  }),
2236
- errorMsg && React__default.createElement(
1188
+ errorMsg && React.createElement(
2237
1189
  'p',
2238
1190
  { className: 'error' },
2239
1191
  errorMsg
2240
1192
  ),
2241
- successMsg && React__default.createElement(
1193
+ successMsg && React.createElement(
2242
1194
  'p',
2243
1195
  { className: 'success' },
2244
1196
  successMsg
2245
1197
  ),
2246
- React__default.createElement(
1198
+ React.createElement(
2247
1199
  'style',
2248
1200
  { jsx: 'true'.toString() },
2249
1201
  ' \n .login {\n margin: 0 auto;\n padding: 1rem;\n border: 1px solid #ccc;\n border-radius: 4px;\n }\n .error {\n color: red;\n margin: 1rem 0 0;\n }\n .success {\n color: green;\n margin: 1rem 0 0;\n }\n '
@@ -2380,7 +1332,7 @@ var isArguments = function isArguments(value) {
2380
1332
  var keysShim;
2381
1333
  if (!Object.keys) {
2382
1334
  // modified from https://github.com/es-shims/es5-shim
2383
- var has$1 = Object.prototype.hasOwnProperty;
1335
+ var has = Object.prototype.hasOwnProperty;
2384
1336
  var toStr$1 = Object.prototype.toString;
2385
1337
  var isArgs = isArguments; // eslint-disable-line global-require
2386
1338
  var isEnumerable = Object.prototype.propertyIsEnumerable;
@@ -2429,7 +1381,7 @@ if (!Object.keys) {
2429
1381
  if (typeof window === 'undefined') { return false; }
2430
1382
  for (var k in window) {
2431
1383
  try {
2432
- if (!excludedKeys['$' + k] && has$1.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
1384
+ if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
2433
1385
  try {
2434
1386
  equalsConstructorPrototype(window[k]);
2435
1387
  } catch (e) {
@@ -2466,7 +1418,7 @@ if (!Object.keys) {
2466
1418
  }
2467
1419
 
2468
1420
  var skipProto = hasProtoEnumBug && isFunction;
2469
- if (isString && object.length > 0 && !has$1.call(object, 0)) {
1421
+ if (isString && object.length > 0 && !has.call(object, 0)) {
2470
1422
  for (var i = 0; i < object.length; ++i) {
2471
1423
  theKeys.push(String(i));
2472
1424
  }
@@ -2478,7 +1430,7 @@ if (!Object.keys) {
2478
1430
  }
2479
1431
  } else {
2480
1432
  for (var name in object) {
2481
- if (!(skipProto && name === 'prototype') && has$1.call(object, name)) {
1433
+ if (!(skipProto && name === 'prototype') && has.call(object, name)) {
2482
1434
  theKeys.push(String(name));
2483
1435
  }
2484
1436
  }
@@ -2488,7 +1440,7 @@ if (!Object.keys) {
2488
1440
  var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
2489
1441
 
2490
1442
  for (var k = 0; k < dontEnums.length; ++k) {
2491
- if (!(skipConstructor && dontEnums[k] === 'constructor') && has$1.call(object, dontEnums[k])) {
1443
+ if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
2492
1444
  theKeys.push(dontEnums[k]);
2493
1445
  }
2494
1446
  }
@@ -2903,16 +1855,16 @@ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
2903
1855
  return value;
2904
1856
  };
2905
1857
 
2906
- var $Function = GetIntrinsic('%Function%');
2907
- var $apply = $Function.apply;
2908
- var $call = $Function.call;
1858
+ var $apply = GetIntrinsic('%Function.prototype.apply%');
1859
+ var $call = GetIntrinsic('%Function.prototype.call%');
1860
+ var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
2909
1861
 
2910
1862
  var callBind = function callBind() {
2911
- return functionBind.apply($call, arguments);
1863
+ return $reflectApply(functionBind, $call, arguments);
2912
1864
  };
2913
1865
 
2914
1866
  var apply = function applyBind() {
2915
- return functionBind.apply($apply, arguments);
1867
+ return $reflectApply(functionBind, $apply, arguments);
2916
1868
  };
2917
1869
  callBind.apply = apply;
2918
1870
 
@@ -3038,7 +1990,7 @@ var Type = function Type(x) {
3038
1990
  }
3039
1991
  };
3040
1992
 
3041
- // https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
1993
+ // https://ecma-international.org/ecma-262/6.0/#sec-ecmascript-data-types-and-values
3042
1994
 
3043
1995
  var Type$1 = function Type$1(x) {
3044
1996
  if (typeof x === 'symbol') {
@@ -3107,42 +2059,62 @@ var IsPropertyKey = function IsPropertyKey(argument) {
3107
2059
  return typeof argument === 'string' || typeof argument === 'symbol';
3108
2060
  };
3109
2061
 
3110
- var regexExec = RegExp.prototype.exec;
3111
- var gOPD = Object.getOwnPropertyDescriptor;
3112
-
3113
- var tryRegexExecCall = function tryRegexExec(value) {
3114
- try {
3115
- var lastIndex = value.lastIndex;
3116
- value.lastIndex = 0; // eslint-disable-line no-param-reassign
2062
+ var hasSymbols$3 = hasSymbols$1();
2063
+ var hasToStringTag = hasSymbols$3 && typeof Symbol.toStringTag === 'symbol';
2064
+ var hasOwnProperty;
2065
+ var regexExec;
2066
+ var isRegexMarker;
2067
+ var badStringifier;
2068
+
2069
+ if (hasToStringTag) {
2070
+ hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
2071
+ regexExec = Function.call.bind(RegExp.prototype.exec);
2072
+ isRegexMarker = {};
2073
+
2074
+ var throwRegexMarker = function () {
2075
+ throw isRegexMarker;
2076
+ };
2077
+ badStringifier = {
2078
+ toString: throwRegexMarker,
2079
+ valueOf: throwRegexMarker
2080
+ };
3117
2081
 
3118
- regexExec.call(value);
3119
- return true;
3120
- } catch (e) {
3121
- return false;
3122
- } finally {
3123
- value.lastIndex = lastIndex; // eslint-disable-line no-param-reassign
2082
+ if (typeof Symbol.toPrimitive === 'symbol') {
2083
+ badStringifier[Symbol.toPrimitive] = throwRegexMarker;
3124
2084
  }
3125
- };
2085
+ }
2086
+
3126
2087
  var toStr$5 = Object.prototype.toString;
2088
+ var gOPD = Object.getOwnPropertyDescriptor;
3127
2089
  var regexClass = '[object RegExp]';
3128
- var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
3129
2090
 
3130
- var isRegex = function isRegex(value) {
3131
- if (!value || typeof value !== 'object') {
3132
- return false;
3133
- }
3134
- if (!hasToStringTag) {
3135
- return toStr$5.call(value) === regexClass;
3136
- }
2091
+ var isRegex = hasToStringTag
2092
+ // eslint-disable-next-line consistent-return
2093
+ ? function isRegex(value) {
2094
+ if (!value || typeof value !== 'object') {
2095
+ return false;
2096
+ }
3137
2097
 
3138
- var descriptor = gOPD(value, 'lastIndex');
3139
- var hasLastIndexDataProperty = descriptor && src(descriptor, 'value');
3140
- if (!hasLastIndexDataProperty) {
3141
- return false;
2098
+ var descriptor = gOPD(value, 'lastIndex');
2099
+ var hasLastIndexDataProperty = descriptor && hasOwnProperty(descriptor, 'value');
2100
+ if (!hasLastIndexDataProperty) {
2101
+ return false;
2102
+ }
2103
+
2104
+ try {
2105
+ regexExec(value, badStringifier);
2106
+ } catch (e) {
2107
+ return e === isRegexMarker;
2108
+ }
3142
2109
  }
2110
+ : function isRegex(value) {
2111
+ // In older browsers, typeof regex incorrectly returns 'function'
2112
+ if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
2113
+ return false;
2114
+ }
3143
2115
 
3144
- return tryRegexExecCall(value);
3145
- };
2116
+ return toStr$5.call(value) === regexClass;
2117
+ };
3146
2118
 
3147
2119
  // http://www.ecma-international.org/ecma-262/5.1/#sec-9.2
3148
2120
 
@@ -3170,6 +2142,23 @@ var IsRegExp = function IsRegExp(argument) {
3170
2142
  };
3171
2143
 
3172
2144
  var fnToStr = Function.prototype.toString;
2145
+ var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
2146
+ var badArrayLike;
2147
+ var isCallableMarker;
2148
+ if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
2149
+ try {
2150
+ badArrayLike = Object.defineProperty({}, 'length', {
2151
+ get: function () {
2152
+ throw isCallableMarker;
2153
+ }
2154
+ });
2155
+ isCallableMarker = {};
2156
+ } catch (_) {
2157
+ reflectApply = null;
2158
+ }
2159
+ } else {
2160
+ reflectApply = null;
2161
+ }
3173
2162
 
3174
2163
  var constructorRegex = /^\s*class\b/;
3175
2164
  var isES6ClassFn = function isES6ClassFunction(value) {
@@ -3195,15 +2184,27 @@ var fnClass = '[object Function]';
3195
2184
  var genClass = '[object GeneratorFunction]';
3196
2185
  var hasToStringTag$1 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
3197
2186
 
3198
- var isCallable = function isCallable(value) {
3199
- if (!value) { return false; }
3200
- if (typeof value !== 'function' && typeof value !== 'object') { return false; }
3201
- if (typeof value === 'function' && !value.prototype) { return true; }
3202
- if (hasToStringTag$1) { return tryFunctionObject(value); }
3203
- if (isES6ClassFn(value)) { return false; }
3204
- var strClass = toStr$6.call(value);
3205
- return strClass === fnClass || strClass === genClass;
3206
- };
2187
+ var isCallable = reflectApply
2188
+ ? function isCallable(value) {
2189
+ if (!value) { return false; }
2190
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
2191
+ if (typeof value === 'function' && !value.prototype) { return true; }
2192
+ try {
2193
+ reflectApply(value, null, badArrayLike);
2194
+ } catch (e) {
2195
+ if (e !== isCallableMarker) { return false; }
2196
+ }
2197
+ return !isES6ClassFn(value);
2198
+ }
2199
+ : function isCallable(value) {
2200
+ if (!value) { return false; }
2201
+ if (typeof value !== 'function' && typeof value !== 'object') { return false; }
2202
+ if (typeof value === 'function' && !value.prototype) { return true; }
2203
+ if (hasToStringTag$1) { return tryFunctionObject(value); }
2204
+ if (isES6ClassFn(value)) { return false; }
2205
+ var strClass = toStr$6.call(value);
2206
+ return strClass === fnClass || strClass === genClass;
2207
+ };
3207
2208
 
3208
2209
  // http://www.ecma-international.org/ecma-262/5.1/#sec-9.11
3209
2210
 
@@ -3369,8 +2370,8 @@ var CreateDataProperty = function CreateDataProperty(O, P, V) {
3369
2370
  throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
3370
2371
  }
3371
2372
  var oldDesc = OrdinaryGetOwnProperty(O, P);
3372
- var extensible = oldDesc || IsExtensible(O);
3373
- var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
2373
+ var extensible = !oldDesc || IsExtensible(O);
2374
+ var immutable = oldDesc && (!oldDesc['[[Writable]]'] || !oldDesc['[[Configurable]]']);
3374
2375
  if (immutable || !extensible) {
3375
2376
  return false;
3376
2377
  }
@@ -3487,10 +2488,10 @@ var $slice = callBound('Array.prototype.slice');
3487
2488
  var $concat$1 = callBound('Array.prototype.concat');
3488
2489
  var $forEach = callBound('Array.prototype.forEach');
3489
2490
 
3490
- var hasSymbols$3 = hasSymbols$1();
2491
+ var hasSymbols$4 = hasSymbols$1();
3491
2492
 
3492
- var kCustomPromisifiedSymbol = hasSymbols$3 ? Symbol('util.promisify.custom') : null;
3493
- var kCustomPromisifyArgsSymbol = hasSymbols$3 ? Symbol('customPromisifyArgs') : null;
2493
+ var kCustomPromisifiedSymbol = hasSymbols$4 ? Symbol('util.promisify.custom') : null;
2494
+ var kCustomPromisifyArgsSymbol = hasSymbols$4 ? Symbol('customPromisifyArgs') : null;
3494
2495
 
3495
2496
  var implementation$3 = function promisify(orig) {
3496
2497
  if (typeof orig !== 'function') {
@@ -3500,7 +2501,7 @@ var implementation$3 = function promisify(orig) {
3500
2501
  throw error;
3501
2502
  }
3502
2503
 
3503
- if (hasSymbols$3 && orig[kCustomPromisifiedSymbol]) {
2504
+ if (hasSymbols$4 && orig[kCustomPromisifiedSymbol]) {
3504
2505
  var customFunction = orig[kCustomPromisifiedSymbol];
3505
2506
  if (typeof customFunction !== 'function') {
3506
2507
  throw new TypeError('The [util.promisify.custom] property must be a function');