@blotoutio/providers-evo-search-sdk 1.70.2 → 1.71.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/core.cjs.js +14 -2
- package/core.js +14 -2
- package/core.mjs +14 -2
- package/hooks.cjs.js +18 -3
- package/hooks.d.ts +7 -0
- package/hooks.mjs +18 -3
- package/index.cjs.js +6337 -186
- package/index.js +6353 -202
- package/index.mjs +6337 -186
- package/package.json +1 -1
package/core.cjs.js
CHANGED
|
@@ -1760,6 +1760,17 @@ const parseSseFrame = (frame) => {
|
|
|
1760
1760
|
}
|
|
1761
1761
|
};
|
|
1762
1762
|
|
|
1763
|
+
const FORCED_KEY = 'evsUiVersion';
|
|
1764
|
+
// ?evs=reset must also drop the QA force so a shopper returns to the configured version.
|
|
1765
|
+
const clearForcedUiVersion = () => {
|
|
1766
|
+
try {
|
|
1767
|
+
sessionStorage.removeItem(FORCED_KEY);
|
|
1768
|
+
}
|
|
1769
|
+
catch {
|
|
1770
|
+
/* no-op: storage unavailable */
|
|
1771
|
+
}
|
|
1772
|
+
};
|
|
1773
|
+
|
|
1763
1774
|
const error = (message) => console.error(message);
|
|
1764
1775
|
// Headless hosts render their own UI, so nothing else pings /warm for them.
|
|
1765
1776
|
let disposeKeepWarm;
|
|
@@ -1832,6 +1843,7 @@ const init = (params) => {
|
|
|
1832
1843
|
try {
|
|
1833
1844
|
sessionStorage.removeItem(previewKeyName);
|
|
1834
1845
|
sessionStorage.removeItem(disableKeyName);
|
|
1846
|
+
clearForcedUiVersion();
|
|
1835
1847
|
logger.info('EvoSearch SDK: Reset to configured state via ?evs=reset URL param');
|
|
1836
1848
|
}
|
|
1837
1849
|
catch {
|
|
@@ -1914,7 +1926,7 @@ const init = (params) => {
|
|
|
1914
1926
|
const tag = ({ data }) => {
|
|
1915
1927
|
try {
|
|
1916
1928
|
return {
|
|
1917
|
-
sdkVersion: "1.
|
|
1929
|
+
sdkVersion: "1.71.0" || '',
|
|
1918
1930
|
searchQuery: data['searchQuery'],
|
|
1919
1931
|
searchResults: data['searchResults'],
|
|
1920
1932
|
timestamp: Date.now(),
|
|
@@ -1923,7 +1935,7 @@ const tag = ({ data }) => {
|
|
|
1923
1935
|
catch (err) {
|
|
1924
1936
|
console.error(`EvoSearch SDK: Tagging failed - ${err}`);
|
|
1925
1937
|
return {
|
|
1926
|
-
sdkVersion: "1.
|
|
1938
|
+
sdkVersion: "1.71.0" ,
|
|
1927
1939
|
timestamp: Date.now(),
|
|
1928
1940
|
};
|
|
1929
1941
|
}
|
package/core.js
CHANGED
|
@@ -1761,6 +1761,17 @@ var ProvidersEvoSearchSdk = (function () {
|
|
|
1761
1761
|
}
|
|
1762
1762
|
};
|
|
1763
1763
|
|
|
1764
|
+
const FORCED_KEY = 'evsUiVersion';
|
|
1765
|
+
// ?evs=reset must also drop the QA force so a shopper returns to the configured version.
|
|
1766
|
+
const clearForcedUiVersion = () => {
|
|
1767
|
+
try {
|
|
1768
|
+
sessionStorage.removeItem(FORCED_KEY);
|
|
1769
|
+
}
|
|
1770
|
+
catch {
|
|
1771
|
+
/* no-op: storage unavailable */
|
|
1772
|
+
}
|
|
1773
|
+
};
|
|
1774
|
+
|
|
1764
1775
|
const error = (message) => console.error(message);
|
|
1765
1776
|
// Headless hosts render their own UI, so nothing else pings /warm for them.
|
|
1766
1777
|
let disposeKeepWarm;
|
|
@@ -1833,6 +1844,7 @@ var ProvidersEvoSearchSdk = (function () {
|
|
|
1833
1844
|
try {
|
|
1834
1845
|
sessionStorage.removeItem(previewKeyName);
|
|
1835
1846
|
sessionStorage.removeItem(disableKeyName);
|
|
1847
|
+
clearForcedUiVersion();
|
|
1836
1848
|
logger.info('EvoSearch SDK: Reset to configured state via ?evs=reset URL param');
|
|
1837
1849
|
}
|
|
1838
1850
|
catch {
|
|
@@ -1915,7 +1927,7 @@ var ProvidersEvoSearchSdk = (function () {
|
|
|
1915
1927
|
const tag = ({ data }) => {
|
|
1916
1928
|
try {
|
|
1917
1929
|
return {
|
|
1918
|
-
sdkVersion: "1.
|
|
1930
|
+
sdkVersion: "1.71.0" || '',
|
|
1919
1931
|
searchQuery: data['searchQuery'],
|
|
1920
1932
|
searchResults: data['searchResults'],
|
|
1921
1933
|
timestamp: Date.now(),
|
|
@@ -1924,7 +1936,7 @@ var ProvidersEvoSearchSdk = (function () {
|
|
|
1924
1936
|
catch (err) {
|
|
1925
1937
|
console.error(`EvoSearch SDK: Tagging failed - ${err}`);
|
|
1926
1938
|
return {
|
|
1927
|
-
sdkVersion: "1.
|
|
1939
|
+
sdkVersion: "1.71.0" ,
|
|
1928
1940
|
timestamp: Date.now(),
|
|
1929
1941
|
};
|
|
1930
1942
|
}
|
package/core.mjs
CHANGED
|
@@ -1758,6 +1758,17 @@ const parseSseFrame = (frame) => {
|
|
|
1758
1758
|
}
|
|
1759
1759
|
};
|
|
1760
1760
|
|
|
1761
|
+
const FORCED_KEY = 'evsUiVersion';
|
|
1762
|
+
// ?evs=reset must also drop the QA force so a shopper returns to the configured version.
|
|
1763
|
+
const clearForcedUiVersion = () => {
|
|
1764
|
+
try {
|
|
1765
|
+
sessionStorage.removeItem(FORCED_KEY);
|
|
1766
|
+
}
|
|
1767
|
+
catch {
|
|
1768
|
+
/* no-op: storage unavailable */
|
|
1769
|
+
}
|
|
1770
|
+
};
|
|
1771
|
+
|
|
1761
1772
|
const error = (message) => console.error(message);
|
|
1762
1773
|
// Headless hosts render their own UI, so nothing else pings /warm for them.
|
|
1763
1774
|
let disposeKeepWarm;
|
|
@@ -1830,6 +1841,7 @@ const init = (params) => {
|
|
|
1830
1841
|
try {
|
|
1831
1842
|
sessionStorage.removeItem(previewKeyName);
|
|
1832
1843
|
sessionStorage.removeItem(disableKeyName);
|
|
1844
|
+
clearForcedUiVersion();
|
|
1833
1845
|
logger.info('EvoSearch SDK: Reset to configured state via ?evs=reset URL param');
|
|
1834
1846
|
}
|
|
1835
1847
|
catch {
|
|
@@ -1912,7 +1924,7 @@ const init = (params) => {
|
|
|
1912
1924
|
const tag = ({ data }) => {
|
|
1913
1925
|
try {
|
|
1914
1926
|
return {
|
|
1915
|
-
sdkVersion: "1.
|
|
1927
|
+
sdkVersion: "1.71.0" || '',
|
|
1916
1928
|
searchQuery: data['searchQuery'],
|
|
1917
1929
|
searchResults: data['searchResults'],
|
|
1918
1930
|
timestamp: Date.now(),
|
|
@@ -1921,7 +1933,7 @@ const tag = ({ data }) => {
|
|
|
1921
1933
|
catch (err) {
|
|
1922
1934
|
console.error(`EvoSearch SDK: Tagging failed - ${err}`);
|
|
1923
1935
|
return {
|
|
1924
|
-
sdkVersion: "1.
|
|
1936
|
+
sdkVersion: "1.71.0" ,
|
|
1925
1937
|
timestamp: Date.now(),
|
|
1926
1938
|
};
|
|
1927
1939
|
}
|
package/hooks.cjs.js
CHANGED
|
@@ -1150,8 +1150,21 @@ const extractHandle = (url, fallback) => {
|
|
|
1150
1150
|
return fallback;
|
|
1151
1151
|
}
|
|
1152
1152
|
};
|
|
1153
|
+
// Merchandising badge label from a `badge:`-prefixed tag (case-insensitive
|
|
1154
|
+
// prefix, whole tag, label trimmed); first match wins — one badge per tile.
|
|
1155
|
+
const badgeFromTags = (tags) => {
|
|
1156
|
+
for (const tag of tags !== null && tags !== void 0 ? tags : []) {
|
|
1157
|
+
if (tag.toLowerCase().startsWith('badge:')) {
|
|
1158
|
+
const label = tag.slice('badge:'.length).trim();
|
|
1159
|
+
if (label) {
|
|
1160
|
+
return label;
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
}
|
|
1164
|
+
return undefined;
|
|
1165
|
+
};
|
|
1153
1166
|
const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
1154
|
-
var _a, _b, _c, _d;
|
|
1167
|
+
var _a, _b, _c, _d, _e;
|
|
1155
1168
|
const safeUrl = isHttpURL(apiProduct.url) ? apiProduct.url : '';
|
|
1156
1169
|
const safeImg = isHttpURL(apiProduct.img) ? apiProduct.img : '';
|
|
1157
1170
|
const handle = apiProduct.handle || extractHandle(safeUrl, apiProduct.id);
|
|
@@ -1197,6 +1210,8 @@ const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
|
1197
1210
|
description: apiProduct.description,
|
|
1198
1211
|
url: safeUrl,
|
|
1199
1212
|
inStock: apiProduct.inStock,
|
|
1213
|
+
// `tags` is word-tokenised on the wire; `tagList` keeps whole tags (multi-word labels).
|
|
1214
|
+
badge: badgeFromTags((_c = apiProduct.tagList) !== null && _c !== void 0 ? _c : apiProduct.tags),
|
|
1200
1215
|
image: {
|
|
1201
1216
|
url: safeImg,
|
|
1202
1217
|
alt: apiProduct.name,
|
|
@@ -1209,7 +1224,7 @@ const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
|
1209
1224
|
...(apiProduct.ratingCount !== undefined
|
|
1210
1225
|
? { ratingCount: apiProduct.ratingCount }
|
|
1211
1226
|
: {}),
|
|
1212
|
-
...(((
|
|
1227
|
+
...(((_d = apiProduct.options) === null || _d === void 0 ? void 0 : _d.length)
|
|
1213
1228
|
? {
|
|
1214
1229
|
options: apiProduct.options.map((option) => ({
|
|
1215
1230
|
...option,
|
|
@@ -1233,7 +1248,7 @@ const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
|
1233
1248
|
...(apiProduct.quickAddReason
|
|
1234
1249
|
? { quickAddReason: apiProduct.quickAddReason }
|
|
1235
1250
|
: {}),
|
|
1236
|
-
...(((
|
|
1251
|
+
...(((_e = apiProduct.resolvedBadges) === null || _e === void 0 ? void 0 : _e.length)
|
|
1237
1252
|
? { resolvedBadges: apiProduct.resolvedBadges }
|
|
1238
1253
|
: {}),
|
|
1239
1254
|
};
|
package/hooks.d.ts
CHANGED
|
@@ -535,6 +535,9 @@ declare module '@blotoutio/providers-evo-search-sdk/hooks' {
|
|
|
535
535
|
askStarters?: string[]
|
|
536
536
|
askNudge: 'always' | 'weak' | 'never'
|
|
537
537
|
askNudgeLabel: string
|
|
538
|
+
// v2 merchandising badge toggle (resolved, default false). Absent from a
|
|
539
|
+
// worker that predates v2; read it as `=== true`.
|
|
540
|
+
showBadges?: boolean
|
|
538
541
|
// Absent means no merchant template; '' is an explicit clear.
|
|
539
542
|
searchPageTitleTemplate?: string
|
|
540
543
|
brandName?: string
|
|
@@ -626,6 +629,10 @@ declare module '@blotoutio/providers-evo-search-sdk/hooks' {
|
|
|
626
629
|
trending: (signal?: AbortSignal) => Promise<{
|
|
627
630
|
trending: string[]
|
|
628
631
|
recommended_products: AutocompleteAPIProduct[]
|
|
632
|
+
groups?: {
|
|
633
|
+
topSearches?: { term: string; img?: string }[]
|
|
634
|
+
trending?: { term: string; img?: string }[]
|
|
635
|
+
}
|
|
629
636
|
}>
|
|
630
637
|
config: (signal?: AbortSignal) => Promise<AskConfigResponse>
|
|
631
638
|
/**
|
package/hooks.mjs
CHANGED
|
@@ -1148,8 +1148,21 @@ const extractHandle = (url, fallback) => {
|
|
|
1148
1148
|
return fallback;
|
|
1149
1149
|
}
|
|
1150
1150
|
};
|
|
1151
|
+
// Merchandising badge label from a `badge:`-prefixed tag (case-insensitive
|
|
1152
|
+
// prefix, whole tag, label trimmed); first match wins — one badge per tile.
|
|
1153
|
+
const badgeFromTags = (tags) => {
|
|
1154
|
+
for (const tag of tags !== null && tags !== void 0 ? tags : []) {
|
|
1155
|
+
if (tag.toLowerCase().startsWith('badge:')) {
|
|
1156
|
+
const label = tag.slice('badge:'.length).trim();
|
|
1157
|
+
if (label) {
|
|
1158
|
+
return label;
|
|
1159
|
+
}
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
return undefined;
|
|
1163
|
+
};
|
|
1151
1164
|
const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
1152
|
-
var _a, _b, _c, _d;
|
|
1165
|
+
var _a, _b, _c, _d, _e;
|
|
1153
1166
|
const safeUrl = isHttpURL(apiProduct.url) ? apiProduct.url : '';
|
|
1154
1167
|
const safeImg = isHttpURL(apiProduct.img) ? apiProduct.img : '';
|
|
1155
1168
|
const handle = apiProduct.handle || extractHandle(safeUrl, apiProduct.id);
|
|
@@ -1195,6 +1208,8 @@ const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
|
1195
1208
|
description: apiProduct.description,
|
|
1196
1209
|
url: safeUrl,
|
|
1197
1210
|
inStock: apiProduct.inStock,
|
|
1211
|
+
// `tags` is word-tokenised on the wire; `tagList` keeps whole tags (multi-word labels).
|
|
1212
|
+
badge: badgeFromTags((_c = apiProduct.tagList) !== null && _c !== void 0 ? _c : apiProduct.tags),
|
|
1198
1213
|
image: {
|
|
1199
1214
|
url: safeImg,
|
|
1200
1215
|
alt: apiProduct.name,
|
|
@@ -1207,7 +1222,7 @@ const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
|
1207
1222
|
...(apiProduct.ratingCount !== undefined
|
|
1208
1223
|
? { ratingCount: apiProduct.ratingCount }
|
|
1209
1224
|
: {}),
|
|
1210
|
-
...(((
|
|
1225
|
+
...(((_d = apiProduct.options) === null || _d === void 0 ? void 0 : _d.length)
|
|
1211
1226
|
? {
|
|
1212
1227
|
options: apiProduct.options.map((option) => ({
|
|
1213
1228
|
...option,
|
|
@@ -1231,7 +1246,7 @@ const mapAPIProductToSDKProduct = (apiProduct) => {
|
|
|
1231
1246
|
...(apiProduct.quickAddReason
|
|
1232
1247
|
? { quickAddReason: apiProduct.quickAddReason }
|
|
1233
1248
|
: {}),
|
|
1234
|
-
...(((
|
|
1249
|
+
...(((_e = apiProduct.resolvedBadges) === null || _e === void 0 ? void 0 : _e.length)
|
|
1235
1250
|
? { resolvedBadges: apiProduct.resolvedBadges }
|
|
1236
1251
|
: {}),
|
|
1237
1252
|
};
|