@salesforcedevs/docs-components 1.20.13-redocly → 1.20.13-redocly1

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.20.13-redocly",
3
+ "version": "1.20.13-redocly1",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -2,7 +2,7 @@
2
2
  <slot></slot>
3
3
  <dx-error-fallback
4
4
  if:true={showError}
5
- title="API Documentation Unavailable"
6
- description="This API reference is currently unavailable. Please try again later."
5
+ title={title}
6
+ description={description}
7
7
  ></dx-error-fallback>
8
8
  </template>
@@ -21,6 +21,8 @@ type ReferenceConfig = {
21
21
  refList: ReferenceItem[];
22
22
  };
23
23
 
24
+ declare const Sprig: (eventType: string, eventNme: string) => void;
25
+
24
26
  export default class RedocReference extends LightningElement {
25
27
  private _referenceConfig: ReferenceConfig = { refList: [] };
26
28
  private _parentDocPhaseInfo: string | null = null;
@@ -31,6 +33,9 @@ export default class RedocReference extends LightningElement {
31
33
  private redocInitialized = false;
32
34
 
33
35
  showError = false;
36
+ title: string = "API Documentation Unavailable";
37
+ description: string =
38
+ "This API reference is currently unavailable. Please try again later.";
34
39
 
35
40
  @api
36
41
  get referenceConfig(): ReferenceConfig {
@@ -42,7 +47,14 @@ export default class RedocReference extends LightningElement {
42
47
  const refConfig =
43
48
  typeof value === "string" ? JSON.parse(value) : value;
44
49
  this._referenceConfig = refConfig;
45
- } catch (e) {
50
+ } catch (error) {
51
+ this.title = "Failed to parse reference configuration data";
52
+ this.description =
53
+ "An error occurred while reading/parsing the reference configuration. Please check the config file for syntax errors or invalid references and try again.";
54
+ console.error(
55
+ "Failed to parse reference configuration data",
56
+ error
57
+ );
46
58
  this._referenceConfig = { refList: [] };
47
59
  }
48
60
  }
@@ -187,11 +199,17 @@ export default class RedocReference extends LightningElement {
187
199
  );
188
200
  } else {
189
201
  this.showError = true;
202
+ console.error(
203
+ "Failed to initialize Redoc, required params missing."
204
+ );
190
205
  }
191
206
  }
192
207
  } catch (error) {
208
+ this.title = "Failed to load API specification";
209
+ this.description =
210
+ "An error occurred while trying to initialize Redoc. This may be due to a missing or invalid source in the configuration file, or a network connectivity issue. Please verify the source path and your internet connection and try again.";
211
+ console.error("Failed to load API specification", error);
193
212
  this.showError = true;
194
- console.error("Failed to load data:", error);
195
213
  }
196
214
  }
197
215
 
@@ -209,9 +227,14 @@ export default class RedocReference extends LightningElement {
209
227
  docPhaseInfo
210
228
  );
211
229
  }
212
- this.insertSprigSurvey(apiContentDiv as HTMLElement);
230
+
231
+ if (typeof Sprig !== "undefined") {
232
+ this.insertSprigSurvey(apiContentDiv as HTMLElement);
233
+ }
234
+
213
235
  this.insertFooter(apiContentDiv as HTMLElement);
214
236
  } catch (error) {
237
+ this.showError = true;
215
238
  console.error(
216
239
  "Error showing banner and footer elements",
217
240
  error
@@ -247,10 +270,11 @@ export default class RedocReference extends LightningElement {
247
270
  is: SprigSurvey
248
271
  });
249
272
 
250
- const wrapper = document.createElement("div");
251
- wrapper.className = "feedback-wrapper";
252
- wrapper.appendChild(feedbackElement);
253
-
254
- container.appendChild(wrapper);
273
+ // targeting the last element of middle section of page
274
+ const targetElement =
275
+ container.lastElementChild?.firstElementChild?.firstElementChild;
276
+ if (targetElement) {
277
+ targetElement.appendChild(feedbackElement);
278
+ }
255
279
  }
256
280
  }