fix: lock new.gholaktala.ir as Khanegi newTheme (userTheme)

Correct prior modular/Hamkar misclassification. Protect locked newTheme domains from bulk-modular brand overrides.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-08-11 17:53:04 +03:30
co-authored by Cursor
parent 859530a669
commit dd4850d9fa
4 changed files with 181 additions and 23 deletions
+13 -23
View File
@@ -1,13 +1,13 @@
/**
* Apply Niazi-style modular brand colors to all Khanegi tenants
* that are NOT newTheme (Aygin stays newTheme).
* Apply Niazi-style modular brand colors to Khanegi tenants
* that are NOT locked newTheme (Aygin, new.gholaktala.ir, …).
*
* Colors (from app.niazitala.ir):
* primary #0a1b37 (هدر)
* secondary #e0be7f (اکسنت)
* background #ffffff (پس‌زمینه)
*
* Also forces uiVariant=modular for non-Aygin Khanegi rows.
* Also forces uiVariant=modular for non-protected Khanegi rows.
*
* Dry-run:
* KHANEGI_BRAND_DRY_RUN=1 npm run prisma:bulk-khanegi-modular-brand
@@ -19,6 +19,7 @@
* KHANEGI_BRAND_SOURCE_DOMAIN=app.niazitala.ir npm run prisma:bulk-khanegi-modular-brand
*/
import { KhanegiUiVariant, PrismaClient, ProductType } from '@prisma/client';
import { isForcedKhanegiNewTheme } from './khanegi-variant-locks';
const prisma = new PrismaClient();
@@ -42,20 +43,9 @@ function normalizeHost(value?: string | null) {
.split(':')[0];
}
function isAyginTenant(domain: string, domains: unknown, slug: string) {
const hosts = new Set<string>();
const primary = normalizeHost(domain);
if (primary) hosts.add(primary);
const extra = Array.isArray(domains) ? domains : [];
for (const d of extra) {
const n = normalizeHost(String(d));
if (n) hosts.add(n);
}
if (String(slug || '').toLowerCase().includes('aygin')) return true;
for (const h of hosts) {
if (h.includes('aygingold') || h === 'app.aygingold.ir') return true;
}
return false;
function isProtectedNewThemeTenant(domain: string, domains: unknown, slug: string) {
// Aygin + explicit locks (e.g. new.gholaktala.ir)
return isForcedKhanegiNewTheme(domain, domains, slug);
}
function bumpAppVersion(current?: string | null): string {
@@ -134,10 +124,10 @@ async function main() {
});
const targets = tenants.filter(
(t) => !isAyginTenant(t.domain, t.domains, t.slug),
(t) => !isProtectedNewThemeTenant(t.domain, t.domains, t.slug),
);
const skippedAygin = tenants.filter((t) =>
isAyginTenant(t.domain, t.domains, t.slug),
const skippedNewTheme = tenants.filter((t) =>
isProtectedNewThemeTenant(t.domain, t.domains, t.slug),
);
console.log(
@@ -153,7 +143,7 @@ async function main() {
},
totalKhanegi: tenants.length,
targets: targets.length,
skippedAygin: skippedAygin.map((t) => ({
skippedNewTheme: skippedNewTheme.map((t) => ({
domain: t.domain,
uiVariant: t.uiVariant,
})),
@@ -204,8 +194,8 @@ async function main() {
updated += 1;
}
// Ensure Aygin stays newTheme (do not touch colors unless variant wrong)
for (const t of skippedAygin) {
// Ensure locked newTheme tenants stay newTheme
for (const t of skippedNewTheme) {
if (t.uiVariant === KhanegiUiVariant.newTheme) continue;
console.log(
JSON.stringify({