@getlupa/client 0.10.7 → 0.11.1

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.
Files changed (26) hide show
  1. package/dist/cjs/components/common/ProductImage.vue.d.ts +17 -0
  2. package/dist/cjs/components/search-box/products/elements/SearchBoxProductImage.vue.d.ts +0 -7
  3. package/dist/cjs/components/search-box/suggestions/SearchBoxSuggestion.vue.d.ts +2 -0
  4. package/dist/cjs/components/search-results/filters/facets/StatsFacet.vue.d.ts +1 -1
  5. package/dist/cjs/components/search-results/products/product-card/elements/SearchResultsProductImage.vue.d.ts +0 -7
  6. package/dist/cjs/index.min.js +132 -79
  7. package/dist/cjs/types/DocumentElement.d.ts +1 -0
  8. package/dist/cjs/utils/shadowDom.utils.d.ts +1 -1
  9. package/dist/es/components/common/ProductImage.vue.d.ts +17 -0
  10. package/dist/es/components/search-box/products/elements/SearchBoxProductImage.vue.d.ts +0 -7
  11. package/dist/es/components/search-box/suggestions/SearchBoxSuggestion.vue.d.ts +2 -0
  12. package/dist/es/components/search-results/filters/facets/StatsFacet.vue.d.ts +1 -1
  13. package/dist/es/components/search-results/products/product-card/elements/SearchResultsProductImage.vue.d.ts +0 -7
  14. package/dist/es/index.min.js +132 -79
  15. package/dist/es/types/DocumentElement.d.ts +1 -0
  16. package/dist/es/utils/shadowDom.utils.d.ts +1 -1
  17. package/dist/iife/components/common/ProductImage.vue.d.ts +17 -0
  18. package/dist/iife/components/search-box/products/elements/SearchBoxProductImage.vue.d.ts +0 -7
  19. package/dist/iife/components/search-box/suggestions/SearchBoxSuggestion.vue.d.ts +2 -0
  20. package/dist/iife/components/search-results/filters/facets/StatsFacet.vue.d.ts +1 -1
  21. package/dist/iife/components/search-results/products/product-card/elements/SearchResultsProductImage.vue.d.ts +0 -7
  22. package/dist/iife/index.min.js +1 -1
  23. package/dist/iife/types/DocumentElement.d.ts +1 -0
  24. package/dist/iife/utils/shadowDom.utils.d.ts +1 -1
  25. package/dist/lupaContainerStyle.css +1 -1
  26. package/package.json +2 -2
@@ -11025,7 +11025,7 @@ SearchBoxInput = __decorate([
11025
11025
  name: "searchBoxInput",
11026
11026
  })
11027
11027
  ], SearchBoxInput);
11028
- var script$1a = SearchBoxInput;
11028
+ var script$1b = SearchBoxInput;
11029
11029
 
11030
11030
  function normalizeComponent(template, style, script, scopeId, isFunctionalTemplate, moduleIdentifier /* server only */, shadowMode, createInjector, createInjectorSSR, createInjectorShadow) {
11031
11031
  if (typeof shadowMode !== 'boolean') {
@@ -11156,10 +11156,10 @@ function addStyle(id, css) {
11156
11156
  }
11157
11157
 
11158
11158
  /* script */
11159
- const __vue_script__$1b = script$1a;
11159
+ const __vue_script__$1c = script$1b;
11160
11160
 
11161
11161
  /* template */
11162
- var __vue_render__$1b = function () {
11162
+ var __vue_render__$1c = function () {
11163
11163
  var _vm = this;
11164
11164
  var _h = _vm.$createElement;
11165
11165
  var _c = _vm._self._c || _h;
@@ -11244,34 +11244,34 @@ var __vue_render__$1b = function () {
11244
11244
  : _vm._e(),
11245
11245
  ])
11246
11246
  };
11247
- var __vue_staticRenderFns__$1b = [];
11248
- __vue_render__$1b._withStripped = true;
11247
+ var __vue_staticRenderFns__$1c = [];
11248
+ __vue_render__$1c._withStripped = true;
11249
11249
 
11250
11250
  /* style */
11251
- const __vue_inject_styles__$1b = function (inject) {
11251
+ const __vue_inject_styles__$1c = function (inject) {
11252
11252
  if (!inject) return
11253
- inject("data-v-219ea03b_0", { source: "\n.lupa-search-box-input-field,\n.lupa-hint {\n width: 100%;\n}\n.lupa-search-box-input-field {\n position: relative !important;\n background: transparent !important;\n}\n.lupa-hint {\n opacity: 0.5;\n position: absolute !important;\n pointer-events: none;\n}\n.lupa-input-clear {\n display: none;\n}\n", map: undefined, media: undefined });
11253
+ inject("data-v-af94f296_0", { source: "\n.lupa-search-box-input-field,\n.lupa-hint {\n width: 100%;\n}\n.lupa-search-box-input-field {\n position: relative !important;\n background: transparent !important;\n}\n.lupa-hint {\n opacity: 0.5;\n position: absolute !important;\n pointer-events: none;\n}\n.lupa-input-clear {\n display: none;\n}\n", map: undefined, media: undefined });
11254
11254
 
11255
11255
  };
11256
11256
  /* scoped */
11257
- const __vue_scope_id__$1b = undefined;
11257
+ const __vue_scope_id__$1c = undefined;
11258
11258
  /* module identifier */
11259
- const __vue_module_identifier__$1b = undefined;
11259
+ const __vue_module_identifier__$1c = undefined;
11260
11260
  /* functional template */
11261
- const __vue_is_functional_template__$1b = false;
11261
+ const __vue_is_functional_template__$1c = false;
11262
11262
  /* style inject SSR */
11263
11263
 
11264
11264
  /* style inject shadow dom */
11265
11265
 
11266
11266
 
11267
11267
 
11268
- const __vue_component__$1b = /*#__PURE__*/normalizeComponent(
11269
- { render: __vue_render__$1b, staticRenderFns: __vue_staticRenderFns__$1b },
11270
- __vue_inject_styles__$1b,
11271
- __vue_script__$1b,
11272
- __vue_scope_id__$1b,
11273
- __vue_is_functional_template__$1b,
11274
- __vue_module_identifier__$1b,
11268
+ const __vue_component__$1c = /*#__PURE__*/normalizeComponent(
11269
+ { render: __vue_render__$1c, staticRenderFns: __vue_staticRenderFns__$1c },
11270
+ __vue_inject_styles__$1c,
11271
+ __vue_script__$1c,
11272
+ __vue_scope_id__$1c,
11273
+ __vue_is_functional_template__$1c,
11274
+ __vue_module_identifier__$1c,
11275
11275
  false,
11276
11276
  createInjector,
11277
11277
  undefined,
@@ -11293,7 +11293,7 @@ const debounce = (func, timeout) => {
11293
11293
  };
11294
11294
  };
11295
11295
 
11296
- let SearchBoxProductImage = class SearchBoxProductImage extends Vue$1 {
11296
+ let ProductImage = class ProductImage extends Vue$1 {
11297
11297
  get hasFullImageUrl() {
11298
11298
  const imageUrl = this.image;
11299
11299
  return (typeof imageUrl === "string" &&
@@ -11319,6 +11319,12 @@ let SearchBoxProductImage = class SearchBoxProductImage extends Vue$1 {
11319
11319
  get placeholder() {
11320
11320
  return this.options.placeholder;
11321
11321
  }
11322
+ get finalUrl() {
11323
+ if (this.options.customUrl) {
11324
+ return this.options.customUrl(this.item);
11325
+ }
11326
+ return this.hasImage ? this.imageUrl : this.placeholder;
11327
+ }
11322
11328
  replaceWithPlaceholder(e) {
11323
11329
  var _a;
11324
11330
  const targetImage = e === null || e === void 0 ? void 0 : e.target;
@@ -11327,6 +11333,73 @@ let SearchBoxProductImage = class SearchBoxProductImage extends Vue$1 {
11327
11333
  }
11328
11334
  }
11329
11335
  };
11336
+ __decorate([
11337
+ Prop()
11338
+ ], ProductImage.prototype, "item", void 0);
11339
+ __decorate([
11340
+ Prop()
11341
+ ], ProductImage.prototype, "options", void 0);
11342
+ __decorate([
11343
+ Prop({ default: "" })
11344
+ ], ProductImage.prototype, "wrapperClass", void 0);
11345
+ __decorate([
11346
+ Prop({ default: "" })
11347
+ ], ProductImage.prototype, "imageClass", void 0);
11348
+ ProductImage = __decorate([
11349
+ Component
11350
+ ], ProductImage);
11351
+ var script$1a = ProductImage;
11352
+
11353
+ /* script */
11354
+ const __vue_script__$1b = script$1a;
11355
+
11356
+ /* template */
11357
+ var __vue_render__$1b = function () {
11358
+ var _vm = this;
11359
+ var _h = _vm.$createElement;
11360
+ var _c = _vm._self._c || _h;
11361
+ return _c("div", { class: _vm.wrapperClass }, [
11362
+ _c("img", {
11363
+ class: _vm.imageClass,
11364
+ attrs: { src: _vm.finalUrl },
11365
+ on: { error: _vm.replaceWithPlaceholder },
11366
+ }),
11367
+ ])
11368
+ };
11369
+ var __vue_staticRenderFns__$1b = [];
11370
+ __vue_render__$1b._withStripped = true;
11371
+
11372
+ /* style */
11373
+ const __vue_inject_styles__$1b = undefined;
11374
+ /* scoped */
11375
+ const __vue_scope_id__$1b = undefined;
11376
+ /* module identifier */
11377
+ const __vue_module_identifier__$1b = undefined;
11378
+ /* functional template */
11379
+ const __vue_is_functional_template__$1b = false;
11380
+ /* style inject */
11381
+
11382
+ /* style inject SSR */
11383
+
11384
+ /* style inject shadow dom */
11385
+
11386
+
11387
+
11388
+ const __vue_component__$1b = /*#__PURE__*/normalizeComponent(
11389
+ { render: __vue_render__$1b, staticRenderFns: __vue_staticRenderFns__$1b },
11390
+ __vue_inject_styles__$1b,
11391
+ __vue_script__$1b,
11392
+ __vue_scope_id__$1b,
11393
+ __vue_is_functional_template__$1b,
11394
+ __vue_module_identifier__$1b,
11395
+ false,
11396
+ undefined,
11397
+ undefined,
11398
+ undefined
11399
+ );
11400
+
11401
+ let SearchBoxProductImage = class SearchBoxProductImage extends Vue$1 {
11402
+ };
11330
11403
  __decorate([
11331
11404
  Prop()
11332
11405
  ], SearchBoxProductImage.prototype, "item", void 0);
@@ -11334,7 +11407,11 @@ __decorate([
11334
11407
  Prop()
11335
11408
  ], SearchBoxProductImage.prototype, "options", void 0);
11336
11409
  SearchBoxProductImage = __decorate([
11337
- Component
11410
+ Component({
11411
+ components: {
11412
+ ProductImage: __vue_component__$1b,
11413
+ },
11414
+ })
11338
11415
  ], SearchBoxProductImage);
11339
11416
  var script$19 = SearchBoxProductImage;
11340
11417
 
@@ -11346,13 +11423,14 @@ var __vue_render__$1a = function () {
11346
11423
  var _vm = this;
11347
11424
  var _h = _vm.$createElement;
11348
11425
  var _c = _vm._self._c || _h;
11349
- return _c("div", { staticClass: "lupa-search-box-image-wrapper" }, [
11350
- _c("img", {
11351
- staticClass: "lupa-search-box-image",
11352
- attrs: { src: _vm.hasImage ? _vm.imageUrl : _vm.placeholder },
11353
- on: { error: _vm.replaceWithPlaceholder },
11354
- }),
11355
- ])
11426
+ return _c("ProductImage", {
11427
+ attrs: {
11428
+ item: _vm.item,
11429
+ options: _vm.options,
11430
+ "wrapper-class": "lupa-search-box-image-wrapper",
11431
+ "image-class": "lupa-search-box-image",
11432
+ },
11433
+ })
11356
11434
  };
11357
11435
  var __vue_staticRenderFns__$1a = [];
11358
11436
  __vue_render__$1a._withStripped = true;
@@ -12219,7 +12297,9 @@ const generateResultLink = (link, searchText, facet) => {
12219
12297
  if (!searchText) {
12220
12298
  return link;
12221
12299
  }
12222
- const facetParam = facet ? `&${FACET_PARAMS_TYPE.TERMS}=${facet.title}` : "";
12300
+ const facetParam = facet
12301
+ ? `&${FACET_PARAMS_TYPE.TERMS}${encodeParam(facet.key)}=${encodeParam(facet.title)}`
12302
+ : "";
12223
12303
  const queryParam = `?${QUERY_PARAMS.QUERY}=${encodeParam(searchText)}`;
12224
12304
  return `${link}${queryParam}${facetParam}`;
12225
12305
  };
@@ -12673,6 +12753,16 @@ let SearchBoxSuggestion = class SearchBoxSuggestion extends Vue$1 {
12673
12753
  ? this.suggestion.displayHighlight
12674
12754
  : this.suggestion.display;
12675
12755
  }
12756
+ get facetKey() {
12757
+ var _a;
12758
+ return ((_a = this.suggestion.facet) === null || _a === void 0 ? void 0 : _a.key) || "";
12759
+ }
12760
+ get facetLabel() {
12761
+ var _a, _b;
12762
+ return (((_b = (_a = this.suggestion.suggestion) === null || _a === void 0 ? void 0 : _a.facetLabels) === null || _b === void 0 ? void 0 : _b[this.facetKey]) ||
12763
+ this.labels.defaultFacetLabel ||
12764
+ this.facetKey);
12765
+ }
12676
12766
  handleSelect() {
12677
12767
  this.$emit("select", {
12678
12768
  suggestion: this.suggestion.suggestion,
@@ -12710,10 +12800,7 @@ var __vue_render__$$ = function () {
12710
12800
  {
12711
12801
  on: {
12712
12802
  click: function ($event) {
12713
- return _vm.handleSelect({
12714
- suggestion: _vm.suggestion.suggestion,
12715
- override: true,
12716
- })
12803
+ return _vm.handleSelect()
12717
12804
  },
12718
12805
  },
12719
12806
  },
@@ -12747,13 +12834,7 @@ var __vue_render__$$ = function () {
12747
12834
  staticClass: "lupa-suggestion-facet-label",
12748
12835
  attrs: { "data-cy": "lupa-suggestion-facet-label" },
12749
12836
  },
12750
- [
12751
- _vm._v(
12752
- _vm._s(
12753
- _vm.labels.defaultFacetLabel || _vm.suggestion.facet.key
12754
- )
12755
- ),
12756
- ]
12837
+ [_vm._v(_vm._s(_vm.facetLabel))]
12757
12838
  ),
12758
12839
  _vm._v(" "),
12759
12840
  _c(
@@ -31075,7 +31156,7 @@ SearchBox = __decorate([
31075
31156
  Component({
31076
31157
  name: "searchBox",
31077
31158
  components: {
31078
- SearchBoxInput: __vue_component__$1b,
31159
+ SearchBoxInput: __vue_component__$1c,
31079
31160
  SearchBoxMainPanel: __vue_component__$V,
31080
31161
  },
31081
31162
  })
@@ -31136,7 +31217,7 @@ __vue_render__$U._withStripped = true;
31136
31217
  /* style */
31137
31218
  const __vue_inject_styles__$U = function (inject) {
31138
31219
  if (!inject) return
31139
- inject("data-v-49023ab6_0", { source: "\n#lupa-search-box {\n width: 100%;\n}\n.lupa-search-box-wrapper {\n position: relative;\n}\n", map: undefined, media: undefined });
31220
+ inject("data-v-39831122_0", { source: "\n#lupa-search-box {\n width: 100%;\n}\n.lupa-search-box-wrapper {\n position: relative;\n}\n", map: undefined, media: undefined });
31140
31221
 
31141
31222
  };
31142
31223
  /* scoped */
@@ -34451,38 +34532,6 @@ __vue_render__$z._withStripped = true;
34451
34532
  );
34452
34533
 
34453
34534
  let SearchResultsProductImage = class SearchResultsProductImage extends Vue$1 {
34454
- get hasFullImageUrl() {
34455
- const imageUrl = this.image;
34456
- return (typeof imageUrl === "string" &&
34457
- (imageUrl.indexOf("http://") === 0 || imageUrl.indexOf("https://") === 0));
34458
- }
34459
- get rootImageUrl() {
34460
- return this.options.baseUrl;
34461
- }
34462
- get image() {
34463
- return this.item[this.options.key];
34464
- }
34465
- get imageUrl() {
34466
- var _a;
34467
- const imageUrl = this.image;
34468
- if (this.hasFullImageUrl) {
34469
- return imageUrl;
34470
- }
34471
- return `${(_a = this.rootImageUrl) !== null && _a !== void 0 ? _a : ""}/${imageUrl}`;
34472
- }
34473
- get hasImage() {
34474
- return Boolean(this.hasFullImageUrl || this.image);
34475
- }
34476
- get placeholder() {
34477
- return this.options.placeholder;
34478
- }
34479
- replaceWithPlaceholder(e) {
34480
- var _a;
34481
- const targetImage = e === null || e === void 0 ? void 0 : e.target;
34482
- if (targetImage && !((_a = targetImage === null || targetImage === void 0 ? void 0 : targetImage.src) === null || _a === void 0 ? void 0 : _a.includes(this.placeholder))) {
34483
- targetImage.src = this.placeholder;
34484
- }
34485
- }
34486
34535
  };
34487
34536
  __decorate([
34488
34537
  Prop()
@@ -34493,6 +34542,9 @@ __decorate([
34493
34542
  SearchResultsProductImage = __decorate([
34494
34543
  Component({
34495
34544
  name: "searchResultsProductImage",
34545
+ components: {
34546
+ ProductImage: __vue_component__$1b,
34547
+ },
34496
34548
  })
34497
34549
  ], SearchResultsProductImage);
34498
34550
  var script$x = SearchResultsProductImage;
@@ -34505,13 +34557,14 @@ var __vue_render__$y = function () {
34505
34557
  var _vm = this;
34506
34558
  var _h = _vm.$createElement;
34507
34559
  var _c = _vm._self._c || _h;
34508
- return _c("div", { staticClass: "lupa-search-results-image-wrapper" }, [
34509
- _c("img", {
34510
- staticClass: "lupa-search-results-image",
34511
- attrs: { src: _vm.hasImage ? _vm.imageUrl : _vm.placeholder },
34512
- on: { error: _vm.replaceWithPlaceholder },
34513
- }),
34514
- ])
34560
+ return _c("ProductImage", {
34561
+ attrs: {
34562
+ item: _vm.item,
34563
+ options: _vm.options,
34564
+ "wrapper-class": "lupa-search-results-image-wrapper",
34565
+ "image-class": "lupa-search-results-image",
34566
+ },
34567
+ })
34515
34568
  };
34516
34569
  var __vue_staticRenderFns__$y = [];
34517
34570
  __vue_render__$y._withStripped = true;
@@ -20,6 +20,7 @@ export declare type ImageDocumentElement<T = any> = DocumentElementBase<T> & {
20
20
  placeholder: string;
21
21
  baseUrl?: string;
22
22
  key: string;
23
+ customUrl?: (document: T) => string;
23
24
  };
24
25
  export declare type TitleDocumentElement<T = any> = DocumentElementBase<T> & {
25
26
  type: DocumentElementType.TITLE;
@@ -1,6 +1,6 @@
1
1
  export declare const createShadowDom: (shadowId: string, managerId: string) => {
2
2
  host: HTMLElement;
3
- manager: HTMLDivElement;
3
+ manager: HTMLElement;
4
4
  };
5
5
  export declare const attatchShadowDom: ({ host, manager, styleUrl, }: {
6
6
  host: HTMLElement;
@@ -0,0 +1,17 @@
1
+ import Vue from "vue";
2
+ import { Document } from "@getlupa/client-sdk/Types";
3
+ import { ImageDocumentElement } from "@/types/DocumentElement";
4
+ export default class ProductImage extends Vue {
5
+ item: Document;
6
+ options: ImageDocumentElement;
7
+ wrapperClass: string;
8
+ imageClass: string;
9
+ get hasFullImageUrl(): boolean;
10
+ get rootImageUrl(): string | undefined;
11
+ get image(): string;
12
+ get imageUrl(): string;
13
+ get hasImage(): boolean;
14
+ get placeholder(): string;
15
+ get finalUrl(): string;
16
+ replaceWithPlaceholder(e: Event): void;
17
+ }
@@ -4,11 +4,4 @@ import { ImageDocumentElement } from "@/types/DocumentElement";
4
4
  export default class SearchBoxProductImage extends Vue {
5
5
  item: Document;
6
6
  options: ImageDocumentElement;
7
- get hasFullImageUrl(): boolean;
8
- get rootImageUrl(): string | undefined;
9
- get image(): string;
10
- get imageUrl(): string;
11
- get hasImage(): boolean;
12
- get placeholder(): string;
13
- replaceWithPlaceholder(e: Event): void;
14
7
  }
@@ -6,5 +6,7 @@ export default class SearchBoxSuggestion extends Vue {
6
6
  highlight: boolean[];
7
7
  labels: SearchBoxOptionLabels;
8
8
  get title(): string;
9
+ get facetKey(): string;
10
+ get facetLabel(): string;
9
11
  handleSelect(): void;
10
12
  }
@@ -28,7 +28,7 @@ export default class TermFacet extends Vue {
28
28
  get statsSummary(): string;
29
29
  get separator(): string;
30
30
  get isIntegerRange(): boolean;
31
- get interval(): 1 | 0.01;
31
+ get interval(): number;
32
32
  get sliderInputFormat(): string | undefined;
33
33
  onMinValueChange(): void;
34
34
  onMaxValueChange(): void;
@@ -4,11 +4,4 @@ import { ImageDocumentElement } from "@/types/DocumentElement";
4
4
  export default class SearchResultsProductImage extends Vue {
5
5
  item: Document;
6
6
  options: ImageDocumentElement;
7
- get hasFullImageUrl(): boolean;
8
- get rootImageUrl(): string | undefined;
9
- get image(): string;
10
- get imageUrl(): string;
11
- get hasImage(): boolean;
12
- get placeholder(): string;
13
- replaceWithPlaceholder(e: Event): void;
14
7
  }