@salesforcedevs/docs-components 1.3.150-lwf-ref-alpha4 → 1.3.151

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/LICENSE ADDED
@@ -0,0 +1,12 @@
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.
package/lwc.config.json CHANGED
@@ -11,14 +11,12 @@
11
11
  "doc/contentCallout",
12
12
  "doc/contentLayout",
13
13
  "doc/contentMedia",
14
- "doc/component",
15
14
  "doc/docXmlContent",
16
15
  "doc/header",
17
16
  "doc/heading",
18
17
  "doc/headingAnchor",
19
18
  "doc/overview",
20
19
  "doc/phase",
21
- "doc/styledOrderedList",
22
20
  "doc/xmlContent"
23
21
  ]
24
22
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/docs-components",
3
- "version": "1.3.150-lwf-ref-alpha4",
3
+ "version": "1.3.151",
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.7",
25
25
  "@types/lodash.uniqby": "^4.7.7"
26
26
  },
27
- "gitHead": "4629fdd9ca18a13480044ad43515b91945d16aad"
27
+ "gitHead": "a18da1e5151467020122ee365fef9f8f189768dd"
28
28
  }
@@ -4,6 +4,7 @@ import { sentenceCase } from "sentence-case";
4
4
  import qs from "query-string";
5
5
  import { AmfModelParser } from "./utils";
6
6
  import { normalizeBoolean } from "dxUtils/normalizers";
7
+ import { CoveoAnalyticsClient } from "coveo.analytics";
7
8
  import type {
8
9
  AmfConfig,
9
10
  AmfMetadataTopic,
@@ -34,6 +35,7 @@ export default class AmfReference extends LightningElement {
34
35
  @api sidebarHeader!: string;
35
36
  @api coveoOrganizationId!: string;
36
37
  @api coveoPublicAccessToken!: string;
38
+ @api coveoAnalyticsToken!: string;
37
39
  @api coveoAdvancedQueryConfig!: string;
38
40
  @api coveoSearchHub!: string;
39
41
  @api useOldSidebar?: boolean = false;
@@ -215,6 +217,19 @@ export default class AmfReference extends LightningElement {
215
217
  }
216
218
  }
217
219
 
220
+ private logCoveoPageView() {
221
+ if (this.coveoOrganizationId && this.coveoAnalyticsToken) {
222
+ const ua = new CoveoAnalyticsClient({
223
+ token: this.coveoAnalyticsToken,
224
+ endpoint: `https://${this.coveoOrganizationId}.analytics.org.coveo.com`
225
+ });
226
+ ua.sendViewEvent({
227
+ contentIdKey: "@clickableuri",
228
+ contentIdValue: window.location.href
229
+ });
230
+ }
231
+ }
232
+
218
233
  /**
219
234
  * Check if the URL hash to see whether this is one we want to redirect
220
235
  * See GUS W-10718771 for references where we want hash-based redirects
@@ -907,6 +922,8 @@ export default class AmfReference extends LightningElement {
907
922
  this.handleSelectedItem();
908
923
 
909
924
  this.updateDocPhase();
925
+
926
+ this.logCoveoPageView();
910
927
  }
911
928
 
912
929
  /**
@@ -1168,6 +1185,8 @@ export default class AmfReference extends LightningElement {
1168
1185
  if (referenceItem) {
1169
1186
  window.location.href = referenceItem.href;
1170
1187
  }
1188
+
1189
+ this.logCoveoPageView();
1171
1190
  }
1172
1191
 
1173
1192
  /**
@@ -1260,6 +1279,8 @@ export default class AmfReference extends LightningElement {
1260
1279
  }
1261
1280
  this.updateDocPhase();
1262
1281
  this.selectedSidebarValue = window.location.pathname;
1282
+
1283
+ this.logCoveoPageView();
1263
1284
  }
1264
1285
  }
1265
1286
 
@@ -17,6 +17,7 @@ import { LightningElementWithState } from "docBaseElements/lightningElementWithS
17
17
  import { oldVersionDocInfo } from "docUtils/utils";
18
18
  import { Breadcrumb, DocPhaseInfo, Language } from "typings/custom";
19
19
  import { track as trackGTM } from "dxUtils/analytics";
20
+ import { CoveoAnalyticsClient } from "coveo.analytics";
20
21
 
21
22
  // TODO: Imitating from actual implementation as doc-content use it like this. We should refactor it later.
22
23
  const handleContentError = (error): void => console.log(error);
@@ -34,6 +35,7 @@ export default class DocXmlContent extends LightningElementWithState<{
34
35
  @api apiDomain = "https://developer.salesforce.com";
35
36
  @api coveoOrganizationId!: string;
36
37
  @api coveoPublicAccessToken!: string;
38
+ @api coveoAnalyticsToken!: string;
37
39
  @api coveoSearchHub!: string;
38
40
 
39
41
  @api
@@ -434,6 +436,19 @@ export default class DocXmlContent extends LightningElementWithState<{
434
436
  );
435
437
  }
436
438
 
439
+ async logCoveoPageView() {
440
+ if (this.coveoOrganizationId && this.coveoAnalyticsToken) {
441
+ const ua = new CoveoAnalyticsClient({
442
+ token: this.coveoAnalyticsToken,
443
+ endpoint: `https://${this.coveoOrganizationId}.analytics.org.coveo.com`
444
+ }); // MILES TODO: replace 'fullsalesforce' with coveo organizationid
445
+ ua.sendViewEvent({
446
+ contentIdKey: "@clickableuri",
447
+ contentIdValue: window.location.href
448
+ });
449
+ }
450
+ }
451
+
437
452
  async fetchDocument(): Promise<void> {
438
453
  this.setState({
439
454
  isFetchingDocument: true
@@ -498,6 +513,7 @@ export default class DocXmlContent extends LightningElementWithState<{
498
513
  }
499
514
 
500
515
  async fetchContent(): Promise<void> {
516
+ this.logCoveoPageView();
501
517
  this.setState({
502
518
  isFetchingContent: true
503
519
  });
@@ -1,32 +0,0 @@
1
- @import "dxHelpers/reset";
2
-
3
- h2 {
4
- font-weight: bold;
5
- font-size: 24px;
6
- margin-top: 10px;
7
- margin-bottom: 10px;
8
- }
9
-
10
- .component-image {
11
- padding: 48px 40px;
12
- display: flex;
13
- justify-content: center;
14
- align-items: center;
15
- border: 1px solid var(--foundation-gray-neutral-95, #f3f3f3);
16
- min-height: 140px;
17
- max-height: 480px;
18
- flex: 1;
19
- margin-top: 16px;
20
- margin-bottom: 16px;
21
- }
22
-
23
- .small {
24
- font-size: 12px;
25
- }
26
-
27
- .item {
28
- display: flex;
29
- flex: 1;
30
- flex-direction: column;
31
- justify-content: center;
32
- }
@@ -1,11 +0,0 @@
1
- <template>
2
- <div class="item">
3
- <h2 if:true={title}>{title}</h2>
4
- <p if:true={description}>{description}</p>
5
- <p if:true={doDontLabel}>{doDontLabel}</p>
6
- <div if:true={imageSrc} class="component-image">
7
- <img src={imageSrc} />
8
- </div>
9
- <p if:true={note} class="small">{note}</p>
10
- </div>
11
- </template>
@@ -1,22 +0,0 @@
1
- import { LightningElement, api } from "lwc";
2
-
3
- class Component extends LightningElement {
4
- @api title;
5
- @api description;
6
- @api imageSrc;
7
- @api isDo;
8
- @api note;
9
-
10
- @api
11
- get doDontLabel(): string {
12
- //TODO: store a boolean value and refactor logic
13
- if (this.isDo === "true") {
14
- return "DO";
15
- } else if (this.isDo === "false") {
16
- return "DON'T";
17
- }
18
- return "";
19
- }
20
- }
21
-
22
- export default Component;
@@ -1,35 +0,0 @@
1
- @import "dxHelpers/reset";
2
-
3
- .list {
4
- display: flex;
5
- flex: 1;
6
- flex-direction: column;
7
- justify-content: center;
8
- }
9
-
10
-
11
- .list-item{
12
- display: flex;
13
- flex-direction: row;
14
- justify-content: center;
15
- margin-bottom: 2px;
16
- }
17
-
18
- .circle{
19
- background: var(--foundation-blue-blue-40, #0B5CAB);
20
- height: 24px;
21
- width: 24px;
22
- border-radius: 50%;
23
- justify-content: center;
24
- align-items: center;
25
- display: flex;
26
- color: white;
27
- font-size: 10px;
28
- }
29
-
30
- .list-item-content {
31
- color: var(--text-default, #181818);
32
- font-family: Open Sans;
33
- font-size: 16px;
34
- margin-left: 16px;
35
- }
@@ -1,10 +0,0 @@
1
- <template>
2
- <div class="list">
3
- <template for:each={list} for:item="item" for:index="index">
4
- <div class="list-item" key={item}>
5
- <div class="circle">{index}</div>
6
- <p class="list-item-content">{item}</p>
7
- </div>
8
- </template>
9
- </div>
10
- </template>
@@ -1,18 +0,0 @@
1
- import { LightningElement, api } from "lwc";
2
-
3
- class StyledOrderedList extends LightningElement {
4
- private _list: Array<string> = [];
5
-
6
- set list(value: string) {
7
- if (value) {
8
- this._list = JSON.parse(value)
9
- }
10
- }
11
-
12
- @api
13
- get list(): Array<string> {
14
- return this._list
15
- }
16
- }
17
-
18
- export default StyledOrderedList;