@getlupa/client 1.14.7 → 1.14.9

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: {}
@@ -38927,7 +39002,7 @@ and ensure you are accounting for this risk.
38927
39002
  const instance = createVue(
38928
39003
  options.displayOptions.containerSelector,
38929
39004
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
38930
- _sfc_main$1s,
39005
+ _sfc_main$1t,
38931
39006
  {
38932
39007
  options
38933
39008
  }