react-intlayer 5.5.2 → 5.5.3
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 +0 -7
- package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
- package/dist/esm/editor/IntlayerEditorProvider.mjs +0 -8
- package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
- package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
- package/package.json +14 -14
|
@@ -35,17 +35,10 @@ module.exports = __toCommonJS(IntlayerEditorProvider_exports);
|
|
|
35
35
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
36
|
var import_api = require("@intlayer/api");
|
|
37
37
|
var import_built = __toESM(require("@intlayer/config/built"));
|
|
38
|
-
var import_dictionaries_entry = __toESM(require("@intlayer/dictionaries-entry"));
|
|
39
38
|
var import_editor_react = require("@intlayer/editor-react");
|
|
40
39
|
var import_react = require("react");
|
|
41
40
|
const IntlayerEditorHooksEnabled = () => {
|
|
42
41
|
(0, import_editor_react.useCrossURLPathSetter)();
|
|
43
|
-
const { setLocaleDictionaries } = (0, import_editor_react.useDictionariesRecordActions)();
|
|
44
|
-
(0, import_react.useEffect)(() => {
|
|
45
|
-
setLocaleDictionaries(
|
|
46
|
-
import_dictionaries_entry.default
|
|
47
|
-
);
|
|
48
|
-
}, []);
|
|
49
42
|
(0, import_editor_react.useIframeClickInterceptor)();
|
|
50
43
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_jsx_runtime.Fragment, {});
|
|
51
44
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport configuration from '@intlayer/config/built';\
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport configuration from '@intlayer/config/built';\nimport {\n EditorProvider,\n useChangedContentActions,\n useCrossURLPathSetter,\n useEditorEnabled,\n useIframeClickInterceptor,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst { editor } = configuration;\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n /**\n * Hot reloading\n */\n const { setChangedContent } = useChangedContentActions();\n\n useEffect(() => {\n if (!editor.hotReload) return;\n if (!editor.clientId) return;\n if (!editor.clientSecret) return;\n\n const eventSource = new IntlayerEventListener();\n try {\n eventSource.initialize().then(() => {\n eventSource.onDictionaryChange = (dictionary) =>\n setChangedContent(dictionary.key, dictionary.content);\n });\n } catch (error) {\n console.error('Error initializing IntlayerEventListener:', error);\n }\n\n return () => eventSource.cleanup();\n }, []);\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n if (!isInIframe) return;\n\n if (editor.applicationURL.length > 0) {\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 }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={[\n editor?.editorURL,\n editor?.cmsURL,\n editor?.applicationURL,\n ]}\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwBS;AAtBT,iBAAsC;AACtC,mBAA0B;AAC1B,0BAMO;AACP,mBAA2D;AAE3D,MAAM,6BAAiC,MAAM;AAI3C,iDAAsB;AAKtB,qDAA0B;AAE1B,SAAO,2EAAE;AACX;AAEA,MAAM,EAAE,OAAO,IAAI,aAAAA;AAEnB,MAAM,qBAAyB,MAAM;AACnC,QAAM,EAAE,QAAQ,QAAI,sCAAiB;AAKrC,QAAM,EAAE,kBAAkB,QAAI,8CAAyB;AAEvD,8BAAU,MAAM;AACd,QAAI,CAAC,OAAO,UAAW;AACvB,QAAI,CAAC,OAAO,SAAU;AACtB,QAAI,CAAC,OAAO,aAAc;AAE1B,UAAM,cAAc,IAAI,iCAAsB;AAC9C,QAAI;AACF,kBAAY,WAAW,EAAE,KAAK,MAAM;AAClC,oBAAY,qBAAqB,CAAC,eAChC,kBAAkB,WAAW,KAAK,WAAW,OAAO;AAAA,MACxD,CAAC;AAAA,IACH,SAAS,OAAO;AACd,cAAQ,MAAM,6CAA6C,KAAK;AAAA,IAClE;AAEA,WAAO,MAAM,YAAY,QAAQ;AAAA,EACnC,GAAG,CAAC,CAAC;AAEL,SAAO,UAAU,4CAAC,8BAA2B,IAAK,2EAAE;AACtD;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,CAAC,SAAc;AAC1B,YAAI,OAAO,WAAW,YAAa;AAEnC,cAAM,aAAa,OAAO,SAAS,OAAO;AAC1C,YAAI,CAAC,WAAY;AAEjB,YAAI,OAAO,eAAe,SAAS,GAAG;AACpC,kBAAQ;AAAA,YACN;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAEA,YAAI,OAAO,UAAU,SAAS,GAAG;AAC/B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAEA,YAAI,OAAO,OAAO,SAAS,GAAG;AAC5B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,MACA,gBAAgB;AAAA,QACd,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,QAAQ;AAAA,MACV;AAAA,MACA,MAAK;AAAA,MACL,eAAe,aAAAA;AAAA,MAEf;AAAA,oDAAC,sBAAmB;AAAA,QACnB;AAAA;AAAA;AAAA,EACH;AAEJ;","names":["configuration"]}
|
|
@@ -2,24 +2,16 @@
|
|
|
2
2
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { IntlayerEventListener } from "@intlayer/api";
|
|
4
4
|
import configuration from "@intlayer/config/built";
|
|
5
|
-
import dictionaries from "@intlayer/dictionaries-entry";
|
|
6
5
|
import {
|
|
7
6
|
EditorProvider,
|
|
8
7
|
useChangedContentActions,
|
|
9
8
|
useCrossURLPathSetter,
|
|
10
|
-
useDictionariesRecordActions,
|
|
11
9
|
useEditorEnabled,
|
|
12
10
|
useIframeClickInterceptor
|
|
13
11
|
} from "@intlayer/editor-react";
|
|
14
12
|
import { useEffect } from "react";
|
|
15
13
|
const IntlayerEditorHooksEnabled = () => {
|
|
16
14
|
useCrossURLPathSetter();
|
|
17
|
-
const { setLocaleDictionaries } = useDictionariesRecordActions();
|
|
18
|
-
useEffect(() => {
|
|
19
|
-
setLocaleDictionaries(
|
|
20
|
-
dictionaries
|
|
21
|
-
);
|
|
22
|
-
}, []);
|
|
23
15
|
useIframeClickInterceptor();
|
|
24
16
|
return /* @__PURE__ */ jsx(Fragment, {});
|
|
25
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport configuration from '@intlayer/config/built';\
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"sourcesContent":["'use client';\n\nimport { IntlayerEventListener } from '@intlayer/api';\nimport configuration from '@intlayer/config/built';\nimport {\n EditorProvider,\n useChangedContentActions,\n useCrossURLPathSetter,\n useEditorEnabled,\n useIframeClickInterceptor,\n} from '@intlayer/editor-react';\nimport { useEffect, type FC, type PropsWithChildren } from 'react';\n\nconst IntlayerEditorHooksEnabled: FC = () => {\n /**\n * URL Messages\n */\n useCrossURLPathSetter();\n\n /**\n * Click Messages\n */\n useIframeClickInterceptor();\n\n return <></>;\n};\n\nconst { editor } = configuration;\n\nconst IntlayerEditorHook: FC = () => {\n const { enabled } = useEditorEnabled();\n\n /**\n * Hot reloading\n */\n const { setChangedContent } = useChangedContentActions();\n\n useEffect(() => {\n if (!editor.hotReload) return;\n if (!editor.clientId) return;\n if (!editor.clientSecret) return;\n\n const eventSource = new IntlayerEventListener();\n try {\n eventSource.initialize().then(() => {\n eventSource.onDictionaryChange = (dictionary) =>\n setChangedContent(dictionary.key, dictionary.content);\n });\n } catch (error) {\n console.error('Error initializing IntlayerEventListener:', error);\n }\n\n return () => eventSource.cleanup();\n }, []);\n\n return enabled ? <IntlayerEditorHooksEnabled /> : <></>;\n};\n\nexport const IntlayerEditorProvider: FC<PropsWithChildren> = ({ children }) => {\n return (\n <EditorProvider\n postMessage={(data: any) => {\n if (typeof window === 'undefined') return;\n\n const isInIframe = window.self !== window.top;\n if (!isInIframe) return;\n\n if (editor.applicationURL.length > 0) {\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 }\n\n if (editor.editorURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the editor for security reasons.\n // Correspond to the editor URL to synchronize the locales states.\n editor.editorURL\n );\n }\n\n if (editor.cmsURL.length > 0) {\n window.parent?.postMessage(\n data,\n // Use to restrict the origin of the CMS for security reasons.\n // Correspond to the CMS URL.\n editor.cmsURL\n );\n }\n }}\n allowedOrigins={[\n editor?.editorURL,\n editor?.cmsURL,\n editor?.applicationURL,\n ]}\n mode=\"client\"\n configuration={configuration}\n >\n <IntlayerEditorHook />\n {children}\n </EditorProvider>\n );\n};\n"],"mappings":";AAwBS,wBAoCL,YApCK;AAtBT,SAAS,6BAA6B;AACtC,OAAO,mBAAmB;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAkD;AAE3D,MAAM,6BAAiC,MAAM;AAI3C,wBAAsB;AAKtB,4BAA0B;AAE1B,SAAO,gCAAE;AACX;AAEA,MAAM,EAAE,OAAO,IAAI;AAEnB,MAAM,qBAAyB,MAAM;AACnC,QAAM,EAAE,QAAQ,IAAI,iBAAiB;AAKrC,QAAM,EAAE,kBAAkB,IAAI,yBAAyB;AAEvD,YAAU,MAAM;AACd,QAAI,CAAC,OAAO,UAAW;AACvB,QAAI,CAAC,OAAO,SAAU;AACtB,QAAI,CAAC,OAAO,aAAc;AAE1B,UAAM,cAAc,IAAI,sBAAsB;AAC9C,QAAI;AACF,kBAAY,WAAW,EAAE,KAAK,MAAM;AAClC,oBAAY,qBAAqB,CAAC,eAChC,kBAAkB,WAAW,KAAK,WAAW,OAAO;AAAA,MACxD,CAAC;AAAA,IACH,SAAS,OAAO;AACd,cAAQ,MAAM,6CAA6C,KAAK;AAAA,IAClE;AAEA,WAAO,MAAM,YAAY,QAAQ;AAAA,EACnC,GAAG,CAAC,CAAC;AAEL,SAAO,UAAU,oBAAC,8BAA2B,IAAK,gCAAE;AACtD;AAEO,MAAM,yBAAgD,CAAC,EAAE,SAAS,MAAM;AAC7E,SACE;AAAA,IAAC;AAAA;AAAA,MACC,aAAa,CAAC,SAAc;AAC1B,YAAI,OAAO,WAAW,YAAa;AAEnC,cAAM,aAAa,OAAO,SAAS,OAAO;AAC1C,YAAI,CAAC,WAAY;AAEjB,YAAI,OAAO,eAAe,SAAS,GAAG;AACpC,kBAAQ;AAAA,YACN;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAEA,YAAI,OAAO,UAAU,SAAS,GAAG;AAC/B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAEA,YAAI,OAAO,OAAO,SAAS,GAAG;AAC5B,iBAAO,QAAQ;AAAA,YACb;AAAA;AAAA;AAAA,YAGA,OAAO;AAAA,UACT;AAAA,QACF;AAAA,MACF;AAAA,MACA,gBAAgB;AAAA,QACd,QAAQ;AAAA,QACR,QAAQ;AAAA,QACR,QAAQ;AAAA,MACV;AAAA,MACA,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":"
|
|
1
|
+
{"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAWA,OAAO,EAAa,KAAK,EAAE,EAAE,KAAK,iBAAiB,EAAE,MAAM,OAAO,CAAC;AA+CnE,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CAgDxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "5.5.
|
|
3
|
+
"version": "5.5.3",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Easily internationalize i18n your React applications with type-safe multilingual content management.",
|
|
6
6
|
"keywords": [
|
|
@@ -69,11 +69,11 @@
|
|
|
69
69
|
],
|
|
70
70
|
"dependencies": {
|
|
71
71
|
"js-cookie": "^3.0.5",
|
|
72
|
-
"@intlayer/config": "5.5.
|
|
73
|
-
"@intlayer/core": "5.5.
|
|
74
|
-
"@intlayer/dictionaries-entry": "5.5.
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"@intlayer/
|
|
72
|
+
"@intlayer/config": "5.5.3",
|
|
73
|
+
"@intlayer/core": "5.5.3",
|
|
74
|
+
"@intlayer/dictionaries-entry": "5.5.3",
|
|
75
|
+
"@intlayer/api": "5.5.3",
|
|
76
|
+
"@intlayer/editor-react": "5.5.3"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@craco/types": "^7.1.0",
|
|
@@ -90,20 +90,20 @@
|
|
|
90
90
|
"tsup": "^8.4.0",
|
|
91
91
|
"typescript": "^5.8.2",
|
|
92
92
|
"@utils/eslint-config": "1.0.4",
|
|
93
|
-
"@utils/ts-config": "1.0.4",
|
|
94
93
|
"@utils/ts-config-types": "1.0.4",
|
|
94
|
+
"@utils/ts-config": "1.0.4",
|
|
95
95
|
"@utils/tsup-config": "1.0.4",
|
|
96
|
-
"@intlayer/backend": "5.5.
|
|
96
|
+
"@intlayer/backend": "5.5.3"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"react": ">=16.0.0",
|
|
100
100
|
"react-dom": ">=16.0.0",
|
|
101
|
-
"@intlayer/api": "5.5.
|
|
102
|
-
"@intlayer/config": "5.5.
|
|
103
|
-
"@intlayer/core": "5.5.
|
|
104
|
-
"@intlayer/editor-react": "5.5.
|
|
105
|
-
"intlayer": "5.5.
|
|
106
|
-
"@intlayer/dictionaries-entry": "5.5.
|
|
101
|
+
"@intlayer/api": "5.5.3",
|
|
102
|
+
"@intlayer/config": "5.5.3",
|
|
103
|
+
"@intlayer/core": "5.5.3",
|
|
104
|
+
"@intlayer/editor-react": "5.5.3",
|
|
105
|
+
"intlayer": "5.5.3",
|
|
106
|
+
"@intlayer/dictionaries-entry": "5.5.3"
|
|
107
107
|
},
|
|
108
108
|
"engines": {
|
|
109
109
|
"node": ">=14.18"
|