@intlayer/design-system 3.0.2 → 3.1.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 (482) hide show
  1. package/dist/.vite/manifest.json +521 -395
  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/components/Accordion/Accordion.d.ts +0 -1
  35. package/dist/components/Auth/AuthModal/index.d.ts +0 -1
  36. package/dist/components/Auth/AuthProvider/index.cjs +5 -21
  37. package/dist/components/Auth/AuthProvider/index.cjs.map +1 -1
  38. package/dist/components/Auth/AuthProvider/index.d.ts +4 -3
  39. package/dist/components/Auth/AuthProvider/index.d.ts.map +1 -1
  40. package/dist/components/Auth/AuthProvider/index.mjs +6 -22
  41. package/dist/components/Auth/AuthProvider/index.mjs.map +1 -1
  42. package/dist/components/Auth/AuthProvider/useSession.cjs +7 -3
  43. package/dist/components/Auth/AuthProvider/useSession.cjs.map +1 -1
  44. package/dist/components/Auth/AuthProvider/useSession.d.ts +0 -1
  45. package/dist/components/Auth/AuthProvider/useSession.d.ts.map +1 -1
  46. package/dist/components/Auth/AuthProvider/useSession.mjs +7 -3
  47. package/dist/components/Auth/AuthProvider/useSession.mjs.map +1 -1
  48. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierClient.d.ts +0 -1
  49. package/dist/components/Auth/AuthenticationBarrier/AuthenticationBarrierServer.d.ts +0 -1
  50. package/dist/components/Auth/AuthenticationBarrier/accessValidation.d.ts +0 -1
  51. package/dist/components/Auth/AuthenticationBarrier/index.d.ts +0 -1
  52. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.cjs +1 -1
  53. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.d.ts +0 -1
  54. package/dist/components/Auth/ChangePasswordForm/ChangePasswordForm.mjs +1 -1
  55. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.cjs.map +1 -1
  56. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.d.ts +0 -1
  57. package/dist/components/Auth/ChangePasswordForm/ChangePasswordSchema.mjs.map +1 -1
  58. package/dist/components/Auth/ChangePasswordForm/index.content.cjs.map +1 -1
  59. package/dist/components/Auth/ChangePasswordForm/index.content.d.ts +10 -10
  60. package/dist/components/Auth/ChangePasswordForm/index.content.mjs.map +1 -1
  61. package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.d.ts +0 -1
  62. package/dist/components/Auth/ExternalsLoginButtons/assets/GithubLogo.d.ts +0 -1
  63. package/dist/components/Auth/ExternalsLoginButtons/assets/GoogleLogo.d.ts +0 -1
  64. package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs.map +1 -1
  65. package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.d.ts +5 -5
  66. package/dist/components/Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs.map +1 -1
  67. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.cjs +1 -1
  68. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.d.ts +0 -1
  69. package/dist/components/Auth/ResetPasswordForm/ResetPasswordForm.mjs +1 -1
  70. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.cjs.map +1 -1
  71. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.d.ts +0 -1
  72. package/dist/components/Auth/ResetPasswordForm/ResetPasswordSchema.mjs.map +1 -1
  73. package/dist/components/Auth/ResetPasswordForm/index.content.cjs.map +1 -1
  74. package/dist/components/Auth/ResetPasswordForm/index.content.d.ts +7 -7
  75. package/dist/components/Auth/ResetPasswordForm/index.content.mjs.map +1 -1
  76. package/dist/components/Auth/SignInForm/SignInForm.cjs +1 -1
  77. package/dist/components/Auth/SignInForm/SignInForm.d.ts +0 -1
  78. package/dist/components/Auth/SignInForm/SignInForm.mjs +1 -1
  79. package/dist/components/Auth/SignInForm/SignInSchema.cjs.map +1 -1
  80. package/dist/components/Auth/SignInForm/SignInSchema.d.ts +0 -1
  81. package/dist/components/Auth/SignInForm/SignInSchema.mjs.map +1 -1
  82. package/dist/components/Auth/SignInForm/index.content.cjs.map +1 -1
  83. package/dist/components/Auth/SignInForm/index.content.d.ts +13 -13
  84. package/dist/components/Auth/SignInForm/index.content.mjs.map +1 -1
  85. package/dist/components/Auth/SignUpForm/SignUpForm.cjs +1 -1
  86. package/dist/components/Auth/SignUpForm/SignUpForm.d.ts +0 -1
  87. package/dist/components/Auth/SignUpForm/SignUpForm.mjs +1 -1
  88. package/dist/components/Auth/SignUpForm/SignUpSchema.cjs.map +1 -1
  89. package/dist/components/Auth/SignUpForm/SignUpSchema.d.ts +0 -1
  90. package/dist/components/Auth/SignUpForm/SignUpSchema.mjs.map +1 -1
  91. package/dist/components/Auth/SignUpForm/index.content.cjs.map +1 -1
  92. package/dist/components/Auth/SignUpForm/index.content.d.ts +11 -11
  93. package/dist/components/Auth/SignUpForm/index.content.mjs.map +1 -1
  94. package/dist/components/Avatar/index.d.ts +0 -1
  95. package/dist/components/Badge/index.d.ts +1 -2
  96. package/dist/components/Breadcrumb/index.d.ts +0 -1
  97. package/dist/components/Button/Button.cjs +1 -0
  98. package/dist/components/Button/Button.cjs.map +1 -1
  99. package/dist/components/Button/Button.d.ts +2 -3
  100. package/dist/components/Button/Button.d.ts.map +1 -1
  101. package/dist/components/Button/Button.mjs +1 -0
  102. package/dist/components/Button/Button.mjs.map +1 -1
  103. package/dist/components/Command/index.d.ts +9 -10
  104. package/dist/components/Command/index.d.ts.map +1 -1
  105. package/dist/components/Container/index.cjs.map +1 -1
  106. package/dist/components/Container/index.d.ts +16 -3
  107. package/dist/components/Container/index.d.ts.map +1 -1
  108. package/dist/components/Container/index.mjs.map +1 -1
  109. package/dist/components/ContentEditor/ContentEditor.d.ts +0 -1
  110. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +0 -1
  111. package/dist/components/ContentSelector/ContentSelector.d.ts +0 -1
  112. package/dist/components/CopyToClipboard/index.d.ts +0 -1
  113. package/dist/components/DictionaryEditor/DictionaryEditor.cjs +30 -24
  114. package/dist/components/DictionaryEditor/DictionaryEditor.cjs.map +1 -1
  115. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts +0 -7
  116. package/dist/components/DictionaryEditor/DictionaryEditor.d.ts.map +1 -1
  117. package/dist/components/DictionaryEditor/DictionaryEditor.mjs +30 -24
  118. package/dist/components/DictionaryEditor/DictionaryEditor.mjs.map +1 -1
  119. package/dist/components/DictionaryEditor/ItemLayout.cjs +1 -0
  120. package/dist/components/DictionaryEditor/ItemLayout.cjs.map +1 -1
  121. package/dist/components/DictionaryEditor/ItemLayout.d.ts +0 -1
  122. package/dist/components/DictionaryEditor/ItemLayout.d.ts.map +1 -1
  123. package/dist/components/DictionaryEditor/ItemLayout.mjs +1 -0
  124. package/dist/components/DictionaryEditor/ItemLayout.mjs.map +1 -1
  125. package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.d.ts +0 -1
  126. package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.d.ts +0 -1
  127. package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.d.ts +0 -1
  128. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs +7 -5
  129. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
  130. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.d.ts +0 -1
  131. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +7 -5
  132. package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
  133. package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.d.ts +0 -1
  134. package/dist/components/DictionaryEditor/NodeWrapper/index.d.ts +0 -1
  135. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +111 -19
  136. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  137. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts +1 -5
  138. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.d.ts.map +1 -1
  139. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +112 -20
  140. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  141. package/dist/components/DictionaryEditor/useEditedContentStore.cjs +18 -20
  142. package/dist/components/DictionaryEditor/useEditedContentStore.cjs.map +1 -1
  143. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts +0 -1
  144. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts.map +1 -1
  145. package/dist/components/DictionaryEditor/useEditedContentStore.mjs +19 -21
  146. package/dist/components/DictionaryEditor/useEditedContentStore.mjs.map +1 -1
  147. package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts +0 -1
  148. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs +67 -0
  149. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.cjs.map +1 -0
  150. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts +27 -0
  151. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.d.ts.map +1 -0
  152. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs +67 -0
  153. package/dist/components/DictionaryEditor/validDictionaryChangeButtons.content.mjs.map +1 -0
  154. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.cjs +8 -0
  155. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.cjs.map +1 -0
  156. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.d.ts +4 -0
  157. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.d.ts.map +1 -0
  158. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.mjs +8 -0
  159. package/dist/components/DictionaryEditor/validDictionaryChangeButtonsSchema.mjs.map +1 -0
  160. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +8 -2
  161. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  162. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +0 -1
  163. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  164. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +8 -2
  165. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  166. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +1 -1
  167. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
  168. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts +0 -1
  169. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
  170. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
  171. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  172. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.cjs.map +1 -1
  173. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.d.ts +2 -3
  174. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.d.ts.map +1 -1
  175. package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryFormSchema.mjs.map +1 -1
  176. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +1 -1
  177. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  178. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts +0 -1
  179. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  180. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +1 -1
  181. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  182. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.cjs.map +1 -1
  183. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.d.ts +2 -3
  184. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.d.ts.map +1 -1
  185. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsSchema.mjs.map +1 -1
  186. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +2 -2
  187. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
  188. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +2 -2
  189. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  190. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +37 -13
  191. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  192. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +0 -1
  193. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  194. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +37 -13
  195. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  196. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +21 -6
  197. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  198. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts +0 -1
  199. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
  200. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +21 -6
  201. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  202. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +29 -14
  203. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
  204. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts +0 -1
  205. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
  206. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +29 -14
  207. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
  208. package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs +1 -0
  209. package/dist/components/DictionaryFieldEditor/EnumKeyInput.cjs.map +1 -1
  210. package/dist/components/DictionaryFieldEditor/EnumKeyInput.d.ts +0 -1
  211. package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs +1 -0
  212. package/dist/components/DictionaryFieldEditor/EnumKeyInput.mjs.map +1 -1
  213. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts +0 -1
  214. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +18 -2
  215. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  216. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts +0 -1
  217. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
  218. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +18 -2
  219. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  220. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +18 -2
  221. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  222. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts +0 -1
  223. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
  224. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +18 -2
  225. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  226. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +14 -15
  227. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  228. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts +0 -1
  229. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  230. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +14 -15
  231. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  232. package/dist/components/DictionaryFieldEditor/SaveForm/SaveFormSchema.d.ts +0 -1
  233. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +12 -12
  234. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  235. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +1 -1
  236. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +12 -12
  237. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  238. package/dist/components/DictionaryFieldEditor/getIsEditableSection.d.ts +0 -1
  239. package/dist/components/DropDown/index.d.ts +0 -1
  240. package/dist/components/DropDown/types.d.ts +0 -1
  241. package/dist/components/EditableField/EditableFieldInput.cjs +12 -5
  242. package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
  243. package/dist/components/EditableField/EditableFieldInput.d.ts +2 -4
  244. package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
  245. package/dist/components/EditableField/EditableFieldInput.mjs +13 -6
  246. package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
  247. package/dist/components/EditableField/EditableFieldLayout.d.ts +0 -1
  248. package/dist/components/EditableField/EditableFieldTextArea.cjs +17 -4
  249. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  250. package/dist/components/EditableField/EditableFieldTextArea.d.ts +6 -3
  251. package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
  252. package/dist/components/EditableField/EditableFieldTextArea.mjs +18 -5
  253. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  254. package/dist/components/Flags/Flag.d.ts +0 -1
  255. package/dist/components/Footer/index.d.ts +0 -1
  256. package/dist/components/Form/Form.cjs +1 -1
  257. package/dist/components/Form/Form.d.ts +2 -1
  258. package/dist/components/Form/Form.d.ts.map +1 -1
  259. package/dist/components/Form/Form.mjs +1 -1
  260. package/dist/components/Form/FormBase.d.ts +0 -1
  261. package/dist/components/Form/FormBase.d.ts.map +1 -1
  262. package/dist/components/Form/FormDescription.d.ts +0 -1
  263. package/dist/components/Form/FormField.d.ts +0 -1
  264. package/dist/components/Form/FormItem.d.ts +0 -1
  265. package/dist/components/Form/FormMessage.d.ts +0 -1
  266. package/dist/components/Form/elements/CheckboxElement.cjs +10 -0
  267. package/dist/components/Form/elements/CheckboxElement.cjs.map +1 -0
  268. package/dist/components/Form/elements/CheckboxElement.d.ts +10 -0
  269. package/dist/components/Form/elements/CheckboxElement.d.ts.map +1 -0
  270. package/dist/components/Form/elements/CheckboxElement.mjs +10 -0
  271. package/dist/components/Form/elements/CheckboxElement.mjs.map +1 -0
  272. package/dist/components/Form/elements/EditableFieldInputElement.cjs +1 -1
  273. package/dist/components/Form/elements/EditableFieldInputElement.d.ts +0 -1
  274. package/dist/components/Form/elements/EditableFieldInputElement.mjs +1 -1
  275. package/dist/components/Form/elements/EditableFieldTextAreaElement.cjs +1 -1
  276. package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +0 -1
  277. package/dist/components/Form/elements/EditableFieldTextAreaElement.mjs +1 -1
  278. package/dist/components/Form/elements/FormElement.cjs +1 -1
  279. package/dist/components/Form/elements/FormElement.d.ts +0 -1
  280. package/dist/components/Form/elements/FormElement.mjs +1 -1
  281. package/dist/components/Form/elements/FormElementWrapper.d.ts +0 -1
  282. package/dist/components/Form/elements/InputElement.cjs +2 -1
  283. package/dist/components/Form/elements/InputElement.cjs.map +1 -1
  284. package/dist/components/Form/elements/InputElement.d.ts +2 -3
  285. package/dist/components/Form/elements/InputElement.d.ts.map +1 -1
  286. package/dist/components/Form/elements/InputElement.mjs +2 -1
  287. package/dist/components/Form/elements/InputElement.mjs.map +1 -1
  288. package/dist/components/Form/elements/InputPasswordElement.cjs +2 -1
  289. package/dist/components/Form/elements/InputPasswordElement.cjs.map +1 -1
  290. package/dist/components/Form/elements/InputPasswordElement.d.ts +2 -3
  291. package/dist/components/Form/elements/InputPasswordElement.d.ts.map +1 -1
  292. package/dist/components/Form/elements/InputPasswordElement.mjs +2 -1
  293. package/dist/components/Form/elements/InputPasswordElement.mjs.map +1 -1
  294. package/dist/components/Form/elements/MultiselectElement.cjs +1 -1
  295. package/dist/components/Form/elements/MultiselectElement.d.ts +0 -1
  296. package/dist/components/Form/elements/MultiselectElement.mjs +1 -1
  297. package/dist/components/Form/elements/SelectElement.cjs +1 -1
  298. package/dist/components/Form/elements/SelectElement.d.ts +0 -1
  299. package/dist/components/Form/elements/SelectElement.mjs +1 -1
  300. package/dist/components/Form/elements/SwitchSelectorElement.cjs +1 -1
  301. package/dist/components/Form/elements/SwitchSelectorElement.d.ts +0 -1
  302. package/dist/components/Form/elements/SwitchSelectorElement.mjs +1 -1
  303. package/dist/components/Form/elements/TextAreaElement.cjs +1 -1
  304. package/dist/components/Form/elements/TextAreaElement.d.ts +0 -1
  305. package/dist/components/Form/elements/TextAreaElement.mjs +1 -1
  306. package/dist/components/Form/elements/index.cjs +1 -1
  307. package/dist/components/Form/elements/index.mjs +1 -1
  308. package/dist/components/Form/index.cjs +1 -1
  309. package/dist/components/Form/index.mjs +1 -1
  310. package/dist/components/Form/layout/FormItemLayout.cjs +1 -1
  311. package/dist/components/Form/layout/FormItemLayout.d.ts +1 -2
  312. package/dist/components/Form/layout/FormItemLayout.d.ts.map +1 -1
  313. package/dist/components/Form/layout/FormItemLayout.mjs +1 -1
  314. package/dist/components/Form/layout/FormLabelLayout.d.ts +0 -1
  315. package/dist/components/Form/layout/RequiredStar.d.ts +0 -1
  316. package/dist/components/Form/layout/index.cjs +1 -1
  317. package/dist/components/Form/layout/index.mjs +1 -1
  318. package/dist/components/Headers/index.d.ts +0 -1
  319. package/dist/components/IDE/CodeRender.cjs.map +1 -1
  320. package/dist/components/IDE/CodeRender.d.ts +0 -1
  321. package/dist/components/IDE/CodeRender.mjs.map +1 -1
  322. package/dist/components/IDE/FileList.d.ts +0 -1
  323. package/dist/components/IDE/FileTree.d.ts +0 -1
  324. package/dist/components/IDE/IDE.d.ts +0 -1
  325. package/dist/components/IDE/MarkDownRender.d.ts +0 -1
  326. package/dist/components/InformationTag/index.d.ts +0 -1
  327. package/dist/components/Input/Checkbox.cjs +80 -0
  328. package/dist/components/Input/Checkbox.cjs.map +1 -0
  329. package/dist/components/Input/Checkbox.d.ts +14 -0
  330. package/dist/components/Input/Checkbox.d.ts.map +1 -0
  331. package/dist/components/Input/Checkbox.mjs +80 -0
  332. package/dist/components/Input/Checkbox.mjs.map +1 -0
  333. package/dist/components/Input/Input.d.ts +0 -1
  334. package/dist/components/Input/InputPassword.d.ts +0 -1
  335. package/dist/components/Input/index.cjs +3 -0
  336. package/dist/components/Input/index.cjs.map +1 -1
  337. package/dist/components/Input/index.d.ts +1 -0
  338. package/dist/components/Input/index.d.ts.map +1 -1
  339. package/dist/components/Input/index.mjs +3 -0
  340. package/dist/components/Input/index.mjs.map +1 -1
  341. package/dist/components/Label/index.d.ts +0 -1
  342. package/dist/components/Link/Link.cjs +7 -2
  343. package/dist/components/Link/Link.cjs.map +1 -1
  344. package/dist/components/Link/Link.d.ts +3 -3
  345. package/dist/components/Link/Link.d.ts.map +1 -1
  346. package/dist/components/Link/Link.mjs +7 -2
  347. package/dist/components/Link/Link.mjs.map +1 -1
  348. package/dist/components/Loader/index.d.ts +0 -1
  349. package/dist/components/Loader/spinner.d.ts +0 -1
  350. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts +0 -1
  351. package/dist/components/Logo/LogoCircle.d.ts +0 -1
  352. package/dist/components/Logo/LogoNoFrame.d.ts +0 -1
  353. package/dist/components/Logo/LogoSquare.d.ts +0 -1
  354. package/dist/components/Logo/LogoSquircle.d.ts +0 -1
  355. package/dist/components/Logo/LogoTextOnly.d.ts +0 -1
  356. package/dist/components/Logo/LogoWithTextBelowCircle.d.ts +0 -1
  357. package/dist/components/Logo/LogoWithTextBelowNoFrame.d.ts +0 -1
  358. package/dist/components/Logo/LogoWithTextBelowSquircle.d.ts +0 -1
  359. package/dist/components/Logo/LogoWithTextCircle.d.ts +0 -1
  360. package/dist/components/Logo/LogoWithTextNoFrame.d.ts +0 -1
  361. package/dist/components/Logo/LogoWithTextSquircle.d.ts +0 -1
  362. package/dist/components/Logo/index.d.ts +0 -1
  363. package/dist/components/MarkDownRender/index.d.ts +0 -1
  364. package/dist/components/MaxHeightSmoother/index.d.ts +0 -1
  365. package/dist/components/MaxWidthSmoother/index.d.ts +0 -1
  366. package/dist/components/Modal/Modal.cjs +19 -15
  367. package/dist/components/Modal/Modal.cjs.map +1 -1
  368. package/dist/components/Modal/Modal.d.ts +3 -3
  369. package/dist/components/Modal/Modal.d.ts.map +1 -1
  370. package/dist/components/Modal/Modal.mjs +19 -15
  371. package/dist/components/Modal/Modal.mjs.map +1 -1
  372. package/dist/components/Navbar/Burger.d.ts +0 -1
  373. package/dist/components/Navbar/DesktopNavbar.cjs +10 -26
  374. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  375. package/dist/components/Navbar/DesktopNavbar.d.ts +6 -6
  376. package/dist/components/Navbar/DesktopNavbar.d.ts.map +1 -1
  377. package/dist/components/Navbar/DesktopNavbar.mjs +10 -26
  378. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  379. package/dist/components/Navbar/MobileNavbar.cjs +3 -57
  380. package/dist/components/Navbar/MobileNavbar.cjs.map +1 -1
  381. package/dist/components/Navbar/MobileNavbar.d.ts +6 -7
  382. package/dist/components/Navbar/MobileNavbar.d.ts.map +1 -1
  383. package/dist/components/Navbar/MobileNavbar.mjs +3 -57
  384. package/dist/components/Navbar/MobileNavbar.mjs.map +1 -1
  385. package/dist/components/Navbar/index.cjs +4 -2
  386. package/dist/components/Navbar/index.cjs.map +1 -1
  387. package/dist/components/Navbar/index.d.ts +9 -15
  388. package/dist/components/Navbar/index.d.ts.map +1 -1
  389. package/dist/components/Navbar/index.mjs +4 -2
  390. package/dist/components/Navbar/index.mjs.map +1 -1
  391. package/dist/components/Pattern/DotPattern.d.ts +0 -1
  392. package/dist/components/Pattern/GridPattern.d.ts +0 -1
  393. package/dist/components/Pattern/SpotLight.d.ts +0 -1
  394. package/dist/components/Popover/index.d.ts +0 -1
  395. package/dist/components/PressableSpan/PressableSpan.d.ts +0 -1
  396. package/dist/components/ProfileDropDown/index.d.ts +0 -1
  397. package/dist/components/RightDrawer/RightDrawer.d.ts +0 -1
  398. package/dist/components/Select/Multiselect.d.ts +2 -3
  399. package/dist/components/Select/Multiselect.d.ts.map +1 -1
  400. package/dist/components/SwitchSelector/index.d.ts +1 -2
  401. package/dist/components/TabSelector/TabSelector.cjs +2 -0
  402. package/dist/components/TabSelector/TabSelector.cjs.map +1 -1
  403. package/dist/components/TabSelector/TabSelector.d.ts +2 -3
  404. package/dist/components/TabSelector/TabSelector.d.ts.map +1 -1
  405. package/dist/components/TabSelector/TabSelector.mjs +2 -0
  406. package/dist/components/TabSelector/TabSelector.mjs.map +1 -1
  407. package/dist/components/TextArea/AutoSizeTextArea.d.ts +0 -1
  408. package/dist/components/TextArea/TextArea.cjs +1 -0
  409. package/dist/components/TextArea/TextArea.cjs.map +1 -1
  410. package/dist/components/TextArea/TextArea.d.ts +0 -1
  411. package/dist/components/TextArea/TextArea.mjs +1 -0
  412. package/dist/components/TextArea/TextArea.mjs.map +1 -1
  413. package/dist/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.d.ts +0 -1
  414. package/dist/components/ThemeSwitcherDropDown/MobileThemeSwitcher.d.ts +0 -1
  415. package/dist/components/Toaster/Toast.d.ts +1 -1
  416. package/dist/components/Toaster/useToast.d.ts +0 -1
  417. package/dist/components/WithResizer/index.d.ts +0 -1
  418. package/dist/components/index.cjs +4 -3
  419. package/dist/components/index.cjs.map +1 -1
  420. package/dist/components/index.d.ts +0 -1
  421. package/dist/components/index.d.ts.map +1 -1
  422. package/dist/components/index.mjs +4 -3
  423. package/dist/hooks/intlayerAPIHooks.cjs +16 -3
  424. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  425. package/dist/hooks/intlayerAPIHooks.d.ts +0 -1
  426. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  427. package/dist/hooks/intlayerAPIHooks.mjs +16 -3
  428. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  429. package/dist/hooks/useAsync/useAsync.cjs +1 -5
  430. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  431. package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
  432. package/dist/hooks/useAsync/useAsync.mjs +1 -5
  433. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  434. package/dist/hooks/useAsync/useAsyncWrapper.d.ts +0 -1
  435. package/dist/hooks/useGetAllDictionaries.d.ts +0 -1
  436. package/dist/hooks/useItemSelector.d.ts +0 -1
  437. package/dist/index-BUDsCMdX.cjs +204 -0
  438. package/dist/index-BUDsCMdX.cjs.map +1 -0
  439. package/dist/index-C09rI9kw.js +205 -0
  440. package/dist/index-C09rI9kw.js.map +1 -0
  441. package/dist/libs/intlayer-api/auth.d.ts +0 -1
  442. package/dist/libs/intlayer-api/dictionary.d.ts +0 -1
  443. package/dist/libs/intlayer-api/fetcher.cjs +1 -6
  444. package/dist/libs/intlayer-api/fetcher.cjs.map +1 -1
  445. package/dist/libs/intlayer-api/fetcher.d.ts.map +1 -1
  446. package/dist/libs/intlayer-api/fetcher.mjs +1 -6
  447. package/dist/libs/intlayer-api/fetcher.mjs.map +1 -1
  448. package/dist/libs/intlayer-api/index.d.ts +0 -1
  449. package/dist/libs/intlayer-api/organization.d.ts +0 -1
  450. package/dist/libs/intlayer-api/project.d.ts +0 -1
  451. package/dist/libs/intlayer-api/user.d.ts +0 -1
  452. package/dist/tailwind.css +1 -1
  453. package/dist/utils/cn.d.ts +0 -1
  454. package/dist/utils/dictionary.cjs +37 -1
  455. package/dist/utils/dictionary.cjs.map +1 -1
  456. package/dist/utils/dictionary.d.ts +1 -1
  457. package/dist/utils/dictionary.d.ts.map +1 -1
  458. package/dist/utils/dictionary.mjs +38 -2
  459. package/dist/utils/dictionary.mjs.map +1 -1
  460. package/dist/validDictionaryChangeButtons.content-BK9QaXPm.cjs +66 -0
  461. package/dist/validDictionaryChangeButtons.content-BK9QaXPm.cjs.map +1 -0
  462. package/dist/validDictionaryChangeButtons.content-CAAscqJI.cjs +66 -0
  463. package/dist/validDictionaryChangeButtons.content-CAAscqJI.cjs.map +1 -0
  464. package/dist/validDictionaryChangeButtons.content-D7AvoBdl.js +67 -0
  465. package/dist/validDictionaryChangeButtons.content-D7AvoBdl.js.map +1 -0
  466. package/dist/validDictionaryChangeButtons.content-DQwoUNCC.cjs +45 -0
  467. package/dist/validDictionaryChangeButtons.content-DQwoUNCC.cjs.map +1 -0
  468. package/dist/validDictionaryChangeButtons.content-DQxPoIe6.js +67 -0
  469. package/dist/validDictionaryChangeButtons.content-DQxPoIe6.js.map +1 -0
  470. package/dist/validDictionaryChangeButtons.content-JUcjGdBx.cjs +66 -0
  471. package/dist/validDictionaryChangeButtons.content-JUcjGdBx.cjs.map +1 -0
  472. package/dist/validDictionaryChangeButtons.content-ejY3-sbG.js +67 -0
  473. package/dist/validDictionaryChangeButtons.content-ejY3-sbG.js.map +1 -0
  474. package/dist/validDictionaryChangeButtons.content-iyT0lKy7.js +46 -0
  475. package/dist/validDictionaryChangeButtons.content-iyT0lKy7.js.map +1 -0
  476. package/dist/validDictionaryChangeButtons.content-u4qShrQh.cjs +66 -0
  477. package/dist/validDictionaryChangeButtons.content-u4qShrQh.cjs.map +1 -0
  478. package/dist/validDictionaryChangeButtons.content-y4up9NU8.js +67 -0
  479. package/dist/validDictionaryChangeButtons.content-y4up9NU8.js.map +1 -0
  480. package/dist/zod-BV4nCGJE.js.map +1 -1
  481. package/dist/zod-DSrtTSD_.cjs.map +1 -1
  482. package/package.json +81 -54
@@ -0,0 +1,205 @@
1
+ "use client";
2
+ import { j as jsxRuntimeExports } from "./jsx-runtime-BgSF1HG2.js";
3
+ import { NodeType, isSameKeyPath } from "@intlayer/core";
4
+ import { createElement } from "react";
5
+ import { Edit } from "lucide-react";
6
+ import { ItemLayout } from "./components/DictionaryEditor/ItemLayout.mjs";
7
+ import { StringWrapper } from "./components/DictionaryEditor/NodeWrapper/StringWrapper.mjs";
8
+ import { useEditedContentStore } from "./components/DictionaryEditor/useEditedContentStore.mjs";
9
+ const ArrayWrapper = (props) => {
10
+ const {
11
+ keyPath,
12
+ section,
13
+ onFocusKeyPath,
14
+ onClickEdit,
15
+ focusedKeyPath = []
16
+ } = props;
17
+ return section.map((subSection, key) => {
18
+ const newKeyPathEl = {
19
+ key,
20
+ type: NodeType.Array
21
+ };
22
+ const newKeyPath = [...keyPath, newKeyPathEl];
23
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
24
+ ItemLayout,
25
+ {
26
+ level: keyPath.length,
27
+ title: `${key}`,
28
+ description: "",
29
+ isSelected: isSameKeyPath(newKeyPath, focusedKeyPath),
30
+ onClick: (e) => {
31
+ e.stopPropagation();
32
+ onFocusKeyPath(newKeyPath);
33
+ },
34
+ rightParam: /* @__PURE__ */ jsxRuntimeExports.jsx(
35
+ Edit,
36
+ {
37
+ size: 16,
38
+ role: "button",
39
+ "aria-label": "Open the editor",
40
+ onClick: (e) => {
41
+ e.stopPropagation();
42
+ onClickEdit?.(newKeyPath);
43
+ }
44
+ }
45
+ ),
46
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(NodeWrapper, { ...props, keyPath: newKeyPath, section: subSection })
47
+ },
48
+ JSON.stringify(subSection)
49
+ );
50
+ });
51
+ };
52
+ const EnumerationWrapper = (props) => {
53
+ const { keyPath, section } = props;
54
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "ml-2 grid grid-cols-[auto,1fr] gap-2", children: Object.keys(section).filter((key) => !traceKeys.includes(key)).map((key) => {
55
+ const newKeyPathEl = {
56
+ type: NodeType.Enumeration,
57
+ key
58
+ };
59
+ const newKeyPath = [...keyPath, newKeyPathEl];
60
+ const subSection = section.enumeration[key];
61
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
62
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "flex items-center font-bold", children: key }),
63
+ /* @__PURE__ */ createElement(
64
+ NodeWrapper,
65
+ {
66
+ ...props,
67
+ key,
68
+ keyPath: newKeyPath,
69
+ section: subSection
70
+ }
71
+ )
72
+ ] });
73
+ }) });
74
+ };
75
+ const NestedObjectWrapper = (props) => {
76
+ const {
77
+ keyPath,
78
+ section,
79
+ focusedKeyPath = [],
80
+ onClickEdit,
81
+ onFocusKeyPath
82
+ } = props;
83
+ return Object.keys(section).filter((key) => !traceKeys.includes(key)).map((key) => {
84
+ const newKeyPathEl = { key, type: NodeType.Object };
85
+ const newKeyPath = [...keyPath, newKeyPathEl];
86
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
87
+ ItemLayout,
88
+ {
89
+ level: keyPath.length,
90
+ title: key,
91
+ description: "",
92
+ isSelected: isSameKeyPath(newKeyPath, focusedKeyPath),
93
+ onClick: (e) => {
94
+ e.stopPropagation();
95
+ onFocusKeyPath(newKeyPath);
96
+ },
97
+ rightParam: /* @__PURE__ */ jsxRuntimeExports.jsx(
98
+ Edit,
99
+ {
100
+ size: 16,
101
+ role: "button",
102
+ "aria-label": "Open the editor",
103
+ onClick: (e) => {
104
+ e.stopPropagation();
105
+ onClickEdit?.(newKeyPath);
106
+ }
107
+ }
108
+ ),
109
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(NodeWrapper, { ...props, keyPath: newKeyPath, section: section[key] })
110
+ },
111
+ key
112
+ );
113
+ });
114
+ };
115
+ const TranslationWrapper = (props) => {
116
+ const { keyPath, section, locale } = props;
117
+ const newKeyPathEl = {
118
+ type: NodeType.Translation,
119
+ key: locale
120
+ };
121
+ const newKeyPath = [...keyPath, newKeyPathEl];
122
+ const subSection = section.translation[locale];
123
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(NodeWrapper, { ...props, keyPath: newKeyPath, section: subSection });
124
+ };
125
+ const traceKeys = ["filePath", "id", "nodeType"];
126
+ const isReactNode = (node) => typeof node?.key !== "undefined" && typeof node?.props !== "undefined";
127
+ const createReactElement = (element) => {
128
+ if (typeof element === "string") {
129
+ return element;
130
+ }
131
+ const convertChildrenAsArray = (element2) => {
132
+ if (element2?.props && typeof element2.props.children === "object") {
133
+ const childrenResult = [];
134
+ const { children } = element2.props;
135
+ Object.keys(children).forEach((key) => {
136
+ childrenResult.push(createReactElement(children[key]));
137
+ });
138
+ return {
139
+ ...element2,
140
+ props: { ...element2.props, children: childrenResult }
141
+ };
142
+ }
143
+ return {
144
+ ...element2,
145
+ props: { ...element2.props, children: element2.props.children }
146
+ };
147
+ };
148
+ const fixedElement = convertChildrenAsArray(element);
149
+ const { type, props } = fixedElement;
150
+ return createElement(type ?? "div", props, ...props.children);
151
+ };
152
+ const NodeWrapper = (props) => {
153
+ const { section } = props;
154
+ useEditedContentStore((s) => ({
155
+ addEditedContent: s.addEditedContent
156
+ }));
157
+ if (typeof section === "object") {
158
+ if (isReactNode(section)) {
159
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [
160
+ createReactElement(section),
161
+ /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "text-neutral dark:text-neutral-dark text-xs", children: "React node not editable" })
162
+ ] });
163
+ }
164
+ if (section.nodeType === NodeType.Translation) {
165
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
166
+ TranslationWrapper,
167
+ {
168
+ ...props,
169
+ section
170
+ }
171
+ );
172
+ }
173
+ if (section.nodeType === NodeType.Enumeration) {
174
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
175
+ EnumerationWrapper,
176
+ {
177
+ ...props,
178
+ section
179
+ }
180
+ );
181
+ }
182
+ if (Array.isArray(section)) {
183
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(ArrayWrapper, { ...props, section });
184
+ }
185
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(
186
+ NestedObjectWrapper,
187
+ {
188
+ ...props,
189
+ section
190
+ }
191
+ );
192
+ }
193
+ if (typeof section === "string") {
194
+ return /* @__PURE__ */ jsxRuntimeExports.jsx(StringWrapper, { ...props, section });
195
+ }
196
+ };
197
+ export {
198
+ ArrayWrapper as A,
199
+ EnumerationWrapper as E,
200
+ NodeWrapper as N,
201
+ TranslationWrapper as T,
202
+ NestedObjectWrapper as a,
203
+ traceKeys as t
204
+ };
205
+ //# sourceMappingURL=index-C09rI9kw.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index-C09rI9kw.js","sources":["../src/components/DictionaryEditor/NodeWrapper/ArrayWrapper.tsx","../src/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.tsx","../src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx","../src/components/DictionaryEditor/NodeWrapper/TranslationWrapper.tsx","../src/components/DictionaryEditor/NodeWrapper/index.tsx"],"sourcesContent":["/* eslint-disable import/no-cycle */\nimport {\n isSameKeyPath,\n NodeType,\n type DictionaryValue,\n type KeyPath,\n} from '@intlayer/core';\nimport { Edit } from 'lucide-react';\nimport type { FC } from 'react';\nimport { ItemLayout } from '../ItemLayout';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype ArrayWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: DictionaryValue[];\n};\n\nexport const ArrayWrapper: FC<ArrayWrapperProps> = (props) => {\n const {\n keyPath,\n section,\n onFocusKeyPath,\n onClickEdit,\n focusedKeyPath = [],\n } = props;\n\n return section.map((subSection, key) => {\n const newKeyPathEl: KeyPath = {\n key,\n type: NodeType.Array,\n };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n return (\n <ItemLayout\n level={keyPath.length}\n key={JSON.stringify(subSection)}\n title={`${key}`}\n description=\"\"\n isSelected={isSameKeyPath(newKeyPath, focusedKeyPath)}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(newKeyPath);\n }}\n rightParam={\n <Edit\n size={16}\n role=\"button\"\n aria-label=\"Open the editor\"\n onClick={(e) => {\n e.stopPropagation();\n\n onClickEdit?.(newKeyPath);\n }}\n />\n }\n >\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />\n </ItemLayout>\n );\n });\n};\n","/* eslint-disable import/no-cycle */\nimport {\n type KeyPath,\n NodeType,\n type EnumerationContent,\n type DictionaryValue,\n} from '@intlayer/core';\nimport type { FC } from 'react';\nimport { NodeWrapper, traceKeys, type NodeWrapperProps } from './index';\n\ntype EnumerationWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: EnumerationContent<DictionaryValue>;\n};\n\nexport const EnumerationWrapper: FC<EnumerationWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n {Object.keys(section)\n .filter((key) => !traceKeys.includes(key))\n .map((key) => {\n const newKeyPathEl: KeyPath = {\n type: NodeType.Enumeration,\n key,\n };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const subSection =\n section.enumeration[key as keyof (typeof section)['enumeration']]!;\n\n return (\n <>\n <span className=\"flex items-center font-bold\">{key}</span>\n <NodeWrapper\n {...props}\n key={key}\n keyPath={newKeyPath}\n section={subSection}\n />\n </>\n );\n })}\n </div>\n );\n};\n","/* eslint-disable import/no-cycle */\n\nimport {\n type KeyPath,\n isSameKeyPath,\n type DictionaryValue,\n NodeType,\n} from '@intlayer/core';\nimport { Edit } from 'lucide-react';\nimport type { FC } from 'react';\nimport { ItemLayout } from '../ItemLayout';\nimport { NodeWrapper, traceKeys, type NodeWrapperProps } from './index';\n\ntype NestedObjectWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: Record<string, DictionaryValue>;\n};\n\nexport const NestedObjectWrapper: FC<NestedObjectWrapperProps> = (props) => {\n const {\n keyPath,\n section,\n focusedKeyPath = [],\n onClickEdit,\n onFocusKeyPath,\n } = props;\n\n return Object.keys(section)\n .filter((key) => !traceKeys.includes(key))\n .map((key) => {\n const newKeyPathEl: KeyPath = { key, type: NodeType.Object };\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n return (\n <ItemLayout\n level={keyPath.length}\n key={key}\n title={key}\n description=\"\"\n isSelected={isSameKeyPath(newKeyPath, focusedKeyPath)}\n onClick={(e) => {\n e.stopPropagation();\n\n onFocusKeyPath(newKeyPath);\n }}\n rightParam={\n <Edit\n size={16}\n role=\"button\"\n aria-label=\"Open the editor\"\n onClick={(e) => {\n e.stopPropagation();\n\n onClickEdit?.(newKeyPath);\n }}\n />\n }\n >\n <NodeWrapper {...props} keyPath={newKeyPath} section={section[key]} />\n </ItemLayout>\n );\n });\n};\n","/* eslint-disable import/no-cycle */\n\nimport {\n type KeyPath,\n NodeType,\n type TranslationContent,\n type DictionaryValue,\n} from '@intlayer/core';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype TranslationWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: TranslationContent<DictionaryValue>;\n};\n\nexport const TranslationWrapper: FC<TranslationWrapperProps> = (props) => {\n const { keyPath, section, locale } = props;\n\n const newKeyPathEl: KeyPath = {\n type: NodeType.Translation,\n key: locale,\n };\n\n const newKeyPath: KeyPath[] = [...keyPath, newKeyPathEl];\n\n const subSection =\n section.translation[\n locale as unknown as keyof (typeof section)['translation']\n ]!;\n\n return <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />;\n};\n","/* eslint-disable import/no-cycle */\n'use client';\n\nimport type { Locales } from '@intlayer/config/client';\nimport {\n type EnumerationContent,\n type TranslationContent,\n NodeType,\n type KeyPath,\n type DictionaryValue,\n type Dictionary,\n} from '@intlayer/core';\nimport {\n createElement,\n type ReactElement,\n type ReactNode,\n type FC,\n} from 'react';\nimport { ArrayWrapper } from './ArrayWrapper';\nimport { EnumerationWrapper } from './EnumerationWrapper';\nimport { NestedObjectWrapper } from './NestedObjectWrapper';\nimport { StringWrapper } from './StringWrapper';\nimport { TranslationWrapper } from './TranslationWrapper';\nimport { useEditedContentStore } from '../useEditedContentStore';\n\nexport const traceKeys: string[] = ['filePath', 'id', 'nodeType'];\n\nconst isReactNode = (node: Record<string, unknown>): boolean =>\n typeof node?.key !== 'undefined' && typeof node?.props !== 'undefined';\n\nexport type NodeWrapperProps = {\n keyPath: KeyPath[];\n section: DictionaryValue;\n onContentChange: (content: { keyPath: KeyPath[]; newValue: string }) => void;\n locale: Locales;\n editedContent: Dictionary;\n focusedKeyPath: KeyPath[] | undefined;\n onFocusKeyPath: (keyPath: KeyPath[]) => void;\n onClickEdit?: (keyPath: KeyPath[]) => void;\n};\n\nconst createReactElement = (element: ReactElement) => {\n if (typeof element === 'string') {\n // If it's a string, simply return it (used for text content)\n return element;\n }\n\n const convertChildrenAsArray = (element: ReactElement): ReactElement => {\n if (element?.props && typeof element.props.children === 'object') {\n const childrenResult: ReactNode[] = [];\n const { children } = element.props;\n\n // Create the children elements recursively, if any\n Object.keys(children).forEach((key) => {\n childrenResult.push(createReactElement(children[key]));\n });\n\n return {\n ...element,\n props: { ...element.props, children: childrenResult },\n };\n }\n\n return {\n ...element,\n props: { ...element.props, children: element.props.children },\n };\n };\n\n const fixedElement = convertChildrenAsArray(element);\n\n const { type, props } = fixedElement;\n\n // Create and return the React element\n return createElement(type ?? 'div', props, ...props.children);\n};\n\nexport const NodeWrapper: FC<NodeWrapperProps> = (props) => {\n const { section } = props;\n\n const { addEditedContent } = useEditedContentStore((s) => ({\n addEditedContent: s.addEditedContent,\n }));\n\n if (typeof section === 'object') {\n if (isReactNode(section as Record<string, unknown>)) {\n return (\n <>\n {createReactElement(section as unknown as ReactElement)}\n <span className=\"text-neutral dark:text-neutral-dark text-xs\">\n React node not editable\n </span>\n </>\n );\n }\n\n if (\n (section as TranslationContent<DictionaryValue>).nodeType ===\n NodeType.Translation\n ) {\n return (\n <TranslationWrapper\n {...props}\n section={section as TranslationContent<DictionaryValue>}\n />\n );\n }\n\n if (\n (section as EnumerationContent<DictionaryValue>).nodeType ===\n NodeType.Enumeration\n ) {\n return (\n <EnumerationWrapper\n {...props}\n section={section as EnumerationContent<DictionaryValue>}\n />\n );\n }\n\n if (Array.isArray(section)) {\n return <ArrayWrapper {...props} section={section as DictionaryValue[]} />;\n }\n\n return (\n <NestedObjectWrapper\n {...props}\n section={section as Record<string, DictionaryValue>}\n />\n );\n }\n\n if (typeof section === 'string') {\n return <StringWrapper {...props} section={section} />;\n }\n};\n"],"names":["jsx","jsxs","Fragment","element"],"mappings":";;;;;;;;AAgBa,MAAA,eAAsC,CAAC,UAAU;AACtD,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,iBAAiB,CAAC;AAAA,EAChB,IAAA;AAEJ,SAAO,QAAQ,IAAI,CAAC,YAAY,QAAQ;AACtC,UAAM,eAAwB;AAAA,MAC5B;AAAA,MACA,MAAM,SAAS;AAAA,IAAA;AAEjB,UAAM,aAAwB,CAAC,GAAG,SAAS,YAAY;AAGrD,WAAAA,kCAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO,QAAQ;AAAA,QAEf,OAAO,GAAG,GAAG;AAAA,QACb,aAAY;AAAA,QACZ,YAAY,cAAc,YAAY,cAAc;AAAA,QACpD,SAAS,CAAC,MAAM;AACd,YAAE,gBAAgB;AAClB,yBAAe,UAAU;AAAA,QAC3B;AAAA,QACA,YACEA,kCAAA;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAM;AAAA,YACN,MAAK;AAAA,YACL,cAAW;AAAA,YACX,SAAS,CAAC,MAAM;AACd,gBAAE,gBAAgB;AAElB,4BAAc,UAAU;AAAA,YAC1B;AAAA,UAAA;AAAA,QACF;AAAA,QAGF,gDAAC,aAAa,E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,GAAG;AAAA,QACJ;AAAA,MAAA;AAAA,IAAA;AAAA,EAGN;AAEI,MAAA,OAAO,YAAY,UAAU;AAC/B,WAAQA,kCAAAA,IAAA,eAAA,EAAe,GAAG,OAAO,QAAkB,CAAA;AAAA,EACrD;AACF;"}
@@ -1,6 +1,5 @@
1
1
  import { AskResetPasswordBody, AskResetPasswordResult, CreateSessionBody, CreateSessionResult, GetSessionInformationQuery, GithubLoginQueryParams, GoogleLoginQueryParams, GetSessionInformationResult, LoginBody, LoginResult, RegisterBody, RegisterResult, ResetPasswordParams, ResetPasswordResult, UpdatePasswordBody, UpdatePasswordResult, ValidEmailParams, ValidEmailResult, SetCSRFTokenResult, GetOAuth2TokenResult } from '@intlayer/backend';
2
2
  import { FetcherOptions } from './fetcher';
3
-
4
3
  export declare const getAuthAPI: (authAPIOptions?: FetcherOptions) => {
5
4
  login: (user: LoginBody, otherOptions?: FetcherOptions) => Promise<LoginResult>;
6
5
  getLoginWithGitHubURL: (params: GithubLoginQueryParams) => string;
@@ -1,6 +1,5 @@
1
1
  import { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesParams, GetDictionariesResult, UpdateDictionaryBody, UpdateDictionaryResult, PushDictionariesBody, PushDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetDictionariesKeysResult } from '@intlayer/backend';
2
2
  import { FetcherOptions } from './fetcher';
3
-
4
3
  export declare const getDictionaryAPI: (authAPIOptions?: FetcherOptions) => {
5
4
  getDictionaries: (filters?: GetDictionariesParams, otherOptions?: FetcherOptions) => Promise<GetDictionariesResult>;
6
5
  getDictionariesKeys: (otherOptions?: FetcherOptions) => Promise<GetDictionariesKeysResult>;
@@ -60,12 +60,7 @@ const fetcher = async (url, ...options) => {
60
60
  body: bodyString
61
61
  };
62
62
  const urlResult = `${url}${paramsString}`;
63
- const response = await fetch(urlResult, formattedOptions);
64
- if (!response.ok) {
65
- const errorBody = await response.json();
66
- throw new Error(errorBody.error);
67
- }
68
- return response.json();
63
+ return (await fetch(urlResult, formattedOptions)).json();
69
64
  };
70
65
  exports.fetcher = fetcher;
71
66
  exports.fetcherOptions = fetcherOptions;
@@ -1 +1 @@
1
- {"version":3,"file":"fetcher.cjs","sources":["../../../src/libs/intlayer-api/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include', // Include cookies in the request\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined = undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n const response = await fetch(urlResult, formattedOptions);\n\n // Check if the response status is OK (status code between 200-299)\n if (!response.ok) {\n // Parse error details from the response\n const errorBody = await response.json();\n // Throw an error with the error message from the response\n throw new Error(errorBody.error);\n }\n\n // Return the parsed JSON response\n return response.json();\n};\n"],"names":["params","otherOptions"],"mappings":";;AAwBO,MAAM,iBAAiC;AAAA,EAC5C,QAAQ;AAAA;AAAA,EACR,SAAS;AAAA,IACP,gBAAgB;AAAA;AAAA,EAClB;AAAA,EACA,aAAa;AAAA;AACf;AASA,MAAM,kBAAkB,CAAC,QAAgB;AACvC,SAAO,KAAK,GAAG,EAAE,QAAQ,CAAC,QAAQ;AAC5B,QAAA,IAAI,GAAuB,MAAM,QAAW;AAC9C,aAAO,IAAI,GAAuB;AAAA,IACpC;AAAA,EAAA,CACD;AACM,SAAA;AACT;AAUA,MAAM,YAAY,CAAmB,YACnC,QAAQ,OAAO,CAAC,KAAK,QAAQ;AACrB,QAAA,OAAW,OAAO;AACxB,QAAM,OAAU,gBAAgB,OAAO,CAAE,CAAA;AAEzC,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAExD,WAAO,EAAE,GAAG,MAAM,GAAG;EACvB;AAGA,SAAO,QAAQ;AACjB,GAAG,CAAO,CAAA;AAiDC,MAAA,UAAU,OACrB,QACG,YACY;AAEf,MAAI,eAAe;AACnB,MAAI,aAAiC;AAGrC,QAAM,eAAe,QAAQ;AAAA,IAC3B,CAAC,EAAE,MAAM,QAAAA,SAAQ,SAAS,GAAGC,oBAAmBA;AAAAA,EAAA;AAIlD,QAAM,gBAAgB,UAAU,CAAC,gBAAgB,GAAG,YAAY,CAAC;AAGjE,QAAM,gBAAgB,UAAU;AAAA,IAC9B,eAAe;AAAA,IACf,GAAG,QAAQ,IAAI,CAAC,WAAW,OAAO,OAAO;AAAA,EAAA,CAC1C;AAGK,QAAA,SAAS,UAAU,QAAQ,IAAI,CAAC,WAAW,OAAO,MAAM,CAAC;AAE/D,QAAM,SAAS,cAAc;AAGzB,MAAA,WAAW,SAAS,WAAW,QAAQ;AAEnC,UAAA,OAAO,UAAU,QAAQ,IAAI,CAAC,WAAW,OAAO,IAAI,CAAC;AAEzD,QAAA,gBAAgB,cAAmC,MACnD,qCACA;AAEA,mBAAa,IAAI;AAAA,QACf;AAAA,QACA,SAAS;AAAA,IAAA,OACN;AAEQ,mBAAA,KAAK,UAAU,IAAI;AAAA,IAClC;AAAA,EACF;AAGA,MAAI,OAAO,QAAQ,MAAM,EAAE,SAAS,GAAG;AACrC,mBAAe,IAAI,IAAI;AAAA,MACrB;AAAA,IAAA,EACA,SAAU,CAAA;AAAA,EACd;AAGA,QAAM,mBAAgC;AAAA,IACpC,GAAG;AAAA,IACH,SAAS;AAAA,IACT,MAAM;AAAA,EAAA;AAIR,QAAM,YAAY,GAAG,GAAG,GAAG,YAAY;AAGvC,QAAM,WAAW,MAAM,MAAM,WAAW,gBAAgB;AAGpD,MAAA,CAAC,SAAS,IAAI;AAEV,UAAA,YAAY,MAAM,SAAS;AAE3B,UAAA,IAAI,MAAM,UAAU,KAAK;AAAA,EACjC;AAGA,SAAO,SAAS;AAClB;;;"}
1
+ {"version":3,"file":"fetcher.cjs","sources":["../../../src/libs/intlayer-api/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include', // Include cookies in the request\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined = undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n return (await fetch(urlResult, formattedOptions)).json();\n};\n"],"names":["params","otherOptions"],"mappings":";;AAwBO,MAAM,iBAAiC;AAAA,EAC5C,QAAQ;AAAA;AAAA,EACR,SAAS;AAAA,IACP,gBAAgB;AAAA;AAAA,EAClB;AAAA,EACA,aAAa;AAAA;AACf;AASA,MAAM,kBAAkB,CAAC,QAAgB;AACvC,SAAO,KAAK,GAAG,EAAE,QAAQ,CAAC,QAAQ;AAC5B,QAAA,IAAI,GAAuB,MAAM,QAAW;AAC9C,aAAO,IAAI,GAAuB;AAAA,IACpC;AAAA,EAAA,CACD;AACM,SAAA;AACT;AAUA,MAAM,YAAY,CAAmB,YACnC,QAAQ,OAAO,CAAC,KAAK,QAAQ;AACrB,QAAA,OAAW,OAAO;AACxB,QAAM,OAAU,gBAAgB,OAAO,CAAE,CAAA;AAEzC,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAExD,WAAO,EAAE,GAAG,MAAM,GAAG;EACvB;AAGA,SAAO,QAAQ;AACjB,GAAG,CAAO,CAAA;AAiDC,MAAA,UAAU,OACrB,QACG,YACY;AAEf,MAAI,eAAe;AACnB,MAAI,aAAiC;AAGrC,QAAM,eAAe,QAAQ;AAAA,IAC3B,CAAC,EAAE,MAAM,QAAAA,SAAQ,SAAS,GAAGC,oBAAmBA;AAAAA,EAAA;AAIlD,QAAM,gBAAgB,UAAU,CAAC,gBAAgB,GAAG,YAAY,CAAC;AAGjE,QAAM,gBAAgB,UAAU;AAAA,IAC9B,eAAe;AAAA,IACf,GAAG,QAAQ,IAAI,CAAC,WAAW,OAAO,OAAO;AAAA,EAAA,CAC1C;AAGK,QAAA,SAAS,UAAU,QAAQ,IAAI,CAAC,WAAW,OAAO,MAAM,CAAC;AA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CAAC,CAwEX,CAAC"}
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/fetcher.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,EAAE,MAAM,CAAC,GAAG;IACvD;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC/B;;OAEG;IACH,MAAM,CAAC,EACH,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC,GAC7C,MAAM,EAAE,GACR,eAAe,CAAC;CACrB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,EAAE,cAM5B,CAAC;AAwCF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,OAAO,GAAU,CAAC,OACxB,MAAM,cACC,cAAc,EAAE,KAC3B,OAAO,CAAC,CAAC,CA6DX,CAAC"}
@@ -58,12 +58,7 @@ const fetcher = async (url, ...options) => {
58
58
  body: bodyString
59
59
  };
60
60
  const urlResult = `${url}${paramsString}`;
61
- const response = await fetch(urlResult, formattedOptions);
62
- if (!response.ok) {
63
- const errorBody = await response.json();
64
- throw new Error(errorBody.error);
65
- }
66
- return response.json();
61
+ return (await fetch(urlResult, formattedOptions)).json();
67
62
  };
68
63
  export {
69
64
  fetcher,
@@ -1 +1 @@
1
- {"version":3,"file":"fetcher.mjs","sources":["../../../src/libs/intlayer-api/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include', // Include cookies in the request\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined = undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n const response = await fetch(urlResult, formattedOptions);\n\n // Check if the response status is OK (status code between 200-299)\n if (!response.ok) {\n // Parse error details from the response\n const errorBody = await response.json();\n // Throw an error with the error message from the response\n throw new Error(errorBody.error);\n }\n\n // Return the parsed JSON response\n return response.json();\n};\n"],"names":["params","otherOptions"],"mappings":"AAwBO,MAAM,iBAAiC;AAAA,EAC5C,QAAQ;AAAA;AAAA,EACR,SAAS;AAAA,IACP,gBAAgB;AAAA;AAAA,EAClB;AAAA,EACA,aAAa;AAAA;AACf;AASA,MAAM,kBAAkB,CAAC,QAAgB;AACvC,SAAO,KAAK,GAAG,EAAE,QAAQ,CAAC,QAAQ;AAC5B,QAAA,IAAI,GAAuB,MAAM,QAAW;AAC9C,aAAO,IAAI,GAAuB;AAAA,IACpC;AAAA,EAAA,CACD;AACM,SAAA;AACT;AAUA,MAAM,YAAY,CAAmB,YACnC,QAAQ,OAAO,CAAC,KAAK,QAAQ;AACrB,QAAA,OAAW,OAAO;AACxB,QAAM,OAAU,gBAAgB,OAAO,CAAE,CAAA;AAEzC,MAAI,OAAO,SAAS,YAAY,OAAO,SAAS,UAAU;AAExD,WAAO,EAAE,GAAG,MAAM,GAAG;EACvB;AAGA,SAAO,QAAQ;AACjB,GAAG,CAAO,CAAA;AAiDC,MAAA,UAAU,OACrB,QACG,YACY;AAEf,MAAI,eAAe;AACnB,MAAI,aAAiC;AAGrC,QAAM,eAAe,QAAQ;AAAA,IAC3B,CAAC,EAAE,MAAM,QAAAA,SAAQ,SAAS,GAAGC,oBAAmBA;AAAAA,EAAA;AAIlD,QAAM,gBAAgB,UAAU,CAAC,gBAAgB,GAAG,YAAY,CAAC;AAGjE,QAAM,gBAAgB,UAAU;AAAA,IAC9B,eAAe;AAAA,IACf,GAAG,QAAQ,IAAI,CAAC,WAAW,OAAO,OAAO;AAAA,EAAA,CAC1C;AAGK,QAAA,SAAS,UAAU,QAAQ,IAAI,CAAC,WAAW,OAAO,MAAM,CAAC;AAE/D,QAAM,SAAS,cAAc;AAGzB,MAAA,WAAW,SAAS,WAAW,QAAQ;AAEnC,UAAA,OAAO,UAAU,QAAQ,IAAI,CAAC,WAAW,OAAO,IAAI,CAAC;AAEzD,QAAA,gBAAgB,cAAmC,MACnD,qCACA;AAEA,mBAAa,IAAI;AAAA,QACf;AAAA,QACA,SAAS;AAAA,IAAA,OACN;AAEQ,mBAAA,KAAK,UAAU,IAAI;AAAA,IAClC;AAAA,EACF;AAGA,MAAI,OAAO,QAAQ,MAAM,EAAE,SAAS,GAAG;AACrC,mBAAe,IAAI,IAAI;AAAA,MACrB;AAAA,IAAA,EACA,SAAU,CAAA;AAAA,EACd;AAGA,QAAM,mBAAgC;AAAA,IACpC,GAAG;AAAA,IACH,SAAS;AAAA,IACT,MAAM;AAAA,EAAA;AAIR,QAAM,YAAY,GAAG,GAAG,GAAG,YAAY;AAGvC,QAAM,WAAW,MAAM,MAAM,WAAW,gBAAgB;AAGpD,MAAA,CAAC,SAAS,IAAI;AAEV,UAAA,YAAY,MAAM,SAAS;AAE3B,UAAA,IAAI,MAAM,UAAU,KAAK;AAAA,EACjC;AAGA,SAAO,SAAS;AAClB;"}
1
+ {"version":3,"file":"fetcher.mjs","sources":["../../../src/libs/intlayer-api/fetcher.ts"],"sourcesContent":["/**\n * Type definition for options used in the fetcher function.\n * Extends the standard RequestInit interface (excluding 'body'),\n * and adds 'body' and 'params' properties for convenience.\n */\nexport type FetcherOptions = Omit<RequestInit, 'body'> & {\n /**\n * Body of the request. Should be a key-value pair object.\n */\n body?: Record<string, unknown>;\n /**\n * Query parameters to be appended to the URL.\n */\n params?:\n | Record<string, string | string[] | undefined>\n | string[]\n | URLSearchParams;\n};\n\n/**\n * Default options for the fetcher function.\n * Sets the default method to 'GET', the 'Content-Type' header to 'application/json',\n * and includes credentials in the request.\n */\nexport const fetcherOptions: FetcherOptions = {\n method: 'GET', // Default HTTP method\n headers: {\n 'Content-Type': 'application/json', // Default content type\n },\n credentials: 'include', // Include cookies in the request\n};\n\n/**\n * Utility function to remove properties with undefined values from an object.\n * This helps prevent sending undefined values in the request options.\n *\n * @param obj - The object to clean.\n * @returns The cleaned object without undefined values.\n */\nconst removeUndefined = (obj: object) => {\n Object.keys(obj).forEach((key) => {\n if (obj[key as keyof typeof obj] === undefined) {\n delete obj[key as keyof typeof obj];\n }\n });\n return obj;\n};\n\n/**\n * Deeply merges an array of objects into a single object.\n * Later objects in the array overwrite properties of earlier ones.\n *\n * @template T - The type of objects being merged.\n * @param objects - An array of objects to merge.\n * @returns The merged object.\n */\nconst deepMerge = <T extends object>(objects: (T | undefined)[]): T =>\n objects.reduce((acc, obj) => {\n const acc1: T = (acc ?? {}) as T;\n const obj1: T = removeUndefined(obj ?? {}) as T;\n\n if (typeof acc1 === 'object' && typeof obj1 === 'object') {\n // Merge the two objects\n return { ...acc1, ...obj1 };\n }\n\n // If one of them is not an object, return the defined one\n return obj1 ?? acc1;\n }, {} as T)!;\n\n/**\n * Fetcher function to make HTTP requests.\n * It merges default options with user-provided options,\n * handles query parameters and request body,\n * and returns the parsed JSON response.\n *\n * @template T - The expected type of the response data.\n * @param url - The endpoint URL.\n * @param options - Additional options to customize the request.\n * @returns A promise that resolves with the response data of type T.\n *\n * @example\n * ```typescript\n * // Making a GET request with query parameters\n * const data = await fetcher<MyResponseType>('https://api.example.com/data', {\n * params: { search: 'query' },\n * });\n *\n * // Making a POST request with a JSON body\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * });\n *\n * // Merge body, headers, and params\n * const result = await fetcher<AnotherResponseType>('https://api.example.com/submit', {\n * method: 'POST',\n * body: { key: 'value' },\n * headers: { 'Content-Type': 'application/json' },\n * params: { search: 'query' },\n * },\n * {\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1 },\n * });\n * ```\n *\n * Result:\n * ```typescript\n * {\n * method: 'POST',\n * headers: { 'Content-Type': 'application/x-www-form-urlencoded' },\n * params: { page: 1, search: 'query' },\n * body: { key: 'value' },\n * }\n * ```\n */\nexport const fetcher = async <T>(\n url: string,\n ...options: FetcherOptions[]\n): Promise<T> => {\n // Initialize query parameters string and request body string\n let paramsString = '';\n let bodyString: string | undefined = undefined;\n\n // Extract other options excluding 'body', 'params', and 'headers'\n const otherOptions = options.map(\n ({ body, params, headers, ...otherOptions }) => otherOptions\n );\n\n // Merge default options with user-provided options\n const mergedOptions = deepMerge([fetcherOptions, ...otherOptions]);\n\n // Merge default headers with user-provided headers\n const mergedHeaders = deepMerge([\n fetcherOptions.headers,\n ...options.map((option) => option.headers),\n ]);\n\n // Merge query parameters\n const params = deepMerge(options.map((option) => option.params));\n\n const method = mergedOptions.method;\n\n // If the request method is not 'GET' or 'HEAD', prepare the request body\n if (method !== 'GET' && method !== 'HEAD') {\n // Merge all 'body' options\n const body = deepMerge(options.map((option) => option.body));\n if (\n mergedHeaders?.['Content-Type' as keyof HeadersInit] ===\n 'application/x-www-form-urlencoded'\n ) {\n // If the content type is 'application/x-www-form-urlencoded', encode the body accordingly\n bodyString = new URLSearchParams(\n body as Record<string, string>\n ).toString();\n } else {\n // Otherwise, stringify the body as JSON\n bodyString = JSON.stringify(body);\n }\n }\n\n // If there are query parameters, append them to the URL\n if (Object.entries(params).length > 0) {\n paramsString = `?${new URLSearchParams(\n params as Record<string, string>\n ).toString()}`;\n }\n\n // Prepare the final request options\n const formattedOptions: RequestInit = {\n ...mergedOptions,\n headers: mergedHeaders,\n body: bodyString,\n };\n\n // Construct the full URL with query parameters\n const urlResult = `${url}${paramsString}`;\n\n // Make the HTTP request using fetch\n return (await fetch(urlResult, formattedOptions)).json();\n};\n"],"names":["params","otherOptions"],"mappings":"AAwBO,MAAM,iBAAiC;AAAA,EAC5C,QAAQ;AAAA;AAAA,EACR,SAAS;AAAA,IACP,gBAAgB;AAAA;AAAA,EAClB;AAAA,EACA,aAAa;AAAA;AACf;AASA,MAAM,kBAAkB,CAAC,QAAgB;AACvC,SAAO,KAAK,GAAG,EAAE,QAAQ,CAAC,QAAQ;AAC5B,QAAA,IAAI,GAA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,GAAG;AAAA,IACH,SAAS;AAAA,IACT,MAAM;AAAA,EAAA;AAIR,QAAM,YAAY,GAAG,GAAG,GAAG,YAAY;AAGvC,UAAQ,MAAM,MAAM,WAAW,gBAAgB,GAAG,KAAK;AACzD;"}
@@ -1,5 +1,4 @@
1
1
  import { FetcherOptions } from './fetcher';
2
-
3
2
  export declare const getIntlayerAPI: (authAPIOptions?: FetcherOptions) => {
4
3
  organization: {
5
4
  getOrganizations: (filters?: import('@intlayer/backend').GetOrganizationsParams, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').GetOrganizationsResult>;
@@ -1,6 +1,5 @@
1
1
  import { AddOrganizationBody, AddOrganizationResult, DeleteOrganizationResult, GetOrganizationParam, GetOrganizationResult, GetOrganizationsParams, GetOrganizationsResult, UpdateOrganizationBody, UpdateOrganizationResult, SelectOrganizationParam, SelectOrganizationResult, UnselectOrganizationResult, UpdateOrganizationMembersBody, UpdateOrganizationMembersResult, AddOrganizationMemberBody, AddOrganizationMemberResult } from '@intlayer/backend';
2
2
  import { FetcherOptions } from './fetcher';
3
-
4
3
  export declare const getOrganizationAPI: (authAPIOptions?: FetcherOptions) => {
5
4
  getOrganizations: (filters?: GetOrganizationsParams, otherOptions?: FetcherOptions) => Promise<GetOrganizationsResult>;
6
5
  getOrganization: (organizationId: GetOrganizationParam["organizationId"], otherOptions?: FetcherOptions) => Promise<GetOrganizationResult>;
@@ -1,6 +1,5 @@
1
1
  import { AddProjectBody, AddProjectResult, DeleteProjectResult, GetProjectsParams, GetProjectsResult, UpdateProjectBody, UpdateProjectResult, SelectProjectParam, SelectProjectResult, UnselectProjectResult, AddNewAccessKeyBody, AddNewAccessKeyResponse, DeleteAccessKeyBody, DeleteAccessKeyResponse, RefreshAccessKeyBody, RefreshAccessKeyResponse, UpdateProjectMembersBody, UpdateProjectMembersResult } from '@intlayer/backend';
2
2
  import { FetcherOptions } from './fetcher';
3
-
4
3
  export declare const getProjectAPI: (authAPIOptions?: FetcherOptions) => {
5
4
  getProjects: (filters?: GetProjectsParams, otherOptions?: FetcherOptions) => Promise<GetProjectsResult>;
6
5
  addProject: (project: AddProjectBody, otherOptions?: FetcherOptions) => Promise<AddProjectResult>;
@@ -1,6 +1,5 @@
1
1
  import { CreateUserBody, CreateUserResult, GetUserByAccountParams, GetUserByAccountResult, GetUserByEmailParams, GetUserByEmailResult, GetUserByIdParams, GetUserByIdResult, GetUsersParams, GetUsersResult, UpdateUserBody, UpdateUserResult } from '@intlayer/backend';
2
2
  import { FetcherOptions } from './fetcher';
3
-
4
3
  export declare const getUserAPI: (authAPIOptions?: FetcherOptions) => {
5
4
  createUser: (user: CreateUserBody, otherOptions?: FetcherOptions) => Promise<CreateUserResult>;
6
5
  getUsers: (filters?: GetUsersParams, otherOptions?: FetcherOptions) => Promise<GetUsersResult>;