@xyo-network/react-api 2.41.33 → 2.41.34

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/package.json CHANGED
@@ -10,24 +10,24 @@
10
10
  "url": "https://github.com/XYOracleNetwork/sdk-xyo-react-js/issues"
11
11
  },
12
12
  "dependencies": {
13
- "@xylabs/react-button": "^2.15.8",
14
- "@xylabs/react-common": "^2.15.8",
15
- "@xylabs/react-dialogs": "^2.15.8",
16
- "@xylabs/react-flexbox": "^2.15.8",
17
- "@xylabs/react-shared": "^2.15.8",
18
- "@xyo-network/api": "^2.43.7",
19
- "@xyo-network/api-models": "^2.43.7",
20
- "@xyo-network/archivist-wrapper": "^2.43.7",
21
- "@xyo-network/boundwitness-model": "^2.43.7",
22
- "@xyo-network/diviner": "^2.43.7",
23
- "@xyo-network/huri": "^2.43.7",
24
- "@xyo-network/module": "^2.43.7",
25
- "@xyo-network/network": "^2.43.7",
26
- "@xyo-network/payload-builder": "^2.43.7",
27
- "@xyo-network/payload-model": "^2.43.7",
28
- "@xyo-network/react-archivist": "^2.41.33",
29
- "@xyo-network/react-network": "^2.41.33",
30
- "@xyo-network/react-shared": "^2.41.33",
13
+ "@xylabs/react-button": "^2.15.9",
14
+ "@xylabs/react-common": "^2.15.9",
15
+ "@xylabs/react-dialogs": "^2.15.9",
16
+ "@xylabs/react-flexbox": "^2.15.9",
17
+ "@xylabs/react-shared": "^2.15.9",
18
+ "@xyo-network/api": "^2.43.9",
19
+ "@xyo-network/api-models": "^2.43.9",
20
+ "@xyo-network/archivist-wrapper": "^2.43.9",
21
+ "@xyo-network/boundwitness-model": "^2.43.9",
22
+ "@xyo-network/diviner": "^2.43.9",
23
+ "@xyo-network/huri": "^2.43.9",
24
+ "@xyo-network/module": "^2.43.9",
25
+ "@xyo-network/network": "^2.43.9",
26
+ "@xyo-network/payload-builder": "^2.43.9",
27
+ "@xyo-network/payload-model": "^2.43.9",
28
+ "@xyo-network/react-archivist": "^2.41.34",
29
+ "@xyo-network/react-network": "^2.41.34",
30
+ "@xyo-network/react-shared": "^2.41.34",
31
31
  "lodash": "^4.17.21",
32
32
  "react-json-view": "^1.21.3"
33
33
  },
@@ -35,12 +35,13 @@
35
35
  "@mui/icons-material": "^5.11.0",
36
36
  "@mui/material": "^5.11.5",
37
37
  "@mui/styles": "^5.11.2",
38
- "@xylabs/ts-scripts-yarn3": "2.12.0",
39
- "@xyo-network/react-storybook": "^2.41.33",
38
+ "@xylabs/ts-scripts-yarn3": "2.12.21",
39
+ "@xyo-network/react-storybook": "^2.41.34",
40
+ "@xyo-network/utils": "^2.43.9",
40
41
  "react": "^18.2.0",
41
42
  "react-dom": "^18.2.0",
42
43
  "react-icons": "^4.7.1",
43
- "react-router-dom": "^6.6.2",
44
+ "react-router-dom": "^6.7.0",
44
45
  "rollbar": "^2.26.1"
45
46
  },
46
47
  "peerDependencies": {
@@ -100,5 +101,5 @@
100
101
  },
101
102
  "sideEffects": false,
102
103
  "types": "dist/esm/index.d.ts",
103
- "version": "2.41.33"
104
+ "version": "2.41.34"
104
105
  }
@@ -3,10 +3,8 @@ import { Typography } from '@mui/material'
3
3
  import { ComponentMeta, ComponentStory } from '@storybook/react'
4
4
  import { useAsyncEffect } from '@xylabs/react-shared'
5
5
  import { XyoArchive } from '@xyo-network/api'
6
- import { useAuthState } from '@xyo-network/react-auth'
7
- import { AuthServiceWrapper } from '@xyo-network/react-auth-service'
8
6
  import { authDecorator, WrappedAuthComponent } from '@xyo-network/react-storybook'
9
- import { useEffect, useState } from 'react'
7
+ import { useState } from 'react'
10
8
 
11
9
  import { ApiProvider, useApi } from '../../contexts'
12
10
  import { ApiHistory } from './ApiHistory'
@@ -28,38 +26,27 @@ const StorybookEntry = {
28
26
 
29
27
  const DemoArchiveFetcher = () => {
30
28
  const [myArchives, setMyArchives] = useState<XyoArchive[]>([])
31
- const { api, currentToken } = useApi()
32
- const { state } = useAuthState()
29
+ const { api } = useApi()
33
30
  const [successfulCall, setSuccessfulCall] = useState(false)
34
31
 
35
32
  useAsyncEffect(
36
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
37
34
  async (mounted) => {
38
- if (state?.jwtToken && currentToken && state?.loggedInAccount) {
39
- const archives = await api?.archives?.get()
40
- if (archives && mounted()) {
41
- setMyArchives(archives)
42
- setSuccessfulCall(true)
43
- }
35
+ const archives = await api?.archives?.get()
36
+ if (archives && mounted()) {
37
+ setMyArchives(archives)
38
+ setSuccessfulCall(true)
44
39
  }
45
40
  },
46
- [api, state?.jwtToken, currentToken, state?.loggedInAccount, setSuccessfulCall],
41
+ [api?.archives],
47
42
  )
48
43
 
49
- useEffect(() => {
50
- if (!state?.loggedInAccount) {
51
- setMyArchives([])
52
- setSuccessfulCall(false)
53
- }
54
- }, [state?.loggedInAccount])
55
-
56
44
  return (
57
45
  <>
58
- <AuthServiceWrapper />
59
- <p>My Archives</p>
46
+ <p>Archives</p>
60
47
  {successfulCall && (
61
48
  <Typography color="success.main" variant="body1">
62
- Successfully made authenticated request!!
49
+ Successfully made request
63
50
  </Typography>
64
51
  )}
65
52
  <ul>
@@ -74,8 +61,6 @@ const DemoArchiveFetcher = () => {
74
61
  }
75
62
 
76
63
  const Template: ComponentStory<WrappedAuthComponent> = () => {
77
- const { state } = useAuthState()
78
- const jwtToken = state?.jwtToken
79
64
  return (
80
65
  <ApiProvider
81
66
  errorHistoryMaxDepth={10}
@@ -83,7 +68,6 @@ const Template: ComponentStory<WrappedAuthComponent> = () => {
83
68
  failureHistoryMaxDepth={10}
84
69
  responseHistoryMaxDepth={10}
85
70
  apiDomain="https://beta.api.archivist.xyo.network"
86
- jwtToken={jwtToken}
87
71
  >
88
72
  <DemoArchiveFetcher />
89
73
  </ApiProvider>
@@ -3,10 +3,8 @@ import { Typography } from '@mui/material'
3
3
  import { ComponentMeta, ComponentStory } from '@storybook/react'
4
4
  import { useAsyncEffect } from '@xylabs/react-shared'
5
5
  import { XyoArchive } from '@xyo-network/api'
6
- import { useAuthState } from '@xyo-network/react-auth'
7
- import { AuthServiceWrapper } from '@xyo-network/react-auth-service'
8
6
  import { authDecorator, WrappedAuthComponent } from '@xyo-network/react-storybook'
9
- import { useEffect, useState } from 'react'
7
+ import { useState } from 'react'
10
8
 
11
9
  import { ApiProvider } from './Provider'
12
10
  import { useApi } from './use'
@@ -28,38 +26,32 @@ const StorybookEntry = {
28
26
 
29
27
  const DemoArchiveFetcher = () => {
30
28
  const [myArchives, setMyArchives] = useState<XyoArchive[]>([])
31
- const { api, currentToken, responseHistory } = useApi()
32
- const { state } = useAuthState()
29
+ const { api, responseHistory } = useApi()
33
30
  const [successfulCall, setSuccessfulCall] = useState(false)
34
31
 
35
32
  useAsyncEffect(
36
33
  // eslint-disable-next-line react-hooks/exhaustive-deps
37
34
  async (mounted) => {
38
- if (state?.jwtToken && currentToken && state?.loggedInAccount) {
35
+ try {
39
36
  const archives = await api?.archives?.get()
40
37
  if (archives && mounted()) {
41
38
  setMyArchives(archives)
42
39
  setSuccessfulCall(true)
43
40
  }
41
+ } catch (e) {
42
+ setMyArchives([])
43
+ setSuccessfulCall(false)
44
44
  }
45
45
  },
46
- [api, state?.jwtToken, currentToken, state?.loggedInAccount, setSuccessfulCall],
46
+ [api],
47
47
  )
48
48
 
49
- useEffect(() => {
50
- if (!state?.loggedInAccount) {
51
- setMyArchives([])
52
- setSuccessfulCall(false)
53
- }
54
- }, [state?.loggedInAccount])
55
-
56
49
  return (
57
50
  <>
58
- <AuthServiceWrapper />
59
- <p>My Archives</p>
51
+ <p>Archives</p>
60
52
  {successfulCall && (
61
53
  <Typography color="success.main" variant="body1">
62
- Successfully made authenticated request!!
54
+ Successfully made request!!
63
55
  </Typography>
64
56
  )}
65
57
  <ul>
@@ -78,8 +70,6 @@ const DemoArchiveFetcher = () => {
78
70
  }
79
71
 
80
72
  const Template: ComponentStory<WrappedAuthComponent> = () => {
81
- const { state } = useAuthState()
82
- const jwtToken = state?.jwtToken
83
73
  return (
84
74
  <ApiProvider
85
75
  errorHistoryMaxDepth={10}
@@ -87,7 +77,6 @@ const Template: ComponentStory<WrappedAuthComponent> = () => {
87
77
  failureHistoryMaxDepth={10}
88
78
  responseHistoryMaxDepth={10}
89
79
  apiDomain="https://beta.api.archivist.xyo.network"
90
- jwtToken={jwtToken}
91
80
  >
92
81
  <DemoArchiveFetcher />
93
82
  </ApiProvider>