@intlayer/design-system 3.5.4 → 3.5.6

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 (486) hide show
  1. package/dist/.vite/manifest.json +351 -60
  2. package/dist/CodeBlockShiki-BlmZyrr7.cjs +29 -0
  3. package/dist/CodeBlockShiki-BlmZyrr7.cjs.map +1 -0
  4. package/dist/CodeBlockShiki-CcpV9SVi.js +29 -0
  5. package/dist/CodeBlockShiki-CcpV9SVi.js.map +1 -0
  6. package/dist/CopyButton-Cxu3goRg.cjs +59 -0
  7. package/dist/CopyButton-Cxu3goRg.cjs.map +1 -0
  8. package/dist/CopyButton-DlcDlf6U.js +60 -0
  9. package/dist/CopyButton-DlcDlf6U.js.map +1 -0
  10. package/dist/Form-BB0kpER9.cjs +301 -0
  11. package/dist/Form-BB0kpER9.cjs.map +1 -0
  12. package/dist/Form-BDcoNTLV.cjs.map +1 -1
  13. package/dist/Form-DGLgTAdY.js +302 -0
  14. package/dist/Form-DGLgTAdY.js.map +1 -0
  15. package/dist/Form-DhsgC7kB.js.map +1 -1
  16. package/dist/components/Auth/useAuth/useSession.cjs +1 -0
  17. package/dist/components/Auth/useAuth/useSession.cjs.map +1 -1
  18. package/dist/components/Auth/useAuth/useSession.mjs +1 -0
  19. package/dist/components/Auth/useAuth/useSession.mjs.map +1 -1
  20. package/dist/components/Breadcrumb/breadcrumb.content.cjs +26 -0
  21. package/dist/components/Breadcrumb/breadcrumb.content.cjs.map +1 -0
  22. package/dist/components/Breadcrumb/breadcrumb.content.d.ts +8 -0
  23. package/dist/components/Breadcrumb/breadcrumb.content.d.ts.map +1 -0
  24. package/dist/components/Breadcrumb/breadcrumb.content.mjs +26 -0
  25. package/dist/components/Breadcrumb/breadcrumb.content.mjs.map +1 -0
  26. package/dist/components/Breadcrumb/index.cjs +106 -34
  27. package/dist/components/Breadcrumb/index.cjs.map +1 -1
  28. package/dist/components/Breadcrumb/index.d.ts +6 -2
  29. package/dist/components/Breadcrumb/index.d.ts.map +1 -1
  30. package/dist/components/Breadcrumb/index.mjs +106 -34
  31. package/dist/components/Breadcrumb/index.mjs.map +1 -1
  32. package/dist/components/Button/Button.cjs +7 -8
  33. package/dist/components/Button/Button.cjs.map +1 -1
  34. package/dist/components/Button/Button.d.ts.map +1 -1
  35. package/dist/components/Button/Button.mjs +7 -8
  36. package/dist/components/Button/Button.mjs.map +1 -1
  37. package/dist/components/ClickOutsideDiv/index.cjs +26 -0
  38. package/dist/components/ClickOutsideDiv/index.cjs.map +1 -0
  39. package/dist/components/ClickOutsideDiv/index.d.ts +6 -0
  40. package/dist/components/ClickOutsideDiv/index.d.ts.map +1 -0
  41. package/dist/components/ClickOutsideDiv/index.mjs +26 -0
  42. package/dist/components/ClickOutsideDiv/index.mjs.map +1 -0
  43. package/dist/components/Container/index.cjs +2 -2
  44. package/dist/components/Container/index.cjs.map +1 -1
  45. package/dist/components/Container/index.mjs +2 -2
  46. package/dist/components/Container/index.mjs.map +1 -1
  47. package/dist/components/ContentEditor/ContentEditorCode.cjs +78 -0
  48. package/dist/components/ContentEditor/ContentEditorCode.cjs.map +1 -0
  49. package/dist/components/ContentEditor/ContentEditorCode.d.ts +11 -0
  50. package/dist/components/ContentEditor/ContentEditorCode.d.ts.map +1 -0
  51. package/dist/components/ContentEditor/ContentEditorCode.mjs +78 -0
  52. package/dist/components/ContentEditor/ContentEditorCode.mjs.map +1 -0
  53. package/dist/components/ContentEditor/ContentEditorTextArea.cjs +30 -26
  54. package/dist/components/ContentEditor/ContentEditorTextArea.cjs.map +1 -1
  55. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts +2 -1
  56. package/dist/components/ContentEditor/ContentEditorTextArea.d.ts.map +1 -1
  57. package/dist/components/ContentEditor/ContentEditorTextArea.mjs +30 -26
  58. package/dist/components/ContentEditor/ContentEditorTextArea.mjs.map +1 -1
  59. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +3 -3
  60. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
  61. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +3 -3
  62. package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
  63. package/dist/components/DictionaryEditor/index.cjs +4 -0
  64. package/dist/components/DictionaryEditor/index.cjs.map +1 -1
  65. package/dist/components/DictionaryEditor/index.mjs +4 -0
  66. package/dist/components/DictionaryEditor/index.mjs.map +1 -1
  67. package/dist/components/DictionaryEditor/useEditedContentStore.cjs +3 -0
  68. package/dist/components/DictionaryEditor/useEditedContentStore.cjs.map +1 -1
  69. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts +2 -2
  70. package/dist/components/DictionaryEditor/useEditedContentStore.d.ts.map +1 -1
  71. package/dist/components/DictionaryEditor/useEditedContentStore.mjs +3 -0
  72. package/dist/components/DictionaryEditor/useEditedContentStore.mjs.map +1 -1
  73. package/dist/components/DictionaryEditor/useEditionPanelStore.cjs.map +1 -1
  74. package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts +1 -1
  75. package/dist/components/DictionaryEditor/useEditionPanelStore.d.ts.map +1 -1
  76. package/dist/components/DictionaryEditor/useEditionPanelStore.mjs.map +1 -1
  77. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +9 -5
  78. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs.map +1 -1
  79. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts +3 -0
  80. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.d.ts.map +1 -1
  81. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +9 -5
  82. package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs.map +1 -1
  83. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +161 -69
  84. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
  85. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  86. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +163 -71
  87. package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  88. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs +123 -0
  89. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.cjs.map +1 -1
  90. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +14 -0
  91. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts.map +1 -1
  92. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +123 -0
  93. package/dist/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  94. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs +9 -2
  95. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.cjs.map +1 -1
  96. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs +15 -0
  97. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.cjs.map +1 -1
  98. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts +1 -0
  99. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.d.ts.map +1 -1
  100. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs +15 -0
  101. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.content.mjs.map +1 -1
  102. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +6 -0
  103. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts.map +1 -1
  104. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +9 -2
  105. package/dist/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
  106. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +17 -6
  107. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
  108. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts +3 -0
  109. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
  110. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +17 -6
  111. package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
  112. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +7 -5
  113. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
  114. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts +2 -0
  115. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
  116. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +7 -5
  117. package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
  118. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +117 -55
  119. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
  120. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts +4 -2
  121. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
  122. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +115 -53
  123. package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
  124. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs +20 -18
  125. package/dist/components/DictionaryFieldEditor/JSONEditor.cjs.map +1 -1
  126. package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts +1 -0
  127. package/dist/components/DictionaryFieldEditor/JSONEditor.d.ts.map +1 -1
  128. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs +20 -18
  129. package/dist/components/DictionaryFieldEditor/JSONEditor.mjs.map +1 -1
  130. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.cjs +10 -2
  131. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.cjs.map +1 -1
  132. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts +2 -0
  133. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.d.ts.map +1 -1
  134. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs +10 -2
  135. package/dist/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs.map +1 -1
  136. package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelector.d.ts +8 -0
  137. package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelector.d.ts.map +1 -0
  138. package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelectorContext.d.ts +13 -0
  139. package/dist/components/DictionaryFieldEditor/LocaleSelector/LocaleSelectorContext.d.ts.map +1 -0
  140. package/dist/components/DictionaryFieldEditor/LocaleSelector/localeSelector.content.d.ts +9 -0
  141. package/dist/components/DictionaryFieldEditor/LocaleSelector/localeSelector.content.d.ts.map +1 -0
  142. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +10 -10
  143. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
  144. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +10 -10
  145. package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
  146. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +32 -23
  147. package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
  148. package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts +2 -0
  149. package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
  150. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +32 -23
  151. package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
  152. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +1 -1
  153. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
  154. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +1 -1
  155. package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
  156. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +59 -18
  157. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
  158. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.d.ts.map +1 -1
  159. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +62 -21
  160. package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
  161. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs +32 -0
  162. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.cjs.map +1 -1
  163. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts +4 -0
  164. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.d.ts.map +1 -1
  165. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs +32 -0
  166. package/dist/components/DictionaryFieldEditor/SaveForm/saveForm.content.mjs.map +1 -1
  167. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs +73 -0
  168. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.cjs.map +1 -0
  169. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts +7 -0
  170. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts.map +1 -0
  171. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +73 -0
  172. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs.map +1 -0
  173. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +37 -0
  174. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs.map +1 -0
  175. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts +14 -0
  176. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.d.ts.map +1 -0
  177. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +37 -0
  178. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs.map +1 -0
  179. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.cjs +8 -0
  180. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.cjs.map +1 -0
  181. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.d.ts +3 -0
  182. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.d.ts.map +1 -0
  183. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.mjs +8 -0
  184. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/index.mjs.map +1 -0
  185. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs +54 -0
  186. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.cjs.map +1 -0
  187. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts +10 -0
  188. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.d.ts.map +1 -0
  189. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs +55 -0
  190. package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/versionSwitcherDropDown.content.mjs.map +1 -0
  191. package/dist/components/DictionaryFieldEditor/index.cjs +5 -0
  192. package/dist/components/DictionaryFieldEditor/index.cjs.map +1 -1
  193. package/dist/components/DictionaryFieldEditor/index.d.ts +1 -0
  194. package/dist/components/DictionaryFieldEditor/index.d.ts.map +1 -1
  195. package/dist/components/DictionaryFieldEditor/index.mjs +6 -1
  196. package/dist/components/DictionaryFieldEditor/index.mjs.map +1 -1
  197. package/dist/components/DropDown/index.cjs.map +1 -1
  198. package/dist/components/DropDown/index.d.ts +18 -1
  199. package/dist/components/DropDown/index.d.ts.map +1 -1
  200. package/dist/components/DropDown/index.mjs.map +1 -1
  201. package/dist/components/EditableField/EditableFieldInput.cjs +5 -1
  202. package/dist/components/EditableField/EditableFieldInput.cjs.map +1 -1
  203. package/dist/components/EditableField/EditableFieldInput.d.ts.map +1 -1
  204. package/dist/components/EditableField/EditableFieldInput.mjs +6 -2
  205. package/dist/components/EditableField/EditableFieldInput.mjs.map +1 -1
  206. package/dist/components/EditableField/EditableFieldTextArea.cjs +2 -8
  207. package/dist/components/EditableField/EditableFieldTextArea.cjs.map +1 -1
  208. package/dist/components/EditableField/EditableFieldTextArea.d.ts.map +1 -1
  209. package/dist/components/EditableField/EditableFieldTextArea.mjs +2 -8
  210. package/dist/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
  211. package/dist/components/Form/FormLabel.cjs +6 -2
  212. package/dist/components/Form/FormLabel.cjs.map +1 -1
  213. package/dist/components/Form/FormLabel.d.ts.map +1 -1
  214. package/dist/components/Form/FormLabel.mjs +6 -2
  215. package/dist/components/Form/FormLabel.mjs.map +1 -1
  216. package/dist/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
  217. package/dist/components/Form/elements/EditableFieldInputElement.d.ts.map +1 -1
  218. package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
  219. package/dist/components/Form/elements/EditableFieldTextAreaElement.d.ts.map +1 -1
  220. package/dist/components/Form/elements/SelectElement.d.ts.map +1 -1
  221. package/dist/components/Headers/index.cjs +1 -1
  222. package/dist/components/Headers/index.cjs.map +1 -1
  223. package/dist/components/Headers/index.mjs +1 -1
  224. package/dist/components/Headers/index.mjs.map +1 -1
  225. package/dist/components/IDE/Code.cjs +77 -0
  226. package/dist/components/IDE/Code.cjs.map +1 -0
  227. package/dist/components/IDE/Code.d.ts +18 -0
  228. package/dist/components/IDE/Code.d.ts.map +1 -0
  229. package/dist/components/IDE/Code.mjs +77 -0
  230. package/dist/components/IDE/Code.mjs.map +1 -0
  231. package/dist/components/IDE/CodeBlock.cjs +54 -0
  232. package/dist/components/IDE/CodeBlock.cjs.map +1 -0
  233. package/dist/components/IDE/CodeBlock.d.ts +12 -0
  234. package/dist/components/IDE/CodeBlock.d.ts.map +1 -0
  235. package/dist/components/IDE/CodeBlock.mjs +54 -0
  236. package/dist/components/IDE/CodeBlock.mjs.map +1 -0
  237. package/dist/components/IDE/CodeBlockClient.cjs +55 -0
  238. package/dist/components/IDE/CodeBlockClient.cjs.map +1 -0
  239. package/dist/components/IDE/CodeBlockClient.mjs +55 -0
  240. package/dist/components/IDE/CodeBlockClient.mjs.map +1 -0
  241. package/dist/components/IDE/CodeBlockLoader.cjs +28 -0
  242. package/dist/components/IDE/CodeBlockLoader.cjs.map +1 -0
  243. package/dist/components/IDE/CodeBlockLoader.d.ts +4 -0
  244. package/dist/components/IDE/CodeBlockLoader.d.ts.map +1 -0
  245. package/dist/components/IDE/CodeBlockLoader.mjs +28 -0
  246. package/dist/components/IDE/CodeBlockLoader.mjs.map +1 -0
  247. package/dist/components/IDE/CodeBlockServer.cjs +53 -0
  248. package/dist/components/IDE/CodeBlockServer.cjs.map +1 -0
  249. package/dist/components/IDE/CodeBlockServer.d.ts +12 -0
  250. package/dist/components/IDE/CodeBlockServer.d.ts.map +1 -0
  251. package/dist/components/IDE/CodeBlockServer.mjs +53 -0
  252. package/dist/components/IDE/CodeBlockServer.mjs.map +1 -0
  253. package/dist/components/IDE/CodeBlockShiki.d.ts +3 -0
  254. package/dist/components/IDE/CodeBlockShiki.d.ts.map +1 -0
  255. package/dist/components/IDE/CodeBlockclient.d.ts +12 -0
  256. package/dist/components/IDE/CodeBlockclient.d.ts.map +1 -0
  257. package/dist/components/IDE/CodeConditionalRenderer.cjs +20 -0
  258. package/dist/components/IDE/CodeConditionalRenderer.cjs.map +1 -0
  259. package/dist/components/IDE/CodeConditionalRenderer.d.ts +4 -0
  260. package/dist/components/IDE/CodeConditionalRenderer.d.ts.map +1 -0
  261. package/dist/components/IDE/CodeConditionalRenderer.mjs +20 -0
  262. package/dist/components/IDE/CodeConditionalRenderer.mjs.map +1 -0
  263. package/dist/components/IDE/CodeContext.cjs +57 -0
  264. package/dist/components/IDE/CodeContext.cjs.map +1 -0
  265. package/dist/components/IDE/CodeContext.d.ts +26 -0
  266. package/dist/components/IDE/CodeContext.d.ts.map +1 -0
  267. package/dist/components/IDE/CodeContext.mjs +57 -0
  268. package/dist/components/IDE/CodeContext.mjs.map +1 -0
  269. package/dist/components/IDE/CodeFormatSelector.cjs +30 -0
  270. package/dist/components/IDE/CodeFormatSelector.cjs.map +1 -0
  271. package/dist/components/IDE/CodeFormatSelector.d.ts +3 -0
  272. package/dist/components/IDE/CodeFormatSelector.d.ts.map +1 -0
  273. package/dist/components/IDE/CodeFormatSelector.mjs +30 -0
  274. package/dist/components/IDE/CodeFormatSelector.mjs.map +1 -0
  275. package/dist/components/IDE/CodeRender copy.cjs +141 -0
  276. package/dist/components/IDE/CodeRender copy.cjs.map +1 -0
  277. package/dist/components/IDE/CodeRender copy.d.ts +14 -0
  278. package/dist/components/IDE/CodeRender copy.d.ts.map +1 -0
  279. package/dist/components/IDE/CodeRender copy.mjs +141 -0
  280. package/dist/components/IDE/CodeRender copy.mjs.map +1 -0
  281. package/dist/components/IDE/CodeRender.cjs +39 -625
  282. package/dist/components/IDE/CodeRender.cjs.map +1 -1
  283. package/dist/components/IDE/CodeRender.d.ts +4 -5
  284. package/dist/components/IDE/CodeRender.d.ts.map +1 -1
  285. package/dist/components/IDE/CodeRender.mjs +40 -604
  286. package/dist/components/IDE/CodeRender.mjs.map +1 -1
  287. package/dist/components/IDE/CodeRenderer.cjs +27 -0
  288. package/dist/components/IDE/CodeRenderer.cjs.map +1 -0
  289. package/dist/components/IDE/CodeRenderer.d.ts +5 -0
  290. package/dist/components/IDE/CodeRenderer.d.ts.map +1 -0
  291. package/dist/components/IDE/CodeRenderer.mjs +27 -0
  292. package/dist/components/IDE/CodeRenderer.mjs.map +1 -0
  293. package/dist/components/IDE/ContentDeclarationFormatSelector.cjs +28 -0
  294. package/dist/components/IDE/ContentDeclarationFormatSelector.cjs.map +1 -0
  295. package/dist/components/IDE/ContentDeclarationFormatSelector.d.ts +3 -0
  296. package/dist/components/IDE/ContentDeclarationFormatSelector.d.ts.map +1 -0
  297. package/dist/components/IDE/ContentDeclarationFormatSelector.mjs +28 -0
  298. package/dist/components/IDE/ContentDeclarationFormatSelector.mjs.map +1 -0
  299. package/dist/components/IDE/CopyButton.cjs +40 -0
  300. package/dist/components/IDE/CopyButton.cjs.map +1 -0
  301. package/dist/components/IDE/CopyButton.content.cjs +26 -0
  302. package/dist/components/IDE/CopyButton.content.cjs.map +1 -0
  303. package/dist/components/IDE/CopyButton.content.d.ts +8 -0
  304. package/dist/components/IDE/CopyButton.content.d.ts.map +1 -0
  305. package/dist/components/IDE/CopyButton.content.mjs +26 -0
  306. package/dist/components/IDE/CopyButton.content.mjs.map +1 -0
  307. package/dist/components/IDE/CopyButton.d.ts +7 -0
  308. package/dist/components/IDE/CopyButton.d.ts.map +1 -0
  309. package/dist/components/IDE/CopyButton.mjs +40 -0
  310. package/dist/components/IDE/CopyButton.mjs.map +1 -0
  311. package/dist/components/IDE/EditableCodeBlock.d.ts +9 -0
  312. package/dist/components/IDE/EditableCodeBlock.d.ts.map +1 -0
  313. package/dist/components/IDE/IDE.cjs +1 -1
  314. package/dist/components/IDE/IDE.cjs.map +1 -1
  315. package/dist/components/IDE/IDE.mjs +1 -1
  316. package/dist/components/IDE/IDE.mjs.map +1 -1
  317. package/dist/components/IDE/MarkDownRender.cjs +11 -4
  318. package/dist/components/IDE/MarkDownRender.cjs.map +1 -1
  319. package/dist/components/IDE/MarkDownRender.d.ts.map +1 -1
  320. package/dist/components/IDE/MarkDownRender.mjs +11 -4
  321. package/dist/components/IDE/MarkDownRender.mjs.map +1 -1
  322. package/dist/components/IDE/MonacoCode.cjs +129 -0
  323. package/dist/components/IDE/MonacoCode.cjs.map +1 -0
  324. package/dist/components/IDE/MonacoCode.d.ts +14 -0
  325. package/dist/components/IDE/MonacoCode.d.ts.map +1 -0
  326. package/dist/components/IDE/MonacoCode.mjs +129 -0
  327. package/dist/components/IDE/MonacoCode.mjs.map +1 -0
  328. package/dist/components/IDE/PackageManagerSelector.cjs +20 -0
  329. package/dist/components/IDE/PackageManagerSelector.cjs.map +1 -0
  330. package/dist/components/IDE/PackageManagerSelector.d.ts +3 -0
  331. package/dist/components/IDE/PackageManagerSelector.d.ts.map +1 -0
  332. package/dist/components/IDE/PackageManagerSelector.mjs +20 -0
  333. package/dist/components/IDE/PackageManagerSelector.mjs.map +1 -0
  334. package/dist/components/IDE/index.cjs +2 -2
  335. package/dist/components/IDE/index.d.ts +1 -1
  336. package/dist/components/IDE/index.d.ts.map +1 -1
  337. package/dist/components/IDE/index.mjs +1 -1
  338. package/dist/components/Link/Link.cjs +50 -31
  339. package/dist/components/Link/Link.cjs.map +1 -1
  340. package/dist/components/Link/Link.d.ts +3 -0
  341. package/dist/components/Link/Link.d.ts.map +1 -1
  342. package/dist/components/Link/Link.mjs +51 -32
  343. package/dist/components/Link/Link.mjs.map +1 -1
  344. package/dist/components/Link/index.cjs +1 -0
  345. package/dist/components/Link/index.cjs.map +1 -1
  346. package/dist/components/Link/index.mjs +3 -2
  347. package/dist/components/LocaleSwitcherContentDropDown/LocaleSelectorContext.d.ts +13 -0
  348. package/dist/components/LocaleSwitcherContentDropDown/LocaleSelectorContext.d.ts.map +1 -0
  349. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +218 -0
  350. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs.map +1 -0
  351. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts +8 -0
  352. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.d.ts.map +1 -0
  353. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +218 -0
  354. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -0
  355. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +42 -0
  356. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs.map +1 -0
  357. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts +15 -0
  358. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.d.ts.map +1 -0
  359. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +42 -0
  360. package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs.map +1 -0
  361. package/dist/components/LocaleSwitcherContentDropDown/index.cjs +8 -0
  362. package/dist/components/LocaleSwitcherContentDropDown/index.cjs.map +1 -0
  363. package/dist/components/LocaleSwitcherContentDropDown/index.d.ts +3 -0
  364. package/dist/components/LocaleSwitcherContentDropDown/index.d.ts.map +1 -0
  365. package/dist/components/LocaleSwitcherContentDropDown/index.mjs +8 -0
  366. package/dist/components/LocaleSwitcherContentDropDown/index.mjs.map +1 -0
  367. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs +118 -0
  368. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.cjs.map +1 -0
  369. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts +18 -0
  370. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.d.ts.map +1 -0
  371. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs +119 -0
  372. package/dist/components/LocaleSwitcherContentDropDown/localeSwitcher.content.mjs.map +1 -0
  373. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs +110 -34
  374. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.cjs.map +1 -1
  375. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts +2 -0
  376. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.d.ts.map +1 -1
  377. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +111 -35
  378. package/dist/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs.map +1 -1
  379. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs +63 -1
  380. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.cjs.map +1 -1
  381. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts +6 -0
  382. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.d.ts.map +1 -1
  383. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs +63 -1
  384. package/dist/components/LocaleSwitcherDropDown/localeSwitcher.content.mjs.map +1 -1
  385. package/dist/components/MarkDownRender/index.cjs +22 -26
  386. package/dist/components/MarkDownRender/index.cjs.map +1 -1
  387. package/dist/components/MarkDownRender/index.d.ts +5 -1
  388. package/dist/components/MarkDownRender/index.d.ts.map +1 -1
  389. package/dist/components/MarkDownRender/index.mjs +22 -26
  390. package/dist/components/MarkDownRender/index.mjs.map +1 -1
  391. package/dist/components/Modal/Modal.cjs +11 -13
  392. package/dist/components/Modal/Modal.cjs.map +1 -1
  393. package/dist/components/Modal/Modal.d.ts +1 -1
  394. package/dist/components/Modal/Modal.d.ts.map +1 -1
  395. package/dist/components/Modal/Modal.mjs +11 -13
  396. package/dist/components/Modal/Modal.mjs.map +1 -1
  397. package/dist/components/Navbar/DesktopNavbar.cjs +1 -1
  398. package/dist/components/Navbar/DesktopNavbar.cjs.map +1 -1
  399. package/dist/components/Navbar/DesktopNavbar.mjs +1 -1
  400. package/dist/components/Navbar/DesktopNavbar.mjs.map +1 -1
  401. package/dist/components/SwitchSelector/index.cjs +4 -0
  402. package/dist/components/SwitchSelector/index.cjs.map +1 -1
  403. package/dist/components/SwitchSelector/index.d.ts.map +1 -1
  404. package/dist/components/SwitchSelector/index.mjs +5 -1
  405. package/dist/components/SwitchSelector/index.mjs.map +1 -1
  406. package/dist/components/index.cjs +21 -4
  407. package/dist/components/index.cjs.map +1 -1
  408. package/dist/components/index.d.ts +3 -1
  409. package/dist/components/index.d.ts.map +1 -1
  410. package/dist/components/index.mjs +21 -4
  411. package/dist/components/index.mjs.map +1 -1
  412. package/dist/design-system.css +235 -0
  413. package/dist/hooks/index.cjs +13 -0
  414. package/dist/hooks/index.cjs.map +1 -1
  415. package/dist/hooks/index.d.ts +1 -0
  416. package/dist/hooks/index.d.ts.map +1 -1
  417. package/dist/hooks/index.mjs +14 -1
  418. package/dist/hooks/index.mjs.map +1 -1
  419. package/dist/hooks/intlayerAPIHooks.cjs +86 -5
  420. package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
  421. package/dist/hooks/intlayerAPIHooks.d.ts +15 -1
  422. package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
  423. package/dist/hooks/intlayerAPIHooks.mjs +86 -5
  424. package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
  425. package/dist/hooks/useAsync/index.cjs +3 -0
  426. package/dist/hooks/useAsync/index.cjs.map +1 -1
  427. package/dist/hooks/useAsync/index.d.ts +1 -0
  428. package/dist/hooks/useAsync/index.d.ts.map +1 -1
  429. package/dist/hooks/useAsync/index.mjs +4 -1
  430. package/dist/hooks/useAsync/index.mjs.map +1 -1
  431. package/dist/hooks/useAsync/useAsync.cjs +2 -9
  432. package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
  433. package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
  434. package/dist/hooks/useAsync/useAsync.mjs +3 -10
  435. package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
  436. package/dist/hooks/useAsync/useAsyncStateStore.cjs +123 -73
  437. package/dist/hooks/useAsync/useAsyncStateStore.cjs.map +1 -1
  438. package/dist/hooks/useAsync/useAsyncStateStore.d.ts +35 -11
  439. package/dist/hooks/useAsync/useAsyncStateStore.d.ts.map +1 -1
  440. package/dist/hooks/useAsync/useAsyncStateStore.mjs +123 -73
  441. package/dist/hooks/useAsync/useAsyncStateStore.mjs.map +1 -1
  442. package/dist/hooks/useGetAllDictionaries.cjs +4 -2
  443. package/dist/hooks/useGetAllDictionaries.cjs.map +1 -1
  444. package/dist/hooks/useGetAllDictionaries.d.ts +4 -1
  445. package/dist/hooks/useGetAllDictionaries.d.ts.map +1 -1
  446. package/dist/hooks/useGetAllDictionaries.mjs +4 -2
  447. package/dist/hooks/useGetAllDictionaries.mjs.map +1 -1
  448. package/dist/hooks/useIntlayerAPI.d.ts +13 -1
  449. package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
  450. package/dist/hooks/useIsDarkMode.cjs +15 -0
  451. package/dist/hooks/useIsDarkMode.cjs.map +1 -0
  452. package/dist/hooks/useIsDarkMode.d.ts +2 -0
  453. package/dist/hooks/useIsDarkMode.d.ts.map +1 -0
  454. package/dist/hooks/useIsDarkMode.mjs +15 -0
  455. package/dist/hooks/useIsDarkMode.mjs.map +1 -0
  456. package/dist/hooks/usePersistedStore.cjs +17 -5
  457. package/dist/hooks/usePersistedStore.cjs.map +1 -1
  458. package/dist/hooks/usePersistedStore.d.ts.map +1 -1
  459. package/dist/hooks/usePersistedStore.mjs +17 -5
  460. package/dist/hooks/usePersistedStore.mjs.map +1 -1
  461. package/dist/libs/intlayer-api/ai.cjs +54 -0
  462. package/dist/libs/intlayer-api/ai.cjs.map +1 -0
  463. package/dist/libs/intlayer-api/ai.d.ts +16 -0
  464. package/dist/libs/intlayer-api/ai.d.ts.map +1 -0
  465. package/dist/libs/intlayer-api/ai.mjs +54 -0
  466. package/dist/libs/intlayer-api/ai.mjs.map +1 -0
  467. package/dist/libs/intlayer-api/dictionary.cjs +2 -2
  468. package/dist/libs/intlayer-api/dictionary.cjs.map +1 -1
  469. package/dist/libs/intlayer-api/dictionary.d.ts +3 -3
  470. package/dist/libs/intlayer-api/dictionary.d.ts.map +1 -1
  471. package/dist/libs/intlayer-api/dictionary.mjs +2 -2
  472. package/dist/libs/intlayer-api/dictionary.mjs.map +1 -1
  473. package/dist/libs/intlayer-api/index.cjs +5 -1
  474. package/dist/libs/intlayer-api/index.cjs.map +1 -1
  475. package/dist/libs/intlayer-api/index.d.ts +26 -2
  476. package/dist/libs/intlayer-api/index.d.ts.map +1 -1
  477. package/dist/libs/intlayer-api/index.mjs +5 -1
  478. package/dist/libs/intlayer-api/index.mjs.map +1 -1
  479. package/dist/libs/intlayer-api/tag.cjs +52 -0
  480. package/dist/libs/intlayer-api/tag.cjs.map +1 -0
  481. package/dist/libs/intlayer-api/tag.d.ts +16 -0
  482. package/dist/libs/intlayer-api/tag.d.ts.map +1 -0
  483. package/dist/libs/intlayer-api/tag.mjs +52 -0
  484. package/dist/libs/intlayer-api/tag.mjs.map +1 -0
  485. package/dist/tailwind.css +1 -1
  486. package/package.json +20 -18
@@ -1 +1 @@
1
- {"version":3,"file":"useAsyncStateStore.mjs","sources":["../../../src/hooks/useAsync/useAsyncStateStore.ts"],"sourcesContent":["import { create } from 'zustand';\n\ntype States<T> = {\n isLoading: boolean;\n isFetched: boolean;\n isInvalidated: boolean;\n fetchedDateTime: null | Date;\n error: string | null;\n isSuccess: boolean;\n data: T | null;\n retryCount: number;\n isEnabled: boolean;\n};\n\ntype StateSlice<T> = {\n [key: string]: States<T>;\n};\n\ntype Actions<T> = {\n getStates: (key: string) => States<T>;\n setQueryState: (key: string, value: Partial<States<T>>) => void;\n setQueriesState: (key: string[], value: Partial<States<T>>) => void;\n makeQueryInError: (key: string, error: string) => void;\n resetKeyState: (key: string[]) => void;\n resetState: (excludedKey: string[]) => void;\n};\n\ntype AsyncState<T> = {\n states: StateSlice<T>;\n} & Actions<T>;\n\nconst createDefaultStates = <T>(): States<T> => ({\n isFetched: false,\n fetchedDateTime: null,\n isLoading: false,\n isInvalidated: false,\n error: null,\n isSuccess: false,\n data: null,\n retryCount: 0,\n isEnabled: true,\n});\n\n/**\n * If the value is not an array. Transform it en array\n *\n * @param value value to transform en array if not array\n * @returns array\n */\nconst ensureArray = <T>(value?: T | T[]): T[] => {\n if (!value) {\n return [];\n } else if (Array.isArray(value)) {\n return value;\n }\n\n return [value];\n};\n\n/**\n * Return all keys that match\n *\n * @param {string[]} selectorsKeys - List of key to check - example: ['getProducts']\n * @param {string[]} keysWithArgs - List of keys that can includes args - example: [\"getProducts\", \"getProducts/{'ids':['id1','id2']}\", \"getUsers\", \"getUsers/{'ids':['id1','id2']}\" ]\n * @returns {string[]} - key that match the selectors - example: [\"getProducts\", \"getProducts/{'ids':['id1','id2']}\" ]\n */\nconst getMatchKeys = (\n selectorsKeys: string[],\n keysWithArgs: string[]\n): string[] => {\n const matchedKeys: string[] = keysWithArgs.filter((key) =>\n selectorsKeys.includes(key.split('/')[0])\n );\n\n return matchedKeys;\n};\n\nexport const useAsyncStateStore = create<AsyncState<unknown>>((set, get) => ({\n states: {},\n\n getStates: (key) => get().states[key] ?? createDefaultStates<unknown>(),\n\n setQueryState: (key, value) =>\n set((state) => ({\n states: {\n ...state.states,\n [key]: {\n ...(state.states[key] ?? createDefaultStates<unknown>()),\n ...value,\n },\n },\n })),\n\n makeQueryInError: (key, error) =>\n set((state) => ({\n states: {\n ...state.states,\n [key]: {\n ...(state.states[key] ?? createDefaultStates<unknown>()),\n error: error,\n isFetched: true,\n isSuccess: false,\n retryCount: (state.states[key]?.retryCount ?? 0) + 1,\n isLoading: false,\n isInvalidated: false,\n },\n },\n })),\n\n setQueriesState: (keys, value) => {\n const keyArray = ensureArray(keys);\n if (keyArray.length === 0) return;\n\n set((state) => ({\n states: {\n ...state.states,\n ...keyArray.reduce((acc, key) => {\n acc[key] = {\n ...(state.states[key] ?? createDefaultStates<unknown>()),\n ...value,\n };\n return acc;\n }, {} as StateSlice<unknown>),\n },\n }));\n },\n\n resetKeyState: (keys) => {\n const keyArray = ensureArray(keys);\n if (keyArray.length === 0) return;\n\n set((state) => {\n const allKeys = Object.keys(state.states);\n const matchedKeys = getMatchKeys(keyArray, allKeys);\n\n if (matchedKeys.length === 0) return {};\n\n const resetStates = matchedKeys.reduce((acc, key) => {\n acc[key] = createDefaultStates<unknown>();\n return acc;\n }, {} as StateSlice<unknown>);\n\n return {\n states: {\n ...state.states,\n ...resetStates,\n },\n };\n });\n },\n\n resetState: (excludedKeys) => {\n const excludeArray = ensureArray(excludedKeys);\n const allKeys = Object.keys(get().states);\n const matchedKeys = getMatchKeys(excludeArray, allKeys);\n\n set((state) => {\n const newStates = allKeys.reduce((acc, key) => {\n acc[key] = matchedKeys.includes(key)\n ? state.states[key]\n : createDefaultStates<unknown>();\n return acc;\n }, {} as StateSlice<unknown>);\n\n return {\n states: newStates,\n };\n });\n },\n}));\n"],"names":[],"mappings":"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"}
1
+ {"version":3,"file":"useAsyncStateStore.mjs","sources":["../../../src/hooks/useAsync/useAsyncStateStore.tsx"],"sourcesContent":["'use client';\n\nimport {\n createContext,\n useContext,\n useReducer,\n PropsWithChildren,\n} from 'react';\n\n/**\n * Represents the states for a given key in the asynchronous state management.\n * This includes flags for loading, fetched, invalidation, and success/error status.\n * It also keeps track of the fetched datetime, retry counts, the data itself, and whether queries are enabled.\n */\ntype States<T> = {\n isLoading: boolean;\n isFetched: boolean;\n isInvalidated: boolean;\n fetchedDateTime: null | Date;\n error: string | null;\n isSuccess: boolean;\n data: T | null;\n retryCount: number;\n isEnabled: boolean;\n};\n\n/**\n * Holds a mapping from a key (string) to its associated state.\n */\ntype StateSlice<T> = {\n [key: string]: States<T>;\n};\n\n/**\n * Describes all the possible actions that can be dispatched to the reducer.\n * These actions allow setting or updating states for specific keys or multiple keys at once,\n * handling errors, and resetting states.\n */\ntype Actions<T> =\n | { type: 'SET_QUERY_STATE'; key: string; value: Partial<States<T>> }\n | { type: 'MAKE_QUERY_IN_ERROR'; key: string; error: string }\n | { type: 'SET_QUERIES_STATE'; keys: string[]; value: Partial<States<T>> }\n | { type: 'RESET_KEY_STATE'; keys: string[] }\n | { type: 'RESET_STATE'; excludeKeys: string[] };\n\n/**\n * The shape of the entire asynchronous state, holding all states in a single object.\n */\ntype AsyncState<T> = {\n states: StateSlice<T>;\n};\n\n/**\n * Creates a default state object with initial values. This is useful when a key\n * has not been initialized yet or when resetting a state back to defaults.\n */\nconst createDefaultStates = <T,>(): States<T> => ({\n isFetched: false,\n fetchedDateTime: null,\n isLoading: false,\n isInvalidated: false,\n error: null,\n isSuccess: false,\n data: null,\n retryCount: 0,\n isEnabled: true,\n});\n\n/**\n * Ensures that a given value is returned as an array.\n * If the value is undefined or null, returns an empty array.\n * If the value is not already an array, wraps it in one.\n */\nconst ensureArray = <T,>(value?: T | T[]): T[] => {\n if (!value) {\n // If no value is provided, return an empty array\n return [];\n } else if (Array.isArray(value)) {\n // If it's already an array, just return it\n return value;\n }\n // If it's a single value, wrap it in an array\n return [value];\n};\n\n/**\n * Given a list of selector keys and a list of keys that may contain arguments,\n * this function returns all keys that match the selectors. Matching is determined\n * by comparing the initial part (split by \"/\") of the key.\n *\n * For example:\n * selectorsKeys = [\"user\", \"posts\"]\n * keysWithArgs = [\"user/123\", \"posts/active\", \"comments/42\"]\n * Result = [\"user/123\", \"posts/active\"]\n */\nconst getMatchKeys = (\n selectorsKeys: string[],\n keysWithArgs: string[]\n): string[] =>\n keysWithArgs.filter((key) => selectorsKeys.includes(key.split('/')[0]));\n\n/**\n * The reducer function handling all state transitions. It takes the current state and an action,\n * and returns a new state based on the type of the action.\n *\n * Actions include:\n * - SET_QUERY_STATE: Update a single key with partial new state.\n * - MAKE_QUERY_IN_ERROR: Mark a single key as errored and update related flags.\n * - SET_QUERIES_STATE: Update multiple keys at once with partial new state.\n * - RESET_KEY_STATE: Reset certain keys to their default states.\n * - RESET_STATE: Reset all keys to their default states except those excluded.\n */\nconst reducer = <T,>(\n state: AsyncState<T>,\n action: Actions<T>\n): AsyncState<T> => {\n switch (action.type) {\n case 'SET_QUERY_STATE': {\n const { key, value } = action;\n return {\n ...state,\n states: {\n ...state.states,\n [key]: {\n // Merge existing state for the key or default state if not present\n ...(state.states[key] ?? createDefaultStates<T>()),\n ...value,\n },\n },\n };\n }\n case 'MAKE_QUERY_IN_ERROR': {\n const { key, error } = action;\n return {\n ...state,\n states: {\n ...state.states,\n [key]: {\n // Merge existing state or default if not found\n ...(state.states[key] ?? createDefaultStates<T>()),\n // Explicitly set error and related flags\n error,\n isFetched: true,\n isSuccess: false,\n retryCount: (state.states[key]?.retryCount ?? 0) + 1,\n isLoading: false,\n isInvalidated: false,\n },\n },\n };\n }\n case 'SET_QUERIES_STATE': {\n const { keys, value } = action;\n const keyArray = ensureArray(keys);\n if (keyArray.length === 0) return state;\n\n // Update multiple keys in a single action\n const updatedStates = { ...state.states };\n keyArray.forEach((key) => {\n updatedStates[key] = {\n ...(state.states[key] ?? createDefaultStates<T>()),\n ...value,\n };\n });\n\n return {\n ...state,\n states: updatedStates,\n };\n }\n case 'RESET_KEY_STATE': {\n const { keys } = action;\n const keyArray = ensureArray(keys);\n if (keyArray.length === 0) return state;\n\n // Find all keys that match the given selectors\n const allKeys = Object.keys(state.states);\n const matchedKeys = getMatchKeys(keyArray, allKeys);\n if (matchedKeys.length === 0) return state;\n\n // Reset the matched keys back to default states\n const resetStates = { ...state.states };\n matchedKeys.forEach((key) => {\n resetStates[key] = createDefaultStates<T>();\n });\n\n return {\n ...state,\n states: resetStates,\n };\n }\n case 'RESET_STATE': {\n const excludeArray = ensureArray(action.excludeKeys);\n const allKeys = Object.keys(state.states);\n const matchedKeys = getMatchKeys(excludeArray, allKeys);\n\n // Reset all states except those that match the exclude keys\n const newStates: StateSlice<T> = {};\n allKeys.forEach((key) => {\n newStates[key] = matchedKeys.includes(key)\n ? state.states[key]\n : createDefaultStates<T>();\n });\n\n return {\n ...state,\n states: newStates,\n };\n }\n default:\n return state;\n }\n};\n\n/**\n * The context type that will be provided to consumers.\n * It exposes a set of functions for interacting with the asynchronous state:\n * - getStates: Retrieve the current state for a given key.\n * - setQueryState: Partially update a single key's state.\n * - setQueriesState: Partially update multiple keys' states.\n * - makeQueryInError: Set a particular key into an error state.\n * - resetKeyState: Reset certain keys to their default states.\n * - resetState: Reset all keys to their default states except a set of excluded ones.\n */\ntype AsyncStateContextType<T> = {\n getStates: (key: string) => States<T>;\n setQueryState: (key: string, value: Partial<States<T>>) => void;\n setQueriesState: (keys: string[], value: Partial<States<T>>) => void;\n makeQueryInError: (key: string, error: string) => void;\n resetKeyState: (keys: string[]) => void;\n resetState: (excludedKeys: string[]) => void;\n};\n\n/**\n * Creates a React context for asynchronous state management.\n * This context will be provided by the AsyncStateProvider and consumed by hooks like useAsyncState.\n */\nconst AsyncStateContext = createContext<AsyncStateContextType<unknown> | null>(\n null\n);\n\n/**\n * A provider component that wraps its children and provides the asynchronous\n * state context. It uses the reducer to manage states and dispatch actions\n * based on consumer interactions.\n *\n * @param children The React children elements that should have access to this context.\n */\nexport const AsyncStateProvider = ({ children }: PropsWithChildren<{}>) => {\n // Initialize the reducer with an empty state object\n const [asyncState, dispatch] = useReducer(reducer, { states: {} });\n\n /**\n * Retrieve the state associated with a given key. If no state exists for that key,\n * return a default state.\n *\n * @param key The key for which to retrieve the state.\n */\n const getStates = (key: string) =>\n asyncState.states[key] ?? createDefaultStates<unknown>();\n\n /**\n * Partially update the state for a given key.\n *\n * @param key The key to update.\n * @param value A partial state object to merge with the existing state.\n */\n const setQueryState = (key: string, value: Partial<States<unknown>>) => {\n dispatch({ type: 'SET_QUERY_STATE', key, value });\n };\n\n /**\n * Partially update the state for multiple keys at once.\n *\n * @param keys An array of keys to update.\n * @param value A partial state object to merge with each key's existing state.\n */\n const setQueriesState = (keys: string[], value: Partial<States<unknown>>) => {\n dispatch({ type: 'SET_QUERIES_STATE', keys, value });\n };\n\n /**\n * Mark a given query as having encountered an error.\n *\n * @param key The key associated with the query.\n * @param error The error message to set.\n */\n const makeQueryInError = (key: string, error: string) => {\n dispatch({ type: 'MAKE_QUERY_IN_ERROR', key, error });\n };\n\n /**\n * Reset certain keys back to their default states.\n *\n * @param keys The keys to reset.\n */\n const resetKeyState = (keys: string[]) => {\n dispatch({ type: 'RESET_KEY_STATE', keys });\n };\n\n /**\n * Reset the entire state back to defaults, except for keys that match the excluded ones.\n *\n * @param excludedKeys Keys that should not be reset.\n */\n const resetState = (excludedKeys: string[]) => {\n dispatch({ type: 'RESET_STATE', excludeKeys: excludedKeys });\n };\n\n return (\n <AsyncStateContext.Provider\n value={{\n getStates,\n setQueryState,\n setQueriesState,\n makeQueryInError,\n resetKeyState,\n resetState,\n }}\n >\n {children}\n </AsyncStateContext.Provider>\n );\n};\n\n/**\n * A custom hook for accessing the asynchronous state context. It throws an error if used\n * outside of a provider.\n *\n * @returns The asynchronous state context value.\n */\nexport const useAsyncState = () => {\n const context = useContext(AsyncStateContext);\n if (!context) {\n throw new Error('useAsyncState must be used within an AsyncStateProvider');\n }\n return context;\n};\n"],"names":["jsx"],"mappings":"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"}
@@ -5,8 +5,10 @@ const localeDictionaries = require("@intlayer/dictionaries-entry");
5
5
  const merge = require("deepmerge");
6
6
  const require$$0 = require("react");
7
7
  const hooks_intlayerAPIHooks = require("./intlayerAPIHooks.cjs");
8
- const useGetAllDictionaries = () => {
9
- const { data: onlineDictionariesAPI, isLoading } = hooks_intlayerAPIHooks.useGetDictionaries();
8
+ const useGetAllDictionaries = (...props) => {
9
+ const { data: onlineDictionariesAPI, isLoading } = hooks_intlayerAPIHooks.useGetDictionaries(
10
+ ...props
11
+ );
10
12
  const onlineDictionaries = require$$0.useMemo(
11
13
  () => (onlineDictionariesAPI?.data ?? []).reduce(
12
14
  (acc, dictionary) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useGetAllDictionaries.cjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport { Dictionary } from '@intlayer/core';\nimport localeDictionaries from '@intlayer/dictionaries-entry';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\nexport const useGetAllDictionaries = () => {\n const { data: onlineDictionariesAPI, isLoading } = useGetDictionaries();\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading,\n };\n};\n"],"names":["useGetDictionaries","useMemo"],"mappings":";;;;;;;AAaO,MAAM,wBAAwB,MAAM;AACzC,QAAM,EAAE,MAAM,uBAAuB,UAAA,IAAcA,uBAAAA,mBAAmB;AAEtE,QAAM,qBAAiDC,WAAA;AAAA,IACrD,OACG,uBAAuB,QAAQ,CAAA,GAAI;AAAA,MAClC,CAAC,KAAK,eAAe;AACf,YAAA,WAAW,GAAG,IAAI;AACf,eAAA;AAAA,MACT;AAAA,MACA,CAAA;AAAA,IACF;AAAA,IACF,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,kBAA8CA,WAAA;AAAA,IAClD,MAAM,MAAM,sBAAsB,IAAI,kBAAkB;AAAA,IACxD,CAAC,kBAAkB;AAAA,EACrB;AAEO,SAAA;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL;AAAA,EACF;AACF;;"}
1
+ {"version":3,"file":"useGetAllDictionaries.cjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport { Dictionary } from '@intlayer/core';\nimport localeDictionaries from '@intlayer/dictionaries-entry';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\ntype Args = Parameters<typeof useGetDictionaries>;\n\nexport const useGetAllDictionaries = (...props: Args) => {\n const { data: onlineDictionariesAPI, isLoading } = useGetDictionaries(\n ...props\n );\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading,\n };\n};\n"],"names":["useGetDictionaries","useMemo"],"mappings":";;;;;;;AAea,MAAA,wBAAwB,IAAI,UAAgB;AACvD,QAAM,EAAE,MAAM,uBAAuB,UAAc,IAAAA,uBAAA;AAAA,IACjD,GAAG;AAAA,EACL;AAEA,QAAM,qBAAiDC,WAAA;AAAA,IACrD,OACG,uBAAuB,QAAQ,CAAA,GAAI;AAAA,MAClC,CAAC,KAAK,eAAe;AACf,YAAA,WAAW,GAAG,IAAI;AACf,eAAA;AAAA,MACT;AAAA,MACA,CAAA;AAAA,IACF;AAAA,IACF,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,kBAA8CA,WAAA;AAAA,IAClD,MAAM,MAAM,sBAAsB,IAAI,kBAAkB;AAAA,IACxD,CAAC,kBAAkB;AAAA,EACrB;AAEO,SAAA;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL;AAAA,EACF;AACF;;"}
@@ -1,8 +1,11 @@
1
1
  import { Dictionary } from '@intlayer/core';
2
- export declare const useGetAllDictionaries: () => {
2
+ import { useGetDictionaries } from './intlayerAPIHooks';
3
+ type Args = Parameters<typeof useGetDictionaries>;
4
+ export declare const useGetAllDictionaries: (args?: import('./useAsync').UseAsyncOptions<(filters?: import('@intlayer/backend').GetDictionariesParams, otherOptions?: import('../libs/intlayer-api/fetcher').FetcherOptions) => Promise<import('@intlayer/backend').GetDictionariesResult>> | undefined) => {
3
5
  online: Record<string, Dictionary>;
4
6
  locale: Record<string, Dictionary>;
5
7
  all: Record<string, Dictionary>;
6
8
  isLoading: boolean;
7
9
  };
10
+ export {};
8
11
  //# sourceMappingURL=useGetAllDictionaries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useGetAllDictionaries.d.ts","sourceRoot":"","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAM5C,eAAO,MAAM,qBAAqB;;;;;CA0BjC,CAAC"}
1
+ {"version":3,"file":"useGetAllDictionaries.d.ts","sourceRoot":"","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAI5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAExD,KAAK,IAAI,GAAG,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAElD,eAAO,MAAM,qBAAqB;;;;;CA4BjC,CAAC"}
@@ -3,8 +3,10 @@ import localeDictionaries from "@intlayer/dictionaries-entry";
3
3
  import merge from "deepmerge";
4
4
  import { useMemo } from "react";
5
5
  import { useGetDictionaries } from "./intlayerAPIHooks.mjs";
6
- const useGetAllDictionaries = () => {
7
- const { data: onlineDictionariesAPI, isLoading } = useGetDictionaries();
6
+ const useGetAllDictionaries = (...props) => {
7
+ const { data: onlineDictionariesAPI, isLoading } = useGetDictionaries(
8
+ ...props
9
+ );
8
10
  const onlineDictionaries = useMemo(
9
11
  () => (onlineDictionariesAPI?.data ?? []).reduce(
10
12
  (acc, dictionary) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useGetAllDictionaries.mjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport { Dictionary } from '@intlayer/core';\nimport localeDictionaries from '@intlayer/dictionaries-entry';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\nexport const useGetAllDictionaries = () => {\n const { data: onlineDictionariesAPI, isLoading } = useGetDictionaries();\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading,\n };\n};\n"],"names":[],"mappings":";;;;;AAaO,MAAM,wBAAwB,MAAM;AACzC,QAAM,EAAE,MAAM,uBAAuB,UAAA,IAAc,mBAAmB;AAEtE,QAAM,qBAAiD;AAAA,IACrD,OACG,uBAAuB,QAAQ,CAAA,GAAI;AAAA,MAClC,CAAC,KAAK,eAAe;AACf,YAAA,WAAW,GAAG,IAAI;AACf,eAAA;AAAA,MACT;AAAA,MACA,CAAA;AAAA,IACF;AAAA,IACF,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,kBAA8C;AAAA,IAClD,MAAM,MAAM,sBAAsB,IAAI,kBAAkB;AAAA,IACxD,CAAC,kBAAkB;AAAA,EACrB;AAEO,SAAA;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL;AAAA,EACF;AACF;"}
1
+ {"version":3,"file":"useGetAllDictionaries.mjs","sources":["../../src/hooks/useGetAllDictionaries.tsx"],"sourcesContent":["'use client';\n\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport { Dictionary } from '@intlayer/core';\nimport localeDictionaries from '@intlayer/dictionaries-entry';\nimport merge from 'deepmerge';\nimport { useMemo } from 'react';\nimport { useGetDictionaries } from './intlayerAPIHooks';\n\ntype Args = Parameters<typeof useGetDictionaries>;\n\nexport const useGetAllDictionaries = (...props: Args) => {\n const { data: onlineDictionariesAPI, isLoading } = useGetDictionaries(\n ...props\n );\n\n const onlineDictionaries: Record<string, Dictionary> = useMemo(\n () =>\n (onlineDictionariesAPI?.data ?? []).reduce(\n (acc, dictionary) => {\n acc[dictionary.key] = dictionary;\n return acc;\n },\n {} as Record<string, Dictionary>\n ),\n [onlineDictionariesAPI]\n );\n\n const allDictionaries: Record<string, Dictionary> = useMemo(\n () => merge(onlineDictionaries ?? {}, localeDictionaries),\n [onlineDictionaries]\n );\n\n return {\n online: onlineDictionaries,\n locale: localeDictionaries,\n all: allDictionaries,\n isLoading,\n };\n};\n"],"names":[],"mappings":";;;;;AAea,MAAA,wBAAwB,IAAI,UAAgB;AACvD,QAAM,EAAE,MAAM,uBAAuB,UAAc,IAAA;AAAA,IACjD,GAAG;AAAA,EACL;AAEA,QAAM,qBAAiD;AAAA,IACrD,OACG,uBAAuB,QAAQ,CAAA,GAAI;AAAA,MAClC,CAAC,KAAK,eAAe;AACf,YAAA,WAAW,GAAG,IAAI;AACf,eAAA;AAAA,MACT;AAAA,MACA,CAAA;AAAA,IACF;AAAA,IACF,CAAC,qBAAqB;AAAA,EACxB;AAEA,QAAM,kBAA8C;AAAA,IAClD,MAAM,MAAM,sBAAsB,IAAI,kBAAkB;AAAA,IACxD,CAAC,kBAAkB;AAAA,EACrB;AAEO,SAAA;AAAA,IACL,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,KAAK;AAAA,IACL;AAAA,EACF;AACF;"}
@@ -55,12 +55,24 @@ export declare const useIntlayerAuth: (options?: FetcherOptions) => {
55
55
  getDictionary: (dictionaryKey: import('@intlayer/backend').GetDictionaryParams["dictionaryKey"], version?: import('@intlayer/backend').GetDictionaryQuery["version"], otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').GetDictionaryResult>;
56
56
  pushDictionaries: (dictionaries: import('@intlayer/backend').PushDictionariesBody["dictionaries"], otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').PushDictionariesResult>;
57
57
  addDictionary: (dictionary: import('@intlayer/backend').AddDictionaryBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').AddDictionaryResult>;
58
- updateDictionary: (dictionary: import('@intlayer/backend').UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').UpdateDictionaryResult>;
58
+ updateDictionary: (dictionaryId: import('@intlayer/backend').UpdateDictionaryParam["dictionaryId"], dictionary: import('@intlayer/backend').UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').UpdateDictionaryResult>;
59
59
  deleteDictionary: (id: import('@intlayer/backend').DeleteDictionaryParam["dictionaryId"], otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').DeleteDictionaryResult>;
60
60
  };
61
61
  stripe: {
62
62
  getSubscription: (body?: import('@intlayer/backend').GetCheckoutSessionBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').GetCheckoutSessionResult>;
63
63
  cancelSubscription: (otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').GetCheckoutSessionResult>;
64
64
  };
65
+ ai: {
66
+ auditContentDeclaration: (body?: import('@intlayer/backend').AuditContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').AuditContentDeclarationResult>;
67
+ auditContentDeclarationField: (body?: import('@intlayer/backend').AuditContentDeclarationFieldBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').AuditContentDeclarationFieldResult>;
68
+ auditContentDeclarationMetadata: (body?: import('@intlayer/backend').AuditContentDeclarationMetadataBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').AuditContentDeclarationMetadataResult>;
69
+ auditTag: (body?: import('@intlayer/backend').AuditTagBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').AuditTagResult>;
70
+ };
71
+ tag: {
72
+ getTags: (filters?: import('@intlayer/backend').GetTagsParams, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').GetTagsResult>;
73
+ addTag: (tag: import('@intlayer/backend').AddTagBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').AddTagResult>;
74
+ updateTag: (tagId: import('@intlayer/backend').UpdateTagParams["tagId"], tag: import('@intlayer/backend').UpdateTagBody, otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').UpdateTagResult>;
75
+ deleteTag: (tagId: import('@intlayer/backend').DeleteTagParams["tagId"], otherOptions?: FetcherOptions) => Promise<import('@intlayer/backend').DeleteTagResult>;
76
+ };
65
77
  };
66
78
  //# sourceMappingURL=useIntlayerAPI.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayerAPI.d.ts","sourceRoot":"","sources":["../../src/hooks/useIntlayerAPI.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAO,MAAM,eAAe,aAAc,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BvD,CAAC"}
1
+ {"version":3,"file":"useIntlayerAPI.d.ts","sourceRoot":"","sources":["../../src/hooks/useIntlayerAPI.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,eAAO,MAAM,eAAe,aAAc,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BvD,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ "use strict";
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
4
+ const require$$0 = require("react");
5
+ const useIsDarkMode = () => {
6
+ const [isDarkMode, setIsDarkMode] = require$$0.useState(false);
7
+ require$$0.useEffect(() => {
8
+ const htmlElement = document.querySelector("html");
9
+ const isDarkMode2 = htmlElement?.getAttribute("data-theme") === "dark";
10
+ setIsDarkMode(isDarkMode2);
11
+ }, []);
12
+ return isDarkMode;
13
+ };
14
+ exports.useIsDarkMode = useIsDarkMode;
15
+ //# sourceMappingURL=useIsDarkMode.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsDarkMode.cjs","sources":["../../src/hooks/useIsDarkMode.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const useIsDarkMode = () => {\n const [isDarkMode, setIsDarkMode] = useState(false);\n\n useEffect(() => {\n const htmlElement = document.querySelector('html');\n const isDarkMode = htmlElement?.getAttribute('data-theme') === 'dark';\n setIsDarkMode(isDarkMode);\n }, []);\n\n return isDarkMode;\n};\n"],"names":["useState","useEffect","isDarkMode"],"mappings":";;;;AAIO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,YAAY,aAAa,IAAIA,WAAAA,SAAS,KAAK;AAElDC,aAAAA,UAAU,MAAM;AACR,UAAA,cAAc,SAAS,cAAc,MAAM;AACjD,UAAMC,cAAa,aAAa,aAAa,YAAY,MAAM;AAC/D,kBAAcA,WAAU;AAAA,EAC1B,GAAG,EAAE;AAEE,SAAA;AACT;;"}
@@ -0,0 +1,2 @@
1
+ export declare const useIsDarkMode: () => boolean;
2
+ //# sourceMappingURL=useIsDarkMode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsDarkMode.d.ts","sourceRoot":"","sources":["../../src/hooks/useIsDarkMode.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,aAAa,eAUzB,CAAC"}
@@ -0,0 +1,15 @@
1
+ "use client";
2
+ import { useState, useEffect } from "react";
3
+ const useIsDarkMode = () => {
4
+ const [isDarkMode, setIsDarkMode] = useState(false);
5
+ useEffect(() => {
6
+ const htmlElement = document.querySelector("html");
7
+ const isDarkMode2 = htmlElement?.getAttribute("data-theme") === "dark";
8
+ setIsDarkMode(isDarkMode2);
9
+ }, []);
10
+ return isDarkMode;
11
+ };
12
+ export {
13
+ useIsDarkMode
14
+ };
15
+ //# sourceMappingURL=useIsDarkMode.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useIsDarkMode.mjs","sources":["../../src/hooks/useIsDarkMode.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const useIsDarkMode = () => {\n const [isDarkMode, setIsDarkMode] = useState(false);\n\n useEffect(() => {\n const htmlElement = document.querySelector('html');\n const isDarkMode = htmlElement?.getAttribute('data-theme') === 'dark';\n setIsDarkMode(isDarkMode);\n }, []);\n\n return isDarkMode;\n};\n"],"names":["isDarkMode"],"mappings":";;AAIO,MAAM,gBAAgB,MAAM;AACjC,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,KAAK;AAElD,YAAU,MAAM;AACR,UAAA,cAAc,SAAS,cAAc,MAAM;AACjD,UAAMA,cAAa,aAAa,aAAa,YAAY,MAAM;AAC/D,kBAAcA,WAAU;AAAA,EAC1B,GAAG,EAAE;AAEE,SAAA;AACT;"}
@@ -5,18 +5,30 @@ const require$$0 = require("react");
5
5
  const usePersistedStore = (key, initialValue) => {
6
6
  const [state, setState] = require$$0.useState(() => {
7
7
  if (typeof window === "undefined") return initialValue;
8
- const persistedState = sessionStorage?.getItem(key);
8
+ const persistedState = localStorage?.getItem(key);
9
9
  if (persistedState) {
10
- return JSON.parse(persistedState);
10
+ try {
11
+ setState(JSON.parse(persistedState));
12
+ } catch (e) {
13
+ console.error(e);
14
+ }
11
15
  }
12
16
  return initialValue;
13
17
  });
14
18
  require$$0.useEffect(() => {
15
- const persistedState = sessionStorage?.getItem(key);
19
+ const persistedState = localStorage?.getItem(key);
16
20
  if (persistedState) {
17
- setState(JSON.parse(persistedState));
21
+ try {
22
+ setState(JSON.parse(persistedState));
23
+ } catch (e) {
24
+ console.error(e);
25
+ }
18
26
  }
19
- }, [key, initialValue]);
27
+ }, [key]);
28
+ require$$0.useEffect(() => {
29
+ if (state === void 0) return;
30
+ localStorage?.setItem(key, JSON.stringify(state));
31
+ }, [key, state]);
20
32
  return [state, setState];
21
33
  };
22
34
  exports.usePersistedStore = usePersistedStore;
@@ -1 +1 @@
1
- {"version":3,"file":"usePersistedStore.cjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const usePersistedStore = <T>(key: string, initialValue?: T) => {\n const [state, setState] = useState<T>(() => {\n if (typeof window === 'undefined') return initialValue as T;\n\n const persistedState = sessionStorage?.getItem(key);\n\n if (persistedState) {\n return JSON.parse(persistedState);\n }\n\n return initialValue as T;\n });\n\n useEffect(() => {\n const persistedState = sessionStorage?.getItem(key);\n\n if (persistedState) {\n setState(JSON.parse(persistedState));\n }\n }, [key, initialValue]);\n\n return [state, setState] as const;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIa,MAAA,oBAAoB,CAAI,KAAa,iBAAqB;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAIA,oBAAY,MAAM;AACtC,QAAA,OAAO,WAAW,YAAoB,QAAA;AAEpC,UAAA,iBAAiB,gBAAgB,QAAQ,GAAG;AAElD,QAAI,gBAAgB;AACX,aAAA,KAAK,MAAM,cAAc;AAAA,IAAA;AAG3B,WAAA;AAAA,EAAA,CACR;AAEDC,aAAAA,UAAU,MAAM;AACR,UAAA,iBAAiB,gBAAgB,QAAQ,GAAG;AAElD,QAAI,gBAAgB;AACT,eAAA,KAAK,MAAM,cAAc,CAAC;AAAA,IAAA;AAAA,EACrC,GACC,CAAC,KAAK,YAAY,CAAC;AAEf,SAAA,CAAC,OAAO,QAAQ;AACzB;;"}
1
+ {"version":3,"file":"usePersistedStore.cjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const usePersistedStore = <T>(key: string, initialValue?: T) => {\n const [state, setState] = useState<T>(() => {\n if (typeof window === 'undefined') return initialValue as T;\n\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n }\n\n return initialValue as T;\n });\n\n useEffect(() => {\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n }\n }, [key]);\n\n useEffect(() => {\n if (state === undefined) return;\n\n localStorage?.setItem(key, JSON.stringify(state));\n }, [key, state]);\n\n return [state, setState] as const;\n};\n"],"names":["useState","useEffect"],"mappings":";;;;AAIa,MAAA,oBAAoB,CAAI,KAAa,iBAAqB;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAIA,oBAAY,MAAM;AACtC,QAAA,OAAO,WAAW,YAAoB,QAAA;AAEpC,UAAA,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,QAAI,gBAAgB;AACd,UAAA;AACO,iBAAA,KAAK,MAAM,cAAc,CAAC;AAAA,eAC5B,GAAG;AACV,gBAAQ,MAAM,CAAC;AAAA,MAAA;AAAA,IACjB;AAGK,WAAA;AAAA,EAAA,CACR;AAEDC,aAAAA,UAAU,MAAM;AACR,UAAA,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,QAAI,gBAAgB;AACd,UAAA;AACO,iBAAA,KAAK,MAAM,cAAc,CAAC;AAAA,eAC5B,GAAG;AACV,gBAAQ,MAAM,CAAC;AAAA,MAAA;AAAA,IACjB;AAAA,EACF,GACC,CAAC,GAAG,CAAC;AAERA,aAAAA,UAAU,MAAM;AACd,QAAI,UAAU,OAAW;AAEzB,kBAAc,QAAQ,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EAAA,GAC/C,CAAC,KAAK,KAAK,CAAC;AAER,SAAA,CAAC,OAAO,QAAQ;AACzB;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"usePersistedStore.d.ts","sourceRoot":"","sources":["../../src/hooks/usePersistedStore.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAAI,CAAC,OAAO,MAAM,iBAAiB,CAAC,8EAsBjE,CAAC"}
1
+ {"version":3,"file":"usePersistedStore.d.ts","sourceRoot":"","sources":["../../src/hooks/usePersistedStore.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,iBAAiB,GAAI,CAAC,OAAO,MAAM,iBAAiB,CAAC,8EAoCjE,CAAC"}
@@ -3,18 +3,30 @@ import { useState, useEffect } from "react";
3
3
  const usePersistedStore = (key, initialValue) => {
4
4
  const [state, setState] = useState(() => {
5
5
  if (typeof window === "undefined") return initialValue;
6
- const persistedState = sessionStorage?.getItem(key);
6
+ const persistedState = localStorage?.getItem(key);
7
7
  if (persistedState) {
8
- return JSON.parse(persistedState);
8
+ try {
9
+ setState(JSON.parse(persistedState));
10
+ } catch (e) {
11
+ console.error(e);
12
+ }
9
13
  }
10
14
  return initialValue;
11
15
  });
12
16
  useEffect(() => {
13
- const persistedState = sessionStorage?.getItem(key);
17
+ const persistedState = localStorage?.getItem(key);
14
18
  if (persistedState) {
15
- setState(JSON.parse(persistedState));
19
+ try {
20
+ setState(JSON.parse(persistedState));
21
+ } catch (e) {
22
+ console.error(e);
23
+ }
16
24
  }
17
- }, [key, initialValue]);
25
+ }, [key]);
26
+ useEffect(() => {
27
+ if (state === void 0) return;
28
+ localStorage?.setItem(key, JSON.stringify(state));
29
+ }, [key, state]);
18
30
  return [state, setState];
19
31
  };
20
32
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"usePersistedStore.mjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const usePersistedStore = <T>(key: string, initialValue?: T) => {\n const [state, setState] = useState<T>(() => {\n if (typeof window === 'undefined') return initialValue as T;\n\n const persistedState = sessionStorage?.getItem(key);\n\n if (persistedState) {\n return JSON.parse(persistedState);\n }\n\n return initialValue as T;\n });\n\n useEffect(() => {\n const persistedState = sessionStorage?.getItem(key);\n\n if (persistedState) {\n setState(JSON.parse(persistedState));\n }\n }, [key, initialValue]);\n\n return [state, setState] as const;\n};\n"],"names":[],"mappings":";;AAIa,MAAA,oBAAoB,CAAI,KAAa,iBAAqB;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAY,MAAM;AACtC,QAAA,OAAO,WAAW,YAAoB,QAAA;AAEpC,UAAA,iBAAiB,gBAAgB,QAAQ,GAAG;AAElD,QAAI,gBAAgB;AACX,aAAA,KAAK,MAAM,cAAc;AAAA,IAAA;AAG3B,WAAA;AAAA,EAAA,CACR;AAED,YAAU,MAAM;AACR,UAAA,iBAAiB,gBAAgB,QAAQ,GAAG;AAElD,QAAI,gBAAgB;AACT,eAAA,KAAK,MAAM,cAAc,CAAC;AAAA,IAAA;AAAA,EACrC,GACC,CAAC,KAAK,YAAY,CAAC;AAEf,SAAA,CAAC,OAAO,QAAQ;AACzB;"}
1
+ {"version":3,"file":"usePersistedStore.mjs","sources":["../../src/hooks/usePersistedStore.ts"],"sourcesContent":["'use client';\n\nimport { useState, useEffect } from 'react';\n\nexport const usePersistedStore = <T>(key: string, initialValue?: T) => {\n const [state, setState] = useState<T>(() => {\n if (typeof window === 'undefined') return initialValue as T;\n\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n }\n\n return initialValue as T;\n });\n\n useEffect(() => {\n const persistedState = localStorage?.getItem(key);\n\n if (persistedState) {\n try {\n setState(JSON.parse(persistedState));\n } catch (e) {\n console.error(e);\n }\n }\n }, [key]);\n\n useEffect(() => {\n if (state === undefined) return;\n\n localStorage?.setItem(key, JSON.stringify(state));\n }, [key, state]);\n\n return [state, setState] as const;\n};\n"],"names":[],"mappings":";;AAIa,MAAA,oBAAoB,CAAI,KAAa,iBAAqB;AACrE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAY,MAAM;AACtC,QAAA,OAAO,WAAW,YAAoB,QAAA;AAEpC,UAAA,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,QAAI,gBAAgB;AACd,UAAA;AACO,iBAAA,KAAK,MAAM,cAAc,CAAC;AAAA,eAC5B,GAAG;AACV,gBAAQ,MAAM,CAAC;AAAA,MAAA;AAAA,IACjB;AAGK,WAAA;AAAA,EAAA,CACR;AAED,YAAU,MAAM;AACR,UAAA,iBAAiB,cAAc,QAAQ,GAAG;AAEhD,QAAI,gBAAgB;AACd,UAAA;AACO,iBAAA,KAAK,MAAM,cAAc,CAAC;AAAA,eAC5B,GAAG;AACV,gBAAQ,MAAM,CAAC;AAAA,MAAA;AAAA,IACjB;AAAA,EACF,GACC,CAAC,GAAG,CAAC;AAER,YAAU,MAAM;AACd,QAAI,UAAU,OAAW;AAEzB,kBAAc,QAAQ,KAAK,KAAK,UAAU,KAAK,CAAC;AAAA,EAAA,GAC/C,CAAC,KAAK,KAAK,CAAC;AAER,SAAA,CAAC,OAAO,QAAQ;AACzB;"}
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const client = require("@intlayer/config/client");
4
+ const libs_intlayerApi_fetcher = require("./fetcher.cjs");
5
+ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
6
+ const { backendURL } = (intlayerConfig ?? client.getConfiguration()).editor;
7
+ const AI_API_ROUTE = `${backendURL}/api/ai`;
8
+ const auditContentDeclaration = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
9
+ `${AI_API_ROUTE}/audit/content-declaration`,
10
+ authAPIOptions,
11
+ otherOptions,
12
+ {
13
+ method: "POST",
14
+ body
15
+ }
16
+ );
17
+ const auditContentDeclarationField = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
18
+ `${AI_API_ROUTE}/audit/content-declaration/field`,
19
+ authAPIOptions,
20
+ otherOptions,
21
+ {
22
+ method: "POST",
23
+ body
24
+ }
25
+ );
26
+ const auditContentDeclarationMetadata = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
27
+ `${AI_API_ROUTE}/audit/content-declaration/metadata`,
28
+ authAPIOptions,
29
+ otherOptions,
30
+ {
31
+ method: "POST",
32
+ body
33
+ }
34
+ );
35
+ const auditTag = async (body, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
36
+ `${AI_API_ROUTE}/audit/tag`,
37
+ authAPIOptions,
38
+ otherOptions,
39
+ {
40
+ method: "POST",
41
+ body
42
+ }
43
+ );
44
+ return {
45
+ auditContentDeclaration,
46
+ auditContentDeclarationField,
47
+ auditContentDeclarationMetadata,
48
+ auditTag
49
+ };
50
+ };
51
+ const userAPI = getAiAPI();
52
+ exports.getAiAPI = getAiAPI;
53
+ exports.userAPI = userAPI;
54
+ //# sourceMappingURL=ai.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.cjs","sources":["../../../src/libs/intlayer-api/ai.ts"],"sourcesContent":["import type {\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/content-declaration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/content-declaration/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/content-declaration/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n };\n};\n\nexport const userAPI = getAiAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAaO,MAAM,WAAW,CACtB,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkBA,OAAAA,iBAAoB,GAAA;AACxD,QAAA,eAAe,GAAG,UAAU;AAOlC,QAAM,0BAA0B,OAC9B,MACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,+BAA+B,OACnC,MACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,kCAAkC,OACtC,MACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,WAAW,OACf,MACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,UAAU,SAAS;;;"}
@@ -0,0 +1,16 @@
1
+ import { AuditContentDeclarationBody, AuditContentDeclarationFieldBody, AuditContentDeclarationFieldResult, AuditContentDeclarationMetadataBody, AuditContentDeclarationMetadataResult, AuditContentDeclarationResult, AuditTagBody, AuditTagResult } from '@intlayer/backend';
2
+ import { IntlayerConfig } from '@intlayer/config/client';
3
+ import { FetcherOptions } from './fetcher';
4
+ export declare const getAiAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
5
+ auditContentDeclaration: (body?: AuditContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationResult>;
6
+ auditContentDeclarationField: (body?: AuditContentDeclarationFieldBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationFieldResult>;
7
+ auditContentDeclarationMetadata: (body?: AuditContentDeclarationMetadataBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationMetadataResult>;
8
+ auditTag: (body?: AuditTagBody, otherOptions?: FetcherOptions) => Promise<AuditTagResult>;
9
+ };
10
+ export declare const userAPI: {
11
+ auditContentDeclaration: (body?: AuditContentDeclarationBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationResult>;
12
+ auditContentDeclarationField: (body?: AuditContentDeclarationFieldBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationFieldResult>;
13
+ auditContentDeclarationMetadata: (body?: AuditContentDeclarationMetadataBody, otherOptions?: FetcherOptions) => Promise<AuditContentDeclarationMetadataResult>;
14
+ auditTag: (body?: AuditTagBody, otherOptions?: FetcherOptions) => Promise<AuditTagResult>;
15
+ };
16
+ //# sourceMappingURL=ai.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/ai.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,2BAA2B,EAC3B,gCAAgC,EAChC,kCAAkC,EAClC,mCAAmC,EACnC,qCAAqC,EACrC,6BAA6B,EAC7B,YAAY,EACZ,cAAc,EACf,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,QAAQ,oBACH,cAAc,mBACb,cAAc;qCAWtB,2BAA2B,iBACpB,cAAc;0CAkBrB,gCAAgC,iBACzB,cAAc;6CAkBrB,mCAAmC,iBAC5B,cAAc;sBAkBrB,YAAY,iBACL,cAAc;CAkB/B,CAAC;AAEF,eAAO,MAAM,OAAO;qCA9ET,2BAA2B,iBACpB,cAAc;0CAkBrB,gCAAgC,iBACzB,cAAc;6CAkBrB,mCAAmC,iBAC5B,cAAc;sBAkBrB,YAAY,iBACL,cAAc;CAoBC,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { getConfiguration } from "@intlayer/config/client";
2
+ import { fetcher } from "./fetcher.mjs";
3
+ const getAiAPI = (authAPIOptions = {}, intlayerConfig) => {
4
+ const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;
5
+ const AI_API_ROUTE = `${backendURL}/api/ai`;
6
+ const auditContentDeclaration = async (body, otherOptions = {}) => await fetcher(
7
+ `${AI_API_ROUTE}/audit/content-declaration`,
8
+ authAPIOptions,
9
+ otherOptions,
10
+ {
11
+ method: "POST",
12
+ body
13
+ }
14
+ );
15
+ const auditContentDeclarationField = async (body, otherOptions = {}) => await fetcher(
16
+ `${AI_API_ROUTE}/audit/content-declaration/field`,
17
+ authAPIOptions,
18
+ otherOptions,
19
+ {
20
+ method: "POST",
21
+ body
22
+ }
23
+ );
24
+ const auditContentDeclarationMetadata = async (body, otherOptions = {}) => await fetcher(
25
+ `${AI_API_ROUTE}/audit/content-declaration/metadata`,
26
+ authAPIOptions,
27
+ otherOptions,
28
+ {
29
+ method: "POST",
30
+ body
31
+ }
32
+ );
33
+ const auditTag = async (body, otherOptions = {}) => await fetcher(
34
+ `${AI_API_ROUTE}/audit/tag`,
35
+ authAPIOptions,
36
+ otherOptions,
37
+ {
38
+ method: "POST",
39
+ body
40
+ }
41
+ );
42
+ return {
43
+ auditContentDeclaration,
44
+ auditContentDeclarationField,
45
+ auditContentDeclarationMetadata,
46
+ auditTag
47
+ };
48
+ };
49
+ const userAPI = getAiAPI();
50
+ export {
51
+ getAiAPI,
52
+ userAPI
53
+ };
54
+ //# sourceMappingURL=ai.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ai.mjs","sources":["../../../src/libs/intlayer-api/ai.ts"],"sourcesContent":["import type {\n AuditContentDeclarationBody,\n AuditContentDeclarationFieldBody,\n AuditContentDeclarationFieldResult,\n AuditContentDeclarationMetadataBody,\n AuditContentDeclarationMetadataResult,\n AuditContentDeclarationResult,\n AuditTagBody,\n AuditTagResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getAiAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const AI_API_ROUTE = `${backendURL}/api/ai`;\n\n /**\n * Audits a content declaration file\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclaration = async (\n body?: AuditContentDeclarationBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationResult>(\n `${AI_API_ROUTE}/audit/content-declaration`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration field\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationField = async (\n body?: AuditContentDeclarationFieldBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationFieldResult>(\n `${AI_API_ROUTE}/audit/content-declaration/field`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a content declaration file to retrieve title, description and tags\n * @param body - Audit file parameters.\n * @returns Audited file content.\n */\n const auditContentDeclarationMetadata = async (\n body?: AuditContentDeclarationMetadataBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditContentDeclarationMetadataResult>(\n `${AI_API_ROUTE}/audit/content-declaration/metadata`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n /**\n * Audits a tag\n * @param body - Audit tag parameters.\n * @returns Audited tag content.\n */\n const auditTag = async (\n body?: AuditTagBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AuditTagResult>(\n `${AI_API_ROUTE}/audit/tag`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: body,\n }\n );\n\n return {\n auditContentDeclaration,\n auditContentDeclarationField,\n auditContentDeclarationMetadata,\n auditTag,\n };\n};\n\nexport const userAPI = getAiAPI();\n"],"names":[],"mappings":";;AAaO,MAAM,WAAW,CACtB,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkB,iBAAoB,GAAA;AACxD,QAAA,eAAe,GAAG,UAAU;AAOlC,QAAM,0BAA0B,OAC9B,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,+BAA+B,OACnC,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,kCAAkC,OACtC,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAOF,QAAM,WAAW,OACf,MACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,YAAY;AAAA,IACf;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR;AAAA,IAAA;AAAA,EAEJ;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,UAAU,SAAS;"}
@@ -44,8 +44,8 @@ const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
44
44
  body: { dictionaries }
45
45
  }
46
46
  );
47
- const updateDictionary = async (dictionary, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
48
- `${PROJECT_API_ROUTE}`,
47
+ const updateDictionary = async (dictionaryId, dictionary, otherOptions = {}) => await libs_intlayerApi_fetcher.fetcher(
48
+ `${PROJECT_API_ROUTE}/${dictionaryId}`,
49
49
  authAPIOptions,
50
50
  otherOptions,
51
51
  {
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.cjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;\n\n /**\n * Retrieves a list of dictionaries based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getDictionaries = async (\n filters?: GetDictionariesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n `${PROJECT_API_ROUTE}/keys`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Retrieves a dictionary by its key and version.\n * @param dictionaryKey - Dictionary key.\n * @param version - Dictionary version of content.\n */\n const getDictionary = async (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryKey}`,\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n dictionary: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: dictionary,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { dictionaries },\n }\n );\n\n /**\n * Updates an existing dictionary in the database.\n * @param dictionary - Updated dictionary data.\n */\n const updateDictionary = async (\n dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: dictionary,\n }\n );\n\n /**\n * Deletes a dictionary from the database by its ID.\n * @param id - Dictionary ID.\n */\n const deleteDictionary = async (\n id: DeleteDictionaryParam['dictionaryId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { id },\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\nexport const dictionaryAPI = getDictionaryAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAmBO,MAAM,mBAAmB,CAC9B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkBA,OAAAA,iBAAoB,GAAA;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,kBAAkB,OACtB,SACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IAAA;AAAA,EAEZ;AAKF,QAAM,sBAAsB,OAAO,eAA+B,CAAA,MAChE,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AAOF,QAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,OAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB,IAAI,aAAa;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,eAAe;AAAA,IAAA;AAAA,EAExD;AAMF,QAAM,gBAAgB,OACpB,YACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAEF,QAAM,mBAAmB,OACvB,cACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,aAAa;AAAA,IAAA;AAAA,EAEzB;AAMF,QAAM,mBAAmB,OACvB,YACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAMF,QAAM,mBAAmB,OACvB,IACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,GAAG;AAAA,IAAA;AAAA,EAEf;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,gBAAgB,iBAAiB;;;"}
1
+ {"version":3,"file":"dictionary.cjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryParam,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;\n\n /**\n * Retrieves a list of dictionaries based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getDictionaries = async (\n filters?: GetDictionariesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n `${PROJECT_API_ROUTE}/keys`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Retrieves a dictionary by its key and version.\n * @param dictionaryKey - Dictionary key.\n * @param version - Dictionary version of content.\n */\n const getDictionary = async (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryKey}`,\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n dictionary: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: dictionary,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { dictionaries },\n }\n );\n\n /**\n * Updates an existing dictionary in the database.\n * @param dictionary - Updated dictionary data.\n */\n const updateDictionary = async (\n dictionaryId: UpdateDictionaryParam['dictionaryId'],\n dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: dictionary,\n }\n );\n\n /**\n * Deletes a dictionary from the database by its ID.\n * @param id - Dictionary ID.\n */\n const deleteDictionary = async (\n id: DeleteDictionaryParam['dictionaryId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { id },\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\nexport const dictionaryAPI = getDictionaryAPI();\n"],"names":["getConfiguration","fetcher"],"mappings":";;;;AAoBO,MAAM,mBAAmB,CAC9B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkBA,OAAAA,iBAAoB,GAAA;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,kBAAkB,OACtB,SACA,eAA+B,CAAA,MAE/B,MAAMC,yBAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IAAA;AAAA,EAEZ;AAKF,QAAM,sBAAsB,OAAO,eAA+B,CAAA,MAChE,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AAOF,QAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,OAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB,IAAI,aAAa;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,eAAe;AAAA,IAAA;AAAA,EAExD;AAMF,QAAM,gBAAgB,OACpB,YACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAEF,QAAM,mBAAmB,OACvB,cACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,aAAa;AAAA,IAAA;AAAA,EAEzB;AAMF,QAAM,mBAAmB,OACvB,cACA,YACA,eAA+B,OAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB,IAAI,YAAY;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAMF,QAAM,mBAAmB,OACvB,IACA,eAA+B,CAAA,MAE/B,MAAMA,yBAAA;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,GAAG;AAAA,IAAA;AAAA,EAEf;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,gBAAgB,iBAAiB;;;"}
@@ -1,4 +1,4 @@
1
- import { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesParams, GetDictionariesResult, UpdateDictionaryBody, UpdateDictionaryResult, PushDictionariesBody, PushDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetDictionariesKeysResult } from '@intlayer/backend';
1
+ import { AddDictionaryBody, AddDictionaryResult, DeleteDictionaryParam, DeleteDictionaryResult, GetDictionariesParams, GetDictionariesResult, UpdateDictionaryParam, UpdateDictionaryBody, UpdateDictionaryResult, PushDictionariesBody, PushDictionariesResult, GetDictionaryParams, GetDictionaryQuery, GetDictionaryResult, GetDictionariesKeysResult } from '@intlayer/backend';
2
2
  import { IntlayerConfig } from '@intlayer/config/client';
3
3
  import { FetcherOptions } from './fetcher';
4
4
  export declare const getDictionaryAPI: (authAPIOptions?: FetcherOptions, intlayerConfig?: IntlayerConfig) => {
@@ -7,7 +7,7 @@ export declare const getDictionaryAPI: (authAPIOptions?: FetcherOptions, intlaye
7
7
  getDictionary: (dictionaryKey: GetDictionaryParams["dictionaryKey"], version?: GetDictionaryQuery["version"], otherOptions?: FetcherOptions) => Promise<GetDictionaryResult>;
8
8
  pushDictionaries: (dictionaries: PushDictionariesBody["dictionaries"], otherOptions?: FetcherOptions) => Promise<PushDictionariesResult>;
9
9
  addDictionary: (dictionary: AddDictionaryBody, otherOptions?: FetcherOptions) => Promise<AddDictionaryResult>;
10
- updateDictionary: (dictionary: UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<UpdateDictionaryResult>;
10
+ updateDictionary: (dictionaryId: UpdateDictionaryParam["dictionaryId"], dictionary: UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<UpdateDictionaryResult>;
11
11
  deleteDictionary: (id: DeleteDictionaryParam["dictionaryId"], otherOptions?: FetcherOptions) => Promise<DeleteDictionaryResult>;
12
12
  };
13
13
  export declare const dictionaryAPI: {
@@ -16,7 +16,7 @@ export declare const dictionaryAPI: {
16
16
  getDictionary: (dictionaryKey: GetDictionaryParams["dictionaryKey"], version?: GetDictionaryQuery["version"], otherOptions?: FetcherOptions) => Promise<GetDictionaryResult>;
17
17
  pushDictionaries: (dictionaries: PushDictionariesBody["dictionaries"], otherOptions?: FetcherOptions) => Promise<PushDictionariesResult>;
18
18
  addDictionary: (dictionary: AddDictionaryBody, otherOptions?: FetcherOptions) => Promise<AddDictionaryResult>;
19
- updateDictionary: (dictionary: UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<UpdateDictionaryResult>;
19
+ updateDictionary: (dictionaryId: UpdateDictionaryParam["dictionaryId"], dictionary: UpdateDictionaryBody, otherOptions?: FetcherOptions) => Promise<UpdateDictionaryResult>;
20
20
  deleteDictionary: (id: DeleteDictionaryParam["dictionaryId"], otherOptions?: FetcherOptions) => Promise<DeleteDictionaryResult>;
21
21
  };
22
22
  //# sourceMappingURL=dictionary.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,gBAAgB,oBACX,cAAc,mBACb,cAAc;gCAUnB,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;mCAa9C,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;gCAfhB,iBAAiB,iBACf,cAAc;mCA+BhB,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAqB/B,CAAC;AAEF,eAAO,MAAM,aAAa;gCAxHZ,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;mCAa9C,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;gCAfhB,iBAAiB,iBACf,cAAc;mCA+BhB,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAuBe,CAAC"}
1
+ {"version":3,"file":"dictionary.d.ts","sourceRoot":"","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,mBAAmB,EACnB,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,oBAAoB,EACpB,sBAAsB,EACtB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAoB,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAChF,OAAO,EAAW,KAAK,cAAc,EAAE,MAAM,WAAW,CAAC;AAEzD,eAAO,MAAM,gBAAgB,oBACX,cAAc,mBACb,cAAc;gCAUnB,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;mCAa9C,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;gCAfhB,iBAAiB,iBACf,cAAc;qCA+Bd,qBAAqB,CAAC,cAAc,CAAC,cACvC,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAqB/B,CAAC;AAEF,eAAO,MAAM,aAAa;gCAzHZ,qBAAqB,iBACjB,cAAc;yCAcmB,cAAc;mCAa9C,mBAAmB,CAAC,eAAe,CAAC,YACzC,kBAAkB,CAAC,SAAS,CAAC,iBACzB,cAAc;qCA8Bd,oBAAoB,CAAC,cAAc,CAAC,iBACpC,cAAc;gCAfhB,iBAAiB,iBACf,cAAc;qCA+Bd,qBAAqB,CAAC,cAAc,CAAC,cACvC,oBAAoB,iBAClB,cAAc;2BAiBxB,qBAAqB,CAAC,cAAc,CAAC,iBAC3B,cAAc;CAuBe,CAAC"}
@@ -42,8 +42,8 @@ const getDictionaryAPI = (authAPIOptions = {}, intlayerConfig) => {
42
42
  body: { dictionaries }
43
43
  }
44
44
  );
45
- const updateDictionary = async (dictionary, otherOptions = {}) => await fetcher(
46
- `${PROJECT_API_ROUTE}`,
45
+ const updateDictionary = async (dictionaryId, dictionary, otherOptions = {}) => await fetcher(
46
+ `${PROJECT_API_ROUTE}/${dictionaryId}`,
47
47
  authAPIOptions,
48
48
  otherOptions,
49
49
  {
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.mjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;\n\n /**\n * Retrieves a list of dictionaries based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getDictionaries = async (\n filters?: GetDictionariesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n `${PROJECT_API_ROUTE}/keys`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Retrieves a dictionary by its key and version.\n * @param dictionaryKey - Dictionary key.\n * @param version - Dictionary version of content.\n */\n const getDictionary = async (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryKey}`,\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n dictionary: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: dictionary,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { dictionaries },\n }\n );\n\n /**\n * Updates an existing dictionary in the database.\n * @param dictionary - Updated dictionary data.\n */\n const updateDictionary = async (\n dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: dictionary,\n }\n );\n\n /**\n * Deletes a dictionary from the database by its ID.\n * @param id - Dictionary ID.\n */\n const deleteDictionary = async (\n id: DeleteDictionaryParam['dictionaryId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { id },\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\nexport const dictionaryAPI = getDictionaryAPI();\n"],"names":[],"mappings":";;AAmBO,MAAM,mBAAmB,CAC9B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkB,iBAAoB,GAAA;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,kBAAkB,OACtB,SACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IAAA;AAAA,EAEZ;AAKF,QAAM,sBAAsB,OAAO,eAA+B,CAAA,MAChE,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AAOF,QAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,OAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB,IAAI,aAAa;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,eAAe;AAAA,IAAA;AAAA,EAExD;AAMF,QAAM,gBAAgB,OACpB,YACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAEF,QAAM,mBAAmB,OACvB,cACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,aAAa;AAAA,IAAA;AAAA,EAEzB;AAMF,QAAM,mBAAmB,OACvB,YACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAMF,QAAM,mBAAmB,OACvB,IACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,GAAG;AAAA,IAAA;AAAA,EAEf;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,gBAAgB,iBAAiB;"}
1
+ {"version":3,"file":"dictionary.mjs","sources":["../../../src/libs/intlayer-api/dictionary.ts"],"sourcesContent":["import type {\n AddDictionaryBody,\n AddDictionaryResult,\n DeleteDictionaryParam,\n DeleteDictionaryResult,\n GetDictionariesParams,\n GetDictionariesResult,\n UpdateDictionaryParam,\n UpdateDictionaryBody,\n UpdateDictionaryResult,\n PushDictionariesBody,\n PushDictionariesResult,\n GetDictionaryParams,\n GetDictionaryQuery,\n GetDictionaryResult,\n GetDictionariesKeysResult,\n} from '@intlayer/backend';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { fetcher, type FetcherOptions } from './fetcher';\n\nexport const getDictionaryAPI = (\n authAPIOptions: FetcherOptions = {},\n intlayerConfig?: IntlayerConfig\n) => {\n const { backendURL } = (intlayerConfig ?? getConfiguration()).editor;\n const PROJECT_API_ROUTE = `${backendURL}/api/dictionary`;\n\n /**\n * Retrieves a list of dictionaries based on filters and pagination.\n * @param filters - Filters and pagination options.\n */\n const getDictionaries = async (\n filters?: GetDictionariesParams,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionariesResult>(\n PROJECT_API_ROUTE,\n authAPIOptions,\n otherOptions,\n {\n params: filters,\n }\n );\n\n /**\n * Retrieves a list of dictionary keys related to the project.\n */\n const getDictionariesKeys = async (otherOptions: FetcherOptions = {}) =>\n await fetcher<GetDictionariesKeysResult>(\n `${PROJECT_API_ROUTE}/keys`,\n authAPIOptions,\n otherOptions\n );\n\n /**\n * Retrieves a dictionary by its key and version.\n * @param dictionaryKey - Dictionary key.\n * @param version - Dictionary version of content.\n */\n const getDictionary = async (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<GetDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryKey}`,\n authAPIOptions,\n otherOptions,\n {\n params: version ? { version: version.toString() } : undefined,\n }\n );\n\n /**\n * Adds a new dictionary to the database.\n * @param dictionary - Dictionary data.\n */\n const addDictionary = async (\n dictionary: AddDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<AddDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'POST',\n body: dictionary,\n }\n );\n\n const pushDictionaries = async (\n dictionaries: PushDictionariesBody['dictionaries'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<PushDictionariesResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PATCH',\n body: { dictionaries },\n }\n );\n\n /**\n * Updates an existing dictionary in the database.\n * @param dictionary - Updated dictionary data.\n */\n const updateDictionary = async (\n dictionaryId: UpdateDictionaryParam['dictionaryId'],\n dictionary: UpdateDictionaryBody,\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<UpdateDictionaryResult>(\n `${PROJECT_API_ROUTE}/${dictionaryId}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'PUT',\n body: dictionary,\n }\n );\n\n /**\n * Deletes a dictionary from the database by its ID.\n * @param id - Dictionary ID.\n */\n const deleteDictionary = async (\n id: DeleteDictionaryParam['dictionaryId'],\n otherOptions: FetcherOptions = {}\n ) =>\n await fetcher<DeleteDictionaryResult>(\n `${PROJECT_API_ROUTE}`,\n authAPIOptions,\n otherOptions,\n {\n method: 'DELETE',\n body: { id },\n }\n );\n\n return {\n getDictionaries,\n getDictionariesKeys,\n getDictionary,\n pushDictionaries,\n addDictionary,\n updateDictionary,\n deleteDictionary,\n };\n};\n\nexport const dictionaryAPI = getDictionaryAPI();\n"],"names":[],"mappings":";;AAoBO,MAAM,mBAAmB,CAC9B,iBAAiC,IACjC,mBACG;AACH,QAAM,EAAE,WAAgB,KAAA,kBAAkB,iBAAoB,GAAA;AACxD,QAAA,oBAAoB,GAAG,UAAU;AAMvC,QAAM,kBAAkB,OACtB,SACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,IAAA;AAAA,EAEZ;AAKF,QAAM,sBAAsB,OAAO,eAA+B,CAAA,MAChE,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,EACF;AAOF,QAAM,gBAAgB,OACpB,eACA,SACA,eAA+B,OAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB,IAAI,aAAa;AAAA,IACrC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ,UAAU,EAAE,SAAS,QAAQ,eAAe;AAAA,IAAA;AAAA,EAExD;AAMF,QAAM,gBAAgB,OACpB,YACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAEF,QAAM,mBAAmB,OACvB,cACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,aAAa;AAAA,IAAA;AAAA,EAEzB;AAMF,QAAM,mBAAmB,OACvB,cACA,YACA,eAA+B,OAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB,IAAI,YAAY;AAAA,IACpC;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM;AAAA,IAAA;AAAA,EAEV;AAMF,QAAM,mBAAmB,OACvB,IACA,eAA+B,CAAA,MAE/B,MAAM;AAAA,IACJ,GAAG,iBAAiB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,MACE,QAAQ;AAAA,MACR,MAAM,EAAE,GAAG;AAAA,IAAA;AAAA,EAEf;AAEK,SAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;AAEO,MAAM,gBAAgB,iBAAiB;"}