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