vviinn-widgets 2.17.4 → 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.
- package/dist/cjs/cropper-handler_27.cjs.entry.js +10 -7
- package/dist/cjs/vviinn-button.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-carousel_2.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +1 -1
- package/dist/collection/components/vviinn-button/vviinn-button.css +1 -6
- package/dist/collection/components/vviinn-button/vviinn-button.js +1 -1
- package/dist/collection/components/vviinn-product-card/render-helpers.js +6 -3
- package/dist/collection/components/vviinn-product-card/stories/args.js +4 -13
- package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js +38 -24
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +5 -5
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +1 -1
- package/dist/collection/components/vviinn-vpr-button/stories/args.js +26 -14
- package/dist/collection/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.js +5 -1
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +0 -5
- package/dist/collection/components/vviinn-vpr-widget/stories/args.js +0 -20
- package/dist/collection/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.js +29 -27
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +2 -1
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +1 -2
- package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +6 -1
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +2 -3
- package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +7 -2
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +14 -14
- package/dist/esm/cropper-handler_27.entry.js +10 -7
- package/dist/esm/vviinn-button.entry.js +2 -2
- package/dist/esm/vviinn-carousel_2.entry.js +1 -1
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +1 -1
- package/dist/esm/vviinn-vps-button.entry.js +1 -1
- package/dist/types/components/vviinn-product-card/stories/args.d.ts +3 -12
- package/dist/types/components/vviinn-product-card/stories/vviinn-product-card.stories.d.ts +3 -12
- package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -2
- package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +26 -14
- package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +26 -14
- package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +0 -20
- package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +0 -25
- package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +2 -1
- package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +1 -2
- package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +14 -14
- package/dist/vviinn-widgets/{p-fe01e0d1.entry.js → p-06d86abe.entry.js} +1 -1
- package/{www/build/p-add39d92.entry.js → dist/vviinn-widgets/p-132c12eb.entry.js} +1 -1
- package/dist/vviinn-widgets/p-81c220eb.entry.js +1 -0
- package/dist/vviinn-widgets/{p-10226f87.entry.js → p-9f3bcedd.entry.js} +1 -1
- package/{www/build/p-e441f87f.entry.js → dist/vviinn-widgets/p-fb14ace7.entry.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/{p-fe01e0d1.entry.js → p-06d86abe.entry.js} +1 -1
- package/{dist/vviinn-widgets/p-add39d92.entry.js → www/build/p-132c12eb.entry.js} +1 -1
- package/www/build/p-81c220eb.entry.js +1 -0
- package/www/build/{p-10226f87.entry.js → p-9f3bcedd.entry.js} +1 -1
- package/www/build/{p-b8e40b4d.js → p-ee250584.js} +1 -1
- package/{dist/vviinn-widgets/p-e441f87f.entry.js → www/build/p-fb14ace7.entry.js} +1 -1
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +1 -1
- package/dist/vviinn-widgets/p-c4a15f15.entry.js +0 -1
- 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
|
|
711
|
-
|
|
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.
|
|
789
|
-
: Image(props, () => this.
|
|
791
|
+
? ResponsiveImage(props, () => this.emitImageLoaded())
|
|
792
|
+
: Image(props, () => this.emitImageLoaded());
|
|
790
793
|
}
|
|
791
|
-
|
|
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-
|
|
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:#
|
|
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,
|
|
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;
|
|
@@ -855,7 +855,7 @@ class AnonymousSubject extends Subject {
|
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
857
|
|
|
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 #
|
|
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}";
|
|
859
859
|
|
|
860
860
|
let VviinnVprWidget = class {
|
|
861
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-
|
|
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,
|
|
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
|
};
|
|
@@ -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: #
|
|
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,
|
|
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
|
|
20
|
-
|
|
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
|
-
|
|
15
|
-
name: "
|
|
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
|
-
|
|
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
|
-
|
|
39
|
-
name: "Currency",
|
|
30
|
+
currency: {
|
|
40
31
|
options: ["$", "€", "£", "¥", "₽"],
|
|
41
32
|
control: {
|
|
42
33
|
type: "select",
|
package/dist/collection/components/vviinn-product-card/stories/vviinn-product-card.stories.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
57
|
-
[0,
|
|
58
|
-
[1,
|
|
59
|
-
[2,
|
|
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
|
-
${
|
|
61
|
+
${alignment.get(args.contentAlignment)}
|
|
64
62
|
${showImageBorders(args.imageBorder, args.imageBorderColor)}
|
|
65
|
-
${setupBrandVisibility(args.
|
|
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="
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
88
|
+
responsive="${args.responsive}"
|
|
89
|
+
image-ratio="${args.imageRatio}"
|
|
90
|
+
dimmed-background="${args.dimmedBackground}"
|
|
89
91
|
locale="${args.locale}"
|
|
90
|
-
currency="${args.
|
|
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
|
-
|
|
105
|
+
dimmedBackground: false,
|
|
99
106
|
primaryTextColor: "#161616",
|
|
100
107
|
secondaryTextColor: "#757575",
|
|
101
|
-
|
|
108
|
+
brand: "Ronald Schmitt",
|
|
102
109
|
titleLineCount: 2,
|
|
103
110
|
locale: "en-US",
|
|
104
|
-
|
|
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.
|
|
80
|
-
: Image(props, () => this.
|
|
79
|
+
? ResponsiveImage(props, () => this.emitImageLoaded())
|
|
80
|
+
: Image(props, () => this.emitImageLoaded());
|
|
81
81
|
}
|
|
82
|
-
|
|
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-
|
|
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-
|
|
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"
|
|
@@ -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
|
};
|
|
@@ -1,13 +1,5 @@
|
|
|
1
1
|
import { argTypes, continuityLayoutArgs, gridLayoutArgs } from "./args";
|
|
2
2
|
import { gridDecorator, continuityDecorator } from "./decorators";
|
|
3
|
-
const excludeControls = [
|
|
4
|
-
"blockTitle",
|
|
5
|
-
"currencySign",
|
|
6
|
-
"imageRatio",
|
|
7
|
-
"imageWidth",
|
|
8
|
-
"pricePrefix",
|
|
9
|
-
"showScroll",
|
|
10
|
-
];
|
|
11
3
|
export default {
|
|
12
4
|
title: "Widgets/Visual Recommendations/Widget",
|
|
13
5
|
component: "vviinn-vpr-widget",
|
|
@@ -16,13 +8,8 @@ export default {
|
|
|
16
8
|
disable: true,
|
|
17
9
|
},
|
|
18
10
|
} }),
|
|
19
|
-
parameters: {
|
|
20
|
-
controls: {
|
|
21
|
-
exclude: excludeControls,
|
|
22
|
-
},
|
|
23
|
-
},
|
|
24
11
|
};
|
|
25
|
-
const
|
|
12
|
+
const alignmentLeft = `
|
|
26
13
|
vviinn-vpr-widget::part(title),
|
|
27
14
|
vviinn-vpr-widget::part(brand),
|
|
28
15
|
vviinn-vpr-widget::part(type),
|
|
@@ -31,7 +18,7 @@ const allignementLeft = `
|
|
|
31
18
|
align-self: start;
|
|
32
19
|
text-align: left;
|
|
33
20
|
}`;
|
|
34
|
-
const
|
|
21
|
+
const alignmentCenter = `
|
|
35
22
|
vviinn-vpr-widget::part(title),
|
|
36
23
|
vviinn-vpr-widget::part(brand),
|
|
37
24
|
vviinn-vpr-widget::part(type),
|
|
@@ -40,7 +27,7 @@ const allignementCenter = `
|
|
|
40
27
|
align-self: center;
|
|
41
28
|
text-align: center;
|
|
42
29
|
}`;
|
|
43
|
-
const
|
|
30
|
+
const alignmentRight = `
|
|
44
31
|
vviinn-vpr-widget::part(title),
|
|
45
32
|
vviinn-vpr-widget::part(brand),
|
|
46
33
|
vviinn-vpr-widget::part(type),
|
|
@@ -49,10 +36,10 @@ const allignementRight = `
|
|
|
49
36
|
align-self: end;
|
|
50
37
|
text-align: right;
|
|
51
38
|
}`;
|
|
52
|
-
const
|
|
53
|
-
[0,
|
|
54
|
-
[1,
|
|
55
|
-
[2,
|
|
39
|
+
const alignment = new Map([
|
|
40
|
+
[0, alignmentLeft],
|
|
41
|
+
[1, alignmentCenter],
|
|
42
|
+
[2, alignmentRight],
|
|
56
43
|
]);
|
|
57
44
|
const Template = (args) => `
|
|
58
45
|
<script>
|
|
@@ -66,7 +53,7 @@ const Template = (args) => `
|
|
|
66
53
|
gtag("require", "ec");
|
|
67
54
|
</script>
|
|
68
55
|
<style>
|
|
69
|
-
${
|
|
56
|
+
${alignment.get(args.contentAlignment)}
|
|
70
57
|
vviinn-vpr-widget::part(title),
|
|
71
58
|
vviinn-vpr-widget::part(brand),
|
|
72
59
|
vviinn-vpr-widget::part(type),
|
|
@@ -151,12 +138,17 @@ const Template = (args) => `
|
|
|
151
138
|
</style>
|
|
152
139
|
|
|
153
140
|
<vviinn-vpr-widget
|
|
154
|
-
block-title="${args.
|
|
141
|
+
block-title="${args.blockTitle}"
|
|
142
|
+
css-url="${args.cssUrl}"
|
|
143
|
+
currency-sign="${args.currencySign}"
|
|
144
|
+
show-scroll="${args.showScroll}"
|
|
145
|
+
image-ratio="${args.imageRatio}"
|
|
146
|
+
locale="${args.locale}"
|
|
147
|
+
price-prefix="${args.pricePrefix}"
|
|
155
148
|
api-path="${args.apiPath}"
|
|
156
149
|
product-id="${args.productId}"
|
|
157
150
|
token="${args.token}"
|
|
158
151
|
mode="${args.mode}"
|
|
159
|
-
show-scroll="${args.showScrollbars}"
|
|
160
152
|
image-width="${args.imageWidth}"
|
|
161
153
|
campaign-type="${args.campaignType}"
|
|
162
154
|
campaigns="${args.campaigns}"
|
|
@@ -180,10 +172,15 @@ Grid.args = {
|
|
|
180
172
|
recommendationsGridProductsMobile: 4,
|
|
181
173
|
recommendationsGridProductsTablet: 4,
|
|
182
174
|
secondaryTextColor: "#757575",
|
|
183
|
-
|
|
175
|
+
showScroll: true,
|
|
184
176
|
showTitle: true,
|
|
185
177
|
titleFontSize: 28,
|
|
186
|
-
|
|
178
|
+
blockTitle: "Recommended products",
|
|
179
|
+
cssUrl: "",
|
|
180
|
+
locale: "en-US",
|
|
181
|
+
currencySign: "€",
|
|
182
|
+
pricePrefix: "",
|
|
183
|
+
imageRatio: 1,
|
|
187
184
|
token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4",
|
|
188
185
|
};
|
|
189
186
|
Grid.argTypes = Object.assign({}, gridLayoutArgs);
|
|
@@ -204,10 +201,15 @@ Continuity.args = {
|
|
|
204
201
|
recommendationsContinuityProductsMobile: 160,
|
|
205
202
|
recommendationsContinuityProductsTablet: 150,
|
|
206
203
|
secondaryTextColor: "#757575",
|
|
207
|
-
|
|
204
|
+
showScroll: false,
|
|
208
205
|
showTitle: true,
|
|
209
206
|
titleFontSize: 28,
|
|
210
|
-
|
|
207
|
+
blockTitle: "Recommended products",
|
|
208
|
+
cssUrl: "",
|
|
209
|
+
locale: "en-US",
|
|
210
|
+
currencySign: "€",
|
|
211
|
+
pricePrefix: "",
|
|
212
|
+
imageRatio: 1,
|
|
211
213
|
token: "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOjgzLCJqdGkiOiI3ZTg2Y2I1YS00ZTFjLTRhYjctYjU2My1lN2FjMTYzZTYyZDIiLCJzY29wZXMiOlsidnByIiwidnBzIiwidnBjIl19.SbaQnBkvoXer3GPCWUthFQStFKLHZNMBfj4Qu44WHM8nzaIt48I74yVy4gVbX29vtd6jIkDPdakqEXRXmAxOCtv7_nsd4iBs1yMegfOWW5g8f10PKfZqmWJcfhwKIEElnUMFmP6rXpogntZ7iFfeTBbiRNzQPhkaa7jUjgQkCC4",
|
|
212
214
|
};
|
|
213
215
|
Continuity.decorators = [continuityDecorator];
|
|
@@ -18,14 +18,15 @@ import { checkEmpryString } from "../../utils/option/option";
|
|
|
18
18
|
* @part currency - brand inside product card
|
|
19
19
|
* @part image - product card image
|
|
20
20
|
* @part image-link - anchor element around product image
|
|
21
|
+
* @part deeplink - anchor element around product title
|
|
21
22
|
* @part price-amount-sale - numeric part of price.
|
|
22
23
|
* @part price-amount-outdated - numeric part of price.
|
|
23
24
|
* @part price-amount-regular - numeric part of price.
|
|
24
25
|
* @part price-container - block of prices
|
|
25
26
|
* @part price-outdated - block for outdated price. rendered when product contains sale price
|
|
26
|
-
* @part price-prefix - block rendered before each price element (for ex. "from")
|
|
27
27
|
* @part price-regular - block for price if no sale price presented
|
|
28
28
|
* @part price-sale - block for sale price. rendered only if sale price presented
|
|
29
|
+
* @part price-prefix - block rendered before each price element (for ex. "from")
|
|
29
30
|
* @part carousel-button
|
|
30
31
|
*/
|
|
31
32
|
export class VviinnVprWidget {
|