@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
|
@@ -2415,15 +2415,35 @@ function parseAssetURL(url, assetPath = './assets') {
|
|
|
2415
2415
|
return null;
|
|
2416
2416
|
}
|
|
2417
2417
|
|
|
2418
|
-
function
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2418
|
+
function memoize(fn, getCacheKey, options = {}) {
|
|
2419
|
+
const cache = new Map();
|
|
2420
|
+
const { maxEntries } = options;
|
|
2421
|
+
return {
|
|
2422
|
+
fn: async (...args)=>{
|
|
2423
|
+
const key = getCacheKey(...args);
|
|
2424
|
+
if (cache.has(key)) {
|
|
2425
|
+
const cachedPromise = cache.get(key);
|
|
2426
|
+
cache.delete(key);
|
|
2427
|
+
cache.set(key, cachedPromise);
|
|
2428
|
+
return cachedPromise;
|
|
2429
|
+
}
|
|
2430
|
+
const promise = fn(...args).catch((error)=>{
|
|
2431
|
+
cache.delete(key);
|
|
2432
|
+
throw error;
|
|
2433
|
+
});
|
|
2434
|
+
cache.set(key, promise);
|
|
2435
|
+
if (void 0 !== maxEntries && cache.size > maxEntries) {
|
|
2436
|
+
const lruKey = cache.keys().next().value;
|
|
2437
|
+
if (void 0 !== lruKey) cache.delete(lruKey);
|
|
2438
|
+
}
|
|
2439
|
+
return promise;
|
|
2440
|
+
},
|
|
2441
|
+
clearCache: ()=>{
|
|
2442
|
+
cache.clear();
|
|
2443
|
+
}
|
|
2444
|
+
};
|
|
2426
2445
|
}
|
|
2446
|
+
|
|
2427
2447
|
class IconFetchError extends Error {
|
|
2428
2448
|
static fromStatusCode(url, statusCode, statusText) {
|
|
2429
2449
|
return new IconFetchError(url, `status code ${statusCode} (${statusText})`);
|
|
@@ -2435,14 +2455,30 @@ class IconFetchError extends Error {
|
|
|
2435
2455
|
super(`Could not fetch icon from ${url}, got ${errorMessage}.`), this.url = url, this.errorObject = errorObject;
|
|
2436
2456
|
}
|
|
2437
2457
|
}
|
|
2458
|
+
const fetchIconUnmemoized = async (url)=>fetch(url).catch((e)=>{
|
|
2459
|
+
throw IconFetchError.fromError(url, e);
|
|
2460
|
+
}).then((response)=>{
|
|
2461
|
+
if (200 !== response.status && 304 !== response.status) throw IconFetchError.fromStatusCode(url, response.status, response.statusText);
|
|
2462
|
+
return response.text();
|
|
2463
|
+
});
|
|
2464
|
+
const memoizedFetchIcon = memoize(fetchIconUnmemoized, (url)=>url, {
|
|
2465
|
+
maxEntries: 20
|
|
2466
|
+
});
|
|
2467
|
+
const fetchIcon = memoizedFetchIcon.fn;
|
|
2468
|
+
|
|
2469
|
+
function _ts_decorate$1g(decorators, target, key, desc) {
|
|
2470
|
+
var c = arguments.length, r = c < 3 ? target : null === desc ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2471
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.decorate) r = Reflect.decorate(decorators, target, key, desc);
|
|
2472
|
+
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;
|
|
2473
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2474
|
+
}
|
|
2475
|
+
function _ts_metadata$11(k, v) {
|
|
2476
|
+
if ("object" == typeof Reflect && "function" == typeof Reflect.metadata) return Reflect.metadata(k, v);
|
|
2477
|
+
}
|
|
2438
2478
|
let AtomicIcon$1 = class AtomicIcon extends LightDomMixin(InitializeBindingsMixin(lit.LitElement)) {
|
|
2439
2479
|
async fetchIcon(url) {
|
|
2440
2480
|
try {
|
|
2441
|
-
|
|
2442
|
-
throw IconFetchError.fromError(url, e);
|
|
2443
|
-
});
|
|
2444
|
-
if (200 !== response.status && 304 !== response.status) throw IconFetchError.fromStatusCode(url, response.status, response.statusText);
|
|
2445
|
-
return await response.text();
|
|
2481
|
+
return await fetchIcon(url);
|
|
2446
2482
|
} catch (e) {
|
|
2447
2483
|
this.error = e;
|
|
2448
2484
|
this.requestUpdate();
|
|
@@ -8420,7 +8456,7 @@ function getWindow$1() {
|
|
|
8420
8456
|
}
|
|
8421
8457
|
function getAtomicEnvironment(headlessVersion) {
|
|
8422
8458
|
return {
|
|
8423
|
-
version: "3.
|
|
8459
|
+
version: "3.56.0",
|
|
8424
8460
|
headlessVersion
|
|
8425
8461
|
};
|
|
8426
8462
|
}
|
|
@@ -16596,7 +16632,7 @@ const renderSearchBoxTextArea = ({ props: { textAreaRef, loading, i18n, onInput,
|
|
|
16596
16632
|
}}
|
|
16597
16633
|
@keyup=${(e)=>{
|
|
16598
16634
|
onKeyUp?.(e);
|
|
16599
|
-
if ('Enter' === e.key) return void e.preventDefault();
|
|
16635
|
+
if ('Enter' === e.key && !e.shiftKey) return void e.preventDefault();
|
|
16600
16636
|
syncTextWithReplica(textAreaRef);
|
|
16601
16637
|
}}
|
|
16602
16638
|
@blur=${(e)=>{
|
|
@@ -17752,7 +17788,7 @@ let AtomicCommerceSearchBox$1 = class AtomicCommerceSearchBox extends lit.LitEle
|
|
|
17752
17788
|
if (this.isSearchDisabledForEndUser) return;
|
|
17753
17789
|
switch(e.key){
|
|
17754
17790
|
case 'Enter':
|
|
17755
|
-
this.onSubmit();
|
|
17791
|
+
if (!e.shiftKey) this.onSubmit();
|
|
17756
17792
|
break;
|
|
17757
17793
|
case 'Escape':
|
|
17758
17794
|
this.suggestionManager.clearSuggestions();
|
|
@@ -21109,7 +21145,7 @@ class AtomicCitation extends lit.LitElement {
|
|
|
21109
21145
|
<div class="relative">
|
|
21110
21146
|
${renderLinkWithItemAnalytics({
|
|
21111
21147
|
props: {
|
|
21112
|
-
href: this.anchorUrl(this.citation.clickUri ?? this.citation.uri, this.citation.text, this.citation.fields?.filetype),
|
|
21148
|
+
href: this.anchorUrl(this.citation.clickUri ?? this.citation.uri, this.citation.text, this.citation.filetype ?? this.citation.fields?.filetype),
|
|
21113
21149
|
ref: this.citationRef,
|
|
21114
21150
|
part: 'citation',
|
|
21115
21151
|
target: '_blank',
|