@getlupa/client 1.17.9 → 1.17.11
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/lupaSearch.iife.js +52 -11
- package/dist/lupaSearch.js +52 -11
- package/dist/lupaSearch.mjs +52 -11
- package/dist/lupaSearch.umd.js +52 -11
- package/package.json +2 -2
package/dist/lupaSearch.iife.js
CHANGED
|
@@ -25363,6 +25363,8 @@ and ensure you are accounting for this risk.
|
|
|
25363
25363
|
return extractFromStorage(options);
|
|
25364
25364
|
case "htmlElementText":
|
|
25365
25365
|
return extractFromHtmlElementText(options);
|
|
25366
|
+
case "htmlElementAttribute":
|
|
25367
|
+
return extractFromHtmlElementAttribute(options);
|
|
25366
25368
|
case "cookie":
|
|
25367
25369
|
return extractFromCookie(options);
|
|
25368
25370
|
default:
|
|
@@ -25406,6 +25408,17 @@ and ensure you are accounting for this risk.
|
|
|
25406
25408
|
const element = document.querySelector(options.querySelector);
|
|
25407
25409
|
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
25408
25410
|
};
|
|
25411
|
+
const extractFromHtmlElementAttribute = (options) => {
|
|
25412
|
+
const element = document.querySelector(options.querySelector);
|
|
25413
|
+
if (!element) {
|
|
25414
|
+
return options.default;
|
|
25415
|
+
}
|
|
25416
|
+
const attr = options.attribute;
|
|
25417
|
+
if (attr === "value" && (element == null ? void 0 : element.value)) {
|
|
25418
|
+
return element.value;
|
|
25419
|
+
}
|
|
25420
|
+
return element.getAttribute(attr) || options.default;
|
|
25421
|
+
};
|
|
25409
25422
|
const getValueFromPath = (obj, path) => {
|
|
25410
25423
|
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
25411
25424
|
};
|
|
@@ -32639,6 +32652,7 @@ and ensure you are accounting for this risk.
|
|
|
32639
32652
|
}
|
|
32640
32653
|
};
|
|
32641
32654
|
onMounted(() => {
|
|
32655
|
+
var _a, _b;
|
|
32642
32656
|
handleResize();
|
|
32643
32657
|
optionsStore.setSearchResultOptions({
|
|
32644
32658
|
options: props.options
|
|
@@ -32651,6 +32665,9 @@ and ensure you are accounting for this risk.
|
|
|
32651
32665
|
} else {
|
|
32652
32666
|
loadRecommendations();
|
|
32653
32667
|
}
|
|
32668
|
+
if ((_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onMounted) {
|
|
32669
|
+
(_b = props.options.recommendationCallbacks) == null ? void 0 : _b.onMounted();
|
|
32670
|
+
}
|
|
32654
32671
|
window.addEventListener("resize", handleResize);
|
|
32655
32672
|
});
|
|
32656
32673
|
onBeforeUnmount(() => {
|
|
@@ -32706,6 +32723,7 @@ and ensure you are accounting for this risk.
|
|
|
32706
32723
|
return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
|
|
32707
32724
|
});
|
|
32708
32725
|
const loadLupaRecommendations = () => __async2(this, null, function* () {
|
|
32726
|
+
var _a, _b;
|
|
32709
32727
|
recommendationsType.value = "recommendations_lupasearch";
|
|
32710
32728
|
try {
|
|
32711
32729
|
loading.value = true;
|
|
@@ -32723,6 +32741,7 @@ and ensure you are accounting for this risk.
|
|
|
32723
32741
|
yield dynamicDataStore.enhanceSearchResultsWithDynamicData({
|
|
32724
32742
|
result: { items: result2.recommended }
|
|
32725
32743
|
});
|
|
32744
|
+
(_b = (_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onRecommenderResults) == null ? void 0 : _b.call(_a, result2.recommended);
|
|
32726
32745
|
} finally {
|
|
32727
32746
|
loading.value = false;
|
|
32728
32747
|
}
|
|
@@ -40411,17 +40430,8 @@ and ensure you are accounting for this risk.
|
|
|
40411
40430
|
);
|
|
40412
40431
|
productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40413
40432
|
});
|
|
40414
|
-
const mountRecommendations = (
|
|
40433
|
+
const mountRecommendations = (resolvedSearchResultsConfiguration, resolvedConfiguration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40415
40434
|
var _a;
|
|
40416
|
-
if (!configuration.recommendations) {
|
|
40417
|
-
return;
|
|
40418
|
-
}
|
|
40419
|
-
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40420
|
-
configuration.searchResults
|
|
40421
|
-
);
|
|
40422
|
-
const resolvedConfiguration = JSON.parse(
|
|
40423
|
-
configuration.recommendations
|
|
40424
|
-
);
|
|
40425
40435
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40426
40436
|
const visible = yield waitForElementToBeVisible(
|
|
40427
40437
|
resolvedConfiguration.containerSelector,
|
|
@@ -40440,6 +40450,37 @@ and ensure you are accounting for this risk.
|
|
|
40440
40450
|
);
|
|
40441
40451
|
recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40442
40452
|
});
|
|
40453
|
+
const mountAllRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40454
|
+
if (!configuration.recommendations) {
|
|
40455
|
+
return;
|
|
40456
|
+
}
|
|
40457
|
+
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40458
|
+
configuration.searchResults
|
|
40459
|
+
);
|
|
40460
|
+
const resolvedConfiguration = JSON.parse(configuration.recommendations);
|
|
40461
|
+
if (Array.isArray(resolvedConfiguration)) {
|
|
40462
|
+
const mountPromises = resolvedConfiguration.map(
|
|
40463
|
+
(recommendation) => mountRecommendations(
|
|
40464
|
+
resolvedSearchResultsConfiguration,
|
|
40465
|
+
recommendation,
|
|
40466
|
+
options,
|
|
40467
|
+
optionOverrides,
|
|
40468
|
+
fetch2,
|
|
40469
|
+
remount
|
|
40470
|
+
)
|
|
40471
|
+
);
|
|
40472
|
+
yield Promise.all(mountPromises);
|
|
40473
|
+
} else {
|
|
40474
|
+
yield mountRecommendations(
|
|
40475
|
+
resolvedSearchResultsConfiguration,
|
|
40476
|
+
resolvedConfiguration,
|
|
40477
|
+
options,
|
|
40478
|
+
optionOverrides,
|
|
40479
|
+
fetch2,
|
|
40480
|
+
remount
|
|
40481
|
+
);
|
|
40482
|
+
}
|
|
40483
|
+
});
|
|
40443
40484
|
const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40444
40485
|
if (!configuration.genAiChat) {
|
|
40445
40486
|
return;
|
|
@@ -40481,7 +40522,7 @@ and ensure you are accounting for this risk.
|
|
|
40481
40522
|
mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
|
|
40482
40523
|
mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
|
|
40483
40524
|
mountProductList(configuration, options, optionOverrides, fetch2, remount),
|
|
40484
|
-
|
|
40525
|
+
mountAllRecommendations(configuration, options, optionOverrides, fetch2, remount),
|
|
40485
40526
|
mountChat(configuration, options, fetch2, remount)
|
|
40486
40527
|
];
|
|
40487
40528
|
yield Promise.all(mountPromises);
|
package/dist/lupaSearch.js
CHANGED
|
@@ -25363,6 +25363,8 @@ const extractValue = (options) => {
|
|
|
25363
25363
|
return extractFromStorage(options);
|
|
25364
25364
|
case "htmlElementText":
|
|
25365
25365
|
return extractFromHtmlElementText(options);
|
|
25366
|
+
case "htmlElementAttribute":
|
|
25367
|
+
return extractFromHtmlElementAttribute(options);
|
|
25366
25368
|
case "cookie":
|
|
25367
25369
|
return extractFromCookie(options);
|
|
25368
25370
|
default:
|
|
@@ -25406,6 +25408,17 @@ const extractFromHtmlElementText = (options) => {
|
|
|
25406
25408
|
const element = document.querySelector(options.querySelector);
|
|
25407
25409
|
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
25408
25410
|
};
|
|
25411
|
+
const extractFromHtmlElementAttribute = (options) => {
|
|
25412
|
+
const element = document.querySelector(options.querySelector);
|
|
25413
|
+
if (!element) {
|
|
25414
|
+
return options.default;
|
|
25415
|
+
}
|
|
25416
|
+
const attr = options.attribute;
|
|
25417
|
+
if (attr === "value" && (element == null ? void 0 : element.value)) {
|
|
25418
|
+
return element.value;
|
|
25419
|
+
}
|
|
25420
|
+
return element.getAttribute(attr) || options.default;
|
|
25421
|
+
};
|
|
25409
25422
|
const getValueFromPath = (obj, path) => {
|
|
25410
25423
|
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
25411
25424
|
};
|
|
@@ -32639,6 +32652,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32639
32652
|
}
|
|
32640
32653
|
};
|
|
32641
32654
|
onMounted(() => {
|
|
32655
|
+
var _a, _b;
|
|
32642
32656
|
handleResize();
|
|
32643
32657
|
optionsStore.setSearchResultOptions({
|
|
32644
32658
|
options: props.options
|
|
@@ -32651,6 +32665,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32651
32665
|
} else {
|
|
32652
32666
|
loadRecommendations();
|
|
32653
32667
|
}
|
|
32668
|
+
if ((_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onMounted) {
|
|
32669
|
+
(_b = props.options.recommendationCallbacks) == null ? void 0 : _b.onMounted();
|
|
32670
|
+
}
|
|
32654
32671
|
window.addEventListener("resize", handleResize);
|
|
32655
32672
|
});
|
|
32656
32673
|
onBeforeUnmount(() => {
|
|
@@ -32706,6 +32723,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32706
32723
|
return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
|
|
32707
32724
|
});
|
|
32708
32725
|
const loadLupaRecommendations = () => __async2(this, null, function* () {
|
|
32726
|
+
var _a, _b;
|
|
32709
32727
|
recommendationsType.value = "recommendations_lupasearch";
|
|
32710
32728
|
try {
|
|
32711
32729
|
loading.value = true;
|
|
@@ -32723,6 +32741,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32723
32741
|
yield dynamicDataStore.enhanceSearchResultsWithDynamicData({
|
|
32724
32742
|
result: { items: result2.recommended }
|
|
32725
32743
|
});
|
|
32744
|
+
(_b = (_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onRecommenderResults) == null ? void 0 : _b.call(_a, result2.recommended);
|
|
32726
32745
|
} finally {
|
|
32727
32746
|
loading.value = false;
|
|
32728
32747
|
}
|
|
@@ -40411,17 +40430,8 @@ const mountProductList = (configuration, options, optionOverrides, fetch2 = true
|
|
|
40411
40430
|
);
|
|
40412
40431
|
productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40413
40432
|
});
|
|
40414
|
-
const mountRecommendations = (
|
|
40433
|
+
const mountRecommendations = (resolvedSearchResultsConfiguration, resolvedConfiguration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
40415
40434
|
var _a;
|
|
40416
|
-
if (!configuration.recommendations) {
|
|
40417
|
-
return;
|
|
40418
|
-
}
|
|
40419
|
-
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40420
|
-
configuration.searchResults
|
|
40421
|
-
);
|
|
40422
|
-
const resolvedConfiguration = JSON.parse(
|
|
40423
|
-
configuration.recommendations
|
|
40424
|
-
);
|
|
40425
40435
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40426
40436
|
const visible = yield waitForElementToBeVisible(
|
|
40427
40437
|
resolvedConfiguration.containerSelector,
|
|
@@ -40440,6 +40450,37 @@ const mountRecommendations = (configuration, options, optionOverrides, fetch2 =
|
|
|
40440
40450
|
);
|
|
40441
40451
|
recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40442
40452
|
});
|
|
40453
|
+
const mountAllRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
40454
|
+
if (!configuration.recommendations) {
|
|
40455
|
+
return;
|
|
40456
|
+
}
|
|
40457
|
+
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40458
|
+
configuration.searchResults
|
|
40459
|
+
);
|
|
40460
|
+
const resolvedConfiguration = JSON.parse(configuration.recommendations);
|
|
40461
|
+
if (Array.isArray(resolvedConfiguration)) {
|
|
40462
|
+
const mountPromises = resolvedConfiguration.map(
|
|
40463
|
+
(recommendation) => mountRecommendations(
|
|
40464
|
+
resolvedSearchResultsConfiguration,
|
|
40465
|
+
recommendation,
|
|
40466
|
+
options,
|
|
40467
|
+
optionOverrides,
|
|
40468
|
+
fetch2,
|
|
40469
|
+
remount
|
|
40470
|
+
)
|
|
40471
|
+
);
|
|
40472
|
+
yield Promise.all(mountPromises);
|
|
40473
|
+
} else {
|
|
40474
|
+
yield mountRecommendations(
|
|
40475
|
+
resolvedSearchResultsConfiguration,
|
|
40476
|
+
resolvedConfiguration,
|
|
40477
|
+
options,
|
|
40478
|
+
optionOverrides,
|
|
40479
|
+
fetch2,
|
|
40480
|
+
remount
|
|
40481
|
+
);
|
|
40482
|
+
}
|
|
40483
|
+
});
|
|
40443
40484
|
const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
40444
40485
|
if (!configuration.genAiChat) {
|
|
40445
40486
|
return;
|
|
@@ -40481,7 +40522,7 @@ const mount = (_0, ..._1) => __async(exports, [_0, ..._1], function* (configurat
|
|
|
40481
40522
|
mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
|
|
40482
40523
|
mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
|
|
40483
40524
|
mountProductList(configuration, options, optionOverrides, fetch2, remount),
|
|
40484
|
-
|
|
40525
|
+
mountAllRecommendations(configuration, options, optionOverrides, fetch2, remount),
|
|
40485
40526
|
mountChat(configuration, options, fetch2, remount)
|
|
40486
40527
|
];
|
|
40487
40528
|
yield Promise.all(mountPromises);
|
package/dist/lupaSearch.mjs
CHANGED
|
@@ -25361,6 +25361,8 @@ const extractValue = (options) => {
|
|
|
25361
25361
|
return extractFromStorage(options);
|
|
25362
25362
|
case "htmlElementText":
|
|
25363
25363
|
return extractFromHtmlElementText(options);
|
|
25364
|
+
case "htmlElementAttribute":
|
|
25365
|
+
return extractFromHtmlElementAttribute(options);
|
|
25364
25366
|
case "cookie":
|
|
25365
25367
|
return extractFromCookie(options);
|
|
25366
25368
|
default:
|
|
@@ -25404,6 +25406,17 @@ const extractFromHtmlElementText = (options) => {
|
|
|
25404
25406
|
const element = document.querySelector(options.querySelector);
|
|
25405
25407
|
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
25406
25408
|
};
|
|
25409
|
+
const extractFromHtmlElementAttribute = (options) => {
|
|
25410
|
+
const element = document.querySelector(options.querySelector);
|
|
25411
|
+
if (!element) {
|
|
25412
|
+
return options.default;
|
|
25413
|
+
}
|
|
25414
|
+
const attr = options.attribute;
|
|
25415
|
+
if (attr === "value" && (element == null ? void 0 : element.value)) {
|
|
25416
|
+
return element.value;
|
|
25417
|
+
}
|
|
25418
|
+
return element.getAttribute(attr) || options.default;
|
|
25419
|
+
};
|
|
25407
25420
|
const getValueFromPath = (obj, path) => {
|
|
25408
25421
|
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
25409
25422
|
};
|
|
@@ -32637,6 +32650,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32637
32650
|
}
|
|
32638
32651
|
};
|
|
32639
32652
|
onMounted(() => {
|
|
32653
|
+
var _a, _b;
|
|
32640
32654
|
handleResize();
|
|
32641
32655
|
optionsStore.setSearchResultOptions({
|
|
32642
32656
|
options: props.options
|
|
@@ -32649,6 +32663,9 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32649
32663
|
} else {
|
|
32650
32664
|
loadRecommendations();
|
|
32651
32665
|
}
|
|
32666
|
+
if ((_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onMounted) {
|
|
32667
|
+
(_b = props.options.recommendationCallbacks) == null ? void 0 : _b.onMounted();
|
|
32668
|
+
}
|
|
32652
32669
|
window.addEventListener("resize", handleResize);
|
|
32653
32670
|
});
|
|
32654
32671
|
onBeforeUnmount(() => {
|
|
@@ -32704,6 +32721,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32704
32721
|
return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
|
|
32705
32722
|
});
|
|
32706
32723
|
const loadLupaRecommendations = () => __async2(this, null, function* () {
|
|
32724
|
+
var _a, _b;
|
|
32707
32725
|
recommendationsType.value = "recommendations_lupasearch";
|
|
32708
32726
|
try {
|
|
32709
32727
|
loading.value = true;
|
|
@@ -32721,6 +32739,7 @@ const _sfc_main$a = /* @__PURE__ */ defineComponent({
|
|
|
32721
32739
|
yield dynamicDataStore.enhanceSearchResultsWithDynamicData({
|
|
32722
32740
|
result: { items: result2.recommended }
|
|
32723
32741
|
});
|
|
32742
|
+
(_b = (_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onRecommenderResults) == null ? void 0 : _b.call(_a, result2.recommended);
|
|
32724
32743
|
} finally {
|
|
32725
32744
|
loading.value = false;
|
|
32726
32745
|
}
|
|
@@ -40409,17 +40428,8 @@ const mountProductList = (configuration, options, optionOverrides, fetch2 = true
|
|
|
40409
40428
|
);
|
|
40410
40429
|
productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40411
40430
|
});
|
|
40412
|
-
const mountRecommendations = (
|
|
40431
|
+
const mountRecommendations = (resolvedSearchResultsConfiguration, resolvedConfiguration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
40413
40432
|
var _a;
|
|
40414
|
-
if (!configuration.recommendations) {
|
|
40415
|
-
return;
|
|
40416
|
-
}
|
|
40417
|
-
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40418
|
-
configuration.searchResults
|
|
40419
|
-
);
|
|
40420
|
-
const resolvedConfiguration = JSON.parse(
|
|
40421
|
-
configuration.recommendations
|
|
40422
|
-
);
|
|
40423
40433
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40424
40434
|
const visible = yield waitForElementToBeVisible(
|
|
40425
40435
|
resolvedConfiguration.containerSelector,
|
|
@@ -40438,6 +40448,37 @@ const mountRecommendations = (configuration, options, optionOverrides, fetch2 =
|
|
|
40438
40448
|
);
|
|
40439
40449
|
recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40440
40450
|
});
|
|
40451
|
+
const mountAllRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
40452
|
+
if (!configuration.recommendations) {
|
|
40453
|
+
return;
|
|
40454
|
+
}
|
|
40455
|
+
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40456
|
+
configuration.searchResults
|
|
40457
|
+
);
|
|
40458
|
+
const resolvedConfiguration = JSON.parse(configuration.recommendations);
|
|
40459
|
+
if (Array.isArray(resolvedConfiguration)) {
|
|
40460
|
+
const mountPromises = resolvedConfiguration.map(
|
|
40461
|
+
(recommendation) => mountRecommendations(
|
|
40462
|
+
resolvedSearchResultsConfiguration,
|
|
40463
|
+
recommendation,
|
|
40464
|
+
options,
|
|
40465
|
+
optionOverrides,
|
|
40466
|
+
fetch2,
|
|
40467
|
+
remount
|
|
40468
|
+
)
|
|
40469
|
+
);
|
|
40470
|
+
yield Promise.all(mountPromises);
|
|
40471
|
+
} else {
|
|
40472
|
+
yield mountRecommendations(
|
|
40473
|
+
resolvedSearchResultsConfiguration,
|
|
40474
|
+
resolvedConfiguration,
|
|
40475
|
+
options,
|
|
40476
|
+
optionOverrides,
|
|
40477
|
+
fetch2,
|
|
40478
|
+
remount
|
|
40479
|
+
);
|
|
40480
|
+
}
|
|
40481
|
+
});
|
|
40441
40482
|
const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(void 0, null, function* () {
|
|
40442
40483
|
if (!configuration.genAiChat) {
|
|
40443
40484
|
return;
|
|
@@ -40479,7 +40520,7 @@ const mount = (_0, ..._1) => __async(void 0, [_0, ..._1], function* (configurati
|
|
|
40479
40520
|
mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
|
|
40480
40521
|
mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
|
|
40481
40522
|
mountProductList(configuration, options, optionOverrides, fetch2, remount),
|
|
40482
|
-
|
|
40523
|
+
mountAllRecommendations(configuration, options, optionOverrides, fetch2, remount),
|
|
40483
40524
|
mountChat(configuration, options, fetch2, remount)
|
|
40484
40525
|
];
|
|
40485
40526
|
yield Promise.all(mountPromises);
|
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -25365,6 +25365,8 @@ and ensure you are accounting for this risk.
|
|
|
25365
25365
|
return extractFromStorage(options);
|
|
25366
25366
|
case "htmlElementText":
|
|
25367
25367
|
return extractFromHtmlElementText(options);
|
|
25368
|
+
case "htmlElementAttribute":
|
|
25369
|
+
return extractFromHtmlElementAttribute(options);
|
|
25368
25370
|
case "cookie":
|
|
25369
25371
|
return extractFromCookie(options);
|
|
25370
25372
|
default:
|
|
@@ -25408,6 +25410,17 @@ and ensure you are accounting for this risk.
|
|
|
25408
25410
|
const element = document.querySelector(options.querySelector);
|
|
25409
25411
|
return element ? ((_a = element.textContent) == null ? void 0 : _a.trim()) || options.default : options.default;
|
|
25410
25412
|
};
|
|
25413
|
+
const extractFromHtmlElementAttribute = (options) => {
|
|
25414
|
+
const element = document.querySelector(options.querySelector);
|
|
25415
|
+
if (!element) {
|
|
25416
|
+
return options.default;
|
|
25417
|
+
}
|
|
25418
|
+
const attr = options.attribute;
|
|
25419
|
+
if (attr === "value" && (element == null ? void 0 : element.value)) {
|
|
25420
|
+
return element.value;
|
|
25421
|
+
}
|
|
25422
|
+
return element.getAttribute(attr) || options.default;
|
|
25423
|
+
};
|
|
25411
25424
|
const getValueFromPath = (obj, path) => {
|
|
25412
25425
|
return path.split(".").reduce((value, key) => value && value[key] || null, obj);
|
|
25413
25426
|
};
|
|
@@ -32641,6 +32654,7 @@ and ensure you are accounting for this risk.
|
|
|
32641
32654
|
}
|
|
32642
32655
|
};
|
|
32643
32656
|
onMounted(() => {
|
|
32657
|
+
var _a, _b;
|
|
32644
32658
|
handleResize();
|
|
32645
32659
|
optionsStore.setSearchResultOptions({
|
|
32646
32660
|
options: props.options
|
|
@@ -32653,6 +32667,9 @@ and ensure you are accounting for this risk.
|
|
|
32653
32667
|
} else {
|
|
32654
32668
|
loadRecommendations();
|
|
32655
32669
|
}
|
|
32670
|
+
if ((_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onMounted) {
|
|
32671
|
+
(_b = props.options.recommendationCallbacks) == null ? void 0 : _b.onMounted();
|
|
32672
|
+
}
|
|
32656
32673
|
window.addEventListener("resize", handleResize);
|
|
32657
32674
|
});
|
|
32658
32675
|
onBeforeUnmount(() => {
|
|
@@ -32708,6 +32725,7 @@ and ensure you are accounting for this risk.
|
|
|
32708
32725
|
return typeof props.options.itemId === "string" || typeof props.options.itemId === "number" || Array.isArray(props.options.itemId) ? props.options.itemId : extractValue(props.options.itemId);
|
|
32709
32726
|
});
|
|
32710
32727
|
const loadLupaRecommendations = () => __async2(this, null, function* () {
|
|
32728
|
+
var _a, _b;
|
|
32711
32729
|
recommendationsType.value = "recommendations_lupasearch";
|
|
32712
32730
|
try {
|
|
32713
32731
|
loading.value = true;
|
|
@@ -32725,6 +32743,7 @@ and ensure you are accounting for this risk.
|
|
|
32725
32743
|
yield dynamicDataStore.enhanceSearchResultsWithDynamicData({
|
|
32726
32744
|
result: { items: result2.recommended }
|
|
32727
32745
|
});
|
|
32746
|
+
(_b = (_a = props.options.recommendationCallbacks) == null ? void 0 : _a.onRecommenderResults) == null ? void 0 : _b.call(_a, result2.recommended);
|
|
32728
32747
|
} finally {
|
|
32729
32748
|
loading.value = false;
|
|
32730
32749
|
}
|
|
@@ -40413,17 +40432,8 @@ and ensure you are accounting for this risk.
|
|
|
40413
40432
|
);
|
|
40414
40433
|
productList(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40415
40434
|
});
|
|
40416
|
-
const mountRecommendations = (
|
|
40435
|
+
const mountRecommendations = (resolvedSearchResultsConfiguration, resolvedConfiguration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40417
40436
|
var _a;
|
|
40418
|
-
if (!configuration.recommendations) {
|
|
40419
|
-
return;
|
|
40420
|
-
}
|
|
40421
|
-
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40422
|
-
configuration.searchResults
|
|
40423
|
-
);
|
|
40424
|
-
const resolvedConfiguration = JSON.parse(
|
|
40425
|
-
configuration.recommendations
|
|
40426
|
-
);
|
|
40427
40437
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40428
40438
|
const visible = yield waitForElementToBeVisible(
|
|
40429
40439
|
resolvedConfiguration.containerSelector,
|
|
@@ -40442,6 +40452,37 @@ and ensure you are accounting for this risk.
|
|
|
40442
40452
|
);
|
|
40443
40453
|
recommendations(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40444
40454
|
});
|
|
40455
|
+
const mountAllRecommendations = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40456
|
+
if (!configuration.recommendations) {
|
|
40457
|
+
return;
|
|
40458
|
+
}
|
|
40459
|
+
const resolvedSearchResultsConfiguration = JSON.parse(
|
|
40460
|
+
configuration.searchResults
|
|
40461
|
+
);
|
|
40462
|
+
const resolvedConfiguration = JSON.parse(configuration.recommendations);
|
|
40463
|
+
if (Array.isArray(resolvedConfiguration)) {
|
|
40464
|
+
const mountPromises = resolvedConfiguration.map(
|
|
40465
|
+
(recommendation) => mountRecommendations(
|
|
40466
|
+
resolvedSearchResultsConfiguration,
|
|
40467
|
+
recommendation,
|
|
40468
|
+
options,
|
|
40469
|
+
optionOverrides,
|
|
40470
|
+
fetch2,
|
|
40471
|
+
remount
|
|
40472
|
+
)
|
|
40473
|
+
);
|
|
40474
|
+
yield Promise.all(mountPromises);
|
|
40475
|
+
} else {
|
|
40476
|
+
yield mountRecommendations(
|
|
40477
|
+
resolvedSearchResultsConfiguration,
|
|
40478
|
+
resolvedConfiguration,
|
|
40479
|
+
options,
|
|
40480
|
+
optionOverrides,
|
|
40481
|
+
fetch2,
|
|
40482
|
+
remount
|
|
40483
|
+
);
|
|
40484
|
+
}
|
|
40485
|
+
});
|
|
40445
40486
|
const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40446
40487
|
if (!configuration.genAiChat) {
|
|
40447
40488
|
return;
|
|
@@ -40483,7 +40524,7 @@ and ensure you are accounting for this risk.
|
|
|
40483
40524
|
mountSearchBox(configuration, options, optionOverrides, fetch2, remount),
|
|
40484
40525
|
mountSearchResults(configuration, options, optionOverrides, fetch2, remount),
|
|
40485
40526
|
mountProductList(configuration, options, optionOverrides, fetch2, remount),
|
|
40486
|
-
|
|
40527
|
+
mountAllRecommendations(configuration, options, optionOverrides, fetch2, remount),
|
|
40487
40528
|
mountChat(configuration, options, fetch2, remount)
|
|
40488
40529
|
];
|
|
40489
40530
|
yield Promise.all(mountPromises);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.11",
|
|
4
4
|
"main": "dist/lupaSearch.js",
|
|
5
5
|
"module": "dist/index.mjs",
|
|
6
6
|
"types": "dist/src/index.d.ts",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@getlupa/client-sdk": "^1.3.4",
|
|
23
|
-
"@getlupa/vue": "0.17.
|
|
23
|
+
"@getlupa/vue": "0.17.11",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|