tenjin-ui-kit 0.3.67 → 0.3.69
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/.dockerignore +6 -0
- package/.storybook/main.js +16 -0
- package/.storybook/preview.js +11 -0
- package/Dockerfile +17 -0
- package/Jenkinsfile +66 -0
- package/build/asset-manifest.json +16 -0
- package/build/favicon.ico +0 -0
- package/build/index.html +1 -0
- package/build/logo192.png +0 -0
- package/build/logo512.png +0 -0
- package/build/manifest.json +25 -0
- package/build/robots.txt +3 -0
- package/build/static/css/main.e7366529.css +2 -0
- package/build/static/css/main.e7366529.css.map +1 -0
- package/build/static/js/453.900c81c3.chunk.js +2 -0
- package/build/static/js/453.900c81c3.chunk.js.map +1 -0
- package/build/static/js/main.8abb72fa.js +3 -0
- package/build/static/js/main.8abb72fa.js.LICENSE.txt +61 -0
- package/build/static/js/main.8abb72fa.js.map +1 -0
- package/build/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg +1 -0
- package/build/tenjinLogo.png +0 -0
- package/dist/README.md +13 -0
- package/dist/common/hooks/apiHooks.js +155 -0
- package/dist/common/hooks/newApiHook.js +188 -0
- package/{common → dist/common}/utils/security/index.js +2 -2
- package/{common → dist/common}/utils/security/securityConfig.js +1 -2
- package/dist/components/Canvas.js +330 -0
- package/dist/components/DragBox/index.js +40 -0
- package/dist/components/InputWithChip/index.js +294 -0
- package/{components → dist/components}/RightContext/index.js +19 -28
- package/dist/components/WorkFlow.js +42 -0
- package/dist/components/WorkFlowBuilder.js +115 -0
- package/dist/components/alert/Style.js +20 -0
- package/dist/components/alert/index.js +67 -0
- package/{components → dist/components}/attachment/index.js +21 -28
- package/{components → dist/components}/authenticationProvider/AuthError.js +3 -4
- package/{components → dist/components}/authenticationProvider/AuthLoader.js +3 -4
- package/dist/components/authenticationProvider/index.js +110 -0
- package/{components → dist/components}/avatar/index.js +13 -14
- package/dist/components/avatar/styles.js +91 -0
- package/dist/components/breadCrumbs/index.js +169 -0
- package/{components → dist/components}/breadCrumbs/style.js +1 -4
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +5 -6
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
- package/{components → dist/components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +4 -5
- package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +4 -5
- package/{components → dist/components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +5 -6
- package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +23 -0
- package/{components → dist/components}/browsingTestCaseLayout/index.js +25 -30
- package/dist/components/button/index.js +133 -0
- package/{components → dist/components}/chatBotModal/index.js +36 -45
- package/dist/components/checkBox/index.js +29 -0
- package/{components → dist/components}/combobox/index.js +51 -72
- package/dist/components/divider/index.js +37 -0
- package/{components → dist/components}/editableField/index.js +19 -28
- package/{components → dist/components}/error/index.js +6 -12
- package/dist/components/errorBoundary/index.js +140 -0
- package/dist/components/fileUploader/index.js +151 -0
- package/dist/components/fileUploader/style.js +57 -0
- package/dist/components/filter/ValueSelector.js +333 -0
- package/{components → dist/components}/filter/index.js +31 -36
- package/{components → dist/components}/iconButton/index.js +3 -4
- package/dist/components/input/index.js +167 -0
- package/dist/components/layout/index.js +94 -0
- package/dist/components/layout/main/index.js +24 -0
- package/dist/components/layout/main/style.js +19 -0
- package/{components → dist/components}/layout/pageContent/index.js +6 -7
- package/dist/components/layout/sidebar/FlatMenu.js +64 -0
- package/dist/components/layout/sidebar/GroupedIconMenu.js +233 -0
- package/dist/components/layout/sidebar/GroupedMenu.js +57 -0
- package/dist/components/layout/sidebar/ProjectMenu.js +223 -0
- package/dist/components/layout/sidebar/index.js +88 -0
- package/dist/components/layout/sidebar/style.js +149 -0
- package/{components → dist/components}/layout/topBar/ProjectTopbar.js +81 -98
- package/dist/components/layout/topBar/UserAvatar.js +138 -0
- package/dist/components/layout/topBar/index.js +121 -0
- package/{components → dist/components}/loader/index.js +9 -12
- package/dist/components/menu/index.js +71 -0
- package/{components → dist/components}/modal/Modal.js +5 -6
- package/dist/components/modal/index.js +88 -0
- package/dist/components/modal/style.js +65 -0
- package/dist/components/optionMenu/index.js +105 -0
- package/dist/components/pagination/index.js +114 -0
- package/dist/components/pagination/style.js +33 -0
- package/dist/components/paginationUpdated/index.js +73 -0
- package/dist/components/paper/index.js +43 -0
- package/dist/components/paper/style.js +31 -0
- package/dist/components/reactSelect/index.js +195 -0
- package/dist/components/reactSelect/style.js +130 -0
- package/dist/components/richTextEditor/index.js +64 -0
- package/dist/components/select/GroupedSelect.js +167 -0
- package/dist/components/select/SimpleSelect.js +184 -0
- package/{components → dist/components}/select/index.js +38 -54
- package/dist/components/simpleSelect/index.js +53 -0
- package/{components → dist/components}/sort/index.js +19 -22
- package/{components → dist/components}/switch/index.js +10 -11
- package/dist/components/switch/style.js +39 -0
- package/{components → dist/components}/switch/switch.js +17 -23
- package/dist/components/table/ReactTable.js +101 -0
- package/dist/components/table/SimpleTable.js +117 -0
- package/dist/components/table/index.js +381 -0
- package/dist/components/text/index.js +65 -0
- package/{components → dist/components}/timeStamp/index.js +4 -6
- package/dist/components/timeStamp/style.js +20 -0
- package/dist/components/topBar/index.js +169 -0
- package/{components → dist/components}/tree/index.js +29 -47
- package/dist/components/tree/style.js +29 -0
- package/dist/components/valuePicker/ValueSelector.js +205 -0
- package/{components → dist/components}/valuePicker/index.js +19 -26
- package/{components → dist/components}/wrapperLayout/layout/index.js +4 -5
- package/{components → dist/components}/wrapperLayout/main/index.js +4 -5
- package/{components → dist/components}/wrapperLayout/main/pageContainer/index.js +4 -5
- package/dist/components/wrapperLayout/main/sideBar/index.js +272 -0
- package/dist/components/wrapperLayout/main/sideBar/style.js +190 -0
- package/{components → dist/components}/wrapperLayout/topBar/UserAvatar.js +4 -5
- package/dist/components/wrapperLayout/topBar/avatar.js +55 -0
- package/dist/components/wrapperLayout/topBar/index.js +196 -0
- package/{components → dist/components}/wrapperLayout/topBar/menuIcon.js +4 -5
- package/dist/components/wrapperLayout/topBar/style.js +74 -0
- package/dist/http/index.js +133 -0
- package/{index.js → dist/index.js} +53 -55
- package/dist/package.json +127 -0
- package/{templates → dist/templates}/listPage/index.js +36 -57
- package/{themes → dist/themes}/default.js +5 -7
- package/{themes → dist/themes}/defaultSmall.js +2 -3
- package/{themes → dist/themes}/responsiveTheme.js +6 -8
- package/package.json +4 -1
- package/public/favicon.ico +0 -0
- package/public/index.html +43 -0
- package/public/logo192.png +0 -0
- package/public/logo512.png +0 -0
- package/public/manifest.json +25 -0
- package/public/robots.txt +3 -0
- package/public/tenjinLogo.png +0 -0
- package/common/hooks/apiHooks.js +0 -223
- package/common/hooks/newApiHook.js +0 -270
- package/components/Canvas.js +0 -254
- package/components/DragBox/index.js +0 -45
- package/components/InputWithChip/index.js +0 -187
- package/components/WorkFlow.js +0 -47
- package/components/WorkFlowBuilder.js +0 -130
- package/components/alert/Style.js +0 -23
- package/components/alert/index.js +0 -69
- package/components/authenticationProvider/index.js +0 -166
- package/components/avatar/styles.js +0 -94
- package/components/breadCrumbs/index.js +0 -180
- package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +0 -26
- package/components/button/index.js +0 -135
- package/components/checkBox/index.js +0 -30
- package/components/divider/index.js +0 -41
- package/components/errorBoundary/index.js +0 -160
- package/components/fileUploader/index.js +0 -156
- package/components/fileUploader/style.js +0 -60
- package/components/filter/ValueSelector.js +0 -350
- package/components/input/index.js +0 -174
- package/components/layout/index.js +0 -98
- package/components/layout/main/index.js +0 -27
- package/components/layout/main/style.js +0 -22
- package/components/layout/sidebar/FlatMenu.js +0 -64
- package/components/layout/sidebar/GroupedIconMenu.js +0 -246
- package/components/layout/sidebar/GroupedMenu.js +0 -67
- package/components/layout/sidebar/ProjectMenu.js +0 -230
- package/components/layout/sidebar/index.js +0 -91
- package/components/layout/sidebar/style.js +0 -154
- package/components/layout/topBar/UserAvatar.js +0 -145
- package/components/layout/topBar/index.js +0 -132
- package/components/menu/index.js +0 -80
- package/components/modal/index.js +0 -91
- package/components/modal/style.js +0 -68
- package/components/optionMenu/index.js +0 -112
- package/components/pagination/index.js +0 -129
- package/components/pagination/style.js +0 -36
- package/components/paginationUpdated/index.js +0 -75
- package/components/paper/index.js +0 -44
- package/components/paper/style.js +0 -34
- package/components/reactSelect/index.js +0 -212
- package/components/reactSelect/style.js +0 -163
- package/components/richTextEditor/index.js +0 -83
- package/components/select/GroupedSelect.js +0 -183
- package/components/select/SimpleSelect.js +0 -212
- package/components/simpleSelect/index.js +0 -56
- package/components/switch/style.js +0 -42
- package/components/table/ReactTable.js +0 -118
- package/components/table/SimpleTable.js +0 -136
- package/components/table/index.js +0 -256
- package/components/text/index.js +0 -67
- package/components/timeStamp/style.js +0 -23
- package/components/topBar/index.js +0 -176
- package/components/tree/style.js +0 -32
- package/components/valuePicker/ValueSelector.js +0 -273
- package/components/wrapperLayout/main/sideBar/index.js +0 -262
- package/components/wrapperLayout/main/sideBar/style.js +0 -196
- package/components/wrapperLayout/topBar/avatar.js +0 -57
- package/components/wrapperLayout/topBar/index.js +0 -182
- package/components/wrapperLayout/topBar/style.js +0 -77
- package/http/index.js +0 -226
- /package/{assets → dist/assets}/images/MicrosoftTeams-image (1).png +0 -0
- /package/{assets → dist/assets}/images/tenjin-4.0-logo.png +0 -0
- /package/{components → dist/components}/RightContext/index.css +0 -0
- /package/{components → dist/components}/browsingTestCaseLayout/style.css +0 -0
- /package/{components → dist/components}/errorBoundary/Error.jpg +0 -0
- /package/{components → dist/components}/iconButton/style.js +0 -0
- /package/{components → dist/components}/richTextEditor/style.js +0 -0
- /package/{components → dist/components}/wrapperLayout/layout/style.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
|
|
Binary file
|
package/dist/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# Tenjin UI Kit
|
|
2
|
+
|
|
3
|
+
The Tenjin UI kit ships a set of pre-built components that can be used while building user interfaces for Tenjin.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
In the project directory, you can run:
|
|
8
|
+
|
|
9
|
+
npm install tenjin-ui-kit
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
The [Tenjin UI Kit](https://tenjin-ui-kit.netlify.app) storybook gives clear documentation on how to use the Tenjin UI Kit.
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.usePut = exports.usePost = exports.useFetch = exports.useDelete = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _http = require("../../http");
|
|
9
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
10
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
12
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
13
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
14
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /* eslint-disable react-hooks/exhaustive-deps */
|
|
15
|
+
const useFetch = (url, clean, dependency) => {
|
|
16
|
+
const _useState = (0, _react.useState)(null),
|
|
17
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
18
|
+
data = _useState2[0],
|
|
19
|
+
setData = _useState2[1];
|
|
20
|
+
const _useState3 = (0, _react.useState)(false),
|
|
21
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
22
|
+
loading = _useState4[0],
|
|
23
|
+
setLoading = _useState4[1];
|
|
24
|
+
const _useState5 = (0, _react.useState)(null),
|
|
25
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
26
|
+
error = _useState6[0],
|
|
27
|
+
setError = _useState6[1];
|
|
28
|
+
(0, _react.useEffect)(async () => {
|
|
29
|
+
setLoading(true);
|
|
30
|
+
setError(null);
|
|
31
|
+
try {
|
|
32
|
+
const res = await (0, _http.get)(url);
|
|
33
|
+
setData(res);
|
|
34
|
+
setLoading(false);
|
|
35
|
+
} catch (error) {
|
|
36
|
+
setLoading(false);
|
|
37
|
+
const parsedError = (0, _http.parseAxiosError)(error);
|
|
38
|
+
setError(parsedError.message);
|
|
39
|
+
}
|
|
40
|
+
return () => {
|
|
41
|
+
clean();
|
|
42
|
+
};
|
|
43
|
+
}, [dependency]);
|
|
44
|
+
return {
|
|
45
|
+
data,
|
|
46
|
+
loading,
|
|
47
|
+
error
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
exports.useFetch = useFetch;
|
|
51
|
+
const usePost = (url, body, clean, dependency) => {
|
|
52
|
+
const _useState7 = (0, _react.useState)(null),
|
|
53
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
54
|
+
data = _useState8[0],
|
|
55
|
+
setData = _useState8[1];
|
|
56
|
+
const _useState9 = (0, _react.useState)(false),
|
|
57
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
58
|
+
loading = _useState0[0],
|
|
59
|
+
setLoading = _useState0[1];
|
|
60
|
+
const _useState1 = (0, _react.useState)(null),
|
|
61
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
62
|
+
error = _useState10[0],
|
|
63
|
+
setError = _useState10[1];
|
|
64
|
+
(0, _react.useEffect)(async () => {
|
|
65
|
+
setLoading(true);
|
|
66
|
+
setError(null);
|
|
67
|
+
try {
|
|
68
|
+
const data = await (0, _http.post)(url, body);
|
|
69
|
+
setData(data);
|
|
70
|
+
setLoading(false);
|
|
71
|
+
} catch (error) {
|
|
72
|
+
setError(error);
|
|
73
|
+
setLoading(false);
|
|
74
|
+
}
|
|
75
|
+
return () => {
|
|
76
|
+
clean();
|
|
77
|
+
};
|
|
78
|
+
}, [dependency]);
|
|
79
|
+
return {
|
|
80
|
+
data,
|
|
81
|
+
loading,
|
|
82
|
+
error
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
exports.usePost = usePost;
|
|
86
|
+
const usePut = (url, body, clean, dependency) => {
|
|
87
|
+
const _useState11 = (0, _react.useState)(null),
|
|
88
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
89
|
+
data = _useState12[0],
|
|
90
|
+
setData = _useState12[1];
|
|
91
|
+
const _useState13 = (0, _react.useState)(false),
|
|
92
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
93
|
+
loading = _useState14[0],
|
|
94
|
+
setLoading = _useState14[1];
|
|
95
|
+
const _useState15 = (0, _react.useState)(null),
|
|
96
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
97
|
+
error = _useState16[0],
|
|
98
|
+
setError = _useState16[1];
|
|
99
|
+
(0, _react.useEffect)(async () => {
|
|
100
|
+
setLoading(true);
|
|
101
|
+
setError(null);
|
|
102
|
+
try {
|
|
103
|
+
const data = await (0, _http.put)(url, body);
|
|
104
|
+
setData(data);
|
|
105
|
+
setLoading(false);
|
|
106
|
+
} catch (error) {
|
|
107
|
+
setError(error);
|
|
108
|
+
setLoading(false);
|
|
109
|
+
}
|
|
110
|
+
return () => {
|
|
111
|
+
clean();
|
|
112
|
+
};
|
|
113
|
+
}, [dependency]);
|
|
114
|
+
return {
|
|
115
|
+
data,
|
|
116
|
+
loading,
|
|
117
|
+
error
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
exports.usePut = usePut;
|
|
121
|
+
const useDelete = (url, body, clean, dependency) => {
|
|
122
|
+
const _useState17 = (0, _react.useState)(null),
|
|
123
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
124
|
+
data = _useState18[0],
|
|
125
|
+
setData = _useState18[1];
|
|
126
|
+
const _useState19 = (0, _react.useState)(false),
|
|
127
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
128
|
+
loading = _useState20[0],
|
|
129
|
+
setLoading = _useState20[1];
|
|
130
|
+
const _useState21 = (0, _react.useState)(null),
|
|
131
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
132
|
+
error = _useState22[0],
|
|
133
|
+
setError = _useState22[1];
|
|
134
|
+
(0, _react.useEffect)(async () => {
|
|
135
|
+
setLoading(true);
|
|
136
|
+
setError(null);
|
|
137
|
+
try {
|
|
138
|
+
const data = await (0, _http.doDelete)(url);
|
|
139
|
+
setData(data);
|
|
140
|
+
setLoading(false);
|
|
141
|
+
} catch (error) {
|
|
142
|
+
setError(error);
|
|
143
|
+
setLoading(false);
|
|
144
|
+
}
|
|
145
|
+
return () => {
|
|
146
|
+
clean();
|
|
147
|
+
};
|
|
148
|
+
}, [dependency]);
|
|
149
|
+
return {
|
|
150
|
+
data,
|
|
151
|
+
loading,
|
|
152
|
+
error
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
exports.useDelete = useDelete;
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _http = require("../../http");
|
|
9
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
10
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
11
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
12
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
15
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; } /* eslint-disable no-unused-vars */
|
|
16
|
+
const useAPI = () => {
|
|
17
|
+
const _useState = (0, _react.useState)(null),
|
|
18
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
19
|
+
getResult = _useState2[0],
|
|
20
|
+
setGetResult = _useState2[1];
|
|
21
|
+
const _useState3 = (0, _react.useState)(null),
|
|
22
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
23
|
+
postResult = _useState4[0],
|
|
24
|
+
setpostResult = _useState4[1];
|
|
25
|
+
const _useState5 = (0, _react.useState)(null),
|
|
26
|
+
_useState6 = _slicedToArray(_useState5, 2),
|
|
27
|
+
putResult = _useState6[0],
|
|
28
|
+
setputResult = _useState6[1];
|
|
29
|
+
const _useState7 = (0, _react.useState)(null),
|
|
30
|
+
_useState8 = _slicedToArray(_useState7, 2),
|
|
31
|
+
deleteResult = _useState8[0],
|
|
32
|
+
setdeleteResult = _useState8[1];
|
|
33
|
+
//
|
|
34
|
+
const _useState9 = (0, _react.useState)(null),
|
|
35
|
+
_useState0 = _slicedToArray(_useState9, 2),
|
|
36
|
+
getError = _useState0[0],
|
|
37
|
+
setGetError = _useState0[1];
|
|
38
|
+
const _useState1 = (0, _react.useState)(null),
|
|
39
|
+
_useState10 = _slicedToArray(_useState1, 2),
|
|
40
|
+
postError = _useState10[0],
|
|
41
|
+
setpostError = _useState10[1];
|
|
42
|
+
const _useState11 = (0, _react.useState)(null),
|
|
43
|
+
_useState12 = _slicedToArray(_useState11, 2),
|
|
44
|
+
putError = _useState12[0],
|
|
45
|
+
setputError = _useState12[1];
|
|
46
|
+
const _useState13 = (0, _react.useState)(null),
|
|
47
|
+
_useState14 = _slicedToArray(_useState13, 2),
|
|
48
|
+
deleteError = _useState14[0],
|
|
49
|
+
setdeleteError = _useState14[1];
|
|
50
|
+
//
|
|
51
|
+
const _useState15 = (0, _react.useState)(null),
|
|
52
|
+
_useState16 = _slicedToArray(_useState15, 2),
|
|
53
|
+
getLoading = _useState16[0],
|
|
54
|
+
setGetLoading = _useState16[1];
|
|
55
|
+
const _useState17 = (0, _react.useState)(null),
|
|
56
|
+
_useState18 = _slicedToArray(_useState17, 2),
|
|
57
|
+
postLoading = _useState18[0],
|
|
58
|
+
setpostLoading = _useState18[1];
|
|
59
|
+
const _useState19 = (0, _react.useState)(null),
|
|
60
|
+
_useState20 = _slicedToArray(_useState19, 2),
|
|
61
|
+
putLoading = _useState20[0],
|
|
62
|
+
setputLoading = _useState20[1];
|
|
63
|
+
const _useState21 = (0, _react.useState)(null),
|
|
64
|
+
_useState22 = _slicedToArray(_useState21, 2),
|
|
65
|
+
deleteLoading = _useState22[0],
|
|
66
|
+
setdeleteLoading = _useState22[1];
|
|
67
|
+
const _useState23 = (0, _react.useState)({
|
|
68
|
+
getResult: getResult,
|
|
69
|
+
postResult: postResult,
|
|
70
|
+
putResult: putResult,
|
|
71
|
+
deleteResult: deleteResult
|
|
72
|
+
}),
|
|
73
|
+
_useState24 = _slicedToArray(_useState23, 2),
|
|
74
|
+
result = _useState24[0],
|
|
75
|
+
setResult = _useState24[1];
|
|
76
|
+
let _useState25 = (0, _react.useState)({
|
|
77
|
+
getError: getError,
|
|
78
|
+
postError: postError,
|
|
79
|
+
putError: putError,
|
|
80
|
+
deleteError: deleteError
|
|
81
|
+
}),
|
|
82
|
+
_useState26 = _slicedToArray(_useState25, 2),
|
|
83
|
+
errorMessage = _useState26[0],
|
|
84
|
+
setErrorMessage = _useState26[1];
|
|
85
|
+
let _useState27 = (0, _react.useState)({
|
|
86
|
+
getLoading: getLoading,
|
|
87
|
+
postLoading: postLoading,
|
|
88
|
+
putLoading: putLoading,
|
|
89
|
+
deleteLoading: deleteLoading
|
|
90
|
+
}),
|
|
91
|
+
_useState28 = _slicedToArray(_useState27, 2),
|
|
92
|
+
loading = _useState28[0],
|
|
93
|
+
setLoading = _useState28[1];
|
|
94
|
+
const useGet = async (url, action) => {
|
|
95
|
+
let response;
|
|
96
|
+
try {
|
|
97
|
+
setLoading({
|
|
98
|
+
getLoading: true
|
|
99
|
+
});
|
|
100
|
+
response = await (0, _http.getSecureClient)().get(url);
|
|
101
|
+
setResult({
|
|
102
|
+
getResult: response
|
|
103
|
+
});
|
|
104
|
+
setLoading({
|
|
105
|
+
getLoading: false
|
|
106
|
+
});
|
|
107
|
+
} catch (error) {
|
|
108
|
+
const parsedError = (0, _http.parseAxiosError)(error);
|
|
109
|
+
setErrorMessage({
|
|
110
|
+
getError: parsedError.message
|
|
111
|
+
});
|
|
112
|
+
setLoading({
|
|
113
|
+
getLoading: false
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
};
|
|
117
|
+
const usePost = async (url, body, action) => {
|
|
118
|
+
let response;
|
|
119
|
+
try {
|
|
120
|
+
setLoading({
|
|
121
|
+
postLoading: true
|
|
122
|
+
});
|
|
123
|
+
response = await (0, _http.getSecureClient)().post(url, body);
|
|
124
|
+
setResult({
|
|
125
|
+
postResult: response
|
|
126
|
+
});
|
|
127
|
+
setLoading({
|
|
128
|
+
postLoading: false
|
|
129
|
+
});
|
|
130
|
+
} catch (error) {
|
|
131
|
+
const parsedError = (0, _http.parseAxiosError)(error);
|
|
132
|
+
setErrorMessage({
|
|
133
|
+
postError: parsedError.message
|
|
134
|
+
});
|
|
135
|
+
setLoading({
|
|
136
|
+
postLoading: false
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
const usePut = async (url, body, action) => {
|
|
141
|
+
let response;
|
|
142
|
+
try {
|
|
143
|
+
setLoading({
|
|
144
|
+
putLoading: true
|
|
145
|
+
});
|
|
146
|
+
const response = await (0, _http.getSecureClient)().put(url, body);
|
|
147
|
+
setResult({
|
|
148
|
+
putResult: response
|
|
149
|
+
});
|
|
150
|
+
setLoading({
|
|
151
|
+
putLoading: false
|
|
152
|
+
});
|
|
153
|
+
} catch (error) {
|
|
154
|
+
const parsedError = (0, _http.parseAxiosError)(error);
|
|
155
|
+
setErrorMessage({
|
|
156
|
+
putError: parsedError.message
|
|
157
|
+
});
|
|
158
|
+
setLoading({
|
|
159
|
+
putLoading: false
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
const useDelete = async (url, action) => {
|
|
164
|
+
let response;
|
|
165
|
+
try {
|
|
166
|
+
setLoading({
|
|
167
|
+
deleteLoading: true
|
|
168
|
+
});
|
|
169
|
+
response = await (0, _http.getSecureClient)().delete(url);
|
|
170
|
+
setResult({
|
|
171
|
+
deleteResult: response
|
|
172
|
+
});
|
|
173
|
+
setLoading({
|
|
174
|
+
deleteLoading: false
|
|
175
|
+
});
|
|
176
|
+
} catch (error) {
|
|
177
|
+
const parsedError = (0, _http.parseAxiosError)(error);
|
|
178
|
+
setErrorMessage({
|
|
179
|
+
deleteError: parsedError.message
|
|
180
|
+
});
|
|
181
|
+
setLoading({
|
|
182
|
+
deleteLoading: false
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
};
|
|
186
|
+
return [result, errorMessage, loading, useGet, usePost, usePut, useDelete];
|
|
187
|
+
};
|
|
188
|
+
var _default = exports.default = useAPI;
|
|
@@ -6,6 +6,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.secureEnterprise = void 0;
|
|
7
7
|
var _axios = _interopRequireDefault(require("axios"));
|
|
8
8
|
var _securityConfig = require("./securityConfig");
|
|
9
|
-
function _interopRequireDefault(
|
|
10
|
-
|
|
9
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
|
+
const secureEnterprise = () => {};
|
|
11
11
|
exports.secureEnterprise = secureEnterprise;
|
|
@@ -4,5 +4,4 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.ACCESS_TOKEN_FROM_LOCAL_STORAGE = void 0;
|
|
7
|
-
|
|
8
|
-
exports.ACCESS_TOKEN_FROM_LOCAL_STORAGE = ACCESS_TOKEN_FROM_LOCAL_STORAGE;
|
|
7
|
+
const ACCESS_TOKEN_FROM_LOCAL_STORAGE = exports.ACCESS_TOKEN_FROM_LOCAL_STORAGE = "te4_at";
|