@coveo/quantic 3.37.2 → 3.37.4
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/force-app/main/default/lwc/quanticResultHighlightedTextField/quanticResultHighlightedTextField.js +14 -5
- package/force-app/main/default/staticresources/coveoheadless/case-assist/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/headless.js +13 -13
- package/force-app/main/default/staticresources/coveoheadless/insight/headless.js +2 -2
- package/force-app/main/default/staticresources/coveoheadless/recommendation/headless.js +2 -2
- package/package.json +4 -7
|
@@ -93,12 +93,21 @@ export default class QuanticResultHighlightedTextField extends LightningElement
|
|
|
93
93
|
this.field
|
|
94
94
|
);
|
|
95
95
|
/** @type {HighlightKeyword[]} */
|
|
96
|
-
const
|
|
97
|
-
this.
|
|
98
|
-
|
|
99
|
-
|
|
96
|
+
const proxiedHighlights =
|
|
97
|
+
this.headless.ResultTemplatesHelpers.getResultProperty(
|
|
98
|
+
this.result,
|
|
99
|
+
`${this.field}Highlights`
|
|
100
|
+
);
|
|
100
101
|
|
|
101
|
-
if (
|
|
102
|
+
if (proxiedHighlights && this.headless?.HighlightUtils?.highlightString) {
|
|
103
|
+
// Shallow-copy each highlight keyword into a plain object to avoid the Salesforce Locker Service proxy handling.
|
|
104
|
+
// Without this, every .offset / .length access inside highlightString triggers the proxy which is expensive at scale.
|
|
105
|
+
const highlights = Array.isArray(proxiedHighlights)
|
|
106
|
+
? proxiedHighlights.map((h) => ({
|
|
107
|
+
offset: h.offset,
|
|
108
|
+
length: h.length,
|
|
109
|
+
}))
|
|
110
|
+
: proxiedHighlights;
|
|
102
111
|
const openingDelimiter = '<b class="highlighted-field__highlight">';
|
|
103
112
|
const closingDelimiter = '</b>';
|
|
104
113
|
const highlightedValue = this.headless.HighlightUtils.highlightString({
|