@campfire-interactive/shell-header 0.8.3 → 0.8.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -16,6 +16,15 @@ interface AppDefinition {
16
16
  * admin-style apps (e.g. User Management → ['admin', 'owner']).
17
17
  */
18
18
  requiresRole?: string[];
19
+ /**
20
+ * Optional path to append to the app's origin when building tile links
21
+ * (and the localhost fallback). Omit for apps whose root URL is the
22
+ * desired landing page; set for apps where the user should land on a
23
+ * specific surface (e.g. identity → `/admin/users` so the User
24
+ * Management tile lands on the users page rather than the launcher).
25
+ * Must start with `/`.
26
+ */
27
+ path?: string;
19
28
  }
20
29
  interface ShellUser {
21
30
  name: string;
@@ -210,10 +219,11 @@ declare function LocaleSwitcher({ currentLocale, supportedLocales, onLocaleChang
210
219
 
211
220
  declare const appCatalog: AppDefinition[];
212
221
  /**
213
- * Derive the app URL from the current hostname.
214
- * - localhost localhost:<localPort>
215
- * - *.dev.campfiresuite.com → <id>.dev.campfiresuite.com
216
- * - *.campfiresuite.com → <id>.campfiresuite.com
222
+ * Derive the app URL from the current hostname, optionally appending the
223
+ * catalog entry's preferred landing path.
224
+ * - localhostlocalhost:<localPort>[<path>]
225
+ * - *.dev.campfiresuite.com → <id>.dev.campfiresuite.com[<path>]
226
+ * - *.campfiresuite.com → <id>.campfiresuite.com[<path>]
217
227
  */
218
228
  declare function getAppUrl(app: AppDefinition): string;
219
229
 
package/dist/index.js CHANGED
@@ -34,19 +34,20 @@ var appCatalog = [
34
34
  { id: "pim", name: "Price Index", icon: "BarChart3", letter: "P", color: "#f97316", localPort: 3300 },
35
35
  { id: "cpq", name: "CPQ", icon: "Calculator", letter: "C", color: "#4f46e5", localPort: 3400 },
36
36
  { id: "omsf", name: "OMSF", icon: "FileText", letter: "O", color: "#0ea5e9", localPort: 3500 },
37
- { id: "identity", name: "User Management", icon: "Shield", letter: "U", color: "#8b5cf6", localPort: 3600, requiresRole: ["admin", "owner"] },
37
+ { id: "identity", name: "User Management", icon: "Shield", letter: "U", color: "#8b5cf6", localPort: 3600, requiresRole: ["admin", "owner"], path: "/admin/users" },
38
38
  { id: "bom", name: "BOM", icon: "Network", letter: "B", color: "#0d9488", localPort: 3700 }
39
39
  ];
40
40
  function getAppUrl(app) {
41
41
  const host = typeof window !== "undefined" ? window.location.hostname : "";
42
42
  const protocol = typeof window !== "undefined" ? window.location.protocol : "https:";
43
+ const path = app.path ?? "";
43
44
  if (host === "localhost" || host === "127.0.0.1") {
44
- return app.localPort ? `http://localhost:${app.localPort}` : "#";
45
+ return app.localPort ? `http://localhost:${app.localPort}${path}` : "#";
45
46
  }
46
47
  if (host.includes(".dev.")) {
47
- return `${protocol}//${app.id}.dev.campfiresuite.com`;
48
+ return `${protocol}//${app.id}.dev.campfiresuite.com${path}`;
48
49
  }
49
- return `${protocol}//${app.id}.campfiresuite.com`;
50
+ return `${protocol}//${app.id}.campfiresuite.com${path}`;
50
51
  }
51
52
 
52
53
  // src/AppSwitcher.tsx
@@ -330,6 +331,7 @@ function UserMenu({
330
331
  }
331
332
  const showTenant = tenant !== void 0;
332
333
  const canSwitchTenant = showTenant && onTenantSwitch !== void 0 && Array.isArray(tenants) && tenants.length > 1;
334
+ const sortedTenants = canSwitchTenant ? [...tenants].sort((a, b) => a.name.localeCompare(b.name)) : [];
333
335
  async function handleTenantSelect(tenantId) {
334
336
  if (!onTenantSwitch || tenantId === tenant?.id) {
335
337
  setTenantExpanded(false);
@@ -386,7 +388,7 @@ function UserMenu({
386
388
  /* @__PURE__ */ jsx4(Building2, { size: 14 }),
387
389
  /* @__PURE__ */ jsx4("span", { className: "cfi-sh-locale-row-label", children: tenant.name })
388
390
  ] }),
389
- canSwitchTenant && tenantExpanded && /* @__PURE__ */ jsx4("div", { className: "cfi-sh-locale-sublist", children: tenants.map((t) => {
391
+ canSwitchTenant && tenantExpanded && /* @__PURE__ */ jsx4("div", { className: "cfi-sh-locale-sublist", children: sortedTenants.map((t) => {
390
392
  const active = t.id === tenant.id;
391
393
  return /* @__PURE__ */ jsxs4(
392
394
  "button",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@campfire-interactive/shell-header",
3
- "version": "0.8.3",
3
+ "version": "0.8.7",
4
4
  "description": "Shared shell header with app switcher for Campfire Suite",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",