@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.js
CHANGED
|
@@ -7836,7 +7836,7 @@ const getAmount = (price, separator = ".") => {
|
|
|
7836
7836
|
}
|
|
7837
7837
|
return (_b = value.toFixed(2)) == null ? void 0 : _b.replace(".", separator);
|
|
7838
7838
|
};
|
|
7839
|
-
const formatPrice = (price, currency = "€", separator = ",") => {
|
|
7839
|
+
const formatPrice = (price, currency = "€", separator = ",", currencyTemplate = "") => {
|
|
7840
7840
|
if (price !== 0 && !price) {
|
|
7841
7841
|
return "";
|
|
7842
7842
|
}
|
|
@@ -7844,16 +7844,24 @@ const formatPrice = (price, currency = "€", separator = ",") => {
|
|
|
7844
7844
|
if (!amount) {
|
|
7845
7845
|
return "";
|
|
7846
7846
|
}
|
|
7847
|
+
if (currencyTemplate) {
|
|
7848
|
+
return addParamsToLabel(currencyTemplate, amount);
|
|
7849
|
+
}
|
|
7847
7850
|
return `${amount} ${currency}`;
|
|
7848
7851
|
};
|
|
7849
|
-
const formatPriceSummary = ([min, max], currency, separator = ",") => {
|
|
7852
|
+
const formatPriceSummary = ([min, max], currency, separator = ",", currencyTemplate = "") => {
|
|
7850
7853
|
if (min !== void 0 && max !== void 0) {
|
|
7851
|
-
return `${formatPrice(min, currency, separator)} - ${formatPrice(
|
|
7854
|
+
return `${formatPrice(min, currency, separator, currencyTemplate)} - ${formatPrice(
|
|
7855
|
+
max,
|
|
7856
|
+
currency,
|
|
7857
|
+
separator,
|
|
7858
|
+
currencyTemplate
|
|
7859
|
+
)}`;
|
|
7852
7860
|
}
|
|
7853
7861
|
if (min !== void 0) {
|
|
7854
|
-
return `> ${formatPrice(min, currency, separator)}`;
|
|
7862
|
+
return `> ${formatPrice(min, currency, separator, currencyTemplate)}`;
|
|
7855
7863
|
}
|
|
7856
|
-
return `< ${formatPrice(max, currency, separator)}`;
|
|
7864
|
+
return `< ${formatPrice(max, currency, separator, currencyTemplate)}`;
|
|
7857
7865
|
};
|
|
7858
7866
|
const formatRange = (filter2) => {
|
|
7859
7867
|
var _a, _b;
|
|
@@ -7883,7 +7891,12 @@ const unfoldRangeFilter = (key, filter2, price = {}) => {
|
|
|
7883
7891
|
return [
|
|
7884
7892
|
{
|
|
7885
7893
|
key,
|
|
7886
|
-
value: formatPriceSummary(
|
|
7894
|
+
value: formatPriceSummary(
|
|
7895
|
+
[gt, lt],
|
|
7896
|
+
price.currency,
|
|
7897
|
+
price.separator,
|
|
7898
|
+
price.currencyTemplate
|
|
7899
|
+
),
|
|
7887
7900
|
type: "range"
|
|
7888
7901
|
}
|
|
7889
7902
|
];
|
|
@@ -14489,6 +14502,7 @@ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
|
14489
14502
|
},
|
|
14490
14503
|
emits: ["go-to-results"],
|
|
14491
14504
|
setup(__props, { emit: emit2 }) {
|
|
14505
|
+
const props = __props;
|
|
14492
14506
|
const historyStore = useHistoryStore();
|
|
14493
14507
|
const searchBoxStore = useSearchBoxStore();
|
|
14494
14508
|
const { highlightedIndex } = storeToRefs(searchBoxStore);
|
|
@@ -14504,6 +14518,14 @@ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
|
14504
14518
|
onBeforeMount(() => {
|
|
14505
14519
|
window.removeEventListener("keydown", handleKeyDown);
|
|
14506
14520
|
});
|
|
14521
|
+
const historyLimit = computed(() => {
|
|
14522
|
+
var _a;
|
|
14523
|
+
return (_a = props.options.historyLimit) != null ? _a : 5;
|
|
14524
|
+
});
|
|
14525
|
+
const limitedHistory = computed(() => {
|
|
14526
|
+
var _a;
|
|
14527
|
+
return ((_a = history.value) != null ? _a : []).slice(0, historyLimit.value);
|
|
14528
|
+
});
|
|
14507
14529
|
const remove2 = ({ item }) => {
|
|
14508
14530
|
historyStore.remove({ item });
|
|
14509
14531
|
};
|
|
@@ -14524,7 +14546,7 @@ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
|
|
|
14524
14546
|
};
|
|
14525
14547
|
return (_ctx, _cache) => {
|
|
14526
14548
|
return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1g, [
|
|
14527
|
-
(openBlock(true), createElementBlock(Fragment, null, renderList(
|
|
14549
|
+
(openBlock(true), createElementBlock(Fragment, null, renderList(limitedHistory.value, (item, index) => {
|
|
14528
14550
|
return openBlock(), createBlock(_sfc_main$1t, {
|
|
14529
14551
|
key: item,
|
|
14530
14552
|
item,
|
|
@@ -24081,11 +24103,12 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
|
|
|
24081
24103
|
setup(__props) {
|
|
24082
24104
|
const props = __props;
|
|
24083
24105
|
const price = computed(() => {
|
|
24084
|
-
var _a, _b;
|
|
24106
|
+
var _a, _b, _c;
|
|
24085
24107
|
return formatPrice(
|
|
24086
24108
|
props.item[props.options.key],
|
|
24087
24109
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24088
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24110
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24111
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24089
24112
|
);
|
|
24090
24113
|
});
|
|
24091
24114
|
return (_ctx, _cache) => {
|
|
@@ -24108,11 +24131,12 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
|
|
|
24108
24131
|
return props.options.className;
|
|
24109
24132
|
});
|
|
24110
24133
|
const price = computed(() => {
|
|
24111
|
-
var _a, _b;
|
|
24134
|
+
var _a, _b, _c;
|
|
24112
24135
|
return formatPrice(
|
|
24113
24136
|
props.item[props.options.key],
|
|
24114
24137
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
24115
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
24138
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
24139
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
24116
24140
|
);
|
|
24117
24141
|
});
|
|
24118
24142
|
return (_ctx, _cache) => {
|
|
@@ -24276,12 +24300,17 @@ const useSearchResultStore = defineStore("searchResult", () => {
|
|
|
24276
24300
|
var _a, _b, _c;
|
|
24277
24301
|
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.priceSeparator) != null ? _c : "";
|
|
24278
24302
|
});
|
|
24303
|
+
const currencyTemplate = computed(() => {
|
|
24304
|
+
var _a, _b, _c;
|
|
24305
|
+
return (_c = (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currencyTemplate) != null ? _c : "";
|
|
24306
|
+
});
|
|
24279
24307
|
const labeledFilters = computed(
|
|
24280
24308
|
() => getLabeledFilters(
|
|
24281
24309
|
unfoldFilters(filters.value, {
|
|
24282
24310
|
keys: priceKeys.value,
|
|
24283
24311
|
currency: currency.value,
|
|
24284
|
-
separator: priceSeparator.value
|
|
24312
|
+
separator: priceSeparator.value,
|
|
24313
|
+
currencyTemplate: currencyTemplate.value
|
|
24285
24314
|
}),
|
|
24286
24315
|
facets2.value
|
|
24287
24316
|
)
|
|
@@ -24829,11 +24858,12 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
|
|
|
24829
24858
|
return 0;
|
|
24830
24859
|
});
|
|
24831
24860
|
const discountStringValue = computed(() => {
|
|
24832
|
-
var _a, _b, _c, _d;
|
|
24861
|
+
var _a, _b, _c, _d, _e, _f;
|
|
24833
24862
|
return props.badge.discountType === "percentage" ? discountValue.value.toFixed(0) : formatPrice(
|
|
24834
24863
|
discountValue.value,
|
|
24835
24864
|
(_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currency,
|
|
24836
|
-
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator
|
|
24865
|
+
(_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator,
|
|
24866
|
+
(_f = (_e = searchResultOptions.value) == null ? void 0 : _e.labels) == null ? void 0 : _f.currencyTemplate
|
|
24837
24867
|
);
|
|
24838
24868
|
});
|
|
24839
24869
|
const hasDiscount = computed(() => {
|
|
@@ -25221,6 +25251,9 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
|
|
|
25221
25251
|
}
|
|
25222
25252
|
emit2("product-click");
|
|
25223
25253
|
handleRoutingEvent(link, event, boxRoutingBehavior.value === "event");
|
|
25254
|
+
if (props.panelOptions.programmaticNavigation) {
|
|
25255
|
+
window.location.assign(link);
|
|
25256
|
+
}
|
|
25224
25257
|
};
|
|
25225
25258
|
return (_ctx, _cache) => {
|
|
25226
25259
|
return openBlock(), createElementBlock("div", _hoisted_1$Z, [
|
|
@@ -25841,6 +25874,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
25841
25874
|
const suggestedValue = ref(defaultSuggestedValue);
|
|
25842
25875
|
const opened = ref(props.isSearchContainer);
|
|
25843
25876
|
const focused = ref(false);
|
|
25877
|
+
const openedAt = ref(null);
|
|
25844
25878
|
const searchBoxInput = ref(null);
|
|
25845
25879
|
const { highlightedDocument } = storeToRefs(searchBoxStore);
|
|
25846
25880
|
const searchValue = computed(() => {
|
|
@@ -25877,7 +25911,7 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
25877
25911
|
});
|
|
25878
25912
|
const goToResultsDebounced = debounce$1(paramsStore.goToResults, (_a = props.options.debounce) != null ? _a : 300);
|
|
25879
25913
|
onMounted(() => {
|
|
25880
|
-
var _a2;
|
|
25914
|
+
var _a2, _b, _c;
|
|
25881
25915
|
window.addEventListener("keydown", handleKeyDown);
|
|
25882
25916
|
window.addEventListener("click", handleMouseClick);
|
|
25883
25917
|
paramsStore.setSearchResultsLink(props.options.links.searchResults);
|
|
@@ -25888,6 +25922,9 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
25888
25922
|
if (props.isSearchContainer && searchBoxInput.value) {
|
|
25889
25923
|
(_a2 = searchBoxInput.value) == null ? void 0 : _a2.focus();
|
|
25890
25924
|
}
|
|
25925
|
+
if ((_b = props.options.callbacks) == null ? void 0 : _b.onMounted) {
|
|
25926
|
+
(_c = props.options.callbacks) == null ? void 0 : _c.onMounted();
|
|
25927
|
+
}
|
|
25891
25928
|
});
|
|
25892
25929
|
onBeforeUnmount(() => {
|
|
25893
25930
|
window.removeEventListener("keydown", handleKeyDown);
|
|
@@ -25895,11 +25932,14 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
25895
25932
|
unbindSearchTriggers(searchTriggers.value, handleCurrentValueSearch);
|
|
25896
25933
|
});
|
|
25897
25934
|
const handleMouseClick = (e2) => {
|
|
25898
|
-
var _a2, _b;
|
|
25935
|
+
var _a2, _b, _c, _d;
|
|
25899
25936
|
const el = document.getElementById("lupa-search-box");
|
|
25900
25937
|
const elementClass = (_b = (_a2 = e2.target) == null ? void 0 : _a2.className) != null ? _b : "";
|
|
25901
25938
|
const hasLupaClass = typeof elementClass.includes == "function" && elementClass.includes("lupa-search-box");
|
|
25902
25939
|
const isOutsideElement = el && !el.contains(e2.target) && !hasLupaClass;
|
|
25940
|
+
if (openedAt.value && Date.now() - (openedAt == null ? void 0 : openedAt.value) < 500) {
|
|
25941
|
+
return;
|
|
25942
|
+
}
|
|
25903
25943
|
if (isOutsideElement && props.options.keepOpen) {
|
|
25904
25944
|
focused.value = false;
|
|
25905
25945
|
}
|
|
@@ -25908,11 +25948,18 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
25908
25948
|
}
|
|
25909
25949
|
opened.value = false;
|
|
25910
25950
|
suggestedValue.value = defaultSuggestedValue;
|
|
25951
|
+
if ((_c = props.options.callbacks) == null ? void 0 : _c.onClosed) {
|
|
25952
|
+
(_d = props.options.callbacks) == null ? void 0 : _d.onClosed();
|
|
25953
|
+
}
|
|
25911
25954
|
};
|
|
25912
25955
|
const close = () => {
|
|
25956
|
+
var _a2, _b;
|
|
25913
25957
|
opened.value = false;
|
|
25914
25958
|
focused.value = false;
|
|
25915
25959
|
suggestedValue.value = defaultSuggestedValue;
|
|
25960
|
+
if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onClosed) {
|
|
25961
|
+
(_b = props.options.callbacks) == null ? void 0 : _b.onClosed();
|
|
25962
|
+
}
|
|
25916
25963
|
};
|
|
25917
25964
|
const handleKeyDown = (e2) => {
|
|
25918
25965
|
var _a2, _b;
|
|
@@ -25931,15 +25978,22 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
25931
25978
|
handleSearch();
|
|
25932
25979
|
resetValues();
|
|
25933
25980
|
break;
|
|
25981
|
+
case "Escape":
|
|
25982
|
+
opened.value = false;
|
|
25983
|
+
focused.value = false;
|
|
25984
|
+
break;
|
|
25934
25985
|
}
|
|
25935
25986
|
};
|
|
25936
25987
|
const handleInput = (value) => {
|
|
25937
|
-
var _a2;
|
|
25988
|
+
var _a2, _b;
|
|
25938
25989
|
opened.value = true;
|
|
25939
25990
|
focused.value = true;
|
|
25940
25991
|
inputValue.value = (_a2 = value == null ? void 0 : value.replace(/\s+$/, "")) != null ? _a2 : "";
|
|
25941
25992
|
suggestedValue.value = defaultSuggestedValue;
|
|
25942
25993
|
searchBoxStore.resetHighlightIndex();
|
|
25994
|
+
if ((_b = props.options.callbacks) == null ? void 0 : _b.onSearchBoxInput) {
|
|
25995
|
+
props.options.callbacks.onSearchBoxInput(value);
|
|
25996
|
+
}
|
|
25943
25997
|
trackSearchQuery(value);
|
|
25944
25998
|
if (props.isSearchContainer) {
|
|
25945
25999
|
goToResultsDebounced({
|
|
@@ -26072,6 +26126,13 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
26072
26126
|
});
|
|
26073
26127
|
};
|
|
26074
26128
|
watch(() => props.options.debounce, handleCurrentValueSearch);
|
|
26129
|
+
watch(opened, () => {
|
|
26130
|
+
if (opened.value) {
|
|
26131
|
+
openedAt.value = Date.now();
|
|
26132
|
+
} else {
|
|
26133
|
+
openedAt.value = null;
|
|
26134
|
+
}
|
|
26135
|
+
});
|
|
26075
26136
|
const resetValues = () => {
|
|
26076
26137
|
inputValue.value = "";
|
|
26077
26138
|
suggestedValue.value = defaultSuggestedValue;
|
|
@@ -26083,6 +26144,20 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
26083
26144
|
const slotProps = (props2) => {
|
|
26084
26145
|
return __spreadValues2({}, props2);
|
|
26085
26146
|
};
|
|
26147
|
+
const onFocus = () => {
|
|
26148
|
+
var _a2, _b;
|
|
26149
|
+
opened.value = true;
|
|
26150
|
+
if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onFocused) {
|
|
26151
|
+
(_b = props.options.callbacks) == null ? void 0 : _b.onFocused();
|
|
26152
|
+
}
|
|
26153
|
+
};
|
|
26154
|
+
const onBlur = () => {
|
|
26155
|
+
var _a2, _b;
|
|
26156
|
+
focused.value = false;
|
|
26157
|
+
if ((_a2 = props.options.callbacks) == null ? void 0 : _a2.onBlurred) {
|
|
26158
|
+
(_b = props.options.callbacks) == null ? void 0 : _b.onBlurred();
|
|
26159
|
+
}
|
|
26160
|
+
};
|
|
26086
26161
|
return (_ctx, _cache) => {
|
|
26087
26162
|
var _a2;
|
|
26088
26163
|
return openBlock(), createElementBlock("div", _hoisted_1$W, [
|
|
@@ -26095,10 +26170,10 @@ const _sfc_main$10 = /* @__PURE__ */ defineComponent({
|
|
|
26095
26170
|
ref_key: "searchBoxInput",
|
|
26096
26171
|
ref: searchBoxInput,
|
|
26097
26172
|
onInput: handleInput,
|
|
26098
|
-
onBlur
|
|
26099
|
-
onFocus
|
|
26173
|
+
onBlur,
|
|
26174
|
+
onFocus,
|
|
26100
26175
|
onSearch: handleSearch,
|
|
26101
|
-
onClose: _cache[
|
|
26176
|
+
onClose: _cache[0] || (_cache[0] = ($event) => _ctx.$emit("close"))
|
|
26102
26177
|
}, null, 8, ["options", "suggestedValue", "can-close", "emit-input-on-focus"]),
|
|
26103
26178
|
opened.value || _ctx.isSearchContainer ? (openBlock(), createBlock(_sfc_main$11, {
|
|
26104
26179
|
key: 0,
|
|
@@ -27854,6 +27929,10 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
27854
27929
|
var _a;
|
|
27855
27930
|
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currency;
|
|
27856
27931
|
});
|
|
27932
|
+
const currencyTemplate = computed(() => {
|
|
27933
|
+
var _a;
|
|
27934
|
+
return (_a = searchResultOptions.value) == null ? void 0 : _a.labels.currencyTemplate;
|
|
27935
|
+
});
|
|
27857
27936
|
const priceKeys = computed(() => {
|
|
27858
27937
|
var _a, _b;
|
|
27859
27938
|
return (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.priceKeys) != null ? _b : [];
|
|
@@ -27936,7 +28015,7 @@ const _sfc_main$T = /* @__PURE__ */ defineComponent({
|
|
|
27936
28015
|
});
|
|
27937
28016
|
const statsSummary = computed(() => {
|
|
27938
28017
|
const [min, max] = sliderRange.value;
|
|
27939
|
-
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value) : formatRange({ gte: min, lte: max });
|
|
28018
|
+
return isPrice.value ? formatPriceSummary([min, max], currency.value, separator.value, currencyTemplate.value) : formatRange({ gte: min, lte: max });
|
|
27940
28019
|
});
|
|
27941
28020
|
const separator = computed(() => {
|
|
27942
28021
|
var _a, _b, _c;
|
|
@@ -29589,11 +29668,12 @@ const _sfc_main$x = /* @__PURE__ */ defineComponent({
|
|
|
29589
29668
|
setup(__props) {
|
|
29590
29669
|
const props = __props;
|
|
29591
29670
|
const price = computed(() => {
|
|
29592
|
-
var _a, _b;
|
|
29671
|
+
var _a, _b, _c;
|
|
29593
29672
|
return formatPrice(
|
|
29594
29673
|
props.item[props.options.key],
|
|
29595
29674
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
29596
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
29675
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
29676
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
29597
29677
|
);
|
|
29598
29678
|
});
|
|
29599
29679
|
return (_ctx, _cache) => {
|
|
@@ -29614,11 +29694,12 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
|
|
|
29614
29694
|
return props.options.className;
|
|
29615
29695
|
});
|
|
29616
29696
|
const price = computed(() => {
|
|
29617
|
-
var _a, _b;
|
|
29697
|
+
var _a, _b, _c;
|
|
29618
29698
|
return formatPrice(
|
|
29619
29699
|
props.item[props.options.key],
|
|
29620
29700
|
(_a = props.labels) == null ? void 0 : _a.currency,
|
|
29621
|
-
(_b = props.labels) == null ? void 0 : _b.priceSeparator
|
|
29701
|
+
(_b = props.labels) == null ? void 0 : _b.priceSeparator,
|
|
29702
|
+
(_c = props.labels) == null ? void 0 : _c.currencyTemplate
|
|
29622
29703
|
);
|
|
29623
29704
|
});
|
|
29624
29705
|
return (_ctx, _cache) => {
|
|
@@ -39561,6 +39642,33 @@ const attatchShadowDom = ({
|
|
|
39561
39642
|
shadow.appendChild(style);
|
|
39562
39643
|
}
|
|
39563
39644
|
};
|
|
39645
|
+
const createDomPing = () => {
|
|
39646
|
+
let intervalId = null;
|
|
39647
|
+
let remaining = 0;
|
|
39648
|
+
return (intervalMs = 100, count = 50) => {
|
|
39649
|
+
if (intervalId !== null) {
|
|
39650
|
+
clearInterval(intervalId);
|
|
39651
|
+
}
|
|
39652
|
+
remaining = count;
|
|
39653
|
+
const flush = () => {
|
|
39654
|
+
if (remaining-- <= 0) {
|
|
39655
|
+
if (intervalId !== null) {
|
|
39656
|
+
clearInterval(intervalId);
|
|
39657
|
+
intervalId = null;
|
|
39658
|
+
}
|
|
39659
|
+
return;
|
|
39660
|
+
}
|
|
39661
|
+
const el = document.createElement("div");
|
|
39662
|
+
el.style.cssText = "position:absolute;width:0;height:0;overflow:hidden;pointer-events:none;";
|
|
39663
|
+
el.setAttribute("data-nudge", Date.now().toString());
|
|
39664
|
+
document.body.appendChild(el);
|
|
39665
|
+
document.body.removeChild(el);
|
|
39666
|
+
};
|
|
39667
|
+
flush();
|
|
39668
|
+
intervalId = window.setInterval(flush, intervalMs);
|
|
39669
|
+
};
|
|
39670
|
+
};
|
|
39671
|
+
const startDomPing = createDomPing();
|
|
39564
39672
|
const getMountElement = (element, mountingBehavior = "replace", mountToParent) => {
|
|
39565
39673
|
const parent = element == null ? void 0 : element.parentElement;
|
|
39566
39674
|
if (mountingBehavior === "replace") {
|
|
@@ -39616,6 +39724,58 @@ const app = {
|
|
|
39616
39724
|
recommendations: {},
|
|
39617
39725
|
chat: {}
|
|
39618
39726
|
};
|
|
39727
|
+
const addSearchBoxDomPingIfConfigured = (options, mountOptions) => {
|
|
39728
|
+
var _a;
|
|
39729
|
+
if (!((_a = mountOptions == null ? void 0 : mountOptions.domPing) == null ? void 0 : _a.count)) {
|
|
39730
|
+
return options;
|
|
39731
|
+
}
|
|
39732
|
+
const newOptions = __spreadProps(__spreadValues({}, options), {
|
|
39733
|
+
callbacks: {
|
|
39734
|
+
onMounted: () => {
|
|
39735
|
+
var _a2, _b;
|
|
39736
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onMounted) == null ? void 0 : _b.call(_a2);
|
|
39737
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39738
|
+
},
|
|
39739
|
+
onBlurred: () => {
|
|
39740
|
+
var _a2, _b;
|
|
39741
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onBlurred) == null ? void 0 : _b.call(_a2);
|
|
39742
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39743
|
+
},
|
|
39744
|
+
onFocused: () => {
|
|
39745
|
+
var _a2, _b;
|
|
39746
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onFocused) == null ? void 0 : _b.call(_a2);
|
|
39747
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39748
|
+
},
|
|
39749
|
+
onSearchBoxInput: (...args) => {
|
|
39750
|
+
var _a2, _b;
|
|
39751
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onSearchBoxInput) == null ? void 0 : _b.call(_a2, ...args);
|
|
39752
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39753
|
+
}
|
|
39754
|
+
}
|
|
39755
|
+
});
|
|
39756
|
+
return newOptions;
|
|
39757
|
+
};
|
|
39758
|
+
const addSearchResultsDomPingIfConfigured = (options, mountOptions) => {
|
|
39759
|
+
var _a;
|
|
39760
|
+
if (!((_a = mountOptions == null ? void 0 : mountOptions.domPing) == null ? void 0 : _a.count)) {
|
|
39761
|
+
return options;
|
|
39762
|
+
}
|
|
39763
|
+
const newOptions = __spreadProps(__spreadValues({}, options), {
|
|
39764
|
+
callbacks: {
|
|
39765
|
+
onMounted: () => {
|
|
39766
|
+
var _a2, _b;
|
|
39767
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onMounted) == null ? void 0 : _b.call(_a2);
|
|
39768
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39769
|
+
},
|
|
39770
|
+
onUrlQueryChange: (...args) => {
|
|
39771
|
+
var _a2, _b;
|
|
39772
|
+
(_b = (_a2 = options.callbacks) == null ? void 0 : _a2.onUrlQueryChange) == null ? void 0 : _b.call(_a2, ...args);
|
|
39773
|
+
startDomPing(mountOptions.domPing.intervalMs, mountOptions.domPing.count);
|
|
39774
|
+
}
|
|
39775
|
+
}
|
|
39776
|
+
});
|
|
39777
|
+
return newOptions;
|
|
39778
|
+
};
|
|
39619
39779
|
const applySearchBox = (options, mountOptions) => {
|
|
39620
39780
|
const existingInstance = app.box[options.inputSelector];
|
|
39621
39781
|
if (existingInstance) {
|
|
@@ -39645,9 +39805,10 @@ const searchBox = (options, mountOptions) => {
|
|
|
39645
39805
|
if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
|
|
39646
39806
|
return;
|
|
39647
39807
|
}
|
|
39808
|
+
const transformedOptions = addSearchBoxDomPingIfConfigured(options, mountOptions);
|
|
39648
39809
|
const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
|
|
39649
39810
|
for (const input2 of inputs) {
|
|
39650
|
-
applySearchBox(__spreadProps(__spreadValues({},
|
|
39811
|
+
applySearchBox(__spreadProps(__spreadValues({}, transformedOptions), { inputSelector: input2.trim() }), mountOptions);
|
|
39651
39812
|
}
|
|
39652
39813
|
};
|
|
39653
39814
|
const searchResults = (options, mountOptions) => {
|
|
@@ -39665,12 +39826,13 @@ const searchResults = (options, mountOptions) => {
|
|
|
39665
39826
|
}
|
|
39666
39827
|
return;
|
|
39667
39828
|
}
|
|
39829
|
+
const transformedOptions = addSearchResultsDomPingIfConfigured(options, mountOptions);
|
|
39668
39830
|
const instance = createVue(
|
|
39669
39831
|
options.containerSelector,
|
|
39670
39832
|
mountOptions == null ? void 0 : mountOptions.mountingBehavior,
|
|
39671
39833
|
_sfc_main$3,
|
|
39672
39834
|
{
|
|
39673
|
-
searchResultsOptions:
|
|
39835
|
+
searchResultsOptions: transformedOptions
|
|
39674
39836
|
}
|
|
39675
39837
|
);
|
|
39676
39838
|
if (!instance) {
|
|
@@ -40110,6 +40272,7 @@ const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true,
|
|
|
40110
40272
|
}
|
|
40111
40273
|
const resolvedConfiguration = JSON.parse(configuration.searchBox);
|
|
40112
40274
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40275
|
+
const domPing = resolvedConfiguration.domPing;
|
|
40113
40276
|
const visible = yield waitForElementToBeVisible(
|
|
40114
40277
|
resolvedConfiguration.inputSelector,
|
|
40115
40278
|
0,
|
|
@@ -40125,7 +40288,7 @@ const mountSearchBox = (configuration, options, optionOverrides, fetch2 = true,
|
|
|
40125
40288
|
resolvedConfiguration,
|
|
40126
40289
|
(_a = optionOverrides == null ? void 0 : optionOverrides.searchBox) != null ? _a : {}
|
|
40127
40290
|
);
|
|
40128
|
-
searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40291
|
+
searchBox(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls, domPing });
|
|
40129
40292
|
});
|
|
40130
40293
|
const mountSearchResults = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
40131
40294
|
var _a;
|
|
@@ -40134,6 +40297,7 @@ const mountSearchResults = (configuration, options, optionOverrides, fetch2 = tr
|
|
|
40134
40297
|
}
|
|
40135
40298
|
const resolvedConfiguration = JSON.parse(configuration.searchResults);
|
|
40136
40299
|
const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
|
|
40300
|
+
const domPing = resolvedConfiguration.domPing;
|
|
40137
40301
|
const visible = yield waitForElementToBeVisible(
|
|
40138
40302
|
resolvedConfiguration.containerSelector,
|
|
40139
40303
|
0,
|
|
@@ -40149,7 +40313,7 @@ const mountSearchResults = (configuration, options, optionOverrides, fetch2 = tr
|
|
|
40149
40313
|
resolvedConfiguration,
|
|
40150
40314
|
(_a = optionOverrides == null ? void 0 : optionOverrides.searchResults) != null ? _a : {}
|
|
40151
40315
|
);
|
|
40152
|
-
searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls });
|
|
40316
|
+
searchResults(__spreadProps(__spreadValues({}, mergedOptions), { options }), { fetch: fetch2, allowedMountUrls, domPing });
|
|
40153
40317
|
});
|
|
40154
40318
|
const mountProductList = (configuration, options, optionOverrides, fetch2 = true, remount = false) => __async(exports, null, function* () {
|
|
40155
40319
|
var _a;
|