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

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 (97) 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/useAuth/useOAuth2.mjs +1 -1
  4. package/dist/esm/api/useAuth/useSession.mjs +1 -1
  5. package/dist/esm/api/useIntlayerAPI.mjs.map +1 -1
  6. package/dist/esm/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.mjs.map +1 -1
  7. package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +40 -68
  8. package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs.map +1 -1
  9. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +46 -72
  10. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
  11. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs +0 -62
  12. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.mjs.map +1 -1
  13. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +2 -4
  14. package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
  15. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +64 -145
  16. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
  17. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs +1 -1
  18. package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.mjs.map +1 -1
  19. package/dist/esm/components/Form/elements/OTPElement.mjs +1 -1
  20. package/dist/esm/components/LanguageBackground/LanguageBackground.mjs +3 -8
  21. package/dist/esm/components/LanguageBackground/LanguageBackground.mjs.map +1 -1
  22. package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +1 -1
  23. package/dist/esm/components/MarkDownRender/MarkDownRender.mjs +1 -1
  24. package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
  25. package/dist/esm/components/Modal/Modal.mjs +2 -2
  26. package/dist/esm/components/Navbar/MobileNavbar.mjs +1 -1
  27. package/dist/esm/components/Pagination/Pagination.mjs +1 -1
  28. package/dist/esm/components/Pattern/GridDistortionPattern.mjs +275 -0
  29. package/dist/esm/components/Pattern/GridDistortionPattern.mjs.map +1 -0
  30. package/dist/esm/components/Pattern/index.mjs +2 -1
  31. package/dist/esm/components/RightDrawer/RightDrawer.mjs +3 -3
  32. package/dist/esm/components/SwitchSelector/useSwitchSelector.mjs +0 -1
  33. package/dist/esm/components/SwitchSelector/useSwitchSelector.mjs.map +1 -1
  34. package/dist/esm/components/Tab/Tab.mjs +1 -1
  35. package/dist/esm/components/index.mjs +2 -1
  36. package/dist/esm/hooks/index.mjs +8 -8
  37. package/dist/esm/hooks/useIsMounted.mjs +4 -2
  38. package/dist/esm/hooks/useIsMounted.mjs.map +1 -1
  39. package/dist/esm/utils/cn.mjs +2 -8
  40. package/dist/types/api/hooks/dictionary.d.ts.map +1 -1
  41. package/dist/types/api/useIntlayerAPI.d.ts +41 -288
  42. package/dist/types/api/useIntlayerAPI.d.ts.map +1 -1
  43. package/dist/types/components/Badge/index.d.ts +2 -2
  44. package/dist/types/components/Button/Button.d.ts +5 -5
  45. package/dist/types/components/CollapsibleTable/CollapsibleTable.d.ts +1 -1
  46. package/dist/types/components/Command/index.d.ts +2 -2
  47. package/dist/types/components/Container/index.d.ts +1 -1
  48. package/dist/types/components/DictionaryEditor/NodeWrapper/MarkdownWrapper.d.ts.map +1 -1
  49. package/dist/types/components/DictionaryFieldEditor/ContentEditor.d.ts.map +1 -1
  50. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.d.ts.map +1 -1
  51. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts +0 -62
  52. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/dictionaryCreationForm.content.d.ts.map +1 -1
  53. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts +1 -3
  54. package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts.map +1 -1
  55. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.d.ts.map +1 -1
  56. package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/dictionaryDetails.content.d.ts +1 -1
  57. package/dist/types/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.d.ts +1 -1
  58. package/dist/types/components/Form/elements/AutoSizeTextAreaElement.d.ts +1 -1
  59. package/dist/types/components/Form/elements/CheckboxElement.d.ts +1 -1
  60. package/dist/types/components/Form/elements/EditableFieldInputElement.d.ts +1 -1
  61. package/dist/types/components/Form/elements/EditableFieldTextAreaElement.d.ts +1 -1
  62. package/dist/types/components/Form/elements/InputElement.d.ts +1 -1
  63. package/dist/types/components/Form/elements/InputPasswordElement.d.ts +1 -1
  64. package/dist/types/components/Form/elements/MultiselectElement.d.ts +1 -1
  65. package/dist/types/components/Form/elements/OTPElement.d.ts +1 -1
  66. package/dist/types/components/Form/elements/SearchInputElement.d.ts +1 -1
  67. package/dist/types/components/Form/elements/SelectElement.d.ts +1 -1
  68. package/dist/types/components/Form/elements/SwitchSelectorElement.d.ts +1 -1
  69. package/dist/types/components/Form/elements/TextAreaElement.d.ts +1 -1
  70. package/dist/types/components/IDE/CopyCode.d.ts +1 -1
  71. package/dist/types/components/Input/Checkbox.d.ts +1 -1
  72. package/dist/types/components/Input/Radio.d.ts +1 -1
  73. package/dist/types/components/LanguageBackground/LanguageBackground.d.ts.map +1 -1
  74. package/dist/types/components/Link/Link.d.ts +2 -2
  75. package/dist/types/components/MarkDownRender/MarkDownRender.d.ts.map +1 -1
  76. package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts +1 -1
  77. package/dist/types/components/MarkdownEditor/generative/AISelector.d.ts.map +1 -1
  78. package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts +1 -1
  79. package/dist/types/components/MarkdownEditor/generative/GenerativeMenuSwitch.d.ts.map +1 -1
  80. package/dist/types/components/Pagination/Pagination.d.ts +2 -2
  81. package/dist/types/components/Pattern/GridDistortionPattern.d.ts +15 -0
  82. package/dist/types/components/Pattern/GridDistortionPattern.d.ts.map +1 -0
  83. package/dist/types/components/Pattern/index.d.ts +2 -1
  84. package/dist/types/components/SwitchSelector/SwitchSelector.d.ts +2 -2
  85. package/dist/types/components/SwitchSelector/VerticalSwitchSelector.d.ts +1 -1
  86. package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts +10 -2
  87. package/dist/types/components/SwitchSelector/useSwitchSelector.d.ts.map +1 -1
  88. package/dist/types/components/Tab/Tab.d.ts +1 -1
  89. package/dist/types/components/TabSelector/TabSelector.d.ts +2 -2
  90. package/dist/types/components/Tag/index.d.ts +1 -1
  91. package/dist/types/components/Toaster/Toast.d.ts +1 -1
  92. package/dist/types/components/index.d.ts +7 -6
  93. package/dist/types/hooks/index.d.ts +1 -1
  94. package/dist/types/utils/cn.d.ts +2 -7
  95. package/package.json +27 -28
  96. package/dist/esm/utils/cn.mjs.map +0 -1
  97. 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,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,EAAE,YAAY,GAAG,aAAa;AAK5C,UAAO,MAJW,cAAc,gBAC9B;IAAE,GAAG;IAAS,MAAM;IAAW,EAC/B,EAAE,QAAQ,CACX;;EAGH,mBAAmB,aAAa;AAC9B,OAAI,SAAS,KAAK,WAAW,EAAG,QAAO;GACvC,MAAM,cAAc,SAAS,QAAQ;AAErC,UAAO,eADY,SAAS,eAA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C,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,EAAE,YAAY,GAAG,aAAa;AAK5C,UAAO,MAJW,cAAc,gBAC9B;IAAE,GAAG;IAAS,MAAM;IAAW,EAC/B,EAAE,QAAQ,CACX;;EAGH,mBAAmB,aAAa;AAC9B,OAAI,SAAS,KAAK,WAAW,EAAG,QAAO;GACvC,MAAM,cAAc,SAAS,QAAQ;AAErC,UAAO,eADY,SAAS,eAAe,KACT,cAAc,IAAI;;EAEtD,kBAAkB;EAClB,SAAS,SAAS,YAAY,QAAQ,QAAQ;EAC9C,GAAG;EACJ,CAAC;;AAGJ,MAAa,0BAA0B,YAAuC;CAC5E,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,UAAU,CAAC,mBAAmB;EAC9B,eAAe,cAAc,qBAAqB;EAClD,aAAa;EACb,qBAAqB;EACrB,gBAAgB;EAChB,GAAG;EACJ,CAAC;;AAGJ,MAAa,oBACX,eACA,SACA,YACG;CACH,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,UAAU,CAAC,cAAc,cAAc;EACvC,UAAU,EAAE,aACV,cAAc,cAAc,eAAe,SAAS,EAClD,QACD,CAAC;EACJ,aAAa;EACb,qBAAqB;EACrB,gBAAgB;EAChB,GAAG;EACJ,CAAC;;AAGJ,MAAa,yBAAyB;CACpC,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,YAAY;EACjB,aAAa,CAAC,eAAe;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;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;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,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import { editor } from "@intlayer/config/built";
4
3
  import { useQuery } from "@tanstack/react-query";
4
+ import { editor } from "@intlayer/config/built";
5
5
  import { getOAuthAPI } from "@intlayer/api";
6
6
  import { useConfiguration } from "@intlayer/editor-react";
7
7
  import { defu } from "defu";
@@ -1,8 +1,8 @@
1
1
  'use client';
2
2
 
3
3
  import { getAuthAPI } from "../../libs/auth.mjs";
4
- import { editor } from "@intlayer/config/built";
5
4
  import { useQuery, useQueryClient } from "@tanstack/react-query";
5
+ import { editor } from "@intlayer/config/built";
6
6
  import { useConfiguration } from "@intlayer/editor-react";
7
7
 
8
8
  //#region src/api/useAuth/useSession.ts
@@ -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,eAAe,SAAS,eAAe;;AAGhD,MAAa,mBAAmB,UAA0C;CACxE,MAAM,gBAAgB,kBAAkB;AAExC,QAAO,WAAW,OAAO,yBAAyB,cAAc;;AAGlE,MAAa,sBAAsB,UAAiC;CAClE,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,mBAAmB,SAAS,eAAe;;AAGpD,MAAa,iBAAiB,UAAiC;CAC7D,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,cAAc,SAAS,eAAe;;AAG/C,MAAa,cAAc,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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,cACX,UACkC;CAClC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,WAAW,SAAS,eAAe;;AAG5C,MAAa,eACX,UACmC;CACnC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAOA,cAAY,SAAS,eAAe;;AAG7C,MAAa,oBACX,UACwC;CACxC,MAAM,EAAE,SAAS,mBAAmB,wBAAwB,MAAM;AAClE,QAAO,iBAAiB,SAAS,eAAe;;AAGlD,MAAa,gBACX,UACoC;CACpC,MAAM,EAAE,SAAS,mBAA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,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 +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"}
@@ -15,8 +15,10 @@ import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@
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 isDarkMode={isDarkMode}\n />\n </div>\n )}\n </div>\n </div>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;AAiCA,MAAa,iBAAsC,EACjD,YACA,iBACI;CACJ,MAAM,EAAE,gBAAgB,iBAAiB,iBACvC,YAAY,iBAAiB;CAC/B,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;AAElC,iBAAgB;AACd,sBAAoB,WAAW;IAC9B,CAAC,WAAW,QAAQ,CAAC;CAExB,MAAM,eACJ,WAAW,SAAS,UACpB,WAAW,YAAY,UACvB,WAAW,SAAS;CAEtB,MAAM,EAAE,MAAM,iBAAiB,mBAC7B,EAAE,MAAM,CAAC,WAAW,I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WAAW,kDACT,WACI,6CACA;kBAGL,QAAQ,MAAM;QACR,EAVF,QAAQ,QAUN;QAEX;MACD,kBAAkB,UACjB,CAAC,UAAU,MAAM,MAAM,EAAE,YAAY,WAAW,QAAQ,IACtD,oBAAC,QAAD;OAAM,WAAU;iBACb;OACI;MAEP;;IAEJ;;EAGR,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,mBAAD;IACE,eAAe;IACf,SAAS,kBAAkB,EAAE;IAC7B,gBAAgB;IAChB,GACF,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,uBAAD,EAAyB;IACrB,EACF;;EACN,qBAAC,OAAD;GAAK,WAAU;aAAf,CACG,OAAO,YAAY,YAClB,WACA,CAAC,yBACD,OAAO,KAAK,QAAQ,CAAC,SAAS,KAC5B,oBAAC,WAAD;IACE;IACA,YAAW;IACX,WAAU;IACV,aAAY;IACZ,cAAa;cAEb,oBAAC,oBAAD;KACE,SAAS,EAAE;KACF;KACT,YAAY;KACZ;IACQ,IAEd,6BAA6B,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,YA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AmB,UAClB,CAAC,aAAa,MAAM,MAAM,EAAE,YAAY,WAAW,QAAQ,IACzD,oBAAC,QAAD;MAAM,WAAU;gBACb,cAAc,eAAe;MACzB;KAEP;MAEJ;;EAGR,qBAAC,OAAD;GAAK,WAAU;aAAf,CACE,oBAAC,mBAAD;IACE,eAAe;IACf,SAAS,kBAAkB,EAAE;IAC7B,gBAAgB;IAChB,GACF,oBAAC,OAAD;IAAK,WAAU;cACb,oBAAC,uBAAD,EAAyB;IACrB,EACF;;EACN,qBAAC,OAAD;GAAK,WAAU;aAAf,CACG,OAAO,YAAY,YAClB,WACA,CAAC,yBACD,OAAO,KAAK,QAAQ,CAAC,SAAS,KAC5B,oBAAC,WAAD;IACE;IACA,YAAW;IACX,WAAU;IACV,aAAY;IACZ,cAAa;cAEb,oBAAC,oBAAD;KACE,SAAS,EAAE;KACF;KACT,YAAY;KACZ;IACQ,IAEd,6BAA6B,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"}
@@ -22,7 +22,7 @@ import { AnimatePresence, motion } from "framer-motion";
22
22
  * Inner component rendered inside Form's FormProvider context so useWatch works.
23
23
  */
24
24
  const DictionaryCreationFormFields = ({ isSubmitting, isPending, projectsData }) => {
25
- const { keyInput, createDictionaryButton, projectInput, qualifierTypeSelect, itemInput, variantInput, metaIdInput } = useIntlayer("dictionary-form");
25
+ const { keyInput, createDictionaryButton, projectInput, qualifierTypeSelect, itemInput, variantInput } = useIntlayer("dictionary-form");
26
26
  const qualifierType = useWatch({ name: "qualifierType" }) ?? "none";
27
27
  return /* @__PURE__ */ jsxs(Fragment, { children: [
28
28
  /* @__PURE__ */ jsx(InputElement, {
@@ -53,76 +53,51 @@ const DictionaryCreationFormFields = ({ isSubmitting, isPending, projectsData })
53
53
  }),
54
54
  /* @__PURE__ */ jsxs(AnimatePresence, {
55
55
  mode: "wait",
56
- children: [
57
- qualifierType === "item" && /* @__PURE__ */ jsx(motion.div, {
58
- initial: {
59
- opacity: 0,
60
- height: 0
61
- },
62
- animate: {
63
- opacity: 1,
64
- height: "auto"
65
- },
66
- exit: {
67
- opacity: 0,
68
- height: 0
69
- },
70
- transition: { duration: .2 },
71
- className: "overflow-hidden",
72
- children: /* @__PURE__ */ jsx(InputElement, {
73
- name: "item",
74
- type: "number",
75
- label: itemInput.label.value,
76
- placeholder: itemInput.placeholder.value,
77
- description: itemInput.description.value,
78
- min: 1
79
- })
80
- }, "item-input"),
81
- qualifierType === "variant" && /* @__PURE__ */ jsx(motion.div, {
82
- initial: {
83
- opacity: 0,
84
- height: 0
85
- },
86
- animate: {
87
- opacity: 1,
88
- height: "auto"
89
- },
90
- exit: {
91
- opacity: 0,
92
- height: 0
93
- },
94
- transition: { duration: .2 },
95
- className: "overflow-hidden",
96
- children: /* @__PURE__ */ jsx(InputElement, {
97
- name: "variant",
98
- label: variantInput.label.value,
99
- placeholder: variantInput.placeholder.value,
100
- description: variantInput.description.value
101
- })
102
- }, "variant-input"),
103
- qualifierType === "meta" && /* @__PURE__ */ jsx(motion.div, {
104
- initial: {
105
- opacity: 0,
106
- height: 0
107
- },
108
- animate: {
109
- opacity: 1,
110
- height: "auto"
111
- },
112
- exit: {
113
- opacity: 0,
114
- height: 0
115
- },
116
- transition: { duration: .2 },
117
- className: "overflow-hidden",
118
- children: /* @__PURE__ */ jsx(InputElement, {
119
- name: "metaId",
120
- label: metaIdInput.label.value,
121
- placeholder: metaIdInput.placeholder.value,
122
- description: metaIdInput.description.value
123
- })
124
- }, "meta-input")
125
- ]
56
+ children: [qualifierType === "item" && /* @__PURE__ */ jsx(motion.div, {
57
+ initial: {
58
+ opacity: 0,
59
+ height: 0
60
+ },
61
+ animate: {
62
+ opacity: 1,
63
+ height: "auto"
64
+ },
65
+ exit: {
66
+ opacity: 0,
67
+ height: 0
68
+ },
69
+ transition: { duration: .2 },
70
+ className: "overflow-hidden",
71
+ children: /* @__PURE__ */ jsx(InputElement, {
72
+ name: "item",
73
+ type: "number",
74
+ label: itemInput.label.value,
75
+ placeholder: itemInput.placeholder.value,
76
+ description: itemInput.description.value,
77
+ min: 1
78
+ })
79
+ }, "item-input"), qualifierType === "variant" && /* @__PURE__ */ jsx(motion.div, {
80
+ initial: {
81
+ opacity: 0,
82
+ height: 0
83
+ },
84
+ animate: {
85
+ opacity: 1,
86
+ height: "auto"
87
+ },
88
+ exit: {
89
+ opacity: 0,
90
+ height: 0
91
+ },
92
+ transition: { duration: .2 },
93
+ className: "overflow-hidden",
94
+ children: /* @__PURE__ */ jsx(InputElement, {
95
+ name: "variant",
96
+ label: variantInput.label.value,
97
+ placeholder: variantInput.placeholder.value,
98
+ description: variantInput.description.value
99
+ })
100
+ }, "variant-input")]
126
101
  }),
127
102
  /* @__PURE__ */ jsx(Button, {
128
103
  className: "mt-12 ml-auto",
@@ -149,7 +124,6 @@ const DictionaryCreationForm = ({ onDictionaryCreated }) => {
149
124
  const qualifiers = {};
150
125
  if (data.qualifierType === "item" && data.item !== void 0) qualifiers.item = data.item;
151
126
  else if (data.qualifierType === "variant" && data.variant) qualifiers.variant = data.variant;
152
- else if (data.qualifierType === "meta" && data.metaId) qualifiers.meta = { id: data.metaId };
153
127
  addDictionary({ dictionary: {
154
128
  key: data.key,
155
129
  projectIds: data.projectIds,
@@ -1 +1 @@
1
- {"version":3,"file":"DictionaryCreationForm.mjs","names":["FormInput","FormMultiSelect","FormSelect","FormButton","useForm"],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { useAddDictionary, useGetProjects } from '@api/index';\nimport { useSession } from '@api/useAuth';\nimport {\n Form,\n FormButton,\n FormInput,\n FormMultiSelect,\n FormSelect,\n useForm,\n} from '@components/Form';\nimport { MultiSelect, Select } from '@components/Select';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport type { FC } from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { useIntlayer } from 'react-intlayer';\nimport {\n type DictionaryFormData,\n QUALIFIER_TYPES,\n type QualifierType,\n useDictionarySchema,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\n/**\n * Inner component rendered inside Form's FormProvider context so useWatch works.\n */\nconst DictionaryCreationFormFields: FC<{\n isSubmitting: boolean;\n isPending: boolean;\n projectsData: ReturnType<typeof useGetProjects>['data'];\n}> = ({ isSubmitting, isPending, projectsData }) => {\n const {\n keyInput,\n createDictionaryButton,\n projectInput,\n qualifierTypeSelect,\n itemInput,\n variantInput,\n metaIdInput,\n } = useIntlayer('dictionary-form');\n\n const qualifierType = (useWatch({ name: 'qualifierType' }) ??\n 'none') as QualifierType;\n\n return (\n <>\n <FormInput\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <FormMultiSelect name=\"projectIds\" label={projectInput.label.value}>\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projectsData?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <MultiSelect.List>\n {projectsData?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </MultiSelect.Content>\n </FormMultiSelect>\n\n <FormSelect\n name=\"qualifierType\"\n label={qualifierTypeSelect.label.value}\n description={qualifierTypeSelect.description.value}\n >\n <Select.Trigger>\n <Select.Value />\n </Select.Trigger>\n <Select.Content>\n {QUALIFIER_TYPES.map((type) => (\n <Select.Item key={type} value={type}>\n {\n (\n qualifierTypeSelect as Record<\n string,\n { value: string } | string\n >\n )[type]\n }\n </Select.Item>\n ))}\n </Select.Content>\n </FormSelect>\n\n <AnimatePresence mode=\"wait\">\n {qualifierType === 'item' && (\n <motion.div\n key=\"item-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n className=\"overflow-hidden\"\n >\n <FormInput\n name=\"item\"\n type=\"number\"\n label={itemInput.label.value}\n placeholder={itemInput.placeholder.value}\n description={itemInput.description.value}\n min={1}\n />\n </motion.div>\n )}\n\n {qualifierType === 'variant' && (\n <motion.div\n key=\"variant-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n className=\"overflow-hidden\"\n >\n <FormInput\n name=\"variant\"\n label={variantInput.label.value}\n placeholder={variantInput.placeholder.value}\n description={variantInput.description.value}\n />\n </motion.div>\n )}\n\n {qualifierType === 'meta' && (\n <motion.div\n key=\"meta-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n className=\"overflow-hidden\"\n >\n <FormInput\n name=\"metaId\"\n label={metaIdInput.label.value}\n placeholder={metaIdInput.placeholder.value}\n description={metaIdInput.description.value}\n />\n </motion.div>\n )}\n </AnimatePresence>\n\n <FormButton\n className=\"mt-12 ml-auto\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting || isPending}\n label={createDictionaryButton.ariaLabel.value}\n isFullWidth\n >\n {createDictionaryButton.text}\n </FormButton>\n </>\n );\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useSession();\n const { project } = session ?? {};\n const { mutate: addDictionary, isPending } = useAddDictionary();\n const { data: projectsData } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?.id));\n const { form, isSubmitting } = useForm(DictionarySchema, {\n defaultValues: {\n projectIds: [project?.id],\n qualifierType: 'none',\n },\n });\n\n const onSubmitSuccess = (data: DictionaryFormData) => {\n const qualifiers: Record<string, unknown> = {};\n if (data.qualifierType === 'item' && data.item !== undefined) {\n qualifiers.item = data.item;\n } else if (data.qualifierType === 'variant' && data.variant) {\n qualifiers.variant = data.variant;\n } else if (data.qualifierType === 'meta' && data.metaId) {\n qualifiers.meta = { id: data.metaId };\n }\n\n addDictionary(\n {\n dictionary: {\n key: data.key,\n projectIds: data.projectIds,\n ...qualifiers,\n },\n },\n {\n onSuccess: () => {\n onDictionaryCreated?.();\n },\n }\n );\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"m-auto w-full max-w-100\"\n {...form}\n >\n <DictionaryCreationFormFields\n isSubmitting={isSubmitting}\n isPending={isPending}\n projectsData={projectsData}\n />\n </Form>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,gCAIA,EAAE,cAAc,WAAW,mBAAmB;CAClD,MAAM,EACJ,UACA,wBACA,cACA,qBACA,WACA,cACA,gBACE,YAAY,kBAAkB;CAElC,MAAM,gBAAiB,SAAS,EAAE,MAAM,iBAAiB,CAAC,IACxD;AAEF,QACE;EACE,oBAACA,cAAD;GACE,MAAK;GACL,OAAO,SAAS,MAAM;GACtB,aAAa,SAAS,YAAY;GAClC;GACA;EAEF,qBAACC,oBAAD;GAAiB,MAAK;GAAa,OAAO,aAAa,MAAM;aAA7D,CACE,oBAAC,YAAY,SAAb;IACE,gBAAgB,UACd,cAAc,MAAM,MAAM,YAAY,OAAO,QAAQ,GAAG,KAAK,MAAM,EAC/D,QAAQ;cAGd,oBAAC,YAAY,OAAb,EAAmB,aAAa,aAAa,YAAY,OAAS;IAC9C,GACtB,oBAAC,YAAY,SAAb,YACE,oBAAC,YAAY,MAAb,YACG,cAAc,MAAM,KAAK,YACxB,oBAAC,YAAY,MAAb;IAEE,OAAO,OAAO,QAAQ,GAAG;cAExB,QAAQ;IACQ,EAJZ,OAA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MAAG;KAC/B,YAAY,EAAE,UAAU,IAAK;KAC7B,WAAU;eAEV,oBAACA,cAAD;MACE,MAAK;MACL,OAAO,YAAY,MAAM;MACzB,aAAa,YAAY,YAAY;MACrC,aAAa,YAAY,YAAY;MACrC;KACS,EAbP,aAaO;IAEC;;EAElB,oBAACG,QAAD;GACE,WAAU;GACV,MAAK;GACL,OAAM;GACN,WAAW,gBAAgB;GAC3B,OAAO,uBAAuB,UAAU;GACxC;aAEC,uBAAuB;GACb;EACZ;;AAIP,MAAa,0BAA2D,EACtE,0BACI;CACJ,MAAM,EAAE,YAAY,YAAY;CAChC,MAAM,EAAE,YAAY,WAAW,EAAE;CACjC,MAAM,EAAE,QAAQ,eAAe,cAAc,kBAAkB;CAC/D,MAAM,EAAE,MAAM,iBAAiB,gBAAgB;CAC/C,MAAM,mBAAmB,oBAAoB,OAAO,SAAS,GAAG,CAAC;CACjE,MAAM,EAAE,MAAM,iBAAiBC,UAAQ,kBAAkB,EACvD,eAAe;EACb,YAAY,CAAC,SAAS,GAAG;EACzB,eAAe;EAChB,EACF,CAAC;CAEF,MAAM,mBAAmB,SAA6B;EACpD,MAAM,aAAsC,EAAE;AAC9C,MAAI,KAAK,kBAAkB,UAAU,KAAK,SAAS,OACjD,YAAW,OAAO,KAAK;WACd,KAAK,kBAAkB,aAAa,KAAK,QAClD,YAAW,UAAU,KAAK;WACjB,KAAK,kBAAkB,UAAU,KAAK,OAC/C,YAAW,OAAO,EAAE,IAAI,KAAK,QAAQ;AAGvC,gBACE,EACE,YAAY;GACV,KAAK,KAAK;GACV,YAAY,KAAK;GACjB,GAAG;GACJ,EACF,EACD,EACE,iBAAiB;AACf,0BAAuB;KAE1B,CACF;;AAGH,QACE,oBAAC,MAAD;EACE,QAAQ;EACS;EACjB,WAAU;EACV,GAAI;YAEJ,oBAAC,8BAAD;GACgB;GACH;GACG;GACd;EACG"}
1
+ {"version":3,"file":"DictionaryCreationForm.mjs","names":["FormInput","FormMultiSelect","FormSelect","FormButton","useForm"],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { useAddDictionary, useGetProjects } from '@api/index';\nimport { useSession } from '@api/useAuth';\nimport {\n Form,\n FormButton,\n FormInput,\n FormMultiSelect,\n FormSelect,\n useForm,\n} from '@components/Form';\nimport { MultiSelect, Select } from '@components/Select';\nimport { AnimatePresence, motion } from 'framer-motion';\nimport type { FC } from 'react';\nimport { useWatch } from 'react-hook-form';\nimport { useIntlayer } from 'react-intlayer';\nimport {\n type DictionaryFormData,\n QUALIFIER_TYPES,\n type QualifierType,\n useDictionarySchema,\n} from './useDictionaryFormSchema';\n\ntype DictionaryCreationFormProps = {\n onDictionaryCreated?: () => void;\n};\n\n/**\n * Inner component rendered inside Form's FormProvider context so useWatch works.\n */\nconst DictionaryCreationFormFields: FC<{\n isSubmitting: boolean;\n isPending: boolean;\n projectsData: ReturnType<typeof useGetProjects>['data'];\n}> = ({ isSubmitting, isPending, projectsData }) => {\n const {\n keyInput,\n createDictionaryButton,\n projectInput,\n qualifierTypeSelect,\n itemInput,\n variantInput,\n } = useIntlayer('dictionary-form');\n\n const qualifierType = (useWatch({ name: 'qualifierType' }) ??\n 'none') as QualifierType;\n\n return (\n <>\n <FormInput\n name=\"key\"\n label={keyInput.label.value}\n placeholder={keyInput.placeholder.value}\n isRequired\n />\n\n <FormMultiSelect name=\"projectIds\" label={projectInput.label.value}>\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projectsData?.data?.find((project) => String(project.id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder.value} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <MultiSelect.List>\n {projectsData?.data?.map((project) => (\n <MultiSelect.Item\n key={String(project.id)}\n value={String(project.id)}\n >\n {project.name}\n </MultiSelect.Item>\n ))}\n </MultiSelect.List>\n </MultiSelect.Content>\n </FormMultiSelect>\n\n <FormSelect\n name=\"qualifierType\"\n label={qualifierTypeSelect.label.value}\n description={qualifierTypeSelect.description.value}\n >\n <Select.Trigger>\n <Select.Value />\n </Select.Trigger>\n <Select.Content>\n {QUALIFIER_TYPES.map((type) => (\n <Select.Item key={type} value={type}>\n {\n (\n qualifierTypeSelect as Record<\n string,\n { value: string } | string\n >\n )[type]\n }\n </Select.Item>\n ))}\n </Select.Content>\n </FormSelect>\n\n <AnimatePresence mode=\"wait\">\n {qualifierType === 'item' && (\n <motion.div\n key=\"item-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n className=\"overflow-hidden\"\n >\n <FormInput\n name=\"item\"\n type=\"number\"\n label={itemInput.label.value}\n placeholder={itemInput.placeholder.value}\n description={itemInput.description.value}\n min={1}\n />\n </motion.div>\n )}\n\n {qualifierType === 'variant' && (\n <motion.div\n key=\"variant-input\"\n initial={{ opacity: 0, height: 0 }}\n animate={{ opacity: 1, height: 'auto' }}\n exit={{ opacity: 0, height: 0 }}\n transition={{ duration: 0.2 }}\n className=\"overflow-hidden\"\n >\n <FormInput\n name=\"variant\"\n label={variantInput.label.value}\n placeholder={variantInput.placeholder.value}\n description={variantInput.description.value}\n />\n </motion.div>\n )}\n </AnimatePresence>\n\n <FormButton\n className=\"mt-12 ml-auto\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting || isPending}\n label={createDictionaryButton.ariaLabel.value}\n isFullWidth\n >\n {createDictionaryButton.text}\n </FormButton>\n </>\n );\n};\n\nexport const DictionaryCreationForm: FC<DictionaryCreationFormProps> = ({\n onDictionaryCreated,\n}) => {\n const { session } = useSession();\n const { project } = session ?? {};\n const { mutate: addDictionary, isPending } = useAddDictionary();\n const { data: projectsData } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?.id));\n const { form, isSubmitting } = useForm(DictionarySchema, {\n defaultValues: {\n projectIds: [project?.id],\n qualifierType: 'none',\n },\n });\n\n const onSubmitSuccess = (data: DictionaryFormData) => {\n const qualifiers: Record<string, unknown> = {};\n if (data.qualifierType === 'item' && data.item !== undefined) {\n qualifiers.item = data.item;\n } else if (data.qualifierType === 'variant' && data.variant) {\n qualifiers.variant = data.variant;\n }\n\n addDictionary(\n {\n dictionary: {\n key: data.key,\n projectIds: data.projectIds,\n ...qualifiers,\n },\n },\n {\n onSuccess: () => {\n onDictionaryCreated?.();\n },\n }\n );\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"m-auto w-full max-w-100\"\n {...form}\n >\n <DictionaryCreationFormFields\n isSubmitting={isSubmitting}\n isPending={isPending}\n projectsData={projectsData}\n />\n </Form>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA+BA,MAAM,gCAIA,EAAE,cAAc,WAAW,mBAAmB;CAClD,MAAM,EACJ,UACA,wBACA,cACA,qBACA,WACA,iBACE,YAAY,kBAAkB;CAElC,MAAM,gBAAiB,SAAS,EAAE,MAAM,iBAAiB,CAAC,IACxD;AAEF,QACE;EACE,oBAACA,cAAD;GACE,MAAK;GACL,OAAO,SAAS,MAAM;GACtB,aAAa,SAAS,YAAY;GAClC;GACA;EAEF,qBAACC,oBAAD;GAAiB,MAAK;GAAa,OAAO,aAAa,MAAM;aAA7D,CACE,oBAAC,YAAY,SAAb;IACE,gBAAgB,UACd,cAAc,MAAM,MAAM,YAAY,OAAO,QAAQ,GAAG,KAAK,MAAM,EAC/D,QAAQ;cAGd,oBAAC,YAAY,OAAb,EAAmB,aAAa,aAAa,YAAY,OAAS;IAC9C,GACtB,oBAAC,YAAY,SAAb,YACE,oBAAC,YAAY,MAAb,YACG,cAAc,MAAM,KAAK,YACxB,oBAAC,YAAY,MAAb;IAEE,OAAO,OAAO,QAAQ,GAAG;cAExB,QAAQ;IACQ,EAJZ,OAAO,QAAQ,GAAG,CAIN,CACnB,EACe,GACC,EACN;;EAElB,qBAACC,eAAD;GACE,MAAK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CACjC,MAAM,EAAE,QAAQ,eAAe,cAAc,kBAAkB;CAC/D,MAAM,EAAE,MAAM,iBAAiB,gBAAgB;CAC/C,MAAM,mBAAmB,oBAAoB,OAAO,SAAS,GAAG,CAAC;CACjE,MAAM,EAAE,MAAM,iBAAiBC,UAAQ,kBAAkB,EACvD,eAAe;EACb,YAAY,CAAC,SAAS,GAAG;EACzB,eAAe;EAChB,EACF,CAAC;CAEF,MAAM,mBAAmB,SAA6B;EACpD,MAAM,aAAsC,EAAE;AAC9C,MAAI,KAAK,kBAAkB,UAAU,KAAK,SAAS,OACjD,YAAW,OAAO,KAAK;WACd,KAAK,kBAAkB,aAAa,KAAK,QAClD,YAAW,UAAU,KAAK;AAG5B,gBACE,EACE,YAAY;GACV,KAAK,KAAK;GACV,YAAY,KAAK;GACjB,GAAG;GACJ,EACF,EACD,EACE,iBAAiB;AACf,0BAAuB;KAE1B,CACF;;AAGH,QACE,oBAAC,MAAD;EACE,QAAQ;EACS;EACjB,WAAU;EACV,GAAI;YAEJ,oBAAC,8BAAD;GACgB;GACH;GACG;GACd;EACG"}
@@ -334,68 +334,6 @@ const dictionaryFormContent = {
334
334
  uk: "Іменована альтернативна форма вмісту для A/B-тестування, сезонних банерів або прапорів функцій."
335
335
  })
336
336
  },
337
- metaIdInput: {
338
- label: t({
339
- en: "Meta ID",
340
- "en-GB": "Meta ID",
341
- fr: "ID méta",
342
- es: "ID meta",
343
- de: "Meta-ID",
344
- ja: "メタID",
345
- ko: "메타 ID",
346
- zh: "元ID",
347
- it: "ID meta",
348
- pt: "ID meta",
349
- hi: "मेटा ID",
350
- ar: "معرّف البيانات الوصفية",
351
- ru: "Мета-ID",
352
- tr: "Meta kimliği",
353
- pl: "ID meta",
354
- id: "ID meta",
355
- vi: "ID meta",
356
- uk: "Мета-ID"
357
- }),
358
- placeholder: t({
359
- en: "e.g. prod_abc",
360
- "en-GB": "e.g. prod_abc",
361
- fr: "par ex. prod_abc",
362
- es: "por ej. prod_abc",
363
- de: "z. B. prod_abc",
364
- ja: "例: prod_abc",
365
- ko: "예: prod_abc",
366
- zh: "例如: prod_abc",
367
- it: "es. prod_abc",
368
- pt: "ex. prod_abc",
369
- hi: "उदा. prod_abc",
370
- ar: "مثال: prod_abc",
371
- ru: "напр. prod_abc",
372
- tr: "ör. prod_abc",
373
- pl: "np. prod_abc",
374
- id: "mis. prod_abc",
375
- vi: "ví dụ: prod_abc",
376
- uk: "напр. prod_abc"
377
- }),
378
- description: t({
379
- en: "The discriminator ID used to resolve this record at runtime.",
380
- "en-GB": "The discriminator ID used to resolve this record at runtime.",
381
- fr: "L'ID discriminant utilisé pour résoudre cet enregistrement au moment de l'exécution.",
382
- es: "El ID discriminador utilizado para resolver este registro en tiempo de ejecución.",
383
- de: "Die Diskriminator-ID, die verwendet wird, um diesen Datensatz zur Laufzeit aufzulösen.",
384
- ja: "実行時にこのレコードを解決するために使用される識別子ID。",
385
- ko: "런타임에 이 레코드를 해결하는 데 사용되는 식별자 ID.",
386
- zh: "在运行时用于解析此记录的鉴别符ID。",
387
- it: "L'ID discriminante utilizzato per risolvere questo record in fase di esecuzione.",
388
- pt: "O ID discriminador usado para resolver este registro em tempo de execução.",
389
- hi: "रनटाइम पर इस रिकॉर्ड को हल करने के लिए उपयोग किया जाने वाला विवेचक ID।",
390
- ar: "معرف المميز المستخدم لحل هذا السجل في وقت التشغيل.",
391
- ru: "Идентификатор-дискриминатор, используемый для разрешения этой записи во время выполнения.",
392
- tr: "Bu kaydı çalışma zamanında çözümlemek için kullanılan ayırt edici kimlik.",
393
- pl: "Identyfikator dyskryminatora używany do rozwiązania tego rekordu w czasie wykonywania.",
394
- id: "ID pembeda yang digunakan untuk menyelesaikan rekaman ini saat runtime.",
395
- vi: "ID phân biệt được sử dụng để giải quyết bản ghi này lúc chạy.",
396
- uk: "Ідентифікатор-дискримінатор, що використовується для розв'язання цього запису під час виконання."
397
- })
398
- },
399
337
  createDictionaryButton: {
400
338
  text: t({
401
339
  en: "Create dictionary",