@getlupa/client 1.17.0 → 1.17.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/dist/lupaSearch.iife.js +193 -29
- package/dist/lupaSearch.js +193 -29
- package/dist/lupaSearch.mjs +193 -29
- package/dist/lupaSearch.umd.js +193 -29
- package/dist/src/index.d.ts +28 -0
- package/dist/src/modules/pluginManager/PluginConfigurationMerger.d.ts +8 -0
- package/dist/src/mounting.d.ts +4 -0
- package/dist/src/types/ResolvedOptions.d.ts +8 -0
- package/dist/src/utils/mounting.utils.d.ts +2 -0
- package/package.json +2 -2
package/dist/lupaSearch.umd.js
CHANGED
|
@@ -7838,7 +7838,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7838
7838
|
}
|
|
7839
7839
|
return (_b = value.toFixed(2)) == null ? void 0 : _b.replace(".", separator);
|
|
7840
7840
|
};
|
|
7841
|
-
const formatPrice = (price, currency = "€", separator = ",") => {
|
|
7841
|
+
const formatPrice = (price, currency = "€", separator = ",", currencyTemplate = "") => {
|
|
7842
7842
|
if (price !== 0 && !price) {
|
|
7843
7843
|
return "";
|
|
7844
7844
|
}
|
|
@@ -7846,16 +7846,24 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7846
7846
|
if (!amount) {
|
|
7847
7847
|
return "";
|
|
7848
7848
|
}
|
|
7849
|
+
if (currencyTemplate) {
|
|
7850
|
+
return addParamsToLabel(currencyTemplate, amount);
|
|
7851
|
+
}
|
|
7849
7852
|
return `${amount} ${currency}`;
|
|
7850
7853
|
};
|
|
7851
|
-
const formatPriceSummary = ([min, max], currency, separator = ",") => {
|
|
7854
|
+
const formatPriceSummary = ([min, max], currency, separator = ",", currencyTemplate = "") => {
|
|
7852
7855
|
if (min !== void 0 && max !== void 0) {
|
|
7853
|
-
return `${formatPrice(min, currency, separator)} - ${formatPrice(
|
|
7856
|
+
return `${formatPrice(min, currency, separator, currencyTemplate)} - ${formatPrice(
|
|
7857
|
+
max,
|
|
7858
|
+
currency,
|
|
7859
|
+
separator,
|
|
7860
|
+
currencyTemplate
|
|
7861
|
+
)}`;
|
|
7854
7862
|
}
|
|
7855
7863
|
if (min !== void 0) {
|
|
7856
|
-
return `> ${formatPrice(min, currency, separator)}`;
|
|
7864
|
+
return `> ${formatPrice(min, currency, separator, currencyTemplate)}`;
|
|
7857
7865
|
}
|
|
7858
|
-
return `< ${formatPrice(max, currency, separator)}`;
|
|
7866
|
+
return `< ${formatPrice(max, currency, separator, currencyTemplate)}`;
|
|
7859
7867
|
};
|
|
7860
7868
|
const formatRange = (filter2) => {
|
|
7861
7869
|
var _a, _b;
|
|
@@ -7885,7 +7893,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
7885
7893
|
return [
|
|
7886
7894
|
{
|
|
7887
7895
|
key,
|
|
7888
|
-
value: formatPriceSummary(
|
|
7896
|
+
value: formatPriceSummary(
|
|
7897
|
+
[gt, lt],
|
|
7898
|
+
price.currency,
|
|
7899
|
+
price.separator,
|
|
7900
|
+
price.currencyTemplate
|
|
7901
|
+
),
|
|
7889
7902
|
type: "range"
|
|
7890
7903
|
}
|
|
7891
7904
|
];
|
|
@@ -14491,6 +14504,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14491
14504
|
},
|
|
14492
14505
|
emits: ["go-to-results"],
|
|
14493
14506
|
setup(__props, { emit: emit2 }) {
|
|
14507
|
+
const props = __props;
|
|
14494
14508
|
const historyStore = useHistoryStore();
|
|
14495
14509
|
const searchBoxStore = useSearchBoxStore();
|
|
14496
14510
|
const { highlightedIndex } = storeToRefs(searchBoxStore);
|
|
@@ -14506,6 +14520,14 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14506
14520
|
onBeforeMount(() => {
|
|
14507
14521
|
window.removeEventListener("keydown", handleKeyDown);
|
|
14508
14522
|
});
|
|
14523
|
+
const historyLimit = computed(() => {
|
|
14524
|
+
var _a;
|
|
14525
|
+
return (_a = props.options.historyLimit) != null ? _a : 5;
|
|
14526
|
+
});
|
|
14527
|
+
const limitedHistory = computed(() => {
|
|
14528
|
+
var _a;
|
|
14529
|
+
return ((_a = history.value) != null ? _a : []).slice(0, historyLimit.value);
|
|
14530
|
+
});
|
|
14509
14531
|
const remove2 = ({ item }) => {
|
|
14510
14532
|
historyStore.remove({ item });
|
|
14511
14533
|
};
|
|
@@ -14526,7 +14548,7 @@ var __async = (__this, __arguments, generator) => {
|
|
|
14526
14548
|
};
|
|
14527
14549
|
return (_ctx, _cache) => {
|
|
14528
14550
|
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1g, [
|
|
14529
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
14551
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(limitedHistory.value, (item, index) => {
|
|
14530
14552
|
return openBlock(), createBlock(_sfc_main$1t, {
|
|
14531
14553
|
key: item,
|
|
14532
14554
|
item,
|
|
@@ -24083,11 +24105,12 @@ and ensure you are accounting for this risk.
|
|
|
24083
24105
|
setup(__props) {
|
|
24084
24106
|
const props = __props;
|
|
24085
24107
|
const price = computed(() => {
|
|
24086
|
-
var _a, _b;
|
|
24108
|
+
var _a, _b, _c;
|
|
24087
24109
|
return formatPrice(
|
|
24088
24110
|
props.item[props.options.key],
|
|
24089
24111
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24090
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24112
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24113
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24091
24114
|
);
|
|
24092
24115
|
});
|
|
24093
24116
|
return (_ctx, _cache) => {
|
|
@@ -24110,11 +24133,12 @@ and ensure you are accounting for this risk.
|
|
|
24110
24133
|
return props.options.className;
|
|
24111
24134
|
});
|
|
24112
24135
|
const price = computed(() => {
|
|
24113
|
-
var _a, _b;
|
|
24136
|
+
var _a, _b, _c;
|
|
24114
24137
|
return formatPrice(
|
|
24115
24138
|
props.item[props.options.key],
|
|
24116
24139
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24117
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24140
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24141
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24118
24142
|
);
|
|
24119
24143
|
});
|
|
24120
24144
|
return (_ctx, _cache) => {
|
|
@@ -24278,12 +24302,17 @@ and ensure you are accounting for this risk.
|
|
|
24278
24302
|
var _a, _b, _c;
|
|
24279
24303
|
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.priceSeparator) != null ? _c : "";
|
|
24280
24304
|
});
|
|
24305
|
+
const currencyTemplate = computed(() => {
|
|
24306
|
+
var _a, _b, _c;
|
|
24307
|
+
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currencyTemplate) != null ? _c : "";
|
|
24308
|
+
});
|
|
24281
24309
|
const labeledFilters = computed(
|
|
24282
24310
|
() => getLabeledFilters(
|
|
24283
24311
|
unfoldFilters(filters.value, {
|
|
24284
24312
|
keys: priceKeys.value,
|
|
24285
24313
|
currency: currency.value,
|
|
24286
|
-
separator: priceSeparator.value
|
|
24314
|
+
separator: priceSeparator.value,
|
|
24315
|
+
currencyTemplate: currencyTemplate.value
|
|
24287
24316
|
}),
|
|
24288
24317
|
facets2.value
|
|
24289
24318
|
)
|
|
@@ -24831,11 +24860,12 @@ and ensure you are accounting for this risk.
|
|
|
24831
24860
|
return 0;
|
|
24832
24861
|
});
|
|
24833
24862
|
const discountStringValue = computed(() => {
|
|
24834
|
-
var _a, _b, _c, _d;
|
|
24863
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24835
24864
|
return props.badge.discountType === "percentage" ? discountValue.value.toFixed(0) : formatPrice(
|
|
24836
24865
|
discountValue.value,
|
|
24837
24866
|
(_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currency,
|
|
24838
|
-
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator
|
|
24867
|
+
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator,
|
|
24868
|
+
(_f = (_e = searchResultOptions.value) == null ? void 0 : _e.labels) == null ? void 0 : _f.currencyTemplate
|
|
24839
24869
|
);
|
|
24840
24870
|
});
|
|
24841
24871
|
const hasDiscount = computed(() => {
|
|
@@ -25223,6 +25253,9 @@ and ensure you are accounting for this risk.
|
|
|
25223
25253
|
}
|
|
25224
25254
|
emit2("product-click");
|
|
25225
25255
|
handleRoutingEvent(link, event, boxRoutingBehavior.value === "event");
|
|
25256
|
+
if (props.panelOptions.programmaticNavigation) {
|
|
25257
|
+
window.location.assign(link);
|
|
25258
|
+
}
|
|
25226
25259
|
};
|
|
25227
25260
|
return (_ctx, _cache) => {
|
|
25228
25261
|
return openBlock(), createElementBlock("div", _hoisted_1$Z, [
|
|
@@ -25843,6 +25876,7 @@ and ensure you are accounting for this risk.
|
|
|
25843
25876
|
const suggestedValue = ref(defaultSuggestedValue);
|
|
25844
25877
|
const opened = ref(props.isSearchContainer);
|
|
25845
25878
|
const focused = ref(false);
|
|
25879
|
+
const openedAt = ref(null);
|
|
25846
25880
|
const searchBoxInput = ref(null);
|
|
25847
25881
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
25848
25882
|
const searchValue = computed(() => {
|
|
@@ -25879,7 +25913,7 @@ and ensure you are accounting for this risk.
|
|
|
25879
25913
|
});
|
|
25880
25914
|
const goToResultsDebounced = debounce$1(paramsStore.goToResults, (_a = props.options.debounce) != null ? _a : 300);
|
|
25881
25915
|
onMounted(() => {
|
|
25882
|
-
var _a2;
|
|
25916
|
+
var _a2, _b, _c;
|
|
25883
25917
|
window.addEventListener("keydown", handleKeyDown);
|
|
25884
25918
|
window.addEventListener("click", handleMouseClick);
|
|
25885
25919
|
paramsStore.setSearchResultsLink(props.options.links.searchResults);
|
|
@@ -25890,6 +25924,9 @@ and ensure you are accounting for this risk.
|
|
|
25890
25924
|
if (props.isSearchContainer && searchBoxInput.value) {
|
|
25891
25925
|
(_a2 = searchBoxInput.value) == null ? void 0 : _a2.focus();
|
|
25892
25926
|
}
|
|
25927
|
+
if ((_b = props.options.callbacks) == null ? void 0 : _b.onMounted) {
|
|
25928
|
+
(_c = props.options.callbacks) == null ? void 0 : _c.onMounted();
|
|
25929
|
+
}
|
|
25893
25930
|
});
|
|
25894
25931
|
onBeforeUnmount(() => {
|
|
25895
25932
|
window.removeEventListener("keydown", handleKeyDown);
|
|
@@ -25897,11 +25934,14 @@ and ensure you are accounting for this risk.
|
|
|
25897
25934
|
unbindSearchTriggers(searchTriggers.value, handleCurrentValueSearch);
|
|
25898
25935
|
});
|
|
25899
25936
|
const handleMouseClick = (e2) => {
|
|
25900
|
-
var _a2, _b;
|
|
25937
|
+
var _a2, _b, _c, _d;
|
|
25901
25938
|
const el = document.getElementById("lupa-search-box");
|
|
25902
25939
|
const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
|
|
25903
25940
|
const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
|
|
25904
25941
|
const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
|
|
25942
|
+
if (openedAt.value && Date.now() - (openedAt == null ? void 0 : openedAt.value) < 500) {
|
|
25943
|
+
return;
|
|
25944
|
+
}
|
|
25905
25945
|
if (isOutsideElement && props.options.keepOpen) {
|
|
25906
25946
|
focused.value = false;
|
|
25907
25947
|
}
|
|
@@ -25910,11 +25950,18 @@ and ensure you are accounting for this risk.
|
|
|
25910
25950
|
}
|
|
25911
25951
|
opened.value = false;
|
|
25912
25952
|
suggestedValue.value = defaultSuggestedValue;
|
|
25953
|
+
if ((_c = props.options.callbacks) == null ? void 0 : _c.onClosed) {
|
|
25954
|
+
(_d = props.options.callbacks) == null ? void 0 : _d.onClosed();
|
|
25955
|
+
}
|
|
25913
25956
|
};
|
|
25914
25957
|
const close = () => {
|
|
25958
|
+
var _a2, _b;
|
|
25915
25959
|
opened.value = false;
|
|
25916
25960
|
focused.value = false;
|
|
25917
25961
|
suggestedValue.value = defaultSuggestedValue;
|
|
25962
|
+
if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onClosed) {
|
|
25963
|
+
(_b = props.options.callbacks) == null ? void 0 : _b.onClosed();
|
|
25964
|
+
}
|
|
25918
25965
|
};
|
|
25919
25966
|
const handleKeyDown = (e2) => {
|
|
25920
25967
|
var _a2, _b;
|
|
@@ -25933,15 +25980,22 @@ and ensure you are accounting for this risk.
|
|
|
25933
25980
|
handleSearch();
|
|
25934
25981
|
resetValues();
|
|
25935
25982
|
break;
|
|
25983
|
+
case "Escape":
|
|
25984
|
+
opened.value = false;
|
|
25985
|
+
focused.value = false;
|
|
25986
|
+
break;
|
|
25936
25987
|
}
|
|
25937
25988
|
};
|
|
25938
25989
|
const handleInput = (value) => {
|
|
25939
|
-
var _a2;
|
|
25990
|
+
var _a2, _b;
|
|
25940
25991
|
opened.value = true;
|
|
25941
25992
|
focused.value = true;
|
|
25942
25993
|
inputValue.value = (_a2 = value == null ? void 0 : value.replace(/\s+$/, "")) != null ? _a2 : "";
|
|
25943
25994
|
suggestedValue.value = defaultSuggestedValue;
|
|
25944
25995
|
searchBoxStore.resetHighlightIndex();
|
|
25996
|
+
if ((_b = props.options.callbacks) == null ? void 0 : _b.onSearchBoxInput) {
|
|
25997
|
+
props.options.callbacks.onSearchBoxInput(value);
|
|
25998
|
+
}
|
|
25945
25999
|
trackSearchQuery(value);
|
|
25946
26000
|
if (props.isSearchContainer) {
|
|
25947
26001
|
goToResultsDebounced({
|
|
@@ -26074,6 +26128,13 @@ and ensure you are accounting for this risk.
|
|
|
26074
26128
|
});
|
|
26075
26129
|
};
|
|
26076
26130
|
watch(() => props.options.debounce, handleCurrentValueSearch);
|
|
26131
|
+
watch(opened, () => {
|
|
26132
|
+
if (opened.value) {
|
|
26133
|
+
openedAt.value = Date.now();
|
|
26134
|
+
} else {
|
|
26135
|
+
openedAt.value = null;
|
|
26136
|
+
}
|
|
26137
|
+
});
|
|
26077
26138
|
const resetValues = () => {
|
|
26078
26139
|
inputValue.value = "";
|
|
26079
26140
|
suggestedValue.value = defaultSuggestedValue;
|
|
@@ -26085,6 +26146,20 @@ and ensure you are accounting for this risk.
|
|
|
26085
26146
|
const slotProps = (props2) => {
|
|
26086
26147
|
return __spreadValues2({}, props2);
|
|
26087
26148
|
};
|
|
26149
|
+
const onFocus = () => {
|
|
26150
|
+
var _a2, _b;
|
|
26151
|
+
opened.value = true;
|
|
26152
|
+
if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onFocused) {
|
|
26153
|
+
(_b = props.options.callbacks) == null ? void 0 : _b.onFocused();
|
|
26154
|
+
}
|
|
26155
|
+
};
|
|
26156
|
+
const onBlur = () => {
|
|
26157
|
+
var _a2, _b;
|
|
26158
|
+
focused.value = false;
|
|
26159
|
+
if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onBlurred) {
|
|
26160
|
+
(_b = props.options.callbacks) == null ? void 0 : _b.onBlurred();
|
|
26161
|
+
}
|
|
26162
|
+
};
|
|
26088
26163
|
return (_ctx, _cache) => {
|
|
26089
26164
|
var _a2;
|
|
26090
26165
|
return openBlock(), createElementBlock("div", _hoisted_1$W, [
|
|
@@ -26097,10 +26172,10 @@ and ensure you are accounting for this risk.
|
|
|
26097
26172
|
ref_key: "searchBoxInput",
|
|
26098
26173
|
ref: searchBoxInput,
|
|
26099
26174
|
onInput: handleInput,
|
|
26100
|
-
onBlur
|
|
26101
|
-
onFocus
|
|
26175
|
+
onBlur,
|
|
26176
|
+
onFocus,
|
|
26102
26177
|
onSearch: handleSearch,
|
|
26103
|
-
onClose: _cache[
|
|
26178
|
+
onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
|
|
26104
26179
|
}, null, 8, ["options", "suggestedValue", "can-close", "emit-input-on-focus"]),
|
|
26105
26180
|
opened.value || _ctx.isSearchContainer ? (openBlock(), createBlock(_sfc_main$11, {
|
|
26106
26181
|
key: 0,
|
|
@@ -27856,6 +27931,10 @@ and ensure you are accounting for this risk.
|
|
|
27856
27931
|
var _a;
|
|
27857
27932
|
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currency;
|
|
27858
27933
|
});
|
|
27934
|
+
const currencyTemplate = computed(() => {
|
|
27935
|
+
var _a;
|
|
27936
|
+
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currencyTemplate;
|
|
27937
|
+
});
|
|
27859
27938
|
const priceKeys = computed(() => {
|
|
27860
27939
|
var _a, _b;
|
|
27861
27940
|
return (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.priceKeys) != null ? _b : [];
|
|
@@ -27938,7 +28017,7 @@ and ensure you are accounting for this risk.
|
|
|
27938
28017
|
});
|
|
27939
28018
|
const statsSummary = computed(() => {
|
|
27940
28019
|
const [min, max] = sliderRange.value;
|
|
27941
|
-
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value) : formatRange({ gte: min, lte: max });
|
|
28020
|
+
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value, currencyTemplate.value) : formatRange({ gte: min, lte: max });
|
|
27942
28021
|
});
|
|
27943
28022
|
const separator = computed(() => {
|
|
27944
28023
|
var _a, _b, _c;
|
|
@@ -29591,11 +29670,12 @@ and ensure you are accounting for this risk.
|
|
|
29591
29670
|
setup(__props) {
|
|
29592
29671
|
const props = __props;
|
|
29593
29672
|
const price = computed(() => {
|
|
29594
|
-
var _a, _b;
|
|
29673
|
+
var _a, _b, _c;
|
|
29595
29674
|
return formatPrice(
|
|
29596
29675
|
props.item[props.options.key],
|
|
29597
29676
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
29598
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
29677
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
29678
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
29599
29679
|
);
|
|
29600
29680
|
});
|
|
29601
29681
|
return (_ctx, _cache) => {
|
|
@@ -29616,11 +29696,12 @@ and ensure you are accounting for this risk.
|
|
|
29616
29696
|
return props.options.className;
|
|
29617
29697
|
});
|
|
29618
29698
|
const price = computed(() => {
|
|
29619
|
-
var _a, _b;
|
|
29699
|
+
var _a, _b, _c;
|
|
29620
29700
|
return formatPrice(
|
|
29621
29701
|
props.item[props.options.key],
|
|
29622
29702
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
29623
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
29703
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
29704
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
29624
29705
|
);
|
|
29625
29706
|
});
|
|
29626
29707
|
return (_ctx, _cache) => {
|
|
@@ -39563,6 +39644,33 @@ and ensure you are accounting for this risk.
|
|
|
39563
39644
|
shadow.appendChild(style);
|
|
39564
39645
|
}
|
|
39565
39646
|
};
|
|
39647
|
+
const createDomPing = () => {
|
|
39648
|
+
let intervalId = null;
|
|
39649
|
+
let remaining = 0;
|
|
39650
|
+
return (intervalMs = 100, count = 50) => {
|
|
39651
|
+
if (intervalId !== null) {
|
|
39652
|
+
clearInterval(intervalId);
|
|
39653
|
+
}
|
|
39654
|
+
remaining = count;
|
|
39655
|
+
const flush = () => {
|
|
39656
|
+
if (remaining-- <= 0) {
|
|
39657
|
+
if (intervalId !== null) {
|
|
39658
|
+
clearInterval(intervalId);
|
|
39659
|
+
intervalId = null;
|
|
39660
|
+
}
|
|
39661
|
+
return;
|
|
39662
|
+
}
|
|
39663
|
+
const el = document.createElement("div");
|
|
39664
|
+
el.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;pointer-events:none;";
|
|
39665
|
+
el.setAttribute("data-nudge", Date.now().toString());
|
|
39666
|
+
document.body.appendChild(el);
|
|
39667
|
+
document.body.removeChild(el);
|
|
39668
|
+
};
|
|
39669
|
+
flush();
|
|
39670
|
+
intervalId = window.setInterval(flush, intervalMs);
|
|
39671
|
+
};
|
|
39672
|
+
};
|
|
39673
|
+
const startDomPing = createDomPing();
|
|
39566
39674
|
const getMountElement = (element, mountingBehavior = "replace", mountToParent) => {
|
|
39567
39675
|
const parent = element == null ? void 0 : element.parentElement;
|
|
39568
39676
|
if (mountingBehavior === "replace") {
|
|
@@ -39618,6 +39726,58 @@ and ensure you are accounting for this risk.
|
|
|
39618
39726
|
recommendations: {},
|
|
39619
39727
|
chat: {}
|
|
39620
39728
|
};
|
|
39729
|
+
const addSearchBoxDomPingIfConfigured = (options, mountOptions) => {
|
|
39730
|
+
var _a;
|
|
39731
|
+
if (!((_a = mountOptions == null ? void 0 : mountOptions.domPing) == null ? void 0 : _a.count)) {
|
|
39732
|
+
return options;
|
|
39733
|
+
}
|
|
39734
|
+
const newOptions = __spreadProps(__spreadValues({}, options), {
|
|
39735
|
+
callbacks: {
|
|
39736
|
+
onMounted: () => {
|
|
39737
|
+
var _a2, _b;
|
|
39738
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onMounted) == null ? void 0 : _b.call(_a2);
|
|
39739
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39740
|
+
},
|
|
39741
|
+
onBlurred: () => {
|
|
39742
|
+
var _a2, _b;
|
|
39743
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onBlurred) == null ? void 0 : _b.call(_a2);
|
|
39744
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39745
|
+
},
|
|
39746
|
+
onFocused: () => {
|
|
39747
|
+
var _a2, _b;
|
|
39748
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onFocused) == null ? void 0 : _b.call(_a2);
|
|
39749
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39750
|
+
},
|
|
39751
|
+
onSearchBoxInput: (...args) => {
|
|
39752
|
+
var _a2, _b;
|
|
39753
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onSearchBoxInput) == null ? void 0 : _b.call(_a2, ...args);
|
|
39754
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39755
|
+
}
|
|
39756
|
+
}
|
|
39757
|
+
});
|
|
39758
|
+
return newOptions;
|
|
39759
|
+
};
|
|
39760
|
+
const addSearchResultsDomPingIfConfigured = (options, mountOptions) => {
|
|
39761
|
+
var _a;
|
|
39762
|
+
if (!((_a = mountOptions == null ? void 0 : mountOptions.domPing) == null ? void 0 : _a.count)) {
|
|
39763
|
+
return options;
|
|
39764
|
+
}
|
|
39765
|
+
const newOptions = __spreadProps(__spreadValues({}, options), {
|
|
39766
|
+
callbacks: {
|
|
39767
|
+
onMounted: () => {
|
|
39768
|
+
var _a2, _b;
|
|
39769
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onMounted) == null ? void 0 : _b.call(_a2);
|
|
39770
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39771
|
+
},
|
|
39772
|
+
onUrlQueryChange: (...args) => {
|
|
39773
|
+
var _a2, _b;
|
|
39774
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onUrlQueryChange) == null ? void 0 : _b.call(_a2, ...args);
|
|
39775
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39776
|
+
}
|
|
39777
|
+
}
|
|
39778
|
+
});
|
|
39779
|
+
return newOptions;
|
|
39780
|
+
};
|
|
39621
39781
|
const applySearchBox = (options, mountOptions) => {
|
|
39622
39782
|
const existingInstance = app.box[options.inputSelector];
|
|
39623
39783
|
if (existingInstance) {
|
|
@@ -39647,9 +39807,10 @@ and ensure you are accounting for this risk.
|
|
|
39647
39807
|
if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
|
|
39648
39808
|
return;
|
|
39649
39809
|
}
|
|
39810
|
+
const transformedOptions = addSearchBoxDomPingIfConfigured(options, mountOptions);
|
|
39650
39811
|
const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
|
|
39651
39812
|
for (const input2 of inputs) {
|
|
39652
|
-
applySearchBox(__spreadProps(__spreadValues({},
|
|
39813
|
+
applySearchBox(__spreadProps(__spreadValues({}, transformedOptions), { inputSelector: input2.trim() }), mountOptions);
|
|
39653
39814
|
}
|
|
39654
39815
|
};
|
|
39655
39816
|
const searchResults = (options, mountOptions) => {
|
|
@@ -39667,12 +39828,13 @@ and ensure you are accounting for this risk.
|
|
|
39667
39828
|
}
|
|
39668
39829
|
return;
|
|
39669
39830
|
}
|
|
39831
|
+
const transformedOptions = addSearchResultsDomPingIfConfigured(options, mountOptions);
|
|
39670
39832
|
const instance = createVue(
|
|
39671
39833
|
options.containerSelector,
|
|
39672
39834
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
39673
39835
|
_sfc_main$3,
|
|
39674
39836
|
{
|
|
39675
|
-
searchResultsOptions:
|
|
39837
|
+
searchResultsOptions: transformedOptions
|
|
39676
39838
|
}
|
|
39677
39839
|
);
|
|
39678
39840
|
if (!instance) {
|
|
@@ -40112,6 +40274,7 @@ and ensure you are accounting for this risk.
|
|
|
40112
40274
|
}
|
|
40113
40275
|
const resolvedConfiguration = JSON.parse(configuration.searchBox);
|
|
40114
40276
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40277
|
+
const domPing = resolvedConfiguration.domPing;
|
|
40115
40278
|
const visible = yield waitForElementToBeVisible(
|
|
40116
40279
|
resolvedConfiguration.inputSelector,
|
|
40117
40280
|
0,
|
|
@@ -40127,7 +40290,7 @@ and ensure you are accounting for this risk.
|
|
|
40127
40290
|
resolvedConfiguration,
|
|
40128
40291
|
(_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {}
|
|
40129
40292
|
);
|
|
40130
|
-
searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40293
|
+
searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls, domPing });
|
|
40131
40294
|
});
|
|
40132
40295
|
const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40133
40296
|
var _a;
|
|
@@ -40136,6 +40299,7 @@ and ensure you are accounting for this risk.
|
|
|
40136
40299
|
}
|
|
40137
40300
|
const resolvedConfiguration = JSON.parse(configuration.searchResults);
|
|
40138
40301
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40302
|
+
const domPing = resolvedConfiguration.domPing;
|
|
40139
40303
|
const visible = yield waitForElementToBeVisible(
|
|
40140
40304
|
resolvedConfiguration.containerSelector,
|
|
40141
40305
|
0,
|
|
@@ -40151,7 +40315,7 @@ and ensure you are accounting for this risk.
|
|
|
40151
40315
|
resolvedConfiguration,
|
|
40152
40316
|
(_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {}
|
|
40153
40317
|
);
|
|
40154
|
-
searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40318
|
+
searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls, domPing });
|
|
40155
40319
|
});
|
|
40156
40320
|
const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(this, null, function* () {
|
|
40157
40321
|
var _a;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -12,27 +12,47 @@ declare const lupaSearch: {
|
|
|
12
12
|
fetch?: boolean;
|
|
13
13
|
mountingBehavior?: "replace" | "append" | "prepend";
|
|
14
14
|
allowedMountUrls?: string[];
|
|
15
|
+
domPing?: {
|
|
16
|
+
intervalMs?: number;
|
|
17
|
+
count?: number;
|
|
18
|
+
};
|
|
15
19
|
}) => void;
|
|
16
20
|
searchResults: (options: SearchResultsOptions, mountOptions?: {
|
|
17
21
|
fetch?: boolean;
|
|
18
22
|
mountingBehavior?: "replace" | "append" | "prepend";
|
|
19
23
|
allowedMountUrls?: string[];
|
|
24
|
+
domPing?: {
|
|
25
|
+
intervalMs?: number;
|
|
26
|
+
count?: number;
|
|
27
|
+
};
|
|
20
28
|
}) => void;
|
|
21
29
|
tracking: (options: TrackingOptions) => void;
|
|
22
30
|
productList: (options: ProductListOptions, mountOptions?: {
|
|
23
31
|
fetch?: boolean;
|
|
24
32
|
mountingBehavior?: "replace" | "append" | "prepend";
|
|
25
33
|
allowedMountUrls?: string[];
|
|
34
|
+
domPing?: {
|
|
35
|
+
intervalMs?: number;
|
|
36
|
+
count?: number;
|
|
37
|
+
};
|
|
26
38
|
}) => void;
|
|
27
39
|
searchContainer: (options: SearchContainerOptions, mountOptions?: {
|
|
28
40
|
fetch?: boolean;
|
|
29
41
|
mountingBehavior?: "replace" | "append" | "prepend";
|
|
30
42
|
allowedMountUrls?: string[];
|
|
43
|
+
domPing?: {
|
|
44
|
+
intervalMs?: number;
|
|
45
|
+
count?: number;
|
|
46
|
+
};
|
|
31
47
|
}) => void;
|
|
32
48
|
recommendations: (options: ProductRecommendationOptions, mountOptions?: {
|
|
33
49
|
fetch?: boolean;
|
|
34
50
|
mountingBehavior?: "replace" | "append" | "prepend";
|
|
35
51
|
allowedMountUrls?: string[];
|
|
52
|
+
domPing?: {
|
|
53
|
+
intervalMs?: number;
|
|
54
|
+
count?: number;
|
|
55
|
+
};
|
|
36
56
|
}) => void;
|
|
37
57
|
clearSearchBox: (selector?: string) => void;
|
|
38
58
|
clearSearchResults: (selector?: string) => void;
|
|
@@ -43,12 +63,20 @@ declare const lupaSearch: {
|
|
|
43
63
|
fetch?: boolean;
|
|
44
64
|
mountingBehavior?: "replace" | "append" | "prepend";
|
|
45
65
|
allowedMountUrls?: string[];
|
|
66
|
+
domPing?: {
|
|
67
|
+
intervalMs?: number;
|
|
68
|
+
count?: number;
|
|
69
|
+
};
|
|
46
70
|
}) => void;
|
|
47
71
|
clearChat: (selector?: string) => void;
|
|
48
72
|
preconfiguredSearchContainer: (preconfiguredSearchContainerOptions: PreconfiguredSearchContainerOptions, mountOptions?: {
|
|
49
73
|
fetch?: boolean;
|
|
50
74
|
mountingBehavior?: "replace" | "append" | "prepend";
|
|
51
75
|
allowedMountUrls?: string[];
|
|
76
|
+
domPing?: {
|
|
77
|
+
intervalMs?: number;
|
|
78
|
+
count?: number;
|
|
79
|
+
};
|
|
52
80
|
}) => void;
|
|
53
81
|
getSearchBoxComponent: ({ searchBoxOptions, labels, panelOptions, redirections, placeholderImage }: PreconfiguredSearchContainerOptions) => SearchBoxOptions;
|
|
54
82
|
getSearchResultsComponent: ({ searchResultOptions, labels, redirections, placeholderImage, configuratorOverrides, callbacks, additionalFields }: PreconfiguredSearchContainerOptions) => SearchResultsOptions;
|
|
@@ -24,6 +24,10 @@ declare const _default: {
|
|
|
24
24
|
keepOpen?: boolean;
|
|
25
25
|
} & {
|
|
26
26
|
allowedMountUrls?: string[];
|
|
27
|
+
domPing?: {
|
|
28
|
+
intervalMs?: number;
|
|
29
|
+
count?: number;
|
|
30
|
+
};
|
|
27
31
|
} & {
|
|
28
32
|
minInputLength?: number;
|
|
29
33
|
labels?: import("@getlupa/vue/dist/src/types/search-box/SearchBoxOptions").SearchBoxOptionLabels;
|
|
@@ -82,6 +86,10 @@ declare const _default: {
|
|
|
82
86
|
initialFilters?: import("@getlupa/client-sdk/Types").FilterGroup | Record<string, import("@getlupa/vue/dist/src/types/DataExtraction").DataExtraction>;
|
|
83
87
|
} & {
|
|
84
88
|
allowedMountUrls?: string[];
|
|
89
|
+
domPing?: {
|
|
90
|
+
intervalMs?: number;
|
|
91
|
+
count?: number;
|
|
92
|
+
};
|
|
85
93
|
} & Partial<SearchResultsOptions>;
|
|
86
94
|
};
|
|
87
95
|
export default _default;
|
package/dist/src/mounting.d.ts
CHANGED
|
@@ -5,6 +5,10 @@ type MountOptions = {
|
|
|
5
5
|
fetch?: boolean;
|
|
6
6
|
mountingBehavior?: 'replace' | 'append' | 'prepend';
|
|
7
7
|
allowedMountUrls?: string[];
|
|
8
|
+
domPing?: {
|
|
9
|
+
intervalMs?: number;
|
|
10
|
+
count?: number;
|
|
11
|
+
};
|
|
8
12
|
};
|
|
9
13
|
export declare const applySearchBox: (options: SearchBoxOptions, mountOptions?: MountOptions) => void;
|
|
10
14
|
export declare const searchBox: (options: SearchBoxOptions, mountOptions?: MountOptions) => void;
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { ProductListOptions, ProductRecommendationOptions, SearchBoxOptions, SearchResultsOptions } from '@getlupa/vue';
|
|
2
2
|
export type ResolvedSearchBoxOptions = SearchBoxOptions & {
|
|
3
3
|
allowedMountUrls?: string[];
|
|
4
|
+
domPing?: {
|
|
5
|
+
intervalMs?: number;
|
|
6
|
+
count?: number;
|
|
7
|
+
};
|
|
4
8
|
};
|
|
5
9
|
export type ResolvedSearchResultOptions = SearchResultsOptions & {
|
|
6
10
|
allowedMountUrls?: string[];
|
|
11
|
+
domPing?: {
|
|
12
|
+
intervalMs?: number;
|
|
13
|
+
count?: number;
|
|
14
|
+
};
|
|
7
15
|
};
|
|
8
16
|
export type ResolvedProductListOptions = ProductListOptions & {
|
|
9
17
|
allowedMountUrls?: string[];
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { type Component } from 'vue';
|
|
2
|
+
export declare const createDomPing: () => (intervalMs?: number, count?: number) => void;
|
|
3
|
+
export declare const startDomPing: (intervalMs?: number, count?: number) => void;
|
|
2
4
|
export declare const createVue: (selector: string | Element, mountingBehavior: string, rootComponent: Component, options: Record<string, unknown>, mountToParent?: boolean) => {
|
|
3
5
|
mountedApp: import("vue").ComponentPublicInstance<{}, {}, {}, {}, {}, {}, {}, {}, false, import("vue").ComponentOptionsBase<any, any, any, any, any, any, any, any, any, {}, {}, string, {}>, {}, {}>;
|
|
4
6
|
mountedComponent: any;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@getlupa/client",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.4",
|
|
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.4",
|
|
24
24
|
"@rushstack/eslint-patch": "^1.3.2",
|
|
25
25
|
"@tsconfig/node18": "^2.0.1",
|
|
26
26
|
"@types/jsdom": "^21.1.1",
|