@intlayer/design-system 4.0.3 → 4.0.4
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.
- package/dist/.vite/manifest.json +36 -45
- package/dist/components/Auth/AuthModal/index.cjs +1 -1
- package/dist/components/Auth/AuthModal/index.mjs +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs +2 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.cjs.map +1 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs +2 -1
- package/dist/components/Auth/ExternalsLoginButtons/ExternalsLoginButtons.mjs.map +1 -1
- package/dist/components/Auth/useAuth/index.cjs +8 -4
- package/dist/components/Auth/useAuth/index.cjs.map +1 -1
- package/dist/components/Auth/useAuth/index.d.ts +3 -1
- package/dist/components/Auth/useAuth/index.d.ts.map +1 -1
- package/dist/components/Auth/useAuth/index.mjs +8 -4
- package/dist/components/Auth/useAuth/index.mjs.map +1 -1
- package/dist/components/Auth/useAuth/useCSRF.cjs +6 -3
- package/dist/components/Auth/useAuth/useCSRF.cjs.map +1 -1
- package/dist/components/Auth/useAuth/useCSRF.d.ts +2 -1
- package/dist/components/Auth/useAuth/useCSRF.d.ts.map +1 -1
- package/dist/components/Auth/useAuth/useCSRF.mjs +5 -2
- package/dist/components/Auth/useAuth/useCSRF.mjs.map +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.cjs +6 -5
- package/dist/components/Auth/useAuth/useOAuth2.cjs.map +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.d.ts +2 -1
- package/dist/components/Auth/useAuth/useOAuth2.d.ts.map +1 -1
- package/dist/components/Auth/useAuth/useOAuth2.mjs +5 -4
- package/dist/components/Auth/useAuth/useOAuth2.mjs.map +1 -1
- package/dist/components/Auth/useAuth/useSession.cjs +6 -3
- package/dist/components/Auth/useAuth/useSession.cjs.map +1 -1
- package/dist/components/Auth/useAuth/useSession.d.ts +2 -1
- package/dist/components/Auth/useAuth/useSession.d.ts.map +1 -1
- package/dist/components/Auth/useAuth/useSession.mjs +6 -3
- package/dist/components/Auth/useAuth/useSession.mjs.map +1 -1
- package/dist/components/Auth/useUser/index.cjs +1 -1
- package/dist/components/Auth/useUser/index.mjs +1 -1
- package/dist/components/Container/index.d.ts +2 -2
- package/dist/components/DictionaryEditor/DictionaryEditor.cjs +1 -1
- package/dist/components/DictionaryEditor/DictionaryEditor.mjs +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.cjs +2 -1
- package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.cjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.mjs +2 -1
- package/dist/components/DictionaryEditor/NodeWrapper/ArrayWrapper.mjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.cjs +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/EnumerationWrapper.mjs +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.cjs +2 -1
- package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.cjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.d.ts.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs +2 -1
- package/dist/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.mjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs +3 -3
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.cjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs +2 -2
- package/dist/components/DictionaryEditor/NodeWrapper/StringWrapper.mjs.map +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.cjs +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/TranslationWrapper.mjs +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/index.cjs +1 -1
- package/dist/components/DictionaryEditor/NodeWrapper/index.mjs +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs +0 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.cjs.map +1 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs +0 -1
- package/dist/components/DictionaryEditor/ValidDictionaryChangeButtons.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.cjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionariesSelector/DictionariesSelector.mjs +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +4 -2
- package/dist/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs +2 -11
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +3 -12
- package/dist/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs +5 -5
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs +3 -3
- package/dist/components/DictionaryFieldEditor/EditorView/EditorView.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs +2 -2
- package/dist/components/DictionaryFieldEditor/EditorView/TextEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs +6 -5
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +2 -1
- package/dist/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs +0 -8
- package/dist/components/DictionaryFieldEditor/NodeEditor.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs +1 -9
- package/dist/components/DictionaryFieldEditor/NodeEditor.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs +2 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.d.ts.map +1 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs +2 -1
- package/dist/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs +7 -5
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.cjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +7 -5
- package/dist/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs.map +1 -1
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.cjs +2 -2
- package/dist/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcherContext.mjs +2 -2
- package/dist/components/EditableField/EditableFieldLayout.cjs +7 -3
- package/dist/components/EditableField/EditableFieldLayout.cjs.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.d.ts.map +1 -1
- package/dist/components/EditableField/EditableFieldLayout.mjs +7 -3
- package/dist/components/EditableField/EditableFieldLayout.mjs.map +1 -1
- package/dist/components/IDE/CodeContext.cjs +2 -2
- package/dist/components/IDE/CodeContext.mjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.cjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.cjs +2 -2
- package/dist/components/LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs +2 -2
- package/dist/components/Modal/Modal.cjs +11 -7
- package/dist/components/Modal/Modal.cjs.map +1 -1
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.mjs +11 -7
- package/dist/components/Modal/Modal.mjs.map +1 -1
- package/dist/components/Navbar/MobileNavbar.cjs +2 -2
- package/dist/components/Navbar/MobileNavbar.mjs +2 -2
- package/dist/components/Navbar/index.cjs +2 -2
- package/dist/components/Navbar/index.mjs +2 -2
- package/dist/components/RightDrawer/RightDrawer.cjs +32 -15
- package/dist/components/RightDrawer/RightDrawer.cjs.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.d.ts.map +1 -1
- package/dist/components/RightDrawer/RightDrawer.mjs +32 -15
- package/dist/components/RightDrawer/RightDrawer.mjs.map +1 -1
- package/dist/components/SwitchSelector/index.cjs +2 -2
- package/dist/components/SwitchSelector/index.mjs +2 -2
- package/dist/components/TabSelector/TabSelector.cjs +2 -2
- package/dist/components/TabSelector/TabSelector.mjs +2 -2
- package/dist/hooks/intlayerAPIHooks.cjs +5 -1
- package/dist/hooks/intlayerAPIHooks.cjs.map +1 -1
- package/dist/hooks/intlayerAPIHooks.d.ts +49 -49
- package/dist/hooks/intlayerAPIHooks.d.ts.map +1 -1
- package/dist/hooks/intlayerAPIHooks.mjs +5 -1
- package/dist/hooks/intlayerAPIHooks.mjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.cjs +14 -0
- package/dist/hooks/useAsync/useAsync.cjs.map +1 -1
- package/dist/hooks/useAsync/useAsync.d.ts.map +1 -1
- package/dist/hooks/useAsync/useAsync.mjs +14 -0
- package/dist/hooks/useAsync/useAsync.mjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.cjs +3 -2
- package/dist/hooks/useGetAllDictionaries.cjs.map +1 -1
- package/dist/hooks/useGetAllDictionaries.d.ts +2 -2
- package/dist/hooks/useGetAllDictionaries.d.ts.map +1 -1
- package/dist/hooks/useGetAllDictionaries.mjs +3 -2
- package/dist/hooks/useGetAllDictionaries.mjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.cjs +10 -7
- package/dist/hooks/useIntlayerAPI.cjs.map +1 -1
- package/dist/hooks/useIntlayerAPI.d.ts +8 -2
- package/dist/hooks/useIntlayerAPI.d.ts.map +1 -1
- package/dist/hooks/useIntlayerAPI.mjs +10 -7
- package/dist/hooks/useIntlayerAPI.mjs.map +1 -1
- package/dist/hooks/usePersistedStore.cjs +25 -18
- package/dist/hooks/usePersistedStore.cjs.map +1 -1
- package/dist/hooks/usePersistedStore.d.ts +2 -2
- package/dist/hooks/usePersistedStore.d.ts.map +1 -1
- package/dist/hooks/usePersistedStore.mjs +26 -19
- package/dist/hooks/usePersistedStore.mjs.map +1 -1
- package/dist/index-B-VAyQ9R.js +673 -0
- package/dist/index-B-VAyQ9R.js.map +1 -0
- package/dist/index-B-adg6xa.js +206 -0
- package/dist/index-B-adg6xa.js.map +1 -0
- package/dist/index-BIV0x_z2.js +206 -0
- package/dist/index-BIV0x_z2.js.map +1 -0
- package/dist/index-BNH9wXVj.cjs +205 -0
- package/dist/index-BNH9wXVj.cjs.map +1 -0
- package/dist/index-D69JRZcQ.js +206 -0
- package/dist/index-D69JRZcQ.js.map +1 -0
- package/dist/index-DAsui9u9.cjs +205 -0
- package/dist/index-DAsui9u9.cjs.map +1 -0
- package/dist/index-SOIahRpS.cjs +205 -0
- package/dist/index-SOIahRpS.cjs.map +1 -0
- package/dist/index-T-TjVQoD.js +671 -0
- package/dist/index-T-TjVQoD.js.map +1 -0
- package/dist/index-f8_VC6c8.cjs +672 -0
- package/dist/index-f8_VC6c8.cjs.map +1 -0
- package/dist/index-llGIfxqV.cjs +670 -0
- package/dist/index-llGIfxqV.cjs.map +1 -0
- package/dist/tailwind.css +1 -1
- package/dist/useGetAllDictionaries-B1sqs2IB.cjs +34 -0
- package/dist/useGetAllDictionaries-B1sqs2IB.cjs.map +1 -0
- package/dist/useGetAllDictionaries-BbH8vTkY.js +35 -0
- package/dist/useGetAllDictionaries-BbH8vTkY.js.map +1 -0
- package/dist/useGetAllDictionaries-Bgkytpa2.cjs +34 -0
- package/dist/useGetAllDictionaries-Bgkytpa2.cjs.map +1 -0
- package/dist/useGetAllDictionaries-D8ma3h41.cjs +33 -0
- package/dist/useGetAllDictionaries-D8ma3h41.cjs.map +1 -0
- package/dist/useGetAllDictionaries-DHgHEbD5.js +34 -0
- package/dist/useGetAllDictionaries-DHgHEbD5.js.map +1 -0
- package/dist/useGetAllDictionaries-DUzm0rIa.js +35 -0
- package/dist/useGetAllDictionaries-DUzm0rIa.js.map +1 -0
- package/package.json +21 -16
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { getIntlayerAPI } from "@intlayer/api";
|
|
2
3
|
import { getConfiguration } from "@intlayer/config/client";
|
|
3
|
-
import { i as intlayerAPI } from "../../../index-DcWYZrJW.js";
|
|
4
4
|
import { useAsync } from "../../../hooks/useAsync/useAsync.mjs";
|
|
5
|
-
const useOAuth2 = (csrfToken) => {
|
|
6
|
-
const
|
|
5
|
+
const useOAuth2 = (csrfToken, intlayerConfiguration) => {
|
|
6
|
+
const config = intlayerConfiguration ?? getConfiguration();
|
|
7
|
+
const intlayerAPI = getIntlayerAPI(void 0, config);
|
|
7
8
|
const { data } = useAsync(
|
|
8
9
|
"getOAuth2AccessToken",
|
|
9
10
|
() => intlayerAPI.auth.getOAuth2AccessToken({
|
|
@@ -12,7 +13,7 @@ const useOAuth2 = (csrfToken) => {
|
|
|
12
13
|
{
|
|
13
14
|
cache: true,
|
|
14
15
|
autoFetch: true,
|
|
15
|
-
enable: !!(clientId && clientSecret && csrfToken)
|
|
16
|
+
enable: !!(config.editor.clientId && config.editor.clientSecret && csrfToken)
|
|
16
17
|
}
|
|
17
18
|
);
|
|
18
19
|
const oAuth2AccessToken = data?.data;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuth2.mjs","sources":["../../../../src/components/Auth/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useOAuth2.mjs","sources":["../../../../src/components/Auth/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, type IntlayerConfig } from '@intlayer/config/client';\nimport { useAsync } from '../../../hooks/useAsync/useAsync';\n\nexport const useOAuth2 = (\n csrfToken: string | null | undefined,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const config = intlayerConfiguration ?? getConfiguration();\n const intlayerAPI = getIntlayerAPI(undefined, config);\n\n const { data } = useAsync(\n 'getOAuth2AccessToken',\n () =>\n intlayerAPI.auth.getOAuth2AccessToken({\n body: { csrf_token: csrfToken },\n }),\n {\n cache: true,\n autoFetch: true,\n enable: !!(\n config.editor.clientId &&\n config.editor.clientSecret &&\n csrfToken\n ),\n }\n );\n\n const oAuth2AccessToken = data?.data;\n\n return {\n oAuth2AccessToken,\n };\n};\n"],"names":[],"mappings":";;;;AAMa,MAAA,YAAY,CACvB,WACA,0BACG;AACG,QAAA,SAAS,yBAAyB,iBAAiB;AACnD,QAAA,cAAc,eAAe,QAAW,MAAM;AAE9C,QAAA,EAAE,SAAS;AAAA,IACf;AAAA,IACA,MACE,YAAY,KAAK,qBAAqB;AAAA,MACpC,MAAM,EAAE,YAAY,UAAU;AAAA,IAAA,CAC/B;AAAA,IACH;AAAA,MACE,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC,EACP,OAAO,OAAO,YACd,OAAO,OAAO,gBACd;AAAA,IAAA;AAAA,EAGN;AAEA,QAAM,oBAAoB,MAAM;AAEzB,SAAA;AAAA,IACL;AAAA,EACF;AACF;"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
4
|
+
const api = require("@intlayer/api");
|
|
5
|
+
const client = require("@intlayer/config/client");
|
|
4
6
|
const require$$0 = require("react");
|
|
5
|
-
const index = require("../../../index-DFc7og1d.cjs");
|
|
6
7
|
const hooks_useAsync_useAsync = require("../../../hooks/useAsync/useAsync.cjs");
|
|
7
8
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
8
|
-
const useSession = (sessionProp) => {
|
|
9
|
+
const useSession = (sessionProp, intlayerConfiguration) => {
|
|
10
|
+
const config = intlayerConfiguration ?? client.getConfiguration();
|
|
11
|
+
const intlayerAPI = api.getIntlayerAPI(void 0, config);
|
|
9
12
|
const {
|
|
10
13
|
getSession,
|
|
11
14
|
revalidate,
|
|
@@ -16,7 +19,7 @@ const useSession = (sessionProp) => {
|
|
|
16
19
|
"getSession",
|
|
17
20
|
async () => {
|
|
18
21
|
try {
|
|
19
|
-
const result = await
|
|
22
|
+
const result = await intlayerAPI.auth.getSession();
|
|
20
23
|
if (result.data) {
|
|
21
24
|
const { user, organization, project } = result.data;
|
|
22
25
|
const formattedSession = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSession.cjs","sources":["../../../../src/components/Auth/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useSession.cjs","sources":["../../../../src/components/Auth/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, IntlayerConfig } from '@intlayer/config/client';\nimport { useMemo } from 'react';\nimport { useAsync } from '../../../hooks/useAsync';\nimport type { Session } from './index';\n\nexport const useSession = (\n sessionProp?: Session | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const config = intlayerConfiguration ?? getConfiguration();\n const intlayerAPI = getIntlayerAPI(undefined, config);\n\n const {\n getSession,\n revalidate,\n data,\n setData: setSession,\n isFetched,\n } = useAsync(\n 'getSession',\n async () => {\n try {\n const result = await intlayerAPI.auth.getSession();\n\n if (result.data) {\n const { user, organization, project } = result.data;\n\n const formattedSession: Session = {\n user,\n organization,\n isOrganizationAdmin:\n (user && (organization?.adminsIds ?? []).includes(user._id!)) ??\n false,\n project,\n isProjectAdmin:\n (user && (project?.adminsIds ?? []).includes(user._id!)) ?? false,\n };\n\n return formattedSession;\n }\n } catch (_error) {\n console.error(_error);\n // Failed to fetch session\n }\n\n return null;\n },\n {\n cache: true,\n store: true,\n autoFetch: true,\n enable: !sessionProp,\n invalidateQueries: [\n 'getOrganizations',\n 'getProjects',\n 'getUsers',\n 'getDictionaries',\n ],\n }\n );\n\n const session = useMemo(\n () => data ?? (isFetched ? null : undefined),\n [data, isFetched]\n );\n\n return {\n session,\n fetchSession: getSession,\n revalidateSession: revalidate,\n setSession,\n };\n};\n"],"names":["getConfiguration","getIntlayerAPI","useAsync","useMemo"],"mappings":";;;;;;;;AAQa,MAAA,aAAa,CACxB,aACA,0BACG;AACG,QAAA,SAAS,yBAAyBA,wBAAiB;AACnD,QAAA,cAAcC,IAAAA,eAAe,QAAW,MAAM;AAE9C,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EAAA,IACEC,wBAAA;AAAA,IACF;AAAA,IACA,YAAY;AACN,UAAA;AACF,cAAM,SAAS,MAAM,YAAY,KAAK,WAAW;AAEjD,YAAI,OAAO,MAAM;AACf,gBAAM,EAAE,MAAM,cAAc,YAAY,OAAO;AAE/C,gBAAM,mBAA4B;AAAA,YAChC;AAAA,YACA;AAAA,YACA,sBACG,SAAS,cAAc,aAAa,CAAI,GAAA,SAAS,KAAK,GAAI,MAC3D;AAAA,YACF;AAAA,YACA,iBACG,SAAS,SAAS,aAAa,CAAA,GAAI,SAAS,KAAK,GAAI,MAAM;AAAA,UAChE;AAEO,iBAAA;AAAA,QAAA;AAAA,eAEF,QAAQ;AACf,gBAAQ,MAAM,MAAM;AAAA,MAAA;AAIf,aAAA;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC;AAAA,MACT,mBAAmB;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAEA,QAAM,UAAUC,WAAA;AAAA,IACd,MAAM,SAAS,YAAY,OAAO;AAAA,IAClC,CAAC,MAAM,SAAS;AAAA,EAClB;AAEO,SAAA;AAAA,IACL;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,EACF;AACF;;"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { IntlayerConfig } from '@intlayer/config/client';
|
|
1
2
|
import { Session } from './index';
|
|
2
|
-
export declare const useSession: (sessionProp?: Session | null) => {
|
|
3
|
+
export declare const useSession: (sessionProp?: Session | null, intlayerConfiguration?: IntlayerConfig) => {
|
|
3
4
|
session: Session | null | undefined;
|
|
4
5
|
fetchSession: () => Promise<Session | null>;
|
|
5
6
|
revalidateSession: () => Promise<Session | null>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSession.d.ts","sourceRoot":"","sources":["../../../../src/components/Auth/useAuth/useSession.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSession.d.ts","sourceRoot":"","sources":["../../../../src/components/Auth/useAuth/useSession.ts"],"names":[],"mappings":"AAGA,OAAO,EAAoB,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG3E,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAEvC,eAAO,MAAM,UAAU,iBACP,OAAO,GAAG,IAAI,0BACJ,cAAc;;;;;CAiEvC,CAAC"}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { getIntlayerAPI } from "@intlayer/api";
|
|
3
|
+
import { getConfiguration } from "@intlayer/config/client";
|
|
2
4
|
import { useMemo } from "react";
|
|
3
|
-
import { g as getIntlayerAPI } from "../../../index-DcWYZrJW.js";
|
|
4
5
|
import { useAsync } from "../../../hooks/useAsync/useAsync.mjs";
|
|
5
6
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
6
|
-
const useSession = (sessionProp) => {
|
|
7
|
+
const useSession = (sessionProp, intlayerConfiguration) => {
|
|
8
|
+
const config = intlayerConfiguration ?? getConfiguration();
|
|
9
|
+
const intlayerAPI = getIntlayerAPI(void 0, config);
|
|
7
10
|
const {
|
|
8
11
|
getSession,
|
|
9
12
|
revalidate,
|
|
@@ -14,7 +17,7 @@ const useSession = (sessionProp) => {
|
|
|
14
17
|
"getSession",
|
|
15
18
|
async () => {
|
|
16
19
|
try {
|
|
17
|
-
const result = await
|
|
20
|
+
const result = await intlayerAPI.auth.getSession();
|
|
18
21
|
if (result.data) {
|
|
19
22
|
const { user, organization, project } = result.data;
|
|
20
23
|
const formattedSession = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSession.mjs","sources":["../../../../src/components/Auth/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport {
|
|
1
|
+
{"version":3,"file":"useSession.mjs","sources":["../../../../src/components/Auth/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport { getIntlayerAPI } from '@intlayer/api';\nimport { getConfiguration, IntlayerConfig } from '@intlayer/config/client';\nimport { useMemo } from 'react';\nimport { useAsync } from '../../../hooks/useAsync';\nimport type { Session } from './index';\n\nexport const useSession = (\n sessionProp?: Session | null,\n intlayerConfiguration?: IntlayerConfig\n) => {\n const config = intlayerConfiguration ?? getConfiguration();\n const intlayerAPI = getIntlayerAPI(undefined, config);\n\n const {\n getSession,\n revalidate,\n data,\n setData: setSession,\n isFetched,\n } = useAsync(\n 'getSession',\n async () => {\n try {\n const result = await intlayerAPI.auth.getSession();\n\n if (result.data) {\n const { user, organization, project } = result.data;\n\n const formattedSession: Session = {\n user,\n organization,\n isOrganizationAdmin:\n (user && (organization?.adminsIds ?? []).includes(user._id!)) ??\n false,\n project,\n isProjectAdmin:\n (user && (project?.adminsIds ?? []).includes(user._id!)) ?? false,\n };\n\n return formattedSession;\n }\n } catch (_error) {\n console.error(_error);\n // Failed to fetch session\n }\n\n return null;\n },\n {\n cache: true,\n store: true,\n autoFetch: true,\n enable: !sessionProp,\n invalidateQueries: [\n 'getOrganizations',\n 'getProjects',\n 'getUsers',\n 'getDictionaries',\n ],\n }\n );\n\n const session = useMemo(\n () => data ?? (isFetched ? null : undefined),\n [data, isFetched]\n );\n\n return {\n session,\n fetchSession: getSession,\n revalidateSession: revalidate,\n setSession,\n };\n};\n"],"names":[],"mappings":";;;;;;AAQa,MAAA,aAAa,CACxB,aACA,0BACG;AACG,QAAA,SAAS,yBAAyB,iBAAiB;AACnD,QAAA,cAAc,eAAe,QAAW,MAAM;AAE9C,QAAA;AAAA,IACJ;AAAA,IACA;AAAA,IACA;AAAA,IACA,SAAS;AAAA,IACT;AAAA,EAAA,IACE;AAAA,IACF;AAAA,IACA,YAAY;AACN,UAAA;AACF,cAAM,SAAS,MAAM,YAAY,KAAK,WAAW;AAEjD,YAAI,OAAO,MAAM;AACf,gBAAM,EAAE,MAAM,cAAc,YAAY,OAAO;AAE/C,gBAAM,mBAA4B;AAAA,YAChC;AAAA,YACA;AAAA,YACA,sBACG,SAAS,cAAc,aAAa,CAAI,GAAA,SAAS,KAAK,GAAI,MAC3D;AAAA,YACF;AAAA,YACA,iBACG,SAAS,SAAS,aAAa,CAAA,GAAI,SAAS,KAAK,GAAI,MAAM;AAAA,UAChE;AAEO,iBAAA;AAAA,QAAA;AAAA,eAEF,QAAQ;AACf,gBAAQ,MAAM,MAAM;AAAA,MAAA;AAIf,aAAA;AAAA,IACT;AAAA,IACA;AAAA,MACE,OAAO;AAAA,MACP,OAAO;AAAA,MACP,WAAW;AAAA,MACX,QAAQ,CAAC;AAAA,MACT,mBAAmB;AAAA,QACjB;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IACF;AAAA,EAEJ;AAEA,QAAM,UAAU;AAAA,IACd,MAAM,SAAS,YAAY,OAAO;AAAA,IAClC,CAAC,MAAM,SAAS;AAAA,EAClB;AAEO,SAAA;AAAA,IACL;AAAA,IACA,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB;AAAA,EACF;AACF;"}
|
|
@@ -5,7 +5,7 @@ require("react");
|
|
|
5
5
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
6
6
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
7
7
|
const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
|
|
8
|
-
require("@intlayer/
|
|
8
|
+
require("@intlayer/editor-react");
|
|
9
9
|
require("deepmerge");
|
|
10
10
|
const components_Auth_useAuth_index = require("../useAuth/index.cjs");
|
|
11
11
|
const useUser = () => {
|
|
@@ -3,7 +3,7 @@ import "react";
|
|
|
3
3
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
4
4
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
5
5
|
import { useLogout } from "../../../hooks/intlayerAPIHooks.mjs";
|
|
6
|
-
import "@intlayer/
|
|
6
|
+
import "@intlayer/editor-react";
|
|
7
7
|
import "deepmerge";
|
|
8
8
|
import { useAuth } from "../useAuth/index.mjs";
|
|
9
9
|
const useUser = () => {
|
|
@@ -4,7 +4,7 @@ declare const containerVariants: (props?: ({
|
|
|
4
4
|
roundedSize?: "sm" | "md" | "lg" | "xl" | "2xl" | "none" | "3xl" | "full" | null | undefined;
|
|
5
5
|
transparency?: "sm" | "md" | "lg" | "xl" | "none" | "full" | null | undefined;
|
|
6
6
|
padding?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
7
|
-
separator?: "
|
|
7
|
+
separator?: "x" | "y" | "both" | "without" | null | undefined;
|
|
8
8
|
border?: "none" | "with" | null | undefined;
|
|
9
9
|
borderColor?: "text" | "primary" | "secondary" | "neutral" | null | undefined;
|
|
10
10
|
background?: "none" | "with" | null | undefined;
|
|
@@ -18,7 +18,7 @@ export declare const Container: import('react').ForwardRefExoticComponent<Omit<V
|
|
|
18
18
|
roundedSize?: "sm" | "md" | "lg" | "xl" | "2xl" | "none" | "3xl" | "full" | null | undefined;
|
|
19
19
|
transparency?: "sm" | "md" | "lg" | "xl" | "none" | "full" | null | undefined;
|
|
20
20
|
padding?: "sm" | "md" | "lg" | "xl" | "none" | null | undefined;
|
|
21
|
-
separator?: "
|
|
21
|
+
separator?: "x" | "y" | "both" | "without" | null | undefined;
|
|
22
22
|
border?: "none" | "with" | null | undefined;
|
|
23
23
|
borderColor?: "text" | "primary" | "secondary" | "neutral" | null | undefined;
|
|
24
24
|
background?: "none" | "with" | null | undefined;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const jsxRuntime = require("../../jsx-runtime-CgFM7lM3.cjs");
|
|
5
5
|
const require$$0 = require("react");
|
|
6
6
|
const editorReact = require("@intlayer/editor-react");
|
|
7
|
-
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../index-
|
|
7
|
+
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../index-DAsui9u9.cjs");
|
|
8
8
|
const components_DictionaryEditor_ValidDictionaryChangeButtons = require("./ValidDictionaryChangeButtons.cjs");
|
|
9
9
|
const DictionaryEditor = ({
|
|
10
10
|
dictionary,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { j as jsxRuntimeExports } from "../../jsx-runtime-DQkoUcjV.js";
|
|
3
3
|
import { createElement } from "react";
|
|
4
4
|
import { useEditedContent, useFocusDictionary } from "@intlayer/editor-react";
|
|
5
|
-
import { N as NodeWrapper } from "../../index-
|
|
5
|
+
import { N as NodeWrapper } from "../../index-B-adg6xa.js";
|
|
6
6
|
import { ValidDictionaryChangeButtons } from "./ValidDictionaryChangeButtons.mjs";
|
|
7
7
|
const DictionaryEditor = ({
|
|
8
8
|
dictionary,
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
4
4
|
require("@intlayer/core");
|
|
5
5
|
require("lucide-react");
|
|
6
|
+
require("../../Button/Button.cjs");
|
|
6
7
|
require("../ItemLayout.cjs");
|
|
7
|
-
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-
|
|
8
|
+
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DAsui9u9.cjs");
|
|
8
9
|
exports.ArrayWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.ArrayWrapper;
|
|
9
10
|
//# sourceMappingURL=ArrayWrapper.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayWrapper.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArrayWrapper.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/ArrayWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ArrayWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/ArrayWrapper.tsx"],"names":[],"mappings":"AACA,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAAe,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAE7D,KAAK,iBAAiB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IAC3D,OAAO,EAAE,eAAe,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,iBAAiB,CA8C9C,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "../../../jsx-runtime-DQkoUcjV.js";
|
|
2
2
|
import "@intlayer/core";
|
|
3
3
|
import "lucide-react";
|
|
4
|
+
import "../../Button/Button.mjs";
|
|
4
5
|
import "../ItemLayout.mjs";
|
|
5
|
-
import { A } from "../../../index-
|
|
6
|
+
import { A } from "../../../index-B-adg6xa.js";
|
|
6
7
|
export {
|
|
7
8
|
A as ArrayWrapper
|
|
8
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ArrayWrapper.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ArrayWrapper.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
4
4
|
require("react");
|
|
5
5
|
require("@intlayer/core");
|
|
6
|
-
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-
|
|
6
|
+
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DAsui9u9.cjs");
|
|
7
7
|
exports.EnumerationWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.EnumerationWrapper;
|
|
8
8
|
//# sourceMappingURL=EnumerationWrapper.cjs.map
|
|
@@ -3,7 +3,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
4
4
|
require("@intlayer/core");
|
|
5
5
|
require("lucide-react");
|
|
6
|
+
require("../../Button/Button.cjs");
|
|
6
7
|
require("../ItemLayout.cjs");
|
|
7
|
-
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-
|
|
8
|
+
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DAsui9u9.cjs");
|
|
8
9
|
exports.NestedObjectWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.NestedObjectWrapper;
|
|
9
10
|
//# sourceMappingURL=NestedObjectWrapper.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedObjectWrapper.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NestedObjectWrapper.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedObjectWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"NestedObjectWrapper.d.ts","sourceRoot":"","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAGL,KAAK,eAAe,EAErB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGhC,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAExE,KAAK,wBAAwB,GAAG,IAAI,CAAC,gBAAgB,EAAE,SAAS,CAAC,GAAG;IAClE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC;CAC1C,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,EAAE,CAAC,wBAAwB,CA8C5D,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import "../../../jsx-runtime-DQkoUcjV.js";
|
|
2
2
|
import "@intlayer/core";
|
|
3
3
|
import "lucide-react";
|
|
4
|
+
import "../../Button/Button.mjs";
|
|
4
5
|
import "../ItemLayout.mjs";
|
|
5
|
-
import { a } from "../../../index-
|
|
6
|
+
import { a } from "../../../index-B-adg6xa.js";
|
|
6
7
|
export {
|
|
7
8
|
a as NestedObjectWrapper
|
|
8
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NestedObjectWrapper.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"NestedObjectWrapper.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
4
|
-
const
|
|
4
|
+
const editor = require("@intlayer/editor");
|
|
5
|
+
const utils_cn = require("../../../utils/cn.cjs");
|
|
5
6
|
require("../../EditableField/EditableFieldInput.cjs");
|
|
6
7
|
const components_EditableField_EditableFieldTextArea = require("../../EditableField/EditableFieldTextArea.cjs");
|
|
7
|
-
const utils_cn = require("../../../utils/cn.cjs");
|
|
8
8
|
const StringWrapper = ({
|
|
9
9
|
keyPath,
|
|
10
10
|
section,
|
|
@@ -12,7 +12,7 @@ const StringWrapper = ({
|
|
|
12
12
|
onContentChange,
|
|
13
13
|
onFocusKeyPath
|
|
14
14
|
}) => {
|
|
15
|
-
const editedContentValue =
|
|
15
|
+
const editedContentValue = editor.getDictionaryValueByKeyPath(
|
|
16
16
|
editedContent,
|
|
17
17
|
keyPath
|
|
18
18
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringWrapper.cjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import { getDictionaryValueByKeyPath } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"StringWrapper.cjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import { getDictionaryValueByKeyPath } from '@intlayer/editor';\nimport type { FC } from 'react';\nimport { cn } from '../../../utils/cn';\nimport { EditableFieldTextArea } from '../../EditableField';\nimport type { NodeWrapperProps } from './index';\n\ntype StringWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: string;\n};\n\nexport const StringWrapper: FC<StringWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const editedContentValue = getDictionaryValueByKeyPath(\n editedContent,\n keyPath\n );\n\n if (editedContentValue && typeof editedContentValue !== 'string') {\n return <>Error loading section</>;\n }\n\n const level = keyPath.length;\n\n const content = editedContentValue ?? section;\n\n return (\n <button\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 dark:hover:bg-card-dark/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30 dark:hover:bg-card-dark/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldTextArea\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"names":["getDictionaryValueByKeyPath","jsx","cn","EditableFieldTextArea"],"mappings":";;;;;;;AAUO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,qBAAqBA,OAAA;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AAEI,MAAA,sBAAsB,OAAO,uBAAuB,UAAU;AAChE,qGAAS,UAAqB,wBAAA,CAAA;AAAA,EAAA;AAGhC,QAAM,QAAQ,QAAQ;AAEtB,QAAM,UAAU,sBAAsB;AAGpC,SAAAC,2BAAA,kBAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC,SAAA;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,QACf,SAAS,KAAK;AAAA,MAChB;AAAA,MACA,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,uBAAe,OAAO;AAAA,MACxB;AAAA,MAEA,UAAAD,2BAAA,kBAAA;AAAA,QAACE,+CAAA;AAAA,QAAA;AAAA,UACC,cAAc;AAAA,UACd,QAAQ,CAAC,aAAa,gBAAgB,EAAE,SAAS,UAAU;AAAA,UAC3D,UAAU,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAEJ;;"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { j as jsxRuntimeExports } from "../../../jsx-runtime-DQkoUcjV.js";
|
|
2
|
-
import { getDictionaryValueByKeyPath } from "@intlayer/
|
|
2
|
+
import { getDictionaryValueByKeyPath } from "@intlayer/editor";
|
|
3
|
+
import { cn } from "../../../utils/cn.mjs";
|
|
3
4
|
import "../../EditableField/EditableFieldInput.mjs";
|
|
4
5
|
import { EditableFieldTextArea } from "../../EditableField/EditableFieldTextArea.mjs";
|
|
5
|
-
import { cn } from "../../../utils/cn.mjs";
|
|
6
6
|
const StringWrapper = ({
|
|
7
7
|
keyPath,
|
|
8
8
|
section,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StringWrapper.mjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import { getDictionaryValueByKeyPath } from '@intlayer/
|
|
1
|
+
{"version":3,"file":"StringWrapper.mjs","sources":["../../../../src/components/DictionaryEditor/NodeWrapper/StringWrapper.tsx"],"sourcesContent":["import { getDictionaryValueByKeyPath } from '@intlayer/editor';\nimport type { FC } from 'react';\nimport { cn } from '../../../utils/cn';\nimport { EditableFieldTextArea } from '../../EditableField';\nimport type { NodeWrapperProps } from './index';\n\ntype StringWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: string;\n};\n\nexport const StringWrapper: FC<StringWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const editedContentValue = getDictionaryValueByKeyPath(\n editedContent,\n keyPath\n );\n\n if (editedContentValue && typeof editedContentValue !== 'string') {\n return <>Error loading section</>;\n }\n\n const level = keyPath.length;\n\n const content = editedContentValue ?? section;\n\n return (\n <button\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 dark:hover:bg-card-dark/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30 dark:hover:bg-card-dark/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldTextArea\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"names":["jsx"],"mappings":";;;;;AAUO,MAAM,gBAAwC,CAAC;AAAA,EACpD;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,qBAAqB;AAAA,IACzB;AAAA,IACA;AAAA,EACF;AAEI,MAAA,sBAAsB,OAAO,uBAAuB,UAAU;AAChE,+EAAS,UAAqB,wBAAA,CAAA;AAAA,EAAA;AAGhC,QAAM,QAAQ,QAAQ;AAEtB,QAAM,UAAU,sBAAsB;AAGpC,SAAAA,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,QACA,UAAU,KAAK;AAAA,QACf,SAAS,KAAK;AAAA,MAChB;AAAA,MACA,SAAS,CAAC,MAAM;AACd,UAAE,gBAAgB;AAClB,uBAAe,OAAO;AAAA,MACxB;AAAA,MAEA,UAAAA,kCAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,cAAc;AAAA,UACd,QAAQ,CAAC,aAAa,gBAAgB,EAAE,SAAS,UAAU;AAAA,UAC3D,UAAU,MAAM;AAAA,QAAA;AAAA,MAAA;AAAA,IAClB;AAAA,EACF;AAEJ;"}
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
4
4
|
require("@intlayer/core");
|
|
5
|
-
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-
|
|
5
|
+
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DAsui9u9.cjs");
|
|
6
6
|
exports.TranslationWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.TranslationWrapper;
|
|
7
7
|
//# sourceMappingURL=TranslationWrapper.cjs.map
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
4
4
|
require("@intlayer/core");
|
|
5
5
|
require("react");
|
|
6
|
-
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-
|
|
6
|
+
const components_DictionaryEditor_NodeWrapper_ArrayWrapper = require("../../../index-DAsui9u9.cjs");
|
|
7
7
|
require("./StringWrapper.cjs");
|
|
8
8
|
exports.NodeWrapper = components_DictionaryEditor_NodeWrapper_ArrayWrapper.NodeWrapper;
|
|
9
9
|
exports.traceKeys = components_DictionaryEditor_NodeWrapper_ArrayWrapper.traceKeys;
|
|
@@ -9,7 +9,6 @@ const reactIntlayer = require("react-intlayer");
|
|
|
9
9
|
require("../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
10
10
|
require("../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
11
11
|
const hooks_intlayerAPIHooks = require("../../hooks/intlayerAPIHooks.cjs");
|
|
12
|
-
require("@intlayer/dictionaries-entry");
|
|
13
12
|
require("deepmerge");
|
|
14
13
|
const components_Form_FormBase = require("../Form/FormBase.cjs");
|
|
15
14
|
require("../Form/FormField.cjs");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","usePushDictionaries","useEditedContent","useForm","useMemo","jsx","jsxs","Form","RotateCcw","ArrowUpFromLine","Save"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.cjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["getValidDictionaryChangeButtonsSchemaSchema","useDictionary","validDictionaryChangeButtonsContent","usePushDictionaries","useEditedContent","useForm","useMemo","jsx","jsxs","Form","RotateCcw","ArrowUpFromLine","Save"],"mappings":";;;;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJA,+DAAAA,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAAC,cAAA;AAAA,IACjDC,iEAAAA;AAAAA,EACF;AAEM,QAAA,EAAE,iBAAiB,IAAIC,2CAAoB;AAEjD,QAAM,EAAE,eAAe,qBAAqB,IAAIC,6BAAiB;AAC3D,QAAA,EAAE,MAAM,aAAA,IAAiBC,yBAAA;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,mBAAmBC,WAAA;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEA,QAAM,WAAWA,WAAA;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAC/B;AAEA,QAAM,oBAAoBA,WAAA;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,kBAAkB,YAAY;AAClC,UAAM,iBAAiB;AAAA,MACrB;AAAA,QACE,GAAG;AAAA,QACH,GAAG,cAAc,WAAW,GAAG;AAAA,MAAA;AAAA,IACjC,CACD;AAAA,EACH;AAGE,SAAAC,2BAAAA,kBAAAA,IAAC,OAAI,EAAA,WAAU,QACb,UAAAC,2BAAA,kBAAA;AAAA,IAACC,sCAAA;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAF,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY;AAAA,YACnB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAMC,YAAA;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCH,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc;AAAA,YACrB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAME,YAAA;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEJ,2BAAA,kBAAA;AAAA,UAACE,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAMG,YAAA;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAAA,GAIR;AAEJ;;"}
|
|
@@ -7,7 +7,6 @@ import { useDictionary } from "react-intlayer";
|
|
|
7
7
|
import "../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
8
8
|
import "../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
9
9
|
import { usePushDictionaries } from "../../hooks/intlayerAPIHooks.mjs";
|
|
10
|
-
import "@intlayer/dictionaries-entry";
|
|
11
10
|
import "deepmerge";
|
|
12
11
|
import { useForm } from "../Form/FormBase.mjs";
|
|
13
12
|
import "../Form/FormField.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["jsx","jsxs"],"mappings":"
|
|
1
|
+
{"version":3,"file":"ValidDictionaryChangeButtons.mjs","sources":["../../../src/components/DictionaryEditor/ValidDictionaryChangeButtons.tsx"],"sourcesContent":["'use client';\n\nimport { Dictionary as DistantDictionary } from '@intlayer/backend';\nimport type { Dictionary } from '@intlayer/core';\nimport { useEditedContent } from '@intlayer/editor-react';\nimport { ArrowUpFromLine, RotateCcw, Save } from 'lucide-react';\nimport { useMemo, type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport { usePushDictionaries } from '../../hooks';\nimport { Form, useForm } from '../Form';\nimport { validDictionaryChangeButtonsContent } from './validDictionaryChangeButtons.content';\nimport { getValidDictionaryChangeButtonsSchemaSchema } from './validDictionaryChangeButtonsSchema';\n\ntype ValidDictionaryChangeButtonsProps = {\n dictionary: Dictionary;\n};\n\nexport const ValidDictionaryChangeButtons: FC<\n ValidDictionaryChangeButtonsProps\n> = ({ dictionary }) => {\n const ValidDictionaryChangeButtonsSchemaSchema =\n getValidDictionaryChangeButtonsSchemaSchema();\n\n const { resetButton, saveButton, publishButton } = useDictionary(\n validDictionaryChangeButtonsContent\n );\n\n const { pushDictionaries } = usePushDictionaries();\n\n const { editedContent, restoreEditedContent } = useEditedContent();\n const { form, isSubmitting } = useForm(\n ValidDictionaryChangeButtonsSchemaSchema\n );\n\n const editedDictionary = useMemo(\n () => editedContent[dictionary.key],\n [editedContent, dictionary.key]\n );\n\n const isEdited = useMemo(\n () =>\n editedDictionary &&\n JSON.stringify(editedDictionary?.content) !==\n JSON.stringify(dictionary?.content),\n [editedDictionary, dictionary]\n );\n\n const isLocalDictionary = useMemo(\n () => typeof (dictionary as DistantDictionary)?._id === 'undefined',\n [dictionary]\n );\n\n const onSubmitSuccess = async () => {\n await pushDictionaries([\n {\n ...dictionary,\n ...editedContent[dictionary.key],\n },\n ]);\n };\n\n return (\n <div className=\"mb-4\">\n <Form\n className=\"flex w-full flex-row flex-wrap justify-end gap-3\"\n {...form}\n schema={ValidDictionaryChangeButtonsSchemaSchema}\n onSubmitSuccess={onSubmitSuccess}\n >\n {isEdited && (\n <Form.Button\n type=\"button\"\n label={resetButton.label}\n disabled={!isEdited || isSubmitting}\n className=\"ml-auto\"\n Icon={RotateCcw}\n variant=\"outline\"\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n onClick={() => restoreEditedContent(dictionary.key)}\n >\n {resetButton.text}\n </Form.Button>\n )}\n {isLocalDictionary ? (\n <Form.Button\n type=\"submit\"\n label={publishButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={ArrowUpFromLine}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {publishButton.text}\n </Form.Button>\n ) : (\n isEdited && (\n <Form.Button\n type=\"submit\"\n label={saveButton.label}\n disabled={!isEdited || isSubmitting}\n Icon={Save}\n color=\"text\"\n isFullWidth\n isLoading={isSubmitting}\n >\n {saveButton.text}\n </Form.Button>\n )\n )}\n </Form>\n </div>\n );\n};\n"],"names":["jsx","jsxs"],"mappings":";;;;;;;;;;;;;;;AAkBO,MAAM,+BAET,CAAC,EAAE,iBAAiB;AACtB,QAAM,2CACJ,4CAA4C;AAE9C,QAAM,EAAE,aAAa,YAAY,cAAkB,IAAA;AAAA,IACjD;AAAA,EACF;AAEM,QAAA,EAAE,iBAAiB,IAAI,oBAAoB;AAEjD,QAAM,EAAE,eAAe,qBAAqB,IAAI,iBAAiB;AAC3D,QAAA,EAAE,MAAM,aAAA,IAAiB;AAAA,IAC7B;AAAA,EACF;AAEA,QAAM,mBAAmB;AAAA,IACvB,MAAM,cAAc,WAAW,GAAG;AAAA,IAClC,CAAC,eAAe,WAAW,GAAG;AAAA,EAChC;AAEA,QAAM,WAAW;AAAA,IACf,MACE,oBACA,KAAK,UAAU,kBAAkB,OAAO,MACtC,KAAK,UAAU,YAAY,OAAO;AAAA,IACtC,CAAC,kBAAkB,UAAU;AAAA,EAC/B;AAEA,QAAM,oBAAoB;AAAA,IACxB,MAAM,OAAQ,YAAkC,QAAQ;AAAA,IACxD,CAAC,UAAU;AAAA,EACb;AAEA,QAAM,kBAAkB,YAAY;AAClC,UAAM,iBAAiB;AAAA,MACrB;AAAA,QACE,GAAG;AAAA,QACH,GAAG,cAAc,WAAW,GAAG;AAAA,MAAA;AAAA,IACjC,CACD;AAAA,EACH;AAGE,SAAAA,kCAAAA,IAAC,OAAI,EAAA,WAAU,QACb,UAAAC,kCAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAU;AAAA,MACT,GAAG;AAAA,MACJ,QAAQ;AAAA,MACR;AAAA,MAEC,UAAA;AAAA,QACC,YAAAD,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,YAAY;AAAA,YACnB,UAAU,CAAC,YAAY;AAAA,YACvB,WAAU;AAAA,YACV,MAAM;AAAA,YACN,SAAQ;AAAA,YACR,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YACX,SAAS,MAAM,qBAAqB,WAAW,GAAG;AAAA,YAEjD,UAAY,YAAA;AAAA,UAAA;AAAA,QACf;AAAA,QAED,oBACCA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,cAAc;AAAA,YACrB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAc,cAAA;AAAA,UAAA;AAAA,YAGjB,YACEA,kCAAA;AAAA,UAAC,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,WAAW;AAAA,YAClB,UAAU,CAAC,YAAY;AAAA,YACvB,MAAM;AAAA,YACN,OAAM;AAAA,YACN,aAAW;AAAA,YACX,WAAW;AAAA,YAEV,UAAW,WAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MACd;AAAA,IAAA;AAAA,EAAA,GAIR;AAEJ;"}
|
|
@@ -7,7 +7,7 @@ const require$$0 = require("react");
|
|
|
7
7
|
const reactIntlayer = require("react-intlayer");
|
|
8
8
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
9
9
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
10
|
-
require("
|
|
10
|
+
require("@intlayer/api");
|
|
11
11
|
require("@intlayer/config/client");
|
|
12
12
|
require("../../Toaster/Toast.cjs");
|
|
13
13
|
const hooks_useGetAllDictionaries = require("../../../hooks/useGetAllDictionaries.cjs");
|
|
@@ -5,7 +5,7 @@ import { useMemo } from "react";
|
|
|
5
5
|
import { useDictionary } from "react-intlayer";
|
|
6
6
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
7
7
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
8
|
-
import "
|
|
8
|
+
import "@intlayer/api";
|
|
9
9
|
import "@intlayer/config/client";
|
|
10
10
|
import "../../Toaster/Toast.mjs";
|
|
11
11
|
import { useGetAllDictionaries } from "../../../hooks/useGetAllDictionaries.mjs";
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs
CHANGED
|
@@ -4,7 +4,8 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
4
4
|
const jsxRuntime = require("../../../jsx-runtime-CgFM7lM3.cjs");
|
|
5
5
|
const reactIntlayer = require("react-intlayer");
|
|
6
6
|
const hooks_intlayerAPIHooks = require("../../../hooks/intlayerAPIHooks.cjs");
|
|
7
|
-
require("../../../index-
|
|
7
|
+
require("../../../index-f8_VC6c8.cjs");
|
|
8
|
+
require("@intlayer/config/client");
|
|
8
9
|
require("../../Button/Button.cjs");
|
|
9
10
|
require("../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.cjs");
|
|
10
11
|
const components_Form_FormBase = require("../../Form/FormBase.cjs");
|
|
@@ -17,7 +18,7 @@ require("../../Auth/SignUpForm/useSignUpSchema.content.cjs");
|
|
|
17
18
|
require("react");
|
|
18
19
|
require("../../../hooks/useScrollBlockage/useScrollBlockageStore.cjs");
|
|
19
20
|
require("../../../hooks/useAsync/useAsyncStateStore.cjs");
|
|
20
|
-
require("@intlayer/
|
|
21
|
+
require("@intlayer/editor-react");
|
|
21
22
|
require("deepmerge");
|
|
22
23
|
const components_Auth_useAuth_index = require("../../Auth/useAuth/index.cjs");
|
|
23
24
|
require("../../Auth/ChangePasswordForm/changePasswordForm.content.cjs");
|
|
@@ -27,6 +28,7 @@ require("../../Auth/ResetPasswordForm/useResetPasswordSchema.content.cjs");
|
|
|
27
28
|
require("../../Modal/Modal.cjs");
|
|
28
29
|
require("clsx");
|
|
29
30
|
require("tailwind-merge");
|
|
31
|
+
require("@intlayer/api");
|
|
30
32
|
const components_Select_Multiselect = require("../../Select/Multiselect.cjs");
|
|
31
33
|
require("../../Select/Select.cjs");
|
|
32
34
|
const components_DictionaryFieldEditor_DictionaryCreationForm_dictionaryCreationForm_content = require("./dictionaryCreationForm.content.cjs");
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DictionaryCreationForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAddDictionary,\n useGetProjects,\n} from '../../../hooks/intlayerAPIHooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryFormContent } from './dictionaryCreationForm.content';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\nexport const DictionaryCreationForm: FC = () => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { addDictionary } = useAddDictionary();\n const { data: projects } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?._id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } = useDictionary(\n dictionaryFormContent\n );\n\n const onSubmitSuccess = async (data: DictionaryFormData) => {\n await addDictionary(data);\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px]\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.placeholder}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label}>\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project._id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <MultiSelect.List>\n {projects?.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 </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting}\n label={createDictionaryButton.ariaLabel}\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["useAuth","useAddDictionary","useGetProjects","useDictionarySchema","useForm","useDictionary","dictionaryFormContent","jsxs","Form","jsx","MultiSelect","project"],"mappings":"
|
|
1
|
+
{"version":3,"file":"DictionaryCreationForm.cjs","sources":["../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.tsx"],"sourcesContent":["'use client';\n\nimport { type FC } from 'react';\n// @ts-ignore react-intlayer not build yet\nimport { useDictionary } from 'react-intlayer';\nimport {\n useAddDictionary,\n useGetProjects,\n} from '../../../hooks/intlayerAPIHooks';\nimport { useAuth } from '../../Auth';\nimport { Form, useForm } from '../../Form';\nimport { MultiSelect } from '../../Select';\nimport { dictionaryFormContent } from './dictionaryCreationForm.content';\nimport {\n useDictionarySchema,\n type DictionaryFormData,\n} from './useDictionaryFormSchema';\n\nexport const DictionaryCreationForm: FC = () => {\n const { session } = useAuth();\n const { project } = session ?? {};\n const { addDictionary } = useAddDictionary();\n const { data: projects } = useGetProjects();\n const DictionarySchema = useDictionarySchema(String(project?._id));\n const { form, isSubmitting } = useForm(DictionarySchema);\n const { keyInput, createDictionaryButton, projectInput } = useDictionary(\n dictionaryFormContent\n );\n\n const onSubmitSuccess = async (data: DictionaryFormData) => {\n await addDictionary(data);\n };\n\n return (\n <Form\n schema={DictionarySchema}\n onSubmitSuccess={onSubmitSuccess}\n className=\"w-full max-w-[400px]\"\n {...form}\n >\n <Form.Input\n name=\"key\"\n label={keyInput.label}\n placeholder={keyInput.placeholder}\n isRequired\n />\n\n <Form.MultiSelect name=\"projectIds\" label={projectInput.label}>\n <MultiSelect.Trigger\n getBadgeValue={(value) =>\n projects?.data?.find((project) => String(project._id) === value)\n ?.name ?? value\n }\n >\n <MultiSelect.Input placeholder={projectInput.placeholder} />\n </MultiSelect.Trigger>\n <MultiSelect.Content>\n <MultiSelect.List>\n {projects?.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 </Form.MultiSelect>\n\n <Form.Button\n className=\"ml-auto mt-12\"\n type=\"submit\"\n color=\"text\"\n isLoading={isSubmitting}\n label={createDictionaryButton.ariaLabel}\n >\n {createDictionaryButton.text}\n </Form.Button>\n </Form>\n );\n};\n"],"names":["useAuth","useAddDictionary","useGetProjects","useDictionarySchema","useForm","useDictionary","dictionaryFormContent","jsxs","Form","jsx","MultiSelect","project"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkBO,MAAM,yBAA6B,MAAM;AACxC,QAAA,EAAE,QAAQ,IAAIA,sCAAQ;AAC5B,QAAM,EAAE,YAAY,WAAW,CAAC;AAC1B,QAAA,EAAE,cAAc,IAAIC,wCAAiB;AAC3C,QAAM,EAAE,MAAM,SAAS,IAAIC,sCAAe;AAC1C,QAAM,mBAAmBC,gFAAA,oBAAoB,OAAO,SAAS,GAAG,CAAC;AACjE,QAAM,EAAE,MAAM,iBAAiBC,yBAAAA,QAAQ,gBAAgB;AACvD,QAAM,EAAE,UAAU,wBAAwB,aAAiB,IAAAC,cAAA;AAAA,IACzDC,uFAAAA;AAAAA,EACF;AAEM,QAAA,kBAAkB,OAAO,SAA6B;AAC1D,UAAM,cAAc,IAAI;AAAA,EAC1B;AAGE,SAAAC,2BAAA,kBAAA;AAAA,IAACC,sCAAA;AAAA,IAAA;AAAA,MACC,QAAQ;AAAA,MACR;AAAA,MACA,WAAU;AAAA,MACT,GAAG;AAAA,MAEJ,UAAA;AAAA,QAAAC,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,MAAK;AAAA,YACL,OAAO,SAAS;AAAA,YAChB,aAAa,SAAS;AAAA,YACtB,YAAU;AAAA,UAAA;AAAA,QACZ;AAAA,QAEAD,kDAACC,sCAAAA,KAAK,aAAL,EAAiB,MAAK,cAAa,OAAO,aAAa,OACtD,UAAA;AAAA,UAAAC,2BAAA,kBAAA;AAAA,YAACC,8BAAAA,YAAY;AAAA,YAAZ;AAAA,cACC,eAAe,CAAC,UACd,UAAU,MAAM,KAAK,CAACC,aAAY,OAAOA,SAAQ,GAAG,MAAM,KAAK,GAC3D,QAAQ;AAAA,cAGd,2DAACD,0CAAY,OAAZ,EAAkB,aAAa,aAAa,YAAa,CAAA;AAAA,YAAA;AAAA,UAC5D;AAAA,UACCD,2BAAAA,kBAAAA,IAAAC,8BAAAA,YAAY,SAAZ,EACC,UAACD,2BAAA,kBAAA,IAAAC,8BAAA,YAAY,MAAZ,EACE,UAAU,UAAA,MAAM,IAAI,CAACC,aACpBF,2BAAA,kBAAA;AAAA,YAACC,8BAAAA,YAAY;AAAA,YAAZ;AAAA,cAEC,OAAO,OAAOC,SAAQ,GAAG;AAAA,cAExB,UAAAA,SAAQ;AAAA,YAAA;AAAA,YAHJ,OAAOA,SAAQ,GAAG;AAAA,UAK1B,CAAA,EACH,CAAA,EACF,CAAA;AAAA,QAAA,GACF;AAAA,QAEAF,2BAAA,kBAAA;AAAA,UAACD,sCAAAA,KAAK;AAAA,UAAL;AAAA,YACC,WAAU;AAAA,YACV,MAAK;AAAA,YACL,OAAM;AAAA,YACN,WAAW;AAAA,YACX,OAAO,uBAAuB;AAAA,YAE7B,UAAuB,uBAAA;AAAA,UAAA;AAAA,QAAA;AAAA,MAC1B;AAAA,IAAA;AAAA,EACF;AAEJ;;"}
|
package/dist/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { j as jsxRuntimeExports } from "../../../jsx-runtime-DQkoUcjV.js";
|
|
3
3
|
import { useDictionary } from "react-intlayer";
|
|
4
4
|
import { useAddDictionary, useGetProjects } from "../../../hooks/intlayerAPIHooks.mjs";
|
|
5
|
-
import "../../../index-
|
|
5
|
+
import "../../../index-B-VAyQ9R.js";
|
|
6
|
+
import "@intlayer/config/client";
|
|
6
7
|
import "../../Button/Button.mjs";
|
|
7
8
|
import "../../Auth/ExternalsLoginButtons/externalsLoginButtons.content.mjs";
|
|
8
9
|
import { useForm } from "../../Form/FormBase.mjs";
|
|
@@ -15,7 +16,7 @@ import "../../Auth/SignUpForm/useSignUpSchema.content.mjs";
|
|
|
15
16
|
import "react";
|
|
16
17
|
import "../../../hooks/useScrollBlockage/useScrollBlockageStore.mjs";
|
|
17
18
|
import "../../../hooks/useAsync/useAsyncStateStore.mjs";
|
|
18
|
-
import "@intlayer/
|
|
19
|
+
import "@intlayer/editor-react";
|
|
19
20
|
import "deepmerge";
|
|
20
21
|
import { useAuth } from "../../Auth/useAuth/index.mjs";
|
|
21
22
|
import "../../Auth/ChangePasswordForm/changePasswordForm.content.mjs";
|
|
@@ -25,6 +26,7 @@ import "../../Auth/ResetPasswordForm/useResetPasswordSchema.content.mjs";
|
|
|
25
26
|
import "../../Modal/Modal.mjs";
|
|
26
27
|
import "clsx";
|
|
27
28
|
import "tailwind-merge";
|
|
29
|
+
import "@intlayer/api";
|
|
28
30
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
29
31
|
import "../../Select/Select.mjs";
|
|
30
32
|
import { dictionaryFormContent } from "./dictionaryCreationForm.content.mjs";
|