@coveo/atomic-react 3.11.13 → 3.11.14
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/dist/cjs/atomic-react.cjs +53 -17
- package/dist/cjs/atomic-react.cjs.map +1 -1
- package/dist/cjs/commerce/atomic-react.cjs +53 -17
- package/dist/cjs/commerce/atomic-react.cjs.map +1 -1
- package/dist/cjs/recommendation/atomic-react.cjs +53 -17
- package/dist/cjs/recommendation/atomic-react.cjs.map +1 -1
- package/package.json +3 -3
|
@@ -2524,15 +2524,35 @@ function parseAssetURL(url, assetPath = './assets') {
|
|
|
2524
2524
|
return null;
|
|
2525
2525
|
}
|
|
2526
2526
|
|
|
2527
|
-
function
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2527
|
+
function memoize(fn, getCacheKey, options = {}) {
|
|
2528
|
+
const cache = new Map();
|
|
2529
|
+
const { maxEntries } = options;
|
|
2530
|
+
return {
|
|
2531
|
+
fn: async (...args)=>{
|
|
2532
|
+
const key = getCacheKey(...args);
|
|
2533
|
+
if (cache.has(key)) {
|
|
2534
|
+
const cachedPromise = cache.get(key);
|
|
2535
|
+
cache.delete(key);
|
|
2536
|
+
cache.set(key, cachedPromise);
|
|
2537
|
+
return cachedPromise;
|
|
2538
|
+
}
|
|
2539
|
+
const promise = fn(...args).catch((error)=>{
|
|
2540
|
+
cache.delete(key);
|
|
2541
|
+
throw error;
|
|
2542
|
+
});
|
|
2543
|
+
cache.set(key, promise);
|
|
2544
|
+
if (void 0 !== maxEntries && cache.size > maxEntries) {
|
|
2545
|
+
const lruKey = cache.keys().next().value;
|
|
2546
|
+
if (void 0 !== lruKey) cache.delete(lruKey);
|
|
2547
|
+
}
|
|
2548
|
+
return promise;
|
|
2549
|
+
},
|
|
2550
|
+
clearCache: ()=>{
|
|
2551
|
+
cache.clear();
|
|
2552
|
+
}
|
|
2553
|
+
};
|
|
2535
2554
|
}
|
|
2555
|
+
|
|
2536
2556
|
class IconFetchError extends Error {
|
|
2537
2557
|
static fromStatusCode(url, statusCode, statusText) {
|
|
2538
2558
|
return new IconFetchError(url, `status code ${statusCode} (${statusText})`);
|
|
@@ -2544,14 +2564,30 @@ class IconFetchError extends Error {
|
|
|
2544
2564
|
super(`Could not fetch icon from ${url}, got ${errorMessage}.`), this.url = url, this.errorObject = errorObject;
|
|
2545
2565
|
}
|
|
2546
2566
|
}
|
|
2567
|
+
const fetchIconUnmemoized = async (url)=>fetch(url).catch((e)=>{
|
|
2568
|
+
throw IconFetchError.fromError(url, e);
|
|
2569
|
+
}).then((response)=>{
|
|
2570
|
+
if (200 !== response.status && 304 !== response.status) throw IconFetchError.fromStatusCode(url, response.status, response.statusText);
|
|
2571
|
+
return response.text();
|
|
2572
|
+
});
|
|
2573
|
+
const memoizedFetchIcon = memoize(fetchIconUnmemoized, (url)=>url, {
|
|
2574
|
+
maxEntries: 20
|
|
2575
|
+
});
|
|
2576
|
+
const fetchIcon = memoizedFetchIcon.fn;
|
|
2577
|
+
|
|
2578
|
+
function _ts_decorate$1G(decorators, target, key, desc) {
|
|
2579
|
+
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2580
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
2581
|
+
else for(var i = decorators.length - 1; i >= 0; i--)if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
2582
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2583
|
+
}
|
|
2584
|
+
function _ts_metadata$1w(k, v) {
|
|
2585
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
2586
|
+
}
|
|
2547
2587
|
let AtomicIcon$1 = class AtomicIcon extends LightDomMixin(InitializeBindingsMixin(lit.LitElement)) {
|
|
2548
2588
|
async fetchIcon(url) {
|
|
2549
2589
|
try {
|
|
2550
|
-
|
|
2551
|
-
throw IconFetchError.fromError(url, e);
|
|
2552
|
-
});
|
|
2553
|
-
if (200 !== response.status && 304 !== response.status) throw IconFetchError.fromStatusCode(url, response.status, response.statusText);
|
|
2554
|
-
return await response.text();
|
|
2590
|
+
return await fetchIcon(url);
|
|
2555
2591
|
} catch (e) {
|
|
2556
2592
|
this.error = e;
|
|
2557
2593
|
this.requestUpdate();
|
|
@@ -6958,7 +6994,7 @@ function getWindow$1() {
|
|
|
6958
6994
|
}
|
|
6959
6995
|
function getAtomicEnvironment(headlessVersion) {
|
|
6960
6996
|
return {
|
|
6961
|
-
version: "3.
|
|
6997
|
+
version: "3.56.0",
|
|
6962
6998
|
headlessVersion
|
|
6963
6999
|
};
|
|
6964
7000
|
}
|
|
@@ -11967,7 +12003,7 @@ const renderSearchBoxTextArea = ({ props: { textAreaRef, loading, i18n, onInput,
|
|
|
11967
12003
|
}}
|
|
11968
12004
|
@keyup=${(e)=>{
|
|
11969
12005
|
onKeyUp?.(e);
|
|
11970
|
-
if ('Enter' === e.key) return void e.preventDefault();
|
|
12006
|
+
if ('Enter' === e.key && !e.shiftKey) return void e.preventDefault();
|
|
11971
12007
|
syncTextWithReplica(textAreaRef);
|
|
11972
12008
|
}}
|
|
11973
12009
|
@blur=${(e)=>{
|
|
@@ -14496,7 +14532,7 @@ class AtomicCitation extends lit.LitElement {
|
|
|
14496
14532
|
<div class="relative">
|
|
14497
14533
|
${renderLinkWithItemAnalytics({
|
|
14498
14534
|
props: {
|
|
14499
|
-
href: this.anchorUrl(this.citation.clickUri ?? this.citation.uri, this.citation.text, this.citation.fields?.filetype),
|
|
14535
|
+
href: this.anchorUrl(this.citation.clickUri ?? this.citation.uri, this.citation.text, this.citation.filetype ?? this.citation.fields?.filetype),
|
|
14500
14536
|
ref: this.citationRef,
|
|
14501
14537
|
part: 'citation',
|
|
14502
14538
|
target: '_blank',
|
|
@@ -33286,7 +33322,7 @@ let AtomicSearchBox$1 = class AtomicSearchBox extends lit.LitElement {
|
|
|
33286
33322
|
if (this.isSearchDisabledForEndUser) return;
|
|
33287
33323
|
switch(e.key){
|
|
33288
33324
|
case 'Enter':
|
|
33289
|
-
this.onSubmit();
|
|
33325
|
+
if (!e.shiftKey) this.onSubmit();
|
|
33290
33326
|
break;
|
|
33291
33327
|
case 'Escape':
|
|
33292
33328
|
this.suggestionManager.clearSuggestions();
|