@getlupa/client 0.7.0-alpha-15 → 0.7.0-alpha-18

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.
@@ -26,6 +26,8 @@ export default class TermFacet extends Vue {
26
26
  get facetMin(): number;
27
27
  get facetMax(): number;
28
28
  get statsSummary(): string;
29
+ get separator(): string;
30
+ get sliderInputFormat(): string | undefined;
29
31
  onMinValueChange(): void;
30
32
  onMaxValueChange(): void;
31
33
  handleInputChange(): void;
@@ -14806,7 +14806,7 @@ let TermFacet = class TermFacet extends Vue$1 {
14806
14806
  }
14807
14807
  get fromValue() {
14808
14808
  return this.isPrice
14809
- ? this.sliderRange[0].toFixed(2)
14809
+ ? this.sliderRange[0].toFixed(2).replace(".", this.separator)
14810
14810
  : `${this.sliderRange[0]}`;
14811
14811
  }
14812
14812
  set fromValue(stringValue) {
@@ -14822,7 +14822,7 @@ let TermFacet = class TermFacet extends Vue$1 {
14822
14822
  }
14823
14823
  get toValue() {
14824
14824
  return this.isPrice
14825
- ? this.sliderRange[1].toFixed(2)
14825
+ ? this.sliderRange[1].toFixed(2).replace(".", this.separator)
14826
14826
  : `${this.sliderRange[1]}`;
14827
14827
  }
14828
14828
  set toValue(stringValue) {
@@ -14881,9 +14881,16 @@ let TermFacet = class TermFacet extends Vue$1 {
14881
14881
  get statsSummary() {
14882
14882
  const [min, max] = this.sliderRange;
14883
14883
  return this.isPrice
14884
- ? formatPriceSummary([min, max], this.currency, this.searchResultOptions.labels.priceSeparator)
14884
+ ? formatPriceSummary([min, max], this.currency, this.separator)
14885
14885
  : formatRange({ gte: min, lte: max });
14886
14886
  }
14887
+ get separator() {
14888
+ var _a, _b, _c;
14889
+ return (_c = (_b = (_a = this.searchResultOptions) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.priceSeparator) !== null && _c !== void 0 ? _c : ",";
14890
+ }
14891
+ get sliderInputFormat() {
14892
+ return this.isPrice ? `[0-9]+([${this.separator}][0-9]{1,2})?` : undefined;
14893
+ }
14887
14894
  onMinValueChange() {
14888
14895
  this.innerSliderRange = [];
14889
14896
  }
@@ -14974,10 +14981,10 @@ var __vue_render__$N = function () {
14974
14981
  },
14975
14982
  ],
14976
14983
  attrs: {
14977
- type: "number",
14984
+ type: "text",
14978
14985
  max: _vm.facetMax,
14979
14986
  min: _vm.facetMin,
14980
- step: _vm.isPrice ? "0.01" : "1",
14987
+ pattern: _vm.sliderInputFormat,
14981
14988
  },
14982
14989
  domProps: { value: _vm.fromValue },
14983
14990
  on: {
@@ -15014,10 +15021,10 @@ var __vue_render__$N = function () {
15014
15021
  },
15015
15022
  ],
15016
15023
  attrs: {
15017
- type: "number",
15024
+ type: "text",
15018
15025
  max: _vm.facetMax,
15019
15026
  min: _vm.facetMin,
15020
- step: _vm.isPrice ? "0.01" : "1",
15027
+ pattern: _vm.sliderInputFormat,
15021
15028
  },
15022
15029
  domProps: { value: _vm.toValue },
15023
15030
  on: {
@@ -20716,7 +20723,12 @@ let SearchResults = class SearchResults extends Vue$1 {
20716
20723
  this.setDefaultLimit(this.defaultSearchResultPageSize);
20717
20724
  }
20718
20725
  handleParamsChange() {
20726
+ var _a, _b;
20719
20727
  this.handleUrlChange();
20728
+ (_b = (_a = this.options.callbacks) === null || _a === void 0 ? void 0 : _a.onUrlQueryChange) === null || _b === void 0 ? void 0 : _b.call(_a, {
20729
+ queryKey: this.options.queryKey,
20730
+ urlQueryString: this.searchString,
20731
+ });
20720
20732
  }
20721
20733
  handleUrlChange(params) {
20722
20734
  const searchParams = params || new URLSearchParams(window.location.search);
@@ -22416,6 +22428,7 @@ const tracking = (options) => {
22416
22428
  initTracking(options);
22417
22429
  };
22418
22430
  const searchBox = (options) => {
22431
+ clearSearchBox();
22419
22432
  Vue$1.use(Vuex);
22420
22433
  app.box = new Vue$1({
22421
22434
  el: options.inputSelector,
@@ -22425,6 +22438,7 @@ const searchBox = (options) => {
22425
22438
  });
22426
22439
  };
22427
22440
  const searchResults = (options) => {
22441
+ clearSearchResults();
22428
22442
  Vue$1.use(Vuex);
22429
22443
  app.results = new Vue$1({
22430
22444
  el: options.containerSelector,
@@ -22434,6 +22448,7 @@ const searchResults = (options) => {
22434
22448
  });
22435
22449
  };
22436
22450
  const productList = (options) => {
22451
+ clearProductList();
22437
22452
  Vue$1.use(Vuex);
22438
22453
  app.productList = new Vue$1({
22439
22454
  el: options.containerSelector,
@@ -22444,15 +22459,30 @@ const productList = (options) => {
22444
22459
  };
22445
22460
  const clearSearchBox = () => {
22446
22461
  var _a;
22447
- (_a = app.box) === null || _a === void 0 ? void 0 : _a.$destroy();
22462
+ try {
22463
+ (_a = app.box) === null || _a === void 0 ? void 0 : _a.$destroy();
22464
+ }
22465
+ catch (_b) {
22466
+ // do nothing, already destroyed;
22467
+ }
22448
22468
  };
22449
22469
  const clearSearchResults = () => {
22450
22470
  var _a;
22451
- (_a = app.results) === null || _a === void 0 ? void 0 : _a.$destroy();
22471
+ try {
22472
+ (_a = app.results) === null || _a === void 0 ? void 0 : _a.$destroy();
22473
+ }
22474
+ catch (_b) {
22475
+ // do nothing, already destroyed;
22476
+ }
22452
22477
  };
22453
22478
  const clearProductList = () => {
22454
22479
  var _a;
22455
- (_a = app.productList) === null || _a === void 0 ? void 0 : _a.$destroy();
22480
+ try {
22481
+ (_a = app.productList) === null || _a === void 0 ? void 0 : _a.$destroy();
22482
+ }
22483
+ catch (_b) {
22484
+ // do nothing, already destroyed;
22485
+ }
22456
22486
  };
22457
22487
  const lupaSearch = {
22458
22488
  searchBox,
@@ -23,13 +23,15 @@ export declare type SearchResultsSimilarQueriesLabels = {
23
23
  };
24
24
  export declare type CallbackContext = {
25
25
  queryKey: string;
26
- hasResults: boolean;
26
+ hasResults?: boolean;
27
+ urlQueryString?: string;
27
28
  };
28
29
  export declare type SearchResultEventCallbacks = {
29
30
  onSearchResults?: (context: CallbackContext) => unknown;
30
31
  onAdditionalPanelResults?: (context: CallbackContext) => unknown;
31
32
  onCategoryFilterResults?: (context: CallbackContext) => unknown;
32
33
  onProductClick?: (context: CallbackContext) => unknown;
34
+ onUrlQueryChange?: (context: CallbackContext) => unknown;
33
35
  onMounted?: () => unknown;
34
36
  };
35
37
  export declare type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & {
@@ -26,6 +26,8 @@ export default class TermFacet extends Vue {
26
26
  get facetMin(): number;
27
27
  get facetMax(): number;
28
28
  get statsSummary(): string;
29
+ get separator(): string;
30
+ get sliderInputFormat(): string | undefined;
29
31
  onMinValueChange(): void;
30
32
  onMaxValueChange(): void;
31
33
  handleInputChange(): void;
@@ -14802,7 +14802,7 @@ let TermFacet = class TermFacet extends Vue$1 {
14802
14802
  }
14803
14803
  get fromValue() {
14804
14804
  return this.isPrice
14805
- ? this.sliderRange[0].toFixed(2)
14805
+ ? this.sliderRange[0].toFixed(2).replace(".", this.separator)
14806
14806
  : `${this.sliderRange[0]}`;
14807
14807
  }
14808
14808
  set fromValue(stringValue) {
@@ -14818,7 +14818,7 @@ let TermFacet = class TermFacet extends Vue$1 {
14818
14818
  }
14819
14819
  get toValue() {
14820
14820
  return this.isPrice
14821
- ? this.sliderRange[1].toFixed(2)
14821
+ ? this.sliderRange[1].toFixed(2).replace(".", this.separator)
14822
14822
  : `${this.sliderRange[1]}`;
14823
14823
  }
14824
14824
  set toValue(stringValue) {
@@ -14877,9 +14877,16 @@ let TermFacet = class TermFacet extends Vue$1 {
14877
14877
  get statsSummary() {
14878
14878
  const [min, max] = this.sliderRange;
14879
14879
  return this.isPrice
14880
- ? formatPriceSummary([min, max], this.currency, this.searchResultOptions.labels.priceSeparator)
14880
+ ? formatPriceSummary([min, max], this.currency, this.separator)
14881
14881
  : formatRange({ gte: min, lte: max });
14882
14882
  }
14883
+ get separator() {
14884
+ var _a, _b, _c;
14885
+ return (_c = (_b = (_a = this.searchResultOptions) === null || _a === void 0 ? void 0 : _a.labels) === null || _b === void 0 ? void 0 : _b.priceSeparator) !== null && _c !== void 0 ? _c : ",";
14886
+ }
14887
+ get sliderInputFormat() {
14888
+ return this.isPrice ? `[0-9]+([${this.separator}][0-9]{1,2})?` : undefined;
14889
+ }
14883
14890
  onMinValueChange() {
14884
14891
  this.innerSliderRange = [];
14885
14892
  }
@@ -14970,10 +14977,10 @@ var __vue_render__$N = function () {
14970
14977
  },
14971
14978
  ],
14972
14979
  attrs: {
14973
- type: "number",
14980
+ type: "text",
14974
14981
  max: _vm.facetMax,
14975
14982
  min: _vm.facetMin,
14976
- step: _vm.isPrice ? "0.01" : "1",
14983
+ pattern: _vm.sliderInputFormat,
14977
14984
  },
14978
14985
  domProps: { value: _vm.fromValue },
14979
14986
  on: {
@@ -15010,10 +15017,10 @@ var __vue_render__$N = function () {
15010
15017
  },
15011
15018
  ],
15012
15019
  attrs: {
15013
- type: "number",
15020
+ type: "text",
15014
15021
  max: _vm.facetMax,
15015
15022
  min: _vm.facetMin,
15016
- step: _vm.isPrice ? "0.01" : "1",
15023
+ pattern: _vm.sliderInputFormat,
15017
15024
  },
15018
15025
  domProps: { value: _vm.toValue },
15019
15026
  on: {
@@ -20712,7 +20719,12 @@ let SearchResults = class SearchResults extends Vue$1 {
20712
20719
  this.setDefaultLimit(this.defaultSearchResultPageSize);
20713
20720
  }
20714
20721
  handleParamsChange() {
20722
+ var _a, _b;
20715
20723
  this.handleUrlChange();
20724
+ (_b = (_a = this.options.callbacks) === null || _a === void 0 ? void 0 : _a.onUrlQueryChange) === null || _b === void 0 ? void 0 : _b.call(_a, {
20725
+ queryKey: this.options.queryKey,
20726
+ urlQueryString: this.searchString,
20727
+ });
20716
20728
  }
20717
20729
  handleUrlChange(params) {
20718
20730
  const searchParams = params || new URLSearchParams(window.location.search);
@@ -22412,6 +22424,7 @@ const tracking = (options) => {
22412
22424
  initTracking(options);
22413
22425
  };
22414
22426
  const searchBox = (options) => {
22427
+ clearSearchBox();
22415
22428
  Vue$1.use(Vuex);
22416
22429
  app.box = new Vue$1({
22417
22430
  el: options.inputSelector,
@@ -22421,6 +22434,7 @@ const searchBox = (options) => {
22421
22434
  });
22422
22435
  };
22423
22436
  const searchResults = (options) => {
22437
+ clearSearchResults();
22424
22438
  Vue$1.use(Vuex);
22425
22439
  app.results = new Vue$1({
22426
22440
  el: options.containerSelector,
@@ -22430,6 +22444,7 @@ const searchResults = (options) => {
22430
22444
  });
22431
22445
  };
22432
22446
  const productList = (options) => {
22447
+ clearProductList();
22433
22448
  Vue$1.use(Vuex);
22434
22449
  app.productList = new Vue$1({
22435
22450
  el: options.containerSelector,
@@ -22440,15 +22455,30 @@ const productList = (options) => {
22440
22455
  };
22441
22456
  const clearSearchBox = () => {
22442
22457
  var _a;
22443
- (_a = app.box) === null || _a === void 0 ? void 0 : _a.$destroy();
22458
+ try {
22459
+ (_a = app.box) === null || _a === void 0 ? void 0 : _a.$destroy();
22460
+ }
22461
+ catch (_b) {
22462
+ // do nothing, already destroyed;
22463
+ }
22444
22464
  };
22445
22465
  const clearSearchResults = () => {
22446
22466
  var _a;
22447
- (_a = app.results) === null || _a === void 0 ? void 0 : _a.$destroy();
22467
+ try {
22468
+ (_a = app.results) === null || _a === void 0 ? void 0 : _a.$destroy();
22469
+ }
22470
+ catch (_b) {
22471
+ // do nothing, already destroyed;
22472
+ }
22448
22473
  };
22449
22474
  const clearProductList = () => {
22450
22475
  var _a;
22451
- (_a = app.productList) === null || _a === void 0 ? void 0 : _a.$destroy();
22476
+ try {
22477
+ (_a = app.productList) === null || _a === void 0 ? void 0 : _a.$destroy();
22478
+ }
22479
+ catch (_b) {
22480
+ // do nothing, already destroyed;
22481
+ }
22452
22482
  };
22453
22483
  const lupaSearch = {
22454
22484
  searchBox,
@@ -23,13 +23,15 @@ export declare type SearchResultsSimilarQueriesLabels = {
23
23
  };
24
24
  export declare type CallbackContext = {
25
25
  queryKey: string;
26
- hasResults: boolean;
26
+ hasResults?: boolean;
27
+ urlQueryString?: string;
27
28
  };
28
29
  export declare type SearchResultEventCallbacks = {
29
30
  onSearchResults?: (context: CallbackContext) => unknown;
30
31
  onAdditionalPanelResults?: (context: CallbackContext) => unknown;
31
32
  onCategoryFilterResults?: (context: CallbackContext) => unknown;
32
33
  onProductClick?: (context: CallbackContext) => unknown;
34
+ onUrlQueryChange?: (context: CallbackContext) => unknown;
33
35
  onMounted?: () => unknown;
34
36
  };
35
37
  export declare type SearchResultsOptionLabels = SearchResultsPaginationLabels & SearchResultsDidYouMeanLabels & SearchResultsSimilarQueriesLabels & {
@@ -26,6 +26,8 @@ export default class TermFacet extends Vue {
26
26
  get facetMin(): number;
27
27
  get facetMax(): number;
28
28
  get statsSummary(): string;
29
+ get separator(): string;
30
+ get sliderInputFormat(): string | undefined;
29
31
  onMinValueChange(): void;
30
32
  onMaxValueChange(): void;
31
33
  handleInputChange(): void;