react-intlayer 5.3.10 → 5.3.12
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/client/IntlayerProvider.cjs +2 -6
- package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
- package/dist/cjs/editor/useEditedContentRenderer.cjs +11 -0
- package/dist/cjs/editor/useEditedContentRenderer.cjs.map +1 -1
- package/dist/cjs/markdown/MarkdownRenderer.cjs +2 -2
- package/dist/cjs/markdown/MarkdownRenderer.cjs.map +1 -1
- package/dist/esm/client/IntlayerProvider.mjs +3 -7
- package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
- package/dist/esm/editor/useEditedContentRenderer.mjs +11 -0
- package/dist/esm/editor/useEditedContentRenderer.mjs.map +1 -1
- package/dist/esm/markdown/MarkdownRenderer.mjs +4 -4
- package/dist/esm/markdown/MarkdownRenderer.mjs.map +1 -1
- package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts +3 -1
- package/dist/types/editor/useEditedContentRenderer.d.ts.map +1 -1
- package/dist/types/markdown/MarkdownRenderer.d.ts +2 -2
- package/dist/types/markdown/MarkdownRenderer.d.ts.map +1 -1
- package/package.json +14 -14
- package/dist/cjs/client/PoweredByMeta.cjs +0 -45
- package/dist/cjs/client/PoweredByMeta.cjs.map +0 -1
- package/dist/esm/client/PoweredByMeta.mjs +0 -21
- package/dist/esm/client/PoweredByMeta.mjs.map +0 -1
- package/dist/types/client/PoweredByMeta.d.ts +0 -3
- package/dist/types/client/PoweredByMeta.d.ts.map +0 -1
|
@@ -37,12 +37,11 @@ __export(IntlayerProvider_exports, {
|
|
|
37
37
|
module.exports = __toCommonJS(IntlayerProvider_exports);
|
|
38
38
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
39
39
|
var import_built = __toESM(require("@intlayer/config/built"));
|
|
40
|
+
var import_core = require("@intlayer/core");
|
|
40
41
|
var import_editor_react = require("@intlayer/editor-react");
|
|
41
42
|
var import_react = require("react");
|
|
42
43
|
var import_IntlayerEditorProvider = require('../editor/IntlayerEditorProvider.cjs');
|
|
43
|
-
var import_PoweredByMeta = require('./PoweredByMeta.cjs');
|
|
44
44
|
var import_useLocaleCookie = require('./useLocaleCookie.cjs');
|
|
45
|
-
var import_core = require("@intlayer/core");
|
|
46
45
|
const IntlayerClientContext = (0, import_react.createContext)({
|
|
47
46
|
locale: import_useLocaleCookie.localeCookie ?? import_built.default?.internationalization?.defaultLocale,
|
|
48
47
|
setLocale: () => null,
|
|
@@ -86,10 +85,7 @@ const IntlayerProviderContent = ({
|
|
|
86
85
|
}
|
|
87
86
|
);
|
|
88
87
|
};
|
|
89
|
-
const IntlayerProvider = (props) => /* @__PURE__ */ (0, import_jsx_runtime.
|
|
90
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_PoweredByMeta.PoweredByMeta, {}),
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerProviderContent, { ...props })
|
|
92
|
-
] });
|
|
88
|
+
const IntlayerProvider = (props) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_IntlayerEditorProvider.IntlayerEditorProvider, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(IntlayerProviderContent, { ...props }) });
|
|
93
89
|
// Annotate the CommonJS export names for ESM import in node:
|
|
94
90
|
0 && (module.exports = {
|
|
95
91
|
IntlayerClientContext,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { LocalesValues } from '@intlayer/config/client';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\n\nimport { localeResolver } from '@intlayer/core';\nimport { useCrossFrameState } from '@intlayer/editor-react';\nimport {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n} from 'react';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\n\ntype IntlayerValue = {\n locale: LocalesValues;\n setLocale: (newLocale: LocalesValues) => void;\n disableEditor?: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? configuration?.internationalization?.defaultLocale,\n setLocale: () => null,\n disableEditor: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren<{\n locale?: LocalesValues;\n defaultLocale?: LocalesValues;\n setLocale?: (locale: LocalesValues) => void;\n disableEditor?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProviderContent: FC<IntlayerProviderProps> = ({\n locale: localeProp,\n defaultLocale: defaultLocaleProp,\n children,\n setLocale: setLocaleProp,\n disableEditor,\n}) => {\n const { internationalization } = configuration ?? {};\n const { defaultLocale: defaultLocaleConfig, locales: availableLocales } =\n internationalization ?? {};\n\n const defaultLocale =\n localeProp ?? localeCookie ?? defaultLocaleProp ?? defaultLocaleConfig;\n\n const [currentLocale, setCurrentLocale] = useCrossFrameState(\n 'INTLAYER_CURRENT_LOCALE',\n defaultLocale\n );\n\n const setLocaleBase = (newLocale: LocalesValues) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n };\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const resolvedLocale = localeResolver(localeProp ?? currentLocale);\n\n return (\n <IntlayerClientContext.Provider\n value={{\n locale: resolvedLocale,\n setLocale,\n disableEditor,\n }}\n >\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\nexport const IntlayerProvider: FC<IntlayerProviderProps> = (props) => (\n <IntlayerEditorProvider>\n <IntlayerProviderContent {...props} />\n </IntlayerEditorProvider>\n);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAkFI;AAhFJ,mBAA0B;AAG1B,kBAA+B;AAC/B,0BAAmC;AACnC,mBAKO;AACP,oCAAuC;AACvC,6BAA8C;AAWvC,MAAM,4BAAwB,4BAA6B;AAAA,EAChE,QAAQ,uCAAgB,aAAAA,SAAe,sBAAsB;AAAA,EAC7D,WAAW,MAAM;AAAA,EACjB,eAAe;AACjB,CAAC;AAKM,MAAM,qBAAqB,UAAM,yBAAW,qBAAqB;AAYjE,MAAM,0BAAqD,CAAC;AAAA,EACjE,QAAQ;AAAA,EACR,eAAe;AAAA,EACf;AAAA,EACA,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM,EAAE,qBAAqB,IAAI,aAAAA,WAAiB,CAAC;AACnD,QAAM,EAAE,eAAe,qBAAqB,SAAS,iBAAiB,IACpE,wBAAwB,CAAC;AAE3B,QAAM,gBACJ,cAAc,uCAAgB,qBAAqB;AAErD,QAAM,CAAC,eAAe,gBAAgB,QAAI;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,gBAAgB,CAAC,cAA6B;AAClD,QAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,QAAI,CAAC,kBAAkB,IAAI,MAAM,EAAE,SAAS,SAAS,GAAG;AACtD,cAAQ,MAAM,UAAU,SAAS,mBAAmB;AACpD;AAAA,IACF;AAEA,qBAAiB,SAAS;AAC1B,gDAAgB,SAAS;AAAA,EAC3B;AAEA,QAAM,YAAY,iBAAiB;AAEnC,QAAM,qBAAiB,4BAAe,cAAc,aAAa;AAEjE,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,OAAO;AAAA,QACL,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEO,MAAM,mBAA8C,CAAC,UAC1D,4CAAC,wDACC,sDAAC,2BAAyB,GAAG,OAAO,GACtC;","names":["configuration"]}
|
|
@@ -23,6 +23,7 @@ __export(useEditedContentRenderer_exports, {
|
|
|
23
23
|
useEditedContentRenderer: () => useEditedContentRenderer
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(useEditedContentRenderer_exports);
|
|
26
|
+
var import_core = require("@intlayer/core");
|
|
26
27
|
var import_editor_react = require("@intlayer/editor-react");
|
|
27
28
|
const useEditedContentRenderer = ({
|
|
28
29
|
dictionaryKey,
|
|
@@ -42,6 +43,16 @@ const useEditedContentRenderer = ({
|
|
|
42
43
|
};
|
|
43
44
|
const EditedContentRenderer = (props) => {
|
|
44
45
|
const content = useEditedContentRenderer(props);
|
|
46
|
+
if (typeof content === "object") {
|
|
47
|
+
const transformedEditedContent = (0, import_core.getContent)(content, props, props.locale);
|
|
48
|
+
if (typeof transformedEditedContent !== "string") {
|
|
49
|
+
console.error(
|
|
50
|
+
`Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`
|
|
51
|
+
);
|
|
52
|
+
return props.children;
|
|
53
|
+
}
|
|
54
|
+
return transformedEditedContent;
|
|
55
|
+
}
|
|
45
56
|
return content;
|
|
46
57
|
};
|
|
47
58
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config/client';\nimport { getContent, type KeyPath } from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { FC } from 'react';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n renderChildren?: (children: any) => any;\n locale?: Locales;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(content, props, props.locale);\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return props.children;\n }\n\n return transformedEditedContent;\n }\n\n return content;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAAyC;AACzC,0BAAwC;AAWjC,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAAkC;AAChC,QAAM,2BAAuB,6CAAwB;AAErD,MAAI,sBAAsB;AACxB,UAAM,cAAc,qBAAqB;AAAA,MACvC;AAAA,MACA;AAAA,IACF;AAEA,UAAM,QAAQ,eAAe;AAE7B,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,MAAM,wBAAwD,CACnE,UACG;AACH,QAAM,UAAU,yBAAyB,KAAK;AAE9C,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAM,+BAA2B,wBAAW,SAAS,OAAO,MAAM,MAAM;AAExE,QAAI,OAAO,6BAA6B,UAAU;AAChD,cAAQ;AAAA,QACN,kDAAkD,OAAO,wBAAwB,4BAA4B,KAAK,UAAU,wBAAwB,CAAC;AAAA,MACvJ;AAEA,aAAO,MAAM;AAAA,IACf;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -23,9 +23,9 @@ __export(MarkdownRenderer_exports, {
|
|
|
23
23
|
MarkdownRenderer: () => MarkdownRenderer
|
|
24
24
|
});
|
|
25
25
|
module.exports = __toCommonJS(MarkdownRenderer_exports);
|
|
26
|
-
var import_MarkdownProvider = require('./MarkdownProvider.cjs');
|
|
27
|
-
var import_useEditedContentRenderer = require('../editor/useEditedContentRenderer.cjs');
|
|
28
26
|
var import_core = require("@intlayer/core");
|
|
27
|
+
var import_useEditedContentRenderer = require('../editor/useEditedContentRenderer.cjs');
|
|
28
|
+
var import_MarkdownProvider = require('./MarkdownProvider.cjs');
|
|
29
29
|
const MarkdownRenderer = ({
|
|
30
30
|
dictionaryKey,
|
|
31
31
|
keyPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { LocalesValues } from '@intlayer/config/client';\nimport {\n ContentNode,\n getContent,\n getContentNodeByKeyPath,\n getMarkdownMetadata,\n KeyPath,\n} from '@intlayer/core';\nimport type { FC, ReactNode } from 'react';\nimport { useEditedContentRenderer } from '../editor/useEditedContentRenderer';\nimport { useMarkdownContext } from './MarkdownProvider';\n\ntype MarkdownRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n locale,\n}): ReactNode => {\n const { renderMarkdown } = useMarkdownContext();\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n\n if (typeof editedContentContext !== 'string') {\n const transformedEditedContent = getContent(\n editedContentContext,\n {\n dictionaryKey,\n keyPath,\n },\n locale\n );\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect Markdown content. Edited Markdown content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return renderMarkdown(children);\n }\n\n return renderMarkdown(transformedEditedContent);\n }\n\n return renderMarkdown(editedContentContext);\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererProps & {\n metadataKeyPath: KeyPath[];\n};\n\nexport const MarkdownMetadataRenderer: FC<MarkdownMetadataRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n metadataKeyPath,\n}): ReactNode => {\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n const metadata = getMarkdownMetadata(editedContentContext);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath\n );\n\n return metadataEl as ReactNode;\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAGA,kBAMO;AAEP,sCAAyC;AACzC,8BAAmC;AAS5B,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAiB;AACf,QAAM,EAAE,eAAe,QAAI,4CAAmB;AAC9C,QAAM,2BAAuB,0DAAyB;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,OAAO,yBAAyB,UAAU;AAC5C,UAAM,+BAA2B;AAAA,MAC/B;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAEA,QAAI,OAAO,6BAA6B,UAAU;AAChD,cAAQ;AAAA,QACN,6DAA6D,OAAO,wBAAwB,4BAA4B,KAAK,UAAU,wBAAwB,CAAC;AAAA,MAClK;AAEA,aAAO,eAAe,QAAQ;AAAA,IAChC;AAEA,WAAO,eAAe,wBAAwB;AAAA,EAChD;AAEA,SAAO,eAAe,oBAAoB;AAC5C;AAMO,MAAM,2BAA8D,CAAC;AAAA,EAC1E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAiB;AACf,QAAM,2BAAuB,0DAAyB;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,eAAW,iCAAoB,oBAAoB;AAEzD,QAAM,iBAAa;AAAA,IACjB;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import configuration from "@intlayer/config/built";
|
|
4
|
+
import { localeResolver } from "@intlayer/core";
|
|
4
5
|
import { useCrossFrameState } from "@intlayer/editor-react";
|
|
5
6
|
import {
|
|
6
7
|
createContext,
|
|
7
8
|
useContext
|
|
8
9
|
} from "react";
|
|
9
10
|
import { IntlayerEditorProvider } from "../editor/IntlayerEditorProvider.mjs";
|
|
10
|
-
import { PoweredByMeta } from "./PoweredByMeta.mjs";
|
|
11
11
|
import { localeCookie, setLocaleCookie } from "./useLocaleCookie.mjs";
|
|
12
|
-
import { localeResolver } from "@intlayer/core";
|
|
13
12
|
const IntlayerClientContext = createContext({
|
|
14
13
|
locale: localeCookie ?? configuration?.internationalization?.defaultLocale,
|
|
15
14
|
setLocale: () => null,
|
|
@@ -53,10 +52,7 @@ const IntlayerProviderContent = ({
|
|
|
53
52
|
}
|
|
54
53
|
);
|
|
55
54
|
};
|
|
56
|
-
const IntlayerProvider = (props) => /* @__PURE__ */
|
|
57
|
-
/* @__PURE__ */ jsx(PoweredByMeta, {}),
|
|
58
|
-
/* @__PURE__ */ jsx(IntlayerProviderContent, { ...props })
|
|
59
|
-
] });
|
|
55
|
+
const IntlayerProvider = (props) => /* @__PURE__ */ jsx(IntlayerEditorProvider, { children: /* @__PURE__ */ jsx(IntlayerProviderContent, { ...props }) });
|
|
60
56
|
export {
|
|
61
57
|
IntlayerClientContext,
|
|
62
58
|
IntlayerProvider,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport type { LocalesValues } from '@intlayer/config/client';\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/client/IntlayerProvider.tsx"],"sourcesContent":["'use client';\n\nimport configuration from '@intlayer/config/built';\nimport type { LocalesValues } from '@intlayer/config/client';\n\nimport { localeResolver } from '@intlayer/core';\nimport { useCrossFrameState } from '@intlayer/editor-react';\nimport {\n type FC,\n type PropsWithChildren,\n createContext,\n useContext,\n} from 'react';\nimport { IntlayerEditorProvider } from '../editor/IntlayerEditorProvider';\nimport { localeCookie, setLocaleCookie } from './useLocaleCookie';\n\ntype IntlayerValue = {\n locale: LocalesValues;\n setLocale: (newLocale: LocalesValues) => void;\n disableEditor?: boolean;\n};\n\n/**\n * Context that store the current locale on the client side\n */\nexport const IntlayerClientContext = createContext<IntlayerValue>({\n locale: localeCookie ?? configuration?.internationalization?.defaultLocale,\n setLocale: () => null,\n disableEditor: false,\n});\n\n/**\n * Hook that provides the current locale\n */\nexport const useIntlayerContext = () => useContext(IntlayerClientContext);\n\nexport type IntlayerProviderProps = PropsWithChildren<{\n locale?: LocalesValues;\n defaultLocale?: LocalesValues;\n setLocale?: (locale: LocalesValues) => void;\n disableEditor?: boolean;\n}>;\n\n/**\n * Provider that store the current locale on the client side\n */\nexport const IntlayerProviderContent: FC<IntlayerProviderProps> = ({\n locale: localeProp,\n defaultLocale: defaultLocaleProp,\n children,\n setLocale: setLocaleProp,\n disableEditor,\n}) => {\n const { internationalization } = configuration ?? {};\n const { defaultLocale: defaultLocaleConfig, locales: availableLocales } =\n internationalization ?? {};\n\n const defaultLocale =\n localeProp ?? localeCookie ?? defaultLocaleProp ?? defaultLocaleConfig;\n\n const [currentLocale, setCurrentLocale] = useCrossFrameState(\n 'INTLAYER_CURRENT_LOCALE',\n defaultLocale\n );\n\n const setLocaleBase = (newLocale: LocalesValues) => {\n if (currentLocale.toString() === newLocale.toString()) return;\n\n if (!availableLocales?.map(String).includes(newLocale)) {\n console.error(`Locale ${newLocale} is not available`);\n return;\n }\n\n setCurrentLocale(newLocale); // Update state\n setLocaleCookie(newLocale); // Optionally set cookie for persistence\n };\n\n const setLocale = setLocaleProp ?? setLocaleBase;\n\n const resolvedLocale = localeResolver(localeProp ?? currentLocale);\n\n return (\n <IntlayerClientContext.Provider\n value={{\n locale: resolvedLocale,\n setLocale,\n disableEditor,\n }}\n >\n {children}\n </IntlayerClientContext.Provider>\n );\n};\n\nexport const IntlayerProvider: FC<IntlayerProviderProps> = (props) => (\n <IntlayerEditorProvider>\n <IntlayerProviderContent {...props} />\n </IntlayerEditorProvider>\n);\n"],"mappings":";AAkFI;AAhFJ,OAAO,mBAAmB;AAG1B,SAAS,sBAAsB;AAC/B,SAAS,0BAA0B;AACnC;AAAA,EAGE;AAAA,EACA;AAAA,OACK;AACP,SAAS,8BAA8B;AACvC,SAAS,cAAc,uBAAuB;AAWvC,MAAM,wBAAwB,cAA6B;AAAA,EAChE,QAAQ,gBAAgB,eAAe,sBAAsB;AAAA,EAC7D,WAAW,MAAM;AAAA,EACjB,eAAe;AACjB,CAAC;AAKM,MAAM,qBAAqB,MAAM,WAAW,qBAAqB;AAYjE,MAAM,0BAAqD,CAAC;AAAA,EACjE,QAAQ;AAAA,EACR,eAAe;AAAA,EACf;AAAA,EACA,WAAW;AAAA,EACX;AACF,MAAM;AACJ,QAAM,EAAE,qBAAqB,IAAI,iBAAiB,CAAC;AACnD,QAAM,EAAE,eAAe,qBAAqB,SAAS,iBAAiB,IACpE,wBAAwB,CAAC;AAE3B,QAAM,gBACJ,cAAc,gBAAgB,qBAAqB;AAErD,QAAM,CAAC,eAAe,gBAAgB,IAAI;AAAA,IACxC;AAAA,IACA;AAAA,EACF;AAEA,QAAM,gBAAgB,CAAC,cAA6B;AAClD,QAAI,cAAc,SAAS,MAAM,UAAU,SAAS,EAAG;AAEvD,QAAI,CAAC,kBAAkB,IAAI,MAAM,EAAE,SAAS,SAAS,GAAG;AACtD,cAAQ,MAAM,UAAU,SAAS,mBAAmB;AACpD;AAAA,IACF;AAEA,qBAAiB,SAAS;AAC1B,oBAAgB,SAAS;AAAA,EAC3B;AAEA,QAAM,YAAY,iBAAiB;AAEnC,QAAM,iBAAiB,eAAe,cAAc,aAAa;AAEjE,SACE;AAAA,IAAC,sBAAsB;AAAA,IAAtB;AAAA,MACC,OAAO;AAAA,QACL,QAAQ;AAAA,QACR;AAAA,QACA;AAAA,MACF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEO,MAAM,mBAA8C,CAAC,UAC1D,oBAAC,0BACC,8BAAC,2BAAyB,GAAG,OAAO,GACtC;","names":[]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { getContent } from "@intlayer/core";
|
|
2
3
|
import { useEditedContentActions } from "@intlayer/editor-react";
|
|
3
4
|
const useEditedContentRenderer = ({
|
|
4
5
|
dictionaryKey,
|
|
@@ -18,6 +19,16 @@ const useEditedContentRenderer = ({
|
|
|
18
19
|
};
|
|
19
20
|
const EditedContentRenderer = (props) => {
|
|
20
21
|
const content = useEditedContentRenderer(props);
|
|
22
|
+
if (typeof content === "object") {
|
|
23
|
+
const transformedEditedContent = getContent(content, props, props.locale);
|
|
24
|
+
if (typeof transformedEditedContent !== "string") {
|
|
25
|
+
console.error(
|
|
26
|
+
`Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`
|
|
27
|
+
);
|
|
28
|
+
return props.children;
|
|
29
|
+
}
|
|
30
|
+
return transformedEditedContent;
|
|
31
|
+
}
|
|
21
32
|
return content;
|
|
22
33
|
};
|
|
23
34
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/editor/useEditedContentRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { Locales } from '@intlayer/config/client';\nimport { getContent, type KeyPath } from '@intlayer/core';\nimport { useEditedContentActions } from '@intlayer/editor-react';\nimport type { FC } from 'react';\n\ntype EditedContentRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n children: string;\n renderChildren?: (children: any) => any;\n locale?: Locales;\n};\n\nexport const useEditedContentRenderer = ({\n dictionaryKey,\n keyPath,\n children,\n}: EditedContentRendererProps) => {\n const editedContentContext = useEditedContentActions();\n\n if (editedContentContext) {\n const editedValue = editedContentContext.getEditedContentValue(\n dictionaryKey,\n keyPath\n ) as string;\n\n const value = editedValue ?? children;\n\n return value;\n }\n\n return children;\n};\n\nexport const EditedContentRenderer: FC<EditedContentRendererProps> = (\n props\n) => {\n const content = useEditedContentRenderer(props);\n\n if (typeof content === 'object') {\n const transformedEditedContent = getContent(content, props, props.locale);\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect edited content format. Content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return props.children;\n }\n\n return transformedEditedContent;\n }\n\n return content;\n};\n"],"mappings":";AAGA,SAAS,kBAAgC;AACzC,SAAS,+BAA+B;AAWjC,MAAM,2BAA2B,CAAC;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AACF,MAAkC;AAChC,QAAM,uBAAuB,wBAAwB;AAErD,MAAI,sBAAsB;AACxB,UAAM,cAAc,qBAAqB;AAAA,MACvC;AAAA,MACA;AAAA,IACF;AAEA,UAAM,QAAQ,eAAe;AAE7B,WAAO;AAAA,EACT;AAEA,SAAO;AACT;AAEO,MAAM,wBAAwD,CACnE,UACG;AACH,QAAM,UAAU,yBAAyB,KAAK;AAE9C,MAAI,OAAO,YAAY,UAAU;AAC/B,UAAM,2BAA2B,WAAW,SAAS,OAAO,MAAM,MAAM;AAExE,QAAI,OAAO,6BAA6B,UAAU;AAChD,cAAQ;AAAA,QACN,kDAAkD,OAAO,wBAAwB,4BAA4B,KAAK,UAAU,wBAAwB,CAAC;AAAA,MACvJ;AAEA,aAAO,MAAM;AAAA,IACf;AAEA,WAAO;AAAA,EACT;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { useMarkdownContext } from "./MarkdownProvider.mjs";
|
|
3
|
-
import { useEditedContentRenderer } from "../editor/useEditedContentRenderer.mjs";
|
|
4
2
|
import {
|
|
3
|
+
getContent,
|
|
5
4
|
getContentNodeByKeyPath,
|
|
6
|
-
getMarkdownMetadata
|
|
7
|
-
getContent
|
|
5
|
+
getMarkdownMetadata
|
|
8
6
|
} from "@intlayer/core";
|
|
7
|
+
import { useEditedContentRenderer } from "../editor/useEditedContentRenderer.mjs";
|
|
8
|
+
import { useMarkdownContext } from "./MarkdownProvider.mjs";
|
|
9
9
|
const MarkdownRenderer = ({
|
|
10
10
|
dictionaryKey,
|
|
11
11
|
keyPath,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["'use client';\n\nimport
|
|
1
|
+
{"version":3,"sources":["../../../src/markdown/MarkdownRenderer.tsx"],"sourcesContent":["'use client';\n\nimport { LocalesValues } from '@intlayer/config/client';\nimport {\n ContentNode,\n getContent,\n getContentNodeByKeyPath,\n getMarkdownMetadata,\n KeyPath,\n} from '@intlayer/core';\nimport type { FC, ReactNode } from 'react';\nimport { useEditedContentRenderer } from '../editor/useEditedContentRenderer';\nimport { useMarkdownContext } from './MarkdownProvider';\n\ntype MarkdownRendererProps = {\n dictionaryKey: string;\n keyPath: KeyPath[];\n locale?: LocalesValues;\n children: string;\n};\n\nexport const MarkdownRenderer: FC<MarkdownRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n locale,\n}): ReactNode => {\n const { renderMarkdown } = useMarkdownContext();\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n\n if (typeof editedContentContext !== 'string') {\n const transformedEditedContent = getContent(\n editedContentContext,\n {\n dictionaryKey,\n keyPath,\n },\n locale\n );\n\n if (typeof transformedEditedContent !== 'string') {\n console.error(\n `Incorrect Markdown content. Edited Markdown content type: ${typeof transformedEditedContent}. Expected string. Value ${JSON.stringify(transformedEditedContent)}`\n );\n\n return renderMarkdown(children);\n }\n\n return renderMarkdown(transformedEditedContent);\n }\n\n return renderMarkdown(editedContentContext);\n};\n\ntype MarkdownMetadataRendererProps = MarkdownRendererProps & {\n metadataKeyPath: KeyPath[];\n};\n\nexport const MarkdownMetadataRenderer: FC<MarkdownMetadataRendererProps> = ({\n dictionaryKey,\n keyPath,\n children,\n metadataKeyPath,\n}): ReactNode => {\n const editedContentContext = useEditedContentRenderer({\n dictionaryKey,\n keyPath,\n children,\n });\n const metadata = getMarkdownMetadata(editedContentContext);\n\n const metadataEl = getContentNodeByKeyPath(\n metadata as ContentNode,\n metadataKeyPath\n );\n\n return metadataEl as ReactNode;\n};\n"],"mappings":";AAGA;AAAA,EAEE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,SAAS,gCAAgC;AACzC,SAAS,0BAA0B;AAS5B,MAAM,mBAA8C,CAAC;AAAA,EAC1D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAiB;AACf,QAAM,EAAE,eAAe,IAAI,mBAAmB;AAC9C,QAAM,uBAAuB,yBAAyB;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AAED,MAAI,OAAO,yBAAyB,UAAU;AAC5C,UAAM,2BAA2B;AAAA,MAC/B;AAAA,MACA;AAAA,QACE;AAAA,QACA;AAAA,MACF;AAAA,MACA;AAAA,IACF;AAEA,QAAI,OAAO,6BAA6B,UAAU;AAChD,cAAQ;AAAA,QACN,6DAA6D,OAAO,wBAAwB,4BAA4B,KAAK,UAAU,wBAAwB,CAAC;AAAA,MAClK;AAEA,aAAO,eAAe,QAAQ;AAAA,IAChC;AAEA,WAAO,eAAe,wBAAwB;AAAA,EAChD;AAEA,SAAO,eAAe,oBAAoB;AAC5C;AAMO,MAAM,2BAA8D,CAAC;AAAA,EAC1E;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAiB;AACf,QAAM,uBAAuB,yBAAyB;AAAA,IACpD;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACD,QAAM,WAAW,oBAAoB,oBAAoB;AAEzD,QAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,EACF;AAEA,SAAO;AACT;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAI7D,OAAO,EACL,KAAK,EAAE,EACP,KAAK,iBAAiB,EAGvB,MAAM,OAAO,CAAC;AAIf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,aAAa,CAAC;IACtB,SAAS,EAAE,CAAC,SAAS,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,wCAIhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,qBAA0C,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC;IACpD,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,aAAa,CAAC,EAAE,aAAa,CAAC;IAC9B,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IAC5C,aAAa,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,uBAAuB,EAAE,EAAE,CAAC,qBAAqB,CA8C7D,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAItD,CAAC"}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { Locales } from '@intlayer/config/client';
|
|
2
|
+
import { type KeyPath } from '@intlayer/core';
|
|
1
3
|
import type { FC } from 'react';
|
|
2
|
-
import type { KeyPath } from '@intlayer/core';
|
|
3
4
|
type EditedContentRendererProps = {
|
|
4
5
|
dictionaryKey: string;
|
|
5
6
|
keyPath: KeyPath[];
|
|
6
7
|
children: string;
|
|
7
8
|
renderChildren?: (children: any) => any;
|
|
9
|
+
locale?: Locales;
|
|
8
10
|
};
|
|
9
11
|
export declare const useEditedContentRenderer: ({ dictionaryKey, keyPath, children, }: EditedContentRendererProps) => string;
|
|
10
12
|
export declare const EditedContentRenderer: FC<EditedContentRendererProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useEditedContentRenderer.d.ts","sourceRoot":"","sources":["../../../src/editor/useEditedContentRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"useEditedContentRenderer.d.ts","sourceRoot":"","sources":["../../../src/editor/useEditedContentRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAc,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE1D,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhC,KAAK,0BAA0B,GAAG;IAChC,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,CAAC,QAAQ,EAAE,GAAG,KAAK,GAAG,CAAC;IACxC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,wBAAwB,GAAI,uCAItC,0BAA0B,WAe5B,CAAC;AAEF,eAAO,MAAM,qBAAqB,EAAE,EAAE,CAAC,0BAA0B,CAoBhE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { LocalesValues } from '@intlayer/config/client';
|
|
2
2
|
import { KeyPath } from '@intlayer/core';
|
|
3
|
-
import {
|
|
3
|
+
import type { FC } from 'react';
|
|
4
4
|
type MarkdownRendererProps = {
|
|
5
5
|
dictionaryKey: string;
|
|
6
6
|
keyPath: KeyPath[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/markdown/MarkdownRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"MarkdownRenderer.d.ts","sourceRoot":"","sources":["../../../src/markdown/MarkdownRenderer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAKL,OAAO,EACR,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,EAAE,EAAa,MAAM,OAAO,CAAC;AAI3C,KAAK,qBAAqB,GAAG;IAC3B,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,MAAM,CAAC,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAmCtD,CAAC;AAEF,KAAK,6BAA6B,GAAG,qBAAqB,GAAG;IAC3D,eAAe,EAAE,OAAO,EAAE,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CAmBtE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-intlayer",
|
|
3
|
-
"version": "5.3.
|
|
3
|
+
"version": "5.3.12",
|
|
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/
|
|
73
|
-
"@intlayer/
|
|
74
|
-
"@intlayer/
|
|
75
|
-
"@intlayer/
|
|
76
|
-
"@intlayer/
|
|
72
|
+
"@intlayer/core": "5.3.12",
|
|
73
|
+
"@intlayer/dictionaries-entry": "5.3.12",
|
|
74
|
+
"@intlayer/config": "5.3.12",
|
|
75
|
+
"@intlayer/api": "5.3.12",
|
|
76
|
+
"@intlayer/editor-react": "5.3.12"
|
|
77
77
|
},
|
|
78
78
|
"devDependencies": {
|
|
79
79
|
"@craco/types": "^7.1.0",
|
|
@@ -91,19 +91,19 @@
|
|
|
91
91
|
"typescript": "^5.8.2",
|
|
92
92
|
"@utils/eslint-config": "1.0.4",
|
|
93
93
|
"@utils/ts-config": "1.0.4",
|
|
94
|
-
"@utils/tsup-config": "1.0.4",
|
|
95
94
|
"@utils/ts-config-types": "1.0.4",
|
|
96
|
-
"@
|
|
95
|
+
"@utils/tsup-config": "1.0.4",
|
|
96
|
+
"@intlayer/backend": "5.3.12"
|
|
97
97
|
},
|
|
98
98
|
"peerDependencies": {
|
|
99
99
|
"react": ">=16.0.0",
|
|
100
100
|
"react-dom": ">=16.0.0",
|
|
101
|
-
"@intlayer/api": "5.3.
|
|
102
|
-
"@intlayer/config": "5.3.
|
|
103
|
-
"@intlayer/
|
|
104
|
-
"@intlayer/editor-react": "5.3.
|
|
105
|
-
"intlayer": "5.3.
|
|
106
|
-
"
|
|
101
|
+
"@intlayer/api": "5.3.12",
|
|
102
|
+
"@intlayer/config": "5.3.12",
|
|
103
|
+
"@intlayer/core": "5.3.12",
|
|
104
|
+
"@intlayer/editor-react": "5.3.12",
|
|
105
|
+
"@intlayer/dictionaries-entry": "5.3.12",
|
|
106
|
+
"intlayer": "5.3.12"
|
|
107
107
|
},
|
|
108
108
|
"engines": {
|
|
109
109
|
"node": ">=14.18"
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
"use client";
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __export = (target, all) => {
|
|
8
|
-
for (var name in all)
|
|
9
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
-
};
|
|
11
|
-
var __copyProps = (to, from, except, desc) => {
|
|
12
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
-
for (let key of __getOwnPropNames(from))
|
|
14
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
-
}
|
|
17
|
-
return to;
|
|
18
|
-
};
|
|
19
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
-
var PoweredByMeta_exports = {};
|
|
21
|
-
__export(PoweredByMeta_exports, {
|
|
22
|
-
PoweredByMeta: () => PoweredByMeta
|
|
23
|
-
});
|
|
24
|
-
module.exports = __toCommonJS(PoweredByMeta_exports);
|
|
25
|
-
var import_react = require("react");
|
|
26
|
-
const PoweredByMeta = () => {
|
|
27
|
-
if (process.env.NODE_ENV !== "production") return null;
|
|
28
|
-
(0, import_react.useEffect)(() => {
|
|
29
|
-
const existingMeta = document.head.querySelector(
|
|
30
|
-
'meta[name="content-powered-by"]'
|
|
31
|
-
);
|
|
32
|
-
if (!existingMeta) {
|
|
33
|
-
const metaTag = document.createElement("meta");
|
|
34
|
-
metaTag.name = "content-powered-by";
|
|
35
|
-
metaTag.content = "Intlayer - https://intlayer.org";
|
|
36
|
-
document.head.appendChild(metaTag);
|
|
37
|
-
}
|
|
38
|
-
}, []);
|
|
39
|
-
return null;
|
|
40
|
-
};
|
|
41
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
42
|
-
0 && (module.exports = {
|
|
43
|
-
PoweredByMeta
|
|
44
|
-
});
|
|
45
|
-
//# sourceMappingURL=PoweredByMeta.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/PoweredByMeta.ts"],"sourcesContent":["'use client';\n\nimport { type FC, useEffect } from 'react';\n\nexport const PoweredByMeta: FC = () => {\n if (process.env.NODE_ENV !== 'production') return null;\n\n useEffect(() => {\n // Check if the meta tag already exists\n const existingMeta = document.head.querySelector(\n 'meta[name=\"content-powered-by\"]'\n );\n\n if (!existingMeta) {\n const metaTag = document.createElement('meta');\n metaTag.name = 'content-powered-by';\n metaTag.content = 'Intlayer - https://intlayer.org';\n document.head.appendChild(metaTag);\n }\n }, []);\n\n return null; // This component does not render anything visible\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,mBAAmC;AAE5B,MAAM,gBAAoB,MAAM;AACrC,MAAI,QAAQ,IAAI,aAAa,aAAc,QAAO;AAElD,8BAAU,MAAM;AAEd,UAAM,eAAe,SAAS,KAAK;AAAA,MACjC;AAAA,IACF;AAEA,QAAI,CAAC,cAAc;AACjB,YAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,cAAQ,OAAO;AACf,cAAQ,UAAU;AAClB,eAAS,KAAK,YAAY,OAAO;AAAA,IACnC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;","names":[]}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
"use client";
|
|
2
|
-
import { useEffect } from "react";
|
|
3
|
-
const PoweredByMeta = () => {
|
|
4
|
-
if (process.env.NODE_ENV !== "production") return null;
|
|
5
|
-
useEffect(() => {
|
|
6
|
-
const existingMeta = document.head.querySelector(
|
|
7
|
-
'meta[name="content-powered-by"]'
|
|
8
|
-
);
|
|
9
|
-
if (!existingMeta) {
|
|
10
|
-
const metaTag = document.createElement("meta");
|
|
11
|
-
metaTag.name = "content-powered-by";
|
|
12
|
-
metaTag.content = "Intlayer - https://intlayer.org";
|
|
13
|
-
document.head.appendChild(metaTag);
|
|
14
|
-
}
|
|
15
|
-
}, []);
|
|
16
|
-
return null;
|
|
17
|
-
};
|
|
18
|
-
export {
|
|
19
|
-
PoweredByMeta
|
|
20
|
-
};
|
|
21
|
-
//# sourceMappingURL=PoweredByMeta.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/client/PoweredByMeta.ts"],"sourcesContent":["'use client';\n\nimport { type FC, useEffect } from 'react';\n\nexport const PoweredByMeta: FC = () => {\n if (process.env.NODE_ENV !== 'production') return null;\n\n useEffect(() => {\n // Check if the meta tag already exists\n const existingMeta = document.head.querySelector(\n 'meta[name=\"content-powered-by\"]'\n );\n\n if (!existingMeta) {\n const metaTag = document.createElement('meta');\n metaTag.name = 'content-powered-by';\n metaTag.content = 'Intlayer - https://intlayer.org';\n document.head.appendChild(metaTag);\n }\n }, []);\n\n return null; // This component does not render anything visible\n};\n"],"mappings":";AAEA,SAAkB,iBAAiB;AAE5B,MAAM,gBAAoB,MAAM;AACrC,MAAI,QAAQ,IAAI,aAAa,aAAc,QAAO;AAElD,YAAU,MAAM;AAEd,UAAM,eAAe,SAAS,KAAK;AAAA,MACjC;AAAA,IACF;AAEA,QAAI,CAAC,cAAc;AACjB,YAAM,UAAU,SAAS,cAAc,MAAM;AAC7C,cAAQ,OAAO;AACf,cAAQ,UAAU;AAClB,eAAS,KAAK,YAAY,OAAO;AAAA,IACnC;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,SAAO;AACT;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PoweredByMeta.d.ts","sourceRoot":"","sources":["../../../src/client/PoweredByMeta.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAE,EAAa,MAAM,OAAO,CAAC;AAE3C,eAAO,MAAM,aAAa,EAAE,EAkB3B,CAAC"}
|