Integration & Migration (10 Projects)

Step-by-step installation guide, zero-FOUC Next.js root layout, and 10-repo migration checklist to remove vendored UI copies.

Step 1 — Installation Options

Choose the installation method that matches your repository setup (pnpm workspace, local relative path, GitHub, or private npm registry).

package.json — local sibling checkout (file:../kallo-ui)bash
// For the 8 pnpm repos (Portal, Social, CRM, Calendar, Storage, Sign, Auth, Wrapper):
pnpm add @kallo/ui@file:../kallo-ui/packages/ui \
         @kallo/tokens@file:../kallo-ui/packages/tokens \
         @kallo/icons@file:../kallo-ui/packages/icons

// For SocManageSuperadmin (uses npm — NOT pnpm):
npm install ../kallo-ui/packages/ui ../kallo-ui/packages/tokens ../kallo-ui/packages/icons
Step 2 — Next.js Config & Root Layout

Add transpilePackages in next.config.mjs and mount KalloInitScript, KalloSprite, and KalloProvider in root layout.tsx for zero-FOUC hydration.

next.config.mjsjavascript
// next.config.mjs (required in every Next.js Kallo app)
/** @type {import('next').NextConfig} */
const nextConfig = {
  transpilePackages: ['@kallo/ui', '@kallo/tokens', '@kallo/icons'],
};

export default nextConfig;
src/app/layout.tsxtsx
// src/app/layout.tsx
import type { ReactNode } from 'react';
import { KalloInitScript, KalloProvider, KalloSprite } from '@kallo/ui';
import '@kallo/ui/styles.css';

export default function RootLayout({ children }: { children: ReactNode }) {
  return (
    <html lang="ka" suppressHydrationWarning>
      <head>
        {/* Synchronous zero-FOUC theme, lang & iframe embed bootstrap */}
        <KalloInitScript defaultTheme="light" defaultLang="ka" />
      </head>
      <body className="app-crm">
        {/* Single shared 116-icon + 6-channel-logo SVG sprite */}
        <KalloSprite />
        <KalloProvider app="crm" defaultTheme="light" defaultLang="ka">
          {children}
        </KalloProvider>
      </body>
    </html>
  );
}

Step 3 — 10-Project Migration Checklist

Tick off each repository as you migrate. Lists exact appId, package manager, vendored files to delete, and drift bugs eliminated.

2 / 10 migrated
Project & appIdPkg ManagerVendored Files to DELETEKey Drift Bugs Eliminated
SocManage (AI Portal)apps/portal · app-ai
pnpm
src/kallo-v9/*src/hooks/useModalBehavior.tssrc/lib/kallo-bridge.tslucide-react
Removes vendored CSS kit, sparkle AI icons, and duplicate modal scroll-lock hook
SocManage (Mobile)apps/mobile · @kallo/tokens/native
pnpm (Expo)
src/theme/legacyColors.tshardcoded hex maps in V9* components
Eliminates Calendar (#0D7490) & Sign (#4F46E5) hex drift vs Web; shares raw SVG paths
SocManageSocialapp-social
pnpm
src/kallo-v9/*src/components/v9/Capsule.tsxsrc/lib/kallo-bridge.tslucide-react
Unifies Live Studio Capsule, MessageComposer, VoiceWave, and iframe theme/lang bridge
SocManageCRMapp-crm
pnpm
src/kallo-v9/*src/components/v9/*src/hooks/useModalBehavior.tslucide-react
Fixes DealMini/StageSteps drift, A4 quote dark-mode bleed, and Inspector drawer slide-over
SocManageCalendarapp-calendar
pnpm
src/kallo-v9/*src/components/v9/*lucide-react
Fixes stale #0891B2 accent to canonical #0D7490 / #5CC0DB and unifies WeekdayPicker
SocManageStorageapp-storage
pnpm
src/kallo-v9/*src/components/v9/FileThumb.tsxlucide-react
Standardizes FileThumb (.ftype / .ext), SourceBadge, and amber-near-limit Meter
SocManageSignapp-sign
pnpm
src/kallo-v9/*src/components/v9/*lucide-react
Enforces canonical indigo #4F46E5 / #9994F4 accent and PaperSheet A4 contract surface
SocManageAuthapp-id (alias app-auth)
pnpm
src/kallo-v9/*src/components/AuthCard.tsxlucide-react
Replaces forbidden red auth errors with canonical --late amber AuthMessage & zero-FOUC init
SocManageSuperadminapp-id
npm (only!)
src/kallo-v9/*src/components/v9/*src/hooks/useModalBehavior.tslucide-react
Adopts unified PermissionMatrix / AccessRulesChips and migrates legacy admin_theme storage key
SocManageWrapperapp-* (dynamic)
pnpm
src/kallo-v9/*src/lib/kallo-bridge.tslucide-react
Unifies Rail, ⌘K CommandPalette, and postMessage theme/lang sync across all embedded iframes
Step 4 — Import Migration Cheatsheet (Before / After)

Replace vendored src/kallo-v9/*, src/components/v9/*, and lucide-react with clean @kallo/ui imports.

Before vs After — Import Migrationtsx
// ❌ BEFORE — vendored per-repo copies + lucide-react
import '@/kallo-v9/kallo-v9.css';
import { Phone, Sparkles, Check } from 'lucide-react';
import { Modal } from '@/components/v9/Modal';
import { LiveCallCapsule } from '@/components/v9/Capsule';
import { useModalBehavior } from '@/hooks/useModalBehavior';
import { postToWrapper } from '@/lib/kallo-bridge';

// ✅ AFTER — single canonical @kallo/ui import
import '@kallo/ui/styles.css';
import {
  Button,
  Capsule,
  Icon,
  KalloShell,
  Modal,
  Mono,
  Toolbar,
  postToWrapper,
  useKallo,
  useModalBehavior,
} from '@kallo/ui';
// Note: AI never uses <Sparkles /> — always use <Mono /> or <Icon name="audio-lines" />!
After migrating, remove lucide-react from package.json and verify with pnpm typecheck && pnpm build (in SocManageSuperadmin: npm run build).