@intlayer/design-system 5.5.10 → 5.5.11

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 (77) hide show
  1. package/dist/.vite/manifest.json +48 -41
  2. package/dist/components/Auth/AuthModal/index.cjs +2 -2
  3. package/dist/components/Auth/AuthModal/index.mjs +2 -2
  4. package/dist/components/Auth/useAuth/useCSRF.d.ts +1 -1
  5. package/dist/components/Auth/useAuth/useOAuth2.d.ts +1 -1
  6. package/dist/components/Auth/useUser/index.cjs +2 -2
  7. package/dist/components/Auth/useUser/index.mjs +2 -2
  8. package/dist/components/ContentEditor/ContentEditorTextArea.cjs +2 -2
  9. package/dist/components/ContentEditor/ContentEditorTextArea.mjs +2 -2
  10. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +2 -2
  11. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +2 -2
  12. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
  13. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
  14. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +2 -2
  15. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +2 -2
  16. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +2 -2
  17. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -2
  18. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +2 -2
  19. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
  20. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +2 -2
  21. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -2
  22. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +2 -2
  23. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +2 -2
  24. package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -2
  25. package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -2
  26. package/dist/components/IDE/CodeContext.cjs +2 -2
  27. package/dist/components/IDE/CodeContext.mjs +2 -2
  28. package/dist/components/Link/Link.cjs.map +1 -1
  29. package/dist/components/Link/Link.d.ts.map +1 -1
  30. package/dist/components/Link/Link.mjs.map +1 -1
  31. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +2 -2
  32. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -2
  33. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +2 -2
  34. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +2 -2
  35. package/dist/components/MarkDownRender/index.cjs +27 -1
  36. package/dist/components/MarkDownRender/index.cjs.map +1 -1
  37. package/dist/components/MarkDownRender/index.d.ts +2 -2
  38. package/dist/components/MarkDownRender/index.d.ts.map +1 -1
  39. package/dist/components/MarkDownRender/index.mjs +27 -1
  40. package/dist/components/MarkDownRender/index.mjs.map +1 -1
  41. package/dist/components/Modal/Modal.cjs +4 -4
  42. package/dist/components/Modal/Modal.mjs +4 -4
  43. package/dist/components/Navbar/MobileNavbar.cjs +3 -3
  44. package/dist/components/Navbar/MobileNavbar.mjs +3 -3
  45. package/dist/components/Navbar/index.cjs +5 -5
  46. package/dist/components/Navbar/index.mjs +5 -5
  47. package/dist/components/SwitchSelector/index.cjs +3 -3
  48. package/dist/components/SwitchSelector/index.mjs +3 -3
  49. package/dist/components/TabSelector/TabSelector.cjs +3 -3
  50. package/dist/components/TabSelector/TabSelector.mjs +3 -3
  51. package/dist/components/TextArea/AutocompleteTextArea.cjs +2 -2
  52. package/dist/components/TextArea/AutocompleteTextArea.mjs +2 -2
  53. package/dist/hooks/index.cjs +25 -23
  54. package/dist/hooks/index.cjs.map +1 -1
  55. package/dist/hooks/index.d.ts +8 -7
  56. package/dist/hooks/index.d.ts.map +1 -1
  57. package/dist/hooks/index.mjs +10 -8
  58. package/dist/hooks/index.mjs.map +1 -1
  59. package/dist/hooks/intlayerAPIHooks.d.ts +54 -54
  60. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  61. package/dist/hooks/useAsync/useAsync.cjs +10 -11
  62. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  63. package/dist/hooks/useAsync/useAsync.mjs +10 -11
  64. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  65. package/dist/hooks/useIntlayerAPI.cjs +5 -4
  66. package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
  67. package/dist/hooks/useIntlayerAPI.d.ts +66 -65
  68. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  69. package/dist/hooks/useIntlayerAPI.mjs +5 -4
  70. package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
  71. package/dist/hooks/useScreenWidth.cjs +18 -0
  72. package/dist/hooks/useScreenWidth.cjs.map +1 -0
  73. package/dist/hooks/useScreenWidth.d.ts +4 -0
  74. package/dist/hooks/useScreenWidth.d.ts.map +1 -0
  75. package/dist/hooks/useScreenWidth.mjs +18 -0
  76. package/dist/hooks/useScreenWidth.mjs.map +1 -0
  77. package/package.json +16 -16
@@ -2,10 +2,10 @@
2
2
  import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { useConfiguration } from "@intlayer/editor-react";
4
4
  import { useState, useEffect } from "react";
5
- import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
6
- import "../../hooks/useAsync/useAsyncStateStore.mjs";
7
5
  import { useAutocomplete } from "../../hooks/intlayerAPIHooks.mjs";
6
+ import "../../hooks/useAsync/useAsyncStateStore.mjs";
8
7
  import "deepmerge";
8
+ import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
9
9
  import { AutoSizedTextArea } from "./AutoSizeTextArea.mjs";
10
10
  const useDebounce = (value, delay) => {
11
11
  const [debouncedValue, setDebouncedValue] = useState(value);
@@ -1,31 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const hooks_useDevice = require("./useDevice.cjs");
4
- const hooks_useGetElementOrWindow = require("./useGetElementOrWindow.cjs");
5
- const hooks_useScrollBlockage_index = require("../index-BYzBot7l.cjs");
6
- const hooks_useIsMounted = require("./useIsMounted.cjs");
7
- const hooks_useScrollDetection = require("./useScrollDetection.cjs");
3
+ const hooks_intlayerAPIHooks = require("./intlayerAPIHooks.cjs");
8
4
  const hooks_useAsync_useAsync = require("./useAsync/useAsync.cjs");
9
5
  const hooks_useAsync_useAsyncStateStore = require("./useAsync/useAsyncStateStore.cjs");
10
- const hooks_intlayerAPIHooks = require("./intlayerAPIHooks.cjs");
11
- const hooks_useItemSelector = require("./useItemSelector.cjs");
6
+ const hooks_useDevice = require("./useDevice.cjs");
12
7
  const hooks_useGetAllDictionaries = require("./useGetAllDictionaries.cjs");
13
- const hooks_usePersistedStore = require("./usePersistedStore.cjs");
8
+ const hooks_useGetElementOrWindow = require("./useGetElementOrWindow.cjs");
14
9
  const hooks_useIsDarkMode = require("./useIsDarkMode.cjs");
10
+ const hooks_useIsMounted = require("./useIsMounted.cjs");
11
+ const hooks_useItemSelector = require("./useItemSelector.cjs");
15
12
  const hooks_useKeyboardDetector = require("./useKeyboardDetector.cjs");
16
- exports.calculateIsMobile = hooks_useDevice.calculateIsMobile;
17
- exports.checkIsIphoneOrSafariDevice = hooks_useDevice.checkIsIphoneOrSafariDevice;
18
- exports.checkIsMobileScreen = hooks_useDevice.checkIsMobileScreen;
19
- exports.checkIsMobileUserAgent = hooks_useDevice.checkIsMobileUserAgent;
20
- exports.getBreakpointFromSize = hooks_useDevice.getBreakpointFromSize;
21
- exports.useDevice = hooks_useDevice.useDevice;
22
- exports.useGetElementOrWindow = hooks_useGetElementOrWindow.useGetElementOrWindow;
23
- exports.useScrollBlockage = hooks_useScrollBlockage_index.useScrollBlockage;
24
- exports.useIsMounted = hooks_useIsMounted.useIsMounted;
25
- exports.useScrollDetection = hooks_useScrollDetection.useScrollDetection;
26
- exports.useAsync = hooks_useAsync_useAsync.useAsync;
27
- exports.AsyncStateProvider = hooks_useAsync_useAsyncStateStore.AsyncStateProvider;
28
- exports.useAsyncState = hooks_useAsync_useAsyncStateStore.useAsyncState;
13
+ const hooks_usePersistedStore = require("./usePersistedStore.cjs");
14
+ const hooks_useScreenWidth = require("./useScreenWidth.cjs");
15
+ const hooks_useScrollBlockage_index = require("../index-BYzBot7l.cjs");
16
+ const hooks_useScrollDetection = require("./useScrollDetection.cjs");
29
17
  exports.useAddDictionary = hooks_intlayerAPIHooks.useAddDictionary;
30
18
  exports.useAddNewAccessKey = hooks_intlayerAPIHooks.useAddNewAccessKey;
31
19
  exports.useAddOrganization = hooks_intlayerAPIHooks.useAddOrganization;
@@ -84,9 +72,23 @@ exports.useUpdateTag = hooks_intlayerAPIHooks.useUpdateTag;
84
72
  exports.useUpdateUser = hooks_intlayerAPIHooks.useUpdateUser;
85
73
  exports.useVerifyEmail = hooks_intlayerAPIHooks.useVerifyEmail;
86
74
  exports.useWriteDictionary = hooks_intlayerAPIHooks.useWriteDictionary;
87
- exports.useItemSelector = hooks_useItemSelector.useItemSelector;
75
+ exports.useAsync = hooks_useAsync_useAsync.useAsync;
76
+ exports.AsyncStateProvider = hooks_useAsync_useAsyncStateStore.AsyncStateProvider;
77
+ exports.useAsyncState = hooks_useAsync_useAsyncStateStore.useAsyncState;
78
+ exports.calculateIsMobile = hooks_useDevice.calculateIsMobile;
79
+ exports.checkIsIphoneOrSafariDevice = hooks_useDevice.checkIsIphoneOrSafariDevice;
80
+ exports.checkIsMobileScreen = hooks_useDevice.checkIsMobileScreen;
81
+ exports.checkIsMobileUserAgent = hooks_useDevice.checkIsMobileUserAgent;
82
+ exports.getBreakpointFromSize = hooks_useDevice.getBreakpointFromSize;
83
+ exports.useDevice = hooks_useDevice.useDevice;
88
84
  exports.useGetAllDictionaries = hooks_useGetAllDictionaries.useGetAllDictionaries;
89
- exports.usePersistedStore = hooks_usePersistedStore.usePersistedStore;
85
+ exports.useGetElementOrWindow = hooks_useGetElementOrWindow.useGetElementOrWindow;
90
86
  exports.useIsDarkMode = hooks_useIsDarkMode.useIsDarkMode;
87
+ exports.useIsMounted = hooks_useIsMounted.useIsMounted;
88
+ exports.useItemSelector = hooks_useItemSelector.useItemSelector;
91
89
  exports.useKeyboardDetector = hooks_useKeyboardDetector.useKeyboardDetector;
90
+ exports.usePersistedStore = hooks_usePersistedStore.usePersistedStore;
91
+ exports.useScreenWidth = hooks_useScreenWidth.useScreenWidth;
92
+ exports.useScrollBlockage = hooks_useScrollBlockage_index.useScrollBlockage;
93
+ exports.useScrollDetection = hooks_useScrollDetection.useScrollDetection;
92
94
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,13 +1,14 @@
1
+ export * from './intlayerAPIHooks';
2
+ export * from './useAsync';
1
3
  export * from './useDevice';
4
+ export * from './useGetAllDictionaries';
2
5
  export * from './useGetElementOrWindow';
3
- export * from './useScrollBlockage';
6
+ export * from './useIsDarkMode';
4
7
  export * from './useIsMounted';
5
- export * from './useScrollDetection';
6
- export * from './useAsync';
7
- export * from './intlayerAPIHooks';
8
8
  export * from './useItemSelector';
9
- export * from './useGetAllDictionaries';
10
- export * from './usePersistedStore';
11
- export * from './useIsDarkMode';
12
9
  export * from './useKeyboardDetector';
10
+ export * from './usePersistedStore';
11
+ export * from './useScreenWidth';
12
+ export * from './useScrollBlockage';
13
+ export * from './useScrollDetection';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,YAAY,CAAC;AAC3B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AACnC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC"}
@@ -1,16 +1,17 @@
1
- import { calculateIsMobile, checkIsIphoneOrSafariDevice, checkIsMobileScreen, checkIsMobileUserAgent, getBreakpointFromSize, useDevice } from "./useDevice.mjs";
2
- import { useGetElementOrWindow } from "./useGetElementOrWindow.mjs";
3
- import { u } from "../index-BCuMWKyy.js";
4
- import { useIsMounted } from "./useIsMounted.mjs";
5
- import { useScrollDetection } from "./useScrollDetection.mjs";
1
+ import { useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddProject, useAddTag, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditTag, useAutocomplete, useCancelSubscription, useChangePassword, useCheckIfUserHasPassword, useCreateUser, useDefineNewPassword, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteProject, useDeleteTag, useDeleteUser, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetEditorDictionaries, useGetNewsletterStatus, useGetOrganizations, useGetPricing, useGetProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUsers, useLogin, useLogout, usePushDictionaries, useRefreshAccessKey, useRegister, useSearchDoc, useSelectOrganization, useSelectProject, useSubscribeToNewsletter, useTranslateJSONDeclaration, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateDictionary, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateProject, useUpdateProjectMembers, useUpdateTag, useUpdateUser, useVerifyEmail, useWriteDictionary } from "./intlayerAPIHooks.mjs";
6
2
  import { useAsync } from "./useAsync/useAsync.mjs";
7
3
  import { AsyncStateProvider, useAsyncState } from "./useAsync/useAsyncStateStore.mjs";
8
- import { useAddDictionary, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddProject, useAddTag, useAskDocQuestion, useAskResetPassword, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditTag, useAutocomplete, useCancelSubscription, useChangePassword, useCheckIfUserHasPassword, useCreateUser, useDefineNewPassword, useDeleteAccessKey, useDeleteDictionary, useDeleteOrganization, useDeleteProject, useDeleteTag, useDeleteUser, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetEditorDictionaries, useGetNewsletterStatus, useGetOrganizations, useGetPricing, useGetProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUsers, useLogin, useLogout, usePushDictionaries, useRefreshAccessKey, useRegister, useSearchDoc, useSelectOrganization, useSelectProject, useSubscribeToNewsletter, useTranslateJSONDeclaration, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateDictionary, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateProject, useUpdateProjectMembers, useUpdateTag, useUpdateUser, useVerifyEmail, useWriteDictionary } from "./intlayerAPIHooks.mjs";
9
- import { useItemSelector } from "./useItemSelector.mjs";
4
+ import { calculateIsMobile, checkIsIphoneOrSafariDevice, checkIsMobileScreen, checkIsMobileUserAgent, getBreakpointFromSize, useDevice } from "./useDevice.mjs";
10
5
  import { useGetAllDictionaries } from "./useGetAllDictionaries.mjs";
11
- import { usePersistedStore } from "./usePersistedStore.mjs";
6
+ import { useGetElementOrWindow } from "./useGetElementOrWindow.mjs";
12
7
  import { useIsDarkMode } from "./useIsDarkMode.mjs";
8
+ import { useIsMounted } from "./useIsMounted.mjs";
9
+ import { useItemSelector } from "./useItemSelector.mjs";
13
10
  import { useKeyboardDetector } from "./useKeyboardDetector.mjs";
11
+ import { usePersistedStore } from "./usePersistedStore.mjs";
12
+ import { useScreenWidth } from "./useScreenWidth.mjs";
13
+ import { u } from "../index-BCuMWKyy.js";
14
+ import { useScrollDetection } from "./useScrollDetection.mjs";
14
15
  export {
15
16
  AsyncStateProvider,
16
17
  calculateIsMobile,
@@ -69,6 +70,7 @@ export {
69
70
  usePushDictionaries,
70
71
  useRefreshAccessKey,
71
72
  useRegister,
73
+ useScreenWidth,
72
74
  u as useScrollBlockage,
73
75
  useScrollDetection,
74
76
  useSearchDoc,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
@@ -3,89 +3,89 @@ import { UseAsyncOptions } from './useAsync/useAsync';
3
3
  /**
4
4
  * Auth
5
5
  */
6
- export declare const useLogin: (args?: UseAsyncOptions<IntlayerAPI["auth"]["login"]>) => import('./useAsync').UseAsyncResult<"login", (user: LoginBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<LoginResult>>;
7
- export declare const useRegister: (args?: UseAsyncOptions<IntlayerAPI["auth"]["register"]>) => import('./useAsync').UseAsyncResult<"register", (user: RegisterBody, query?: RegisterQuery, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<RegisterResult>>;
6
+ export declare const useLogin: (args?: UseAsyncOptions<IntlayerAPI["auth"]["login"]>) => import('./useAsync').UseAsyncResult<"login", (user: import('@intlayer/backend').LoginBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').LoginResult>>;
7
+ export declare const useRegister: (args?: UseAsyncOptions<IntlayerAPI["auth"]["register"]>) => import('./useAsync').UseAsyncResult<"register", (user: import('@intlayer/backend').RegisterBody, query?: import('@intlayer/backend').RegisterQuery, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').RegisterResult>>;
8
8
  export declare const useLogout: (args?: UseAsyncOptions<IntlayerAPI["auth"]["logout"]>) => import('./useAsync').UseAsyncResult<"logout", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<void>>;
9
- export declare const useChangePassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["changePassword"]>) => import('./useAsync').UseAsyncResult<"changePassword", (data: UpdatePasswordBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdatePasswordResult>>;
10
- export declare const useAskResetPassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["askResetPassword"]>) => import('./useAsync').UseAsyncResult<"askResetPassword", (email: AskResetPasswordBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AskResetPasswordResult>>;
11
- export declare const useDefineNewPassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["defineNewPassword"]>) => import('./useAsync').UseAsyncResult<"defineNewPassword", (data: DefinePasswordBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<DefinePasswordResult>>;
12
- export declare const useCheckIfUserHasPassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["checkIfUserHasPassword"]>) => import('./useAsync').UseAsyncResult<"checkIfUserHasPassword", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<CheckIfUserHasPasswordResult>>;
13
- export declare const useVerifyEmail: (args?: UseAsyncOptions<IntlayerAPI["auth"]["verifyEmail"]>) => import('./useAsync').UseAsyncResult<"verifyEmail", ({ userId, secret }: ValidEmailParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<ValidEmailResult>>;
14
- export declare const useGetUserByAccount: (args?: UseAsyncOptions<IntlayerAPI["user"]["getUserByAccount"]>) => import('./useAsync').UseAsyncResult<"getUserByAccount", (providerAccountId: GetUserByAccountParams, provider: GetUserByAccountParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetUserByAccountResult>>;
9
+ export declare const useChangePassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["changePassword"]>) => import('./useAsync').UseAsyncResult<"changePassword", (data: import('@intlayer/backend').UpdatePasswordBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdatePasswordResult>>;
10
+ export declare const useAskResetPassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["askResetPassword"]>) => import('./useAsync').UseAsyncResult<"askResetPassword", (email: import('@intlayer/backend').AskResetPasswordBody["email"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AskResetPasswordResult>>;
11
+ export declare const useDefineNewPassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["defineNewPassword"]>) => import('./useAsync').UseAsyncResult<"defineNewPassword", (data: import('@intlayer/backend').DefinePasswordBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').DefinePasswordResult>>;
12
+ export declare const useCheckIfUserHasPassword: (args?: UseAsyncOptions<IntlayerAPI["auth"]["checkIfUserHasPassword"]>) => import('./useAsync').UseAsyncResult<"checkIfUserHasPassword", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').CheckIfUserHasPasswordResult>>;
13
+ export declare const useVerifyEmail: (args?: UseAsyncOptions<IntlayerAPI["auth"]["verifyEmail"]>) => import('./useAsync').UseAsyncResult<"verifyEmail", ({ userId, secret }: import('@intlayer/backend').ValidEmailParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').ValidEmailResult>>;
14
+ export declare const useGetUserByAccount: (args?: UseAsyncOptions<IntlayerAPI["user"]["getUserByAccount"]>) => import('./useAsync').UseAsyncResult<"getUserByAccount", (providerAccountId: import('@intlayer/backend').GetUserByAccountParams["providerAccountId"], provider: import('@intlayer/backend').GetUserByAccountParams["provider"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetUserByAccountResult>>;
15
15
  /**
16
16
  * User
17
17
  */
18
- export declare const useGetUsers: (args?: UseAsyncOptions<IntlayerAPI["user"]["getUsers"]>) => import('./useAsync').UseAsyncResult<"getUsers", (filters?: GetUsersParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetUsersResult>>;
19
- export declare const useCreateUser: (args?: UseAsyncOptions<IntlayerAPI["user"]["createUser"]>) => import('./useAsync').UseAsyncResult<"createUser", (user: CreateUserBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<CreateUserResult>>;
20
- export declare const useUpdateUser: (args?: UseAsyncOptions<IntlayerAPI["user"]["updateUser"]>) => import('./useAsync').UseAsyncResult<"updateUser", (user: UpdateUserBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateUserResult>>;
21
- export declare const useDeleteUser: (args?: UseAsyncOptions<IntlayerAPI["user"]["deleteUser"]>) => import('./useAsync').UseAsyncResult<"deleteUser", (userId: string, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateUserResult>>;
18
+ export declare const useGetUsers: (args?: UseAsyncOptions<IntlayerAPI["user"]["getUsers"]>) => import('./useAsync').UseAsyncResult<"getUsers", (filters?: import('@intlayer/backend').GetUsersParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetUsersResult>>;
19
+ export declare const useCreateUser: (args?: UseAsyncOptions<IntlayerAPI["user"]["createUser"]>) => import('./useAsync').UseAsyncResult<"createUser", (user: import('@intlayer/backend').CreateUserBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').CreateUserResult>>;
20
+ export declare const useUpdateUser: (args?: UseAsyncOptions<IntlayerAPI["user"]["updateUser"]>) => import('./useAsync').UseAsyncResult<"updateUser", (user: import('@intlayer/backend').UpdateUserBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateUserResult>>;
21
+ export declare const useDeleteUser: (args?: UseAsyncOptions<IntlayerAPI["user"]["deleteUser"]>) => import('./useAsync').UseAsyncResult<"deleteUser", (userId: string, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateUserResult>>;
22
22
  /**
23
23
  * Organization
24
24
  */
25
- export declare const useGetOrganizations: (args?: UseAsyncOptions<IntlayerAPI["organization"]["getOrganizations"]>) => import('./useAsync').UseAsyncResult<"getOrganizations", (filters?: GetOrganizationsParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetOrganizationsResult>>;
26
- export declare const useAddOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["addOrganization"]>) => import('./useAsync').UseAsyncResult<"addOrganization", (organization: AddOrganizationBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AddOrganizationResult>>;
27
- export declare const useUpdateOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["updateOrganization"]>) => import('./useAsync').UseAsyncResult<"updateOrganization", (organization: UpdateOrganizationBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateOrganizationResult>>;
28
- export declare const useUpdateOrganizationMembers: (args?: UseAsyncOptions<IntlayerAPI["organization"]["updateOrganizationMembers"]>) => import('./useAsync').UseAsyncResult<"updateOrganizationMembers", (body: UpdateOrganizationMembersBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateOrganizationMembersResult>>;
29
- export declare const useAddOrganizationMember: (args?: UseAsyncOptions<IntlayerAPI["organization"]["addOrganizationMember"]>) => import('./useAsync').UseAsyncResult<"addOrganizationMember", (body: AddOrganizationMemberBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AddOrganizationMemberResult>>;
30
- export declare const useDeleteOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["deleteOrganization"]>) => import('./useAsync').UseAsyncResult<"deleteOrganization", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<DeleteOrganizationResult>>;
31
- export declare const useSelectOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["selectOrganization"]>) => import('./useAsync').UseAsyncResult<"selectOrganization", (organizationId: SelectOrganizationParam, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<SelectOrganizationResult>>;
32
- export declare const useUnselectOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["unselectOrganization"]>) => import('./useAsync').UseAsyncResult<"unselectOrganization", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UnselectOrganizationResult>>;
25
+ export declare const useGetOrganizations: (args?: UseAsyncOptions<IntlayerAPI["organization"]["getOrganizations"]>) => import('./useAsync').UseAsyncResult<"getOrganizations", (filters?: import('@intlayer/backend').GetOrganizationsParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetOrganizationsResult>>;
26
+ export declare const useAddOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["addOrganization"]>) => import('./useAsync').UseAsyncResult<"addOrganization", (organization: import('@intlayer/backend').AddOrganizationBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AddOrganizationResult>>;
27
+ export declare const useUpdateOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["updateOrganization"]>) => import('./useAsync').UseAsyncResult<"updateOrganization", (organization: import('@intlayer/backend').UpdateOrganizationBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateOrganizationResult>>;
28
+ export declare const useUpdateOrganizationMembers: (args?: UseAsyncOptions<IntlayerAPI["organization"]["updateOrganizationMembers"]>) => import('./useAsync').UseAsyncResult<"updateOrganizationMembers", (body: import('@intlayer/backend').UpdateOrganizationMembersBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateOrganizationMembersResult>>;
29
+ export declare const useAddOrganizationMember: (args?: UseAsyncOptions<IntlayerAPI["organization"]["addOrganizationMember"]>) => import('./useAsync').UseAsyncResult<"addOrganizationMember", (body: import('@intlayer/backend').AddOrganizationMemberBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AddOrganizationMemberResult>>;
30
+ export declare const useDeleteOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["deleteOrganization"]>) => import('./useAsync').UseAsyncResult<"deleteOrganization", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').DeleteOrganizationResult>>;
31
+ export declare const useSelectOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["selectOrganization"]>) => import('./useAsync').UseAsyncResult<"selectOrganization", (organizationId: import('@intlayer/backend').SelectOrganizationParam["organizationId"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').SelectOrganizationResult>>;
32
+ export declare const useUnselectOrganization: (args?: UseAsyncOptions<IntlayerAPI["organization"]["unselectOrganization"]>) => import('./useAsync').UseAsyncResult<"unselectOrganization", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UnselectOrganizationResult>>;
33
33
  /**
34
34
  * Project
35
35
  */
36
- export declare const useGetProjects: (args?: UseAsyncOptions<IntlayerAPI["project"]["getProjects"]>) => import('./useAsync').UseAsyncResult<"getProjects", (filters?: GetProjectsParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetProjectsResult>>;
37
- export declare const useAddProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["addProject"]>) => import('./useAsync').UseAsyncResult<"addProject", (project: AddProjectBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AddProjectResult>>;
38
- export declare const useUpdateProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["updateProject"]>) => import('./useAsync').UseAsyncResult<"updateProject", (project: UpdateProjectBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateProjectResult>>;
39
- export declare const useUpdateProjectMembers: (args?: UseAsyncOptions<IntlayerAPI["project"]["updateProjectMembers"]>) => import('./useAsync').UseAsyncResult<"updateProjectMembers", (body: UpdateProjectMembersBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateProjectMembersResult>>;
40
- export declare const useDeleteProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["deleteProject"]>) => import('./useAsync').UseAsyncResult<"deleteProject", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<DeleteProjectResult>>;
41
- export declare const useSelectProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["selectProject"]>) => import('./useAsync').UseAsyncResult<"selectProject", (projectId: SelectProjectParam, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<SelectProjectResult>>;
42
- export declare const useUnselectProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["unselectProject"]>) => import('./useAsync').UseAsyncResult<"unselectProject", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UnselectProjectResult>>;
43
- export declare const useAddNewAccessKey: (args?: UseAsyncOptions<IntlayerAPI["project"]["addNewAccessKey"]>) => import('./useAsync').UseAsyncResult<"addNewAccessKey", (accessKey: AddNewAccessKeyBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AddNewAccessKeyResponse>>;
44
- export declare const useDeleteAccessKey: (args?: UseAsyncOptions<IntlayerAPI["project"]["deleteAccessKey"]>) => import('./useAsync').UseAsyncResult<"deleteAccessKey", (clientId: DeleteAccessKeyBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<DeleteAccessKeyResponse>>;
45
- export declare const useRefreshAccessKey: (args?: UseAsyncOptions<IntlayerAPI["project"]["refreshAccessKey"]>) => import('./useAsync').UseAsyncResult<"refreshAccessKey", (clientId: RefreshAccessKeyBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<RefreshAccessKeyResponse>>;
36
+ export declare const useGetProjects: (args?: UseAsyncOptions<IntlayerAPI["project"]["getProjects"]>) => import('./useAsync').UseAsyncResult<"getProjects", (filters?: import('@intlayer/backend').GetProjectsParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetProjectsResult>>;
37
+ export declare const useAddProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["addProject"]>) => import('./useAsync').UseAsyncResult<"addProject", (project: import('@intlayer/backend').AddProjectBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AddProjectResult>>;
38
+ export declare const useUpdateProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["updateProject"]>) => import('./useAsync').UseAsyncResult<"updateProject", (project: import('@intlayer/backend').UpdateProjectBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateProjectResult>>;
39
+ export declare const useUpdateProjectMembers: (args?: UseAsyncOptions<IntlayerAPI["project"]["updateProjectMembers"]>) => import('./useAsync').UseAsyncResult<"updateProjectMembers", (body: import('@intlayer/backend').UpdateProjectMembersBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateProjectMembersResult>>;
40
+ export declare const useDeleteProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["deleteProject"]>) => import('./useAsync').UseAsyncResult<"deleteProject", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').DeleteProjectResult>>;
41
+ export declare const useSelectProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["selectProject"]>) => import('./useAsync').UseAsyncResult<"selectProject", (projectId: import('@intlayer/backend').SelectProjectParam["projectId"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').SelectProjectResult>>;
42
+ export declare const useUnselectProject: (args?: UseAsyncOptions<IntlayerAPI["project"]["unselectProject"]>) => import('./useAsync').UseAsyncResult<"unselectProject", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UnselectProjectResult>>;
43
+ export declare const useAddNewAccessKey: (args?: UseAsyncOptions<IntlayerAPI["project"]["addNewAccessKey"]>) => import('./useAsync').UseAsyncResult<"addNewAccessKey", (accessKey: import('@intlayer/backend').AddNewAccessKeyBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AddNewAccessKeyResponse>>;
44
+ export declare const useDeleteAccessKey: (args?: UseAsyncOptions<IntlayerAPI["project"]["deleteAccessKey"]>) => import('./useAsync').UseAsyncResult<"deleteAccessKey", (clientId: import('@intlayer/backend').DeleteAccessKeyBody["clientId"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').DeleteAccessKeyResponse>>;
45
+ export declare const useRefreshAccessKey: (args?: UseAsyncOptions<IntlayerAPI["project"]["refreshAccessKey"]>) => import('./useAsync').UseAsyncResult<"refreshAccessKey", (clientId: import('@intlayer/backend').RefreshAccessKeyBody["clientId"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').RefreshAccessKeyResponse>>;
46
46
  /**
47
47
  * Dictionary
48
48
  */
49
- export declare const useGetDictionaries: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["getDictionaries"]>) => import('./useAsync').UseAsyncResult<"getDictionaries", (filters?: GetDictionariesParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetDictionariesResult>>;
50
- export declare const useGetDictionariesKeys: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["getDictionariesKeys"]>) => import('./useAsync').UseAsyncResult<"getDictionariesKeys", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetDictionariesKeysResult>>;
51
- export declare const useGetDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["getDictionary"]>) => import('./useAsync').UseAsyncResult<"getDictionary", (dictionaryKey: GetDictionaryParams, version?: GetDictionaryQuery, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetDictionaryResult>>;
52
- export declare const useAddDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["addDictionary"]>) => import('./useAsync').UseAsyncResult<"addDictionary", (body: AddDictionaryBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AddDictionaryResult>>;
53
- export declare const usePushDictionaries: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["pushDictionaries"]>) => import('./useAsync').UseAsyncResult<"pushDictionaries", (dictionaries: PushDictionariesBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<PushDictionariesResult>>;
54
- export declare const useUpdateDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["updateDictionary"]>) => import('./useAsync').UseAsyncResult<"updateDictionary", (dictionaryId: UpdateDictionaryParam, dictionary: UpdateDictionaryBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateDictionaryResult>>;
55
- export declare const useDeleteDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["deleteDictionary"]>) => import('./useAsync').UseAsyncResult<"deleteDictionary", (id: DeleteDictionaryParam, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<DeleteDictionaryResult>>;
49
+ export declare const useGetDictionaries: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["getDictionaries"]>) => import('./useAsync').UseAsyncResult<"getDictionaries", (filters?: import('@intlayer/backend').GetDictionariesParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetDictionariesResult>>;
50
+ export declare const useGetDictionariesKeys: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["getDictionariesKeys"]>) => import('./useAsync').UseAsyncResult<"getDictionariesKeys", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetDictionariesKeysResult>>;
51
+ export declare const useGetDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["getDictionary"]>) => import('./useAsync').UseAsyncResult<"getDictionary", (dictionaryKey: import('@intlayer/backend').GetDictionaryParams["dictionaryKey"], version?: import('@intlayer/backend').GetDictionaryQuery["version"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetDictionaryResult>>;
52
+ export declare const useAddDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["addDictionary"]>) => import('./useAsync').UseAsyncResult<"addDictionary", (body: import('@intlayer/backend').AddDictionaryBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AddDictionaryResult>>;
53
+ export declare const usePushDictionaries: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["pushDictionaries"]>) => import('./useAsync').UseAsyncResult<"pushDictionaries", (dictionaries: import('@intlayer/backend').PushDictionariesBody["dictionaries"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').PushDictionariesResult>>;
54
+ export declare const useUpdateDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["updateDictionary"]>) => import('./useAsync').UseAsyncResult<"updateDictionary", (dictionaryId: import('@intlayer/backend').UpdateDictionaryParam["dictionaryId"], dictionary: import('@intlayer/backend').UpdateDictionaryBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateDictionaryResult>>;
55
+ export declare const useDeleteDictionary: (args?: UseAsyncOptions<IntlayerAPI["dictionary"]["deleteDictionary"]>) => import('./useAsync').UseAsyncResult<"deleteDictionary", (id: import('@intlayer/backend').DeleteDictionaryParam["dictionaryId"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').DeleteDictionaryResult>>;
56
56
  /**
57
57
  * Tag
58
58
  */
59
- export declare const useGetTags: (args?: UseAsyncOptions<IntlayerAPI["tag"]["getTags"]>) => import('./useAsync').UseAsyncResult<"getTags", (filters?: GetTagsParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetTagsResult>>;
60
- export declare const useAddTag: (args?: UseAsyncOptions<IntlayerAPI["tag"]["addTag"]>) => import('./useAsync').UseAsyncResult<"addTag", (tag: AddTagBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AddTagResult>>;
61
- export declare const useUpdateTag: (args?: UseAsyncOptions<IntlayerAPI["tag"]["updateTag"]>) => import('./useAsync').UseAsyncResult<"updateTag", (tagId: UpdateTagParams, tag: UpdateTagBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<UpdateTagResult>>;
62
- export declare const useDeleteTag: (args?: UseAsyncOptions<IntlayerAPI["tag"]["deleteTag"]>) => import('./useAsync').UseAsyncResult<"deleteTag", (tagId: DeleteTagParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<DeleteTagResult>>;
59
+ export declare const useGetTags: (args?: UseAsyncOptions<IntlayerAPI["tag"]["getTags"]>) => import('./useAsync').UseAsyncResult<"getTags", (filters?: import('@intlayer/backend').GetTagsParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetTagsResult>>;
60
+ export declare const useAddTag: (args?: UseAsyncOptions<IntlayerAPI["tag"]["addTag"]>) => import('./useAsync').UseAsyncResult<"addTag", (tag: import('@intlayer/backend').AddTagBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AddTagResult>>;
61
+ export declare const useUpdateTag: (args?: UseAsyncOptions<IntlayerAPI["tag"]["updateTag"]>) => import('./useAsync').UseAsyncResult<"updateTag", (tagId: import('@intlayer/backend').UpdateTagParams["tagId"], tag: import('@intlayer/backend').UpdateTagBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').UpdateTagResult>>;
62
+ export declare const useDeleteTag: (args?: UseAsyncOptions<IntlayerAPI["tag"]["deleteTag"]>) => import('./useAsync').UseAsyncResult<"deleteTag", (tagId: import('@intlayer/backend').DeleteTagParams["tagId"], otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').DeleteTagResult>>;
63
63
  /**
64
64
  * Stripe
65
65
  */
66
- export declare const useGetPricing: (args?: UseAsyncOptions<IntlayerAPI["stripe"]["getPricing"]>) => import('./useAsync').UseAsyncResult<"getPricing", (body?: GetPricingBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetPricingResult>>;
67
- export declare const useGetSubscription: (args?: UseAsyncOptions<IntlayerAPI["stripe"]["getSubscription"]>) => import('./useAsync').UseAsyncResult<"getSubscription", (body?: GetCheckoutSessionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetCheckoutSessionResult>>;
68
- export declare const useCancelSubscription: (args?: UseAsyncOptions<IntlayerAPI["stripe"]["cancelSubscription"]>) => import('./useAsync').UseAsyncResult<"cancelSubscription", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<GetCheckoutSessionResult>>;
66
+ export declare const useGetPricing: (args?: UseAsyncOptions<IntlayerAPI["stripe"]["getPricing"]>) => import('./useAsync').UseAsyncResult<"getPricing", (body?: import('@intlayer/backend').GetPricingBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetPricingResult>>;
67
+ export declare const useGetSubscription: (args?: UseAsyncOptions<IntlayerAPI["stripe"]["getSubscription"]>) => import('./useAsync').UseAsyncResult<"getSubscription", (body?: import('@intlayer/backend').GetCheckoutSessionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetCheckoutSessionResult>>;
68
+ export declare const useCancelSubscription: (args?: UseAsyncOptions<IntlayerAPI["stripe"]["cancelSubscription"]>) => import('./useAsync').UseAsyncResult<"cancelSubscription", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').GetCheckoutSessionResult>>;
69
69
  /**
70
70
  * AI
71
71
  */
72
- export declare const useTranslateJSONDeclaration: (args?: UseAsyncOptions<IntlayerAPI["ai"]["translateJSON"]>) => import('./useAsync').UseAsyncResult<"translateJSON", (body?: TranslateJSONBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<TranslateJSONResult>>;
73
- export declare const useAuditContentDeclaration: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditContentDeclaration"]>) => import('./useAsync').UseAsyncResult<"auditContentDeclaration", (body?: AuditContentDeclarationBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AuditContentDeclarationResult>>;
74
- export declare const useAuditContentDeclarationMetadata: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditContentDeclarationMetadata"]>) => import('./useAsync').UseAsyncResult<"auditContentDeclaration", (body?: AuditContentDeclarationMetadataBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AuditContentDeclarationMetadataResult>>;
75
- export declare const useAuditContentDeclarationField: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditContentDeclarationField"]>) => import('./useAsync').UseAsyncResult<"auditContentDeclarationField", (body?: AuditContentDeclarationFieldBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AuditContentDeclarationFieldResult>>;
76
- export declare const useAuditTag: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditTag"]>) => import('./useAsync').UseAsyncResult<"auditTag", (body?: AuditTagBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AuditTagResult>>;
72
+ export declare const useTranslateJSONDeclaration: (args?: UseAsyncOptions<IntlayerAPI["ai"]["translateJSON"]>) => import('./useAsync').UseAsyncResult<"translateJSON", (body?: import('@intlayer/backend').TranslateJSONBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').TranslateJSONResult>>;
73
+ export declare const useAuditContentDeclaration: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditContentDeclaration"]>) => import('./useAsync').UseAsyncResult<"auditContentDeclaration", (body?: import('@intlayer/backend').AuditContentDeclarationBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AuditContentDeclarationResult>>;
74
+ export declare const useAuditContentDeclarationMetadata: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditContentDeclarationMetadata"]>) => import('./useAsync').UseAsyncResult<"auditContentDeclaration", (body?: import('@intlayer/backend').AuditContentDeclarationMetadataBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AuditContentDeclarationMetadataResult>>;
75
+ export declare const useAuditContentDeclarationField: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditContentDeclarationField"]>) => import('./useAsync').UseAsyncResult<"auditContentDeclarationField", (body?: import('@intlayer/backend').AuditContentDeclarationFieldBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AuditContentDeclarationFieldResult>>;
76
+ export declare const useAuditTag: (args?: UseAsyncOptions<IntlayerAPI["ai"]["auditTag"]>) => import('./useAsync').UseAsyncResult<"auditTag", (body?: import('@intlayer/backend').AuditTagBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AuditTagResult>>;
77
77
  export declare const useAskDocQuestion: (args?: UseAsyncOptions<IntlayerAPI["ai"]["askDocQuestion"]>) => import('./useAsync').UseAsyncResult<"askDocQuestion", (body?: import('@intlayer/api').AskDocQuestionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<void>>;
78
- export declare const useAutocomplete: (args?: UseAsyncOptions<IntlayerAPI["ai"]["autocomplete"]>) => import('./useAsync').UseAsyncResult<"autocomplete", (body?: AutocompleteBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<AutocompleteResponse>>;
78
+ export declare const useAutocomplete: (args?: UseAsyncOptions<IntlayerAPI["ai"]["autocomplete"]>) => import('./useAsync').UseAsyncResult<"autocomplete", (body?: import('@intlayer/backend').AutocompleteBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').AutocompleteResponse>>;
79
79
  /**
80
80
  * Search
81
81
  */
82
- export declare const useSearchDoc: (args?: UseAsyncOptions<IntlayerAPI["search"]["searchDoc"]>) => import('./useAsync').UseAsyncResult<"searchDoc", (params?: SearchDocUtilParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<SearchDocUtilResult>>;
82
+ export declare const useSearchDoc: (args?: UseAsyncOptions<IntlayerAPI["search"]["searchDoc"]>) => import('./useAsync').UseAsyncResult<"searchDoc", (params?: import('@intlayer/backend').SearchDocUtilParams, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').SearchDocUtilResult>>;
83
83
  /**
84
84
  * Newsletter
85
85
  */
86
- export declare const useSubscribeToNewsletter: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["subscribeToNewsletter"]>) => import('./useAsync').UseAsyncResult<"subscribeToNewsletter", (body: NewsletterSubscriptionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<NewsletterSubscriptionResult>>;
87
- export declare const useUnsubscribeFromNewsletter: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["unsubscribeFromNewsletter"]>) => import('./useAsync').UseAsyncResult<"unsubscribeFromNewsletter", (body: NewsletterUnsubscriptionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<NewsletterSubscriptionResult>>;
88
- export declare const useGetNewsletterStatus: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["getNewsletterStatus"]>) => import('./useAsync').UseAsyncResult<"getNewsletterStatus", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<NewsletterSubscriptionResult>>;
86
+ export declare const useSubscribeToNewsletter: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["subscribeToNewsletter"]>) => import('./useAsync').UseAsyncResult<"subscribeToNewsletter", (body: import('@intlayer/backend').NewsletterSubscriptionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').NewsletterSubscriptionResult>>;
87
+ export declare const useUnsubscribeFromNewsletter: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["unsubscribeFromNewsletter"]>) => import('./useAsync').UseAsyncResult<"unsubscribeFromNewsletter", (body: import('@intlayer/backend').NewsletterUnsubscriptionBody, otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').NewsletterSubscriptionResult>>;
88
+ export declare const useGetNewsletterStatus: (args?: UseAsyncOptions<IntlayerAPI["newsletter"]["getNewsletterStatus"]>) => import('./useAsync').UseAsyncResult<"getNewsletterStatus", (otherOptions?: import('@intlayer/api').FetcherOptions) => Promise<import('@intlayer/backend').NewsletterSubscriptionResult>>;
89
89
  /**
90
90
  * Editor
91
91
  */
@@ -1 +1 @@
1
- {"version":3,"file":"intlayerAPIHooks.d.ts","sourceRoot":"","sources":["../../src/hooks/intlayerAPIHooks.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAIjD,OAAO,EAAE,KAAK,eAAe,EAAY,MAAM,qBAAqB,CAAC;AA+IrE;;GAEG;AAEH,eAAO,MAAM,QAAQ,GACnB,OAAO,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,yDAtBhB,SAAS,oEAGxB,WACf,EAuBJ,CAAC;AAEL,eAAO,MAAM,WAAW,GACtB,OAAO,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,UAAU,CAAC,CAAC,4DAnBT,YAAa,UAG3D,aADa,oEACX,cAAc,EAqBd,CAAC;AAEL,eAAO,MAAM,SAAS,GACpB,OAAO,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,CAAC,4HAKnD,CAAC;AAEL,eAAO,MAAM,iBAAiB,GAC5B,OAAO,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAAC,CAAC,kEALjD,kBAAmB,oEAIf,oBACf,EAC4E,CAAC;AAEhF,eAAO,MAAM,mBAAmB,GAC9B,OAAO,eAAe,CAAC,WAA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CAAC,iBAAiB,CAAC,CAAC,oJAM9D,CAAC"}
@@ -56,7 +56,12 @@ const useAsync = (key, asyncFunction, options) => {
56
56
  const promise = (async () => {
57
57
  setQueryState(keyWithArgs2, { isLoading: true });
58
58
  let response = null;
59
- await asyncFunction(...args2).then((result) => {
59
+ try {
60
+ const asyncResult = asyncFunction(...args2);
61
+ if (!asyncResult || typeof asyncResult.then !== "function") {
62
+ throw new Error("asyncFunction must return a Promise");
63
+ }
64
+ const result = await asyncResult;
60
65
  response = result;
61
66
  setQueryState(keyWithArgs2, {
62
67
  data: result,
@@ -82,14 +87,14 @@ const useAsync = (key, asyncFunction, options) => {
82
87
  if (storeEnabled) {
83
88
  localStorage.setItem(keyWithArgs2, JSON.stringify(result));
84
89
  }
85
- }).catch((error2) => {
90
+ } catch (error2) {
86
91
  console.error({ error: error2 });
87
92
  const msg = error2 instanceof Error ? error2.message : String(error2);
88
93
  makeQueryInError(keyWithArgs2, msg);
89
- onError?.(error2.message);
90
- }).finally(() => {
94
+ onError?.(msg);
95
+ } finally {
91
96
  pendingPromises.delete(keyWithArgs2);
92
- });
97
+ }
93
98
  return response;
94
99
  })();
95
100
  pendingPromises.set(keyWithArgs2, promise);
@@ -161,7 +166,6 @@ const useAsync = (key, asyncFunction, options) => {
161
166
  if (!isEnabled || !enabled) return;
162
167
  if (!isRetryEnabled) return;
163
168
  if (isRetryLimitReached) return;
164
- if (!(cacheEnabled || storeEnabled)) return;
165
169
  if (isLoading) return;
166
170
  if (isSuccess) return;
167
171
  const timeout = setTimeout(() => {
@@ -174,8 +178,6 @@ const useAsync = (key, asyncFunction, options) => {
174
178
  retryLimit,
175
179
  enabled,
176
180
  retryTime,
177
- cacheEnabled,
178
- storeEnabled,
179
181
  isSuccess,
180
182
  isLoading,
181
183
  fetch
@@ -185,7 +187,6 @@ const useAsync = (key, asyncFunction, options) => {
185
187
  if (!isEnabled || !enabled) return;
186
188
  if (isLoading) return;
187
189
  if (!isSuccess || !fetchedDateTime) return;
188
- if (!(cacheEnabled || storeEnabled)) return;
189
190
  const timeout = setTimeout(() => {
190
191
  fetch(...storedArgsRef.current);
191
192
  }, revalidateTime);
@@ -193,8 +194,6 @@ const useAsync = (key, asyncFunction, options) => {
193
194
  }, [
194
195
  revalidationEnabled,
195
196
  revalidateTime,
196
- cacheEnabled,
197
- storeEnabled,
198
197
  isSuccess,
199
198
  fetchedDateTime,
200
199
  isLoading,
@@ -1 +1 @@
1
- {"version":3,"file":"useAsync.cjs","sources":["../../../src/hooks/useAsync/useAsync.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport { useAsyncState } from './useAsyncStateStore';\n\n// Pending promises cache to prevent parallel requests when multiple components use the hook\nconst pendingPromises = new Map();\n\n// Defines the base structure for the result of the custom hook.\ntype UseAsyncResultBase<T extends (...args: any[]) => Promise<any>> = {\n isFetched: boolean;\n isLoading: boolean;\n isInvalidated: boolean;\n isSuccess: boolean;\n isDisabled: boolean;\n isWaitingData: boolean;\n isRevalidating: boolean;\n error: string | null;\n data: Awaited<ReturnType<T>> | null;\n errorCount: number;\n revalidate: T;\n setData: (data: Awaited<ReturnType<T> | null>) => void;\n abort: () => void;\n};\n\n// Options type for the hook, allowing customization of behavior.\nexport type UseAsyncOptions<T extends (...args: any[]) => Promise<any>> = {\n retryLimit?: number; // The number of times the hook should retry the function on failure before giving up\n retryTime?: number; // Time in milliseconds for retrying the data\n cache?: boolean; // Cache the result of the function\n store?: boolean; // Store the result of the function in local storage\n enable?: boolean; // Enable the hook\n autoFetch?: boolean; // Automatically fetch the data when the hook is mounted\n revalidation?: boolean; // Enable revalidation\n revalidateTime?: number; // Time in milliseconds for revalidating the data\n invalidateQueries?: string[]; // Invalidate other queries when the data is updated\n updateQueries?: string[]; // Update other queries when the data is updated\n onSuccess?: (data: Awaited<ReturnType<T>>) => void; // Callback function that is called when the asynchronous function resolves successfully\n onError?: (error: string) => void; // Callback function that is called when the asynchronous function rejects or encounters an error\n abort?: () => void; // Abort the request\n args?: Parameters<T>; // Arguments to pass to the asynchronous function\n};\n\n// Default values for the hook's options\nconst DEFAULT_CACHE_ENABLED = false;\nconst DEFAULT_STORE_ENABLED = false;\nconst DEFAULT_ENABLED = true;\nconst DEFAULT_AUTO_FETCH = false;\nconst DEFAULT_RETRY_LIMIT = 1;\nconst DEFAULT_REVALIDATION_ENABLED = false;\nconst DEFAULT_REVALIDATE_TIME = 5 * 60 * 1000; // 5 minutes\nconst DEFAULT_RETRY_TIME = 5 * 60 * 1000; // 5 minutes\n\n// The main hook type that includes the async function along with its additional properties.\nexport type UseAsyncResult<\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n> = UseAsyncResultBase<T> & Record<U, T>;\n\nconst getArgs = (args?: any[]): any[] =>\n args ? (Array.isArray(args) ? args : [args]) : [];\n\nconst getKeyWithArgs = (key: string, args: any[]) =>\n getArgs(args).length > 0 ? `${key}/${JSON.stringify(args)}` : key;\n\n/**\n * A custom React hook that manages asynchronous operations, providing easy-to-use states and controls over fetching, caching, and retry mechanisms.\n * This hook abstracts away the complexity of handling loading, error, and success states for any asynchronous function.\n *\n *\n * ```tsx\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useAsync('userDetails', fetchUserData, {\n * cache: true,\n * revalidateTime: 60000, // 1 minute\n * autoFetch: true,\n * onSuccess: (data) => console.log('User data fetched successfully:', data),\n * onError: (error) => console.error('Error fetching user data:', error),\n * });\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n * ```\n */\nexport const useAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n): UseAsyncResult<U, T> => {\n // Resolving optional parameters with default values\n const retryLimit = options?.retryLimit ?? DEFAULT_RETRY_LIMIT;\n const autoFetch = options?.autoFetch ?? DEFAULT_AUTO_FETCH;\n const retryTime = options?.retryTime ?? DEFAULT_RETRY_TIME;\n const cacheEnabled = options?.cache ?? DEFAULT_CACHE_ENABLED;\n const storeEnabled = options?.store ?? DEFAULT_STORE_ENABLED;\n const enabled = options?.enable ?? DEFAULT_ENABLED;\n const revalidationEnabled =\n options?.revalidation ?? DEFAULT_REVALIDATION_ENABLED;\n const revalidateTime = options?.revalidateTime ?? DEFAULT_REVALIDATE_TIME;\n const updateQueries = options?.updateQueries ?? [];\n const invalidateQueries = options?.invalidateQueries ?? [];\n const onSuccess = options?.onSuccess;\n const onError = options?.onError;\n const args = getArgs(options?.args ?? []);\n\n // Using a custom hook to manage state specific to asynchronous operations\n const { getStates, setQueryState, setQueriesState, makeQueryInError } =\n useAsyncState();\n\n // Storing the last arguments used to call the async function\n const storedArgsRef = useRef<any[]>(args);\n\n const controllerRef = useRef<AbortController | null>(null);\n\n // Apply different key for different requests\n const keyWithArgs = getKeyWithArgs(key, storedArgsRef.current);\n\n // Retrieving the current state of async operations using the same custom hook\n const {\n isFetched,\n fetchedDateTime,\n isLoading,\n isEnabled,\n error,\n isSuccess,\n isInvalidated,\n data,\n errorCount,\n } = getStates(keyWithArgs);\n\n /**\n * FETCH FUNCTION\n *\n * Manage parallel fetching across multiple instances of the hook\n * Manage state updates on success and error\n * Manage eventual invalidation of other queries\n */\n const fetch: T = (async (...args) => {\n const keyWithArgs = getKeyWithArgs(key, args);\n\n /**\n * ABORT CONTROLLER\n *\n * cancel an unnecessary request.\n * For example, if a user navigates away from a page or triggers a new request that makes the previous one obsolete, you can abort the previous fetch\n */\n if (controllerRef.current) {\n // Abort the previous request\n controllerRef.current.abort();\n }\n\n // Create a new AbortController\n const controller = new AbortController();\n controllerRef.current = controller;\n\n /**\n * PENDING PROMISES\n *\n * This logic ensures that if two parts of your application trigger the same request simultaneously,\n * only one network call is made, and both receive the same result.\n */\n if (pendingPromises.has(keyWithArgs)) {\n // Return the existing pending promise\n return pendingPromises.get(keyWithArgs);\n }\n\n const promise = (async () => {\n setQueryState(keyWithArgs, { isLoading: true });\n let response = null;\n\n await asyncFunction(...args)\n .then((result) => {\n response = result;\n\n setQueryState(keyWithArgs, {\n data: result,\n errorCount: 0,\n isLoading: false,\n isFetched: true,\n fetchedDateTime: new Date(),\n isSuccess: true,\n isInvalidated: false,\n error: null,\n });\n\n onSuccess?.(result);\n\n // Invalidate other queries if necessary\n if (invalidateQueries.length > 0) {\n setQueriesState(invalidateQueries, {\n isInvalidated: true,\n });\n }\n\n // Update other queries if necessary\n if (updateQueries.length > 0) {\n setQueriesState(updateQueries, {\n data: result,\n });\n }\n\n // Store the result in local storage\n if (storeEnabled) {\n localStorage.setItem(keyWithArgs, JSON.stringify(result));\n }\n })\n .catch((error) => {\n console.error({ error });\n const msg = error instanceof Error ? error.message : String(error);\n\n makeQueryInError(keyWithArgs, msg);\n onError?.(error.message);\n })\n .finally(() => {\n // Remove the pending promise from the cache\n pendingPromises.delete(keyWithArgs);\n });\n\n return response;\n })();\n\n // Store the pending promise in the cache\n pendingPromises.set(keyWithArgs, promise);\n\n return await promise;\n }) as T;\n\n /**\n * REVALIDATE FUNCTION\n *\n * Wrap core function to handle revalidation\n * Handle arguments caching\n *\n */\n const revalidate: T = (async (...args) => {\n if (!isEnabled || !enabled) return; // Hook is disabled\n\n if (args) {\n // Revalidation arguments can be different from the initial fetch arguments\n // If arguments are provided, store/update them for future periodic revalidation\n\n storedArgsRef.current = getArgs(args);\n }\n\n return await fetch(...storedArgsRef.current);\n }) as T;\n\n /**\n * EXECUTION FUNCTION\n *\n * Wrap revalidation function\n * If data is valid return it directly to avoid fetching again\n */\n const execute: T = (async (...args) => {\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (isLoading) return; // Fetch is already in progress\n\n const shouldReturnData =\n !isInvalidated && // If data are invalidated, we should refetch to revalidate the data\n isSuccess &&\n cacheEnabled &&\n data;\n\n if (shouldReturnData) return data; // Data are already fetched and should be returned directly. Avoid fetching again.\n\n return await revalidate(...args);\n }) as T;\n\n /**\n * HANDLE SYNCHRONIZATION HOOKS DISACTIVATION\n *\n * If one instance of the hook is disabled, the other instances should be disabled too.\n * This is to prevent inconsistencies in the state of the hook.\n */\n useEffect(() => {\n if (enabled !== isEnabled) {\n setQueryState(keyWithArgs, {\n isEnabled,\n });\n }\n }, [enabled, isEnabled, keyWithArgs]);\n\n /**\n * HANDLE LOCAL STORAGE LOADING\n *\n * If store is enabled, load data from local storage\n */\n useEffect(() => {\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (!storeEnabled) return; // Hook should not use local storage\n if (isInvalidated || isFetched || data) return; // Hook have been already mounted and fetched or invalidated\n\n const storedData = localStorage.getItem(keyWithArgs);\n\n // Wrap parsing in a try-catch block to handle invalid JSON data\n try {\n if (storedData) {\n setQueryState(keyWithArgs, {\n data: JSON.parse(storedData),\n });\n }\n } catch (error) {\n console.error(error);\n }\n }, [\n storeEnabled,\n keyWithArgs,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n data,\n ]);\n\n /**\n * HANDLE AUTO-FETCH ON HOOK MOUNT\n *\n * If autoFetch is enabled, fetch the data when the hook is mounted\n */\n useEffect(() => {\n if (!autoFetch) return; // Auto-fetch is disabled\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (isFetched && !isInvalidated) return; // Hook have already fetched or invalidated\n if (isLoading) return; // Fetch is already in progress\n\n fetch(...storedArgsRef.current);\n }, [\n autoFetch,\n isEnabled,\n enabled,\n isFetched,\n isInvalidated,\n isLoading,\n fetch,\n ]);\n\n /**\n * HANDLE RETRY\n *\n * If fetching fails, retry the fetch after a certain time\n */\n useEffect(() => {\n const isRetryEnabled = errorCount > 0 && retryLimit > 0;\n const isRetryLimitReached = errorCount > retryLimit;\n\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (!isRetryEnabled) return; // Retry is disabled\n if (isRetryLimitReached) return; // Retry limit has been reached\n if (!(cacheEnabled || storeEnabled)) return; // Useless to retry if caching is disabled\n if (isLoading) return; // Fetch is already in progress\n if (isSuccess) return; // Hook has already fetched successfully\n\n const timeout = setTimeout(() => {\n fetch(...storedArgsRef.current);\n }, retryTime);\n\n return () => clearTimeout(timeout);\n }, [\n isEnabled,\n errorCount,\n retryLimit,\n enabled,\n retryTime,\n cacheEnabled,\n storeEnabled,\n isSuccess,\n isLoading,\n fetch,\n ]);\n\n /**\n * HANDLE PERIODIC REVALIDATION\n *\n * If revalidation is enabled, revalidate the data periodically\n */\n useEffect(() => {\n if (!revalidationEnabled || revalidateTime <= 0) return; // Revalidation is disabled\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (isLoading) return; // Fetch is already in progress\n if (!isSuccess || !fetchedDateTime) return; // Should retry either of revalidate\n if (!(cacheEnabled || storeEnabled)) return; // Useless to revalidate if caching is disabled\n\n const timeout = setTimeout(() => {\n fetch(...storedArgsRef.current);\n }, revalidateTime);\n\n return () => clearTimeout(timeout);\n }, [\n revalidationEnabled,\n revalidateTime,\n cacheEnabled,\n storeEnabled,\n isSuccess,\n fetchedDateTime,\n isLoading,\n isEnabled,\n enabled,\n fetch,\n ]);\n\n // Memoization of the setData function to prevent unnecessary re-renders\n const setDataMemo = (data: Awaited<ReturnType<T> | null>) => {\n setQueryState(keyWithArgs, {\n data,\n });\n };\n\n const abort = () => {\n if (controllerRef.current) {\n controllerRef.current.abort();\n }\n };\n\n // Memoization to prevent unnecessary re-renders\n const memoResult = {\n isFetched,\n isInvalidated,\n error,\n data,\n errorCount,\n isSuccess,\n isEnabled,\n isDisabled: !isEnabled,\n isLoading,\n isWaitingData: isLoading && !isFetched && !data, // Check if the data is still being fetched. Stay at true during revalidation or if data are stored in local storage\n isRevalidating: isLoading && isFetched, // Check if the data is valid and is being revalidated\n [key]: execute, // Name the execute function as the given key to avoid conflicts with other hooks (e.g. `const { fetchUser } = useAsync('fetchUser', () => fetchUserFunction());`)\n revalidate,\n setData: setDataMemo,\n abort,\n };\n\n useEffect(\n () => () => {\n // Clean up the controller on unmount\n if (controllerRef.current) {\n controllerRef.current.abort();\n }\n },\n []\n );\n\n // Return the hook's result, including all state and control functions\n return memoResult as UseAsyncResultBase<T> & Record<U, T>;\n};\n"],"names":["useAsyncState","useRef","args","keyWithArgs","error","useEffect","data"],"mappings":";;;;;AAMA,MAAM,sCAAsB,IAAI;AAsChC,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAC5B,MAAM,+BAA+B;AACrC,MAAM,0BAA0B,IAAI,KAAK;AACzC,MAAM,qBAAqB,IAAI,KAAK;AAQpC,MAAM,UAAU,CAAC,SACf,OAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,IAAK,CAAC;AAElD,MAAM,iBAAiB,CAAC,KAAa,SACnC,QAAQ,IAAI,EAAE,SAAS,IAAI,GAAG,GAAG,IAAI,KAAK,UAAU,IAAI,CAAC,KAAK;AAwCzD,MAAM,WAAW,CAItB,KACA,eACA,YACyB;AAEnB,QAAA,aAAa,SAAS,cAAc;AACpC,QAAA,YAAY,SAAS,aAAa;AAClC,QAAA,YAAY,SAAS,aAAa;AAClC,QAAA,eAAe,SAAS,SAAS;AACjC,QAAA,eAAe,SAAS,SAAS;AACjC,QAAA,UAAU,SAAS,UAAU;AAC7B,QAAA,sBACJ,SAAS,gBAAgB;AACrB,QAAA,iBAAiB,SAAS,kBAAkB;AAC5C,QAAA,gBAAgB,SAAS,iBAAiB,CAAC;AAC3C,QAAA,oBAAoB,SAAS,qBAAqB,CAAC;AACzD,QAAM,YAAY,SAAS;AAC3B,QAAM,UAAU,SAAS;AACzB,QAAM,OAAO,QAAQ,SAAS,QAAQ,CAAA,CAAE;AAGxC,QAAM,EAAE,WAAW,eA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AAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACD;AAGK,QAAA,cAAc,CAACC,UAAwC;AAC3D,kBAAc,aAAa;AAAA,MACzB,MAAAA;AAAAA,IAAA,CACD;AAAA,EACH;AAEA,QAAM,QAAQ,MAAM;AAClB,QAAI,cAAc,SAAS;AACzB,oBAAc,QAAQ,MAAM;AAAA,IAAA;AAAA,EAEhC;AAGA,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY,CAAC;AAAA,IACb;AAAA,IACA,eAAe,aAAa,CAAC,aAAa,CAAC;AAAA;AAAA,IAC3C,gBAAgB,aAAa;AAAA;AAAA,IAC7B,CAAC,GAAG,GAAG;AAAA;AAAA,IACP;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EACF;AAEAD,eAAA;AAAA,IACE,MAAM,MAAM;AAEV,UAAI,cAAc,SAAS;AACzB,sBAAc,QAAQ,MAAM;AAAA,MAAA;AAAA,IAEhC;AAAA,IACA,CAAA;AAAA,EACF;AAGO,SAAA;AACT;;"}
1
+ {"version":3,"file":"useAsync.cjs","sources":["../../../src/hooks/useAsync/useAsync.ts"],"sourcesContent":["'use client';\n\nimport { useEffect, useRef } from 'react';\nimport { useAsyncState } from './useAsyncStateStore';\n\n// Pending promises cache to prevent parallel requests when multiple components use the hook\nconst pendingPromises = new Map();\n\n// Defines the base structure for the result of the custom hook.\ntype UseAsyncResultBase<T extends (...args: any[]) => Promise<any>> = {\n isFetched: boolean;\n isLoading: boolean;\n isInvalidated: boolean;\n isSuccess: boolean;\n isDisabled: boolean;\n isWaitingData: boolean;\n isRevalidating: boolean;\n error: string | null;\n data: Awaited<ReturnType<T>> | null;\n errorCount: number;\n revalidate: T;\n setData: (data: Awaited<ReturnType<T> | null>) => void;\n abort: () => void;\n};\n\n// Options type for the hook, allowing customization of behavior.\nexport type UseAsyncOptions<T extends (...args: any[]) => Promise<any>> = {\n retryLimit?: number; // The number of times the hook should retry the function on failure before giving up\n retryTime?: number; // Time in milliseconds for retrying the data\n cache?: boolean; // Cache the result of the function\n store?: boolean; // Store the result of the function in local storage\n enable?: boolean; // Enable the hook\n autoFetch?: boolean; // Automatically fetch the data when the hook is mounted\n revalidation?: boolean; // Enable revalidation\n revalidateTime?: number; // Time in milliseconds for revalidating the data\n invalidateQueries?: string[]; // Invalidate other queries when the data is updated\n updateQueries?: string[]; // Update other queries when the data is updated\n onSuccess?: (data: Awaited<ReturnType<T>>) => void; // Callback function that is called when the asynchronous function resolves successfully\n onError?: (error: string) => void; // Callback function that is called when the asynchronous function rejects or encounters an error\n abort?: () => void; // Abort the request\n args?: Parameters<T>; // Arguments to pass to the asynchronous function\n};\n\n// Default values for the hook's options\nconst DEFAULT_CACHE_ENABLED = false;\nconst DEFAULT_STORE_ENABLED = false;\nconst DEFAULT_ENABLED = true;\nconst DEFAULT_AUTO_FETCH = false;\nconst DEFAULT_RETRY_LIMIT = 1;\nconst DEFAULT_REVALIDATION_ENABLED = false;\nconst DEFAULT_REVALIDATE_TIME = 5 * 60 * 1000; // 5 minutes\nconst DEFAULT_RETRY_TIME = 5 * 60 * 1000; // 5 minutes\n\n// The main hook type that includes the async function along with its additional properties.\nexport type UseAsyncResult<\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n> = UseAsyncResultBase<T> & Record<U, T>;\n\nconst getArgs = (args?: any[]): any[] =>\n args ? (Array.isArray(args) ? args : [args]) : [];\n\nconst getKeyWithArgs = (key: string, args: any[]) =>\n getArgs(args).length > 0 ? `${key}/${JSON.stringify(args)}` : key;\n\n/**\n * A custom React hook that manages asynchronous operations, providing easy-to-use states and controls over fetching, caching, and retry mechanisms.\n * This hook abstracts away the complexity of handling loading, error, and success states for any asynchronous function.\n *\n *\n * ```tsx\n * // Example of using useAsync to manage fetching user data from an API.\n * const fetchUserData = async (userId) => {\n * const response = await fetch(`/api/users/${userId}`);\n * if (!response.ok) throw new Error('Failed to fetch');\n * return await response.json();\n * };\n *\n * const UserDetails = ({ userId }) => {\n * const {\n * isLoading,\n * data,\n * error,\n * revalidate,\n * } = useAsync('userDetails', fetchUserData, {\n * cache: true,\n * revalidateTime: 60000, // 1 minute\n * autoFetch: true,\n * onSuccess: (data) => console.log('User data fetched successfully:', data),\n * onError: (error) => console.error('Error fetching user data:', error),\n * });\n *\n * if (isLoading) return <div>Loading...</div>;\n * if (error) return <div>Error: {error}</div>;\n * return (\n * <div>\n * <h1>{data.name}</h1>\n * <button onClick={() => revalidate()}>Refresh</button>\n * </div>\n * );\n * };\n * ```\n */\nexport const useAsync = <\n U extends string,\n T extends (...args: any[]) => Promise<any>,\n>(\n key: U,\n asyncFunction: T,\n options?: UseAsyncOptions<T>\n): UseAsyncResult<U, T> => {\n // Resolving optional parameters with default values\n const retryLimit = options?.retryLimit ?? DEFAULT_RETRY_LIMIT;\n const autoFetch = options?.autoFetch ?? DEFAULT_AUTO_FETCH;\n const retryTime = options?.retryTime ?? DEFAULT_RETRY_TIME;\n const cacheEnabled = options?.cache ?? DEFAULT_CACHE_ENABLED;\n const storeEnabled = options?.store ?? DEFAULT_STORE_ENABLED;\n const enabled = options?.enable ?? DEFAULT_ENABLED;\n const revalidationEnabled =\n options?.revalidation ?? DEFAULT_REVALIDATION_ENABLED;\n const revalidateTime = options?.revalidateTime ?? DEFAULT_REVALIDATE_TIME;\n const updateQueries = options?.updateQueries ?? [];\n const invalidateQueries = options?.invalidateQueries ?? [];\n const onSuccess = options?.onSuccess;\n const onError = options?.onError;\n const args = getArgs(options?.args ?? []);\n\n // Using a custom hook to manage state specific to asynchronous operations\n const { getStates, setQueryState, setQueriesState, makeQueryInError } =\n useAsyncState();\n\n // Storing the last arguments used to call the async function\n const storedArgsRef = useRef<any[]>(args);\n\n const controllerRef = useRef<AbortController | null>(null);\n\n // Apply different key for different requests\n const keyWithArgs = getKeyWithArgs(key, storedArgsRef.current);\n\n // Retrieving the current state of async operations using the same custom hook\n const {\n isFetched,\n fetchedDateTime,\n isLoading,\n isEnabled,\n error,\n isSuccess,\n isInvalidated,\n data,\n errorCount,\n } = getStates(keyWithArgs);\n\n /**\n * FETCH FUNCTION\n *\n * Manage parallel fetching across multiple instances of the hook\n * Manage state updates on success and error\n * Manage eventual invalidation of other queries\n */\n const fetch: T = (async (...args) => {\n const keyWithArgs = getKeyWithArgs(key, args);\n\n /**\n * ABORT CONTROLLER\n *\n * cancel an unnecessary request.\n * For example, if a user navigates away from a page or triggers a new request that makes the previous one obsolete, you can abort the previous fetch\n */\n if (controllerRef.current) {\n // Abort the previous request\n controllerRef.current.abort();\n }\n\n // Create a new AbortController\n const controller = new AbortController();\n controllerRef.current = controller;\n\n /**\n * PENDING PROMISES\n *\n * This logic ensures that if two parts of your application trigger the same request simultaneously,\n * only one network call is made, and both receive the same result.\n */\n if (pendingPromises.has(keyWithArgs)) {\n // Return the existing pending promise\n return pendingPromises.get(keyWithArgs);\n }\n\n const promise = (async () => {\n setQueryState(keyWithArgs, { isLoading: true });\n let response = null;\n\n try {\n // Ensure asyncFunction returns a Promise\n const asyncResult = asyncFunction(...args);\n\n // Check if the result is a Promise-like object\n if (!asyncResult || typeof asyncResult.then !== 'function') {\n throw new Error('asyncFunction must return a Promise');\n }\n\n const result = await asyncResult;\n response = result;\n\n setQueryState(keyWithArgs, {\n data: result,\n errorCount: 0,\n isLoading: false,\n isFetched: true,\n fetchedDateTime: new Date(),\n isSuccess: true,\n isInvalidated: false,\n error: null,\n });\n\n onSuccess?.(result);\n\n // Invalidate other queries if necessary\n if (invalidateQueries.length > 0) {\n setQueriesState(invalidateQueries, {\n isInvalidated: true,\n });\n }\n\n // Update other queries if necessary\n if (updateQueries.length > 0) {\n setQueriesState(updateQueries, {\n data: result,\n });\n }\n\n // Store the result in local storage\n if (storeEnabled) {\n localStorage.setItem(keyWithArgs, JSON.stringify(result));\n }\n } catch (error) {\n console.error({ error });\n const msg = error instanceof Error ? error.message : String(error);\n\n makeQueryInError(keyWithArgs, msg);\n onError?.(msg);\n } finally {\n // Remove the pending promise from the cache\n pendingPromises.delete(keyWithArgs);\n }\n\n return response;\n })();\n\n // Store the pending promise in the cache\n pendingPromises.set(keyWithArgs, promise);\n\n return await promise;\n }) as T;\n\n /**\n * REVALIDATE FUNCTION\n *\n * Wrap core function to handle revalidation\n * Handle arguments caching\n *\n */\n const revalidate: T = (async (...args) => {\n if (!isEnabled || !enabled) return; // Hook is disabled\n\n if (args) {\n // Revalidation arguments can be different from the initial fetch arguments\n // If arguments are provided, store/update them for future periodic revalidation\n\n storedArgsRef.current = getArgs(args);\n }\n\n return await fetch(...storedArgsRef.current);\n }) as T;\n\n /**\n * EXECUTION FUNCTION\n *\n * Wrap revalidation function\n * If data is valid return it directly to avoid fetching again\n */\n const execute: T = (async (...args) => {\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (isLoading) return; // Fetch is already in progress\n\n const shouldReturnData =\n !isInvalidated && // If data are invalidated, we should refetch to revalidate the data\n isSuccess &&\n cacheEnabled &&\n data;\n\n if (shouldReturnData) return data; // Data are already fetched and should be returned directly. Avoid fetching again.\n\n return await revalidate(...args);\n }) as T;\n\n /**\n * HANDLE SYNCHRONIZATION HOOKS DISACTIVATION\n *\n * If one instance of the hook is disabled, the other instances should be disabled too.\n * This is to prevent inconsistencies in the state of the hook.\n */\n useEffect(() => {\n if (enabled !== isEnabled) {\n setQueryState(keyWithArgs, {\n isEnabled,\n });\n }\n }, [enabled, isEnabled, keyWithArgs]);\n\n /**\n * HANDLE LOCAL STORAGE LOADING\n *\n * If store is enabled, load data from local storage\n */\n useEffect(() => {\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (!storeEnabled) return; // Hook should not use local storage\n if (isInvalidated || isFetched || data) return; // Hook have been already mounted and fetched or invalidated\n\n const storedData = localStorage.getItem(keyWithArgs);\n\n // Wrap parsing in a try-catch block to handle invalid JSON data\n try {\n if (storedData) {\n setQueryState(keyWithArgs, {\n data: JSON.parse(storedData),\n });\n }\n } catch (error) {\n console.error(error);\n }\n }, [\n storeEnabled,\n keyWithArgs,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n data,\n ]);\n\n /**\n * HANDLE AUTO-FETCH ON HOOK MOUNT\n *\n * If autoFetch is enabled, fetch the data when the hook is mounted\n */\n useEffect(() => {\n if (!autoFetch) return; // Auto-fetch is disabled\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (isFetched && !isInvalidated) return; // Hook have already fetched or invalidated\n if (isLoading) return; // Fetch is already in progress\n\n fetch(...storedArgsRef.current);\n }, [\n autoFetch,\n isEnabled,\n enabled,\n isFetched,\n isInvalidated,\n isLoading,\n fetch,\n ]);\n\n /**\n * HANDLE RETRY\n *\n * If fetching fails, retry the fetch after a certain time\n */\n useEffect(() => {\n const isRetryEnabled = errorCount > 0 && retryLimit > 0;\n const isRetryLimitReached = errorCount > retryLimit;\n\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (!isRetryEnabled) return; // Retry is disabled\n if (isRetryLimitReached) return; // Retry limit has been reached\n if (isLoading) return; // Fetch is already in progress\n if (isSuccess) return; // Hook has already fetched successfully\n\n const timeout = setTimeout(() => {\n fetch(...storedArgsRef.current);\n }, retryTime);\n\n return () => clearTimeout(timeout);\n }, [\n isEnabled,\n errorCount,\n retryLimit,\n enabled,\n retryTime,\n isSuccess,\n isLoading,\n fetch,\n ]);\n\n /**\n * HANDLE PERIODIC REVALIDATION\n *\n * If revalidation is enabled, revalidate the data periodically\n */\n useEffect(() => {\n if (!revalidationEnabled || revalidateTime <= 0) return; // Revalidation is disabled\n if (!isEnabled || !enabled) return; // Hook is disabled\n if (isLoading) return; // Fetch is already in progress\n if (!isSuccess || !fetchedDateTime) return; // Should retry either of revalidate\n\n const timeout = setTimeout(() => {\n fetch(...storedArgsRef.current);\n }, revalidateTime);\n\n return () => clearTimeout(timeout);\n }, [\n revalidationEnabled,\n revalidateTime,\n isSuccess,\n fetchedDateTime,\n isLoading,\n isEnabled,\n enabled,\n fetch,\n ]);\n\n // Memoization of the setData function to prevent unnecessary re-renders\n const setDataMemo = (data: Awaited<ReturnType<T> | null>) => {\n setQueryState(keyWithArgs, {\n data,\n });\n };\n\n const abort = () => {\n if (controllerRef.current) {\n controllerRef.current.abort();\n }\n };\n\n // Memoization to prevent unnecessary re-renders\n const memoResult = {\n isFetched,\n isInvalidated,\n error,\n data,\n errorCount,\n isSuccess,\n isEnabled,\n isDisabled: !isEnabled,\n isLoading,\n isWaitingData: isLoading && !isFetched && !data, // Check if the data is still being fetched. Stay at true during revalidation or if data are stored in local storage\n isRevalidating: isLoading && isFetched, // Check if the data is valid and is being revalidated\n [key]: execute, // Name the execute function as the given key to avoid conflicts with other hooks (e.g. `const { fetchUser } = useAsync('fetchUser', () => fetchUserFunction());`)\n revalidate,\n setData: setDataMemo,\n abort,\n };\n\n useEffect(\n () => () => {\n // Clean up the controller on unmount\n if (controllerRef.current) {\n controllerRef.current.abort();\n }\n },\n []\n );\n\n // Return the hook's result, including all state and control functions\n return memoResult as UseAsyncResultBase<T> & Record<U, T>;\n};\n"],"names":["useAsyncState","useRef","args","keyWithArgs","error","useEffect","data"],"mappings":";;;;;AAMA,MAAM,sCAAsB,IAAI;AAsChC,MAAM,wBAAwB;AAC9B,MAAM,wBAAwB;AAC9B,MAAM,kBAAkB;AACxB,MAAM,qBAAqB;AAC3B,MAAM,sBAAsB;AAC5B,MAAM,+BAA+B;AACrC,MAAM,0BAA0B,IAAI,KAAK;AACzC,MAAM,qBAAqB,IAAI,KAAK;AAQpC,MAAM,UAAU,CAAC,SACf,OAAQ,MAAM,QAAQ,IAAI,IAAI,OAAO,CAAC,IAAI,IAAK,CAAC;AAElD,MAAM,iBAAiB,CAAC,KAAa,SACnC,QAAQ,IAAI,EAAE,SAAS,IAAI,GAAG,GAAG,IAAI,KAAK,UAAU,IAAI,CAAC,KAAK;AAwCzD,MAAM,WAAW,CAItB,KACA,eACA,YACyB;AA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