react-intlayer 4.0.5 → 4.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/editor/IntlayerEditorProvider.cjs +3 -6
- package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs +3 -7
- package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
- package/package.json +15 -15
|
@@ -42,11 +42,6 @@ const IntlayerEditorHooksEnabled = () => {
|
|
|
42
42
|
receive: false,
|
|
43
43
|
emit: true
|
|
44
44
|
});
|
|
45
|
-
const [, setConfiguration] = (0, import_editor_react.useConfigurationState)();
|
|
46
|
-
(0, import_react.useEffect)(() => {
|
|
47
|
-
const config = (0, import_client.getConfiguration)();
|
|
48
|
-
setConfiguration(config);
|
|
49
|
-
}, [setConfiguration]);
|
|
50
45
|
const { setLocaleDictionaries } = (0, import_editor_react.useDictionariesRecordActions)();
|
|
51
46
|
(0, import_react.useEffect)(() => {
|
|
52
47
|
setLocaleDictionaries(import_dictionaries_entry.default);
|
|
@@ -59,7 +54,8 @@ const IntlayerEditorHook = () => {
|
|
|
59
54
|
return enabled ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerEditorHooksEnabled, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
60
55
|
};
|
|
61
56
|
const IntlayerEditorProvider = ({ children }) => {
|
|
62
|
-
const
|
|
57
|
+
const configuration = (0, import_client.getConfiguration)();
|
|
58
|
+
const { editor } = configuration;
|
|
63
59
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
64
60
|
import_editor_react.EditorProvider,
|
|
65
61
|
{
|
|
@@ -80,6 +76,7 @@ const IntlayerEditorProvider = ({ children }) => {
|
|
|
80
76
|
},
|
|
81
77
|
allowedOrigins: [editor.editorURL, editor.applicationURL],
|
|
82
78
|
mode: "client",
|
|
79
|
+
configuration,
|
|
83
80
|
children: [
|
|
84
81
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerEditorHook, {}),
|
|
85
82
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathState,\n useDictionariesRecordActions,\n useConfigurationState,\n useIframeClickInterceptor,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathState(undefined, {\n receive: false,\n emit: true,\n });\n\n /**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathState,\n useDictionariesRecordActions,\n useConfigurationState,\n useIframeClickInterceptor,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathState(undefined, {\n receive: false,\n emit: true,\n });\n\n /**\n * Locale Dictionaries Messages\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n setLocaleDictionaries(dictionaries);\n }, [setLocaleDictionaries]);\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n const configuration = getConfiguration();\n\n const { editor } = configuration;\n\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current editor URL.\n editor.editorURL\n );\n }}\n allowedOrigins={[editor.editorURL, editor.applicationURL]}\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA4CS;AAxCT,oBAAiC;AAMjC,gCAAyB;AACzB,0BAOO;AACP,mBAA2D;AAE3D,MAAM,6BAAiC,MAAM;AAI3C,gDAAqB,QAAW;AAAA,IAC9B,SAAS;AAAA,IACT,MAAM;AAAA,EACR,CAAC;AAKD,QAAM,EAAE,sBAAsB,QAAI,kDAA6B;AAE/D,8BAAU,MAAM;AACd,0BAAsB,0BAAAA,OAAY;AAAA,EACpC,GAAG,CAAC,qBAAqB,CAAC;AAK1B,qDAA0B;AAE1B,SAAO,2EAAE;AACX;AAEA,MAAM,qBAAyB,MAAM;AACnC,QAAM,EAAE,QAAQ,QAAI,sCAAiB;AAErC,SAAO,UAAU,4CAAC,8BAA2B,IAAK,2EAAE;AACtD;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,oBAAgB,gCAAiB;AAEvC,QAAM,EAAE,OAAO,IAAI;AAEnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,CAAC,SAAc;AAC1B,YAAI,OAAO,WAAW,YAAa;AAEnC,gBAAQ;AAAA,UACN;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AACA,eAAO,QAAQ;AAAA,UACb;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA,gBAAgB,CAAC,OAAO,WAAW,OAAO,cAAc;AAAA,MACxD,MAAK;AAAA,MACL;AAAA,MAEA;AAAA,oDAAC,sBAAmB;AAAA,QACnB;AAAA;AAAA;AAAA,EACH;AAEJ;","names":["dictionaries"]}
|
|
@@ -6,7 +6,6 @@ import {
|
|
|
6
6
|
EditorProvider,
|
|
7
7
|
useCrossURLPathState,
|
|
8
8
|
useDictionariesRecordActions,
|
|
9
|
-
useConfigurationState,
|
|
10
9
|
useIframeClickInterceptor,
|
|
11
10
|
useEditorEnabled
|
|
12
11
|
} from "@intlayer/editor-react";
|
|
@@ -16,11 +15,6 @@ const IntlayerEditorHooksEnabled = () => {
|
|
|
16
15
|
receive: false,
|
|
17
16
|
emit: true
|
|
18
17
|
});
|
|
19
|
-
const [, setConfiguration] = useConfigurationState();
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
const config = getConfiguration();
|
|
22
|
-
setConfiguration(config);
|
|
23
|
-
}, [setConfiguration]);
|
|
24
18
|
const { setLocaleDictionaries } = useDictionariesRecordActions();
|
|
25
19
|
useEffect(() => {
|
|
26
20
|
setLocaleDictionaries(dictionaries);
|
|
@@ -33,7 +27,8 @@ const IntlayerEditorHook = () => {
|
|
|
33
27
|
return enabled ? /* @__PURE__ */ jsx(IntlayerEditorHooksEnabled, {}) : /* @__PURE__ */ jsx(Fragment, {});
|
|
34
28
|
};
|
|
35
29
|
const IntlayerEditorProvider = ({ children }) => {
|
|
36
|
-
const
|
|
30
|
+
const configuration = getConfiguration();
|
|
31
|
+
const { editor } = configuration;
|
|
37
32
|
return /* @__PURE__ */ jsxs(
|
|
38
33
|
EditorProvider,
|
|
39
34
|
{
|
|
@@ -54,6 +49,7 @@ const IntlayerEditorProvider = ({ children }) => {
|
|
|
54
49
|
},
|
|
55
50
|
allowedOrigins: [editor.editorURL, editor.applicationURL],
|
|
56
51
|
mode: "client",
|
|
52
|
+
configuration,
|
|
57
53
|
children: [
|
|
58
54
|
/* @__PURE__ */ jsx(IntlayerEditorHook, {}),
|
|
59
55
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathState,\n useDictionariesRecordActions,\n useConfigurationState,\n useIframeClickInterceptor,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathState(undefined, {\n receive: false,\n emit: true,\n });\n\n /**\n *
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\n\n'use client';\n\nimport { getConfiguration } from '@intlayer/config/client';\n/**\n * @intlayer/dictionaries-entry is a package that only returns the dictionary entry path.\n * Using an external package allow to alias it in the bundle configuration (such as webpack).\n * The alias allow hot reload the app (such as nextjs) on any dictionary change.\n */\nimport dictionaries from '@intlayer/dictionaries-entry';\nimport {\n EditorProvider,\n useCrossURLPathState,\n useDictionariesRecordActions,\n useConfigurationState,\n useIframeClickInterceptor,\n useEditorEnabled,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathState(undefined, {\n receive: false,\n emit: true,\n });\n\n /**\n * Locale Dictionaries Messages\n */\n const { setLocaleDictionaries } = useDictionariesRecordActions();\n\n useEffect(() => {\n setLocaleDictionaries(dictionaries);\n }, [setLocaleDictionaries]);\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n const configuration = getConfiguration();\n\n const { editor } = configuration;\n\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n window?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current application URL to synchronize the locales states.\n editor.applicationURL\n );\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the current editor URL.\n editor.editorURL\n );\n }}\n allowedOrigins={[editor.editorURL, editor.applicationURL]}\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";AA4CS,wBAeL,YAfK;AAxCT,SAAS,wBAAwB;AAMjC,OAAO,kBAAkB;AACzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EAEA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAkD;AAE3D,MAAM,6BAAiC,MAAM;AAI3C,uBAAqB,QAAW;AAAA,IAC9B,SAAS;AAAA,IACT,MAAM;AAAA,EACR,CAAC;AAKD,QAAM,EAAE,sBAAsB,IAAI,6BAA6B;AAE/D,YAAU,MAAM;AACd,0BAAsB,YAAY;AAAA,EACpC,GAAG,CAAC,qBAAqB,CAAC;AAK1B,4BAA0B;AAE1B,SAAO,gCAAE;AACX;AAEA,MAAM,qBAAyB,MAAM;AACnC,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAErC,SAAO,UAAU,oBAAC,8BAA2B,IAAK,gCAAE;AACtD;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,QAAM,gBAAgB,iBAAiB;AAEvC,QAAM,EAAE,OAAO,IAAI;AAEnB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,CAAC,SAAc;AAC1B,YAAI,OAAO,WAAW,YAAa;AAEnC,gBAAQ;AAAA,UACN;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AACA,eAAO,QAAQ;AAAA,UACb;AAAA;AAAA;AAAA,UAGA,OAAO;AAAA,QACT;AAAA,MACF;AAAA,MACA,gBAAgB,CAAC,OAAO,WAAW,OAAO,cAAc;AAAA,MACxD,MAAK;AAAA,MACL;AAAA,MAEA;AAAA,4BAAC,sBAAmB;AAAA,QACnB;AAAA;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAa,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAmBA,OAAO,EAAa,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAkCnE,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CA+BxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "4.0
|
|
3
|
+
"version": "4.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -71,11 +71,11 @@
|
|
|
71
71
|
],
|
|
72
72
|
"dependencies": {
|
|
73
73
|
"js-cookie": "^3.0.5",
|
|
74
|
-
"@intlayer/api": "4.0
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"@intlayer/
|
|
77
|
-
"@intlayer/
|
|
78
|
-
"@intlayer/
|
|
74
|
+
"@intlayer/api": "4.1.0",
|
|
75
|
+
"@intlayer/core": "4.1.0",
|
|
76
|
+
"@intlayer/dictionaries-entry": "4.1.0",
|
|
77
|
+
"@intlayer/config": "4.1.0",
|
|
78
|
+
"@intlayer/editor-react": "4.1.0"
|
|
79
79
|
},
|
|
80
80
|
"devDependencies": {
|
|
81
81
|
"@craco/types": "^7.1.0",
|
|
@@ -92,22 +92,22 @@
|
|
|
92
92
|
"tsc-alias": "^1.8.10",
|
|
93
93
|
"tsup": "^8.3.5",
|
|
94
94
|
"typescript": "^5.7.3",
|
|
95
|
-
"@intlayer/backend": "4.0
|
|
95
|
+
"@intlayer/backend": "4.1.0",
|
|
96
96
|
"@utils/eslint-config": "1.0.4",
|
|
97
97
|
"@utils/ts-config": "1.0.4",
|
|
98
|
-
"@utils/
|
|
99
|
-
"@utils/
|
|
98
|
+
"@utils/tsup-config": "1.0.4",
|
|
99
|
+
"@utils/ts-config-types": "1.0.4"
|
|
100
100
|
},
|
|
101
101
|
"peerDependencies": {
|
|
102
102
|
"react": ">=16.0.0",
|
|
103
103
|
"react-dom": ">=16.0.0",
|
|
104
104
|
"vite": ">=4.0.0",
|
|
105
|
-
"@intlayer/api": "4.0
|
|
106
|
-
"@intlayer/
|
|
107
|
-
"@intlayer/
|
|
108
|
-
"@intlayer/dictionaries-entry": "4.0
|
|
109
|
-
"intlayer": "4.0
|
|
110
|
-
"
|
|
105
|
+
"@intlayer/api": "4.1.0",
|
|
106
|
+
"@intlayer/core": "4.1.0",
|
|
107
|
+
"@intlayer/config": "4.1.0",
|
|
108
|
+
"@intlayer/dictionaries-entry": "4.1.0",
|
|
109
|
+
"@intlayer/editor-react": "4.1.0",
|
|
110
|
+
"intlayer": "4.1.0"
|
|
111
111
|
},
|
|
112
112
|
"engines": {
|
|
113
113
|
"node": ">=14.18"
|