tenjin-ui-kit 0.3.70 → 0.3.72-dev

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 (203) hide show
  1. package/common/hooks/apiHooks.js +155 -0
  2. package/common/hooks/newApiHook.js +188 -0
  3. package/{dist/common → common}/utils/security/index.js +2 -2
  4. package/{dist/common → common}/utils/security/securityConfig.js +1 -2
  5. package/components/Canvas.js +330 -0
  6. package/components/DragBox/index.js +40 -0
  7. package/components/InputWithChip/index.js +294 -0
  8. package/{dist/components → components}/RightContext/index.js +19 -28
  9. package/components/WorkFlow.js +42 -0
  10. package/components/WorkFlowBuilder.js +115 -0
  11. package/components/alert/Style.js +20 -0
  12. package/components/alert/index.js +67 -0
  13. package/{dist/components → components}/attachment/index.js +21 -28
  14. package/{dist/components → components}/authenticationProvider/AuthError.js +3 -4
  15. package/{dist/components → components}/authenticationProvider/AuthLoader.js +3 -4
  16. package/components/authenticationProvider/index.js +110 -0
  17. package/{dist/components → components}/avatar/index.js +13 -14
  18. package/components/avatar/styles.js +91 -0
  19. package/components/breadCrumbs/index.js +169 -0
  20. package/{dist/components → components}/breadCrumbs/style.js +1 -4
  21. package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/index.js +5 -6
  22. package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewContent/style.js +5 -8
  23. package/{dist/components → components}/browsingTestCaseLayout/DetailsViewLayout/DetailsViewHeader/index.js +4 -5
  24. package/{dist/components → components}/browsingTestCaseLayout/TreeViewLayout/TreeViewContent/Index.js +4 -5
  25. package/{dist/components → components}/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/Index.js +5 -6
  26. package/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +23 -0
  27. package/{dist/components → components}/browsingTestCaseLayout/index.js +25 -30
  28. package/components/button/index.js +133 -0
  29. package/{dist/components → components}/chatBotModal/index.js +36 -45
  30. package/components/checkBox/index.js +29 -0
  31. package/{dist/components → components}/combobox/index.js +51 -72
  32. package/components/divider/index.js +37 -0
  33. package/{dist/components → components}/editableField/index.js +19 -28
  34. package/{dist/components → components}/error/index.js +6 -12
  35. package/components/errorBoundary/index.js +140 -0
  36. package/components/fileUploader/index.js +151 -0
  37. package/components/fileUploader/style.js +57 -0
  38. package/components/filter/ValueSelector.js +333 -0
  39. package/{dist/components → components}/filter/index.js +26 -33
  40. package/{dist/components → components}/iconButton/index.js +3 -4
  41. package/components/input/index.js +167 -0
  42. package/components/layout/index.js +94 -0
  43. package/components/layout/main/index.js +24 -0
  44. package/components/layout/main/style.js +19 -0
  45. package/{dist/components → components}/layout/pageContent/index.js +6 -7
  46. package/components/layout/sidebar/FlatMenu.js +64 -0
  47. package/components/layout/sidebar/GroupedIconMenu.js +233 -0
  48. package/components/layout/sidebar/GroupedMenu.js +57 -0
  49. package/components/layout/sidebar/ProjectMenu.js +223 -0
  50. package/components/layout/sidebar/index.js +88 -0
  51. package/components/layout/sidebar/style.js +149 -0
  52. package/components/layout/topBar/ProjectTopbar.js +388 -0
  53. package/components/layout/topBar/UserAvatar.js +138 -0
  54. package/components/layout/topBar/index.js +121 -0
  55. package/{dist/components → components}/loader/index.js +9 -12
  56. package/components/menu/index.js +71 -0
  57. package/{dist/components → components}/modal/Modal.js +5 -6
  58. package/components/modal/index.js +88 -0
  59. package/components/modal/style.js +65 -0
  60. package/components/optionMenu/index.js +105 -0
  61. package/components/pagination/index.js +114 -0
  62. package/components/pagination/style.js +33 -0
  63. package/components/paginationUpdated/index.js +74 -0
  64. package/components/paper/index.js +43 -0
  65. package/components/paper/style.js +31 -0
  66. package/components/reactSelect/index.js +195 -0
  67. package/components/reactSelect/style.js +130 -0
  68. package/components/richTextEditor/index.js +64 -0
  69. package/components/select/GroupedSelect.js +167 -0
  70. package/components/select/SimpleSelect.js +184 -0
  71. package/{dist/components → components}/select/index.js +38 -54
  72. package/components/simpleSelect/index.js +53 -0
  73. package/{dist/components → components}/sort/index.js +19 -22
  74. package/{dist/components → components}/switch/index.js +10 -11
  75. package/components/switch/style.js +39 -0
  76. package/{dist/components → components}/switch/switch.js +17 -23
  77. package/components/table/ReactTable.js +101 -0
  78. package/components/table/SimpleTable.js +117 -0
  79. package/components/table/index.js +381 -0
  80. package/components/text/index.js +65 -0
  81. package/{dist/components → components}/timeStamp/index.js +4 -6
  82. package/components/timeStamp/style.js +20 -0
  83. package/components/topBar/index.js +169 -0
  84. package/{dist/components → components}/tree/index.js +29 -47
  85. package/components/tree/style.js +29 -0
  86. package/components/valuePicker/ValueSelector.js +205 -0
  87. package/{dist/components → components}/valuePicker/index.js +19 -26
  88. package/{dist/components → components}/wrapperLayout/layout/index.js +4 -5
  89. package/{dist/components → components}/wrapperLayout/main/index.js +4 -5
  90. package/{dist/components → components}/wrapperLayout/main/pageContainer/index.js +4 -5
  91. package/components/wrapperLayout/main/sideBar/index.js +272 -0
  92. package/components/wrapperLayout/main/sideBar/style.js +190 -0
  93. package/{dist/components → components}/wrapperLayout/topBar/UserAvatar.js +4 -5
  94. package/components/wrapperLayout/topBar/avatar.js +55 -0
  95. package/components/wrapperLayout/topBar/index.js +196 -0
  96. package/{dist/components → components}/wrapperLayout/topBar/menuIcon.js +4 -5
  97. package/components/wrapperLayout/topBar/style.js +74 -0
  98. package/http/index.js +133 -0
  99. package/{dist/index.js → index.js} +53 -55
  100. package/package.json +5 -3
  101. package/{dist/templates → templates}/listPage/index.js +36 -57
  102. package/{dist/themes → themes}/default.js +5 -7
  103. package/{dist/themes → themes}/defaultSmall.js +2 -3
  104. package/{dist/themes → themes}/responsiveTheme.js +6 -8
  105. package/.dockerignore +0 -6
  106. package/.storybook/main.js +0 -16
  107. package/.storybook/preview.js +0 -11
  108. package/Dockerfile +0 -17
  109. package/Jenkinsfile +0 -66
  110. package/build/asset-manifest.json +0 -16
  111. package/build/favicon.ico +0 -0
  112. package/build/index.html +0 -1
  113. package/build/logo192.png +0 -0
  114. package/build/logo512.png +0 -0
  115. package/build/manifest.json +0 -25
  116. package/build/robots.txt +0 -3
  117. package/build/static/css/main.522396f6.css +0 -2
  118. package/build/static/css/main.522396f6.css.map +0 -1
  119. package/build/static/js/787.18cf14d0.chunk.js +0 -2
  120. package/build/static/js/787.18cf14d0.chunk.js.map +0 -1
  121. package/build/static/js/main.d71fecac.js +0 -3
  122. package/build/static/js/main.d71fecac.js.LICENSE.txt +0 -50
  123. package/build/static/js/main.d71fecac.js.map +0 -1
  124. package/build/static/media/logo.6ce24c58023cc2f8fd88fe9d219db6c6.svg +0 -1
  125. package/build/tenjinLogo.png +0 -0
  126. package/dist/common/hooks/apiHooks.js +0 -223
  127. package/dist/common/hooks/newApiHook.js +0 -270
  128. package/dist/components/Canvas.js +0 -254
  129. package/dist/components/DragBox/index.js +0 -45
  130. package/dist/components/InputWithChip/index.js +0 -187
  131. package/dist/components/WorkFlow.js +0 -47
  132. package/dist/components/WorkFlowBuilder.js +0 -130
  133. package/dist/components/alert/Style.js +0 -23
  134. package/dist/components/alert/index.js +0 -69
  135. package/dist/components/authenticationProvider/index.js +0 -166
  136. package/dist/components/avatar/styles.js +0 -94
  137. package/dist/components/breadCrumbs/index.js +0 -180
  138. package/dist/components/browsingTestCaseLayout/TreeViewLayout/TreeViewHeader/style.js +0 -26
  139. package/dist/components/button/index.js +0 -140
  140. package/dist/components/checkBox/index.js +0 -30
  141. package/dist/components/divider/index.js +0 -41
  142. package/dist/components/errorBoundary/index.js +0 -160
  143. package/dist/components/fileUploader/index.js +0 -156
  144. package/dist/components/fileUploader/style.js +0 -60
  145. package/dist/components/filter/ValueSelector.js +0 -405
  146. package/dist/components/input/index.js +0 -174
  147. package/dist/components/layout/index.js +0 -98
  148. package/dist/components/layout/main/index.js +0 -27
  149. package/dist/components/layout/main/style.js +0 -22
  150. package/dist/components/layout/sidebar/FlatMenu.js +0 -64
  151. package/dist/components/layout/sidebar/GroupedIconMenu.js +0 -246
  152. package/dist/components/layout/sidebar/GroupedMenu.js +0 -67
  153. package/dist/components/layout/sidebar/ProjectMenu.js +0 -230
  154. package/dist/components/layout/sidebar/index.js +0 -91
  155. package/dist/components/layout/sidebar/style.js +0 -154
  156. package/dist/components/layout/topBar/ProjectTopbar.js +0 -338
  157. package/dist/components/layout/topBar/UserAvatar.js +0 -145
  158. package/dist/components/layout/topBar/index.js +0 -132
  159. package/dist/components/menu/index.js +0 -80
  160. package/dist/components/modal/index.js +0 -91
  161. package/dist/components/modal/style.js +0 -68
  162. package/dist/components/optionMenu/index.js +0 -112
  163. package/dist/components/pagination/index.js +0 -129
  164. package/dist/components/pagination/style.js +0 -36
  165. package/dist/components/paginationUpdated/index.js +0 -75
  166. package/dist/components/paper/index.js +0 -44
  167. package/dist/components/paper/style.js +0 -34
  168. package/dist/components/reactSelect/index.js +0 -212
  169. package/dist/components/reactSelect/style.js +0 -163
  170. package/dist/components/richTextEditor/index.js +0 -83
  171. package/dist/components/select/GroupedSelect.js +0 -183
  172. package/dist/components/select/SimpleSelect.js +0 -212
  173. package/dist/components/simpleSelect/index.js +0 -56
  174. package/dist/components/switch/style.js +0 -42
  175. package/dist/components/table/ReactTable.js +0 -118
  176. package/dist/components/table/SimpleTable.js +0 -136
  177. package/dist/components/table/index.js +0 -256
  178. package/dist/components/text/index.js +0 -67
  179. package/dist/components/timeStamp/style.js +0 -23
  180. package/dist/components/topBar/index.js +0 -176
  181. package/dist/components/tree/style.js +0 -32
  182. package/dist/components/valuePicker/ValueSelector.js +0 -273
  183. package/dist/components/wrapperLayout/main/sideBar/index.js +0 -262
  184. package/dist/components/wrapperLayout/main/sideBar/style.js +0 -196
  185. package/dist/components/wrapperLayout/topBar/avatar.js +0 -57
  186. package/dist/components/wrapperLayout/topBar/index.js +0 -182
  187. package/dist/components/wrapperLayout/topBar/style.js +0 -77
  188. package/dist/http/index.js +0 -226
  189. package/public/favicon.ico +0 -0
  190. package/public/index.html +0 -43
  191. package/public/logo192.png +0 -0
  192. package/public/logo512.png +0 -0
  193. package/public/manifest.json +0 -25
  194. package/public/robots.txt +0 -3
  195. package/public/tenjinLogo.png +0 -0
  196. /package/{dist/assets → assets}/images/MicrosoftTeams-image (1).png +0 -0
  197. /package/{dist/assets → assets}/images/tenjin-4.0-logo.png +0 -0
  198. /package/{dist/components → components}/RightContext/index.css +0 -0
  199. /package/{dist/components → components}/browsingTestCaseLayout/style.css +0 -0
  200. /package/{dist/components → components}/errorBoundary/Error.jpg +0 -0
  201. /package/{dist/components → components}/iconButton/style.js +0 -0
  202. /package/{dist/components → components}/richTextEditor/style.js +0 -0
  203. /package/{dist/components → components}/wrapperLayout/layout/style.js +0 -0
@@ -1 +0,0 @@
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
@@ -1,223 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.usePut = exports.usePost = exports.useFetch = exports.useDelete = void 0;
8
- var _react = require("react");
9
- var _http = require("../../http");
10
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
11
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
12
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
13
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
- 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."); }
15
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
16
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
17
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
18
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
19
- var useFetch = function useFetch(url, clean, dependency) {
20
- var _useState = (0, _react.useState)(null),
21
- _useState2 = _slicedToArray(_useState, 2),
22
- data = _useState2[0],
23
- setData = _useState2[1];
24
- var _useState3 = (0, _react.useState)(false),
25
- _useState4 = _slicedToArray(_useState3, 2),
26
- loading = _useState4[0],
27
- setLoading = _useState4[1];
28
- var _useState5 = (0, _react.useState)(null),
29
- _useState6 = _slicedToArray(_useState5, 2),
30
- error = _useState6[0],
31
- setError = _useState6[1];
32
- (0, _react.useEffect)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
33
- var res, parsedError;
34
- return _regeneratorRuntime().wrap(function _callee$(_context) {
35
- while (1) switch (_context.prev = _context.next) {
36
- case 0:
37
- setLoading(true);
38
- setError(null);
39
- _context.prev = 2;
40
- _context.next = 5;
41
- return (0, _http.get)(url);
42
- case 5:
43
- res = _context.sent;
44
- setData(res);
45
- setLoading(false);
46
- _context.next = 15;
47
- break;
48
- case 10:
49
- _context.prev = 10;
50
- _context.t0 = _context["catch"](2);
51
- setLoading(false);
52
- parsedError = (0, _http.parseAxiosError)(_context.t0);
53
- setError(parsedError.message);
54
- case 15:
55
- return _context.abrupt("return", function () {
56
- clean();
57
- });
58
- case 16:
59
- case "end":
60
- return _context.stop();
61
- }
62
- }, _callee, null, [[2, 10]]);
63
- })), [dependency]);
64
- return {
65
- data: data,
66
- loading: loading,
67
- error: error
68
- };
69
- };
70
- exports.useFetch = useFetch;
71
- var usePost = function usePost(url, body, clean, dependency) {
72
- var _useState7 = (0, _react.useState)(null),
73
- _useState8 = _slicedToArray(_useState7, 2),
74
- data = _useState8[0],
75
- setData = _useState8[1];
76
- var _useState9 = (0, _react.useState)(false),
77
- _useState10 = _slicedToArray(_useState9, 2),
78
- loading = _useState10[0],
79
- setLoading = _useState10[1];
80
- var _useState11 = (0, _react.useState)(null),
81
- _useState12 = _slicedToArray(_useState11, 2),
82
- error = _useState12[0],
83
- setError = _useState12[1];
84
- (0, _react.useEffect)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {
85
- var _data;
86
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
87
- while (1) switch (_context2.prev = _context2.next) {
88
- case 0:
89
- setLoading(true);
90
- setError(null);
91
- _context2.prev = 2;
92
- _context2.next = 5;
93
- return (0, _http.post)(url, body);
94
- case 5:
95
- _data = _context2.sent;
96
- setData(_data);
97
- setLoading(false);
98
- _context2.next = 14;
99
- break;
100
- case 10:
101
- _context2.prev = 10;
102
- _context2.t0 = _context2["catch"](2);
103
- setError(_context2.t0);
104
- setLoading(false);
105
- case 14:
106
- return _context2.abrupt("return", function () {
107
- clean();
108
- });
109
- case 15:
110
- case "end":
111
- return _context2.stop();
112
- }
113
- }, _callee2, null, [[2, 10]]);
114
- })), [dependency]);
115
- return {
116
- data: data,
117
- loading: loading,
118
- error: error
119
- };
120
- };
121
- exports.usePost = usePost;
122
- var usePut = function usePut(url, body, clean, dependency) {
123
- var _useState13 = (0, _react.useState)(null),
124
- _useState14 = _slicedToArray(_useState13, 2),
125
- data = _useState14[0],
126
- setData = _useState14[1];
127
- var _useState15 = (0, _react.useState)(false),
128
- _useState16 = _slicedToArray(_useState15, 2),
129
- loading = _useState16[0],
130
- setLoading = _useState16[1];
131
- var _useState17 = (0, _react.useState)(null),
132
- _useState18 = _slicedToArray(_useState17, 2),
133
- error = _useState18[0],
134
- setError = _useState18[1];
135
- (0, _react.useEffect)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {
136
- var _data2;
137
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
138
- while (1) switch (_context3.prev = _context3.next) {
139
- case 0:
140
- setLoading(true);
141
- setError(null);
142
- _context3.prev = 2;
143
- _context3.next = 5;
144
- return (0, _http.put)(url, body);
145
- case 5:
146
- _data2 = _context3.sent;
147
- setData(_data2);
148
- setLoading(false);
149
- _context3.next = 14;
150
- break;
151
- case 10:
152
- _context3.prev = 10;
153
- _context3.t0 = _context3["catch"](2);
154
- setError(_context3.t0);
155
- setLoading(false);
156
- case 14:
157
- return _context3.abrupt("return", function () {
158
- clean();
159
- });
160
- case 15:
161
- case "end":
162
- return _context3.stop();
163
- }
164
- }, _callee3, null, [[2, 10]]);
165
- })), [dependency]);
166
- return {
167
- data: data,
168
- loading: loading,
169
- error: error
170
- };
171
- };
172
- exports.usePut = usePut;
173
- var useDelete = function useDelete(url, body, clean, dependency) {
174
- var _useState19 = (0, _react.useState)(null),
175
- _useState20 = _slicedToArray(_useState19, 2),
176
- data = _useState20[0],
177
- setData = _useState20[1];
178
- var _useState21 = (0, _react.useState)(false),
179
- _useState22 = _slicedToArray(_useState21, 2),
180
- loading = _useState22[0],
181
- setLoading = _useState22[1];
182
- var _useState23 = (0, _react.useState)(null),
183
- _useState24 = _slicedToArray(_useState23, 2),
184
- error = _useState24[0],
185
- setError = _useState24[1];
186
- (0, _react.useEffect)( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {
187
- var _data3;
188
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
189
- while (1) switch (_context4.prev = _context4.next) {
190
- case 0:
191
- setLoading(true);
192
- setError(null);
193
- _context4.prev = 2;
194
- _context4.next = 5;
195
- return (0, _http.doDelete)(url);
196
- case 5:
197
- _data3 = _context4.sent;
198
- setData(_data3);
199
- setLoading(false);
200
- _context4.next = 14;
201
- break;
202
- case 10:
203
- _context4.prev = 10;
204
- _context4.t0 = _context4["catch"](2);
205
- setError(_context4.t0);
206
- setLoading(false);
207
- case 14:
208
- return _context4.abrupt("return", function () {
209
- clean();
210
- });
211
- case 15:
212
- case "end":
213
- return _context4.stop();
214
- }
215
- }, _callee4, null, [[2, 10]]);
216
- })), [dependency]);
217
- return {
218
- data: data,
219
- loading: loading,
220
- error: error
221
- };
222
- };
223
- exports.useDelete = useDelete;
@@ -1,270 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = void 0;
8
- var _react = _interopRequireWildcard(require("react"));
9
- var _http = require("../../http");
10
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
11
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
12
- function _regeneratorRuntime() { "use strict"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return exports; }; var exports = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, defineProperty = Object.defineProperty || function (obj, key, desc) { obj[key] = desc.value; }, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag"; function define(obj, key, value) { return Object.defineProperty(obj, key, { value: value, enumerable: !0, configurable: !0, writable: !0 }), obj[key]; } try { define({}, ""); } catch (err) { define = function define(obj, key, value) { return obj[key] = value; }; } function wrap(innerFn, outerFn, self, tryLocsList) { var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []); return defineProperty(generator, "_invoke", { value: makeInvokeMethod(innerFn, self, context) }), generator; } function tryCatch(fn, obj, arg) { try { return { type: "normal", arg: fn.call(obj, arg) }; } catch (err) { return { type: "throw", arg: err }; } } exports.wrap = wrap; var ContinueSentinel = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var IteratorPrototype = {}; define(IteratorPrototype, iteratorSymbol, function () { return this; }); var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([]))); NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype); var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype); function defineIteratorMethods(prototype) { ["next", "throw", "return"].forEach(function (method) { define(prototype, method, function (arg) { return this._invoke(method, arg); }); }); } function AsyncIterator(generator, PromiseImpl) { function invoke(method, arg, resolve, reject) { var record = tryCatch(generator[method], generator, arg); if ("throw" !== record.type) { var result = record.arg, value = result.value; return value && "object" == _typeof(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function (value) { invoke("next", value, resolve, reject); }, function (err) { invoke("throw", err, resolve, reject); }) : PromiseImpl.resolve(value).then(function (unwrapped) { result.value = unwrapped, resolve(result); }, function (error) { return invoke("throw", error, resolve, reject); }); } reject(record.arg); } var previousPromise; defineProperty(this, "_invoke", { value: function value(method, arg) { function callInvokeWithMethodAndArg() { return new PromiseImpl(function (resolve, reject) { invoke(method, arg, resolve, reject); }); } return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(innerFn, self, context) { var state = "suspendedStart"; return function (method, arg) { if ("executing" === state) throw new Error("Generator is already running"); if ("completed" === state) { if ("throw" === method) throw arg; return doneResult(); } for (context.method = method, context.arg = arg;;) { var delegate = context.delegate; if (delegate) { var delegateResult = maybeInvokeDelegate(delegate, context); if (delegateResult) { if (delegateResult === ContinueSentinel) continue; return delegateResult; } } if ("next" === context.method) context.sent = context._sent = context.arg;else if ("throw" === context.method) { if ("suspendedStart" === state) throw state = "completed", context.arg; context.dispatchException(context.arg); } else "return" === context.method && context.abrupt("return", context.arg); state = "executing"; var record = tryCatch(innerFn, self, context); if ("normal" === record.type) { if (state = context.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel) continue; return { value: record.arg, done: context.done }; } "throw" === record.type && (state = "completed", context.method = "throw", context.arg = record.arg); } }; } function maybeInvokeDelegate(delegate, context) { var methodName = context.method, method = delegate.iterator[methodName]; if (undefined === method) return context.delegate = null, "throw" === methodName && delegate.iterator.return && (context.method = "return", context.arg = undefined, maybeInvokeDelegate(delegate, context), "throw" === context.method) || "return" !== methodName && (context.method = "throw", context.arg = new TypeError("The iterator does not provide a '" + methodName + "' method")), ContinueSentinel; var record = tryCatch(method, delegate.iterator, context.arg); if ("throw" === record.type) return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel; var info = record.arg; return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = undefined), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel); } function pushTryEntry(locs) { var entry = { tryLoc: locs[0] }; 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry); } function resetTryEntry(entry) { var record = entry.completion || {}; record.type = "normal", delete record.arg, entry.completion = record; } function Context(tryLocsList) { this.tryEntries = [{ tryLoc: "root" }], tryLocsList.forEach(pushTryEntry, this), this.reset(!0); } function values(iterable) { if (iterable) { var iteratorMethod = iterable[iteratorSymbol]; if (iteratorMethod) return iteratorMethod.call(iterable); if ("function" == typeof iterable.next) return iterable; if (!isNaN(iterable.length)) { var i = -1, next = function next() { for (; ++i < iterable.length;) if (hasOwn.call(iterable, i)) return next.value = iterable[i], next.done = !1, next; return next.value = undefined, next.done = !0, next; }; return next.next = next; } } return { next: doneResult }; } function doneResult() { return { value: undefined, done: !0 }; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, defineProperty(Gp, "constructor", { value: GeneratorFunctionPrototype, configurable: !0 }), defineProperty(GeneratorFunctionPrototype, "constructor", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports.isGeneratorFunction = function (genFun) { var ctor = "function" == typeof genFun && genFun.constructor; return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name)); }, exports.mark = function (genFun) { return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun; }, exports.awrap = function (arg) { return { __await: arg }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function () { return this; }), exports.AsyncIterator = AsyncIterator, exports.async = function (innerFn, outerFn, self, tryLocsList, PromiseImpl) { void 0 === PromiseImpl && (PromiseImpl = Promise); var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl); return exports.isGeneratorFunction(outerFn) ? iter : iter.next().then(function (result) { return result.done ? result.value : iter.next(); }); }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function () { return this; }), define(Gp, "toString", function () { return "[object Generator]"; }), exports.keys = function (val) { var object = Object(val), keys = []; for (var key in object) keys.push(key); return keys.reverse(), function next() { for (; keys.length;) { var key = keys.pop(); if (key in object) return next.value = key, next.done = !1, next; } return next.done = !0, next; }; }, exports.values = values, Context.prototype = { constructor: Context, reset: function reset(skipTempReset) { if (this.prev = 0, this.next = 0, this.sent = this._sent = undefined, this.done = !1, this.delegate = null, this.method = "next", this.arg = undefined, this.tryEntries.forEach(resetTryEntry), !skipTempReset) for (var name in this) "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = undefined); }, stop: function stop() { this.done = !0; var rootRecord = this.tryEntries[0].completion; if ("throw" === rootRecord.type) throw rootRecord.arg; return this.rval; }, dispatchException: function dispatchException(exception) { if (this.done) throw exception; var context = this; function handle(loc, caught) { return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = undefined), !!caught; } for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i], record = entry.completion; if ("root" === entry.tryLoc) return handle("end"); if (entry.tryLoc <= this.prev) { var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc"); if (hasCatch && hasFinally) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } else if (hasCatch) { if (this.prev < entry.catchLoc) return handle(entry.catchLoc, !0); } else { if (!hasFinally) throw new Error("try statement without catch or finally"); if (this.prev < entry.finallyLoc) return handle(entry.finallyLoc); } } } }, abrupt: function abrupt(type, arg) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) { var finallyEntry = entry; break; } } finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null); var record = finallyEntry ? finallyEntry.completion : {}; return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record); }, complete: function complete(record, afterLoc) { if ("throw" === record.type) throw record.arg; return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel; }, finish: function finish(finallyLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.finallyLoc === finallyLoc) return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel; } }, catch: function _catch(tryLoc) { for (var i = this.tryEntries.length - 1; i >= 0; --i) { var entry = this.tryEntries[i]; if (entry.tryLoc === tryLoc) { var record = entry.completion; if ("throw" === record.type) { var thrown = record.arg; resetTryEntry(entry); } return thrown; } } throw new Error("illegal catch attempt"); }, delegateYield: function delegateYield(iterable, resultName, nextLoc) { return this.delegate = { iterator: values(iterable), resultName: resultName, nextLoc: nextLoc }, "next" === this.method && (this.arg = undefined), ContinueSentinel; } }, exports; }
13
- function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
14
- function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
15
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
16
- 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."); }
17
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
18
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
19
- function _iterableToArrayLimit(arr, i) { var _i = null == arr ? null : "undefined" != typeof Symbol && arr[Symbol.iterator] || arr["@@iterator"]; if (null != _i) { var _s, _e, _x, _r, _arr = [], _n = !0, _d = !1; try { if (_x = (_i = _i.call(arr)).next, 0 === i) { if (Object(_i) !== _i) return; _n = !1; } else for (; !(_n = (_s = _x.call(_i)).done) && (_arr.push(_s.value), _arr.length !== i); _n = !0); } catch (err) { _d = !0, _e = err; } finally { try { if (!_n && null != _i.return && (_r = _i.return(), Object(_r) !== _r)) return; } finally { if (_d) throw _e; } } return _arr; } }
20
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
21
- var useAPI = function useAPI() {
22
- var _useState = (0, _react.useState)(null),
23
- _useState2 = _slicedToArray(_useState, 2),
24
- getResult = _useState2[0],
25
- setGetResult = _useState2[1];
26
- var _useState3 = (0, _react.useState)(null),
27
- _useState4 = _slicedToArray(_useState3, 2),
28
- postResult = _useState4[0],
29
- setpostResult = _useState4[1];
30
- var _useState5 = (0, _react.useState)(null),
31
- _useState6 = _slicedToArray(_useState5, 2),
32
- putResult = _useState6[0],
33
- setputResult = _useState6[1];
34
- var _useState7 = (0, _react.useState)(null),
35
- _useState8 = _slicedToArray(_useState7, 2),
36
- deleteResult = _useState8[0],
37
- setdeleteResult = _useState8[1];
38
- //
39
- var _useState9 = (0, _react.useState)(null),
40
- _useState10 = _slicedToArray(_useState9, 2),
41
- getError = _useState10[0],
42
- setGetError = _useState10[1];
43
- var _useState11 = (0, _react.useState)(null),
44
- _useState12 = _slicedToArray(_useState11, 2),
45
- postError = _useState12[0],
46
- setpostError = _useState12[1];
47
- var _useState13 = (0, _react.useState)(null),
48
- _useState14 = _slicedToArray(_useState13, 2),
49
- putError = _useState14[0],
50
- setputError = _useState14[1];
51
- var _useState15 = (0, _react.useState)(null),
52
- _useState16 = _slicedToArray(_useState15, 2),
53
- deleteError = _useState16[0],
54
- setdeleteError = _useState16[1];
55
- //
56
- var _useState17 = (0, _react.useState)(null),
57
- _useState18 = _slicedToArray(_useState17, 2),
58
- getLoading = _useState18[0],
59
- setGetLoading = _useState18[1];
60
- var _useState19 = (0, _react.useState)(null),
61
- _useState20 = _slicedToArray(_useState19, 2),
62
- postLoading = _useState20[0],
63
- setpostLoading = _useState20[1];
64
- var _useState21 = (0, _react.useState)(null),
65
- _useState22 = _slicedToArray(_useState21, 2),
66
- putLoading = _useState22[0],
67
- setputLoading = _useState22[1];
68
- var _useState23 = (0, _react.useState)(null),
69
- _useState24 = _slicedToArray(_useState23, 2),
70
- deleteLoading = _useState24[0],
71
- setdeleteLoading = _useState24[1];
72
- var _useState25 = (0, _react.useState)({
73
- getResult: getResult,
74
- postResult: postResult,
75
- putResult: putResult,
76
- deleteResult: deleteResult
77
- }),
78
- _useState26 = _slicedToArray(_useState25, 2),
79
- result = _useState26[0],
80
- setResult = _useState26[1];
81
- var _useState27 = (0, _react.useState)({
82
- getError: getError,
83
- postError: postError,
84
- putError: putError,
85
- deleteError: deleteError
86
- }),
87
- _useState28 = _slicedToArray(_useState27, 2),
88
- errorMessage = _useState28[0],
89
- setErrorMessage = _useState28[1];
90
- var _useState29 = (0, _react.useState)({
91
- getLoading: getLoading,
92
- postLoading: postLoading,
93
- putLoading: putLoading,
94
- deleteLoading: deleteLoading
95
- }),
96
- _useState30 = _slicedToArray(_useState29, 2),
97
- loading = _useState30[0],
98
- setLoading = _useState30[1];
99
- var useGet = /*#__PURE__*/function () {
100
- var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(url, action) {
101
- var response, parsedError;
102
- return _regeneratorRuntime().wrap(function _callee$(_context) {
103
- while (1) switch (_context.prev = _context.next) {
104
- case 0:
105
- _context.prev = 0;
106
- setLoading({
107
- getLoading: true
108
- });
109
- _context.next = 4;
110
- return (0, _http.getSecureClient)().get(url);
111
- case 4:
112
- response = _context.sent;
113
- setResult({
114
- getResult: response
115
- });
116
- setLoading({
117
- getLoading: false
118
- });
119
- _context.next = 14;
120
- break;
121
- case 9:
122
- _context.prev = 9;
123
- _context.t0 = _context["catch"](0);
124
- parsedError = (0, _http.parseAxiosError)(_context.t0);
125
- setErrorMessage({
126
- getError: parsedError.message
127
- });
128
- setLoading({
129
- getLoading: false
130
- });
131
- case 14:
132
- case "end":
133
- return _context.stop();
134
- }
135
- }, _callee, null, [[0, 9]]);
136
- }));
137
- return function useGet(_x2, _x3) {
138
- return _ref.apply(this, arguments);
139
- };
140
- }();
141
- var usePost = /*#__PURE__*/function () {
142
- var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(url, body, action) {
143
- var response, parsedError;
144
- return _regeneratorRuntime().wrap(function _callee2$(_context2) {
145
- while (1) switch (_context2.prev = _context2.next) {
146
- case 0:
147
- _context2.prev = 0;
148
- setLoading({
149
- postLoading: true
150
- });
151
- _context2.next = 4;
152
- return (0, _http.getSecureClient)().post(url, body);
153
- case 4:
154
- response = _context2.sent;
155
- setResult({
156
- postResult: response
157
- });
158
- setLoading({
159
- postLoading: false
160
- });
161
- _context2.next = 14;
162
- break;
163
- case 9:
164
- _context2.prev = 9;
165
- _context2.t0 = _context2["catch"](0);
166
- parsedError = (0, _http.parseAxiosError)(_context2.t0);
167
- setErrorMessage({
168
- postError: parsedError.message
169
- });
170
- setLoading({
171
- postLoading: false
172
- });
173
- case 14:
174
- case "end":
175
- return _context2.stop();
176
- }
177
- }, _callee2, null, [[0, 9]]);
178
- }));
179
- return function usePost(_x4, _x5, _x6) {
180
- return _ref2.apply(this, arguments);
181
- };
182
- }();
183
- var usePut = /*#__PURE__*/function () {
184
- var _ref3 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(url, body, action) {
185
- var response, _response, parsedError;
186
- return _regeneratorRuntime().wrap(function _callee3$(_context3) {
187
- while (1) switch (_context3.prev = _context3.next) {
188
- case 0:
189
- _context3.prev = 0;
190
- setLoading({
191
- putLoading: true
192
- });
193
- _context3.next = 4;
194
- return (0, _http.getSecureClient)().put(url, body);
195
- case 4:
196
- _response = _context3.sent;
197
- setResult({
198
- putResult: _response
199
- });
200
- setLoading({
201
- putLoading: false
202
- });
203
- _context3.next = 14;
204
- break;
205
- case 9:
206
- _context3.prev = 9;
207
- _context3.t0 = _context3["catch"](0);
208
- parsedError = (0, _http.parseAxiosError)(_context3.t0);
209
- setErrorMessage({
210
- putError: parsedError.message
211
- });
212
- setLoading({
213
- putLoading: false
214
- });
215
- case 14:
216
- case "end":
217
- return _context3.stop();
218
- }
219
- }, _callee3, null, [[0, 9]]);
220
- }));
221
- return function usePut(_x7, _x8, _x9) {
222
- return _ref3.apply(this, arguments);
223
- };
224
- }();
225
- var useDelete = /*#__PURE__*/function () {
226
- var _ref4 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(url, action) {
227
- var response, parsedError;
228
- return _regeneratorRuntime().wrap(function _callee4$(_context4) {
229
- while (1) switch (_context4.prev = _context4.next) {
230
- case 0:
231
- _context4.prev = 0;
232
- setLoading({
233
- deleteLoading: true
234
- });
235
- _context4.next = 4;
236
- return (0, _http.getSecureClient)().delete(url);
237
- case 4:
238
- response = _context4.sent;
239
- setResult({
240
- deleteResult: response
241
- });
242
- setLoading({
243
- deleteLoading: false
244
- });
245
- _context4.next = 14;
246
- break;
247
- case 9:
248
- _context4.prev = 9;
249
- _context4.t0 = _context4["catch"](0);
250
- parsedError = (0, _http.parseAxiosError)(_context4.t0);
251
- setErrorMessage({
252
- deleteError: parsedError.message
253
- });
254
- setLoading({
255
- deleteLoading: false
256
- });
257
- case 14:
258
- case "end":
259
- return _context4.stop();
260
- }
261
- }, _callee4, null, [[0, 9]]);
262
- }));
263
- return function useDelete(_x10, _x11) {
264
- return _ref4.apply(this, arguments);
265
- };
266
- }();
267
- return [result, errorMessage, loading, useGet, usePost, usePut, useDelete];
268
- };
269
- var _default = useAPI;
270
- exports.default = _default;