@xylabs/sdk-react 2.7.22 → 2.7.26

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.
Files changed (118) hide show
  1. package/dist/components/Experiments/Experiments.d.ts +0 -1
  2. package/dist/components/Experiments/Experiments.js +46 -25
  3. package/dist/components/Experiments/Experiments.js.map +1 -1
  4. package/dist/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
  5. package/dist/components/InvertableThemeProvider/InvertableThemeContext.js +2 -2
  6. package/dist/components/InvertableThemeProvider/InvertableThemeContext.js.map +1 -1
  7. package/dist/components/QuickTipButton/QuickTipButton.js +2 -2
  8. package/dist/components/QuickTipButton/QuickTipButton.js.map +1 -1
  9. package/dist/contexts/CookieConsent/Loader.js +2 -2
  10. package/dist/contexts/CookieConsent/Loader.js.map +1 -1
  11. package/dist/contexts/Ethers/Context.d.ts +2 -2
  12. package/dist/contexts/Ethers/Context.js +2 -2
  13. package/dist/contexts/Ethers/Context.js.map +1 -1
  14. package/dist/contexts/Ethers/MetaMask.js +10 -10
  15. package/dist/contexts/Ethers/MetaMask.js.map +1 -1
  16. package/dist/contexts/Ethers/MyEtherWallet.js +9 -9
  17. package/dist/contexts/Ethers/MyEtherWallet.js.map +1 -1
  18. package/dist/contexts/Ethers/Opera.d.ts +1 -1
  19. package/dist/contexts/Ethers/Opera.js +40 -45
  20. package/dist/contexts/Ethers/Opera.js.map +1 -1
  21. package/dist/contexts/Ethers/Trust.d.ts +1 -1
  22. package/dist/contexts/Ethers/Trust.js +31 -36
  23. package/dist/contexts/Ethers/Trust.js.map +1 -1
  24. package/dist/contexts/NetworkSettings/Context.d.ts +2 -2
  25. package/dist/contexts/NetworkSettings/Context.js +2 -2
  26. package/dist/contexts/NetworkSettings/Context.js.map +1 -1
  27. package/dist/contexts/UserEvents/Context.d.ts +2 -2
  28. package/dist/contexts/UserEvents/Context.js +2 -2
  29. package/dist/contexts/UserEvents/Context.js.map +1 -1
  30. package/dist/esm2017/components/Experiments/Experiments.d.ts +0 -1
  31. package/dist/esm2017/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
  32. package/dist/esm2017/contexts/Ethers/Context.d.ts +2 -2
  33. package/dist/esm2017/contexts/Ethers/Opera.d.ts +1 -1
  34. package/dist/esm2017/contexts/Ethers/Trust.d.ts +1 -1
  35. package/dist/esm2017/contexts/NetworkSettings/Context.d.ts +2 -2
  36. package/dist/esm2017/contexts/UserEvents/Context.d.ts +2 -2
  37. package/dist/esm2017/index.js +193 -225
  38. package/dist/esm2017/index.js.map +1 -1
  39. package/dist/esm2017/lib/Tracking/Facebook/Fbq.d.ts +2 -2
  40. package/dist/esm2017/lib/Tracking/Reddit/Rdt.d.ts +1 -1
  41. package/dist/esm2017/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
  42. package/dist/esm2017/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
  43. package/dist/esm5/components/Experiments/Experiments.d.ts +0 -1
  44. package/dist/esm5/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
  45. package/dist/esm5/contexts/Ethers/Context.d.ts +2 -2
  46. package/dist/esm5/contexts/Ethers/Opera.d.ts +1 -1
  47. package/dist/esm5/contexts/Ethers/Trust.d.ts +1 -1
  48. package/dist/esm5/contexts/NetworkSettings/Context.d.ts +2 -2
  49. package/dist/esm5/contexts/UserEvents/Context.d.ts +2 -2
  50. package/dist/esm5/index.js +193 -225
  51. package/dist/esm5/index.js.map +1 -1
  52. package/dist/esm5/lib/Tracking/Facebook/Fbq.d.ts +2 -2
  53. package/dist/esm5/lib/Tracking/Reddit/Rdt.d.ts +1 -1
  54. package/dist/esm5/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
  55. package/dist/esm5/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
  56. package/dist/hooks/useMounted.js +2 -1
  57. package/dist/hooks/useMounted.js.map +1 -1
  58. package/dist/hooks/useWebP.js +2 -2
  59. package/dist/hooks/useWebP.js.map +1 -1
  60. package/dist/hooks/useWindowSize.js +3 -2
  61. package/dist/hooks/useWindowSize.js.map +1 -1
  62. package/dist/lib/Tracking/Facebook/Fbq.d.ts +2 -2
  63. package/dist/lib/Tracking/Facebook/Fbq.js +3 -26
  64. package/dist/lib/Tracking/Facebook/Fbq.js.map +1 -1
  65. package/dist/lib/Tracking/Reddit/Rdt.d.ts +1 -1
  66. package/dist/lib/Tracking/Reddit/Rdt.js +7 -21
  67. package/dist/lib/Tracking/Reddit/Rdt.js.map +1 -1
  68. package/dist/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
  69. package/dist/lib/Tracking/Snapchat/Snaptr.js +2 -15
  70. package/dist/lib/Tracking/Snapchat/Snaptr.js.map +1 -1
  71. package/dist/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
  72. package/dist/lib/Tracking/Tiktok/Ttq.js +13 -40
  73. package/dist/lib/Tracking/Tiktok/Ttq.js.map +1 -1
  74. package/dist/lib/useAsyncEffect.js +5 -1
  75. package/dist/lib/useAsyncEffect.js.map +1 -1
  76. package/dist/node/components/Experiments/Experiments.d.ts +0 -1
  77. package/dist/node/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
  78. package/dist/node/contexts/Ethers/Context.d.ts +2 -2
  79. package/dist/node/contexts/Ethers/Opera.d.ts +1 -1
  80. package/dist/node/contexts/Ethers/Trust.d.ts +1 -1
  81. package/dist/node/contexts/NetworkSettings/Context.d.ts +2 -2
  82. package/dist/node/contexts/UserEvents/Context.d.ts +2 -2
  83. package/dist/node/index.js +207 -240
  84. package/dist/node/index.js.map +1 -1
  85. package/dist/node/lib/Tracking/Facebook/Fbq.d.ts +2 -2
  86. package/dist/node/lib/Tracking/Reddit/Rdt.d.ts +1 -1
  87. package/dist/node/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
  88. package/dist/node/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
  89. package/dist/node-esm/components/Experiments/Experiments.d.ts +0 -1
  90. package/dist/node-esm/components/InvertableThemeProvider/InvertableThemeContext.d.ts +2 -2
  91. package/dist/node-esm/contexts/Ethers/Context.d.ts +2 -2
  92. package/dist/node-esm/contexts/Ethers/Opera.d.ts +1 -1
  93. package/dist/node-esm/contexts/Ethers/Trust.d.ts +1 -1
  94. package/dist/node-esm/contexts/NetworkSettings/Context.d.ts +2 -2
  95. package/dist/node-esm/contexts/UserEvents/Context.d.ts +2 -2
  96. package/dist/node-esm/index.js +193 -225
  97. package/dist/node-esm/index.js.map +1 -1
  98. package/dist/node-esm/lib/Tracking/Facebook/Fbq.d.ts +2 -2
  99. package/dist/node-esm/lib/Tracking/Reddit/Rdt.d.ts +1 -1
  100. package/dist/node-esm/lib/Tracking/Snapchat/Snaptr.d.ts +1 -1
  101. package/dist/node-esm/lib/Tracking/Tiktok/Ttq.d.ts +2 -2
  102. package/package.json +10 -10
  103. package/rollup.config.js +2 -116
  104. package/src/components/Experiments/Experiments.tsx +7 -9
  105. package/src/components/InvertableThemeProvider/InvertableThemeContext.tsx +2 -2
  106. package/src/contexts/Ethers/Context.ts +2 -2
  107. package/src/contexts/Ethers/Opera.tsx +14 -20
  108. package/src/contexts/Ethers/Trust.tsx +10 -16
  109. package/src/contexts/NetworkSettings/Context.ts +2 -2
  110. package/src/contexts/UserEvents/Context.ts +2 -2
  111. package/src/lib/Tracking/Facebook/Fbq.ts +2 -6
  112. package/src/lib/Tracking/Reddit/Rdt.ts +1 -4
  113. package/src/lib/Tracking/Snapchat/Snaptr.ts +1 -4
  114. package/src/lib/Tracking/Tiktok/Ttq.ts +2 -6
  115. package/src/lib/useAsyncEffect.tsx +9 -5
  116. package/xylabs-sdk-react-v2.7.25.tgz +0 -0
  117. package/index.node.ts +0 -1
  118. package/index.ts +0 -1
package/rollup.config.js CHANGED
@@ -1,119 +1,5 @@
1
- import image from '@rollup/plugin-image'
2
- import json from '@rollup/plugin-json'
3
- import replace from '@rollup/plugin-replace'
4
- import strip from '@rollup/plugin-strip'
5
- import typescriptPlugin from '@rollup/plugin-typescript'
6
- import typescript from 'typescript'
1
+ import { getRollupConfig } from '@xylabs/rollup-config'
7
2
 
8
3
  import pkg from './package.json'
9
4
 
10
- const deps = Object.keys(Object.assign({}, pkg.peerDependencies, pkg.dependencies))
11
-
12
- const BUILD_TARGET_MAGIC_STRING = '__BUILD_TARGET__'
13
-
14
- function generateBuildTargetReplaceConfig(moduleFormat, languageTarget) {
15
- let buildTarget = ''
16
-
17
- switch (moduleFormat.toLowerCase()) {
18
- case 'esm':
19
- buildTarget += 'esm'
20
- break
21
- case 'cjs':
22
- buildTarget += 'cjs'
23
- break
24
- default:
25
- throw Error(`unsupported module format ${moduleFormat}. Valid values are esm and cjs.`)
26
- }
27
-
28
- if (typeof languageTarget !== 'number') {
29
- throw Error('languageTarget accepts only number')
30
- }
31
-
32
- // simplified input validation
33
- if (languageTarget != 5 && languageTarget < 2015) {
34
- throw Error(`invalid languageTarget ${languageTarget}. Valid values are 5, 2015, 2016, etc.`)
35
- }
36
-
37
- buildTarget += languageTarget
38
-
39
- return {
40
- [BUILD_TARGET_MAGIC_STRING]: buildTarget,
41
- preventAssignment: true,
42
- }
43
- }
44
-
45
- function emitModulePackageFile() {
46
- return {
47
- generateBundle() {
48
- this.emitFile({
49
- fileName: 'package.json',
50
- source: '{"type":"module"}',
51
- type: 'asset',
52
- })
53
- },
54
- name: 'emit-module-package-file',
55
- }
56
- }
57
-
58
- const getPlugIns = (outDir) => {
59
- return [
60
- image(),
61
- json(),
62
- strip({
63
- functions: ['debugAssert.*'],
64
- }),
65
- typescriptPlugin({
66
- outDir,
67
- typescript,
68
- }),
69
- ]
70
- }
71
-
72
- const browserBuilds = [
73
- {
74
- external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
75
- input: {
76
- index: './src/index.ts',
77
- },
78
- output: [{ dir: './dist/esm5', format: 'es', sourcemap: true }],
79
- plugins: [...getPlugIns('./dist/esm5'), replace(generateBuildTargetReplaceConfig('esm', 5))],
80
- },
81
- {
82
- external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
83
- input: {
84
- index: './src/index.ts',
85
- },
86
- output: {
87
- dir: './dist/esm2017',
88
- format: 'es',
89
- sourcemap: true,
90
- },
91
- plugins: [...getPlugIns('./dist/esm2017'), replace(generateBuildTargetReplaceConfig('esm', 2017))],
92
- },
93
- ]
94
-
95
- const nodeBuilds = [
96
- {
97
- external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
98
- input: {
99
- index: './src/index.ts',
100
- },
101
- output: [{ dir: './dist/node', format: 'cjs', sourcemap: true }],
102
- plugins: [...getPlugIns('./dist/node'), replace(generateBuildTargetReplaceConfig('cjs', 5))],
103
- },
104
- {
105
- external: (id) => deps.some((dep) => id === dep || id.startsWith(`${dep}/`)),
106
- input: {
107
- index: './src/index.ts',
108
- },
109
- output: [{ dir: './dist/node-esm', format: 'es', sourcemap: true }],
110
- plugins: [
111
- ...getPlugIns('./dist/node-esm'),
112
- replace(generateBuildTargetReplaceConfig('esm', 2017)),
113
- emitModulePackageFile(),
114
- ],
115
- },
116
- ]
117
-
118
- // eslint-disable-next-line import/no-default-export
119
- export default [...browserBuilds, ...nodeBuilds]
5
+ export default getRollupConfig(pkg)
@@ -1,8 +1,8 @@
1
- import { Log } from '@xylabs/sdk-js'
1
+ import { forget, Log } from '@xylabs/sdk-js'
2
2
  import React, { ReactElement, useContext } from 'react'
3
3
 
4
4
  import { UserEventsContext } from '../../contexts'
5
- import { getLocalStorageObject, isLocalhost, setLocalStorageObject } from '../../lib'
5
+ import { getLocalStorageObject, setLocalStorageObject } from '../../lib'
6
6
  import { ExperimentProps } from './Experiment'
7
7
 
8
8
  const defaultLocalStorageKey = 'testData'
@@ -31,7 +31,6 @@ type Props = {
31
31
  children: ReactElement<ExperimentProps>[] | ReactElement<ExperimentProps>
32
32
  localStorageProp?: string | boolean
33
33
  name: string
34
- testStarted?: () => Promise<void>
35
34
  }
36
35
 
37
36
  const missingKeyError = new Error('Experiment Elements must have Keys')
@@ -61,9 +60,9 @@ const calcTotalWeight = (childList: ReactElement<ExperimentProps>[]) => {
61
60
  }
62
61
 
63
62
  const Experiments: React.FC<Props> = (props) => {
64
- const { name, children, testStarted, localStorageProp = true } = props
65
- const userEventsConntext = useContext(UserEventsContext)
66
- const { userEvents } = userEventsConntext
63
+ const { name, children, localStorageProp = true } = props
64
+ const userEventsContext = useContext(UserEventsContext)
65
+ const { userEvents } = userEventsContext
67
66
  loadOutcomes()
68
67
 
69
68
  const localStorageKey = buildLocalStorageKey(localStorageProp)
@@ -87,9 +86,8 @@ const Experiments: React.FC<Props> = (props) => {
87
86
  if (localStorageProp !== false) {
88
87
  localStorage.setItem(localStorageKey, mergeData(experimentsTestData))
89
88
  }
90
- if (!isLocalhost) {
91
- userEvents?.testStarted({})
92
- testStarted?.()
89
+ if (userEvents) {
90
+ forget(userEvents.testStarted({ name, variation: child.key }))
93
91
  }
94
92
  }
95
93
 
@@ -1,8 +1,8 @@
1
- import React from 'react'
1
+ import { createContext } from 'react'
2
2
 
3
3
  import { InvertableTheme } from './InvertableTheme'
4
4
 
5
- const InvertableThemeContext = React.createContext<InvertableTheme>({
5
+ const InvertableThemeContext = createContext<InvertableTheme>({
6
6
  options: {},
7
7
  })
8
8
 
@@ -1,7 +1,7 @@
1
1
  import { Signer } from '@ethersproject/abstract-signer'
2
2
  import { Provider } from '@ethersproject/providers'
3
3
  import { EthAddress } from '@xylabs/sdk-js'
4
- import React from 'react'
4
+ import { createContext } from 'react'
5
5
 
6
6
  export interface EthersData {
7
7
  busy?: boolean
@@ -18,4 +18,4 @@ export interface EthersData {
18
18
  walletProvider?: Provider | null
19
19
  }
20
20
 
21
- export const EthersContext = React.createContext<EthersData>({})
21
+ export const EthersContext = createContext<EthersData>({})
@@ -1,7 +1,8 @@
1
1
  import { JsonRpcProvider, JsonRpcSigner, Web3Provider } from '@ethersproject/providers'
2
2
  import { EthAddress } from '@xylabs/sdk-js'
3
- import React, { PropsWithChildren, useState } from 'react'
3
+ import { PropsWithChildren, useState } from 'react'
4
4
 
5
+ import { useAsyncEffect } from '../../lib'
5
6
  import { EthersContext } from './Context'
6
7
 
7
8
  interface Props {
@@ -23,37 +24,30 @@ export const OperaEthersLoader: React.FC<PropsWithChildren<Props>> = (props) =>
23
24
  const chainId = ethereum?.chainId ? parseInt(ethereum?.chainId) : 1
24
25
  const isConnected = ethereum?.isConnected() ?? false
25
26
 
26
- React.useEffect(() => {
27
- let cancelled = false
28
-
29
- if (ethereum) {
30
- ethereum.enable()
31
- const operaProvider = new Web3Provider(ethereum)
32
- const provider = operaProvider
33
- const signer = operaProvider.getSigner()
34
- const load = async () => {
27
+ useAsyncEffect(
28
+ async (mounted) => {
29
+ if (ethereum) {
30
+ ethereum.enable()
31
+ const operaProvider = new Web3Provider(ethereum)
32
+ const provider = operaProvider
33
+ const signer = operaProvider.getSigner()
35
34
  try {
36
35
  const localAddress = EthAddress.fromString(await signer.getAddress())
37
36
  ethereum.autoRefreshOnNetworkChange = false
38
- if (!cancelled) {
37
+ if (mounted()) {
39
38
  setSigner(signer)
40
39
  setProvider(provider)
41
40
  setLocalAddress(localAddress)
42
41
  }
43
42
  } catch (ex) {
44
- if (!cancelled) {
43
+ if (mounted()) {
45
44
  setError(Error(`localAddress: ${ex}`))
46
45
  }
47
46
  }
48
47
  }
49
-
50
- load()
51
- }
52
-
53
- return () => {
54
- cancelled = true
55
- }
56
- }, [ethereum])
48
+ },
49
+ [ethereum]
50
+ )
57
51
 
58
52
  return (
59
53
  <EthersContext.Provider
@@ -1,7 +1,8 @@
1
1
  import { Web3Provider } from '@ethersproject/providers'
2
2
  import { EthAddress } from '@xylabs/sdk-js'
3
- import React, { PropsWithChildren, useEffect, useState } from 'react'
3
+ import { PropsWithChildren, useState } from 'react'
4
4
 
5
+ import { useAsyncEffect } from '../../lib'
5
6
  import { EthersContext } from './Context'
6
7
 
7
8
  interface Props {
@@ -22,30 +23,23 @@ export const TrustEthersLoader: React.FC<PropsWithChildren<Props>> = (props) =>
22
23
 
23
24
  const provider = trustProvider
24
25
 
25
- useEffect(() => {
26
- let cancelled = false
27
-
28
- if (signer) {
29
- const load = async () => {
26
+ useAsyncEffect(
27
+ async (mounted) => {
28
+ if (signer) {
30
29
  try {
31
30
  const localAddress = EthAddress.fromString(await signer.getAddress())
32
- if (!cancelled) {
31
+ if (mounted()) {
33
32
  setLocalAddress(localAddress)
34
33
  }
35
34
  } catch (ex) {
36
- if (!cancelled) {
35
+ if (mounted()) {
37
36
  setError(Error(`localAddress: ${ex}`))
38
37
  }
39
38
  }
40
39
  }
41
-
42
- load()
43
- }
44
-
45
- return () => {
46
- cancelled = true
47
- }
48
- }, [signer])
40
+ },
41
+ [signer]
42
+ )
49
43
 
50
44
  return (
51
45
  <EthersContext.Provider
@@ -1,7 +1,7 @@
1
1
  import { EthAddress } from '@xylabs/sdk-js'
2
- import React from 'react'
2
+ import { createContext } from 'react'
3
3
 
4
- const NetworkSettingsContext = React.createContext<{
4
+ const NetworkSettingsContext = createContext<{
5
5
  xyStakingConsensusAddress?: EthAddress
6
6
  xyBondAddress?: EthAddress
7
7
  xyGovernanceAddress?: EthAddress
@@ -1,9 +1,9 @@
1
1
  import { UserEventHandler } from '@xylabs/pixel'
2
- import React from 'react'
2
+ import { createContext } from 'react'
3
3
 
4
4
  interface Props {
5
5
  userEvents?: UserEventHandler<unknown>
6
6
  }
7
7
 
8
- const UserEventsContext = React.createContext<Props>({})
8
+ const UserEventsContext = createContext<Props>({})
9
9
  export { UserEventsContext }
@@ -1,5 +1,3 @@
1
- import { delay } from '@xylabs/sdk-js'
2
-
3
1
  import { global } from '../../global'
4
2
 
5
3
  class Fbq {
@@ -36,18 +34,16 @@ class Fbq {
36
34
  return this.instance
37
35
  }
38
36
 
39
- public async track(event: string, data: Record<string, unknown>) {
37
+ public track(event: string, data: Record<string, unknown>) {
40
38
  this.fbq('track', event, {
41
39
  ...data,
42
40
  })
43
- await delay(0)
44
41
  }
45
42
 
46
- public async trackCustom(event: string, data: Record<string, unknown>) {
43
+ public trackCustom(event: string, data: Record<string, unknown>) {
47
44
  this.fbq('trackCustom', event, {
48
45
  ...data,
49
46
  })
50
- await delay(0)
51
47
  }
52
48
  }
53
49
 
@@ -1,5 +1,3 @@
1
- import { delay } from '@xylabs/sdk-js'
2
-
3
1
  import { global } from '../../global'
4
2
 
5
3
  class Rdt {
@@ -26,12 +24,11 @@ class Rdt {
26
24
  }
27
25
  }
28
26
 
29
- public async track(event: string, data?: Record<string, unknown>) {
27
+ public track(event: string, data?: Record<string, unknown>) {
30
28
  try {
31
29
  Rdt.getRdt()('track', event, {
32
30
  ...data,
33
31
  })
34
- await delay(0)
35
32
  } catch (ex) {
36
33
  console.error(ex)
37
34
  }
@@ -1,5 +1,3 @@
1
- import { delay } from '@xylabs/sdk-js'
2
-
3
1
  import { global } from '../../global'
4
2
 
5
3
  class SnapTr {
@@ -15,10 +13,9 @@ class SnapTr {
15
13
  this.track('PAGE_VIEW')
16
14
  }
17
15
 
18
- public static async track<T>(event: string, data?: T) {
16
+ public static track<T>(event: string, data?: T) {
19
17
  this.getSnapTr()('init', this.pixelId)
20
18
  this.getSnapTr()('track', event, data)
21
- await delay(0)
22
19
  }
23
20
  }
24
21
 
@@ -1,5 +1,3 @@
1
- import { delay } from '@xylabs/sdk-js'
2
-
3
1
  import { global } from '../../global'
4
2
 
5
3
  class Ttq {
@@ -18,21 +16,19 @@ class Ttq {
18
16
  return global.ttq
19
17
  }
20
18
 
21
- public static async page() {
19
+ public static page() {
22
20
  try {
23
21
  Ttq.getTtq().page()
24
- await delay(0)
25
22
  } catch (ex) {
26
23
  console.error(`Ttq.page: ${ex}`)
27
24
  }
28
25
  }
29
26
 
30
- public async track(event: string, data?: Record<string, unknown>) {
27
+ public track(event: string, data?: Record<string, unknown>) {
31
28
  try {
32
29
  Ttq.getTtq().track(event, {
33
30
  ...data,
34
31
  })
35
- await delay(0)
36
32
  } catch (ex) {
37
33
  console.error(`Ttq.track: ${ex}`)
38
34
  }
@@ -12,11 +12,15 @@ function useAsyncEffect(effect: EffectFunc, inputs?: unknown[]) {
12
12
  return mounted
13
13
  })
14
14
 
15
- Promise.resolve(promise).then((callback) => {
16
- if (callback) {
17
- callback?.()
18
- }
19
- })
15
+ Promise.resolve(promise)
16
+ .then((callback) => {
17
+ if (callback) {
18
+ callback?.()
19
+ }
20
+ })
21
+ .catch((reason) => {
22
+ console.log(`useAsyncEffect Excepted: ${reason}`)
23
+ })
20
24
 
21
25
  return function () {
22
26
  mounted = false
Binary file
package/index.node.ts DELETED
@@ -1 +0,0 @@
1
- export * from './src'
package/index.ts DELETED
@@ -1 +0,0 @@
1
- export * from './src'