@salesforcedevs/dx-components 1.3.244-alpha → 1.3.244-alpha2
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
|
@@ -6,7 +6,6 @@ export default class CoveoRecommendations extends LightningElement {
|
|
|
6
6
|
@api coveoOrganizationId!: string;
|
|
7
7
|
|
|
8
8
|
_recommendations = [] as any[];
|
|
9
|
-
_searchTime = 0;
|
|
10
9
|
|
|
11
10
|
private get recommendations(): any[] {
|
|
12
11
|
return this._recommendations || [];
|
|
@@ -36,10 +35,15 @@ export default class CoveoRecommendations extends LightningElement {
|
|
|
36
35
|
})
|
|
37
36
|
}).then(
|
|
38
37
|
async (response) => {
|
|
39
|
-
this._searchTime = performance.now() - searchStart;
|
|
40
|
-
this.logSearchAnalytics();
|
|
41
38
|
try {
|
|
42
|
-
const
|
|
39
|
+
const json = await response.json();
|
|
40
|
+
const results = json.results;
|
|
41
|
+
|
|
42
|
+
this.logSearchAnalytics(
|
|
43
|
+
json.searchUid,
|
|
44
|
+
performance.now() - searchStart
|
|
45
|
+
);
|
|
46
|
+
|
|
43
47
|
const blogDataLoadTasks = results
|
|
44
48
|
.slice(0, 3)
|
|
45
49
|
.map(async (rec: any) => {
|
|
@@ -65,18 +69,24 @@ export default class CoveoRecommendations extends LightningElement {
|
|
|
65
69
|
);
|
|
66
70
|
}
|
|
67
71
|
|
|
68
|
-
logSearchAnalytics = () => {
|
|
72
|
+
logSearchAnalytics = (uid: string, time: number) => {
|
|
69
73
|
const payload = {
|
|
70
74
|
anonymous: true,
|
|
71
75
|
language: "en",
|
|
72
76
|
originLevel1: SEARCH_HUB,
|
|
73
77
|
originLevel2: SEARCH_HUB,
|
|
74
78
|
actionCause: "recommendationInterfaceLoad",
|
|
75
|
-
|
|
79
|
+
queryText: "",
|
|
80
|
+
responseTime: time,
|
|
81
|
+
searchQueryUid: uid
|
|
76
82
|
};
|
|
77
83
|
fetch(
|
|
78
84
|
`https://${this.coveoOrganizationId}.analytics.org.coveo.com/rest/ua/v15/analytics/search`,
|
|
79
85
|
{
|
|
86
|
+
headers: {
|
|
87
|
+
Authorization: `Bearer ${this.coveoAuthToken}`,
|
|
88
|
+
"Content-Type": "application/json"
|
|
89
|
+
},
|
|
80
90
|
method: "POST",
|
|
81
91
|
body: JSON.stringify(payload)
|
|
82
92
|
}
|