@onepercentio/one-ui 0.8.5-beta.1 → 0.8.5-beta.11
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/WebpackConfigs/email-templates.js +35 -3
- package/cypress/support/component-index.html +4 -0
- package/dist/assets/styles/variables.scss +1 -0
- package/dist/components/AdaptiveContainer/AdaptiveContainer.d.ts +8 -1
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js +36 -15
- package/dist/components/AdaptiveContainer/AdaptiveContainer.js.map +1 -1
- package/dist/components/AdaptiveContainer/AdaptiveContainer.module.scss +1 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.d.ts +17 -10
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js +10 -5
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.js.map +1 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +21 -24
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js +5 -3
- package/dist/components/AnimatedEntrance/AnimatedEntrance.js.map +1 -1
- package/dist/components/Button/Button.d.ts +2 -2
- package/dist/components/Button/Button.js.map +1 -1
- package/dist/components/Collapsable/Collapsable.d.ts +11 -1
- package/dist/components/Collapsable/Collapsable.js +17 -4
- package/dist/components/Collapsable/Collapsable.js.map +1 -1
- package/dist/components/EmailInput/EmailInput.d.ts +2 -2
- package/dist/components/FadeIn/FadeIn.d.ts +1 -0
- package/dist/components/FadeIn/FadeIn.js +14 -2
- package/dist/components/FadeIn/FadeIn.js.map +1 -1
- package/dist/components/InfinityScroll/InfinityScroll.d.ts +7 -0
- package/dist/components/InfinityScroll/InfinityScroll.js +39 -22
- package/dist/components/InfinityScroll/InfinityScroll.js.map +1 -1
- package/dist/components/Input/Input.d.ts +1 -1
- package/dist/components/Loader/Loader.d.ts +3 -2
- package/dist/components/Loader/Loader.js +14 -2
- package/dist/components/Loader/Loader.js.map +1 -1
- package/dist/components/OrderableList/OrderableList.d.ts +13 -3
- package/dist/components/OrderableList/OrderableList.js +71 -14
- package/dist/components/OrderableList/OrderableList.js.map +1 -1
- package/dist/components/OrderableList/OrderableList.module.scss +15 -0
- package/dist/components/PaginationIndicator/PaginationIndicator.d.ts +28 -0
- package/dist/components/PaginationIndicator/PaginationIndicator.js +139 -0
- package/dist/components/PaginationIndicator/PaginationIndicator.js.map +1 -0
- package/dist/components/PaginationIndicator/PaginationIndicator.module.scss +48 -0
- package/dist/components/PaginationIndicator/index.d.ts +1 -0
- package/dist/components/PaginationIndicator/index.js +9 -0
- package/dist/components/PaginationIndicator/index.js.map +1 -0
- package/dist/components/PasswordInput/PasswordInput.d.ts +1 -1
- package/dist/components/Select/Select.d.ts +3 -1
- package/dist/components/Select/Select.js +2 -2
- package/dist/components/Select/Select.js.map +1 -1
- package/dist/components/Tabs/Tabs.d.ts +3 -1
- package/dist/components/Tabs/Tabs.js +17 -9
- package/dist/components/Tabs/Tabs.js.map +1 -1
- package/dist/components/Tabs/Tabs.module.scss +0 -1
- package/dist/components/Text/Text.d.ts +3 -3
- package/dist/components/Text/Text.js +4 -4
- package/dist/components/Text/Text.js.map +1 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.js.map +1 -1
- package/dist/context/AsyncProcessQueue.js +9 -13
- package/dist/context/AsyncProcessQueue.js.map +1 -1
- package/dist/context/OneUIProvider.d.ts +10 -1
- package/dist/context/OneUIProvider.js +1 -1
- package/dist/context/OneUIProvider.js.map +1 -1
- package/dist/hooks/ui/useBreakpoint.d.ts +5 -0
- package/dist/hooks/ui/useBreakpoint.js +25 -0
- package/dist/hooks/ui/useBreakpoint.js.map +1 -0
- package/dist/hooks/ui/usePaginationControls.d.ts +14 -0
- package/dist/hooks/ui/usePaginationControls.js +92 -0
- package/dist/hooks/ui/usePaginationControls.js.map +1 -0
- package/dist/hooks/ui/usePaginationControls.module.scss +16 -0
- package/dist/hooks/useAsyncControl.d.ts +4 -1
- package/dist/hooks/useAsyncControl.js +3 -1
- package/dist/hooks/useAsyncControl.js.map +1 -1
- package/dist/hooks/useContainedRepositioning.d.ts +3 -1
- package/dist/hooks/useContainedRepositioning.js +13 -10
- package/dist/hooks/useContainedRepositioning.js.map +1 -1
- package/dist/hooks/useElementFit.d.ts +2 -2
- package/dist/hooks/useElementFit.js.map +1 -1
- package/dist/hooks/useFreeze.d.ts +1 -1
- package/dist/hooks/useHero.d.ts +13 -0
- package/dist/hooks/useHero.js +97 -0
- package/dist/hooks/useHero.js.map +1 -0
- package/dist/hooks/useMergeRefs.d.ts +5 -0
- package/dist/hooks/useMergeRefs.js +15 -0
- package/dist/hooks/useMergeRefs.js.map +1 -0
- package/dist/hooks/usePagination.d.ts +5 -4
- package/dist/hooks/usePagination.js +22 -15
- package/dist/hooks/usePagination.js.map +1 -1
- package/dist/hooks/usePaginationControls.d.ts +5 -0
- package/dist/hooks/usePaginationControls.js +8 -0
- package/dist/hooks/usePaginationControls.js.map +1 -0
- package/dist/models/GenericContract.d.ts +1 -1
- package/dist/types.d.ts +1 -2
- package/dist/types.js +0 -1
- package/dist/types.js.map +1 -1
- package/package.json +8 -16
- package/src/types.ts +85 -0
- package/tsconfig.json +108 -0
- package/WebpackConfigs/__snapshots__/email-templates.test.js.snap +0 -9
- package/WebpackConfigs/email-templates.test.js +0 -53
- package/WebpackConfigs/loaders/css-var-removal.test.ts +0 -17
- package/dist/__test__/analytics.d.ts +0 -3
- package/dist/__test__/analytics.js +0 -20
- package/dist/__test__/analytics.js.map +0 -1
- package/dist/__test__/firestore.d.ts +0 -2
- package/dist/__test__/firestore.js +0 -26
- package/dist/__test__/firestore.js.map +0 -1
- package/dist/__test__/utils.d.ts +0 -16
- package/dist/__test__/utils.js +0 -164
- package/dist/__test__/utils.js.map +0 -1
- package/dist/components/AdaptiveButton/AdaptiveButton.stories.d.ts +0 -18
- package/dist/components/AdaptiveButton/AdaptiveButton.stories.js +0 -82
- package/dist/components/AdaptiveButton/AdaptiveButton.stories.js.map +0 -1
- package/dist/components/AdaptiveContainer/AdaptiveContainer.stories.d.ts +0 -17
- package/dist/components/AdaptiveContainer/AdaptiveContainer.stories.js +0 -82
- package/dist/components/AdaptiveContainer/AdaptiveContainer.stories.js.map +0 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.stories.d.ts +0 -20
- package/dist/components/AdaptiveDialog/AdaptiveDialog.stories.js +0 -94
- package/dist/components/AdaptiveDialog/AdaptiveDialog.stories.js.map +0 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.test.d.ts +0 -1
- package/dist/components/AdaptiveDialog/AdaptiveDialog.test.js +0 -15
- package/dist/components/AdaptiveDialog/AdaptiveDialog.test.js.map +0 -1
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.stories.d.ts +0 -19
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.stories.js +0 -21
- package/dist/components/AdaptiveSidebar/AdaptiveSidebar.stories.js.map +0 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.stories.d.ts +0 -16
- package/dist/components/AnchoredTooltip/AnchoredTooltip.stories.js +0 -86
- package/dist/components/AnchoredTooltip/AnchoredTooltip.stories.js.map +0 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.test.d.ts +0 -1
- package/dist/components/AnchoredTooltip/AnchoredTooltip.test.js +0 -20
- package/dist/components/AnchoredTooltip/AnchoredTooltip.test.js.map +0 -1
- package/dist/components/AnimatedEntrance/AnimatedEntrance.stories.d.ts +0 -14
- package/dist/components/AnimatedEntrance/AnimatedEntrance.stories.js +0 -67
- package/dist/components/AnimatedEntrance/AnimatedEntrance.stories.js.map +0 -1
- package/dist/components/AsyncWrapper/AsyncWrapper.stories.d.ts +0 -18
- package/dist/components/AsyncWrapper/AsyncWrapper.stories.js +0 -34
- package/dist/components/AsyncWrapper/AsyncWrapper.stories.js.map +0 -1
- package/dist/components/AsyncWrapper/AsyncWrapper.test.d.ts +0 -1
- package/dist/components/AsyncWrapper/AsyncWrapper.test.js +0 -19
- package/dist/components/AsyncWrapper/AsyncWrapper.test.js.map +0 -1
- package/dist/components/Avatar/Avatar.stories.d.ts +0 -14
- package/dist/components/Avatar/Avatar.stories.js +0 -19
- package/dist/components/Avatar/Avatar.stories.js.map +0 -1
- package/dist/components/Avatar/Avatar.test.d.ts +0 -1
- package/dist/components/Avatar/Avatar.test.js +0 -36
- package/dist/components/Avatar/Avatar.test.js.map +0 -1
- package/dist/components/BucketFill/BucketFill.stories.d.ts +0 -17
- package/dist/components/BucketFill/BucketFill.stories.js +0 -141
- package/dist/components/BucketFill/BucketFill.stories.js.map +0 -1
- package/dist/components/BucketFill/BucketFill.stories.module.scss +0 -3
- package/dist/components/Button/Button.stories.d.ts +0 -9
- package/dist/components/Button/Button.stories.js +0 -58
- package/dist/components/Button/Button.stories.js.map +0 -1
- package/dist/components/Button/Button.test.d.ts +0 -1
- package/dist/components/Button/Button.test.js +0 -15
- package/dist/components/Button/Button.test.js.map +0 -1
- package/dist/components/Card/Card.stories.d.ts +0 -15
- package/dist/components/Card/Card.stories.js +0 -16
- package/dist/components/Card/Card.stories.js.map +0 -1
- package/dist/components/CheckBox/CheckBox.stories.d.ts +0 -20
- package/dist/components/CheckBox/CheckBox.stories.js +0 -53
- package/dist/components/CheckBox/CheckBox.stories.js.map +0 -1
- package/dist/components/Collapsable/Collapsable.stories.d.ts +0 -39
- package/dist/components/Collapsable/Collapsable.stories.js +0 -28
- package/dist/components/Collapsable/Collapsable.stories.js.map +0 -1
- package/dist/components/Countdown/Countdown.stories.d.ts +0 -14
- package/dist/components/Countdown/Countdown.stories.js +0 -55
- package/dist/components/Countdown/Countdown.stories.js.map +0 -1
- package/dist/components/Divider/Divider.stories.d.ts +0 -7
- package/dist/components/Divider/Divider.stories.js +0 -15
- package/dist/components/Divider/Divider.stories.js.map +0 -1
- package/dist/components/EmailInput/EmailInput.stories.d.ts +0 -28
- package/dist/components/EmailInput/EmailInput.stories.js +0 -15
- package/dist/components/EmailInput/EmailInput.stories.js.map +0 -1
- package/dist/components/EmailInput/EmailInput.test.d.ts +0 -1
- package/dist/components/EmailInput/EmailInput.test.js +0 -77
- package/dist/components/EmailInput/EmailInput.test.js.map +0 -1
- package/dist/components/FadeIn/FadeIn.stories.d.ts +0 -24
- package/dist/components/FadeIn/FadeIn.stories.js +0 -16
- package/dist/components/FadeIn/FadeIn.stories.js.map +0 -1
- package/dist/components/FadeIn/FadeIn.test.d.ts +0 -1
- package/dist/components/FadeIn/FadeIn.test.js +0 -22
- package/dist/components/FadeIn/FadeIn.test.js.map +0 -1
- package/dist/components/FileInput/FileInput.stories.d.ts +0 -19
- package/dist/components/FileInput/FileInput.stories.js +0 -59
- package/dist/components/FileInput/FileInput.stories.js.map +0 -1
- package/dist/components/FlowController/FlowController.stories.d.ts +0 -43
- package/dist/components/FlowController/FlowController.stories.js +0 -101
- package/dist/components/FlowController/FlowController.stories.js.map +0 -1
- package/dist/components/FlowController/FlowController.test.d.ts +0 -1
- package/dist/components/FlowController/FlowController.test.js +0 -166
- package/dist/components/FlowController/FlowController.test.js.map +0 -1
- package/dist/components/Form/Form.stories.d.ts +0 -13
- package/dist/components/Form/Form.stories.js +0 -36
- package/dist/components/Form/Form.stories.js.map +0 -1
- package/dist/components/Freeze/Freeze.stories.d.ts +0 -7
- package/dist/components/Freeze/Freeze.stories.js +0 -56
- package/dist/components/Freeze/Freeze.stories.js.map +0 -1
- package/dist/components/Freeze/Freeze.test.d.ts +0 -1
- package/dist/components/Freeze/Freeze.test.js +0 -15
- package/dist/components/Freeze/Freeze.test.js.map +0 -1
- package/dist/components/Header/Header.stories.d.ts +0 -28
- package/dist/components/Header/Header.stories.js +0 -41
- package/dist/components/Header/Header.stories.js.map +0 -1
- package/dist/components/Header/Header.test.d.ts +0 -1
- package/dist/components/Header/Header.test.js +0 -100
- package/dist/components/Header/Header.test.js.map +0 -1
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.stories.d.ts +0 -14
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.stories.js +0 -16
- package/dist/components/HeaderCloseBtn/HeaderCloseBtn.stories.js.map +0 -1
- package/dist/components/InfinityScroll/InfinityScroll.stories.d.ts +0 -23
- package/dist/components/InfinityScroll/InfinityScroll.stories.js +0 -54
- package/dist/components/InfinityScroll/InfinityScroll.stories.js.map +0 -1
- package/dist/components/InfinityScroll/InfinityScroll.test.d.ts +0 -1
- package/dist/components/InfinityScroll/InfinityScroll.test.js +0 -189
- package/dist/components/InfinityScroll/InfinityScroll.test.js.map +0 -1
- package/dist/components/Input/Input.stories.d.ts +0 -24
- package/dist/components/Input/Input.stories.js +0 -21
- package/dist/components/Input/Input.stories.js.map +0 -1
- package/dist/components/Input/Input.test.d.ts +0 -1
- package/dist/components/Input/Input.test.js +0 -58
- package/dist/components/Input/Input.test.js.map +0 -1
- package/dist/components/InstantCounter/InstantCounter.stories.d.ts +0 -41
- package/dist/components/InstantCounter/InstantCounter.stories.js +0 -61
- package/dist/components/InstantCounter/InstantCounter.stories.js.map +0 -1
- package/dist/components/InstantCounter/InstantCounter.test.d.ts +0 -1
- package/dist/components/InstantCounter/InstantCounter.test.js +0 -50
- package/dist/components/InstantCounter/InstantCounter.test.js.map +0 -1
- package/dist/components/LinkToId/LinkToId.stories.d.ts +0 -7
- package/dist/components/LinkToId/LinkToId.stories.js +0 -15
- package/dist/components/LinkToId/LinkToId.stories.js.map +0 -1
- package/dist/components/LinkToId/LinkToId.test.d.ts +0 -1
- package/dist/components/LinkToId/LinkToId.test.js +0 -12
- package/dist/components/LinkToId/LinkToId.test.js.map +0 -1
- package/dist/components/Loader/Loader.stories.d.ts +0 -12
- package/dist/components/Loader/Loader.stories.js +0 -16
- package/dist/components/Loader/Loader.stories.js.map +0 -1
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.stories.d.ts +0 -7
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.stories.js +0 -15
- package/dist/components/LoaderDotsIndicator/LoaderDotsIndicator.stories.js.map +0 -1
- package/dist/components/MainGrid/MainGrid.stories.d.ts +0 -14
- package/dist/components/MainGrid/MainGrid.stories.js +0 -70
- package/dist/components/MainGrid/MainGrid.stories.js.map +0 -1
- package/dist/components/MainGrid/MainGrid.test.d.ts +0 -1
- package/dist/components/MainGrid/MainGrid.test.js +0 -18
- package/dist/components/MainGrid/MainGrid.test.js.map +0 -1
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.stories.d.ts +0 -21
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.stories.js +0 -74
- package/dist/components/MutableHamburgerButton/MutableHamburgerButton.stories.js.map +0 -1
- package/dist/components/Notification/Notification.stories.d.ts +0 -15
- package/dist/components/Notification/Notification.stories.js +0 -19
- package/dist/components/Notification/Notification.stories.js.map +0 -1
- package/dist/components/OrderableList/OrderableList.stories.d.ts +0 -14
- package/dist/components/OrderableList/OrderableList.stories.js +0 -77
- package/dist/components/OrderableList/OrderableList.stories.js.map +0 -1
- package/dist/components/Parallax/Parallax.stories.d.ts +0 -32
- package/dist/components/Parallax/Parallax.stories.js +0 -23
- package/dist/components/Parallax/Parallax.stories.js.map +0 -1
- package/dist/components/Parallax/Parallax.test.d.ts +0 -1
- package/dist/components/Parallax/Parallax.test.js +0 -22
- package/dist/components/Parallax/Parallax.test.js.map +0 -1
- package/dist/components/PasswordInput/PasswordInput.stories.d.ts +0 -45
- package/dist/components/PasswordInput/PasswordInput.stories.js +0 -22
- package/dist/components/PasswordInput/PasswordInput.stories.js.map +0 -1
- package/dist/components/PasswordInput/PasswordInput.test.d.ts +0 -1
- package/dist/components/PasswordInput/PasswordInput.test.js +0 -157
- package/dist/components/PasswordInput/PasswordInput.test.js.map +0 -1
- package/dist/components/PixelatedScan/PixelatedScan.stories.d.ts +0 -15
- package/dist/components/PixelatedScan/PixelatedScan.stories.js +0 -40
- package/dist/components/PixelatedScan/PixelatedScan.stories.js.map +0 -1
- package/dist/components/Portal/Portal.stories.d.ts +0 -7
- package/dist/components/Portal/Portal.stories.js +0 -15
- package/dist/components/Portal/Portal.stories.js.map +0 -1
- package/dist/components/ProgressBar/ProgressBar.stories.d.ts +0 -14
- package/dist/components/ProgressBar/ProgressBar.stories.js +0 -52
- package/dist/components/ProgressBar/ProgressBar.stories.js.map +0 -1
- package/dist/components/ProgressTexts/ProgressTexts.stories.d.ts +0 -24
- package/dist/components/ProgressTexts/ProgressTexts.stories.js +0 -90
- package/dist/components/ProgressTexts/ProgressTexts.stories.js.map +0 -1
- package/dist/components/ProgressTexts/ProgressTexts.test.d.ts +0 -1
- package/dist/components/ProgressTexts/ProgressTexts.test.js +0 -52
- package/dist/components/ProgressTexts/ProgressTexts.test.js.map +0 -1
- package/dist/components/SectionContainer/SectionContainer.stories.d.ts +0 -14
- package/dist/components/SectionContainer/SectionContainer.stories.js +0 -15
- package/dist/components/SectionContainer/SectionContainer.stories.js.map +0 -1
- package/dist/components/Select/Select.stories.d.ts +0 -56
- package/dist/components/Select/Select.stories.js +0 -34
- package/dist/components/Select/Select.stories.js.map +0 -1
- package/dist/components/Select/Select.test.d.ts +0 -1
- package/dist/components/Select/Select.test.js +0 -12
- package/dist/components/Select/Select.test.js.map +0 -1
- package/dist/components/Spacing/Spacing.stories.d.ts +0 -7
- package/dist/components/Spacing/Spacing.stories.js +0 -35
- package/dist/components/Spacing/Spacing.stories.js.map +0 -1
- package/dist/components/Table/Table.stories.d.ts +0 -15
- package/dist/components/Table/Table.stories.js +0 -88
- package/dist/components/Table/Table.stories.js.map +0 -1
- package/dist/components/Table/Table.test.d.ts +0 -1
- package/dist/components/Table/Table.test.js +0 -35
- package/dist/components/Table/Table.test.js.map +0 -1
- package/dist/components/Tabs/Tabs.stories.d.ts +0 -17
- package/dist/components/Tabs/Tabs.stories.js +0 -57
- package/dist/components/Tabs/Tabs.stories.js.map +0 -1
- package/dist/components/Tabs/Tabs.test.d.ts +0 -1
- package/dist/components/Tabs/Tabs.test.js +0 -39
- package/dist/components/Tabs/Tabs.test.js.map +0 -1
- package/dist/components/Text/Text.stories.d.ts +0 -7
- package/dist/components/Text/Text.stories.js +0 -43
- package/dist/components/Text/Text.stories.js.map +0 -1
- package/dist/components/Text/Text.test.d.ts +0 -1
- package/dist/components/Text/Text.test.js +0 -12
- package/dist/components/Text/Text.test.js.map +0 -1
- package/dist/components/Transition/Transition.stories.d.ts +0 -10
- package/dist/components/Transition/Transition.stories.js +0 -29
- package/dist/components/Transition/Transition.stories.js.map +0 -1
- package/dist/components/Transition/Transition.test.d.ts +0 -1
- package/dist/components/Transition/Transition.test.js +0 -55
- package/dist/components/Transition/Transition.test.js.map +0 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.d.ts +0 -33
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.js +0 -225
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.js.map +0 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.stories.module.scss +0 -66
- package/dist/components/UncontrolledTransition/UncontrolledTransition.test.d.ts +0 -1
- package/dist/components/UncontrolledTransition/UncontrolledTransition.test.js +0 -135
- package/dist/components/UncontrolledTransition/UncontrolledTransition.test.js.map +0 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.d.ts +0 -70
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.js +0 -65
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.stories.js.map +0 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.test.d.ts +0 -1
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.test.js +0 -137
- package/dist/components/WalletConnectionWrapper/WalletConnectionWrapper.test.js.map +0 -1
- package/dist/context/__mocks__/OneUIProvider.d.ts +0 -74
- package/dist/context/__mocks__/OneUIProvider.js +0 -13
- package/dist/context/__mocks__/OneUIProvider.js.map +0 -1
- package/dist/hooks/usePooling.test.d.ts +0 -1
- package/dist/hooks/usePooling.test.js +0 -104
- package/dist/hooks/usePooling.test.js.map +0 -1
- package/scripts/start-emulator.js +0 -48
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
35
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
36
|
-
};
|
|
37
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
-
const react_1 = __importStar(require("react"));
|
|
39
|
-
const react_2 = require("@testing-library/react");
|
|
40
|
-
const WalletConnectionWrapper_1 = __importDefault(require("./WalletConnectionWrapper"));
|
|
41
|
-
const utils_1 = require("../../__test__/utils");
|
|
42
|
-
const ProviderMock = jest.spyOn(require("use-wallet"), "UseWalletProvider");
|
|
43
|
-
const useWalletMock = jest
|
|
44
|
-
.spyOn(require("use-wallet"), "useWallet")
|
|
45
|
-
.mockImplementation(() => ({}));
|
|
46
|
-
const MockContent = () => null;
|
|
47
|
-
const defaultProps = {
|
|
48
|
-
Content: MockContent,
|
|
49
|
-
};
|
|
50
|
-
beforeEach(() => {
|
|
51
|
-
jest.clearAllMocks();
|
|
52
|
-
localStorage.removeItem("auto_connect");
|
|
53
|
-
});
|
|
54
|
-
it("Should auto connect the connection after the user connects", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
55
|
-
const connectCb = jest.fn(() => { });
|
|
56
|
-
useWalletMock.mockImplementation(() => (Object.assign({ isConnected: () => false, connect: connectCb, reset: () => { } }, {})));
|
|
57
|
-
global.window.ethereum = {};
|
|
58
|
-
function getAutoConnectFlag() {
|
|
59
|
-
return !!localStorage.getItem("auto_connect");
|
|
60
|
-
}
|
|
61
|
-
expect(getAutoConnectFlag()).toBeFalsy();
|
|
62
|
-
const ref = (0, react_1.createRef)();
|
|
63
|
-
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
64
|
-
expect(ProviderMock).toHaveBeenCalledTimes(1);
|
|
65
|
-
yield (0, react_2.act)(() => __awaiter(void 0, void 0, void 0, function* () {
|
|
66
|
-
yield ref.current.connect();
|
|
67
|
-
}));
|
|
68
|
-
expect(connectCb).toHaveBeenCalledTimes(1);
|
|
69
|
-
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
70
|
-
yield (0, react_2.act)(() => (0, utils_1.WaitTimeout)(100));
|
|
71
|
-
expect(ProviderMock).toHaveBeenCalledTimes(2);
|
|
72
|
-
expect(getAutoConnectFlag()).toBeTruthy();
|
|
73
|
-
expect(connectCb).toHaveBeenCalledTimes(2);
|
|
74
|
-
ref.current.disconnect();
|
|
75
|
-
(0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps)));
|
|
76
|
-
expect(ProviderMock).toHaveBeenCalledTimes(3);
|
|
77
|
-
expect(getAutoConnectFlag()).toBeFalsy();
|
|
78
|
-
expect(connectCb).toHaveBeenCalledTimes(2);
|
|
79
|
-
}));
|
|
80
|
-
it("Should warn when there is no provider available", () => {
|
|
81
|
-
useWalletMock.mockImplementation(() => (Object.assign({ isConnected: () => false }, {})));
|
|
82
|
-
delete window.ethereum;
|
|
83
|
-
const { container } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ProviderUnavailable: () => react_1.default.createElement("h1", null, "Provider unavailable") }, defaultProps)));
|
|
84
|
-
expect(container.textContent).toEqual("Provider unavailable");
|
|
85
|
-
window.ethereum = {};
|
|
86
|
-
const { container: continer2 } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ProviderUnavailable: () => react_1.default.createElement("h1", null, "Provider unavailable") }, defaultProps)));
|
|
87
|
-
expect(continer2.textContent).not.toEqual("Provider unavailable");
|
|
88
|
-
});
|
|
89
|
-
it("Should warn when the chainId is not the correct one", () => {
|
|
90
|
-
const requestMock = jest.fn();
|
|
91
|
-
window.ethereum = {
|
|
92
|
-
request: requestMock,
|
|
93
|
-
};
|
|
94
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: 56, isConnected: () => true }, {})));
|
|
95
|
-
const { container } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 56, ChainIdInvalid: () => react_1.default.createElement("h1", null, "Invalid") }, defaultProps)));
|
|
96
|
-
expect(container.textContent).not.toContain("Invalid");
|
|
97
|
-
const resetMock = jest.fn();
|
|
98
|
-
const connectMock = jest.fn();
|
|
99
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: "UNEXPECTED", reset: resetMock, connect: connectMock, isConnected: () => true }, {})));
|
|
100
|
-
const ui = jest.fn(({ changeChainId }) => (react_1.default.createElement("h1", null, "Invalid")));
|
|
101
|
-
const { container: container2 } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 56, ChainIdInvalid: ui }, defaultProps)));
|
|
102
|
-
expect(container2.textContent).toContain("Invalid");
|
|
103
|
-
// When the user clicks the change chain
|
|
104
|
-
ui.mock.calls.slice(-1)[0][0].changeChainId();
|
|
105
|
-
expect(resetMock).toHaveBeenCalled();
|
|
106
|
-
expect(connectMock).toHaveBeenCalled();
|
|
107
|
-
expect(requestMock).toHaveBeenCalledWith({
|
|
108
|
-
method: "wallet_switchEthereumChain",
|
|
109
|
-
params: [
|
|
110
|
-
{
|
|
111
|
-
chainId: `0x38`,
|
|
112
|
-
},
|
|
113
|
-
],
|
|
114
|
-
});
|
|
115
|
-
});
|
|
116
|
-
it("Should warn when the connection fails", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
117
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: "UNEXPECTED", isConnected: () => false, connect: () => Promise.reject() }, {})));
|
|
118
|
-
window.ethereum = {};
|
|
119
|
-
const ref = (0, react_1.createRef)();
|
|
120
|
-
const mockComp = jest.fn((props) => (props.error ? "Error" : props.loading ? "Loading" : "OK"));
|
|
121
|
-
const { findByText } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ ref: ref }, defaultProps, { Content: mockComp })));
|
|
122
|
-
(0, react_2.act)(() => {
|
|
123
|
-
ref.current.connect();
|
|
124
|
-
});
|
|
125
|
-
yield findByText("Error");
|
|
126
|
-
}));
|
|
127
|
-
// This cenario is given by the useWallet hook .isConnected()
|
|
128
|
-
//it("Should notify when the user connects", () => {});
|
|
129
|
-
describe("BUGFIX", () => {
|
|
130
|
-
it("Should not validate chainId if not connected yet", () => {
|
|
131
|
-
window.ethereum = {};
|
|
132
|
-
useWalletMock.mockImplementation(() => (Object.assign({ chainId: undefined, isConnected: () => false }, {})));
|
|
133
|
-
const { container, findByText } = (0, react_2.render)(react_1.default.createElement(WalletConnectionWrapper_1.default, Object.assign({ allowedChainId: 90, ChainIdInvalid: () => react_1.default.createElement("p", null, "Invalid") }, defaultProps)));
|
|
134
|
-
expect(container.textContent).not.toContain("Invalid");
|
|
135
|
-
});
|
|
136
|
-
});
|
|
137
|
-
//# sourceMappingURL=WalletConnectionWrapper.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"WalletConnectionWrapper.test.js","sourceRoot":"","sources":["../../../src/components/WalletConnectionWrapper/WalletConnectionWrapper.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAqE;AACrE,kDAAqD;AAErD,wFAAkD;AAClD,gDAAmD;AAEnD,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,mBAAmB,CAAC,CAAC;AAC5E,MAAM,aAAa,GAAG,IAAI;KACvB,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC,EAAE,WAAW,CAAC;KACzC,kBAAkB,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAElB,CAAC;AACf,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC;AAC/B,MAAM,YAAY,GAAQ;IACxB,OAAO,EAAE,WAAW;CACrB,CAAC;AAEF,UAAU,CAAC,GAAG,EAAE;IACd,IAAI,CAAC,aAAa,EAAE,CAAC;IACrB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F,IAAA,WAAG,EAAC,GAAG,EAAE;QACP,GAAG,CAAC,OAAQ,CAAC,OAAO,EAAE,CAAC;IACzB,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,CAAC,OAAO,CAAC,CAAC;AAC5B,CAAC,CAAA,CAAC,CAAC;AAEH,6DAA6D;AAC7D,uDAAuD;AAEvD,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,CAAC,QAAQ,GAAG,EAAE,CAAC;QACrB,aAAa,CAAC,kBAAkB,CAAC,GAAG,EAAE,CAAC,iBACrC,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,GAAG,EAAE,CAAC,KAAK,IACpB,EAAU,EACd,CAAC,CAAC;QACJ,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,GAAG,IAAA,cAAM,EACtC,8BAAC,iCAAS,kBACR,cAAc,EAAE,EAAE,EAClB,cAAc,EAAE,GAAG,EAAE,CAAC,mDAAc,IAChC,YAAY,EAChB,CACH,CAAC;QAEF,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,GAAG,CAAC,SAAS,CAAC,SAAS,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
2
|
-
export declare function useOneUIContext(): {
|
|
3
|
-
component?: {
|
|
4
|
-
text?: {
|
|
5
|
-
className?: {
|
|
6
|
-
link?: string | undefined;
|
|
7
|
-
description?: string | undefined;
|
|
8
|
-
caption?: string | undefined;
|
|
9
|
-
title?: string | undefined;
|
|
10
|
-
content?: string | undefined;
|
|
11
|
-
error?: string | undefined;
|
|
12
|
-
highlightTitle?: string | undefined;
|
|
13
|
-
highlight?: string | undefined;
|
|
14
|
-
subtitle?: string | undefined;
|
|
15
|
-
boldTitle?: string | undefined;
|
|
16
|
-
boldTitleBig?: string | undefined;
|
|
17
|
-
} | undefined;
|
|
18
|
-
} | undefined;
|
|
19
|
-
button?: {
|
|
20
|
-
className?: {
|
|
21
|
-
transparent?: string | undefined;
|
|
22
|
-
filled?: string | undefined;
|
|
23
|
-
outline?: string | undefined;
|
|
24
|
-
} | undefined;
|
|
25
|
-
} | undefined;
|
|
26
|
-
input?: {
|
|
27
|
-
className?: string | undefined;
|
|
28
|
-
border?: boolean | undefined;
|
|
29
|
-
} | undefined;
|
|
30
|
-
fileInput?: {
|
|
31
|
-
Icon?: (() => JSX.Element) | undefined;
|
|
32
|
-
} | undefined;
|
|
33
|
-
passwordInput?: {
|
|
34
|
-
iconSrc?: {
|
|
35
|
-
passwordHidden?: string | undefined;
|
|
36
|
-
passwordVisible?: string | undefined;
|
|
37
|
-
} | undefined;
|
|
38
|
-
} | undefined;
|
|
39
|
-
asyncWrapper?: {
|
|
40
|
-
LoadingComponent?: {} | undefined;
|
|
41
|
-
messages?: {
|
|
42
|
-
error?: {
|
|
43
|
-
title?: string | undefined;
|
|
44
|
-
retryBtn?: string | undefined;
|
|
45
|
-
} | undefined;
|
|
46
|
-
} | undefined;
|
|
47
|
-
} | undefined;
|
|
48
|
-
select?: {
|
|
49
|
-
StateIndicator?: ((props: {
|
|
50
|
-
open: boolean;
|
|
51
|
-
}) => JSX.Element) | undefined;
|
|
52
|
-
} | undefined;
|
|
53
|
-
header?: {
|
|
54
|
-
LogoImage?: (() => JSX.Element) | undefined;
|
|
55
|
-
MoreOptions?: (({ open }: {
|
|
56
|
-
open: boolean;
|
|
57
|
-
}) => JSX.Element) | undefined;
|
|
58
|
-
} | undefined;
|
|
59
|
-
table?: {
|
|
60
|
-
controls?: {
|
|
61
|
-
PrevPage?: (({ disabled }: {
|
|
62
|
-
disabled: boolean;
|
|
63
|
-
}) => JSX.Element) | undefined;
|
|
64
|
-
NextPage?: (({ disabled }: {
|
|
65
|
-
disabled: boolean;
|
|
66
|
-
}) => JSX.Element) | undefined;
|
|
67
|
-
} | undefined;
|
|
68
|
-
} | undefined;
|
|
69
|
-
tooltip?: {
|
|
70
|
-
className?: string | undefined;
|
|
71
|
-
} | undefined;
|
|
72
|
-
} | undefined;
|
|
73
|
-
};
|
|
74
|
-
export declare function setupMock(ctx: ComponentProps<typeof import("../OneUIProvider")["default"]>["config"]): void;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setupMock = exports.useOneUIContext = void 0;
|
|
4
|
-
let MockedProvider;
|
|
5
|
-
function useOneUIContext() {
|
|
6
|
-
return MockedProvider;
|
|
7
|
-
}
|
|
8
|
-
exports.useOneUIContext = useOneUIContext;
|
|
9
|
-
function setupMock(ctx) {
|
|
10
|
-
MockedProvider = ctx;
|
|
11
|
-
}
|
|
12
|
-
exports.setupMock = setupMock;
|
|
13
|
-
//# sourceMappingURL=OneUIProvider.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OneUIProvider.js","sourceRoot":"","sources":["../../../src/context/__mocks__/OneUIProvider.tsx"],"names":[],"mappings":";;;AAEA,IAAI,cAEO,CAAC;AAEZ,SAAgB,eAAe;IAC7B,OAAO,cAAc,CAAC;AACxB,CAAC;AAFD,0CAEC;AAED,SAAgB,SAAS,CACvB,GAA2E;IAE3E,cAAc,GAAG,GAAG,CAAC;AACvB,CAAC;AAJD,8BAIC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
const react_hooks_1 = require("@testing-library/react-hooks");
|
|
16
|
-
const test_utils_1 = require("react-dom/test-utils");
|
|
17
|
-
const usePooling_1 = __importDefault(require("./usePooling"));
|
|
18
|
-
const mockCb = () => Promise.resolve(true);
|
|
19
|
-
beforeEach(() => {
|
|
20
|
-
jest.useFakeTimers();
|
|
21
|
-
});
|
|
22
|
-
afterEach(() => {
|
|
23
|
-
jest.useRealTimers();
|
|
24
|
-
jest.clearAllTimers();
|
|
25
|
-
});
|
|
26
|
-
function actAndSync(cb) {
|
|
27
|
-
(0, test_utils_1.act)(() => {
|
|
28
|
-
cb();
|
|
29
|
-
// This is to advance the timer for the setState
|
|
30
|
-
jest.advanceTimersByTime(100);
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
const renderHookAndSync = (cb) => {
|
|
34
|
-
const result = (0, react_hooks_1.renderHook)(cb);
|
|
35
|
-
jest.advanceTimersByTime(100);
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
it("Should mount", () => {
|
|
39
|
-
renderHookAndSync(() => (0, usePooling_1.default)());
|
|
40
|
-
});
|
|
41
|
-
it("Should be able to create an interval", () => {
|
|
42
|
-
expect(jest.getTimerCount()).toBe(0);
|
|
43
|
-
const { result: { current: { startPolling }, }, } = renderHookAndSync(() => (0, usePooling_1.default)());
|
|
44
|
-
actAndSync(() => startPolling(mockCb));
|
|
45
|
-
expect(jest.getTimerCount()).toBe(1);
|
|
46
|
-
/** Should clear the old interval */
|
|
47
|
-
actAndSync(() => startPolling(mockCb));
|
|
48
|
-
expect(jest.getTimerCount()).toBe(1);
|
|
49
|
-
});
|
|
50
|
-
it("Should indicate when the interval shall end", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
51
|
-
let num = 0;
|
|
52
|
-
const cb = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
53
|
-
num++;
|
|
54
|
-
return num === 3;
|
|
55
|
-
});
|
|
56
|
-
const { result, rerender } = renderHookAndSync(() => (0, usePooling_1.default)());
|
|
57
|
-
const { startPolling } = result.current;
|
|
58
|
-
expect(jest.getTimerCount()).toBe(0);
|
|
59
|
-
expect(result.current.isPooling).toBeFalsy();
|
|
60
|
-
actAndSync(() => startPolling(cb));
|
|
61
|
-
expect(jest.getTimerCount()).toBe(1);
|
|
62
|
-
expect(result.current.isPooling).toBeTruthy();
|
|
63
|
-
// First execution
|
|
64
|
-
(0, test_utils_1.act)(() => {
|
|
65
|
-
jest.advanceTimersByTime(1000);
|
|
66
|
-
});
|
|
67
|
-
expect(jest.getTimerCount()).toBe(1);
|
|
68
|
-
expect(result.current.isPooling).toBeTruthy();
|
|
69
|
-
//Second execution
|
|
70
|
-
(0, test_utils_1.act)(() => {
|
|
71
|
-
jest.advanceTimersByTime(1000);
|
|
72
|
-
});
|
|
73
|
-
expect(jest.getTimerCount()).toBe(1);
|
|
74
|
-
expect(result.current.isPooling).toBeTruthy();
|
|
75
|
-
//Last execution
|
|
76
|
-
(0, test_utils_1.act)(() => {
|
|
77
|
-
jest.advanceTimersByTime(1000);
|
|
78
|
-
});
|
|
79
|
-
// expect(jest.getTimerCount()).toBe(0);
|
|
80
|
-
// expect(result.current.isPooling).toBeFalsy();
|
|
81
|
-
}));
|
|
82
|
-
it.each([
|
|
83
|
-
[1000, 5000, 5],
|
|
84
|
-
[500, 10000, 20],
|
|
85
|
-
[1000, 2578, 3],
|
|
86
|
-
])("Should end the pooling with error when the pooling of interval %s with max of %s exceeds max executions of %s", (poolingInterval, maxTime, expectedExecutionsCount) => {
|
|
87
|
-
const { result } = renderHookAndSync(() => (0, usePooling_1.default)(poolingInterval, maxTime));
|
|
88
|
-
const { startPolling } = result.current;
|
|
89
|
-
actAndSync(() => startPolling(() => __awaiter(void 0, void 0, void 0, function* () { return false; })));
|
|
90
|
-
for (let i = 1; i < expectedExecutionsCount; i++) {
|
|
91
|
-
(0, test_utils_1.act)(() => {
|
|
92
|
-
jest.advanceTimersByTime(poolingInterval);
|
|
93
|
-
});
|
|
94
|
-
if (i === expectedExecutionsCount) {
|
|
95
|
-
expect(result.current.isPooling).toBeFalsy();
|
|
96
|
-
expect(result.current.failed).toBeTruthy();
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
expect(result.current.isPooling).toBeTruthy();
|
|
100
|
-
expect(result.current.failed).toBeFalsy();
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
});
|
|
104
|
-
//# sourceMappingURL=usePooling.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"usePooling.test.js","sourceRoot":"","sources":["../../src/hooks/usePooling.test.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,8DAA0D;AAC1D,qDAA2C;AAC3C,8DAAsC;AAEtC,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAE3C,UAAU,CAAC,GAAG,EAAE;IACd,IAAI,CAAC,aAAa,EAAE,CAAC;AACvB,CAAC,CAAC,CAAC;AACH,SAAS,CAAC,GAAG,EAAE;IACb,IAAI,CAAC,aAAa,EAAE,CAAC;IACrB,IAAI,CAAC,cAAc,EAAE,CAAC;AACxB,CAAC,CAAC,CAAC;AAEH,SAAS,UAAU,CAAC,EAAY;IAC9B,IAAA,gBAAG,EAAC,GAAG,EAAE;QACP,EAAE,EAAE,CAAC;QACL,gDAAgD;QAChD,IAAI,CAAC,mBAAmB,CAAC,GAAG,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC;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/bin/env node
|
|
2
|
-
|
|
3
|
-
const fetch = require("node-fetch");
|
|
4
|
-
const { spawn } = require("child_process");
|
|
5
|
-
function WaitTimeout(ml = 200) {
|
|
6
|
-
return new Promise((r) => {
|
|
7
|
-
setTimeout(() => {
|
|
8
|
-
r();
|
|
9
|
-
}, ml);
|
|
10
|
-
});
|
|
11
|
-
}
|
|
12
|
-
const [, , projectId, databaseToImport] = process.argv;
|
|
13
|
-
|
|
14
|
-
if (!projectId) {
|
|
15
|
-
console.error("You need to provide a project id");
|
|
16
|
-
process.exit(1);
|
|
17
|
-
}
|
|
18
|
-
spawn(
|
|
19
|
-
`firebase emulators:start -P ${projectId} ${
|
|
20
|
-
databaseToImport ? `--import ${databaseToImport}` : ""
|
|
21
|
-
}`,
|
|
22
|
-
{
|
|
23
|
-
cwd: undefined,
|
|
24
|
-
env: process.env,
|
|
25
|
-
shell: true,
|
|
26
|
-
detached: true,
|
|
27
|
-
}
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
(async function () {
|
|
31
|
-
let breakLoop = false;
|
|
32
|
-
const timeout = setTimeout(() => {
|
|
33
|
-
breakLoop = true;
|
|
34
|
-
console.error("Could not receive ok from firebase emulator");
|
|
35
|
-
clearTimeout(timeout);
|
|
36
|
-
process.exit(1);
|
|
37
|
-
}, 60000);
|
|
38
|
-
while (!breakLoop) {
|
|
39
|
-
try {
|
|
40
|
-
await fetch(`http://localhost:4000`);
|
|
41
|
-
console.log("Emulator restarted");
|
|
42
|
-
clearTimeout(timeout);
|
|
43
|
-
process.exit(0);
|
|
44
|
-
} catch (e) {}
|
|
45
|
-
await WaitTimeout(1000);
|
|
46
|
-
}
|
|
47
|
-
await new Promise((r) => {});
|
|
48
|
-
})();
|