@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.
@@ -7649,12 +7649,11 @@ var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
7649
7649
  return SearchBoxPanelType2;
7650
7650
  })(SearchBoxPanelType || {});
7651
7651
  var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
7652
- BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
7653
- BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
7654
7652
  BadgeType2["NEWITEM"] = "newItem";
7655
7653
  BadgeType2["TEXT"] = "text";
7656
7654
  BadgeType2["IMAGE"] = "image";
7657
7655
  BadgeType2["CUSTOM_HTML"] = "customHtml";
7656
+ BadgeType2["DISCOUNT"] = "discount";
7658
7657
  return BadgeType2;
7659
7658
  })(BadgeType || {});
7660
7659
  const retrieveHistory = () => {
@@ -8607,7 +8606,7 @@ const _hoisted_8$3 = {
8607
8606
  key: 0,
8608
8607
  class: "lupa-close-label"
8609
8608
  };
8610
- const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8609
+ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
8611
8610
  __name: "SearchBoxInput",
8612
8611
  props: {
8613
8612
  options: {},
@@ -8737,7 +8736,7 @@ const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8737
8736
  };
8738
8737
  }
8739
8738
  });
8740
- const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8739
+ const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8741
8740
  __name: "SearchBoxMoreResults",
8742
8741
  props: {
8743
8742
  labels: {},
@@ -8771,7 +8770,7 @@ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8771
8770
  });
8772
8771
  const _hoisted_1$1f = { class: "lupa-search-box-history-item" };
8773
8772
  const _hoisted_2$T = { class: "lupa-search-box-history-item-content" };
8774
- const _sfc_main$1p = /* @__PURE__ */ defineComponent({
8773
+ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8775
8774
  __name: "SearchBoxHistoryItem",
8776
8775
  props: {
8777
8776
  item: {},
@@ -8806,7 +8805,7 @@ const _hoisted_1$1e = {
8806
8805
  key: 0,
8807
8806
  class: "lupa-search-box-history-panel"
8808
8807
  };
8809
- const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8808
+ const _sfc_main$1p = /* @__PURE__ */ defineComponent({
8810
8809
  __name: "SearchBoxHistoryPanel",
8811
8810
  props: {
8812
8811
  options: {}
@@ -8849,7 +8848,7 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8849
8848
  return (_ctx, _cache) => {
8850
8849
  return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1e, [
8851
8850
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
8852
- return openBlock(), createBlock(_sfc_main$1p, {
8851
+ return openBlock(), createBlock(_sfc_main$1q, {
8853
8852
  key: item,
8854
8853
  item,
8855
8854
  highlighted: index === highlightIndex.value,
@@ -8866,7 +8865,7 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8866
8865
  }
8867
8866
  });
8868
8867
  const _hoisted_1$1d = { class: "lupa-search-box-no-results" };
8869
- const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8868
+ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8870
8869
  __name: "SearchBoxNoResults",
8871
8870
  props: {
8872
8871
  labels: {}
@@ -8924,7 +8923,7 @@ const _hoisted_5$i = {
8924
8923
  class: "lupa-suggestion-facet-value",
8925
8924
  "data-cy": "lupa-suggestion-facet-value"
8926
8925
  };
8927
- const _sfc_main$1m = /* @__PURE__ */ defineComponent({
8926
+ const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8928
8927
  __name: "SearchBoxSuggestion",
8929
8928
  props: {
8930
8929
  suggestion: {},
@@ -8973,7 +8972,7 @@ const _hoisted_1$1b = {
8973
8972
  id: "lupa-search-box-suggestions",
8974
8973
  "data-cy": "lupa-search-box-suggestions"
8975
8974
  };
8976
- const _sfc_main$1l = /* @__PURE__ */ defineComponent({
8975
+ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
8977
8976
  __name: "SearchBoxSuggestions",
8978
8977
  props: {
8979
8978
  items: {},
@@ -9035,7 +9034,7 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
9035
9034
  return (_ctx, _cache) => {
9036
9035
  return openBlock(), createElementBlock("div", _hoisted_1$1b, [
9037
9036
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
9038
- return openBlock(), createBlock(_sfc_main$1m, {
9037
+ return openBlock(), createBlock(_sfc_main$1n, {
9039
9038
  key: getSuggestionKey(item),
9040
9039
  class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
9041
9040
  suggestion: item,
@@ -9063,7 +9062,7 @@ const debounce$1 = (func, timeout) => {
9063
9062
  }, timeout);
9064
9063
  };
9065
9064
  };
9066
- const _sfc_main$1k = /* @__PURE__ */ defineComponent({
9065
+ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
9067
9066
  __name: "SearchBoxSuggestionsWrapper",
9068
9067
  props: {
9069
9068
  panel: {},
@@ -9105,7 +9104,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
9105
9104
  const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
9106
9105
  watch(() => props.panel.limit, getSuggestionsDebounced);
9107
9106
  return (_ctx, _cache) => {
9108
- return openBlock(), createBlock(_sfc_main$1l, {
9107
+ return openBlock(), createBlock(_sfc_main$1m, {
9109
9108
  items: searchResult.value,
9110
9109
  highlight: _ctx.panel.highlight,
9111
9110
  queryKey: _ctx.panel.queryKey,
@@ -18104,9 +18103,13 @@ const renderHtmlTemplate = (template, document2 = {}) => {
18104
18103
  const getFieldValue = (doc2, field = "") => {
18105
18104
  var _a;
18106
18105
  if (typeof field === "number") {
18107
- return field;
18106
+ return +field;
18107
+ }
18108
+ const value = (_a = field == null ? void 0 : field.split(".")) == null ? void 0 : _a.reduce((obj, key) => obj ? obj[key] : void 0, doc2);
18109
+ if (+value) {
18110
+ return +value;
18108
18111
  }
18109
- return (_a = field == null ? void 0 : field.split(".")) == null ? void 0 : _a.reduce((obj, key) => obj ? obj[key] : void 0, doc2);
18112
+ return value;
18110
18113
  };
18111
18114
  const processDisplayCondition = (displayCondition, doc2 = {}) => {
18112
18115
  const { condition, fields } = displayCondition;
@@ -18181,7 +18184,7 @@ const replaceImageWithPlaceholder = (e2, placeholder) => {
18181
18184
  };
18182
18185
  const _hoisted_1$1a = ["src"];
18183
18186
  const _hoisted_2$R = ["src"];
18184
- const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18187
+ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
18185
18188
  __name: "ProductImage",
18186
18189
  props: {
18187
18190
  item: {},
@@ -18336,7 +18339,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18336
18339
  };
18337
18340
  }
18338
18341
  });
18339
- const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18342
+ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18340
18343
  __name: "SearchBoxProductImage",
18341
18344
  props: {
18342
18345
  item: {},
@@ -18344,7 +18347,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18344
18347
  },
18345
18348
  setup(__props) {
18346
18349
  return (_ctx, _cache) => {
18347
- return openBlock(), createBlock(_sfc_main$1j, {
18350
+ return openBlock(), createBlock(_sfc_main$1k, {
18348
18351
  item: _ctx.item,
18349
18352
  options: _ctx.options,
18350
18353
  "wrapper-class": "lupa-search-box-image-wrapper",
@@ -18358,7 +18361,7 @@ const _hoisted_2$Q = {
18358
18361
  key: 1,
18359
18362
  class: "lupa-search-box-product-title"
18360
18363
  };
18361
- const _sfc_main$1h = /* @__PURE__ */ defineComponent({
18364
+ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18362
18365
  __name: "SearchBoxProductTitle",
18363
18366
  props: {
18364
18367
  item: {},
@@ -18392,7 +18395,7 @@ const _hoisted_2$P = {
18392
18395
  key: 1,
18393
18396
  class: "lupa-search-box-product-description"
18394
18397
  };
18395
- const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18398
+ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
18396
18399
  __name: "SearchBoxProductDescription",
18397
18400
  props: {
18398
18401
  item: {},
@@ -18420,7 +18423,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18420
18423
  }
18421
18424
  });
18422
18425
  const _hoisted_1$17 = { class: "lupa-search-box-product-price" };
18423
- const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18426
+ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18424
18427
  __name: "SearchBoxProductPrice",
18425
18428
  props: {
18426
18429
  item: {},
@@ -18444,7 +18447,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18444
18447
  };
18445
18448
  }
18446
18449
  });
18447
- const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18450
+ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18448
18451
  __name: "SearchBoxProductRegularPrice",
18449
18452
  props: {
18450
18453
  item: {},
@@ -18476,7 +18479,7 @@ const _hoisted_2$O = { key: 0 };
18476
18479
  const _hoisted_3$B = { key: 1 };
18477
18480
  const _hoisted_4$r = { class: "lupa-search-box-custom-label" };
18478
18481
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
18479
- const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18482
+ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18480
18483
  __name: "SearchBoxProductCustom",
18481
18484
  props: {
18482
18485
  item: {},
@@ -18515,7 +18518,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18515
18518
  }
18516
18519
  });
18517
18520
  const _hoisted_1$15 = ["innerHTML"];
18518
- const _sfc_main$1c = /* @__PURE__ */ defineComponent({
18521
+ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18519
18522
  __name: "SearchBoxProductCustomHtml",
18520
18523
  props: {
18521
18524
  item: {},
@@ -18777,7 +18780,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
18777
18780
  const _hoisted_1$14 = { class: "lupa-search-box-add-to-cart-wrapper" };
18778
18781
  const _hoisted_2$N = { class: "lupa-search-box-product-addtocart" };
18779
18782
  const _hoisted_3$A = ["onClick", "disabled"];
18780
- const _sfc_main$1b = /* @__PURE__ */ defineComponent({
18783
+ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
18781
18784
  __name: "SearchBoxProductAddToCart",
18782
18785
  props: {
18783
18786
  item: {},
@@ -18830,17 +18833,17 @@ const _hoisted_1$13 = {
18830
18833
  };
18831
18834
  const __default__$4 = {
18832
18835
  components: {
18833
- SearchBoxProductImage: _sfc_main$1i,
18834
- SearchBoxProductTitle: _sfc_main$1h,
18835
- SearchBoxProductDescription: _sfc_main$1g,
18836
- SearchBoxProductPrice: _sfc_main$1f,
18837
- SearchBoxProductRegularPrice: _sfc_main$1e,
18838
- SearchBoxProductCustom: _sfc_main$1d,
18839
- SearchBoxProductCustomHtml: _sfc_main$1c,
18840
- SearchBoxProductAddToCart: _sfc_main$1b
18836
+ SearchBoxProductImage: _sfc_main$1j,
18837
+ SearchBoxProductTitle: _sfc_main$1i,
18838
+ SearchBoxProductDescription: _sfc_main$1h,
18839
+ SearchBoxProductPrice: _sfc_main$1g,
18840
+ SearchBoxProductRegularPrice: _sfc_main$1f,
18841
+ SearchBoxProductCustom: _sfc_main$1e,
18842
+ SearchBoxProductCustomHtml: _sfc_main$1d,
18843
+ SearchBoxProductAddToCart: _sfc_main$1c
18841
18844
  }
18842
18845
  };
18843
- const _sfc_main$1a = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
18846
+ const _sfc_main$1b = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
18844
18847
  __name: "SearchBoxProductElement",
18845
18848
  props: {
18846
18849
  item: {},
@@ -18924,7 +18927,7 @@ const _hoisted_4$q = {
18924
18927
  key: 0,
18925
18928
  class: "lupa-badge-full-text"
18926
18929
  };
18927
- const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18930
+ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
18928
18931
  __name: "SearchResultGeneratedBadge",
18929
18932
  props: {
18930
18933
  options: {},
@@ -18970,7 +18973,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18970
18973
  }
18971
18974
  });
18972
18975
  const _hoisted_1$11 = { class: "lupa-generated-badges" };
18973
- const _sfc_main$18 = /* @__PURE__ */ defineComponent({
18976
+ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18974
18977
  __name: "SearchResultGeneratedBadges",
18975
18978
  props: {
18976
18979
  options: {}
@@ -18998,7 +19001,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
18998
19001
  return (_ctx, _cache) => {
18999
19002
  return openBlock(), createElementBlock("div", _hoisted_1$11, [
19000
19003
  (openBlock(true), createElementBlock(Fragment, null, renderList(badges.value, (badge) => {
19001
- return openBlock(), createBlock(_sfc_main$19, {
19004
+ return openBlock(), createBlock(_sfc_main$1a, {
19002
19005
  key: badge.id,
19003
19006
  badge,
19004
19007
  options: _ctx.options
@@ -19009,7 +19012,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
19009
19012
  }
19010
19013
  });
19011
19014
  const _hoisted_1$10 = ["innerHTML"];
19012
- const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19015
+ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
19013
19016
  __name: "CustomBadge",
19014
19017
  props: {
19015
19018
  badge: {}
@@ -19035,7 +19038,7 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19035
19038
  }
19036
19039
  });
19037
19040
  const _hoisted_1$$ = { class: "lupa-text-badges" };
19038
- const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19041
+ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19039
19042
  __name: "TextBadge",
19040
19043
  props: {
19041
19044
  badge: {}
@@ -19043,8 +19046,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19043
19046
  setup(__props) {
19044
19047
  const props = __props;
19045
19048
  const badges = computed(() => {
19046
- var _a, _b;
19047
- return (_b = (_a = props.badge) == null ? void 0 : _a.value) != null ? _b : [];
19049
+ return Array.isArray(props.badge.value) ? props.badge.value : [props.badge.value];
19048
19050
  });
19049
19051
  const displayBadges = computed(() => {
19050
19052
  return badges.value.slice(0, props.badge.maxItems);
@@ -19063,7 +19065,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19063
19065
  });
19064
19066
  const _hoisted_1$_ = { class: "lupa-image-badges" };
19065
19067
  const _hoisted_2$L = ["src"];
19066
- const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19068
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19067
19069
  __name: "ImageBadge",
19068
19070
  props: {
19069
19071
  badge: {}
@@ -19071,7 +19073,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19071
19073
  setup(__props) {
19072
19074
  const props = __props;
19073
19075
  const badges = computed(() => {
19074
- return props.badge.value;
19076
+ return Array.isArray(props.badge.value) ? props.badge.value : [props.badge.value];
19075
19077
  });
19076
19078
  const displayBadges = computed(() => {
19077
19079
  return badges.value.slice(0, props.badge.maxItems);
@@ -19098,12 +19100,71 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19098
19100
  };
19099
19101
  }
19100
19102
  });
19103
+ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19104
+ __name: "DiscountBadge",
19105
+ props: {
19106
+ badge: {}
19107
+ },
19108
+ setup(__props) {
19109
+ const props = __props;
19110
+ const optionStore = useOptionsStore();
19111
+ const { searchResultOptions } = storeToRefs(optionStore);
19112
+ const className = computed(() => {
19113
+ var _a;
19114
+ return (_a = props.badge.className) != null ? _a : "";
19115
+ });
19116
+ const discountValue = computed(() => {
19117
+ var _a, _b, _c, _d;
19118
+ if (props.badge.discountKey) {
19119
+ return (_b = (_a = props.badge.product) == null ? void 0 : _a[props.badge.discountKey]) != null ? _b : 0;
19120
+ }
19121
+ if (props.badge.regularPriceKey && props.badge.finalPriceKey) {
19122
+ const regularPrice = +((_c = props.badge.product) == null ? void 0 : _c[props.badge.regularPriceKey]);
19123
+ const finalPrice = +((_d = props.badge.product) == null ? void 0 : _d[props.badge.finalPriceKey]);
19124
+ if (!regularPrice || !finalPrice) {
19125
+ return 0;
19126
+ }
19127
+ if (props.badge.discountType === "percentage") {
19128
+ return (regularPrice - finalPrice) / regularPrice * 100;
19129
+ } else {
19130
+ return regularPrice - finalPrice;
19131
+ }
19132
+ }
19133
+ return 0;
19134
+ });
19135
+ const discountStringValue = computed(() => {
19136
+ var _a, _b, _c, _d;
19137
+ return props.badge.discountType === "percentage" ? discountValue.value.toFixed(0) : formatPrice(
19138
+ discountValue.value,
19139
+ (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currency,
19140
+ (_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator
19141
+ );
19142
+ });
19143
+ const hasDiscount = computed(() => {
19144
+ return Boolean(discountValue.value) && discountValue.value > 0;
19145
+ });
19146
+ const discount = computed(() => {
19147
+ var _a, _b, _c, _d;
19148
+ const defaultPostfix = props.badge.discountType === "percentage" ? " %" : "";
19149
+ const prefix = (_b = (_a = props.badge.labels) == null ? void 0 : _a.prefix) != null ? _b : "- ";
19150
+ const postfix = (_d = (_c = props.badge.labels) == null ? void 0 : _c.postfix) != null ? _d : defaultPostfix;
19151
+ return `${prefix}${discountStringValue.value}${postfix}`;
19152
+ });
19153
+ return (_ctx, _cache) => {
19154
+ return hasDiscount.value ? (openBlock(), createElementBlock("div", {
19155
+ key: 0,
19156
+ class: normalizeClass([className.value, "lupa-discount-badge"])
19157
+ }, toDisplayString(discount.value), 3)) : createCommentVNode("", true);
19158
+ };
19159
+ }
19160
+ });
19101
19161
  const _hoisted_1$Z = { id: "lupa-search-results-badges" };
19102
19162
  const __default__$3 = {
19103
19163
  components: {
19104
- CustomBadge: _sfc_main$17,
19105
- TextBadge: _sfc_main$16,
19106
- ImageBadge: _sfc_main$15
19164
+ CustomBadge: _sfc_main$18,
19165
+ TextBadge: _sfc_main$17,
19166
+ ImageBadge: _sfc_main$16,
19167
+ DiscountBadge: _sfc_main$15
19107
19168
  }
19108
19169
  };
19109
19170
  const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
@@ -19162,6 +19223,8 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
19162
19223
  return "ImageBadge";
19163
19224
  case BadgeType.CUSTOM_HTML:
19164
19225
  return "CustomBadge";
19226
+ case BadgeType.DISCOUNT:
19227
+ return "DiscountBadge";
19165
19228
  default:
19166
19229
  return "CustomBadge";
19167
19230
  }
@@ -19178,7 +19241,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
19178
19241
  badge
19179
19242
  }, null, 8, ["badge"]);
19180
19243
  }), 128)),
19181
- positionValue.value === "card" ? (openBlock(), createBlock(_sfc_main$18, {
19244
+ positionValue.value === "card" ? (openBlock(), createBlock(_sfc_main$19, {
19182
19245
  key: 0,
19183
19246
  options: _ctx.options
19184
19247
  }, null, 8, ["options"])) : createCommentVNode("", true)
@@ -19279,7 +19342,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
19279
19342
  style: normalizeStyle(imageStyleOverride.value)
19280
19343
  }, [
19281
19344
  (openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
19282
- return openBlock(), createBlock(_sfc_main$1a, {
19345
+ return openBlock(), createBlock(_sfc_main$1b, {
19283
19346
  class: "lupa-search-box-product-element",
19284
19347
  item: _ctx.item,
19285
19348
  element,
@@ -19292,7 +19355,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
19292
19355
  createBaseVNode("div", _hoisted_2$K, [
19293
19356
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
19294
19357
  var _a;
19295
- return openBlock(), createBlock(_sfc_main$1a, {
19358
+ return openBlock(), createBlock(_sfc_main$1b, {
19296
19359
  key: element.key,
19297
19360
  class: "lupa-search-box-product-element",
19298
19361
  item: _ctx.item,
@@ -19314,7 +19377,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
19314
19377
  }), 128))
19315
19378
  ]),
19316
19379
  addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_3$y, [
19317
- createVNode(_sfc_main$1a, {
19380
+ createVNode(_sfc_main$1b, {
19318
19381
  class: "lupa-search-box-product-element",
19319
19382
  item: _ctx.item,
19320
19383
  element: addToCartElement.value,
@@ -19714,7 +19777,7 @@ const _hoisted_5$g = {
19714
19777
  };
19715
19778
  const __default__$2 = {
19716
19779
  components: {
19717
- SearchBoxSuggestionsWrapper: _sfc_main$1k,
19780
+ SearchBoxSuggestionsWrapper: _sfc_main$1l,
19718
19781
  SearchBoxProductsWrapper: _sfc_main$10,
19719
19782
  SearchBoxRelatedSourceWrapper: _sfc_main$$
19720
19783
  }
@@ -19923,18 +19986,18 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
19923
19986
  ], 14, _hoisted_2$I);
19924
19987
  }), 128))
19925
19988
  ], 4),
19926
- !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1n, {
19989
+ !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1o, {
19927
19990
  key: 1,
19928
19991
  labels: labels.value
19929
19992
  }, null, 8, ["labels"])) : createCommentVNode("", true),
19930
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1q, {
19993
+ unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1r, {
19931
19994
  key: 2,
19932
19995
  labels: labels.value,
19933
19996
  showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
19934
19997
  onGoToResults: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("go-to-results"))
19935
19998
  }, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
19936
19999
  ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$g, [
19937
- createVNode(_sfc_main$1o, {
20000
+ createVNode(_sfc_main$1p, {
19938
20001
  options: _ctx.options.history,
19939
20002
  history: history.value,
19940
20003
  onGoToResults: handleGoToResults,
@@ -20223,7 +20286,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
20223
20286
  var _a2;
20224
20287
  return openBlock(), createElementBlock("div", _hoisted_1$U, [
20225
20288
  createBaseVNode("div", _hoisted_2$H, [
20226
- createVNode(_sfc_main$1r, {
20289
+ createVNode(_sfc_main$1s, {
20227
20290
  options: inputOptions.value,
20228
20291
  suggestedValue: suggestedValue.value,
20229
20292
  "can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
@@ -23417,7 +23480,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23417
23480
  },
23418
23481
  setup(__props) {
23419
23482
  return (_ctx, _cache) => {
23420
- return openBlock(), createBlock(_sfc_main$1j, {
23483
+ return openBlock(), createBlock(_sfc_main$1k, {
23421
23484
  item: _ctx.item,
23422
23485
  options: _ctx.options,
23423
23486
  "wrapper-class": "lupa-search-results-image-wrapper",
@@ -23566,7 +23629,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23566
23629
  return new Array(STAR_COUNT).fill(RATING_STAR_HTML);
23567
23630
  });
23568
23631
  const ratingPercentage = computed(() => {
23569
- return props.options.getRatingPercentage ? props.options.getRatingPercentage(props.item) : currentRating.value;
23632
+ if (props.options.getRatingPercentage) {
23633
+ return props.options.getRatingPercentage(props.item);
23634
+ }
23635
+ if (props.options.maxRating) {
23636
+ return currentRating.value / props.options.maxRating * 100;
23637
+ }
23638
+ return currentRating.value;
23570
23639
  });
23571
23640
  const ratingLink = computed(() => {
23572
23641
  var _a;
@@ -23668,7 +23737,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23668
23737
  });
23669
23738
  const _hoisted_1$q = { class: "lupa-search-results-add-to-cart-wrapper" };
23670
23739
  const _hoisted_2$l = { class: "lupa-search-results-product-addtocart" };
23671
- const _hoisted_3$f = ["onClick", "disabled"];
23740
+ const _hoisted_3$f = ["id", "disabled", "onClick"];
23672
23741
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
23673
23742
  __name: "SearchResultsProductAddToCart",
23674
23743
  props: {
@@ -23689,11 +23758,16 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23689
23758
  const label = computed(() => {
23690
23759
  return props.options.labels.addToCart;
23691
23760
  });
23761
+ const id = computed(() => {
23762
+ var _a;
23763
+ const id2 = (_a = props.item.id) != null ? _a : "";
23764
+ return `lupa-add-to-cart-${id2}`;
23765
+ });
23692
23766
  const handleClick = () => __async2(this, null, function* () {
23693
23767
  loading.value = true;
23694
23768
  if (props.options.emitEvent) {
23695
23769
  const event = new CustomEvent(props.options.emitEvent, { detail: { item: props.item } });
23696
- window.dispatchEvent(event);
23770
+ document.dispatchEvent(event);
23697
23771
  }
23698
23772
  if (props.options.action) {
23699
23773
  yield props.options.action(props.item, addToCartAmount.value);
@@ -23705,10 +23779,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23705
23779
  return openBlock(), createElementBlock("div", _hoisted_1$q, [
23706
23780
  createBaseVNode("div", _hoisted_2$l, [
23707
23781
  createBaseVNode("button", {
23708
- onClick: withModifiers(handleClick, ["stop"]),
23782
+ id: id.value,
23709
23783
  class: normalizeClass(loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart"),
23710
23784
  "data-cy": "lupa-add-to-cart",
23711
- disabled: !inStockValue.value || loading.value
23785
+ disabled: !inStockValue.value || loading.value,
23786
+ onClick: withModifiers(handleClick, ["stop"])
23712
23787
  }, toDisplayString(label.value), 11, _hoisted_3$f)
23713
23788
  ])
23714
23789
  ]);
@@ -24545,7 +24620,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
24545
24620
  var _a;
24546
24621
  return openBlock(), createElementBlock("div", _hoisted_1$g, [
24547
24622
  createBaseVNode("div", _hoisted_2$d, [
24548
- firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1j, {
24623
+ firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1k, {
24549
24624
  key: 0,
24550
24625
  "wrapper-class": "lupa-related-query-image-wrapper",
24551
24626
  "image-class": "lupa-related-query-image",
@@ -32378,7 +32453,7 @@ const _hoisted_4 = {
32378
32453
  key: 0,
32379
32454
  class: "lupasearch-chat-content"
32380
32455
  };
32381
- const _sfc_main$1s = /* @__PURE__ */ defineComponent({
32456
+ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
32382
32457
  __name: "ChatContainer",
32383
32458
  props: {
32384
32459
  options: {}
@@ -38923,7 +38998,7 @@ const chat = (options, mountOptions) => {
38923
38998
  const instance = createVue(
38924
38999
  options.displayOptions.containerSelector,
38925
39000
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
38926
- _sfc_main$1s,
39001
+ _sfc_main$1t,
38927
39002
  {
38928
39003
  options
38929
39004
  }