File size: 3,336 Bytes
1955a0f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import { lazy } from "react";
import { ModuleId } from "./registry";

/* ------------------------------------------------------------------ */
/* Code-split module pages. Chunks are preloaded on hub mount and on   */
/* menu-button hover so the launch animation never janks on fetch.     */
/* ------------------------------------------------------------------ */

// Module E pages (mint theme namespace)
export const EDashboard = lazy(() => import("../pages/Dashboard"));
export const ECampaigns = lazy(() => import("../pages/Campaigns"));
export const ECampaignDetail = lazy(() => import("../pages/CampaignDetail"));
export const ELeads = lazy(() => import("../pages/Leads"));
export const EEmailAccounts = lazy(() => import("../pages/EmailAccounts"));
export const EWarmup = lazy(() => import("../pages/Warmup"));
export const EInbox = lazy(() => import("../pages/Inbox"));
export const EWebhooks = lazy(() => import("../pages/Webhooks"));
export const EAnalytics = lazy(() => import("../pages/Analytics"));
export const EClients = lazy(() => import("../pages/Clients"));
export const EPricing = lazy(() => import("../pages/Pricing"));
export const ESettings = lazy(() => import("../pages/Settings"));

// Module S pages (prod indigo namespace)
export const SDashboard = lazy(() => import("./s/pages/Dashboard"));
export const SCampaigns = lazy(() => import("./s/pages/Campaigns"));
export const SCampaignDetail = lazy(() => import("./s/pages/CampaignDetail"));
export const SLeads = lazy(() => import("./s/pages/Leads"));
export const SEmailAccounts = lazy(() => import("./s/pages/EmailAccounts"));
export const SWarmup = lazy(() => import("./s/pages/Warmup"));
export const SInbox = lazy(() => import("./s/pages/Inbox"));
export const SWebhooks = lazy(() => import("./s/pages/Webhooks"));
export const SAnalytics = lazy(() => import("./s/pages/Analytics"));
export const SClients = lazy(() => import("./s/pages/Clients"));
export const SSettings = lazy(() => import("./s/pages/Settings"));

const E_IMPORTS = [
  () => import("../pages/Dashboard"),
  () => import("../pages/Campaigns"),
  () => import("../pages/CampaignDetail"),
  () => import("../pages/Leads"),
  () => import("../pages/EmailAccounts"),
  () => import("../pages/Warmup"),
  () => import("../pages/Inbox"),
  () => import("../pages/Webhooks"),
  () => import("../pages/Analytics"),
  () => import("../pages/Clients"),
  () => import("../pages/Pricing"),
  () => import("../pages/Settings"),
];

const S_IMPORTS = [
  () => import("./s/pages/Dashboard"),
  () => import("./s/pages/Campaigns"),
  () => import("./s/pages/CampaignDetail"),
  () => import("./s/pages/Leads"),
  () => import("./s/pages/EmailAccounts"),
  () => import("./s/pages/Warmup"),
  () => import("./s/pages/Inbox"),
  () => import("./s/pages/Webhooks"),
  () => import("./s/pages/Analytics"),
  () => import("./s/pages/Clients"),
  () => import("./s/pages/Settings"),
];

const preloaded = new Set<string>();

/** Warm every chunk of a module before its launch animation starts. */
export function preloadModulePages(id: ModuleId): void {
  if (preloaded.has(id)) return;
  preloaded.add(id);
  const imports = id === "e" ? E_IMPORTS : S_IMPORTS;
  imports.forEach((fn) => {
    fn().catch(() => {
      // Preload is best-effort; the Suspense boundary handles real failures.
    });
  });
}