jamdesk 1.0.11 → 1.0.12

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.
@@ -52,10 +52,15 @@ describe('generateWorkerCode', () => {
52
52
  const code = generateWorkerCode(testConfig);
53
53
  expect(code).toContain('cacheEverything: true');
54
54
  });
55
- it('does not cache server errors', () => {
55
+ it('does not cache redirects or server errors', () => {
56
56
  const code = generateWorkerCode(testConfig);
57
+ expect(code).toContain('"300-399": 0');
57
58
  expect(code).toContain('"500-599": 0');
58
59
  });
60
+ it('passes redirects through to browser', () => {
61
+ const code = generateWorkerCode(testConfig);
62
+ expect(code).toContain('redirect: "manual"');
63
+ });
59
64
  });
60
65
  describe('generateWranglerConfig', () => {
61
66
  it('generates valid TOML with catch-all route', () => {
@@ -1 +1 @@
1
- {"version":3,"file":"deploy-templates.test.js","sourceRoot":"","sources":["../../../src/__tests__/unit/deploy-templates.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,sBAAsB,EACtB,mBAAmB,EACnB,iBAAiB,EACjB,iBAAiB,GAClB,MAAM,oCAAoC,CAAC;AAG5C,MAAM,UAAU,GAAqB;IACnC,IAAI,EAAE,MAAM;IACZ,MAAM,EAAE,aAAa;IACrB,UAAU,EAAE,OAAO;IACnB,QAAQ,EAAE,aAAa;CACxB,CAAC;AAEF,QAAQ,CAAC,oBAAoB,EAAE,GAAG,EAAE;IAClC,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC5C,MAAM,IAAI,GAAG,kBAAkB,CAAC,UAAU,CAAC,CAAC;QAC5C,MAAM,CAAC,IAAI,CAAC,CAAC,SAAS,CAAC,yCAAyC,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,GAAG,EAAE;QAC1C,MAAM,IAAI,GAA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GAAG,MAAM,CAexD"}
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CA4EnE;AAED,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAuBvE;AAED,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAqBpE;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,MAAM,CAK1C;AAsCD;;;;;;;GAOG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAexD"}
@@ -56,18 +56,23 @@ export default {
56
56
  // Custom header for domain verification (Vercel strips standard forwarding headers)
57
57
  headers.set("X-Jamdesk-Forwarded-Host", url.hostname);
58
58
 
59
+ // Don't follow redirects — let the browser handle them so the URL updates.
60
+ // Without this, redirects happen internally and the browser URL doesn't change,
61
+ // which causes the sidebar to mis-highlight the active page.
59
62
  const proxyRequest = new Request(proxyUrl, {
60
63
  method: request.method,
61
- headers: headers,
64
+ headers,
62
65
  body: request.body,
66
+ redirect: "manual",
63
67
  });
64
68
 
65
69
  // Cache all content types at Cloudflare edge (CF doesn't cache HTML by default).
66
70
  // Cache duration is controlled by upstream Cache-Control headers.
71
+ // Never cache redirects or errors — they must always hit origin.
67
72
  return fetch(proxyRequest, {
68
73
  cf: {
69
74
  cacheEverything: true,
70
- cacheTtlByStatus: { "500-599": 0 },
75
+ cacheTtlByStatus: { "300-399": 0, "500-599": 0 },
71
76
  },
72
77
  });
73
78
  },
@@ -1 +1 @@
1
- {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../../src/commands/deploy/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,MAAM,UAAU,kBAAkB,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esk",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "CLI for Jamdesk — build, preview, and deploy documentation sites from MDX. Dev server with hot reload, 50+ components, OpenAPI support, AI search, and Mintlify migration",
5
5
  "keywords": [
6
6
  "jamdesk",
@@ -610,9 +610,12 @@ export default async function DocPage({ params }: PageProps) {
610
610
  />
611
611
  )}
612
612
 
613
- {/* Additional MDX content (e.g., ResponseExample) */}
613
+ {/* Additional MDX content strip <ResponseExample> on OpenAPI pages
614
+ (auto-generated ResponseExamplePanel already handles responses) */}
614
615
  <MDXRemote
615
- source={content}
616
+ source={openApiEndpointData
617
+ ? content.replace(/<ResponseExample>[\s\S]*?<\/ResponseExample>/g, '')
618
+ : content}
616
619
  components={AllComponentsWithInline}
617
620
  options={{
618
621
  // Keep expression props (e.g. cols={2}) compatible under next-mdx-remote v6.
@@ -361,6 +361,24 @@ export function ApiPageWrapper({ children }: ApiPageWrapperProps) {
361
361
  return () => window.removeEventListener('resize', handleResize);
362
362
  }, [isDesktop, mounted, applyPanelHeights]);
363
363
 
364
+ // Recalculate sidebar panel heights when a CodePanel switches tabs
365
+ useEffect(() => {
366
+ if (!sidebarRef.current || !isDesktop || !mounted) return;
367
+
368
+ const handleTabChange = (e: Event) => {
369
+ const panel = (e.target as Element).closest('[data-code-panel]');
370
+ if (panel) {
371
+ // Invalidate cached measurement — content changed
372
+ panelDataRef.current.delete(panel);
373
+ requestAnimationFrame(() => applyPanelHeights());
374
+ }
375
+ };
376
+
377
+ const sidebar = sidebarRef.current;
378
+ sidebar.addEventListener('codepanel-tab-change', handleTabChange);
379
+ return () => sidebar.removeEventListener('codepanel-tab-change', handleTabChange);
380
+ }, [isDesktop, mounted, applyPanelHeights]);
381
+
364
382
  return (
365
383
  <div className="flex h-full">
366
384
  {/* Main content area with independent scroll */}
@@ -877,10 +877,10 @@ function CodeExamplesSection({ examples }: { examples: CodeExamples }) {
877
877
  * Renders full endpoint documentation from OpenAPI spec data.
878
878
  * Composes existing ParamField, ResponseField, and CodeGroup components.
879
879
  */
880
- export function OpenApiEndpoint({
881
- endpoint,
880
+ export function OpenApiEndpoint({
881
+ endpoint,
882
882
  codeExamples,
883
- children
883
+ children
884
884
  }: OpenApiEndpointProps) {
885
885
  const {
886
886
  method,
@@ -174,17 +174,77 @@ function findNavigationPath(config: DocsConfig, targetSlug: string): BreadcrumbI
174
174
  }
175
175
 
176
176
  /**
177
- * Get page title from frontmatter or slug
177
+ * Find the page's navigation title from docs.json config.
178
+ * Falls back to formatting the last slug segment.
178
179
  */
179
180
  function getPageTitle(slug: string[], config?: DocsConfig): string {
180
- // For now, just format the last segment nicely
181
- // TODO: Could read from frontmatter or navigation title
181
+ if (config) {
182
+ const targetSlug = slug.join('/');
183
+ const title = findPageNavTitle(config, targetSlug);
184
+ if (title) return title;
185
+ }
182
186
  const lastSegment = slug[slug.length - 1];
183
187
  return lastSegment
184
188
  .replace(/-/g, ' ')
185
189
  .replace(/\b\w/g, (l) => l.toUpperCase());
186
190
  }
187
191
 
192
+ /**
193
+ * Search navigation for the page's title (from enhanced nav or page object).
194
+ */
195
+ function findPageNavTitle(config: DocsConfig, targetSlug: string): string | null {
196
+ const nav = config.navigation;
197
+
198
+ function searchPages(pages: (NavigationPage | GroupConfig)[]): string | null {
199
+ for (const item of pages) {
200
+ if (typeof item === 'object' && 'group' in item) {
201
+ const groupItem = item as GroupConfig;
202
+ if (groupItem.pages) {
203
+ const found = searchPages(groupItem.pages);
204
+ if (found) return found;
205
+ }
206
+ } else {
207
+ const { path, title } = normalizeNavPage(item as NavigationPage);
208
+ if (path === targetSlug) return title;
209
+ }
210
+ }
211
+ return null;
212
+ }
213
+
214
+ function searchGroups(groups: GroupConfig[]): string | null {
215
+ for (const group of groups) {
216
+ if (group.pages) {
217
+ const found = searchPages(group.pages);
218
+ if (found) return found;
219
+ }
220
+ }
221
+ return null;
222
+ }
223
+
224
+ // Search all navigation structures
225
+ if (nav.languages) {
226
+ for (const lang of nav.languages) {
227
+ if (lang.tabs) {
228
+ for (const tab of lang.tabs) {
229
+ if (tab.groups) { const r = searchGroups(tab.groups); if (r) return r; }
230
+ }
231
+ }
232
+ }
233
+ }
234
+ if (nav.anchors) {
235
+ for (const anchor of nav.anchors) {
236
+ if (anchor.groups) { const r = searchGroups(anchor.groups); if (r) return r; }
237
+ }
238
+ }
239
+ if (nav.tabs) {
240
+ for (const tab of nav.tabs) {
241
+ if (tab.groups) { const r = searchGroups(tab.groups); if (r) return r; }
242
+ }
243
+ }
244
+ if (nav.groups) { const r = searchGroups(nav.groups); if (r) return r; }
245
+ return null;
246
+ }
247
+
188
248
  export function Breadcrumb({ slug, config }: BreadcrumbProps) {
189
249
  const linkPrefix = useLinkPrefix();
190
250
  const homeLink = config ? `${linkPrefix}/${getFirstPage(config)}` : `${linkPrefix}/introduction`;
@@ -53,10 +53,11 @@ interface NavPageProps {
53
53
  pathname: string | null;
54
54
  layout: LayoutVariant;
55
55
  onPrefetch: (path: string) => void;
56
+ onNavigate: (href: string) => void;
56
57
  linkPrefix?: string; // e.g., '/docs' when hostAtDocs is true
57
58
  }
58
59
 
59
- export const NavPage = React.memo(function NavPage({ page, pathname, layout, onPrefetch, linkPrefix = '' }: NavPageProps) {
60
+ export const NavPage = React.memo(function NavPage({ page, pathname, layout, onPrefetch, onNavigate, linkPrefix = '' }: NavPageProps) {
60
61
  const href = `${linkPrefix}/${page.path}`;
61
62
  const isActive = pathname === href;
62
63
  const colors = page.method ? methodColors[page.method] : null;
@@ -67,6 +68,7 @@ export const NavPage = React.memo(function NavPage({ page, pathname, layout, onP
67
68
  href={href}
68
69
  prefetch={false}
69
70
  onMouseEnter={() => onPrefetch(page.path)}
71
+ onClick={() => onNavigate(href)}
70
72
  className={`flex items-center gap-2 ${layout === 'header-logo' ? 'pr-3' : 'px-3'} py-1.5 rounded-lg text-sm transition-colors ${
71
73
  isActive
72
74
  ? 'text-[var(--color-primary)] nav-active'
@@ -92,6 +94,30 @@ export const NavPage = React.memo(function NavPage({ page, pathname, layout, onP
92
94
  );
93
95
  });
94
96
 
97
+ /** Find the first page path in a group, searching items, pages, and nested groups */
98
+ function findFirstPageInGroups(groups: ResolvedGroup[]): string | null {
99
+ for (const group of groups) {
100
+ // Prefer ordered items array (includes both pages and nested groups in order)
101
+ if (group.items) {
102
+ for (const item of group.items) {
103
+ if (item.type === 'page') return item.page.path;
104
+ if (item.type === 'group') {
105
+ const nested = findFirstPageInGroups([item.group]);
106
+ if (nested) return nested;
107
+ }
108
+ }
109
+ } else {
110
+ // Legacy format: pages + nested arrays
111
+ if (group.pages.length > 0) return group.pages[0].path;
112
+ if (group.nested) {
113
+ const nested = findFirstPageInGroups(group.nested);
114
+ if (nested) return nested;
115
+ }
116
+ }
117
+ }
118
+ return null;
119
+ }
120
+
95
121
  /** Find all groups in the path from root to the page containing currentPath */
96
122
  function findGroupsContainingPath(groups: ResolvedGroup[], currentPath: string, parentNames: string[] = []): Set<string> {
97
123
  const result = new Set<string>();
@@ -121,8 +147,9 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
121
147
  const sidebarRef = useRef<HTMLElement>(null);
122
148
  const linkPrefix = useLinkPrefix();
123
149
 
124
- // Optimistic pathname: use pending (from search navigation) until real pathname catches up
125
- const handleSearchNavigate = useCallback((url: string) => {
150
+ // Optimistic navigation: immediately highlight clicked link while page loads.
151
+ // Strips hash fragments so anchor links (e.g. /page#section) match pathname.
152
+ const handleNavigate = useCallback((url: string) => {
126
153
  setPendingPathname(url.split('#')[0]);
127
154
  }, []);
128
155
 
@@ -148,28 +175,43 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
148
175
  // In sidebar-logo layout, logo and search are in sidebar
149
176
  const showLogoInSidebar = layout === 'sidebar-logo';
150
177
  const showSearchInSidebar = layout === 'sidebar-logo';
151
-
178
+
152
179
  // Logo configuration
153
180
  const logoConfig = normalizeLogo(config.logo, config.assetVersion);
154
181
  const logoHref = logoConfig?.href || '/';
155
182
  const logoSrc = logoConfig ? (isDark && logoConfig.dark ? logoConfig.dark : logoConfig.light) : null;
156
183
  const showLogoImage = logoSrc && !logoError;
157
184
 
158
- // Resolve navigation using the new resolver
159
- // Use the actual pathname never fall back to '/docs' which resolves the wrong
160
- // active tab and causes the sidebar to highlight "Introduction" instead of the current page
185
+ // Resolve navigation structure (tab/anchor selection) using the raw pathname.
186
+ // Uses effectivePathname (not activePathname) because navigation resolution
187
+ // needs the actual URL for correct tab detection activePathname is only for
188
+ // highlight matching within the resolved groups.
161
189
  const resolvedNav = useMemo(() => {
162
190
  return resolveNavigation(config, effectivePathname || pathname || '/');
163
191
  }, [config, effectivePathname, pathname]);
164
192
 
193
+ // Normalize bare root path to first page path for active state highlighting.
194
+ // When an upstream proxy (e.g., Cloudflare Worker) follows the server redirect
195
+ // from /docs → /docs/introduction internally, the browser URL stays at /docs.
196
+ // This causes usePathname() to return "/docs" which doesn't match any nav link.
197
+ // Map the bare root to the first page so the sidebar highlights correctly.
198
+ const activePathname = useMemo(() => {
199
+ if (!effectivePathname) return effectivePathname;
200
+ const rootPath = linkPrefix || '/';
201
+ if (effectivePathname !== rootPath) return effectivePathname;
202
+
203
+ const firstPage = findFirstPageInGroups(resolvedNav.groups);
204
+ return firstPage ? `${linkPrefix}/${firstPage}` : effectivePathname;
205
+ }, [effectivePathname, linkPrefix, resolvedNav.groups]);
206
+
165
207
  // Track if this is the initial mount (for resetting expanded state on refresh)
166
208
  const isInitialMount = useRef(true);
167
209
 
168
210
  // Memoize the groups that should be expanded for the current page
169
211
  const groupsForCurrentPage = useMemo(() => {
170
- const currentPath = effectivePathname?.replace(/^\/(?:docs\/)?/, '') || '';
212
+ const currentPath = activePathname?.replace(/^\/(?:docs\/)?/, '') || '';
171
213
  return findGroupsContainingPath(resolvedNav.groups, currentPath);
172
- }, [resolvedNav.groups, effectivePathname]);
214
+ }, [resolvedNav.groups, activePathname]);
173
215
 
174
216
  // Expand groups containing current page
175
217
  // On initial mount: reset to only current page's groups
@@ -241,7 +283,7 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
241
283
  });
242
284
 
243
285
  return () => cancelAnimationFrame(rafId);
244
- }, [effectivePathname]);
286
+ }, [activePathname]);
245
287
 
246
288
  // Prevent body scroll when sidebar is open on mobile
247
289
  useEffect(() => {
@@ -255,16 +297,6 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
255
297
  };
256
298
  }, [isOpen]);
257
299
 
258
- // Find the first page in a group (including nested groups)
259
- function findFirstPageInGroup(g: ResolvedGroup): string | null {
260
- if (g.pages.length > 0) return g.pages[0].path;
261
- for (const nested of g.nested || []) {
262
- const nestedFirst = findFirstPageInGroup(nested);
263
- if (nestedFirst) return nestedFirst;
264
- }
265
- return null;
266
- }
267
-
268
300
  // Toggle group expansion; if expanding, navigate to first page
269
301
  const handleGroupClick = useCallback((group: ResolvedGroup) => {
270
302
  setExpandedGroups(prev => {
@@ -272,7 +304,7 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
272
304
  if (prev.has(group.name)) {
273
305
  newSet.delete(group.name);
274
306
  } else {
275
- const firstPagePath = findFirstPageInGroup(group);
307
+ const firstPagePath = findFirstPageInGroups([group]);
276
308
  if (firstPagePath) router.push(`${linkPrefix}/${firstPagePath}`);
277
309
  newSet.add(group.name);
278
310
  }
@@ -346,9 +378,10 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
346
378
  <NavPage
347
379
  key={p.page.path}
348
380
  page={p.page}
349
- pathname={effectivePathname}
381
+ pathname={activePathname}
350
382
  layout={layout}
351
383
  onPrefetch={handlePrefetch}
384
+ onNavigate={handleNavigate}
352
385
  linkPrefix={linkPrefix}
353
386
  />
354
387
  ))}
@@ -384,9 +417,10 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
384
417
  <NavPage
385
418
  key={page.path}
386
419
  page={page}
387
- pathname={effectivePathname}
420
+ pathname={activePathname}
388
421
  layout={layout}
389
422
  onPrefetch={handlePrefetch}
423
+ onNavigate={handleNavigate}
390
424
  linkPrefix={linkPrefix}
391
425
  />
392
426
  ))}
@@ -431,20 +465,7 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
431
465
  );
432
466
  }
433
467
 
434
- // Find the first page in this anchor's groups
435
- const findFirstPage = (groups: ResolvedGroup[]): string | null => {
436
- for (const group of groups) {
437
- if (group.pages.length > 0) {
438
- return group.pages[0].path;
439
- }
440
- if (group.nested) {
441
- const nestedFirst = findFirstPage(group.nested);
442
- if (nestedFirst) return nestedFirst;
443
- }
444
- }
445
- return null;
446
- };
447
- const firstPagePath = findFirstPage(anchor.groups);
468
+ const firstPagePath = findFirstPageInGroups(anchor.groups);
448
469
 
449
470
  return (
450
471
  <button
@@ -721,7 +742,7 @@ export function Sidebar({ config, layout = 'header-logo', tabsPosition: tabsPosi
721
742
  </aside>
722
743
 
723
744
  {/* Search Modal - shown when search is opened from sidebar */}
724
- <SearchModal isOpen={isSearchOpen} onClose={() => setIsSearchOpen(false)} onNavigate={handleSearchNavigate} />
745
+ <SearchModal isOpen={isSearchOpen} onClose={() => setIsSearchOpen(false)} onNavigate={handleNavigate} />
725
746
  </>
726
747
  );
727
748
  }
@@ -0,0 +1,25 @@
1
+ // Auto-generated file - do not edit manually
2
+ // @ts-nocheck
3
+
4
+ import React from 'react';
5
+
6
+ // Import built-in MDX components that snippets can use
7
+ import { Note, Info, Warning, Tip, Check, Danger, Callout } from '@/components/mdx/Callouts';
8
+ import { Card } from '@/components/mdx/Card';
9
+ import { CardGroup } from '@/components/mdx/CardGroup';
10
+ import { ParamField } from '@/components/mdx/ParamField';
11
+ import { ResponseField } from '@/components/mdx/ResponseField';
12
+ import { Accordion, AccordionGroup } from '@/components/mdx/Accordion';
13
+ import { CodeGroup } from '@/components/mdx/CodeGroup';
14
+ import { Steps, Step } from '@/components/mdx/Steps';
15
+
16
+
17
+ const CodeLink = ({ title, href }: any) => {
18
+ return (
19
+ <Card title={`${title}`} href={`${href}`} horizontal icon="code">
20
+ {" "}
21
+ </Card>
22
+ );
23
+ };
24
+
25
+ export default CodeLink;
@@ -0,0 +1,44 @@
1
+ // Auto-generated file - do not edit manually
2
+ // @ts-nocheck
3
+
4
+ import React from 'react';
5
+
6
+ // Import built-in MDX components that snippets can use
7
+ import { Note, Info, Warning, Tip, Check, Danger, Callout } from '@/components/mdx/Callouts';
8
+ import { Card } from '@/components/mdx/Card';
9
+ import { CardGroup } from '@/components/mdx/CardGroup';
10
+ import { ParamField } from '@/components/mdx/ParamField';
11
+ import { ResponseField } from '@/components/mdx/ResponseField';
12
+ import { Accordion, AccordionGroup } from '@/components/mdx/Accordion';
13
+ import { CodeGroup } from '@/components/mdx/CodeGroup';
14
+ import { Steps, Step } from '@/components/mdx/Steps';
15
+
16
+
17
+ const HeaderAPI = ({ noProfileKey, profileKeyRequired }: any) => (
18
+ <>
19
+ <ParamField header="Authorization" type="string" required>
20
+ <a href="/apis/overview#authorization">API Key</a> of the Primary Profile.
21
+ <br />
22
+ <br />
23
+ Format: <code>Authorization: Bearer API_KEY</code>
24
+ </ParamField>
25
+ {!noProfileKey &&
26
+ (profileKeyRequired ? (
27
+ <ParamField header="Profile-Key" type="string" required>
28
+ <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
29
+ <br />
30
+ <br />
31
+ Format: <code>Profile-Key: PROFILE_KEY</code>
32
+ </ParamField>
33
+ ) : (
34
+ <ParamField header="Profile-Key" type="string">
35
+ <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
36
+ <br />
37
+ <br />
38
+ Format: <code>Profile-Key: PROFILE_KEY</code>
39
+ </ParamField>
40
+ ))}
41
+ </>
42
+ );
43
+
44
+ export default HeaderAPI;
@@ -0,0 +1,53 @@
1
+ // Auto-generated file - do not edit manually
2
+ // @ts-nocheck
3
+
4
+ import React from 'react';
5
+
6
+ // Import built-in MDX components that snippets can use
7
+ import { Note, Info, Warning, Tip, Check, Danger, Callout } from '@/components/mdx/Callouts';
8
+ import { Card } from '@/components/mdx/Card';
9
+ import { CardGroup } from '@/components/mdx/CardGroup';
10
+ import { ParamField } from '@/components/mdx/ParamField';
11
+ import { ResponseField } from '@/components/mdx/ResponseField';
12
+ import { Accordion, AccordionGroup } from '@/components/mdx/Accordion';
13
+ import { CodeGroup } from '@/components/mdx/CodeGroup';
14
+ import { Steps, Step } from '@/components/mdx/Steps';
15
+
16
+
17
+ const PlansAvailable = ({ plans, maxPackRequired }: any) => {
18
+ let displayPlans = plans;
19
+
20
+ if (plans.length === 1) {
21
+ const lowerCasePlan = plans[0].toLowerCase();
22
+ if (lowerCasePlan === "basic") {
23
+ displayPlans = ["Basic", "Premium", "Business", "Enterprise"];
24
+ } else if (lowerCasePlan === "business") {
25
+ displayPlans = ["Business", "Enterprise"];
26
+ } else if (lowerCasePlan === "premium") {
27
+ displayPlans = ["Premium", "Business", "Enterprise"];
28
+ }
29
+ }
30
+
31
+ return (
32
+
33
+ <Note>
34
+ Available on {displayPlans.length === 1 ? "the " : ""}
35
+ {displayPlans.join(", ").replace(/\b\w/g, (l) => l.toUpperCase())}{" "}
36
+ {displayPlans.length > 1 ? "plans" : "plan"}.
37
+
38
+ {maxPackRequired && (
39
+
40
+ <a href="https://www.acme.com/docs/additional/maxpack"
41
+ className="flex items-center mt-2 cursor-pointer"
42
+ >
43
+ <span className="px-1.5 py-0.5 rounded text-sm" style={{backgroundColor: '#C264B6', color: 'white', fontSize: '12px'}}>
44
+ Max Pack required
45
+ </span>
46
+ </a>
47
+ )}
48
+ </Note>
49
+
50
+ );
51
+ };
52
+
53
+ export default PlansAvailable;
@@ -0,0 +1,43 @@
1
+ // Auto-generated file - do not edit manually
2
+ // @ts-nocheck
3
+
4
+ import React from 'react';
5
+
6
+ // Import built-in MDX components that snippets can use
7
+ import { Note, Info, Warning, Tip, Check, Danger, Callout } from '@/components/mdx/Callouts';
8
+ import { Card } from '@/components/mdx/Card';
9
+ import { CardGroup } from '@/components/mdx/CardGroup';
10
+ import { ParamField } from '@/components/mdx/ParamField';
11
+ import { ResponseField } from '@/components/mdx/ResponseField';
12
+ import { Accordion, AccordionGroup } from '@/components/mdx/Accordion';
13
+ import { CodeGroup } from '@/components/mdx/CodeGroup';
14
+ import { Steps, Step } from '@/components/mdx/Steps';
15
+
16
+
17
+ // Helper component for rendering plain MDX snippets
18
+ // Content is from project snippets (controlled source), not user input
19
+ const PlainMdxSnippet = ({ content }: { content: string }) => {
20
+ const formattedContent = content
21
+ .split('\n\n')
22
+ .map((paragraph) => {
23
+ let html = paragraph.replace(/\*\*([^*]+)\*\*/g, '<strong>$1</strong>');
24
+ html = html.replace(/\*([^*]+)\*/g, '<em>$1</em>');
25
+ html = html.replace(/\`([^\`]+)\`/g, '<code>$1</code>');
26
+ return html;
27
+ })
28
+ .filter(p => p.trim());
29
+
30
+ return (
31
+ <div className="snippet-content">
32
+ {formattedContent.map((p, i) => (
33
+ <p key={i} dangerouslySetInnerHTML={{ __html: p }} />
34
+ ))}
35
+ </div>
36
+ );
37
+ };
38
+
39
+ const SnippetIntro = () => {
40
+ return <PlainMdxSnippet content={"One of the core principles of software development is DRY (Don't Repeat\nYourself). This is a principle that apply to documentation as\nwell. If you find yourself repeating the same content in multiple places, you\nshould consider creating a custom snippet to keep your content in sync."} />;
41
+ };
42
+
43
+ export default SnippetIntro;
@@ -121,6 +121,7 @@ export function CodePanel({
121
121
  const [scrollRatio, setScrollRatio] = useState(0); // 0 to 1, for custom scrollbar position
122
122
  const [thumbWidth, setThumbWidth] = useState(30); // Percentage width of thumb
123
123
  const [isDragging, setIsDragging] = useState(false);
124
+ const panelRef = useRef<HTMLDivElement>(null);
124
125
  const tabsRef = useRef<HTMLDivElement>(null);
125
126
  const trackRef = useRef<HTMLDivElement>(null);
126
127
  const contentRef = useRef<HTMLDivElement>(null);
@@ -149,6 +150,11 @@ export function CodePanel({
149
150
  }
150
151
  };
151
152
 
153
+ // Notify parent (ApiPage) after tab content re-renders so sidebar heights recalculate
154
+ useEffect(() => {
155
+ panelRef.current?.dispatchEvent(new CustomEvent('codepanel-tab-change', { bubbles: true }));
156
+ }, [activeTab]);
157
+
152
158
  // Check for overflow and scroll position
153
159
  useEffect(() => {
154
160
  const checkOverflow = () => {
@@ -246,6 +252,7 @@ export function CodePanel({
246
252
 
247
253
  return (
248
254
  <div
255
+ ref={panelRef}
249
256
  className={`rounded-xl overflow-hidden not-prose w-full flex flex-col ${className}`}
250
257
  style={{ border: `0.5px solid ${codePanelColors.border}`, boxShadow: 'var(--shadow-lg)' }}
251
258
  data-code-panel={panelType || 'inline'}
@@ -0,0 +1,25 @@
1
+ // DO NOT EDIT — this file is auto-synced from shared/. Edit the source in shared/ and run ./scripts/sync-shared.sh
2
+
3
+ /**
4
+ * Shared Cryptographic Helpers
5
+ *
6
+ * Constant-time comparison using HMAC to avoid length-leak timing attacks.
7
+ *
8
+ * SYNC TARGET: This file is the source of truth.
9
+ * Synced to: builder/build-service/lib, proxy/lib
10
+ */
11
+ import { timingSafeEqual, createHmac } from 'crypto';
12
+
13
+ /**
14
+ * Constant-time string comparison using HMAC.
15
+ *
16
+ * Unlike naive timingSafeEqual (which requires equal-length buffers and
17
+ * leaks length via early return), this HMACs both values first so
18
+ * comparisons are always on fixed-length 32-byte digests.
19
+ */
20
+ export function secretsEqual(a: string, b: string): boolean {
21
+ const key = 'jamdesk-secret-comparison';
22
+ const hmacA = createHmac('sha256', key).update(a).digest();
23
+ const hmacB = createHmac('sha256', key).update(b).digest();
24
+ return timingSafeEqual(hmacA, hmacB);
25
+ }
@@ -0,0 +1,175 @@
1
+ /**
2
+ * Navigation Enhancement
3
+ *
4
+ * Enhances docs.json navigation entries with metadata from MDX frontmatter:
5
+ * - Sidebar titles (sidebarTitle > title)
6
+ * - HTTP method badges (from openapi: or api: frontmatter)
7
+ * - Icons and tags
8
+ *
9
+ * Port of scripts/enhance-navigation.cjs for use in the production build pipeline.
10
+ */
11
+
12
+ import type {
13
+ DocsConfig,
14
+ NavigationPage,
15
+ NavigationPageObject,
16
+ GroupConfig,
17
+ } from './docs-types.js';
18
+
19
+ type HttpMethod = NonNullable<NavigationPageObject['method']>;
20
+
21
+ export interface PageInfo {
22
+ path: string;
23
+ frontmatter: Record<string, unknown>;
24
+ content: string;
25
+ }
26
+
27
+ const VALID_METHODS: readonly string[] = ['GET', 'POST', 'PUT', 'PATCH', 'DELETE'];
28
+
29
+ /**
30
+ * Parse HTTP method from `api:` frontmatter field.
31
+ * Example: "POST /analytics/post" -> "POST"
32
+ */
33
+ export function parseApiMethod(apiField: unknown): HttpMethod | null {
34
+ if (!apiField || typeof apiField !== 'string') return null;
35
+ const trimmed = apiField.trim().toUpperCase();
36
+ for (const method of VALID_METHODS) {
37
+ if (trimmed.startsWith(method)) return method as HttpMethod;
38
+ }
39
+ return null;
40
+ }
41
+
42
+ /**
43
+ * Parse HTTP method from `openapi:` frontmatter field.
44
+ * Example: "/openapi/spec.yml GET /api/v1/users" -> "GET"
45
+ */
46
+ export function parseOpenApiMethod(openapiField: unknown): HttpMethod | null {
47
+ if (!openapiField || typeof openapiField !== 'string') return null;
48
+ const parts = openapiField.trim().split(/\s+/);
49
+ for (const part of parts) {
50
+ const upper = part.toUpperCase();
51
+ if (VALID_METHODS.includes(upper)) return upper as HttpMethod;
52
+ }
53
+ return null;
54
+ }
55
+
56
+ function buildFrontmatterMap(
57
+ pageInfos: PageInfo[],
58
+ ): Map<string, Record<string, unknown>> {
59
+ const map = new Map<string, Record<string, unknown>>();
60
+ for (const info of pageInfos) {
61
+ const pagePath = info.path.replace(/\.mdx?$/, '');
62
+ map.set(pagePath, info.frontmatter);
63
+ }
64
+ return map;
65
+ }
66
+
67
+ /**
68
+ * Enhance a single page entry with frontmatter data.
69
+ * Preserves existing explicit values — only fills in missing ones.
70
+ */
71
+ function enhancePage(
72
+ page: NavigationPage,
73
+ map: Map<string, Record<string, unknown>>,
74
+ ): NavigationPage {
75
+ const pagePath = typeof page === 'string' ? page : page.page;
76
+ const existing: Partial<NavigationPageObject> =
77
+ typeof page === 'object' ? page : {};
78
+
79
+ const fm = map.get(pagePath);
80
+ if (!fm) return page;
81
+
82
+ // sidebarTitle takes priority over title for sidebar display
83
+ const title =
84
+ existing.title ||
85
+ (fm.sidebarTitle as string | undefined) ||
86
+ (fm.title as string | undefined);
87
+ const method =
88
+ existing.method || parseApiMethod(fm.api) || parseOpenApiMethod(fm.openapi);
89
+ const icon = existing.icon || (fm.icon as string | undefined);
90
+ const tag = existing.tag || (fm.tag as string | undefined);
91
+
92
+ if (title || method || icon || tag) {
93
+ return {
94
+ page: pagePath,
95
+ ...(title && { title }),
96
+ ...(method && { method }),
97
+ ...(icon && { icon }),
98
+ ...(tag && { tag }),
99
+ };
100
+ }
101
+
102
+ return page;
103
+ }
104
+
105
+ /**
106
+ * Recursively enhance all pages/groups in a navigation array.
107
+ */
108
+ function enhancePages(
109
+ pages: (NavigationPage | GroupConfig)[],
110
+ map: Map<string, Record<string, unknown>>,
111
+ ): (NavigationPage | GroupConfig)[] {
112
+ return pages.map((item) => {
113
+ if (typeof item === 'object' && 'group' in item) {
114
+ return enhanceNavNode(
115
+ item as unknown as Record<string, unknown>,
116
+ map,
117
+ ) as unknown as GroupConfig;
118
+ }
119
+ return enhancePage(item as NavigationPage, map);
120
+ });
121
+ }
122
+
123
+ /** Navigation keys whose children are sub-nodes (recurse with enhanceNavNode). */
124
+ const RECURSE_KEYS = [
125
+ 'groups', 'tabs', 'anchors', 'dropdowns',
126
+ 'products', 'versions', 'languages', 'menu',
127
+ ] as const;
128
+
129
+ /**
130
+ * Generic recursive walker — enhances any navigation node that has
131
+ * pages, groups, tabs, anchors, dropdowns, products, versions,
132
+ * languages, or menu keys.
133
+ */
134
+ function enhanceNavNode(
135
+ node: Record<string, unknown>,
136
+ map: Map<string, Record<string, unknown>>,
137
+ ): Record<string, unknown> {
138
+ const result = { ...node };
139
+
140
+ // Pages contain leaf page entries (strings or objects) mixed with nested groups
141
+ if (Array.isArray(node.pages)) {
142
+ result.pages = enhancePages(node.pages, map);
143
+ }
144
+
145
+ // All other array keys contain sub-nodes that need recursive enhancement
146
+ for (const key of RECURSE_KEYS) {
147
+ if (Array.isArray(node[key])) {
148
+ result[key] = (node[key] as Record<string, unknown>[]).map((child) =>
149
+ enhanceNavNode(child, map),
150
+ );
151
+ }
152
+ }
153
+
154
+ return result;
155
+ }
156
+
157
+ /**
158
+ * Enhance docs.json navigation with frontmatter metadata.
159
+ * Returns a new config — does NOT mutate the input.
160
+ */
161
+ export function enhanceConfigNavigation(
162
+ config: DocsConfig,
163
+ pageInfos: PageInfo[],
164
+ ): DocsConfig {
165
+ const nav = config.navigation;
166
+ if (!nav || Object.keys(nav).length === 0) return config;
167
+
168
+ const map = buildFrontmatterMap(pageInfos);
169
+ const enhanced = enhanceNavNode(
170
+ nav as Record<string, unknown>,
171
+ map,
172
+ );
173
+
174
+ return { ...config, navigation: enhanced as DocsConfig['navigation'] };
175
+ }