@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.
@@ -7651,12 +7651,11 @@ var SearchBoxPanelType = /* @__PURE__ */ ((SearchBoxPanelType2) => {
7651
7651
  return SearchBoxPanelType2;
7652
7652
  })(SearchBoxPanelType || {});
7653
7653
  var BadgeType = /* @__PURE__ */ ((BadgeType2) => {
7654
- BadgeType2["DISCOUNTPERCENTAGE"] = "discountPercentage";
7655
- BadgeType2["DISCOUNTAMOUNT"] = "discountAmount";
7656
7654
  BadgeType2["NEWITEM"] = "newItem";
7657
7655
  BadgeType2["TEXT"] = "text";
7658
7656
  BadgeType2["IMAGE"] = "image";
7659
7657
  BadgeType2["CUSTOM_HTML"] = "customHtml";
7658
+ BadgeType2["DISCOUNT"] = "discount";
7660
7659
  return BadgeType2;
7661
7660
  })(BadgeType || {});
7662
7661
  const retrieveHistory = () => {
@@ -8609,7 +8608,7 @@ const _hoisted_8$3 = {
8609
8608
  key: 0,
8610
8609
  class: "lupa-close-label"
8611
8610
  };
8612
- const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8611
+ const _sfc_main$1s = /* @__PURE__ */ defineComponent({
8613
8612
  __name: "SearchBoxInput",
8614
8613
  props: {
8615
8614
  options: {},
@@ -8739,7 +8738,7 @@ const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8739
8738
  };
8740
8739
  }
8741
8740
  });
8742
- const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8741
+ const _sfc_main$1r = /* @__PURE__ */ defineComponent({
8743
8742
  __name: "SearchBoxMoreResults",
8744
8743
  props: {
8745
8744
  labels: {},
@@ -8773,7 +8772,7 @@ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8773
8772
  });
8774
8773
  const _hoisted_1$1f = { class: "lupa-search-box-history-item" };
8775
8774
  const _hoisted_2$T = { class: "lupa-search-box-history-item-content" };
8776
- const _sfc_main$1p = /* @__PURE__ */ defineComponent({
8775
+ const _sfc_main$1q = /* @__PURE__ */ defineComponent({
8777
8776
  __name: "SearchBoxHistoryItem",
8778
8777
  props: {
8779
8778
  item: {},
@@ -8808,7 +8807,7 @@ const _hoisted_1$1e = {
8808
8807
  key: 0,
8809
8808
  class: "lupa-search-box-history-panel"
8810
8809
  };
8811
- const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8810
+ const _sfc_main$1p = /* @__PURE__ */ defineComponent({
8812
8811
  __name: "SearchBoxHistoryPanel",
8813
8812
  props: {
8814
8813
  options: {}
@@ -8851,7 +8850,7 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8851
8850
  return (_ctx, _cache) => {
8852
8851
  return hasHistory.value ? (openBlock(), createElementBlock("div", _hoisted_1$1e, [
8853
8852
  (openBlock(true), createElementBlock(Fragment, null, renderList(unref(history), (item, index) => {
8854
- return openBlock(), createBlock(_sfc_main$1p, {
8853
+ return openBlock(), createBlock(_sfc_main$1q, {
8855
8854
  key: item,
8856
8855
  item,
8857
8856
  highlighted: index === highlightIndex.value,
@@ -8868,7 +8867,7 @@ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8868
8867
  }
8869
8868
  });
8870
8869
  const _hoisted_1$1d = { class: "lupa-search-box-no-results" };
8871
- const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8870
+ const _sfc_main$1o = /* @__PURE__ */ defineComponent({
8872
8871
  __name: "SearchBoxNoResults",
8873
8872
  props: {
8874
8873
  labels: {}
@@ -8926,7 +8925,7 @@ const _hoisted_5$i = {
8926
8925
  class: "lupa-suggestion-facet-value",
8927
8926
  "data-cy": "lupa-suggestion-facet-value"
8928
8927
  };
8929
- const _sfc_main$1m = /* @__PURE__ */ defineComponent({
8928
+ const _sfc_main$1n = /* @__PURE__ */ defineComponent({
8930
8929
  __name: "SearchBoxSuggestion",
8931
8930
  props: {
8932
8931
  suggestion: {},
@@ -8975,7 +8974,7 @@ const _hoisted_1$1b = {
8975
8974
  id: "lupa-search-box-suggestions",
8976
8975
  "data-cy": "lupa-search-box-suggestions"
8977
8976
  };
8978
- const _sfc_main$1l = /* @__PURE__ */ defineComponent({
8977
+ const _sfc_main$1m = /* @__PURE__ */ defineComponent({
8979
8978
  __name: "SearchBoxSuggestions",
8980
8979
  props: {
8981
8980
  items: {},
@@ -9037,7 +9036,7 @@ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
9037
9036
  return (_ctx, _cache) => {
9038
9037
  return openBlock(), createElementBlock("div", _hoisted_1$1b, [
9039
9038
  (openBlock(true), createElementBlock(Fragment, null, renderList(items.value, (item, index) => {
9040
- return openBlock(), createBlock(_sfc_main$1m, {
9039
+ return openBlock(), createBlock(_sfc_main$1n, {
9041
9040
  key: getSuggestionKey(item),
9042
9041
  class: normalizeClass(["lupa-suggestion", index === highlightedIndex.value ? "lupa-suggestion-highlighted" : ""]),
9043
9042
  suggestion: item,
@@ -9065,7 +9064,7 @@ const debounce$1 = (func, timeout) => {
9065
9064
  }, timeout);
9066
9065
  };
9067
9066
  };
9068
- const _sfc_main$1k = /* @__PURE__ */ defineComponent({
9067
+ const _sfc_main$1l = /* @__PURE__ */ defineComponent({
9069
9068
  __name: "SearchBoxSuggestionsWrapper",
9070
9069
  props: {
9071
9070
  panel: {},
@@ -9107,7 +9106,7 @@ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
9107
9106
  const getSuggestionsDebounced = debounce$1(getSuggestions, props.debounce);
9108
9107
  watch(() => props.panel.limit, getSuggestionsDebounced);
9109
9108
  return (_ctx, _cache) => {
9110
- return openBlock(), createBlock(_sfc_main$1l, {
9109
+ return openBlock(), createBlock(_sfc_main$1m, {
9111
9110
  items: searchResult.value,
9112
9111
  highlight: _ctx.panel.highlight,
9113
9112
  queryKey: _ctx.panel.queryKey,
@@ -18106,9 +18105,13 @@ const renderHtmlTemplate = (template, document2 = {}) => {
18106
18105
  const getFieldValue = (doc2, field = "") => {
18107
18106
  var _a;
18108
18107
  if (typeof field === "number") {
18109
- return field;
18108
+ return +field;
18109
+ }
18110
+ const value = (_a = field == null ? void 0 : field.split(".")) == null ? void 0 : _a.reduce((obj, key) => obj ? obj[key] : void 0, doc2);
18111
+ if (+value) {
18112
+ return +value;
18110
18113
  }
18111
- return (_a = field == null ? void 0 : field.split(".")) == null ? void 0 : _a.reduce((obj, key) => obj ? obj[key] : void 0, doc2);
18114
+ return value;
18112
18115
  };
18113
18116
  const processDisplayCondition = (displayCondition, doc2 = {}) => {
18114
18117
  const { condition, fields } = displayCondition;
@@ -18183,7 +18186,7 @@ const replaceImageWithPlaceholder = (e2, placeholder) => {
18183
18186
  };
18184
18187
  const _hoisted_1$1a = ["src"];
18185
18188
  const _hoisted_2$R = ["src"];
18186
- const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18189
+ const _sfc_main$1k = /* @__PURE__ */ defineComponent({
18187
18190
  __name: "ProductImage",
18188
18191
  props: {
18189
18192
  item: {},
@@ -18338,7 +18341,7 @@ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18338
18341
  };
18339
18342
  }
18340
18343
  });
18341
- const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18344
+ const _sfc_main$1j = /* @__PURE__ */ defineComponent({
18342
18345
  __name: "SearchBoxProductImage",
18343
18346
  props: {
18344
18347
  item: {},
@@ -18346,7 +18349,7 @@ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18346
18349
  },
18347
18350
  setup(__props) {
18348
18351
  return (_ctx, _cache) => {
18349
- return openBlock(), createBlock(_sfc_main$1j, {
18352
+ return openBlock(), createBlock(_sfc_main$1k, {
18350
18353
  item: _ctx.item,
18351
18354
  options: _ctx.options,
18352
18355
  "wrapper-class": "lupa-search-box-image-wrapper",
@@ -18360,7 +18363,7 @@ const _hoisted_2$Q = {
18360
18363
  key: 1,
18361
18364
  class: "lupa-search-box-product-title"
18362
18365
  };
18363
- const _sfc_main$1h = /* @__PURE__ */ defineComponent({
18366
+ const _sfc_main$1i = /* @__PURE__ */ defineComponent({
18364
18367
  __name: "SearchBoxProductTitle",
18365
18368
  props: {
18366
18369
  item: {},
@@ -18394,7 +18397,7 @@ const _hoisted_2$P = {
18394
18397
  key: 1,
18395
18398
  class: "lupa-search-box-product-description"
18396
18399
  };
18397
- const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18400
+ const _sfc_main$1h = /* @__PURE__ */ defineComponent({
18398
18401
  __name: "SearchBoxProductDescription",
18399
18402
  props: {
18400
18403
  item: {},
@@ -18422,7 +18425,7 @@ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18422
18425
  }
18423
18426
  });
18424
18427
  const _hoisted_1$17 = { class: "lupa-search-box-product-price" };
18425
- const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18428
+ const _sfc_main$1g = /* @__PURE__ */ defineComponent({
18426
18429
  __name: "SearchBoxProductPrice",
18427
18430
  props: {
18428
18431
  item: {},
@@ -18446,7 +18449,7 @@ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18446
18449
  };
18447
18450
  }
18448
18451
  });
18449
- const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18452
+ const _sfc_main$1f = /* @__PURE__ */ defineComponent({
18450
18453
  __name: "SearchBoxProductRegularPrice",
18451
18454
  props: {
18452
18455
  item: {},
@@ -18478,7 +18481,7 @@ const _hoisted_2$O = { key: 0 };
18478
18481
  const _hoisted_3$B = { key: 1 };
18479
18482
  const _hoisted_4$r = { class: "lupa-search-box-custom-label" };
18480
18483
  const _hoisted_5$h = { class: "lupa-search-box-custom-text" };
18481
- const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18484
+ const _sfc_main$1e = /* @__PURE__ */ defineComponent({
18482
18485
  __name: "SearchBoxProductCustom",
18483
18486
  props: {
18484
18487
  item: {},
@@ -18517,7 +18520,7 @@ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18517
18520
  }
18518
18521
  });
18519
18522
  const _hoisted_1$15 = ["innerHTML"];
18520
- const _sfc_main$1c = /* @__PURE__ */ defineComponent({
18523
+ const _sfc_main$1d = /* @__PURE__ */ defineComponent({
18521
18524
  __name: "SearchBoxProductCustomHtml",
18522
18525
  props: {
18523
18526
  item: {},
@@ -18779,7 +18782,7 @@ const useSearchResultStore = defineStore("searchResult", () => {
18779
18782
  const _hoisted_1$14 = { class: "lupa-search-box-add-to-cart-wrapper" };
18780
18783
  const _hoisted_2$N = { class: "lupa-search-box-product-addtocart" };
18781
18784
  const _hoisted_3$A = ["onClick", "disabled"];
18782
- const _sfc_main$1b = /* @__PURE__ */ defineComponent({
18785
+ const _sfc_main$1c = /* @__PURE__ */ defineComponent({
18783
18786
  __name: "SearchBoxProductAddToCart",
18784
18787
  props: {
18785
18788
  item: {},
@@ -18832,17 +18835,17 @@ const _hoisted_1$13 = {
18832
18835
  };
18833
18836
  const __default__$4 = {
18834
18837
  components: {
18835
- SearchBoxProductImage: _sfc_main$1i,
18836
- SearchBoxProductTitle: _sfc_main$1h,
18837
- SearchBoxProductDescription: _sfc_main$1g,
18838
- SearchBoxProductPrice: _sfc_main$1f,
18839
- SearchBoxProductRegularPrice: _sfc_main$1e,
18840
- SearchBoxProductCustom: _sfc_main$1d,
18841
- SearchBoxProductCustomHtml: _sfc_main$1c,
18842
- SearchBoxProductAddToCart: _sfc_main$1b
18838
+ SearchBoxProductImage: _sfc_main$1j,
18839
+ SearchBoxProductTitle: _sfc_main$1i,
18840
+ SearchBoxProductDescription: _sfc_main$1h,
18841
+ SearchBoxProductPrice: _sfc_main$1g,
18842
+ SearchBoxProductRegularPrice: _sfc_main$1f,
18843
+ SearchBoxProductCustom: _sfc_main$1e,
18844
+ SearchBoxProductCustomHtml: _sfc_main$1d,
18845
+ SearchBoxProductAddToCart: _sfc_main$1c
18843
18846
  }
18844
18847
  };
18845
- const _sfc_main$1a = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
18848
+ const _sfc_main$1b = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$4), {
18846
18849
  __name: "SearchBoxProductElement",
18847
18850
  props: {
18848
18851
  item: {},
@@ -18926,7 +18929,7 @@ const _hoisted_4$q = {
18926
18929
  key: 0,
18927
18930
  class: "lupa-badge-full-text"
18928
18931
  };
18929
- const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18932
+ const _sfc_main$1a = /* @__PURE__ */ defineComponent({
18930
18933
  __name: "SearchResultGeneratedBadge",
18931
18934
  props: {
18932
18935
  options: {},
@@ -18972,7 +18975,7 @@ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18972
18975
  }
18973
18976
  });
18974
18977
  const _hoisted_1$11 = { class: "lupa-generated-badges" };
18975
- const _sfc_main$18 = /* @__PURE__ */ defineComponent({
18978
+ const _sfc_main$19 = /* @__PURE__ */ defineComponent({
18976
18979
  __name: "SearchResultGeneratedBadges",
18977
18980
  props: {
18978
18981
  options: {}
@@ -19000,7 +19003,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
19000
19003
  return (_ctx, _cache) => {
19001
19004
  return openBlock(), createElementBlock("div", _hoisted_1$11, [
19002
19005
  (openBlock(true), createElementBlock(Fragment, null, renderList(badges.value, (badge) => {
19003
- return openBlock(), createBlock(_sfc_main$19, {
19006
+ return openBlock(), createBlock(_sfc_main$1a, {
19004
19007
  key: badge.id,
19005
19008
  badge,
19006
19009
  options: _ctx.options
@@ -19011,7 +19014,7 @@ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
19011
19014
  }
19012
19015
  });
19013
19016
  const _hoisted_1$10 = ["innerHTML"];
19014
- const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19017
+ const _sfc_main$18 = /* @__PURE__ */ defineComponent({
19015
19018
  __name: "CustomBadge",
19016
19019
  props: {
19017
19020
  badge: {}
@@ -19037,7 +19040,7 @@ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19037
19040
  }
19038
19041
  });
19039
19042
  const _hoisted_1$$ = { class: "lupa-text-badges" };
19040
- const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19043
+ const _sfc_main$17 = /* @__PURE__ */ defineComponent({
19041
19044
  __name: "TextBadge",
19042
19045
  props: {
19043
19046
  badge: {}
@@ -19045,8 +19048,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19045
19048
  setup(__props) {
19046
19049
  const props = __props;
19047
19050
  const badges = computed(() => {
19048
- var _a, _b;
19049
- return (_b = (_a = props.badge) == null ? void 0 : _a.value) != null ? _b : [];
19051
+ return Array.isArray(props.badge.value) ? props.badge.value : [props.badge.value];
19050
19052
  });
19051
19053
  const displayBadges = computed(() => {
19052
19054
  return badges.value.slice(0, props.badge.maxItems);
@@ -19065,7 +19067,7 @@ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19065
19067
  });
19066
19068
  const _hoisted_1$_ = { class: "lupa-image-badges" };
19067
19069
  const _hoisted_2$L = ["src"];
19068
- const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19070
+ const _sfc_main$16 = /* @__PURE__ */ defineComponent({
19069
19071
  __name: "ImageBadge",
19070
19072
  props: {
19071
19073
  badge: {}
@@ -19073,7 +19075,7 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19073
19075
  setup(__props) {
19074
19076
  const props = __props;
19075
19077
  const badges = computed(() => {
19076
- return props.badge.value;
19078
+ return Array.isArray(props.badge.value) ? props.badge.value : [props.badge.value];
19077
19079
  });
19078
19080
  const displayBadges = computed(() => {
19079
19081
  return badges.value.slice(0, props.badge.maxItems);
@@ -19100,12 +19102,71 @@ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19100
19102
  };
19101
19103
  }
19102
19104
  });
19105
+ const _sfc_main$15 = /* @__PURE__ */ defineComponent({
19106
+ __name: "DiscountBadge",
19107
+ props: {
19108
+ badge: {}
19109
+ },
19110
+ setup(__props) {
19111
+ const props = __props;
19112
+ const optionStore = useOptionsStore();
19113
+ const { searchResultOptions } = storeToRefs(optionStore);
19114
+ const className = computed(() => {
19115
+ var _a;
19116
+ return (_a = props.badge.className) != null ? _a : "";
19117
+ });
19118
+ const discountValue = computed(() => {
19119
+ var _a, _b, _c, _d;
19120
+ if (props.badge.discountKey) {
19121
+ return (_b = (_a = props.badge.product) == null ? void 0 : _a[props.badge.discountKey]) != null ? _b : 0;
19122
+ }
19123
+ if (props.badge.regularPriceKey && props.badge.finalPriceKey) {
19124
+ const regularPrice = +((_c = props.badge.product) == null ? void 0 : _c[props.badge.regularPriceKey]);
19125
+ const finalPrice = +((_d = props.badge.product) == null ? void 0 : _d[props.badge.finalPriceKey]);
19126
+ if (!regularPrice || !finalPrice) {
19127
+ return 0;
19128
+ }
19129
+ if (props.badge.discountType === "percentage") {
19130
+ return (regularPrice - finalPrice) / regularPrice * 100;
19131
+ } else {
19132
+ return regularPrice - finalPrice;
19133
+ }
19134
+ }
19135
+ return 0;
19136
+ });
19137
+ const discountStringValue = computed(() => {
19138
+ var _a, _b, _c, _d;
19139
+ return props.badge.discountType === "percentage" ? discountValue.value.toFixed(0) : formatPrice(
19140
+ discountValue.value,
19141
+ (_b = (_a = searchResultOptions.value) == null ? void 0 : _a.labels) == null ? void 0 : _b.currency,
19142
+ (_d = (_c = searchResultOptions.value) == null ? void 0 : _c.labels) == null ? void 0 : _d.priceSeparator
19143
+ );
19144
+ });
19145
+ const hasDiscount = computed(() => {
19146
+ return Boolean(discountValue.value) && discountValue.value > 0;
19147
+ });
19148
+ const discount = computed(() => {
19149
+ var _a, _b, _c, _d;
19150
+ const defaultPostfix = props.badge.discountType === "percentage" ? " %" : "";
19151
+ const prefix = (_b = (_a = props.badge.labels) == null ? void 0 : _a.prefix) != null ? _b : "- ";
19152
+ const postfix = (_d = (_c = props.badge.labels) == null ? void 0 : _c.postfix) != null ? _d : defaultPostfix;
19153
+ return `${prefix}${discountStringValue.value}${postfix}`;
19154
+ });
19155
+ return (_ctx, _cache) => {
19156
+ return hasDiscount.value ? (openBlock(), createElementBlock("div", {
19157
+ key: 0,
19158
+ class: normalizeClass([className.value, "lupa-discount-badge"])
19159
+ }, toDisplayString(discount.value), 3)) : createCommentVNode("", true);
19160
+ };
19161
+ }
19162
+ });
19103
19163
  const _hoisted_1$Z = { id: "lupa-search-results-badges" };
19104
19164
  const __default__$3 = {
19105
19165
  components: {
19106
- CustomBadge: _sfc_main$17,
19107
- TextBadge: _sfc_main$16,
19108
- ImageBadge: _sfc_main$15
19166
+ CustomBadge: _sfc_main$18,
19167
+ TextBadge: _sfc_main$17,
19168
+ ImageBadge: _sfc_main$16,
19169
+ DiscountBadge: _sfc_main$15
19109
19170
  }
19110
19171
  };
19111
19172
  const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValues2({}, __default__$3), {
@@ -19164,6 +19225,8 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
19164
19225
  return "ImageBadge";
19165
19226
  case BadgeType.CUSTOM_HTML:
19166
19227
  return "CustomBadge";
19228
+ case BadgeType.DISCOUNT:
19229
+ return "DiscountBadge";
19167
19230
  default:
19168
19231
  return "CustomBadge";
19169
19232
  }
@@ -19180,7 +19243,7 @@ const _sfc_main$14 = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValu
19180
19243
  badge
19181
19244
  }, null, 8, ["badge"]);
19182
19245
  }), 128)),
19183
- positionValue.value === "card" ? (openBlock(), createBlock(_sfc_main$18, {
19246
+ positionValue.value === "card" ? (openBlock(), createBlock(_sfc_main$19, {
19184
19247
  key: 0,
19185
19248
  options: _ctx.options
19186
19249
  }, null, 8, ["options"])) : createCommentVNode("", true)
@@ -19281,7 +19344,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
19281
19344
  style: normalizeStyle(imageStyleOverride.value)
19282
19345
  }, [
19283
19346
  (openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
19284
- return openBlock(), createBlock(_sfc_main$1a, {
19347
+ return openBlock(), createBlock(_sfc_main$1b, {
19285
19348
  class: "lupa-search-box-product-element",
19286
19349
  item: _ctx.item,
19287
19350
  element,
@@ -19294,7 +19357,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
19294
19357
  createBaseVNode("div", _hoisted_2$K, [
19295
19358
  (openBlock(true), createElementBlock(Fragment, null, renderList(detailElements.value, (element) => {
19296
19359
  var _a;
19297
- return openBlock(), createBlock(_sfc_main$1a, {
19360
+ return openBlock(), createBlock(_sfc_main$1b, {
19298
19361
  key: element.key,
19299
19362
  class: "lupa-search-box-product-element",
19300
19363
  item: _ctx.item,
@@ -19316,7 +19379,7 @@ const _sfc_main$13 = /* @__PURE__ */ defineComponent({
19316
19379
  }), 128))
19317
19380
  ]),
19318
19381
  addToCartElement.value ? (openBlock(), createElementBlock("div", _hoisted_3$y, [
19319
- createVNode(_sfc_main$1a, {
19382
+ createVNode(_sfc_main$1b, {
19320
19383
  class: "lupa-search-box-product-element",
19321
19384
  item: _ctx.item,
19322
19385
  element: addToCartElement.value,
@@ -19716,7 +19779,7 @@ const _hoisted_5$g = {
19716
19779
  };
19717
19780
  const __default__$2 = {
19718
19781
  components: {
19719
- SearchBoxSuggestionsWrapper: _sfc_main$1k,
19782
+ SearchBoxSuggestionsWrapper: _sfc_main$1l,
19720
19783
  SearchBoxProductsWrapper: _sfc_main$10,
19721
19784
  SearchBoxRelatedSourceWrapper: _sfc_main$$
19722
19785
  }
@@ -19925,18 +19988,18 @@ const _sfc_main$_ = /* @__PURE__ */ defineComponent(__spreadProps2(__spreadValue
19925
19988
  ], 14, _hoisted_2$I);
19926
19989
  }), 128))
19927
19990
  ], 4),
19928
- !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1n, {
19991
+ !unref(hasAnyResults) && _ctx.options.showNoResultsPanel ? (openBlock(), createBlock(_sfc_main$1o, {
19929
19992
  key: 1,
19930
19993
  labels: labels.value
19931
19994
  }, null, 8, ["labels"])) : createCommentVNode("", true),
19932
- unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1q, {
19995
+ unref(hasAnyResults) || !_ctx.options.hideMoreResultsButtonOnNoResults ? (openBlock(), createBlock(_sfc_main$1r, {
19933
19996
  key: 2,
19934
19997
  labels: labels.value,
19935
19998
  showTotalCount: (_a = _ctx.options.showTotalCount) != null ? _a : false,
19936
19999
  onGoToResults: _cache[4] || (_cache[4] = ($event) => _ctx.$emit("go-to-results"))
19937
20000
  }, null, 8, ["labels", "showTotalCount"])) : createCommentVNode("", true)
19938
20001
  ])) : displayHistory.value ? (openBlock(), createElementBlock("div", _hoisted_5$g, [
19939
- createVNode(_sfc_main$1o, {
20002
+ createVNode(_sfc_main$1p, {
19940
20003
  options: _ctx.options.history,
19941
20004
  history: history.value,
19942
20005
  onGoToResults: handleGoToResults,
@@ -20225,7 +20288,7 @@ const _sfc_main$Z = /* @__PURE__ */ defineComponent({
20225
20288
  var _a2;
20226
20289
  return openBlock(), createElementBlock("div", _hoisted_1$U, [
20227
20290
  createBaseVNode("div", _hoisted_2$H, [
20228
- createVNode(_sfc_main$1r, {
20291
+ createVNode(_sfc_main$1s, {
20229
20292
  options: inputOptions.value,
20230
20293
  suggestedValue: suggestedValue.value,
20231
20294
  "can-close": (_a2 = _ctx.isSearchContainer) != null ? _a2 : false,
@@ -23419,7 +23482,7 @@ const _sfc_main$z = /* @__PURE__ */ defineComponent({
23419
23482
  },
23420
23483
  setup(__props) {
23421
23484
  return (_ctx, _cache) => {
23422
- return openBlock(), createBlock(_sfc_main$1j, {
23485
+ return openBlock(), createBlock(_sfc_main$1k, {
23423
23486
  item: _ctx.item,
23424
23487
  options: _ctx.options,
23425
23488
  "wrapper-class": "lupa-search-results-image-wrapper",
@@ -23568,7 +23631,13 @@ const _sfc_main$w = /* @__PURE__ */ defineComponent({
23568
23631
  return new Array(STAR_COUNT).fill(RATING_STAR_HTML);
23569
23632
  });
23570
23633
  const ratingPercentage = computed(() => {
23571
- return props.options.getRatingPercentage ? props.options.getRatingPercentage(props.item) : currentRating.value;
23634
+ if (props.options.getRatingPercentage) {
23635
+ return props.options.getRatingPercentage(props.item);
23636
+ }
23637
+ if (props.options.maxRating) {
23638
+ return currentRating.value / props.options.maxRating * 100;
23639
+ }
23640
+ return currentRating.value;
23572
23641
  });
23573
23642
  const ratingLink = computed(() => {
23574
23643
  var _a;
@@ -23670,7 +23739,7 @@ const _sfc_main$u = /* @__PURE__ */ defineComponent({
23670
23739
  });
23671
23740
  const _hoisted_1$q = { class: "lupa-search-results-add-to-cart-wrapper" };
23672
23741
  const _hoisted_2$l = { class: "lupa-search-results-product-addtocart" };
23673
- const _hoisted_3$f = ["onClick", "disabled"];
23742
+ const _hoisted_3$f = ["id", "disabled", "onClick"];
23674
23743
  const _sfc_main$t = /* @__PURE__ */ defineComponent({
23675
23744
  __name: "SearchResultsProductAddToCart",
23676
23745
  props: {
@@ -23691,11 +23760,16 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23691
23760
  const label = computed(() => {
23692
23761
  return props.options.labels.addToCart;
23693
23762
  });
23763
+ const id = computed(() => {
23764
+ var _a;
23765
+ const id2 = (_a = props.item.id) != null ? _a : "";
23766
+ return `lupa-add-to-cart-${id2}`;
23767
+ });
23694
23768
  const handleClick = () => __async2(this, null, function* () {
23695
23769
  loading.value = true;
23696
23770
  if (props.options.emitEvent) {
23697
23771
  const event = new CustomEvent(props.options.emitEvent, { detail: { item: props.item } });
23698
- window.dispatchEvent(event);
23772
+ document.dispatchEvent(event);
23699
23773
  }
23700
23774
  if (props.options.action) {
23701
23775
  yield props.options.action(props.item, addToCartAmount.value);
@@ -23707,10 +23781,11 @@ const _sfc_main$t = /* @__PURE__ */ defineComponent({
23707
23781
  return openBlock(), createElementBlock("div", _hoisted_1$q, [
23708
23782
  createBaseVNode("div", _hoisted_2$l, [
23709
23783
  createBaseVNode("button", {
23710
- onClick: withModifiers(handleClick, ["stop"]),
23784
+ id: id.value,
23711
23785
  class: normalizeClass(loading.value ? "lupa-add-to-cart-loading" : "lupa-add-to-cart"),
23712
23786
  "data-cy": "lupa-add-to-cart",
23713
- disabled: !inStockValue.value || loading.value
23787
+ disabled: !inStockValue.value || loading.value,
23788
+ onClick: withModifiers(handleClick, ["stop"])
23714
23789
  }, toDisplayString(label.value), 11, _hoisted_3$f)
23715
23790
  ])
23716
23791
  ]);
@@ -24547,7 +24622,7 @@ const _sfc_main$i = /* @__PURE__ */ defineComponent({
24547
24622
  var _a;
24548
24623
  return openBlock(), createElementBlock("div", _hoisted_1$g, [
24549
24624
  createBaseVNode("div", _hoisted_2$d, [
24550
- firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1j, {
24625
+ firstResultItem.value && image.value ? (openBlock(), createBlock(_sfc_main$1k, {
24551
24626
  key: 0,
24552
24627
  "wrapper-class": "lupa-related-query-image-wrapper",
24553
24628
  "image-class": "lupa-related-query-image",
@@ -32380,7 +32455,7 @@ const _hoisted_4 = {
32380
32455
  key: 0,
32381
32456
  class: "lupasearch-chat-content"
32382
32457
  };
32383
- const _sfc_main$1s = /* @__PURE__ */ defineComponent({
32458
+ const _sfc_main$1t = /* @__PURE__ */ defineComponent({
32384
32459
  __name: "ChatContainer",
32385
32460
  props: {
32386
32461
  options: {}
@@ -38925,7 +39000,7 @@ const chat = (options, mountOptions) => {
38925
39000
  const instance = createVue(
38926
39001
  options.displayOptions.containerSelector,
38927
39002
  mountOptions == null ? void 0 : mountOptions.mountingBehavior,
38928
- _sfc_main$1s,
39003
+ _sfc_main$1t,
38929
39004
  {
38930
39005
  options
38931
39006
  }