@coveo/quantic 3.17.1-pre.e71f7b47c3 → 3.18.0-pre.0fddcd3383

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.
Files changed (46) hide show
  1. package/docs/out/quantic-docs.json +28 -0
  2. package/force-app/main/default/labels/CustomLabels.labels-meta.xml +7 -0
  3. package/force-app/main/default/lwc/jsconfig.json +3 -0
  4. package/force-app/main/default/lwc/quanticInsightInterface/quanticInsightInterface.js +30 -10
  5. package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.css +5 -0
  6. package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.html +18 -0
  7. package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.js +95 -0
  8. package/force-app/main/default/lwc/quanticInsightSummary/quanticInsightSummary.js-meta.xml +5 -0
  9. package/force-app/main/default/lwc/quanticNumericFacet/quanticNumericFacet.html +4 -1
  10. package/force-app/main/default/lwc/quanticNumericFacet/quanticNumericFacet.js +15 -23
  11. package/force-app/main/default/lwc/quanticResultAction/quanticResultAction.html +1 -1
  12. package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
  13. package/force-app/main/default/staticresources/coveoheadless/definitions/app/commerce-ssr-engine/types/core-engine.d.ts +1 -1
  14. package/force-app/main/default/staticresources/coveoheadless/definitions/app/engine.d.ts +1 -1
  15. package/force-app/main/default/staticresources/coveoheadless/definitions/app/ssr-engine/types/core-engine.d.ts +1 -1
  16. package/force-app/main/default/staticresources/coveoheadless/definitions/app/store.d.ts +1 -1
  17. package/force-app/main/default/staticresources/coveoheadless/definitions/app/thunk-extra-arguments.d.ts +1 -1
  18. package/force-app/main/default/staticresources/coveoheadless/definitions/case-assist.index.d.ts +1 -1
  19. package/force-app/main/default/staticresources/coveoheadless/definitions/commerce.index.d.ts +1 -1
  20. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/common/base-commerce-api-request-builder.d.ts +1 -1
  21. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/common/filterable-commerce-api-request-builder.d.ts +1 -1
  22. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/common/paginated-commerce-api-request-builder.d.ts +1 -1
  23. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/category/commerce-category-facet-search-request-builder.d.ts +1 -1
  24. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/facets/facet-search-set/regular/commerce-regular-facet-search-request-builder.d.ts +1 -1
  25. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/query-suggest/query-suggest-request-builder.d.ts +1 -1
  26. package/force-app/main/default/staticresources/coveoheadless/definitions/features/commerce/standalone-search-box-set/plan-request-builder.d.ts +1 -1
  27. package/force-app/main/default/staticresources/coveoheadless/definitions/features/configuration/analytics-params.d.ts +1 -1
  28. package/force-app/main/default/staticresources/coveoheadless/definitions/features/document-suggestion/document-suggestion-actions.d.ts +1 -1
  29. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/category/category-facet-search-request-builder.d.ts +1 -1
  30. package/force-app/main/default/staticresources/coveoheadless/definitions/features/facets/facet-search-set/specific/specific-facet-search-request-builder.d.ts +1 -1
  31. package/force-app/main/default/staticresources/coveoheadless/definitions/features/query-suggest/query-suggest-actions.d.ts +1 -1
  32. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-actions.d.ts +1 -1
  33. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search/search-request.d.ts +1 -1
  34. package/force-app/main/default/staticresources/coveoheadless/definitions/features/search-and-folding/search-and-folding-request.d.ts +1 -1
  35. package/force-app/main/default/staticresources/coveoheadless/definitions/features/standalone-search-box-set/standalone-search-box-set-actions.d.ts +1 -1
  36. package/force-app/main/default/staticresources/coveoheadless/definitions/index.d.ts +1 -1
  37. package/force-app/main/default/staticresources/coveoheadless/definitions/insight.index.d.ts +1 -1
  38. package/force-app/main/default/staticresources/coveoheadless/definitions/recommendation.index.d.ts +1 -1
  39. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr-commerce.index.d.ts +1 -1
  40. package/force-app/main/default/staticresources/coveoheadless/definitions/ssr.index.d.ts +2 -2
  41. package/force-app/main/default/staticresources/coveoheadless/definitions/test/mock-navigator-context-provider.d.ts +1 -1
  42. package/force-app/main/default/staticresources/coveoheadless/headless.js +2 -2
  43. package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +6 -6
  44. package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
  45. package/package.json +5 -5
  46. /package/force-app/main/default/staticresources/coveoheadless/definitions/app/{navigatorContextProvider.d.ts → navigator-context-provider.d.ts} +0 -0
@@ -4911,6 +4911,34 @@
4911
4911
  }
4912
4912
  ]
4913
4913
  },
4914
+ {
4915
+ "name": "QuanticInsightPanelSummary",
4916
+ "attribute": "quantic-insight-panel-summary",
4917
+ "description": "<p>The <code>QuanticInsightPanelSummary</code> component is a composite component that displays a title or a Quantic Query Summary depending whether a user query is performed.</p>",
4918
+ "categories": [
4919
+ "Insight Panel"
4920
+ ],
4921
+ "fires": "",
4922
+ "examples": [
4923
+ "<c-quantic-insight-query-summary engine-id={engineId}></c-quantic-insight-query-summary>"
4924
+ ],
4925
+ "xmlMeta": {
4926
+ "apiVersion": "60.0",
4927
+ "isExposed": "false",
4928
+ "targets": []
4929
+ },
4930
+ "properties": [
4931
+ {
4932
+ "name": "engineId",
4933
+ "attribute": "engine-id",
4934
+ "access": "@api",
4935
+ "description": "<p>The ID of the engine instance the component registers to.</p>",
4936
+ "required": true,
4937
+ "defaultValue": "",
4938
+ "type": "string"
4939
+ }
4940
+ ]
4941
+ },
4914
4942
  {
4915
4943
  "name": "QuanticModal",
4916
4944
  "attribute": "quantic-modal",
@@ -1610,4 +1610,11 @@
1610
1610
  <protected>false</protected>
1611
1611
  <shortDescription>Close notification</shortDescription>
1612
1612
  </labels>
1613
+ <labels>
1614
+ <fullName>quantic_InsightRelatedToThisCase</fullName>
1615
+ <value>Insights related to this case</value>
1616
+ <language>en_US</language>
1617
+ <protected>false</protected>
1618
+ <shortDescription>Insights related to this case</shortDescription>
1619
+ </labels>
1613
1620
  </CustomLabels>
@@ -38,6 +38,9 @@
38
38
  "c/quanticResultList": ["quanticResultList/quanticResultList.js"],
39
39
  "c/quanticResultLink": ["quanticResultLink/quanticResultLink.js"],
40
40
  "c/quanticSort": ["quanticSort/quanticSort.js"],
41
+ "c/quanticInsightInterface": [
42
+ "quanticInsightInterface/quanticInsightInterface.js"
43
+ ],
41
44
  "c/quanticSummary": ["quanticSummary/quanticSummary.js"],
42
45
  "c/quanticFacetValue": ["quanticFacetValue/quanticFacetValue.js"],
43
46
  "c/quanticNumericFacet": ["quanticNumericFacet/quanticNumericFacet.js"],
@@ -44,11 +44,14 @@ export default class QuanticInsightInterface extends LightningElement {
44
44
  hasRendered = false;
45
45
  /** @type {boolean} */
46
46
  ariaLiveEventsBound = false;
47
+ /** @type {function} */
48
+ unsubscribeInsightInterface;
47
49
 
48
50
  /** @type {string} */
49
51
  analyticsOriginContext = 'InsightPanel';
50
52
 
51
53
  disconnectedCallback() {
54
+ this.unsubscribeInsightInterface?.();
52
55
  destroyEngine(this.engineId);
53
56
  if (this.ariaLiveEventsBound) {
54
57
  this.removeEventListener(
@@ -133,19 +136,36 @@ export default class QuanticInsightInterface extends LightningElement {
133
136
  if (this.initialized) {
134
137
  return;
135
138
  }
136
- this.dispatchEvent(
137
- new CustomEvent(`quantic__insightinterfaceinitialized`, {
138
- detail: {
139
- engineId: this.engineId,
140
- insightId: this.insightId,
141
- },
142
- bubbles: true,
143
- composed: true,
144
- })
139
+ const engine = getHeadlessBindings(this.engineId).engine;
140
+ this.insightInterface = CoveoHeadlessInsight.buildInsightInterface(engine);
141
+ this.unsubscribeInsightInterface = this.insightInterface.subscribe(() =>
142
+ this.updateInsightInterfaceState()
145
143
  );
146
- this.initialized = true;
147
144
  };
148
145
 
146
+ updateInsightInterfaceState() {
147
+ if (this.initialized) {
148
+ return;
149
+ }
150
+ this.isInsightInterfaceReady =
151
+ !this.insightInterface.state.loading &&
152
+ !!this.insightInterface.state.config;
153
+
154
+ if (this.isInsightInterfaceReady) {
155
+ this.dispatchEvent(
156
+ new CustomEvent(`quantic__insightinterfaceinitialized`, {
157
+ detail: {
158
+ engineId: this.engineId,
159
+ insightId: this.insightId,
160
+ },
161
+ bubbles: true,
162
+ composed: true,
163
+ })
164
+ );
165
+ this.initialized = true;
166
+ }
167
+ }
168
+
149
169
  /**
150
170
  * @returns {HTMLInputElement}
151
171
  */
@@ -0,0 +1,5 @@
1
+ .initial-summary-message {
2
+ background-color: #d8e6fe;
3
+ color: #54698d;
4
+ width: 100%;
5
+ }
@@ -0,0 +1,18 @@
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:else>
7
+ <template if:false={hasError}>
8
+ <template if:false={showQuerySummary}>
9
+ <div data-testid="initial-summary-message" class="slds-text-title_bold initial-summary-message slds-var-p-vertical_small slds-var-p-horizontal_medium">{labels.insightRelatedToThisCase}</div>
10
+ </template>
11
+ <template if:true={showQuerySummary}>
12
+ <div class="slds-var-p-vertical_small slds-var-p-horizontal_medium">
13
+ <c-quantic-summary engine-id={engineId}></c-quantic-summary>
14
+ </div>
15
+ </template>
16
+ </template>
17
+ </template>
18
+ </template>
@@ -0,0 +1,95 @@
1
+ import {LightningElement, api} from 'lwc';
2
+ import {
3
+ registerComponentForInit,
4
+ initializeWithHeadless,
5
+ getHeadlessBundle,
6
+ } from 'c/quanticHeadlessLoader';
7
+ import insightRelatedToThisCase from '@salesforce/label/c.quantic_InsightRelatedToThisCase';
8
+
9
+ /** @typedef {import("coveo").InsightEngine} InsightEngine */
10
+ /** @typedef {import("coveo").SearchBox} SearchBox */
11
+ /** @typedef {import("coveo").QuerySummary} QuerySummary */
12
+
13
+ /**
14
+ * The `QuanticInsightPanelSummary` component is a composite component that displays a title or a Quantic Query Summary depending whether a user query is performed.
15
+ * @category Insight Panel
16
+ * @example
17
+ * <c-quantic-insight-query-summary engine-id={engineId}></c-quantic-insight-query-summary>
18
+ */
19
+ export default class QuanticInsightPanelSummary extends LightningElement {
20
+ /**
21
+ * The ID of the engine instance the component registers to.
22
+ * @api
23
+ * @type {string}
24
+ */
25
+ @api engineId;
26
+
27
+ labels = {
28
+ insightRelatedToThisCase,
29
+ };
30
+
31
+ /** @type {boolean} */
32
+ showQuerySummary = false;
33
+ /** @type {boolean} */
34
+ hasError = false;
35
+
36
+ /** @type {AnyHeadless} */
37
+ headless;
38
+ /** @type {SearchBox} */
39
+ searchBox;
40
+ /** @type {QuerySummary} */
41
+ querySummary;
42
+ /** @type {boolean} */
43
+ hasInitializationError;
44
+
45
+ connectedCallback() {
46
+ registerComponentForInit(this, this.engineId);
47
+ }
48
+
49
+ renderedCallback() {
50
+ initializeWithHeadless(this, this.engineId, this.initialize);
51
+ }
52
+
53
+ /**
54
+ * @param {InsightEngine} engine
55
+ */
56
+ initialize = (engine) => {
57
+ this.headless = getHeadlessBundle(this.engineId);
58
+ this.searchBox = this.headless.buildSearchBox(engine);
59
+ this.querySummary = this.headless.buildQuerySummary(engine);
60
+ this.unsubscribeSearchBox = this.searchBox.subscribe(() =>
61
+ this.updateSummaryVisibility()
62
+ );
63
+ this.unsubscribeQuerySummary = this.querySummary.subscribe(() =>
64
+ this.updateHasError()
65
+ );
66
+ };
67
+
68
+ disconnectedCallback() {
69
+ this.unsubscribeSearchBox?.();
70
+ this.unsubscribeQuerySummary?.();
71
+ }
72
+
73
+ /**
74
+ * Updates summary visibility.
75
+ * @returns {void}
76
+ */
77
+ updateSummaryVisibility() {
78
+ this.showQuerySummary = !!this.searchBox.state.value;
79
+ }
80
+
81
+ /**
82
+ * updates the error state of the component.
83
+ * @returns {void}
84
+ */
85
+ updateHasError() {
86
+ this.hasError = this.querySummary?.state?.hasError;
87
+ }
88
+
89
+ /**
90
+ * Sets the component in the initialization error state.
91
+ */
92
+ setInitializationError() {
93
+ this.hasInitializationError = true;
94
+ }
95
+ }
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
3
+ <apiVersion>60.0</apiVersion>
4
+ <isExposed>false</isExposed>
5
+ </LightningComponentBundle>
@@ -5,7 +5,7 @@
5
5
  </template>
6
6
  <template lwc:else>
7
7
  <template lwc:if={isFacetEnabled}>
8
- <div data-test="facet-content">
8
+ <div data-testid="facet-content">
9
9
  <template if:true={showPlaceholder}>
10
10
  <c-quantic-placeholder
11
11
  variant="card"
@@ -35,6 +35,7 @@
35
35
  </lightning-button-icon>
36
36
  <template if:true={hasActiveValues}>
37
37
  <button
38
+ data-testid="clear-selection-button"
38
39
  class="facet__clear-filter slds-button slds-grid slds-grid_vertical-align-center slds-var-p-horizontal_x-small slds-m-top_small"
39
40
  onclick={clearSelections}
40
41
  title={clearFilterLabel}
@@ -53,11 +54,13 @@
53
54
  </template>
54
55
  <template if:false={isCollapsed}>
55
56
  <div
57
+ data-testid="facet__body"
56
58
  class="slds-has-dividers_around-space slds-var-m-top_medium"
57
59
  >
58
60
  <template if:true={withInput}>
59
61
  <div class="slds-p-horizontal_x-small">
60
62
  <form
63
+ data-testid="facet__search-form"
61
64
  onsubmit={onApply}
62
65
  class="facet__search-form slds-grid slds-gutters slds-var-p-bottom_small"
63
66
  >
@@ -15,7 +15,6 @@ import numberInputMinimum from '@salesforce/label/c.quantic_NumberInputMinimum';
15
15
  import {
16
16
  registerComponentForInit,
17
17
  initializeWithHeadless,
18
- getHeadlessBindings,
19
18
  registerToStore,
20
19
  getHeadlessBundle,
21
20
  getBueno,
@@ -34,6 +33,7 @@ import {LightningElement, track, api} from 'lwc';
34
33
  /** @typedef {import("coveo").NumericFacetValue} NumericFacetValue */
35
34
  /** @typedef {import("coveo").SearchStatus} SearchStatus */
36
35
  /** @typedef {import("coveo").SearchEngine} SearchEngine */
36
+ /** @typedef {import("coveo").InsightEngine} InsightEngine */
37
37
  /** @typedef {import("coveo").FacetConditionsManager} FacetConditionsManager */
38
38
  /** @typedef {import('../quanticUtils/facetDependenciesUtils').DependsOn} DependsOn */
39
39
  /**
@@ -223,6 +223,8 @@ export default class QuanticNumericFacet extends LightningElement {
223
223
  numericFacetConditionsManager;
224
224
  /** @type {FacetConditionsManager} */
225
225
  numericFilterConditionsManager;
226
+ /** @type {SearchEngine | InsightEngine} */
227
+ engine;
226
228
 
227
229
  /** @type {string} */
228
230
  start;
@@ -262,9 +264,10 @@ export default class QuanticNumericFacet extends LightningElement {
262
264
  }
263
265
 
264
266
  /**
265
- * @param {SearchEngine} engine
267
+ * @param {SearchEngine | InsightEngine} engine
266
268
  */
267
269
  initialize = (engine) => {
270
+ this.engine = engine;
268
271
  this.validateDependsOnProperty();
269
272
  this.headless = getHeadlessBundle(this.engineId);
270
273
  this.searchStatus = this.headless.buildSearchStatus(engine);
@@ -273,15 +276,11 @@ export default class QuanticNumericFacet extends LightningElement {
273
276
  );
274
277
 
275
278
  if (this.numberOfValues > 0) {
276
- this.initializeFacet(engine);
279
+ this.initializeFacet();
277
280
  }
278
281
  if (this.withInput) {
279
- this.initializeFilter(engine);
282
+ this.initializeFilter();
280
283
  }
281
- this.searchStatus = this.headless.buildSearchStatus(engine);
282
- this.unsubscribeSearchStatus = this.searchStatus.subscribe(() =>
283
- this.updateState()
284
- );
285
284
  registerToStore(this.engineId, Store.facetTypes.NUMERICFACETS, {
286
285
  label: this.label,
287
286
  facetId: this.facet?.state.facetId ?? this.field,
@@ -310,11 +309,8 @@ export default class QuanticNumericFacet extends LightningElement {
310
309
  }
311
310
  }
312
311
 
313
- /**
314
- * @param {import("coveo").SearchEngine} engine
315
- */
316
- initializeFacet(engine) {
317
- this.facet = this.headless.buildNumericFacet(engine, {
312
+ initializeFacet() {
313
+ this.facet = this.headless.buildNumericFacet(this.engine, {
318
314
  options: {
319
315
  field: this.field,
320
316
  generateAutomaticRanges: true,
@@ -327,17 +323,14 @@ export default class QuanticNumericFacet extends LightningElement {
327
323
  this.unsubscribe = this.facet.subscribe(() => this.updateState());
328
324
  if (this.dependsOn) {
329
325
  this.numericFacetConditionsManager = this.initFacetConditionManager(
330
- engine,
326
+ this.engine,
331
327
  this.facet.state?.facetId
332
328
  );
333
329
  }
334
330
  }
335
331
 
336
- /**
337
- * @param {import("coveo").SearchEngine} engine
338
- */
339
- initializeFilter(engine) {
340
- this.numericFilter = this.headless.buildNumericFilter(engine, {
332
+ initializeFilter() {
333
+ this.numericFilter = this.headless.buildNumericFilter(this.engine, {
341
334
  options: {
342
335
  field: this.field,
343
336
  facetId: this.facet?.state.facetId
@@ -350,7 +343,7 @@ export default class QuanticNumericFacet extends LightningElement {
350
343
  );
351
344
  if (this.dependsOn) {
352
345
  this.numericFilterConditionsManager = this.initFacetConditionManager(
353
- engine,
346
+ this.engine,
354
347
  this.numericFilter.state?.facetId
355
348
  );
356
349
  }
@@ -580,10 +573,9 @@ export default class QuanticNumericFacet extends LightningElement {
580
573
  }
581
574
 
582
575
  if (this.numberOfValues > 0) {
583
- const engine = getHeadlessBindings(this.engineId).engine;
584
- engine.dispatch(
576
+ this.engine.dispatch(
585
577
  this.headless
586
- .loadNumericFacetSetActions(engine)
578
+ .loadNumericFacetSetActions(this.engine)
587
579
  .deselectAllNumericFacetValues(this.facet.state.facetId)
588
580
  );
589
581
  }
@@ -11,7 +11,7 @@
11
11
  </button>
12
12
  </template>
13
13
  <template if:false={loading}>
14
- <lightning-button-icon-stateful onclick={handleClick} aria-label={displayedLabel} variant="border-filled"
14
+ <lightning-button-icon-stateful data-testid="result-action-button" onclick={handleClick} aria-label={displayedLabel} variant="border-filled"
15
15
  class={resultActionOrderClasses} icon-name={displayedIcon} selected={_selected}>
16
16
  </lightning-button-icon-stateful>
17
17
  </template>