diff --git a/defaultState.ts b/defaultState.ts index 5becac2..eea8787 100644 --- a/defaultState.ts +++ b/defaultState.ts @@ -1,2 +1,93 @@ -export const defaultState = `This page is a sample of what you can include in your Home app. Edit the content and add a banner image to give your __client__ a personalized experience when they open up the __client__ portal.

The Tasks widget will show __client__ notifications for actions they have to take (in real-time), if they have any.

Welcome, {{__client__.givenName}}

Welcome to Assembly, a full-service marketing agency that helps businesses increase their brand awareness, attract new customers, and grow their bottom line. We specialize in crafting unique and effective marketing strategies that align with your business goals and help you stand out in a crowded marketplace.

Here are our Working Hours:

Days

Hours (EST)

M-F

9AM - 6PM

Sat

10AM - 5PM

Sun

Closed

How to use the Assembly portal

πŸ’¬ Messages

Chat with the Assembly team or ask questions β€” make sure to check the Helpdesk first for some FAQs!

πŸ“‚ Files

Use this tab to share files with the Assembly team β€” you can upload any required documents and assets here. This is where we will store files for reference in the future.

πŸ“œ Contracts

View and sign contracts shared by our team.

πŸ“€ Forms

We’ve already shared our onboarding form with you. Please fill out the form and include all relevant information, including your brand guidelines and company details.

πŸ’΅ Billing

Here you will see active subscription and invoices once they’ve been assigned to you.

πŸ†˜ Helpdesk

Access a collection of helpful articles we have put together.

πŸ“Š Analytics

View custom analytics reports for your business.

πŸŒ‡ Media Gallery

See any visual and design work that the Assembly team has completed.

πŸ“ˆ Project status

Track the projects we’re working on for you.

`; +const brandNameAutofill = ` + + {{workspace.brandName}} + +` +export const defaultState = ` + + + + This page is an example. Edit the content and add a banner image in your + Client Home app to give your clients a personalized experience when they open + up the client portal. +

+ The action items widget will show client notifications for actions they have + to take (in real-time), if they have any. +
+ +

+ Welcome, + {{__client__.givenName}} + +

+

+ +

Welcome to your ${brandNameAutofill} client portal.

+ +

+ This portal is your all-in-one experience while working with ${brandNameAutofill} where you can view and complete important tasks and connect with our team. +

+

+ +

Here are our Working Hours:

+ + + + + + + + + + + + + + + + + + + + +
+

Days

+
+

Hours (EST)

+
+

M-F

+
+

9AM - 6PM

+
+

Sat

+
+

9AM - 6PM

+
+

Sun

+
+

Closed

+
+ +

How to use the ${brandNameAutofill} portal

+

+ +

+ Save the link to this portal. If you miss an email notification, you can + always log in and check this portal for reminders on important tasks and + actions required. Explore the options on your left sidebar. We may add more + options tailored to your experience. +

+

+ +

πŸ’¬ Messages

+

Questions? Chat with the {workspace.brandName} team and get answers.

+` diff --git a/src/app/client-preview/page.tsx b/src/app/client-preview/page.tsx index 3e4261e..24ef3db 100644 --- a/src/app/client-preview/page.tsx +++ b/src/app/client-preview/page.tsx @@ -169,7 +169,10 @@ export default async function ClientPreviewPage({ company: company?.name, } - const htmlContent = template({ client }) + const htmlContent = template({ + client, + workspace: { brandName: workspace.brandName }, + }) const bannerImgUrl = !defaultSetting ? defaultBannerImagePath diff --git a/src/app/components/EditorInterface.tsx b/src/app/components/EditorInterface.tsx index ecc92d6..5ca1775 100644 --- a/src/app/components/EditorInterface.tsx +++ b/src/app/components/EditorInterface.tsx @@ -200,9 +200,10 @@ const EditorInterface = ({ ), ), ) - const c = template(appData) + const htmlContent = template(appData) + setTimeout(() => { - editor?.chain().focus().setContent(c).run() + editor?.chain().focus().setContent(htmlContent).run() editor?.chain().focus().setTextSelection(0).run() }) } else { diff --git a/src/app/components/SideBarInterface.tsx b/src/app/components/SideBarInterface.tsx index 6d1b67c..be87bfa 100644 --- a/src/app/components/SideBarInterface.tsx +++ b/src/app/components/SideBarInterface.tsx @@ -6,7 +6,7 @@ import AutofillFields from '@/components/autofillFields/AutofillFields' import ColorPicker from '@/components/colorPicker/ColorPicker' import DisplayTasksToggle from '@/components/display/DisplayTasksToggle' import { useAppState } from '@/hooks/useAppState' -import { CompanyResponse } from '@/types/common' +import { CompanyResponse, WorkspaceInfo } from '@/types/common' import { IClient, ICustomField } from '@/types/interfaces' import { flattenClients } from '@/utils/api' import { @@ -23,6 +23,7 @@ interface IEditorInterface { displayTasks: boolean clientList: IClient[] companies: CompanyResponse[] + workspace: WorkspaceInfo customFields: ICustomField[] } @@ -30,6 +31,7 @@ const SideBarInterface: FC = ({ displayTasks, clientList, companies, + workspace, customFields, }) => { const sideBarRef = useRef(null) @@ -96,7 +98,8 @@ const SideBarInterface: FC = ({ appState?.setClientList(clientList) appState?.setCompanies(companies) appState?.setCustomFields(customFields) - }, [displayTasks, clientList, companies, customFields]) + appState?.setBrandName(workspace.brandName) + }, [displayTasks, clientList, companies, customFields, workspace]) useEffect(() => { ;(async () => { diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 37a92eb..ffcd61d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -24,12 +24,12 @@ export default async function RootLayout({ var t = ev.target; if (t && t.tagName === 'IFRAME') { ev.stopImmediatePropagation(); - console.log('[iframe load error]', t.src); + console.info('[iframe load error]', t.src); return; } if (ev instanceof ErrorEvent && ev.message === 'Script error.') { ev.stopImmediatePropagation(); - console.log('[iframe script error]', ev.filename); + console.info('[iframe script error]', ev.filename); return; } }, true); diff --git a/src/app/page.tsx b/src/app/page.tsx index 907d0bf..5deab1d 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -117,6 +117,7 @@ export default async function Page({ displayTasks={settings?.displayTasks} clientList={clientList} companies={companies} + workspace={workspace} customFields={customFields} /> diff --git a/src/components/tiptap/autofieldSelector/autofillMenuSuggestion.ts b/src/components/tiptap/autofieldSelector/autofillMenuSuggestion.ts index 439e2a9..0f39814 100644 --- a/src/components/tiptap/autofieldSelector/autofillMenuSuggestion.ts +++ b/src/components/tiptap/autofieldSelector/autofillMenuSuggestion.ts @@ -41,7 +41,6 @@ export const autofillMenuSuggestion = { ...customFields.map((el: any) => `{{__client__.${el.key}}}`), ] .map((text) => prepareCustomLabel(text, appContextData?.customLabels)) - .filter((item: any) => item ?.toLowerCase() diff --git a/src/components/tiptap/iframe/EmbedComponent.tsx b/src/components/tiptap/iframe/EmbedComponent.tsx index 43e2855..b2af5c1 100644 --- a/src/components/tiptap/iframe/EmbedComponent.tsx +++ b/src/components/tiptap/iframe/EmbedComponent.tsx @@ -68,7 +68,7 @@ export const EmbedComponent = (props: any) => { height='100%' onError={(e) => { e.stopPropagation() - console.log('[iframe error]:', e) + console.info('[iframe error]:', e) }} /> diff --git a/src/components/tiptap/notificationWidget/NotificationWidget.tsx b/src/components/tiptap/notificationWidget/NotificationWidget.tsx index 97a0c88..7a6c64b 100644 --- a/src/components/tiptap/notificationWidget/NotificationWidget.tsx +++ b/src/components/tiptap/notificationWidget/NotificationWidget.tsx @@ -160,6 +160,7 @@ export const NotificationWidget = () => { }, )} + void setTasks: (tasks: number) => void setCustomLabels: (customLabels?: CustomLabels) => void + setBrandName: (brandName?: string | null) => void /* eslint-enable no-unused-vars */ } @@ -100,6 +102,7 @@ export const AppContextProvider: FC = ({ children }) => { font: 'Inter', //default font tasks: undefined, customLabels: undefined, + brandName: '', }) useEffect(() => { @@ -203,6 +206,10 @@ export const AppContextProvider: FC = ({ children }) => { const setCustomLabels = (customLabels?: CustomLabels) => setState((prev) => ({ ...prev, customLabels })) + const setBrandName = (brandName?: string | null) => { + setState((prev) => ({ ...prev, brandName: brandName || '' })) + } + return ( = ({ children }) => { setFont, setTasks, setCustomLabels, + setBrandName, }} > {children} diff --git a/src/hooks/useAppData.tsx b/src/hooks/useAppData.tsx index 66f4a1e..f3bf619 100644 --- a/src/hooks/useAppData.tsx +++ b/src/hooks/useAppData.tsx @@ -107,11 +107,13 @@ export const AppDataProvider = ({ children }: PropsWithChildren) => { form, contract, tasks, + workspace: { brandName: appState?.appState.brandName || '' }, } }, [ appState?.appState.selectedClient, appState?.appState.selectedClientCompanyName, appState?.appState.notifications, + appState?.appState.brandName, ]) return ( diff --git a/src/types/common.ts b/src/types/common.ts index c58b18e..6b052f2 100644 --- a/src/types/common.ts +++ b/src/types/common.ts @@ -125,5 +125,6 @@ export type CustomLabels = z.infer export const WorkspaceInfoSchema = z.object({ font: z.string(), labels: CustomLabelsSchema, + brandName: z.string().nullish(), }) export type WorkspaceInfo = z.infer diff --git a/src/utils/constants.ts b/src/utils/constants.ts index 09ba447..3e7ae46 100644 --- a/src/utils/constants.ts +++ b/src/utils/constants.ts @@ -1,4 +1,5 @@ export const staticAutofillValues = [ + '{{workspace.brandName}}', '{{__client__.givenName}}', '{{__client__.familyName}}', '{{__client__.email}}', diff --git a/src/utils/customLabels.ts b/src/utils/customLabels.ts index 76cea73..c9135b0 100644 --- a/src/utils/customLabels.ts +++ b/src/utils/customLabels.ts @@ -45,7 +45,7 @@ export const prepareCustomLabel = ( isClientMode?: boolean }, ) => { - if (!text) return text + if (!text || !text.includes('__client__')) return text let result = text