@getlupa/client 0.7.0-alpha-20 → 0.7.0-alpha-23

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.
@@ -2,8 +2,10 @@ import { BadgeElement, BadgeOptions } from "@/types/search-results/BadgeOptions"
2
2
  import { AnchorPosition } from "@/types/search-results/SearchResultsProductCardOptions";
3
3
  import Vue from "vue";
4
4
  export default class SearchResultsBadgeWrapper extends Vue {
5
+ position: "card" | "image";
5
6
  options: BadgeOptions;
6
7
  get anchorPosition(): AnchorPosition;
7
8
  get badges(): BadgeElement[];
9
+ get displayBadges(): BadgeElement[];
8
10
  getBadgeComponent(type: string): string;
9
11
  }
@@ -16986,6 +16986,11 @@ let SearchResultsBadgeWrapper = class SearchResultsBadgeWrapper extends Vue$1 {
16986
16986
  return Object.assign(Object.assign({}, x), { value: ((_a = this.options.product) === null || _a === void 0 ? void 0 : _a[x.key]) || "badge", product: this.options.product });
16987
16987
  });
16988
16988
  }
16989
+ get displayBadges() {
16990
+ return this.position === "card"
16991
+ ? this.badges.filter((b) => !b.position || b.position === "card")
16992
+ : this.badges.filter((b) => b.position === "image");
16993
+ }
16989
16994
  getBadgeComponent(type) {
16990
16995
  switch (type) {
16991
16996
  case exports.BadgeType.TEXT:
@@ -16999,6 +17004,9 @@ let SearchResultsBadgeWrapper = class SearchResultsBadgeWrapper extends Vue$1 {
16999
17004
  }
17000
17005
  }
17001
17006
  };
17007
+ __decorate([
17008
+ Prop({ default: "card" })
17009
+ ], SearchResultsBadgeWrapper.prototype, "position", void 0);
17002
17010
  __decorate([
17003
17011
  Prop({ default: {} })
17004
17012
  ], SearchResultsBadgeWrapper.prototype, "options", void 0);
@@ -17028,7 +17036,7 @@ var __vue_render__$x = function () {
17028
17036
  "div",
17029
17037
  { class: _vm.anchorPosition, attrs: { id: "lupa-badges" } },
17030
17038
  [
17031
- _vm._l(_vm.badges, function (badge, index) {
17039
+ _vm._l(_vm.displayBadges, function (badge, index) {
17032
17040
  return _c(_vm.getBadgeComponent(badge.type), {
17033
17041
  key: index,
17034
17042
  tag: "search-results-badge",
@@ -18160,6 +18168,11 @@ var __vue_render__$m = function () {
18160
18168
  })
18161
18169
  }),
18162
18170
  _vm._v(" "),
18171
+ _c("SearchResultsBadgeWrapper", {
18172
+ staticClass: "lupa-image-badges",
18173
+ attrs: { options: _vm.badgesOptions, position: "image" },
18174
+ }),
18175
+ _vm._v(" "),
18163
18176
  _vm.labels.outOfStock && !_vm.isInStock
18164
18177
  ? _c("div", { staticClass: "lupa-out-of-stock" }, [
18165
18178
  _vm._v(
@@ -22437,7 +22450,6 @@ const searchBox = (options) => {
22437
22450
  });
22438
22451
  };
22439
22452
  const searchResults = (options) => {
22440
- clearSearchResults();
22441
22453
  Vue$1.use(Vuex);
22442
22454
  app.results = new Vue$1({
22443
22455
  el: options.containerSelector,
@@ -22447,7 +22459,6 @@ const searchResults = (options) => {
22447
22459
  });
22448
22460
  };
22449
22461
  const productList = (options) => {
22450
- clearProductList();
22451
22462
  Vue$1.use(Vuex);
22452
22463
  app.productList = new Vue$1({
22453
22464
  el: options.containerSelector,
@@ -28,6 +28,7 @@ export declare type SearchResultBadgeElement<T = any> = {
28
28
  rootImageUrl?: string;
29
29
  maxItems?: number;
30
30
  html?: (doc: T) => string;
31
+ position?: "card" | "image";
31
32
  };
32
33
  export declare type BaseBadgeElement<T = any> = SearchResultBadgeElement<T> & {
33
34
  value?: string;
@@ -2,8 +2,10 @@ import { BadgeElement, BadgeOptions } from "@/types/search-results/BadgeOptions"
2
2
  import { AnchorPosition } from "@/types/search-results/SearchResultsProductCardOptions";
3
3
  import Vue from "vue";
4
4
  export default class SearchResultsBadgeWrapper extends Vue {
5
+ position: "card" | "image";
5
6
  options: BadgeOptions;
6
7
  get anchorPosition(): AnchorPosition;
7
8
  get badges(): BadgeElement[];
9
+ get displayBadges(): BadgeElement[];
8
10
  getBadgeComponent(type: string): string;
9
11
  }
@@ -16982,6 +16982,11 @@ let SearchResultsBadgeWrapper = class SearchResultsBadgeWrapper extends Vue$1 {
16982
16982
  return Object.assign(Object.assign({}, x), { value: ((_a = this.options.product) === null || _a === void 0 ? void 0 : _a[x.key]) || "badge", product: this.options.product });
16983
16983
  });
16984
16984
  }
16985
+ get displayBadges() {
16986
+ return this.position === "card"
16987
+ ? this.badges.filter((b) => !b.position || b.position === "card")
16988
+ : this.badges.filter((b) => b.position === "image");
16989
+ }
16985
16990
  getBadgeComponent(type) {
16986
16991
  switch (type) {
16987
16992
  case BadgeType.TEXT:
@@ -16995,6 +17000,9 @@ let SearchResultsBadgeWrapper = class SearchResultsBadgeWrapper extends Vue$1 {
16995
17000
  }
16996
17001
  }
16997
17002
  };
17003
+ __decorate([
17004
+ Prop({ default: "card" })
17005
+ ], SearchResultsBadgeWrapper.prototype, "position", void 0);
16998
17006
  __decorate([
16999
17007
  Prop({ default: {} })
17000
17008
  ], SearchResultsBadgeWrapper.prototype, "options", void 0);
@@ -17024,7 +17032,7 @@ var __vue_render__$x = function () {
17024
17032
  "div",
17025
17033
  { class: _vm.anchorPosition, attrs: { id: "lupa-badges" } },
17026
17034
  [
17027
- _vm._l(_vm.badges, function (badge, index) {
17035
+ _vm._l(_vm.displayBadges, function (badge, index) {
17028
17036
  return _c(_vm.getBadgeComponent(badge.type), {
17029
17037
  key: index,
17030
17038
  tag: "search-results-badge",
@@ -18156,6 +18164,11 @@ var __vue_render__$m = function () {
18156
18164
  })
18157
18165
  }),
18158
18166
  _vm._v(" "),
18167
+ _c("SearchResultsBadgeWrapper", {
18168
+ staticClass: "lupa-image-badges",
18169
+ attrs: { options: _vm.badgesOptions, position: "image" },
18170
+ }),
18171
+ _vm._v(" "),
18159
18172
  _vm.labels.outOfStock && !_vm.isInStock
18160
18173
  ? _c("div", { staticClass: "lupa-out-of-stock" }, [
18161
18174
  _vm._v(
@@ -22433,7 +22446,6 @@ const searchBox = (options) => {
22433
22446
  });
22434
22447
  };
22435
22448
  const searchResults = (options) => {
22436
- clearSearchResults();
22437
22449
  Vue$1.use(Vuex);
22438
22450
  app.results = new Vue$1({
22439
22451
  el: options.containerSelector,
@@ -22443,7 +22455,6 @@ const searchResults = (options) => {
22443
22455
  });
22444
22456
  };
22445
22457
  const productList = (options) => {
22446
- clearProductList();
22447
22458
  Vue$1.use(Vuex);
22448
22459
  app.productList = new Vue$1({
22449
22460
  el: options.containerSelector,
@@ -28,6 +28,7 @@ export declare type SearchResultBadgeElement<T = any> = {
28
28
  rootImageUrl?: string;
29
29
  maxItems?: number;
30
30
  html?: (doc: T) => string;
31
+ position?: "card" | "image";
31
32
  };
32
33
  export declare type BaseBadgeElement<T = any> = SearchResultBadgeElement<T> & {
33
34
  value?: string;
@@ -2,8 +2,10 @@ import { BadgeElement, BadgeOptions } from "@/types/search-results/BadgeOptions"
2
2
  import { AnchorPosition } from "@/types/search-results/SearchResultsProductCardOptions";
3
3
  import Vue from "vue";
4
4
  export default class SearchResultsBadgeWrapper extends Vue {
5
+ position: "card" | "image";
5
6
  options: BadgeOptions;
6
7
  get anchorPosition(): AnchorPosition;
7
8
  get badges(): BadgeElement[];
9
+ get displayBadges(): BadgeElement[];
8
10
  getBadgeComponent(type: string): string;
9
11
  }