@intlayer/design-system 9.3.0 → 9.3.2
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/README.md +22 -22
- package/dist/esm/api/hooks/utils.mjs +2 -1
- package/dist/esm/api/hooks/utils.mjs.map +1 -1
- package/dist/esm/api/index.mjs +2 -2
- package/dist/esm/api/useAuth/useOAuth2.mjs +14 -4
- package/dist/esm/api/useAuth/useOAuth2.mjs.map +1 -1
- package/dist/esm/api/useAuth/useSession.mjs +7 -5
- package/dist/esm/api/useAuth/useSession.mjs.map +1 -1
- package/dist/esm/components/Accordion/Accordion.mjs +1 -1
- package/dist/esm/components/Avatar/index.mjs +1 -1
- package/dist/esm/components/Badge/index.mjs +1 -1
- package/dist/esm/components/Breadcrumb/index.mjs +1 -1
- package/dist/esm/components/Browser/Browser.mjs +1 -1
- package/dist/esm/components/Button/Button.mjs +1 -1
- package/dist/esm/components/Carousel/index.mjs +1 -1
- package/dist/esm/components/CollapsibleTable/CollapsibleTable.mjs +1 -1
- package/dist/esm/components/Command/index.mjs +1 -1
- package/dist/esm/components/Container/index.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditor.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorInput.mjs +1 -1
- package/dist/esm/components/ContentEditor/ContentEditorTextArea.mjs +2 -2
- package/dist/esm/components/CopyButton/index.mjs +1 -1
- package/dist/esm/components/CopyToClipboard/index.mjs +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/BooleanWrapper.mjs +2 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/BooleanWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/NumberWrapper.mjs +2 -1
- package/dist/esm/components/DictionaryEditor/NodeWrapper/NumberWrapper.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/ContentEditor.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/ContentEditorView/TextEditor.mjs +3 -3
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/DictionaryDetailsForm.mjs +7 -7
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/DictionaryFieldEditor.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs +8 -7
- package/dist/esm/components/DictionaryFieldEditor/KeyPathBreadcrumb.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs +8 -5
- package/dist/esm/components/DictionaryFieldEditor/NavigationView/NavigationViewNode.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/NodeTypeSelector.mjs +2 -1
- package/dist/esm/components/DictionaryFieldEditor/NodeTypeSelector.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/SaveForm/SaveForm.mjs +3 -3
- package/dist/esm/components/DictionaryFieldEditor/StructureEditor.mjs +2 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureEditor.mjs.map +1 -1
- package/dist/esm/components/DictionaryFieldEditor/StructureView/StructureView.mjs +2 -2
- package/dist/esm/components/DictionaryFieldEditor/VersionSwitcherDropDown/VersionSwitcher.mjs +1 -1
- package/dist/esm/components/EditableField/EditableFieldInput.mjs +6 -5
- package/dist/esm/components/EditableField/EditableFieldInput.mjs.map +1 -1
- package/dist/esm/components/EditableField/EditableFieldLayout.mjs +1 -1
- package/dist/esm/components/EditableField/EditableFieldTextArea.mjs +2 -1
- package/dist/esm/components/EditableField/EditableFieldTextArea.mjs.map +1 -1
- package/dist/esm/components/Form/FormBase.mjs.map +1 -1
- package/dist/esm/components/Form/elements/FormElementWrapper.mjs +1 -1
- package/dist/esm/components/Form/elements/FormElementWrapper.mjs.map +1 -1
- package/dist/esm/components/Form/elements/OTPElement.mjs +1 -1
- package/dist/esm/components/HTMLRender/HTMLRender.mjs +5 -3
- package/dist/esm/components/HTMLRender/HTMLRender.mjs.map +1 -1
- package/dist/esm/components/HideShow/index.mjs +1 -1
- package/dist/esm/components/IDE/Code.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockClient.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs +3 -14
- package/dist/esm/components/IDE/CodeBlockHighlight.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockServer.mjs +14 -12
- package/dist/esm/components/IDE/CodeBlockServer.mjs.map +1 -1
- package/dist/esm/components/IDE/CodeBlockShiki.mjs +32 -86
- package/dist/esm/components/IDE/CodeBlockShiki.mjs.map +1 -1
- package/dist/esm/components/IDE/FileTree.mjs +3 -2
- package/dist/esm/components/IDE/FileTree.mjs.map +1 -1
- package/dist/esm/components/IDE/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/IDE/shikiLanguages.mjs +122 -0
- package/dist/esm/components/IDE/shikiLanguages.mjs.map +1 -0
- package/dist/esm/components/Input/Checkbox.mjs +1 -1
- package/dist/esm/components/Input/Input.mjs +1 -1
- package/dist/esm/components/Input/InputPassword.mjs +1 -1
- package/dist/esm/components/Input/OTPInput.mjs +5 -4
- package/dist/esm/components/Input/OTPInput.mjs.map +1 -1
- package/dist/esm/components/Input/Radio.mjs +1 -1
- package/dist/esm/components/Input/SearchInput.mjs +1 -1
- package/dist/esm/components/LanguageBackground/LanguageBackground.mjs +2 -1
- package/dist/esm/components/LanguageBackground/LanguageBackground.mjs.map +1 -1
- package/dist/esm/components/Link/Link.mjs +1 -1
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs +7 -6
- package/dist/esm/components/LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs.map +1 -1
- package/dist/esm/components/LocaleSwitcherDropDown/LocaleSwitcher.mjs +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownIframe.mjs +1 -1
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs +12 -7
- package/dist/esm/components/MarkDownRender/MarkDownRender.mjs.map +1 -1
- package/dist/esm/components/MarkdownEditor/generative/AICompletionCommands.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/generative/AISelector.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/generative/AISelectorCommands.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/generative/GenerativeMenuSwitch.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/selectors/ColorSelector.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/selectors/LinkSelector.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/selectors/NodeSelector.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/selectors/TextButtons.mjs +1 -1
- package/dist/esm/components/MarkdownEditor/slashCommand.mjs +1 -1
- package/dist/esm/components/Modal/Modal.mjs +3 -3
- package/dist/esm/components/Navbar/MobileNavbar.mjs +1 -1
- package/dist/esm/components/Pagination/Pagination.mjs +2 -2
- package/dist/esm/components/PressableSpan/PressableSpan.mjs +0 -2
- package/dist/esm/components/PressableSpan/PressableSpan.mjs.map +1 -1
- package/dist/esm/components/RightDrawer/RightDrawer.mjs +4 -4
- package/dist/esm/components/Select/Multiselect.mjs +3 -5
- package/dist/esm/components/Select/Multiselect.mjs.map +1 -1
- package/dist/esm/components/Select/Select.mjs +1 -1
- package/dist/esm/components/SwitchSelector/SwitchSelector.mjs +1 -1
- package/dist/esm/components/SwitchSelector/VerticalSwitchSelector.mjs +1 -1
- package/dist/esm/components/Tab/Tab.mjs +2 -2
- package/dist/esm/components/TabSelector/TabSelector.mjs +1 -1
- package/dist/esm/components/Table/ExpandButton.mjs +1 -1
- package/dist/esm/components/Tag/index.mjs +1 -1
- package/dist/esm/components/Terminal/Terminal.mjs +7 -5
- package/dist/esm/components/Terminal/Terminal.mjs.map +1 -1
- package/dist/esm/components/TextArea/AutocompleteTextArea.mjs +6 -3
- package/dist/esm/components/TextArea/AutocompleteTextArea.mjs.map +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/DesktopThemeSwitcher.mjs +1 -1
- package/dist/esm/components/ThemeSwitcherDropDown/MobileThemeSwitcher.mjs +1 -1
- package/dist/esm/components/Toaster/Toast.mjs +1 -1
- package/dist/esm/components/Toaster/useToast.mjs +1 -1
- package/dist/esm/components/Toaster/useToast.mjs.map +1 -1
- package/dist/esm/hooks/index.mjs +8 -8
- package/dist/esm/hooks/useScrollDetection.mjs +4 -2
- package/dist/esm/hooks/useScrollDetection.mjs.map +1 -1
- package/dist/esm/providers/DeferredAuthProvider.mjs +75 -0
- package/dist/esm/providers/DeferredAuthProvider.mjs.map +1 -0
- package/dist/esm/providers/ReactQueryProvider.mjs +4 -4
- package/dist/esm/providers/ReactQueryProvider.mjs.map +1 -1
- package/dist/esm/providers/index.mjs +2 -1
- package/dist/esm/routes.mjs +12 -11
- package/dist/esm/routes.mjs.map +1 -1
- package/dist/esm/structured-data/buildAuthorJsonLd.mjs +6 -3
- package/dist/esm/structured-data/buildAuthorJsonLd.mjs.map +1 -1
- package/dist/esm/structured-data/buildBreadcrumbsJsonLd.mjs +4 -1
- package/dist/esm/structured-data/buildBreadcrumbsJsonLd.mjs.map +1 -1
- package/dist/esm/structured-data/buildCreativeWorkJsonLd.mjs +7 -5
- package/dist/esm/structured-data/buildCreativeWorkJsonLd.mjs.map +1 -1
- package/dist/esm/structured-data/buildOrganizationJsonLd.mjs +27 -21
- package/dist/esm/structured-data/buildOrganizationJsonLd.mjs.map +1 -1
- package/dist/esm/structured-data/buildProductJsonLd.mjs +5 -2
- package/dist/esm/structured-data/buildProductJsonLd.mjs.map +1 -1
- package/dist/esm/structured-data/buildSoftwareApplicationJsonLd.mjs +59 -51
- package/dist/esm/structured-data/buildSoftwareApplicationJsonLd.mjs.map +1 -1
- package/dist/esm/structured-data/buildWebsiteJsonLd.mjs +31 -25
- package/dist/esm/structured-data/buildWebsiteJsonLd.mjs.map +1 -1
- package/dist/esm/structured-data/index.mjs +2 -1
- package/dist/esm/structured-data/normalizeJsonLdUrl.mjs +34 -0
- package/dist/esm/structured-data/normalizeJsonLdUrl.mjs.map +1 -0
- package/dist/esm/tailwind.config.mjs +4 -2
- package/dist/esm/tailwind.config.mjs.map +1 -1
- package/dist/types/api/index.d.ts +2 -2
- package/dist/types/api/useAuth/index.d.ts +2 -2
- package/dist/types/api/useAuth/useOAuth2.d.ts +12 -3
- package/dist/types/api/useAuth/useOAuth2.d.ts.map +1 -1
- package/dist/types/api/useAuth/useSession.d.ts.map +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.d.ts +1 -1
- package/dist/types/components/DictionaryFieldEditor/DictionaryDetails/useDictionaryDetailsSchema.d.ts +1 -1
- package/dist/types/components/Form/FormBase.d.ts +1 -1
- package/dist/types/components/Form/elements/FormElementWrapper.d.ts +1 -1
- package/dist/types/components/IDE/Code.d.ts +2 -2
- package/dist/types/components/IDE/CodeBlockClient.d.ts +2 -2
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts +2 -2
- package/dist/types/components/IDE/CodeBlockHighlight.d.ts.map +1 -1
- package/dist/types/components/IDE/CodeBlockShiki.d.ts +2 -2
- package/dist/types/components/IDE/CodeBlockShiki.d.ts.map +1 -1
- package/dist/types/components/IDE/index.d.ts +2 -1
- package/dist/types/components/IDE/shikiLanguages.d.ts +138 -0
- package/dist/types/components/IDE/shikiLanguages.d.ts.map +1 -0
- package/dist/types/components/index.d.ts +2 -1
- package/dist/types/providers/DeferredAuthProvider.d.ts +33 -0
- package/dist/types/providers/DeferredAuthProvider.d.ts.map +1 -0
- package/dist/types/providers/index.d.ts +2 -1
- package/dist/types/routes.d.ts +17 -16
- package/dist/types/routes.d.ts.map +1 -1
- package/dist/types/structured-data/buildAuthorJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildBreadcrumbsJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildCreativeWorkJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildOrganizationJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildProductJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildSoftwareApplicationJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/buildWebsiteJsonLd.d.ts.map +1 -1
- package/dist/types/structured-data/index.d.ts +2 -1
- package/dist/types/structured-data/normalizeJsonLdUrl.d.ts +28 -0
- package/dist/types/structured-data/normalizeJsonLdUrl.d.ts.map +1 -0
- package/package.json +43 -43
package/README.md
CHANGED
|
@@ -46,25 +46,25 @@ With **per-locale content files**, **TypeScript autocompletion**, **tree-shakabl
|
|
|
46
46
|
|
|
47
47
|
## Keys benefits of Intlayer:
|
|
48
48
|
|
|
49
|
-
| Feature | Description
|
|
50
|
-
| --------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more.
|
|
52
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content)
|
|
53
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file)
|
|
54
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript)
|
|
55
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs)
|
|
56
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app)
|
|
57
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code)
|
|
58
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer)
|
|
59
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs)
|
|
60
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file)
|
|
61
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms)
|
|
62
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization)
|
|
63
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs)
|
|
64
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill)
|
|
65
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md)
|
|
66
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension)
|
|
67
|
-
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, and react-intl. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next)
|
|
49
|
+
| Feature | Description |
|
|
50
|
+
| --------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
51
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/frameworks.png?raw=true" alt="Feature" width="700"> | **Cross-Frameworks Support**<br><br>Intlayer is compatible with all major frameworks and libraries, including Next.js, React, Vite, Vue.js, Nuxt, Preact, Express, and more. |
|
|
52
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/javascript_content_management.jpg?raw=true" alt="Feature" width="700"> | **JavaScript-Powered Content Management**<br><br>Harness the flexibility of JavaScript to define and manage your content efficiently. <br><br> - [Content declaration](https://intlayer.org/doc/concept/content) |
|
|
53
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/per_locale_content_declaration_file.png?raw=true" alt="Feature" width="700"> | **Per-Locale Content Declaration File**<br><br>Speed up your development by declaring your content once, before auto generation.<br><br> - [Per-Locale Content Declaration File](https://intlayer.org/doc/concept/per-locale-file) |
|
|
54
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/autocompletion.png?raw=true" alt="Feature" width="700"> | **Type-Safe Environment**<br><br>Leverage TypeScript to ensure your content definitions and code are error-free, while also benefiting from IDE autocompletion.<br><br> - [TypeScript configuration](https://intlayer.org/doc/environment/vite-and-react#configure-typescript) |
|
|
55
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/config_file.png?raw=true" alt="Feature" width="700"> | **Simplified Setup**<br><br>Get up and running quickly with minimal configuration. Adjust settings for internationalization, routing, AI, build, and content handling with ease. <br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
56
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/content_retrieval.png?raw=true" alt="Feature" width="700"> | **Simplified Content Retrieval**<br><br>No need to call your `t` function for each piece of content. Retrieve all your content directly using a single hook.<br><br> - [React integration](https://intlayer.org/doc/environment/create-react-app) |
|
|
57
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/server_component.png?raw=true" alt="Feature" width="700"> | **Consistent Server Component Implementation**<br><br>Perfectly suited for Next.js server components, use the same implementation for both client and server components, no need to pass your `t` function across each server component. <br><br> - [Server Components](https://intlayer.org/doc/environment/nextjs#step-7-utilize-content-in-your-code) |
|
|
58
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/file_tree.png?raw=true" alt="Feature" width="700"> | **Organized Codebase**<br><br>Keep your codebase more organized: 1 component = 1 dictionary in the same folder. Translations close to their respective components, enhance maintainability and clarity. <br><br> - [How Intlayer works](https://intlayer.org/doc/concept/how-works-intlayer) |
|
|
59
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/url_routing.png?raw=true" alt="Feature" width="700"> | **Enhanced Routing**<br><br>Full support of app routing, adapting seamlessly to complex application structures, for Next.js, React, Vite, Vue.js, etc.<br><br> - [Explore Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
60
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/markdown.png?raw=true" alt="Feature" width="700"> | **Markdown Support**<br><br>Import and interpret, locale files and remote Markdown for multilingual content like privacy policies, documentation, etc. Interpret and make Markdown metadata accessible in your code.<br><br> - [Content files](https://intlayer.org/doc/concept/content/file) |
|
|
61
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/visual_editor.png?raw=true" alt="Feature" width="700"> | **Free Visual Editor & CMS**<br><br>A free visual editor and CMS are available for content writers, removing the need for a localization platform. Keep your content synchronized using Git, or externalize it totally or partially with the CMS.<br><br> - [Intlayer Editor](https://intlayer.org/doc/concept/editor) <br> - [Intlayer CMS](https://intlayer.org/doc/concept/cms) |
|
|
62
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/bundle.png?raw=true" alt="Feature" width="700"> | **Tree-shakable Content**<br><br>Tree-shakable content, reducing the size of the final bundle. Loads content per component, excluding any unused content from your bundle. Supports lazy loading to enhance app loading efficiency. <br><br> - [App build optimization](https://intlayer.org/doc/concept/how-works-intlayer#app-build-optimization) |
|
|
63
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/static_rendering.png?raw=true" alt="Feature" width="700"> | **Static Rendering**<br><br>Doesn't block Static Rendering. <br><br> - [Next.js integration](https://intlayer.org/doc/environment/nextjs) |
|
|
64
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/AI_translation.png?raw=true" alt="Feature" width="700"> | **AI-Powered Translation**<br><br>Transform your website into 231 languages with just one click using Intlayer's advanced AI-powered translation tools using your own AI provider / API key. <br><br> - [CI/CD integration](https://intlayer.org/doc/concept/ci-cd) <br> - [Intlayer CLI](https://intlayer.org/doc/concept/cli) <br> - [Auto fill](https://intlayer.org/doc/concept/auto-fill) |
|
|
65
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/mcp.png?raw=true" alt="Feature" width="700"> | **MCP Server Integration**<br><br>Provides an MCP (Model Context Protocol) server for IDE automation, enabling seamless content management and i18n workflows directly within your development environment. <br><br> - [MCP Server](https://github.com/aymericzip/intlayer/blob/main/docs/docs/en/mcp_server.md) |
|
|
66
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/vscode_extension.png?raw=true" alt="Feature" width="700"> | **VSCode Extension**<br><br>Intlayer provides a VSCode extension to help you manage your content and translations, building your dictionaries, translating your content, and more. <br><br> - [VSCode Extension](https://intlayer.org/doc/vs-code-extension) |
|
|
67
|
+
| <img src="https://github.com/aymericzip/intlayer/blob/main/docs/assets/interoperability.png?raw=true" alt="Feature" width="700"> | **Interoperability**<br><br>Allow interoperability with react-i18next, next-i18next, next-intl, and react-intl. <br><br> - [Intlayer and react-intl](https://intlayer.org/blog/intlayer-with-react-intl) <br> - [Intlayer and next-intl](https://intlayer.org/blog/intlayer-with-next-intl) <br> - [Intlayer and next-i18next](https://intlayer.org/blog/intlayer-with-next-i18next) <br> - [Intlayer compat adapters](https://intlayer.org/doc/compatibility) |
|
|
68
68
|
|
|
69
69
|
---
|
|
70
70
|
|
|
@@ -157,7 +157,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
157
157
|
<li><a href="https://intlayer.org/doc/concept/cms" rel=''>Intlayer CMS</a></li>
|
|
158
158
|
<li><a href="https://intlayer.org/doc/concept/content" rel=''>Dictionary</a>
|
|
159
159
|
<ul>
|
|
160
|
-
<li><a href="https://intlayer.org/doc/concept/
|
|
160
|
+
<li><a href="https://intlayer.org/doc/concept/per-locale-file" rel=''>Per-Locale Content Declaration File</a></li>
|
|
161
161
|
<li><a href="https://intlayer.org/doc/concept/content/translation" rel=''>Translation</a></li>
|
|
162
162
|
<li><a href="https://intlayer.org/doc/concept/content/enumeration" rel=''>Enumeration</a></li>
|
|
163
163
|
<li><a href="https://intlayer.org/doc/concept/content/condition" rel=''>Condition</a></li>
|
|
@@ -177,7 +177,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
177
177
|
<li><a href="https://intlayer.org/doc/environment/nextjs" rel=''>Intlayer with Next.js 15</a>
|
|
178
178
|
<ul>
|
|
179
179
|
<li><a href="https://intlayer.org/doc/environment/nextjs/14" rel=''>Next.js 14 (App Router)</a></li>
|
|
180
|
-
<li><a href="https://intlayer.org/doc/environment/nextjs/next-with-
|
|
180
|
+
<li><a href="https://intlayer.org/doc/environment/nextjs/next-with-page-router" rel=''>Next.js Page Router</a></li>
|
|
181
181
|
</ul>
|
|
182
182
|
</li>
|
|
183
183
|
<li><a href="https://intlayer.org/doc/environment/create-react-app" rel=''>React CRA</a></li>
|
|
@@ -192,7 +192,7 @@ Explore our comprehensive documentation to get started with Intlayer and learn h
|
|
|
192
192
|
<li><a href="https://intlayer.org/doc/environment/vite-and-svelte" rel=''>Vite + Svelte</a></li>
|
|
193
193
|
<li><a href="https://intlayer.org/doc/environment/vite-and-preact" rel=''>Vite + Preact</a></li>
|
|
194
194
|
<li><a href="https://intlayer.org/doc/environment/vite-and-vue" rel=''>Vite + Vue</a></li>
|
|
195
|
-
<li><a href="https://intlayer.org/doc/environment/
|
|
195
|
+
<li><a href="https://intlayer.org/doc/environment/nuxt-and-vue" rel=''>Vite + Nuxt</a></li>
|
|
196
196
|
<li><a href="https://intlayer.org/doc/environment/vite-and-solid" rel=''>Vite + Solid</a></li>
|
|
197
197
|
<li><a href="https://intlayer.org/doc/environment/angular" rel=''>Angular</a></li>
|
|
198
198
|
<li><a href="https://intlayer.org/doc/environment/express" rel=''>Express</a></li>
|
|
@@ -6,7 +6,8 @@ import { useConfiguration } from "@intlayer/editor-react";
|
|
|
6
6
|
|
|
7
7
|
//#region src/api/hooks/utils.ts
|
|
8
8
|
const useAuthEnable = ({ requireUser, requireProject, requireOrganization }) => {
|
|
9
|
-
const
|
|
9
|
+
const configuration = useConfiguration();
|
|
10
|
+
const { oAuth2AccessToken, session } = useAuth({ intlayerConfiguration: configuration });
|
|
10
11
|
const user = session ? session.user : oAuth2AccessToken?.user;
|
|
11
12
|
const organization = session ? session.organization : oAuth2AccessToken?.organization;
|
|
12
13
|
const project = session ? session.project : oAuth2AccessToken?.project;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../../src/api/hooks/utils.ts"],"sourcesContent":["'use client';\n\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type UseQueryOptions, useQuery } from '@tanstack/react-query';\nimport { useAuth } from '../useAuth';\n\ntype AuthEnableOptions = {\n requireUser?: boolean;\n requireProject?: boolean;\n requireOrganization?: boolean;\n};\n\nexport const useAuthEnable = ({\n requireUser,\n requireProject,\n requireOrganization,\n}: AuthEnableOptions) => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken, session } = useAuth({\n intlayerConfiguration: configuration,\n });\n\n const user = session ? session.user : oAuth2AccessToken?.user;\n\n const organization = session\n ? session.organization\n : oAuth2AccessToken?.organization;\n\n const project = session ? session.project : oAuth2AccessToken?.project;\n\n const isUserEnabled = requireUser ? Boolean(user) : true;\n\n const isProjectEnabled = requireProject ? Boolean(project) : true;\n\n const isOrganizationEnabled = requireOrganization\n ? Boolean(organization)\n : true;\n\n const isEnabled = isUserEnabled && isProjectEnabled && isOrganizationEnabled;\n\n return {\n enable: isEnabled,\n };\n};\n\nexport const useAppQuery = (\n options: UseQueryOptions & {\n requireUser?: boolean;\n requireProject?: boolean;\n requireOrganization?: boolean;\n }\n) => {\n const { requireUser, requireProject, requireOrganization, ...rest } = options;\n const { enable } = useAuthEnable({\n requireUser,\n requireProject,\n requireOrganization,\n });\n\n const result = useQuery({\n enabled: rest?.enabled === false ? false : enable,\n ...rest,\n });\n\n return result;\n};\n"],"mappings":";;;;;;;AAYA,MAAa,iBAAiB,EAC5B,aACA,gBACA,0BACuB;
|
|
1
|
+
{"version":3,"file":"utils.mjs","names":[],"sources":["../../../../src/api/hooks/utils.ts"],"sourcesContent":["'use client';\n\nimport { useConfiguration } from '@intlayer/editor-react';\nimport { type UseQueryOptions, useQuery } from '@tanstack/react-query';\nimport { useAuth } from '../useAuth';\n\ntype AuthEnableOptions = {\n requireUser?: boolean;\n requireProject?: boolean;\n requireOrganization?: boolean;\n};\n\nexport const useAuthEnable = ({\n requireUser,\n requireProject,\n requireOrganization,\n}: AuthEnableOptions) => {\n const configuration = useConfiguration();\n const { oAuth2AccessToken, session } = useAuth({\n intlayerConfiguration: configuration,\n });\n\n const user = session ? session.user : oAuth2AccessToken?.user;\n\n const organization = session\n ? session.organization\n : oAuth2AccessToken?.organization;\n\n const project = session ? session.project : oAuth2AccessToken?.project;\n\n const isUserEnabled = requireUser ? Boolean(user) : true;\n\n const isProjectEnabled = requireProject ? Boolean(project) : true;\n\n const isOrganizationEnabled = requireOrganization\n ? Boolean(organization)\n : true;\n\n const isEnabled = isUserEnabled && isProjectEnabled && isOrganizationEnabled;\n\n return {\n enable: isEnabled,\n };\n};\n\nexport const useAppQuery = (\n options: UseQueryOptions & {\n requireUser?: boolean;\n requireProject?: boolean;\n requireOrganization?: boolean;\n }\n) => {\n const { requireUser, requireProject, requireOrganization, ...rest } = options;\n const { enable } = useAuthEnable({\n requireUser,\n requireProject,\n requireOrganization,\n });\n\n const result = useQuery({\n enabled: rest?.enabled === false ? false : enable,\n ...rest,\n });\n\n return result;\n};\n"],"mappings":";;;;;;;AAYA,MAAa,iBAAiB,EAC5B,aACA,gBACA,0BACuB;CACvB,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,EAAE,mBAAmB,YAAY,QAAQ,EAC7C,uBAAuB,cACzB,CAAC;CAED,MAAM,OAAO,UAAU,QAAQ,OAAO,mBAAmB;CAEzD,MAAM,eAAe,UACjB,QAAQ,eACR,mBAAmB;CAEvB,MAAM,UAAU,UAAU,QAAQ,UAAU,mBAAmB;CAY/D,OAAO,EACL,SAXoB,cAAc,QAAQ,IAAI,IAAI,UAE3B,iBAAiB,QAAQ,OAAO,IAAI,UAE/B,sBAC1B,QAAQ,YAAY,IACpB,MAMJ;AACF;AAEA,MAAa,eACX,YAKG;CACH,MAAM,EAAE,aAAa,gBAAgB,qBAAqB,GAAG,SAAS;CACtE,MAAM,EAAE,WAAW,cAAc;EAC/B;EACA;EACA;CACF,CAAC;CAOD,OALe,SAAS;EACtB,SAAS,MAAM,YAAY,QAAQ,QAAQ;EAC3C,GAAG;CACL,CAEY;AACd"}
|
package/dist/esm/api/index.mjs
CHANGED
|
@@ -2,12 +2,11 @@ import { useOAuth2 } from "./useAuth/useOAuth2.mjs";
|
|
|
2
2
|
import { useSession } from "./useAuth/useSession.mjs";
|
|
3
3
|
import { useAuth } from "./useAuth/useAuth.mjs";
|
|
4
4
|
import { useAiAPI, useAnalyticsAPI, useAssetAPI, useAuditAPI, useBitbucketAPI, useDictionaryAPI, useEditorAPI, useEnvironmentAPI, useGithubAPI, useGitlabAPI, useIntlayerAuth, useIntlayerOAuth, useIntlayerOAuthOptions, useNewsletterAPI, useOAuthAPI, useOrganizationAPI, useProjectAPI, useReviewerAPI, useSearchAPI, useShowcaseProjectAPI, useStripeAPI, useTagAPI, useTranslateAPI, useUserAPI } from "./useIntlayerAPI.mjs";
|
|
5
|
-
import { useAddPasskey, useAskResetPassword, useChangePassword, useDeletePasskey, useDeleteSSOProvider, useDisableTwoFactor, useEnableTwoFactor, useGetUserByAccount, useGetVerifyEmailStatus, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useRegister, useRegisterSSO, useResetPassword, useSignInMagicLink, useSignInPasskey, useSignInSSO, useUnlinkAccount, useVerifyBackupCode, useVerifyEmail, useVerifyTotp } from "./hooks/auth.mjs";
|
|
6
|
-
import { useUser } from "./useUser/index.mjs";
|
|
7
5
|
import { useAskDocQuestion, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditTag, useAutocomplete, useChat, useCustomQuery, useGetAIStats, useTranslateJSONDeclaration } from "./hooks/ai.mjs";
|
|
8
6
|
import { useGetAnalyticsAudience, useGetContentStats, useGetExperimentResults } from "./hooks/analytics.mjs";
|
|
9
7
|
import { useDeleteAsset, useGetAssetById, useGetAssets, useUpdateAsset, useUploadAsset } from "./hooks/asset.mjs";
|
|
10
8
|
import { useAuditScan, useGetRecursiveAuditStatus, useStartRecursiveAudit } from "./hooks/audit.mjs";
|
|
9
|
+
import { useAddPasskey, useAskResetPassword, useChangePassword, useDeletePasskey, useDeleteSSOProvider, useDisableTwoFactor, useEnableTwoFactor, useGetUserByAccount, useGetVerifyEmailStatus, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useRegister, useRegisterSSO, useResetPassword, useSignInMagicLink, useSignInPasskey, useSignInSSO, useUnlinkAccount, useVerifyBackupCode, useVerifyEmail, useVerifyTotp } from "./hooks/auth.mjs";
|
|
11
10
|
import { useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos } from "./hooks/bitbucket.mjs";
|
|
12
11
|
import { useAddDictionary, useDeleteDictionary, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useInfiniteGetDictionaries, usePushDictionaries, useUpdateDictionary } from "./hooks/dictionary.mjs";
|
|
13
12
|
import { useGetDiscussions, useGetDiscussionsData } from "./hooks/discussions.mjs";
|
|
@@ -25,5 +24,6 @@ import { useAcceptAffiliateInvitation, useCancelSubscription, useCreatePortalSes
|
|
|
25
24
|
import { useAddTag, useDeleteTag, useGetTags, useUpdateTag } from "./hooks/tag.mjs";
|
|
26
25
|
import { useFillAllTranslations, usePauseTranslationJob, useResumeTranslationJob, useStopTranslationJob } from "./hooks/translate.mjs";
|
|
27
26
|
import { useCreateUser, useDeleteUser, useGetUserById, useGetUsers, useUpdateUser, useUploadUserAvatar } from "./hooks/user.mjs";
|
|
27
|
+
import { useUser } from "./useUser/index.mjs";
|
|
28
28
|
|
|
29
29
|
export { useAcceptAffiliateInvitation, useAddDictionary, useAddEnvironment, useAddNewAccessKey, useAddOrganization, useAddOrganizationMember, useAddPasskey, useAddProject, useAddTag, useAiAPI, useAnalyticsAPI, useAskDocQuestion, useAskResetPassword, useAssetAPI, useAuditAPI, useAuditContentDeclaration, useAuditContentDeclarationField, useAuditContentDeclarationMetadata, useAuditScan, useAuditTag, useAuth, useAutocomplete, useBitbucketAPI, useBitbucketAuth, useBitbucketCheckConfig, useBitbucketGetConfigFile, useBitbucketRepos, useCancelSubscription, useChangePassword, useChat, useContactReviewer, useCreateMission, useCreatePortalSession, useCreatePromoCode, useCreateUser, useCustomQuery, useDeleteAccessKey, useDeleteAsset, useDeleteDictionary, useDeleteEnvironment, useDeleteOrganization, useDeleteOrganizationById, useDeletePasskey, useDeleteProject, useDeleteProjectById, useDeletePromoCode, useDeleteReviewerProfile, useDeleteSSOProvider, useDeleteShowcaseProject, useDeleteTag, useDeleteUser, useDictionaryAPI, useDisableTwoFactor, useEditorAPI, useEnableTwoFactor, useEnvironmentAPI, useEstimateMission, useFillAllTranslations, useGetAIStats, useGetAdminReviewers, useGetAffiliate, useGetAffiliateAccountSession, useGetAffiliateById, useGetAffiliateInvitation, useGetAffiliateInvitations, useGetAffiliateOnboardingLink, useGetAffiliatePromoCode, useGetAffiliateStats, useGetAffiliates, useGetAnalyticsAudience, useGetAssetById, useGetAssets, useGetCIConfig, useGetChatHistory, useGetContentStats, useGetDictionaries, useGetDictionariesKeys, useGetDictionary, useGetDiscussions, useGetDiscussionsData, useGetEditorDictionaries, useGetExperimentResults, useGetInvoices, useGetMissionById, useGetMyMissions, useGetMyReviewerProfile, useGetNewsletterStatus, useGetOrganizations, useGetOtherShowcaseProjects, useGetPaymentMethod, useGetPricing, useGetProjectInsights, useGetProjects, useGetPromoCodeById, useGetPromoCodes, useGetRecursiveAuditStatus, useGetReviewerById, useGetReviewerMarketplace, useGetReviewerPriceDistribution, useGetReviewerReviews, useGetShowcaseProjectById, useGetShowcaseProjects, useGetSubscription, useGetTags, useGetUserByAccount, useGetUserById, useGetUsers, useGetVerifyEmailStatus, useGithubAPI, useGithubAuth, useGithubCheckConfig, useGithubGetAuthUrl, useGithubGetConfigFile, useGithubRepos, useGithubToken, useGitlabAPI, useGitlabAuth, useGitlabCheckConfig, useGitlabGetConfigFile, useGitlabProjects, useGrantAffiliateAccess, useInfiniteGetDictionaries, useIntlayerAuth, useIntlayerOAuth, useIntlayerOAuthOptions, useLinkSocial, useListAccounts, useListPasskeys, useListSSOProviders, useLogin, useLogout, useMigrateEnvironment, useNewsletterAPI, useOAuth2, useOAuthAPI, useOrganizationAPI, usePauseTranslationJob, useProjectAPI, usePushCIConfig, usePushDictionaries, usePushProjectConfiguration, useRefreshAccessKey, useRegister, useRegisterAsReviewer, useRegisterSSO, useResetPassword, useResetToProductionEnvironment, useResumeTranslationJob, useReviewerAPI, useSearchAPI, useSearchDoc, useSelectEnvironment, useSelectOrganization, useSelectProject, useSendAffiliateInvitation, useSendReviewerMessage, useSession, useShowcaseProjectAPI, useSignInMagicLink, useSignInPasskey, useSignInSSO, useStartRecursiveAudit, useStopTranslationJob, useStripeAPI, useSubmitReview, useSubmitShowcaseProject, useSubscribeToNewsletter, useTagAPI, useToggleShowcaseDownvote, useToggleShowcaseUpvote, useTranslateAPI, useTranslateJSONDeclaration, useTriggerBuild, useTriggerWebhook, useUnlinkAccount, useUnselectOrganization, useUnselectProject, useUnsubscribeFromNewsletter, useUpdateAffiliateStatus, useUpdateAsset, useUpdateDictionary, useUpdateEnvironment, useUpdateMemberAccess, useUpdateMissionStatus, useUpdateOrganization, useUpdateOrganizationMailerConfig, useUpdateOrganizationMembers, useUpdateOrganizationMembersById, useUpdateProject, useUpdateProjectMembers, useUpdatePromoCode, useUpdateReviewerProfile, useUpdateShowcaseProject, useUpdateTag, useUpdateUser, useUploadAsset, useUploadReviewerCoverPicture, useUploadReviewerMainPicture, useUploadUserAvatar, useUser, useUserAPI, useValidateReviewerProfile, useVerifyBackupCode, useVerifyEmail, useVerifyTotp, useWriteDictionary };
|
|
@@ -1,18 +1,28 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useIsAuthFetchEnabled } from "../../providers/DeferredAuthProvider.mjs";
|
|
3
4
|
import { useQuery } from "@tanstack/react-query";
|
|
4
|
-
import { editor } from "@intlayer/config/built";
|
|
5
5
|
import { getOAuthAPI } from "@intlayer/api";
|
|
6
6
|
import { useConfiguration } from "@intlayer/editor-react";
|
|
7
|
+
import { editor } from "@intlayer/config/built";
|
|
7
8
|
import { defu } from "defu";
|
|
8
9
|
|
|
9
10
|
//#region src/api/useAuth/useOAuth2.ts
|
|
11
|
+
/**
|
|
12
|
+
* Fetches the OAuth2 client-credentials token for the configured editor client.
|
|
13
|
+
*
|
|
14
|
+
* The query stays disabled when no client credentials are configured, and — under
|
|
15
|
+
* a `DeferredAuthProvider` — until the page has finished loading.
|
|
16
|
+
*/
|
|
10
17
|
const useOAuth2 = (intlayerConfiguration) => {
|
|
11
|
-
const
|
|
18
|
+
const configuration = useConfiguration();
|
|
19
|
+
const config = defu(intlayerConfiguration, configuration, { editor });
|
|
20
|
+
const intlayerAPI = getOAuthAPI(void 0, config);
|
|
21
|
+
const isAuthFetchEnabled = useIsAuthFetchEnabled();
|
|
12
22
|
const { data } = useQuery({
|
|
13
23
|
queryKey: ["oAuth2AccessToken"],
|
|
14
|
-
queryFn:
|
|
15
|
-
enabled: !!(config.editor.clientId && config.editor.clientSecret),
|
|
24
|
+
queryFn: intlayerAPI.getOAuth2AccessToken,
|
|
25
|
+
enabled: !!(config.editor.clientId && config.editor.clientSecret) && isAuthFetchEnabled,
|
|
16
26
|
staleTime: 0,
|
|
17
27
|
gcTime: 0,
|
|
18
28
|
refetchOnWindowFocus: false,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useOAuth2.mjs","names":[],"sources":["../../../../src/api/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport { getOAuthAPI } from '@intlayer/api';\nimport { editor } from '@intlayer/config/built';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useQuery } from '@tanstack/react-query';\nimport { defu } from 'defu';\n\nexport const useOAuth2 = (\n intlayerConfiguration?: Pick<IntlayerConfig, 'editor'>\n) => {\n const configuration = useConfiguration();\n const config = defu(intlayerConfiguration, configuration, {\n editor,\n }) as IntlayerConfig;\n\n const intlayerAPI = getOAuthAPI(undefined, config);\n\n const { data } = useQuery({\n queryKey: ['oAuth2AccessToken'],\n queryFn: intlayerAPI.getOAuth2AccessToken,\n enabled
|
|
1
|
+
{"version":3,"file":"useOAuth2.mjs","names":[],"sources":["../../../../src/api/useAuth/useOAuth2.ts"],"sourcesContent":["'use client';\n\nimport { getOAuthAPI } from '@intlayer/api';\nimport type { OAuth2Token } from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useQuery } from '@tanstack/react-query';\nimport { defu } from 'defu';\nimport { useIsAuthFetchEnabled } from '../../providers/DeferredAuthProvider';\n\nexport type UseOAuth2Result = {\n /** The OAuth2 token: `undefined` while unfetched, `null` when none was issued. */\n oAuth2AccessToken: OAuth2Token | null | undefined;\n};\n\n/**\n * Fetches the OAuth2 client-credentials token for the configured editor client.\n *\n * The query stays disabled when no client credentials are configured, and — under\n * a `DeferredAuthProvider` — until the page has finished loading.\n */\nexport const useOAuth2 = (\n intlayerConfiguration?: Pick<IntlayerConfig, 'editor'>\n): UseOAuth2Result => {\n const configuration = useConfiguration();\n const config = defu(intlayerConfiguration, configuration, {\n editor,\n }) as IntlayerConfig;\n\n const intlayerAPI = getOAuthAPI(undefined, config);\n const isAuthFetchEnabled = useIsAuthFetchEnabled();\n\n const { data } = useQuery({\n queryKey: ['oAuth2AccessToken'],\n queryFn: intlayerAPI.getOAuth2AccessToken,\n // Held back until after page load when a `DeferredAuthProvider` is mounted\n // (content sites); unconditional everywhere else (the CMS dashboard).\n enabled:\n !!(config.editor.clientId && config.editor.clientSecret) &&\n isAuthFetchEnabled,\n staleTime: 0,\n gcTime: 0,\n refetchOnWindowFocus: false,\n refetchOnMount: false,\n refetchOnReconnect: false,\n refetchInterval: false,\n refetchIntervalInBackground: false,\n });\n\n const oAuth2AccessToken = data?.data;\n\n return {\n oAuth2AccessToken,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;;;AAsBA,MAAa,aACX,0BACoB;CACpB,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,SAAS,KAAK,uBAAuB,eAAe,EACxD,OACF,CAAC;CAED,MAAM,cAAc,YAAY,QAAW,MAAM;CACjD,MAAM,qBAAqB,sBAAsB;CAEjD,MAAM,EAAE,SAAS,SAAS;EACxB,UAAU,CAAC,mBAAmB;EAC9B,SAAS,YAAY;EAGrB,SACE,CAAC,EAAE,OAAO,OAAO,YAAY,OAAO,OAAO,iBAC3C;EACF,WAAW;EACX,QAAQ;EACR,sBAAsB;EACtB,gBAAgB;EAChB,oBAAoB;EACpB,iBAAiB;EACjB,6BAA6B;CAC/B,CAAC;CAID,OAAO,EACL,mBAHwB,MAAM,KAIhC;AACF"}
|
|
@@ -1,28 +1,30 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useIsAuthFetchEnabled } from "../../providers/DeferredAuthProvider.mjs";
|
|
3
4
|
import { getAuthAPI } from "../../libs/auth.mjs";
|
|
4
5
|
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { editor } from "@intlayer/config/built";
|
|
6
6
|
import { useConfiguration } from "@intlayer/editor-react";
|
|
7
|
+
import { editor } from "@intlayer/config/built";
|
|
7
8
|
|
|
8
9
|
//#region src/api/useAuth/useSession.ts
|
|
9
10
|
const useSession = (sessionProp, intlayerConfiguration) => {
|
|
10
11
|
const configuration = useConfiguration();
|
|
11
12
|
const config = intlayerConfiguration ?? configuration ?? { editor };
|
|
12
13
|
const queryClient = useQueryClient();
|
|
14
|
+
const isAuthFetchEnabled = useIsAuthFetchEnabled();
|
|
13
15
|
const { data, isFetched, refetch } = useQuery({
|
|
14
16
|
queryKey: ["session"],
|
|
15
17
|
queryFn: async () => {
|
|
16
18
|
return (await getAuthAPI(config).getSession()).data;
|
|
17
19
|
},
|
|
18
|
-
staleTime:
|
|
19
|
-
gcTime:
|
|
20
|
-
refetchInterval:
|
|
20
|
+
staleTime: 3e5,
|
|
21
|
+
gcTime: 18e5,
|
|
22
|
+
refetchInterval: 6e5,
|
|
21
23
|
refetchIntervalInBackground: false,
|
|
22
24
|
refetchOnMount: true,
|
|
23
25
|
refetchOnWindowFocus: true,
|
|
24
26
|
refetchOnReconnect: true,
|
|
25
|
-
enabled: !sessionProp
|
|
27
|
+
enabled: !sessionProp && isAuthFetchEnabled
|
|
26
28
|
});
|
|
27
29
|
const session = data ?? (isFetched ? null : void 0);
|
|
28
30
|
const setSession = (nextSession) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useSession.mjs","names":[],"sources":["../../../../src/api/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { getAuthAPI } from '../../libs/auth';\n\nexport type UseSessionResult = {\n /** The current session: `undefined` while loading, `null` if fetched and no session, otherwise the session. */\n session: SessionAPI | null | undefined;\n /** Refetches the session and returns it (undefined while loading). */\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n /** Alias of `fetchSession` for ergonomics. */\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n /** Manually set the session cache. */\n setSession: (nextSession: SessionAPI | null) => void;\n};\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n): UseSessionResult => {\n const configuration = useConfiguration();\n const config = (intlayerConfiguration ??\n configuration ?? { editor }) as IntlayerConfig;\n\n const queryClient = useQueryClient();\n\n // Keep TanStack generics internal so they don't leak into the d.ts\n const { data, isFetched, refetch } = useQuery({\n queryKey: ['session'],\n queryFn: async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n // Narrow to the public shape we want to expose\n return result.data as unknown as SessionAPI;\n },\n // Session data rarely changes during navigation, so keep it fresh for 5 minutes\n // This prevents unnecessary refetches when navigating between pages\n staleTime: 5 * 60 * 1000,\n gcTime: 30 * 60 * 1000,\n // Periodically revalidate so the backend's sliding session-refresh\n // (better-auth `updateAge`) keeps the cookie alive for active users.\n refetchInterval: 10 * 60 * 1000,\n refetchIntervalInBackground: false,\n refetchOnMount: true,\n // Refetching on focus/reconnect lets a returning user get a fresh,\n // extended session without a manual reload.\n refetchOnWindowFocus: true,\n refetchOnReconnect: true,\n enabled: !sessionProp,\n });\n\n const session = data ?? (isFetched ? null : undefined);\n\n const setSession = (nextSession: SessionAPI | null) => {\n queryClient.setQueryData(['session'], nextSession);\n };\n\n const fetchSession = async (): Promise<SessionAPI | null | undefined> => {\n const res = await refetch();\n return res.data as SessionAPI | null | undefined;\n };\n\n const revalidateSession = fetchSession;\n\n return {\n session,\n fetchSession,\n revalidateSession,\n setSession,\n };\n};\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useSession.mjs","names":[],"sources":["../../../../src/api/useAuth/useSession.ts"],"sourcesContent":["'use client';\n\nimport type { SessionAPI } from '@intlayer/backend';\nimport { editor } from '@intlayer/config/built';\nimport { useConfiguration } from '@intlayer/editor-react';\nimport type { IntlayerConfig } from '@intlayer/types/config';\nimport { useQuery, useQueryClient } from '@tanstack/react-query';\nimport { getAuthAPI } from '../../libs/auth';\nimport { useIsAuthFetchEnabled } from '../../providers/DeferredAuthProvider';\n\nexport type UseSessionResult = {\n /** The current session: `undefined` while loading, `null` if fetched and no session, otherwise the session. */\n session: SessionAPI | null | undefined;\n /** Refetches the session and returns it (undefined while loading). */\n fetchSession: () => Promise<SessionAPI | null | undefined>;\n /** Alias of `fetchSession` for ergonomics. */\n revalidateSession: () => Promise<SessionAPI | null | undefined>;\n /** Manually set the session cache. */\n setSession: (nextSession: SessionAPI | null) => void;\n};\n\nexport const useSession = (\n sessionProp?: SessionAPI | null,\n intlayerConfiguration?: IntlayerConfig\n): UseSessionResult => {\n const configuration = useConfiguration();\n const config = (intlayerConfiguration ??\n configuration ?? { editor }) as IntlayerConfig;\n\n const queryClient = useQueryClient();\n const isAuthFetchEnabled = useIsAuthFetchEnabled();\n\n // Keep TanStack generics internal so they don't leak into the d.ts\n const { data, isFetched, refetch } = useQuery({\n queryKey: ['session'],\n queryFn: async () => {\n const intlayerAPI = getAuthAPI(config);\n const result = await intlayerAPI.getSession();\n // Narrow to the public shape we want to expose\n return result.data as unknown as SessionAPI;\n },\n // Session data rarely changes during navigation, so keep it fresh for 5 minutes\n // This prevents unnecessary refetches when navigating between pages\n staleTime: 5 * 60 * 1000,\n gcTime: 30 * 60 * 1000,\n // Periodically revalidate so the backend's sliding session-refresh\n // (better-auth `updateAge`) keeps the cookie alive for active users.\n refetchInterval: 10 * 60 * 1000,\n refetchIntervalInBackground: false,\n refetchOnMount: true,\n // Refetching on focus/reconnect lets a returning user get a fresh,\n // extended session without a manual reload.\n refetchOnWindowFocus: true,\n refetchOnReconnect: true,\n // Held back until after page load when a `DeferredAuthProvider` is mounted\n // (content sites); unconditional everywhere else (the CMS dashboard).\n enabled: !sessionProp && isAuthFetchEnabled,\n });\n\n const session = data ?? (isFetched ? null : undefined);\n\n const setSession = (nextSession: SessionAPI | null) => {\n queryClient.setQueryData(['session'], nextSession);\n };\n\n const fetchSession = async (): Promise<SessionAPI | null | undefined> => {\n const res = await refetch();\n return res.data as SessionAPI | null | undefined;\n };\n\n const revalidateSession = fetchSession;\n\n return {\n session,\n fetchSession,\n revalidateSession,\n setSession,\n };\n};\n"],"mappings":";;;;;;;;;AAqBA,MAAa,cACX,aACA,0BACqB;CACrB,MAAM,gBAAgB,iBAAiB;CACvC,MAAM,SAAU,yBACd,iBAAiB,EAAE,OAAO;CAE5B,MAAM,cAAc,eAAe;CACnC,MAAM,qBAAqB,sBAAsB;CAGjD,MAAM,EAAE,MAAM,WAAW,YAAY,SAAS;EAC5C,UAAU,CAAC,SAAS;EACpB,SAAS,YAAY;GAInB,QAAO,MAHa,WAAW,MACA,CAAC,CAAC,WAAW,EAE/B,CAAC;EAChB;EAGA,WAAW;EACX,QAAQ;EAGR,iBAAiB;EACjB,6BAA6B;EAC7B,gBAAgB;EAGhB,sBAAsB;EACtB,oBAAoB;EAGpB,SAAS,CAAC,eAAe;CAC3B,CAAC;CAED,MAAM,UAAU,SAAS,YAAY,OAAO;CAE5C,MAAM,cAAc,gBAAmC;EACrD,YAAY,aAAa,CAAC,SAAS,GAAG,WAAW;CACnD;CAEA,MAAM,eAAe,YAAoD;EAEvE,QAAO,MADW,QAAQ,EAChB,CAAC;CACb;CAIA,OAAO;EACL;EACA;EACA;EACA;CACF;AACF"}
|
|
@@ -4,8 +4,8 @@ import { cn } from "../../utils/cn.mjs";
|
|
|
4
4
|
import { Button } from "../Button/Button.mjs";
|
|
5
5
|
import { MaxHeightSmoother } from "../MaxHeightSmoother/index.mjs";
|
|
6
6
|
import { useId, useState } from "react";
|
|
7
|
-
import { ChevronDown } from "lucide-react";
|
|
8
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { ChevronDown } from "lucide-react";
|
|
9
9
|
|
|
10
10
|
//#region src/components/Accordion/Accordion.tsx
|
|
11
11
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.mjs";
|
|
2
2
|
import { Loader } from "../Loader/index.mjs";
|
|
3
3
|
import { useMemo } from "react";
|
|
4
|
-
import { User } from "lucide-react";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { User } from "lucide-react";
|
|
6
6
|
|
|
7
7
|
//#region src/components/Avatar/index.tsx
|
|
8
8
|
/**
|
|
@@ -4,9 +4,9 @@ import { cn } from "../../utils/cn.mjs";
|
|
|
4
4
|
import { Button } from "../Button/Button.mjs";
|
|
5
5
|
import { Link } from "../Link/Link.mjs";
|
|
6
6
|
import { Fragment, createElement } from "react";
|
|
7
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
8
|
import { cva } from "class-variance-authority";
|
|
8
9
|
import { ChevronRightIcon } from "lucide-react";
|
|
9
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
10
|
import { getIntlayer } from "intlayer";
|
|
11
11
|
import { useIntlayer } from "react-intlayer";
|
|
12
12
|
|
|
@@ -7,8 +7,8 @@ import { ClickOutsideDiv } from "../ClickOutsideDiv/index.mjs";
|
|
|
7
7
|
import { DropDown } from "../DropDown/index.mjs";
|
|
8
8
|
import { Input, inputVariants } from "../Input/Input.mjs";
|
|
9
9
|
import { useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
|
-
import { ArrowLeft, ArrowRight, RotateCw, ScanSearch } from "lucide-react";
|
|
11
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
|
+
import { ArrowLeft, ArrowRight, RotateCw, ScanSearch } from "lucide-react";
|
|
12
12
|
import { useIntlayer } from "react-intlayer";
|
|
13
13
|
|
|
14
14
|
//#region src/components/Browser/Browser.tsx
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { cn } from "../../utils/cn.mjs";
|
|
2
2
|
import { Loader } from "../Loader/index.mjs";
|
|
3
|
-
import { cva } from "class-variance-authority";
|
|
4
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { cva } from "class-variance-authority";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Button/Button.tsx
|
|
7
7
|
const buttonIconVariants = cva("flex-none shrink-0", {
|
|
@@ -5,8 +5,8 @@ import { Button } from "../Button/Button.mjs";
|
|
|
5
5
|
import { KeyboardShortcut } from "../KeyboardShortcut/KeyboardShortcut.mjs";
|
|
6
6
|
import { Popover } from "../Popover/dynamic.mjs";
|
|
7
7
|
import { Children, createContext, isValidElement, useContext, useEffect, useLayoutEffect, useRef, useState } from "react";
|
|
8
|
-
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
9
8
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
|
+
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
10
10
|
import { useIntlayer } from "react-intlayer";
|
|
11
11
|
|
|
12
12
|
//#region src/components/Carousel/index.tsx
|
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
4
|
import { MaxHeightSmoother } from "../MaxHeightSmoother/index.mjs";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
7
|
import { cva } from "class-variance-authority";
|
|
7
8
|
import { ChevronRight } from "lucide-react";
|
|
8
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
|
|
10
10
|
//#region src/components/CollapsibleTable/CollapsibleTable.tsx
|
|
11
11
|
const collapsibleTableVariants = cva("w-full max-w-full overflow-hidden rounded-lg border bg-card", {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
|
-
import { Search } from "lucide-react";
|
|
5
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Search } from "lucide-react";
|
|
6
6
|
import { Dialog, DialogContent } from "@radix-ui/react-dialog";
|
|
7
7
|
import { Command as Command$1 } from "cmdk";
|
|
8
8
|
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
4
|
import { AutoSizedTextArea } from "../TextArea/AutoSizeTextArea.mjs";
|
|
5
5
|
import { useState } from "react";
|
|
6
|
-
import { Check, X } from "lucide-react";
|
|
7
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Check, X } from "lucide-react";
|
|
8
8
|
|
|
9
9
|
//#region src/components/ContentEditor/ContentEditor.tsx
|
|
10
10
|
/**
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
import { Button } from "../Button/Button.mjs";
|
|
4
4
|
import { Input } from "../Input/Input.mjs";
|
|
5
5
|
import { useEffect, useState } from "react";
|
|
6
|
-
import { Check, X } from "lucide-react";
|
|
7
6
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Check, X } from "lucide-react";
|
|
8
8
|
|
|
9
9
|
//#region src/components/ContentEditor/ContentEditorInput.tsx
|
|
10
10
|
/**
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Button } from "../Button/Button.mjs";
|
|
4
3
|
import { useUser } from "../../api/useUser/index.mjs";
|
|
4
|
+
import { Button } from "../Button/Button.mjs";
|
|
5
5
|
import { AutoCompleteTextarea } from "../TextArea/AutocompleteTextArea.mjs";
|
|
6
6
|
import { useEffect, useState } from "react";
|
|
7
|
-
import { Check, X } from "lucide-react";
|
|
8
7
|
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { Check, X } from "lucide-react";
|
|
9
9
|
|
|
10
10
|
//#region src/components/ContentEditor/ContentEditorTextArea.tsx
|
|
11
11
|
/**
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { Button } from "../Button/Button.mjs";
|
|
4
4
|
import { useEffect, useState } from "react";
|
|
5
|
-
import { CopyCheckIcon, CopyIcon } from "lucide-react";
|
|
6
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { CopyCheckIcon, CopyIcon } from "lucide-react";
|
|
7
7
|
import { useIntlayer } from "react-intlayer";
|
|
8
8
|
|
|
9
9
|
//#region src/components/CopyButton/index.tsx
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
import { cn } from "../../utils/cn.mjs";
|
|
4
4
|
import { useState } from "react";
|
|
5
|
-
import { CopyCheck, CopyIcon } from "lucide-react";
|
|
6
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
|
+
import { CopyCheck, CopyIcon } from "lucide-react";
|
|
7
7
|
|
|
8
8
|
//#region src/components/CopyToClipboard/index.tsx
|
|
9
9
|
const useCopyToClipboard = (text, feedbackDuration = 2e3, onCopySuccess, onCopyError) => {
|
|
@@ -8,7 +8,8 @@ import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
|
|
|
8
8
|
|
|
9
9
|
//#region src/components/DictionaryEditor/NodeWrapper/BooleanWrapper.tsx
|
|
10
10
|
const BooleanWrapper = ({ keyPath, section, editedContent, onContentChange, onFocusKeyPath }) => {
|
|
11
|
-
const
|
|
11
|
+
const currentLocale = useEditorLocale();
|
|
12
|
+
const editedContentValue = getContentNodeByKeyPath(editedContent, keyPath, currentLocale);
|
|
12
13
|
if (editedContentValue !== void 0 && typeof editedContentValue !== "boolean") return /* @__PURE__ */ jsx(Fragment, { children: "Error loading section - Edited content incoherence with the original content format" });
|
|
13
14
|
const level = keyPath.length;
|
|
14
15
|
const value = editedContentValue ?? section;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/BooleanWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport { cn } from '@utils/cn';\nimport type { FC } from 'react';\nimport { SwitchSelector } from '../../SwitchSelector';\nimport type { NodeWrapperProps } from './index';\n\nexport type BooleanWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: boolean;\n};\n\nexport const BooleanWrapper: FC<BooleanWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const currentLocale = useEditorLocale();\n const editedContentValue = getContentNodeByKeyPath(\n editedContent,\n keyPath,\n currentLocale\n );\n\n if (\n editedContentValue !== undefined &&\n typeof editedContentValue !== 'boolean'\n ) {\n return (\n <>\n Error loading section - Edited content incoherence with the original\n content format\n </>\n );\n }\n\n const level = keyPath.length;\n const value = editedContentValue ?? section;\n\n return (\n <button\n type=\"button\"\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <SwitchSelector\n value={value}\n onChange={(newValue) =>\n onContentChange({ keyPath, newValue: String(newValue) })\n }\n />\n </button>\n );\n};\n"],"mappings":";;;;;;;;;AAaA,MAAa,kBAA2C,EACtD,SACA,SACA,eACA,iBACA,qBACI;
|
|
1
|
+
{"version":3,"file":"BooleanWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/BooleanWrapper.tsx"],"sourcesContent":["'use client';\n\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport { cn } from '@utils/cn';\nimport type { FC } from 'react';\nimport { SwitchSelector } from '../../SwitchSelector';\nimport type { NodeWrapperProps } from './index';\n\nexport type BooleanWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: boolean;\n};\n\nexport const BooleanWrapper: FC<BooleanWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const currentLocale = useEditorLocale();\n const editedContentValue = getContentNodeByKeyPath(\n editedContent,\n keyPath,\n currentLocale\n );\n\n if (\n editedContentValue !== undefined &&\n typeof editedContentValue !== 'boolean'\n ) {\n return (\n <>\n Error loading section - Edited content incoherence with the original\n content format\n </>\n );\n }\n\n const level = keyPath.length;\n const value = editedContentValue ?? section;\n\n return (\n <button\n type=\"button\"\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <SwitchSelector\n value={value}\n onChange={(newValue) =>\n onContentChange({ keyPath, newValue: String(newValue) })\n }\n />\n </button>\n );\n};\n"],"mappings":";;;;;;;;;AAaA,MAAa,kBAA2C,EACtD,SACA,SACA,eACA,iBACA,qBACI;CACJ,MAAM,gBAAgB,gBAAgB;CACtC,MAAM,qBAAqB,wBACzB,eACA,SACA,aACF;CAEA,IACE,uBAAuB,UACvB,OAAO,uBAAuB,WAE9B,OACE,0CAAE,sFAGA;CAIN,MAAM,QAAQ,QAAQ;CACtB,MAAM,QAAQ,sBAAsB;CAEpC,OACE,oBAAC,UAAD;EACE,MAAK;EACL,WAAW,GACT,8CACA,2DACA,UAAU,KAAK,oBACf,SAAS,KAAK,EAChB;EACA,UAAU,MAAM;GACd,EAAE,gBAAgB;GAClB,eAAe,OAAO;EACxB;YAEA,oBAAC,gBAAD;GACS;GACP,WAAW,aACT,gBAAgB;IAAE;IAAS,UAAU,OAAO,QAAQ;GAAE,CAAC;EAE1D;CACK;AAEZ"}
|
|
@@ -6,7 +6,8 @@ import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
|
|
|
6
6
|
|
|
7
7
|
//#region src/components/DictionaryEditor/NodeWrapper/NumberWrapper.tsx
|
|
8
8
|
const NumberWrapper = ({ keyPath, section, editedContent, onContentChange, onFocusKeyPath }) => {
|
|
9
|
-
const
|
|
9
|
+
const currentLocale = useEditorLocale();
|
|
10
|
+
const editedContentValue = getContentNodeByKeyPath(editedContent, keyPath, currentLocale);
|
|
10
11
|
if (editedContentValue !== void 0 && typeof editedContentValue !== "number") return /* @__PURE__ */ jsx(Fragment, { children: "Error loading section - Edited content incoherence with the original content format" });
|
|
11
12
|
const level = keyPath.length;
|
|
12
13
|
const content = String(editedContentValue ?? section);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"NumberWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/NumberWrapper.tsx"],"sourcesContent":["import { EditableFieldInput } from '@components/EditableField';\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport { cn } from '@utils/cn';\nimport type { FC } from 'react';\nimport type { NodeWrapperProps } from './index';\n\nexport type NumberWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: number;\n};\n\nexport const NumberWrapper: FC<NumberWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const currentLocale = useEditorLocale();\n const editedContentValue = getContentNodeByKeyPath(\n editedContent,\n keyPath,\n currentLocale\n );\n\n if (\n editedContentValue !== undefined &&\n typeof editedContentValue !== 'number'\n ) {\n return (\n <>\n Error loading section - Edited content incoherence with the original\n content format\n </>\n );\n }\n\n const level = keyPath.length;\n const content = String(editedContentValue ?? section);\n\n return (\n <button\n type=\"button\"\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldInput\n aria-label=\"Editable number field\"\n type=\"number\"\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"mappings":";;;;;;;AAWA,MAAa,iBAAyC,EACpD,SACA,SACA,eACA,iBACA,qBACI;
|
|
1
|
+
{"version":3,"file":"NumberWrapper.mjs","names":[],"sources":["../../../../../src/components/DictionaryEditor/NodeWrapper/NumberWrapper.tsx"],"sourcesContent":["import { EditableFieldInput } from '@components/EditableField';\nimport { getContentNodeByKeyPath } from '@intlayer/core/dictionaryManipulator';\nimport { useEditorLocale } from '@intlayer/editor-react';\nimport { cn } from '@utils/cn';\nimport type { FC } from 'react';\nimport type { NodeWrapperProps } from './index';\n\nexport type NumberWrapperProps = Omit<NodeWrapperProps, 'section'> & {\n section: number;\n};\n\nexport const NumberWrapper: FC<NumberWrapperProps> = ({\n keyPath,\n section,\n editedContent,\n onContentChange,\n onFocusKeyPath,\n}) => {\n const currentLocale = useEditorLocale();\n const editedContentValue = getContentNodeByKeyPath(\n editedContent,\n keyPath,\n currentLocale\n );\n\n if (\n editedContentValue !== undefined &&\n typeof editedContentValue !== 'number'\n ) {\n return (\n <>\n Error loading section - Edited content incoherence with the original\n content format\n </>\n );\n }\n\n const level = keyPath.length;\n const content = String(editedContentValue ?? section);\n\n return (\n <button\n type=\"button\"\n className={cn(\n 'w-full rounded-md p-2 text-left transition',\n 'hover:bg-card/30 [&:has(.section:hover)]:bg-transparent',\n level === 2 && 'hover:bg-card/30',\n level >= 3 && ''\n )}\n onClick={(e) => {\n e.stopPropagation();\n onFocusKeyPath(keyPath);\n }}\n >\n <EditableFieldInput\n aria-label=\"Editable number field\"\n type=\"number\"\n defaultValue={content}\n onSave={(newValue) => onContentChange({ keyPath, newValue })}\n onCancel={() => null}\n />\n </button>\n );\n};\n"],"mappings":";;;;;;;AAWA,MAAa,iBAAyC,EACpD,SACA,SACA,eACA,iBACA,qBACI;CACJ,MAAM,gBAAgB,gBAAgB;CACtC,MAAM,qBAAqB,wBACzB,eACA,SACA,aACF;CAEA,IACE,uBAAuB,UACvB,OAAO,uBAAuB,UAE9B,OACE,0CAAE,sFAGA;CAIN,MAAM,QAAQ,QAAQ;CACtB,MAAM,UAAU,OAAO,sBAAsB,OAAO;CAEpD,OACE,oBAAC,UAAD;EACE,MAAK;EACL,WAAW,GACT,8CACA,2DACA,UAAU,KAAK,oBACf,SAAS,KAAK,EAChB;EACA,UAAU,MAAM;GACd,EAAE,gBAAgB;GAClB,eAAe,OAAO;EACxB;YAEA,oBAAC,oBAAD;GACE,cAAW;GACX,MAAK;GACL,cAAc;GACd,SAAS,aAAa,gBAAgB;IAAE;IAAS;GAAS,CAAC;GAC3D,gBAAgB;EACjB;CACK;AAEZ"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Container } from "../Container/index.mjs";
|
|
4
3
|
import { useGetDictionaries } from "../../api/hooks/dictionary.mjs";
|
|
4
|
+
import { Container } from "../Container/index.mjs";
|
|
5
5
|
import { LocaleSwitcherContent } from "../LocaleSwitcherContentDropDown/LocaleSwitcherContent.mjs";
|
|
6
6
|
import { Pagination } from "../Pagination/Pagination.mjs";
|
|
7
7
|
import { TextEditorContainer } from "./ContentEditorView/TextEditor.mjs";
|
|
@@ -10,8 +10,8 @@ import { KeyPathBreadcrumb } from "./KeyPathBreadcrumb.mjs";
|
|
|
10
10
|
import { NavigationViewNode } from "./NavigationView/NavigationViewNode.mjs";
|
|
11
11
|
import { useCallback, useDeferredValue, useEffect, useMemo, useState, useTransition } from "react";
|
|
12
12
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
-
import { useIntlayer } from "react-intlayer";
|
|
14
13
|
import { useEditedContent, useEditorLocale, useFocusUnmergedDictionary } from "@intlayer/editor-react";
|
|
14
|
+
import { useIntlayer } from "react-intlayer";
|
|
15
15
|
import { getContentNodeByKeyPath } from "@intlayer/core/dictionaryManipulator";
|
|
16
16
|
|
|
17
17
|
//#region src/components/DictionaryFieldEditor/ContentEditor.tsx
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
+
import { useAuditContentDeclarationField } from "../../../api/hooks/ai.mjs";
|
|
3
4
|
import { Loader } from "../../Loader/index.mjs";
|
|
4
5
|
import { Button } from "../../Button/Button.mjs";
|
|
5
6
|
import { Accordion } from "../../Accordion/Accordion.mjs";
|
|
@@ -7,18 +8,17 @@ import { Container } from "../../Container/index.mjs";
|
|
|
7
8
|
import { ContentEditorInput as ContentEditorInput$1 } from "../../ContentEditor/ContentEditorInput.mjs";
|
|
8
9
|
import { ContentEditorTextArea as ContentEditorTextArea$1 } from "../../ContentEditor/ContentEditorTextArea.mjs";
|
|
9
10
|
import { SwitchSelector } from "../../SwitchSelector/SwitchSelector.mjs";
|
|
10
|
-
import { useAuditContentDeclarationField } from "../../../api/hooks/ai.mjs";
|
|
11
11
|
import { useLocaleSwitcherContent } from "../../LocaleSwitcherContentDropDown/LocaleSwitcherContentContext.mjs";
|
|
12
12
|
import { renameKey } from "./object.mjs";
|
|
13
13
|
import { Label } from "../../Label/index.mjs";
|
|
14
14
|
import { EnumKeyInput } from "../EnumKeyInput.mjs";
|
|
15
15
|
import { SafeHtmlRenderer } from "./SafeHtmlRenderer.mjs";
|
|
16
16
|
import { Fragment, Suspense, lazy, memo, useState } from "react";
|
|
17
|
-
import { Plus, Trash, WandSparkles } from "lucide-react";
|
|
18
17
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
18
|
+
import { Plus, Trash, WandSparkles } from "lucide-react";
|
|
19
|
+
import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
|
|
19
20
|
import { useIntlayer, useLocale } from "react-intlayer";
|
|
20
21
|
import { getLocaleName } from "@intlayer/core/localization";
|
|
21
|
-
import { useConfiguration, useEditedContent } from "@intlayer/editor-react";
|
|
22
22
|
import { getEmptyNode, getNodeType } from "@intlayer/core/dictionaryManipulator";
|
|
23
23
|
import * as NodeTypes from "@intlayer/types/nodeType";
|
|
24
24
|
import { camelCaseToSentence } from "@intlayer/config/client";
|
package/dist/esm/components/DictionaryFieldEditor/DictionaryCreationForm/DictionaryCreationForm.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { Button } from "../../Button/Button.mjs";
|
|
4
3
|
import { useSession } from "../../../api/useAuth/useSession.mjs";
|
|
5
4
|
import { useAddDictionary } from "../../../api/hooks/dictionary.mjs";
|
|
6
5
|
import { useGetProjects } from "../../../api/hooks/project.mjs";
|
|
6
|
+
import { Button } from "../../Button/Button.mjs";
|
|
7
7
|
import { MultiSelect } from "../../Select/Multiselect.mjs";
|
|
8
8
|
import { Select } from "../../Select/Select.mjs";
|
|
9
9
|
import { InputElement } from "../../Form/elements/InputElement.mjs";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useDictionaryFormSchema.mjs","names":[],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.ts"],"sourcesContent":["import { useIntlayer } from 'react-intlayer';\nimport { z } from 'zod
|
|
1
|
+
{"version":3,"file":"useDictionaryFormSchema.mjs","names":[],"sources":["../../../../../src/components/DictionaryFieldEditor/DictionaryCreationForm/useDictionaryFormSchema.ts"],"sourcesContent":["import { useIntlayer } from 'react-intlayer';\nimport { z } from 'zod';\n\nexport const QUALIFIER_TYPES = ['none', 'item', 'variant'] as const;\nexport type QualifierType = (typeof QUALIFIER_TYPES)[number];\n\nexport const useDictionarySchema = (projectId: string) => {\n const {\n requiredErrorName,\n invalidTypeErrorName,\n requiredErrorProjectId,\n invalidTypeErrorProjectId,\n } = useIntlayer('dictionary-form-schema');\n\n return z.object({\n key: z\n .string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorName.value\n : invalidTypeErrorName.value,\n })\n .min(1, { error: invalidTypeErrorName.value })\n .default(''),\n projectIds: z\n .array(\n z.string({\n error: (issue) =>\n issue.input === undefined\n ? requiredErrorProjectId.value\n : invalidTypeErrorProjectId.value,\n })\n )\n .default([projectId]),\n qualifierType: z.enum(QUALIFIER_TYPES).default('none'),\n item: z.coerce.number().int().positive().optional(),\n variant: z.string().optional(),\n });\n};\n\nexport type DictionaryFormData = z.infer<\n ReturnType<typeof useDictionarySchema>\n>;\n"],"mappings":";;;;AAGA,MAAa,kBAAkB;CAAC;CAAQ;CAAQ;AAAS;AAGzD,MAAa,uBAAuB,cAAsB;CACxD,MAAM,EACJ,mBACA,sBACA,wBACA,8BACE,YAAY,wBAAwB;CAExC,OAAO,EAAE,OAAO;EACd,KAAK,EACF,OAAO,EACN,QAAQ,UACN,MAAM,UAAU,SACZ,kBAAkB,QAClB,qBAAqB,MAC7B,CAAC,CAAC,CACD,IAAI,GAAG,EAAE,OAAO,qBAAqB,MAAM,CAAC,CAAC,CAC7C,QAAQ,EAAE;EACb,YAAY,EACT,MACC,EAAE,OAAO,EACP,QAAQ,UACN,MAAM,UAAU,SACZ,uBAAuB,QACvB,0BAA0B,MAClC,CAAC,CACH,CAAC,CACA,QAAQ,CAAC,SAAS,CAAC;EACtB,eAAe,EAAE,KAAK,eAAe,CAAC,CAAC,QAAQ,MAAM;EACrD,MAAM,EAAE,OAAO,OAAO,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,CAAC,SAAS;EAClD,SAAS,EAAE,OAAO,CAAC,CAAC,SAAS;CAC/B,CAAC;AACH"}
|