@salesforcedevs/docs-components 1.3.403-node-20-alpha → 1.11.2-cx-router-alpha1

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/package.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.403-node-20-alpha",
3
+ "version": "1.11.2-cx-router-alpha1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
7
7
  "engines": {
8
- "node": "20.x"
8
+ "node": "18.x"
9
9
  },
10
10
  "publishConfig": {
11
11
  "access": "public"
12
12
  },
13
13
  "dependencies": {
14
- "@api-components/amf-helper-mixin": "4.5.24",
14
+ "@api-components/amf-helper-mixin": "4.5.29",
15
15
  "classnames": "2.5.1",
16
16
  "kagekiri": "1.4.2",
17
17
  "lodash.orderby": "4.6.0",
@@ -2,19 +2,13 @@ import { LightningElement, track, api } from "lwc";
2
2
  import { Method, Specification } from "typings/custom";
3
3
  import debounce from "debounce";
4
4
 
5
+ const CX_ROUTER_API: string = "/cx-router/components";
5
6
  export default class SpecificationContent extends LightningElement {
6
7
  @track data: any;
7
- // TODO: added these default values for testing, will drop this once the backend is ready.
8
- @api component: string = "button";
9
- @api model: string = "lwc";
10
- @api namespace: string = "lightning";
11
-
12
- /* TODO: The actual URL is as follows:
13
- * http://api.salesforce.com/doc-platform/developer/v1/{type}/{sub-type}/{component-name}
14
- * Until the API integration is ready, we will go ahead with mocked-router-url.
15
- */
16
- @api apiBaseUrl: string =
17
- "https://cx-mock-router-internal-07a18d7b3f61.herokuapp.com";
8
+
9
+ @api component!: string;
10
+ @api model!: string;
11
+ @api namespace!: string;
18
12
 
19
13
  private attributes: Specification[] = [];
20
14
  private methods: Method[] = [];
@@ -33,7 +27,16 @@ export default class SpecificationContent extends LightningElement {
33
27
  }
34
28
 
35
29
  async fetchComponentMetadata() {
36
- const url = `${this.apiBaseUrl}/${this.model}/${this.namespace}/${this.component}`;
30
+ const componentQueryParams = {
31
+ model: this.model,
32
+ namespace: this.namespace,
33
+ component: this.component
34
+ };
35
+
36
+ const queryString = new URLSearchParams(
37
+ componentQueryParams
38
+ ).toString();
39
+ const url = `${CX_ROUTER_API}?${queryString}`;
37
40
 
38
41
  try {
39
42
  const response = await fetch(url);
@@ -44,7 +47,9 @@ export default class SpecificationContent extends LightningElement {
44
47
  }
45
48
 
46
49
  const result = await response.json();
47
- this.data = result;
50
+
51
+ // Due to middleware the data is sent as part of response now.
52
+ this.data = result?.response;
48
53
  ({
49
54
  attributes: this.attributes,
50
55
  methods: this.methods,
@@ -53,7 +58,7 @@ export default class SpecificationContent extends LightningElement {
53
58
  } = this.data);
54
59
  } catch (error) {
55
60
  this.data = {};
56
- console.error("fetchComponentMetadata() failed for:" + url);
61
+ console.error("fetchComponentMetadata() failed for:", url);
57
62
  }
58
63
  }
59
64