@intlayer/design-system 9.0.0-canary.1 → 9.0.0-canary.10

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 (108) hide show
  1. package/dist/esm/api/hooks/dictionary.mjs +15 -3
  2. package/dist/esm/api/hooks/dictionary.mjs.map +1 -1
  3. package/dist/esm/api/hooks/utils.mjs +1 -1
  4. package/dist/esm/api/index.mjs +2 -2
  5. package/dist/esm/api/useAuth/useOAuth2.mjs +2 -2
  6. package/dist/esm/api/useAuth/useSession.mjs +1 -1
  7. package/dist/esm/api/useIntlayerAPI.mjs.map +1 -1
  8. package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +1 -1
  9. package/dist/esm/components/DictionaryEditor/DictionaryEditor.mjs +1 -1
  10. package/dist/esm/components/DictionaryEditor/NodeWrapper/BooleanWrapper.mjs +1 -1
  11. package/dist/esm/components/DictionaryEditor/NodeWrapper/FileWrapper.mjs +1 -1
  12. package/dist/esm/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.mjs.map +1 -1
  13. package/dist/esm/components/DictionaryEditor/NodeWrapper/NumberWrapper.mjs +1 -1
  14. package/dist/esm/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +1 -1
  15. package/dist/esm/components/DictionaryEditor/NodeWrapper/index.mjs +1 -1
  16. package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +42 -70
  17. package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
  18. package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +2 -2
  19. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +47 -73
  20. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  21. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +0 -62
  22. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
  23. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +2 -4
  24. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
  25. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +70 -151
  26. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  27. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +1 -1
  28. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  29. package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +1 -1
  30. package/dist/esm/components/DictionaryFieldEditor/JSONEditor.mjs +1 -1
  31. package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +1 -1
  32. package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +2 -2
  33. package/dist/esm/components/DictionaryFieldEditor/StructureEditor.mjs +1 -1
  34. package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +1 -1
  35. package/dist/esm/components/Form/elements/OTPElement.mjs +1 -1
  36. package/dist/esm/components/LanguageBackground/LanguageBackground.mjs +3 -8
  37. package/dist/esm/components/LanguageBackground/LanguageBackground.mjs.map +1 -1
  38. package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
  39. package/dist/esm/components/MarkDownRender/MarkDownRender.mjs +1 -1
  40. package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
  41. package/dist/esm/components/Modal/Modal.mjs +2 -2
  42. package/dist/esm/components/Navbar/MobileNavbar.mjs +1 -1
  43. package/dist/esm/components/Pagination/Pagination.mjs +1 -1
  44. package/dist/esm/components/Pattern/GridDistortionPattern.mjs +275 -0
  45. package/dist/esm/components/Pattern/GridDistortionPattern.mjs.map +1 -0
  46. package/dist/esm/components/Pattern/index.mjs +2 -1
  47. package/dist/esm/components/RightDrawer/RightDrawer.mjs +3 -3
  48. package/dist/esm/components/SwitchSelector/useSwitchSelector.mjs +0 -1
  49. package/dist/esm/components/SwitchSelector/useSwitchSelector.mjs.map +1 -1
  50. package/dist/esm/components/Tab/Tab.mjs +1 -1
  51. package/dist/esm/components/index.mjs +2 -1
  52. package/dist/esm/hooks/index.mjs +8 -8
  53. package/dist/esm/hooks/useIsMounted.mjs +4 -2
  54. package/dist/esm/hooks/useIsMounted.mjs.map +1 -1
  55. package/dist/esm/providers/ReactQueryProvider.mjs +1 -1
  56. package/dist/esm/utils/cn.mjs +2 -8
  57. package/dist/types/api/hooks/dictionary.d.ts.map +1 -1
  58. package/dist/types/api/useIntlayerAPI.d.ts +40 -287
  59. package/dist/types/api/useIntlayerAPI.d.ts.map +1 -1
  60. package/dist/types/components/Badge/index.d.ts +1 -1
  61. package/dist/types/components/Button/Button.d.ts +5 -5
  62. package/dist/types/components/Command/index.d.ts +2 -2
  63. package/dist/types/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.d.ts.map +1 -1
  64. package/dist/types/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
  65. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
  66. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +0 -62
  67. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
  68. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts +1 -3
  69. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
  70. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  71. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +1 -1
  72. package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts +1 -1
  73. package/dist/types/components/Form/elements/AutoSizeTextAreaElement.d.ts +1 -1
  74. package/dist/types/components/Form/elements/CheckboxElement.d.ts +1 -1
  75. package/dist/types/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
  76. package/dist/types/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
  77. package/dist/types/components/Form/elements/InputElement.d.ts +1 -1
  78. package/dist/types/components/Form/elements/InputPasswordElement.d.ts +1 -1
  79. package/dist/types/components/Form/elements/MultiselectElement.d.ts +1 -1
  80. package/dist/types/components/Form/elements/OTPElement.d.ts +1 -1
  81. package/dist/types/components/Form/elements/SearchInputElement.d.ts +1 -1
  82. package/dist/types/components/Form/elements/SelectElement.d.ts +1 -1
  83. package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts +1 -1
  84. package/dist/types/components/Form/elements/TextAreaElement.d.ts +1 -1
  85. package/dist/types/components/IDE/CopyCode.d.ts +1 -1
  86. package/dist/types/components/Input/Checkbox.d.ts +1 -1
  87. package/dist/types/components/Input/Radio.d.ts +1 -1
  88. package/dist/types/components/LanguageBackground/LanguageBackground.d.ts.map +1 -1
  89. package/dist/types/components/Link/Link.d.ts +2 -2
  90. package/dist/types/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
  91. package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts +1 -1
  92. package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts.map +1 -1
  93. package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts +1 -1
  94. package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts.map +1 -1
  95. package/dist/types/components/Pagination/Pagination.d.ts +1 -1
  96. package/dist/types/components/Pattern/GridDistortionPattern.d.ts +15 -0
  97. package/dist/types/components/Pattern/GridDistortionPattern.d.ts.map +1 -0
  98. package/dist/types/components/Pattern/index.d.ts +2 -1
  99. package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts +10 -2
  100. package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts.map +1 -1
  101. package/dist/types/components/Tab/Tab.d.ts +1 -1
  102. package/dist/types/components/TabSelector/TabSelector.d.ts +1 -1
  103. package/dist/types/components/index.d.ts +7 -6
  104. package/dist/types/hooks/index.d.ts +1 -1
  105. package/dist/types/utils/cn.d.ts +2 -7
  106. package/package.json +27 -28
  107. package/dist/esm/utils/cn.mjs.map +0 -1
  108. package/dist/types/utils/cn.d.ts.map +0 -1
@@ -80,7 +80,11 @@ const usePushDictionaries = () => {
80
80
  return useMutation({
81
81
  mutationKey: ["dictionaries"],
82
82
  mutationFn: (args) => dictionaryAPI.pushDictionaries(args.dictionaries),
83
- meta: { invalidateQueries: [["dictionaries"], ["dictionariesKeys"]] }
83
+ meta: { invalidateQueries: [
84
+ ["dictionaries"],
85
+ ["dictionary"],
86
+ ["dictionariesKeys"]
87
+ ] }
84
88
  });
85
89
  };
86
90
  const useUpdateDictionary = () => {
@@ -88,7 +92,11 @@ const useUpdateDictionary = () => {
88
92
  return useMutation({
89
93
  mutationKey: ["dictionaries"],
90
94
  mutationFn: (args) => dictionaryAPI.updateDictionary(args),
91
- meta: { invalidateQueries: [["dictionaries"], ["dictionariesKeys"]] }
95
+ meta: { invalidateQueries: [
96
+ ["dictionaries"],
97
+ ["dictionary"],
98
+ ["dictionariesKeys"]
99
+ ] }
92
100
  });
93
101
  };
94
102
  const useDeleteDictionary = () => {
@@ -96,7 +104,11 @@ const useDeleteDictionary = () => {
96
104
  return useMutation({
97
105
  mutationKey: ["dictionaries"],
98
106
  mutationFn: (args) => dictionaryAPI.deleteDictionary(args.dictionaryId),
99
- meta: { invalidateQueries: [["dictionaries"], ["dictionariesKeys"]] }
107
+ meta: { invalidateQueries: [
108
+ ["dictionaries"],
109
+ ["dictionary"],
110
+ ["dictionariesKeys"]
111
+ ] }
100
112
  });
101
113
  };
102
114
 
@@ -1 +1 @@
1
- {"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../../src/api/hooks/dictionary.ts"],"sourcesContent":["'use client';\n\nimport type {\n AddDictionaryBody,\n DeleteDictionaryParam,\n GetDictionariesParams,\n GetDictionaryParams,\n GetDictionaryQuery,\n PushDictionariesBody,\n UpdateDictionaryBody,\n} from '@intlayer/backend';\nimport {\n type UseQueryOptions,\n useInfiniteQuery,\n useMutation,\n} from '@tanstack/react-query';\nimport { useDictionaryAPI } from '../useIntlayerAPI';\nimport { useAppQuery, useAuthEnable } from './utils';\n\nexport const useGetDictionaries = (\n filters?: GetDictionariesParams,\n options?: Partial<UseQueryOptions>\n) => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useAppQuery({\n queryKey: ['dictionaries', filters],\n queryFn: ({ signal }) => dictionaryAPI.getDictionaries(filters, { signal }),\n // placeholderData: keepPreviousData,\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n ...options,\n });\n};\n\nexport const useInfiniteGetDictionaries = (\n filters?: Omit<GetDictionariesParams, 'page'>,\n options?: Partial<UseQueryOptions>\n) => {\n const dictionaryAPI = useDictionaryAPI();\n const { enable } = useAuthEnable({\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n });\n\n return useInfiniteQuery({\n queryKey: ['dictionaries', 'infinite', filters],\n queryFn: async ({ pageParam = 1, signal }) => {\n const res = await dictionaryAPI.getDictionaries(\n { ...filters, page: pageParam },\n { signal }\n );\n return res;\n },\n getNextPageParam: (lastPage) => {\n if (lastPage.data.length === 0) return undefined;\n const currentPage = lastPage.page ?? 1;\n const totalPages = lastPage.total_pages ?? 1;\n return currentPage < totalPages ? currentPage + 1 : undefined;\n },\n initialPageParam: 1,\n enabled: options?.enabled === false ? false : enable,\n ...options,\n });\n};\n\nexport const useGetDictionariesKeys = (options?: Partial<UseQueryOptions>) => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useAppQuery({\n queryKey: ['dictionariesKeys'],\n queryFn: () => dictionaryAPI.getDictionariesKeys(),\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n ...options,\n });\n};\n\nexport const useGetDictionary = (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n options?: Partial<UseQueryOptions>\n) => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useAppQuery({\n queryKey: ['dictionary', dictionaryKey],\n queryFn: ({ signal }) =>\n dictionaryAPI.getDictionary(dictionaryKey, version, {\n signal,\n }),\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n ...options,\n });\n};\n\nexport const useAddDictionary = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: AddDictionaryBody) => dictionaryAPI.addDictionary(args),\n meta: {\n invalidateQueries: [['dictionaries'], ['dictionariesKeys']],\n },\n });\n};\n\nexport const usePushDictionaries = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: PushDictionariesBody) =>\n dictionaryAPI.pushDictionaries(args.dictionaries),\n meta: {\n invalidateQueries: [['dictionaries'], ['dictionariesKeys']],\n },\n });\n};\n\nexport const useUpdateDictionary = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: UpdateDictionaryBody) =>\n dictionaryAPI.updateDictionary(args),\n meta: {\n invalidateQueries: [['dictionaries'], ['dictionariesKeys']],\n },\n });\n};\n\nexport const useDeleteDictionary = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: DeleteDictionaryParam) =>\n dictionaryAPI.deleteDictionary(args.dictionaryId),\n meta: {\n invalidateQueries: [['dictionaries'], ['dictionariesKeys']],\n },\n });\n};\n"],"mappings":";;;;;;;AAmBA,MAAa,sBACX,SACA,YACG;CACH,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,UAAU,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;EAC7B,aAAa,SAA4B,cAAc,cAAc,KAAK;EAC1E,MAAM,EACJ,mBAAmB,CAAC,CAAC,eAAe,EAAE,CAAC,mBAAmB,CAAC,EAC5D;EACF,CAAC;;AAGJ,MAAa,4BAA4B;CACvC,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,aAAa,CAAC,eAAe;EAC7B,aAAa,SACX,cAAc,iBAAiB,KAAK,aAAa;EACnD,MAAM,EACJ,mBAAmB,CAAC,CAAC,eAAe,EAAE,CAAC,mBAAmB,CAAC,EAC5D;EACF,CAAC;;AAGJ,MAAa,4BAA4B;CACvC,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,aAAa,CAAC,eAAe;EAC7B,aAAa,SACX,cAAc,iBAAiB,KAAK;EACtC,MAAM,EACJ,mBAAmB,CAAC,CAAC,eAAe,EAAE,CAAC,mBAAmB,CAAC,EAC5D;EACF,CAAC;;AAGJ,MAAa,4BAA4B;CACvC,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,aAAa,CAAC,eAAe;EAC7B,aAAa,SACX,cAAc,iBAAiB,KAAK,aAAa;EACnD,MAAM,EACJ,mBAAmB,CAAC,CAAC,eAAe,EAAE,CAAC,mBAAmB,CAAC,EAC5D;EACF,CAAC"}
1
+ {"version":3,"file":"dictionary.mjs","names":[],"sources":["../../../../src/api/hooks/dictionary.ts"],"sourcesContent":["'use client';\n\nimport type {\n AddDictionaryBody,\n DeleteDictionaryParam,\n GetDictionariesParams,\n GetDictionaryParams,\n GetDictionaryQuery,\n PushDictionariesBody,\n UpdateDictionaryBody,\n} from '@intlayer/backend';\nimport {\n type UseQueryOptions,\n useInfiniteQuery,\n useMutation,\n} from '@tanstack/react-query';\nimport { useDictionaryAPI } from '../useIntlayerAPI';\nimport { useAppQuery, useAuthEnable } from './utils';\n\nexport const useGetDictionaries = (\n filters?: GetDictionariesParams,\n options?: Partial<UseQueryOptions>\n) => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useAppQuery({\n queryKey: ['dictionaries', filters],\n queryFn: ({ signal }) => dictionaryAPI.getDictionaries(filters, { signal }),\n // placeholderData: keepPreviousData,\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n ...options,\n });\n};\n\nexport const useInfiniteGetDictionaries = (\n filters?: Omit<GetDictionariesParams, 'page'>,\n options?: Partial<UseQueryOptions>\n) => {\n const dictionaryAPI = useDictionaryAPI();\n const { enable } = useAuthEnable({\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n });\n\n return useInfiniteQuery({\n queryKey: ['dictionaries', 'infinite', filters],\n queryFn: async ({ pageParam = 1, signal }) => {\n const res = await dictionaryAPI.getDictionaries(\n { ...filters, page: pageParam },\n { signal }\n );\n return res;\n },\n getNextPageParam: (lastPage) => {\n if (lastPage.data.length === 0) return undefined;\n const currentPage = lastPage.page ?? 1;\n const totalPages = lastPage.total_pages ?? 1;\n return currentPage < totalPages ? currentPage + 1 : undefined;\n },\n initialPageParam: 1,\n enabled: options?.enabled === false ? false : enable,\n ...options,\n });\n};\n\nexport const useGetDictionariesKeys = (options?: Partial<UseQueryOptions>) => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useAppQuery({\n queryKey: ['dictionariesKeys'],\n queryFn: () => dictionaryAPI.getDictionariesKeys(),\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n ...options,\n });\n};\n\nexport const useGetDictionary = (\n dictionaryKey: GetDictionaryParams['dictionaryKey'],\n version?: GetDictionaryQuery['version'],\n options?: Partial<UseQueryOptions>\n) => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useAppQuery({\n queryKey: ['dictionary', dictionaryKey],\n queryFn: ({ signal }) =>\n dictionaryAPI.getDictionary(dictionaryKey, version, {\n signal,\n }),\n requireUser: true,\n requireOrganization: true,\n requireProject: true,\n ...options,\n });\n};\n\nexport const useAddDictionary = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: AddDictionaryBody) => dictionaryAPI.addDictionary(args),\n meta: {\n invalidateQueries: [['dictionaries'], ['dictionariesKeys']],\n },\n });\n};\n\nexport const usePushDictionaries = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: PushDictionariesBody) =>\n dictionaryAPI.pushDictionaries(args.dictionaries),\n meta: {\n invalidateQueries: [\n ['dictionaries'],\n ['dictionary'],\n ['dictionariesKeys'],\n ],\n },\n });\n};\n\nexport const useUpdateDictionary = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: UpdateDictionaryBody) =>\n dictionaryAPI.updateDictionary(args),\n meta: {\n invalidateQueries: [\n ['dictionaries'],\n ['dictionary'],\n ['dictionariesKeys'],\n ],\n },\n });\n};\n\nexport const useDeleteDictionary = () => {\n const dictionaryAPI = useDictionaryAPI();\n\n return useMutation({\n mutationKey: ['dictionaries'],\n mutationFn: (args: DeleteDictionaryParam) =>\n dictionaryAPI.deleteDictionary(args.dictionaryId),\n meta: {\n invalidateQueries: [\n ['dictionaries'],\n ['dictionary'],\n ['dictionariesKeys'],\n ],\n },\n });\n};\n"],"mappings":";;;;;;;AAmBA,MAAa,sBACX,SACA,YACG;CACH,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,UAAU,CAAC,gBAAgB,QAAQ;EACnC,UAAU,EAAE,aAAa,cAAc,gBAAgB,SAAS,EAAE,QAAQ,CAAC;EAE3E,aAAa;EACb,qBAAqB;EACrB,gBAAgB;EAChB,GAAG;EACJ,CAAC;;AAGJ,MAAa,8BACX,SACA,YACG;CACH,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,EAAE,WAAW,cAAc;EAC/B,aAAa;EACb,qBAAqB;EACrB,gBAAgB;EACjB,CAAC;AAEF,QAAO,iBAAiB;EACtB,UAAU;GAAC;GAAgB;GAAY;GAAQ;EAC/C,SAAS,OAAO,EAA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AAGJ,MAAa,4BAA4B;CACvC,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,aAAa,CAAC,eAAe;EAC7B,aAAa,SACX,cAAc,iBAAiB,KAAK;EACtC,MAAM,EACJ,mBAAmB;GACjB,CAAC,eAAe;GAChB,CAAC,aAAa;GACd,CAAC,mBAAmB;GACrB,EACF;EACF,CAAC;;AAGJ,MAAa,4BAA4B;CACvC,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,aAAa,CAAC,eAAe;EAC7B,aAAa,SACX,cAAc,iBAAiB,KAAK,aAAa;EACnD,MAAM,EACJ,mBAAmB;GACjB,CAAC,eAAe;GAChB,CAAC,aAAa;GACd,CAAC,mBAAmB;GACrB,EACF;EACF,CAAC"}
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import { useAuth } from "../useAuth/useAuth.mjs";
4
- import { useQuery } from "@tanstack/react-query";
5
4
  import { useConfiguration } from "@intlayer/editor-react";
5
+ import { useQuery } from "@tanstack/react-query";
6
6
 
7
7
  //#region src/api/hooks/utils.ts
8
8
  const useAuthEnable = ({ requireUser, requireProject, requireOrganization }) => {
@@ -2,11 +2,10 @@ import { useOAuth2 } from "./useAuth/useOAuth2.mjs";
2
2
  import { useSession } from "./useAuth/useSession.mjs";
3
3
  import { useAuth } from "./useAuth/useAuth.mjs";
4
4
  import { useAiAPI, useAssetAPI, useAuditAPI, useBitbucketAPI, useDictionaryAPI, useEditorAPI, useEnvironmentAPI, useGithubAPI, useGitlabAPI, useIntlayerAuth, useIntlayerOAuth, useIntlayerOAuthOptions, useNewsletterAPI, useOAuthAPI, useOrganizationAPI, useProjectAPI, useReviewerAPI, useSearchAPI, useShowcaseProjectAPI, useStripeAPI, useTagAPI, useTranslateAPI, useUserAPI } from "./useIntlayerAPI.mjs";
5
- import { useAddPasskey, useAskResetPassword, useChangePassword, useDeletePasskey, useDeleteSSOProvider, useDisableTwoFactor, useEnableTwoFactor, useGetUserByAccount, useGetVerifyEmailStatus, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useRegister, useRegisterSSO, useResetPassword, useSignInMagicLink, useSignInPasskey, useSignInSSO, useUnlinkAccount, useVerifyBackupCode, useVerifyEmail, useVerifyTotp } from "./hooks/auth.mjs";
6
- import { useUser } from "./useUser/index.mjs";
7
5
  import { useAskDocQuestion, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditTag, useAutocomplete, useChat, useCustomQuery, useGetAIStats, useTranslateJSONDeclaration } from "./hooks/ai.mjs";
8
6
  import { useDeleteAsset, useGetAssetById, useGetAssets, useUpdateAsset, useUploadAsset } from "./hooks/asset.mjs";
9
7
  import { useAuditScan, useGetRecursiveAuditStatus, useStartRecursiveAudit } from "./hooks/audit.mjs";
8
+ import { useAddPasskey, useAskResetPassword, useChangePassword, useDeletePasskey, useDeleteSSOProvider, useDisableTwoFactor, useEnableTwoFactor, useGetUserByAccount, useGetVerifyEmailStatus, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useRegister, useRegisterSSO, useResetPassword, useSignInMagicLink, useSignInPasskey, useSignInSSO, useUnlinkAccount, useVerifyBackupCode, useVerifyEmail, useVerifyTotp } from "./hooks/auth.mjs";
10
9
  import { useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos } from "./hooks/bitbucket.mjs";
11
10
  import { useAddDictionary, useDeleteDictionary, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useInfiniteGetDictionaries, usePushDictionaries, useUpdateDictionary } from "./hooks/dictionary.mjs";
12
11
  import { useGetDiscussions, useGetDiscussionsData } from "./hooks/discussions.mjs";
@@ -24,5 +23,6 @@ import { useAcceptAffiliateInvitation, useCancelSubscription, useCreatePortalSes
24
23
  import { useAddTag, useDeleteTag, useGetTags, useUpdateTag } from "./hooks/tag.mjs";
25
24
  import { useFillAllTranslations, usePauseTranslationJob, useResumeTranslationJob, useStopTranslationJob } from "./hooks/translate.mjs";
26
25
  import { useCreateUser, useDeleteUser, useGetUserById, useGetUsers, useUpdateUser, useUploadUserAvatar } from "./hooks/user.mjs";
26
+ import { useUser } from "./useUser/index.mjs";
27
27
 
28
28
  export { useAcceptAffiliateInvitation, useAddDictionary, useAddEnvironment, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAiAPI, useAskDocQuestion, useAskResetPassword, useAssetAPI, useAuditAPI, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAuth, useAutocomplete, useBitbucketAPI, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useContactReviewer, useCreateMission, useCreatePortalSession, useCreatePromoCode, useCreateUser, useCustomQuery, useDeleteAccessKey, useDeleteAsset, useDeleteDictionary, useDeleteEnvironment, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeletePromoCode, useDeleteReviewerProfile, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDictionaryAPI, useDisableTwoFactor, useEditorAPI, useEnableTwoFactor, useEnvironmentAPI, useEstimateMission, useFillAllTranslations, useGetAIStats, useGetAdminReviewers, useGetAffiliate, useGetAffiliateAccountSession, useGetAffiliateById, useGetAffiliateInvitation, useGetAffiliateInvitations, useGetAffiliateOnboardingLink, useGetAffiliatePromoCode, useGetAffiliateStats, useGetAffiliates, useGetAssetById, useGetAssets, useGetCIConfig, useGetChatHistory, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetInvoices, useGetMissionById, useGetMyMissions, useGetMyReviewerProfile, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjectInsights, useGetProjects, useGetPromoCodeById, useGetPromoCodes, useGetRecursiveAuditStatus, useGetReviewerById, useGetReviewerMarketplace, useGetReviewerPriceDistribution, useGetReviewerReviews, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAPI, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAPI, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useGrantAffiliateAccess, useInfiniteGetDictionaries, useIntlayerAuth, useIntlayerOAuth, useIntlayerOAuthOptions, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useMigrateEnvironment, useNewsletterAPI, useOAuth2, useOAuthAPI, useOrganizationAPI, usePauseTranslationJob, useProjectAPI, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useRefreshAccessKey, useRegister, useRegisterAsReviewer, useRegisterSSO, useResetPassword, useResetToProductionEnvironment, useResumeTranslationJob, useReviewerAPI, useSearchAPI, useSearchDoc, useSelectEnvironment, useSelectOrganization, useSelectProject, useSendAffiliateInvitation, useSendReviewerMessage, useSession, useShowcaseProjectAPI, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useStripeAPI, useSubmitReview, useSubmitShowcaseProject, useSubscribeToNewsletter, useTagAPI, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateAPI, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateAffiliateStatus, useUpdateAsset, useUpdateDictionary, useUpdateEnvironment, useUpdateMemberAccess, useUpdateMissionStatus, useUpdateOrganization, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdatePromoCode, useUpdateReviewerProfile, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadAsset, useUploadReviewerCoverPicture, useUploadReviewerMainPicture, useUploadUserAvatar, useUser, useUserAPI, useValidateReviewerProfile, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary };
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
- import { editor } from "@intlayer/config/built";
4
- import { useQuery } from "@tanstack/react-query";
5
3
  import { getOAuthAPI } from "@intlayer/api";
6
4
  import { useConfiguration } from "@intlayer/editor-react";
5
+ import { editor } from "@intlayer/config/built";
6
+ import { useQuery } from "@tanstack/react-query";
7
7
  import { defu } from "defu";
8
8
 
9
9
  //#region src/api/useAuth/useOAuth2.ts
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
3
  import { getAuthAPI } from "../../libs/auth.mjs";
4
+ import { useConfiguration } from "@intlayer/editor-react";
4
5
  import { editor } from "@intlayer/config/built";
5
6
  import { useQuery, useQueryClient } from "@tanstack/react-query";
6
- import { useConfiguration } from "@intlayer/editor-react";
7
7
 
8
8
  //#region src/api/useAuth/useSession.ts
9
9
  const useSession = (sessionProp, intlayerConfiguration) => {
@@ -1 +1 @@
1
- {"version":3,"file":"useIntlayerAPI.mjs","names":["getOAuthAPI"],"sources":["../../../src/api/useIntlayerAPI.ts"],"sourcesContent":["'use client';\n\nimport {\n type FetcherOptions,\n getIntlayerAPI,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { getAiAPI } from '@intlayer/api/ai';\nimport { getAssetAPI } from '@intlayer/api/asset';\nimport { getAuditAPI } from '@intlayer/api/audit';\nimport { getBitbucketAPI } from '@intlayer/api/bitbucket';\nimport { getDictionaryAPI } from '@intlayer/api/dictionary';\nimport { getEditorAPI } from '@intlayer/api/editor';\nimport { getEnvironmentAPI } from '@intlayer/api/environment';\nimport { getGithubAPI } from '@intlayer/api/github';\nimport { getGitlabAPI } from '@intlayer/api/gitlab';\nimport { getNewsletterAPI } from '@intlayer/api/newsletter';\nimport { getOAuthAPI } from '@intlayer/api/oAuth';\nimport { getOrganizationAPI } from '@intlayer/api/organization';\nimport { getProjectAPI } from '@intlayer/api/project';\nimport { getReviewerAPI } from '@intlayer/api/reviewer';\nimport { getSearchAPI } from '@intlayer/api/search';\nimport { getShowcaseProjectAPI } from '@intlayer/api/showcaseProject';\nimport { getStripeAPI } from '@intlayer/api/stripe';\nimport { getTagAPI } from '@intlayer/api/tag';\nimport { getTranslateAPI } from '@intlayer/api/translate';\nimport { getUserAPI } from '@intlayer/api/user';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type AuthAPI, getAuthAPI } from '../libs/auth';\nimport { useAuth } from './useAuth';\n\nexport type UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuthOptions = (props?: UseIntlayerAuthProps) => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n const options = {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken.accessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n };\n\n const rawConfig = props?.intlayerConfiguration ?? configuration;\n // Only use the config if it's fully populated; an empty object (e.g. while\n // the session is still loading) has no `editor` key and would crash API\n // getters that do `intlayerConfig.editor.backendURL`.\n const resolvedConfig = rawConfig?.editor ? rawConfig : undefined;\n\n return { options, resolvedConfig };\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getIntlayerAPI(options, resolvedConfig);\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n\nexport const useOrganizationAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getOrganizationAPI(options, resolvedConfig);\n};\n\nexport const useProjectAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getProjectAPI(options, resolvedConfig);\n};\n\nexport const useUserAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getUserAPI(options, resolvedConfig);\n};\n\nexport const useOAuthAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getOAuthAPI(options, resolvedConfig);\n};\n\nexport const useDictionaryAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getDictionaryAPI(options, resolvedConfig);\n};\n\nexport const useStripeAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getStripeAPI(options, resolvedConfig);\n};\n\nexport const useAiAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getAiAPI(options, resolvedConfig);\n};\n\nexport const useAuditAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getAuditAPI(options, resolvedConfig);\n};\n\nexport const useTagAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getTagAPI(options, resolvedConfig);\n};\n\nexport const useSearchAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getSearchAPI(options, resolvedConfig);\n};\n\nexport const useEditorAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getEditorAPI(options, resolvedConfig);\n};\n\nexport const useNewsletterAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getNewsletterAPI(options, resolvedConfig);\n};\n\nexport const useGithubAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getGithubAPI(options, resolvedConfig);\n};\n\nexport const useGitlabAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getGitlabAPI(options, resolvedConfig);\n};\n\nexport const useBitbucketAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getBitbucketAPI(options, resolvedConfig);\n};\n\nexport const useShowcaseProjectAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getShowcaseProjectAPI(options, resolvedConfig);\n};\n\nexport const useTranslateAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getTranslateAPI(options, resolvedConfig);\n};\n\nexport const useReviewerAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getReviewerAPI(options, resolvedConfig);\n};\n\nexport const useEnvironmentAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getEnvironmentAPI(options, resolvedConfig);\n};\n\nexport const useAssetAPI = (props?: UseIntlayerAuthProps) => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getAssetAPI(options, resolvedConfig);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA2B,UAAiC;CACvE,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,EAAE,sBAAsB,SAAS;CAEvC,MAAM,UAAU;EACd,GAAI,qBAAqB,EACvB,SAAS,EACP,eAAe,UAAU,kBAAkB,eAC5C,EACF;EACD,GAAI,OAAO,WAAW,EAAE;EACzB;CAED,MAAM,YAAY,OAAO,yBAAyB;AAMlD,QAAO;EAAE;EAAS,gBAFK,WAAW,SAAS,YAAY;EAErB;;AAGpC,MAAa,oBAAoB,UAA8C;CAC7E,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,eA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E,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,aAAa,SAAS,eAAe;;AAG9C,MAAa,oBAAoB,UAAiC;CAChE,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,iBAAiB,SAAS,eAAe;;AAGlD,MAAa,gBAAgB,UAAiC;CAC5D,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,aAAa,SAAS,eAAe;;AAG9C,MAAa,gBAAgB,UAAiC;CAC5D,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,aAAa,SAAS,eAAe;;AAG9C,MAAa,mBAAmB,UAAiC;CAC/D,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,gBAAgB,SAAS,eAAe;;AAGjD,MAAa,yBAAyB,UAAiC;CACrE,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,sBAAsB,SAAS,eAAe;;AAGvD,MAAa,mBAAmB,UAAiC;CAC/D,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,gBAAgB,SAAS,eAAe;;AAGjD,MAAa,kBAAkB,UAAiC;CAC9D,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,eAAe,SAAS,eAAe;;AAGhD,MAAa,qBAAqB,UAAiC;CACjE,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,kBAAkB,SAAS,eAAe;;AAGnD,MAAa,eAAe,UAAiC;CAC3D,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,YAAY,SAAS,eAAe"}
1
+ {"version":3,"file":"useIntlayerAPI.mjs","names":["getOAuthAPI"],"sources":["../../../src/api/useIntlayerAPI.ts"],"sourcesContent":["'use client';\n\nimport {\n type FetcherOptions,\n getIntlayerAPI,\n type IntlayerAPI,\n} from '@intlayer/api';\nimport { getAiAPI } from '@intlayer/api/ai';\nimport { getAssetAPI } from '@intlayer/api/asset';\nimport { getAuditAPI } from '@intlayer/api/audit';\nimport { getBitbucketAPI } from '@intlayer/api/bitbucket';\nimport { getDictionaryAPI } from '@intlayer/api/dictionary';\nimport { getEditorAPI } from '@intlayer/api/editor';\nimport { getEnvironmentAPI } from '@intlayer/api/environment';\nimport { getGithubAPI } from '@intlayer/api/github';\nimport { getGitlabAPI } from '@intlayer/api/gitlab';\nimport { getNewsletterAPI } from '@intlayer/api/newsletter';\nimport { getOAuthAPI } from '@intlayer/api/oAuth';\nimport { getOrganizationAPI } from '@intlayer/api/organization';\nimport { getProjectAPI } from '@intlayer/api/project';\nimport { getReviewerAPI } from '@intlayer/api/reviewer';\nimport { getSearchAPI } from '@intlayer/api/search';\nimport { getShowcaseProjectAPI } from '@intlayer/api/showcaseProject';\nimport { getStripeAPI } from '@intlayer/api/stripe';\nimport { getTagAPI } from '@intlayer/api/tag';\nimport { getTranslateAPI } from '@intlayer/api/translate';\nimport { getUserAPI } from '@intlayer/api/user';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { type AuthAPI, getAuthAPI } from '../libs/auth';\nimport { useAuth } from './useAuth';\n\nexport type UseIntlayerAuthProps = {\n options?: FetcherOptions;\n intlayerConfiguration?: IntlayerConfig;\n};\n\nexport const useIntlayerOAuthOptions = (props?: UseIntlayerAuthProps) => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken } = useAuth();\n\n const options = {\n ...(oAuth2AccessToken && {\n headers: {\n Authorization: `Bearer ${oAuth2AccessToken.accessToken}`,\n },\n }),\n ...(props?.options ?? {}),\n };\n\n const rawConfig = props?.intlayerConfiguration ?? configuration;\n // Only use the config if it's fully populated; an empty object (e.g. while\n // the session is still loading) has no `editor` key and would crash API\n // getters that do `intlayerConfig.editor.backendURL`.\n const resolvedConfig = rawConfig?.editor ? rawConfig : undefined;\n\n return { options, resolvedConfig };\n};\n\nexport const useIntlayerOAuth = (props?: UseIntlayerAuthProps): IntlayerAPI => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getIntlayerAPI(options, resolvedConfig);\n};\n\nexport const useIntlayerAuth = (props?: UseIntlayerAuthProps): AuthAPI => {\n const configuration = useConfiguration();\n\n return getAuthAPI(props?.intlayerConfiguration ?? configuration);\n};\n\nexport const useOrganizationAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getOrganizationAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getOrganizationAPI(options, resolvedConfig);\n};\n\nexport const useProjectAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getProjectAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getProjectAPI(options, resolvedConfig);\n};\n\nexport const useUserAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getUserAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getUserAPI(options, resolvedConfig);\n};\n\nexport const useOAuthAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getOAuthAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getOAuthAPI(options, resolvedConfig);\n};\n\nexport const useDictionaryAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getDictionaryAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getDictionaryAPI(options, resolvedConfig);\n};\n\nexport const useStripeAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getStripeAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getStripeAPI(options, resolvedConfig);\n};\n\nexport const useAiAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getAiAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getAiAPI(options, resolvedConfig);\n};\n\nexport const useAuditAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getAuditAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getAuditAPI(options, resolvedConfig);\n};\n\nexport const useTagAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getTagAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getTagAPI(options, resolvedConfig);\n};\n\nexport const useSearchAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getSearchAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getSearchAPI(options, resolvedConfig);\n};\n\nexport const useEditorAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getEditorAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getEditorAPI(options, resolvedConfig);\n};\n\nexport const useNewsletterAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getNewsletterAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getNewsletterAPI(options, resolvedConfig);\n};\n\nexport const useGithubAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getGithubAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getGithubAPI(options, resolvedConfig);\n};\n\nexport const useGitlabAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getGitlabAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getGitlabAPI(options, resolvedConfig);\n};\n\nexport const useBitbucketAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getBitbucketAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getBitbucketAPI(options, resolvedConfig);\n};\n\nexport const useShowcaseProjectAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getShowcaseProjectAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getShowcaseProjectAPI(options, resolvedConfig);\n};\n\nexport const useTranslateAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getTranslateAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getTranslateAPI(options, resolvedConfig);\n};\n\nexport const useReviewerAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getReviewerAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getReviewerAPI(options, resolvedConfig);\n};\n\nexport const useEnvironmentAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getEnvironmentAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getEnvironmentAPI(options, resolvedConfig);\n};\n\nexport const useAssetAPI = (\n props?: UseIntlayerAuthProps\n): ReturnType<typeof getAssetAPI> => {\n const { options, resolvedConfig } = useIntlayerOAuthOptions(props);\n return getAssetAPI(options, resolvedConfig);\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,MAAa,2BAA2B,UAAiC;CACvE,MAAM,gBAAgB,kBAAkB;CACxC,MAAM,EAAE,sBAAsB,SAAS;CAEvC,MAAM,UAAU;EACd,GAAI,qBAAqB,EACvB,SAAS,EACP,eAAe,UAAU,kBAAkB,eAC5C,EACF;EACD,GAAI,OAAO,WAAW,EAAE;EACzB;CAED,MAAM,YAAY,OAAO,yBAAyB;AAMlD,QAAO;EAAE;EAAS,gBAFK,WAAW,SAAS,YAAY;EAErB;;AAGpC,MAAa,oBAAoB,UAA8C;CAC7E,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,eAAe,SAAS,eAAe;;AAGhD,MAAa,mBAAmB,UAA0C;CACxE,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,WAAW,OAAO,yBAAyB,cAAc;;AAGlE,MAAa,sBACX,UAC0C;CAC1C,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,mBAAmB,SAAS,eAAe;;AAGpD,MAAa,iBACX,UACqC;CACrC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,cAAc,SAAS,eAAe;;AAG/C,MAAa,c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C,MAAa,mBACX,UACuC;CACvC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,gBAAgB,SAAS,eAAe;;AAGjD,MAAa,yBACX,UAC6C;CAC7C,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,sBAAsB,SAAS,eAAe;;AAGvD,MAAa,mBACX,UACuC;CACvC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,gBAAgB,SAAS,eAAe;;AAGjD,MAAa,kBACX,UACsC;CACtC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,eAAe,SAAS,eAAe;;AAGhD,MAAa,qBACX,UACyC;CACzC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,kBAAkB,SAAS,eAAe;;AAGnD,MAAa,eACX,UACmC;CACnC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,YAAY,SAAS,eAAe"}
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { Button } from "../Button/Button.mjs";
4
3
  import { useUser } from "../../api/useUser/index.mjs";
4
+ import { Button } from "../Button/Button.mjs";
5
5
  import { AutoCompleteTextarea } from "../TextArea/AutocompleteTextArea.mjs";
6
6
  import { useEffect, useState } from "react";
7
7
  import { Check, X } from "lucide-react";
@@ -1,9 +1,9 @@
1
1
  'use client';
2
2
 
3
3
  import { NodeWrapper } from "./NodeWrapper/index.mjs";
4
+ import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
4
5
  import { createElement } from "react";
5
6
  import { jsx } from "react/jsx-runtime";
6
- import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
7
7
 
8
8
  //#region src/components/DictionaryEditor/DictionaryEditor.tsx
9
9
  const DictionaryEditor = ({ dictionary, ...props }) => {
@@ -2,8 +2,8 @@
2
2
 
3
3
  import { cn } from "../../../utils/cn.mjs";
4
4
  import { SwitchSelector } from "../../SwitchSelector/SwitchSelector.mjs";
5
- import { Fragment, jsx } from "react/jsx-runtime";
6
5
  import { useEditorLocale } from "@intlayer/editor-react";
6
+ import { Fragment, jsx } from "react/jsx-runtime";
7
7
  import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
8
8
 
9
9
  //#region src/components/DictionaryEditor/NodeWrapper/BooleanWrapper.tsx
@@ -1,6 +1,6 @@
1
1
  import { StringWrapper } from "./StringWrapper.mjs";
2
- import { jsx, jsxs } from "react/jsx-runtime";
3
2
  import { useEditedContent } from "@intlayer/editor-react";
3
+ import { jsx, jsxs } from "react/jsx-runtime";
4
4
  import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
5
5
  import * as NodeTypes from "@intlayer/types/nodeType";
6
6
 
@@ -1 +1 @@
1
- {"version":3,"file":"MarkdownWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.tsx"],"sourcesContent":["import type { MarkdownContent } from '@intlayer/core/transpiler';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\n\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype MarkdownWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: MarkdownContent<ContentNode>;\n};\n\nexport const MarkdownWrapper: FC<MarkdownWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeTypes.MARKDOWN,\n },\n ];\n\n const subSection = section[NodeTypes.MARKDOWN] as ContentNode;\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />\n </div>\n );\n};\n"],"mappings":";;;;;AAYA,MAAa,mBAA6C,UAAU;CAClE,MAAM,EAAE,SAAS,YAAY;CAE7B,MAAM,aAAwB,CAC5B,GAAG,SACH,EACE,MAAM,UAAU,UACjB,CACF;CAED,MAAM,aAAa,QAAQ,UAAU;AAErC,QACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,aAAD;GAAa,GAAI;GAAO,SAAS;GAAY,SAAS;GAAc;EAChE"}
1
+ {"version":3,"file":"MarkdownWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.tsx"],"sourcesContent":["import type { MarkdownContent } from '@intlayer/core/transpiler';\nimport type { ContentNode } from '@intlayer/types/dictionary';\nimport type { KeyPath } from '@intlayer/types/keyPath';\nimport * as NodeTypes from '@intlayer/types/nodeType';\nimport type { FC } from 'react';\nimport { NodeWrapper, type NodeWrapperProps } from './index';\n\ntype MarkdownWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: MarkdownContent<ContentNode>;\n};\n\nexport const MarkdownWrapper: FC<MarkdownWrapperProps> = (props) => {\n const { keyPath, section } = props;\n\n const newKeyPath: KeyPath[] = [\n ...keyPath,\n {\n type: NodeTypes.MARKDOWN,\n },\n ];\n\n const subSection = section[NodeTypes.MARKDOWN] as ContentNode;\n\n return (\n <div className=\"ml-2 grid grid-cols-[auto,1fr] gap-2\">\n <NodeWrapper {...props} keyPath={newKeyPath} section={subSection} />\n </div>\n );\n};\n"],"mappings":";;;;;AAWA,MAAa,mBAA6C,UAAU;CAClE,MAAM,EAAE,SAAS,YAAY;CAE7B,MAAM,aAAwB,CAC5B,GAAG,SACH,EACE,MAAM,UAAU,UACjB,CACF;CAED,MAAM,aAAa,QAAQ,UAAU;AAErC,QACE,oBAAC,OAAD;EAAK,WAAU;YACb,oBAAC,aAAD;GAAa,GAAI;GAAO,SAAS;GAAY,SAAS;GAAc;EAChE"}
@@ -1,7 +1,7 @@
1
1
  import { cn } from "../../../utils/cn.mjs";
2
2
  import { EditableFieldInput } from "../../EditableField/EditableFieldInput.mjs";
3
- import { Fragment, jsx } from "react/jsx-runtime";
4
3
  import { useEditorLocale } from "@intlayer/editor-react";
4
+ import { Fragment, jsx } from "react/jsx-runtime";
5
5
  import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
6
6
 
7
7
  //#region src/components/DictionaryEditor/NodeWrapper/NumberWrapper.tsx
@@ -1,7 +1,7 @@
1
1
  import { cn } from "../../../utils/cn.mjs";
2
2
  import { EditableFieldTextArea } from "../../EditableField/EditableFieldTextArea.mjs";
3
- import { Fragment, jsx } from "react/jsx-runtime";
4
3
  import { useEditorLocale } from "@intlayer/editor-react";
4
+ import { Fragment, jsx } from "react/jsx-runtime";
5
5
  import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
6
6
 
7
7
  //#region src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx
@@ -13,9 +13,9 @@ import { NestedObjectWrapper } from "./NestedObjectWrapper.mjs";
13
13
  import { NumberWrapper } from "./NumberWrapper.mjs";
14
14
  import { PluralWrapper } from "./PluralWrapper.mjs";
15
15
  import { TranslationWrapper } from "./TranslationWrapper.mjs";
16
+ import { useEditorLocale } from "@intlayer/editor-react";
16
17
  import { memo, useMemo } from "react";
17
18
  import { jsx } from "react/jsx-runtime";
18
- import { useEditorLocale } from "@intlayer/editor-react";
19
19
  import { getContentNodeByKeyPath, getNodeType } from "@intlayer/core/dictionaryManipulator";
20
20
  import * as NodeTypes from "@intlayer/types/nodeType";
21
21
 
@@ -1,22 +1,24 @@
1
1
  'use client';
2
2
 
3
- import { Container } from "../Container/index.mjs";
4
3
  import { useGetDictionaries } from "../../api/hooks/dictionary.mjs";
4
+ import { Container } from "../Container/index.mjs";
5
5
  import { LocaleSwitcherContent } from "../LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs";
6
6
  import { Pagination } from "../Pagination/Pagination.mjs";
7
7
  import { TextEditorContainer } from "./ContentEditorView/TextEditor.mjs";
8
8
  import { getIsEditableSection } from "./getIsEditableSection.mjs";
9
9
  import { KeyPathBreadcrumb } from "./KeyPathBreadcrumb.mjs";
10
10
  import { NavigationViewNode } from "./NavigationView/NavigationViewNode.mjs";
11
+ import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
11
12
  import { useCallback, useDeferredValue, useEffect, useMemo, useState, useTransition } from "react";
12
13
  import { jsx, jsxs } from "react/jsx-runtime";
13
14
  import { useIntlayer } from "react-intlayer";
14
- import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
15
15
  import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
16
16
 
17
17
  //#region src/components/DictionaryFieldEditor/ContentEditor.tsx
18
+ /** Render a variant (named string or structured object) for display. */
19
+ const formatVariant = (variant) => variant !== null && typeof variant === "object" ? JSON.stringify(variant) : variant ?? "";
18
20
  const ContentEditor = ({ dictionary, isDarkMode }) => {
19
- const { itemPagination, variantSwitcher, metaSwitcher } = useIntlayer("content-editor");
21
+ const { itemPagination, variantSwitcher } = useIntlayer("content-editor");
20
22
  const { editedContent } = useEditedContent();
21
23
  const { focusedContent, setFocusedContentKeyPath: _setFocusedContentKeyPath } = useFocusUnmergedDictionary();
22
24
  const [, startTransition] = useTransition();
@@ -24,8 +26,8 @@ const ContentEditor = ({ dictionary, isDarkMode }) => {
24
26
  const [activeDictionary, setActiveDictionary] = useState(dictionary);
25
27
  useEffect(() => {
26
28
  setActiveDictionary(dictionary);
27
- }, [dictionary.localId]);
28
- const hasQualifier = dictionary.item !== void 0 || dictionary.variant !== void 0 || dictionary.meta !== void 0;
29
+ }, [dictionary]);
30
+ const hasQualifier = dictionary.item !== void 0 || dictionary.variant !== void 0;
29
31
  const { data: siblingsData } = useGetDictionaries({ keys: [dictionary.key] }, { enabled: hasQualifier && !!dictionary.key });
30
32
  const allSiblings = useMemo(() => siblingsData?.data ?? [], [siblingsData]);
31
33
  const itemDicts = useMemo(() => {
@@ -36,10 +38,6 @@ const ContentEditor = ({ dictionary, isDarkMode }) => {
36
38
  if (dictionary.variant === void 0) return [];
37
39
  return allSiblings.filter((d) => d.variant !== void 0);
38
40
  }, [dictionary, allSiblings]);
39
- const metaDicts = useMemo(() => {
40
- if (dictionary.meta === void 0) return [];
41
- return allSiblings.filter((d) => d.meta !== void 0);
42
- }, [dictionary, allSiblings]);
43
41
  const switchSibling = useCallback((sibling) => {
44
42
  setActiveDictionary(sibling);
45
43
  setFocusedContentKeyPath([]);
@@ -59,71 +57,45 @@ const ContentEditor = ({ dictionary, isDarkMode }) => {
59
57
  }, []);
60
58
  const currentItemIndex = itemDicts.findIndex((dictionary) => dictionary.localId === activeDictionary.localId);
61
59
  const currentVariant = activeDictionary.variant;
62
- const currentMetaId = activeDictionary.meta?.id;
63
60
  return /* @__PURE__ */ jsxs("div", { children: [
64
61
  hasQualifier && /* @__PURE__ */ jsxs("div", {
65
62
  className: "mb-4 flex flex-wrap items-center gap-4",
66
- children: [
67
- itemDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
68
- className: "flex items-center gap-2",
69
- children: [/* @__PURE__ */ jsx("span", {
63
+ children: [itemDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
64
+ className: "flex items-center gap-2",
65
+ children: [/* @__PURE__ */ jsx("span", {
66
+ className: "font-medium text-muted text-xs",
67
+ children: itemPagination.label
68
+ }), /* @__PURE__ */ jsx(Pagination, {
69
+ currentPage: currentItemIndex >= 0 ? currentItemIndex + 1 : 1,
70
+ totalPages: itemDicts.length,
71
+ onPageChange: (page) => {
72
+ const target = itemDicts[page - 1];
73
+ if (target) switchSibling(target);
74
+ },
75
+ size: "sm"
76
+ })]
77
+ }), variantDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
78
+ className: "flex flex-wrap items-center gap-2",
79
+ children: [
80
+ /* @__PURE__ */ jsxs("span", {
70
81
  className: "font-medium text-muted text-xs",
71
- children: itemPagination.label
72
- }), /* @__PURE__ */ jsx(Pagination, {
73
- currentPage: currentItemIndex >= 0 ? currentItemIndex + 1 : 1,
74
- totalPages: itemDicts.length,
75
- onPageChange: (page) => {
76
- const target = itemDicts[page - 1];
77
- if (target) switchSibling(target);
78
- },
79
- size: "sm"
80
- })]
81
- }),
82
- variantDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
83
- className: "flex flex-wrap items-center gap-2",
84
- children: [
85
- /* @__PURE__ */ jsxs("span", {
86
- className: "font-medium text-muted text-xs",
87
- children: [variantSwitcher.label, ":"]
88
- }),
89
- variantDicts.map((sibling) => {
90
- const isActive = sibling.localId === activeDictionary.localId;
91
- return /* @__PURE__ */ jsx("button", {
92
- type: "button",
93
- onClick: () => !isActive && switchSibling(sibling),
94
- className: `rounded-lg px-3 py-1 text-xs transition-colors ${isActive ? "bg-text font-semibold text-text-opposite" : "cursor-pointer border border-border hover:bg-text/10"}`,
95
- children: sibling.variant
96
- }, sibling.localId);
97
- }),
98
- currentVariant !== void 0 && !variantDicts.some((d) => d.localId === dictionary.localId) && /* @__PURE__ */ jsx("span", {
99
- className: "rounded-lg bg-text px-3 py-1 font-semibold text-text-opposite text-xs",
100
- children: currentVariant
101
- })
102
- ]
103
- }),
104
- metaDicts.length > 0 && /* @__PURE__ */ jsxs("div", {
105
- className: "flex flex-wrap items-center gap-2",
106
- children: [
107
- /* @__PURE__ */ jsxs("span", {
108
- className: "font-medium text-muted text-xs",
109
- children: [metaSwitcher.label, ":"]
110
- }),
111
- metaDicts.map((sibling) => {
112
- const isActive = sibling.localId === activeDictionary.localId;
113
- return /* @__PURE__ */ jsx("button", {
114
- type: "button",
115
- onClick: () => !isActive && switchSibling(sibling),
116
- className: `rounded-lg px-3 py-1 text-xs transition-colors ${isActive ? "bg-text font-semibold text-text-opposite" : "cursor-pointer border border-border hover:bg-text/10"}`,
117
- children: sibling.meta?.id
118
- }, sibling.localId);
119
- }),
120
- currentMetaId !== void 0 && !metaDicts.some((d) => d.localId === dictionary.localId) && /* @__PURE__ */ jsx("span", {
121
- className: "rounded-lg bg-text px-3 py-1 font-semibold text-text-opposite text-xs",
122
- children: currentMetaId
123
- })
124
- ]
125
- })
126
- ]
82
+ children: [variantSwitcher.label, ":"]
83
+ }),
84
+ variantDicts.map((sibling) => {
85
+ const isActive = sibling.localId === activeDictionary.localId;
86
+ return /* @__PURE__ */ jsx("button", {
87
+ type: "button",
88
+ onClick: () => !isActive && switchSibling(sibling),
89
+ className: `rounded-lg px-3 py-1 text-xs transition-colors ${isActive ? "bg-text font-semibold text-text-opposite" : "cursor-pointer border border-border hover:bg-text/10"}`,
90
+ children: formatVariant(sibling.variant)
91
+ }, sibling.localId);
92
+ }),
93
+ currentVariant !== void 0 && !variantDicts.some((d) => d.localId === dictionary.localId) && /* @__PURE__ */ jsx("span", {
94
+ className: "rounded-lg bg-text px-3 py-1 font-semibold text-text-opposite text-xs",
95
+ children: formatVariant(currentVariant)
96
+ })
97
+ ]
98
+ })]
127
99
  }),
128
100
  /* @__PURE__ */ jsxs("div", {
129
101
  className: "mb-6 flex items-center justify-between gap-2",
@@ -1 +1 @@
1
- {"version":3,"file":"ContentEditor.mjs","names":[],"sources":["../../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"sourcesContent":["'use client';\n\nimport { useGetDictionaries } from '@api/index';\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport {\n useEditedContent,\n useEditorLocale,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport {\n type FC,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useState,\n useTransition,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContent } from '../LocaleSwitcherContentDropDown';\nimport { Pagination } from '../Pagination';\nimport { TextEditorContainer } from './ContentEditorView/TextEditor';\nimport { getIsEditableSection } from './getIsEditableSection';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n isDarkMode?: boolean;\n};\n\nexport const ContentEditor: FC<NodeEditorProps> = ({\n dictionary,\n isDarkMode,\n}) => {\n const { itemPagination, variantSwitcher, metaSwitcher } =\n useIntlayer('content-editor');\n const { editedContent } = useEditedContent();\n const {\n focusedContent,\n setFocusedContentKeyPath: _setFocusedContentKeyPath,\n } = useFocusUnmergedDictionary();\n const [, startTransition] = useTransition();\n const setFocusedContentKeyPath: typeof _setFocusedContentKeyPath = (\n keyPath\n ) => startTransition(() => _setFocusedContentKeyPath(keyPath));\n\n const [activeDictionary, setActiveDictionary] =\n useState<Dictionary>(dictionary);\n\n useEffect(() => {\n setActiveDictionary(dictionary);\n }, [dictionary.localId]);\n\n const hasQualifier =\n dictionary.item !== undefined ||\n dictionary.variant !== undefined ||\n dictionary.meta !== undefined;\n\n const { data: siblingsData } = useGetDictionaries(\n { keys: [dictionary.key] },\n { enabled: hasQualifier && !!dictionary.key }\n );\n\n const allSiblings = useMemo<Dictionary[]>(\n () => (siblingsData?.data ?? []) as unknown as Dictionary[],\n [siblingsData]\n );\n\n const itemDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.item === undefined) return [];\n return allSiblings\n .filter((d) => d.item !== undefined)\n .sort((a, b) => (a.item ?? 0) - (b.item ?? 0));\n }, [dictionary, allSiblings]);\n\n const variantDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.variant === undefined) return [];\n return allSiblings.filter((d) => d.variant !== undefined);\n }, [dictionary, allSiblings]);\n\n const metaDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.meta === undefined) return [];\n return allSiblings.filter((d) => d.meta !== undefined);\n }, [dictionary, allSiblings]);\n\n const switchSibling = useCallback(\n (sibling: Dictionary) => {\n setActiveDictionary(sibling);\n setFocusedContentKeyPath([]);\n },\n [setFocusedContentKeyPath]\n );\n\n const { content, key, localId } = activeDictionary;\n const focusedKeyPath = focusedContent?.keyPath;\n const section =\n typeof editedContent?.[localId as LocalDictionaryId]?.content ===\n 'undefined'\n ? content\n : editedContent?.[localId as LocalDictionaryId]?.content;\n\n const currentLocale = useEditorLocale();\n const focusedSection = getContentNodeByKeyPath(\n section,\n focusedKeyPath ?? [],\n currentLocale\n );\n\n const deferredKeyPath = useDeferredValue(focusedKeyPath);\n const deferredSection = useDeferredValue(focusedSection);\n const isStale = deferredSection !== focusedSection;\n\n const isEditableBaseSection = getIsEditableSection(section);\n const isEditableFocusedSection = getIsEditableSection(deferredSection);\n\n useEffect(() => {\n if (typeof focusedSection === 'undefined') {\n setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);\n }\n }, []);\n\n const currentItemIndex = itemDicts.findIndex(\n (dictionary) => dictionary.localId === activeDictionary.localId\n );\n const currentVariant = activeDictionary.variant;\n const currentMetaId = activeDictionary.meta?.id;\n\n return (\n <div>\n {/* Qualifier navigation controls */}\n {hasQualifier && (\n <div className=\"mb-4 flex flex-wrap items-center gap-4\">\n {itemDicts.length > 0 && (\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium text-muted text-xs\">\n {itemPagination.label}\n </span>\n <Pagination\n currentPage={currentItemIndex >= 0 ? currentItemIndex + 1 : 1}\n totalPages={itemDicts.length}\n onPageChange={(page) => {\n const target = itemDicts[page - 1];\n if (target) switchSibling(target);\n }}\n size=\"sm\"\n />\n </div>\n )}\n\n {variantDicts.length > 0 && (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"font-medium text-muted text-xs\">\n {variantSwitcher.label}:\n </span>\n {variantDicts.map((sibling) => {\n const isActive = sibling.localId === activeDictionary.localId;\n return (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => !isActive && switchSibling(sibling)}\n className={`rounded-lg px-3 py-1 text-xs transition-colors ${\n isActive\n ? 'bg-text font-semibold text-text-opposite'\n : 'cursor-pointer border border-border hover:bg-text/10'\n }`}\n >\n {sibling.variant}\n </button>\n );\n })}\n {currentVariant !== undefined &&\n !variantDicts.some((d) => d.localId === dictionary.localId) && (\n <span className=\"rounded-lg bg-text px-3 py-1 font-semibold text-text-opposite text-xs\">\n {currentVariant}\n </span>\n )}\n </div>\n )}\n\n {metaDicts.length > 0 && (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"font-medium text-muted text-xs\">\n {metaSwitcher.label}:\n </span>\n {metaDicts.map((sibling) => {\n const isActive = sibling.localId === activeDictionary.localId;\n return (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => !isActive && switchSibling(sibling)}\n className={`rounded-lg px-3 py-1 text-xs transition-colors ${\n isActive\n ? 'bg-text font-semibold text-text-opposite'\n : 'cursor-pointer border border-border hover:bg-text/10'\n }`}\n >\n {sibling.meta?.id}\n </button>\n );\n })}\n {currentMetaId !== undefined &&\n !metaDicts.some((d) => d.localId === dictionary.localId) && (\n <span className=\"rounded-lg bg-text px-3 py-1 font-semibold text-text-opposite text-xs\">\n {currentMetaId}\n </span>\n )}\n </div>\n )}\n </div>\n )}\n\n <div className=\"mb-6 flex items-center justify-between gap-2\">\n <KeyPathBreadcrumb\n dictionaryKey={key}\n keyPath={focusedKeyPath ?? []}\n onClickKeyPath={setFocusedContentKeyPath}\n />\n <div className=\"flex items-center gap-2\">\n <LocaleSwitcherContent />\n </div>\n </div>\n <div className=\"flex flex-1 gap-2 overflow-visible max-md:flex-col\">\n {typeof section === 'object' &&\n section &&\n !isEditableBaseSection &&\n Object.keys(section).length > 0 && (\n <Container\n border\n background=\"none\"\n className=\"top-10 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]\"\n roundedSize=\"2xl\"\n transparency=\"xs\"\n >\n <NavigationViewNode\n keyPath={[]}\n section={section}\n dictionary={activeDictionary}\n />\n </Container>\n )}\n {(isEditableFocusedSection || (deferredKeyPath ?? []).length > 0) && (\n <div\n className={\n isStale\n ? 'pointer-events-none flex-1 opacity-50 transition-opacity'\n : 'flex-1 transition-opacity'\n }\n >\n <TextEditorContainer\n keyPath={deferredKeyPath ?? []}\n section={deferredSection}\n dictionary={activeDictionary}\n isD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B,mBAAmB,EAAE,EAAE,SAAS,MAC7D,oBAAC,OAAD;IACE,WACE,UACI,6DACA;cAGN,oBAAC,qBAAD;KACE,SAAS,mBAAmB,EAAE;KAC9B,SAAS;KACT,YAAY;KACA;KACZ;IACE,EAEJ;;EACF"}
1
+ {"version":3,"file":"ContentEditor.mjs","names":[],"sources":["../../../../src/components/DictionaryFieldEditor/ContentEditor.tsx"],"sourcesContent":["'use client';\n\nimport { useGetDictionaries } from '@api/index';\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport {\n useEditedContent,\n useEditorLocale,\n useFocusUnmergedDictionary,\n} from '@intlayer/editor-react';\nimport type { Dictionary, LocalDictionaryId } from '@intlayer/types/dictionary';\nimport {\n type FC,\n useCallback,\n useDeferredValue,\n useEffect,\n useMemo,\n useState,\n useTransition,\n} from 'react';\nimport { useIntlayer } from 'react-intlayer';\nimport { Container } from '../Container';\nimport { LocaleSwitcherContent } from '../LocaleSwitcherContentDropDown';\nimport { Pagination } from '../Pagination';\nimport { TextEditorContainer } from './ContentEditorView/TextEditor';\nimport { getIsEditableSection } from './getIsEditableSection';\nimport { KeyPathBreadcrumb } from './KeyPathBreadcrumb';\nimport { NavigationViewNode } from './NavigationView/NavigationViewNode';\n\ntype NodeEditorProps = {\n dictionary: Dictionary;\n isDarkMode?: boolean;\n};\n\n/** Render a variant (named string or structured object) for display. */\nconst formatVariant = (\n variant: string | Record<string, string | number> | undefined\n): string =>\n variant !== null && typeof variant === 'object'\n ? JSON.stringify(variant)\n : (variant ?? '');\n\nexport const ContentEditor: FC<NodeEditorProps> = ({\n dictionary,\n isDarkMode,\n}) => {\n const { itemPagination, variantSwitcher } = useIntlayer('content-editor');\n const { editedContent } = useEditedContent();\n const {\n focusedContent,\n setFocusedContentKeyPath: _setFocusedContentKeyPath,\n } = useFocusUnmergedDictionary();\n const [, startTransition] = useTransition();\n const setFocusedContentKeyPath: typeof _setFocusedContentKeyPath = (\n keyPath\n ) => startTransition(() => _setFocusedContentKeyPath(keyPath));\n\n const [activeDictionary, setActiveDictionary] =\n useState<Dictionary>(dictionary);\n\n // Re-sync the locally tracked dictionary whenever the incoming prop changes\n // identity — not only when its `localId` changes. After a save, the query\n // refetches and hands back the same `localId` with fresh content; keying the\n // effect on `localId` alone left `activeDictionary` (the render source) stale\n // until a full page reload. The prop reference is stable across unrelated\n // re-renders (query data / store entry), so sibling switches made via\n // `switchSibling` are preserved.\n useEffect(() => {\n setActiveDictionary(dictionary);\n }, [dictionary]);\n\n const hasQualifier =\n dictionary.item !== undefined || dictionary.variant !== undefined;\n\n const { data: siblingsData } = useGetDictionaries(\n { keys: [dictionary.key] },\n { enabled: hasQualifier && !!dictionary.key }\n );\n\n const allSiblings = useMemo<Dictionary[]>(\n () => (siblingsData?.data ?? []) as unknown as Dictionary[],\n [siblingsData]\n );\n\n const itemDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.item === undefined) return [];\n return allSiblings\n .filter((d) => d.item !== undefined)\n .sort((a, b) => (a.item ?? 0) - (b.item ?? 0));\n }, [dictionary, allSiblings]);\n\n const variantDicts = useMemo<Dictionary[]>(() => {\n if (dictionary.variant === undefined) return [];\n return allSiblings.filter((d) => d.variant !== undefined);\n }, [dictionary, allSiblings]);\n\n const switchSibling = useCallback(\n (sibling: Dictionary) => {\n setActiveDictionary(sibling);\n setFocusedContentKeyPath([]);\n },\n [setFocusedContentKeyPath]\n );\n\n const { content, key, localId } = activeDictionary;\n const focusedKeyPath = focusedContent?.keyPath;\n const section =\n typeof editedContent?.[localId as LocalDictionaryId]?.content ===\n 'undefined'\n ? content\n : editedContent?.[localId as LocalDictionaryId]?.content;\n\n const currentLocale = useEditorLocale();\n const focusedSection = getContentNodeByKeyPath(\n section,\n focusedKeyPath ?? [],\n currentLocale\n );\n\n const deferredKeyPath = useDeferredValue(focusedKeyPath);\n const deferredSection = useDeferredValue(focusedSection);\n const isStale = deferredSection !== focusedSection;\n\n const isEditableBaseSection = getIsEditableSection(section);\n const isEditableFocusedSection = getIsEditableSection(deferredSection);\n\n useEffect(() => {\n if (typeof focusedSection === 'undefined') {\n setFocusedContentKeyPath(focusedContent?.keyPath?.slice(0, -1) ?? []);\n }\n }, []);\n\n const currentItemIndex = itemDicts.findIndex(\n (dictionary) => dictionary.localId === activeDictionary.localId\n );\n const currentVariant = activeDictionary.variant;\n\n return (\n <div>\n {/* Qualifier navigation controls */}\n {hasQualifier && (\n <div className=\"mb-4 flex flex-wrap items-center gap-4\">\n {itemDicts.length > 0 && (\n <div className=\"flex items-center gap-2\">\n <span className=\"font-medium text-muted text-xs\">\n {itemPagination.label}\n </span>\n <Pagination\n currentPage={currentItemIndex >= 0 ? currentItemIndex + 1 : 1}\n totalPages={itemDicts.length}\n onPageChange={(page) => {\n const target = itemDicts[page - 1];\n if (target) switchSibling(target);\n }}\n size=\"sm\"\n />\n </div>\n )}\n\n {variantDicts.length > 0 && (\n <div className=\"flex flex-wrap items-center gap-2\">\n <span className=\"font-medium text-muted text-xs\">\n {variantSwitcher.label}:\n </span>\n {variantDicts.map((sibling) => {\n const isActive = sibling.localId === activeDictionary.localId;\n return (\n <button\n key={sibling.localId}\n type=\"button\"\n onClick={() => !isActive && switchSibling(sibling)}\n className={`rounded-lg px-3 py-1 text-xs transition-colors ${\n isActive\n ? 'bg-text font-semibold text-text-opposite'\n : 'cursor-pointer border border-border hover:bg-text/10'\n }`}\n >\n {formatVariant(sibling.variant)}\n </button>\n );\n })}\n {currentVariant !== undefined &&\n !variantDicts.some((d) => d.localId === dictionary.localId) && (\n <span className=\"rounded-lg bg-text px-3 py-1 font-semibold text-text-opposite text-xs\">\n {formatVariant(currentVariant)}\n </span>\n )}\n </div>\n )}\n </div>\n )}\n\n <div className=\"mb-6 flex items-center justify-between gap-2\">\n <KeyPathBreadcrumb\n dictionaryKey={key}\n keyPath={focusedKeyPath ?? []}\n onClickKeyPath={setFocusedContentKeyPath}\n />\n <div className=\"flex items-center gap-2\">\n <LocaleSwitcherContent />\n </div>\n </div>\n <div className=\"flex flex-1 gap-2 overflow-visible max-md:flex-col\">\n {typeof section === 'object' &&\n section &&\n !isEditableBaseSection &&\n Object.keys(section).length > 0 && (\n <Container\n border\n background=\"none\"\n className=\"top-10 flex h-full flex-col items-start gap-0.5 overflow-auto p-2 md:sticky md:max-w-[50%]\"\n roundedSize=\"2xl\"\n transparency=\"xs\"\n >\n <NavigationViewNode\n keyPath={[]}\n section={section}\n dictionary={activeDictionary}\n />\n </Container>\n )}\n {(isEditableFocusedSection || (deferredKeyPath ?? []).length > 0) && (\n <div\n className={\n isStale\n ? 'pointer-events-none flex-1 opacity-50 transition-opacity'\n : 'flex-1 transition-opacity'\n }\n >\n <TextEditorContainer\n keyPath={deferredKeyPath ?? []}\n section={deferredSection}\n dictionary={activeDictionary}\n isDarkMode={isDarkMode}\n />\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAM,iBACJ,YAEA,YAAY,QAAQ,OAAO,YAAY,WACnC,KAAK,UAAU,QAAQ,GACtB,WAAW;AAElB,MAAa,iBAAsC,EACjD,YACA,iBACI;CACJ,MAAM,EAAE,gBAAgB,oBAAoB,YAAY,iBAAiB;CACzE,MAAM,EAAE,kBAAkB,kBAAkB;CAC5C,MAAM,EACJ,gBACA,0BAA0B,8BACxB,4BAA4B;CAChC,MAAM,GAAG,mBAAmB,eAAe;CAC3C,MAAM,4BACJ,YACG,sBAAsB,0BAA0B,QAAQ,CAAC;CAE9D,MAAM,CAAC,kBAAkB,uBACvB,SAAqB,WAAW;AASlC,iBAAgB;AACd,sBAAoB,WAAW;IAC9B,CAAC,WAAW,CAAC;CAEhB,MAAM,eACJ,WAAW,SAAS,UAAa,WAAW,YAAY;CAE1D,MAAM,EAAE,MAAM,iBAAiB,mBAC7B,EAAE,MAAM,CAAC,WAAW,IAAI,EAAE,EAC1B,EAAE,SAAS,gBAAgB,CAAC,CAAC,WAAW,KAAK,CAC9C;CAED,MAAM,cAAc,cACX,cA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cAGN,oBAAC,qBAAD;KACE,SAAS,mBAAmB,EAAE;KAC9B,SAAS;KACT,YAAY;KACA;KACZ;IACE,EAEJ;;EACF"}
@@ -1,5 +1,6 @@
1
1
  'use client';
2
2
 
3
+ import { useAuditContentDeclarationField } from "../../../api/hooks/ai.mjs";
3
4
  import { Loader } from "../../Loader/index.mjs";
4
5
  import { Button } from "../../Button/Button.mjs";
5
6
  import { Accordion } from "../../Accordion/Accordion.mjs";
@@ -7,18 +8,17 @@ import { Container } from "../../Container/index.mjs";
7
8
  import { ContentEditorInput as ContentEditorInput$1 } from "../../ContentEditor/ContentEditorInput.mjs";
8
9
  import { ContentEditorTextArea as ContentEditorTextArea$1 } from "../../ContentEditor/ContentEditorTextArea.mjs";
9
10
  import { SwitchSelector } from "../../SwitchSelector/SwitchSelector.mjs";
10
- import { useAuditContentDeclarationField } from "../../../api/hooks/ai.mjs";
11
11
  import { useLocaleSwitcherContent } from "../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";
12
12
  import { renameKey } from "./object.mjs";
13
13
  import { Label } from "../../Label/index.mjs";
14
14
  import { EnumKeyInput } from "../EnumKeyInput.mjs";
15
15
  import { SafeHtmlRenderer } from "./SafeHtmlRenderer.mjs";
16
+ import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
16
17
  import { Fragment, Suspense, lazy, memo, useState } from "react";
17
18
  import { Plus, Trash, WandSparkles } from "lucide-react";
18
19
  import { jsx, jsxs } from "react/jsx-runtime";
19
20
  import { useIntlayer, useLocale } from "react-intlayer";
20
21
  import { getLocaleName } from "@intlayer/core/localization";
21
- import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
22
22
  import { getEmptyNode, getNodeType } from "@intlayer/core/dictionaryManipulator";
23
23
  import * as NodeTypes from "@intlayer/types/nodeType";
24
24
  import { camelCaseToSentence } from "@intlayer/config/client";