@intlayer/design-system 3.0.3 → 3.2.0

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 (648) hide show
  1. package/dist/.vite/manifest.json +269 -117
  2. package/dist/Form-2XHQV7F_.cjs +295 -0
  3. package/dist/Form-2XHQV7F_.cjs.map +1 -0
  4. package/dist/Form-BO0i3nT9.js +300 -0
  5. package/dist/Form-BO0i3nT9.js.map +1 -0
  6. package/dist/Form-BaHDK0RZ.cjs +298 -0
  7. package/dist/Form-BaHDK0RZ.cjs.map +1 -0
  8. package/dist/Form-BfZMqK2D.js +300 -0
  9. package/dist/Form-BfZMqK2D.js.map +1 -0
  10. package/dist/Form-C13KWSZs.cjs +299 -0
  11. package/dist/Form-C13KWSZs.cjs.map +1 -0
  12. package/dist/Form-C8K2f8ph.js +300 -0
  13. package/dist/Form-C8K2f8ph.js.map +1 -0
  14. package/dist/Form-CKvCgz8c.cjs +299 -0
  15. package/dist/Form-CKvCgz8c.cjs.map +1 -0
  16. package/dist/Form-Cbk5Lhpd.js +299 -0
  17. package/dist/Form-Cbk5Lhpd.js.map +1 -0
  18. package/dist/Form-CiAgFAPb.cjs +300 -0
  19. package/dist/Form-CiAgFAPb.cjs.map +1 -0
  20. package/dist/Form-CnBKDneQ.js +296 -0
  21. package/dist/Form-CnBKDneQ.js.map +1 -0
  22. package/dist/Form-DERuauvB.cjs +300 -0
  23. package/dist/Form-DERuauvB.cjs.map +1 -0
  24. package/dist/Form-DhlDf3ML.cjs +299 -0
  25. package/dist/Form-DhlDf3ML.cjs.map +1 -0
  26. package/dist/Form-DkAZ0Jdf.cjs +299 -0
  27. package/dist/Form-DkAZ0Jdf.cjs.map +1 -0
  28. package/dist/Form-DqnNP4DA.js +300 -0
  29. package/dist/Form-DqnNP4DA.js.map +1 -0
  30. package/dist/Form-DyFBmVya.js +301 -0
  31. package/dist/Form-DyFBmVya.js.map +1 -0
  32. package/dist/Form-FW4Odjfm.js +301 -0
  33. package/dist/Form-FW4Odjfm.js.map +1 -0
  34. package/dist/TabSelector-BmkzVPXl.js +660 -0
  35. package/dist/TabSelector-BmkzVPXl.js.map +1 -0
  36. package/dist/TabSelector-o_NRBvPQ.cjs +659 -0
  37. package/dist/TabSelector-o_NRBvPQ.cjs.map +1 -0
  38. package/dist/components/Accordion/Accordion.d.ts +0 -1
  39. package/dist/components/Auth/AuthModal/index.cjs +17 -62
  40. package/dist/components/Auth/AuthModal/index.cjs.map +1 -1
  41. package/dist/components/Auth/AuthModal/index.d.ts +0 -1
  42. package/dist/components/Auth/AuthModal/index.d.ts.map +1 -1
  43. package/dist/components/Auth/AuthModal/index.mjs +17 -62
  44. package/dist/components/Auth/AuthModal/index.mjs.map +1 -1
  45. package/dist/components/Auth/AuthProvider/index.cjs +5 -21
  46. package/dist/components/Auth/AuthProvider/index.cjs.map +1 -1
  47. package/dist/components/Auth/AuthProvider/index.d.ts +7 -6
  48. package/dist/components/Auth/AuthProvider/index.d.ts.map +1 -1
  49. package/dist/components/Auth/AuthProvider/index.mjs +6 -22
  50. package/dist/components/Auth/AuthProvider/index.mjs.map +1 -1
  51. package/dist/components/Auth/AuthProvider/useSession.cjs +14 -11
  52. package/dist/components/Auth/AuthProvider/useSession.cjs.map +1 -1
  53. package/dist/components/Auth/AuthProvider/useSession.d.ts +0 -1
  54. package/dist/components/Auth/AuthProvider/useSession.d.ts.map +1 -1
  55. package/dist/components/Auth/AuthProvider/useSession.mjs +14 -11
  56. package/dist/components/Auth/AuthProvider/useSession.mjs.map +1 -1
  57. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.cjs +2 -2
  58. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.cjs.map +1 -1
  59. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.d.ts +0 -1
  60. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.mjs +1 -1
  61. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.mjs.map +1 -1
  62. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.cjs.map +1 -1
  63. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.d.ts +2 -3
  64. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.d.ts.map +1 -1
  65. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.mjs.map +1 -1
  66. package/dist/components/Auth/AuthenticationBarrier/accessValidation.cjs.map +1 -1
  67. package/dist/components/Auth/AuthenticationBarrier/accessValidation.d.ts +1 -2
  68. package/dist/components/Auth/AuthenticationBarrier/accessValidation.d.ts.map +1 -1
  69. package/dist/components/Auth/AuthenticationBarrier/accessValidation.mjs.map +1 -1
  70. package/dist/components/Auth/AuthenticationBarrier/index.d.ts +3 -4
  71. package/dist/components/Auth/AuthenticationBarrier/index.d.ts.map +1 -1
  72. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs +2 -1
  73. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs.map +1 -1
  74. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts +1 -2
  75. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts.map +1 -1
  76. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs +2 -1
  77. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs.map +1 -1
  78. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.cjs.map +1 -1
  79. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.d.ts +0 -1
  80. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.mjs.map +1 -1
  81. package/dist/components/Auth/ChangePasswordForm/index.content.cjs.map +1 -1
  82. package/dist/components/Auth/ChangePasswordForm/index.content.mjs.map +1 -1
  83. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +3 -2
  84. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +1 -1
  85. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.d.ts +0 -1
  86. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.d.ts.map +1 -1
  87. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +3 -2
  88. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +1 -1
  89. package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.d.ts +0 -1
  90. package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.d.ts +0 -1
  91. package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs.map +1 -1
  92. package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs.map +1 -1
  93. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs +2 -1
  94. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs.map +1 -1
  95. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts +1 -2
  96. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts.map +1 -1
  97. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs +2 -1
  98. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs.map +1 -1
  99. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.cjs.map +1 -1
  100. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.d.ts +0 -1
  101. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.mjs.map +1 -1
  102. package/dist/components/Auth/ResetPasswordForm/index.content.cjs.map +1 -1
  103. package/dist/components/Auth/ResetPasswordForm/index.content.mjs.map +1 -1
  104. package/dist/components/Auth/SignInForm/SignInForm.cjs +5 -4
  105. package/dist/components/Auth/SignInForm/SignInForm.cjs.map +1 -1
  106. package/dist/components/Auth/SignInForm/SignInForm.d.ts +1 -2
  107. package/dist/components/Auth/SignInForm/SignInForm.d.ts.map +1 -1
  108. package/dist/components/Auth/SignInForm/SignInForm.mjs +5 -4
  109. package/dist/components/Auth/SignInForm/SignInForm.mjs.map +1 -1
  110. package/dist/components/Auth/SignInForm/SignInSchema.cjs.map +1 -1
  111. package/dist/components/Auth/SignInForm/SignInSchema.d.ts +0 -1
  112. package/dist/components/Auth/SignInForm/SignInSchema.mjs.map +1 -1
  113. package/dist/components/Auth/SignInForm/index.content.cjs.map +1 -1
  114. package/dist/components/Auth/SignInForm/index.content.mjs.map +1 -1
  115. package/dist/components/Auth/SignUpForm/SignUpForm.cjs +4 -4
  116. package/dist/components/Auth/SignUpForm/SignUpForm.cjs.map +1 -1
  117. package/dist/components/Auth/SignUpForm/SignUpForm.d.ts +1 -2
  118. package/dist/components/Auth/SignUpForm/SignUpForm.d.ts.map +1 -1
  119. package/dist/components/Auth/SignUpForm/SignUpForm.mjs +4 -4
  120. package/dist/components/Auth/SignUpForm/SignUpForm.mjs.map +1 -1
  121. package/dist/components/Auth/SignUpForm/SignUpSchema.cjs.map +1 -1
  122. package/dist/components/Auth/SignUpForm/SignUpSchema.d.ts +0 -1
  123. package/dist/components/Auth/SignUpForm/SignUpSchema.mjs.map +1 -1
  124. package/dist/components/Auth/SignUpForm/index.content.cjs.map +1 -1
  125. package/dist/components/Auth/SignUpForm/index.content.mjs.map +1 -1
  126. package/dist/components/Auth/index.cjs +2 -4
  127. package/dist/components/Auth/index.cjs.map +1 -1
  128. package/dist/components/Auth/index.d.ts +1 -1
  129. package/dist/components/Auth/index.d.ts.map +1 -1
  130. package/dist/components/Auth/index.mjs +1 -3
  131. package/dist/components/Auth/useAuth/index.cjs +39 -0
  132. package/dist/components/Auth/useAuth/index.cjs.map +1 -0
  133. package/dist/components/Auth/useAuth/index.d.ts +24 -0
  134. package/dist/components/Auth/useAuth/index.d.ts.map +1 -0
  135. package/dist/components/Auth/useAuth/index.mjs +39 -0
  136. package/dist/components/Auth/useAuth/index.mjs.map +1 -0
  137. package/dist/components/Auth/useAuth/useCSRF.cjs +22 -0
  138. package/dist/components/Auth/useAuth/useCSRF.cjs.map +1 -0
  139. package/dist/components/Auth/useAuth/useCSRF.d.ts +5 -0
  140. package/dist/components/Auth/useAuth/useCSRF.d.ts.map +1 -0
  141. package/dist/components/Auth/useAuth/useCSRF.mjs +22 -0
  142. package/dist/components/Auth/useAuth/useCSRF.mjs.map +1 -0
  143. package/dist/components/Auth/useAuth/useOAuth2.cjs +26 -0
  144. package/dist/components/Auth/useAuth/useOAuth2.cjs.map +1 -0
  145. package/dist/components/Auth/useAuth/useOAuth2.d.ts +4 -0
  146. package/dist/components/Auth/useAuth/useOAuth2.d.ts.map +1 -0
  147. package/dist/components/Auth/useAuth/useOAuth2.mjs +26 -0
  148. package/dist/components/Auth/useAuth/useOAuth2.mjs.map +1 -0
  149. package/dist/components/Auth/useAuth/useSession.cjs +60 -0
  150. package/dist/components/Auth/useAuth/useSession.cjs.map +1 -0
  151. package/dist/components/Auth/useAuth/useSession.d.ts +8 -0
  152. package/dist/components/Auth/useAuth/useSession.d.ts.map +1 -0
  153. package/dist/components/Auth/useAuth/useSession.mjs +60 -0
  154. package/dist/components/Auth/useAuth/useSession.mjs.map +1 -0
  155. package/dist/components/Auth/useUser/index.cjs +3 -3
  156. package/dist/components/Auth/useUser/index.cjs.map +1 -1
  157. package/dist/components/Auth/useUser/index.d.ts.map +1 -1
  158. package/dist/components/Auth/useUser/index.mjs +3 -3
  159. package/dist/components/Auth/useUser/index.mjs.map +1 -1
  160. package/dist/components/Avatar/index.d.ts +0 -1
  161. package/dist/components/Badge/index.d.ts +0 -1
  162. package/dist/components/Breadcrumb/index.d.ts +0 -1
  163. package/dist/components/Button/Button.cjs +1 -0
  164. package/dist/components/Button/Button.cjs.map +1 -1
  165. package/dist/components/Button/Button.d.ts +1 -3
  166. package/dist/components/Button/Button.d.ts.map +1 -1
  167. package/dist/components/Button/Button.mjs +1 -0
  168. package/dist/components/Button/Button.mjs.map +1 -1
  169. package/dist/components/Command/index.d.ts +9 -10
  170. package/dist/components/Command/index.d.ts.map +1 -1
  171. package/dist/components/Container/index.cjs +1 -0
  172. package/dist/components/Container/index.cjs.map +1 -1
  173. package/dist/components/Container/index.d.ts +20 -7
  174. package/dist/components/Container/index.d.ts.map +1 -1
  175. package/dist/components/Container/index.mjs +1 -0
  176. package/dist/components/Container/index.mjs.map +1 -1
  177. package/dist/components/ContentEditor/ContentEditor.d.ts +0 -1
  178. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +0 -1
  179. package/dist/components/ContentSelector/ContentSelector.d.ts +0 -1
  180. package/dist/components/CopyToClipboard/index.d.ts +0 -1
  181. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +30 -24
  182. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  183. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +0 -7
  184. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  185. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +30 -24
  186. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  187. package/dist/components/DictionaryEditor/ItemLayout.cjs +1 -0
  188. package/dist/components/DictionaryEditor/ItemLayout.cjs.map +1 -1
  189. package/dist/components/DictionaryEditor/ItemLayout.d.ts +0 -1
  190. package/dist/components/DictionaryEditor/ItemLayout.d.ts.map +1 -1
  191. package/dist/components/DictionaryEditor/ItemLayout.mjs +1 -0
  192. package/dist/components/DictionaryEditor/ItemLayout.mjs.map +1 -1
  193. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.d.ts +0 -1
  194. package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.d.ts +0 -1
  195. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.d.ts +0 -1
  196. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs +7 -5
  197. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
  198. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.d.ts +0 -1
  199. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +7 -5
  200. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
  201. package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.d.ts +0 -1
  202. package/dist/components/DictionaryEditor/NodeWrapper/index.d.ts +0 -1
  203. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +98 -19
  204. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  205. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts +1 -5
  206. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
  207. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +99 -20
  208. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  209. package/dist/components/DictionaryEditor/useEditedContentStore.cjs +18 -20
  210. package/dist/components/DictionaryEditor/useEditedContentStore.cjs.map +1 -1
  211. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts +0 -1
  212. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts.map +1 -1
  213. package/dist/components/DictionaryEditor/useEditedContentStore.mjs +19 -21
  214. package/dist/components/DictionaryEditor/useEditedContentStore.mjs.map +1 -1
  215. package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts +0 -1
  216. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs +46 -0
  217. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs.map +1 -0
  218. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts +18 -0
  219. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts.map +1 -0
  220. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs +46 -0
  221. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs.map +1 -0
  222. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.cjs +8 -0
  223. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.cjs.map +1 -0
  224. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.d.ts +4 -0
  225. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.d.ts.map +1 -0
  226. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.mjs +8 -0
  227. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.mjs.map +1 -0
  228. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +10 -3
  229. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  230. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +0 -1
  231. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  232. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +10 -3
  233. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  234. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +8 -25
  235. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
  236. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts +0 -1
  237. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
  238. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +7 -24
  239. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  240. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs +0 -42
  241. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs.map +1 -1
  242. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +0 -18
  243. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
  244. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +0 -42
  245. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
  246. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.cjs.map +1 -1
  247. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.d.ts +0 -1
  248. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.d.ts.map +1 -1
  249. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.mjs.map +1 -1
  250. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +5 -37
  251. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  252. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +0 -1
  253. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  254. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +4 -36
  255. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  256. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.cjs.map +1 -1
  257. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.d.ts +2 -3
  258. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.d.ts.map +1 -1
  259. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.mjs.map +1 -1
  260. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +2 -49
  261. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
  262. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +0 -19
  263. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
  264. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +2 -49
  265. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  266. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +38 -13
  267. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  268. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +0 -1
  269. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  270. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +38 -13
  271. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  272. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +22 -6
  273. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  274. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts +0 -1
  275. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
  276. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +22 -6
  277. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  278. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +29 -14
  279. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
  280. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts +0 -1
  281. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
  282. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +29 -14
  283. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
  284. package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs +1 -0
  285. package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
  286. package/dist/components/DictionaryFieldEditor/EnumKeyInput.d.ts +0 -1
  287. package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs +1 -0
  288. package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
  289. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts +0 -1
  290. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +18 -2
  291. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  292. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts +0 -1
  293. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
  294. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +18 -2
  295. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  296. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +18 -2
  297. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  298. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts +0 -1
  299. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
  300. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +18 -2
  301. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  302. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +14 -28
  303. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  304. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +0 -1
  305. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  306. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +14 -28
  307. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  308. package/dist/components/DictionaryFieldEditor/SaveForm/SaveFormSchema.d.ts +0 -1
  309. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +2 -23
  310. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  311. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +0 -9
  312. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  313. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +2 -23
  314. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  315. package/dist/components/DictionaryFieldEditor/getIsEditableSection.d.ts +0 -1
  316. package/dist/components/DropDown/index.d.ts +0 -1
  317. package/dist/components/DropDown/types.d.ts +0 -1
  318. package/dist/components/EditableField/EditableFieldInput.cjs +12 -5
  319. package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
  320. package/dist/components/EditableField/EditableFieldInput.d.ts +2 -4
  321. package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
  322. package/dist/components/EditableField/EditableFieldInput.mjs +13 -6
  323. package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
  324. package/dist/components/EditableField/EditableFieldLayout.d.ts +0 -1
  325. package/dist/components/EditableField/EditableFieldTextArea.cjs +17 -4
  326. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  327. package/dist/components/EditableField/EditableFieldTextArea.d.ts +6 -3
  328. package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
  329. package/dist/components/EditableField/EditableFieldTextArea.mjs +18 -5
  330. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  331. package/dist/components/Flags/Flag.d.ts +0 -1
  332. package/dist/components/Footer/index.d.ts +0 -1
  333. package/dist/components/Form/Form.cjs +1 -1
  334. package/dist/components/Form/Form.d.ts +2 -1
  335. package/dist/components/Form/Form.d.ts.map +1 -1
  336. package/dist/components/Form/Form.mjs +1 -1
  337. package/dist/components/Form/FormBase.cjs +4 -1
  338. package/dist/components/Form/FormBase.cjs.map +1 -1
  339. package/dist/components/Form/FormBase.d.ts +1 -2
  340. package/dist/components/Form/FormBase.d.ts.map +1 -1
  341. package/dist/components/Form/FormBase.mjs +4 -1
  342. package/dist/components/Form/FormBase.mjs.map +1 -1
  343. package/dist/components/Form/FormDescription.d.ts +0 -1
  344. package/dist/components/Form/FormField.d.ts +0 -1
  345. package/dist/components/Form/FormItem.d.ts +0 -1
  346. package/dist/components/Form/FormMessage.d.ts +0 -1
  347. package/dist/components/Form/elements/CheckboxElement.cjs +10 -0
  348. package/dist/components/Form/elements/CheckboxElement.cjs.map +1 -0
  349. package/dist/components/Form/elements/CheckboxElement.d.ts +10 -0
  350. package/dist/components/Form/elements/CheckboxElement.d.ts.map +1 -0
  351. package/dist/components/Form/elements/CheckboxElement.mjs +10 -0
  352. package/dist/components/Form/elements/CheckboxElement.mjs.map +1 -0
  353. package/dist/components/Form/elements/EditableFieldInputElement.cjs +1 -1
  354. package/dist/components/Form/elements/EditableFieldInputElement.d.ts +0 -1
  355. package/dist/components/Form/elements/EditableFieldInputElement.mjs +1 -1
  356. package/dist/components/Form/elements/EditableFieldTextAreaElement.cjs +1 -1
  357. package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +0 -1
  358. package/dist/components/Form/elements/EditableFieldTextAreaElement.mjs +1 -1
  359. package/dist/components/Form/elements/FormElement.cjs +1 -1
  360. package/dist/components/Form/elements/FormElement.d.ts +0 -1
  361. package/dist/components/Form/elements/FormElement.mjs +1 -1
  362. package/dist/components/Form/elements/FormElementWrapper.d.ts +0 -1
  363. package/dist/components/Form/elements/InputElement.cjs +2 -1
  364. package/dist/components/Form/elements/InputElement.cjs.map +1 -1
  365. package/dist/components/Form/elements/InputElement.d.ts +2 -3
  366. package/dist/components/Form/elements/InputElement.d.ts.map +1 -1
  367. package/dist/components/Form/elements/InputElement.mjs +2 -1
  368. package/dist/components/Form/elements/InputElement.mjs.map +1 -1
  369. package/dist/components/Form/elements/InputPasswordElement.cjs +2 -1
  370. package/dist/components/Form/elements/InputPasswordElement.cjs.map +1 -1
  371. package/dist/components/Form/elements/InputPasswordElement.d.ts +2 -3
  372. package/dist/components/Form/elements/InputPasswordElement.d.ts.map +1 -1
  373. package/dist/components/Form/elements/InputPasswordElement.mjs +2 -1
  374. package/dist/components/Form/elements/InputPasswordElement.mjs.map +1 -1
  375. package/dist/components/Form/elements/MultiselectElement.cjs +1 -1
  376. package/dist/components/Form/elements/MultiselectElement.d.ts +0 -1
  377. package/dist/components/Form/elements/MultiselectElement.mjs +1 -1
  378. package/dist/components/Form/elements/SelectElement.cjs +1 -1
  379. package/dist/components/Form/elements/SelectElement.d.ts +0 -1
  380. package/dist/components/Form/elements/SelectElement.mjs +1 -1
  381. package/dist/components/Form/elements/SwitchSelectorElement.cjs +1 -1
  382. package/dist/components/Form/elements/SwitchSelectorElement.d.ts +0 -1
  383. package/dist/components/Form/elements/SwitchSelectorElement.mjs +1 -1
  384. package/dist/components/Form/elements/TextAreaElement.cjs +1 -1
  385. package/dist/components/Form/elements/TextAreaElement.d.ts +0 -1
  386. package/dist/components/Form/elements/TextAreaElement.mjs +1 -1
  387. package/dist/components/Form/elements/index.cjs +1 -1
  388. package/dist/components/Form/elements/index.mjs +1 -1
  389. package/dist/components/Form/index.cjs +1 -1
  390. package/dist/components/Form/index.mjs +1 -1
  391. package/dist/components/Form/layout/FormItemLayout.cjs +1 -1
  392. package/dist/components/Form/layout/FormItemLayout.d.ts +1 -2
  393. package/dist/components/Form/layout/FormItemLayout.d.ts.map +1 -1
  394. package/dist/components/Form/layout/FormItemLayout.mjs +1 -1
  395. package/dist/components/Form/layout/FormLabelLayout.d.ts +0 -1
  396. package/dist/components/Form/layout/RequiredStar.d.ts +0 -1
  397. package/dist/components/Form/layout/index.cjs +1 -1
  398. package/dist/components/Form/layout/index.mjs +1 -1
  399. package/dist/components/Headers/index.d.ts +0 -1
  400. package/dist/components/IDE/CodeRender.cjs.map +1 -1
  401. package/dist/components/IDE/CodeRender.d.ts +0 -1
  402. package/dist/components/IDE/CodeRender.mjs.map +1 -1
  403. package/dist/components/IDE/FileList.d.ts +0 -1
  404. package/dist/components/IDE/FileTree.d.ts +0 -1
  405. package/dist/components/IDE/IDE.d.ts +0 -1
  406. package/dist/components/IDE/MarkDownRender.d.ts +0 -1
  407. package/dist/components/InformationTag/index.d.ts +0 -1
  408. package/dist/components/Input/Checkbox.cjs +80 -0
  409. package/dist/components/Input/Checkbox.cjs.map +1 -0
  410. package/dist/components/Input/Checkbox.d.ts +14 -0
  411. package/dist/components/Input/Checkbox.d.ts.map +1 -0
  412. package/dist/components/Input/Checkbox.mjs +80 -0
  413. package/dist/components/Input/Checkbox.mjs.map +1 -0
  414. package/dist/components/Input/Input.cjs +8 -2
  415. package/dist/components/Input/Input.cjs.map +1 -1
  416. package/dist/components/Input/Input.d.ts +1 -1
  417. package/dist/components/Input/Input.d.ts.map +1 -1
  418. package/dist/components/Input/Input.mjs +8 -2
  419. package/dist/components/Input/Input.mjs.map +1 -1
  420. package/dist/components/Input/InputPassword.d.ts +0 -1
  421. package/dist/components/Input/index.cjs +3 -0
  422. package/dist/components/Input/index.cjs.map +1 -1
  423. package/dist/components/Input/index.d.ts +1 -0
  424. package/dist/components/Input/index.d.ts.map +1 -1
  425. package/dist/components/Input/index.mjs +3 -0
  426. package/dist/components/Input/index.mjs.map +1 -1
  427. package/dist/components/Label/index.d.ts +0 -1
  428. package/dist/components/Link/Link.cjs +7 -2
  429. package/dist/components/Link/Link.cjs.map +1 -1
  430. package/dist/components/Link/Link.d.ts +2 -2
  431. package/dist/components/Link/Link.d.ts.map +1 -1
  432. package/dist/components/Link/Link.mjs +7 -2
  433. package/dist/components/Link/Link.mjs.map +1 -1
  434. package/dist/components/Loader/index.d.ts +0 -1
  435. package/dist/components/Loader/spinner.d.ts +0 -1
  436. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts +0 -1
  437. package/dist/components/Logo/LogoCircle.d.ts +0 -1
  438. package/dist/components/Logo/LogoNoFrame.d.ts +0 -1
  439. package/dist/components/Logo/LogoSquare.d.ts +0 -1
  440. package/dist/components/Logo/LogoSquircle.d.ts +0 -1
  441. package/dist/components/Logo/LogoTextOnly.d.ts +0 -1
  442. package/dist/components/Logo/LogoWithTextBelowCircle.d.ts +0 -1
  443. package/dist/components/Logo/LogoWithTextBelowNoFrame.d.ts +0 -1
  444. package/dist/components/Logo/LogoWithTextBelowSquircle.d.ts +0 -1
  445. package/dist/components/Logo/LogoWithTextCircle.d.ts +0 -1
  446. package/dist/components/Logo/LogoWithTextNoFrame.d.ts +0 -1
  447. package/dist/components/Logo/LogoWithTextSquircle.d.ts +0 -1
  448. package/dist/components/Logo/index.d.ts +0 -1
  449. package/dist/components/MarkDownRender/index.d.ts +0 -1
  450. package/dist/components/MaxHeightSmoother/index.d.ts +0 -1
  451. package/dist/components/MaxWidthSmoother/index.d.ts +0 -1
  452. package/dist/components/Modal/Modal.cjs +22 -16
  453. package/dist/components/Modal/Modal.cjs.map +1 -1
  454. package/dist/components/Modal/Modal.d.ts +3 -3
  455. package/dist/components/Modal/Modal.d.ts.map +1 -1
  456. package/dist/components/Modal/Modal.mjs +22 -16
  457. package/dist/components/Modal/Modal.mjs.map +1 -1
  458. package/dist/components/Navbar/Burger.d.ts +0 -1
  459. package/dist/components/Navbar/DesktopNavbar.cjs +10 -26
  460. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  461. package/dist/components/Navbar/DesktopNavbar.d.ts +6 -6
  462. package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
  463. package/dist/components/Navbar/DesktopNavbar.mjs +10 -26
  464. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  465. package/dist/components/Navbar/MobileNavbar.cjs +6 -58
  466. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  467. package/dist/components/Navbar/MobileNavbar.d.ts +6 -7
  468. package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
  469. package/dist/components/Navbar/MobileNavbar.mjs +6 -58
  470. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  471. package/dist/components/Navbar/index.cjs +7 -3
  472. package/dist/components/Navbar/index.cjs.map +1 -1
  473. package/dist/components/Navbar/index.d.ts +9 -15
  474. package/dist/components/Navbar/index.d.ts.map +1 -1
  475. package/dist/components/Navbar/index.mjs +7 -3
  476. package/dist/components/Navbar/index.mjs.map +1 -1
  477. package/dist/components/Pattern/DotPattern.d.ts +0 -1
  478. package/dist/components/Pattern/GridPattern.d.ts +0 -1
  479. package/dist/components/Pattern/SpotLight.d.ts +0 -1
  480. package/dist/components/Popover/index.d.ts +0 -1
  481. package/dist/components/PressableSpan/PressableSpan.d.ts +0 -1
  482. package/dist/components/ProfileDropDown/index.d.ts +0 -1
  483. package/dist/components/RightDrawer/RightDrawer.d.ts +0 -1
  484. package/dist/components/Select/Multiselect.d.ts +2 -3
  485. package/dist/components/Select/Multiselect.d.ts.map +1 -1
  486. package/dist/components/SwitchSelector/index.cjs +3 -1
  487. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  488. package/dist/components/SwitchSelector/index.d.ts +0 -1
  489. package/dist/components/SwitchSelector/index.mjs +3 -1
  490. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  491. package/dist/components/TabSelector/TabSelector.cjs +15 -10
  492. package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
  493. package/dist/components/TabSelector/TabSelector.d.ts +1 -2
  494. package/dist/components/TabSelector/TabSelector.d.ts.map +1 -1
  495. package/dist/components/TabSelector/TabSelector.mjs +15 -10
  496. package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
  497. package/dist/components/Tag/index.cjs +79 -0
  498. package/dist/components/Tag/index.cjs.map +1 -0
  499. package/dist/components/Tag/index.d.ts +12 -0
  500. package/dist/components/Tag/index.d.ts.map +1 -0
  501. package/dist/components/Tag/index.mjs +79 -0
  502. package/dist/components/Tag/index.mjs.map +1 -0
  503. package/dist/components/TextArea/AutoSizeTextArea.d.ts +0 -1
  504. package/dist/components/TextArea/TextArea.cjs +1 -0
  505. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  506. package/dist/components/TextArea/TextArea.d.ts +0 -1
  507. package/dist/components/TextArea/TextArea.mjs +1 -0
  508. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  509. package/dist/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.d.ts +0 -1
  510. package/dist/components/ThemeSwitcherDropDown/MobileThemeSwitcher.d.ts +0 -1
  511. package/dist/components/Toaster/useToast.d.ts +0 -1
  512. package/dist/components/WithResizer/index.d.ts +0 -1
  513. package/dist/components/index.cjs +8 -7
  514. package/dist/components/index.cjs.map +1 -1
  515. package/dist/components/index.d.ts +1 -1
  516. package/dist/components/index.d.ts.map +1 -1
  517. package/dist/components/index.mjs +7 -6
  518. package/dist/components/index.mjs.map +1 -1
  519. package/dist/hooks/index.cjs +4 -1
  520. package/dist/hooks/index.cjs.map +1 -1
  521. package/dist/hooks/index.d.ts +1 -0
  522. package/dist/hooks/index.d.ts.map +1 -1
  523. package/dist/hooks/index.mjs +5 -2
  524. package/dist/hooks/index.mjs.map +1 -1
  525. package/dist/hooks/intlayerAPIHooks.cjs +258 -114
  526. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  527. package/dist/hooks/intlayerAPIHooks.d.ts +43 -39
  528. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  529. package/dist/hooks/intlayerAPIHooks.mjs +259 -115
  530. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  531. package/dist/hooks/useAsync/useAsync.cjs +142 -108
  532. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  533. package/dist/hooks/useAsync/useAsync.d.ts +0 -2
  534. package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
  535. package/dist/hooks/useAsync/useAsync.mjs +143 -109
  536. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  537. package/dist/hooks/useAsync/useAsyncStateStore.cjs +50 -112
  538. package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
  539. package/dist/hooks/useAsync/useAsyncStateStore.d.ts +3 -9
  540. package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
  541. package/dist/hooks/useAsync/useAsyncStateStore.mjs +50 -112
  542. package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
  543. package/dist/hooks/useAsync/useAsyncWrapper.d.ts +0 -1
  544. package/dist/hooks/useAsync/useProxyState.d.ts +3 -0
  545. package/dist/hooks/useAsync/useProxyState.d.ts.map +1 -0
  546. package/dist/hooks/useGetAllDictionaries.d.ts +0 -1
  547. package/dist/hooks/useIntlayerAPI.cjs +6 -5
  548. package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
  549. package/dist/hooks/useIntlayerAPI.d.ts +51 -45
  550. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  551. package/dist/hooks/useIntlayerAPI.mjs +5 -4
  552. package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
  553. package/dist/hooks/useItemSelector.cjs +11 -2
  554. package/dist/hooks/useItemSelector.cjs.map +1 -1
  555. package/dist/hooks/useItemSelector.d.ts +3 -3
  556. package/dist/hooks/useItemSelector.d.ts.map +1 -1
  557. package/dist/hooks/useItemSelector.mjs +11 -2
  558. package/dist/hooks/useItemSelector.mjs.map +1 -1
  559. package/dist/hooks/usePersistedStore.cjs +22 -0
  560. package/dist/hooks/usePersistedStore.cjs.map +1 -0
  561. package/dist/hooks/usePersistedStore.d.ts +2 -0
  562. package/dist/hooks/usePersistedStore.d.ts.map +1 -0
  563. package/dist/hooks/usePersistedStore.mjs +22 -0
  564. package/dist/hooks/usePersistedStore.mjs.map +1 -0
  565. package/dist/hooks/usePersistenceStore.cjs +22 -0
  566. package/dist/hooks/usePersistenceStore.cjs.map +1 -0
  567. package/dist/hooks/usePersistenceStore.d.ts +2 -0
  568. package/dist/hooks/usePersistenceStore.d.ts.map +1 -0
  569. package/dist/hooks/usePersistenceStore.mjs +22 -0
  570. package/dist/hooks/usePersistenceStore.mjs.map +1 -0
  571. package/dist/index-BUDsCMdX.cjs +204 -0
  572. package/dist/index-BUDsCMdX.cjs.map +1 -0
  573. package/dist/index-C09rI9kw.js +205 -0
  574. package/dist/index-C09rI9kw.js.map +1 -0
  575. package/dist/libs/intlayer-api/auth.cjs +14 -2
  576. package/dist/libs/intlayer-api/auth.cjs.map +1 -1
  577. package/dist/libs/intlayer-api/auth.d.ts +7 -4
  578. package/dist/libs/intlayer-api/auth.d.ts.map +1 -1
  579. package/dist/libs/intlayer-api/auth.mjs +14 -2
  580. package/dist/libs/intlayer-api/auth.mjs.map +1 -1
  581. package/dist/libs/intlayer-api/dictionary.d.ts +0 -1
  582. package/dist/libs/intlayer-api/fetcher.cjs +4 -3
  583. package/dist/libs/intlayer-api/fetcher.cjs.map +1 -1
  584. package/dist/libs/intlayer-api/fetcher.d.ts.map +1 -1
  585. package/dist/libs/intlayer-api/fetcher.mjs +4 -3
  586. package/dist/libs/intlayer-api/fetcher.mjs.map +1 -1
  587. package/dist/libs/intlayer-api/index.cjs +3 -1
  588. package/dist/libs/intlayer-api/index.cjs.map +1 -1
  589. package/dist/libs/intlayer-api/index.d.ts +12 -3
  590. package/dist/libs/intlayer-api/index.d.ts.map +1 -1
  591. package/dist/libs/intlayer-api/index.mjs +3 -1
  592. package/dist/libs/intlayer-api/index.mjs.map +1 -1
  593. package/dist/libs/intlayer-api/organization.d.ts +0 -1
  594. package/dist/libs/intlayer-api/project.d.ts +0 -1
  595. package/dist/libs/intlayer-api/stripe.cjs +22 -0
  596. package/dist/libs/intlayer-api/stripe.cjs.map +1 -0
  597. package/dist/libs/intlayer-api/stripe.d.ts +6 -0
  598. package/dist/libs/intlayer-api/stripe.d.ts.map +1 -0
  599. package/dist/libs/intlayer-api/stripe.mjs +22 -0
  600. package/dist/libs/intlayer-api/stripe.mjs.map +1 -0
  601. package/dist/libs/intlayer-api/user.d.ts +0 -1
  602. package/dist/stripe-BsI0lJWz.js +22 -0
  603. package/dist/stripe-BsI0lJWz.js.map +1 -0
  604. package/dist/stripe-C-u5RvGh.js +22 -0
  605. package/dist/stripe-C-u5RvGh.js.map +1 -0
  606. package/dist/stripe-CF_E65Vu.js +22 -0
  607. package/dist/stripe-CF_E65Vu.js.map +1 -0
  608. package/dist/stripe-CpGvfq6T.cjs +21 -0
  609. package/dist/stripe-CpGvfq6T.cjs.map +1 -0
  610. package/dist/stripe-DEv4DjAL.cjs +21 -0
  611. package/dist/stripe-DEv4DjAL.cjs.map +1 -0
  612. package/dist/stripe-DuG0uaEn.cjs +21 -0
  613. package/dist/stripe-DuG0uaEn.cjs.map +1 -0
  614. package/dist/tailwind.css +1 -1
  615. package/dist/useProxyState-D5GLrY2y.js +20 -0
  616. package/dist/useProxyState-D5GLrY2y.js.map +1 -0
  617. package/dist/useProxyState-DewdF3no.cjs +19 -0
  618. package/dist/useProxyState-DewdF3no.cjs.map +1 -0
  619. package/dist/utils/cn.d.ts +0 -1
  620. package/dist/utils/dictionary.cjs +37 -1
  621. package/dist/utils/dictionary.cjs.map +1 -1
  622. package/dist/utils/dictionary.d.ts +1 -1
  623. package/dist/utils/dictionary.d.ts.map +1 -1
  624. package/dist/utils/dictionary.mjs +38 -2
  625. package/dist/utils/dictionary.mjs.map +1 -1
  626. package/dist/validDictionaryChangeButtons.content-BK9QaXPm.cjs +66 -0
  627. package/dist/validDictionaryChangeButtons.content-BK9QaXPm.cjs.map +1 -0
  628. package/dist/validDictionaryChangeButtons.content-CAAscqJI.cjs +66 -0
  629. package/dist/validDictionaryChangeButtons.content-CAAscqJI.cjs.map +1 -0
  630. package/dist/validDictionaryChangeButtons.content-D7AvoBdl.js +67 -0
  631. package/dist/validDictionaryChangeButtons.content-D7AvoBdl.js.map +1 -0
  632. package/dist/validDictionaryChangeButtons.content-DQwoUNCC.cjs +45 -0
  633. package/dist/validDictionaryChangeButtons.content-DQwoUNCC.cjs.map +1 -0
  634. package/dist/validDictionaryChangeButtons.content-DQxPoIe6.js +67 -0
  635. package/dist/validDictionaryChangeButtons.content-DQxPoIe6.js.map +1 -0
  636. package/dist/validDictionaryChangeButtons.content-JUcjGdBx.cjs +66 -0
  637. package/dist/validDictionaryChangeButtons.content-JUcjGdBx.cjs.map +1 -0
  638. package/dist/validDictionaryChangeButtons.content-ejY3-sbG.js +67 -0
  639. package/dist/validDictionaryChangeButtons.content-ejY3-sbG.js.map +1 -0
  640. package/dist/validDictionaryChangeButtons.content-iyT0lKy7.js +46 -0
  641. package/dist/validDictionaryChangeButtons.content-iyT0lKy7.js.map +1 -0
  642. package/dist/validDictionaryChangeButtons.content-u4qShrQh.cjs +66 -0
  643. package/dist/validDictionaryChangeButtons.content-u4qShrQh.cjs.map +1 -0
  644. package/dist/validDictionaryChangeButtons.content-y4up9NU8.js +67 -0
  645. package/dist/validDictionaryChangeButtons.content-y4up9NU8.js.map +1 -0
  646. package/dist/zod-BV4nCGJE.js.map +1 -1
  647. package/dist/zod-DSrtTSD_.cjs.map +1 -1
  648. package/package.json +87 -56
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import require$$0, { useRef as useRef$1, useCallback, useEffect } from "react";
2
+ import require$$0, { useRef as useRef$1, useCallback, useEffect, useMemo } from "react";
3
3
  import { useAsyncStateStore } from "./useAsyncStateStore.mjs";
4
4
  function shallow(objA, objB) {
5
5
  if (Object.is(objA, objB)) {
@@ -54,7 +54,8 @@ const DEFAULT_RETRY_LIMIT = 1;
54
54
  const DEFAULT_REVALIDATION_ENABLED = false;
55
55
  const DEFAULT_REVALIDATE_TIME = 5 * 60 * 1e3;
56
56
  const DEFAULT_RETRY_TIME = 5 * 60 * 1e3;
57
- const getKeyWithArgs = (key, args) => args.length > 0 ? `${key}/${JSON.stringify(args)}` : key;
57
+ const getArgs = (args) => args ? Array.isArray(args) ? args : [args] : [];
58
+ const getKeyWithArgs = (key, args) => getArgs(args).length > 0 ? `${key}/${JSON.stringify(args)}` : key;
58
59
  const useAsync = (key, asyncFunction, options) => {
59
60
  const retryLimit = options?.retryLimit ?? DEFAULT_RETRY_LIMIT;
60
61
  const autoFetch = options?.autoFetch ?? DEFAULT_AUTO_FETCH;
@@ -64,50 +65,31 @@ const useAsync = (key, asyncFunction, options) => {
64
65
  const enabled = options?.enable ?? DEFAULT_ENABLED;
65
66
  const revalidationEnabled = options?.revalidation ?? DEFAULT_REVALIDATION_ENABLED;
66
67
  const revalidateTime = options?.revalidateTime ?? DEFAULT_REVALIDATE_TIME;
67
- const isInvalidatedProps = options?.isInvalidated ?? false;
68
68
  const updateQueries = options?.updateQueries ?? [];
69
69
  const invalidateQueries = options?.invalidateQueries ?? [];
70
70
  const onSuccess = options?.onSuccess;
71
71
  const onError = options?.onError;
72
- const args = options?.args ?? [];
73
- const {
74
- setIsFetched,
75
- setIsLoading,
76
- setError,
77
- setIsSuccess,
78
- setData,
79
- setIsInvalidated,
80
- setIsEnabled,
81
- incrementRetryCount,
82
- resetRetryCount
83
- } = useAsyncStateStore(
72
+ const args = getArgs(options?.args ?? []);
73
+ const { setQueryState, setQueriesState, makeQueryInError } = useAsyncStateStore(
84
74
  useShallow((state) => ({
85
- setIsFetched: state.setIsFetched,
86
- setIsLoading: state.setIsLoading,
87
- setError: state.setError,
88
- setIsSuccess: state.setIsSuccess,
89
- setIsInvalidated: state.setIsInvalidated,
90
- setIsEnabled: state.setIsEnabled,
91
- setData: state.setData,
92
- incrementRetryCount: state.incrementRetryCount,
93
- resetRetryCount: state.resetRetryCount
75
+ setQueryState: state.setQueryState,
76
+ setQueriesState: state.setQueriesState,
77
+ makeQueryInError: state.makeQueryInError
94
78
  }))
95
79
  );
96
- const storedArgsRef = useRef$1(args ?? []);
80
+ const storedArgsRef = useRef$1(args);
97
81
  const keyWithArgs = getKeyWithArgs(key, storedArgsRef.current);
98
82
  const {
99
83
  isFetched,
100
84
  fetchedDateTime,
101
85
  isLoading,
102
- isEnabled: isEnabledState,
86
+ isEnabled,
103
87
  error,
104
88
  isSuccess,
105
89
  isInvalidated,
106
90
  data,
107
91
  retryCount: errorCount
108
- } = useAsyncStateStore((state) => state.getStates(keyWithArgs));
109
- const isEnabled = isEnabledState || enabled;
110
- const isDisabled = !isEnabled;
92
+ } = useAsyncStateStore(useShallow((state) => state.getStates(keyWithArgs)));
111
93
  const fetch = useCallback(
112
94
  async (...args2) => {
113
95
  const keyWithArgs2 = getKeyWithArgs(key, args2);
@@ -115,87 +97,90 @@ const useAsync = (key, asyncFunction, options) => {
115
97
  return pendingPromises.get(keyWithArgs2);
116
98
  }
117
99
  const promise = (async () => {
118
- setIsLoading(keyWithArgs2, true);
100
+ setQueryState(keyWithArgs2, { isLoading: true });
119
101
  let response = null;
120
- let errorResponse = null;
121
102
  await asyncFunction(...args2).then((result) => {
122
- const isResultChanged = JSON.stringify(result) !== JSON.stringify(data);
123
103
  response = result;
124
- if (isResultChanged) {
125
- setData(keyWithArgs2, result);
126
- }
127
- setIsSuccess(keyWithArgs2, true);
104
+ setQueryState(keyWithArgs2, {
105
+ data: result,
106
+ retryCount: 0,
107
+ isLoading: false,
108
+ isFetched: true,
109
+ isSuccess: true,
110
+ isInvalidated: false,
111
+ error: null
112
+ });
128
113
  onSuccess?.(result);
129
- resetRetryCount(keyWithArgs2);
130
- if (storeEnabled) {
131
- sessionStorage.setItem(keyWithArgs2, JSON.stringify(result));
132
- }
133
- if (isResultChanged && updateQueries.length > 0) {
134
- updateQueries.forEach((key2) => {
135
- setData(key2, result);
114
+ if (invalidateQueries.length > 0) {
115
+ setQueriesState(invalidateQueries, {
116
+ isInvalidated: true
136
117
  });
137
118
  }
138
- if (isResultChanged && invalidateQueries.length > 0) {
139
- invalidateQueries.forEach((key2) => {
140
- setIsInvalidated(key2, true);
119
+ if (updateQueries.length > 0) {
120
+ setQueriesState(updateQueries, {
121
+ data: result
141
122
  });
142
123
  }
124
+ if (storeEnabled) {
125
+ sessionStorage.setItem(keyWithArgs2, JSON.stringify(result));
126
+ }
143
127
  }).catch((error2) => {
144
- const errorMessage = error2.message ?? "An error occurred";
145
- setData(keyWithArgs2, null);
146
- setError(keyWithArgs2, errorMessage);
147
- incrementRetryCount(keyWithArgs2);
148
- onError?.(errorMessage);
149
- errorResponse = error2;
128
+ makeQueryInError(keyWithArgs2, error2.message);
129
+ onError?.(error2.message);
150
130
  }).finally(() => {
151
- setIsLoading(keyWithArgs2, false);
152
- setIsFetched(keyWithArgs2, true);
153
- setIsInvalidated(keyWithArgs2, false);
154
131
  pendingPromises.delete(keyWithArgs2);
155
132
  });
156
- if (errorResponse) {
157
- throw new Error(errorResponse);
158
- }
159
133
  return response;
160
134
  })();
161
135
  pendingPromises.set(keyWithArgs2, promise);
136
+ return await promise;
162
137
  },
163
- [asyncFunction, keyWithArgs]
138
+ [asyncFunction, keyWithArgs, storeEnabled, cacheEnabled, onSuccess, onError]
164
139
  );
165
140
  const execute = useCallback(
166
141
  async (...args2) => {
167
- if (isDisabled) return;
142
+ if (!isEnabled || !enabled) return;
168
143
  if (isLoading) return;
169
- if (isSuccess && cacheEnabled && data) return data;
144
+ if (!isInvalidated && isSuccess && cacheEnabled && data) return data;
170
145
  if (args2) {
171
- storedArgsRef.current = args2;
146
+ storedArgsRef.current = getArgs(...args2);
172
147
  }
173
- await fetch(...args2);
148
+ return await fetch(...args2);
174
149
  },
175
- [isDisabled, cacheEnabled, isSuccess, data, isLoading]
150
+ [
151
+ isEnabled,
152
+ enabled,
153
+ isInvalidated,
154
+ cacheEnabled,
155
+ isSuccess,
156
+ data,
157
+ isLoading,
158
+ fetch
159
+ ]
176
160
  );
177
161
  const revalidate = useCallback(
178
162
  async (...args2) => {
179
- if (isDisabled) return;
180
- if (isSuccess) return;
181
- if (isLoading) return;
163
+ if (!isEnabled || !enabled) return;
182
164
  if (args2) {
183
- storedArgsRef.current = args2;
165
+ storedArgsRef.current = getArgs(...args2);
184
166
  }
185
- await fetch(...storedArgsRef.current);
167
+ const result = await fetch(...storedArgsRef.current);
168
+ return result;
186
169
  },
187
- [isDisabled, storedArgsRef, isSuccess, isLoading]
170
+ [isEnabled, enabled, storedArgsRef, fetch]
188
171
  );
189
- const autoRevalidate = useCallback(() => {
190
- if (isDisabled) return;
191
- if (isLoading || !(cacheEnabled || storeEnabled)) return;
192
- if (!revalidationEnabled || revalidateTime <= 0 || !isSuccess) return;
172
+ const autoRevalidate = useCallback(async () => {
173
+ if (!isEnabled || !enabled) return;
174
+ if (isLoading) return;
175
+ if (!(cacheEnabled || storeEnabled)) return;
176
+ if (!isSuccess) return;
177
+ if (!revalidationEnabled || revalidateTime <= 0) return;
193
178
  if (!fetchedDateTime) return;
194
179
  const now = (/* @__PURE__ */ new Date()).getTime();
195
180
  const lastFetchedTime = new Date(fetchedDateTime).getTime();
196
181
  const shouldRevalidate = now - lastFetchedTime >= revalidateTime;
197
182
  if (shouldRevalidate) {
198
- fetch(...storedArgsRef.current);
183
+ return await fetch(...storedArgsRef.current);
199
184
  }
200
185
  }, [
201
186
  cacheEnabled,
@@ -204,70 +189,119 @@ const useAsync = (key, asyncFunction, options) => {
204
189
  isSuccess,
205
190
  fetchedDateTime,
206
191
  isLoading,
207
- isDisabled
192
+ isEnabled,
193
+ enabled
208
194
  ]);
209
195
  useEffect(() => {
210
- setIsEnabled(keyWithArgs, enabled);
211
- }, [enabled]);
196
+ if (enabled !== isEnabled) {
197
+ setQueryState(keyWithArgs, {
198
+ isEnabled
199
+ });
200
+ }
201
+ }, [enabled, keyWithArgs]);
212
202
  useEffect(() => {
213
203
  if (!autoFetch) return;
214
- if (isDisabled) return;
215
- if (isFetched || isLoading) return;
204
+ if (!isEnabled || !enabled) return;
205
+ if (isFetched && !isInvalidated) return;
206
+ if (isLoading) return;
216
207
  fetch(...storedArgsRef.current);
217
- }, [autoFetch, isFetched, isDisabled, isLoading]);
208
+ }, [
209
+ autoFetch,
210
+ isFetched,
211
+ isInvalidated,
212
+ isEnabled,
213
+ enabled,
214
+ isLoading,
215
+ fetch
216
+ ]);
218
217
  useEffect(() => {
219
218
  const isRetryEnabled = errorCount > 0 && retryLimit > 0;
220
219
  const isRetryLimitReached = errorCount >= retryLimit;
221
- if (isDisabled) return;
220
+ if (!isEnabled || !enabled) return;
222
221
  if (!(cacheEnabled || storeEnabled)) return;
223
222
  if (!isRetryEnabled || isRetryLimitReached) return;
224
223
  if (isSuccess) return;
225
224
  if (isLoading) return;
226
225
  const timeOut = setTimeout(() => {
227
- if (isRetryEnabled && !isRetryLimitReached && !isSuccess) {
228
- execute(...storedArgsRef.current);
229
- }
226
+ fetch(...storedArgsRef.current);
230
227
  }, retryTime);
231
228
  return () => clearTimeout(timeOut);
232
- }, [execute, errorCount, retryLimit, retryTime, isSuccess]);
229
+ }, [
230
+ fetch,
231
+ errorCount,
232
+ retryLimit,
233
+ retryTime,
234
+ isSuccess,
235
+ isEnabled,
236
+ enabled,
237
+ isLoading,
238
+ cacheEnabled,
239
+ storeEnabled
240
+ ]);
233
241
  useEffect(() => {
234
242
  const interval = setInterval(autoRevalidate, revalidateTime);
235
243
  return () => clearInterval(interval);
236
244
  }, [autoRevalidate, revalidateTime]);
237
245
  useEffect(() => {
238
- if (isDisabled) return;
246
+ if (!isEnabled || !enabled) return;
239
247
  if (!storeEnabled) return;
240
248
  if (isInvalidated) return;
241
249
  if (isFetched) return;
250
+ if (data) return;
242
251
  const storedData = sessionStorage.getItem(keyWithArgs);
243
- if (storedData) {
244
- setData(keyWithArgs, JSON.parse(storedData));
252
+ if (storedData && JSON.stringify(storedData) !== JSON.stringify(data)) {
253
+ setQueryState(keyWithArgs, {
254
+ data: JSON.parse(storedData)
255
+ });
245
256
  }
246
- }, [storeEnabled, keyWithArgs, isFetched, isInvalidated, isDisabled]);
247
- useEffect(() => {
248
- if (!isInvalidatedProps) return;
249
- setIsInvalidated(keyWithArgs, isInvalidatedProps);
250
- }, [isInvalidatedProps]);
257
+ }, [
258
+ storeEnabled,
259
+ keyWithArgs,
260
+ isFetched,
261
+ isInvalidated,
262
+ isEnabled,
263
+ enabled,
264
+ data
265
+ ]);
251
266
  const setDataMemo = useCallback(
252
267
  (data2) => {
253
- setData(keyWithArgs, data2);
268
+ setQueryState(keyWithArgs, {
269
+ data: data2
270
+ });
254
271
  },
255
272
  [keyWithArgs]
256
273
  );
257
- return {
258
- isFetched,
259
- isLoading,
260
- isInvalidated,
261
- error,
262
- isSuccess,
263
- data,
264
- retryCount: errorCount,
265
- isDisabled,
266
- isEnabled,
267
- [key]: execute,
268
- revalidate,
269
- setData: setDataMemo
270
- };
274
+ const memoResult = useMemo(
275
+ () => ({
276
+ isFetched,
277
+ isLoading,
278
+ isInvalidated,
279
+ error,
280
+ isSuccess,
281
+ data,
282
+ retryCount: errorCount,
283
+ isDisabled: !isEnabled,
284
+ isEnabled,
285
+ [key]: execute,
286
+ revalidate,
287
+ setData: setDataMemo
288
+ }),
289
+ [
290
+ isFetched,
291
+ isLoading,
292
+ isInvalidated,
293
+ error,
294
+ isSuccess,
295
+ data,
296
+ errorCount,
297
+ isEnabled,
298
+ key,
299
+ execute,
300
+ revalidate,
301
+ setDataMemo
302
+ ]
303
+ );
304
+ return memoResult;
271
305
  };
272
306
  export {
273
307
  useAsync
@@ -1 +1 @@
1
- {"version":3,"file":"useAsync.mjs","sources":["../../../../../../node_modules/.pnpm/zustand@4.5.5_@types+react@18.3.11_react@18.3.1/node_modules/zustand/esm/react/shallow.mjs","../../../src/hooks/useAsync/useAsync.ts"],"sourcesContent":["import ReactExports from 'react';\n\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA of keysA) {\n if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {\n return false;\n }\n }\n return true;\n}\n\nconst { useRef } = ReactExports;\nfunction useShallow(selector) {\n const prev = useRef();\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","'use client';\n\n// This is an ESLint directive to disable specific rules.\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { useCallback, useEffect, useRef } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useAsyncStateStore } 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 error: string | null;\n data: Awaited<ReturnType<T>> | null;\n retryCount: number;\n revalidate: T;\n setData: (data: Awaited<ReturnType<T> | null>) => 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 using zustand\n store?: boolean; // Store the result of the function in session 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 isInvalidated?: boolean; // Determine if the data is invalidated and should be refetched\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 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 getKeyWithArgs = (key: string, args: any[]) =>\n 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 * @template U - A string type that extends the keys of the async function, used as a key to store and retrieve state.\n * @template T - A function type that must return a Promise, representing the asynchronous operation to be managed.\n *\n * @param {U} key - A unique identifier for the async operation, used to handle state internally and avoid conflicts.\n * @param {T} asyncFunction - The asynchronous function that will be managed by this hook. This function should return a Promise.\n * @param {UseAsyncOptions<T>} [options] - Optional configuration options to customize the behavior of the hook.\n * @returns {UseAsyncResult<U, T>} The states and controls related to the managed async function. Includes states like isLoading, isSuccess, and provides control methods like revalidate and setData.\n *\n * @typedef {Object} UseAsyncOptions\n * @property {number} [retryTime=300000] - Time in milliseconds for retrying the data after an error occurs.\n * @property {number} [retryLimit=1] - The number of times the hook should retry the asynchronous function on failure before giving up.\n * @property {boolean} [revalidation=false] - Enable revalidation.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {boolean} [cache=false] - Whether to cache the result of the async function. When enabled, revalidation is controlled by `revalidateTime`.\n * @property {boolean} [store=false] - Store the result of the function in session storage.\n * @property {boolean} [autoFetch=false] - Whether the hook should automatically invoke the asynchronous function on mount.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {boolean} [isInvalidated=false] - Determine if the data is invalidated and should be refetched.\n * @property {string[]} [updateQueries=[]] - Update other queries when the data is updated.\n * @property {string[]} [invalidateQueries=[]] - Invalidate other queries when the data is updated.\n * @property {(data: Awaited<ReturnType<T>>) => void} [onSuccess] - Callback function that is called when the asynchronous function resolves successfully.\n * @property {(error: string) => void} [onError] - Callback function that is called when the asynchronous function rejects or encounters an error.\n * @property {Parameters<T>} [args=[]] - Arguments to pass to the asynchronous function.\n *\n *\n * @example\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 */\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 isInvalidatedProps = options?.isInvalidated ?? false;\n const updateQueries = options?.updateQueries ?? [];\n const invalidateQueries = options?.invalidateQueries ?? [];\n const onSuccess = options?.onSuccess;\n const onError = options?.onError;\n const args = options?.args ?? [];\n\n // Using a custom hook to manage state specific to asynchronous operations\n const {\n setIsFetched,\n setIsLoading,\n setError,\n setIsSuccess,\n setData,\n setIsInvalidated,\n setIsEnabled,\n incrementRetryCount,\n resetRetryCount,\n } = useAsyncStateStore(\n useShallow((state) => ({\n setIsFetched: state.setIsFetched,\n setIsLoading: state.setIsLoading,\n setError: state.setError,\n setIsSuccess: state.setIsSuccess,\n setIsInvalidated: state.setIsInvalidated,\n setIsEnabled: state.setIsEnabled,\n setData: state.setData,\n incrementRetryCount: state.incrementRetryCount,\n resetRetryCount: state.resetRetryCount,\n }))\n );\n\n // Storing the last arguments used to call the async function\n const storedArgsRef = useRef<any>(args ?? []);\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: isEnabledState,\n error,\n isSuccess,\n isInvalidated,\n data,\n retryCount: errorCount,\n } = useAsyncStateStore((state) => state.getStates(keyWithArgs));\n\n const isEnabled = isEnabledState || enabled;\n const isDisabled = !isEnabled;\n\n // The core fetching function, designed to be called directly or automatically based on configuration\n const fetch: T = useCallback<T>(\n (async (...args) => {\n const keyWithArgs = getKeyWithArgs(key, args);\n\n if (pendingPromises.has(keyWithArgs)) {\n // Return the existing pending promise\n return pendingPromises.get(keyWithArgs);\n }\n\n const promise = (async () => {\n setIsLoading(keyWithArgs, true);\n let response = null;\n let errorResponse = null;\n\n await asyncFunction(...args)\n .then((result) => {\n const isResultChanged =\n JSON.stringify(result) !== JSON.stringify(data);\n\n response = result;\n if (isResultChanged) {\n setData(keyWithArgs, result);\n }\n setIsSuccess(keyWithArgs, true);\n onSuccess?.(result);\n resetRetryCount(keyWithArgs);\n\n // Store the result in session storage\n if (storeEnabled) {\n sessionStorage.setItem(keyWithArgs, JSON.stringify(result));\n }\n\n // Update other queries if necessary\n if (isResultChanged && updateQueries.length > 0) {\n updateQueries.forEach((key) => {\n setData(key, result);\n });\n }\n\n // Invalidate other queries if necessary\n if (isResultChanged && invalidateQueries.length > 0) {\n invalidateQueries.forEach((key) => {\n setIsInvalidated(key, true);\n });\n }\n })\n .catch((error) => {\n const errorMessage = error.message ?? 'An error occurred';\n\n setData(keyWithArgs, null);\n setError(keyWithArgs, errorMessage);\n incrementRetryCount(keyWithArgs);\n onError?.(errorMessage);\n errorResponse = error;\n })\n .finally(() => {\n setIsLoading(keyWithArgs, false);\n setIsFetched(keyWithArgs, true);\n setIsInvalidated(keyWithArgs, false);\n\n // Remove the pending promise from the cache\n pendingPromises.delete(keyWithArgs);\n });\n\n if (errorResponse) {\n throw new Error(errorResponse);\n }\n\n return response;\n })();\n\n // Store the pending promise in the cache\n pendingPromises.set(keyWithArgs, promise);\n }) as T,\n [asyncFunction, keyWithArgs]\n );\n\n // Wrapped execution function to handle disabled state and check for success before re-fetching\n const execute: T = useCallback<T>(\n (async (...args) => {\n if (isDisabled) return;\n if (isLoading) return;\n if (isSuccess && cacheEnabled && data) return data;\n\n if (args) {\n storedArgsRef.current = args;\n }\n\n await fetch(...args);\n }) as T,\n [isDisabled, cacheEnabled, isSuccess, data, isLoading]\n );\n\n // Function to revalidate the data when necessary\n const revalidate: T = useCallback<T>(\n (async (...args) => {\n if (isDisabled) return;\n if (isSuccess) return;\n if (isLoading) return;\n\n if (args) {\n storedArgsRef.current = args;\n }\n\n await fetch(...storedArgsRef.current);\n }) as T,\n [isDisabled, storedArgsRef, isSuccess, isLoading]\n );\n\n const autoRevalidate = useCallback(() => {\n if (isDisabled) return;\n if (isLoading || !(cacheEnabled || storeEnabled)) return;\n if (!revalidationEnabled || revalidateTime <= 0 || !isSuccess) return;\n if (!fetchedDateTime) return;\n\n const now = new Date().getTime();\n const lastFetchedTime = new Date(fetchedDateTime).getTime();\n const shouldRevalidate = now - lastFetchedTime >= revalidateTime;\n if (shouldRevalidate) {\n fetch(...storedArgsRef.current);\n }\n }, [\n cacheEnabled,\n revalidationEnabled,\n revalidateTime,\n isSuccess,\n fetchedDateTime,\n isLoading,\n isDisabled,\n ]);\n\n useEffect(() => {\n setIsEnabled(keyWithArgs, enabled);\n }, [enabled]);\n\n // Auto-fetch data on hook mount if autoFetch is true\n useEffect(() => {\n if (!autoFetch) return;\n if (isDisabled) return;\n if (isFetched || isLoading) return;\n\n fetch(...storedArgsRef.current);\n }, [autoFetch, isFetched, isDisabled, isLoading]);\n\n // Handle retry based on conditions set in options\n useEffect(() => {\n const isRetryEnabled = errorCount > 0 && retryLimit > 0;\n const isRetryLimitReached = errorCount >= retryLimit;\n if (isDisabled) return;\n if (!(cacheEnabled || storeEnabled)) return;\n if (!isRetryEnabled || isRetryLimitReached) return;\n if (isSuccess) return;\n if (isLoading) return;\n\n const timeOut = setTimeout(() => {\n if (isRetryEnabled && !isRetryLimitReached && !isSuccess) {\n execute(...storedArgsRef.current);\n }\n }, retryTime);\n\n return () => clearTimeout(timeOut);\n }, [execute, errorCount, retryLimit, retryTime, isSuccess]);\n\n // Handle periodic revalidation if caching is enabled\n useEffect(() => {\n const interval = setInterval(autoRevalidate, revalidateTime);\n\n return () => clearInterval(interval);\n }, [autoRevalidate, revalidateTime]);\n\n // Load data from session storage if storeEnabled is true\n useEffect(() => {\n if (isDisabled) return;\n if (!storeEnabled) return;\n if (isInvalidated) return;\n if (isFetched) return;\n\n const storedData = sessionStorage.getItem(keyWithArgs);\n\n if (storedData) {\n setData(keyWithArgs, JSON.parse(storedData));\n }\n }, [storeEnabled, keyWithArgs, isFetched, isInvalidated, isDisabled]);\n\n // Handle invalidation if props are changed\n useEffect(() => {\n if (!isInvalidatedProps) return;\n setIsInvalidated(keyWithArgs, isInvalidatedProps);\n }, [isInvalidatedProps]);\n\n // Memoization of the setData function to prevent unnecessary re-renders\n const setDataMemo = useCallback(\n (data: Awaited<ReturnType<T> | null>) => {\n setData(keyWithArgs, data);\n },\n [keyWithArgs]\n );\n\n // Return the hook's result, including all state and control functions\n return {\n isFetched,\n isLoading,\n isInvalidated,\n error,\n isSuccess,\n data,\n retryCount: errorCount,\n isDisabled,\n isEnabled,\n [key]: execute,\n revalidate,\n setData: setDataMemo,\n } as UseAsyncResultBase<T> & Record<U, T>;\n};\n"],"names":["ReactExports","useRef","args","keyWithArgs","key","error","data"],"mappings":";;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACR;AACD,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACR;AACD,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,CAAC,KAAK,KAAK,KAAK,MAAM;AAC/B,UAAI,CAAC,OAAO,GAAG,OAAO,KAAK,IAAI,GAAG,CAAC,GAAG;AACpC,eAAO;AAAA,MACR;AAAA,IACF;AACD,WAAO;AAAA,EACR;AACD,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,SAAS,MAAM;AACxB,UAAI,CAAC,KAAK,IAAI,KAAK,GAAG;AACpB,eAAO;AAAA,MACR;AAAA,IACF;AACD,WAAO;AAAA,EACR;AACD,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI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O;AAAA,MAClC;AAAA,OACC,SAAS;AAEL,WAAA,MAAM,aAAa,OAAO;AAAA,EAAA,GAChC,CAAC,SAAS,YAAY,YAAY,WAAW,SAAS,CAAC;AAG1D,YAAU,MAAM;AACR,UAAA,WAAW,YAAY,gBAAgB,cAAc;AAEpD,WAAA,MAAM,cAAc,QAAQ;AAAA,EAAA,GAClC,CAAC,gBAAgB,cAAc,CAAC;AAGnC,YAAU,MAAM;AACd,QAAI,WAAY;AAChB,QAAI,CAAC,aAAc;AACnB,QAAI,cAAe;AACnB,QAAI,UAAW;AAET,UAAA,aAAa,eAAe,QAAQ,WAAW;AAErD,QAAI,YAAY;AACd,cAAQ,aAAa,KAAK,MAAM,UAAU,CAAC;AAAA,IAC7C;AAAA,EAAA,GACC,CAAC,cAAc,aAAa,WAAW,eAAe,UAAU,CAAC;AAGpE,YAAU,MAAM;AACd,QAAI,CAAC,mBAAoB;AACzB,qBAAiB,aAAa,kBAAkB;AAAA,EAAA,GAC/C,CAAC,kBAAkB,CAAC;AAGvB,QAAM,cAAc;AAAA,IAClB,CAACI,UAAwC;AACvC,cAAQ,aAAaA,KAAI;AAAA,IAC3B;AAAA,IACA,CAAC,WAAW;AAAA,EAAA;AAIP,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,IACA;AAAA,IACA,CAAC,GAAG,GAAG;AAAA,IACP;AAAA,IACA,SAAS;AAAA,EAAA;AAEb;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"useAsync.mjs","sources":["../../../../../../node_modules/.pnpm/zustand@4.5.5_@types+react@18.3.12_react@18.3.1/node_modules/zustand/esm/react/shallow.mjs","../../../src/hooks/useAsync/useAsync.ts"],"sourcesContent":["import ReactExports from 'react';\n\nfunction shallow(objA, objB) {\n if (Object.is(objA, objB)) {\n return true;\n }\n if (typeof objA !== \"object\" || objA === null || typeof objB !== \"object\" || objB === null) {\n return false;\n }\n if (objA instanceof Map && objB instanceof Map) {\n if (objA.size !== objB.size) return false;\n for (const [key, value] of objA) {\n if (!Object.is(value, objB.get(key))) {\n return false;\n }\n }\n return true;\n }\n if (objA instanceof Set && objB instanceof Set) {\n if (objA.size !== objB.size) return false;\n for (const value of objA) {\n if (!objB.has(value)) {\n return false;\n }\n }\n return true;\n }\n const keysA = Object.keys(objA);\n if (keysA.length !== Object.keys(objB).length) {\n return false;\n }\n for (const keyA of keysA) {\n if (!Object.prototype.hasOwnProperty.call(objB, keyA) || !Object.is(objA[keyA], objB[keyA])) {\n return false;\n }\n }\n return true;\n}\n\nconst { useRef } = ReactExports;\nfunction useShallow(selector) {\n const prev = useRef();\n return (state) => {\n const next = selector(state);\n return shallow(prev.current, next) ? prev.current : prev.current = next;\n };\n}\n\nexport { useShallow };\n","'use client';\n\n// This is an ESLint directive to disable specific rules.\n/* eslint-disable @typescript-eslint/no-explicit-any */\n\nimport { useCallback, useEffect, useMemo, useRef } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useAsyncStateStore } 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 error: string | null;\n data: Awaited<ReturnType<T>> | null;\n retryCount: number;\n revalidate: T;\n setData: (data: Awaited<ReturnType<T> | null>) => 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 using zustand\n store?: boolean; // Store the result of the function in session 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 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 * @template U - A string type that extends the keys of the async function, used as a key to store and retrieve state.\n * @template T - A function type that must return a Promise, representing the asynchronous operation to be managed.\n *\n * @param {U} key - A unique identifier for the async operation, used to handle state internally and avoid conflicts.\n * @param {T} asyncFunction - The asynchronous function that will be managed by this hook. This function should return a Promise.\n * @param {UseAsyncOptions<T>} [options] - Optional configuration options to customize the behavior of the hook.\n * @returns {UseAsyncResult<U, T>} The states and controls related to the managed async function. Includes states like isLoading, isSuccess, and provides control methods like revalidate and setData.\n *\n * @typedef {Object} UseAsyncOptions\n * @property {number} [retryTime=300000] - Time in milliseconds for retrying the data after an error occurs.\n * @property {number} [retryLimit=1] - The number of times the hook should retry the asynchronous function on failure before giving up.\n * @property {boolean} [revalidation=false] - Enable revalidation.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {boolean} [cache=false] - Whether to cache the result of the async function. When enabled, revalidation is controlled by `revalidateTime`.\n * @property {boolean} [store=false] - Store the result of the function in session storage.\n * @property {boolean} [autoFetch=false] - Whether the hook should automatically invoke the asynchronous function on mount.\n * @property {number} [revalidateTime=300000] - Time in milliseconds after which the cached data is considered stale and the async function is re-invoked, if caching is enabled.\n * @property {string[]} [updateQueries=[]] - Update other queries when the data is updated.\n * @property {string[]} [invalidateQueries=[]] - Invalidate other queries when the data is updated.\n * @property {(data: Awaited<ReturnType<T>>) => void} [onSuccess] - Callback function that is called when the asynchronous function resolves successfully.\n * @property {(error: string) => void} [onError] - Callback function that is called when the asynchronous function rejects or encounters an error.\n * @property {Parameters<T>} [args=[]] - Arguments to pass to the asynchronous function.\n *\n *\n * @example\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 */\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 { setQueryState, setQueriesState, makeQueryInError } =\n useAsyncStateStore(\n useShallow((state) => ({\n setQueryState: state.setQueryState,\n setQueriesState: state.setQueriesState,\n makeQueryInError: state.makeQueryInError,\n }))\n );\n\n // Storing the last arguments used to call the async function\n const storedArgsRef = useRef<any[]>(args);\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 retryCount: errorCount,\n } = useAsyncStateStore(useShallow((state) => state.getStates(keyWithArgs)));\n\n // The core fetching function, designed to be called directly or automatically based on configuration\n const fetch: T = useCallback<T>(\n (async (...args) => {\n const keyWithArgs = getKeyWithArgs(key, args);\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 retryCount: 0,\n isLoading: false,\n isFetched: true,\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 session storage\n if (storeEnabled) {\n sessionStorage.setItem(keyWithArgs, JSON.stringify(result));\n }\n })\n .catch((error) => {\n makeQueryInError(keyWithArgs, error.message);\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 [asyncFunction, keyWithArgs, storeEnabled, cacheEnabled, onSuccess, onError]\n );\n\n // Wrapped execution function to handle disabled state and check for success before re-fetching\n const execute: T = useCallback<T>(\n (async (...args) => {\n if (!isEnabled || !enabled) return;\n if (isLoading) return;\n if (!isInvalidated && isSuccess && cacheEnabled && data) return data;\n\n if (args) {\n storedArgsRef.current = getArgs(...args);\n }\n\n return await fetch(...args);\n }) as T,\n [\n isEnabled,\n enabled,\n isInvalidated,\n cacheEnabled,\n isSuccess,\n data,\n isLoading,\n fetch,\n ]\n );\n\n // Function to revalidate the data when necessary\n const revalidate: T = useCallback<T>(\n (async (...args) => {\n if (!isEnabled || !enabled) return;\n\n if (args) {\n storedArgsRef.current = getArgs(...args);\n }\n\n const result = await fetch(...storedArgsRef.current);\n\n return result;\n }) as T,\n [isEnabled, enabled, storedArgsRef, fetch]\n );\n\n const autoRevalidate = useCallback(async () => {\n if (!isEnabled || !enabled) return;\n if (isLoading) return;\n if (!(cacheEnabled || storeEnabled)) return;\n if (!isSuccess) return;\n if (!revalidationEnabled || revalidateTime <= 0) return;\n if (!fetchedDateTime) return;\n\n const now = new Date().getTime();\n const lastFetchedTime = new Date(fetchedDateTime).getTime();\n const shouldRevalidate = now - lastFetchedTime >= revalidateTime;\n if (shouldRevalidate) {\n return await fetch(...storedArgsRef.current);\n }\n }, [\n cacheEnabled,\n revalidationEnabled,\n revalidateTime,\n isSuccess,\n fetchedDateTime,\n isLoading,\n isEnabled,\n enabled,\n ]);\n\n useEffect(() => {\n if (enabled !== isEnabled) {\n setQueryState(keyWithArgs, {\n isEnabled,\n });\n }\n }, [enabled, keyWithArgs]);\n\n // Auto-fetch data on hook mount if autoFetch is true\n useEffect(() => {\n if (!autoFetch) return;\n if (!isEnabled || !enabled) return;\n if (isFetched && !isInvalidated) return;\n if (isLoading) return;\n\n fetch(...storedArgsRef.current);\n }, [\n autoFetch,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n isLoading,\n fetch,\n ]);\n\n // Handle retry based on conditions set in options\n useEffect(() => {\n const isRetryEnabled = errorCount > 0 && retryLimit > 0;\n const isRetryLimitReached = errorCount >= retryLimit;\n if (!isEnabled || !enabled) return;\n if (!(cacheEnabled || storeEnabled)) return;\n if (!isRetryEnabled || isRetryLimitReached) return;\n if (isSuccess) return;\n if (isLoading) return;\n\n const timeOut = setTimeout(() => {\n fetch(...storedArgsRef.current);\n }, retryTime);\n\n return () => clearTimeout(timeOut);\n }, [\n fetch,\n errorCount,\n retryLimit,\n retryTime,\n isSuccess,\n isEnabled,\n enabled,\n isLoading,\n cacheEnabled,\n storeEnabled,\n ]);\n\n // Handle periodic revalidation if caching is enabled\n useEffect(() => {\n const interval = setInterval(autoRevalidate, revalidateTime);\n\n return () => clearInterval(interval);\n }, [autoRevalidate, revalidateTime]);\n\n // Load data from session storage if storeEnabled is true\n useEffect(() => {\n if (!isEnabled || !enabled) return;\n if (!storeEnabled) return;\n if (isInvalidated) return;\n if (isFetched) return;\n if (data) return;\n\n const storedData = sessionStorage.getItem(keyWithArgs);\n\n if (storedData && JSON.stringify(storedData) !== JSON.stringify(data)) {\n setQueryState(keyWithArgs, {\n data: JSON.parse(storedData),\n });\n }\n }, [\n storeEnabled,\n keyWithArgs,\n isFetched,\n isInvalidated,\n isEnabled,\n enabled,\n data,\n ]);\n\n // Memoization of the setData function to prevent unnecessary re-renders\n const setDataMemo = useCallback(\n (data: Awaited<ReturnType<T> | null>) => {\n setQueryState(keyWithArgs, {\n data,\n });\n },\n [keyWithArgs]\n );\n\n const memoResult = useMemo(\n () => ({\n isFetched,\n isLoading,\n isInvalidated,\n error,\n isSuccess,\n data,\n retryCount: errorCount,\n isDisabled: !isEnabled,\n isEnabled,\n [key]: execute,\n revalidate,\n setData: setDataMemo,\n }),\n [\n isFetched,\n isLoading,\n isInvalidated,\n error,\n isSuccess,\n data,\n errorCount,\n isEnabled,\n key,\n execute,\n revalidate,\n setDataMemo,\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":["ReactExports","useRef","args","keyWithArgs","error","data"],"mappings":";;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACR;AACD,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACR;AACD,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,CAAC,KAAK,KAAK,KAAK,MAAM;AAC/B,UAAI,CAAC,OAAO,GAAG,OAAO,KAAK,IAAI,GAAG,CAAC,GAAG;AACpC,eAAO;AAAA,MACR;AAAA,IACF;AACD,WAAO;AAAA,EACR;AACD,MAAI,gBAAgB,OAAO,gBAAgB,KAAK;AAC9C,QAAI,KAAK,SAAS,KAAK,KAAM,QAAO;AACpC,eAAW,SAAS,MAAM;AACxB,UAAI,CAAC,KAAK,IAAI,KAAK,GAAG;AACpB,eAAO;AAAA,MACR;AAAA,IACF;AAC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AAA,MACA;AAAA,IACF;AAAA,EAAA;AAIK,SAAA;AACT;","x_google_ignoreList":[0]}
@@ -29,140 +29,78 @@ const getMatchKeys = (selectorsKeys, keysWithArgs) => {
29
29
  const useAsyncStateStore = zustand.create((set, get) => ({
30
30
  states: {},
31
31
  getStates: (key) => get().states[key] ?? createDefaultStates(),
32
- setIsFetched: (key, value) => set((state) => ({
32
+ setQueryState: (key, value) => set((state) => ({
33
33
  states: {
34
34
  ...state.states,
35
35
  [key]: {
36
36
  ...state.states[key] ?? createDefaultStates(),
37
- isFetched: value,
38
- fetchedDateTime: /* @__PURE__ */ new Date()
37
+ ...value
39
38
  }
40
39
  }
41
40
  })),
42
- setIsLoading: (key, value) => set((state) => ({
41
+ makeQueryInError: (key, error) => set((state) => ({
43
42
  states: {
44
43
  ...state.states,
45
44
  [key]: {
46
45
  ...state.states[key] ?? createDefaultStates(),
47
- isLoading: value
46
+ error,
47
+ isFetched: true,
48
+ isSuccess: false,
49
+ retryCount: (state.states[key]?.retryCount ?? 0) + 1,
50
+ isLoading: false,
51
+ isInvalidated: false
48
52
  }
49
53
  }
50
54
  })),
51
- setError: (key, value) => set((state) => ({
52
- states: {
53
- ...state.states,
54
- [key]: {
55
- ...state.states[key] ?? createDefaultStates(),
56
- error: value
57
- }
58
- }
59
- })),
60
- setIsSuccess: (key, value) => set((state) => ({
61
- states: {
62
- ...state.states,
63
- [key]: {
64
- ...state.states[key] ?? createDefaultStates(),
65
- isSuccess: value
55
+ setQueriesState: (keys, value) => {
56
+ const keyArray = ensureArray(keys);
57
+ if (keyArray.length === 0) return;
58
+ set((state) => ({
59
+ states: {
60
+ ...state.states,
61
+ ...keyArray.reduce((acc, key) => {
62
+ acc[key] = {
63
+ ...state.states[key] ?? createDefaultStates(),
64
+ ...value
65
+ };
66
+ return acc;
67
+ }, {})
66
68
  }
67
- }
68
- })),
69
- setIsInvalidated: (key, value) => set((state) => {
70
- if (value === true) {
69
+ }));
70
+ },
71
+ resetKeyState: (keys) => {
72
+ const keyArray = ensureArray(keys);
73
+ if (keyArray.length === 0) return;
74
+ set((state) => {
71
75
  const allKeys = Object.keys(state.states);
72
- const matchedKeys = getMatchKeys([key], allKeys);
73
- matchedKeys.forEach((key2) => {
74
- sessionStorage.removeItem(key2);
75
- });
76
+ const matchedKeys = getMatchKeys(keyArray, allKeys);
77
+ if (matchedKeys.length === 0) return {};
78
+ const resetStates = matchedKeys.reduce((acc, key) => {
79
+ acc[key] = createDefaultStates();
80
+ return acc;
81
+ }, {});
76
82
  return {
77
83
  states: {
78
84
  ...state.states,
79
- [key]: {
80
- ...createDefaultStates(),
81
- isInvalidated: true
82
- }
85
+ ...resetStates
83
86
  }
84
87
  };
85
- }
86
- return {
87
- states: {
88
- ...state.states,
89
- [key]: {
90
- ...state.states[key] ?? createDefaultStates(),
91
- isInvalidated: false
92
- }
93
- }
94
- };
95
- }),
96
- setData: (key, value) => set((state) => ({
97
- states: {
98
- ...state.states,
99
- [key]: {
100
- ...state.states[key] ?? createDefaultStates(),
101
- data: value
102
- }
103
- }
104
- })),
105
- incrementRetryCount: (key) => set((state) => {
106
- const prevState = state.states[key] ?? createDefaultStates();
107
- return {
108
- states: {
109
- ...state.states,
110
- [key]: {
111
- ...prevState,
112
- retryCount: prevState.retryCount + 1
113
- }
114
- }
115
- };
116
- }),
117
- resetRetryCount: (key) => set((state) => {
118
- const prevState = state.states[key] ?? createDefaultStates();
119
- return {
120
- states: {
121
- ...state.states,
122
- [key]: {
123
- ...prevState,
124
- retryCount: 0
125
- }
126
- }
127
- };
128
- }),
129
- setIsEnabled: (key, value) => set((state) => ({
130
- states: {
131
- ...state.states,
132
- [key]: {
133
- ...state.states[key] ?? createDefaultStates(),
134
- isEnabled: value
135
- }
136
- }
137
- })),
138
- resetKeyState: (key) => set((state) => {
139
- const keys = ensureArray(key);
140
- const allKeys = Object.keys(state.states);
141
- const matchedKeys = getMatchKeys(keys, allKeys);
142
- const newStates = { ...state.states };
143
- matchedKeys.forEach((k) => {
144
- newStates[k] = createDefaultStates();
145
88
  });
146
- return {
147
- states: newStates
148
- };
149
- }),
150
- resetState: (excludedKey) => set((state) => {
151
- const excludedKeys = ensureArray(excludedKey);
152
- const allKeys = Object.keys(state.states);
153
- const matchedKeys = getMatchKeys(excludedKeys, allKeys);
154
- const newStates = Object.keys(state.states).reduce((acc, key) => {
155
- if (matchedKeys.includes(key)) {
156
- acc[key] = state.states[key];
157
- } else {
158
- acc[key] = createDefaultStates();
159
- }
160
- return acc;
161
- }, {});
162
- return {
163
- states: newStates
164
- };
165
- })
89
+ },
90
+ resetState: (excludedKeys) => {
91
+ const excludeArray = ensureArray(excludedKeys);
92
+ const allKeys = Object.keys(get().states);
93
+ const matchedKeys = getMatchKeys(excludeArray, allKeys);
94
+ set((state) => {
95
+ const newStates = allKeys.reduce((acc, key) => {
96
+ acc[key] = matchedKeys.includes(key) ? state.states[key] : createDefaultStates();
97
+ return acc;
98
+ }, {});
99
+ return {
100
+ states: newStates
101
+ };
102
+ });
103
+ }
166
104
  }));
167
105
  exports.useAsyncStateStore = useAsyncStateStore;
168
106
  //# sourceMappingURL=useAsyncStateStore.cjs.map