@mjhls/mjh-framework 1.0.858 → 1.0.859-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -168
- package/dist/cjs/AD.js +9 -10
- package/dist/cjs/AD300x250.js +11 -11
- package/dist/cjs/AD300x250x600.js +11 -11
- package/dist/cjs/AD728x90.js +12 -12
- package/dist/cjs/ADFloatingFooter.js +13 -13
- package/dist/cjs/ADFooter.js +8 -9
- package/dist/cjs/ADGutter.js +13 -13
- package/dist/cjs/{ADInfeed-ff26342c.js → ADInfeed-98c71bcd.js} +9 -11
- package/dist/cjs/ADSkyscraper.js +13 -13
- package/dist/cjs/ADSponsoredResources.js +13 -13
- package/dist/cjs/ADWebcast.js +13 -13
- package/dist/cjs/ADWelcome.js +17 -17
- package/dist/cjs/{ADlgInfeed-ad4953d4.js → ADlgInfeed-9de32585.js} +6 -7
- package/dist/cjs/AccordionPanel.js +22 -24
- package/dist/cjs/AdSlot.js +15 -15
- package/dist/cjs/AdSlotsProvider.js +903 -11
- package/dist/cjs/AlgoliaSearch.js +14012 -49
- package/dist/cjs/AlphabeticList.js +16 -17
- package/dist/cjs/ArticleCarousel.js +11 -12
- package/dist/cjs/ArticleProgramLandingPage.js +24 -25
- package/dist/cjs/ArticleSeriesLandingPage.js +21 -21
- package/dist/cjs/ArticleSeriesListing.js +41 -41
- package/dist/cjs/Auth.js +1197 -237
- package/dist/cjs/AuthWrapper.js +561 -26
- package/dist/cjs/{AuthorComponent-ac8972ce.js → AuthorComponent-bb831b74.js} +12 -13
- package/dist/cjs/{BlockContent-8b494587.js → BlockContent-091a991f.js} +24 -25
- package/dist/cjs/Breadcrumbs.js +21 -23
- package/dist/cjs/CMEDeck.js +65 -64
- package/dist/cjs/Column1.js +11 -14
- package/dist/cjs/Column2.js +19 -22
- package/dist/cjs/Column3.js +34 -36
- package/dist/cjs/ConferenceArticleCard.js +32 -33
- package/dist/cjs/ConferenceBanner-4a16fddc.js +23 -0
- package/dist/cjs/DeckContent.js +82 -85
- package/dist/cjs/DeckQueue.js +70 -73
- package/dist/cjs/{Dfp-0bf098b5.js → Dfp-26baccf1.js} +23 -23
- package/dist/cjs/EventsDeck.js +134 -141
- package/dist/cjs/ExternalResources.js +48 -49
- package/dist/cjs/Feature.js +23 -25
- package/dist/cjs/ForbesHero.js +34 -35
- package/dist/cjs/GridContent.js +205 -209
- package/dist/cjs/GridHero.js +35 -36
- package/dist/cjs/GroupDeck.js +48 -49
- package/dist/cjs/HamMagazine.js +125 -130
- package/dist/cjs/Header.js +12 -14
- package/dist/cjs/Hero.js +9 -10
- package/dist/cjs/HighlightenVideo.js +16 -17
- package/dist/cjs/HorizontalArticleListing.js +38 -39
- package/dist/cjs/HorizontalHero.js +23 -24
- package/dist/cjs/IssueContentDeck.js +65 -70
- package/dist/cjs/IssueDeck.js +61 -66
- package/dist/cjs/IssueLanding.js +59 -60
- package/dist/cjs/KMTracker.js +15 -15
- package/dist/cjs/LeftNav.js +22 -23
- package/dist/cjs/MasterDeck.js +59 -59
- package/dist/cjs/MediaSeriesLanding.js +909 -801
- package/dist/cjs/NavDvm.js +63 -68
- package/dist/cjs/{NavFooter-3dcd99a8.js → NavFooter-76c913e3.js} +14 -15
- package/dist/cjs/NavMagazine.js +126 -131
- package/dist/cjs/NavNative.js +117 -125
- package/dist/cjs/OncliveHero.js +17 -17
- package/dist/cjs/OncliveLargeHero.js +63 -64
- package/dist/cjs/PageFilter.js +8 -9
- package/dist/cjs/PartnerDetailListing.js +188 -288
- package/dist/cjs/PdfDownload.js +8 -9
- package/dist/cjs/PopUpModal.js +13 -15
- package/dist/cjs/PubSection.js +21 -21
- package/dist/cjs/PubToc.js +7 -8
- package/dist/cjs/PublicationDeck.js +59 -64
- package/dist/cjs/PublicationLanding.js +110 -114
- package/dist/cjs/QueueDeckExpanded.js +287 -286
- package/dist/cjs/RecentNews.js +19 -20
- package/dist/cjs/RelatedContent.js +50 -51
- package/dist/cjs/RelatedTopicsDropdown.js +29 -32
- package/dist/cjs/RolesDeck.js +27 -32
- package/dist/cjs/Search.js +12 -16
- package/dist/cjs/SeriesListingDeck.js +27 -26
- package/dist/cjs/{SeriesSlider-60fa1342.js → SeriesSlider-8bbc989f.js} +37 -38
- package/dist/cjs/SideFooter.js +25 -26
- package/dist/cjs/SocialIcons.js +9 -10
- package/dist/cjs/{SocialSearchComponent-19548e2a.js → SocialSearchComponent-cea213aa.js} +34 -38
- package/dist/cjs/SocialShare.js +29 -31
- package/dist/cjs/TaxonomyCard.js +55 -60
- package/dist/cjs/TaxonomyDescription.js +23 -24
- package/dist/cjs/TemplateNormal.js +36 -36
- package/dist/cjs/ThumbnailCard.js +17 -19
- package/dist/cjs/Ustream.js +21 -22
- package/dist/cjs/VerticalHero.js +15 -16
- package/dist/cjs/VideoProgramLandingPage.js +41 -45
- package/dist/cjs/VideoSeriesCard.js +23 -24
- package/dist/cjs/VideoSeriesFilter.js +9 -9
- package/dist/cjs/VideoSeriesLandingPage.js +26 -26
- package/dist/cjs/VideoSeriesListing.js +58 -58
- package/dist/cjs/View.js +219 -225
- package/dist/cjs/YahooHero.js +30 -31
- package/dist/cjs/YoutubeGroup.js +54 -55
- package/dist/cjs/{brightcove-react-player-loader.es-5c98aec7.js → brightcove-react-player-loader.es-156bd4d6.js} +8 -10
- package/dist/cjs/events-1b438fe7.js +469 -0
- package/dist/cjs/{extends-60837c34.js → extends-0a918631.js} +1 -0
- package/dist/cjs/faundadb.js +1 -1
- package/dist/cjs/getRelatedArticle.js +131 -67
- package/dist/cjs/getSerializers.js +13 -13
- package/dist/cjs/{getTargeting-3e45e4d4.js → getTargeting-f1821260.js} +11 -11
- package/dist/cjs/getTargeting.js +2 -2
- package/dist/cjs/iconBase-68959171.js +3 -0
- package/dist/cjs/{index-99edf08a.js → index-3294d3bc.js} +1 -1
- package/dist/cjs/{index-9d365128.js → index-96b3db50.js} +10 -12
- package/dist/cjs/{index-44481153.js → index-98e01cb9.js} +47 -494
- package/dist/cjs/{index-646379c4.js → index-998ad42c.js} +1204 -954
- package/dist/cjs/{index-b5eb3ff8.js → index-be0c82be.js} +19 -20
- package/dist/cjs/index-e2e62963.js +89 -0
- package/dist/cjs/{index.es-f3e47207.js → index.es-9110add6.js} +12 -31
- package/dist/cjs/{index.esm-3ffa049c.js → index.esm-4d410430.js} +20 -20
- package/dist/cjs/{index.esm-974f47d9.js → index.esm-90433435.js} +15 -6
- package/dist/cjs/{index.esm-44f3e2d0.js → index.esm-e32d3e8e.js} +6 -3
- package/dist/cjs/{index.esm-05850a2f.js → index.esm-ff47db6f.js} +12 -5
- package/dist/cjs/index.js +61 -65
- package/dist/cjs/{inherits-87492b40.js → inherits-452ff02c.js} +4 -1
- package/dist/cjs/inherits-8d29278d.js +110 -0
- package/dist/cjs/{lodash-7fd85bcf.js → lodash-fc2922d0.js} +22 -71
- package/dist/cjs/{main-7b5e57b0.js → main-02daeefe.js} +54 -90
- package/dist/cjs/{md5-e1ca5797.js → md5-5039b1a6.js} +1 -1
- package/dist/cjs/{moment-ca3bd9fb.js → moment-575fe24c.js} +8 -10
- package/dist/cjs/{react-social-icons-07939b41.js → react-social-icons-f7f48f71.js} +11 -12
- package/dist/cjs/timeDifferenceCalc.js +1 -1
- package/dist/cjs/{typeof-9d7f610f.js → typeof-725500bc.js} +1 -1
- package/dist/cjs/urlFor.js +3 -3
- package/dist/cjs/{visibility-sensor-eb2c5b69.js → visibility-sensor-ad5e3116.js} +5 -7
- package/dist/esm/AD.js +7 -7
- package/dist/esm/AD300x250.js +9 -8
- package/dist/esm/AD300x250x600.js +9 -8
- package/dist/esm/AD728x90.js +10 -9
- package/dist/esm/ADFloatingFooter.js +11 -10
- package/dist/esm/ADFooter.js +6 -6
- package/dist/esm/ADGutter.js +11 -10
- package/dist/esm/{ADInfeed-422ad6e6.js → ADInfeed-1cc9d817.js} +7 -7
- package/dist/esm/ADSkyscraper.js +11 -10
- package/dist/esm/ADSponsoredResources.js +11 -10
- package/dist/esm/ADWebcast.js +11 -10
- package/dist/esm/ADWelcome.js +15 -14
- package/dist/esm/{ADlgInfeed-f7468db8.js → ADlgInfeed-8c4f129e.js} +4 -4
- package/dist/esm/AccordionPanel.js +17 -17
- package/dist/esm/AdSlot.js +7 -6
- package/dist/esm/AdSlotsProvider.js +903 -10
- package/dist/esm/AlgoliaSearch.js +14005 -41
- package/dist/esm/AlphabeticList.js +14 -14
- package/dist/esm/ArticleCarousel.js +9 -9
- package/dist/esm/ArticleProgramLandingPage.js +22 -22
- package/dist/esm/ArticleSeriesLandingPage.js +19 -18
- package/dist/esm/ArticleSeriesListing.js +38 -37
- package/dist/esm/Auth.js +1181 -217
- package/dist/esm/AuthWrapper.js +561 -24
- package/dist/esm/{AuthorComponent-8ffd4679.js → AuthorComponent-34b16174.js} +10 -10
- package/dist/esm/{BlockContent-d05b5b23.js → BlockContent-e9b4ddcf.js} +4 -4
- package/dist/esm/Breadcrumbs.js +11 -11
- package/dist/esm/CMEDeck.js +62 -61
- package/dist/esm/Column1.js +9 -9
- package/dist/esm/Column2.js +17 -17
- package/dist/esm/Column3.js +32 -31
- package/dist/esm/ConferenceArticleCard.js +30 -30
- package/dist/esm/{ConferenceBanner-9162d0ca.js → ConferenceBanner-8792ebd2.js} +4 -4
- package/dist/esm/DeckContent.js +78 -77
- package/dist/esm/DeckQueue.js +66 -65
- package/dist/esm/{Dfp-85c9513e.js → Dfp-b7236041.js} +11 -10
- package/dist/esm/EventsDeck.js +110 -110
- package/dist/esm/ExternalResources.js +43 -43
- package/dist/esm/Feature.js +17 -17
- package/dist/esm/ForbesHero.js +28 -28
- package/dist/esm/GridContent.js +174 -173
- package/dist/esm/GridHero.js +29 -29
- package/dist/esm/GroupDeck.js +36 -36
- package/dist/esm/HamMagazine.js +100 -100
- package/dist/esm/Header.js +8 -8
- package/dist/esm/Hero.js +7 -7
- package/dist/esm/HighlightenVideo.js +14 -14
- package/dist/esm/HorizontalArticleListing.js +36 -36
- package/dist/esm/HorizontalHero.js +21 -21
- package/dist/esm/IssueContentDeck.js +53 -53
- package/dist/esm/IssueDeck.js +55 -55
- package/dist/esm/IssueLanding.js +57 -57
- package/dist/esm/KMTracker.js +15 -15
- package/dist/esm/LeftNav.js +18 -17
- package/dist/esm/MasterDeck.js +56 -55
- package/dist/esm/MediaSeriesLanding.js +672 -561
- package/dist/esm/NavDvm.js +46 -46
- package/dist/esm/{NavFooter-c29526b7.js → NavFooter-e27bd93b.js} +12 -12
- package/dist/esm/NavMagazine.js +103 -103
- package/dist/esm/NavNative.js +92 -92
- package/dist/esm/OncliveHero.js +15 -14
- package/dist/esm/OncliveLargeHero.js +52 -52
- package/dist/esm/PageFilter.js +6 -6
- package/dist/esm/PartnerDetailListing.js +79 -178
- package/dist/esm/PdfDownload.js +6 -6
- package/dist/esm/PopUpModal.js +8 -8
- package/dist/esm/PubSection.js +19 -18
- package/dist/esm/PubToc.js +5 -5
- package/dist/esm/PublicationDeck.js +51 -51
- package/dist/esm/PublicationLanding.js +96 -96
- package/dist/esm/QueueDeckExpanded.js +253 -252
- package/dist/esm/RecentNews.js +17 -17
- package/dist/esm/RelatedContent.js +45 -45
- package/dist/esm/RelatedTopicsDropdown.js +21 -21
- package/dist/esm/RolesDeck.js +25 -25
- package/dist/esm/Search.js +7 -7
- package/dist/esm/SeriesListingDeck.js +22 -21
- package/dist/esm/{SeriesSlider-05ecb544.js → SeriesSlider-a866bb21.js} +28 -28
- package/dist/esm/SideFooter.js +21 -21
- package/dist/esm/SocialIcons.js +7 -7
- package/dist/esm/{SocialSearchComponent-47815365.js → SocialSearchComponent-03c3e869.js} +28 -28
- package/dist/esm/SocialShare.js +25 -25
- package/dist/esm/TaxonomyCard.js +51 -51
- package/dist/esm/TaxonomyDescription.js +18 -18
- package/dist/esm/TemplateNormal.js +33 -32
- package/dist/esm/ThumbnailCard.js +10 -10
- package/dist/esm/Ustream.js +18 -18
- package/dist/esm/VerticalHero.js +13 -13
- package/dist/esm/VideoProgramLandingPage.js +34 -34
- package/dist/esm/VideoSeriesCard.js +18 -18
- package/dist/esm/VideoSeriesFilter.js +6 -6
- package/dist/esm/VideoSeriesLandingPage.js +19 -18
- package/dist/esm/VideoSeriesListing.js +55 -54
- package/dist/esm/View.js +202 -204
- package/dist/esm/YahooHero.js +25 -25
- package/dist/esm/YoutubeGroup.js +39 -39
- package/dist/esm/{brightcove-react-player-loader.es-4abff0b1.js → brightcove-react-player-loader.es-83f53e4e.js} +6 -7
- package/dist/esm/events-6c3a7a63.js +467 -0
- package/dist/esm/{extends-eb69e8ac.js → extends-6f2fcc99.js} +1 -1
- package/dist/esm/faundadb.js +1 -1
- package/dist/esm/getRelatedArticle.js +126 -62
- package/dist/esm/getSerializers.js +13 -13
- package/dist/esm/{getTargeting-9cb7e014.js → getTargeting-bd800589.js} +10 -10
- package/dist/esm/getTargeting.js +2 -2
- package/dist/esm/{index-d1dee060.js → index-2fccaa7f.js} +1162 -901
- package/dist/esm/{index-1819118a.js → index-41a678ea.js} +41 -487
- package/dist/esm/{index-6c12bdd5.js → index-5f7e79e7.js} +4 -4
- package/dist/esm/{index-51a80699.js → index-73819142.js} +19 -20
- package/dist/esm/index-aaa2dae0.js +85 -0
- package/dist/esm/{index-fa2ffe86.js → index-ef6d5dcf.js} +1 -1
- package/dist/esm/{index.es-c6222053.js → index.es-29c1cef5.js} +10 -28
- package/dist/esm/{index.esm-3fdda599.js → index.esm-29e48d38.js} +15 -6
- package/dist/esm/{index.esm-a8ff922c.js → index.esm-cf08bf18.js} +12 -5
- package/dist/esm/{index.esm-c6715e80.js → index.esm-f8aaeeeb.js} +6 -3
- package/dist/esm/{index.esm-8ee5ff72.js → index.esm-fd746768.js} +18 -17
- package/dist/esm/index.js +53 -54
- package/dist/esm/inherits-77d5e4fc.js +101 -0
- package/dist/esm/{inherits-0d8cda6e.js → inherits-cf8dde54.js} +2 -2
- package/dist/esm/{lodash-ec8c6b48.js → lodash-17fdfebb.js} +22 -71
- package/dist/esm/{main-747e7d25.js → main-e4a934b2.js} +52 -87
- package/dist/esm/{md5-4e42248e.js → md5-9be0e905.js} +1 -1
- package/dist/esm/{moment-b6f49411.js → moment-e2f9b20c.js} +8 -10
- package/dist/esm/{react-social-icons-3822f1ce.js → react-social-icons-a7d5c5c7.js} +5 -5
- package/dist/esm/timeDifferenceCalc.js +1 -1
- package/dist/esm/{typeof-af9c50d8.js → typeof-6435ba1c.js} +1 -1
- package/dist/esm/urlFor.js +1 -1
- package/dist/esm/{visibility-sensor-f40c2564.js → visibility-sensor-72fd8f8b.js} +2 -2
- package/package.json +110 -110
- package/dist/cjs/ConferenceBanner-6c9e718a.js +0 -24
package/dist/cjs/Auth.js
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
+
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
|
6
|
+
|
|
5
7
|
var _commonjsHelpers = require('./_commonjsHelpers-06173234.js');
|
|
6
8
|
require('./_to-object-329a650b.js');
|
|
7
9
|
require('./es6.string.iterator-cc0bbaa4.js');
|
|
@@ -9,28 +11,21 @@ require('./_library-dd23b178.js');
|
|
|
9
11
|
require('./_iter-detect-60b2f026.js');
|
|
10
12
|
require('./core.get-iterator-method-f62321d4.js');
|
|
11
13
|
require('./_object-pie-68c5bcbc.js');
|
|
12
|
-
var _extends = require('./extends-
|
|
14
|
+
var _extends$1 = require('./extends-0a918631.js');
|
|
13
15
|
require('./web.dom.iterable-a0e279c1.js');
|
|
14
16
|
var React = require('react');
|
|
17
|
+
var React__default = _interopDefault(React);
|
|
15
18
|
var Router = require('next/router');
|
|
19
|
+
var Router__default = _interopDefault(Router);
|
|
16
20
|
var slicedToArray = require('./slicedToArray-8f385299.js');
|
|
17
21
|
var stringify = require('./stringify-7c5aff47.js');
|
|
18
22
|
var asyncToGenerator = require('./asyncToGenerator-140e5f89.js');
|
|
19
23
|
var reactBootstrap = require('react-bootstrap');
|
|
20
24
|
var util = require('./util-f2c1b65b.js');
|
|
21
|
-
var index = require('./index-bd6c9f56.js');
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var md5 = require('./md5-e1ca5797.js');
|
|
26
|
-
|
|
27
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
28
|
-
|
|
29
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
30
|
-
var Router__default = /*#__PURE__*/_interopDefaultLegacy(Router);
|
|
31
|
-
var useSWR__default = /*#__PURE__*/_interopDefaultLegacy(useSWR);
|
|
32
|
-
var Local__default = /*#__PURE__*/_interopDefaultLegacy(Local);
|
|
33
|
-
var mysql__default = /*#__PURE__*/_interopDefaultLegacy(mysql);
|
|
25
|
+
var index$6 = require('./index-bd6c9f56.js');
|
|
26
|
+
var Local = _interopDefault(require('passport-local'));
|
|
27
|
+
var mysql = _interopDefault(require('mysql'));
|
|
28
|
+
var md5 = require('./md5-5039b1a6.js');
|
|
34
29
|
|
|
35
30
|
var returnFormField = function returnFormField(_ref) {
|
|
36
31
|
var name = _ref.name,
|
|
@@ -69,21 +64,21 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
69
64
|
}
|
|
70
65
|
|
|
71
66
|
if (type == 'text' || type == 'email' || type == 'password' || type == 'number') {
|
|
72
|
-
return React__default
|
|
67
|
+
return React__default.createElement(
|
|
73
68
|
reactBootstrap.Form.Group,
|
|
74
|
-
_extends._extends({}, opts, { controlId: name }),
|
|
75
|
-
React__default
|
|
69
|
+
_extends$1._extends({}, opts, { controlId: name }),
|
|
70
|
+
React__default.createElement(
|
|
76
71
|
reactBootstrap.Form.Label,
|
|
77
72
|
{ kye: name + '_label' },
|
|
78
73
|
label,
|
|
79
|
-
required && React__default
|
|
74
|
+
required && React__default.createElement(
|
|
80
75
|
'span',
|
|
81
76
|
{ style: { color: 'red' } },
|
|
82
77
|
'*'
|
|
83
78
|
)
|
|
84
79
|
),
|
|
85
|
-
React__default
|
|
86
|
-
React__default
|
|
80
|
+
React__default.createElement(reactBootstrap.Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
|
|
81
|
+
React__default.createElement(
|
|
87
82
|
reactBootstrap.Form.Control.Feedback,
|
|
88
83
|
{ key: name + '_feedback', type: 'invalid' },
|
|
89
84
|
errors[name]
|
|
@@ -91,28 +86,28 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
91
86
|
);
|
|
92
87
|
}
|
|
93
88
|
if (type == 'select') {
|
|
94
|
-
return React__default
|
|
89
|
+
return React__default.createElement(
|
|
95
90
|
reactBootstrap.Form.Group,
|
|
96
|
-
_extends._extends({}, opts, { key: name, controlId: name }),
|
|
97
|
-
React__default
|
|
91
|
+
_extends$1._extends({}, opts, { key: name, controlId: name }),
|
|
92
|
+
React__default.createElement(
|
|
98
93
|
reactBootstrap.Form.Label,
|
|
99
94
|
{ key: name + '_' + label },
|
|
100
95
|
label,
|
|
101
|
-
required && React__default
|
|
96
|
+
required && React__default.createElement(
|
|
102
97
|
'span',
|
|
103
98
|
{ key: name + '_required_span', style: { color: 'red' } },
|
|
104
99
|
'*'
|
|
105
100
|
)
|
|
106
101
|
),
|
|
107
|
-
React__default
|
|
102
|
+
React__default.createElement(
|
|
108
103
|
reactBootstrap.Form.Control,
|
|
109
104
|
{ key: name + '_select', as: 'select', name: name, required: required, defaultValue: default_value },
|
|
110
|
-
React__default
|
|
105
|
+
React__default.createElement('option', { value: '', key: name + '_options_empty' }),
|
|
111
106
|
options.map(function (option, index) {
|
|
112
107
|
var value = option.value ? option.value : option;
|
|
113
108
|
var label = option.label ? option.label : option;
|
|
114
109
|
var key = name + '_options_' + index;
|
|
115
|
-
return React__default
|
|
110
|
+
return React__default.createElement(
|
|
116
111
|
'option',
|
|
117
112
|
{ key: key, value: value },
|
|
118
113
|
label
|
|
@@ -123,31 +118,1080 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
123
118
|
}
|
|
124
119
|
|
|
125
120
|
if (type == 'radio' || type == 'checkbox') {
|
|
126
|
-
return React__default
|
|
121
|
+
return React__default.createElement(
|
|
127
122
|
reactBootstrap.Form.Group,
|
|
128
123
|
opts,
|
|
129
|
-
React__default
|
|
124
|
+
React__default.createElement(
|
|
130
125
|
reactBootstrap.Form.Label,
|
|
131
126
|
null,
|
|
132
127
|
label,
|
|
133
|
-
required && React__default
|
|
128
|
+
required && React__default.createElement(
|
|
134
129
|
'span',
|
|
135
130
|
{ style: { color: 'red' } },
|
|
136
131
|
'*'
|
|
137
132
|
)
|
|
138
133
|
),
|
|
139
134
|
options.map(function (option, index) {
|
|
140
|
-
return React__default
|
|
135
|
+
return React__default.createElement(
|
|
141
136
|
reactBootstrap.Form.Check,
|
|
142
137
|
{ type: type, key: index, required: required },
|
|
143
|
-
React__default
|
|
144
|
-
React__default
|
|
138
|
+
React__default.createElement(reactBootstrap.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 }),
|
|
139
|
+
React__default.createElement(reactBootstrap.Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
|
|
145
140
|
);
|
|
146
141
|
})
|
|
147
142
|
);
|
|
148
143
|
}
|
|
149
144
|
};
|
|
150
145
|
|
|
146
|
+
var has = Object.prototype.hasOwnProperty;
|
|
147
|
+
|
|
148
|
+
function dequal(foo, bar) {
|
|
149
|
+
var ctor, len;
|
|
150
|
+
if (foo === bar) return true;
|
|
151
|
+
|
|
152
|
+
if (foo && bar && (ctor=foo.constructor) === bar.constructor) {
|
|
153
|
+
if (ctor === Date) return foo.getTime() === bar.getTime();
|
|
154
|
+
if (ctor === RegExp) return foo.toString() === bar.toString();
|
|
155
|
+
|
|
156
|
+
if (ctor === Array) {
|
|
157
|
+
if ((len=foo.length) === bar.length) {
|
|
158
|
+
while (len-- && dequal(foo[len], bar[len]));
|
|
159
|
+
}
|
|
160
|
+
return len === -1;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (!ctor || typeof foo === 'object') {
|
|
164
|
+
len = 0;
|
|
165
|
+
for (ctor in foo) {
|
|
166
|
+
if (has.call(foo, ctor) && ++len && !has.call(bar, ctor)) return false;
|
|
167
|
+
if (!(ctor in bar) || !dequal(foo[ctor], bar[ctor])) return false;
|
|
168
|
+
}
|
|
169
|
+
return Object.keys(bar).length === len;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return foo !== foo && bar !== bar;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// use WeakMap to store the object->key mapping
|
|
177
|
+
// so the objects can be garbage collected.
|
|
178
|
+
// WeakMap uses a hashtable under the hood, so the lookup
|
|
179
|
+
// complexity is almost O(1).
|
|
180
|
+
var table = new WeakMap();
|
|
181
|
+
// counter of the key
|
|
182
|
+
var counter = 0;
|
|
183
|
+
// hashes an array of objects and returns a string
|
|
184
|
+
function hash(args) {
|
|
185
|
+
if (!args.length)
|
|
186
|
+
return '';
|
|
187
|
+
var key = 'arg';
|
|
188
|
+
for (var i = 0; i < args.length; ++i) {
|
|
189
|
+
if (args[i] === null) {
|
|
190
|
+
key += '@null';
|
|
191
|
+
continue;
|
|
192
|
+
}
|
|
193
|
+
var _hash = void 0;
|
|
194
|
+
if (typeof args[i] !== 'object' && typeof args[i] !== 'function') {
|
|
195
|
+
// need to consider the case that args[i] is a string:
|
|
196
|
+
// args[i] _hash
|
|
197
|
+
// "undefined" -> '"undefined"'
|
|
198
|
+
// undefined -> 'undefined'
|
|
199
|
+
// 123 -> '123'
|
|
200
|
+
// "null" -> '"null"'
|
|
201
|
+
if (typeof args[i] === 'string') {
|
|
202
|
+
_hash = '"' + args[i] + '"';
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
_hash = String(args[i]);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
else {
|
|
209
|
+
if (!table.has(args[i])) {
|
|
210
|
+
_hash = counter;
|
|
211
|
+
table.set(args[i], counter++);
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
_hash = table.get(args[i]);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
key += '@' + _hash;
|
|
218
|
+
}
|
|
219
|
+
return key;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
var Cache = /** @class */ (function () {
|
|
223
|
+
function Cache(initialData) {
|
|
224
|
+
if (initialData === void 0) { initialData = {}; }
|
|
225
|
+
this.cache = new Map(Object.entries(initialData));
|
|
226
|
+
this.subs = [];
|
|
227
|
+
}
|
|
228
|
+
Cache.prototype.get = function (key) {
|
|
229
|
+
var _key = this.serializeKey(key)[0];
|
|
230
|
+
return this.cache.get(_key);
|
|
231
|
+
};
|
|
232
|
+
Cache.prototype.set = function (key, value) {
|
|
233
|
+
var _key = this.serializeKey(key)[0];
|
|
234
|
+
this.cache.set(_key, value);
|
|
235
|
+
this.notify();
|
|
236
|
+
};
|
|
237
|
+
Cache.prototype.keys = function () {
|
|
238
|
+
return Array.from(this.cache.keys());
|
|
239
|
+
};
|
|
240
|
+
Cache.prototype.has = function (key) {
|
|
241
|
+
var _key = this.serializeKey(key)[0];
|
|
242
|
+
return this.cache.has(_key);
|
|
243
|
+
};
|
|
244
|
+
Cache.prototype.clear = function () {
|
|
245
|
+
this.cache.clear();
|
|
246
|
+
this.notify();
|
|
247
|
+
};
|
|
248
|
+
Cache.prototype.delete = function (key) {
|
|
249
|
+
var _key = this.serializeKey(key)[0];
|
|
250
|
+
this.cache.delete(_key);
|
|
251
|
+
this.notify();
|
|
252
|
+
};
|
|
253
|
+
// TODO: introduce namespace for the cache
|
|
254
|
+
Cache.prototype.serializeKey = function (key) {
|
|
255
|
+
var args = null;
|
|
256
|
+
if (typeof key === 'function') {
|
|
257
|
+
try {
|
|
258
|
+
key = key();
|
|
259
|
+
}
|
|
260
|
+
catch (err) {
|
|
261
|
+
// dependencies not ready
|
|
262
|
+
key = '';
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
if (Array.isArray(key)) {
|
|
266
|
+
// args array
|
|
267
|
+
args = key;
|
|
268
|
+
key = hash(key);
|
|
269
|
+
}
|
|
270
|
+
else {
|
|
271
|
+
// convert null to ''
|
|
272
|
+
key = String(key || '');
|
|
273
|
+
}
|
|
274
|
+
var errorKey = key ? 'err@' + key : '';
|
|
275
|
+
var isValidatingKey = key ? 'validating@' + key : '';
|
|
276
|
+
return [key, args, errorKey, isValidatingKey];
|
|
277
|
+
};
|
|
278
|
+
Cache.prototype.subscribe = function (listener) {
|
|
279
|
+
var _this = this;
|
|
280
|
+
if (typeof listener !== 'function') {
|
|
281
|
+
throw new Error('Expected the listener to be a function.');
|
|
282
|
+
}
|
|
283
|
+
var isSubscribed = true;
|
|
284
|
+
this.subs.push(listener);
|
|
285
|
+
return function () {
|
|
286
|
+
if (!isSubscribed)
|
|
287
|
+
return;
|
|
288
|
+
isSubscribed = false;
|
|
289
|
+
var index = _this.subs.indexOf(listener);
|
|
290
|
+
if (index > -1) {
|
|
291
|
+
_this.subs[index] = _this.subs[_this.subs.length - 1];
|
|
292
|
+
_this.subs.length--;
|
|
293
|
+
}
|
|
294
|
+
};
|
|
295
|
+
};
|
|
296
|
+
// Notify Cache subscribers about a change in the cache
|
|
297
|
+
Cache.prototype.notify = function () {
|
|
298
|
+
for (var _i = 0, _a = this.subs; _i < _a.length; _i++) {
|
|
299
|
+
var listener = _a[_i];
|
|
300
|
+
listener();
|
|
301
|
+
}
|
|
302
|
+
};
|
|
303
|
+
return Cache;
|
|
304
|
+
}());
|
|
305
|
+
|
|
306
|
+
/**
|
|
307
|
+
* Due to bug https://bugs.chromium.org/p/chromium/issues/detail?id=678075,
|
|
308
|
+
* it's not reliable to detect if the browser is currently online or offline
|
|
309
|
+
* based on `navigator.onLine`.
|
|
310
|
+
* As a work around, we always assume it's online on first load, and change
|
|
311
|
+
* the status upon `online` or `offline` events.
|
|
312
|
+
*/
|
|
313
|
+
var online = true;
|
|
314
|
+
var isOnline = function () { return online; };
|
|
315
|
+
var isDocumentVisible = function () {
|
|
316
|
+
if (typeof document !== 'undefined' &&
|
|
317
|
+
document.visibilityState !== undefined) {
|
|
318
|
+
return document.visibilityState !== 'hidden';
|
|
319
|
+
}
|
|
320
|
+
// always assume it's visible
|
|
321
|
+
return true;
|
|
322
|
+
};
|
|
323
|
+
var fetcher = function (url) { return fetch(url).then(function (res) { return res.json(); }); };
|
|
324
|
+
var registerOnFocus = function (cb) {
|
|
325
|
+
if (typeof window !== 'undefined' &&
|
|
326
|
+
window.addEventListener !== undefined &&
|
|
327
|
+
typeof document !== 'undefined' &&
|
|
328
|
+
document.addEventListener !== undefined) {
|
|
329
|
+
// focus revalidate
|
|
330
|
+
document.addEventListener('visibilitychange', function () { return cb(); }, false);
|
|
331
|
+
window.addEventListener('focus', function () { return cb(); }, false);
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
var registerOnReconnect = function (cb) {
|
|
335
|
+
if (typeof window !== 'undefined' && window.addEventListener !== undefined) {
|
|
336
|
+
// reconnect revalidate
|
|
337
|
+
window.addEventListener('online', function () {
|
|
338
|
+
online = true;
|
|
339
|
+
cb();
|
|
340
|
+
}, false);
|
|
341
|
+
// nothing to revalidate, just update the status
|
|
342
|
+
window.addEventListener('offline', function () { return (online = false); }, false);
|
|
343
|
+
}
|
|
344
|
+
};
|
|
345
|
+
var webPreset = {
|
|
346
|
+
isOnline: isOnline,
|
|
347
|
+
isDocumentVisible: isDocumentVisible,
|
|
348
|
+
fetcher: fetcher,
|
|
349
|
+
registerOnFocus: registerOnFocus,
|
|
350
|
+
registerOnReconnect: registerOnReconnect
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
var __assign = (undefined && undefined.__assign) || function () {
|
|
354
|
+
__assign = Object.assign || function(t) {
|
|
355
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
356
|
+
s = arguments[i];
|
|
357
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
358
|
+
t[p] = s[p];
|
|
359
|
+
}
|
|
360
|
+
return t;
|
|
361
|
+
};
|
|
362
|
+
return __assign.apply(this, arguments);
|
|
363
|
+
};
|
|
364
|
+
// cache
|
|
365
|
+
var cache = new Cache();
|
|
366
|
+
// error retry
|
|
367
|
+
function onErrorRetry(_, __, config, revalidate, opts) {
|
|
368
|
+
if (!config.isDocumentVisible()) {
|
|
369
|
+
// if it's hidden, stop
|
|
370
|
+
// it will auto revalidate when focus
|
|
371
|
+
return;
|
|
372
|
+
}
|
|
373
|
+
if (typeof config.errorRetryCount === 'number' &&
|
|
374
|
+
opts.retryCount > config.errorRetryCount) {
|
|
375
|
+
return;
|
|
376
|
+
}
|
|
377
|
+
// exponential backoff
|
|
378
|
+
var count = Math.min(opts.retryCount, 8);
|
|
379
|
+
var timeout = ~~((Math.random() + 0.5) * (1 << count)) * config.errorRetryInterval;
|
|
380
|
+
setTimeout(revalidate, timeout, opts);
|
|
381
|
+
}
|
|
382
|
+
// client side: need to adjust the config
|
|
383
|
+
// based on the browser status
|
|
384
|
+
// slow connection (<= 70Kbps)
|
|
385
|
+
var slowConnection = typeof window !== 'undefined' &&
|
|
386
|
+
// @ts-ignore
|
|
387
|
+
navigator['connection'] &&
|
|
388
|
+
// @ts-ignore
|
|
389
|
+
['slow-2g', '2g'].indexOf(navigator['connection'].effectiveType) !== -1;
|
|
390
|
+
// config
|
|
391
|
+
var defaultConfig = __assign({
|
|
392
|
+
// events
|
|
393
|
+
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);
|
|
394
|
+
|
|
395
|
+
var IS_SERVER = typeof window === 'undefined' ||
|
|
396
|
+
// @ts-ignore
|
|
397
|
+
!!(typeof Deno !== 'undefined' && Deno && Deno.version && Deno.version.deno);
|
|
398
|
+
// polyfill for requestAnimationFrame
|
|
399
|
+
var rAF = IS_SERVER
|
|
400
|
+
? null
|
|
401
|
+
: window['requestAnimationFrame']
|
|
402
|
+
? function (f) { return window['requestAnimationFrame'](f); }
|
|
403
|
+
: function (f) { return setTimeout(f, 1); };
|
|
404
|
+
// React currently throws a warning when using useLayoutEffect on the server.
|
|
405
|
+
// To get around it, we can conditionally useEffect on the server (no-op) and
|
|
406
|
+
// useLayoutEffect in the browser.
|
|
407
|
+
var useIsomorphicLayoutEffect = IS_SERVER ? React.useEffect : React.useLayoutEffect;
|
|
408
|
+
|
|
409
|
+
var SWRConfigContext = React.createContext({});
|
|
410
|
+
SWRConfigContext.displayName = 'SWRConfigContext';
|
|
411
|
+
|
|
412
|
+
var __awaiter = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
413
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
414
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
415
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
416
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
417
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
418
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
419
|
+
});
|
|
420
|
+
};
|
|
421
|
+
var __generator = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
422
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
423
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
424
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
425
|
+
function step(op) {
|
|
426
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
427
|
+
while (_) try {
|
|
428
|
+
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;
|
|
429
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
430
|
+
switch (op[0]) {
|
|
431
|
+
case 0: case 1: t = op; break;
|
|
432
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
433
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
434
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
435
|
+
default:
|
|
436
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
437
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
438
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
439
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
440
|
+
if (t[2]) _.ops.pop();
|
|
441
|
+
_.trys.pop(); continue;
|
|
442
|
+
}
|
|
443
|
+
op = body.call(thisArg, _);
|
|
444
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
445
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
446
|
+
}
|
|
447
|
+
};
|
|
448
|
+
// global state managers
|
|
449
|
+
var CONCURRENT_PROMISES = {};
|
|
450
|
+
var CONCURRENT_PROMISES_TS = {};
|
|
451
|
+
var FOCUS_REVALIDATORS = {};
|
|
452
|
+
var RECONNECT_REVALIDATORS = {};
|
|
453
|
+
var CACHE_REVALIDATORS = {};
|
|
454
|
+
var MUTATION_TS = {};
|
|
455
|
+
var MUTATION_END_TS = {};
|
|
456
|
+
// generate strictly increasing timestamps
|
|
457
|
+
var now = (function () {
|
|
458
|
+
var ts = 0;
|
|
459
|
+
return function () { return ++ts; };
|
|
460
|
+
})();
|
|
461
|
+
// setup DOM events listeners for `focus` and `reconnect` actions
|
|
462
|
+
if (!IS_SERVER) {
|
|
463
|
+
var revalidate_1 = function (revalidators) {
|
|
464
|
+
if (!defaultConfig.isDocumentVisible() || !defaultConfig.isOnline())
|
|
465
|
+
return;
|
|
466
|
+
for (var key in revalidators) {
|
|
467
|
+
if (revalidators[key][0])
|
|
468
|
+
revalidators[key][0]();
|
|
469
|
+
}
|
|
470
|
+
};
|
|
471
|
+
if (typeof defaultConfig.registerOnFocus === 'function') {
|
|
472
|
+
defaultConfig.registerOnFocus(function () { return revalidate_1(FOCUS_REVALIDATORS); });
|
|
473
|
+
}
|
|
474
|
+
if (typeof defaultConfig.registerOnReconnect === 'function') {
|
|
475
|
+
defaultConfig.registerOnReconnect(function () { return revalidate_1(RECONNECT_REVALIDATORS); });
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
var trigger = function (_key, shouldRevalidate) {
|
|
479
|
+
if (shouldRevalidate === void 0) { shouldRevalidate = true; }
|
|
480
|
+
// we are ignoring the second argument which correspond to the arguments
|
|
481
|
+
// the fetcher will receive when key is an array
|
|
482
|
+
var _a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2], keyValidating = _a[3];
|
|
483
|
+
if (!key)
|
|
484
|
+
return Promise.resolve();
|
|
485
|
+
var updaters = CACHE_REVALIDATORS[key];
|
|
486
|
+
if (key && updaters) {
|
|
487
|
+
var currentData = cache.get(key);
|
|
488
|
+
var currentError = cache.get(keyErr);
|
|
489
|
+
var currentIsValidating = cache.get(keyValidating);
|
|
490
|
+
var promises = [];
|
|
491
|
+
for (var i = 0; i < updaters.length; ++i) {
|
|
492
|
+
promises.push(updaters[i](shouldRevalidate, currentData, currentError, currentIsValidating, i > 0));
|
|
493
|
+
}
|
|
494
|
+
// return new updated value
|
|
495
|
+
return Promise.all(promises).then(function () { return cache.get(key); });
|
|
496
|
+
}
|
|
497
|
+
return Promise.resolve(cache.get(key));
|
|
498
|
+
};
|
|
499
|
+
var broadcastState = function (key, data, error, isValidating) {
|
|
500
|
+
var updaters = CACHE_REVALIDATORS[key];
|
|
501
|
+
if (key && updaters) {
|
|
502
|
+
for (var i = 0; i < updaters.length; ++i) {
|
|
503
|
+
updaters[i](false, data, error, isValidating);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
var mutate = function (_key, _data, shouldRevalidate) {
|
|
508
|
+
if (shouldRevalidate === void 0) { shouldRevalidate = true; }
|
|
509
|
+
return __awaiter(void 0, void 0, void 0, function () {
|
|
510
|
+
var _a, key, keyErr, beforeMutationTs, beforeConcurrentPromisesTs, data, error, isAsyncMutation, err_1, shouldAbort, updaters, promises, i;
|
|
511
|
+
return __generator(this, function (_b) {
|
|
512
|
+
switch (_b.label) {
|
|
513
|
+
case 0:
|
|
514
|
+
_a = cache.serializeKey(_key), key = _a[0], keyErr = _a[2];
|
|
515
|
+
if (!key)
|
|
516
|
+
return [2 /*return*/];
|
|
517
|
+
// if there is no new data to update, let's just revalidate the key
|
|
518
|
+
if (typeof _data === 'undefined')
|
|
519
|
+
return [2 /*return*/, trigger(_key, shouldRevalidate)
|
|
520
|
+
// update global timestamps
|
|
521
|
+
];
|
|
522
|
+
// update global timestamps
|
|
523
|
+
MUTATION_TS[key] = now() - 1;
|
|
524
|
+
MUTATION_END_TS[key] = 0;
|
|
525
|
+
beforeMutationTs = MUTATION_TS[key];
|
|
526
|
+
beforeConcurrentPromisesTs = CONCURRENT_PROMISES_TS[key];
|
|
527
|
+
isAsyncMutation = false;
|
|
528
|
+
if (_data && typeof _data === 'function') {
|
|
529
|
+
// `_data` is a function, call it passing current cache value
|
|
530
|
+
try {
|
|
531
|
+
_data = _data(cache.get(key));
|
|
532
|
+
}
|
|
533
|
+
catch (err) {
|
|
534
|
+
// if `_data` function throws an error synchronously, it shouldn't be cached
|
|
535
|
+
_data = undefined;
|
|
536
|
+
error = err;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (!(_data && typeof _data.then === 'function')) return [3 /*break*/, 5];
|
|
540
|
+
// `_data` is a promise
|
|
541
|
+
isAsyncMutation = true;
|
|
542
|
+
_b.label = 1;
|
|
543
|
+
case 1:
|
|
544
|
+
_b.trys.push([1, 3, , 4]);
|
|
545
|
+
return [4 /*yield*/, _data];
|
|
546
|
+
case 2:
|
|
547
|
+
data = _b.sent();
|
|
548
|
+
return [3 /*break*/, 4];
|
|
549
|
+
case 3:
|
|
550
|
+
err_1 = _b.sent();
|
|
551
|
+
error = err_1;
|
|
552
|
+
return [3 /*break*/, 4];
|
|
553
|
+
case 4: return [3 /*break*/, 6];
|
|
554
|
+
case 5:
|
|
555
|
+
data = _data;
|
|
556
|
+
_b.label = 6;
|
|
557
|
+
case 6:
|
|
558
|
+
shouldAbort = function () {
|
|
559
|
+
// check if other mutations have occurred since we've started this mutation
|
|
560
|
+
if (beforeMutationTs !== MUTATION_TS[key] ||
|
|
561
|
+
beforeConcurrentPromisesTs !== CONCURRENT_PROMISES_TS[key]) {
|
|
562
|
+
if (error)
|
|
563
|
+
throw error;
|
|
564
|
+
return true;
|
|
565
|
+
}
|
|
566
|
+
};
|
|
567
|
+
// if there's a race we don't update cache or broadcast change, just return the data
|
|
568
|
+
if (shouldAbort())
|
|
569
|
+
return [2 /*return*/, data];
|
|
570
|
+
if (typeof data !== 'undefined') {
|
|
571
|
+
// update cached data
|
|
572
|
+
cache.set(key, data);
|
|
573
|
+
}
|
|
574
|
+
// always update or reset the error
|
|
575
|
+
cache.set(keyErr, error);
|
|
576
|
+
// reset the timestamp to mark the mutation has ended
|
|
577
|
+
MUTATION_END_TS[key] = now() - 1;
|
|
578
|
+
if (!isAsyncMutation) {
|
|
579
|
+
// we skip broadcasting if there's another mutation happened synchronously
|
|
580
|
+
if (shouldAbort())
|
|
581
|
+
return [2 /*return*/, data];
|
|
582
|
+
}
|
|
583
|
+
updaters = CACHE_REVALIDATORS[key];
|
|
584
|
+
if (updaters) {
|
|
585
|
+
promises = [];
|
|
586
|
+
for (i = 0; i < updaters.length; ++i) {
|
|
587
|
+
promises.push(updaters[i](!!shouldRevalidate, data, error, undefined, i > 0));
|
|
588
|
+
}
|
|
589
|
+
// return new updated value
|
|
590
|
+
return [2 /*return*/, Promise.all(promises).then(function () {
|
|
591
|
+
if (error)
|
|
592
|
+
throw error;
|
|
593
|
+
return cache.get(key);
|
|
594
|
+
})];
|
|
595
|
+
}
|
|
596
|
+
// throw error or return data to be used by caller of mutate
|
|
597
|
+
if (error)
|
|
598
|
+
throw error;
|
|
599
|
+
return [2 /*return*/, data];
|
|
600
|
+
}
|
|
601
|
+
});
|
|
602
|
+
});
|
|
603
|
+
};
|
|
604
|
+
function useSWR() {
|
|
605
|
+
var _this = this;
|
|
606
|
+
var args = [];
|
|
607
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
608
|
+
args[_i] = arguments[_i];
|
|
609
|
+
}
|
|
610
|
+
var _key = args[0];
|
|
611
|
+
var config = Object.assign({}, defaultConfig, React.useContext(SWRConfigContext), args.length > 2
|
|
612
|
+
? args[2]
|
|
613
|
+
: args.length === 2 && typeof args[1] === 'object'
|
|
614
|
+
? args[1]
|
|
615
|
+
: {});
|
|
616
|
+
// in typescript args.length > 2 is not same as args.lenth === 3
|
|
617
|
+
// we do a safe type assertion here
|
|
618
|
+
// args.length === 3
|
|
619
|
+
var fn = (args.length > 2
|
|
620
|
+
? args[1]
|
|
621
|
+
: args.length === 2 && typeof args[1] === 'function'
|
|
622
|
+
? args[1]
|
|
623
|
+
: /**
|
|
624
|
+
pass fn as null will disable revalidate
|
|
625
|
+
https://paco.sh/blog/shared-hook-state-with-swr
|
|
626
|
+
*/
|
|
627
|
+
args[1] === null
|
|
628
|
+
? args[1]
|
|
629
|
+
: config.fetcher);
|
|
630
|
+
// we assume `key` as the identifier of the request
|
|
631
|
+
// `key` can change but `fn` shouldn't
|
|
632
|
+
// (because `revalidate` only depends on `key`)
|
|
633
|
+
// `keyErr` is the cache key for error objects
|
|
634
|
+
var _a = cache.serializeKey(_key), key = _a[0], fnArgs = _a[1], keyErr = _a[2], keyValidating = _a[3];
|
|
635
|
+
var configRef = React.useRef(config);
|
|
636
|
+
useIsomorphicLayoutEffect(function () {
|
|
637
|
+
configRef.current = config;
|
|
638
|
+
});
|
|
639
|
+
var willRevalidateOnMount = function () {
|
|
640
|
+
return (config.revalidateOnMount ||
|
|
641
|
+
(!config.initialData && config.revalidateOnMount === undefined));
|
|
642
|
+
};
|
|
643
|
+
var resolveData = function () {
|
|
644
|
+
var cachedData = cache.get(key);
|
|
645
|
+
return typeof cachedData === 'undefined' ? config.initialData : cachedData;
|
|
646
|
+
};
|
|
647
|
+
var resolveIsValidating = function () {
|
|
648
|
+
return !!cache.get(keyValidating) || (key && willRevalidateOnMount());
|
|
649
|
+
};
|
|
650
|
+
var initialData = resolveData();
|
|
651
|
+
var initialError = cache.get(keyErr);
|
|
652
|
+
var initialIsValidating = resolveIsValidating();
|
|
653
|
+
// if a state is accessed (data, error or isValidating),
|
|
654
|
+
// we add the state to dependencies so if the state is
|
|
655
|
+
// updated in the future, we can trigger a rerender
|
|
656
|
+
var stateDependencies = React.useRef({
|
|
657
|
+
data: false,
|
|
658
|
+
error: false,
|
|
659
|
+
isValidating: false
|
|
660
|
+
});
|
|
661
|
+
var stateRef = React.useRef({
|
|
662
|
+
data: initialData,
|
|
663
|
+
error: initialError,
|
|
664
|
+
isValidating: initialIsValidating
|
|
665
|
+
});
|
|
666
|
+
// display the data label in the React DevTools next to SWR hooks
|
|
667
|
+
React.useDebugValue(stateRef.current.data);
|
|
668
|
+
var rerender = React.useState({})[1];
|
|
669
|
+
var dispatch = React.useCallback(function (payload) {
|
|
670
|
+
var shouldUpdateState = false;
|
|
671
|
+
for (var k in payload) {
|
|
672
|
+
// @ts-ignore
|
|
673
|
+
if (stateRef.current[k] === payload[k]) {
|
|
674
|
+
continue;
|
|
675
|
+
}
|
|
676
|
+
// @ts-ignore
|
|
677
|
+
stateRef.current[k] = payload[k];
|
|
678
|
+
// @ts-ignore
|
|
679
|
+
if (stateDependencies.current[k]) {
|
|
680
|
+
shouldUpdateState = true;
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
if (shouldUpdateState) {
|
|
684
|
+
// if component is unmounted, should skip rerender
|
|
685
|
+
// if component is not mounted, should skip rerender
|
|
686
|
+
if (unmountedRef.current || !initialMountedRef.current)
|
|
687
|
+
return;
|
|
688
|
+
rerender({});
|
|
689
|
+
}
|
|
690
|
+
},
|
|
691
|
+
// config.suspense isn't allowed to change during the lifecycle
|
|
692
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
693
|
+
[]);
|
|
694
|
+
// error ref inside revalidate (is last request errored?)
|
|
695
|
+
var unmountedRef = React.useRef(false);
|
|
696
|
+
var keyRef = React.useRef(key);
|
|
697
|
+
// check if component is mounted in suspense mode
|
|
698
|
+
var initialMountedRef = React.useRef(false);
|
|
699
|
+
// do unmount check for callbacks
|
|
700
|
+
var eventsCallback = React.useCallback(function (event) {
|
|
701
|
+
var _a;
|
|
702
|
+
var params = [];
|
|
703
|
+
for (var _i = 1; _i < arguments.length; _i++) {
|
|
704
|
+
params[_i - 1] = arguments[_i];
|
|
705
|
+
}
|
|
706
|
+
if (unmountedRef.current)
|
|
707
|
+
return;
|
|
708
|
+
if (!initialMountedRef.current)
|
|
709
|
+
return;
|
|
710
|
+
if (key !== keyRef.current)
|
|
711
|
+
return;
|
|
712
|
+
// @ts-ignore
|
|
713
|
+
(_a = configRef.current)[event].apply(_a, params);
|
|
714
|
+
}, [key]);
|
|
715
|
+
var boundMutate = React.useCallback(function (data, shouldRevalidate) {
|
|
716
|
+
return mutate(keyRef.current, data, shouldRevalidate);
|
|
717
|
+
}, []);
|
|
718
|
+
var addRevalidator = function (revalidators, callback) {
|
|
719
|
+
if (!revalidators[key]) {
|
|
720
|
+
revalidators[key] = [callback];
|
|
721
|
+
}
|
|
722
|
+
else {
|
|
723
|
+
revalidators[key].push(callback);
|
|
724
|
+
}
|
|
725
|
+
return function () {
|
|
726
|
+
var keyedRevalidators = revalidators[key];
|
|
727
|
+
var index = keyedRevalidators.indexOf(callback);
|
|
728
|
+
if (index >= 0) {
|
|
729
|
+
// O(1): faster than splice
|
|
730
|
+
keyedRevalidators[index] =
|
|
731
|
+
keyedRevalidators[keyedRevalidators.length - 1];
|
|
732
|
+
keyedRevalidators.pop();
|
|
733
|
+
}
|
|
734
|
+
};
|
|
735
|
+
};
|
|
736
|
+
// start a revalidation
|
|
737
|
+
var revalidate = React.useCallback(function (revalidateOpts) {
|
|
738
|
+
if (revalidateOpts === void 0) { revalidateOpts = {}; }
|
|
739
|
+
return __awaiter(_this, void 0, void 0, function () {
|
|
740
|
+
var _a, retryCount, _b, dedupe, loading, shouldDeduping, newData, startAt, newState, err_2;
|
|
741
|
+
return __generator(this, function (_c) {
|
|
742
|
+
switch (_c.label) {
|
|
743
|
+
case 0:
|
|
744
|
+
if (!key || !fn)
|
|
745
|
+
return [2 /*return*/, false];
|
|
746
|
+
if (unmountedRef.current)
|
|
747
|
+
return [2 /*return*/, false];
|
|
748
|
+
if (configRef.current.isPaused())
|
|
749
|
+
return [2 /*return*/, false];
|
|
750
|
+
_a = revalidateOpts.retryCount, retryCount = _a === void 0 ? 0 : _a, _b = revalidateOpts.dedupe, dedupe = _b === void 0 ? false : _b;
|
|
751
|
+
loading = true;
|
|
752
|
+
shouldDeduping = typeof CONCURRENT_PROMISES[key] !== 'undefined' && dedupe;
|
|
753
|
+
_c.label = 1;
|
|
754
|
+
case 1:
|
|
755
|
+
_c.trys.push([1, 6, , 7]);
|
|
756
|
+
dispatch({
|
|
757
|
+
isValidating: true
|
|
758
|
+
});
|
|
759
|
+
cache.set(keyValidating, true);
|
|
760
|
+
if (!shouldDeduping) {
|
|
761
|
+
// also update other hooks
|
|
762
|
+
broadcastState(key, stateRef.current.data, stateRef.current.error, true);
|
|
763
|
+
}
|
|
764
|
+
newData = void 0;
|
|
765
|
+
startAt = void 0;
|
|
766
|
+
if (!shouldDeduping) return [3 /*break*/, 3];
|
|
767
|
+
// there's already an ongoing request,
|
|
768
|
+
// this one needs to be deduplicated.
|
|
769
|
+
startAt = CONCURRENT_PROMISES_TS[key];
|
|
770
|
+
return [4 /*yield*/, CONCURRENT_PROMISES[key]];
|
|
771
|
+
case 2:
|
|
772
|
+
newData = _c.sent();
|
|
773
|
+
return [3 /*break*/, 5];
|
|
774
|
+
case 3:
|
|
775
|
+
// if no cache being rendered currently (it shows a blank page),
|
|
776
|
+
// we trigger the loading slow event.
|
|
777
|
+
if (config.loadingTimeout && !cache.get(key)) {
|
|
778
|
+
setTimeout(function () {
|
|
779
|
+
if (loading)
|
|
780
|
+
eventsCallback('onLoadingSlow', key, config);
|
|
781
|
+
}, config.loadingTimeout);
|
|
782
|
+
}
|
|
783
|
+
if (fnArgs !== null) {
|
|
784
|
+
CONCURRENT_PROMISES[key] = fn.apply(void 0, fnArgs);
|
|
785
|
+
}
|
|
786
|
+
else {
|
|
787
|
+
CONCURRENT_PROMISES[key] = fn(key);
|
|
788
|
+
}
|
|
789
|
+
CONCURRENT_PROMISES_TS[key] = startAt = now();
|
|
790
|
+
return [4 /*yield*/, CONCURRENT_PROMISES[key]];
|
|
791
|
+
case 4:
|
|
792
|
+
newData = _c.sent();
|
|
793
|
+
setTimeout(function () {
|
|
794
|
+
delete CONCURRENT_PROMISES[key];
|
|
795
|
+
delete CONCURRENT_PROMISES_TS[key];
|
|
796
|
+
}, config.dedupingInterval);
|
|
797
|
+
// trigger the success event,
|
|
798
|
+
// only do this for the original request.
|
|
799
|
+
eventsCallback('onSuccess', newData, key, config);
|
|
800
|
+
_c.label = 5;
|
|
801
|
+
case 5:
|
|
802
|
+
// if there're other ongoing request(s), started after the current one,
|
|
803
|
+
// we need to ignore the current one to avoid possible race conditions:
|
|
804
|
+
// req1------------------>res1 (current one)
|
|
805
|
+
// req2---------------->res2
|
|
806
|
+
// the request that fired later will always be kept.
|
|
807
|
+
if (CONCURRENT_PROMISES_TS[key] > startAt) {
|
|
808
|
+
return [2 /*return*/, false];
|
|
809
|
+
}
|
|
810
|
+
// if there're other mutations(s), overlapped with the current revalidation:
|
|
811
|
+
// case 1:
|
|
812
|
+
// req------------------>res
|
|
813
|
+
// mutate------>end
|
|
814
|
+
// case 2:
|
|
815
|
+
// req------------>res
|
|
816
|
+
// mutate------>end
|
|
817
|
+
// case 3:
|
|
818
|
+
// req------------------>res
|
|
819
|
+
// mutate-------...---------->
|
|
820
|
+
// we have to ignore the revalidation result (res) because it's no longer fresh.
|
|
821
|
+
// meanwhile, a new revalidation should be triggered when the mutation ends.
|
|
822
|
+
if (MUTATION_TS[key] &&
|
|
823
|
+
// case 1
|
|
824
|
+
(startAt <= MUTATION_TS[key] ||
|
|
825
|
+
// case 2
|
|
826
|
+
startAt <= MUTATION_END_TS[key] ||
|
|
827
|
+
// case 3
|
|
828
|
+
MUTATION_END_TS[key] === 0)) {
|
|
829
|
+
dispatch({ isValidating: false });
|
|
830
|
+
return [2 /*return*/, false];
|
|
831
|
+
}
|
|
832
|
+
cache.set(keyErr, undefined);
|
|
833
|
+
cache.set(keyValidating, false);
|
|
834
|
+
newState = {
|
|
835
|
+
isValidating: false
|
|
836
|
+
};
|
|
837
|
+
if (typeof stateRef.current.error !== 'undefined') {
|
|
838
|
+
// we don't have an error
|
|
839
|
+
newState.error = undefined;
|
|
840
|
+
}
|
|
841
|
+
if (!config.compare(stateRef.current.data, newData)) {
|
|
842
|
+
// deep compare to avoid extra re-render
|
|
843
|
+
// data changed
|
|
844
|
+
newState.data = newData;
|
|
845
|
+
}
|
|
846
|
+
if (!config.compare(cache.get(key), newData)) {
|
|
847
|
+
cache.set(key, newData);
|
|
848
|
+
}
|
|
849
|
+
// merge the new state
|
|
850
|
+
dispatch(newState);
|
|
851
|
+
if (!shouldDeduping) {
|
|
852
|
+
// also update other hooks
|
|
853
|
+
broadcastState(key, newData, newState.error, false);
|
|
854
|
+
}
|
|
855
|
+
return [3 /*break*/, 7];
|
|
856
|
+
case 6:
|
|
857
|
+
err_2 = _c.sent();
|
|
858
|
+
delete CONCURRENT_PROMISES[key];
|
|
859
|
+
delete CONCURRENT_PROMISES_TS[key];
|
|
860
|
+
if (configRef.current.isPaused()) {
|
|
861
|
+
dispatch({
|
|
862
|
+
isValidating: false
|
|
863
|
+
});
|
|
864
|
+
return [2 /*return*/, false];
|
|
865
|
+
}
|
|
866
|
+
cache.set(keyErr, err_2);
|
|
867
|
+
// get a new error
|
|
868
|
+
// don't use deep equal for errors
|
|
869
|
+
if (stateRef.current.error !== err_2) {
|
|
870
|
+
// we keep the stale data
|
|
871
|
+
dispatch({
|
|
872
|
+
isValidating: false,
|
|
873
|
+
error: err_2
|
|
874
|
+
});
|
|
875
|
+
if (!shouldDeduping) {
|
|
876
|
+
// also broadcast to update other hooks
|
|
877
|
+
broadcastState(key, undefined, err_2, false);
|
|
878
|
+
}
|
|
879
|
+
}
|
|
880
|
+
// events and retry
|
|
881
|
+
eventsCallback('onError', err_2, key, config);
|
|
882
|
+
if (config.shouldRetryOnError) {
|
|
883
|
+
// when retrying, we always enable deduping
|
|
884
|
+
eventsCallback('onErrorRetry', err_2, key, config, revalidate, {
|
|
885
|
+
retryCount: retryCount + 1,
|
|
886
|
+
dedupe: true
|
|
887
|
+
});
|
|
888
|
+
}
|
|
889
|
+
return [3 /*break*/, 7];
|
|
890
|
+
case 7:
|
|
891
|
+
loading = false;
|
|
892
|
+
return [2 /*return*/, true];
|
|
893
|
+
}
|
|
894
|
+
});
|
|
895
|
+
});
|
|
896
|
+
},
|
|
897
|
+
// dispatch is immutable, and `eventsCallback`, `fnArgs`, `keyErr`, and `keyValidating` are based on `key`,
|
|
898
|
+
// so we can them from the deps array.
|
|
899
|
+
//
|
|
900
|
+
// FIXME:
|
|
901
|
+
// `fn` and `config` might be changed during the lifecycle,
|
|
902
|
+
// but they might be changed every render like this.
|
|
903
|
+
// useSWR('key', () => fetch('/api/'), { suspense: true })
|
|
904
|
+
// So we omit the values from the deps array
|
|
905
|
+
// even though it might cause unexpected behaviors.
|
|
906
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
907
|
+
[key]);
|
|
908
|
+
// mounted (client side rendering)
|
|
909
|
+
useIsomorphicLayoutEffect(function () {
|
|
910
|
+
if (!key)
|
|
911
|
+
return undefined;
|
|
912
|
+
// after `key` updates, we need to mark it as mounted
|
|
913
|
+
unmountedRef.current = false;
|
|
914
|
+
var isUpdating = initialMountedRef.current;
|
|
915
|
+
initialMountedRef.current = true;
|
|
916
|
+
// after the component is mounted (hydrated),
|
|
917
|
+
// we need to update the data from the cache
|
|
918
|
+
// and trigger a revalidation
|
|
919
|
+
var currentHookData = stateRef.current.data;
|
|
920
|
+
var latestKeyedData = resolveData();
|
|
921
|
+
// update the state if the key changed (not the inital render) or cache updated
|
|
922
|
+
keyRef.current = key;
|
|
923
|
+
if (!config.compare(currentHookData, latestKeyedData)) {
|
|
924
|
+
dispatch({ data: latestKeyedData });
|
|
925
|
+
}
|
|
926
|
+
// revalidate with deduping
|
|
927
|
+
var softRevalidate = function () { return revalidate({ dedupe: true }); };
|
|
928
|
+
// trigger a revalidation
|
|
929
|
+
if (isUpdating || willRevalidateOnMount()) {
|
|
930
|
+
if (typeof latestKeyedData !== 'undefined' && !IS_SERVER) {
|
|
931
|
+
// delay revalidate if there's cache
|
|
932
|
+
// to not block the rendering
|
|
933
|
+
// @ts-ignore it's safe to use requestAnimationFrame in browser
|
|
934
|
+
rAF(softRevalidate);
|
|
935
|
+
}
|
|
936
|
+
else {
|
|
937
|
+
softRevalidate();
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
var pending = false;
|
|
941
|
+
var onFocus = function () {
|
|
942
|
+
if (pending || !configRef.current.revalidateOnFocus)
|
|
943
|
+
return;
|
|
944
|
+
pending = true;
|
|
945
|
+
softRevalidate();
|
|
946
|
+
setTimeout(function () { return (pending = false); }, configRef.current.focusThrottleInterval);
|
|
947
|
+
};
|
|
948
|
+
var onReconnect = function () {
|
|
949
|
+
if (configRef.current.revalidateOnReconnect) {
|
|
950
|
+
softRevalidate();
|
|
951
|
+
}
|
|
952
|
+
};
|
|
953
|
+
// register global cache update listener
|
|
954
|
+
var onUpdate = function (shouldRevalidate, updatedData, updatedError, updatedIsValidating, dedupe) {
|
|
955
|
+
if (shouldRevalidate === void 0) { shouldRevalidate = true; }
|
|
956
|
+
if (dedupe === void 0) { dedupe = true; }
|
|
957
|
+
// update hook state
|
|
958
|
+
var newState = {};
|
|
959
|
+
var needUpdate = false;
|
|
960
|
+
if (typeof updatedData !== 'undefined' &&
|
|
961
|
+
!config.compare(stateRef.current.data, updatedData)) {
|
|
962
|
+
newState.data = updatedData;
|
|
963
|
+
needUpdate = true;
|
|
964
|
+
}
|
|
965
|
+
// always update error
|
|
966
|
+
// because it can be `undefined`
|
|
967
|
+
if (stateRef.current.error !== updatedError) {
|
|
968
|
+
newState.error = updatedError;
|
|
969
|
+
needUpdate = true;
|
|
970
|
+
}
|
|
971
|
+
if (typeof updatedIsValidating !== 'undefined' &&
|
|
972
|
+
stateRef.current.isValidating !== updatedIsValidating) {
|
|
973
|
+
newState.isValidating = updatedIsValidating;
|
|
974
|
+
needUpdate = true;
|
|
975
|
+
}
|
|
976
|
+
if (needUpdate) {
|
|
977
|
+
dispatch(newState);
|
|
978
|
+
}
|
|
979
|
+
if (shouldRevalidate) {
|
|
980
|
+
if (dedupe) {
|
|
981
|
+
return softRevalidate();
|
|
982
|
+
}
|
|
983
|
+
else {
|
|
984
|
+
return revalidate();
|
|
985
|
+
}
|
|
986
|
+
}
|
|
987
|
+
return false;
|
|
988
|
+
};
|
|
989
|
+
var unsubFocus = addRevalidator(FOCUS_REVALIDATORS, onFocus);
|
|
990
|
+
var unsubReconnect = addRevalidator(RECONNECT_REVALIDATORS, onReconnect);
|
|
991
|
+
var unsubUpdate = addRevalidator(CACHE_REVALIDATORS, onUpdate);
|
|
992
|
+
return function () {
|
|
993
|
+
// cleanup
|
|
994
|
+
dispatch = function () { return null; };
|
|
995
|
+
// mark it as unmounted
|
|
996
|
+
unmountedRef.current = true;
|
|
997
|
+
unsubFocus();
|
|
998
|
+
unsubReconnect();
|
|
999
|
+
unsubUpdate();
|
|
1000
|
+
};
|
|
1001
|
+
}, [key, revalidate]);
|
|
1002
|
+
useIsomorphicLayoutEffect(function () {
|
|
1003
|
+
var timer = null;
|
|
1004
|
+
var tick = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
1005
|
+
return __generator(this, function (_a) {
|
|
1006
|
+
switch (_a.label) {
|
|
1007
|
+
case 0:
|
|
1008
|
+
if (!(!stateRef.current.error &&
|
|
1009
|
+
(configRef.current.refreshWhenHidden ||
|
|
1010
|
+
configRef.current.isDocumentVisible()) &&
|
|
1011
|
+
(configRef.current.refreshWhenOffline || configRef.current.isOnline()))) return [3 /*break*/, 2];
|
|
1012
|
+
// only revalidate when the page is visible
|
|
1013
|
+
// if API request errored, we stop polling in this round
|
|
1014
|
+
// and let the error retry function handle it
|
|
1015
|
+
return [4 /*yield*/, revalidate({ dedupe: true })];
|
|
1016
|
+
case 1:
|
|
1017
|
+
// only revalidate when the page is visible
|
|
1018
|
+
// if API request errored, we stop polling in this round
|
|
1019
|
+
// and let the error retry function handle it
|
|
1020
|
+
_a.sent();
|
|
1021
|
+
_a.label = 2;
|
|
1022
|
+
case 2:
|
|
1023
|
+
// Read the latest refreshInterval
|
|
1024
|
+
if (configRef.current.refreshInterval && timer) {
|
|
1025
|
+
timer = setTimeout(tick, configRef.current.refreshInterval);
|
|
1026
|
+
}
|
|
1027
|
+
return [2 /*return*/];
|
|
1028
|
+
}
|
|
1029
|
+
});
|
|
1030
|
+
}); };
|
|
1031
|
+
if (configRef.current.refreshInterval) {
|
|
1032
|
+
timer = setTimeout(tick, configRef.current.refreshInterval);
|
|
1033
|
+
}
|
|
1034
|
+
return function () {
|
|
1035
|
+
if (timer) {
|
|
1036
|
+
clearTimeout(timer);
|
|
1037
|
+
timer = null;
|
|
1038
|
+
}
|
|
1039
|
+
};
|
|
1040
|
+
}, [
|
|
1041
|
+
config.refreshInterval,
|
|
1042
|
+
config.refreshWhenHidden,
|
|
1043
|
+
config.refreshWhenOffline,
|
|
1044
|
+
revalidate
|
|
1045
|
+
]);
|
|
1046
|
+
// suspense
|
|
1047
|
+
var latestData;
|
|
1048
|
+
var latestError;
|
|
1049
|
+
if (config.suspense) {
|
|
1050
|
+
// in suspense mode, we can't return empty state
|
|
1051
|
+
// (it should be suspended)
|
|
1052
|
+
// try to get data and error from cache
|
|
1053
|
+
latestData = cache.get(key);
|
|
1054
|
+
latestError = cache.get(keyErr);
|
|
1055
|
+
if (typeof latestData === 'undefined') {
|
|
1056
|
+
latestData = initialData;
|
|
1057
|
+
}
|
|
1058
|
+
if (typeof latestError === 'undefined') {
|
|
1059
|
+
latestError = initialError;
|
|
1060
|
+
}
|
|
1061
|
+
if (typeof latestData === 'undefined' &&
|
|
1062
|
+
typeof latestError === 'undefined') {
|
|
1063
|
+
// need to start the request if it hasn't
|
|
1064
|
+
if (!CONCURRENT_PROMISES[key]) {
|
|
1065
|
+
// trigger revalidate immediately
|
|
1066
|
+
// to get the promise
|
|
1067
|
+
// in this revalidate, should not rerender
|
|
1068
|
+
revalidate();
|
|
1069
|
+
}
|
|
1070
|
+
if (CONCURRENT_PROMISES[key] &&
|
|
1071
|
+
typeof CONCURRENT_PROMISES[key].then === 'function') {
|
|
1072
|
+
// if it is a promise
|
|
1073
|
+
throw CONCURRENT_PROMISES[key];
|
|
1074
|
+
}
|
|
1075
|
+
// it's a value, return it directly (override)
|
|
1076
|
+
latestData = CONCURRENT_PROMISES[key];
|
|
1077
|
+
}
|
|
1078
|
+
if (typeof latestData === 'undefined' && latestError) {
|
|
1079
|
+
// in suspense mode, throw error if there's no content
|
|
1080
|
+
throw latestError;
|
|
1081
|
+
}
|
|
1082
|
+
}
|
|
1083
|
+
// define returned state
|
|
1084
|
+
// can be memorized since the state is a ref
|
|
1085
|
+
var memoizedState = React.useMemo(function () {
|
|
1086
|
+
// revalidate will be deprecated in the 1.x release
|
|
1087
|
+
// because mutate() covers the same use case of revalidate().
|
|
1088
|
+
// This remains only for backward compatibility
|
|
1089
|
+
var state = { revalidate: revalidate, mutate: boundMutate };
|
|
1090
|
+
Object.defineProperties(state, {
|
|
1091
|
+
error: {
|
|
1092
|
+
// `key` might be changed in the upcoming hook re-render,
|
|
1093
|
+
// but the previous state will stay
|
|
1094
|
+
// so we need to match the latest key and data (fallback to `initialData`)
|
|
1095
|
+
get: function () {
|
|
1096
|
+
stateDependencies.current.error = true;
|
|
1097
|
+
if (config.suspense) {
|
|
1098
|
+
return latestError;
|
|
1099
|
+
}
|
|
1100
|
+
return keyRef.current === key ? stateRef.current.error : initialError;
|
|
1101
|
+
},
|
|
1102
|
+
enumerable: true
|
|
1103
|
+
},
|
|
1104
|
+
data: {
|
|
1105
|
+
get: function () {
|
|
1106
|
+
stateDependencies.current.data = true;
|
|
1107
|
+
if (config.suspense) {
|
|
1108
|
+
return latestData;
|
|
1109
|
+
}
|
|
1110
|
+
return keyRef.current === key ? stateRef.current.data : initialData;
|
|
1111
|
+
},
|
|
1112
|
+
enumerable: true
|
|
1113
|
+
},
|
|
1114
|
+
isValidating: {
|
|
1115
|
+
get: function () {
|
|
1116
|
+
stateDependencies.current.isValidating = true;
|
|
1117
|
+
return key ? stateRef.current.isValidating : false;
|
|
1118
|
+
},
|
|
1119
|
+
enumerable: true
|
|
1120
|
+
}
|
|
1121
|
+
});
|
|
1122
|
+
return state;
|
|
1123
|
+
// `config.suspense` isn't allowed to change during the lifecycle.
|
|
1124
|
+
// `boundMutate` is immutable, and the immutability of `revalidate` depends on `key`
|
|
1125
|
+
// so we can omit them from the deps array,
|
|
1126
|
+
// but we put it to enable react-hooks/exhaustive-deps rule.
|
|
1127
|
+
// `initialData` and `initialError` are not initial values
|
|
1128
|
+
// because they are changed during the lifecycle
|
|
1129
|
+
// so we should add them in the deps array.
|
|
1130
|
+
}, [
|
|
1131
|
+
revalidate,
|
|
1132
|
+
initialData,
|
|
1133
|
+
initialError,
|
|
1134
|
+
boundMutate,
|
|
1135
|
+
key,
|
|
1136
|
+
config.suspense,
|
|
1137
|
+
latestError,
|
|
1138
|
+
latestData
|
|
1139
|
+
]);
|
|
1140
|
+
return memoizedState;
|
|
1141
|
+
}
|
|
1142
|
+
Object.defineProperty(SWRConfigContext.Provider, 'default', {
|
|
1143
|
+
value: defaultConfig
|
|
1144
|
+
});
|
|
1145
|
+
var SWRConfig = SWRConfigContext.Provider;
|
|
1146
|
+
|
|
1147
|
+
var __awaiter$1 = (undefined && undefined.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
1148
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
1149
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
1150
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
1151
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
1152
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
1153
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
1154
|
+
});
|
|
1155
|
+
};
|
|
1156
|
+
var __generator$1 = (undefined && undefined.__generator) || function (thisArg, body) {
|
|
1157
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
1158
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
1159
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
1160
|
+
function step(op) {
|
|
1161
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
1162
|
+
while (_) try {
|
|
1163
|
+
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;
|
|
1164
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
1165
|
+
switch (op[0]) {
|
|
1166
|
+
case 0: case 1: t = op; break;
|
|
1167
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
1168
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
1169
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
1170
|
+
default:
|
|
1171
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
1172
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
1173
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
1174
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
1175
|
+
if (t[2]) _.ops.pop();
|
|
1176
|
+
_.trys.pop(); continue;
|
|
1177
|
+
}
|
|
1178
|
+
op = body.call(thisArg, _);
|
|
1179
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
1180
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
1181
|
+
}
|
|
1182
|
+
};
|
|
1183
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
1184
|
+
var t = {};
|
|
1185
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1186
|
+
t[p] = s[p];
|
|
1187
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1188
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1189
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1190
|
+
t[p[i]] = s[p[i]];
|
|
1191
|
+
}
|
|
1192
|
+
return t;
|
|
1193
|
+
};
|
|
1194
|
+
|
|
151
1195
|
var _this = undefined;
|
|
152
1196
|
|
|
153
1197
|
var dataHandler = function () {
|
|
@@ -227,7 +1271,7 @@ function useUser() {
|
|
|
227
1271
|
redirectTo = _ref.redirectTo,
|
|
228
1272
|
redirectIfFound = _ref.redirectIfFound;
|
|
229
1273
|
|
|
230
|
-
var _useSWR =
|
|
1274
|
+
var _useSWR = useSWR('/api/auth/user', dataHandler),
|
|
231
1275
|
data = _useSWR.data,
|
|
232
1276
|
error = _useSWR.error;
|
|
233
1277
|
|
|
@@ -242,7 +1286,7 @@ function useUser() {
|
|
|
242
1286
|
redirectTo && !redirectIfFound && !hasUser ||
|
|
243
1287
|
// If redirectIfFound is also set, redirect if the user was found
|
|
244
1288
|
redirectIfFound && hasUser) {
|
|
245
|
-
Router__default
|
|
1289
|
+
Router__default.push(redirectTo);
|
|
246
1290
|
}
|
|
247
1291
|
}, [redirectTo, redirectIfFound, finished, hasUser]);
|
|
248
1292
|
|
|
@@ -348,43 +1392,43 @@ var LoginForm = function LoginForm(props) {
|
|
|
348
1392
|
loading = _useState4[0],
|
|
349
1393
|
setLoading = _useState4[1];
|
|
350
1394
|
|
|
351
|
-
return React__default
|
|
1395
|
+
return React__default.createElement(
|
|
352
1396
|
reactBootstrap.Form,
|
|
353
1397
|
{ className: 'login', onSubmit: handleSubmit },
|
|
354
|
-
React__default
|
|
1398
|
+
React__default.createElement(
|
|
355
1399
|
'h1',
|
|
356
1400
|
null,
|
|
357
1401
|
'Login'
|
|
358
1402
|
),
|
|
359
|
-
React__default
|
|
1403
|
+
React__default.createElement('hr', null),
|
|
360
1404
|
returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
|
|
361
1405
|
returnFormField({ name: 'password', label: 'Password', type: 'password', required: true }),
|
|
362
|
-
React__default
|
|
363
|
-
React__default
|
|
1406
|
+
React__default.createElement('hr', null),
|
|
1407
|
+
React__default.createElement(
|
|
364
1408
|
reactBootstrap.Form.Row,
|
|
365
1409
|
null,
|
|
366
|
-
React__default
|
|
1410
|
+
React__default.createElement(
|
|
367
1411
|
reactBootstrap.Form.Group,
|
|
368
1412
|
{ as: reactBootstrap.Col },
|
|
369
|
-
React__default
|
|
1413
|
+
React__default.createElement(
|
|
370
1414
|
'a',
|
|
371
1415
|
{ href: '/auth/signup' },
|
|
372
1416
|
'I don\'t have an account'
|
|
373
1417
|
)
|
|
374
1418
|
),
|
|
375
|
-
React__default
|
|
1419
|
+
React__default.createElement(
|
|
376
1420
|
reactBootstrap.Form.Group,
|
|
377
1421
|
{ as: reactBootstrap.Col, className: 'text-right' },
|
|
378
|
-
!loading && React__default
|
|
1422
|
+
!loading && React__default.createElement(
|
|
379
1423
|
reactBootstrap.Button,
|
|
380
1424
|
{ type: 'submit' },
|
|
381
1425
|
'Login'
|
|
382
1426
|
),
|
|
383
|
-
loading && React__default
|
|
1427
|
+
loading && React__default.createElement(
|
|
384
1428
|
reactBootstrap.Button,
|
|
385
1429
|
{ variant: 'primary', disabled: true },
|
|
386
|
-
React__default
|
|
387
|
-
React__default
|
|
1430
|
+
React__default.createElement(reactBootstrap.Spinner, { as: 'span', animation: 'border', role: 'status', 'aria-hidden': 'true', size: 'sm' }),
|
|
1431
|
+
React__default.createElement(
|
|
388
1432
|
'span',
|
|
389
1433
|
{ className: 'sr-only' },
|
|
390
1434
|
'Loading...'
|
|
@@ -392,12 +1436,12 @@ var LoginForm = function LoginForm(props) {
|
|
|
392
1436
|
)
|
|
393
1437
|
)
|
|
394
1438
|
),
|
|
395
|
-
errorMsg && React__default
|
|
1439
|
+
errorMsg && React__default.createElement(
|
|
396
1440
|
'p',
|
|
397
1441
|
{ className: 'error' },
|
|
398
1442
|
errorMsg
|
|
399
1443
|
),
|
|
400
|
-
React__default
|
|
1444
|
+
React__default.createElement(
|
|
401
1445
|
'style',
|
|
402
1446
|
{ jsx: 'true'.toString() },
|
|
403
1447
|
'\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 '
|
|
@@ -653,29 +1697,29 @@ var SignupForm = function SignupForm(props) {
|
|
|
653
1697
|
loading = _useState14[0],
|
|
654
1698
|
setLoading = _useState14[1];
|
|
655
1699
|
|
|
656
|
-
return React__default
|
|
1700
|
+
return React__default.createElement(
|
|
657
1701
|
reactBootstrap.Form,
|
|
658
1702
|
{ className: 'login', id: 'signupForm', onSubmit: handleSubmit },
|
|
659
|
-
React__default
|
|
1703
|
+
React__default.createElement(
|
|
660
1704
|
'h1',
|
|
661
1705
|
null,
|
|
662
1706
|
'Sign Up'
|
|
663
1707
|
),
|
|
664
|
-
React__default
|
|
1708
|
+
React__default.createElement('hr', null),
|
|
665
1709
|
returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
|
|
666
|
-
React__default
|
|
1710
|
+
React__default.createElement(
|
|
667
1711
|
reactBootstrap.Form.Row,
|
|
668
1712
|
null,
|
|
669
1713
|
returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: reactBootstrap.Col, required: true }),
|
|
670
1714
|
returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: reactBootstrap.Col, required: true })
|
|
671
1715
|
),
|
|
672
|
-
React__default
|
|
1716
|
+
React__default.createElement(
|
|
673
1717
|
reactBootstrap.Form.Row,
|
|
674
1718
|
null,
|
|
675
1719
|
returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: reactBootstrap.Col, required: true }),
|
|
676
1720
|
returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: reactBootstrap.Col, required: true })
|
|
677
1721
|
),
|
|
678
|
-
React__default
|
|
1722
|
+
React__default.createElement(
|
|
679
1723
|
reactBootstrap.Form.Row,
|
|
680
1724
|
null,
|
|
681
1725
|
returnFormField({
|
|
@@ -689,7 +1733,7 @@ var SignupForm = function SignupForm(props) {
|
|
|
689
1733
|
}),
|
|
690
1734
|
countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: reactBootstrap.Col, options: states })
|
|
691
1735
|
),
|
|
692
|
-
React__default
|
|
1736
|
+
React__default.createElement(
|
|
693
1737
|
reactBootstrap.Form.Row,
|
|
694
1738
|
null,
|
|
695
1739
|
countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: reactBootstrap.Col }),
|
|
@@ -736,38 +1780,38 @@ var SignupForm = function SignupForm(props) {
|
|
|
736
1780
|
required: true,
|
|
737
1781
|
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' }]
|
|
738
1782
|
}),
|
|
739
|
-
React__default
|
|
740
|
-
React__default
|
|
1783
|
+
React__default.createElement('hr', null),
|
|
1784
|
+
React__default.createElement(
|
|
741
1785
|
reactBootstrap.Form.Row,
|
|
742
1786
|
null,
|
|
743
|
-
React__default
|
|
1787
|
+
React__default.createElement(
|
|
744
1788
|
reactBootstrap.Form.Group,
|
|
745
1789
|
{ as: reactBootstrap.Col },
|
|
746
|
-
React__default
|
|
1790
|
+
React__default.createElement(
|
|
747
1791
|
'a',
|
|
748
1792
|
{ href: '/auth/login' },
|
|
749
1793
|
'I already have an account'
|
|
750
1794
|
)
|
|
751
1795
|
),
|
|
752
|
-
React__default
|
|
1796
|
+
React__default.createElement(
|
|
753
1797
|
reactBootstrap.Form.Group,
|
|
754
1798
|
{ as: reactBootstrap.Col, className: 'text-right' },
|
|
755
|
-
!loading && React__default
|
|
1799
|
+
!loading && React__default.createElement(
|
|
756
1800
|
reactBootstrap.Button,
|
|
757
1801
|
{ type: 'submit' },
|
|
758
1802
|
'Sign Up'
|
|
759
1803
|
),
|
|
760
|
-
loading && React__default
|
|
1804
|
+
loading && React__default.createElement(
|
|
761
1805
|
reactBootstrap.Button,
|
|
762
1806
|
{ variant: 'primary', disabled: true },
|
|
763
|
-
React__default
|
|
1807
|
+
React__default.createElement(reactBootstrap.Spinner, {
|
|
764
1808
|
as: 'span',
|
|
765
1809
|
animation: 'border',
|
|
766
1810
|
role: 'status',
|
|
767
1811
|
'aria-hidden': 'true',
|
|
768
1812
|
size: 'sm'
|
|
769
1813
|
}),
|
|
770
|
-
React__default
|
|
1814
|
+
React__default.createElement(
|
|
771
1815
|
'span',
|
|
772
1816
|
{ className: 'sr-only' },
|
|
773
1817
|
'Loading...'
|
|
@@ -775,12 +1819,12 @@ var SignupForm = function SignupForm(props) {
|
|
|
775
1819
|
)
|
|
776
1820
|
)
|
|
777
1821
|
),
|
|
778
|
-
errorMsg && React__default
|
|
1822
|
+
errorMsg && React__default.createElement(
|
|
779
1823
|
'p',
|
|
780
1824
|
{ className: 'error' },
|
|
781
1825
|
errorMsg
|
|
782
1826
|
),
|
|
783
|
-
React__default
|
|
1827
|
+
React__default.createElement(
|
|
784
1828
|
'style',
|
|
785
1829
|
{ jsx: 'true'.toString() },
|
|
786
1830
|
' \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 '
|
|
@@ -1070,32 +2114,32 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1070
2114
|
loading = _useState18[0],
|
|
1071
2115
|
setLoading = _useState18[1];
|
|
1072
2116
|
|
|
1073
|
-
return React__default
|
|
2117
|
+
return React__default.createElement(
|
|
1074
2118
|
reactBootstrap.Form,
|
|
1075
2119
|
{ className: 'login', id: 'signupForm', onSubmit: handleSubmit },
|
|
1076
|
-
React__default
|
|
2120
|
+
React__default.createElement(
|
|
1077
2121
|
'h1',
|
|
1078
2122
|
null,
|
|
1079
2123
|
'Profile'
|
|
1080
2124
|
),
|
|
1081
|
-
React__default
|
|
1082
|
-
userData ? React__default
|
|
1083
|
-
React__default
|
|
2125
|
+
React__default.createElement('hr', null),
|
|
2126
|
+
userData ? React__default.createElement(
|
|
2127
|
+
React__default.Fragment,
|
|
1084
2128
|
null,
|
|
1085
2129
|
returnFormField({ name: 'email', label: 'Email', type: 'email', required: true, readonly: true, default_value: userData.email }),
|
|
1086
|
-
React__default
|
|
2130
|
+
React__default.createElement(
|
|
1087
2131
|
reactBootstrap.Form.Row,
|
|
1088
2132
|
null,
|
|
1089
2133
|
returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: reactBootstrap.Col, required: false }),
|
|
1090
2134
|
returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: reactBootstrap.Col, required: false })
|
|
1091
2135
|
),
|
|
1092
|
-
React__default
|
|
2136
|
+
React__default.createElement(
|
|
1093
2137
|
reactBootstrap.Form.Row,
|
|
1094
2138
|
null,
|
|
1095
2139
|
returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: reactBootstrap.Col, required: true, default_value: userData.shared.first_name }),
|
|
1096
2140
|
returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: reactBootstrap.Col, required: true, default_value: userData.shared.last_name })
|
|
1097
2141
|
),
|
|
1098
|
-
React__default
|
|
2142
|
+
React__default.createElement(
|
|
1099
2143
|
reactBootstrap.Form.Row,
|
|
1100
2144
|
null,
|
|
1101
2145
|
returnFormField({
|
|
@@ -1110,7 +2154,7 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1110
2154
|
}),
|
|
1111
2155
|
countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: reactBootstrap.Col, options: states, default_value: userData.shared.state })
|
|
1112
2156
|
),
|
|
1113
|
-
React__default
|
|
2157
|
+
React__default.createElement(
|
|
1114
2158
|
reactBootstrap.Form.Row,
|
|
1115
2159
|
null,
|
|
1116
2160
|
countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: reactBootstrap.Col, default_value: userData.shared.zip }),
|
|
@@ -1160,29 +2204,29 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1160
2204
|
required: true,
|
|
1161
2205
|
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' }]
|
|
1162
2206
|
}),
|
|
1163
|
-
React__default
|
|
1164
|
-
React__default
|
|
2207
|
+
React__default.createElement('hr', null),
|
|
2208
|
+
React__default.createElement(
|
|
1165
2209
|
reactBootstrap.Form.Row,
|
|
1166
2210
|
null,
|
|
1167
|
-
React__default
|
|
2211
|
+
React__default.createElement(
|
|
1168
2212
|
reactBootstrap.Form.Group,
|
|
1169
2213
|
{ as: reactBootstrap.Col },
|
|
1170
|
-
!loading && React__default
|
|
2214
|
+
!loading && React__default.createElement(
|
|
1171
2215
|
reactBootstrap.Button,
|
|
1172
2216
|
{ type: 'submit' },
|
|
1173
2217
|
'Update'
|
|
1174
2218
|
),
|
|
1175
|
-
loading && React__default
|
|
2219
|
+
loading && React__default.createElement(
|
|
1176
2220
|
reactBootstrap.Button,
|
|
1177
2221
|
{ variant: 'primary', disabled: true },
|
|
1178
|
-
React__default
|
|
2222
|
+
React__default.createElement(reactBootstrap.Spinner, {
|
|
1179
2223
|
as: 'span',
|
|
1180
2224
|
animation: 'border',
|
|
1181
2225
|
role: 'status',
|
|
1182
2226
|
'aria-hidden': 'true',
|
|
1183
2227
|
size: 'sm'
|
|
1184
2228
|
}),
|
|
1185
|
-
React__default
|
|
2229
|
+
React__default.createElement(
|
|
1186
2230
|
'span',
|
|
1187
2231
|
{ className: 'sr-only' },
|
|
1188
2232
|
'Loading...'
|
|
@@ -1190,24 +2234,24 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1190
2234
|
)
|
|
1191
2235
|
)
|
|
1192
2236
|
)
|
|
1193
|
-
) : React__default
|
|
2237
|
+
) : React__default.createElement(reactBootstrap.Spinner, {
|
|
1194
2238
|
as: 'span',
|
|
1195
2239
|
animation: 'border',
|
|
1196
2240
|
role: 'status',
|
|
1197
2241
|
'aria-hidden': 'true',
|
|
1198
2242
|
size: 'sm'
|
|
1199
2243
|
}),
|
|
1200
|
-
errorMsg && React__default
|
|
2244
|
+
errorMsg && React__default.createElement(
|
|
1201
2245
|
'p',
|
|
1202
2246
|
{ className: 'error' },
|
|
1203
2247
|
errorMsg
|
|
1204
2248
|
),
|
|
1205
|
-
successMsg && React__default
|
|
2249
|
+
successMsg && React__default.createElement(
|
|
1206
2250
|
'p',
|
|
1207
2251
|
{ className: 'success' },
|
|
1208
2252
|
successMsg
|
|
1209
2253
|
),
|
|
1210
|
-
React__default
|
|
2254
|
+
React__default.createElement(
|
|
1211
2255
|
'style',
|
|
1212
2256
|
{ jsx: 'true'.toString() },
|
|
1213
2257
|
' \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 '
|
|
@@ -1220,7 +2264,7 @@ var MAX_AGE = 60 * 60 * 8; // 8 hours
|
|
|
1220
2264
|
|
|
1221
2265
|
function setTokenCookie(res, token, eKey) {
|
|
1222
2266
|
var cookies_serailized = [];
|
|
1223
|
-
cookies_serailized.push(index.serialize_1(TOKEN_NAME, token, {
|
|
2267
|
+
cookies_serailized.push(index$6.serialize_1(TOKEN_NAME, token, {
|
|
1224
2268
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1225
2269
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1226
2270
|
//httpOnly: true,
|
|
@@ -1229,7 +2273,7 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1229
2273
|
//sameSite: 'lax',
|
|
1230
2274
|
}));
|
|
1231
2275
|
|
|
1232
|
-
cookies_serailized.push(index.serialize_1('eKey', eKey, {
|
|
2276
|
+
cookies_serailized.push(index$6.serialize_1('eKey', eKey, {
|
|
1233
2277
|
//maxAge: MAX_AGE, // we want login cookie to expire when browser
|
|
1234
2278
|
//expires: new Date(Date.now() + MAX_AGE * 1000),
|
|
1235
2279
|
//httpOnly: true,
|
|
@@ -1243,12 +2287,12 @@ function setTokenCookie(res, token, eKey) {
|
|
|
1243
2287
|
|
|
1244
2288
|
function removeTokenCookie(res) {
|
|
1245
2289
|
var cookies_serailized = [];
|
|
1246
|
-
cookies_serailized.push(index.serialize_1(TOKEN_NAME, '', {
|
|
2290
|
+
cookies_serailized.push(index$6.serialize_1(TOKEN_NAME, '', {
|
|
1247
2291
|
maxAge: -1,
|
|
1248
2292
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1249
2293
|
path: '/'
|
|
1250
2294
|
}));
|
|
1251
|
-
cookies_serailized.push(index.serialize_1('eKey', '', {
|
|
2295
|
+
cookies_serailized.push(index$6.serialize_1('eKey', '', {
|
|
1252
2296
|
maxAge: -1,
|
|
1253
2297
|
expires: new Date(Date.now() - MAX_AGE * 1000),
|
|
1254
2298
|
path: '/'
|
|
@@ -1263,7 +2307,7 @@ function parseCookies(req) {
|
|
|
1263
2307
|
|
|
1264
2308
|
// For pages we do need to parse the cookies.
|
|
1265
2309
|
var cookie = req.headers ? req.headers.cookie : null;
|
|
1266
|
-
return index.parse_1(cookie || '');
|
|
2310
|
+
return index$6.parse_1(cookie || '');
|
|
1267
2311
|
}
|
|
1268
2312
|
|
|
1269
2313
|
function getTokenCookie(req) {
|
|
@@ -1344,7 +2388,7 @@ var isArguments = function isArguments(value) {
|
|
|
1344
2388
|
var keysShim;
|
|
1345
2389
|
if (!Object.keys) {
|
|
1346
2390
|
// modified from https://github.com/es-shims/es5-shim
|
|
1347
|
-
var has = Object.prototype.hasOwnProperty;
|
|
2391
|
+
var has$1 = Object.prototype.hasOwnProperty;
|
|
1348
2392
|
var toStr$1 = Object.prototype.toString;
|
|
1349
2393
|
var isArgs = isArguments; // eslint-disable-line global-require
|
|
1350
2394
|
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
@@ -1393,7 +2437,7 @@ if (!Object.keys) {
|
|
|
1393
2437
|
if (typeof window === 'undefined') { return false; }
|
|
1394
2438
|
for (var k in window) {
|
|
1395
2439
|
try {
|
|
1396
|
-
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
2440
|
+
if (!excludedKeys['$' + k] && has$1.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
1397
2441
|
try {
|
|
1398
2442
|
equalsConstructorPrototype(window[k]);
|
|
1399
2443
|
} catch (e) {
|
|
@@ -1430,7 +2474,7 @@ if (!Object.keys) {
|
|
|
1430
2474
|
}
|
|
1431
2475
|
|
|
1432
2476
|
var skipProto = hasProtoEnumBug && isFunction;
|
|
1433
|
-
if (isString && object.length > 0 && !has.call(object, 0)) {
|
|
2477
|
+
if (isString && object.length > 0 && !has$1.call(object, 0)) {
|
|
1434
2478
|
for (var i = 0; i < object.length; ++i) {
|
|
1435
2479
|
theKeys.push(String(i));
|
|
1436
2480
|
}
|
|
@@ -1442,7 +2486,7 @@ if (!Object.keys) {
|
|
|
1442
2486
|
}
|
|
1443
2487
|
} else {
|
|
1444
2488
|
for (var name in object) {
|
|
1445
|
-
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
|
2489
|
+
if (!(skipProto && name === 'prototype') && has$1.call(object, name)) {
|
|
1446
2490
|
theKeys.push(String(name));
|
|
1447
2491
|
}
|
|
1448
2492
|
}
|
|
@@ -1452,7 +2496,7 @@ if (!Object.keys) {
|
|
|
1452
2496
|
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
|
1453
2497
|
|
|
1454
2498
|
for (var k = 0; k < dontEnums.length; ++k) {
|
|
1455
|
-
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
|
2499
|
+
if (!(skipConstructor && dontEnums[k] === 'constructor') && has$1.call(object, dontEnums[k])) {
|
|
1456
2500
|
theKeys.push(dontEnums[k]);
|
|
1457
2501
|
}
|
|
1458
2502
|
}
|
|
@@ -1858,14 +2902,7 @@ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
1858
2902
|
if (!allowMissing && !(parts[i] in value)) {
|
|
1859
2903
|
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1860
2904
|
}
|
|
1861
|
-
|
|
1862
|
-
// property to emulate a data property that does not suffer from
|
|
1863
|
-
// the override mistake, that accessor's getter is marked with
|
|
1864
|
-
// an `originalValue` property. Here, when we detect this, we
|
|
1865
|
-
// uphold the illusion by pretending to see that original data
|
|
1866
|
-
// property, i.e., returning the value rather than the getter
|
|
1867
|
-
// itself.
|
|
1868
|
-
value = desc && 'get' in desc && !('originalValue' in desc.get) ? desc.get : value[parts[i]];
|
|
2905
|
+
value = desc ? (desc.get || desc.value) : value[parts[i]];
|
|
1869
2906
|
} else {
|
|
1870
2907
|
value = value[parts[i]];
|
|
1871
2908
|
}
|
|
@@ -1874,42 +2911,18 @@ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
1874
2911
|
return value;
|
|
1875
2912
|
};
|
|
1876
2913
|
|
|
1877
|
-
var
|
|
1878
|
-
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
1884
|
-
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
1885
|
-
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
|
|
2914
|
+
var $Function = GetIntrinsic('%Function%');
|
|
2915
|
+
var $apply = $Function.apply;
|
|
2916
|
+
var $call = $Function.call;
|
|
1886
2917
|
|
|
1887
|
-
var
|
|
1888
|
-
|
|
1889
|
-
if ($defineProperty) {
|
|
1890
|
-
try {
|
|
1891
|
-
$defineProperty({}, 'a', { value: 1 });
|
|
1892
|
-
} catch (e) {
|
|
1893
|
-
// IE 8 has a broken defineProperty
|
|
1894
|
-
$defineProperty = null;
|
|
1895
|
-
}
|
|
1896
|
-
}
|
|
1897
|
-
|
|
1898
|
-
module.exports = function callBind() {
|
|
1899
|
-
return $reflectApply(functionBind, $call, arguments);
|
|
2918
|
+
var callBind = function callBind() {
|
|
2919
|
+
return functionBind.apply($call, arguments);
|
|
1900
2920
|
};
|
|
1901
2921
|
|
|
1902
|
-
var
|
|
1903
|
-
return
|
|
2922
|
+
var apply = function applyBind() {
|
|
2923
|
+
return functionBind.apply($apply, arguments);
|
|
1904
2924
|
};
|
|
1905
|
-
|
|
1906
|
-
if ($defineProperty) {
|
|
1907
|
-
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
1908
|
-
} else {
|
|
1909
|
-
module.exports.apply = applyBind;
|
|
1910
|
-
}
|
|
1911
|
-
});
|
|
1912
|
-
var callBind_1 = callBind.apply;
|
|
2925
|
+
callBind.apply = apply;
|
|
1913
2926
|
|
|
1914
2927
|
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
|
1915
2928
|
|
|
@@ -2033,7 +3046,7 @@ var Type = function Type(x) {
|
|
|
2033
3046
|
}
|
|
2034
3047
|
};
|
|
2035
3048
|
|
|
2036
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-
|
|
3049
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
|
|
2037
3050
|
|
|
2038
3051
|
var Type$1 = function Type$1(x) {
|
|
2039
3052
|
if (typeof x === 'symbol') {
|
|
@@ -2102,62 +3115,42 @@ var IsPropertyKey = function IsPropertyKey(argument) {
|
|
|
2102
3115
|
return typeof argument === 'string' || typeof argument === 'symbol';
|
|
2103
3116
|
};
|
|
2104
3117
|
|
|
2105
|
-
var
|
|
2106
|
-
var
|
|
2107
|
-
var hasOwnProperty;
|
|
2108
|
-
var regexExec;
|
|
2109
|
-
var isRegexMarker;
|
|
2110
|
-
var badStringifier;
|
|
2111
|
-
|
|
2112
|
-
if (hasToStringTag) {
|
|
2113
|
-
hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
2114
|
-
regexExec = Function.call.bind(RegExp.prototype.exec);
|
|
2115
|
-
isRegexMarker = {};
|
|
2116
|
-
|
|
2117
|
-
var throwRegexMarker = function () {
|
|
2118
|
-
throw isRegexMarker;
|
|
2119
|
-
};
|
|
2120
|
-
badStringifier = {
|
|
2121
|
-
toString: throwRegexMarker,
|
|
2122
|
-
valueOf: throwRegexMarker
|
|
2123
|
-
};
|
|
3118
|
+
var regexExec = RegExp.prototype.exec;
|
|
3119
|
+
var gOPD = Object.getOwnPropertyDescriptor;
|
|
2124
3120
|
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
3121
|
+
var tryRegexExecCall = function tryRegexExec(value) {
|
|
3122
|
+
try {
|
|
3123
|
+
var lastIndex = value.lastIndex;
|
|
3124
|
+
value.lastIndex = 0; // eslint-disable-line no-param-reassign
|
|
2129
3125
|
|
|
3126
|
+
regexExec.call(value);
|
|
3127
|
+
return true;
|
|
3128
|
+
} catch (e) {
|
|
3129
|
+
return false;
|
|
3130
|
+
} finally {
|
|
3131
|
+
value.lastIndex = lastIndex; // eslint-disable-line no-param-reassign
|
|
3132
|
+
}
|
|
3133
|
+
};
|
|
2130
3134
|
var toStr$5 = Object.prototype.toString;
|
|
2131
|
-
var gOPD = Object.getOwnPropertyDescriptor;
|
|
2132
3135
|
var regexClass = '[object RegExp]';
|
|
3136
|
+
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
|
2133
3137
|
|
|
2134
|
-
var isRegex =
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
|
|
2140
|
-
|
|
2141
|
-
var descriptor = gOPD(value, 'lastIndex');
|
|
2142
|
-
var hasLastIndexDataProperty = descriptor && hasOwnProperty(descriptor, 'value');
|
|
2143
|
-
if (!hasLastIndexDataProperty) {
|
|
2144
|
-
return false;
|
|
2145
|
-
}
|
|
3138
|
+
var isRegex = function isRegex(value) {
|
|
3139
|
+
if (!value || typeof value !== 'object') {
|
|
3140
|
+
return false;
|
|
3141
|
+
}
|
|
3142
|
+
if (!hasToStringTag) {
|
|
3143
|
+
return toStr$5.call(value) === regexClass;
|
|
3144
|
+
}
|
|
2146
3145
|
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
|
|
2150
|
-
|
|
2151
|
-
}
|
|
3146
|
+
var descriptor = gOPD(value, 'lastIndex');
|
|
3147
|
+
var hasLastIndexDataProperty = descriptor && src(descriptor, 'value');
|
|
3148
|
+
if (!hasLastIndexDataProperty) {
|
|
3149
|
+
return false;
|
|
2152
3150
|
}
|
|
2153
|
-
: function isRegex(value) {
|
|
2154
|
-
// In older browsers, typeof regex incorrectly returns 'function'
|
|
2155
|
-
if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
|
|
2156
|
-
return false;
|
|
2157
|
-
}
|
|
2158
3151
|
|
|
2159
|
-
|
|
2160
|
-
|
|
3152
|
+
return tryRegexExecCall(value);
|
|
3153
|
+
};
|
|
2161
3154
|
|
|
2162
3155
|
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.2
|
|
2163
3156
|
|
|
@@ -2185,27 +3178,6 @@ var IsRegExp = function IsRegExp(argument) {
|
|
|
2185
3178
|
};
|
|
2186
3179
|
|
|
2187
3180
|
var fnToStr = Function.prototype.toString;
|
|
2188
|
-
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
|
|
2189
|
-
var badArrayLike;
|
|
2190
|
-
var isCallableMarker;
|
|
2191
|
-
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
|
|
2192
|
-
try {
|
|
2193
|
-
badArrayLike = Object.defineProperty({}, 'length', {
|
|
2194
|
-
get: function () {
|
|
2195
|
-
throw isCallableMarker;
|
|
2196
|
-
}
|
|
2197
|
-
});
|
|
2198
|
-
isCallableMarker = {};
|
|
2199
|
-
// eslint-disable-next-line no-throw-literal
|
|
2200
|
-
reflectApply(function () { throw 42; }, null, badArrayLike);
|
|
2201
|
-
} catch (_) {
|
|
2202
|
-
if (_ !== isCallableMarker) {
|
|
2203
|
-
reflectApply = null;
|
|
2204
|
-
}
|
|
2205
|
-
}
|
|
2206
|
-
} else {
|
|
2207
|
-
reflectApply = null;
|
|
2208
|
-
}
|
|
2209
3181
|
|
|
2210
3182
|
var constructorRegex = /^\s*class\b/;
|
|
2211
3183
|
var isES6ClassFn = function isES6ClassFunction(value) {
|
|
@@ -2231,27 +3203,15 @@ var fnClass = '[object Function]';
|
|
|
2231
3203
|
var genClass = '[object GeneratorFunction]';
|
|
2232
3204
|
var hasToStringTag$1 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
|
2233
3205
|
|
|
2234
|
-
var isCallable =
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
}
|
|
2244
|
-
return !isES6ClassFn(value);
|
|
2245
|
-
}
|
|
2246
|
-
: function isCallable(value) {
|
|
2247
|
-
if (!value) { return false; }
|
|
2248
|
-
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
2249
|
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
2250
|
-
if (hasToStringTag$1) { return tryFunctionObject(value); }
|
|
2251
|
-
if (isES6ClassFn(value)) { return false; }
|
|
2252
|
-
var strClass = toStr$6.call(value);
|
|
2253
|
-
return strClass === fnClass || strClass === genClass;
|
|
2254
|
-
};
|
|
3206
|
+
var isCallable = function isCallable(value) {
|
|
3207
|
+
if (!value) { return false; }
|
|
3208
|
+
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
3209
|
+
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
3210
|
+
if (hasToStringTag$1) { return tryFunctionObject(value); }
|
|
3211
|
+
if (isES6ClassFn(value)) { return false; }
|
|
3212
|
+
var strClass = toStr$6.call(value);
|
|
3213
|
+
return strClass === fnClass || strClass === genClass;
|
|
3214
|
+
};
|
|
2255
3215
|
|
|
2256
3216
|
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.11
|
|
2257
3217
|
|
|
@@ -2286,7 +3246,7 @@ var ToPropertyDescriptor = function ToPropertyDescriptor(Obj) {
|
|
|
2286
3246
|
if (src(Obj, 'get')) {
|
|
2287
3247
|
var getter = Obj.get;
|
|
2288
3248
|
if (typeof getter !== 'undefined' && !IsCallable(getter)) {
|
|
2289
|
-
throw new
|
|
3249
|
+
throw new TypeError('getter must be a function');
|
|
2290
3250
|
}
|
|
2291
3251
|
desc['[[Get]]'] = getter;
|
|
2292
3252
|
}
|
|
@@ -2417,8 +3377,8 @@ var CreateDataProperty = function CreateDataProperty(O, P, V) {
|
|
|
2417
3377
|
throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
|
|
2418
3378
|
}
|
|
2419
3379
|
var oldDesc = OrdinaryGetOwnProperty(O, P);
|
|
2420
|
-
var extensible =
|
|
2421
|
-
var immutable = oldDesc && (!oldDesc
|
|
3380
|
+
var extensible = oldDesc || IsExtensible(O);
|
|
3381
|
+
var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
|
|
2422
3382
|
if (immutable || !extensible) {
|
|
2423
3383
|
return false;
|
|
2424
3384
|
}
|
|
@@ -2535,10 +3495,10 @@ var $slice = callBound('Array.prototype.slice');
|
|
|
2535
3495
|
var $concat$1 = callBound('Array.prototype.concat');
|
|
2536
3496
|
var $forEach = callBound('Array.prototype.forEach');
|
|
2537
3497
|
|
|
2538
|
-
var hasSymbols$
|
|
3498
|
+
var hasSymbols$3 = hasSymbols$1();
|
|
2539
3499
|
|
|
2540
|
-
var kCustomPromisifiedSymbol = hasSymbols$
|
|
2541
|
-
var kCustomPromisifyArgsSymbol = hasSymbols$
|
|
3500
|
+
var kCustomPromisifiedSymbol = hasSymbols$3 ? Symbol('util.promisify.custom') : null;
|
|
3501
|
+
var kCustomPromisifyArgsSymbol = hasSymbols$3 ? Symbol('customPromisifyArgs') : null;
|
|
2542
3502
|
|
|
2543
3503
|
var implementation$3 = function promisify(orig) {
|
|
2544
3504
|
if (typeof orig !== 'function') {
|
|
@@ -2548,7 +3508,7 @@ var implementation$3 = function promisify(orig) {
|
|
|
2548
3508
|
throw error;
|
|
2549
3509
|
}
|
|
2550
3510
|
|
|
2551
|
-
if (hasSymbols$
|
|
3511
|
+
if (hasSymbols$3 && orig[kCustomPromisifiedSymbol]) {
|
|
2552
3512
|
var customFunction = orig[kCustomPromisifiedSymbol];
|
|
2553
3513
|
if (typeof customFunction !== 'function') {
|
|
2554
3514
|
throw new TypeError('The [util.promisify.custom] property must be a function');
|
|
@@ -2655,7 +3615,7 @@ function connect() {
|
|
|
2655
3615
|
};
|
|
2656
3616
|
}
|
|
2657
3617
|
|
|
2658
|
-
var connection =
|
|
3618
|
+
var connection = mysql.createConnection(config);
|
|
2659
3619
|
return {
|
|
2660
3620
|
query: function query(sql, args) {
|
|
2661
3621
|
return util.util.promisify(connection.query).call(connection, sql, args);
|
|
@@ -3298,7 +4258,7 @@ var user = /*#__PURE__*/Object.freeze({
|
|
|
3298
4258
|
findUser: findUser$1
|
|
3299
4259
|
});
|
|
3300
4260
|
|
|
3301
|
-
var localStrategy = new
|
|
4261
|
+
var localStrategy = new Local.Strategy({
|
|
3302
4262
|
usernameField: 'email',
|
|
3303
4263
|
passwordField: 'password'
|
|
3304
4264
|
}, function (email, password, done) {
|