@availity/hooks 3.0.3 → 3.0.7-ts.13
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/CHANGELOG.md +24 -0
- package/README.md +1 -1
- package/package.json +5 -7
- package/src/useMount.js +2 -2
- package/src/useOrganizations.js +2 -7
- package/src/usePermissions.js +2 -7
- package/src/useProviders.js +1 -2
- package/src/useTimeout.js +2 -2
- package/src/useToggle.js +2 -2
- package/stories/ResourceComponent.tsx +19 -0
- package/tests/util.js +1 -3
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,30 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.0.6](https://github.com/Availity/availity-react/compare/@availity/hooks@3.0.5...@availity/hooks@3.0.6) (2021-10-28)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @availity/hooks
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## 3.0.5 (2021-10-28)
|
|
15
|
+
|
|
16
|
+
**Note:** Version bump only for package @availity/hooks
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
## [3.0.4](https://github.com/Availity/availity-react/compare/@availity/hooks@3.0.3...@availity/hooks@3.0.4) (2021-10-01)
|
|
23
|
+
|
|
24
|
+
**Note:** Version bump only for package @availity/hooks
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
6
30
|
## 3.0.3 (2021-09-28)
|
|
7
31
|
|
|
8
32
|
**Note:** Version bump only for package @availity/hooks
|
package/README.md
CHANGED
|
@@ -4,4 +4,4 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@availity/hooks)
|
|
6
6
|
|
|
7
|
-
## [Documentation](https://availity.github.io/availity-react/components/hooks)
|
|
7
|
+
## [Documentation](https://availity.github.io/availity-react/components/hooks/index)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@availity/hooks",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.7-ts.13+2f65f717",
|
|
4
4
|
"author": "Kyle Gray <kyle.gray@availity.com>",
|
|
5
5
|
"description": "A group of pre-built hooks that are common in most apps",
|
|
6
6
|
"main": "index.js",
|
|
@@ -22,20 +22,18 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"prop-types": "^15.7.2",
|
|
25
|
-
"react-query": "^3.
|
|
25
|
+
"react-query": "^3.29.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"@availity/api-axios": "^
|
|
29
|
-
"@availity/api-core": "^7.0.2",
|
|
28
|
+
"@availity/api-axios": "^6.0.0",
|
|
30
29
|
"axios": "^0.21.1",
|
|
31
30
|
"react": "^17.0.2",
|
|
32
31
|
"react-dom": "^17.0.2"
|
|
33
32
|
},
|
|
34
33
|
"peerDependencies": {
|
|
35
|
-
"@availity/api-axios": "^
|
|
36
|
-
"@availity/api-core": "^7.0.2",
|
|
34
|
+
"@availity/api-axios": "^6.0.0",
|
|
37
35
|
"axios": "^0.21.1",
|
|
38
36
|
"react": ">=16.8.0"
|
|
39
37
|
},
|
|
40
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "2f65f71769d2d981e22700b87a09516833588f64"
|
|
41
39
|
}
|
package/src/useMount.js
CHANGED
package/src/useOrganizations.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { useQuery } from 'react-query';
|
|
2
2
|
import { avOrganizationsApi } from '@availity/api-axios';
|
|
3
3
|
|
|
4
|
-
const fetchOrganization = async (config) =>
|
|
5
|
-
avOrganizationsApi.getOrganizations(config);
|
|
4
|
+
const fetchOrganization = async (config) => avOrganizationsApi.getOrganizations(config);
|
|
6
5
|
|
|
7
6
|
export default function useOrganization(config, options) {
|
|
8
|
-
return useQuery(
|
|
9
|
-
['organizations', config],
|
|
10
|
-
() => fetchOrganization(config),
|
|
11
|
-
options
|
|
12
|
-
);
|
|
7
|
+
return useQuery(['organizations', config], () => fetchOrganization(config), options);
|
|
13
8
|
}
|
package/src/usePermissions.js
CHANGED
|
@@ -1,13 +1,8 @@
|
|
|
1
1
|
import { useQuery } from 'react-query';
|
|
2
2
|
import { avPermissionsApi } from '@availity/api-axios';
|
|
3
3
|
|
|
4
|
-
const fetchPermissions = async (config) =>
|
|
5
|
-
avPermissionsApi.getPermissions(config);
|
|
4
|
+
const fetchPermissions = async (config) => avPermissionsApi.getPermissions(config);
|
|
6
5
|
|
|
7
6
|
export default function usePermissions(config, options) {
|
|
8
|
-
return useQuery(
|
|
9
|
-
['permissions', config],
|
|
10
|
-
() => fetchPermissions(config),
|
|
11
|
-
options
|
|
12
|
-
);
|
|
7
|
+
return useQuery(['permissions', config], () => fetchPermissions(config), options);
|
|
13
8
|
}
|
package/src/useProviders.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { useQuery } from 'react-query';
|
|
2
2
|
import { avProvidersApi } from '@availity/api-axios';
|
|
3
3
|
|
|
4
|
-
const fetchProviders = async (config) =>
|
|
5
|
-
avProvidersApi.getProviders(config.customerId, config);
|
|
4
|
+
const fetchProviders = async (config) => avProvidersApi.getProviders(config.customerId, config);
|
|
6
5
|
|
|
7
6
|
export default function useProviders(config, options) {
|
|
8
7
|
return useQuery(['providers', config], () => fetchProviders(config), options);
|
package/src/useTimeout.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useEffect, useState } from 'react';
|
|
2
2
|
|
|
3
|
-
export default (ms = 0)
|
|
3
|
+
export default function useTimeout(ms = 0) {
|
|
4
4
|
const [ready, setReady] = useState(false);
|
|
5
5
|
|
|
6
6
|
useEffect(() => {
|
|
@@ -18,4 +18,4 @@ export default (ms = 0) => {
|
|
|
18
18
|
}, [ms]);
|
|
19
19
|
|
|
20
20
|
return ready;
|
|
21
|
-
}
|
|
21
|
+
}
|
package/src/useToggle.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useState } from 'react';
|
|
2
2
|
|
|
3
|
-
export default (initialState = false)
|
|
3
|
+
export default function useToggle(initialState = false) {
|
|
4
4
|
const [state, setState] = useState(initialState);
|
|
5
5
|
const toggle = (newState) => {
|
|
6
6
|
if (newState !== undefined && newState !== state) {
|
|
@@ -11,4 +11,4 @@ export default (initialState = false) => {
|
|
|
11
11
|
};
|
|
12
12
|
|
|
13
13
|
return [state, toggle];
|
|
14
|
-
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Card, CardBody, CardTitle } from 'reactstrap';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
data: Record<string, unknown>;
|
|
6
|
+
loading: boolean;
|
|
7
|
+
title?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const ResourceComponent = ({ data, loading, title = '' }: Props): JSX.Element => (
|
|
11
|
+
<Card body>
|
|
12
|
+
<CardTitle className="text-center" tag="h4">
|
|
13
|
+
{title}
|
|
14
|
+
</CardTitle>
|
|
15
|
+
<CardBody>{loading ? 'Loading...' : <pre>{JSON.stringify(data, null, 2)}</pre>}</CardBody>
|
|
16
|
+
</Card>
|
|
17
|
+
);
|
|
18
|
+
|
|
19
|
+
export default ResourceComponent;
|
package/tests/util.js
CHANGED
|
@@ -4,7 +4,5 @@ import { QueryClientProvider } from 'react-query';
|
|
|
4
4
|
|
|
5
5
|
// Taken from https://github.com/tannerlinsley/react-query/blob/master/src/react/tests/utils.tsx#L6
|
|
6
6
|
export default function renderWithClient(client, ui) {
|
|
7
|
-
return render(
|
|
8
|
-
<QueryClientProvider client={client}>{ui}</QueryClientProvider>
|
|
9
|
-
);
|
|
7
|
+
return render(<QueryClientProvider client={client}>{ui}</QueryClientProvider>);
|
|
10
8
|
}
|