@fern-api/fdr-sdk 1.2.42-5d054efb73 → 1.2.42-756f6ba5d7

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 (70) hide show
  1. package/dist/js/converters/index.js +0 -9
  2. package/dist/js/converters/index.js.map +1 -1
  3. package/dist/js/converters/index.mjs +0 -9
  4. package/dist/js/converters/index.mjs.map +1 -1
  5. package/dist/js/index.js +0 -9
  6. package/dist/js/index.js.map +1 -1
  7. package/dist/js/index.mjs +0 -9
  8. package/dist/js/index.mjs.map +1 -1
  9. package/dist/js/navigation/index.js +0 -9
  10. package/dist/js/navigation/index.js.map +1 -1
  11. package/dist/js/navigation/index.mjs +0 -9
  12. package/dist/js/navigation/index.mjs.map +1 -1
  13. package/dist/js/navigation/ledger-root-builder.js +36 -191
  14. package/dist/js/navigation/ledger-root-builder.js.map +1 -1
  15. package/dist/js/navigation/ledger-root-builder.mjs +36 -191
  16. package/dist/js/navigation/ledger-root-builder.mjs.map +1 -1
  17. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js +4 -167
  18. package/dist/navigation/__test__/ledger-root-builder.metadataPreservation.test.js.map +1 -1
  19. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js +0 -102
  20. package/dist/navigation/__test__/ledger-root-builder.rootChildOrder.test.js.map +1 -1
  21. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js +0 -276
  22. package/dist/navigation/__test__/ledger-root-builder.skipSlugApiReference.test.js.map +1 -1
  23. package/dist/navigation/ledger-root-builder.d.ts.map +1 -1
  24. package/dist/navigation/ledger-root-builder.js +47 -275
  25. package/dist/navigation/ledger-root-builder.js.map +1 -1
  26. package/dist/navigation/utils/index.d.ts +0 -1
  27. package/dist/navigation/utils/index.d.ts.map +1 -1
  28. package/dist/navigation/utils/index.js +0 -1
  29. package/dist/navigation/utils/index.js.map +1 -1
  30. package/dist/tsconfig.tsbuildinfo +1 -1
  31. package/dist/types/navigation/ledger-root-builder.d.ts.map +1 -1
  32. package/dist/types/navigation/utils/index.d.ts +0 -1
  33. package/dist/types/navigation/utils/index.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  36. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  37. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js +0 -267
  38. package/dist/navigation/__test__/ledger-root-builder.crossProductDedup.test.js.map +0 -1
  39. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  40. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  41. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js +0 -306
  42. package/dist/navigation/__test__/ledger-root-builder.ledgerParity.test.js.map +0 -1
  43. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  44. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  45. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js +0 -273
  46. package/dist/navigation/__test__/ledger-root-builder.sidebarDepth.test.js.map +0 -1
  47. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  48. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  49. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js +0 -256
  50. package/dist/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.js.map +0 -1
  51. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  52. package/dist/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  53. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js +0 -29
  54. package/dist/navigation/utils/__test__/syntheticSectionPath.test.js.map +0 -1
  55. package/dist/navigation/utils/syntheticSectionPath.d.ts +0 -13
  56. package/dist/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
  57. package/dist/navigation/utils/syntheticSectionPath.js +0 -20
  58. package/dist/navigation/utils/syntheticSectionPath.js.map +0 -1
  59. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts +0 -2
  60. package/dist/types/navigation/__test__/ledger-root-builder.crossProductDedup.test.d.ts.map +0 -1
  61. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts +0 -2
  62. package/dist/types/navigation/__test__/ledger-root-builder.ledgerParity.test.d.ts.map +0 -1
  63. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts +0 -2
  64. package/dist/types/navigation/__test__/ledger-root-builder.sidebarDepth.test.d.ts.map +0 -1
  65. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts +0 -2
  66. package/dist/types/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.d.ts.map +0 -1
  67. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts +0 -2
  68. package/dist/types/navigation/utils/__test__/syntheticSectionPath.test.d.ts.map +0 -1
  69. package/dist/types/navigation/utils/syntheticSectionPath.d.ts +0 -13
  70. package/dist/types/navigation/utils/syntheticSectionPath.d.ts.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"ledger-root-builder.sidebarDepth.test.d.ts","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.sidebarDepth.test.ts"],"names":[],"mappings":""}
@@ -1,273 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import * as FernNavigation from "../index.js";
3
- import { buildFullRootFromSegments } from "../ledger-root-builder.js";
4
- import { createBreadcrumb } from "../utils/createBreadcrumb.js";
5
- /**
6
- * Tests for sidebarDepth-based root section identification.
7
- *
8
- * V1 configs define flat root sections (e.g. "Users", "Policies",
9
- * "Verification") that the decomposer marks as sidebarDepth=0. Without
10
- * this marker, the builder's slug-derived hierarchy would infer that
11
- * "users/verification" is a child of "users", creating extra ancestor
12
- * levels in the breadcrumb.
13
- */
14
- function pageRoute(opts) {
15
- return {
16
- type: "markdown",
17
- fullPath: opts.fullPath,
18
- hidden: false,
19
- metadata: { title: opts.title, pageId: `pg-${opts.title.toLowerCase().replace(/\s+/g, "-")}` },
20
- ...(opts.displaySortOrder != null ? { displaySortOrder: opts.displaySortOrder } : {})
21
- };
22
- }
23
- function segment(opts) {
24
- return {
25
- segmentId: opts.segmentHash,
26
- segmentHash: opts.segmentHash,
27
- section: opts.section,
28
- locale: "en",
29
- sortOrder: opts.sortOrder,
30
- hidden: false,
31
- metadata: opts.metadata,
32
- product: null,
33
- version: null,
34
- variant: null,
35
- tab: null
36
- };
37
- }
38
- /** Flatten sidebar-root children (unwrapping sidebarGroups) to section info. */
39
- function rootSections(root) {
40
- const unversioned = root.child;
41
- const sidebar = unversioned.child;
42
- const result = [];
43
- for (const child of sidebar.children) {
44
- const items = child.type === "sidebarGroup"
45
- ? child.children
46
- : [child];
47
- for (const item of items) {
48
- if (item.type === "section") {
49
- const childTitles = (item.children ?? []).map((c) => c.title ?? "");
50
- result.push({ title: item.title ?? "", childTitles });
51
- }
52
- }
53
- }
54
- return result;
55
- }
56
- /** Count all section nodes in the tree via DFS. */
57
- function countSectionNodes(root) {
58
- let count = 0;
59
- FernNavigation.traverseDF(root, (node) => {
60
- if (node.type === "section") {
61
- count++;
62
- }
63
- });
64
- return count;
65
- }
66
- /** Find a page node by slug and return its breadcrumb. */
67
- function breadcrumbForSlug(root, slug) {
68
- const collector = FernNavigation.NodeCollector.collect(root);
69
- const found = collector.getSlugMapWithParents().get(FernNavigation.Slug(slug));
70
- if (found == null) {
71
- throw new Error(`Slug "${slug}" not found in tree`);
72
- }
73
- return createBreadcrumb(found.parents);
74
- }
75
- // ── Fix #1: sidebarDepth prevents false root section nesting ─────────────────
76
- describe("buildFullRootFromSegments — sidebarDepth prevents false nesting", () => {
77
- /**
78
- * Reproduces the structure that causes extra breadcrumb links:
79
- *
80
- * V1 config (flat):
81
- * Introduction (skipUrlSlug → sec="")
82
- * Users (sec="users", sidebarDepth=0)
83
- * Policies (sec="users/policies", sidebarDepth=0)
84
- * Verification (sec="users/verification", sidebarDepth=0)
85
- *
86
- * Without sidebarDepth, the builder would nest Policies and Verification
87
- * under Users (since parentSectionPath("users/policies") === "users"),
88
- * creating extra breadcrumb ancestors.
89
- *
90
- * With sidebarDepth=0, they remain flat root peers.
91
- */
92
- function buildFlatRoot() {
93
- return buildFullRootFromSegments({
94
- basePath: "docs",
95
- title: "Test",
96
- segments: [
97
- segment({
98
- segmentHash: "seg-root",
99
- section: "",
100
- sortOrder: 0,
101
- metadata: { type: "tabRoot" }
102
- }),
103
- // Root section wrapper (Introduction, skipUrlSlug → sec="")
104
- segment({
105
- segmentHash: "seg-intro",
106
- section: "",
107
- sortOrder: 1,
108
- metadata: {
109
- type: "section",
110
- title: "Introduction",
111
- sidebarDepth: 0,
112
- childIndex: 0,
113
- pointsTo: "docs/guides/e-wallet"
114
- }
115
- }),
116
- // Users — depth 0, should be root peer
117
- segment({
118
- segmentHash: "seg-users",
119
- section: "users",
120
- sortOrder: 2,
121
- metadata: {
122
- type: "section",
123
- title: "Users",
124
- sidebarDepth: 0,
125
- childIndex: 1,
126
- pointsTo: "docs/guides/users/types"
127
- }
128
- }),
129
- // Policies — depth 0, path is "users/policies" but should NOT
130
- // be nested under Users
131
- segment({
132
- segmentHash: "seg-policies",
133
- section: "users/policies",
134
- sortOrder: 3,
135
- metadata: {
136
- type: "section",
137
- title: "Policies",
138
- sidebarDepth: 0,
139
- childIndex: 2,
140
- pointsTo: "docs/guides/users/blocked-users"
141
- }
142
- }),
143
- // Verification — depth 0, path is "users/verification" but
144
- // should NOT be nested under Users
145
- segment({
146
- segmentHash: "seg-verification",
147
- section: "users/verification",
148
- sortOrder: 4,
149
- metadata: {
150
- type: "section",
151
- title: "User KYC/KYB verification",
152
- sidebarDepth: 0,
153
- childIndex: 3
154
- }
155
- }),
156
- // Nested child under Verification (depth 1)
157
- segment({
158
- segmentHash: "seg-hosted",
159
- section: "users/verification/hosted",
160
- sortOrder: 5,
161
- metadata: {
162
- type: "section",
163
- title: "Flows per user type",
164
- sidebarDepth: 1,
165
- childIndex: 0,
166
- pointsTo: "docs/guides/users/verification/hosted/natural"
167
- }
168
- })
169
- ],
170
- navBySegment: new Map([
171
- [
172
- "seg-root",
173
- [pageRoute({ fullPath: "docs/guides/e-wallet", title: "E-wallet system", displaySortOrder: 0 })]
174
- ],
175
- ["seg-intro", []],
176
- ["seg-users", [pageRoute({ fullPath: "docs/guides/users/types", title: "User types" })]],
177
- ["seg-policies", [pageRoute({ fullPath: "docs/guides/users/blocked-users", title: "Blocked users" })]],
178
- [
179
- "seg-verification",
180
- [pageRoute({ fullPath: "docs/guides/users/verification", title: "Verification overview" })]
181
- ],
182
- [
183
- "seg-hosted",
184
- [pageRoute({ fullPath: "docs/guides/users/verification/hosted/natural", title: "Natural persons" })]
185
- ]
186
- ])
187
- });
188
- }
189
- it("preserves flat root sections instead of nesting by slug hierarchy", () => {
190
- const root = buildFlatRoot();
191
- const sections = rootSections(root);
192
- const titles = sections.map((s) => s.title);
193
- // All depth-0 sections should appear as root peers
194
- expect(titles).toContain("Users");
195
- expect(titles).toContain("Policies");
196
- expect(titles).toContain("User KYC/KYB verification");
197
- });
198
- it("does not create extra breadcrumb ancestors for flat sections", () => {
199
- const root = buildFlatRoot();
200
- // The verification section's slug is docs/users/verification.
201
- // Its page lives at docs/docs/guides/users/verification (basePath + fullPath).
202
- const bc = breadcrumbForSlug(root, "docs/users/verification");
203
- // With flat root sections, the verification page should have at most
204
- // one section ancestor, not extra "Users" + "Policies" ancestors.
205
- const linkedEntries = bc.filter((item) => item.pointsTo != null);
206
- expect(linkedEntries.length).toBeLessThanOrEqual(1);
207
- // Total breadcrumb entries should be 1 (just the verification section)
208
- // not 3 (Introduction + Policies + Verification)
209
- expect(bc.length).toBeLessThanOrEqual(1);
210
- });
211
- it("still nests depth>0 children under their parent section", () => {
212
- const root = buildFlatRoot();
213
- // "Flows per user type" (depth 1, sec="users/verification/hosted")
214
- // should be nested under "User KYC/KYB verification" (depth 0,
215
- // sec="users/verification")
216
- const sections = rootSections(root);
217
- const verification = sections.find((s) => s.title === "User KYC/KYB verification");
218
- expect(verification).toBeDefined();
219
- expect(verification.childTitles).toContain("Flows per user type");
220
- });
221
- it("does not produce duplicate section nodes", () => {
222
- const root = buildFlatRoot();
223
- const totalSections = countSectionNodes(root);
224
- // 5 unique sections: Introduction, Users, Policies,
225
- // User KYC/KYB verification, Flows per user type
226
- expect(totalSections).toBe(5);
227
- });
228
- });
229
- // ── Backward compatibility: segments without sidebarDepth ────────────────────
230
- describe("buildFullRootFromSegments — backward compatibility without sidebarDepth", () => {
231
- it("falls back to path-based hierarchy when sidebarDepth is absent", () => {
232
- // Old data without sidebarDepth: "users/verification" is correctly
233
- // nested under "users" via slug hierarchy.
234
- const root = buildFullRootFromSegments({
235
- basePath: "docs",
236
- title: "Test",
237
- segments: [
238
- segment({
239
- segmentHash: "seg-root",
240
- section: "",
241
- sortOrder: 0,
242
- metadata: { type: "tabRoot" }
243
- }),
244
- segment({
245
- segmentHash: "seg-users",
246
- section: "users",
247
- sortOrder: 1,
248
- metadata: { type: "section", title: "Users", childIndex: 0 }
249
- }),
250
- segment({
251
- segmentHash: "seg-verification",
252
- section: "users/verification",
253
- sortOrder: 2,
254
- metadata: { type: "section", title: "Verification", childIndex: 0 }
255
- })
256
- ],
257
- navBySegment: new Map([
258
- ["seg-root", [pageRoute({ fullPath: "docs/overview", title: "Overview", displaySortOrder: 0 })]],
259
- ["seg-users", [pageRoute({ fullPath: "docs/users/types", title: "User types" })]],
260
- [
261
- "seg-verification",
262
- [pageRoute({ fullPath: "docs/users/verification/guide", title: "Verification guide" })]
263
- ]
264
- ])
265
- });
266
- // Without sidebarDepth, Verification nests under Users (slug-derived)
267
- const sections = rootSections(root);
268
- const users = sections.find((s) => s.title === "Users");
269
- expect(users).toBeDefined();
270
- expect(users.childTitles).toContain("Verification");
271
- });
272
- });
273
- //# sourceMappingURL=ledger-root-builder.sidebarDepth.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ledger-root-builder.sidebarDepth.test.js","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.sidebarDepth.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,cAAc,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AACtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,8BAA8B,CAAC;AAEhE;;;;;;;;GAQG;AAEH,SAAS,SAAS,CAAC,IAAoE;IACnF,OAAO;QACH,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,IAAI,CAAC,KAAK,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,EAAE;QAC9F,GAAG,CAAC,IAAI,CAAC,gBAAgB,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACxF,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,IAKhB;IACG,OAAO;QACH,SAAS,EAAE,IAAI,CAAC,WAAW;QAC3B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,MAAM,EAAE,IAAI;QACZ,SAAS,EAAE,IAAI,CAAC,SAAS;QACzB,MAAM,EAAE,KAAK;QACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;QACvB,OAAO,EAAE,IAAI;QACb,OAAO,EAA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CAAC,KAAK,KAAK,OAAO,CAAC,CAAC;QACxD,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAC5B,MAAM,CAAC,KAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=ledger-root-builder.skipSlugSiblingSection.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ledger-root-builder.skipSlugSiblingSection.test.d.ts","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.ts"],"names":[],"mappings":""}
@@ -1,256 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import * as FernNavigation from "../index.js";
3
- import { buildFullRootFromSegments } from "../ledger-root-builder.js";
4
- /**
5
- * Tests for the case where a section with skipUrlSlug (section="") sits inside
6
- * a sidebarGroup alongside sibling sections. The `childIndex` metadata field
7
- * (set by `walkNavSubTrees` on the write side) distinguishes these from true
8
- * root-section wrappers (direct sidebarRoot children with no childIndex).
9
- *
10
- * Without the fix, the builder treats ANY section="" segment as a root wrapper,
11
- * incorrectly nesting all depth-0 siblings under it and producing spurious
12
- * breadcrumb entries (e.g. "Introduction > Echo" instead of just "Echo").
13
- *
14
- * Real-world repro: mangopay-ledger-test, where the "Introduction" section
15
- * has skipUrlSlug (slug == tab slug) and shares a sidebarGroup with ~10 peer
16
- * sections (Users, Echo, SCA, Payouts, …).
17
- */
18
- function detail(opts) {
19
- return {
20
- id: opts.id,
21
- displayName: opts.name,
22
- icon: null,
23
- sortOrder: 0,
24
- hidden: false,
25
- viewers: [],
26
- orphaned: false,
27
- featureFlags: [],
28
- metadata: { slug: opts.slug, default: false, pointsTo: opts.pointsTo }
29
- };
30
- }
31
- function seg(opts) {
32
- return {
33
- segmentId: opts.segmentHash,
34
- segmentHash: opts.segmentHash,
35
- section: opts.section,
36
- locale: "en",
37
- sortOrder: opts.sortOrder ?? 0,
38
- hidden: false,
39
- metadata: {
40
- type: opts.type,
41
- ...(opts.title != null ? { title: opts.title } : {}),
42
- ...(opts.childIndex != null ? { childIndex: opts.childIndex } : {})
43
- },
44
- product: null,
45
- version: null,
46
- variant: null,
47
- tab: opts.tab ?? null
48
- };
49
- }
50
- function markdownRoute(fullPath, title, pageId) {
51
- return { type: "markdown", fullPath, hidden: false, metadata: { title, pageId } };
52
- }
53
- function buildRoot(opts) {
54
- return buildFullRootFromSegments({
55
- basePath: opts.basePath,
56
- title: "Test",
57
- segments: opts.segments,
58
- navBySegment: opts.navBySegment
59
- });
60
- }
61
- function findSectionNodes(root) {
62
- const sections = [];
63
- FernNavigation.traverseDF(root, (node) => {
64
- if (node.type === "section") {
65
- sections.push(node);
66
- }
67
- });
68
- return sections;
69
- }
70
- function findSidebarRootChildren(root) {
71
- let sidebarChildren = [];
72
- FernNavigation.traverseDF(root, (node) => {
73
- if (node.type === "sidebarRoot" && sidebarChildren.length === 0) {
74
- sidebarChildren = [...node.children];
75
- }
76
- });
77
- return sidebarChildren;
78
- }
79
- describe("buildFullRootFromSegments — skipUrlSlug sibling sections are NOT adopted as root-section children", () => {
80
- // Reproduces the mangopay-ledger-test bug: "Introduction" (section="",
81
- // childIndex=0) shares a sidebarGroup with "Echo" and "Users".
82
- // Without the fix, "Echo" and "Users" are incorrectly nested inside
83
- // "Introduction", adding a spurious "Introduction" breadcrumb to every
84
- // page under Echo and Users.
85
- const tab = detail({
86
- id: "t-guides",
87
- name: "Guides",
88
- slug: "guides",
89
- pointsTo: "guides/e-wallet-system"
90
- });
91
- const tabRoot = seg({
92
- segmentHash: "s-tabroot",
93
- section: "",
94
- type: "tabRoot",
95
- tab
96
- });
97
- // "Introduction" section with skipUrlSlug — its slug matches the tab slug,
98
- // so the write side assigns section="" with childIndex=0 (from walkNavSubTrees).
99
- const introSection = seg({
100
- segmentHash: "s-intro",
101
- section: "",
102
- type: "section",
103
- title: "Introduction",
104
- sortOrder: 1,
105
- childIndex: 0,
106
- tab
107
- });
108
- // Sibling sections — these should NOT be nested inside Introduction.
109
- const echoSection = seg({
110
- segmentHash: "s-echo",
111
- section: "echo",
112
- type: "section",
113
- title: "Echo",
114
- sortOrder: 2,
115
- childIndex: 1,
116
- tab
117
- });
118
- const usersSection = seg({
119
- segmentHash: "s-users",
120
- section: "users",
121
- type: "section",
122
- title: "Users",
123
- sortOrder: 3,
124
- childIndex: 2,
125
- tab
126
- });
127
- const segments = [tabRoot, introSection, echoSection, usersSection];
128
- const navBySegment = new Map([
129
- ["s-tabroot", []],
130
- ["s-intro", [markdownRoute("guides/e-wallet-system", "E-wallet system", "pg-ewallet")]],
131
- [
132
- "s-echo",
133
- [
134
- markdownRoute("guides/echo", "Mangopay Echo", "pg-echo"),
135
- markdownRoute("guides/echo/reconciliation", "Reconciliation", "pg-recon")
136
- ]
137
- ],
138
- ["s-users", [markdownRoute("guides/users/types", "Types", "pg-user-types")]]
139
- ]);
140
- it("sections with childIndex remain siblings, not nested under section='' segment", () => {
141
- const root = buildRoot({ basePath: "", segments, navBySegment });
142
- const sections = findSectionNodes(root);
143
- const introSec = sections.find((s) => s.title === "Introduction");
144
- const echoSec = sections.find((s) => s.title === "Echo");
145
- const usersSec = sections.find((s) => s.title === "Users");
146
- expect(introSec).toBeDefined();
147
- expect(echoSec).toBeDefined();
148
- expect(usersSec).toBeDefined();
149
- // Echo and Users must NOT be children of Introduction.
150
- const introChildren = (introSec?.children ?? [])
151
- .filter((c) => c.type === "section")
152
- .map((c) => c.title);
153
- expect(introChildren).not.toContain("Echo");
154
- expect(introChildren).not.toContain("Users");
155
- // All three should be at the sidebar root level (possibly inside sidebarGroups).
156
- const sidebarChildren = findSidebarRootChildren(root);
157
- const topLevelTitles = [];
158
- for (const child of sidebarChildren) {
159
- if (child.type === "section") {
160
- topLevelTitles.push(child.title);
161
- }
162
- else if (child.type === "sidebarGroup") {
163
- for (const gc of child.children) {
164
- if (gc.type === "section") {
165
- topLevelTitles.push(gc.title);
166
- }
167
- }
168
- }
169
- }
170
- expect(topLevelTitles).toContain("Introduction");
171
- expect(topLevelTitles).toContain("Echo");
172
- expect(topLevelTitles).toContain("Users");
173
- });
174
- it("breadcrumb for a page inside Echo does NOT include Introduction", () => {
175
- const root = buildRoot({ basePath: "", segments, navBySegment });
176
- FernNavigation.utils.mutableUpdatePointsTo(root);
177
- const found = FernNavigation.utils.findNode(root, FernNavigation.Slug("guides/echo"));
178
- expect(found.type).toBe("found");
179
- if (found.type !== "found") {
180
- return;
181
- }
182
- const breadcrumbTitles = found.breadcrumb.map((b) => b.title);
183
- expect(breadcrumbTitles).toContain("Echo");
184
- expect(breadcrumbTitles).not.toContain("Introduction");
185
- });
186
- it("breadcrumb for a page inside Users does NOT include Introduction", () => {
187
- const root = buildRoot({ basePath: "", segments, navBySegment });
188
- FernNavigation.utils.mutableUpdatePointsTo(root);
189
- const found = FernNavigation.utils.findNode(root, FernNavigation.Slug("guides/users/types"));
190
- expect(found.type).toBe("found");
191
- if (found.type !== "found") {
192
- return;
193
- }
194
- const breadcrumbTitles = found.breadcrumb.map((b) => b.title);
195
- expect(breadcrumbTitles).toContain("Users");
196
- expect(breadcrumbTitles).not.toContain("Introduction");
197
- });
198
- });
199
- describe("buildFullRootFromSegments — true root-section wrappers (no childIndex) still work", () => {
200
- // Regression guard: when a section has section="" WITHOUT childIndex,
201
- // it IS a true root wrapper and should adopt depth-0 children.
202
- const tab = detail({
203
- id: "t-docs",
204
- name: "Docs",
205
- slug: "docs",
206
- pointsTo: "docs/overview/intro"
207
- });
208
- it("adopts depth-0 children when childIndex is absent", () => {
209
- const root = buildRoot({
210
- basePath: "",
211
- segments: [
212
- // True root section wrapper (no childIndex)
213
- seg({
214
- segmentHash: "s-root",
215
- section: "",
216
- type: "section",
217
- title: "Overview",
218
- tab
219
- }),
220
- seg({
221
- segmentHash: "s-gs",
222
- section: "get-started",
223
- type: "section",
224
- title: "Get Started",
225
- sortOrder: 1,
226
- tab
227
- }),
228
- seg({
229
- segmentHash: "s-adv",
230
- section: "advanced",
231
- type: "section",
232
- title: "Advanced",
233
- sortOrder: 2,
234
- tab
235
- })
236
- ],
237
- navBySegment: new Map([
238
- ["s-root", [markdownRoute("docs/overview/intro", "Intro", "pg-intro")]],
239
- ["s-gs", [markdownRoute("docs/overview/get-started/setup", "Setup", "pg-setup")]],
240
- ["s-adv", [markdownRoute("docs/overview/advanced/tips", "Tips", "pg-tips")]]
241
- ])
242
- });
243
- const sections = findSectionNodes(root);
244
- const overviewSec = sections.find((s) => s.title === "Overview");
245
- expect(overviewSec).toBeDefined();
246
- // Child sections should be nested under Overview (root wrapper behavior)
247
- const childTitles = (overviewSec?.children ?? [])
248
- .filter((c) => c.type === "section")
249
- .map((c) => c.title);
250
- expect(childTitles).toContain("Get Started");
251
- expect(childTitles).toContain("Advanced");
252
- // 3 total sections (Overview + Get Started + Advanced), not duplicated
253
- expect(sections.length).toBe(3);
254
- });
255
- });
256
- //# sourceMappingURL=ledger-root-builder.skipSlugSiblingSection.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ledger-root-builder.skipSlugSiblingSection.test.js","sourceRoot":"","sources":["../../../src/navigation/__test__/ledger-root-builder.skipSlugSiblingSection.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAE9C,OAAO,KAAK,cAAc,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,yBAAyB,EAAE,MAAM,2BAA2B,CAAC;AAEtE;;;;;;;;;;;;;GAaG;AAEH,SAAS,MAAM,CAAC,IAAmE;IAC/E,OAAO;QACH,EAAE,EAAE,IAAI,CAAC,EAAE;QACX,WAAW,EAAE,IAAI,CAAC,IAAI;QACtB,IAAI,EAAE,IAAI;QACV,SAAS,EAAE,CAAC;QACZ,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,EAAE;QACX,QAAQ,EAAE,KAAK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,IAAI,EAAE,CAAC;aAC5C,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,SAAS,CAAC;aACnC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAE,CAAgC,CAAC,KAAK,CAAC,CAAC;QACzD,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC;QAC7C,MAAM,CAAC,WAAW,CAAC,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC;QAE1C,uEAAuE;QACvE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACpC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=syntheticSectionPath.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syntheticSectionPath.test.d.ts","sourceRoot":"","sources":["../../../../src/navigation/utils/__test__/syntheticSectionPath.test.ts"],"names":[],"mappings":""}
@@ -1,29 +0,0 @@
1
- import { describe, expect, it } from "vitest";
2
- import { stripSyntheticSegments } from "../syntheticSectionPath";
3
- describe("stripSyntheticSegments", () => {
4
- it("strips a single synthetic segment", () => {
5
- expect(stripSyntheticSegments("api-reference/~0")).toBe("api-reference");
6
- });
7
- it("strips multiple synthetic segments", () => {
8
- expect(stripSyntheticSegments("a/~0/b/~1/c")).toBe("a/b/c");
9
- });
10
- it("returns empty string for an entirely synthetic path", () => {
11
- expect(stripSyntheticSegments("~0/~1")).toBe("");
12
- });
13
- it("preserves non-numeric tilde slugs", () => {
14
- expect(stripSyntheticSegments("a/~beta/c")).toBe("a/~beta/c");
15
- });
16
- it("preserves a path with no synthetic segments", () => {
17
- expect(stripSyntheticSegments("api-reference/direct-card-payins")).toBe("api-reference/direct-card-payins");
18
- });
19
- it("handles empty string", () => {
20
- expect(stripSyntheticSegments("")).toBe("");
21
- });
22
- it("handles large childIndex values", () => {
23
- expect(stripSyntheticSegments("parent/~999/child")).toBe("parent/child");
24
- });
25
- it("preserves tilde in the middle of a segment", () => {
26
- expect(stripSyntheticSegments("a/foo~bar/c")).toBe("a/foo~bar/c");
27
- });
28
- });
29
- //# sourceMappingURL=syntheticSectionPath.test.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syntheticSectionPath.test.js","sourceRoot":"","sources":["../../../../src/navigation/utils/__test__/syntheticSectionPath.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAEjE,QAAQ,CAAC,wBAAwB,EAAE,GAAG,EAAE;IACpC,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,sBAAsB,CAAC,kBAAkB,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAC1C,MAAM,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAChE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,qDAAqD,EAAE,GAAG,EAAE;QAC3D,MAAM,CAAC,sBAAsB,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mCAAmC,EAAE,GAAG,EAAE;QACzC,MAAM,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,GAAG,EAAE;QACnD,MAAM,CAAC,sBAAsB,CAAC,kCAAkC,CAAC,CAAC,CAAC,IAAI,CAAC,kCAAkC,CAAC,CAAC;IAChH,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC5B,MAAM,CAAC,sBAAsB,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,iCAAiC,EAAE,GAAG,EAAE;QACvC,MAAM,CAAC,sBAAsB,CAAC,mBAAmB,CAAC,CAAC,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;IAC7E,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4CAA4C,EAAE,GAAG,EAAE;QAClD,MAAM,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
@@ -1,13 +0,0 @@
1
- /**
2
- * Synthetic section-path segments disambiguate skipUrlSlug nodes in the
3
- * flat ledger segment model. When a node shares its parent's slug
4
- * (skipUrlSlug), the publish transform assigns a section path like
5
- * `parent/~3` instead of `parent`. The read side (ledger-root-builder)
6
- * strips these synthetic components when computing URL slugs so they
7
- * never appear in rendered navigation.
8
- */
9
- /** Prefix for synthetic section-path segments. */
10
- export declare const SKIP_URL_SLUG_PREFIX = "~";
11
- /** Strip synthetic `~<n>` path components used for skipUrlSlug disambiguation. */
12
- export declare function stripSyntheticSegments(section: string): string;
13
- //# sourceMappingURL=syntheticSectionPath.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"syntheticSectionPath.d.ts","sourceRoot":"","sources":["../../../src/navigation/utils/syntheticSectionPath.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,kDAAkD;AAClD,eAAO,MAAM,oBAAoB,MAAM,CAAC;AAKxC,kFAAkF;AAClF,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAK9D"}
@@ -1,20 +0,0 @@
1
- /**
2
- * Synthetic section-path segments disambiguate skipUrlSlug nodes in the
3
- * flat ledger segment model. When a node shares its parent's slug
4
- * (skipUrlSlug), the publish transform assigns a section path like
5
- * `parent/~3` instead of `parent`. The read side (ledger-root-builder)
6
- * strips these synthetic components when computing URL slugs so they
7
- * never appear in rendered navigation.
8
- */
9
- /** Prefix for synthetic section-path segments. */
10
- export const SKIP_URL_SLUG_PREFIX = "~";
11
- /** Pattern matching a synthetic segment: the prefix followed by one or more digits. */
12
- const SYNTHETIC_SEGMENT_RE = /^~\d+$/;
13
- /** Strip synthetic `~<n>` path components used for skipUrlSlug disambiguation. */
14
- export function stripSyntheticSegments(section) {
15
- return section
16
- .split("/")
17
- .filter((part) => !SYNTHETIC_SEGMENT_RE.test(part))
18
- .join("/");
19
- }
20
- //# sourceMappingURL=syntheticSectionPath.js.map