react-intlayer 4.0.3 → 4.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/cjs/UI/ContentSelector.cjs +2 -2
  2. package/dist/cjs/UI/ContentSelector.cjs.map +1 -1
  3. package/dist/cjs/client/IntlayerProvider.cjs +11 -5
  4. package/dist/cjs/client/IntlayerProvider.cjs.map +1 -1
  5. package/dist/cjs/client/PoweredByMeta.cjs +9 -4
  6. package/dist/cjs/client/PoweredByMeta.cjs.map +1 -1
  7. package/dist/cjs/editor/ContentSelectorWrapper.cjs +13 -3
  8. package/dist/cjs/editor/ContentSelectorWrapper.cjs.map +1 -1
  9. package/dist/cjs/editor/IntlayerEditorProvider.cjs +61 -7
  10. package/dist/cjs/editor/IntlayerEditorProvider.cjs.map +1 -1
  11. package/dist/cjs/editor/renderContentEditor.cjs +3 -23
  12. package/dist/cjs/editor/renderContentEditor.cjs.map +1 -1
  13. package/dist/cjs/getDictionary.cjs +4 -31
  14. package/dist/cjs/getDictionary.cjs.map +1 -1
  15. package/dist/cjs/getIntlayer.cjs +2 -2
  16. package/dist/cjs/getIntlayer.cjs.map +1 -1
  17. package/dist/cjs/getIntlayerAsync.cjs +2 -2
  18. package/dist/cjs/getIntlayerAsync.cjs.map +1 -1
  19. package/dist/cjs/recursiveTransformContent.cjs +54 -0
  20. package/dist/cjs/recursiveTransformContent.cjs.map +1 -0
  21. package/dist/esm/UI/ContentSelector.mjs +2 -2
  22. package/dist/esm/UI/ContentSelector.mjs.map +1 -1
  23. package/dist/esm/client/IntlayerProvider.mjs +13 -8
  24. package/dist/esm/client/IntlayerProvider.mjs.map +1 -1
  25. package/dist/esm/client/PoweredByMeta.mjs +9 -4
  26. package/dist/esm/client/PoweredByMeta.mjs.map +1 -1
  27. package/dist/esm/client/index.mjs +10 -10
  28. package/dist/esm/client/t.mjs +2 -2
  29. package/dist/esm/client/useContent.mjs +2 -2
  30. package/dist/esm/client/useDictionary.mjs +2 -2
  31. package/dist/esm/client/useIntlayer.mjs +2 -2
  32. package/dist/esm/client/useIntlayerAsync.mjs +3 -3
  33. package/dist/esm/client/useLocale.mjs +2 -2
  34. package/dist/esm/client/useLocaleBase.mjs +1 -1
  35. package/dist/esm/client/useTraduction.mjs +2 -2
  36. package/dist/esm/editor/ContentSelectorWrapper.mjs +19 -8
  37. package/dist/esm/editor/ContentSelectorWrapper.mjs.map +1 -1
  38. package/dist/esm/editor/IntlayerEditorProvider.mjs +60 -9
  39. package/dist/esm/editor/IntlayerEditorProvider.mjs.map +1 -1
  40. package/dist/esm/editor/index.mjs +2 -2
  41. package/dist/esm/editor/renderContentEditor.mjs +6 -24
  42. package/dist/esm/editor/renderContentEditor.mjs.map +1 -1
  43. package/dist/esm/getDictionary.mjs +4 -30
  44. package/dist/esm/getDictionary.mjs.map +1 -1
  45. package/dist/esm/getIntlayer.mjs +2 -2
  46. package/dist/esm/getIntlayer.mjs.map +1 -1
  47. package/dist/esm/getIntlayerAsync.mjs +2 -2
  48. package/dist/esm/getIntlayerAsync.mjs.map +1 -1
  49. package/dist/esm/index.mjs +4 -4
  50. package/dist/esm/processDictionary/index.mjs +2 -2
  51. package/dist/esm/recursiveTransformContent.mjs +32 -0
  52. package/dist/esm/recursiveTransformContent.mjs.map +1 -0
  53. package/dist/esm/server/IntlayerServerProvider.mjs +1 -1
  54. package/dist/esm/server/getLocaleTranslation.mjs +2 -2
  55. package/dist/esm/server/index.mjs +6 -6
  56. package/dist/esm/server/t.mjs +3 -3
  57. package/dist/esm/server/useDictionary.mjs +3 -3
  58. package/dist/esm/server/useIntlayer.mjs +3 -3
  59. package/dist/esm/server/useTraduction.mjs +3 -3
  60. package/dist/types/client/IntlayerProvider.d.ts +0 -3
  61. package/dist/types/client/IntlayerProvider.d.ts.map +1 -1
  62. package/dist/types/client/PoweredByMeta.d.ts.map +1 -1
  63. package/dist/types/editor/ContentSelectorWrapper.d.ts.map +1 -1
  64. package/dist/types/editor/IntlayerEditorProvider.d.ts +1 -1
  65. package/dist/types/editor/IntlayerEditorProvider.d.ts.map +1 -1
  66. package/dist/types/editor/renderContentEditor.d.ts +5 -9
  67. package/dist/types/editor/renderContentEditor.d.ts.map +1 -1
  68. package/dist/types/getDictionary.d.ts +3 -25
  69. package/dist/types/getDictionary.d.ts.map +1 -1
  70. package/dist/types/getIntlayer.d.ts +3 -3
  71. package/dist/types/getIntlayer.d.ts.map +1 -1
  72. package/dist/types/getIntlayerAsync.d.ts.map +1 -1
  73. package/dist/types/recursiveTransformContent.d.ts +27 -0
  74. package/dist/types/recursiveTransformContent.d.ts.map +1 -0
  75. package/package.json +16 -15
  76. package/dist/cjs/UI/PressableSpan/index.cjs +0 -23
  77. package/dist/cjs/UI/PressableSpan/index.cjs.map +0 -1
  78. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs +0 -59
  79. package/dist/cjs/distantDictionary/fetchDistantDictionary.cjs.map +0 -1
  80. package/dist/esm/UI/PressableSpan/index.mjs +0 -2
  81. package/dist/esm/UI/PressableSpan/index.mjs.map +0 -1
  82. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs +0 -35
  83. package/dist/esm/distantDictionary/fetchDistantDictionary.mjs.map +0 -1
  84. package/dist/types/UI/PressableSpan/index.d.ts +0 -2
  85. package/dist/types/UI/PressableSpan/index.d.ts.map +0 -1
  86. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts +0 -6
  87. package/dist/types/distantDictionary/fetchDistantDictionary.d.ts.map +0 -1
@@ -0,0 +1,32 @@
1
+ import { isValidElement } from "react";
2
+ import {
3
+ renderIntlayerEditor
4
+ } from "./editor/renderContentEditor.mjs";
5
+ const recursiveTransformContent = (value, isRenderEditor = false) => {
6
+ if (typeof value === "function") {
7
+ return (props) => recursiveTransformContent(value(props), isRenderEditor);
8
+ } else if (typeof value === "object") {
9
+ if (typeof value.dictionaryKey !== "undefined") {
10
+ if (isRenderEditor) {
11
+ return renderIntlayerEditor(value);
12
+ }
13
+ return value.content;
14
+ } else if (Array.isArray(value)) {
15
+ return value.map((el) => recursiveTransformContent(el, isRenderEditor));
16
+ } else if (isValidElement(value)) {
17
+ return value;
18
+ }
19
+ return Object.entries(value).reduce(
20
+ (acc, [key, value2]) => ({
21
+ ...acc,
22
+ [key]: recursiveTransformContent(value2, isRenderEditor)
23
+ }),
24
+ {}
25
+ );
26
+ }
27
+ return value;
28
+ };
29
+ export {
30
+ recursiveTransformContent
31
+ };
32
+ //# sourceMappingURL=recursiveTransformContent.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/recursiveTransformContent.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { Locales } from '@intlayer/config';\nimport type { NodeType } from '@intlayer/core';\nimport { isValidElement, type ReactNode } from 'react';\nimport {\n type IntlayerNode,\n renderIntlayerEditor,\n} from './editor/renderContentEditor';\n\ntype TransformNodeType<T, L extends Locales, R extends boolean> = T extends {\n [NodeType.Enumeration]: { '1': any };\n}\n ? (\n quantity: number\n ) => DeepTransformContent<T[NodeType.Enumeration]['1'], L, R>\n : T extends {\n [NodeType.Translation]: object;\n }\n ? L extends keyof T[NodeType.Translation]\n ? DeepTransformContent<T[NodeType.Translation][L], L, R>\n : never\n : T;\n\nexport type DeepTransformContent<\n T,\n L extends Locales,\n R extends boolean,\n> = T extends object // Check if the property is an object\n ? T extends (infer U)[] // If it's an array, infer the type of array elements\n ? DeepTransformContent<U, L, R>[] // Apply DeepTransformContent recursively to each element of the array\n : T extends {\n nodeType: NodeType | string;\n }\n ? TransformNodeType<T, L, R>\n : T extends { _owner: any; key: any; props: any; ref: any }\n ? ReactNode\n : {\n [K in keyof T]: DeepTransformContent<T[K], L, R>;\n }\n : T extends undefined\n ? never\n : R extends true\n ? IntlayerNode<T>\n : T;\n\n/**\n * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.\n */\nexport const recursiveTransformContent = (\n value: any,\n isRenderEditor = false\n): object => {\n if (typeof value === 'function') {\n return (props: any) =>\n recursiveTransformContent(value(props), isRenderEditor);\n } else if (typeof value === 'object') {\n if (typeof value.dictionaryKey !== 'undefined') {\n if (isRenderEditor) {\n return renderIntlayerEditor(value);\n }\n return value.content;\n } else if (Array.isArray(value)) {\n return value.map((el) => recursiveTransformContent(el, isRenderEditor));\n } else if (isValidElement(value)) {\n return value;\n }\n\n return Object.entries(value).reduce(\n (acc, [key, value]) => ({\n ...acc,\n [key]: recursiveTransformContent(value, isRenderEditor),\n }),\n {} as object\n );\n }\n\n return value;\n};\n"],"mappings":"AAGA,SAAS,sBAAsC;AAC/C;AAAA,EAEE;AAAA,OACK;AAyCA,MAAM,4BAA4B,CACvC,OACA,iBAAiB,UACN;AACX,MAAI,OAAO,UAAU,YAAY;AAC/B,WAAO,CAAC,UACN,0BAA0B,MAAM,KAAK,GAAG,cAAc;AAAA,EAC1D,WAAW,OAAO,UAAU,UAAU;AACpC,QAAI,OAAO,MAAM,kBAAkB,aAAa;AAC9C,UAAI,gBAAgB;AAClB,eAAO,qBAAqB,KAAK;AAAA,MACnC;AACA,aAAO,MAAM;AAAA,IACf,WAAW,MAAM,QAAQ,KAAK,GAAG;AAC/B,aAAO,MAAM,IAAI,CAAC,OAAO,0BAA0B,IAAI,cAAc,CAAC;AAAA,IACxE,WAAW,eAAe,KAAK,GAAG;AAChC,aAAO;AAAA,IACT;AAEA,WAAO,OAAO,QAAQ,KAAK,EAAE;AAAA,MAC3B,CAAC,KAAK,CAAC,KAAKA,MAAK,OAAO;AAAA,QACtB,GAAG;AAAA,QACH,CAAC,GAAG,GAAG,0BAA0BA,QAAO,cAAc;AAAA,MACxD;AAAA,MACA,CAAC;AAAA,IACH;AAAA,EACF;AAEA,SAAO;AACT;","names":["value"]}
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { getConfiguration } from "@intlayer/config/client";
3
- import { createServerContext, getServerContext } from './serverContext.mjs';
3
+ import { createServerContext, getServerContext } from "./serverContext.mjs";
4
4
  const { defaultLocale } = getConfiguration().internationalization;
5
5
  const IntlayerServerContext = createServerContext(defaultLocale);
6
6
  const useIntlayer = () => getServerContext(IntlayerServerContext);
@@ -1,7 +1,7 @@
1
1
  import { getConfiguration } from "@intlayer/config/client";
2
2
  import { getTranslationContent } from "@intlayer/core";
3
- import { IntlayerServerContext } from './IntlayerServerProvider.mjs';
4
- import { getServerContext } from './serverContext.mjs';
3
+ import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
4
+ import { getServerContext } from "./serverContext.mjs";
5
5
  const getLocaleTranslation = (languageContent) => {
6
6
  const locale = getServerContext(IntlayerServerContext);
7
7
  const content = getTranslationContent(
@@ -1,13 +1,13 @@
1
- import { getLocaleTranslation } from './getLocaleTranslation.mjs';
2
- import { useTraduction } from './useTraduction.mjs';
1
+ import { getLocaleTranslation } from "./getLocaleTranslation.mjs";
2
+ import { useTraduction } from "./useTraduction.mjs";
3
3
  import {
4
4
  IntlayerServerContext,
5
5
  locale,
6
6
  IntlayerServerProvider
7
- } from './IntlayerServerProvider.mjs';
8
- import { useIntlayer } from './useIntlayer.mjs';
9
- import { useDictionary } from './useDictionary.mjs';
10
- import { t } from './t.mjs';
7
+ } from "./IntlayerServerProvider.mjs";
8
+ import { useIntlayer } from "./useIntlayer.mjs";
9
+ import { useDictionary } from "./useDictionary.mjs";
10
+ import { t } from "./t.mjs";
11
11
  export {
12
12
  IntlayerServerContext as IntlayerServer,
13
13
  IntlayerServerProvider,
@@ -1,6 +1,6 @@
1
- import { getTranslation } from '../getTranslation.mjs';
2
- import { IntlayerServerContext } from './IntlayerServerProvider.mjs';
3
- import { getServerContext } from './serverContext.mjs';
1
+ import { getTranslation } from "../getTranslation.mjs";
2
+ import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
3
+ import { getServerContext } from "./serverContext.mjs";
4
4
  const t = (multilangContent, locale) => {
5
5
  const currentLocale = getServerContext(IntlayerServerContext);
6
6
  const localeTarget = locale ?? currentLocale;
@@ -1,6 +1,6 @@
1
- import { getDictionary } from '../getDictionary.mjs';
2
- import { IntlayerServerContext } from './IntlayerServerProvider.mjs';
3
- import { getServerContext } from './serverContext.mjs';
1
+ import { getDictionary } from "../getDictionary.mjs";
2
+ import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
3
+ import { getServerContext } from "./serverContext.mjs";
4
4
  const useDictionary = (dictionary, locale, isRenderEditor = false) => {
5
5
  const localeTarget = locale ?? getServerContext(IntlayerServerContext);
6
6
  return getDictionary(dictionary, localeTarget, isRenderEditor);
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  getIntlayer
3
- } from '../getIntlayer.mjs';
4
- import { IntlayerServerContext } from './IntlayerServerProvider.mjs';
5
- import { getServerContext } from './serverContext.mjs';
3
+ } from "../getIntlayer.mjs";
4
+ import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
5
+ import { getServerContext } from "./serverContext.mjs";
6
6
  const useIntlayer = (key, locale, isRenderEditor = true) => {
7
7
  const localeTarget = locale ?? getServerContext(IntlayerServerContext);
8
8
  return getIntlayer(key, localeTarget, isRenderEditor);
@@ -1,6 +1,6 @@
1
- import { getTranslation } from '../getTranslation.mjs';
2
- import { IntlayerServerContext } from './IntlayerServerProvider.mjs';
3
- import { getServerContext } from './serverContext.mjs';
1
+ import { getTranslation } from "../getTranslation.mjs";
2
+ import { IntlayerServerContext } from "./IntlayerServerProvider.mjs";
3
+ import { getServerContext } from "./serverContext.mjs";
4
4
  const useTraduction = (languageContent) => {
5
5
  const locale = getServerContext(IntlayerServerContext);
6
6
  return getTranslation(languageContent, locale);
@@ -16,9 +16,6 @@ export type IntlayerProviderProps = PropsWithChildren & {
16
16
  locale?: Locales;
17
17
  setLocale?: (locale: Locales) => void;
18
18
  };
19
- /**
20
- * Provider that store the current locale on the client side
21
- */
22
19
  export declare const IntlayerProvider: FC<IntlayerProviderProps>;
23
20
  export {};
24
21
  //# sourceMappingURL=IntlayerProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACzE,OAAO,EACL,KAAK,iBAAiB,EAItB,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAKf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,wCAGhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,qBAA0C,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAwCtD,CAAC"}
1
+ {"version":3,"file":"IntlayerProvider.d.ts","sourceRoot":"","sources":["../../../src/client/IntlayerProvider.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAoB,KAAK,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAEzE,OAAO,EACL,KAAK,iBAAiB,EAItB,KAAK,EAAE,EAGR,MAAM,OAAO,CAAC;AAKf,KAAK,aAAa,GAAG;IACnB,MAAM,EAAE,OAAO,CAAC;IAChB,SAAS,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,qBAAqB,wCAGhC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kBAAkB,qBAA0C,CAAC;AAE1E,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,GAAG;IACtD,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,CAAC;CACvC,CAAC;AAmDF,eAAO,MAAM,gBAAgB,EAAE,EAAE,CAAC,qBAAqB,CAItD,CAAC"}
@@ -1 +1 @@
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,EAW3B,CAAC"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAKL,KAAK,EAAE,EAEP,cAAc,EACf,MAAM,OAAO,CAAC;AAOf,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,WAAW,GACnD,cAAc,CAAC,cAAc,CAAC,CAAC;AAEjC,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAkDlE,CAAC"}
1
+ {"version":3,"file":"ContentSelectorWrapper.d.ts","sourceRoot":"","sources":["../../../src/editor/ContentSelectorWrapper.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAiB,KAAK,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAM7D,OAAO,EAKL,KAAK,EAAE,EAEP,cAAc,EACf,MAAM,OAAO,CAAC;AAGf,KAAK,WAAW,GAAG;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,WAAW,GACnD,cAAc,CAAC,cAAc,CAAC,CAAC;AAuDjC,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,2BAA2B,CAelE,CAAC"}
@@ -1,3 +1,3 @@
1
- import { FC, PropsWithChildren } from 'react';
1
+ import { type FC, type PropsWithChildren } from 'react';
2
2
  export declare const IntlayerEditorProvider: FC<PropsWithChildren>;
3
3
  //# sourceMappingURL=IntlayerEditorProvider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"IntlayerEditorProvider.d.ts","sourceRoot":"","sources":["../../../src/editor/IntlayerEditorProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAQ9C,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CAMxD,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;AA4CnE,eAAO,MAAM,sBAAsB,EAAE,EAAE,CAAC,iBAAiB,CA4BxD,CAAC"}
@@ -1,14 +1,10 @@
1
- import type { KeyPath } from '@intlayer/core';
2
1
  import type { ReactNode } from 'react';
3
- export type IntlayerEditorElementProps = {
4
- content: string;
5
- dictionaryKey: string;
6
- dictionaryPath: string;
7
- keyPath: KeyPath[];
8
- isContentSelectable: boolean;
9
- };
2
+ import { type ContentSelectorWrapperProps } from './ContentSelectorWrapper';
10
3
  export type IntlayerNode<T = string> = ReactNode & {
11
4
  value: T;
12
5
  };
13
- export declare const renderIntlayerEditor: (data: IntlayerEditorElementProps, isContentSelectable?: boolean) => IntlayerNode;
6
+ export type RenderIntlayerEditorProps = Omit<ContentSelectorWrapperProps, 'children'> & {
7
+ content: string;
8
+ };
9
+ export declare const renderIntlayerEditor: (props: RenderIntlayerEditorProps) => IntlayerNode;
14
10
  //# sourceMappingURL=renderContentEditor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"renderContentEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/renderContentEditor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EAAM,SAAS,EAAE,MAAM,OAAO,CAAC;AAO3C,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,OAAO,EAAE,CAAC;IACnB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAeF,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,MAAM,IAAI,SAAS,GAAG;IACjD,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,eAAO,MAAM,oBAAoB,SACzB,0BAA0B,oCAE/B,YASF,CAAC"}
1
+ {"version":3,"file":"renderContentEditor.d.ts","sourceRoot":"","sources":["../../../src/editor/renderContentEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAEL,KAAK,2BAA2B,EACjC,MAAM,0BAA0B,CAAC;AAElC,MAAM,MAAM,YAAY,CAAC,CAAC,GAAG,MAAM,IAAI,SAAS,GAAG;IACjD,KAAK,EAAE,CAAC,CAAC;CACV,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,2BAA2B,EAC3B,UAAU,CACX,GAAG;IACF,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,eAAO,MAAM,oBAAoB,UACxB,yBAAyB,KAC/B,YAMF,CAAC"}
@@ -1,30 +1,8 @@
1
1
  import type { Locales } from '@intlayer/config';
2
- import type { DeclarationContent, NodeType } from '@intlayer/core';
3
- import { type ReactNode } from 'react';
4
- import { type IntlayerNode } from './editor/renderContentEditor';
5
- type TransformNodeType<T, L extends Locales, R extends boolean> = T extends {
6
- [NodeType.Enumeration]: {
7
- '1': any;
8
- };
9
- } ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration]['1'], L, R> : T extends {
10
- [NodeType.Translation]: object;
11
- } ? L extends keyof T[NodeType.Translation] ? DeepTransformContent<T[NodeType.Translation][L], L, R> : never : T;
12
- export type DeepTransformContent<T, L extends Locales, R extends boolean> = T extends object ? T extends (infer U)[] ? DeepTransformContent<U, L, R>[] : T extends {
13
- nodeType: NodeType | string;
14
- } ? TransformNodeType<T, L, R> : T extends {
15
- _owner: any;
16
- key: any;
17
- props: any;
18
- ref: any;
19
- } ? ReactNode : {
20
- [K in keyof T]: DeepTransformContent<T[K], L, R>;
21
- } : T extends undefined ? never : R extends true ? IntlayerNode<T> : T;
22
- /**
23
- * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.
24
- */
25
- export declare const recursiveTransformContent: (value: any, isRenderEditor?: boolean) => object;
2
+ import type { DeclarationContent } from '@intlayer/core';
3
+ import { DeepTransformContent } from './recursiveTransformContent';
26
4
  type DataFromDictionary<T extends DeclarationContent, K extends Locales, R extends boolean = false> = DeepTransformContent<T['content'], K, R>;
27
- export type UseDictionary = <T extends DeclarationContent, L extends Locales, R extends boolean = false>(dictionary: T, locale?: L, isRenderEditor?: R) => DataFromDictionary<T, L, R>;
5
+ export type UseDictionary = <T extends DeclarationContent, L extends Locales, R extends boolean = false>(dictionary: T, locale?: L, isRenderEditor?: R, isContentSelectable?: boolean) => DataFromDictionary<T, L, R>;
28
6
  /**
29
7
  * Hook that picks one dictionary by its id and return the content
30
8
  *
@@ -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6B,CAAC;AAErC,KAAK,kBAAkB,CACrB,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,GAAG,KAAK,IACvB,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE7C,MAAM,MAAM,aAAa,GAAG,CAC1B,CAAC,SAAS,kBAAkB,EAC5B,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,GAAG,KAAK,EAEzB,UAAU,EAAE,CAAC,EACb,MAAM,CAAC,EAAE,CAAC,EACV,cAAc,CAAC,EAAE,CAAC,EAClB,mBAAmB,CAAC,EAAE,OAAO,KAC1B,kBAAkB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEjC;;;;GAIG;AACH,eAAO,MAAM,aAAa,EAAE,aAqB3B,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { Locales } from '@intlayer/config';
2
2
  import type { IntlayerDictionaryTypesConnector } from 'intlayer';
3
- import { type DeepTransformContent } from './getDictionary';
3
+ import { type DeepTransformContent } from './recursiveTransformContent';
4
4
  /**
5
5
  * Provides a fallback to string type if the generic type T is never,
6
6
  * otherwise returns T. This is useful for handling cases where no keys are found.
@@ -29,7 +29,7 @@ export type DataFromDictionaryKey<T extends DictionaryKeys, K extends Locales, R
29
29
  * and returns the deeply transformed dictionary content.
30
30
  *
31
31
  */
32
- export type UseIntlayer = <T extends DictionaryKeys, L extends Locales, R extends boolean = false>(key: T, locale?: L, isRenderEditor?: R) => DataFromDictionaryKey<T, L, R>;
33
- export type UseIntlayerEditable = <T extends DictionaryKeys, L extends Locales, R extends boolean = true>(key: T, locale?: L, isRenderEditor?: R) => DataFromDictionaryKey<T, L, R>;
32
+ export type UseIntlayer = <T extends DictionaryKeys, L extends Locales, R extends boolean = false>(key: T, locale?: L, isRenderEditor?: R, isContentSelectable?: boolean) => DataFromDictionaryKey<T, L, R>;
33
+ export type UseIntlayerEditable = <T extends DictionaryKeys, L extends Locales, R extends boolean = true>(key: T, locale?: L, isRenderEditor?: R, isContentSelectable?: boolean) => DataFromDictionaryKey<T, L, R>;
34
34
  export declare const getIntlayer: UseIntlayer;
35
35
  //# sourceMappingURL=getIntlayer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayer.d.ts","sourceRoot":"","sources":["../../src/getIntlayer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAQhD,OAAO,KAAK,EAAE,gCAAgC,EAAE,MAAM,UAAU,CAAC;AACjE,OAAO,EACL,KAAK,oBAAoB,EAE1B,MAAM,iBAAiB,CAAC;AAGzB;;;;GAIG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,GAAG,MAAM,GAAG,CAAC,CAAC;AAE7D;;;;;;;;;;GAUG;AACH,MAAM,MAAM,cAAc,GAAG,cAAc,CACzC,MAAM,gCAAgC,CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,CAC/B,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,GAAG,KAAK,IACvB,oBAAoB,CAAC,gCAAgC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAE/E;;;;GAIG;AACH,MAAM,MAAM,WAAW,GAAG,CACxB,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,GAAG,KAAK,EAEzB,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,CAAC,EACV,cAAc,CAAC,EAAE,CAAC,KACf,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG,CAChC,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,EACjB,C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GAAG,CAChC,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,GAAG,IAAI,EAExB,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,CAAC,EACV,cAAc,CAAC,EAAE,CAAC,EAClB,mBAAmB,CAAC,EAAE,OAAO,KAC1B,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAEpC,eAAO,MAAM,WAAW,EAAE,WA2BzB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"getIntlayerAsync.d.ts","sourceRoot":"","sources":["../../src/getIntlayerAsync.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAIvD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,CAC7B,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,GAAG,IAAI,EAExB,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,CAAC,EACV,cAAc,CAAC,EAAE,CAAC,KACf,OAAO,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAoB9B,CAAC"}
1
+ {"version":3,"file":"getIntlayerAsync.d.ts","sourceRoot":"","sources":["../../src/getIntlayerAsync.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AAGvD,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG,CAC7B,CAAC,SAAS,cAAc,EACxB,CAAC,SAAS,OAAO,EACjB,CAAC,SAAS,OAAO,GAAG,IAAI,EAExB,GAAG,EAAE,CAAC,EACN,MAAM,CAAC,EAAE,CAAC,EACV,cAAc,CAAC,EAAE,CAAC,KACf,OAAO,CAAC,qBAAqB,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;AAEpD;;;;;;;GAOG;AACH,eAAO,MAAM,gBAAgB,EAAE,gBAoB9B,CAAC"}
@@ -0,0 +1,27 @@
1
+ import type { Locales } from '@intlayer/config';
2
+ import type { NodeType } from '@intlayer/core';
3
+ import { type ReactNode } from 'react';
4
+ import { type IntlayerNode } from './editor/renderContentEditor';
5
+ type TransformNodeType<T, L extends Locales, R extends boolean> = T extends {
6
+ [NodeType.Enumeration]: {
7
+ '1': any;
8
+ };
9
+ } ? (quantity: number) => DeepTransformContent<T[NodeType.Enumeration]['1'], L, R> : T extends {
10
+ [NodeType.Translation]: object;
11
+ } ? L extends keyof T[NodeType.Translation] ? DeepTransformContent<T[NodeType.Translation][L], L, R> : never : T;
12
+ export type DeepTransformContent<T, L extends Locales, R extends boolean> = T extends object ? T extends (infer U)[] ? DeepTransformContent<U, L, R>[] : T extends {
13
+ nodeType: NodeType | string;
14
+ } ? TransformNodeType<T, L, R> : T extends {
15
+ _owner: any;
16
+ key: any;
17
+ props: any;
18
+ ref: any;
19
+ } ? ReactNode : {
20
+ [K in keyof T]: DeepTransformContent<T[K], L, R>;
21
+ } : T extends undefined ? never : R extends true ? IntlayerNode<T> : T;
22
+ /**
23
+ * Go through the object. If a object has a keyPath, render the intlayer editor if editor enabled.
24
+ */
25
+ export declare const recursiveTransformContent: (value: any, isRenderEditor?: boolean) => object;
26
+ export {};
27
+ //# sourceMappingURL=recursiveTransformContent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"recursiveTransformContent.d.ts","sourceRoot":"","sources":["../../src/recursiveTransformContent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,QAAQ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ACvD,SAAS,GACT;KACG,CAAC,IAAI,MAAM,CAAC,GAAG,oBAAoB,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC;CACjD,GACP,CAAC,SAAS,SAAS,GACjB,KAAK,GACL,CAAC,SAAS,IAAI,GACZ,YAAY,CAAC,CAAC,CAAC,GACf,CAAC,CAAC;AAEV;;GAEG;AACH,eAAO,MAAM,yBAAyB,UAC7B,GAAG,+BAET,MA0BF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-intlayer",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
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/core": "4.0.3",
75
- "@intlayer/config": "4.0.3",
76
- "@intlayer/dictionaries-entry": "4.0.3",
77
- "@intlayer/api": "4.0.3",
78
- "@intlayer/editor-react": "4.0.3"
74
+ "@intlayer/api": "4.0.5",
75
+ "@intlayer/editor-react": "4.0.5",
76
+ "@intlayer/config": "4.0.5",
77
+ "@intlayer/dictionaries-entry": "4.0.5",
78
+ "@intlayer/core": "4.0.5"
79
79
  },
80
80
  "devDependencies": {
81
81
  "@craco/types": "^7.1.0",
@@ -92,21 +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.3",
96
- "@utils/ts-config": "1.0.4",
95
+ "@intlayer/backend": "4.0.5",
97
96
  "@utils/eslint-config": "1.0.4",
98
- "@utils/tsup-config": "1.0.4",
99
- "@utils/ts-config-types": "1.0.4"
97
+ "@utils/ts-config": "1.0.4",
98
+ "@utils/ts-config-types": "1.0.4",
99
+ "@utils/tsup-config": "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/config": "4.0.3",
106
- "@intlayer/dictionaries-entry": "4.0.3",
107
- "@intlayer/core": "4.0.3",
108
- "intlayer": "4.0.3",
109
- "@intlayer/editor-react": "4.0.3"
105
+ "@intlayer/api": "4.0.5",
106
+ "@intlayer/config": "4.0.5",
107
+ "@intlayer/core": "4.0.5",
108
+ "@intlayer/dictionaries-entry": "4.0.5",
109
+ "intlayer": "4.0.5",
110
+ "@intlayer/editor-react": "4.0.5"
110
111
  },
111
112
  "engines": {
112
113
  "node": ">=14.18"
@@ -1,23 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __copyProps = (to, from, except, desc) => {
7
- if (from && typeof from === "object" || typeof from === "function") {
8
- for (let key of __getOwnPropNames(from))
9
- if (!__hasOwnProp.call(to, key) && key !== except)
10
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
11
- }
12
- return to;
13
- };
14
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
15
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
16
- var PressableSpan_exports = {};
17
- module.exports = __toCommonJS(PressableSpan_exports);
18
- __reExport(PressableSpan_exports, require('../ContentSelector.cjs'), module.exports);
19
- // Annotate the CommonJS export names for ESM import in node:
20
- 0 && (module.exports = {
21
- ...require('../ContentSelector.cjs')
22
- });
23
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/UI/PressableSpan/index.ts"],"sourcesContent":["export * from '../ContentSelector';\n"],"mappings":";;;;;;;;;;;;;;;AAAA;AAAA;AAAA,kCAAc,+BAAd;","names":[]}
@@ -1,59 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var fetchDistantDictionary_exports = {};
20
- __export(fetchDistantDictionary_exports, {
21
- fetchDistantDictionary: () => fetchDistantDictionary
22
- });
23
- module.exports = __toCommonJS(fetchDistantDictionary_exports);
24
- var import_api = require("@intlayer/api");
25
- var import_client = require("@intlayer/config/client");
26
- const fetchDistantDictionary = async (dictionaryKey) => {
27
- try {
28
- const config = (0, import_client.getConfiguration)();
29
- const { clientId, clientSecret } = config.editor;
30
- const intlayerAPI = (0, import_api.getIntlayerAPI)(void 0, config);
31
- if (!clientId || !clientSecret) {
32
- throw new Error(
33
- "Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
34
- );
35
- }
36
- const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();
37
- const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
38
- const getDictionaryResult = await intlayerAPI.dictionary.getDictionary(
39
- dictionaryKey,
40
- void 0,
41
- {
42
- headers: { Authorization: `Bearer ${oAuth2AccessToken}` }
43
- }
44
- );
45
- const distantDictionary = getDictionaryResult.data;
46
- if (!distantDictionary) {
47
- throw new Error(`Dictionary ${dictionaryKey} not found on remote`);
48
- }
49
- return distantDictionary;
50
- } catch (error) {
51
- console.error(error);
52
- return void 0;
53
- }
54
- };
55
- // Annotate the CommonJS export names for ESM import in node:
56
- 0 && (module.exports = {
57
- fetchDistantDictionary
58
- });
59
- //# sourceMappingURL=fetchDistantDictionary.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport { type DictionaryAPI } from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\n// @ts-ignore @intlayer/design-system not build yet\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionary = async (\n dictionaryKey: string\n): Promise<DictionaryAPI | undefined> => {\n try {\n const config = getConfiguration();\n const { clientId, clientSecret } = config.editor;\n const intlayerAPI = getIntlayerAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await intlayerAPI.dictionary.getDictionary(\n dictionaryKey,\n undefined,\n {\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n return distantDictionary;\n } catch (error) {\n console.error(error);\n return undefined;\n }\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,iBAA+B;AAG/B,oBAAiC;AAM1B,MAAM,yBAAyB,OACpC,kBACuC;AACvC,MAAI;AACF,UAAM,aAAS,gCAAiB;AAChC,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,kBAAc,2BAAe,QAAW,MAAM;AAEpD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,UAAM,oBAAoB,kBAAkB,MAAM;AAGlD,UAAM,sBAAsB,MAAM,YAAY,WAAW;AAAA,MACvD;AAAA,MACA;AAAA,MACA;AAAA,QACE,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,MAC1D;AAAA,IACF;AAEA,UAAM,oBAAoB,oBAAoB;AAE9C,QAAI,CAAC,mBAAmB;AACtB,YAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,IACnE;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,2 +0,0 @@
1
- export * from '../ContentSelector.mjs';
2
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../src/UI/PressableSpan/index.ts"],"sourcesContent":["export * from '../ContentSelector';\n"],"mappings":"AAAA,cAAc;","names":[]}
@@ -1,35 +0,0 @@
1
- import { getIntlayerAPI } from "@intlayer/api";
2
- import { getConfiguration } from "@intlayer/config/client";
3
- const fetchDistantDictionary = async (dictionaryKey) => {
4
- try {
5
- const config = getConfiguration();
6
- const { clientId, clientSecret } = config.editor;
7
- const intlayerAPI = getIntlayerAPI(void 0, config);
8
- if (!clientId || !clientSecret) {
9
- throw new Error(
10
- "Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project."
11
- );
12
- }
13
- const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();
14
- const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;
15
- const getDictionaryResult = await intlayerAPI.dictionary.getDictionary(
16
- dictionaryKey,
17
- void 0,
18
- {
19
- headers: { Authorization: `Bearer ${oAuth2AccessToken}` }
20
- }
21
- );
22
- const distantDictionary = getDictionaryResult.data;
23
- if (!distantDictionary) {
24
- throw new Error(`Dictionary ${dictionaryKey} not found on remote`);
25
- }
26
- return distantDictionary;
27
- } catch (error) {
28
- console.error(error);
29
- return void 0;
30
- }
31
- };
32
- export {
33
- fetchDistantDictionary
34
- };
35
- //# sourceMappingURL=fetchDistantDictionary.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"sourcesContent":["import { getIntlayerAPI } from '@intlayer/api';\n// @ts-ignore @intlayer/backend is not build yet\nimport { type DictionaryAPI } from '@intlayer/backend';\nimport { getConfiguration } from '@intlayer/config/client';\n// @ts-ignore @intlayer/design-system not build yet\n\n/**\n * Fetch distant dictionary\n */\nexport const fetchDistantDictionary = async (\n dictionaryKey: string\n): Promise<DictionaryAPI | undefined> => {\n try {\n const config = getConfiguration();\n const { clientId, clientSecret } = config.editor;\n const intlayerAPI = getIntlayerAPI(undefined, config);\n\n if (!clientId || !clientSecret) {\n throw new Error(\n 'Missing OAuth2 client ID or client secret. To get access token go to https://intlayer.org/dashboard/project.'\n );\n }\n\n const oAuth2TokenResult = await intlayerAPI.auth.getOAuth2AccessToken();\n\n const oAuth2AccessToken = oAuth2TokenResult.data?.accessToken;\n\n // Fetch the dictionary\n const getDictionaryResult = await intlayerAPI.dictionary.getDictionary(\n dictionaryKey,\n undefined,\n {\n headers: { Authorization: `Bearer ${oAuth2AccessToken}` },\n }\n );\n\n const distantDictionary = getDictionaryResult.data;\n\n if (!distantDictionary) {\n throw new Error(`Dictionary ${dictionaryKey} not found on remote`);\n }\n\n return distantDictionary;\n } catch (error) {\n console.error(error);\n return undefined;\n }\n};\n"],"mappings":"AAAA,SAAS,sBAAsB;AAG/B,SAAS,wBAAwB;AAM1B,MAAM,yBAAyB,OACpC,kBACuC;AACvC,MAAI;AACF,UAAM,SAAS,iBAAiB;AAChC,UAAM,EAAE,UAAU,aAAa,IAAI,OAAO;AAC1C,UAAM,cAAc,eAAe,QAAW,MAAM;AAEpD,QAAI,CAAC,YAAY,CAAC,cAAc;AAC9B,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,oBAAoB,MAAM,YAAY,KAAK,qBAAqB;AAEtE,UAAM,oBAAoB,kBAAkB,MAAM;AAGlD,UAAM,sBAAsB,MAAM,YAAY,WAAW;AAAA,MACvD;AAAA,MACA;AAAA,MACA;AAAA,QACE,SAAS,EAAE,eAAe,UAAU,iBAAiB,GAAG;AAAA,MAC1D;AAAA,IACF;AAEA,UAAM,oBAAoB,oBAAoB;AAE9C,QAAI,CAAC,mBAAmB;AACtB,YAAM,IAAI,MAAM,cAAc,aAAa,sBAAsB;AAAA,IACnE;AAEA,WAAO;AAAA,EACT,SAAS,OAAO;AACd,YAAQ,MAAM,KAAK;AACnB,WAAO;AAAA,EACT;AACF;","names":[]}
@@ -1,2 +0,0 @@
1
- export * from '../ContentSelector';
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/UI/PressableSpan/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC"}
@@ -1,6 +0,0 @@
1
- import { type DictionaryAPI } from '@intlayer/backend';
2
- /**
3
- * Fetch distant dictionary
4
- */
5
- export declare const fetchDistantDictionary: (dictionaryKey: string) => Promise<DictionaryAPI | undefined>;
6
- //# sourceMappingURL=fetchDistantDictionary.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fetchDistantDictionary.d.ts","sourceRoot":"","sources":["../../../src/distantDictionary/fetchDistantDictionary.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAIvD;;GAEG;AACH,eAAO,MAAM,sBAAsB,kBAClB,MAAM,KACpB,OAAO,CAAC,aAAa,GAAG,SAAS,CAoCnC,CAAC"}