feat(get-user): emit brand_chrome for Hamkar brandManaged opt-in

Expose brand_chrome so apps apply header/menu/body colors only after SuperAdmin color save.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-10-14 17:04:35 +03:30
co-authored by Cursor
parent 7521c69c11
commit 9031135797
4 changed files with 11 additions and 0 deletions
@@ -207,11 +207,13 @@ async function main() {
if (tenant.product === 'hamkar') {
const managed = existingUi?.kind === 'hamkar' && existingUi?.settingsManaged === true
const brandManaged = existingUi?.kind === 'hamkar' && existingUi?.brandManaged === true
const built = buildHamkarUiFromBrand({
primaryColor: primary,
secondaryColor: secondary,
backgroundColor: background,
settingsManaged: managed,
brandManaged,
registryMode: registryMode || existingUi?.registryMode || 'dynamicMode',
settings: managed ? existingUi.settings : undefined,
})
+2
View File
@@ -34,6 +34,7 @@ export function buildHamkarUiFromBrand(input: {
secondaryColor?: string | null
backgroundColor?: string | null
settingsManaged?: boolean
brandManaged?: boolean
registryMode?: string | null
settings?: {
pricing_box_theme?: string
@@ -57,6 +58,7 @@ export function buildHamkarUiFromBrand(input: {
const base = {
kind: 'hamkar' as const,
settingsManaged: Boolean(input.settingsManaged),
brandManaged: Boolean(input.brandManaged),
registryMode: input.registryMode || 'dynamicMode',
brand: {
// Keep nulls — do NOT invent #1d4ed8 (causes wrong accent vs live registry)
+1
View File
@@ -171,6 +171,7 @@ async function main() {
? keepSnapshot.brand?.backgroundColor
: existing?.brand?.backgroundColor ?? brandBackground,
settingsManaged: Boolean(existing?.settingsManaged),
brandManaged: Boolean(existing?.brandManaged),
registryMode: restore
? keepSnapshot.registryMode
: existing?.registryMode || registryMode,
+6
View File
@@ -122,6 +122,12 @@ export class GetUserService {
: undefined,
/** Laravel-compatible overlay; Hamkar merges only when present */
ui_settings: uiSettings.length ? uiSettings : undefined,
/**
* Hamkar only: when true, apply brand colors to mobile header+menu and page body
* (including theme-two). Absent/false → keep factory chrome (no visual jump).
*/
brand_chrome:
isHamkarUi && ui?.brandManaged === true ? true : undefined,
/** Admin expiry modals — near/expired server, plugin, support */
subscription_alerts,
plugin_store_enabled: isKhanegi