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