From 8d438e799c8908d27702cb44b5a7ae36558d2ffc Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Tue, 2 Dec 2025 13:21:40 +0545 Subject: [PATCH 1/3] fix(OUT-2683): add script to modify static placeholder into dynamic handlebars template string --- scripts/replace-static-placeholder/index.ts | 43 +++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 scripts/replace-static-placeholder/index.ts diff --git a/scripts/replace-static-placeholder/index.ts b/scripts/replace-static-placeholder/index.ts new file mode 100644 index 0000000..157f138 --- /dev/null +++ b/scripts/replace-static-placeholder/index.ts @@ -0,0 +1,43 @@ +import DBClient from "@/lib/db"; + +const db = DBClient.getInstance(); + +const run = async () => { + const faultyContent = await db.setting.findMany({ + where: { + content: { + contains: " {workspace.brandName} ", + }, + }, + }); + + console.info( + `Found ${faultyContent.length} faulty rows with hardcoded {workspace.brandName}`, + ); + + let counter = 0; + + for (const row of faultyContent) { + // Replace static placeholder with data that was supposed to be rendered + const newContent = row.content?.replaceAll( + " {workspace.brandName} ", + ' {{workspace.brandName}} ', + ); + try { + // This technically can be done with an updateMany -> regex replace matcher but, meh + console.info(" > Fixing data for setting with id", row.id); + await db.setting.update({ + where: { id: row.id }, + data: { + content: newContent, + }, + }); + counter++; + } catch (e) { + console.error(e); + } + } + console.info("Fixed static rows for", counter, "entries"); +}; + +run(); From 9c447bad730688fd6f24873bb26546b238961ffc Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Tue, 2 Dec 2025 13:22:07 +0545 Subject: [PATCH 2/3] fix(OUT-2683): replace hardcoded {workspace.brandName} with dynamic handlebars string --- defaultState.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/defaultState.ts b/defaultState.ts index eea8787..d785cdf 100644 --- a/defaultState.ts +++ b/defaultState.ts @@ -6,7 +6,7 @@ const brandNameAutofill = ` > {{workspace.brandName}} -` +`; export const defaultState = ` @@ -89,5 +89,5 @@ export const defaultState = `

💬 Messages

-

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

-` +

Questions? Chat with the ${brandNameAutofill} team and get answers.

+`; From c71493f454549414a3fc4123ca59e18b94dbe6e6 Mon Sep 17 00:00:00 2001 From: Rojan Rajbhandari Date: Tue, 2 Dec 2025 13:32:39 +0545 Subject: [PATCH 3/3] fix(OUT-2683): lint & format code --- defaultState.ts | 4 +-- scripts/replace-static-placeholder/index.ts | 30 ++++++++++----------- src/app/globals.css | 2 +- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/defaultState.ts b/defaultState.ts index d785cdf..202e6e5 100644 --- a/defaultState.ts +++ b/defaultState.ts @@ -6,7 +6,7 @@ const brandNameAutofill = ` > {{workspace.brandName}} -`; +` export const defaultState = ` @@ -90,4 +90,4 @@ export const defaultState = `

💬 Messages

Questions? Chat with the ${brandNameAutofill} team and get answers.

-`; +` diff --git a/scripts/replace-static-placeholder/index.ts b/scripts/replace-static-placeholder/index.ts index 157f138..3d4512a 100644 --- a/scripts/replace-static-placeholder/index.ts +++ b/scripts/replace-static-placeholder/index.ts @@ -1,43 +1,43 @@ -import DBClient from "@/lib/db"; +import DBClient from '@/lib/db' -const db = DBClient.getInstance(); +const db = DBClient.getInstance() const run = async () => { const faultyContent = await db.setting.findMany({ where: { content: { - contains: " {workspace.brandName} ", + contains: ' {workspace.brandName} ', }, }, - }); + }) console.info( `Found ${faultyContent.length} faulty rows with hardcoded {workspace.brandName}`, - ); + ) - let counter = 0; + let counter = 0 for (const row of faultyContent) { // Replace static placeholder with data that was supposed to be rendered const newContent = row.content?.replaceAll( - " {workspace.brandName} ", + ' {workspace.brandName} ', ' {{workspace.brandName}} ', - ); + ) try { // This technically can be done with an updateMany -> regex replace matcher but, meh - console.info(" > Fixing data for setting with id", row.id); + console.info(' > Fixing data for setting with id', row.id) await db.setting.update({ where: { id: row.id }, data: { content: newContent, }, - }); - counter++; + }) + counter++ } catch (e) { - console.error(e); + console.error(e) } } - console.info("Fixed static rows for", counter, "entries"); -}; + console.info('Fixed static rows for', counter, 'entries') +} -run(); +run() diff --git a/src/app/globals.css b/src/app/globals.css index b092483..b77944d 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -173,7 +173,7 @@ table { margin-top: 4px; margin-bottom: 4px; padding: 3px 0px; - word-break:break-word; + word-break: break-word; } .callout-container > .callout-icon {