@salesforcedevs/dw-components 1.20.16 → 1.24.0
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/dw-components",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.24.0",
|
|
4
4
|
"description": "Lightning web components for https://developer.salesforce.com",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"engines": {
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"node": "20.19.0",
|
|
31
31
|
"yarn": "1.22.19"
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "e05270a253164e2f1ce49808e4a4f962037890af"
|
|
34
34
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { api, LightningElement } from "lwc";
|
|
2
|
-
import { toJson } from "dxUtils/normalizers";
|
|
2
|
+
import { normalizeBoolean, toJson } from "dxUtils/normalizers";
|
|
3
3
|
import { DocsTile, DropdownItem, Language } from "typings/custom";
|
|
4
4
|
import qs from "query-string";
|
|
5
5
|
import uniqBy from "lodash.uniqby";
|
|
@@ -57,10 +57,17 @@ export default class DocsGrid extends LightningElement {
|
|
|
57
57
|
private _couchDbDocTileExclusions?: Set<any>;
|
|
58
58
|
private _allLanguages: Array<Language> = [];
|
|
59
59
|
private filteredItemsSelected: boolean = false;
|
|
60
|
+
private _isFetchingOtherDocs: boolean = false;
|
|
61
|
+
private _ssgEnabled: boolean = false;
|
|
60
62
|
|
|
61
63
|
connectedCallback(): void {
|
|
62
64
|
this.retrieveDscApis(true);
|
|
63
65
|
|
|
66
|
+
// If SSG_ENABLED is true, fetch from /sitemetadata
|
|
67
|
+
if (this.ssgEnabled) {
|
|
68
|
+
this.fetchOtherDocsFromSitemetadata();
|
|
69
|
+
}
|
|
70
|
+
|
|
64
71
|
this.matchDesktop = window.matchMedia("(min-width: 1024px)");
|
|
65
72
|
this.matchDesktop.addEventListener("change", this.handleDesktopView);
|
|
66
73
|
|
|
@@ -98,6 +105,17 @@ export default class DocsGrid extends LightningElement {
|
|
|
98
105
|
|
|
99
106
|
@api apiDomain = "https://developer.salesforce.com";
|
|
100
107
|
|
|
108
|
+
@api
|
|
109
|
+
get ssgEnabled(): boolean {
|
|
110
|
+
return this._ssgEnabled;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
set ssgEnabled(value) {
|
|
114
|
+
if (value) {
|
|
115
|
+
this._ssgEnabled = normalizeBoolean(value);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
101
119
|
@api
|
|
102
120
|
get externalMicrosites() {
|
|
103
121
|
return this._externalMicrosites || [];
|
|
@@ -122,14 +140,18 @@ export default class DocsGrid extends LightningElement {
|
|
|
122
140
|
}
|
|
123
141
|
|
|
124
142
|
set otherDocs(value: any) {
|
|
143
|
+
this._otherDocs = this.transformOtherDocs(value);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
private transformOtherDocs(value: any): any[] {
|
|
125
147
|
const allDocs = toJson(value);
|
|
126
|
-
|
|
148
|
+
const transformed: any[] = [];
|
|
127
149
|
|
|
128
150
|
for (const docs of allDocs) {
|
|
129
151
|
for (const project of docs.projects) {
|
|
130
152
|
const firstLink = project.contentTypes[0].href;
|
|
131
153
|
|
|
132
|
-
|
|
154
|
+
transformed.push({
|
|
133
155
|
id: project.id,
|
|
134
156
|
title: project.title,
|
|
135
157
|
description: project.description,
|
|
@@ -140,6 +162,34 @@ export default class DocsGrid extends LightningElement {
|
|
|
140
162
|
});
|
|
141
163
|
}
|
|
142
164
|
}
|
|
165
|
+
|
|
166
|
+
return transformed;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
async fetchOtherDocsFromSitemetadata(): Promise<void> {
|
|
170
|
+
if (this._isFetchingOtherDocs) {
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
this._isFetchingOtherDocs = true;
|
|
175
|
+
try {
|
|
176
|
+
const response = await fetch("/sitemetadata");
|
|
177
|
+
|
|
178
|
+
if (response.ok) {
|
|
179
|
+
const data = await response.json();
|
|
180
|
+
this._otherDocs = this.transformOtherDocs(data);
|
|
181
|
+
} else {
|
|
182
|
+
console.error(
|
|
183
|
+
`Failed to fetch sitemetadata: ${response.status}`
|
|
184
|
+
);
|
|
185
|
+
this._otherDocs = [];
|
|
186
|
+
}
|
|
187
|
+
} catch (error) {
|
|
188
|
+
console.error("Error fetching sitemetadata:", error);
|
|
189
|
+
this._otherDocs = [];
|
|
190
|
+
} finally {
|
|
191
|
+
this._isFetchingOtherDocs = false;
|
|
192
|
+
}
|
|
143
193
|
}
|
|
144
194
|
|
|
145
195
|
@api
|