@intlayer/design-system 5.8.1 → 6.0.0-canary.1

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 (340) hide show
  1. package/dist/.vite/manifest.json +34 -106
  2. package/dist/better-auth.CMQ3rA-I-7umXOENE.js.map +1 -1
  3. package/dist/better-auth.CMQ3rA-I-C2nBKRMa.cjs.map +1 -1
  4. package/dist/components/Breadcrumb/breadcrumb.content.cjs +3 -1
  5. package/dist/components/Breadcrumb/breadcrumb.content.cjs.map +1 -1
  6. package/dist/components/Breadcrumb/breadcrumb.content.d.ts +3 -0
  7. package/dist/components/Breadcrumb/breadcrumb.content.d.ts.map +1 -1
  8. package/dist/components/Breadcrumb/breadcrumb.content.mjs +3 -1
  9. package/dist/components/Breadcrumb/breadcrumb.content.mjs.map +1 -1
  10. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  11. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  12. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  13. package/dist/components/CopyButton/CopyButton.content.cjs +3 -1
  14. package/dist/components/CopyButton/CopyButton.content.cjs.map +1 -1
  15. package/dist/components/CopyButton/CopyButton.content.d.ts +3 -0
  16. package/dist/components/CopyButton/CopyButton.content.d.ts.map +1 -1
  17. package/dist/components/CopyButton/CopyButton.content.mjs +3 -1
  18. package/dist/components/CopyButton/CopyButton.content.mjs.map +1 -1
  19. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +7 -3
  20. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  21. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  22. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +7 -3
  23. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  24. package/dist/components/DictionaryFieldEditor/ContentEditor.cjs +1 -1
  25. package/dist/components/DictionaryFieldEditor/ContentEditor.cjs.map +1 -1
  26. package/dist/components/DictionaryFieldEditor/ContentEditor.mjs +1 -1
  27. package/dist/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
  28. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs +83 -34
  29. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.cjs.map +1 -1
  30. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.d.ts.map +1 -1
  31. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +83 -34
  32. package/dist/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs.map +1 -1
  33. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +13 -9
  34. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
  35. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
  36. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +12 -8
  37. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  38. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs +27 -13
  39. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.cjs.map +1 -1
  40. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +27 -0
  41. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
  42. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +27 -13
  43. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
  44. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.cjs +9 -4
  45. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.cjs.map +1 -1
  46. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts +9 -0
  47. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.d.ts.map +1 -1
  48. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs +9 -4
  49. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.content.mjs.map +1 -1
  50. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +29 -25
  51. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  52. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  53. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +27 -23
  54. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  55. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +37 -17
  56. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
  57. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +64 -2
  58. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
  59. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +37 -17
  60. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  61. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs +25 -12
  62. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs.map +1 -1
  63. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +25 -0
  64. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts.map +1 -1
  65. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs +25 -12
  66. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs.map +1 -1
  67. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +4 -5
  68. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  69. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  70. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +4 -5
  71. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  72. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +2 -2
  73. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
  74. package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
  75. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +2 -2
  76. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
  77. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs +25 -12
  78. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.cjs.map +1 -1
  79. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts +25 -0
  80. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.d.ts.map +1 -1
  81. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs +25 -12
  82. package/dist/components/DictionaryFieldEditor/NavigationView/navigationViewNode.content.mjs.map +1 -1
  83. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +36 -31
  84. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  85. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  86. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +36 -31
  87. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  88. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +32 -28
  89. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  90. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +32 -5
  91. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  92. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -28
  93. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  94. package/dist/components/DictionaryFieldEditor/StructureEditor.cjs +2 -2
  95. package/dist/components/DictionaryFieldEditor/StructureEditor.cjs.map +1 -1
  96. package/dist/components/DictionaryFieldEditor/StructureEditor.mjs +2 -2
  97. package/dist/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
  98. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs +2 -5
  99. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.cjs.map +1 -1
  100. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -5
  101. package/dist/components/DictionaryFieldEditor/StructureView/StructureView.mjs.map +1 -1
  102. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs +9 -4
  103. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.cjs.map +1 -1
  104. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts +9 -0
  105. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.d.ts.map +1 -1
  106. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs +9 -4
  107. package/dist/components/DictionaryFieldEditor/StructureView/structureView.content.mjs.map +1 -1
  108. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs +3 -3
  109. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -1
  110. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +3 -3
  111. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -1
  112. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +4 -6
  113. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs.map +1 -1
  114. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts +3 -3
  115. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts.map +1 -1
  116. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +4 -6
  117. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -1
  118. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs +7 -3
  119. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs.map +1 -1
  120. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +7 -0
  121. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts.map +1 -1
  122. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs +7 -3
  123. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs.map +1 -1
  124. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs +9 -6
  125. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.cjs.map +1 -1
  126. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts +9 -4
  127. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.d.ts.map +1 -1
  128. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs +9 -6
  129. package/dist/components/DictionaryFieldEditor/dictionaryFieldEditor.content.mjs.map +1 -1
  130. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs +28 -14
  131. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.cjs.map +1 -1
  132. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts +29 -2
  133. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.d.ts.map +1 -1
  134. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs +28 -14
  135. package/dist/components/DictionaryFieldEditor/nodeTypeSelector.content.mjs.map +1 -1
  136. package/dist/components/DropDown/index.cjs +2 -2
  137. package/dist/components/DropDown/index.cjs.map +1 -1
  138. package/dist/components/DropDown/index.d.ts.map +1 -1
  139. package/dist/components/DropDown/index.mjs +2 -2
  140. package/dist/components/DropDown/index.mjs.map +1 -1
  141. package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -5
  142. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  143. package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -5
  144. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  145. package/dist/components/ExpandCollapse/ExpandCollapse.cjs.map +1 -1
  146. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts +2 -2
  147. package/dist/components/ExpandCollapse/ExpandCollapse.d.ts.map +1 -1
  148. package/dist/components/ExpandCollapse/ExpandCollapse.mjs.map +1 -1
  149. package/dist/components/ExpandCollapse/expandCollapse.content.cjs +5 -2
  150. package/dist/components/ExpandCollapse/expandCollapse.content.cjs.map +1 -1
  151. package/dist/components/ExpandCollapse/expandCollapse.content.d.ts +3 -0
  152. package/dist/components/ExpandCollapse/expandCollapse.content.d.ts.map +1 -1
  153. package/dist/components/ExpandCollapse/expandCollapse.content.mjs +5 -2
  154. package/dist/components/ExpandCollapse/expandCollapse.content.mjs.map +1 -1
  155. package/dist/components/Flags/Flag.cjs +2 -1
  156. package/dist/components/Flags/Flag.cjs.map +1 -1
  157. package/dist/components/Flags/Flag.d.ts.map +1 -1
  158. package/dist/components/Flags/Flag.mjs +2 -1
  159. package/dist/components/Flags/Flag.mjs.map +1 -1
  160. package/dist/components/IDE/Code.cjs +8 -8
  161. package/dist/components/IDE/Code.cjs.map +1 -1
  162. package/dist/components/IDE/Code.mjs +8 -8
  163. package/dist/components/IDE/Code.mjs.map +1 -1
  164. package/dist/components/IDE/CodeBlockClient.cjs +1 -1
  165. package/dist/components/IDE/CodeBlockClient.cjs.map +1 -1
  166. package/dist/components/IDE/CodeBlockClient.d.ts +1 -1
  167. package/dist/components/IDE/CodeBlockClient.d.ts.map +1 -1
  168. package/dist/components/IDE/CodeBlockClient.mjs +1 -1
  169. package/dist/components/IDE/CodeBlockClient.mjs.map +1 -1
  170. package/dist/components/IDE/CodeContext.cjs +1 -3
  171. package/dist/components/IDE/CodeContext.cjs.map +1 -1
  172. package/dist/components/IDE/CodeContext.mjs +1 -3
  173. package/dist/components/IDE/CodeContext.mjs.map +1 -1
  174. package/dist/components/IDE/code.content.cjs +5 -2
  175. package/dist/components/IDE/code.content.cjs.map +1 -1
  176. package/dist/components/IDE/code.content.d.ts +5 -0
  177. package/dist/components/IDE/code.content.d.ts.map +1 -1
  178. package/dist/components/IDE/code.content.mjs +5 -2
  179. package/dist/components/IDE/code.content.mjs.map +1 -1
  180. package/dist/components/IDE/copyCode.content.cjs +5 -2
  181. package/dist/components/IDE/copyCode.content.cjs.map +1 -1
  182. package/dist/components/IDE/copyCode.content.d.ts +5 -0
  183. package/dist/components/IDE/copyCode.content.d.ts.map +1 -1
  184. package/dist/components/IDE/copyCode.content.mjs +5 -2
  185. package/dist/components/IDE/copyCode.content.mjs.map +1 -1
  186. package/dist/components/Input/Checkbox.cjs.map +1 -1
  187. package/dist/components/Input/Checkbox.d.ts +2 -2
  188. package/dist/components/Input/Checkbox.d.ts.map +1 -1
  189. package/dist/components/Input/Checkbox.mjs.map +1 -1
  190. package/dist/components/Loader/index.content.cjs +6 -1
  191. package/dist/components/Loader/index.content.cjs.map +1 -1
  192. package/dist/components/Loader/index.content.d.ts +33 -2
  193. package/dist/components/Loader/index.content.d.ts.map +1 -1
  194. package/dist/components/Loader/index.content.mjs +6 -1
  195. package/dist/components/Loader/index.content.mjs.map +1 -1
  196. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +1 -3
  197. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -1
  198. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -3
  199. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
  200. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +1 -3
  201. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs.map +1 -1
  202. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +1 -3
  203. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -1
  204. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs +17 -8
  205. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs.map +1 -1
  206. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +17 -0
  207. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts.map +1 -1
  208. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs +17 -8
  209. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs.map +1 -1
  210. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs +13 -6
  211. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs.map +1 -1
  212. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +13 -0
  213. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts.map +1 -1
  214. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs +13 -6
  215. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs.map +1 -1
  216. package/dist/components/Modal/Modal.cjs +2 -4
  217. package/dist/components/Modal/Modal.cjs.map +1 -1
  218. package/dist/components/Modal/Modal.mjs +2 -4
  219. package/dist/components/Modal/Modal.mjs.map +1 -1
  220. package/dist/components/Navbar/MobileNavbar.cjs +1 -3
  221. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  222. package/dist/components/Navbar/MobileNavbar.mjs +1 -3
  223. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  224. package/dist/components/Navbar/index.cjs +2 -4
  225. package/dist/components/Navbar/index.cjs.map +1 -1
  226. package/dist/components/Navbar/index.mjs +2 -4
  227. package/dist/components/Navbar/index.mjs.map +1 -1
  228. package/dist/components/SwitchSelector/index.cjs +1 -3
  229. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  230. package/dist/components/SwitchSelector/index.mjs +1 -3
  231. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  232. package/dist/components/TabSelector/TabSelector.cjs +1 -3
  233. package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
  234. package/dist/components/TabSelector/TabSelector.d.ts +1 -1
  235. package/dist/components/TabSelector/TabSelector.d.ts.map +1 -1
  236. package/dist/components/TabSelector/TabSelector.mjs +1 -3
  237. package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
  238. package/dist/components/Table/table.content.cjs +3 -1
  239. package/dist/components/Table/table.content.cjs.map +1 -1
  240. package/dist/components/Table/table.content.d.ts +3 -0
  241. package/dist/components/Table/table.content.d.ts.map +1 -1
  242. package/dist/components/Table/table.content.mjs +3 -1
  243. package/dist/components/Table/table.content.mjs.map +1 -1
  244. package/dist/components/Tag/index.cjs +22 -88
  245. package/dist/components/Tag/index.cjs.map +1 -1
  246. package/dist/components/Tag/index.d.ts +5 -5
  247. package/dist/components/Tag/index.mjs +22 -88
  248. package/dist/components/Tag/index.mjs.map +1 -1
  249. package/dist/components/TextArea/AutocompleteTextArea.cjs +20 -21
  250. package/dist/components/TextArea/AutocompleteTextArea.cjs.map +1 -1
  251. package/dist/components/TextArea/AutocompleteTextArea.d.ts.map +1 -1
  252. package/dist/components/TextArea/AutocompleteTextArea.mjs +20 -21
  253. package/dist/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
  254. package/dist/hooks/auth.cjs +26 -11
  255. package/dist/hooks/auth.cjs.map +1 -1
  256. package/dist/hooks/auth.mjs +26 -11
  257. package/dist/hooks/auth.mjs.map +1 -1
  258. package/dist/hooks/index.cjs +65 -66
  259. package/dist/hooks/index.cjs.map +1 -1
  260. package/dist/hooks/index.d.ts +1 -3
  261. package/dist/hooks/index.d.ts.map +1 -1
  262. package/dist/hooks/index.mjs +4 -8
  263. package/dist/hooks/index.mjs.map +1 -1
  264. package/dist/hooks/reactQuery.cjs +648 -0
  265. package/dist/hooks/reactQuery.cjs.map +1 -0
  266. package/dist/hooks/reactQuery.d.ts +899 -0
  267. package/dist/hooks/reactQuery.d.ts.map +1 -0
  268. package/dist/hooks/reactQuery.mjs +646 -0
  269. package/dist/hooks/reactQuery.mjs.map +1 -0
  270. package/dist/hooks/useAuth/useOAuth2.cjs +13 -10
  271. package/dist/hooks/useAuth/useOAuth2.cjs.map +1 -1
  272. package/dist/hooks/useAuth/useOAuth2.d.ts +1 -1
  273. package/dist/hooks/useAuth/useOAuth2.d.ts.map +1 -1
  274. package/dist/hooks/useAuth/useOAuth2.mjs +13 -10
  275. package/dist/hooks/useAuth/useOAuth2.mjs.map +1 -1
  276. package/dist/hooks/useAuth/useSession.cjs +23 -26
  277. package/dist/hooks/useAuth/useSession.cjs.map +1 -1
  278. package/dist/hooks/useAuth/useSession.d.ts +4 -352
  279. package/dist/hooks/useAuth/useSession.d.ts.map +1 -1
  280. package/dist/hooks/useAuth/useSession.mjs +23 -26
  281. package/dist/hooks/useAuth/useSession.mjs.map +1 -1
  282. package/dist/hooks/useIntlayerAPI.cjs +2 -3
  283. package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
  284. package/dist/hooks/useIntlayerAPI.mjs +2 -3
  285. package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
  286. package/dist/hooks/useUser/index.cjs +6 -9
  287. package/dist/hooks/useUser/index.cjs.map +1 -1
  288. package/dist/hooks/useUser/index.d.ts +2 -18
  289. package/dist/hooks/useUser/index.d.ts.map +1 -1
  290. package/dist/hooks/useUser/index.mjs +6 -9
  291. package/dist/hooks/useUser/index.mjs.map +1 -1
  292. package/dist/index-BCuMWKyy.js.map +1 -1
  293. package/dist/index-BYzBot7l.cjs.map +1 -1
  294. package/dist/providers/ReactQueryProvider.cjs +85 -0
  295. package/dist/providers/ReactQueryProvider.cjs.map +1 -0
  296. package/dist/providers/ReactQueryProvider.d.ts +13 -0
  297. package/dist/providers/ReactQueryProvider.d.ts.map +1 -0
  298. package/dist/providers/ReactQueryProvider.mjs +85 -0
  299. package/dist/providers/ReactQueryProvider.mjs.map +1 -0
  300. package/dist/providers/index.cjs +5 -0
  301. package/dist/{hooks/useAsync → providers}/index.cjs.map +1 -1
  302. package/dist/providers/index.d.ts +2 -0
  303. package/dist/providers/index.d.ts.map +1 -0
  304. package/dist/providers/index.mjs +5 -0
  305. package/dist/{hooks/useAsync → providers}/index.mjs.map +1 -1
  306. package/package.json +30 -20
  307. package/dist/hooks/intlayerAPIHooks.cjs +0 -542
  308. package/dist/hooks/intlayerAPIHooks.cjs.map +0 -1
  309. package/dist/hooks/intlayerAPIHooks.d.ts +0 -968
  310. package/dist/hooks/intlayerAPIHooks.d.ts.map +0 -1
  311. package/dist/hooks/intlayerAPIHooks.mjs +0 -542
  312. package/dist/hooks/intlayerAPIHooks.mjs.map +0 -1
  313. package/dist/hooks/useAsync/index.cjs +0 -8
  314. package/dist/hooks/useAsync/index.d.ts +0 -3
  315. package/dist/hooks/useAsync/index.d.ts.map +0 -1
  316. package/dist/hooks/useAsync/index.mjs +0 -8
  317. package/dist/hooks/useAsync/useAsync.cjs +0 -244
  318. package/dist/hooks/useAsync/useAsync.cjs.map +0 -1
  319. package/dist/hooks/useAsync/useAsync.d.ts +0 -73
  320. package/dist/hooks/useAsync/useAsync.d.ts.map +0 -1
  321. package/dist/hooks/useAsync/useAsync.mjs +0 -244
  322. package/dist/hooks/useAsync/useAsync.mjs.map +0 -1
  323. package/dist/hooks/useAsync/useAsyncStateStore.cjs +0 -150
  324. package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +0 -1
  325. package/dist/hooks/useAsync/useAsyncStateStore.d.ts +0 -52
  326. package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +0 -1
  327. package/dist/hooks/useAsync/useAsyncStateStore.mjs +0 -150
  328. package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +0 -1
  329. package/dist/hooks/useAsync/useAsyncWrapper.cjs +0 -10
  330. package/dist/hooks/useAsync/useAsyncWrapper.cjs.map +0 -1
  331. package/dist/hooks/useAsync/useAsyncWrapper.d.ts +0 -37
  332. package/dist/hooks/useAsync/useAsyncWrapper.d.ts.map +0 -1
  333. package/dist/hooks/useAsync/useAsyncWrapper.mjs +0 -10
  334. package/dist/hooks/useAsync/useAsyncWrapper.mjs.map +0 -1
  335. package/dist/hooks/useGetAllDictionaries.cjs +0 -35
  336. package/dist/hooks/useGetAllDictionaries.cjs.map +0 -1
  337. package/dist/hooks/useGetAllDictionaries.d.ts +0 -11
  338. package/dist/hooks/useGetAllDictionaries.d.ts.map +0 -1
  339. package/dist/hooks/useGetAllDictionaries.mjs +0 -35
  340. package/dist/hooks/useGetAllDictionaries.mjs.map +0 -1
@@ -1,43 +1,40 @@
1
1
  "use client";
2
2
  import configuration from "@intlayer/config/built";
3
3
  import { useConfiguration } from "@intlayer/editor-react";
4
+ import { useQueryClient, useQuery } from "@tanstack/react-query";
4
5
  import { getAuthAPI } from "../auth.mjs";
5
- import { useAsync } from "../useAsync/useAsync.mjs";
6
- import "../useAsync/useAsyncStateStore.mjs";
6
+ import "@intlayer/api";
7
7
  const useSession = (sessionProp, intlayerConfiguration) => {
8
8
  const configuration$1 = useConfiguration();
9
9
  const config = intlayerConfiguration ?? configuration$1 ?? configuration;
10
- const {
11
- getSession,
12
- revalidate,
13
- data,
14
- setData: setSession,
15
- isFetched
16
- } = useAsync(
17
- "getSession",
18
- async () => {
10
+ const queryClient = useQueryClient();
11
+ const { data, isFetched, refetch } = useQuery({
12
+ queryKey: ["session"],
13
+ queryFn: async () => {
19
14
  const intlayerAPI = getAuthAPI(config);
20
15
  const result = await intlayerAPI.getSession();
21
16
  return result.data;
22
17
  },
23
- {
24
- cache: true,
25
- store: true,
26
- autoFetch: true,
27
- enable: !sessionProp,
28
- invalidateQueries: [
29
- "getOrganizations",
30
- "getProjects",
31
- "getUsers",
32
- "getDictionaries"
33
- ]
34
- }
35
- );
18
+ staleTime: 0,
19
+ gcTime: 0,
20
+ enabled: !sessionProp,
21
+ refetchOnWindowFocus: false,
22
+ refetchOnMount: false,
23
+ refetchOnReconnect: false,
24
+ refetchInterval: false,
25
+ refetchIntervalInBackground: false
26
+ });
36
27
  const session = data ?? (isFetched ? null : void 0);
28
+ const setSession = (nextSession) => queryClient.setQueryData(["session"], nextSession);
29
+ const fetchSession = async () => {
30
+ const res = await refetch();
31
+ return res.data;
32
+ };
33
+ const revalidateSession = fetchSession;
37
34
  return {
38
35
  session,
39
- fetchSession: getSession,
40
- revalidateSession: revalidate,
36
+ fetchSession,
37
+ revalidateSession,
41
38
  setSession
42
39
  };
43
40
  };
@@ -1 +1 @@
1
- {"version":3,"file":"useSession.mjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI } from '../auth';\nimport { useAsync } from '../useAsync';\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n\n const {\n getSession,\n revalidate,\n data,\n setData: setSession,\n isFetched,\n } = useAsync(\n 'getSession',\n async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n return result.data as unknown as SessionAPI;\n },\n {\n cache: true,\n store: true,\n autoFetch: true,\n enable: !sessionProp,\n invalidateQueries: [\n 'getOrganizations',\n 'getProjects',\n 'getUsers',\n 'getDictionaries',\n ],\n }\n );\n\n const session = data ?? (isFetched ? null : undefined);\n\n return {\n session,\n fetchSession: getSession,\n revalidateSession: revalidate,\n setSession,\n };\n};\n"],"names":["configuration","defaultConfiguration"],"mappings":";;;;;;AASO,MAAM,aAAa,CACxB,aACA,0BACG;AACH,QAAMA,kBAAgB,iBAAA;AACtB,QAAM,SAAS,yBAAyBA,mBAAiBC;AAEzD,QAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EAAA,IACE;AAAA,IACF;AAAA,IACA,YAAY;AACV,YAAM,cAAc,WAAW,MAAM;AACrC,YAAM,SAAS,MAAM,YAAY,WAAA;AACjC,aAAO,OAAO;AAAA,IAChB;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC;AAAA,MACT,mBAAmB;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EACF;AAGF,QAAM,UAAU,SAAS,YAAY,OAAO;AAE5C,SAAO;AAAA,IACL;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,EAAA;AAEJ;"}
1
+ {"version":3,"file":"useSession.mjs","sources":["../../../src/hooks/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport defaultConfiguration from '@intlayer/config/built';\nimport type { IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { useQuery } from '@tanstack/react-query';\nimport { getAuthAPI } from '../auth';\nimport { useQueryClient } from '../reactQuery';\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const configuration = useConfiguration();\n const config = intlayerConfiguration ?? configuration ?? defaultConfiguration;\n\n const queryClient = useQueryClient();\n\n const { data, isFetched, refetch } = useQuery({\n queryKey: ['session'],\n queryFn: async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n return result.data as unknown as SessionAPI;\n },\n staleTime: 0,\n gcTime: 0,\n enabled: !sessionProp,\n refetchOnWindowFocus: false,\n refetchOnMount: false,\n refetchOnReconnect: false,\n refetchInterval: false,\n refetchIntervalInBackground: false,\n });\n\n const session = data ?? (isFetched ? null : undefined);\n\n const setSession = (nextSession: SessionAPI | null) =>\n queryClient.setQueryData(['session'], nextSession);\n\n const fetchSession = async (): Promise<SessionAPI | null | undefined> => {\n const res = await refetch();\n return res.data as SessionAPI | null | undefined;\n };\n\n const revalidateSession = fetchSession;\n\n return {\n session,\n fetchSession,\n revalidateSession,\n setSession,\n };\n};\n"],"names":["configuration","defaultConfiguration"],"mappings":";;;;;;AAUO,MAAM,aAAa,CACxB,aACA,0BACG;AACH,QAAMA,kBAAgB,iBAAA;AACtB,QAAM,SAAS,yBAAyBA,mBAAiBC;AAEzD,QAAM,cAAc,eAAA;AAEpB,QAAM,EAAE,MAAM,WAAW,QAAA,IAAY,SAAS;AAAA,IAC5C,UAAU,CAAC,SAAS;AAAA,IACpB,SAAS,YAAY;AACnB,YAAM,cAAc,WAAW,MAAM;AACrC,YAAM,SAAS,MAAM,YAAY,WAAA;AACjC,aAAO,OAAO;AAAA,IAChB;AAAA,IACA,WAAW;AAAA,IACX,QAAQ;AAAA,IACR,SAAS,CAAC;AAAA,IACV,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,oBAAoB;AAAA,IACpB,iBAAiB;AAAA,IACjB,6BAA6B;AAAA,EAAA,CAC9B;AAED,QAAM,UAAU,SAAS,YAAY,OAAO;AAE5C,QAAM,aAAa,CAAC,gBAClB,YAAY,aAAa,CAAC,SAAS,GAAG,WAAW;AAEnD,QAAM,eAAe,YAAoD;AACvE,UAAM,MAAM,MAAM,QAAA;AAClB,WAAO,IAAI;AAAA,EACb;AAEA,QAAM,oBAAoB;AAE1B,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEJ;"}
@@ -5,8 +5,7 @@ const editorReact = require("@intlayer/editor-react");
5
5
  const hooks_auth = require("./auth.cjs");
6
6
  const hooks_useAuth_useAuth = require("./useAuth/useAuth.cjs");
7
7
  require("@intlayer/config/built");
8
- require("react");
9
- require("./useAsync/useAsyncStateStore.cjs");
8
+ require("@tanstack/react-query");
10
9
  const useIntlayerOAuth = (props) => {
11
10
  const configuration = editorReact.useConfiguration();
12
11
  const { oAuth2AccessToken } = hooks_useAuth_useAuth.useAuth();
@@ -14,7 +13,7 @@ const useIntlayerOAuth = (props) => {
14
13
  {
15
14
  ...oAuth2AccessToken && {
16
15
  headers: {
17
- Authorization: `Bearer ${oAuth2AccessToken}`
16
+ Authorization: `Bearer ${oAuth2AccessToken.accessToken}`
18
17
  }
19
18
  },
20
19
  ...props?.options ?? {}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayerAPI.cjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":["useConfiguration","useAuth","getIntlayerAPI","getAuthAPI"],"mappings":";;;;;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgBA,YAAAA,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsBC,8BAAA;AAE9B,SAAOC,IAAAA;AAAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,iBAAiB;AAAA,QAAA;AAAA,MAC5C;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgBF,YAAAA,iBAAA;AAEtB,SAAOG,sBAAW,OAAO,yBAAyB,aAAa;AACjE;;;"}
1
+ {"version":3,"file":"useIntlayerAPI.cjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken.accessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":["useConfiguration","useAuth","getIntlayerAPI","getAuthAPI"],"mappings":";;;;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgBA,YAAAA,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsBC,8BAAA;AAE9B,SAAOC,IAAAA;AAAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,kBAAkB,WAAW;AAAA,QAAA;AAAA,MACxD;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgBF,YAAAA,iBAAA;AAEtB,SAAOG,sBAAW,OAAO,yBAAyB,aAAa;AACjE;;;"}
@@ -3,8 +3,7 @@ import { useConfiguration } from "@intlayer/editor-react";
3
3
  import { getAuthAPI } from "./auth.mjs";
4
4
  import { useAuth } from "./useAuth/useAuth.mjs";
5
5
  import "@intlayer/config/built";
6
- import "react";
7
- import "./useAsync/useAsyncStateStore.mjs";
6
+ import "@tanstack/react-query";
8
7
  const useIntlayerOAuth = (props) => {
9
8
  const configuration = useConfiguration();
10
9
  const { oAuth2AccessToken } = useAuth();
@@ -12,7 +11,7 @@ const useIntlayerOAuth = (props) => {
12
11
  {
13
12
  ...oAuth2AccessToken && {
14
13
  headers: {
15
- Authorization: `Bearer ${oAuth2AccessToken}`
14
+ Authorization: `Bearer ${oAuth2AccessToken.accessToken}`
16
15
  }
17
16
  },
18
17
  ...props?.options ?? {}
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayerAPI.mjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":[],"mappings":";;;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgB,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsB,QAAA;AAE9B,SAAO;AAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,iBAAiB;AAAA,QAAA;AAAA,MAC5C;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgB,iBAAA;AAEtB,SAAO,WAAW,OAAO,yBAAyB,aAAa;AACjE;"}
1
+ {"version":3,"file":"useIntlayerAPI.mjs","sources":["../../src/hooks/useIntlayerAPI.ts"],"sourcesContent":["import {\n getIntlayerAPI,\n type FetcherOptions,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { type IntlayerConfig } from '@intlayer/config/client';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { getAuthAPI, type AuthAPI } from './auth';\nimport { useAuth } from './useAuth';\n\ntype UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n return getIntlayerAPI(\n {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken.accessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n },\n props?.intlayerConfiguration ?? configuration\n );\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n"],"names":[],"mappings":";;;;;;AAeO,MAAM,mBAAmB,CAAC,UAA8C;AAC7E,QAAM,gBAAgB,iBAAA;AACtB,QAAM,EAAE,kBAAA,IAAsB,QAAA;AAE9B,SAAO;AAAA,IACL;AAAA,MACE,GAAI,qBAAqB;AAAA,QACvB,SAAS;AAAA,UACP,eAAe,UAAU,kBAAkB,WAAW;AAAA,QAAA;AAAA,MACxD;AAAA,MAEF,GAAI,OAAO,WAAW,CAAA;AAAA,IAAC;AAAA,IAEzB,OAAO,yBAAyB;AAAA,EAAA;AAEpC;AAEO,MAAM,kBAAkB,CAAC,UAA0C;AACxE,QAAM,gBAAgB,iBAAA;AAEtB,SAAO,WAAW,OAAO,yBAAyB,aAAa;AACjE;"}
@@ -1,26 +1,23 @@
1
1
  "use client";
2
2
  "use strict";
3
3
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
- require("@intlayer/config/built");
5
- require("../../better-auth.CMQ3rA-I-C2nBKRMa.cjs");
6
- const hooks_intlayerAPIHooks = require("../intlayerAPIHooks.cjs");
7
- require("react");
8
- require("../useAsync/useAsyncStateStore.cjs");
4
+ const hooks_reactQuery = require("../reactQuery.cjs");
9
5
  const hooks_useAuth_useAuth = require("../useAuth/useAuth.cjs");
10
6
  require("@intlayer/api");
7
+ require("@intlayer/config/built");
11
8
  require("@intlayer/editor-react");
12
- require("deepmerge");
13
- require("../useScrollBlockage/useScrollBlockageStore.cjs");
9
+ require("@tanstack/react-query");
10
+ require("../../better-auth.CMQ3rA-I-C2nBKRMa.cjs");
14
11
  const useUser = () => {
15
12
  const { session, revalidateSession, setSession } = hooks_useAuth_useAuth.useAuth();
16
- const { logout } = hooks_intlayerAPIHooks.useLogout();
13
+ const { mutate: logout } = hooks_reactQuery.useLogout();
17
14
  const status = session?.user ? "authenticated" : "unauthenticated";
18
15
  const isAuthenticated = status === "authenticated";
19
16
  const isUnauthenticated = status === "unauthenticated";
20
17
  const user = session?.user;
21
18
  const logoutHandle = async () => {
22
19
  setSession(null);
23
- await logout();
20
+ logout({});
24
21
  };
25
22
  return {
26
23
  isAuthenticated,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '..';\nimport { useAuth } from '../useAuth';\n\nexport const useUser = () => {\n const { session, revalidateSession, setSession } = useAuth();\n const { logout } = useLogout();\n\n const status = session?.user ? 'authenticated' : 'unauthenticated';\n\n const isAuthenticated = status === 'authenticated';\n const isUnauthenticated = status === 'unauthenticated';\n\n const user = session?.user;\n\n const logoutHandle = async () => {\n setSession(null);\n await logout();\n };\n\n return {\n isAuthenticated,\n isUnauthenticated,\n user,\n revalidateSession,\n logout: logoutHandle,\n };\n};\n"],"names":["useAuth","useLogout"],"mappings":";;;;;;;;;;;;;AAKO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,SAAS,mBAAmB,WAAA,IAAeA,sBAAAA,QAAA;AACnD,QAAM,EAAE,OAAA,IAAWC,iCAAA;AAEnB,QAAM,SAAS,SAAS,OAAO,kBAAkB;AAEjD,QAAM,kBAAkB,WAAW;AACnC,QAAM,oBAAoB,WAAW;AAErC,QAAM,OAAO,SAAS;AAEtB,QAAM,eAAe,YAAY;AAC/B,eAAW,IAAI;AACf,UAAM,OAAA;AAAA,EACR;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EAAA;AAEZ;;"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '../reactQuery';\nimport { useAuth } from '../useAuth';\n\nexport const useUser = () => {\n const { session, revalidateSession, setSession } = useAuth();\n const { mutate: logout } = useLogout();\n\n const status = session?.user ? 'authenticated' : 'unauthenticated';\n\n const isAuthenticated = status === 'authenticated';\n const isUnauthenticated = status === 'unauthenticated';\n\n const user = session?.user;\n\n const logoutHandle = async () => {\n setSession(null);\n logout({});\n };\n\n return {\n isAuthenticated,\n isUnauthenticated,\n user,\n revalidateSession,\n logout: logoutHandle,\n };\n};\n"],"names":["useAuth","useLogout"],"mappings":";;;;;;;;;;AAKO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,SAAS,mBAAmB,WAAA,IAAeA,sBAAAA,QAAA;AACnD,QAAM,EAAE,QAAQ,OAAA,IAAWC,2BAAA;AAE3B,QAAM,SAAS,SAAS,OAAO,kBAAkB;AAEjD,QAAM,kBAAkB,WAAW;AACnC,QAAM,oBAAoB,WAAW;AAErC,QAAM,OAAO,SAAS;AAEtB,QAAM,eAAe,YAAY;AAC/B,eAAW,IAAI;AACf,WAAO,CAAA,CAAE;AAAA,EACX;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EAAA;AAEZ;;"}
@@ -1,24 +1,8 @@
1
1
  export declare const useUser: () => {
2
2
  isAuthenticated: boolean;
3
3
  isUnauthenticated: boolean;
4
- user: {
5
- email: string;
6
- name: string;
7
- image?: string | null | undefined;
8
- createdAt: Date;
9
- updatedAt: Date;
10
- emailVerified: boolean;
11
- phone?: string | undefined;
12
- dateOfBirth?: Date | undefined;
13
- id: string;
14
- emailsList?: {
15
- newsLetter: boolean;
16
- } | undefined;
17
- customerId?: string | undefined;
18
- role?: string | undefined;
19
- lang?: string | undefined;
20
- } | undefined;
21
- revalidateSession: () => Promise<import('@intlayer/backend').SessionAPI | null | undefined>;
4
+ user: any;
5
+ revalidateSession: () => Promise<SessionAPI | null | undefined>;
22
6
  logout: () => Promise<void>;
23
7
  };
24
8
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUser/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;CAuBnB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/hooks/useUser/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAM,OAAO;;;;;;CAuBnB,CAAC"}
@@ -1,24 +1,21 @@
1
1
  "use client";
2
- import "@intlayer/config/built";
3
- import "../../better-auth.CMQ3rA-I-7umXOENE.js";
4
- import { useLogout } from "../intlayerAPIHooks.mjs";
5
- import "react";
6
- import "../useAsync/useAsyncStateStore.mjs";
2
+ import { useLogout } from "../reactQuery.mjs";
7
3
  import { useAuth } from "../useAuth/useAuth.mjs";
8
4
  import "@intlayer/api";
5
+ import "@intlayer/config/built";
9
6
  import "@intlayer/editor-react";
10
- import "deepmerge";
11
- import "../useScrollBlockage/useScrollBlockageStore.mjs";
7
+ import "@tanstack/react-query";
8
+ import "../../better-auth.CMQ3rA-I-7umXOENE.js";
12
9
  const useUser = () => {
13
10
  const { session, revalidateSession, setSession } = useAuth();
14
- const { logout } = useLogout();
11
+ const { mutate: logout } = useLogout();
15
12
  const status = session?.user ? "authenticated" : "unauthenticated";
16
13
  const isAuthenticated = status === "authenticated";
17
14
  const isUnauthenticated = status === "unauthenticated";
18
15
  const user = session?.user;
19
16
  const logoutHandle = async () => {
20
17
  setSession(null);
21
- await logout();
18
+ logout({});
22
19
  };
23
20
  return {
24
21
  isAuthenticated,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '..';\nimport { useAuth } from '../useAuth';\n\nexport const useUser = () => {\n const { session, revalidateSession, setSession } = useAuth();\n const { logout } = useLogout();\n\n const status = session?.user ? 'authenticated' : 'unauthenticated';\n\n const isAuthenticated = status === 'authenticated';\n const isUnauthenticated = status === 'unauthenticated';\n\n const user = session?.user;\n\n const logoutHandle = async () => {\n setSession(null);\n await logout();\n };\n\n return {\n isAuthenticated,\n isUnauthenticated,\n user,\n revalidateSession,\n logout: logoutHandle,\n };\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAKO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,SAAS,mBAAmB,WAAA,IAAe,QAAA;AACnD,QAAM,EAAE,OAAA,IAAW,UAAA;AAEnB,QAAM,SAAS,SAAS,OAAO,kBAAkB;AAEjD,QAAM,kBAAkB,WAAW;AACnC,QAAM,oBAAoB,WAAW;AAErC,QAAM,OAAO,SAAS;AAEtB,QAAM,eAAe,YAAY;AAC/B,eAAW,IAAI;AACf,UAAM,OAAA;AAAA,EACR;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EAAA;AAEZ;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../src/hooks/useUser/index.ts"],"sourcesContent":["'use client';\n\nimport { useLogout } from '../reactQuery';\nimport { useAuth } from '../useAuth';\n\nexport const useUser = () => {\n const { session, revalidateSession, setSession } = useAuth();\n const { mutate: logout } = useLogout();\n\n const status = session?.user ? 'authenticated' : 'unauthenticated';\n\n const isAuthenticated = status === 'authenticated';\n const isUnauthenticated = status === 'unauthenticated';\n\n const user = session?.user;\n\n const logoutHandle = async () => {\n setSession(null);\n logout({});\n };\n\n return {\n isAuthenticated,\n isUnauthenticated,\n user,\n revalidateSession,\n logout: logoutHandle,\n };\n};\n"],"names":[],"mappings":";;;;;;;;AAKO,MAAM,UAAU,MAAM;AAC3B,QAAM,EAAE,SAAS,mBAAmB,WAAA,IAAe,QAAA;AACnD,QAAM,EAAE,QAAQ,OAAA,IAAW,UAAA;AAE3B,QAAM,SAAS,SAAS,OAAO,kBAAkB;AAEjD,QAAM,kBAAkB,WAAW;AACnC,QAAM,oBAAoB,WAAW;AAErC,QAAM,OAAO,SAAS;AAEtB,QAAM,eAAe,YAAY;AAC/B,eAAW,IAAI;AACf,WAAO,CAAA,CAAE;AAAA,EACX;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,QAAQ;AAAA,EAAA;AAEZ;"}
@@ -1 +1 @@
1
- {"version":3,"file":"index-BCuMWKyy.js","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.10_immer@9.0.21_react@19.1.1/node_modules/zustand/esm/react/shallow.mjs","../src/hooks/useScrollBlockage/index.tsx"],"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\nimport { useEffect } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetElementOrWindow } from '../useGetElementOrWindow';\n\nimport { useScrollBlockageStore } from './useScrollBlockageStore';\n\ntype useScrollBlockagePropsReadOnly = {\n disableScroll: undefined;\n key: undefined;\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\ntype useScrollBlockageProps = {\n disableScroll: boolean;\n key: string; // The key to identify the blockage to avoid conflicts. Required if disableScroll is defined\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\nexport const useScrollBlockage = (\n props?: useScrollBlockageProps | useScrollBlockagePropsReadOnly\n) => {\n const {\n disableScroll = false,\n element,\n key = 'unnamed_blocker',\n } = props ?? {};\n\n const { isElementScrollBlocked, addBlockage, removeBlockage } =\n useScrollBlockageStore(\n useShallow((s) => ({\n isElementScrollBlocked: s.isElementScrollBlocked,\n addBlockage: s.addBlockage,\n removeBlockage: s.removeBlockage,\n }))\n );\n\n const containerElement = useGetElementOrWindow(element);\n\n useEffect(() => {\n const el = element ?? window.document.body;\n\n if (disableScroll) {\n addBlockage(key, el);\n } else {\n removeBlockage(key, el);\n }\n }, [addBlockage, disableScroll, element, key, removeBlockage]);\n\n const isScrollBlocked = containerElement\n ? isElementScrollBlocked(containerElement)\n : false;\n\n return { isScrollBlocked };\n};\n"],"names":[],"mappings":";;;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI,EAAE,QAAQ;AAC7C,WAAO;AAAA,EACT;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;AAC3F,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,EAAE,OAAM,IAAK;AACnB,SAAS,WAAW,UAAU;AAC5B,QAAM,OAAO,OAAM;AACnB,SAAO,CAAC,UAAU;AAChB,UAAM,OAAO,SAAS,KAAK;AAC3B,WAAO,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,KAAK,UAAU;AAAA,EACrE;AACF;AC1BO,MAAM,oBAAoB,CAC/B,UACG;AACH,QAAM;AAAA,IACJ,gBAAgB;AAAA,IAChB;AAAA,IACA,MAAM;AAAA,EAAA,IACJ,SAAS,CAAA;AAEb,QAAM,EAAE,wBAAwB,aAAa,eAAA,IAC3C;AAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,wBAAwB,EAAE;AAAA,MAC1B,aAAa,EAAE;AAAA,MACf,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EAAA;AAGN,QAAM,mBAAmB,sBAAsB,OAAO;AAEtD,YAAU,MAAM;AACd,UAAM,KAAK,WAAW,OAAO,SAAS;AAEtC,QAAI,eAAe;AACjB,kBAAY,KAAK,EAAE;AAAA,IACrB,OAAO;AACL,qBAAe,KAAK,EAAE;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,SAAS,KAAK,cAAc,CAAC;AAE7D,QAAM,kBAAkB,mBACpB,uBAAuB,gBAAgB,IACvC;AAEJ,SAAO,EAAE,gBAAA;AACX;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index-BCuMWKyy.js","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.12_immer@9.0.21_react@19.1.1/node_modules/zustand/esm/react/shallow.mjs","../src/hooks/useScrollBlockage/index.tsx"],"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\nimport { useEffect } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetElementOrWindow } from '../useGetElementOrWindow';\n\nimport { useScrollBlockageStore } from './useScrollBlockageStore';\n\ntype useScrollBlockagePropsReadOnly = {\n disableScroll: undefined;\n key: undefined;\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\ntype useScrollBlockageProps = {\n disableScroll: boolean;\n key: string; // The key to identify the blockage to avoid conflicts. Required if disableScroll is defined\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\nexport const useScrollBlockage = (\n props?: useScrollBlockageProps | useScrollBlockagePropsReadOnly\n) => {\n const {\n disableScroll = false,\n element,\n key = 'unnamed_blocker',\n } = props ?? {};\n\n const { isElementScrollBlocked, addBlockage, removeBlockage } =\n useScrollBlockageStore(\n useShallow((s) => ({\n isElementScrollBlocked: s.isElementScrollBlocked,\n addBlockage: s.addBlockage,\n removeBlockage: s.removeBlockage,\n }))\n );\n\n const containerElement = useGetElementOrWindow(element);\n\n useEffect(() => {\n const el = element ?? window.document.body;\n\n if (disableScroll) {\n addBlockage(key, el);\n } else {\n removeBlockage(key, el);\n }\n }, [addBlockage, disableScroll, element, key, removeBlockage]);\n\n const isScrollBlocked = containerElement\n ? isElementScrollBlocked(containerElement)\n : false;\n\n return { isScrollBlocked };\n};\n"],"names":[],"mappings":";;;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI,EAAE,QAAQ;AAC7C,WAAO;AAAA,EACT;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;AAC3F,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,EAAE,OAAM,IAAK;AACnB,SAAS,WAAW,UAAU;AAC5B,QAAM,OAAO,OAAM;AACnB,SAAO,CAAC,UAAU;AAChB,UAAM,OAAO,SAAS,KAAK;AAC3B,WAAO,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,KAAK,UAAU;AAAA,EACrE;AACF;AC1BO,MAAM,oBAAoB,CAC/B,UACG;AACH,QAAM;AAAA,IACJ,gBAAgB;AAAA,IAChB;AAAA,IACA,MAAM;AAAA,EAAA,IACJ,SAAS,CAAA;AAEb,QAAM,EAAE,wBAAwB,aAAa,eAAA,IAC3C;AAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,wBAAwB,EAAE;AAAA,MAC1B,aAAa,EAAE;AAAA,MACf,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EAAA;AAGN,QAAM,mBAAmB,sBAAsB,OAAO;AAEtD,YAAU,MAAM;AACd,UAAM,KAAK,WAAW,OAAO,SAAS;AAEtC,QAAI,eAAe;AACjB,kBAAY,KAAK,EAAE;AAAA,IACrB,OAAO;AACL,qBAAe,KAAK,EAAE;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,SAAS,KAAK,cAAc,CAAC;AAE7D,QAAM,kBAAkB,mBACpB,uBAAuB,gBAAgB,IACvC;AAEJ,SAAO,EAAE,gBAAA;AACX;","x_google_ignoreList":[0]}
@@ -1 +1 @@
1
- {"version":3,"file":"index-BYzBot7l.cjs","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.10_immer@9.0.21_react@19.1.1/node_modules/zustand/esm/react/shallow.mjs","../src/hooks/useScrollBlockage/index.tsx"],"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\nimport { useEffect } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetElementOrWindow } from '../useGetElementOrWindow';\n\nimport { useScrollBlockageStore } from './useScrollBlockageStore';\n\ntype useScrollBlockagePropsReadOnly = {\n disableScroll: undefined;\n key: undefined;\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\ntype useScrollBlockageProps = {\n disableScroll: boolean;\n key: string; // The key to identify the blockage to avoid conflicts. Required if disableScroll is defined\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\nexport const useScrollBlockage = (\n props?: useScrollBlockageProps | useScrollBlockagePropsReadOnly\n) => {\n const {\n disableScroll = false,\n element,\n key = 'unnamed_blocker',\n } = props ?? {};\n\n const { isElementScrollBlocked, addBlockage, removeBlockage } =\n useScrollBlockageStore(\n useShallow((s) => ({\n isElementScrollBlocked: s.isElementScrollBlocked,\n addBlockage: s.addBlockage,\n removeBlockage: s.removeBlockage,\n }))\n );\n\n const containerElement = useGetElementOrWindow(element);\n\n useEffect(() => {\n const el = element ?? window.document.body;\n\n if (disableScroll) {\n addBlockage(key, el);\n } else {\n removeBlockage(key, el);\n }\n }, [addBlockage, disableScroll, element, key, removeBlockage]);\n\n const isScrollBlocked = containerElement\n ? isElementScrollBlocked(containerElement)\n : false;\n\n return { isScrollBlocked };\n};\n"],"names":["useScrollBlockageStore","useGetElementOrWindow","useEffect"],"mappings":";;;;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI,EAAE,QAAQ;AAC7C,WAAO;AAAA,EACT;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;AAC3F,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,EAAE,OAAM,IAAK;AACnB,SAAS,WAAW,UAAU;AAC5B,QAAM,OAAO,OAAM;AACnB,SAAO,CAAC,UAAU;AAChB,UAAM,OAAO,SAAS,KAAK;AAC3B,WAAO,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,KAAK,UAAU;AAAA,EACrE;AACF;AC1BO,MAAM,oBAAoB,CAC/B,UACG;AACH,QAAM;AAAA,IACJ,gBAAgB;AAAA,IAChB;AAAA,IACA,MAAM;AAAA,EAAA,IACJ,SAAS,CAAA;AAEb,QAAM,EAAE,wBAAwB,aAAa,eAAA,IAC3CA,+CAAAA;AAAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,wBAAwB,EAAE;AAAA,MAC1B,aAAa,EAAE;AAAA,MACf,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EAAA;AAGN,QAAM,mBAAmBC,4BAAAA,sBAAsB,OAAO;AAEtDC,eAAAA,UAAU,MAAM;AACd,UAAM,KAAK,WAAW,OAAO,SAAS;AAEtC,QAAI,eAAe;AACjB,kBAAY,KAAK,EAAE;AAAA,IACrB,OAAO;AACL,qBAAe,KAAK,EAAE;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,SAAS,KAAK,cAAc,CAAC;AAE7D,QAAM,kBAAkB,mBACpB,uBAAuB,gBAAgB,IACvC;AAEJ,SAAO,EAAE,gBAAA;AACX;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"index-BYzBot7l.cjs","sources":["../../../../node_modules/.pnpm/zustand@4.5.7_@types+react@19.1.12_immer@9.0.21_react@19.1.1/node_modules/zustand/esm/react/shallow.mjs","../src/hooks/useScrollBlockage/index.tsx"],"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\nimport { useEffect } from 'react';\nimport { useShallow } from 'zustand/react/shallow';\nimport { useGetElementOrWindow } from '../useGetElementOrWindow';\n\nimport { useScrollBlockageStore } from './useScrollBlockageStore';\n\ntype useScrollBlockagePropsReadOnly = {\n disableScroll: undefined;\n key: undefined;\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\ntype useScrollBlockageProps = {\n disableScroll: boolean;\n key: string; // The key to identify the blockage to avoid conflicts. Required if disableScroll is defined\n element?: HTMLElement; // The element to block the scroll. If not defined, the window will be used\n};\n\nexport const useScrollBlockage = (\n props?: useScrollBlockageProps | useScrollBlockagePropsReadOnly\n) => {\n const {\n disableScroll = false,\n element,\n key = 'unnamed_blocker',\n } = props ?? {};\n\n const { isElementScrollBlocked, addBlockage, removeBlockage } =\n useScrollBlockageStore(\n useShallow((s) => ({\n isElementScrollBlocked: s.isElementScrollBlocked,\n addBlockage: s.addBlockage,\n removeBlockage: s.removeBlockage,\n }))\n );\n\n const containerElement = useGetElementOrWindow(element);\n\n useEffect(() => {\n const el = element ?? window.document.body;\n\n if (disableScroll) {\n addBlockage(key, el);\n } else {\n removeBlockage(key, el);\n }\n }, [addBlockage, disableScroll, element, key, removeBlockage]);\n\n const isScrollBlocked = containerElement\n ? isElementScrollBlocked(containerElement)\n : false;\n\n return { isScrollBlocked };\n};\n"],"names":["useScrollBlockageStore","useGetElementOrWindow","useEffect"],"mappings":";;;;;AAEA,SAAS,QAAQ,MAAM,MAAM;AAC3B,MAAI,OAAO,GAAG,MAAM,IAAI,GAAG;AACzB,WAAO;AAAA,EACT;AACA,MAAI,OAAO,SAAS,YAAY,SAAS,QAAQ,OAAO,SAAS,YAAY,SAAS,MAAM;AAC1F,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,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,MACT;AAAA,IACF;AACA,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,OAAO,KAAK,IAAI;AAC9B,MAAI,MAAM,WAAW,OAAO,KAAK,IAAI,EAAE,QAAQ;AAC7C,WAAO;AAAA,EACT;AACA,aAAW,QAAQ,OAAO;AACxB,QAAI,CAAC,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,GAAG,KAAK,IAAI,GAAG,KAAK,IAAI,CAAC,GAAG;AAC3F,aAAO;AAAA,IACT;AAAA,EACF;AACA,SAAO;AACT;AAEA,MAAM,EAAE,OAAM,IAAK;AACnB,SAAS,WAAW,UAAU;AAC5B,QAAM,OAAO,OAAM;AACnB,SAAO,CAAC,UAAU;AAChB,UAAM,OAAO,SAAS,KAAK;AAC3B,WAAO,QAAQ,KAAK,SAAS,IAAI,IAAI,KAAK,UAAU,KAAK,UAAU;AAAA,EACrE;AACF;AC1BO,MAAM,oBAAoB,CAC/B,UACG;AACH,QAAM;AAAA,IACJ,gBAAgB;AAAA,IAChB;AAAA,IACA,MAAM;AAAA,EAAA,IACJ,SAAS,CAAA;AAEb,QAAM,EAAE,wBAAwB,aAAa,eAAA,IAC3CA,+CAAAA;AAAAA,IACE,WAAW,CAAC,OAAO;AAAA,MACjB,wBAAwB,EAAE;AAAA,MAC1B,aAAa,EAAE;AAAA,MACf,gBAAgB,EAAE;AAAA,IAAA,EAClB;AAAA,EAAA;AAGN,QAAM,mBAAmBC,4BAAAA,sBAAsB,OAAO;AAEtDC,eAAAA,UAAU,MAAM;AACd,UAAM,KAAK,WAAW,OAAO,SAAS;AAEtC,QAAI,eAAe;AACjB,kBAAY,KAAK,EAAE;AAAA,IACrB,OAAO;AACL,qBAAe,KAAK,EAAE;AAAA,IACxB;AAAA,EACF,GAAG,CAAC,aAAa,eAAe,SAAS,KAAK,cAAc,CAAC;AAE7D,QAAM,kBAAkB,mBACpB,uBAAuB,gBAAgB,IACvC;AAEJ,SAAO,EAAE,gBAAA;AACX;;;","x_google_ignoreList":[0]}
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const jsxRuntime = require("react/jsx-runtime");
5
+ const reactQuery = require("@tanstack/react-query");
6
+ require("../components/Toaster/Toast.cjs");
7
+ const components_Toaster_useToast = require("../components/Toaster/useToast.cjs");
8
+ var define_process_env_default = {};
9
+ const defaultQueryOptions = {
10
+ queries: {
11
+ retry: 1,
12
+ refetchOnWindowFocus: false,
13
+ staleTime: 0,
14
+ gcTime: 1e3 * 60 * 10
15
+ // 10 minutes
16
+ },
17
+ mutations: {
18
+ retry: 0
19
+ }
20
+ };
21
+ const formatErrorCode = (errorCode) => errorCode.split("_").join(" ");
22
+ const useToastEvents = () => {
23
+ const { toast } = components_Toaster_useToast.useToast();
24
+ const onError = (error) => {
25
+ const parsed = (() => {
26
+ try {
27
+ if (typeof error === "string") return JSON.parse(error);
28
+ } catch (_) {
29
+ }
30
+ return error;
31
+ })();
32
+ [parsed].flat().forEach(
33
+ (err) => toast({
34
+ title: formatErrorCode(
35
+ (define_process_env_default.NODE_ENV === "production" ? err?.title : err?.code) ?? "Error"
36
+ ),
37
+ description: err?.message ?? String(err ?? "An error occurred"),
38
+ variant: "error"
39
+ })
40
+ );
41
+ };
42
+ const onSuccess = (data) => {
43
+ if (data?.error) {
44
+ toast({
45
+ title: formatErrorCode(data.error.title ?? data.error.code ?? "Error"),
46
+ description: data.error.message ?? data.error.code ?? "An error occurred",
47
+ variant: "error"
48
+ });
49
+ }
50
+ if (data?.message) {
51
+ toast({
52
+ title: data.message,
53
+ description: data.description,
54
+ variant: "success"
55
+ });
56
+ }
57
+ };
58
+ return {
59
+ onError,
60
+ onSuccess
61
+ };
62
+ };
63
+ const ReactQueryProvider = ({ children }) => {
64
+ const { onError, onSuccess } = useToastEvents();
65
+ const mutationCache = new reactQuery.MutationCache({
66
+ onSuccess,
67
+ onError,
68
+ onSettled: (_data, _error, _variables, _context, mutation) => {
69
+ if (mutation.meta?.invalidateQueries) {
70
+ mutation.meta.invalidateQueries.forEach((queryKey) => {
71
+ queryClient.invalidateQueries({
72
+ queryKey
73
+ });
74
+ });
75
+ }
76
+ }
77
+ });
78
+ const queryClient = new reactQuery.QueryClient({
79
+ defaultOptions: defaultQueryOptions,
80
+ mutationCache
81
+ });
82
+ return /* @__PURE__ */ jsxRuntime.jsx(reactQuery.QueryClientProvider, { client: queryClient, children });
83
+ };
84
+ exports.ReactQueryProvider = ReactQueryProvider;
85
+ //# sourceMappingURL=ReactQueryProvider.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactQueryProvider.cjs","sources":["../../src/providers/ReactQueryProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n MutationCache,\n QueryClient,\n QueryClientProvider,\n QueryKey,\n UseMutationOptions,\n type DefaultOptions,\n} from '@tanstack/react-query';\nimport { type FC, type PropsWithChildren } from 'react';\nimport { useToast } from '../components/Toaster';\n\nconst defaultQueryOptions: DefaultOptions = {\n queries: {\n retry: 1,\n refetchOnWindowFocus: false,\n staleTime: 0,\n gcTime: 1000 * 60 * 10, // 10 minutes\n },\n mutations: {\n retry: 0,\n },\n};\n\ndeclare module '@tanstack/react-query' {\n interface Register {\n mutationMeta: {\n onSuccess?: UseMutationOptions['onSuccess'];\n onError?: UseMutationOptions['onError'];\n invalidateQueries?: QueryKey[];\n };\n }\n}\n\nconst formatErrorCode = (errorCode: string) => errorCode.split('_').join(' ');\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useToastEvents = () => {\n const { toast } = useToast();\n\n const onError: MutationCache['config']['onError'] = (error: any) => {\n const parsed = (() => {\n try {\n if (typeof error === 'string') return JSON.parse(error);\n } catch (_) {}\n return error;\n })();\n\n [parsed].flat().forEach((err: any) =>\n toast({\n title: formatErrorCode(\n (process.env.NODE_ENV === 'production' ? err?.title : err?.code) ??\n 'Error'\n ),\n description: err?.message ?? String(err ?? 'An error occurred'),\n variant: 'error',\n })\n );\n };\n\n const onSuccess: MutationCache['config']['onSuccess'] = (data: any) => {\n if (data?.error) {\n toast({\n title: formatErrorCode(data.error.title ?? data.error.code ?? 'Error'),\n description:\n data.error.message ?? data.error.code ?? 'An error occurred',\n variant: 'error',\n });\n }\n\n if (data?.message) {\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n }\n };\n\n return {\n onError,\n onSuccess,\n };\n};\n\nexport const ReactQueryProvider: FC<PropsWithChildren> = ({ children }) => {\n const { onError, onSuccess } = useToastEvents();\n\n const mutationCache = new MutationCache({\n onSuccess,\n onError,\n onSettled: (_data, _error, _variables, _context, mutation) => {\n if (mutation.meta?.invalidateQueries) {\n mutation.meta.invalidateQueries.forEach((queryKey) => {\n queryClient.invalidateQueries({\n queryKey,\n });\n });\n }\n },\n });\n\n const queryClient = new QueryClient({\n defaultOptions: defaultQueryOptions,\n mutationCache,\n });\n\n return (\n <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n );\n};\n"],"names":["useToast","MutationCache","QueryClient","QueryClientProvider"],"mappings":";;;;;;;;AAaA,MAAM,sBAAsC;AAAA,EAC1C,SAAS;AAAA,IACP,OAAO;AAAA,IACP,sBAAsB;AAAA,IACtB,WAAW;AAAA,IACX,QAAQ,MAAO,KAAK;AAAA;AAAA,EAAA;AAAA,EAEtB,WAAW;AAAA,IACT,OAAO;AAAA,EAAA;AAEX;AAYA,MAAM,kBAAkB,CAAC,cAAsB,UAAU,MAAM,GAAG,EAAE,KAAK,GAAG;AAK5E,MAAM,iBAAiB,MAAM;AAC3B,QAAM,EAAE,MAAA,IAAUA,qCAAA;AAElB,QAAM,UAA8C,CAAC,UAAe;AAClE,UAAM,UAAU,MAAM;AACpB,UAAI;AACF,YAAI,OAAO,UAAU,SAAU,QAAO,KAAK,MAAM,KAAK;AAAA,MACxD,SAAS,GAAG;AAAA,MAAC;AACb,aAAO;AAAA,IACT,GAAA;AAEA,KAAC,MAAM,EAAE,KAAA,EAAO;AAAA,MAAQ,CAAC,QACvB,MAAM;AAAA,QACJ,OAAO;AAAA,WACJ,2BAAY,aAAa,eAAe,KAAK,QAAQ,KAAK,SACzD;AAAA,QAAA;AAAA,QAEJ,aAAa,KAAK,WAAW,OAAO,OAAO,mBAAmB;AAAA,QAC9D,SAAS;AAAA,MAAA,CACV;AAAA,IAAA;AAAA,EAEL;AAEA,QAAM,YAAkD,CAAC,SAAc;AACrE,QAAI,MAAM,OAAO;AACf,YAAM;AAAA,QACJ,OAAO,gBAAgB,KAAK,MAAM,SAAS,KAAK,MAAM,QAAQ,OAAO;AAAA,QACrE,aACE,KAAK,MAAM,WAAW,KAAK,MAAM,QAAQ;AAAA,QAC3C,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM;AAAA,QACJ,OAAO,KAAK;AAAA,QACZ,aAAa,KAAK;AAAA,QAClB,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,qBAA4C,CAAC,EAAE,eAAe;AACzE,QAAM,EAAE,SAAS,UAAA,IAAc,eAAA;AAE/B,QAAM,gBAAgB,IAAIC,yBAAc;AAAA,IACtC;AAAA,IACA;AAAA,IACA,WAAW,CAAC,OAAO,QAAQ,YAAY,UAAU,aAAa;AAC5D,UAAI,SAAS,MAAM,mBAAmB;AACpC,iBAAS,KAAK,kBAAkB,QAAQ,CAAC,aAAa;AACpD,sBAAY,kBAAkB;AAAA,YAC5B;AAAA,UAAA,CACD;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,cAAc,IAAIC,uBAAY;AAAA,IAClC,gBAAgB;AAAA,IAChB;AAAA,EAAA,CACD;AAED,wCACGC,WAAAA,qBAAA,EAAoB,QAAQ,aAAc,UAAS;AAExD;;"}
@@ -0,0 +1,13 @@
1
+ import { QueryKey, UseMutationOptions } from '@tanstack/react-query';
2
+ import { FC, PropsWithChildren } from 'react';
3
+ declare module '@tanstack/react-query' {
4
+ interface Register {
5
+ mutationMeta: {
6
+ onSuccess?: UseMutationOptions['onSuccess'];
7
+ onError?: UseMutationOptions['onError'];
8
+ invalidateQueries?: QueryKey[];
9
+ };
10
+ }
11
+ }
12
+ export declare const ReactQueryProvider: FC<PropsWithChildren>;
13
+ //# sourceMappingURL=ReactQueryProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactQueryProvider.d.ts","sourceRoot":"","sources":["../../src/providers/ReactQueryProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIL,QAAQ,EACR,kBAAkB,EAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAexD,OAAO,QAAQ,uBAAuB,CAAC;IACrC,UAAU,QAAQ;QAChB,YAAY,EAAE;YACZ,SAAS,CAAC,EAAE,kBAAkB,CAAC,WAAW,CAAC,CAAC;YAC5C,OAAO,CAAC,EAAE,kBAAkB,CAAC,SAAS,CAAC,CAAC;YACxC,iBAAiB,CAAC,EAAE,QAAQ,EAAE,CAAC;SAChC,CAAC;KACH;CACF;AAuDD,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC,iBAAiB,CAyBpD,CAAC"}
@@ -0,0 +1,85 @@
1
+ "use client";
2
+ import { jsx } from "react/jsx-runtime";
3
+ import { MutationCache, QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
+ import "../components/Toaster/Toast.mjs";
5
+ import { useToast } from "../components/Toaster/useToast.mjs";
6
+ var define_process_env_default = {};
7
+ const defaultQueryOptions = {
8
+ queries: {
9
+ retry: 1,
10
+ refetchOnWindowFocus: false,
11
+ staleTime: 0,
12
+ gcTime: 1e3 * 60 * 10
13
+ // 10 minutes
14
+ },
15
+ mutations: {
16
+ retry: 0
17
+ }
18
+ };
19
+ const formatErrorCode = (errorCode) => errorCode.split("_").join(" ");
20
+ const useToastEvents = () => {
21
+ const { toast } = useToast();
22
+ const onError = (error) => {
23
+ const parsed = (() => {
24
+ try {
25
+ if (typeof error === "string") return JSON.parse(error);
26
+ } catch (_) {
27
+ }
28
+ return error;
29
+ })();
30
+ [parsed].flat().forEach(
31
+ (err) => toast({
32
+ title: formatErrorCode(
33
+ (define_process_env_default.NODE_ENV === "production" ? err?.title : err?.code) ?? "Error"
34
+ ),
35
+ description: err?.message ?? String(err ?? "An error occurred"),
36
+ variant: "error"
37
+ })
38
+ );
39
+ };
40
+ const onSuccess = (data) => {
41
+ if (data?.error) {
42
+ toast({
43
+ title: formatErrorCode(data.error.title ?? data.error.code ?? "Error"),
44
+ description: data.error.message ?? data.error.code ?? "An error occurred",
45
+ variant: "error"
46
+ });
47
+ }
48
+ if (data?.message) {
49
+ toast({
50
+ title: data.message,
51
+ description: data.description,
52
+ variant: "success"
53
+ });
54
+ }
55
+ };
56
+ return {
57
+ onError,
58
+ onSuccess
59
+ };
60
+ };
61
+ const ReactQueryProvider = ({ children }) => {
62
+ const { onError, onSuccess } = useToastEvents();
63
+ const mutationCache = new MutationCache({
64
+ onSuccess,
65
+ onError,
66
+ onSettled: (_data, _error, _variables, _context, mutation) => {
67
+ if (mutation.meta?.invalidateQueries) {
68
+ mutation.meta.invalidateQueries.forEach((queryKey) => {
69
+ queryClient.invalidateQueries({
70
+ queryKey
71
+ });
72
+ });
73
+ }
74
+ }
75
+ });
76
+ const queryClient = new QueryClient({
77
+ defaultOptions: defaultQueryOptions,
78
+ mutationCache
79
+ });
80
+ return /* @__PURE__ */ jsx(QueryClientProvider, { client: queryClient, children });
81
+ };
82
+ export {
83
+ ReactQueryProvider
84
+ };
85
+ //# sourceMappingURL=ReactQueryProvider.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ReactQueryProvider.mjs","sources":["../../src/providers/ReactQueryProvider.tsx"],"sourcesContent":["'use client';\n\nimport {\n MutationCache,\n QueryClient,\n QueryClientProvider,\n QueryKey,\n UseMutationOptions,\n type DefaultOptions,\n} from '@tanstack/react-query';\nimport { type FC, type PropsWithChildren } from 'react';\nimport { useToast } from '../components/Toaster';\n\nconst defaultQueryOptions: DefaultOptions = {\n queries: {\n retry: 1,\n refetchOnWindowFocus: false,\n staleTime: 0,\n gcTime: 1000 * 60 * 10, // 10 minutes\n },\n mutations: {\n retry: 0,\n },\n};\n\ndeclare module '@tanstack/react-query' {\n interface Register {\n mutationMeta: {\n onSuccess?: UseMutationOptions['onSuccess'];\n onError?: UseMutationOptions['onError'];\n invalidateQueries?: QueryKey[];\n };\n }\n}\n\nconst formatErrorCode = (errorCode: string) => errorCode.split('_').join(' ');\n\n/**\n * Hook to handle error logging and toast notifications\n */\nconst useToastEvents = () => {\n const { toast } = useToast();\n\n const onError: MutationCache['config']['onError'] = (error: any) => {\n const parsed = (() => {\n try {\n if (typeof error === 'string') return JSON.parse(error);\n } catch (_) {}\n return error;\n })();\n\n [parsed].flat().forEach((err: any) =>\n toast({\n title: formatErrorCode(\n (process.env.NODE_ENV === 'production' ? err?.title : err?.code) ??\n 'Error'\n ),\n description: err?.message ?? String(err ?? 'An error occurred'),\n variant: 'error',\n })\n );\n };\n\n const onSuccess: MutationCache['config']['onSuccess'] = (data: any) => {\n if (data?.error) {\n toast({\n title: formatErrorCode(data.error.title ?? data.error.code ?? 'Error'),\n description:\n data.error.message ?? data.error.code ?? 'An error occurred',\n variant: 'error',\n });\n }\n\n if (data?.message) {\n toast({\n title: data.message,\n description: data.description,\n variant: 'success',\n });\n }\n };\n\n return {\n onError,\n onSuccess,\n };\n};\n\nexport const ReactQueryProvider: FC<PropsWithChildren> = ({ children }) => {\n const { onError, onSuccess } = useToastEvents();\n\n const mutationCache = new MutationCache({\n onSuccess,\n onError,\n onSettled: (_data, _error, _variables, _context, mutation) => {\n if (mutation.meta?.invalidateQueries) {\n mutation.meta.invalidateQueries.forEach((queryKey) => {\n queryClient.invalidateQueries({\n queryKey,\n });\n });\n }\n },\n });\n\n const queryClient = new QueryClient({\n defaultOptions: defaultQueryOptions,\n mutationCache,\n });\n\n return (\n <QueryClientProvider client={queryClient}>{children}</QueryClientProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;AAaA,MAAM,sBAAsC;AAAA,EAC1C,SAAS;AAAA,IACP,OAAO;AAAA,IACP,sBAAsB;AAAA,IACtB,WAAW;AAAA,IACX,QAAQ,MAAO,KAAK;AAAA;AAAA,EAAA;AAAA,EAEtB,WAAW;AAAA,IACT,OAAO;AAAA,EAAA;AAEX;AAYA,MAAM,kBAAkB,CAAC,cAAsB,UAAU,MAAM,GAAG,EAAE,KAAK,GAAG;AAK5E,MAAM,iBAAiB,MAAM;AAC3B,QAAM,EAAE,MAAA,IAAU,SAAA;AAElB,QAAM,UAA8C,CAAC,UAAe;AAClE,UAAM,UAAU,MAAM;AACpB,UAAI;AACF,YAAI,OAAO,UAAU,SAAU,QAAO,KAAK,MAAM,KAAK;AAAA,MACxD,SAAS,GAAG;AAAA,MAAC;AACb,aAAO;AAAA,IACT,GAAA;AAEA,KAAC,MAAM,EAAE,KAAA,EAAO;AAAA,MAAQ,CAAC,QACvB,MAAM;AAAA,QACJ,OAAO;AAAA,WACJ,2BAAY,aAAa,eAAe,KAAK,QAAQ,KAAK,SACzD;AAAA,QAAA;AAAA,QAEJ,aAAa,KAAK,WAAW,OAAO,OAAO,mBAAmB;AAAA,QAC9D,SAAS;AAAA,MAAA,CACV;AAAA,IAAA;AAAA,EAEL;AAEA,QAAM,YAAkD,CAAC,SAAc;AACrE,QAAI,MAAM,OAAO;AACf,YAAM;AAAA,QACJ,OAAO,gBAAgB,KAAK,MAAM,SAAS,KAAK,MAAM,QAAQ,OAAO;AAAA,QACrE,aACE,KAAK,MAAM,WAAW,KAAK,MAAM,QAAQ;AAAA,QAC3C,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAEA,QAAI,MAAM,SAAS;AACjB,YAAM;AAAA,QACJ,OAAO,KAAK;AAAA,QACZ,aAAa,KAAK;AAAA,QAClB,SAAS;AAAA,MAAA,CACV;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,EAAA;AAEJ;AAEO,MAAM,qBAA4C,CAAC,EAAE,eAAe;AACzE,QAAM,EAAE,SAAS,UAAA,IAAc,eAAA;AAE/B,QAAM,gBAAgB,IAAI,cAAc;AAAA,IACtC;AAAA,IACA;AAAA,IACA,WAAW,CAAC,OAAO,QAAQ,YAAY,UAAU,aAAa;AAC5D,UAAI,SAAS,MAAM,mBAAmB;AACpC,iBAAS,KAAK,kBAAkB,QAAQ,CAAC,aAAa;AACpD,sBAAY,kBAAkB;AAAA,YAC5B;AAAA,UAAA,CACD;AAAA,QACH,CAAC;AAAA,MACH;AAAA,IACF;AAAA,EAAA,CACD;AAED,QAAM,cAAc,IAAI,YAAY;AAAA,IAClC,gBAAgB;AAAA,IAChB;AAAA,EAAA,CACD;AAED,6BACG,qBAAA,EAAoB,QAAQ,aAAc,UAAS;AAExD;"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const providers_ReactQueryProvider = require("./ReactQueryProvider.cjs");
4
+ exports.ReactQueryProvider = providers_ReactQueryProvider.ReactQueryProvider;
5
+ //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
1
+ {"version":3,"file":"index.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
@@ -0,0 +1,2 @@
1
+ export * from './ReactQueryProvider';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/providers/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { ReactQueryProvider } from "./ReactQueryProvider.mjs";
2
+ export {
3
+ ReactQueryProvider
4
+ };
5
+ //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";"}