@heyo-sh/create-heyo-docs 1.0.0 → 2.0.0

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.
Files changed (122) hide show
  1. package/deployments/cloudflare/astro/package.json +2 -1
  2. package/deployments/cloudflare/astro/src/env.d.ts +8 -0
  3. package/deployments/cloudflare/astro/src/pages/heyo-docs-internal/ai-chat.ts +32 -0
  4. package/deployments/cloudflare/next/app/heyo-docs-internal/ai-chat/route.ts +27 -0
  5. package/deployments/cloudflare/next/cloudflare-env.d.ts +7 -0
  6. package/deployments/cloudflare/react-router/app/cloudflare-env.d.ts +7 -0
  7. package/deployments/cloudflare/react-router/app/lib/cloudflare-context.ts +4 -0
  8. package/deployments/cloudflare/react-router/app/routes/ai-chat.ts +31 -0
  9. package/deployments/cloudflare/react-router/package.json +2 -1
  10. package/deployments/cloudflare/react-router/workers/app.ts +6 -2
  11. package/deployments/vercel/astro/package.json +1 -0
  12. package/dist/index.js +37 -16
  13. package/dist/project-name.d.ts +1 -1
  14. package/dist/project-name.d.ts.map +1 -1
  15. package/dist/scaffold.d.ts.map +1 -1
  16. package/dist/utils.d.ts.map +1 -1
  17. package/package.json +2 -2
  18. package/templates/astro/content/index.mdx +8 -0
  19. package/templates/astro/heyo-docs.config.ts +4 -48
  20. package/templates/astro/src/components/docs-app.tsx +30 -130
  21. package/templates/astro/src/heyo-docs-icons.tsx +3 -1
  22. package/templates/astro/src/layouts/docs-layout.astro +20 -504
  23. package/templates/astro/src/lib/docs.ts +3 -2
  24. package/templates/astro/src/lib/openapi-request.ts +6 -146
  25. package/templates/astro/src/pages/[...slug].astro +7 -15
  26. package/templates/astro/src/pages/[...slug].md.ts +4 -1
  27. package/templates/astro/src/pages/heyo-docs-internal/ai-chat.ts +10 -3
  28. package/templates/astro/src/pages/heyo-docs-internal/openapi-request.ts +6 -0
  29. package/templates/astro/src/pages/index.astro +18 -9
  30. package/templates/astro/src/pages/llms-full.txt.ts +1 -1
  31. package/templates/astro/src/pages/llms.txt.ts +1 -1
  32. package/templates/astro/src/pages/rss.xml.ts +1 -1
  33. package/templates/astro/src/pages/sitemap.xml.ts +2 -2
  34. package/templates/astro/src/virtual.d.ts +5 -5
  35. package/templates/next/app/[[...slug]]/page.tsx +10 -9
  36. package/templates/next/app/components/docs-app.tsx +28 -120
  37. package/templates/next/app/heyo-docs-icons.tsx +1 -1
  38. package/templates/next/app/heyo-docs-internal/ai-chat/route.ts +9 -2
  39. package/templates/next/app/heyo-docs-internal/markdown/[[...slug]]/route.ts +1 -1
  40. package/templates/next/app/layout.tsx +25 -444
  41. package/templates/next/app/lib/docs.ts +3 -3
  42. package/templates/next/app/lib/openapi-request.ts +4 -136
  43. package/templates/next/app/llms-full.txt/route.ts +1 -1
  44. package/templates/next/app/llms.txt/route.ts +1 -1
  45. package/templates/next/app/rss.xml/route.ts +1 -1
  46. package/templates/next/app/sitemap.xml/route.ts +1 -1
  47. package/templates/next/content/index.mdx +8 -0
  48. package/templates/next/heyo-docs.config.ts +3 -47
  49. package/templates/next/next.config.ts +7 -1
  50. package/templates/react-router/app/heyo-docs-icons.tsx +3 -1
  51. package/templates/react-router/app/root.tsx +28 -465
  52. package/templates/react-router/app/routes/ai-chat.ts +6 -2
  53. package/templates/react-router/app/routes/docs.tsx +22 -63
  54. package/templates/react-router/app/routes/home.tsx +6 -1
  55. package/templates/react-router/app/routes/llms-full.ts +1 -1
  56. package/templates/react-router/app/routes/llms.ts +1 -1
  57. package/templates/react-router/app/routes/markdown.ts +4 -1
  58. package/templates/react-router/app/routes/openapi-request.ts +11 -144
  59. package/templates/react-router/app/routes/rss.ts +1 -1
  60. package/templates/react-router/app/routes/sitemap.ts +5 -8
  61. package/templates/react-router/app/virtual.d.ts +5 -5
  62. package/templates/react-router/content/index.mdx +8 -0
  63. package/templates/react-router/heyo-docs.config.ts +4 -48
  64. package/templates/astro/content/api-overview.mdx +0 -20
  65. package/templates/astro/content/assets/local-architecture.svg +0 -22
  66. package/templates/astro/content/assets/quick-reference.txt +0 -5
  67. package/templates/astro/content/changelog.mdx +0 -38
  68. package/templates/astro/content/configuration.mdx +0 -117
  69. package/templates/astro/content/deploying.mdx +0 -57
  70. package/templates/astro/content/essentials/callouts.mdx +0 -34
  71. package/templates/astro/content/essentials/code-blocks.mdx +0 -43
  72. package/templates/astro/content/essentials/lists.mdx +0 -36
  73. package/templates/astro/content/essentials/tables.mdx +0 -30
  74. package/templates/astro/content/essentials/tabs.mdx +0 -40
  75. package/templates/astro/content/essentials/text-styling.mdx +0 -43
  76. package/templates/astro/content/getting-started.mdx +0 -16
  77. package/templates/astro/content/mdx-components.mdx +0 -44
  78. package/templates/astro/content/openapi-petstore.json +0 -160
  79. package/templates/astro/content/openapi.json +0 -278
  80. package/templates/astro/content/quickstart.mdx +0 -60
  81. package/templates/astro/src/components/theme-provider.tsx +0 -106
  82. package/templates/astro/src/lib/seo.ts +0 -221
  83. package/templates/astro/src/lib/theme.ts +0 -74
  84. package/templates/next/app/components/theme-provider.tsx +0 -93
  85. package/templates/next/app/lib/seo.ts +0 -189
  86. package/templates/next/app/lib/theme.ts +0 -61
  87. package/templates/next/content/api-overview.mdx +0 -20
  88. package/templates/next/content/assets/local-architecture.svg +0 -22
  89. package/templates/next/content/assets/quick-reference.txt +0 -5
  90. package/templates/next/content/changelog.mdx +0 -38
  91. package/templates/next/content/configuration.mdx +0 -117
  92. package/templates/next/content/deploying.mdx +0 -57
  93. package/templates/next/content/essentials/callouts.mdx +0 -34
  94. package/templates/next/content/essentials/code-blocks.mdx +0 -43
  95. package/templates/next/content/essentials/lists.mdx +0 -36
  96. package/templates/next/content/essentials/tables.mdx +0 -30
  97. package/templates/next/content/essentials/tabs.mdx +0 -40
  98. package/templates/next/content/essentials/text-styling.mdx +0 -43
  99. package/templates/next/content/getting-started.mdx +0 -16
  100. package/templates/next/content/mdx-components.mdx +0 -41
  101. package/templates/next/content/openapi-petstore.json +0 -160
  102. package/templates/next/content/openapi.json +0 -278
  103. package/templates/next/content/quickstart.mdx +0 -60
  104. package/templates/react-router/app/components/theme-provider.tsx +0 -106
  105. package/templates/react-router/app/lib/theme.ts +0 -74
  106. package/templates/react-router/content/api-overview.mdx +0 -20
  107. package/templates/react-router/content/assets/local-architecture.svg +0 -22
  108. package/templates/react-router/content/assets/quick-reference.txt +0 -5
  109. package/templates/react-router/content/changelog.mdx +0 -38
  110. package/templates/react-router/content/configuration.mdx +0 -117
  111. package/templates/react-router/content/deploying.mdx +0 -57
  112. package/templates/react-router/content/essentials/callouts.mdx +0 -34
  113. package/templates/react-router/content/essentials/code-blocks.mdx +0 -43
  114. package/templates/react-router/content/essentials/lists.mdx +0 -36
  115. package/templates/react-router/content/essentials/tables.mdx +0 -30
  116. package/templates/react-router/content/essentials/tabs.mdx +0 -40
  117. package/templates/react-router/content/essentials/text-styling.mdx +0 -43
  118. package/templates/react-router/content/getting-started.mdx +0 -16
  119. package/templates/react-router/content/mdx-components.mdx +0 -293
  120. package/templates/react-router/content/openapi-petstore.json +0 -160
  121. package/templates/react-router/content/openapi.json +0 -278
  122. package/templates/react-router/content/quickstart.mdx +0 -60
@@ -1,4 +1,4 @@
1
- import { rssXml } from "@heyo-sh/heyo-docs/node";
1
+ import { rssXml } from "@heyo-sh/heyo-docs/rss";
2
2
 
3
3
  import { config, markdownPages } from "../lib/docs";
4
4
 
@@ -1,4 +1,4 @@
1
- import { sitemapXml } from "@heyo-sh/heyo-docs/node";
1
+ import { sitemapXml } from "@heyo-sh/heyo-docs/seo";
2
2
 
3
3
  import { config, docsModel } from "../lib/docs";
4
4
 
@@ -0,0 +1,8 @@
1
+ ---
2
+ title: "Welcome"
3
+ description: "Get started with {{PROJECT_NAME}}."
4
+ ---
5
+
6
+ # Welcome
7
+
8
+ This documentation is ready for your content. Edit this page or add Markdown and MDX files in `content/`.
@@ -3,54 +3,10 @@ import { heyoDocs } from "@heyo-sh/heyo-docs/config";
3
3
  export default heyoDocs({
4
4
  title: "{{PROJECT_NAME}}",
5
5
  description: "Developer documentation",
6
- content: "./content",
7
6
  theme: "{{THEME}}",
8
- mode: "system",
9
- groups: [
10
- {
11
- group: "Documentation",
12
- icon: "globe",
13
- sections: [
14
- {
15
- section: "Get Started",
16
- icon: "lightbulb",
17
- pages: ["quickstart", "configuration", "deploying"],
18
- },
19
- {
20
- section: "Essentials",
21
- icon: "book",
22
- pages: [
23
- "essentials/text-styling",
24
- "essentials/code-blocks",
25
- "essentials/callouts",
26
- "essentials/tabs",
27
- "essentials/lists",
28
- "essentials/tables",
29
- ],
30
- },
31
- ],
32
- },
33
- {
34
- group: "OpenAPI",
35
- icon: "code",
36
- sections: [
37
- {
38
- pages: ["api-overview"],
39
- },
40
- {
41
- schema: "./openapi.json",
42
- },
43
- ],
44
- },
45
- {
46
- group: "Changelog",
47
- description: "Mock release notes for the Heyo Docs demo.",
48
- icon: "changelog",
49
- type: "changelog",
50
- updates: ["changelog"],
51
- },
52
- ],
53
7
  branding: { name: "{{PROJECT_NAME}}", logo: "/logo.svg" },
54
- // Set this before deploying to publish canonical and absolute social URLs.
8
+ // Set this before deploying to publish canonical, sitemap, and social URLs.
55
9
  // siteUrl: "https://docs.example.com",
10
+ // Add analytics, consent, and support integrations here when you need them.
11
+ // integrations: { analytics: { ga4: { measurementId: "G-..." } } },
56
12
  });
@@ -7,6 +7,12 @@ import { heyoDocsMdxOptions } from "@heyo-sh/heyo-docs/next";
7
7
  const projectRoot = dirname(fileURLToPath(import.meta.url));
8
8
 
9
9
  const nextConfig: NextConfig = {
10
+ // Pi resolves provider executors dynamically at runtime. Keep its Node-only
11
+ // packages external so Next does not replace that resolver during bundling.
12
+ serverExternalPackages: [
13
+ "@mariozechner/pi-agent-core",
14
+ "@mariozechner/pi-ai",
15
+ ],
10
16
  turbopack: {
11
17
  root: projectRoot,
12
18
  },
@@ -16,7 +22,7 @@ const nextConfig: NextConfig = {
16
22
  beforeFiles: [
17
23
  {
18
24
  source: "/:path*.md",
19
- destination: "/heyo-docs-internal/markdown/:path*",
25
+ destination: "/heyo-docs-internal/markdown/:path*.md",
20
26
  },
21
27
  ],
22
28
  };
@@ -24,13 +24,14 @@ import {
24
24
  RiInformationLine,
25
25
  RiLightbulbLine,
26
26
  RiLoginBoxLine,
27
+ RiMenuLine,
27
28
  RiMoonLine,
28
29
  RiNewsLine,
29
30
  RiSearchLine,
30
31
  RiStarLine,
31
32
  RiSunLine,
32
33
  } from "@remixicon/react";
33
- import type { IconSet } from "@heyo-sh/heyo-docs";
34
+ import type { IconSet } from "@heyo-sh/heyo-docs/types";
34
35
 
35
36
  /**
36
37
  * This mapping is intentionally local to the generated application. Replace
@@ -51,6 +52,7 @@ export const iconSet = {
51
52
  arrowRight: RiArrowRightLine,
52
53
  close: RiCloseLine,
53
54
  cornerDownLeft: RiCornerDownLeftLine,
55
+ menu: RiMenuLine,
54
56
  search: RiSearchLine,
55
57
  sun: RiSunLine,
56
58
  moon: RiMoonLine,
@@ -1,4 +1,12 @@
1
1
  import type { ReactNode } from "react";
2
+ import { pathnameFromMarkdownPath } from "@heyo-sh/heyo-docs/llm";
3
+ import { ThemeProvider } from "@heyo-sh/heyo-docs/theme/provider";
4
+ import {
5
+ DEFAULT_THEME_STORAGE_KEY,
6
+ themeBootstrapScript,
7
+ } from "@heyo-sh/heyo-docs/theme/script";
8
+ import { IntegrationScripts } from "@heyo-sh/heyo-docs/integrations";
9
+ import { siteSeoMeta } from "@heyo-sh/heyo-docs/seo/react-router";
2
10
  import {
3
11
  Links,
4
12
  Meta,
@@ -8,110 +16,13 @@ import {
8
16
  type LinksFunction,
9
17
  type MetaFunction,
10
18
  } from "react-router";
11
- import { pathnameFromMarkdownPath } from "@heyo-sh/heyo-docs";
12
- import { adobeAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/adobe";
13
- import { amplitudeAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/amplitude";
14
- import { clarityBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/clarity";
15
- import { clearbitAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/clearbit";
16
- import { fathomAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/fathom";
17
- import {
18
- googleAnalyticsBootstrapScript,
19
- googleAnalyticsScript,
20
- } from "@heyo-sh/heyo-docs/integrations/analytics/google-analytics";
21
- import {
22
- googleTagManagerBootstrapScript,
23
- googleTagManagerNoScriptUrl,
24
- } from "@heyo-sh/heyo-docs/integrations/analytics/google-tag-manager";
25
- import { heapBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/heap";
26
- import { hotjarBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/hotjar";
27
- import {
28
- logRocketBootstrapScript,
29
- logRocketScript,
30
- } from "@heyo-sh/heyo-docs/integrations/analytics/logrocket";
31
- import {
32
- mixpanelBootstrapScript,
33
- mixpanelScript,
34
- } from "@heyo-sh/heyo-docs/integrations/analytics/mixpanel";
35
- import {
36
- openpanelBootstrapScript,
37
- openpanelScript,
38
- } from "@heyo-sh/heyo-docs/integrations/analytics/openpanel";
39
- import { openReplayBootstrapScript } from "@heyo-sh/heyo-docs/integrations/analytics/openreplay";
40
- import { osanoConsentScript } from "@heyo-sh/heyo-docs/integrations/consent/osano";
41
- import {
42
- transcendConsentScript,
43
- transcendGoogleConsentModeDefaultsScript,
44
- } from "@heyo-sh/heyo-docs/integrations/consent/transcend";
45
- import { pirschAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/pirsch";
46
- import { plausibleAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/plausible";
47
- import {
48
- posthogApiHost,
49
- posthogBootstrapScript,
50
- posthogScript,
51
- } from "@heyo-sh/heyo-docs/integrations/analytics/posthog";
52
- import { rybbitAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/rybbit";
53
- import {
54
- swetrixBootstrapScript,
55
- swetrixScript,
56
- } from "@heyo-sh/heyo-docs/integrations/analytics/swetrix";
57
- import { chaskiqBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/chaskiq";
58
- import { chatwootBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/chatwoot";
59
- import {
60
- frontChatBootstrapScript,
61
- frontChatScript,
62
- } from "@heyo-sh/heyo-docs/integrations/support/front";
63
- import { intercomBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/intercom";
64
- import { papercupsBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/papercups";
65
- import { typebotBootstrapScript } from "@heyo-sh/heyo-docs/integrations/support/typebot";
66
- import { umamiAnalyticsScript } from "@heyo-sh/heyo-docs/integrations/analytics/umami";
67
- import {
68
- zammadBootstrapScript,
69
- zammadChatScript,
70
- } from "@heyo-sh/heyo-docs/integrations/support/zammad";
71
19
  import type { Route } from "./+types/root";
72
20
 
73
- import "./app.css";
74
21
  import "virtual:heyo-docs-theme.css";
75
- import { ThemeProvider } from "./components/theme-provider";
76
- import { getThemeScript, THEME_STORAGE_KEY } from "./lib/theme";
22
+ import "./app.css";
77
23
  import { config } from "virtual:heyo-docs-config";
78
24
 
79
- export const meta: MetaFunction = () => {
80
- const canonical = config.siteUrl ? `${config.siteUrl}/` : undefined;
81
-
82
- return [
83
- { title: config.title },
84
- { name: "description", content: config.description },
85
- { name: "robots", content: "index, follow" },
86
- { name: "referrer", content: "strict-origin-when-cross-origin" },
87
- { property: "og:type", content: "website" },
88
- { property: "og:site_name", content: config.title },
89
- { property: "og:title", content: config.title },
90
- { property: "og:description", content: config.description },
91
- { name: "twitter:card", content: "summary" },
92
- { name: "twitter:title", content: config.title },
93
- { name: "twitter:description", content: config.description },
94
- ...(canonical
95
- ? [
96
- { property: "og:url", content: canonical },
97
- {
98
- tagName: "link" as const,
99
- rel: "canonical",
100
- href: canonical,
101
- },
102
- ]
103
- : []),
104
- {
105
- "script:ld+json": {
106
- "@context": "https://schema.org",
107
- "@type": "WebSite",
108
- name: config.title,
109
- description: config.description,
110
- ...(config.siteUrl ? { url: config.siteUrl } : {}),
111
- },
112
- },
113
- ];
114
- };
25
+ export const meta: MetaFunction = () => siteSeoMeta(config);
115
26
 
116
27
  export const links: LinksFunction = () => [
117
28
  { rel: "icon", href: "/favicon.ico", sizes: "any" },
@@ -122,11 +33,7 @@ export const links: LinksFunction = () => [
122
33
  sizes: "96x96",
123
34
  type: "image/png",
124
35
  },
125
- {
126
- rel: "apple-touch-icon",
127
- href: "/apple-touch-icon.png",
128
- sizes: "180x180",
129
- },
36
+ { rel: "apple-touch-icon", href: "/apple-touch-icon.png", sizes: "180x180" },
130
37
  { rel: "manifest", href: "/site.webmanifest" },
131
38
  ...(config.groups.some((group) => group.type === "changelog")
132
39
  ? [
@@ -140,381 +47,41 @@ export const links: LinksFunction = () => [
140
47
  : []),
141
48
  ];
142
49
 
143
- const osano = config.integrations.consent.osano
144
- ? osanoConsentScript(config.integrations.consent.osano)
145
- : undefined;
146
- const transcend = config.integrations.consent.transcend
147
- ? transcendConsentScript(config.integrations.consent.transcend)
148
- : undefined;
149
- const transcendGoogleConsentDefaults =
150
- transcend &&
151
- (config.integrations.analytics.ga4 || config.integrations.analytics.gtm)
152
- ? transcendGoogleConsentModeDefaultsScript()
153
- : undefined;
154
- const adobe = config.integrations.analytics.adobe
155
- ? adobeAnalyticsScript(config.integrations.analytics.adobe)
156
- : undefined;
157
- const amplitude = config.integrations.analytics.amplitude
158
- ? amplitudeAnalyticsScript(config.integrations.analytics.amplitude)
159
- : undefined;
160
- const clarity = config.integrations.analytics.clarity
161
- ? clarityBootstrapScript()
162
- : undefined;
163
- const clearbit = config.integrations.analytics.clearbit
164
- ? clearbitAnalyticsScript(config.integrations.analytics.clearbit)
165
- : undefined;
166
- const fathom = config.integrations.analytics.fathom
167
- ? fathomAnalyticsScript(config.integrations.analytics.fathom)
168
- : undefined;
169
- const googleAnalytics = config.integrations.analytics.ga4
170
- ? googleAnalyticsScript(config.integrations.analytics.ga4)
171
- : undefined;
172
- const googleAnalyticsBootstrap = googleAnalytics
173
- ? googleAnalyticsBootstrapScript()
174
- : undefined;
175
- const googleTagManager = config.integrations.analytics.gtm
176
- ? googleTagManagerBootstrapScript()
177
- : undefined;
178
- const googleTagManagerNoScript = config.integrations.analytics.gtm
179
- ? googleTagManagerNoScriptUrl(config.integrations.analytics.gtm)
180
- : undefined;
181
- const heap = config.integrations.analytics.heap
182
- ? heapBootstrapScript()
183
- : undefined;
184
- const hotjar = config.integrations.analytics.hotjar
185
- ? hotjarBootstrapScript()
186
- : undefined;
187
- const logRocket = config.integrations.analytics.logrocket
188
- ? logRocketScript()
189
- : undefined;
190
- const logRocketBootstrap = logRocket ? logRocketBootstrapScript() : undefined;
191
- const mixpanel = config.integrations.analytics.mixpanel
192
- ? mixpanelScript()
193
- : undefined;
194
- const mixpanelBootstrap = mixpanel ? mixpanelBootstrapScript() : undefined;
195
- const openpanel = config.integrations.analytics.openpanel
196
- ? openpanelScript()
197
- : undefined;
198
- const openpanelBootstrap = openpanel ? openpanelBootstrapScript() : undefined;
199
- const openReplay = config.integrations.analytics.openreplay
200
- ? openReplayBootstrapScript()
201
- : undefined;
202
- const pirsch = config.integrations.analytics.pirsch
203
- ? pirschAnalyticsScript(config.integrations.analytics.pirsch)
204
- : undefined;
205
- const plausible = config.integrations.analytics.plausible
206
- ? plausibleAnalyticsScript(config.integrations.analytics.plausible)
207
- : undefined;
208
- const posthog = config.integrations.analytics.posthog
209
- ? posthogScript(config.integrations.analytics.posthog)
210
- : undefined;
211
- const posthogBootstrap = posthog ? posthogBootstrapScript() : undefined;
212
- const posthogHost = config.integrations.analytics.posthog
213
- ? posthogApiHost(config.integrations.analytics.posthog)
214
- : undefined;
215
- const rybbit = config.integrations.analytics.rybbit
216
- ? rybbitAnalyticsScript(config.integrations.analytics.rybbit)
217
- : undefined;
218
- const swetrix = config.integrations.analytics.swetrix
219
- ? swetrixScript()
220
- : undefined;
221
- const swetrixBootstrap = swetrix ? swetrixBootstrapScript() : undefined;
222
- const umami = config.integrations.analytics.umami
223
- ? umamiAnalyticsScript(config.integrations.analytics.umami)
224
- : undefined;
225
- const intercom = config.integrations.support.intercom
226
- ? intercomBootstrapScript()
227
- : undefined;
228
- const front = config.integrations.support.front ? frontChatScript() : undefined;
229
- const frontBootstrap = front ? frontChatBootstrapScript() : undefined;
230
- const chatwoot = config.integrations.support.chatwoot
231
- ? chatwootBootstrapScript()
232
- : undefined;
233
- const chaskiq = config.integrations.support.chaskiq
234
- ? chaskiqBootstrapScript()
235
- : undefined;
236
- const papercups = config.integrations.support.papercups
237
- ? papercupsBootstrapScript()
238
- : undefined;
239
- const typebot = config.integrations.support.typebot
240
- ? typebotBootstrapScript()
241
- : undefined;
242
- const zammad = config.integrations.support.zammad
243
- ? zammadChatScript(config.integrations.support.zammad)
244
- : undefined;
245
- const zammadBootstrap = zammad ? zammadBootstrapScript() : undefined;
246
-
247
50
  export function Layout({ children }: { children: ReactNode }) {
248
51
  return (
249
52
  <html lang="en" suppressHydrationWarning>
250
53
  <head>
251
- {transcendGoogleConsentDefaults && (
252
- <script
253
- dangerouslySetInnerHTML={{
254
- __html: transcendGoogleConsentDefaults,
255
- }}
256
- />
257
- )}
258
- {transcend && (
259
- <script data-cfasync={transcend.dataCfasync} src={transcend.src} />
260
- )}
261
54
  <meta charSet="utf-8" />
262
55
  <meta name="viewport" content="width=device-width, initial-scale=1" />
263
56
  <meta name="color-scheme" content="light dark" />
264
- {osano && <script src={osano.src} />}
265
- {googleTagManager && (
266
- <script
267
- data-google-tag-manager-container-id={
268
- config.integrations.analytics.gtm?.containerId
269
- }
270
- dangerouslySetInnerHTML={{ __html: googleTagManager }}
271
- />
272
- )}
273
57
  <script
274
58
  dangerouslySetInnerHTML={{
275
- __html: getThemeScript(THEME_STORAGE_KEY, config.mode),
59
+ __html: themeBootstrapScript(
60
+ DEFAULT_THEME_STORAGE_KEY,
61
+ config.mode,
62
+ ),
276
63
  }}
277
64
  />
278
- {adobe && <script async={adobe.async} src={adobe.src} />}
279
- {amplitude && <script src={amplitude.src} />}
280
- {clarity && (
281
- <script
282
- data-clarity-project-id={
283
- config.integrations.analytics.clarity?.projectId
284
- }
285
- dangerouslySetInnerHTML={{ __html: clarity }}
286
- />
287
- )}
288
- {clearbit && <script src={clearbit.src} />}
289
- {fathom && (
290
- <script
291
- data-site={fathom.siteId}
292
- data-spa={fathom.spa}
293
- defer={fathom.defer}
294
- src={fathom.src}
295
- />
296
- )}
297
- {googleAnalytics && googleAnalyticsBootstrap && (
298
- <>
299
- <script async={googleAnalytics.async} src={googleAnalytics.src} />
300
- <script
301
- data-google-analytics-measurement-id={
302
- config.integrations.analytics.ga4?.measurementId
303
- }
304
- dangerouslySetInnerHTML={{ __html: googleAnalyticsBootstrap }}
305
- />
306
- </>
307
- )}
308
- {heap && (
309
- <script
310
- data-heap-environment-id={
311
- config.integrations.analytics.heap?.environmentId
312
- }
313
- dangerouslySetInnerHTML={{ __html: heap }}
314
- />
315
- )}
316
- {hotjar && (
317
- <script
318
- data-hotjar-site-id={config.integrations.analytics.hotjar?.siteId}
319
- data-hotjar-snippet-version={
320
- config.integrations.analytics.hotjar?.snippetVersion
321
- }
322
- dangerouslySetInnerHTML={{ __html: hotjar }}
323
- />
324
- )}
325
- {logRocket && logRocketBootstrap && (
326
- <>
327
- <script crossOrigin={logRocket.crossOrigin} src={logRocket.src} />
328
- <script
329
- data-logrocket-app-id={
330
- config.integrations.analytics.logrocket?.appId
331
- }
332
- dangerouslySetInnerHTML={{ __html: logRocketBootstrap }}
333
- />
334
- </>
335
- )}
336
- {mixpanel && mixpanelBootstrap && (
337
- <>
338
- <script src={mixpanel.src} />
339
- <script
340
- data-mixpanel-project-token={
341
- config.integrations.analytics.mixpanel?.projectToken
342
- }
343
- dangerouslySetInnerHTML={{ __html: mixpanelBootstrap }}
344
- />
345
- </>
346
- )}
347
- {openpanel && openpanelBootstrap && (
348
- <>
349
- <script
350
- data-openpanel-api-url={
351
- config.integrations.analytics.openpanel?.apiUrl
352
- }
353
- data-openpanel-client-id={
354
- config.integrations.analytics.openpanel?.clientId
355
- }
356
- dangerouslySetInnerHTML={{ __html: openpanelBootstrap }}
357
- />
358
- <script
359
- async={openpanel.async}
360
- defer={openpanel.defer}
361
- src={openpanel.src}
362
- />
363
- </>
364
- )}
365
- {openReplay && (
366
- <script
367
- data-openreplay-ingest-point={
368
- config.integrations.analytics.openreplay?.ingestPoint
369
- }
370
- data-openreplay-project-key={
371
- config.integrations.analytics.openreplay?.projectKey
372
- }
373
- dangerouslySetInnerHTML={{ __html: openReplay }}
374
- />
375
- )}
376
- {pirsch && (
377
- <script
378
- data-code={pirsch.code}
379
- defer={pirsch.defer}
380
- src={pirsch.src}
381
- />
382
- )}
383
- {plausible && (
384
- <script
385
- data-domain={plausible.domain}
386
- defer={plausible.defer}
387
- src={plausible.src}
388
- />
389
- )}
390
- {posthog && posthogBootstrap && posthogHost && (
391
- <>
392
- <script src={posthog.src} />
393
- <script
394
- data-posthog-api-host={posthogHost}
395
- data-posthog-project-api-key={
396
- config.integrations.analytics.posthog?.projectApiKey
397
- }
398
- dangerouslySetInnerHTML={{ __html: posthogBootstrap }}
399
- />
400
- </>
401
- )}
402
- {rybbit && (
403
- <script
404
- data-site-id={rybbit.siteId}
405
- defer={rybbit.defer}
406
- src={rybbit.src}
407
- />
408
- )}
409
- {umami && (
410
- <script
411
- data-website-id={umami.websiteId}
412
- defer={umami.defer}
413
- src={umami.src}
414
- />
415
- )}
416
- {chaskiq && (
417
- <script
418
- data-chaskiq-app-id={config.integrations.support.chaskiq?.appId}
419
- data-chaskiq-base-url={config.integrations.support.chaskiq?.baseUrl}
420
- data-chaskiq-ws-url={config.integrations.support.chaskiq?.wsUrl}
421
- dangerouslySetInnerHTML={{ __html: chaskiq }}
422
- />
423
- )}
424
- {papercups && (
425
- <script
426
- data-papercups-base-url={
427
- config.integrations.support.papercups?.baseUrl
428
- }
429
- data-papercups-inbox={config.integrations.support.papercups?.inbox}
430
- data-papercups-token={config.integrations.support.papercups?.token}
431
- dangerouslySetInnerHTML={{ __html: papercups }}
432
- />
433
- )}
434
- {typebot && (
435
- <script
436
- data-heyo-typebot
437
- data-typebot-api-host={config.integrations.support.typebot?.apiHost}
438
- data-typebot-id={config.integrations.support.typebot?.typebot}
439
- dangerouslySetInnerHTML={{ __html: typebot }}
440
- type="module"
441
- />
442
- )}
65
+ <IntegrationScripts
66
+ integrations={config.integrations}
67
+ placement="head"
68
+ />
443
69
  <Meta />
444
70
  <Links />
445
71
  </head>
446
72
  <body>
447
- {googleTagManagerNoScript && (
448
- <noscript>
449
- <iframe
450
- height="0"
451
- src={googleTagManagerNoScript}
452
- style={{ display: "none", visibility: "hidden" }}
453
- title="Google Tag Manager"
454
- width="0"
455
- />
456
- </noscript>
457
- )}
73
+ <IntegrationScripts
74
+ integrations={config.integrations}
75
+ placement="body"
76
+ />
458
77
  <ThemeProvider
459
78
  defaultTheme={config.mode}
460
- storageKey={THEME_STORAGE_KEY}
79
+ storageKey={DEFAULT_THEME_STORAGE_KEY}
461
80
  >
462
81
  {children}
463
82
  <ScrollRestoration />
464
83
  <Scripts />
465
84
  </ThemeProvider>
466
- {swetrix && swetrixBootstrap && (
467
- <>
468
- <script defer={swetrix.defer} src={swetrix.src} />
469
- <script
470
- data-swetrix-api-url={
471
- config.integrations.analytics.swetrix?.apiUrl
472
- }
473
- data-swetrix-project-id={
474
- config.integrations.analytics.swetrix?.projectId
475
- }
476
- dangerouslySetInnerHTML={{ __html: swetrixBootstrap }}
477
- />
478
- </>
479
- )}
480
- {intercom && (
481
- <script
482
- data-intercom-app-id={config.integrations.support.intercom?.appId}
483
- data-intercom-api-base={
484
- config.integrations.support.intercom?.apiBase
485
- }
486
- dangerouslySetInnerHTML={{ __html: intercom }}
487
- />
488
- )}
489
- {front && frontBootstrap && (
490
- <>
491
- <script src={front.src} />
492
- <script
493
- data-front-chat-id={config.integrations.support.front?.chatId}
494
- dangerouslySetInnerHTML={{ __html: frontBootstrap }}
495
- />
496
- </>
497
- )}
498
- {chatwoot && (
499
- <script
500
- data-chatwoot-base-url={
501
- config.integrations.support.chatwoot?.baseUrl
502
- }
503
- data-chatwoot-website-token={
504
- config.integrations.support.chatwoot?.websiteToken
505
- }
506
- dangerouslySetInnerHTML={{ __html: chatwoot }}
507
- />
508
- )}
509
- {zammad && zammadBootstrap && (
510
- <>
511
- <script src={zammad.src} />
512
- <script
513
- data-zammad-chat-id={config.integrations.support.zammad?.chatId}
514
- dangerouslySetInnerHTML={{ __html: zammadBootstrap }}
515
- />
516
- </>
517
- )}
518
85
  </body>
519
86
  </html>
520
87
  );
@@ -526,10 +93,7 @@ export default function App() {
526
93
 
527
94
  const MARKDOWN_RESOURCE_PREFIX = "/__heyo-docs/markdown";
528
95
 
529
- /**
530
- * Follows the Fumadocs React Router pattern: Markdown needs a resource route,
531
- * while this middleware keeps the public URL as `/<page>.md`.
532
- */
96
+ /** Exposes `/<page>.md` without making the resource implementation public. */
533
97
  const markdownMiddleware: Route.MiddlewareFunction = async (
534
98
  { request },
535
99
  next,
@@ -539,11 +103,10 @@ const markdownMiddleware: Route.MiddlewareFunction = async (
539
103
  !url.pathname.startsWith(`${MARKDOWN_RESOURCE_PREFIX}/`) &&
540
104
  pathnameFromMarkdownPath(url.pathname) !== undefined
541
105
  ) {
542
- const target = new URL(
543
- `${MARKDOWN_RESOURCE_PREFIX}${url.pathname}${url.search}`,
544
- url,
106
+ return Response.redirect(
107
+ new URL(`${MARKDOWN_RESOURCE_PREFIX}${url.pathname}${url.search}`, url),
108
+ 307,
545
109
  );
546
- return Response.redirect(target, 307);
547
110
  }
548
111
  return next();
549
112
  };