@getlupa/client 1.14.7 → 1.14.13

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.
@@ -7653,12 +7653,11 @@ var __async = (__this, __arguments, generator) => {
7653
7653
  return SearchBoxPanelType2;
7654
7654
  })(SearchBoxPanelType || {});
7655
7655
  var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
7656
- BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
7657
- BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
7658
7656
  BadgeType2["NEWITEM"] = "newItem";
7659
7657
  BadgeType2["TEXT"] = "text";
7660
7658
  BadgeType2["IMAGE"] = "image";
7661
7659
  BadgeType2["CUSTOM_HTML"] = "customHtml";
7660
+ BadgeType2["DISCOUNT"] = "discount";
7662
7661
  return BadgeType2;
7663
7662
  })(BadgeType || {});
7664
7663
  const retrieveHistory = () => {
@@ -8611,7 +8610,7 @@ var __async = (__this, __arguments, generator) => {
8611
8610
  key: 0,
8612
8611
  class: "lupa-close-label"
8613
8612
  };
8614
- const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8613
+ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
8615
8614
  __name: "SearchBoxInput",
8616
8615
  props: {
8617
8616
  options: {},
@@ -8741,7 +8740,7 @@ var __async = (__this, __arguments, generator) => {
8741
8740
  };
8742
8741
  }
8743
8742
  });
8744
- const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8743
+ const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8745
8744
  __name: "SearchBoxMoreResults",
8746
8745
  props: {
8747
8746
  labels: {},
@@ -8775,7 +8774,7 @@ var __async = (__this, __arguments, generator) => {
8775
8774
  });
8776
8775
  const _hoisted_1$1f = { class: "lupa-search-box-history-item" };
8777
8776
  const _hoisted_2$T = { class: "lupa-search-box-history-item-content" };
8778
- const _sfc_main$1p = /* @__PURE__ */ defineComponent({
8777
+ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8779
8778
  __name: "SearchBoxHistoryItem",
8780
8779
  props: {
8781
8780
  item: {},
@@ -8810,7 +8809,7 @@ var __async = (__this, __arguments, generator) => {
8810
8809
  key: 0,
8811
8810
  class: "lupa-search-box-history-panel"
8812
8811
  };
8813
- const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8812
+ const _sfc_main$1p = /* @__PURE__ */ defineComponent({
8814
8813
  __name: "SearchBoxHistoryPanel",
8815
8814
  props: {
8816
8815
  options: {}
@@ -8853,7 +8852,7 @@ var __async = (__this, __arguments, generator) => {
8853
8852
  return (_ctx, _cache) => {
8854
8853
  return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1e, [
8855
8854
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
8856
- return openBlock(), createBlock(_sfc_main$1p, {
8855
+ return openBlock(), createBlock(_sfc_main$1q, {
8857
8856
  key: item,
8858
8857
  item,
8859
8858
  highlighted: index === highlightIndex.value,
@@ -8870,7 +8869,7 @@ var __async = (__this, __arguments, generator) => {
8870
8869
  }
8871
8870
  });
8872
8871
  const _hoisted_1$1d = { class: "lupa-search-box-no-results" };
8873
- const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8872
+ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8874
8873
  __name: "SearchBoxNoResults",
8875
8874
  props: {
8876
8875
  labels: {}
@@ -8928,7 +8927,7 @@ var __async = (__this, __arguments, generator) => {
8928
8927
  class: "lupa-suggestion-facet-value",
8929
8928
  "data-cy": "lupa-suggestion-facet-value"
8930
8929
  };
8931
- const _sfc_main$1m = /* @__PURE__ */ defineComponent({
8930
+ const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8932
8931
  __name: "SearchBoxSuggestion",
8933
8932
  props: {
8934
8933
  suggestion: {},
@@ -8977,7 +8976,7 @@ var __async = (__this, __arguments, generator) => {
8977
8976
  id: "lupa-search-box-suggestions",
8978
8977
  "data-cy": "lupa-search-box-suggestions"
8979
8978
  };
8980
- const _sfc_main$1l = /* @__PURE__ */ defineComponent({
8979
+ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
8981
8980
  __name: "SearchBoxSuggestions",
8982
8981
  props: {
8983
8982
  items: {},
@@ -9039,7 +9038,7 @@ var __async = (__this, __arguments, generator) => {
9039
9038
  return (_ctx, _cache) => {
9040
9039
  return openBlock(), createElementBlock("div", _hoisted_1$1b, [
9041
9040
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
9042
- return openBlock(), createBlock(_sfc_main$1m, {
9041
+ return openBlock(), createBlock(_sfc_main$1n, {
9043
9042
  key: getSuggestionKey(item),
9044
9043
  class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
9045
9044
  suggestion: item,
@@ -9067,7 +9066,7 @@ var __async = (__this, __arguments, generator) => {
9067
9066
  }, timeout);
9068
9067
  };
9069
9068
  };
9070
- const _sfc_main$1k = /* @__PURE__ */ defineComponent({
9069
+ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
9071
9070
  __name: "SearchBoxSuggestionsWrapper",
9072
9071
  props: {
9073
9072
  panel: {},
@@ -9109,7 +9108,7 @@ var __async = (__this, __arguments, generator) => {
9109
9108
  const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
9110
9109
  watch(() => props.panel.limit, getSuggestionsDebounced);
9111
9110
  return (_ctx, _cache) => {
9112
- return openBlock(), createBlock(_sfc_main$1l, {
9111
+ return openBlock(), createBlock(_sfc_main$1m, {
9113
9112
  items: searchResult.value,
9114
9113
  highlight: _ctx.panel.highlight,
9115
9114
  queryKey: _ctx.panel.queryKey,
@@ -18108,9 +18107,13 @@ and ensure you are accounting for this risk.
18108
18107
  const getFieldValue = (doc2, field = "") => {
18109
18108
  var _a;
18110
18109
  if (typeof field === "number") {
18111
- return field;
18110
+ return +field;
18111
+ }
18112
+ const value = (_a = field == null ? void 0 : field.split(".")) == null ? void 0 : _a.reduce((obj, key) => obj ? obj[key] : void 0, doc2);
18113
+ if (+value) {
18114
+ return +value;
18112
18115
  }
18113
- return (_a = field == null ? void 0 : field.split(".")) == null ? void 0 : _a.reduce((obj, key) => obj ? obj[key] : void 0, doc2);
18116
+ return value;
18114
18117
  };
18115
18118
  const processDisplayCondition = (displayCondition, doc2 = {}) => {
18116
18119
  const { condition, fields } = displayCondition;
@@ -18185,7 +18188,7 @@ and ensure you are accounting for this risk.
18185
18188
  };
18186
18189
  const _hoisted_1$1a = ["src"];
18187
18190
  const _hoisted_2$R = ["src"];
18188
- const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18191
+ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
18189
18192
  __name: "ProductImage",
18190
18193
  props: {
18191
18194
  item: {},
@@ -18340,7 +18343,7 @@ and ensure you are accounting for this risk.
18340
18343
  };
18341
18344
  }
18342
18345
  });
18343
- const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18346
+ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18344
18347
  __name: "SearchBoxProductImage",
18345
18348
  props: {
18346
18349
  item: {},
@@ -18348,7 +18351,7 @@ and ensure you are accounting for this risk.
18348
18351
  },
18349
18352
  setup(__props) {
18350
18353
  return (_ctx, _cache) => {
18351
- return openBlock(), createBlock(_sfc_main$1j, {
18354
+ return openBlock(), createBlock(_sfc_main$1k, {
18352
18355
  item: _ctx.item,
18353
18356
  options: _ctx.options,
18354
18357
  "wrapper-class": "lupa-search-box-image-wrapper",
@@ -18362,7 +18365,7 @@ and ensure you are accounting for this risk.
18362
18365
  key: 1,
18363
18366
  class: "lupa-search-box-product-title"
18364
18367
  };
18365
- const _sfc_main$1h = /* @__PURE__ */ defineComponent({
18368
+ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18366
18369
  __name: "SearchBoxProductTitle",
18367
18370
  props: {
18368
18371
  item: {},
@@ -18396,7 +18399,7 @@ and ensure you are accounting for this risk.
18396
18399
  key: 1,
18397
18400
  class: "lupa-search-box-product-description"
18398
18401
  };
18399
- const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18402
+ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
18400
18403
  __name: "SearchBoxProductDescription",
18401
18404
  props: {
18402
18405
  item: {},
@@ -18424,7 +18427,7 @@ and ensure you are accounting for this risk.
18424
18427
  }
18425
18428
  });
18426
18429
  const _hoisted_1$17 = { class: "lupa-search-box-product-price" };
18427
- const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18430
+ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18428
18431
  __name: "SearchBoxProductPrice",
18429
18432
  props: {
18430
18433
  item: {},
@@ -18448,7 +18451,7 @@ and ensure you are accounting for this risk.
18448
18451
  };
18449
18452
  }
18450
18453
  });
18451
- const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18454
+ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18452
18455
  __name: "SearchBoxProductRegularPrice",
18453
18456
  props: {
18454
18457
  item: {},
@@ -18480,7 +18483,7 @@ and ensure you are accounting for this risk.
18480
18483
  const _hoisted_3$B = { key: 1 };
18481
18484
  const _hoisted_4$r = { class: "lupa-search-box-custom-label" };
18482
18485
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
18483
- const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18486
+ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18484
18487
  __name: "SearchBoxProductCustom",
18485
18488
  props: {
18486
18489
  item: {},
@@ -18519,7 +18522,7 @@ and ensure you are accounting for this risk.
18519
18522
  }
18520
18523
  });
18521
18524
  const _hoisted_1$15 = ["innerHTML"];
18522
- const _sfc_main$1c = /* @__PURE__ */ defineComponent({
18525
+ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18523
18526
  __name: "SearchBoxProductCustomHtml",
18524
18527
  props: {
18525
18528
  item: {},
@@ -18781,7 +18784,7 @@ and ensure you are accounting for this risk.
18781
18784
  const _hoisted_1$14 = { class: "lupa-search-box-add-to-cart-wrapper" };
18782
18785
  const _hoisted_2$N = { class: "lupa-search-box-product-addtocart" };
18783
18786
  const _hoisted_3$A = ["onClick", "disabled"];
18784
- const _sfc_main$1b = /* @__PURE__ */ defineComponent({
18787
+ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
18785
18788
  __name: "SearchBoxProductAddToCart",
18786
18789
  props: {
18787
18790
  item: {},
@@ -18834,17 +18837,17 @@ and ensure you are accounting for this risk.
18834
18837
  };
18835
18838
  const __default__$4 = {
18836
18839
  components: {
18837
- SearchBoxProductImage: _sfc_main$1i,
18838
- SearchBoxProductTitle: _sfc_main$1h,
18839
- SearchBoxProductDescription: _sfc_main$1g,
18840
- SearchBoxProductPrice: _sfc_main$1f,
18841
- SearchBoxProductRegularPrice: _sfc_main$1e,
18842
- SearchBoxProductCustom: _sfc_main$1d,
18843
- SearchBoxProductCustomHtml: _sfc_main$1c,
18844
- SearchBoxProductAddToCart: _sfc_main$1b
18840
+ SearchBoxProductImage: _sfc_main$1j,
18841
+ SearchBoxProductTitle: _sfc_main$1i,
18842
+ SearchBoxProductDescription: _sfc_main$1h,
18843
+ SearchBoxProductPrice: _sfc_main$1g,
18844
+ SearchBoxProductRegularPrice: _sfc_main$1f,
18845
+ SearchBoxProductCustom: _sfc_main$1e,
18846
+ SearchBoxProductCustomHtml: _sfc_main$1d,
18847
+ SearchBoxProductAddToCart: _sfc_main$1c
18845
18848
  }
18846
18849
  };
18847
- const _sfc_main$1a = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
18850
+ const _sfc_main$1b = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
18848
18851
  __name: "SearchBoxProductElement",
18849
18852
  props: {
18850
18853
  item: {},
@@ -18928,7 +18931,7 @@ and ensure you are accounting for this risk.
18928
18931
  key: 0,
18929
18932
  class: "lupa-badge-full-text"
18930
18933
  };
18931
- const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18934
+ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
18932
18935
  __name: "SearchResultGeneratedBadge",
18933
18936
  props: {
18934
18937
  options: {},
@@ -18974,7 +18977,7 @@ and ensure you are accounting for this risk.
18974
18977
  }
18975
18978
  });
18976
18979
  const _hoisted_1$11 = { class: "lupa-generated-badges" };
18977
- const _sfc_main$18 = /* @__PURE__ */ defineComponent({
18980
+ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18978
18981
  __name: "SearchResultGeneratedBadges",
18979
18982
  props: {
18980
18983
  options: {}
@@ -19002,7 +19005,7 @@ and ensure you are accounting for this risk.
19002
19005
  return (_ctx, _cache) => {
19003
19006
  return openBlock(), createElementBlock("div", _hoisted_1$11, [
19004
19007
  (openBlock(true), createElementBlock(Fragment, null, renderList(badges.value, (badge) => {
19005
- return openBlock(), createBlock(_sfc_main$19, {
19008
+ return openBlock(), createBlock(_sfc_main$1a, {
19006
19009
  key: badge.id,
19007
19010
  badge,
19008
19011
  options: _ctx.options
@@ -19013,7 +19016,7 @@ and ensure you are accounting for this risk.
19013
19016
  }
19014
19017
  });
19015
19018
  const _hoisted_1$10 = ["innerHTML"];
19016
- const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19019
+ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
19017
19020
  __name: "CustomBadge",
19018
19021
  props: {
19019
19022
  badge: {}
@@ -19039,7 +19042,7 @@ and ensure you are accounting for this risk.
19039
19042
  }
19040
19043
  });
19041
19044
  const _hoisted_1$$ = { class: "lupa-text-badges" };
19042
- const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19045
+ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19043
19046
  __name: "TextBadge",
19044
19047
  props: {
19045
19048
  badge: {}
@@ -19047,8 +19050,7 @@ and ensure you are accounting for this risk.
19047
19050
  setup(__props) {
19048
19051
  const props = __props;
19049
19052
  const badges = computed(() => {
19050
- var _a, _b;
19051
- return (_b = (_a = props.badge) == null ? void 0 : _a.value) != null ? _b : [];
19053
+ return Array.isArray(props.badge.value) ? props.badge.value : [props.badge.value];
19052
19054
  });
19053
19055
  const displayBadges = computed(() => {
19054
19056
  return badges.value.slice(0, props.badge.maxItems);
@@ -19067,7 +19069,7 @@ and ensure you are accounting for this risk.
19067
19069
  });
19068
19070
  const _hoisted_1$_ = { class: "lupa-image-badges" };
19069
19071
  const _hoisted_2$L = ["src"];
19070
- const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19072
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19071
19073
  __name: "ImageBadge",
19072
19074
  props: {
19073
19075
  badge: {}
@@ -19075,7 +19077,7 @@ and ensure you are accounting for this risk.
19075
19077
  setup(__props) {
19076
19078
  const props = __props;
19077
19079
  const badges = computed(() => {
19078
- return props.badge.value;
19080
+ return Array.isArray(props.badge.value) ? props.badge.value : [props.badge.value];
19079
19081
  });
19080
19082
  const displayBadges = computed(() => {
19081
19083
  return badges.value.slice(0, props.badge.maxItems);
@@ -19102,12 +19104,71 @@ and ensure you are accounting for this risk.
19102
19104
  };
19103
19105
  }
19104
19106
  });
19107
+ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19108
+ __name: "DiscountBadge",
19109
+ props: {
19110
+ badge: {}
19111
+ },
19112
+ setup(__props) {
19113
+ const props = __props;
19114
+ const optionStore = useOptionsStore();
19115
+ const { searchResultOptions } = storeToRefs(optionStore);
19116
+ const className = computed(() => {
19117
+ var _a;
19118
+ return (_a = props.badge.className) != null ? _a : "";
19119
+ });
19120
+ const discountValue = computed(() => {
19121
+ var _a, _b, _c, _d;
19122
+ if (props.badge.discountKey) {
19123
+ return (_b = (_a = props.badge.product) == null ? void 0 : _a[props.badge.discountKey]) != null ? _b : 0;
19124
+ }
19125
+ if (props.badge.regularPriceKey && props.badge.finalPriceKey) {
19126
+ const regularPrice = +((_c = props.badge.product) == null ? void 0 : _c[props.badge.regularPriceKey]);
19127
+ const finalPrice = +((_d = props.badge.product) == null ? void 0 : _d[props.badge.finalPriceKey]);
19128
+ if (!regularPrice || !finalPrice) {
19129
+ return 0;
19130
+ }
19131
+ if (props.badge.discountType === "percentage") {
19132
+ return (regularPrice - finalPrice) / regularPrice * 100;
19133
+ } else {
19134
+ return regularPrice - finalPrice;
19135
+ }
19136
+ }
19137
+ return 0;
19138
+ });
19139
+ const discountStringValue = computed(() => {
19140
+ var _a, _b, _c, _d;
19141
+ return props.badge.discountType === "percentage" ? discountValue.value.toFixed(0) : formatPrice(
19142
+ discountValue.value,
19143
+ (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currency,
19144
+ (_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator
19145
+ );
19146
+ });
19147
+ const hasDiscount = computed(() => {
19148
+ return Boolean(discountValue.value) && discountValue.value > 0;
19149
+ });
19150
+ const discount = computed(() => {
19151
+ var _a, _b, _c, _d;
19152
+ const defaultPostfix = props.badge.discountType === "percentage" ? " %" : "";
19153
+ const prefix = (_b = (_a = props.badge.labels) == null ? void 0 : _a.prefix) != null ? _b : "- ";
19154
+ const postfix = (_d = (_c = props.badge.labels) == null ? void 0 : _c.postfix) != null ? _d : defaultPostfix;
19155
+ return `${prefix}${discountStringValue.value}${postfix}`;
19156
+ });
19157
+ return (_ctx, _cache) => {
19158
+ return hasDiscount.value ? (openBlock(), createElementBlock("div", {
19159
+ key: 0,
19160
+ class: normalizeClass([className.value, "lupa-discount-badge"])
19161
+ }, toDisplayString(discount.value), 3)) : createCommentVNode("", true);
19162
+ };
19163
+ }
19164
+ });
19105
19165
  const _hoisted_1$Z = { id: "lupa-search-results-badges" };
19106
19166
  const __default__$3 = {
19107
19167
  components: {
19108
- CustomBadge: _sfc_main$17,
19109
- TextBadge: _sfc_main$16,
19110
- ImageBadge: _sfc_main$15
19168
+ CustomBadge: _sfc_main$18,
19169
+ TextBadge: _sfc_main$17,
19170
+ ImageBadge: _sfc_main$16,
19171
+ DiscountBadge: _sfc_main$15
19111
19172
  }
19112
19173
  };
19113
19174
  const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
@@ -19166,6 +19227,8 @@ and ensure you are accounting for this risk.
19166
19227
  return "ImageBadge";
19167
19228
  case BadgeType.CUSTOM_HTML:
19168
19229
  return "CustomBadge";
19230
+ case BadgeType.DISCOUNT:
19231
+ return "DiscountBadge";
19169
19232
  default:
19170
19233
  return "CustomBadge";
19171
19234
  }
@@ -19182,7 +19245,7 @@ and ensure you are accounting for this risk.
19182
19245
  badge
19183
19246
  }, null, 8, ["badge"]);
19184
19247
  }), 128)),
19185
- positionValue.value === "card" ? (openBlock(), createBlock(_sfc_main$18, {
19248
+ positionValue.value === "card" ? (openBlock(), createBlock(_sfc_main$19, {
19186
19249
  key: 0,
19187
19250
  options: _ctx.options
19188
19251
  }, null, 8, ["options"])) : createCommentVNode("", true)
@@ -19283,7 +19346,7 @@ and ensure you are accounting for this risk.
19283
19346
  style: normalizeStyle(imageStyleOverride.value)
19284
19347
  }, [
19285
19348
  (openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
19286
- return openBlock(), createBlock(_sfc_main$1a, {
19349
+ return openBlock(), createBlock(_sfc_main$1b, {
19287
19350
  class: "lupa-search-box-product-element",
19288
19351
  item: _ctx.item,
19289
19352
  element,
@@ -19296,7 +19359,7 @@ and ensure you are accounting for this risk.
19296
19359
  createBaseVNode("div", _hoisted_2$K, [
19297
19360
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
19298
19361
  var _a;
19299
- return openBlock(), createBlock(_sfc_main$1a, {
19362
+ return openBlock(), createBlock(_sfc_main$1b, {
19300
19363
  key: element.key,
19301
19364
  class: "lupa-search-box-product-element",
19302
19365
  item: _ctx.item,
@@ -19318,7 +19381,7 @@ and ensure you are accounting for this risk.
19318
19381
  }), 128))
19319
19382
  ]),
19320
19383
  addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_3$y, [
19321
- createVNode(_sfc_main$1a, {
19384
+ createVNode(_sfc_main$1b, {
19322
19385
  class: "lupa-search-box-product-element",
19323
19386
  item: _ctx.item,
19324
19387
  element: addToCartElement.value,
@@ -19718,7 +19781,7 @@ and ensure you are accounting for this risk.
19718
19781
  };
19719
19782
  const __default__$2 = {
19720
19783
  components: {
19721
- SearchBoxSuggestionsWrapper: _sfc_main$1k,
19784
+ SearchBoxSuggestionsWrapper: _sfc_main$1l,
19722
19785
  SearchBoxProductsWrapper: _sfc_main$10,
19723
19786
  SearchBoxRelatedSourceWrapper: _sfc_main$$
19724
19787
  }
@@ -19927,18 +19990,18 @@ and ensure you are accounting for this risk.
19927
19990
  ], 14, _hoisted_2$I);
19928
19991
  }), 128))
19929
19992
  ], 4),
19930
- !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1n, {
19993
+ !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1o, {
19931
19994
  key: 1,
19932
19995
  labels: labels.value
19933
19996
  }, null, 8, ["labels"])) : createCommentVNode("", true),
19934
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1q, {
19997
+ unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1r, {
19935
19998
  key: 2,
19936
19999
  labels: labels.value,
19937
20000
  showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
19938
20001
  onGoToResults: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("go-to-results"))
19939
20002
  }, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
19940
20003
  ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$g, [
19941
- createVNode(_sfc_main$1o, {
20004
+ createVNode(_sfc_main$1p, {
19942
20005
  options: _ctx.options.history,
19943
20006
  history: history.value,
19944
20007
  onGoToResults: handleGoToResults,
@@ -20227,7 +20290,7 @@ and ensure you are accounting for this risk.
20227
20290
  var _a2;
20228
20291
  return openBlock(), createElementBlock("div", _hoisted_1$U, [
20229
20292
  createBaseVNode("div", _hoisted_2$H, [
20230
- createVNode(_sfc_main$1r, {
20293
+ createVNode(_sfc_main$1s, {
20231
20294
  options: inputOptions.value,
20232
20295
  suggestedValue: suggestedValue.value,
20233
20296
  "can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
@@ -23421,7 +23484,7 @@ and ensure you are accounting for this risk.
23421
23484
  },
23422
23485
  setup(__props) {
23423
23486
  return (_ctx, _cache) => {
23424
- return openBlock(), createBlock(_sfc_main$1j, {
23487
+ return openBlock(), createBlock(_sfc_main$1k, {
23425
23488
  item: _ctx.item,
23426
23489
  options: _ctx.options,
23427
23490
  "wrapper-class": "lupa-search-results-image-wrapper",
@@ -23570,7 +23633,13 @@ and ensure you are accounting for this risk.
23570
23633
  return new Array(STAR_COUNT).fill(RATING_STAR_HTML);
23571
23634
  });
23572
23635
  const ratingPercentage = computed(() => {
23573
- return props.options.getRatingPercentage ? props.options.getRatingPercentage(props.item) : currentRating.value;
23636
+ if (props.options.getRatingPercentage) {
23637
+ return props.options.getRatingPercentage(props.item);
23638
+ }
23639
+ if (props.options.maxRating) {
23640
+ return currentRating.value / props.options.maxRating * 100;
23641
+ }
23642
+ return currentRating.value;
23574
23643
  });
23575
23644
  const ratingLink = computed(() => {
23576
23645
  var _a;
@@ -23672,7 +23741,7 @@ and ensure you are accounting for this risk.
23672
23741
  });
23673
23742
  const _hoisted_1$q = { class: "lupa-search-results-add-to-cart-wrapper" };
23674
23743
  const _hoisted_2$l = { class: "lupa-search-results-product-addtocart" };
23675
- const _hoisted_3$f = ["onClick", "disabled"];
23744
+ const _hoisted_3$f = ["id", "disabled", "onClick"];
23676
23745
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
23677
23746
  __name: "SearchResultsProductAddToCart",
23678
23747
  props: {
@@ -23693,11 +23762,16 @@ and ensure you are accounting for this risk.
23693
23762
  const label = computed(() => {
23694
23763
  return props.options.labels.addToCart;
23695
23764
  });
23765
+ const id = computed(() => {
23766
+ var _a;
23767
+ const id2 = (_a = props.item.id) != null ? _a : "";
23768
+ return `lupa-add-to-cart-${id2}`;
23769
+ });
23696
23770
  const handleClick = () => __async2(this, null, function* () {
23697
23771
  loading.value = true;
23698
23772
  if (props.options.emitEvent) {
23699
23773
  const event = new CustomEvent(props.options.emitEvent, { detail: { item: props.item } });
23700
- window.dispatchEvent(event);
23774
+ document.dispatchEvent(event);
23701
23775
  }
23702
23776
  if (props.options.action) {
23703
23777
  yield props.options.action(props.item, addToCartAmount.value);
@@ -23709,10 +23783,11 @@ and ensure you are accounting for this risk.
23709
23783
  return openBlock(), createElementBlock("div", _hoisted_1$q, [
23710
23784
  createBaseVNode("div", _hoisted_2$l, [
23711
23785
  createBaseVNode("button", {
23712
- onClick: withModifiers(handleClick, ["stop"]),
23786
+ id: id.value,
23713
23787
  class: normalizeClass(loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart"),
23714
23788
  "data-cy": "lupa-add-to-cart",
23715
- disabled: !inStockValue.value || loading.value
23789
+ disabled: !inStockValue.value || loading.value,
23790
+ onClick: withModifiers(handleClick, ["stop"])
23716
23791
  }, toDisplayString(label.value), 11, _hoisted_3$f)
23717
23792
  ])
23718
23793
  ]);
@@ -24549,7 +24624,7 @@ and ensure you are accounting for this risk.
24549
24624
  var _a;
24550
24625
  return openBlock(), createElementBlock("div", _hoisted_1$g, [
24551
24626
  createBaseVNode("div", _hoisted_2$d, [
24552
- firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1j, {
24627
+ firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1k, {
24553
24628
  key: 0,
24554
24629
  "wrapper-class": "lupa-related-query-image-wrapper",
24555
24630
  "image-class": "lupa-related-query-image",
@@ -32382,7 +32457,7 @@ and ensure you are accounting for this risk.
32382
32457
  key: 0,
32383
32458
  class: "lupasearch-chat-content"
32384
32459
  };
32385
- const _sfc_main$1s = /* @__PURE__ */ defineComponent({
32460
+ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
32386
32461
  __name: "ChatContainer",
32387
32462
  props: {
32388
32463
  options: {}
@@ -38749,6 +38824,13 @@ and ensure you are accounting for this risk.
38749
38824
  }
38750
38825
  return { mountedApp, mountedComponent, props, app: app2, mountElement };
38751
38826
  };
38827
+ const canMount = (allowedMountUrls) => {
38828
+ if (allowedMountUrls && Array.isArray(allowedMountUrls) && allowedMountUrls.length) {
38829
+ const currentUrl = window.location.href;
38830
+ return allowedMountUrls == null ? void 0 : allowedMountUrls.some((url) => currentUrl.includes(url));
38831
+ }
38832
+ return true;
38833
+ };
38752
38834
  const app = {
38753
38835
  box: {},
38754
38836
  results: {},
@@ -38783,12 +38865,18 @@ and ensure you are accounting for this risk.
38783
38865
  };
38784
38866
  const searchBox = (options, mountOptions) => {
38785
38867
  var _a;
38868
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38869
+ return;
38870
+ }
38786
38871
  const inputs = (_a = options.inputSelector) == null ? void 0 : _a.split(",");
38787
38872
  for (const input2 of inputs) {
38788
38873
  applySearchBox(__spreadProps(__spreadValues({}, options), { inputSelector: input2.trim() }), mountOptions);
38789
38874
  }
38790
38875
  };
38791
38876
  const searchResults = (options, mountOptions) => {
38877
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38878
+ return;
38879
+ }
38792
38880
  const existingInstance = app.results[options.containerSelector];
38793
38881
  if (existingInstance) {
38794
38882
  existingInstance.props.searchResultsOptions = options;
@@ -38814,6 +38902,9 @@ and ensure you are accounting for this risk.
38814
38902
  app.results[options.containerSelector] = instance;
38815
38903
  };
38816
38904
  const productList = (options, mountOptions) => {
38905
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38906
+ return;
38907
+ }
38817
38908
  const existingInstance = app.productList[options.containerSelector];
38818
38909
  if (existingInstance) {
38819
38910
  existingInstance.props.productListOptions = options;
@@ -38840,6 +38931,9 @@ and ensure you are accounting for this risk.
38840
38931
  };
38841
38932
  const searchContainer = (options, mountOptions) => {
38842
38933
  var _a, _b, _c, _d, _e, _f;
38934
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38935
+ return;
38936
+ }
38843
38937
  const existingInstance = app.searchContainer[options.trigger];
38844
38938
  if (existingInstance) {
38845
38939
  existingInstance.props.searchContainerOptions = options;
@@ -38871,6 +38965,9 @@ and ensure you are accounting for this risk.
38871
38965
  app.searchContainer[options.trigger] = instance;
38872
38966
  };
38873
38967
  const preconfiguredSearchContainer = (preconfiguredSearchContainerOptions, mountOptions) => {
38968
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38969
+ return;
38970
+ }
38874
38971
  const searchBox2 = SearchContainerConfigurationService.getSearchBoxComponent(
38875
38972
  preconfiguredSearchContainerOptions
38876
38973
  );
@@ -38888,6 +38985,9 @@ and ensure you are accounting for this risk.
38888
38985
  );
38889
38986
  };
38890
38987
  const recommendations = (options, mountOptions) => {
38988
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
38989
+ return;
38990
+ }
38891
38991
  const existingInstance = app.recommendations[options.containerSelector];
38892
38992
  if (existingInstance) {
38893
38993
  existingInstance.props.recommendationOptions = options;
@@ -38913,6 +39013,9 @@ and ensure you are accounting for this risk.
38913
39013
  app.recommendations[options.containerSelector] = instance;
38914
39014
  };
38915
39015
  const chat = (options, mountOptions) => {
39016
+ if (!canMount(mountOptions == null ? void 0 : mountOptions.allowedMountUrls)) {
39017
+ return;
39018
+ }
38916
39019
  const existingInstance = app.chat[options.displayOptions.containerSelector];
38917
39020
  if (existingInstance) {
38918
39021
  existingInstance.props.options = options;
@@ -38927,7 +39030,7 @@ and ensure you are accounting for this risk.
38927
39030
  const instance = createVue(
38928
39031
  options.displayOptions.containerSelector,
38929
39032
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
38930
- _sfc_main$1s,
39033
+ _sfc_main$1t,
38931
39034
  {
38932
39035
  options
38933
39036
  }
@@ -39177,6 +39280,7 @@ and ensure you are accounting for this risk.
39177
39280
  return;
39178
39281
  }
39179
39282
  const resolvedConfiguration = JSON.parse(configuration.searchBox);
39283
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39180
39284
  const visible = yield waitForElementToBeVisible(
39181
39285
  resolvedConfiguration.inputSelector,
39182
39286
  0,
@@ -39188,13 +39292,14 @@ and ensure you are accounting for this risk.
39188
39292
  );
39189
39293
  return;
39190
39294
  }
39191
- searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39295
+ searchBox(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39192
39296
  });
39193
39297
  const mountSearchResults = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39194
39298
  if (!configuration.searchResults) {
39195
39299
  return;
39196
39300
  }
39197
39301
  const resolvedConfiguration = JSON.parse(configuration.searchResults);
39302
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39198
39303
  const visible = yield waitForElementToBeVisible(
39199
39304
  resolvedConfiguration.containerSelector,
39200
39305
  0,
@@ -39206,7 +39311,7 @@ and ensure you are accounting for this risk.
39206
39311
  );
39207
39312
  return;
39208
39313
  }
39209
- searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2 });
39314
+ searchResults(__spreadProps(__spreadValues({}, resolvedConfiguration), { options }), { fetch: fetch2, allowedMountUrls });
39210
39315
  });
39211
39316
  const mountProductList = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39212
39317
  if (!configuration.productList) {
@@ -39216,6 +39321,7 @@ and ensure you are accounting for this risk.
39216
39321
  configuration.searchResults
39217
39322
  );
39218
39323
  const resolvedConfiguration = JSON.parse(configuration.productList);
39324
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39219
39325
  const visible = yield waitForElementToBeVisible(
39220
39326
  resolvedConfiguration.containerSelector,
39221
39327
  0,
@@ -39229,7 +39335,7 @@ and ensure you are accounting for this risk.
39229
39335
  }
39230
39336
  productList(
39231
39337
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39232
- { fetch: fetch2 }
39338
+ { fetch: fetch2, allowedMountUrls }
39233
39339
  );
39234
39340
  });
39235
39341
  const mountRecommendations = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39242,6 +39348,7 @@ and ensure you are accounting for this risk.
39242
39348
  const resolvedConfiguration = JSON.parse(
39243
39349
  configuration.recommendations
39244
39350
  );
39351
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39245
39352
  const visible = yield waitForElementToBeVisible(
39246
39353
  resolvedConfiguration.containerSelector,
39247
39354
  0,
@@ -39255,7 +39362,7 @@ and ensure you are accounting for this risk.
39255
39362
  }
39256
39363
  recommendations(
39257
39364
  __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39258
- { fetch: fetch2 }
39365
+ { fetch: fetch2, allowedMountUrls }
39259
39366
  );
39260
39367
  });
39261
39368
  const mountChat = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
@@ -39266,6 +39373,7 @@ and ensure you are accounting for this risk.
39266
39373
  configuration.searchResults
39267
39374
  );
39268
39375
  const resolvedConfiguration = JSON.parse(configuration.genAiChat);
39376
+ const allowedMountUrls = resolvedConfiguration.allowedMountUrls;
39269
39377
  const visible = yield waitForElementToBeVisible(
39270
39378
  resolvedConfiguration.containerSelector,
39271
39379
  0,
@@ -39277,7 +39385,10 @@ and ensure you are accounting for this risk.
39277
39385
  );
39278
39386
  return;
39279
39387
  }
39280
- chat(__spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }), { fetch: fetch2 });
39388
+ chat(
39389
+ __spreadProps(__spreadValues(__spreadValues({}, resolvedSearchResultsConfiguration), resolvedConfiguration), { options }),
39390
+ { fetch: fetch2, allowedMountUrls }
39391
+ );
39281
39392
  });
39282
39393
  const mount = (configuration, options, fetch2 = true, remount = false) => __async(this, null, function* () {
39283
39394
  yield applyStyles(configuration);