diff --git a/modules/rnetwork/mod.ts b/modules/rnetwork/mod.ts index 1cfaa2d..c3674f3 100644 --- a/modules/rnetwork/mod.ts +++ b/modules/rnetwork/mod.ts @@ -7,7 +7,7 @@ */ import { Hono } from "hono"; -import { renderShell } from "../../server/shell"; +import { renderShell, renderExternalAppShell } from "../../server/shell"; import { getModuleInfoList } from "../../shared/module"; import type { RSpaceModule } from "../../shared/module"; import { renderLanding } from "./landing"; @@ -34,7 +34,7 @@ function getTokenForSpace(space: string): string { async function twentyQuery(query: string, variables?: Record, space?: string) { const token = space ? getTokenForSpace(space) : TWENTY_DEFAULT_TOKEN; if (!token) return null; - const res = await fetch(`${TWENTY_API_URL}/api`, { + const res = await fetch(`${TWENTY_API_URL}/api/graphql`, { method: "POST", headers: { "Content-Type": "application/json", @@ -269,17 +269,16 @@ routes.get("/api/opportunities", async (c) => { return c.json({ opportunities }); }); -// ── CRM sub-route — API-driven CRM view ── +// ── CRM sub-route — embed Twenty CRM via iframe ── routes.get("/crm", (c) => { const space = c.req.param("space") || "demo"; - return c.html(renderShell({ + return c.html(renderExternalAppShell({ title: `${space} — CRM | rSpace`, moduleId: "rnetwork", spaceSlug: space, modules: getModuleInfoList(), - body: ``, - scripts: ``, - styles: ``, + appUrl: "https://crm.rspace.online", + appName: "Twenty CRM", })); }); @@ -289,14 +288,13 @@ routes.get("/", (c) => { const view = c.req.query("view"); if (view === "app") { - return c.html(renderShell({ + return c.html(renderExternalAppShell({ title: `${space} — CRM | rSpace`, moduleId: "rnetwork", spaceSlug: space, modules: getModuleInfoList(), - body: ``, - scripts: ``, - styles: ``, + appUrl: "https://crm.rspace.online", + appName: "Twenty CRM", })); } @@ -321,7 +319,7 @@ export const networkModule: RSpaceModule = { routes, landingPage: renderLanding, standaloneDomain: "rnetwork.online", - externalApp: { url: "https://demo.rnetwork.online", name: "Twenty CRM" }, + externalApp: { url: "https://crm.rspace.online", name: "Twenty CRM" }, feeds: [ { id: "trust-graph",