@salesforcedevs/docs-components 1.14.4 → 1.14.6-load

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.14.4",
3
+ "version": "1.14.6-load",
4
4
  "description": "Docs Lightning web components for DSC",
5
5
  "license": "MIT",
6
6
  "main": "index.js",
@@ -13,6 +13,7 @@
13
13
  "dependencies": {
14
14
  "@api-components/amf-helper-mixin": "4.5.29",
15
15
  "classnames": "2.5.1",
16
+ "dompurify": "3.2.4",
16
17
  "kagekiri": "1.4.2",
17
18
  "lodash.orderby": "4.6.0",
18
19
  "lodash.uniqby": "4.7.0",
@@ -24,5 +25,5 @@
24
25
  "@types/lodash.orderby": "4.6.9",
25
26
  "@types/lodash.uniqby": "4.7.9"
26
27
  },
27
- "gitHead": "012da86cd801d81111ea8a5822f075677e615d8f"
28
+ "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
28
29
  }
@@ -1,5 +1,11 @@
1
1
  <template>
2
2
  <div class="specification-properties">
3
+ <dx-spinner
4
+ size="large"
5
+ variant="brand"
6
+ if:true={isLoading}
7
+ ></dx-spinner>
8
+ <dx-error-fallback lwc:if={showError}></dx-error-fallback>
3
9
  <template lwc:if={hasAttributes}>
4
10
  <doc-heading
5
11
  header="Attributes"
@@ -10,6 +10,9 @@ export default class SpecificationContent extends LightningElement {
10
10
  @api model!: string;
11
11
  @api namespace!: string;
12
12
 
13
+ isLoading: boolean = true;
14
+ showError: boolean = false;
15
+
13
16
  private attributes: Specification[] = [];
14
17
  private methods: Method[] = [];
15
18
  private slots: Specification[] = [];
@@ -60,7 +63,10 @@ export default class SpecificationContent extends LightningElement {
60
63
  }
61
64
  } catch (error) {
62
65
  this.data = {};
66
+ this.showError = true;
63
67
  console.error("fetchComponentMetadata() failed:", error);
68
+ } finally {
69
+ this.isLoading = false;
64
70
  }
65
71
  }
66
72
 
@@ -18,6 +18,7 @@ import { LightningElementWithState } from "dxBaseElements/lightningElementWithSt
18
18
  import { logCoveoPageView, oldVersionDocInfo } from "docUtils/utils";
19
19
  import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
20
20
  import { track as trackGTM } from "dxUtils/analytics";
21
+ import DOMPurify from "dompurify";
21
22
 
22
23
  // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
23
24
  const handleContentError = (error: any): void => console.log(error);
@@ -425,9 +426,19 @@ export default class DocXmlContent extends LightningElementWithState<{
425
426
  .catch(handleContentError);
426
427
  }
427
428
 
429
+ private sanitizeUrlPart(part: string | undefined): string | undefined {
430
+ if (!part) {
431
+ return part;
432
+ }
433
+ return DOMPurify.sanitize(part);
434
+ }
435
+
428
436
  getReferenceFromUrl(): PageReference {
429
437
  const [page, docId, deliverable, contentDocumentId] =
430
- window.location.pathname.substr(1).split("/");
438
+ window.location.pathname
439
+ .substr(1)
440
+ .split("/")
441
+ .map(this.sanitizeUrlPart);
431
442
 
432
443
  const { origin: domain, hash, search } = window.location;
433
444
 
@@ -436,9 +447,9 @@ export default class DocXmlContent extends LightningElementWithState<{
436
447
  deliverable,
437
448
  docId,
438
449
  domain,
439
- hash,
450
+ hash: this.sanitizeUrlPart(hash),
440
451
  page,
441
- search
452
+ search: this.sanitizeUrlPart(search)
442
453
  };
443
454
  }
444
455
 
@@ -701,7 +712,7 @@ export default class DocXmlContent extends LightningElementWithState<{
701
712
 
702
713
  addMetatags(): void {
703
714
  const div = document.createElement("div");
704
- div.innerHTML = this.docContent;
715
+ div.innerHTML = DOMPurify.sanitize(this.docContent);
705
716
  const docDescription = div.querySelector(".shortdesc")?.textContent;
706
717
  const topicTitle = div.querySelector("h1")?.textContent;
707
718
 
package/LICENSE DELETED
@@ -1,12 +0,0 @@
1
- Copyright (c) 2020, Salesforce.com, Inc.
2
- All rights reserved.
3
-
4
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
5
-
6
- * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
7
-
8
- * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
9
-
10
- * Neither the name of Salesforce.com nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
11
-
12
- THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.