@salesforcedevs/docs-components 1.17.6-redoc1 → 1.17.6-redoc3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lwc.config.json CHANGED
@@ -14,13 +14,13 @@
14
14
  "doc/contentLayout",
15
15
  "doc/contentMedia",
16
16
  "doc/docXmlContent",
17
+ "doc/flexReference",
17
18
  "doc/lwcContentLayout",
18
19
  "doc/header",
19
20
  "doc/heading",
20
21
  "doc/headingAnchor",
21
22
  "doc/overview",
22
23
  "doc/phase",
23
- "doc/docReference",
24
24
  "doc/specificationContent",
25
25
  "doc/versionPicker",
26
26
  "doc/xmlContent",
package/package.json CHANGED
@@ -1,12 +1,16 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.17.6-redoc1",
3
+ "version": "1.17.6-redoc3",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "engines": {
8
8
  "node": "20.x"
9
9
  },
10
+ "volta": {
11
+ "node": "20.18.2",
12
+ "yarn": "1.22.19"
13
+ },
10
14
  "publishConfig": {
11
15
  "access": "public"
12
16
  },
@@ -0,0 +1,20 @@
1
+ export const REFERENCE_TYPES = {
2
+ markdown: "markdown",
3
+ raml: "rest-raml",
4
+ oa2: "rest-oa2",
5
+ oa3: "rest-oa3"
6
+ };
7
+
8
+ const oldReferenceIdNewReferenceIdMap: Record<string, string> = {
9
+ "commerce-api-assignments": "assignments",
10
+ "commerce-api-campaigns": "campaigns",
11
+ "commerce-api-catalogs": "catalogs",
12
+ "cdn-zones": "cdn-api-process-apis",
13
+ "inventory-impex": "impex",
14
+ "inventory-reservations": "inventory-reservation-service",
15
+ "shopper-login-and-api-access-service": "shopper-login",
16
+ "shopper-login-and-api-access-service-admin": "slas-admin",
17
+ "einstein-recommendations": "einstein-api-quick-start-guide"
18
+ };
19
+
20
+ export { oldReferenceIdNewReferenceIdMap };
@@ -6,12 +6,12 @@ import type {
6
6
  ReferenceVersion,
7
7
  ReferenceSetConfig,
8
8
  ParsedMarkdownTopic
9
- } from "../amfReference/types";
9
+ } from "./types";
10
10
 
11
11
  import {
12
12
  REFERENCE_TYPES,
13
13
  oldReferenceIdNewReferenceIdMap
14
- } from "../amfReference/constants";
14
+ } from "./constants";
15
15
  import { restoreScroll } from "dx/scrollManager";
16
16
  import { DocPhaseInfo } from "typings/custom";
17
17
  import { logCoveoPageView, oldVersionDocInfo } from "docUtils/utils";
@@ -26,7 +26,7 @@ type NavigationItem = {
26
26
  isChildrenLoading: boolean;
27
27
  };
28
28
 
29
- export default class DocReference extends LightningElement {
29
+ export default class FlexReference extends LightningElement {
30
30
  @api breadcrumbs: string | null = null;
31
31
  @api sidebarHeader!: string;
32
32
  @api coveoOrganizationId!: string;
@@ -355,11 +355,11 @@ export default class DocReference extends LightningElement {
355
355
  * Fetch spec and generate Redoc structure
356
356
  */
357
357
  private async fetchSpec(amfConfig: AmfConfig): Promise<RedocSidebarData | null> {
358
- const { amf } = amfConfig;
358
+ const { source } = amfConfig;
359
359
  try {
360
- // Load Redoc sidebar structure
361
- if (window.Redoc?.getSpecStructure && amf) {
362
- return await window.Redoc.getSpecStructure(amf);
360
+ // Load Redoc sidebar structure using the source spec URL
361
+ if (window.Redoc?.getSpecStructure && source) {
362
+ return await window.Redoc.getSpecStructure(source);
363
363
  }
364
364
  return null;
365
365
  } catch (error) {
@@ -554,9 +554,9 @@ export default class DocReference extends LightningElement {
554
554
  redocContainer.firstChild.remove();
555
555
  }
556
556
 
557
- // Initialize Redoc
558
- if (window.Redoc && amfConfig.amf) {
559
- await window.Redoc.init(amfConfig.amf, {
557
+ // Initialize Redoc using the source spec URL
558
+ if (window.Redoc && amfConfig.source) {
559
+ await window.Redoc.init(amfConfig.source, {
560
560
  expandResponses: '200,400',
561
561
  scrollYOffset: 73,
562
562
  sidebar: false
@@ -0,0 +1,81 @@
1
+ import { DocPhaseInfo } from "typings/custom";
2
+
3
+ // Redoc type declarations for window object
4
+ export interface RedocNavigationItem {
5
+ label: string;
6
+ name: string; // Hash-based URL (#section-id)
7
+ id: string; // Section ID for scroll targeting
8
+ children?: RedocNavigationItem[];
9
+ }
10
+
11
+ export interface RedocSidebarData {
12
+ spec: {
13
+ title: string;
14
+ version: string;
15
+ };
16
+ items: RedocNavigationItem[];
17
+ }
18
+
19
+ // Core types needed for reference handling
20
+ export type ReferenceType = "markdown" | "rest-raml" | "rest-oa2" | "rest-oa3";
21
+
22
+ /**
23
+ * Represents parsed topic for the sidebar.
24
+ */
25
+ export interface ParsedMarkdownTopic {
26
+ label: string;
27
+ name: string;
28
+ children: ParsedMarkdownTopic[];
29
+ link?: {
30
+ href: string;
31
+ target?: string;
32
+ };
33
+ isExpanded?: boolean;
34
+ }
35
+
36
+ export interface AmfConfig {
37
+ id: string;
38
+ version?: string;
39
+ docPhase?: DocPhaseInfo;
40
+ title: string;
41
+ href: string;
42
+ referenceType: ReferenceType;
43
+
44
+ // determines if a reference config is the current active and selected one.
45
+ isSelected: boolean;
46
+
47
+ // required for spec based references
48
+ amf?: string; // compiled JSON for amfTopic (legacy)
49
+ source?: string; // spec URL
50
+
51
+ // required for markdown based references
52
+ topic?: ParsedMarkdownTopic;
53
+ }
54
+
55
+ export interface ReferenceVersion {
56
+ id: string;
57
+ label: string;
58
+ deprecated?: boolean;
59
+ selected?: boolean;
60
+ link: {
61
+ href: string;
62
+ };
63
+ }
64
+
65
+ export interface ReferenceSetConfig {
66
+ refId?: string;
67
+ versionToRefMap?: Map<string, Array<AmfConfig>>;
68
+ refList: Array<AmfConfig>;
69
+ versions: Array<ReferenceVersion>;
70
+ }
71
+
72
+ declare global {
73
+ interface Window {
74
+ Redoc?: {
75
+ init: (specUrl: string, options: any, container: Element) => Promise<void>;
76
+ getSpecStructure?: (specUrl: string) => Promise<RedocSidebarData>;
77
+ };
78
+ }
79
+ }
80
+
81
+ export {};
@@ -1,24 +0,0 @@
1
- // Redoc type declarations for window object
2
- export interface RedocNavigationItem {
3
- label: string;
4
- name: string; // Hash-based URL (#section-id)
5
- id: string; // Section ID for scroll targeting
6
- children?: RedocNavigationItem[];
7
- }
8
-
9
- export interface RedocSidebarData {
10
- spec: {
11
- title: string;
12
- version: string;
13
- };
14
- items: RedocNavigationItem[];
15
- }
16
-
17
- declare global {
18
- interface Window {
19
- Redoc?: {
20
- init: (specUrl: string, options: any, container: Element) => Promise<void>;
21
- getSpecStructure?: (specUrl: string) => Promise<RedocSidebarData>;
22
- };
23
- }
24
- }