vviinn-widgets 2.17.0 → 2.17.7

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 (61) hide show
  1. package/dist/cjs/cropper-handler_27.cjs.entry.js +10 -7
  2. package/dist/cjs/vviinn-button.cjs.entry.js +2 -2
  3. package/dist/cjs/vviinn-carousel_2.cjs.entry.js +5 -10
  4. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +1 -1
  5. package/dist/cjs/vviinn-vps-button.cjs.entry.js +1 -1
  6. package/dist/collection/campaign/Campaign.js +0 -3
  7. package/dist/collection/campaign/VCSCampaignService.js +2 -4
  8. package/dist/collection/campaign/VPRCampaignService.js +2 -4
  9. package/dist/collection/components/vviinn-button/vviinn-button.css +1 -6
  10. package/dist/collection/components/vviinn-button/vviinn-button.js +1 -1
  11. package/dist/collection/components/vviinn-product-card/render-helpers.js +6 -3
  12. package/dist/collection/components/vviinn-product-card/stories/args.js +4 -13
  13. package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +38 -24
  14. package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +5 -5
  15. package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +1 -1
  16. package/dist/collection/components/vviinn-vpr-button/stories/args.js +26 -14
  17. package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +5 -1
  18. package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +0 -5
  19. package/dist/collection/components/vviinn-vpr-widget/stories/args.js +0 -20
  20. package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +29 -27
  21. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +2 -1
  22. package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +1 -2
  23. package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +6 -1
  24. package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +2 -3
  25. package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +7 -2
  26. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +14 -14
  27. package/dist/esm/cropper-handler_27.entry.js +10 -7
  28. package/dist/esm/vviinn-button.entry.js +2 -2
  29. package/dist/esm/vviinn-carousel_2.entry.js +5 -10
  30. package/dist/esm/vviinn-recommendations-sidebar.entry.js +1 -1
  31. package/dist/esm/vviinn-vps-button.entry.js +1 -1
  32. package/dist/types/campaign/Campaign.d.ts +0 -1
  33. package/dist/types/components/vviinn-product-card/stories/args.d.ts +3 -12
  34. package/dist/types/components/vviinn-product-card/stories/vviinn-product-card.stories.d.ts +3 -12
  35. package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -2
  36. package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +26 -14
  37. package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +26 -14
  38. package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +0 -20
  39. package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +0 -25
  40. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +2 -1
  41. package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +1 -2
  42. package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +14 -14
  43. package/dist/vviinn-widgets/p-06d86abe.entry.js +1 -0
  44. package/{www/build/p-add39d92.entry.js → dist/vviinn-widgets/p-132c12eb.entry.js} +1 -1
  45. package/dist/vviinn-widgets/p-81c220eb.entry.js +1 -0
  46. package/dist/vviinn-widgets/{p-10226f87.entry.js → p-9f3bcedd.entry.js} +1 -1
  47. package/dist/vviinn-widgets/{p-e441f87f.entry.js → p-fb14ace7.entry.js} +1 -1
  48. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  49. package/package.json +1 -1
  50. package/www/build/p-06d86abe.entry.js +1 -0
  51. package/{dist/vviinn-widgets/p-add39d92.entry.js → www/build/p-132c12eb.entry.js} +1 -1
  52. package/www/build/p-81c220eb.entry.js +1 -0
  53. package/www/build/{p-10226f87.entry.js → p-9f3bcedd.entry.js} +1 -1
  54. package/www/build/{p-92973057.js → p-ee250584.js} +1 -1
  55. package/www/build/{p-e441f87f.entry.js → p-fb14ace7.entry.js} +1 -1
  56. package/www/build/vviinn-widgets.esm.js +1 -1
  57. package/www/index.html +1 -1
  58. package/dist/vviinn-widgets/p-3bc6d7c6.entry.js +0 -1
  59. package/dist/vviinn-widgets/p-c4a15f15.entry.js +0 -1
  60. package/www/build/p-3bc6d7c6.entry.js +0 -1
  61. package/www/build/p-c4a15f15.entry.js +0 -1
@@ -701,14 +701,17 @@ const processWidth = (url, size) => {
701
701
  };
702
702
  const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
703
703
  const FormattedPrice = (props) => {
704
- var _a;
705
704
  const locale = props.locale;
706
705
  const priceType = props.priceType;
707
706
  const formattedPrice = new Intl.NumberFormat(locale, {
708
707
  minimumFractionDigits: 2,
709
708
  }).format(props.price);
710
- const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
711
- return (index.h("span", { class: "price-amount", part: `price-amount${priceType ? "-" + priceType : ""}` }, fullPrice));
709
+ const prefixElement = props.prefix ? (index.h("span", { part: "price-prefix" }, props.prefix + " ")) : null;
710
+ const currencyElement = props.currency ? (index.h("span", { part: "currency" }, " " + props.currency)) : null;
711
+ return (index.h("span", { class: "price-amount", part: `price-amount${priceType ? "-" + priceType : ""}` },
712
+ prefixElement,
713
+ formattedPrice,
714
+ currencyElement));
712
715
  };
713
716
  const Price = (props) => {
714
717
  return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
@@ -785,15 +788,15 @@ let VviinnProductCard = class {
785
788
  lazy: false,
786
789
  };
787
790
  return this.responsive
788
- ? ResponsiveImage(props, () => this.kek())
789
- : Image(props, () => this.kek());
791
+ ? ResponsiveImage(props, () => this.emitImageLoaded())
792
+ : Image(props, () => this.emitImageLoaded());
790
793
  }
791
- kek() {
794
+ emitImageLoaded() {
792
795
  this.productImageLoaded.emit(this.productId);
793
796
  }
794
797
  render() {
795
798
  var _a, _b, _c;
796
- return (index.h(index.Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-prefix, price-regular, price-sale, title" }, index.h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), index.h(Linked, { deeplink: this.deeplink, part: "deeplink" }, index.h("span", { class: "title", part: "title" }, this.productTitle)), index.h("span", { class: "brand", part: "brand" }, this.brand), index.h("span", { class: "type", part: "type" }, this.productType), index.h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : index$1.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : index$1.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : index$1.state.locale })));
799
+ return (index.h(index.Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-regular, price-sale, price-prefix, title" }, index.h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), index.h(Linked, { deeplink: this.deeplink, part: "deeplink" }, index.h("span", { class: "title", part: "title" }, this.productTitle)), index.h("span", { class: "brand", part: "brand" }, this.brand), index.h("span", { class: "type", part: "type" }, this.productType), index.h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : index$1.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : index$1.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : index$1.state.locale })));
797
800
  }
798
801
  get el() { return index.getElement(this); }
799
802
  };
@@ -5,7 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
5
5
  const index = require('./index-0bda22ec.js');
6
6
  const index$1 = require('./index-5ce4918b.js');
7
7
 
8
- const vviinnButtonCss = ":host{display:block}.open-button{align-items:center;background:rgba(255, 255, 255, 0.8);border-radius:50%;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);box-sizing:border-box;cursor:pointer;display:grid;height:40px;justify-items:center;padding:0;width:40px;transition:all 0.25s ease-in-out}.raw-open-button{background:none;border:none;cursor:pointer}.open-button:hover{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.25)}.open-button:focus{border:2px solid rgba(15, 98, 254, 0.5);outline:none}.open-button:active{background:#F4F4F4;outline:none}";
8
+ const vviinnButtonCss = ":host{display:block}.open-button{align-items:center;background:rgba(255, 255, 255, 0.8);border-radius:50%;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);box-sizing:border-box;cursor:pointer;display:grid;height:40px;justify-items:center;padding:0;width:40px;transition:all 0.25s ease-in-out}.raw-open-button{background:none;border:none;cursor:pointer}.open-button:hover{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.25)}.open-button:focus{border:2px solid rgba(15, 98, 254, 0.5);outline:none}.open-button:active{background:#f4f4f4;outline:none}";
9
9
 
10
10
  let VviinnButton = class {
11
11
  constructor(hostRef) {
@@ -13,7 +13,7 @@ let VviinnButton = class {
13
13
  this.addStyle = true;
14
14
  }
15
15
  render() {
16
- return (index.h(index.Host, null, index.h("button", { class: this.addStyle ? "open-button" : "raw-open-button", part: "button" }, index.h("slot", null, index.h(index$1.VisualSearchIcon, null)))));
16
+ return (index.h(index.Host, { exportparts: "button" }, index.h("button", { class: this.addStyle ? "open-button" : "raw-open-button", part: "button" }, index.h("slot", null, index.h(index$1.VisualSearchIcon, null)))));
17
17
  }
18
18
  };
19
19
  VviinnButton.style = vviinnButtonCss;
@@ -231,23 +231,18 @@ function fold(onVPR, onVCS) {
231
231
  function fromString(s) {
232
232
  return s === "VPR" ? { _tag: "VPR" } : { _tag: "VCS" };
233
233
  }
234
- function addColorToUrl(url, color) {
235
- return (color === null || color === void 0 ? void 0 : color.length) > 0 ? `${url}?color=${color}` : url;
236
- }
237
234
 
238
235
  const sequenceToEither = index$1.sequenceT(index$1.Apply);
239
236
  const apiGet = (path, data = {}) => index$1.pipe(sequenceToEither(index$1.getApiPath(), index$1.createInitGetRequest), index$1.fromEither, index$1.chainW(index$1.makeRequest(path, data)));
240
237
 
241
238
  const getVPRRecommendations = (productId) => (color) => (campaigns) => (options) => {
242
- const url = index$1._function.pipe(campaigns, index$1.map(encodeURIComponent), index$1.match$1(() => `product/${productId}/similar-products`, (encodedCampaignsIds) => `product/${productId}/similar-products?campaigns=${encodedCampaignsIds}`));
243
- const urlWithParams = addColorToUrl(url, color);
244
- return apiGet(urlWithParams, options);
239
+ const url = index$1._function.pipe(campaigns, index$1.map(encodeURIComponent), index$1.match$1(() => `product/${productId}/similar-products${color ? `?color=${color}` : ""}`, (encodedCampaignsIds) => `product/${productId}/similar-products?campaigns=${encodedCampaignsIds}${color ? `&color=${color}` : ""}`));
240
+ return apiGet(url, options);
245
241
  };
246
242
 
247
243
  const getVCSRecommendations = (productId) => (color) => (campaigns) => (options) => {
248
- const url = index$1._function.pipe(campaigns, index$1.map(encodeURIComponent), index$1.match$1(() => `product/${productId}/cross-selling-products`, (encodedCampaignsIds) => `product/${productId}/cross-selling-products?campaigns=${encodedCampaignsIds}`));
249
- const urlWithParams = addColorToUrl(url, color);
250
- return apiGet(urlWithParams, options);
244
+ const url = index$1._function.pipe(campaigns, index$1.map(encodeURIComponent), index$1.match$1(() => `product/${productId}/cross-selling-products${color ? `?color=${color}` : ""}`, (encodedCampaignsIds) => `product/${productId}/cross-selling-products?campaigns=${encodedCampaignsIds}${color ? `&color=${color}` : ""}`));
245
+ return apiGet(url, options);
251
246
  };
252
247
 
253
248
  const getRecommendationsService = (campaignType) => index$1._function.pipe(fromString(campaignType), fold(() => getVPRRecommendations, () => getVCSRecommendations));
@@ -860,7 +855,7 @@ class AnonymousSubject extends Subject {
860
855
  }
861
856
  }
862
857
 
863
- const vviinnVprWidgetCss = ":host{display:grid;grid-gap:1rem;width:100%}:host(:not(.loaded)){position:absolute;visibility:hidden}:host(.grid) vviinn-product-card::part(image){border:1px solid #DDDDDD;width:100%}h2{margin:0}vviinn-product-card::part(price-container){align-self:flex-start;text-align:left;display:flex}.results{display:grid;grid-gap:1rem}.visually-hidden{position:absolute;top:0;left:0;z-index:-1;height:0;width:0}h2{margin:0}:host(.grid) h2{justify-content:center}:host(.grid) vviinn-product-card::part(image){min-width:100%}:host(.grid) vviinn-product-card::part(image-link){width:100%}:host(.grid) vviinn-product-card::part(title),:host(.grid) vviinn-product-card::part(brand),:host(.grid) vviinn-product-card::part(type){text-align:center}:host(.grid) vviinn-product-card::part(price-container){align-self:center}:host(.continuity) vviinn-product-card::part(title),:host(.continuity) vviinn-product-card::part(brand),:host(.continuity) vviinn-product-card::part(type),:host(.continuity) vviinn-product-card::part(deeplink){text-align:left;max-width:unset;align-self:start}";
858
+ const vviinnVprWidgetCss = ":host{display:grid;grid-gap:1rem;width:100%}:host(:not(.loaded)){position:absolute;visibility:hidden}:host(.grid) vviinn-product-card::part(image){border:1px solid #dddddd;width:100%}h2{margin:0}vviinn-product-card::part(price-container){align-self:flex-start;text-align:left;display:flex}.results{display:grid;grid-gap:1rem}.visually-hidden{position:absolute;top:0;left:0;z-index:-1;height:0;width:0}h2{margin:0}:host(.grid) h2{justify-content:center}:host(.grid) vviinn-product-card::part(image){min-width:100%}:host(.grid) vviinn-product-card::part(image-link){width:100%}:host(.grid) vviinn-product-card::part(title),:host(.grid) vviinn-product-card::part(brand),:host(.grid) vviinn-product-card::part(type){text-align:center}:host(.grid) vviinn-product-card::part(price-container){align-self:center}:host(.continuity) vviinn-product-card::part(title),:host(.continuity) vviinn-product-card::part(brand),:host(.continuity) vviinn-product-card::part(type),:host(.continuity) vviinn-product-card::part(deeplink){text-align:left;max-width:unset;align-self:start}";
864
859
 
865
860
  let VviinnVprWidget = class {
866
861
  constructor(hostRef) {
@@ -45,7 +45,7 @@ let RecommendationsSidebar = class {
45
45
  return (_a = this.el.shadowRoot.querySelector("aside")) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect();
46
46
  }
47
47
  render() {
48
- return (index.h(index.Host, { class: this.getClassMap() }, index.h("aside", { class: "sidebar", part: "body", onAnimationEnd: (e) => this.handleAnimationEnd(e) }, index.h("header", { class: { "contains-source-img": this.isSourceImageValid() }, part: "sidebar-header" }, this.isSourceImageValid() ? this.renderSourceImage() : null, index.h("span", { class: "title", part: "title" }, this.sidebarTitle), index.h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") }, index.h(index$1.CrossIcon, null))), index.h("main", { part: "sidebar-content" }, index.h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title, carousel-button, product-card, items-group", token: this.token, productId: this.productId, imageWidth: this.imageWidth, blockTitle: "", mode: this.mode, useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar, campaigns: this.campaigns, color: this.color })))));
48
+ return (index.h(index.Host, { class: this.getClassMap() }, index.h("aside", { class: "sidebar", part: "body", onAnimationEnd: (e) => this.handleAnimationEnd(e) }, index.h("header", { class: { "contains-source-img": this.isSourceImageValid() }, part: "sidebar-header" }, this.isSourceImageValid() ? this.renderSourceImage() : null, index.h("span", { class: "title", part: "title" }, this.sidebarTitle), index.h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") }, index.h(index$1.CrossIcon, null))), index.h("main", { part: "sidebar-content" }, index.h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-prefix, price-outdated, price-regular, price-sale, title: product-title, carousel-button, product-card, items-group", token: this.token, productId: this.productId, imageWidth: this.imageWidth, blockTitle: "", mode: this.mode, useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar, campaigns: this.campaigns, color: this.color })))));
49
49
  }
50
50
  renderSourceImage() {
51
51
  return (index.h("img", { class: "source-image", part: "source-image", src: this.sourceImage }));
@@ -36,7 +36,7 @@ let VviinnVpsButton = class {
36
36
  this.pressed = true;
37
37
  }
38
38
  render() {
39
- return (index.h(index.Host, { tabindex: "0", role: "button", pressed: this.pressed, onKeyDown: (ev) => this.handleKeyDown(ev) }, index.h("vviinn-button", { onClick: () => this.handleClick(), addStyle: this.addStyle, part: "vviinn-button" }, index.h("slot", null, index.h(index$1.CameraIcon, null))), index.h(customizedSlots.SlotSkeleton, null), index.h("vviinn-vps-widget", { active: this.pressed, "currency-sign": "\u20AC", token: this.token, locale: this.locale, apiPath: this.apiPath, exportparts: "brand, currency, deeplink, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-prefix, price-regular, price-sale, title, product-card, example-images", campaignId: this.campaignId })));
39
+ return (index.h(index.Host, { tabindex: "0", role: "button", pressed: this.pressed, onKeyDown: (ev) => this.handleKeyDown(ev) }, index.h("vviinn-button", { onClick: () => this.handleClick(), addStyle: this.addStyle, part: "vviinn-button" }, index.h("slot", null, index.h(index$1.CameraIcon, null))), index.h(customizedSlots.SlotSkeleton, null), index.h("vviinn-vps-widget", { active: this.pressed, "currency-sign": "\u20AC", token: this.token, locale: this.locale, apiPath: this.apiPath, exportparts: "brand, deeplink, currency, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-regular, price-sale, price-prefix, title, product-card, example-images", campaignId: this.campaignId })));
40
40
  }
41
41
  get el() { return index.getElement(this); }
42
42
  };
@@ -6,6 +6,3 @@ export function fold(onVPR, onVCS) {
6
6
  export function fromString(s) {
7
7
  return s === "VPR" ? { _tag: "VPR" } : { _tag: "VCS" };
8
8
  }
9
- export function addColorToUrl(url, color) {
10
- return (color === null || color === void 0 ? void 0 : color.length) > 0 ? `${url}?color=${color}` : url;
11
- }
@@ -1,9 +1,7 @@
1
1
  import { apiGet } from "../network/apiClient";
2
2
  import * as O from "fp-ts/Option";
3
3
  import { pipe } from "fp-ts/lib/function";
4
- import { addColorToUrl } from "./Campaign";
5
4
  export const getVCSRecommendations = (productId) => (color) => (campaigns) => (options) => {
6
- const url = pipe(campaigns, O.map(encodeURIComponent), O.match(() => `product/${productId}/cross-selling-products`, (encodedCampaignsIds) => `product/${productId}/cross-selling-products?campaigns=${encodedCampaignsIds}`));
7
- const urlWithParams = addColorToUrl(url, color);
8
- return apiGet(urlWithParams, options);
5
+ const url = pipe(campaigns, O.map(encodeURIComponent), O.match(() => `product/${productId}/cross-selling-products${color ? `?color=${color}` : ""}`, (encodedCampaignsIds) => `product/${productId}/cross-selling-products?campaigns=${encodedCampaignsIds}${color ? `&color=${color}` : ""}`));
6
+ return apiGet(url, options);
9
7
  };
@@ -1,9 +1,7 @@
1
1
  import { apiGet } from "../network/apiClient";
2
2
  import * as O from "fp-ts/Option";
3
3
  import { pipe } from "fp-ts/lib/function";
4
- import { addColorToUrl } from "./Campaign";
5
4
  export const getVPRRecommendations = (productId) => (color) => (campaigns) => (options) => {
6
- const url = pipe(campaigns, O.map(encodeURIComponent), O.match(() => `product/${productId}/similar-products`, (encodedCampaignsIds) => `product/${productId}/similar-products?campaigns=${encodedCampaignsIds}`));
7
- const urlWithParams = addColorToUrl(url, color);
8
- return apiGet(urlWithParams, options);
5
+ const url = pipe(campaigns, O.map(encodeURIComponent), O.match(() => `product/${productId}/similar-products${color ? `?color=${color}` : ""}`, (encodedCampaignsIds) => `product/${productId}/similar-products?campaigns=${encodedCampaignsIds}${color ? `&color=${color}` : ""}`));
6
+ return apiGet(url, options);
9
7
  };
@@ -1,9 +1,4 @@
1
1
  :host {
2
- /**
3
- * @prop --vviinn-carousel-columns: control number of items in grid mode
4
- * @prop --vviinn-carousel-image-width: control image width in continuity mode
5
- */
6
-
7
2
  display: block;
8
3
  }
9
4
 
@@ -39,6 +34,6 @@
39
34
  }
40
35
 
41
36
  .open-button:active {
42
- background: #F4F4F4;
37
+ background: #f4f4f4;
43
38
  outline: none;
44
39
  }
@@ -9,7 +9,7 @@ export class VviinnButton {
9
9
  this.addStyle = true;
10
10
  }
11
11
  render() {
12
- return (h(Host, null,
12
+ return (h(Host, { exportparts: "button" },
13
13
  h("button", { class: this.addStyle ? "open-button" : "raw-open-button", part: "button" },
14
14
  h("slot", null,
15
15
  h(VisualSearchIcon, null)))));
@@ -10,14 +10,17 @@ export const processWidth = (url, size) => {
10
10
  };
11
11
  export const Linked = (props, child) => props.deeplink ? (h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
12
12
  const FormattedPrice = (props) => {
13
- var _a;
14
13
  const locale = props.locale;
15
14
  const priceType = props.priceType;
16
15
  const formattedPrice = new Intl.NumberFormat(locale, {
17
16
  minimumFractionDigits: 2,
18
17
  }).format(props.price);
19
- const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
20
- return (h("span", { class: "price-amount", part: `price-amount${priceType ? "-" + priceType : ""}` }, fullPrice));
18
+ const prefixElement = props.prefix ? (h("span", { part: "price-prefix" }, props.prefix + " ")) : null;
19
+ const currencyElement = props.currency ? (h("span", { part: "currency" }, " " + props.currency)) : null;
20
+ return (h("span", { class: "price-amount", part: `price-amount${priceType ? "-" + priceType : ""}` },
21
+ prefixElement,
22
+ formattedPrice,
23
+ currencyElement));
21
24
  };
22
25
  export const Price = (props) => {
23
26
  return (h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
@@ -1,22 +1,15 @@
1
1
  export const argTypes = {
2
- imageWidth: {
3
- name: "Card width (px)",
4
- },
5
- imageBorder: {
6
- name: "Image border",
7
- },
8
2
  imageBorderColor: {
9
3
  name: "Image border color",
10
4
  control: {
11
5
  type: "color",
12
6
  },
13
7
  },
14
- imageBackground: {
15
- name: "Image background",
8
+ dimmedBackground: {
9
+ name: "dimmed-background",
16
10
  description: "Adding a light-gray filter on top of the image to distinguish it from the rest of the product card content.",
17
11
  },
18
- showBrand: {
19
- name: "Show brand",
12
+ brand: {
20
13
  description: "Using the [title] attribute from product feed.",
21
14
  },
22
15
  titleLineCount: {
@@ -28,15 +21,13 @@ export const argTypes = {
28
21
  },
29
22
  },
30
23
  locale: {
31
- name: "Locale",
32
24
  options: ["de-DE", "en-US"],
33
25
  control: {
34
26
  type: "select",
35
27
  default: 0,
36
28
  },
37
29
  },
38
- currencyValue: {
39
- name: "Currency",
30
+ currency: {
40
31
  options: ["$", "€", "£", "¥", "₽"],
41
32
  control: {
42
33
  type: "select",
@@ -3,10 +3,8 @@ import { productDecorator } from "./decorators";
3
3
  export default {
4
4
  title: "Elements/Product Card",
5
5
  component: "vviinn-product-card",
6
- decorators: [
7
- productDecorator
8
- ],
9
- argTypes
6
+ decorators: [productDecorator],
7
+ argTypes,
10
8
  };
11
9
  const showImageBorders = (x, color) => {
12
10
  const borderRule = x ? `1px solid ${color}` : "none";
@@ -26,7 +24,7 @@ const setupTitleLineCount = (count) => `
26
24
  -webkit-line-clamp: ${count};
27
25
  }
28
26
  `;
29
- const allignementLeft = `
27
+ const alignmentLeft = `
30
28
  vviinn-product-card::part(title),
31
29
  vviinn-product-card::part(brand),
32
30
  vviinn-product-card::part(type),
@@ -35,7 +33,7 @@ const allignementLeft = `
35
33
  align-self: start;
36
34
  text-align: left;
37
35
  }`;
38
- const allignementCenter = `
36
+ const alignmentCenter = `
39
37
  vviinn-product-card::part(title),
40
38
  vviinn-product-card::part(brand),
41
39
  vviinn-product-card::part(type),
@@ -44,7 +42,7 @@ const allignementCenter = `
44
42
  align-self: center;
45
43
  text-align: center;
46
44
  }`;
47
- const allignementRight = `
45
+ const alignmentRight = `
48
46
  vviinn-product-card::part(title),
49
47
  vviinn-product-card::part(brand),
50
48
  vviinn-product-card::part(type),
@@ -53,16 +51,16 @@ const allignementRight = `
53
51
  align-self: end;
54
52
  text-align: right;
55
53
  }`;
56
- const allignement = new Map([
57
- [0, allignementLeft],
58
- [1, allignementCenter],
59
- [2, allignementRight],
54
+ const alignment = new Map([
55
+ [0, alignmentLeft],
56
+ [1, alignmentCenter],
57
+ [2, alignmentRight],
60
58
  ]);
61
59
  const Template = (args) => `
62
60
  <style>
63
- ${allignement.get(args.contentAlignment)}
61
+ ${alignment.get(args.contentAlignment)}
64
62
  ${showImageBorders(args.imageBorder, args.imageBorderColor)}
65
- ${setupBrandVisibility(args.showBrand)}
63
+ ${setupBrandVisibility(args.brand)}
66
64
  ${setupTitleLineCount(args.titleLineCount)}
67
65
 
68
66
  vviinn-product-card::part(title),
@@ -78,28 +76,44 @@ const Template = (args) => `
78
76
  }
79
77
  </style>
80
78
  <vviinn-product-card
81
- product-title="Couchtisch Rolf Benz 8770 Ronald Schmitt"
82
- brand="Ronald Schmitt"
83
- product-type="Couchtische"
84
- price="3629"
85
- sale-price="1653"
86
- image="https://www.moebel-shop.de/media/image/e3/e9/28/0749295-001_600x600.jpg"
79
+ product-title="${args.productTitle}"
80
+ product-id="${args.productId}"
81
+ brand="${args.brand}"
82
+ product-type="${args.productType}"
83
+ price="${args.price}"
84
+ sale-price="${args.salePrice}"
85
+ price-prefix="${args.pricePrefix}"
86
+ image="${args.image}"
87
87
  image-width="${args.imageWidth}"
88
- dimmed-background="${args.imageBackground}"
88
+ responsive="${args.responsive}"
89
+ image-ratio="${args.imageRatio}"
90
+ dimmed-background="${args.dimmedBackground}"
89
91
  locale="${args.locale}"
90
- currency="${args.currencyValue}"
92
+ currency="${args.currency}"
93
+ deeplink="${args.deeplink}"
94
+ imageRatio="${args.imageRatio}"
91
95
  ></vviinn-product-card>`;
92
96
  export const Default = Template.bind({});
93
97
  Default.args = {
98
+ productTitle: "Couchtisch Rolf Benz 8770 Ronald Schmitt",
99
+ productType: "Couchtische",
100
+ productId: "",
94
101
  imageWidth: 240,
95
102
  contentAlignment: "Left",
96
103
  imageBorder: true,
97
104
  imageBorderColor: "#dddddd",
98
- imageBackground: false,
105
+ dimmedBackground: false,
99
106
  primaryTextColor: "#161616",
100
107
  secondaryTextColor: "#757575",
101
- showBrand: false,
108
+ brand: "Ronald Schmitt",
102
109
  titleLineCount: 2,
103
110
  locale: "en-US",
104
- currencyValue: "€"
111
+ currency: "€",
112
+ deeplink: "",
113
+ image: "https://www.moebel-shop.de/media/image/e3/e9/28/0749295-001_600x600.jpg",
114
+ responsive: false,
115
+ imageRatio: 1,
116
+ price: 3629,
117
+ salePrice: 1653,
118
+ pricePrefix: "",
105
119
  };
@@ -17,9 +17,9 @@ import styles from "./vviinn-product-card.css";
17
17
  * @part price-amount-regular - numeric part of price.
18
18
  * @part price-container - block contains all prices.
19
19
  * @part price-outdated - renders inside price-container when "sale-price" property filled. Contains regular price.
20
- * @part price-prefix - renders before price-amount. Can be set with "price-prefix" property or inherited from parent component.
21
20
  * @part price-regular - renders inside price-container when "sale-price" property is empty.
22
21
  * @part price-sale - renders inside price-container when "sale-price" property filled. Contains sale price.
22
+ * @part price-prefix - renders before price-amount. Can be set with "price-prefix" property or inherited from parent component.
23
23
  * @part title - product title
24
24
  */
25
25
  export class VviinnProductCard {
@@ -76,15 +76,15 @@ export class VviinnProductCard {
76
76
  lazy: false,
77
77
  };
78
78
  return this.responsive
79
- ? ResponsiveImage(props, () => this.kek())
80
- : Image(props, () => this.kek());
79
+ ? ResponsiveImage(props, () => this.emitImageLoaded())
80
+ : Image(props, () => this.emitImageLoaded());
81
81
  }
82
- kek() {
82
+ emitImageLoaded() {
83
83
  this.productImageLoaded.emit(this.productId);
84
84
  }
85
85
  render() {
86
86
  var _a, _b, _c;
87
- return (h(Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-prefix, price-regular, price-sale, title" },
87
+ return (h(Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-regular, price-sale, price-prefix, title" },
88
88
  h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()),
89
89
  h(Linked, { deeplink: this.deeplink, part: "deeplink" },
90
90
  h("span", { class: "title", part: "title" }, this.productTitle)),
@@ -44,7 +44,7 @@ export class RecommendationsSidebar {
44
44
  h("button", { class: "close-sidebar", onClick: () => (this.state = "closed") },
45
45
  h(CrossIcon, null))),
46
46
  h("main", { part: "sidebar-content" },
47
- h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title: product-title, carousel-button, product-card, items-group", token: this.token, productId: this.productId, imageWidth: this.imageWidth, blockTitle: "", mode: this.mode, useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar, campaigns: this.campaigns, color: this.color })))));
47
+ h("vviinn-vpr-widget", { exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-prefix, price-outdated, price-regular, price-sale, title: product-title, carousel-button, product-card, items-group", token: this.token, productId: this.productId, imageWidth: this.imageWidth, blockTitle: "", mode: this.mode, useCarousel: this.position === "bottom", onRecommendationsLoaded: () => (this.state = "open"), showScroll: this.widgetScrollbar, campaigns: this.campaigns, color: this.color })))));
48
48
  }
49
49
  renderSourceImage() {
50
50
  return (h("img", { class: "source-image", part: "source-image", src: this.sourceImage }));
@@ -17,13 +17,6 @@ export const argTypes = {
17
17
  },
18
18
  defaultValue: "Default",
19
19
  },
20
- iconColor: {
21
- name: "Icon color",
22
- control: {
23
- type: "color",
24
- },
25
- defaultValue: "#000000",
26
- },
27
20
  backgroundColor: {
28
21
  name: "Background color",
29
22
  control: {
@@ -77,13 +70,6 @@ export const argTypes = {
77
70
  },
78
71
  defaultValue: "bottom",
79
72
  },
80
- backdropOpacity: {
81
- name: "Backdrop opacity (%)",
82
- control: {
83
- type: "number",
84
- },
85
- defaultValue: 50,
86
- },
87
73
  sidebarBorderRadius: {
88
74
  name: "Modal container round corners (px)",
89
75
  control: {
@@ -203,6 +189,32 @@ export const argTypes = {
203
189
  type: "text",
204
190
  },
205
191
  },
192
+ addStyle: {
193
+ name: "add-style",
194
+ control: {
195
+ type: "boolean",
196
+ },
197
+ defaultValue: true,
198
+ },
199
+ imageWidth: {
200
+ name: "image-width",
201
+ control: {
202
+ type: "text",
203
+ },
204
+ defaultValue: "300",
205
+ },
206
+ mode: {
207
+ name: "mode",
208
+ options: ["continuity", "grid"],
209
+ control: {
210
+ type: "select",
211
+ },
212
+ defaultValue: "continuity",
213
+ },
214
+ sourceImage: {
215
+ name: "source-image",
216
+ defaultValue: "https://www.moebel-shop.de/media/image/e3/e9/28/0749295-001_600x600.jpg",
217
+ },
206
218
  color: {
207
219
  name: "color",
208
220
  control: {
@@ -25,7 +25,6 @@ const Template = (args) => `<style>
25
25
  vviinn-vpr-button::part(button) {
26
26
  width: ${args.buttonSize}px;
27
27
  height: ${args.buttonSize}px;
28
- fill: ${args.iconColor};
29
28
  background: ${args.backgroundColor};
30
29
  opacity: ${args.backgroundOpacity}%;
31
30
  border-radius: ${args.radius}px;
@@ -60,6 +59,7 @@ const Template = (args) => `<style>
60
59
  }
61
60
 
62
61
  vviinn-recommendations-sidebar::part(source-image) {
62
+ display: ${args.sourceImage && args.showSourceImage ? "block" : "none"};
63
63
  width: ${args.sourceImageSize}px;
64
64
  height: ${args.sourceImageSize}px;
65
65
  border: ${args.sourceImageBorder ? "1px solid" : "none"};
@@ -70,9 +70,13 @@ const Template = (args) => `<style>
70
70
  <vviinn-vpr-button token="${args.token}"
71
71
  product-id="${args.productId}"
72
72
  position="${args.position}"
73
+ add-style="${args.addStyle}"
73
74
  sidebar-title="${args.sidebarTitle}"
74
75
  modal-scrollbar="${args.modalScrollbar}"
76
+ mode="${args.mode}"
75
77
  campaigns="${args.campaigns}"
78
+ image-width="${args.imageWidth}"
79
+ source-image="${args.sourceImage}"
76
80
  color="${args.color.toString().slice(1)}"
77
81
  source-image="${args.showSourceImage
78
82
  ? "https://www.moebel-shop.de/media/image/e3/e9/28/0749295-001_600x600.jpg"
@@ -1,8 +1,3 @@
1
1
  :host {
2
- /**
3
- * @prop --vviinn-carousel-columns: control number of items in grid mode
4
- * @prop --vviinn-carousel-image-width: control image width in continuity mode
5
- */
6
-
7
2
  display: block;
8
3
  }
@@ -68,16 +68,6 @@ const showTitle = {
68
68
  },
69
69
  required: false,
70
70
  };
71
- const titleName = {
72
- name: "block-title",
73
- control: {
74
- type: "text",
75
- },
76
- table: {
77
- defaultValue: { summary: "Recommended products" },
78
- },
79
- required: false,
80
- };
81
71
  const titleFontSize = {
82
72
  name: "Section title name font size (px)",
83
73
  control: {
@@ -85,14 +75,6 @@ const titleFontSize = {
85
75
  },
86
76
  required: false,
87
77
  };
88
- const showScrollbars = {
89
- name: "show-scroll",
90
- description: "Add browser default horizontal scroll bar (in continuity mode) or pagination bullets (in grid mode) to add extra cue for users ",
91
- control: {
92
- type: "boolean",
93
- },
94
- required: false,
95
- };
96
78
  const imageWidth = {
97
79
  name: "image-width",
98
80
  control: {
@@ -137,10 +119,8 @@ export const argTypes = {
137
119
  primaryTextColor,
138
120
  productId,
139
121
  secondaryTextColor,
140
- showScrollbars,
141
122
  showTitle,
142
123
  titleFontSize,
143
- titleName,
144
124
  token,
145
125
  color,
146
126
  };