From 1b8e3194362e64bdf95a697b6314579658487fe9 Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Thu, 6 Nov 2025 19:36:58 +0545 Subject: [PATCH 01/10] feat(OUT-2531): support brandname in autofill fields --- src/utils/constants.ts | 1 + 1 file changed, 1 insertion(+) 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}}', From b907553b9bf9e959b6637944def3845b4747e5fc Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Thu, 6 Nov 2025 19:37:37 +0545 Subject: [PATCH 02/10] feat(OUT-2531): support brandName in appState --- src/app/components/SideBarInterface.tsx | 11 +++++++++-- src/app/page.tsx | 1 + src/context/index.tsx | 8 ++++++++ src/types/common.ts | 1 + 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/app/components/SideBarInterface.tsx b/src/app/components/SideBarInterface.tsx index 6d1b67c..25de6de 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,12 @@ 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(() => { + console.log('xxx', appState?.appState?.brandName) + }, [appState]) useEffect(() => { ;(async () => { 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/context/index.tsx b/src/context/index.tsx index 01191c5..a2d3dcd 100644 --- a/src/context/index.tsx +++ b/src/context/index.tsx @@ -36,6 +36,7 @@ export interface IAppState { font: string tasks?: number customLabels?: CustomLabels + brandName?: string } export interface IAppContext { @@ -64,6 +65,7 @@ export interface IAppContext { setFont: (font: string) => 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: 'us', }) 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 || 'us' })) + } + return ( = ({ children }) => { setFont, setTasks, setCustomLabels, + setBrandName, }} > {children} 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 From b520fa783d23cca77f958c1a10409a0c01c489f0 Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Thu, 6 Nov 2025 19:38:27 +0545 Subject: [PATCH 03/10] perf(OUT-2531): optimize custom label preparation --- src/utils/customLabels.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From ae1af68c62233ea5979ab60db26b8b2dd595e614 Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Thu, 6 Nov 2025 19:39:06 +0545 Subject: [PATCH 04/10] refactor(OUT-2531): clean code --- .../tiptap/autofieldSelector/autofillMenuSuggestion.ts | 1 - 1 file changed, 1 deletion(-) 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() From d4a6bfc688490947d6f15b8612b0290b8884a94e Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Fri, 7 Nov 2025 14:58:41 +0545 Subject: [PATCH 05/10] feat(OUT-2531): add new defaultState --- defaultState.ts | 85 ++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 84 insertions(+), 1 deletion(-) diff --git a/defaultState.ts b/defaultState.ts index 5becac2..df316f5 100644 --- a/defaultState.ts +++ b/defaultState.ts @@ -1,2 +1,85 @@ -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.

`; +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 {workspace.brandName} client portal.

+ +

+ This portal is your all-in-one experience while working with + {workspace.brandName} 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 {workspace.brandName} 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.

+` From 27e03db7def48635d1735cb2a9932e0eeb6f92bf Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Fri, 7 Nov 2025 14:58:57 +0545 Subject: [PATCH 06/10] refactor(OUT-2531): proper linting --- src/components/tiptap/notificationWidget/NotificationWidget.tsx | 1 + 1 file changed, 1 insertion(+) 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 = () => { }, )} + Date: Fri, 7 Nov 2025 15:22:34 +0545 Subject: [PATCH 07/10] refactor(OUT-2531): prevent use of console.log in prod --- src/app/layout.tsx | 4 ++-- src/components/tiptap/iframe/EmbedComponent.tsx | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) 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/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) }} /> From ef56d20cbd117f35b6b58dc1181ad7d41d1f3b1e Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Fri, 7 Nov 2025 15:22:50 +0545 Subject: [PATCH 08/10] feat(OUT-2531): inject workspace brandName in context --- src/context/index.tsx | 4 ++-- src/hooks/useAppData.tsx | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/context/index.tsx b/src/context/index.tsx index a2d3dcd..7a96360 100644 --- a/src/context/index.tsx +++ b/src/context/index.tsx @@ -102,7 +102,7 @@ export const AppContextProvider: FC = ({ children }) => { font: 'Inter', //default font tasks: undefined, customLabels: undefined, - brandName: 'us', + brandName: '', }) useEffect(() => { @@ -207,7 +207,7 @@ export const AppContextProvider: FC = ({ children }) => { setState((prev) => ({ ...prev, customLabels })) const setBrandName = (brandName?: string | null) => { - setState((prev) => ({ ...prev, brandName: brandName || 'us' })) + setState((prev) => ({ ...prev, brandName: brandName || '' })) } return ( 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 ( From 0559253089117ffd1a974086ba5edbf6ff970f6a Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Fri, 7 Nov 2025 15:23:15 +0545 Subject: [PATCH 09/10] feat(OUT-2531): implement brandname injection in rendered htmlContent --- src/app/client-preview/page.tsx | 5 ++++- src/app/components/EditorInterface.tsx | 5 +++-- src/app/components/SideBarInterface.tsx | 4 ---- 3 files changed, 7 insertions(+), 7 deletions(-) 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 25de6de..be87bfa 100644 --- a/src/app/components/SideBarInterface.tsx +++ b/src/app/components/SideBarInterface.tsx @@ -101,10 +101,6 @@ const SideBarInterface: FC = ({ appState?.setBrandName(workspace.brandName) }, [displayTasks, clientList, companies, customFields, workspace]) - useEffect(() => { - console.log('xxx', appState?.appState?.brandName) - }, [appState]) - useEffect(() => { ;(async () => { const imagePickerUtils = new ImagePickerUtils() From 13305d94c54e6b27aabd72a44638a7d02d51d05b Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Fri, 7 Nov 2025 15:30:19 +0545 Subject: [PATCH 10/10] fix(OUT-2531): remove dummy placeholder for workspace.brandName --- defaultState.ts | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/defaultState.ts b/defaultState.ts index df316f5..eea8787 100644 --- a/defaultState.ts +++ b/defaultState.ts @@ -1,3 +1,13 @@ +const brandNameAutofill = ` + + {{workspace.brandName}} + +` + export const defaultState = ` @@ -11,22 +21,20 @@ export const defaultState = `

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

-

Welcome to your {workspace.brandName} client portal.

+

Welcome to your ${brandNameAutofill} client portal.

- This portal is your all-in-one experience while working with - {workspace.brandName} where you can view and complete important tasks and - connect with our team. + 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.

@@ -69,7 +77,7 @@ export const defaultState = ` -

How to use the {workspace.brandName} portal

+

How to use the ${brandNameAutofill} portal