@getlupa/client 0.8.0-alpha-2 → 0.8.0

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.
@@ -6,5 +6,6 @@ export default class SearchBoxProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -6,5 +6,6 @@ export default class SearchResultsProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -11640,6 +11640,9 @@ let SearchBoxProductCustom = class SearchBoxProductCustom extends Vue$1 {
11640
11640
  get className() {
11641
11641
  return this.options.className;
11642
11642
  }
11643
+ get label() {
11644
+ return this.options.label;
11645
+ }
11643
11646
  get isHtml() {
11644
11647
  var _a;
11645
11648
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -11670,7 +11673,17 @@ var __vue_render__$13 = function () {
11670
11673
  domProps: { innerHTML: _vm._s(_vm.text) },
11671
11674
  })
11672
11675
  : _c("div", { class: [_vm.className, "lupa-search-box-product-custom"] }, [
11673
- _vm._v("\n " + _vm._s(_vm.text) + "\n"),
11676
+ !_vm.label
11677
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
11678
+ : _c("div", [
11679
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
11680
+ _vm._v(_vm._s(_vm.label)),
11681
+ ]),
11682
+ _vm._v(" "),
11683
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
11684
+ _vm._v(_vm._s(_vm.text)),
11685
+ ]),
11686
+ ]),
11674
11687
  ])
11675
11688
  };
11676
11689
  var __vue_staticRenderFns__$13 = [];
@@ -17756,6 +17769,9 @@ let SearchResultsProductCustom = class SearchResultsProductCustom extends Vue$1
17756
17769
  get className() {
17757
17770
  return this.options.className;
17758
17771
  }
17772
+ get label() {
17773
+ return this.options.label;
17774
+ }
17759
17775
  get isHtml() {
17760
17776
  var _a;
17761
17777
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -17787,7 +17803,19 @@ var __vue_render__$p = function () {
17787
17803
  class: _vm.className,
17788
17804
  domProps: { innerHTML: _vm._s(_vm.text) },
17789
17805
  })
17790
- : _c("div", { class: _vm.className }, [_vm._v(_vm._s(_vm.text))])
17806
+ : _c("div", { class: _vm.className }, [
17807
+ !_vm.label
17808
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
17809
+ : _c("div", [
17810
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
17811
+ _vm._v(_vm._s(_vm.label)),
17812
+ ]),
17813
+ _vm._v(" "),
17814
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
17815
+ _vm._v(_vm._s(_vm.text)),
17816
+ ]),
17817
+ ]),
17818
+ ])
17791
17819
  };
17792
17820
  var __vue_staticRenderFns__$p = [];
17793
17821
  __vue_render__$p._withStripped = true;
@@ -20695,6 +20723,10 @@ __vue_render__$5._withStripped = true;
20695
20723
  undefined
20696
20724
  );
20697
20725
 
20726
+ const setDocumentTitle = (template, textToInsert = "") => {
20727
+ document.title = addParamsToLabel(template, textToInsert);
20728
+ };
20729
+
20698
20730
  const searchResult$1 = namespace("searchResult");
20699
20731
  const params$1 = namespace("params");
20700
20732
  const options$1 = namespace("options");
@@ -20742,6 +20774,9 @@ let SearchResults = class SearchResults extends Vue$1 {
20742
20774
  }
20743
20775
  handleMounted() {
20744
20776
  this.handleResize();
20777
+ if (this.isProductList) {
20778
+ setDocumentTitle(this.options.labels.htmlTitleTemplate, "");
20779
+ }
20745
20780
  const params = new URLSearchParams(window.location.search);
20746
20781
  this.handleUrlChange(params);
20747
20782
  this.addParams(parseParams(params));
@@ -21945,10 +21980,6 @@ HistoryModule = __decorate([
21945
21980
  ], HistoryModule);
21946
21981
  var history = HistoryModule;
21947
21982
 
21948
- const setDocumentTitle = (template, textToInsert = "") => {
21949
- document.title = addParamsToLabel(template, textToInsert);
21950
- };
21951
-
21952
21983
  let SearchResultModule = class SearchResultModule extends VuexModule {
21953
21984
  constructor() {
21954
21985
  super(...arguments);
@@ -22472,7 +22503,7 @@ const app = {
22472
22503
  const tracking = (options) => {
22473
22504
  initTracking(options);
22474
22505
  };
22475
- const searchBox = (options, mountOptions) => {
22506
+ const applySearchBox = (options, mountOptions) => {
22476
22507
  const existingInstance = app.box[options.inputSelector];
22477
22508
  if (existingInstance) {
22478
22509
  existingInstance.searchBoxOptions = options;
@@ -22493,6 +22524,15 @@ const searchBox = (options, mountOptions) => {
22493
22524
  });
22494
22525
  app.box[options.inputSelector] = instance;
22495
22526
  };
22527
+ const searchBox = (options, mountOptions) => {
22528
+ var _a;
22529
+ // Support for multiple search box selectors separated by a comma
22530
+ // Quite often multiple search boxes are required, since mobile and desktop has different inputs in html layout
22531
+ const inputs = (_a = options.inputSelector) === null || _a === void 0 ? void 0 : _a.split(",");
22532
+ for (const input of inputs) {
22533
+ applySearchBox(Object.assign(Object.assign({}, options), { inputSelector: input.trim() }), mountOptions);
22534
+ }
22535
+ };
22496
22536
  const searchResults = (options, mountOptions) => {
22497
22537
  const existingInstance = app.results[options.containerSelector];
22498
22538
  if (existingInstance) {
@@ -38,6 +38,7 @@ export declare type CustomDocumentElement<T = any> = DocumentElementBase<T> & {
38
38
  maxLines?: number;
39
39
  className: string;
40
40
  key: string;
41
+ label?: string;
41
42
  };
42
43
  export declare type PriceElement<T = any> = DocumentElementBase<T> & {
43
44
  type: DocumentElementType.PRICE;
@@ -6,5 +6,6 @@ export default class SearchBoxProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -6,5 +6,6 @@ export default class SearchResultsProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -11636,6 +11636,9 @@ let SearchBoxProductCustom = class SearchBoxProductCustom extends Vue$1 {
11636
11636
  get className() {
11637
11637
  return this.options.className;
11638
11638
  }
11639
+ get label() {
11640
+ return this.options.label;
11641
+ }
11639
11642
  get isHtml() {
11640
11643
  var _a;
11641
11644
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -11666,7 +11669,17 @@ var __vue_render__$13 = function () {
11666
11669
  domProps: { innerHTML: _vm._s(_vm.text) },
11667
11670
  })
11668
11671
  : _c("div", { class: [_vm.className, "lupa-search-box-product-custom"] }, [
11669
- _vm._v("\n " + _vm._s(_vm.text) + "\n"),
11672
+ !_vm.label
11673
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
11674
+ : _c("div", [
11675
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
11676
+ _vm._v(_vm._s(_vm.label)),
11677
+ ]),
11678
+ _vm._v(" "),
11679
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
11680
+ _vm._v(_vm._s(_vm.text)),
11681
+ ]),
11682
+ ]),
11670
11683
  ])
11671
11684
  };
11672
11685
  var __vue_staticRenderFns__$13 = [];
@@ -17752,6 +17765,9 @@ let SearchResultsProductCustom = class SearchResultsProductCustom extends Vue$1
17752
17765
  get className() {
17753
17766
  return this.options.className;
17754
17767
  }
17768
+ get label() {
17769
+ return this.options.label;
17770
+ }
17755
17771
  get isHtml() {
17756
17772
  var _a;
17757
17773
  return (_a = this.options.isHtml) !== null && _a !== void 0 ? _a : false;
@@ -17783,7 +17799,19 @@ var __vue_render__$p = function () {
17783
17799
  class: _vm.className,
17784
17800
  domProps: { innerHTML: _vm._s(_vm.text) },
17785
17801
  })
17786
- : _c("div", { class: _vm.className }, [_vm._v(_vm._s(_vm.text))])
17802
+ : _c("div", { class: _vm.className }, [
17803
+ !_vm.label
17804
+ ? _c("div", [_vm._v("\n " + _vm._s(_vm.text) + "\n ")])
17805
+ : _c("div", [
17806
+ _c("div", { staticClass: "lupa-search-box-custom-label" }, [
17807
+ _vm._v(_vm._s(_vm.label)),
17808
+ ]),
17809
+ _vm._v(" "),
17810
+ _c("div", { staticClass: "lupa-search-box-custom-text" }, [
17811
+ _vm._v(_vm._s(_vm.text)),
17812
+ ]),
17813
+ ]),
17814
+ ])
17787
17815
  };
17788
17816
  var __vue_staticRenderFns__$p = [];
17789
17817
  __vue_render__$p._withStripped = true;
@@ -20691,6 +20719,10 @@ __vue_render__$5._withStripped = true;
20691
20719
  undefined
20692
20720
  );
20693
20721
 
20722
+ const setDocumentTitle = (template, textToInsert = "") => {
20723
+ document.title = addParamsToLabel(template, textToInsert);
20724
+ };
20725
+
20694
20726
  const searchResult$1 = namespace("searchResult");
20695
20727
  const params$1 = namespace("params");
20696
20728
  const options$1 = namespace("options");
@@ -20738,6 +20770,9 @@ let SearchResults = class SearchResults extends Vue$1 {
20738
20770
  }
20739
20771
  handleMounted() {
20740
20772
  this.handleResize();
20773
+ if (this.isProductList) {
20774
+ setDocumentTitle(this.options.labels.htmlTitleTemplate, "");
20775
+ }
20741
20776
  const params = new URLSearchParams(window.location.search);
20742
20777
  this.handleUrlChange(params);
20743
20778
  this.addParams(parseParams(params));
@@ -21941,10 +21976,6 @@ HistoryModule = __decorate([
21941
21976
  ], HistoryModule);
21942
21977
  var history = HistoryModule;
21943
21978
 
21944
- const setDocumentTitle = (template, textToInsert = "") => {
21945
- document.title = addParamsToLabel(template, textToInsert);
21946
- };
21947
-
21948
21979
  let SearchResultModule = class SearchResultModule extends VuexModule {
21949
21980
  constructor() {
21950
21981
  super(...arguments);
@@ -22468,7 +22499,7 @@ const app = {
22468
22499
  const tracking = (options) => {
22469
22500
  initTracking(options);
22470
22501
  };
22471
- const searchBox = (options, mountOptions) => {
22502
+ const applySearchBox = (options, mountOptions) => {
22472
22503
  const existingInstance = app.box[options.inputSelector];
22473
22504
  if (existingInstance) {
22474
22505
  existingInstance.searchBoxOptions = options;
@@ -22489,6 +22520,15 @@ const searchBox = (options, mountOptions) => {
22489
22520
  });
22490
22521
  app.box[options.inputSelector] = instance;
22491
22522
  };
22523
+ const searchBox = (options, mountOptions) => {
22524
+ var _a;
22525
+ // Support for multiple search box selectors separated by a comma
22526
+ // Quite often multiple search boxes are required, since mobile and desktop has different inputs in html layout
22527
+ const inputs = (_a = options.inputSelector) === null || _a === void 0 ? void 0 : _a.split(",");
22528
+ for (const input of inputs) {
22529
+ applySearchBox(Object.assign(Object.assign({}, options), { inputSelector: input.trim() }), mountOptions);
22530
+ }
22531
+ };
22492
22532
  const searchResults = (options, mountOptions) => {
22493
22533
  const existingInstance = app.results[options.containerSelector];
22494
22534
  if (existingInstance) {
@@ -38,6 +38,7 @@ export declare type CustomDocumentElement<T = any> = DocumentElementBase<T> & {
38
38
  maxLines?: number;
39
39
  className: string;
40
40
  key: string;
41
+ label?: string;
41
42
  };
42
43
  export declare type PriceElement<T = any> = DocumentElementBase<T> & {
43
44
  type: DocumentElementType.PRICE;
@@ -6,5 +6,6 @@ export default class SearchBoxProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }
@@ -6,5 +6,6 @@ export default class SearchResultsProductCustom extends Vue {
6
6
  options: CustomDocumentElement;
7
7
  get text(): string;
8
8
  get className(): string;
9
+ get label(): string | undefined;
9
10
  get isHtml(): boolean;
10
11
  }