From c11112d72f2be18e03e3f810434dcf66226ea799 Mon Sep 17 00:00:00 2001 From: Pavel Denisjuk Date: Fri, 24 May 2024 01:40:56 +0200 Subject: [PATCH] feat(app-page-builder): make website settings view configurable (#4145) --- packages/app-page-builder/src/index.ts | 2 +- .../WebsiteSettings/AddPbWebsiteSettings.tsx | 141 ------------------ .../WebsiteSettings/WebsiteSettings.tsx | 5 +- .../WebsiteSettings/WebsiteSettingsView.tsx | 31 +++- .../config/DocumentNodeModifier.ts | 85 +++++++++++ .../WebsiteSettings/config/Element.tsx | 46 ++++++ .../modules/WebsiteSettings/config/Group.tsx | 75 ++++++++++ .../config/WebsiteSettingsConfig.tsx | 43 ++++++ .../settingsGroups/DefaultPages.tsx | 20 ++- .../settingsGroups/FaviconAndLogo.tsx | 60 ++++---- .../settingsGroups/GeneralSettings.tsx | 31 ++-- .../settingsGroups/HtmlTags.tsx | 40 +++-- .../settingsGroups/SocialMedia.tsx | 81 ++++++---- .../WebsiteSettings/usePbWebsiteSettings.ts | 21 ++- packages/app-serverless-cms/src/index.tsx | 1 - .../src/modules/themes/index.tsx | 10 +- 16 files changed, 432 insertions(+), 260 deletions(-) delete mode 100644 packages/app-page-builder/src/modules/WebsiteSettings/AddPbWebsiteSettings.tsx create mode 100644 packages/app-page-builder/src/modules/WebsiteSettings/config/DocumentNodeModifier.ts create mode 100644 packages/app-page-builder/src/modules/WebsiteSettings/config/Element.tsx create mode 100644 packages/app-page-builder/src/modules/WebsiteSettings/config/Group.tsx create mode 100644 packages/app-page-builder/src/modules/WebsiteSettings/config/WebsiteSettingsConfig.tsx diff --git a/packages/app-page-builder/src/index.ts b/packages/app-page-builder/src/index.ts index 81c52ad07c4..1a910a36787 100644 --- a/packages/app-page-builder/src/index.ts +++ b/packages/app-page-builder/src/index.ts @@ -4,7 +4,7 @@ export * from "./templateEditor/editorConfig/TemplateEditorConfig"; export * from "./pageEditor/editorConfig/PageEditorConfig"; // Export extension components -export * from "./modules/WebsiteSettings/AddPbWebsiteSettings"; +export { WebsiteSettingsConfig } from "./modules/WebsiteSettings/config/WebsiteSettingsConfig"; export * from "./plugins"; diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/AddPbWebsiteSettings.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/AddPbWebsiteSettings.tsx deleted file mode 100644 index bc19ab58136..00000000000 --- a/packages/app-page-builder/src/modules/WebsiteSettings/AddPbWebsiteSettings.tsx +++ /dev/null @@ -1,141 +0,0 @@ -import React, { createContext, FC, Fragment, memo, useContext, useEffect, useMemo } from "react"; -import { - Compose, - useViewComposition, - DebounceRender, - AddGraphQLQuerySelection -} from "@webiny/app-admin"; -import { SimpleFormHeader, SimpleFormContent } from "@webiny/app-admin/components/SimpleForm"; -import { Cell, Grid } from "@webiny/ui/Grid"; -import { SettingsFields } from "./WebsiteSettingsView"; -import { DocumentNode } from "graphql"; - -interface GroupContextValue { - /** - * Need to figure out better element type. - * @param element - */ - // TODO @ts-refactor - addElement: (element: any) => void; -} -const GroupContext = createContext({ - addElement: () => { - return void 0; - } -}); - -const VIEW_NAME = "PbWebsiteSettings"; - -const tracker: Record = {}; - -interface GenerateElementsProps { - name: string; -} -const GenerateElementsComponent = ({ name }: GenerateElementsProps) => { - if (tracker[name]) { - return null; - } - - tracker[name] = true; - - const ElementsHOC = (Fields: React.ComponentType) => { - return function Elements() { - const { getViewElement } = useViewComposition(); - const element = getViewElement(VIEW_NAME, name); - - if (!element) { - return null; - } - - return ( - - - - - - {element.elements.map((el, index) => ( - - {el} - - ))} - - - - ); - }; - }; - return ; -}; - -const GenerateElements: React.ComponentType = - memo(GenerateElementsComponent); - -GenerateElements.displayName = "GenerateElements"; - -export interface GroupProps { - name: string; - querySelection?: DocumentNode; - label?: string; - children: React.ReactNode; -} - -const Group: FC = ({ name, label, querySelection, children }: GroupProps) => { - const viewComposition = useViewComposition(); - - const context = useMemo( - (): GroupContextValue => ({ - addElement(element) { - viewComposition.setViewElement(VIEW_NAME, name, existing => { - return { - ...existing, - label: label || (existing && existing.label), - elements: [...((existing && existing.elements) || []), element] - }; - }); - } - }), - [] - ); - - return ( - - {children} - - - - {querySelection && ( - - - - - )} - - ); -}; - -interface ElementProps { - children: React.ReactNode; -} - -const Element = ({ children }: ElementProps) => { - const { addElement } = useContext(GroupContext); - - useEffect(() => { - addElement(children); - }, []); - - return null; -}; - -export const AddPbWebsiteSettings = { - Group, - Element -}; diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettings.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettings.tsx index 703f032de95..197d43a34e6 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettings.tsx +++ b/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettings.tsx @@ -8,6 +8,7 @@ import { WebsiteSettingsView } from "./WebsiteSettingsView"; import { FaviconAndLogo } from "./settingsGroups/FaviconAndLogo"; import { SocialMedia } from "./settingsGroups/SocialMedia"; import { HtmlTags } from "./settingsGroups/HtmlTags"; +import { WebsiteSettingsWithConfig } from "./config/WebsiteSettingsConfig"; export const WebsiteSettings = () => { return ( @@ -15,7 +16,9 @@ export const WebsiteSettings = () => { - + + + diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettingsView.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettingsView.tsx index d2f1ec7eba1..5a8b8d91ef3 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettingsView.tsx +++ b/packages/app-page-builder/src/modules/WebsiteSettings/WebsiteSettingsView.tsx @@ -1,15 +1,21 @@ -import React from "react"; -import { CenteredView, createVoidComponent, makeDecoratable } from "@webiny/app-admin"; +import React, { Fragment } from "react"; +import { CenteredView } from "@webiny/app-admin"; import { Form } from "@webiny/form"; import { ButtonPrimary } from "@webiny/ui/Button"; import { CircularProgress } from "@webiny/ui/Progress"; -import { SimpleForm, SimpleFormFooter } from "@webiny/app-admin/components/SimpleForm"; +import { + SimpleForm, + SimpleFormContent, + SimpleFormFooter, + SimpleFormHeader +} from "@webiny/app-admin/components/SimpleForm"; import { usePbWebsiteSettings } from "./usePbWebsiteSettings"; - -export const SettingsFields = makeDecoratable("SettingsFields", createVoidComponent()); +import { WebsiteSettingsConfig } from "~/modules/WebsiteSettings/config/WebsiteSettingsConfig"; +import { Cell, Grid } from "@webiny/ui/Grid"; export const WebsiteSettingsView = () => { const { fetching, saving, settings, saveSettings } = usePbWebsiteSettings(); + const { groups } = WebsiteSettingsConfig.useWebsiteSettingsConfig(); return ( @@ -18,7 +24,20 @@ export const WebsiteSettingsView = () => { {fetching && } {saving && } - + {groups.map(group => ( + + + + + {(group.elements || []).map(el => ( + + {el.element} + + ))} + + + + ))} { diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/config/DocumentNodeModifier.ts b/packages/app-page-builder/src/modules/WebsiteSettings/config/DocumentNodeModifier.ts new file mode 100644 index 00000000000..cbe798c0060 --- /dev/null +++ b/packages/app-page-builder/src/modules/WebsiteSettings/config/DocumentNodeModifier.ts @@ -0,0 +1,85 @@ +import { DocumentNode } from "graphql"; +import { ExecutableDefinitionNode, FieldNode, OperationDefinitionNode } from "graphql/language/ast"; + +declare module "graphql" { + interface DocumentNode { + __cacheKey: string; + } +} + +let documentNodeModifier: DocumentNodeModifier; + +class DocumentNodeModifier { + private cache = new Map(); + + public augmentDocument( + document: DocumentNode, + selectionPath: string, + selections: DocumentNode[] + ) { + const cacheKey = this.createCacheKey(document, selections); + if (this.cache.has(cacheKey)) { + return this.cache.get(cacheKey) as DocumentNode; + } + + const NEW_QUERY = structuredClone(document); + selections.forEach(selection => { + this.addSelectionToQuery(NEW_QUERY, selectionPath, selection); + }); + + this.cache.set(cacheKey, NEW_QUERY); + + return NEW_QUERY; + } + + public addSelectionToQuery( + document: DocumentNode, + selectionPath: string, + addSelection: DocumentNode + ): void { + const firstQueryDefinition = document.definitions[0] as ExecutableDefinitionNode; + if (!firstQueryDefinition) { + return; + } else if (!firstQueryDefinition.selectionSet) { + return; + } + + let tree = firstQueryDefinition.selectionSet.selections as FieldNode[]; + const fields = selectionPath.split("."); + + fieldLoop: for (const field of fields) { + for (const selection of tree) { + if (!selection.selectionSet) { + continue; + } + if (selection.name.value === field) { + tree = selection.selectionSet.selections as FieldNode[]; + continue fieldLoop; + } + } + // If we get here, it means we didn't find the necessary selection + return; + } + /** + * We must cast because there are a lot of types that are not intertwined and TS is complaining + */ + tree.push( + ...((addSelection.definitions[0] as ExecutableDefinitionNode).selectionSet + .selections as FieldNode[]) + ); + } + + private createCacheKey(document: DocumentNode, selections: DocumentNode[]) { + const def = document.definitions[0] as OperationDefinitionNode; + const operationName = def.name?.value; + return [operationName, ...selections.map(node => node.__cacheKey)].join(":"); + } +} + +export function createDocumentNodeModifier() { + if (!documentNodeModifier) { + documentNodeModifier = new DocumentNodeModifier(); + } + + return documentNodeModifier; +} diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/config/Element.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/config/Element.tsx new file mode 100644 index 00000000000..2eba6854b25 --- /dev/null +++ b/packages/app-page-builder/src/modules/WebsiteSettings/config/Element.tsx @@ -0,0 +1,46 @@ +import React from "react"; +import { DocumentNode } from "graphql"; +import { makeDecoratable } from "@webiny/app-admin"; +import { Property, useIdGenerator } from "@webiny/react-properties"; + +export interface ElementConfig { + name: string; + element: JSX.Element; +} + +export interface ElementProps { + name: string; + element?: JSX.Element; + children?: React.ReactNode; + querySelection?: DocumentNode; + remove?: boolean; + before?: string; + after?: string; +} + +export const Element = makeDecoratable( + "WebsiteSettingsElement", + ({ name, remove, before, after, ...props }: ElementProps) => { + const getId = useIdGenerator("element"); + const element = props.element ?? props.children; + + const placeAfter = after !== undefined ? getId(after) : undefined; + const placeBefore = before !== undefined ? getId(before) : undefined; + + return ( + + + {element ? ( + + ) : null} + + ); + } +); diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/config/Group.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/config/Group.tsx new file mode 100644 index 00000000000..b665344d39a --- /dev/null +++ b/packages/app-page-builder/src/modules/WebsiteSettings/config/Group.tsx @@ -0,0 +1,75 @@ +import React from "react"; +import { DocumentNode } from "graphql"; +import { makeDecoratable } from "@webiny/app-admin"; +import { Property, useIdGenerator } from "@webiny/react-properties"; +import { generateAlphaNumericId } from "@webiny/utils"; +import { ElementConfig } from "./Element"; + +declare module "graphql" { + interface DocumentNode { + __cacheKey: string; + } +} + +export interface GroupConfig { + name: string; + label: string; + elements: ElementConfig[]; + querySelection?: DocumentNode; +} + +export interface GroupProps { + name: string; + label?: string; + children?: React.ReactNode; + querySelection?: DocumentNode; + remove?: boolean; + before?: string; + after?: string; +} + +const withUniqueId = (node: DocumentNode) => { + if (node.__cacheKey) { + return node; + } + + node.__cacheKey = generateAlphaNumericId(8); + return node; +}; + +export const Group = makeDecoratable( + "WebsiteSettingsGroup", + ({ name, label, querySelection, children, remove, before, after }: GroupProps) => { + const getId = useIdGenerator("group"); + + const placeAfter = after !== undefined ? getId(after) : undefined; + const placeBefore = before !== undefined ? getId(before) : undefined; + + return ( + <> + + + {label ? ( + + ) : null} + {children ?? null} + + {querySelection ? ( + + ) : null} + + ); + } +); diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/config/WebsiteSettingsConfig.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/config/WebsiteSettingsConfig.tsx new file mode 100644 index 00000000000..7b26588aaf9 --- /dev/null +++ b/packages/app-page-builder/src/modules/WebsiteSettings/config/WebsiteSettingsConfig.tsx @@ -0,0 +1,43 @@ +import { DocumentNode } from "graphql"; +import { createConfigurableComponent } from "@webiny/react-properties"; +import { Group, GroupConfig } from "./Group"; +import { Element } from "./Element"; +import { GET_SETTINGS, UPDATE_SETTINGS } from "../graphql"; +import { createDocumentNodeModifier } from "./DocumentNodeModifier"; + +const base = createConfigurableComponent("WebsiteSettingsConfig"); + +export const WebsiteSettingsWithConfig = Object.assign(base.WithConfig, { + displayName: "WebsiteSettingsWithConfig" +}); + +interface WebsiteSettingsConfig { + groups: GroupConfig[]; + querySelections: DocumentNode[]; +} + +function useWebsiteSettingsConfig() { + const config = base.useConfig(); + const querySelections = config.querySelections || []; + const documentModifier = createDocumentNodeModifier(); + + return { + groups: config.groups || [], + GET_SETTINGS: documentModifier.augmentDocument( + GET_SETTINGS, + "pageBuilder.getSettings.data", + querySelections + ), + UPDATE_SETTINGS: documentModifier.augmentDocument( + UPDATE_SETTINGS, + "pageBuilder.updateSettings.data", + querySelections + ) + }; +} + +export const WebsiteSettingsConfig = Object.assign(base.Config, { + Group, + Element, + useWebsiteSettingsConfig +}); diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/DefaultPages.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/DefaultPages.tsx index 12c5fb137de..78d1af856cf 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/DefaultPages.tsx +++ b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/DefaultPages.tsx @@ -1,12 +1,10 @@ import React from "react"; import { Bind } from "@webiny/form"; import { ButtonIcon, ButtonPrimary } from "@webiny/ui/Button"; -import { AddPbWebsiteSettings } from "../AddPbWebsiteSettings"; import { usePbWebsiteSettings } from "../usePbWebsiteSettings"; import { PagesAutocomplete } from "~/admin/components/PagesAutocomplete"; import { ReactComponent as EditIcon } from "~/admin/assets/edit.svg"; - -const { Group, Element } = AddPbWebsiteSettings; +import { WebsiteSettingsConfig } from "~/modules/WebsiteSettings/config/WebsiteSettingsConfig"; const Homepage = () => { const { settings, editPage } = usePbWebsiteSettings(); @@ -46,15 +44,15 @@ const NotFoundPage = () => { ); }; +const { Group, Element } = WebsiteSettingsConfig; + export const DefaultPages = () => { return ( - - - - - - - - + + + } /> + } /> + + ); }; diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/FaviconAndLogo.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/FaviconAndLogo.tsx index f216ac49b90..4e855a82e99 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/FaviconAndLogo.tsx +++ b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/FaviconAndLogo.tsx @@ -1,35 +1,43 @@ import React from "react"; import { Bind } from "@webiny/form"; -import { AddPbWebsiteSettings } from "../AddPbWebsiteSettings"; import SingleImageUpload from "@webiny/app-admin/components/SingleImageUpload"; +import { WebsiteSettingsConfig } from "~/modules/WebsiteSettings/config/WebsiteSettingsConfig"; -const { Group, Element } = AddPbWebsiteSettings; +const { Group, Element } = WebsiteSettingsConfig; export const FaviconAndLogo = () => { return ( - - - - - Supported file types: .png and{" "} - .ico . - - } - /> - - - - - - - - + + + + + Supported file types: .png and{" "} + .ico . + + } + /> + + } + /> + + + + } + /> + + ); }; diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/GeneralSettings.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/GeneralSettings.tsx index fa279eee32f..44db66e8add 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/GeneralSettings.tsx +++ b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/GeneralSettings.tsx @@ -2,10 +2,10 @@ import React from "react"; import { Bind } from "@webiny/form"; import { validation } from "@webiny/validation"; import { Input } from "@webiny/ui/Input"; -import { AddPbWebsiteSettings } from "../AddPbWebsiteSettings"; import { usePbWebsiteSettings } from "../usePbWebsiteSettings"; +import { WebsiteSettingsConfig } from "~/modules/WebsiteSettings/config/WebsiteSettingsConfig"; -const { Group, Element } = AddPbWebsiteSettings; +const { Group, Element } = WebsiteSettingsConfig; const WebsiteURL = () => { const { defaultSettings } = usePbWebsiteSettings(); @@ -64,18 +64,19 @@ const WebsitePreviewURL = () => { export const GeneralSettings = () => { return ( - - - - - - - - - - - - - + + + + + + } + /> + } /> + } /> + + ); }; diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/HtmlTags.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/HtmlTags.tsx index c2719059155..363eca6cf8f 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/HtmlTags.tsx +++ b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/HtmlTags.tsx @@ -1,7 +1,7 @@ import React from "react"; import { css } from "emotion"; import { Bind } from "@webiny/form"; -import { AddPbWebsiteSettings } from "../AddPbWebsiteSettings"; +import { WebsiteSettingsConfig } from "~/modules/WebsiteSettings/config/WebsiteSettingsConfig"; import { CodeEditor } from "@webiny/ui/CodeEditor"; import { Typography } from "@webiny/ui/Typography"; @@ -37,25 +37,33 @@ const CodeEditorInput = ({ name, label, description }: CodeEditorInputProps) => ); }; -const { Group, Element } = AddPbWebsiteSettings; +const { Group, Element } = WebsiteSettingsConfig; export const HtmlTags = () => { return ( - - - + + + } /> - - - + } /> - - + + ); }; diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/SocialMedia.tsx b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/SocialMedia.tsx index c3fa60aea0b..e89ce64b15a 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/SocialMedia.tsx +++ b/packages/app-page-builder/src/modules/WebsiteSettings/settingsGroups/SocialMedia.tsx @@ -1,43 +1,60 @@ import React from "react"; import { Bind } from "@webiny/form"; -import { AddPbWebsiteSettings } from "../AddPbWebsiteSettings"; +import { WebsiteSettingsConfig } from "~/modules/WebsiteSettings/config/WebsiteSettingsConfig"; import SingleImageUpload from "@webiny/app-admin/components/SingleImageUpload"; import { Input } from "@webiny/ui/Input"; import { validation } from "@webiny/validation"; -const { Group, Element } = AddPbWebsiteSettings; +const { Group, Element } = WebsiteSettingsConfig; export const SocialMedia = () => { return ( - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + + + } + /> + + ); }; diff --git a/packages/app-page-builder/src/modules/WebsiteSettings/usePbWebsiteSettings.ts b/packages/app-page-builder/src/modules/WebsiteSettings/usePbWebsiteSettings.ts index ffb4004bf52..ca20fc2e187 100644 --- a/packages/app-page-builder/src/modules/WebsiteSettings/usePbWebsiteSettings.ts +++ b/packages/app-page-builder/src/modules/WebsiteSettings/usePbWebsiteSettings.ts @@ -1,19 +1,19 @@ -import { useCallback, useState } from "react"; +import { useCallback, useState, useEffect, useMemo } from "react"; import get from "lodash/get"; import set from "lodash/set"; -import { useMutation, useQuery } from "@apollo/react-hooks"; +import debounce from "lodash/debounce"; +import { useLazyQuery, useMutation } from "@apollo/react-hooks"; import { useSnackbar } from "@webiny/app-admin"; import { sendEvent } from "@webiny/telemetry/react"; import { - GET_SETTINGS, GetSettingsQueryResponse, GetSettingsResponseData, - UPDATE_SETTINGS, UpdateSettingsMutationResponse, UpdateSettingsMutationVariables } from "./graphql"; import { PbErrorResponse } from "~/types"; import { useNavigatePage } from "~/admin/hooks/useNavigatePage"; +import { WebsiteSettingsConfig } from "~/modules/WebsiteSettings/config/WebsiteSettingsConfig"; interface PageBuilderWebsiteSettings { id?: string; @@ -23,10 +23,13 @@ interface PageBuilderWebsiteSettings { export function usePbWebsiteSettings() { const { showSnackbar } = useSnackbar(); const { navigateToPageEditor } = useNavigatePage(); + const { GET_SETTINGS, UPDATE_SETTINGS } = WebsiteSettingsConfig.useWebsiteSettingsConfig(); const [error, setError] = useState(null); - const { data, loading: queryInProgress } = useQuery(GET_SETTINGS); + const [getSettings, { data, loading: queryInProgress }] = + useLazyQuery(GET_SETTINGS); + const settings = get( data, "pageBuilder.getSettings.data", @@ -61,6 +64,14 @@ export function usePbWebsiteSettings() { } }); + const debouncedGetSettings = useMemo(() => { + return debounce(getSettings, 20); + }, []); + + useEffect(() => { + debouncedGetSettings(); + }, []); + const onSubmit = useCallback( /** * Figure out correct type for data. diff --git a/packages/app-serverless-cms/src/index.tsx b/packages/app-serverless-cms/src/index.tsx index 0876132abf3..ea278badc57 100644 --- a/packages/app-serverless-cms/src/index.tsx +++ b/packages/app-serverless-cms/src/index.tsx @@ -68,5 +68,4 @@ export { HasPermission, useSecurity, usePermission } from "@webiny/app-security" export { useTenancy } from "@webiny/app-tenancy"; export type { Tenant } from "@webiny/app-tenancy"; -export { AddPbWebsiteSettings } from "@webiny/app-page-builder"; export * from "./apolloClientFactory"; diff --git a/packages/app-theme-manager/src/modules/themes/index.tsx b/packages/app-theme-manager/src/modules/themes/index.tsx index afd112a4df9..7ecf01a21dc 100644 --- a/packages/app-theme-manager/src/modules/themes/index.tsx +++ b/packages/app-theme-manager/src/modules/themes/index.tsx @@ -1,7 +1,7 @@ import React, { Fragment, memo, useEffect, useRef } from "react"; import gql from "graphql-tag"; import { Provider, Plugins } from "@webiny/app-admin"; -import { AddPbWebsiteSettings } from "@webiny/app-page-builder"; +import { WebsiteSettingsConfig } from "@webiny/app-page-builder"; import { AddTenantFormField, IsRootTenant, IsNotRootTenant } from "@webiny/app-tenant-manager"; import { useBind } from "@webiny/form"; import { AutoComplete } from "@webiny/ui/AutoComplete"; @@ -15,7 +15,7 @@ import { ThemeLoader } from "~/components/ThemeLoader"; import { useCurrentTheme } from "~/hooks/useCurrentTheme"; import { ThemeSource } from "~/types"; -const { Group, Element } = AddPbWebsiteSettings; +const { Group, Element } = WebsiteSettingsConfig; const tenantFormFieldsSelection = gql` { @@ -77,9 +77,9 @@ const WebsiteSettingsSelection = gql` const WebsiteSettings = () => { return ( - + - + @@ -88,7 +88,7 @@ const WebsiteSettings = () => { - + ); };