@salesforcedevs/docs-components 1.11.2 → 1.13.1
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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@salesforcedevs/docs-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "Docs Lightning web components for DSC",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "index.js",
|
|
@@ -24,5 +24,5 @@
|
|
|
24
24
|
"@types/lodash.orderby": "4.6.9",
|
|
25
25
|
"@types/lodash.uniqby": "4.7.9"
|
|
26
26
|
},
|
|
27
|
-
"gitHead": "
|
|
27
|
+
"gitHead": "5972a7da41fde5c28244cbf604064eb390291e09"
|
|
28
28
|
}
|
|
@@ -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
|
-
|
|
8
|
-
@api component
|
|
9
|
-
@api model
|
|
10
|
-
@api namespace
|
|
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
|
|
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,16 +47,20 @@ export default class SpecificationContent extends LightningElement {
|
|
|
44
47
|
}
|
|
45
48
|
|
|
46
49
|
const result = await response.json();
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
|
|
51
|
+
// Due to middleware the data is sent as part of response now.
|
|
52
|
+
this.data = result?.response;
|
|
53
|
+
if (this.data) {
|
|
54
|
+
({
|
|
55
|
+
attributes: this.attributes,
|
|
56
|
+
methods: this.methods,
|
|
57
|
+
slots: this.slots,
|
|
58
|
+
events: this.events
|
|
59
|
+
} = this.data);
|
|
60
|
+
}
|
|
54
61
|
} catch (error) {
|
|
55
62
|
this.data = {};
|
|
56
|
-
console.error("fetchComponentMetadata() failed
|
|
63
|
+
console.error("fetchComponentMetadata() failed:", error);
|
|
57
64
|
}
|
|
58
65
|
}
|
|
59
66
|
|