@mjhls/mjh-framework 1.0.859-segment-targeting-v3 → 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 +1 -1
- package/dist/cjs/AD.js +9 -10
- package/dist/cjs/AD300x250.js +16 -19
- package/dist/cjs/AD300x250x600.js +16 -19
- package/dist/cjs/AD728x90.js +17 -20
- package/dist/cjs/ADFloatingFooter.js +18 -21
- package/dist/cjs/ADFooter.js +11 -14
- package/dist/cjs/ADGutter.js +18 -21
- package/dist/cjs/{ADInfeed-7cd00f5d.js → ADInfeed-7c09edba.js} +10 -12
- package/dist/cjs/ADSkyscraper.js +18 -21
- package/dist/cjs/ADSponsoredResources.js +18 -21
- package/dist/cjs/ADWebcast.js +18 -21
- package/dist/cjs/ADWelcome.js +22 -25
- package/dist/cjs/{ADlgInfeed-0c68c2d8.js → ADlgInfeed-2e7effc7.js} +7 -8
- package/dist/cjs/AccordionPanel.js +25 -29
- package/dist/cjs/AdSlot.js +20 -23
- package/dist/cjs/AdSlotsProvider.js +907 -18
- package/dist/cjs/AlgoliaSearch.js +849 -959
- package/dist/cjs/AlphabeticList.js +21 -24
- package/dist/cjs/ArticleCarousel.js +15 -18
- package/dist/cjs/ArticleProgramLandingPage.js +34 -37
- package/dist/cjs/ArticleSeriesLandingPage.js +30 -33
- package/dist/cjs/ArticleSeriesListing.js +46 -49
- package/dist/cjs/Auth.js +1203 -245
- package/dist/cjs/AuthWrapper.js +41 -124
- 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 +71 -73
- package/dist/cjs/Column1.js +11 -14
- package/dist/cjs/Column2.js +25 -30
- package/dist/cjs/Column3.js +41 -46
- package/dist/cjs/ConferenceArticleCard.js +20 -18
- package/dist/cjs/ConferenceBanner-4a16fddc.js +23 -0
- package/dist/cjs/DeckContent.js +83 -89
- package/dist/cjs/DeckQueue.js +77 -82
- package/dist/cjs/{Dfp-391fd124.js → Dfp-14d2455c.js} +25 -28
- package/dist/cjs/EventsDeck.js +127 -136
- package/dist/cjs/ExternalResources.js +58 -61
- package/dist/cjs/Feature.js +26 -25
- package/dist/cjs/ForbesHero.js +37 -40
- package/dist/cjs/GridContent.js +214 -221
- package/dist/cjs/GridHero.js +38 -41
- package/dist/cjs/GroupDeck.js +52 -55
- package/dist/cjs/HamMagazine.js +121 -128
- 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 +48 -51
- 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 +40 -43
- package/dist/cjs/LeftNav.js +27 -31
- package/dist/cjs/MasterDeck.js +60 -63
- package/dist/cjs/MediaSeriesLanding.js +792 -741
- package/dist/cjs/NavDvm.js +68 -75
- package/dist/cjs/{NavFooter-3dcd99a8.js → NavFooter-76c913e3.js} +14 -15
- package/dist/cjs/NavMagazine.js +121 -128
- package/dist/cjs/NavNative.js +113 -123
- 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 +1179 -84
- package/dist/cjs/PdfDownload.js +8 -9
- package/dist/cjs/PopUpModal.js +16 -20
- package/dist/cjs/PubSection.js +27 -30
- package/dist/cjs/PubToc.js +12 -15
- package/dist/cjs/PublicationDeck.js +62 -64
- package/dist/cjs/PublicationLanding.js +118 -124
- package/dist/cjs/QueueDeckExpanded.js +293 -295
- package/dist/cjs/RecentNews.js +19 -20
- package/dist/cjs/RelatedContent.js +25 -23
- package/dist/cjs/RelatedTopicsDropdown.js +19 -22
- package/dist/cjs/RolesDeck.js +27 -32
- package/dist/cjs/Search.js +15 -21
- package/dist/cjs/Segment.js +25 -15
- package/dist/cjs/SeriesListingDeck.js +31 -33
- package/dist/cjs/{SeriesSlider-0d3bf265.js → SeriesSlider-94af9fcb.js} +34 -35
- package/dist/cjs/SideFooter.js +28 -31
- 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 +33 -36
- package/dist/cjs/TemplateNormal.js +43 -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 +51 -57
- package/dist/cjs/VideoSeriesCard.js +26 -27
- package/dist/cjs/VideoSeriesFilter.js +14 -16
- package/dist/cjs/VideoSeriesLandingPage.js +35 -38
- package/dist/cjs/VideoSeriesListing.js +63 -66
- package/dist/cjs/View.js +216 -228
- package/dist/cjs/YahooHero.js +33 -36
- package/dist/cjs/YoutubeGroup.js +54 -57
- 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/{extends-0a918631.js → extends-eed4f016.js} +8 -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 +23 -25
- package/dist/cjs/{getTargeting-a9a871f0.js → getTargeting-8874437b.js} +3 -3
- package/dist/cjs/getTargeting.js +5 -7
- package/dist/cjs/iconBase-68959171.js +3 -0
- package/dist/cjs/{index-6367b7bf.js → index-3294d3bc.js} +17 -16
- package/dist/cjs/{index-9d365128.js → index-96b3db50.js} +10 -12
- package/dist/cjs/{index-2cf30c83.js → index-98e01cb9.js} +8 -9
- package/dist/cjs/{index-b5eb3ff8.js → index-be0c82be.js} +19 -20
- package/dist/cjs/{index-efd6512d.js → index-cdcc0b5e.js} +963 -968
- 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 +72 -79
- package/dist/cjs/{inherits-0c7830c5.js → inherits-12d44cca.js} +13 -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 +14 -16
- package/dist/esm/AD300x250x600.js +14 -16
- package/dist/esm/AD728x90.js +15 -17
- package/dist/esm/ADFloatingFooter.js +16 -18
- package/dist/esm/ADFooter.js +9 -11
- package/dist/esm/ADGutter.js +16 -18
- package/dist/esm/{ADInfeed-77da0e2a.js → ADInfeed-bfd129d9.js} +8 -8
- package/dist/esm/ADSkyscraper.js +16 -18
- package/dist/esm/ADSponsoredResources.js +16 -18
- package/dist/esm/ADWebcast.js +16 -18
- package/dist/esm/ADWelcome.js +20 -22
- package/dist/esm/{ADlgInfeed-d3e3000f.js → ADlgInfeed-0489335b.js} +5 -5
- package/dist/esm/AccordionPanel.js +20 -22
- package/dist/esm/AdSlot.js +12 -14
- package/dist/esm/AdSlotsProvider.js +906 -16
- package/dist/esm/AlgoliaSearch.js +245 -354
- package/dist/esm/AlphabeticList.js +19 -21
- package/dist/esm/ArticleCarousel.js +13 -15
- package/dist/esm/ArticleProgramLandingPage.js +32 -34
- package/dist/esm/ArticleSeriesLandingPage.js +28 -30
- package/dist/esm/ArticleSeriesListing.js +43 -45
- package/dist/esm/Auth.js +1187 -225
- package/dist/esm/AuthWrapper.js +39 -121
- 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 +68 -70
- package/dist/esm/Column1.js +9 -9
- package/dist/esm/Column2.js +23 -25
- package/dist/esm/Column3.js +39 -41
- package/dist/esm/ConferenceArticleCard.js +18 -15
- package/dist/esm/{ConferenceBanner-9162d0ca.js → ConferenceBanner-8792ebd2.js} +4 -4
- package/dist/esm/DeckContent.js +79 -81
- package/dist/esm/DeckQueue.js +73 -74
- package/dist/esm/{Dfp-2f9796e1.js → Dfp-f867d061.js} +13 -15
- package/dist/esm/EventsDeck.js +102 -104
- package/dist/esm/ExternalResources.js +53 -55
- package/dist/esm/Feature.js +20 -17
- package/dist/esm/ForbesHero.js +31 -33
- package/dist/esm/GridContent.js +183 -185
- package/dist/esm/GridHero.js +32 -34
- package/dist/esm/GroupDeck.js +40 -42
- package/dist/esm/HamMagazine.js +96 -98
- 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 +46 -48
- 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 +38 -40
- package/dist/esm/LeftNav.js +23 -25
- package/dist/esm/MasterDeck.js +57 -59
- package/dist/esm/MediaSeriesLanding.js +518 -464
- package/dist/esm/NavDvm.js +51 -53
- package/dist/esm/{NavFooter-c29526b7.js → NavFooter-e27bd93b.js} +12 -12
- package/dist/esm/NavMagazine.js +98 -100
- package/dist/esm/NavNative.js +88 -90
- 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 +1178 -83
- package/dist/esm/PdfDownload.js +6 -6
- package/dist/esm/PopUpModal.js +11 -13
- package/dist/esm/PubSection.js +25 -27
- package/dist/esm/PubToc.js +10 -12
- package/dist/esm/PublicationDeck.js +54 -51
- package/dist/esm/PublicationLanding.js +77 -79
- package/dist/esm/QueueDeckExpanded.js +259 -261
- package/dist/esm/RecentNews.js +17 -17
- package/dist/esm/RelatedContent.js +20 -17
- package/dist/esm/RelatedTopicsDropdown.js +11 -11
- package/dist/esm/RolesDeck.js +25 -25
- package/dist/esm/Search.js +10 -12
- package/dist/esm/Segment.js +25 -15
- package/dist/esm/SeriesListingDeck.js +26 -28
- package/dist/esm/{SeriesSlider-7d89f4d9.js → SeriesSlider-0371fc11.js} +25 -25
- package/dist/esm/SideFooter.js +25 -27
- 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 +28 -30
- package/dist/esm/TemplateNormal.js +40 -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 +44 -46
- package/dist/esm/VideoSeriesCard.js +21 -21
- package/dist/esm/VideoSeriesFilter.js +11 -13
- package/dist/esm/VideoSeriesLandingPage.js +28 -30
- package/dist/esm/VideoSeriesListing.js +60 -62
- package/dist/esm/View.js +199 -207
- package/dist/esm/YahooHero.js +28 -30
- package/dist/esm/YoutubeGroup.js +39 -41
- 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/{extends-6f2fcc99.js → extends-5b1796d4.js} +1 -1
- 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 +23 -25
- package/dist/esm/{getTargeting-bd800589.js → getTargeting-277c801e.js} +2 -2
- package/dist/esm/getTargeting.js +5 -7
- package/dist/esm/{index-f7fb1e25.js → index-41a678ea.js} +3 -3
- 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-c00b0bbb.js → index-ef6d5dcf.js} +17 -16
- package/dist/esm/{index-23415831.js → index-fe008ffe.js} +914 -909
- 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 +64 -68
- package/dist/esm/{inherits-75d45541.js → inherits-2409637d.js} +4 -5
- 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 +1 -1
- 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/esm/Auth.js
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
import { a as commonjsGlobal
|
|
2
|
-
import './
|
|
3
|
-
import './es6.string.iterator-c990c18c.js';
|
|
1
|
+
import { a as commonjsGlobal } from './_commonjsHelpers-0c4b6f40.js';
|
|
2
|
+
import './core.get-iterator-method-86d4db69.js';
|
|
4
3
|
import './_library-528f1934.js';
|
|
5
|
-
import './_iter-detect-
|
|
6
|
-
import './core.get-iterator-method-e1de7503.js';
|
|
4
|
+
import './_iter-detect-130ee549.js';
|
|
7
5
|
import './_object-pie-33c40e79.js';
|
|
8
|
-
import { _ as _extends } from './extends-
|
|
9
|
-
import './web.dom.iterable-
|
|
10
|
-
import
|
|
6
|
+
import { _ as _extends } from './extends-5b1796d4.js';
|
|
7
|
+
import './web.dom.iterable-f8f967cd.js';
|
|
8
|
+
import React__default, { useEffect, useLayoutEffect, createContext, useContext, useRef, useDebugValue, useState, useCallback, useMemo } from 'react';
|
|
11
9
|
import Router from 'next/router';
|
|
12
|
-
import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-
|
|
13
|
-
import { _ as _JSON$stringify } from './stringify-
|
|
14
|
-
import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-
|
|
10
|
+
import { _ as _slicedToArray, a as _getIterator } from './slicedToArray-67a08c9c.js';
|
|
11
|
+
import { _ as _JSON$stringify } from './stringify-70b72959.js';
|
|
12
|
+
import { a as _asyncToGenerator, r as regenerator } from './asyncToGenerator-7bf8bc4d.js';
|
|
15
13
|
import { Col, Form, Button, Spinner } from 'react-bootstrap';
|
|
16
14
|
import { u as util } from './util-7700fc59.js';
|
|
17
15
|
import { s as serialize_1, p as parse_1 } from './index-db3bb315.js';
|
|
18
|
-
import useSWR from 'swr';
|
|
19
16
|
import Local from 'passport-local';
|
|
20
17
|
import mysql from 'mysql';
|
|
21
|
-
import { m as md5 } from './md5-
|
|
18
|
+
import { m as md5 } from './md5-9be0e905.js';
|
|
22
19
|
|
|
23
20
|
var returnFormField = function returnFormField(_ref) {
|
|
24
21
|
var name = _ref.name,
|
|
@@ -57,21 +54,21 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
57
54
|
}
|
|
58
55
|
|
|
59
56
|
if (type == 'text' || type == 'email' || type == 'password' || type == 'number') {
|
|
60
|
-
return
|
|
57
|
+
return React__default.createElement(
|
|
61
58
|
Form.Group,
|
|
62
59
|
_extends({}, opts, { controlId: name }),
|
|
63
|
-
|
|
60
|
+
React__default.createElement(
|
|
64
61
|
Form.Label,
|
|
65
62
|
{ kye: name + '_label' },
|
|
66
63
|
label,
|
|
67
|
-
required &&
|
|
64
|
+
required && React__default.createElement(
|
|
68
65
|
'span',
|
|
69
66
|
{ style: { color: 'red' } },
|
|
70
67
|
'*'
|
|
71
68
|
)
|
|
72
69
|
),
|
|
73
|
-
|
|
74
|
-
|
|
70
|
+
React__default.createElement(Form.Control, { key: name + '_' + type, type: type, readOnly: readonly, name: name, placeholder: '', defaultValue: default_value, required: required }),
|
|
71
|
+
React__default.createElement(
|
|
75
72
|
Form.Control.Feedback,
|
|
76
73
|
{ key: name + '_feedback', type: 'invalid' },
|
|
77
74
|
errors[name]
|
|
@@ -79,28 +76,28 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
79
76
|
);
|
|
80
77
|
}
|
|
81
78
|
if (type == 'select') {
|
|
82
|
-
return
|
|
79
|
+
return React__default.createElement(
|
|
83
80
|
Form.Group,
|
|
84
81
|
_extends({}, opts, { key: name, controlId: name }),
|
|
85
|
-
|
|
82
|
+
React__default.createElement(
|
|
86
83
|
Form.Label,
|
|
87
84
|
{ key: name + '_' + label },
|
|
88
85
|
label,
|
|
89
|
-
required &&
|
|
86
|
+
required && React__default.createElement(
|
|
90
87
|
'span',
|
|
91
88
|
{ key: name + '_required_span', style: { color: 'red' } },
|
|
92
89
|
'*'
|
|
93
90
|
)
|
|
94
91
|
),
|
|
95
|
-
|
|
92
|
+
React__default.createElement(
|
|
96
93
|
Form.Control,
|
|
97
94
|
{ key: name + '_select', as: 'select', name: name, required: required, defaultValue: default_value },
|
|
98
|
-
|
|
95
|
+
React__default.createElement('option', { value: '', key: name + '_options_empty' }),
|
|
99
96
|
options.map(function (option, index) {
|
|
100
97
|
var value = option.value ? option.value : option;
|
|
101
98
|
var label = option.label ? option.label : option;
|
|
102
99
|
var key = name + '_options_' + index;
|
|
103
|
-
return
|
|
100
|
+
return React__default.createElement(
|
|
104
101
|
'option',
|
|
105
102
|
{ key: key, value: value },
|
|
106
103
|
label
|
|
@@ -111,31 +108,1080 @@ var returnFormField = function returnFormField(_ref) {
|
|
|
111
108
|
}
|
|
112
109
|
|
|
113
110
|
if (type == 'radio' || type == 'checkbox') {
|
|
114
|
-
return
|
|
111
|
+
return React__default.createElement(
|
|
115
112
|
Form.Group,
|
|
116
113
|
opts,
|
|
117
|
-
|
|
114
|
+
React__default.createElement(
|
|
118
115
|
Form.Label,
|
|
119
116
|
null,
|
|
120
117
|
label,
|
|
121
|
-
required &&
|
|
118
|
+
required && React__default.createElement(
|
|
122
119
|
'span',
|
|
123
120
|
{ style: { color: 'red' } },
|
|
124
121
|
'*'
|
|
125
122
|
)
|
|
126
123
|
),
|
|
127
124
|
options.map(function (option, index) {
|
|
128
|
-
return
|
|
125
|
+
return React__default.createElement(
|
|
129
126
|
Form.Check,
|
|
130
127
|
{ type: type, key: index, required: required },
|
|
131
|
-
|
|
132
|
-
|
|
128
|
+
React__default.createElement(Form.Check.Input, { type: type, key: type + '_' + index + '_input', defaultChecked: default_value ? default_value === option.value : false, name: name, id: name + '_' + index, value: option.value, required: required }),
|
|
129
|
+
React__default.createElement(Form.Check.Label, { style: { cursor: 'pointer' }, 'for': name + '_' + index, key: type + '_' + index + '_label', dangerouslySetInnerHTML: { __html: option.label } })
|
|
133
130
|
);
|
|
134
131
|
})
|
|
135
132
|
);
|
|
136
133
|
}
|
|
137
134
|
};
|
|
138
135
|
|
|
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
|
+
|
|
139
1185
|
var _this = undefined;
|
|
140
1186
|
|
|
141
1187
|
var dataHandler = function () {
|
|
@@ -336,43 +1382,43 @@ var LoginForm = function LoginForm(props) {
|
|
|
336
1382
|
loading = _useState4[0],
|
|
337
1383
|
setLoading = _useState4[1];
|
|
338
1384
|
|
|
339
|
-
return
|
|
1385
|
+
return React__default.createElement(
|
|
340
1386
|
Form,
|
|
341
1387
|
{ className: 'login', onSubmit: handleSubmit },
|
|
342
|
-
|
|
1388
|
+
React__default.createElement(
|
|
343
1389
|
'h1',
|
|
344
1390
|
null,
|
|
345
1391
|
'Login'
|
|
346
1392
|
),
|
|
347
|
-
|
|
1393
|
+
React__default.createElement('hr', null),
|
|
348
1394
|
returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
|
|
349
1395
|
returnFormField({ name: 'password', label: 'Password', type: 'password', required: true }),
|
|
350
|
-
|
|
351
|
-
|
|
1396
|
+
React__default.createElement('hr', null),
|
|
1397
|
+
React__default.createElement(
|
|
352
1398
|
Form.Row,
|
|
353
1399
|
null,
|
|
354
|
-
|
|
1400
|
+
React__default.createElement(
|
|
355
1401
|
Form.Group,
|
|
356
1402
|
{ as: Col },
|
|
357
|
-
|
|
1403
|
+
React__default.createElement(
|
|
358
1404
|
'a',
|
|
359
1405
|
{ href: '/auth/signup' },
|
|
360
1406
|
'I don\'t have an account'
|
|
361
1407
|
)
|
|
362
1408
|
),
|
|
363
|
-
|
|
1409
|
+
React__default.createElement(
|
|
364
1410
|
Form.Group,
|
|
365
1411
|
{ as: Col, className: 'text-right' },
|
|
366
|
-
!loading &&
|
|
1412
|
+
!loading && React__default.createElement(
|
|
367
1413
|
Button,
|
|
368
1414
|
{ type: 'submit' },
|
|
369
1415
|
'Login'
|
|
370
1416
|
),
|
|
371
|
-
loading &&
|
|
1417
|
+
loading && React__default.createElement(
|
|
372
1418
|
Button,
|
|
373
1419
|
{ variant: 'primary', disabled: true },
|
|
374
|
-
|
|
375
|
-
|
|
1420
|
+
React__default.createElement(Spinner, { as: 'span', animation: 'border', role: 'status', 'aria-hidden': 'true', size: 'sm' }),
|
|
1421
|
+
React__default.createElement(
|
|
376
1422
|
'span',
|
|
377
1423
|
{ className: 'sr-only' },
|
|
378
1424
|
'Loading...'
|
|
@@ -380,12 +1426,12 @@ var LoginForm = function LoginForm(props) {
|
|
|
380
1426
|
)
|
|
381
1427
|
)
|
|
382
1428
|
),
|
|
383
|
-
errorMsg &&
|
|
1429
|
+
errorMsg && React__default.createElement(
|
|
384
1430
|
'p',
|
|
385
1431
|
{ className: 'error' },
|
|
386
1432
|
errorMsg
|
|
387
1433
|
),
|
|
388
|
-
|
|
1434
|
+
React__default.createElement(
|
|
389
1435
|
'style',
|
|
390
1436
|
{ jsx: 'true'.toString() },
|
|
391
1437
|
'\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 '
|
|
@@ -641,29 +1687,29 @@ var SignupForm = function SignupForm(props) {
|
|
|
641
1687
|
loading = _useState14[0],
|
|
642
1688
|
setLoading = _useState14[1];
|
|
643
1689
|
|
|
644
|
-
return
|
|
1690
|
+
return React__default.createElement(
|
|
645
1691
|
Form,
|
|
646
1692
|
{ className: 'login', id: 'signupForm', onSubmit: handleSubmit },
|
|
647
|
-
|
|
1693
|
+
React__default.createElement(
|
|
648
1694
|
'h1',
|
|
649
1695
|
null,
|
|
650
1696
|
'Sign Up'
|
|
651
1697
|
),
|
|
652
|
-
|
|
1698
|
+
React__default.createElement('hr', null),
|
|
653
1699
|
returnFormField({ name: 'email', label: 'Email', type: 'email', required: true }),
|
|
654
|
-
|
|
1700
|
+
React__default.createElement(
|
|
655
1701
|
Form.Row,
|
|
656
1702
|
null,
|
|
657
1703
|
returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: Col, required: true }),
|
|
658
1704
|
returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: Col, required: true })
|
|
659
1705
|
),
|
|
660
|
-
|
|
1706
|
+
React__default.createElement(
|
|
661
1707
|
Form.Row,
|
|
662
1708
|
null,
|
|
663
1709
|
returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: Col, required: true }),
|
|
664
1710
|
returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: Col, required: true })
|
|
665
1711
|
),
|
|
666
|
-
|
|
1712
|
+
React__default.createElement(
|
|
667
1713
|
Form.Row,
|
|
668
1714
|
null,
|
|
669
1715
|
returnFormField({
|
|
@@ -677,7 +1723,7 @@ var SignupForm = function SignupForm(props) {
|
|
|
677
1723
|
}),
|
|
678
1724
|
countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: Col, options: states })
|
|
679
1725
|
),
|
|
680
|
-
|
|
1726
|
+
React__default.createElement(
|
|
681
1727
|
Form.Row,
|
|
682
1728
|
null,
|
|
683
1729
|
countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: Col }),
|
|
@@ -724,38 +1770,38 @@ var SignupForm = function SignupForm(props) {
|
|
|
724
1770
|
required: true,
|
|
725
1771
|
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' }]
|
|
726
1772
|
}),
|
|
727
|
-
|
|
728
|
-
|
|
1773
|
+
React__default.createElement('hr', null),
|
|
1774
|
+
React__default.createElement(
|
|
729
1775
|
Form.Row,
|
|
730
1776
|
null,
|
|
731
|
-
|
|
1777
|
+
React__default.createElement(
|
|
732
1778
|
Form.Group,
|
|
733
1779
|
{ as: Col },
|
|
734
|
-
|
|
1780
|
+
React__default.createElement(
|
|
735
1781
|
'a',
|
|
736
1782
|
{ href: '/auth/login' },
|
|
737
1783
|
'I already have an account'
|
|
738
1784
|
)
|
|
739
1785
|
),
|
|
740
|
-
|
|
1786
|
+
React__default.createElement(
|
|
741
1787
|
Form.Group,
|
|
742
1788
|
{ as: Col, className: 'text-right' },
|
|
743
|
-
!loading &&
|
|
1789
|
+
!loading && React__default.createElement(
|
|
744
1790
|
Button,
|
|
745
1791
|
{ type: 'submit' },
|
|
746
1792
|
'Sign Up'
|
|
747
1793
|
),
|
|
748
|
-
loading &&
|
|
1794
|
+
loading && React__default.createElement(
|
|
749
1795
|
Button,
|
|
750
1796
|
{ variant: 'primary', disabled: true },
|
|
751
|
-
|
|
1797
|
+
React__default.createElement(Spinner, {
|
|
752
1798
|
as: 'span',
|
|
753
1799
|
animation: 'border',
|
|
754
1800
|
role: 'status',
|
|
755
1801
|
'aria-hidden': 'true',
|
|
756
1802
|
size: 'sm'
|
|
757
1803
|
}),
|
|
758
|
-
|
|
1804
|
+
React__default.createElement(
|
|
759
1805
|
'span',
|
|
760
1806
|
{ className: 'sr-only' },
|
|
761
1807
|
'Loading...'
|
|
@@ -763,12 +1809,12 @@ var SignupForm = function SignupForm(props) {
|
|
|
763
1809
|
)
|
|
764
1810
|
)
|
|
765
1811
|
),
|
|
766
|
-
errorMsg &&
|
|
1812
|
+
errorMsg && React__default.createElement(
|
|
767
1813
|
'p',
|
|
768
1814
|
{ className: 'error' },
|
|
769
1815
|
errorMsg
|
|
770
1816
|
),
|
|
771
|
-
|
|
1817
|
+
React__default.createElement(
|
|
772
1818
|
'style',
|
|
773
1819
|
{ jsx: 'true'.toString() },
|
|
774
1820
|
' \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 '
|
|
@@ -1058,32 +2104,32 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1058
2104
|
loading = _useState18[0],
|
|
1059
2105
|
setLoading = _useState18[1];
|
|
1060
2106
|
|
|
1061
|
-
return
|
|
2107
|
+
return React__default.createElement(
|
|
1062
2108
|
Form,
|
|
1063
2109
|
{ className: 'login', id: 'signupForm', onSubmit: handleSubmit },
|
|
1064
|
-
|
|
2110
|
+
React__default.createElement(
|
|
1065
2111
|
'h1',
|
|
1066
2112
|
null,
|
|
1067
2113
|
'Profile'
|
|
1068
2114
|
),
|
|
1069
|
-
|
|
1070
|
-
userData ?
|
|
1071
|
-
|
|
2115
|
+
React__default.createElement('hr', null),
|
|
2116
|
+
userData ? React__default.createElement(
|
|
2117
|
+
React__default.Fragment,
|
|
1072
2118
|
null,
|
|
1073
2119
|
returnFormField({ name: 'email', label: 'Email', type: 'email', required: true, readonly: true, default_value: userData.email }),
|
|
1074
|
-
|
|
2120
|
+
React__default.createElement(
|
|
1075
2121
|
Form.Row,
|
|
1076
2122
|
null,
|
|
1077
2123
|
returnFormField({ name: 'password', label: 'Password', type: 'password', groupType: Col, required: false }),
|
|
1078
2124
|
returnFormField({ name: 'rpassword', label: 'Retype Password', type: 'password', groupType: Col, required: false })
|
|
1079
2125
|
),
|
|
1080
|
-
|
|
2126
|
+
React__default.createElement(
|
|
1081
2127
|
Form.Row,
|
|
1082
2128
|
null,
|
|
1083
2129
|
returnFormField({ name: 'first_name', label: 'First Name', type: 'text', groupType: Col, required: true, default_value: userData.shared.first_name }),
|
|
1084
2130
|
returnFormField({ name: 'last_name', label: 'Last Name', type: 'text', groupType: Col, required: true, default_value: userData.shared.last_name })
|
|
1085
2131
|
),
|
|
1086
|
-
|
|
2132
|
+
React__default.createElement(
|
|
1087
2133
|
Form.Row,
|
|
1088
2134
|
null,
|
|
1089
2135
|
returnFormField({
|
|
@@ -1098,7 +2144,7 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1098
2144
|
}),
|
|
1099
2145
|
countryUS && returnFormField({ name: 'state', label: 'State', type: 'select', required: true, groupType: Col, options: states, default_value: userData.shared.state })
|
|
1100
2146
|
),
|
|
1101
|
-
|
|
2147
|
+
React__default.createElement(
|
|
1102
2148
|
Form.Row,
|
|
1103
2149
|
null,
|
|
1104
2150
|
countryUS && returnFormField({ name: 'zip', label: 'Working Zip Code', type: 'text', required: true, groupType: Col, default_value: userData.shared.zip }),
|
|
@@ -1148,29 +2194,29 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1148
2194
|
required: true,
|
|
1149
2195
|
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' }]
|
|
1150
2196
|
}),
|
|
1151
|
-
|
|
1152
|
-
|
|
2197
|
+
React__default.createElement('hr', null),
|
|
2198
|
+
React__default.createElement(
|
|
1153
2199
|
Form.Row,
|
|
1154
2200
|
null,
|
|
1155
|
-
|
|
2201
|
+
React__default.createElement(
|
|
1156
2202
|
Form.Group,
|
|
1157
2203
|
{ as: Col },
|
|
1158
|
-
!loading &&
|
|
2204
|
+
!loading && React__default.createElement(
|
|
1159
2205
|
Button,
|
|
1160
2206
|
{ type: 'submit' },
|
|
1161
2207
|
'Update'
|
|
1162
2208
|
),
|
|
1163
|
-
loading &&
|
|
2209
|
+
loading && React__default.createElement(
|
|
1164
2210
|
Button,
|
|
1165
2211
|
{ variant: 'primary', disabled: true },
|
|
1166
|
-
|
|
2212
|
+
React__default.createElement(Spinner, {
|
|
1167
2213
|
as: 'span',
|
|
1168
2214
|
animation: 'border',
|
|
1169
2215
|
role: 'status',
|
|
1170
2216
|
'aria-hidden': 'true',
|
|
1171
2217
|
size: 'sm'
|
|
1172
2218
|
}),
|
|
1173
|
-
|
|
2219
|
+
React__default.createElement(
|
|
1174
2220
|
'span',
|
|
1175
2221
|
{ className: 'sr-only' },
|
|
1176
2222
|
'Loading...'
|
|
@@ -1178,24 +2224,24 @@ var SignupForm$1 = function SignupForm(props) {
|
|
|
1178
2224
|
)
|
|
1179
2225
|
)
|
|
1180
2226
|
)
|
|
1181
|
-
) :
|
|
2227
|
+
) : React__default.createElement(Spinner, {
|
|
1182
2228
|
as: 'span',
|
|
1183
2229
|
animation: 'border',
|
|
1184
2230
|
role: 'status',
|
|
1185
2231
|
'aria-hidden': 'true',
|
|
1186
2232
|
size: 'sm'
|
|
1187
2233
|
}),
|
|
1188
|
-
errorMsg &&
|
|
2234
|
+
errorMsg && React__default.createElement(
|
|
1189
2235
|
'p',
|
|
1190
2236
|
{ className: 'error' },
|
|
1191
2237
|
errorMsg
|
|
1192
2238
|
),
|
|
1193
|
-
successMsg &&
|
|
2239
|
+
successMsg && React__default.createElement(
|
|
1194
2240
|
'p',
|
|
1195
2241
|
{ className: 'success' },
|
|
1196
2242
|
successMsg
|
|
1197
2243
|
),
|
|
1198
|
-
|
|
2244
|
+
React__default.createElement(
|
|
1199
2245
|
'style',
|
|
1200
2246
|
{ jsx: 'true'.toString() },
|
|
1201
2247
|
' \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 '
|
|
@@ -1332,7 +2378,7 @@ var isArguments = function isArguments(value) {
|
|
|
1332
2378
|
var keysShim;
|
|
1333
2379
|
if (!Object.keys) {
|
|
1334
2380
|
// modified from https://github.com/es-shims/es5-shim
|
|
1335
|
-
var has = Object.prototype.hasOwnProperty;
|
|
2381
|
+
var has$1 = Object.prototype.hasOwnProperty;
|
|
1336
2382
|
var toStr$1 = Object.prototype.toString;
|
|
1337
2383
|
var isArgs = isArguments; // eslint-disable-line global-require
|
|
1338
2384
|
var isEnumerable = Object.prototype.propertyIsEnumerable;
|
|
@@ -1381,7 +2427,7 @@ if (!Object.keys) {
|
|
|
1381
2427
|
if (typeof window === 'undefined') { return false; }
|
|
1382
2428
|
for (var k in window) {
|
|
1383
2429
|
try {
|
|
1384
|
-
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
2430
|
+
if (!excludedKeys['$' + k] && has$1.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
|
|
1385
2431
|
try {
|
|
1386
2432
|
equalsConstructorPrototype(window[k]);
|
|
1387
2433
|
} catch (e) {
|
|
@@ -1418,7 +2464,7 @@ if (!Object.keys) {
|
|
|
1418
2464
|
}
|
|
1419
2465
|
|
|
1420
2466
|
var skipProto = hasProtoEnumBug && isFunction;
|
|
1421
|
-
if (isString && object.length > 0 && !has.call(object, 0)) {
|
|
2467
|
+
if (isString && object.length > 0 && !has$1.call(object, 0)) {
|
|
1422
2468
|
for (var i = 0; i < object.length; ++i) {
|
|
1423
2469
|
theKeys.push(String(i));
|
|
1424
2470
|
}
|
|
@@ -1430,7 +2476,7 @@ if (!Object.keys) {
|
|
|
1430
2476
|
}
|
|
1431
2477
|
} else {
|
|
1432
2478
|
for (var name in object) {
|
|
1433
|
-
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
|
|
2479
|
+
if (!(skipProto && name === 'prototype') && has$1.call(object, name)) {
|
|
1434
2480
|
theKeys.push(String(name));
|
|
1435
2481
|
}
|
|
1436
2482
|
}
|
|
@@ -1440,7 +2486,7 @@ if (!Object.keys) {
|
|
|
1440
2486
|
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
|
|
1441
2487
|
|
|
1442
2488
|
for (var k = 0; k < dontEnums.length; ++k) {
|
|
1443
|
-
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
|
|
2489
|
+
if (!(skipConstructor && dontEnums[k] === 'constructor') && has$1.call(object, dontEnums[k])) {
|
|
1444
2490
|
theKeys.push(dontEnums[k]);
|
|
1445
2491
|
}
|
|
1446
2492
|
}
|
|
@@ -1846,14 +2892,7 @@ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
1846
2892
|
if (!allowMissing && !(parts[i] in value)) {
|
|
1847
2893
|
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
|
|
1848
2894
|
}
|
|
1849
|
-
|
|
1850
|
-
// property to emulate a data property that does not suffer from
|
|
1851
|
-
// the override mistake, that accessor's getter is marked with
|
|
1852
|
-
// an `originalValue` property. Here, when we detect this, we
|
|
1853
|
-
// uphold the illusion by pretending to see that original data
|
|
1854
|
-
// property, i.e., returning the value rather than the getter
|
|
1855
|
-
// itself.
|
|
1856
|
-
value = desc && 'get' in desc && !('originalValue' in desc.get) ? desc.get : value[parts[i]];
|
|
2895
|
+
value = desc ? (desc.get || desc.value) : value[parts[i]];
|
|
1857
2896
|
} else {
|
|
1858
2897
|
value = value[parts[i]];
|
|
1859
2898
|
}
|
|
@@ -1862,42 +2901,18 @@ var GetIntrinsic = function GetIntrinsic(name, allowMissing) {
|
|
|
1862
2901
|
return value;
|
|
1863
2902
|
};
|
|
1864
2903
|
|
|
1865
|
-
var
|
|
1866
|
-
|
|
1867
|
-
|
|
1868
|
-
|
|
1869
|
-
|
|
1870
|
-
|
|
1871
|
-
var $apply = GetIntrinsic('%Function.prototype.apply%');
|
|
1872
|
-
var $call = GetIntrinsic('%Function.prototype.call%');
|
|
1873
|
-
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || functionBind.call($call, $apply);
|
|
1874
|
-
|
|
1875
|
-
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
|
|
1876
|
-
|
|
1877
|
-
if ($defineProperty) {
|
|
1878
|
-
try {
|
|
1879
|
-
$defineProperty({}, 'a', { value: 1 });
|
|
1880
|
-
} catch (e) {
|
|
1881
|
-
// IE 8 has a broken defineProperty
|
|
1882
|
-
$defineProperty = null;
|
|
1883
|
-
}
|
|
1884
|
-
}
|
|
2904
|
+
var $Function = GetIntrinsic('%Function%');
|
|
2905
|
+
var $apply = $Function.apply;
|
|
2906
|
+
var $call = $Function.call;
|
|
1885
2907
|
|
|
1886
|
-
|
|
1887
|
-
return
|
|
2908
|
+
var callBind = function callBind() {
|
|
2909
|
+
return functionBind.apply($call, arguments);
|
|
1888
2910
|
};
|
|
1889
2911
|
|
|
1890
|
-
var
|
|
1891
|
-
return
|
|
2912
|
+
var apply = function applyBind() {
|
|
2913
|
+
return functionBind.apply($apply, arguments);
|
|
1892
2914
|
};
|
|
1893
|
-
|
|
1894
|
-
if ($defineProperty) {
|
|
1895
|
-
$defineProperty(module.exports, 'apply', { value: applyBind });
|
|
1896
|
-
} else {
|
|
1897
|
-
module.exports.apply = applyBind;
|
|
1898
|
-
}
|
|
1899
|
-
});
|
|
1900
|
-
var callBind_1 = callBind.apply;
|
|
2915
|
+
callBind.apply = apply;
|
|
1901
2916
|
|
|
1902
2917
|
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
|
|
1903
2918
|
|
|
@@ -2021,7 +3036,7 @@ var Type = function Type(x) {
|
|
|
2021
3036
|
}
|
|
2022
3037
|
};
|
|
2023
3038
|
|
|
2024
|
-
// https://ecma-international.org/ecma-262/6.0/#sec-
|
|
3039
|
+
// https://www.ecma-international.org/ecma-262/6.0/#sec-tostring
|
|
2025
3040
|
|
|
2026
3041
|
var Type$1 = function Type$1(x) {
|
|
2027
3042
|
if (typeof x === 'symbol') {
|
|
@@ -2090,62 +3105,42 @@ var IsPropertyKey = function IsPropertyKey(argument) {
|
|
|
2090
3105
|
return typeof argument === 'string' || typeof argument === 'symbol';
|
|
2091
3106
|
};
|
|
2092
3107
|
|
|
2093
|
-
var
|
|
2094
|
-
var
|
|
2095
|
-
var hasOwnProperty;
|
|
2096
|
-
var regexExec;
|
|
2097
|
-
var isRegexMarker;
|
|
2098
|
-
var badStringifier;
|
|
2099
|
-
|
|
2100
|
-
if (hasToStringTag) {
|
|
2101
|
-
hasOwnProperty = Function.call.bind(Object.prototype.hasOwnProperty);
|
|
2102
|
-
regexExec = Function.call.bind(RegExp.prototype.exec);
|
|
2103
|
-
isRegexMarker = {};
|
|
2104
|
-
|
|
2105
|
-
var throwRegexMarker = function () {
|
|
2106
|
-
throw isRegexMarker;
|
|
2107
|
-
};
|
|
2108
|
-
badStringifier = {
|
|
2109
|
-
toString: throwRegexMarker,
|
|
2110
|
-
valueOf: throwRegexMarker
|
|
2111
|
-
};
|
|
3108
|
+
var regexExec = RegExp.prototype.exec;
|
|
3109
|
+
var gOPD = Object.getOwnPropertyDescriptor;
|
|
2112
3110
|
|
|
2113
|
-
|
|
2114
|
-
|
|
2115
|
-
|
|
2116
|
-
|
|
3111
|
+
var tryRegexExecCall = function tryRegexExec(value) {
|
|
3112
|
+
try {
|
|
3113
|
+
var lastIndex = value.lastIndex;
|
|
3114
|
+
value.lastIndex = 0; // eslint-disable-line no-param-reassign
|
|
2117
3115
|
|
|
3116
|
+
regexExec.call(value);
|
|
3117
|
+
return true;
|
|
3118
|
+
} catch (e) {
|
|
3119
|
+
return false;
|
|
3120
|
+
} finally {
|
|
3121
|
+
value.lastIndex = lastIndex; // eslint-disable-line no-param-reassign
|
|
3122
|
+
}
|
|
3123
|
+
};
|
|
2118
3124
|
var toStr$5 = Object.prototype.toString;
|
|
2119
|
-
var gOPD = Object.getOwnPropertyDescriptor;
|
|
2120
3125
|
var regexClass = '[object RegExp]';
|
|
3126
|
+
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
|
2121
3127
|
|
|
2122
|
-
var isRegex =
|
|
2123
|
-
|
|
2124
|
-
|
|
2125
|
-
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
|
|
2129
|
-
var descriptor = gOPD(value, 'lastIndex');
|
|
2130
|
-
var hasLastIndexDataProperty = descriptor && hasOwnProperty(descriptor, 'value');
|
|
2131
|
-
if (!hasLastIndexDataProperty) {
|
|
2132
|
-
return false;
|
|
2133
|
-
}
|
|
3128
|
+
var isRegex = function isRegex(value) {
|
|
3129
|
+
if (!value || typeof value !== 'object') {
|
|
3130
|
+
return false;
|
|
3131
|
+
}
|
|
3132
|
+
if (!hasToStringTag) {
|
|
3133
|
+
return toStr$5.call(value) === regexClass;
|
|
3134
|
+
}
|
|
2134
3135
|
|
|
2135
|
-
|
|
2136
|
-
|
|
2137
|
-
|
|
2138
|
-
|
|
2139
|
-
}
|
|
3136
|
+
var descriptor = gOPD(value, 'lastIndex');
|
|
3137
|
+
var hasLastIndexDataProperty = descriptor && src(descriptor, 'value');
|
|
3138
|
+
if (!hasLastIndexDataProperty) {
|
|
3139
|
+
return false;
|
|
2140
3140
|
}
|
|
2141
|
-
: function isRegex(value) {
|
|
2142
|
-
// In older browsers, typeof regex incorrectly returns 'function'
|
|
2143
|
-
if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
|
|
2144
|
-
return false;
|
|
2145
|
-
}
|
|
2146
3141
|
|
|
2147
|
-
|
|
2148
|
-
|
|
3142
|
+
return tryRegexExecCall(value);
|
|
3143
|
+
};
|
|
2149
3144
|
|
|
2150
3145
|
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.2
|
|
2151
3146
|
|
|
@@ -2173,27 +3168,6 @@ var IsRegExp = function IsRegExp(argument) {
|
|
|
2173
3168
|
};
|
|
2174
3169
|
|
|
2175
3170
|
var fnToStr = Function.prototype.toString;
|
|
2176
|
-
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
|
|
2177
|
-
var badArrayLike;
|
|
2178
|
-
var isCallableMarker;
|
|
2179
|
-
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
|
|
2180
|
-
try {
|
|
2181
|
-
badArrayLike = Object.defineProperty({}, 'length', {
|
|
2182
|
-
get: function () {
|
|
2183
|
-
throw isCallableMarker;
|
|
2184
|
-
}
|
|
2185
|
-
});
|
|
2186
|
-
isCallableMarker = {};
|
|
2187
|
-
// eslint-disable-next-line no-throw-literal
|
|
2188
|
-
reflectApply(function () { throw 42; }, null, badArrayLike);
|
|
2189
|
-
} catch (_) {
|
|
2190
|
-
if (_ !== isCallableMarker) {
|
|
2191
|
-
reflectApply = null;
|
|
2192
|
-
}
|
|
2193
|
-
}
|
|
2194
|
-
} else {
|
|
2195
|
-
reflectApply = null;
|
|
2196
|
-
}
|
|
2197
3171
|
|
|
2198
3172
|
var constructorRegex = /^\s*class\b/;
|
|
2199
3173
|
var isES6ClassFn = function isES6ClassFunction(value) {
|
|
@@ -2219,27 +3193,15 @@ var fnClass = '[object Function]';
|
|
|
2219
3193
|
var genClass = '[object GeneratorFunction]';
|
|
2220
3194
|
var hasToStringTag$1 = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
|
|
2221
3195
|
|
|
2222
|
-
var isCallable =
|
|
2223
|
-
|
|
2224
|
-
|
|
2225
|
-
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
}
|
|
2232
|
-
return !isES6ClassFn(value);
|
|
2233
|
-
}
|
|
2234
|
-
: function isCallable(value) {
|
|
2235
|
-
if (!value) { return false; }
|
|
2236
|
-
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
2237
|
-
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
2238
|
-
if (hasToStringTag$1) { return tryFunctionObject(value); }
|
|
2239
|
-
if (isES6ClassFn(value)) { return false; }
|
|
2240
|
-
var strClass = toStr$6.call(value);
|
|
2241
|
-
return strClass === fnClass || strClass === genClass;
|
|
2242
|
-
};
|
|
3196
|
+
var isCallable = function isCallable(value) {
|
|
3197
|
+
if (!value) { return false; }
|
|
3198
|
+
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
|
|
3199
|
+
if (typeof value === 'function' && !value.prototype) { return true; }
|
|
3200
|
+
if (hasToStringTag$1) { return tryFunctionObject(value); }
|
|
3201
|
+
if (isES6ClassFn(value)) { return false; }
|
|
3202
|
+
var strClass = toStr$6.call(value);
|
|
3203
|
+
return strClass === fnClass || strClass === genClass;
|
|
3204
|
+
};
|
|
2243
3205
|
|
|
2244
3206
|
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.11
|
|
2245
3207
|
|
|
@@ -2274,7 +3236,7 @@ var ToPropertyDescriptor = function ToPropertyDescriptor(Obj) {
|
|
|
2274
3236
|
if (src(Obj, 'get')) {
|
|
2275
3237
|
var getter = Obj.get;
|
|
2276
3238
|
if (typeof getter !== 'undefined' && !IsCallable(getter)) {
|
|
2277
|
-
throw new
|
|
3239
|
+
throw new TypeError('getter must be a function');
|
|
2278
3240
|
}
|
|
2279
3241
|
desc['[[Get]]'] = getter;
|
|
2280
3242
|
}
|
|
@@ -2405,8 +3367,8 @@ var CreateDataProperty = function CreateDataProperty(O, P, V) {
|
|
|
2405
3367
|
throw new $TypeError$4('Assertion failed: IsPropertyKey(P) is not true');
|
|
2406
3368
|
}
|
|
2407
3369
|
var oldDesc = OrdinaryGetOwnProperty(O, P);
|
|
2408
|
-
var extensible =
|
|
2409
|
-
var immutable = oldDesc && (!oldDesc
|
|
3370
|
+
var extensible = oldDesc || IsExtensible(O);
|
|
3371
|
+
var immutable = oldDesc && (!oldDesc.writable || !oldDesc.configurable);
|
|
2410
3372
|
if (immutable || !extensible) {
|
|
2411
3373
|
return false;
|
|
2412
3374
|
}
|
|
@@ -2523,10 +3485,10 @@ var $slice = callBound('Array.prototype.slice');
|
|
|
2523
3485
|
var $concat$1 = callBound('Array.prototype.concat');
|
|
2524
3486
|
var $forEach = callBound('Array.prototype.forEach');
|
|
2525
3487
|
|
|
2526
|
-
var hasSymbols$
|
|
3488
|
+
var hasSymbols$3 = hasSymbols$1();
|
|
2527
3489
|
|
|
2528
|
-
var kCustomPromisifiedSymbol = hasSymbols$
|
|
2529
|
-
var kCustomPromisifyArgsSymbol = hasSymbols$
|
|
3490
|
+
var kCustomPromisifiedSymbol = hasSymbols$3 ? Symbol('util.promisify.custom') : null;
|
|
3491
|
+
var kCustomPromisifyArgsSymbol = hasSymbols$3 ? Symbol('customPromisifyArgs') : null;
|
|
2530
3492
|
|
|
2531
3493
|
var implementation$3 = function promisify(orig) {
|
|
2532
3494
|
if (typeof orig !== 'function') {
|
|
@@ -2536,7 +3498,7 @@ var implementation$3 = function promisify(orig) {
|
|
|
2536
3498
|
throw error;
|
|
2537
3499
|
}
|
|
2538
3500
|
|
|
2539
|
-
if (hasSymbols$
|
|
3501
|
+
if (hasSymbols$3 && orig[kCustomPromisifiedSymbol]) {
|
|
2540
3502
|
var customFunction = orig[kCustomPromisifiedSymbol];
|
|
2541
3503
|
if (typeof customFunction !== 'function') {
|
|
2542
3504
|
throw new TypeError('The [util.promisify.custom] property must be a function');
|