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