@getlupa/vue 0.7.9 → 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.
@@ -4309,6 +4309,10 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
4309
4309
  var _a;
4310
4310
  return (_a = props.panelOptions.elements) == null ? void 0 : _a.find((e) => e.type === DocumentElementType.ADDTOCART);
4311
4311
  });
4312
+ const customDocumentHtmlAttributes = vue.computed(() => {
4313
+ var _a, _b, _c;
4314
+ return (_c = (_b = (_a = props.panelOptions).customDocumentHtmlAttributes) == null ? void 0 : _b.call(_a, props.item)) != null ? _c : {};
4315
+ });
4312
4316
  const handleClick = (event) => {
4313
4317
  emit("product-click", {
4314
4318
  item: props.item,
@@ -4323,12 +4327,13 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
4323
4327
  isInStock.value = props.panelOptions.isInStock ? yield props.panelOptions.isInStock(props.item) : true;
4324
4328
  });
4325
4329
  return (_ctx, _cache) => {
4326
- return vue.openBlock(), vue.createElementBlock("a", {
4327
- class: vue.normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
4330
+ return vue.openBlock(), vue.createElementBlock("a", vue.mergeProps({
4331
+ class: ["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }],
4332
+ href: link.value
4333
+ }, customDocumentHtmlAttributes.value, {
4328
4334
  "data-cy": "lupa-search-box-product",
4329
- href: link.value,
4330
4335
  onClick: handleClick
4331
- }, [
4336
+ }), [
4332
4337
  vue.createElementVNode("div", _hoisted_2$I, [
4333
4338
  (vue.openBlock(true), vue.createElementBlock(vue.Fragment, null, vue.renderList(imageElements.value, (element) => {
4334
4339
  return vue.openBlock(), vue.createBlock(_sfc_main$13, {
@@ -4363,7 +4368,7 @@ const _sfc_main$12 = /* @__PURE__ */ vue.defineComponent({
4363
4368
  isInStock: isInStock.value
4364
4369
  }, null, 8, ["item", "element", "labels", "link", "isInStock"])
4365
4370
  ])) : vue.createCommentVNode("", true)
4366
- ], 10, _hoisted_1$_);
4371
+ ], 16, _hoisted_1$_);
4367
4372
  };
4368
4373
  }
4369
4374
  });
@@ -8891,6 +8896,10 @@ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
8891
8896
  }
8892
8897
  return (_b = (_a = props.options) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate;
8893
8898
  });
8899
+ const customDocumentHtmlAttributes = vue.computed(() => {
8900
+ var _a, _b, _c;
8901
+ return (_c = (_b = (_a = props.options).customDocumentHtmlAttributes) == null ? void 0 : _b.call(_a, props.product)) != null ? _c : {};
8902
+ });
8894
8903
  const getGroupElements = (group) => {
8895
8904
  var _a, _b;
8896
8905
  return (_b = (_a = props.options.elements) == null ? void 0 : _a.filter((e) => e.group === group)) != null ? _b : [];
@@ -8947,12 +8956,11 @@ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
8947
8956
  }
8948
8957
  return (_ctx, _cache) => {
8949
8958
  var _a;
8950
- return vue.openBlock(), vue.createElementBlock("div", {
8959
+ return vue.openBlock(), vue.createElementBlock("div", vue.mergeProps({
8951
8960
  id: "lupa-search-result-product-card",
8952
8961
  "data-cy": "lupa-search-result-product-card",
8953
- class: vue.normalizeClass(["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]),
8954
- onClick: handleClick
8955
- }, [
8962
+ class: ["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]
8963
+ }, customDocumentHtmlAttributes.value, { onClick: handleClick }), [
8956
8964
  vue.createVNode(_sfc_main$w, { options: badgesOptions.value }, null, 8, ["options"]),
8957
8965
  vue.createElementVNode("div", {
8958
8966
  class: vue.normalizeClass(["lupa-search-result-product-contents", listLayoutClass.value])
@@ -9014,7 +9022,7 @@ const _sfc_main$k = /* @__PURE__ */ vue.defineComponent({
9014
9022
  ], 2);
9015
9023
  }), 128))
9016
9024
  ], 2)
9017
- ], 2);
9025
+ ], 16);
9018
9026
  };
9019
9027
  }
9020
9028
  });
@@ -9341,7 +9349,8 @@ const _sfc_main$e = /* @__PURE__ */ vue.defineComponent({
9341
9349
  "queryKey",
9342
9350
  "idKey",
9343
9351
  "titleKey",
9344
- "routingBehavior"
9352
+ "routingBehavior",
9353
+ "customDocumentHtmlAttributes"
9345
9354
  ]);
9346
9355
  });
9347
9356
  const similarQueriesLabels = vue.computed(() => {
@@ -4307,6 +4307,10 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
4307
4307
  var _a;
4308
4308
  return (_a = props.panelOptions.elements) == null ? void 0 : _a.find((e) => e.type === DocumentElementType.ADDTOCART);
4309
4309
  });
4310
+ const customDocumentHtmlAttributes = computed(() => {
4311
+ var _a, _b, _c;
4312
+ return (_c = (_b = (_a = props.panelOptions).customDocumentHtmlAttributes) == null ? void 0 : _b.call(_a, props.item)) != null ? _c : {};
4313
+ });
4310
4314
  const handleClick = (event) => {
4311
4315
  emit("product-click", {
4312
4316
  item: props.item,
@@ -4321,12 +4325,13 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
4321
4325
  isInStock.value = props.panelOptions.isInStock ? yield props.panelOptions.isInStock(props.item) : true;
4322
4326
  });
4323
4327
  return (_ctx, _cache) => {
4324
- return openBlock(), createElementBlock("a", {
4325
- class: normalizeClass(["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }]),
4328
+ return openBlock(), createElementBlock("a", mergeProps({
4329
+ class: ["lupa-search-box-product", { "lupa-search-box-product-highlighted": _ctx.highlighted }],
4330
+ href: link.value
4331
+ }, customDocumentHtmlAttributes.value, {
4326
4332
  "data-cy": "lupa-search-box-product",
4327
- href: link.value,
4328
4333
  onClick: handleClick
4329
- }, [
4334
+ }), [
4330
4335
  createElementVNode("div", _hoisted_2$I, [
4331
4336
  (openBlock(true), createElementBlock(Fragment, null, renderList(imageElements.value, (element) => {
4332
4337
  return openBlock(), createBlock(_sfc_main$13, {
@@ -4361,7 +4366,7 @@ const _sfc_main$12 = /* @__PURE__ */ defineComponent({
4361
4366
  isInStock: isInStock.value
4362
4367
  }, null, 8, ["item", "element", "labels", "link", "isInStock"])
4363
4368
  ])) : createCommentVNode("", true)
4364
- ], 10, _hoisted_1$_);
4369
+ ], 16, _hoisted_1$_);
4365
4370
  };
4366
4371
  }
4367
4372
  });
@@ -8889,6 +8894,10 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8889
8894
  }
8890
8895
  return (_b = (_a = props.options) == null ? void 0 : _a.labels) == null ? void 0 : _b.htmlTitleTemplate;
8891
8896
  });
8897
+ const customDocumentHtmlAttributes = computed(() => {
8898
+ var _a, _b, _c;
8899
+ return (_c = (_b = (_a = props.options).customDocumentHtmlAttributes) == null ? void 0 : _b.call(_a, props.product)) != null ? _c : {};
8900
+ });
8892
8901
  const getGroupElements = (group) => {
8893
8902
  var _a, _b;
8894
8903
  return (_b = (_a = props.options.elements) == null ? void 0 : _a.filter((e) => e.group === group)) != null ? _b : [];
@@ -8945,12 +8954,11 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
8945
8954
  }
8946
8955
  return (_ctx, _cache) => {
8947
8956
  var _a;
8948
- return openBlock(), createElementBlock("div", {
8957
+ return openBlock(), createElementBlock("div", mergeProps({
8949
8958
  id: "lupa-search-result-product-card",
8950
8959
  "data-cy": "lupa-search-result-product-card",
8951
- class: normalizeClass(["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]),
8952
- onClick: handleClick
8953
- }, [
8960
+ class: ["lupa-search-result-product-card", !isInStock.value ? "lupa-out-of-stock" : ""]
8961
+ }, customDocumentHtmlAttributes.value, { onClick: handleClick }), [
8954
8962
  createVNode(_sfc_main$w, { options: badgesOptions.value }, null, 8, ["options"]),
8955
8963
  createElementVNode("div", {
8956
8964
  class: normalizeClass(["lupa-search-result-product-contents", listLayoutClass.value])
@@ -9012,7 +9020,7 @@ const _sfc_main$k = /* @__PURE__ */ defineComponent({
9012
9020
  ], 2);
9013
9021
  }), 128))
9014
9022
  ], 2)
9015
- ], 2);
9023
+ ], 16);
9016
9024
  };
9017
9025
  }
9018
9026
  });
@@ -9339,7 +9347,8 @@ const _sfc_main$e = /* @__PURE__ */ defineComponent({
9339
9347
  "queryKey",
9340
9348
  "idKey",
9341
9349
  "titleKey",
9342
- "routingBehavior"
9350
+ "routingBehavior",
9351
+ "customDocumentHtmlAttributes"
9343
9352
  ]);
9344
9353
  });
9345
9354
  const similarQueriesLabels = computed(() => {
@@ -1,5 +1,6 @@
1
1
  import type { AnalyticsOptions } from './AnalyticsOptions';
2
- import type { Environment as SdkEnvironment } from '@getlupa/client-sdk/Types';
2
+ import type { Environment as SdkEnvironment, Document } from '@getlupa/client-sdk/Types';
3
+ export type CustomDocumentHtmlAttributes = (doc: Document) => Record<string, unknown>;
3
4
  export type SdkOptions = {
4
5
  environment: SdkEnvironment;
5
6
  customBaseUrl?: string;
@@ -1,5 +1,6 @@
1
1
  import type { DocumentElement } from '../DocumentElement';
2
2
  import type { Document } from '@getlupa/client-sdk/Types';
3
+ import { CustomDocumentHtmlAttributes } from '../General';
3
4
  export declare enum SearchBoxPanelType {
4
5
  SUGGESTION = "suggestion",
5
6
  DOCUMENT = "document"
@@ -25,6 +26,7 @@ export type DocumentSearchBoxPanel = SearchBoxPanelBase & {
25
26
  customClassName?: string;
26
27
  searchBySuggestion?: boolean;
27
28
  isInStock?: (doc: Document) => boolean;
29
+ customDocumentHtmlAttributes?: CustomDocumentHtmlAttributes;
28
30
  };
29
31
  export type SuggestionSearchBoxPanel = SearchBoxPanelBase & {
30
32
  type: SearchBoxPanelType.SUGGESTION;
@@ -3,6 +3,7 @@ import type { DocumentElement } from '../DocumentElement';
3
3
  import type { BadgeElement, BadgeGenerateOptions } from './BadgeOptions';
4
4
  import type { RoutingBehavior } from './RoutingBehavior';
5
5
  import type { SearchResultsOptionLabels } from './SearchResultsOptions';
6
+ import { CustomDocumentHtmlAttributes } from '../General';
6
7
  export type SearchResultsProductCardOptions = {
7
8
  labels: SearchResultsOptionLabels;
8
9
  routingBehavior?: RoutingBehavior;
@@ -15,6 +16,7 @@ export type SearchResultsProductCardOptions = {
15
16
  queryKey: string;
16
17
  idKey?: string;
17
18
  titleKey?: string;
19
+ customDocumentHtmlAttributes?: CustomDocumentHtmlAttributes;
18
20
  };
19
21
  export type SearchResultBadgeOptions = {
20
22
  anchor: AnchorPosition;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getlupa/vue",
3
- "version": "0.7.9",
3
+ "version": "0.8.0",
4
4
  "main": "dist/lupaSearch.mjs",
5
5
  "module": "dist/lupaSearch.mjs",
6
6
  "types": "dist/src/index.d.ts",