@coveo/quantic 3.44.3 → 3.45.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/docs/out/quantic-docs.json +58 -0
- package/force-app/main/default/labels/CustomLabels.labels-meta.xml +28 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.css +5 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.html +30 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.js +162 -0
- package/force-app/main/default/lwc/quanticLoadMoreResults/quanticLoadMoreResults.js-meta.xml +5 -0
- package/force-app/main/default/lwc/quanticResultLink/quanticResultLink.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +15 -15
- package/force-app/main/default/staticresources/coveoheadless/definitions/api/analytics/analytics-relay-client.d.ts +2 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/commerce/factories/build-factory.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr/common/access-token-manager.d.ts +7 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/build.d.ts +10 -0
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/commerce/types/engine.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/common/access-token-manager.d.ts +7 -1
- package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-next/search/types/engine.d.ts +1 -1
- package/force-app/main/default/staticresources/coveoheadless/headless.js +17 -17
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +16 -16
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +15 -15
- package/package.json +2 -2
|
@@ -1060,6 +1060,35 @@
|
|
|
1060
1060
|
}
|
|
1061
1061
|
]
|
|
1062
1062
|
},
|
|
1063
|
+
{
|
|
1064
|
+
"name": "QuanticLoadMoreResults",
|
|
1065
|
+
"attribute": "quantic-load-more-results",
|
|
1066
|
+
"description": "<p>The <code>QuanticLoadMoreResults</code> component allows the user to load additional results if more are available.</p>\n<p>This component is an alternative to the <code>quantic-pager</code> component: use one or the other, not both on the same page.</p>",
|
|
1067
|
+
"categories": [
|
|
1068
|
+
"Search",
|
|
1069
|
+
"Insight Panel"
|
|
1070
|
+
],
|
|
1071
|
+
"fires": "",
|
|
1072
|
+
"examples": [
|
|
1073
|
+
"<c-quantic-load-more-results engine-id={engineId}></c-quantic-load-more-results>"
|
|
1074
|
+
],
|
|
1075
|
+
"xmlMeta": {
|
|
1076
|
+
"apiVersion": "64.0",
|
|
1077
|
+
"isExposed": "false",
|
|
1078
|
+
"targets": []
|
|
1079
|
+
},
|
|
1080
|
+
"properties": [
|
|
1081
|
+
{
|
|
1082
|
+
"name": "engineId",
|
|
1083
|
+
"attribute": "engine-id",
|
|
1084
|
+
"access": "@api",
|
|
1085
|
+
"description": "<p>The ID of the engine instance the component registers to.</p>",
|
|
1086
|
+
"required": true,
|
|
1087
|
+
"defaultValue": "",
|
|
1088
|
+
"type": "string"
|
|
1089
|
+
}
|
|
1090
|
+
]
|
|
1091
|
+
},
|
|
1063
1092
|
{
|
|
1064
1093
|
"name": "QuanticModal",
|
|
1065
1094
|
"attribute": "quantic-modal",
|
|
@@ -4984,6 +5013,35 @@
|
|
|
4984
5013
|
}
|
|
4985
5014
|
]
|
|
4986
5015
|
},
|
|
5016
|
+
{
|
|
5017
|
+
"name": "QuanticLoadMoreResults",
|
|
5018
|
+
"attribute": "quantic-load-more-results",
|
|
5019
|
+
"description": "<p>The <code>QuanticLoadMoreResults</code> component allows the user to load additional results if more are available.</p>\n<p>This component is an alternative to the <code>quantic-pager</code> component: use one or the other, not both on the same page.</p>",
|
|
5020
|
+
"categories": [
|
|
5021
|
+
"Search",
|
|
5022
|
+
"Insight Panel"
|
|
5023
|
+
],
|
|
5024
|
+
"fires": "",
|
|
5025
|
+
"examples": [
|
|
5026
|
+
"<c-quantic-load-more-results engine-id={engineId}></c-quantic-load-more-results>"
|
|
5027
|
+
],
|
|
5028
|
+
"xmlMeta": {
|
|
5029
|
+
"apiVersion": "64.0",
|
|
5030
|
+
"isExposed": "false",
|
|
5031
|
+
"targets": []
|
|
5032
|
+
},
|
|
5033
|
+
"properties": [
|
|
5034
|
+
{
|
|
5035
|
+
"name": "engineId",
|
|
5036
|
+
"attribute": "engine-id",
|
|
5037
|
+
"access": "@api",
|
|
5038
|
+
"description": "<p>The ID of the engine instance the component registers to.</p>",
|
|
5039
|
+
"required": true,
|
|
5040
|
+
"defaultValue": "",
|
|
5041
|
+
"type": "string"
|
|
5042
|
+
}
|
|
5043
|
+
]
|
|
5044
|
+
},
|
|
4987
5045
|
{
|
|
4988
5046
|
"name": "QuanticModal",
|
|
4989
5047
|
"attribute": "quantic-modal",
|
|
@@ -1750,4 +1750,32 @@
|
|
|
1750
1750
|
<protected>false</protected>
|
|
1751
1751
|
<shortDescription>Dislike</shortDescription>
|
|
1752
1752
|
</labels>
|
|
1753
|
+
<labels>
|
|
1754
|
+
<fullName>quantic_LoadMoreResults</fullName>
|
|
1755
|
+
<value>Load more results</value>
|
|
1756
|
+
<language>en_US</language>
|
|
1757
|
+
<protected>false</protected>
|
|
1758
|
+
<shortDescription>Load more results</shortDescription>
|
|
1759
|
+
</labels>
|
|
1760
|
+
<labels>
|
|
1761
|
+
<fullName>quantic_ShowingResultsOfLoadMore</fullName>
|
|
1762
|
+
<value>Showing {{0}} of {{1}} result</value>
|
|
1763
|
+
<language>en_US</language>
|
|
1764
|
+
<protected>false</protected>
|
|
1765
|
+
<shortDescription>ex: Showing 10 of 123 result</shortDescription>
|
|
1766
|
+
</labels>
|
|
1767
|
+
<labels>
|
|
1768
|
+
<fullName>quantic_ShowingResultsOfLoadMore_plural</fullName>
|
|
1769
|
+
<value>Showing {{0}} of {{1}} results</value>
|
|
1770
|
+
<language>en_US</language>
|
|
1771
|
+
<protected>false</protected>
|
|
1772
|
+
<shortDescription>ex: Showing 10 of 123 results</shortDescription>
|
|
1773
|
+
</labels>
|
|
1774
|
+
<labels>
|
|
1775
|
+
<fullName>quantic_AllResultsLoaded</fullName>
|
|
1776
|
+
<value>All results have been loaded.</value>
|
|
1777
|
+
<language>en_US</language>
|
|
1778
|
+
<protected>false</protected>
|
|
1779
|
+
<shortDescription>All results have been loaded.</shortDescription>
|
|
1780
|
+
</labels>
|
|
1753
1781
|
</CustomLabels>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<template lwc:if={hasInitializationError}>
|
|
3
|
+
<c-quantic-component-error component-name={template.host.localName}>
|
|
4
|
+
</c-quantic-component-error>
|
|
5
|
+
</template>
|
|
6
|
+
<template lwc:elseif={hasResults}>
|
|
7
|
+
<div class="slds-text-align_center">
|
|
8
|
+
<p class="slds-text-color_weak slds-m-bottom_x-small" data-testid="summary">
|
|
9
|
+
{summaryLabel}
|
|
10
|
+
</p>
|
|
11
|
+
<div class="load-more-results__progress-bar slds-var-m-bottom_small">
|
|
12
|
+
<lightning-progress-bar
|
|
13
|
+
value={progressPercentage}
|
|
14
|
+
size="x-small"
|
|
15
|
+
variant="circular"
|
|
16
|
+
data-testid="progress-bar"
|
|
17
|
+
></lightning-progress-bar>
|
|
18
|
+
</div>
|
|
19
|
+
<template lwc:if={moreResultsAvailable}>
|
|
20
|
+
<lightning-button
|
|
21
|
+
variant="neutral"
|
|
22
|
+
label={labels.loadMoreResults}
|
|
23
|
+
title={labels.loadMoreResults}
|
|
24
|
+
onclick={fetchMoreResults}
|
|
25
|
+
data-testid="load-more-results-button"
|
|
26
|
+
></lightning-button>
|
|
27
|
+
</template>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
</template>
|
|
@@ -0,0 +1,162 @@
|
|
|
1
|
+
import LOCALE from '@salesforce/i18n/locale';
|
|
2
|
+
import allResultsLoaded from '@salesforce/label/c.quantic_AllResultsLoaded';
|
|
3
|
+
import loadMoreResults from '@salesforce/label/c.quantic_LoadMoreResults';
|
|
4
|
+
import showingResultsOfLoadMore from '@salesforce/label/c.quantic_ShowingResultsOfLoadMore';
|
|
5
|
+
import showingResultsOfLoadMore_plural from '@salesforce/label/c.quantic_ShowingResultsOfLoadMore_plural';
|
|
6
|
+
import {
|
|
7
|
+
registerComponentForInit,
|
|
8
|
+
initializeWithHeadless,
|
|
9
|
+
getHeadlessBundle,
|
|
10
|
+
} from 'c/quanticHeadlessLoader';
|
|
11
|
+
import {AriaLiveRegion, I18nUtils} from 'c/quanticUtils';
|
|
12
|
+
import {LightningElement, api, track} from 'lwc';
|
|
13
|
+
|
|
14
|
+
/** @typedef {import("coveo").SearchEngine} SearchEngine */
|
|
15
|
+
/** @typedef {import("coveo").ResultList} ResultList */
|
|
16
|
+
/** @typedef {import("coveo").ResultListState} ResultListState */
|
|
17
|
+
/** @typedef {import("coveo").QuerySummary} QuerySummary */
|
|
18
|
+
/** @typedef {import("coveo").QuerySummaryState} QuerySummaryState */
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* The `QuanticLoadMoreResults` component allows the user to load additional results if more are available.
|
|
22
|
+
*
|
|
23
|
+
* This component is an alternative to the `quantic-pager` component: use one or the other, not both on the same page.
|
|
24
|
+
* @category Search
|
|
25
|
+
* @category Insight Panel
|
|
26
|
+
* @example
|
|
27
|
+
* <c-quantic-load-more-results engine-id={engineId}></c-quantic-load-more-results>
|
|
28
|
+
*/
|
|
29
|
+
export default class QuanticLoadMoreResults extends LightningElement {
|
|
30
|
+
/**
|
|
31
|
+
* The ID of the engine instance the component registers to.
|
|
32
|
+
* @api
|
|
33
|
+
* @type {string}
|
|
34
|
+
*/
|
|
35
|
+
@api engineId;
|
|
36
|
+
|
|
37
|
+
/** @type {ResultListState} */
|
|
38
|
+
@track resultListState;
|
|
39
|
+
/** @type {QuerySummaryState} */
|
|
40
|
+
@track querySummaryState;
|
|
41
|
+
|
|
42
|
+
/** @type {ResultList} */
|
|
43
|
+
resultList;
|
|
44
|
+
/** @type {QuerySummary} */
|
|
45
|
+
querySummary;
|
|
46
|
+
/** @type {Function} */
|
|
47
|
+
unsubscribeResultList;
|
|
48
|
+
/** @type {Function} */
|
|
49
|
+
unsubscribeQuerySummary;
|
|
50
|
+
/** @type {ResultListState} */
|
|
51
|
+
previousResultListState;
|
|
52
|
+
/** @type {AnyHeadless} */
|
|
53
|
+
headless;
|
|
54
|
+
/** @type {import('c/quanticUtils').AriaLiveUtils} */
|
|
55
|
+
allResultsLoadedAriaMessage;
|
|
56
|
+
/** @type {boolean} */
|
|
57
|
+
hasInitializationError = false;
|
|
58
|
+
|
|
59
|
+
labels = {
|
|
60
|
+
allResultsLoaded,
|
|
61
|
+
loadMoreResults,
|
|
62
|
+
showingResultsOfLoadMore,
|
|
63
|
+
showingResultsOfLoadMore_plural,
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
connectedCallback() {
|
|
67
|
+
registerComponentForInit(this, this.engineId);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
renderedCallback() {
|
|
71
|
+
initializeWithHeadless(this, this.engineId, this.initialize);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* @param {SearchEngine} engine
|
|
76
|
+
*/
|
|
77
|
+
initialize = (engine) => {
|
|
78
|
+
this.headless = getHeadlessBundle(this.engineId);
|
|
79
|
+
this.resultList = this.headless.buildResultList(engine);
|
|
80
|
+
this.querySummary = this.headless.buildQuerySummary(engine);
|
|
81
|
+
this.allResultsLoadedAriaMessage = AriaLiveRegion('loadMoreResults', this);
|
|
82
|
+
this.unsubscribeResultList = this.resultList.subscribe(() =>
|
|
83
|
+
this.updateResultListState()
|
|
84
|
+
);
|
|
85
|
+
this.unsubscribeQuerySummary = this.querySummary.subscribe(() =>
|
|
86
|
+
this.updateQuerySummaryState()
|
|
87
|
+
);
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
disconnectedCallback() {
|
|
91
|
+
this.unsubscribeResultList?.();
|
|
92
|
+
this.unsubscribeQuerySummary?.();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
updateResultListState() {
|
|
96
|
+
this.previousResultListState = this.resultListState;
|
|
97
|
+
this.resultListState = this.resultList.state;
|
|
98
|
+
this.announceWhenAllResultsAreLoaded();
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
updateQuerySummaryState() {
|
|
102
|
+
this.querySummaryState = this.querySummary.state;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
announceWhenAllResultsAreLoaded() {
|
|
106
|
+
const isLastBatchLoaded =
|
|
107
|
+
this.previousResultListState?.moreResultsAvailable === true &&
|
|
108
|
+
this.resultListState?.moreResultsAvailable === false &&
|
|
109
|
+
this.previousResultListState?.searchResponseId ===
|
|
110
|
+
this.resultListState?.searchResponseId;
|
|
111
|
+
|
|
112
|
+
if (isLastBatchLoaded) {
|
|
113
|
+
this.allResultsLoadedAriaMessage.dispatchMessage(
|
|
114
|
+
this.labels.allResultsLoaded
|
|
115
|
+
);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
fetchMoreResults() {
|
|
120
|
+
this.resultList.fetchMoreResults();
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
get hasResults() {
|
|
124
|
+
return !!this.resultListState?.hasResults;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
get moreResultsAvailable() {
|
|
128
|
+
return !!this.resultListState?.moreResultsAvailable;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
get summaryLabel() {
|
|
132
|
+
const labelName = I18nUtils.getLabelNameWithCount(
|
|
133
|
+
'showingResultsOfLoadMore',
|
|
134
|
+
this.querySummaryState?.lastResult
|
|
135
|
+
);
|
|
136
|
+
return I18nUtils.format(
|
|
137
|
+
this.labels[labelName],
|
|
138
|
+
Intl.NumberFormat(LOCALE)
|
|
139
|
+
.format(this.querySummaryState?.lastResult)
|
|
140
|
+
.toString(),
|
|
141
|
+
Intl.NumberFormat(LOCALE).format(this.querySummaryState?.total).toString()
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* @returns {number}
|
|
147
|
+
*/
|
|
148
|
+
get progressPercentage() {
|
|
149
|
+
const total = this.querySummaryState?.total;
|
|
150
|
+
if (!total) {
|
|
151
|
+
return 0;
|
|
152
|
+
}
|
|
153
|
+
return Math.min(100, (this.querySummaryState?.lastResult / total) * 100);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
/**
|
|
157
|
+
* Sets the component in the initialization error state.
|
|
158
|
+
*/
|
|
159
|
+
setInitializationError() {
|
|
160
|
+
this.hasInitializationError = true;
|
|
161
|
+
}
|
|
162
|
+
}
|
|
@@ -9,9 +9,9 @@ import {NavigationMixin} from 'lightning/navigation';
|
|
|
9
9
|
import {LightningElement, api} from 'lwc';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
|
-
* Some document types cannot be opened directly in Salesforce,
|
|
12
|
+
* Some document types cannot be opened directly in Salesforce, so we navigate to their parent record (e.g., CaseComment and FeedComment).
|
|
13
13
|
*/
|
|
14
|
-
const documentTypesRequiringParentRecord = ['CaseComment'];
|
|
14
|
+
const documentTypesRequiringParentRecord = ['CaseComment', 'FeedComment'];
|
|
15
15
|
|
|
16
16
|
/** @typedef {import("coveo").Result} Result */
|
|
17
17
|
/** @typedef {import("coveo").SearchEngine} SearchEngine */
|