vviinn-widgets 2.18.21 → 2.19.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.
- package/dist/cjs/{index-cb410762.js → Campaign-a94a827a.js} +17 -1
- package/dist/cjs/cropper-handler_29.cjs.entry.js +1418 -0
- package/dist/cjs/{imageSearch.store-98824653.js → index-48c94264.js} +16016 -11171
- package/dist/cjs/{index-7f1325a7.js → index-a4becaff.js} +683 -303
- package/dist/cjs/loader.cjs.js +4 -3
- package/dist/cjs/{vviinn-carousel_3.cjs.entry.js → vviinn-carousel_2.cjs.entry.js} +150 -270
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +14 -8
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +12 -14
- package/dist/cjs/vviinn-widgets.cjs.js +10 -3
- package/dist/collection/Image/sizing.spec.js +66 -0
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.css +2 -16
- package/dist/collection/components/image-search/image-view/highlight-box/highlight-box.js +11 -7
- package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.css +0 -1
- package/dist/collection/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.js +40 -37
- package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.js +73 -67
- package/dist/collection/components/image-search/search-filters/search-filters.css +4 -23
- package/dist/collection/components/image-search/search-filters/search-filters.js +97 -91
- package/dist/collection/components/vviinn-button/vviinn-button.js +34 -31
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +1 -2
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +161 -156
- package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.js +12 -14
- package/dist/collection/components/vviinn-error/vviinn-error.js +12 -12
- package/dist/collection/components/vviinn-error/vviinn-server-error/vviinn-server-error.js +35 -30
- package/dist/collection/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.js +35 -30
- package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.js +129 -121
- package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +75 -75
- package/dist/collection/components/vviinn-icons/index.js +10 -27
- package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +120 -67
- package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +81 -69
- package/dist/collection/components/vviinn-image-view/vviinn-image-view.css +0 -1
- package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +27 -28
- package/dist/collection/components/vviinn-modal/vviinn-modal.css +7 -36
- package/dist/collection/components/vviinn-modal/vviinn-modal.js +115 -93
- package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.js +12 -14
- package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.js +12 -14
- package/dist/collection/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.js +12 -14
- package/dist/collection/components/vviinn-onboarding/vviinn-onboarding.js +12 -17
- package/dist/collection/components/vviinn-overlay/vviinn-overlay.css +1 -12
- package/dist/collection/components/vviinn-overlay/vviinn-overlay.js +12 -9
- package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.js +107 -78
- package/dist/collection/components/vviinn-preloader/vviinn-preloader.css +1 -11
- package/dist/collection/components/vviinn-preloader/vviinn-preloader.js +11 -7
- package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.css +0 -1
- package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.js +12 -16
- package/dist/collection/components/vviinn-product-card/render-helpers.js +6 -14
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +425 -415
- package/dist/collection/components/vviinn-slider/arrow.js +1 -2
- package/dist/collection/components/vviinn-slider/vviinn-slide/vviinn-slide.js +12 -9
- package/dist/collection/components/vviinn-slider/vviinn-slider.css +0 -1
- package/dist/collection/components/vviinn-slider/vviinn-slider.js +87 -82
- package/dist/collection/components/vviinn-teaser/vviinn-teaser.js +12 -18
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +12 -64
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +371 -360
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +448 -444
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +545 -542
- package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +2 -0
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +368 -332
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +0 -5
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.e2e.js +26 -0
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +502 -425
- package/dist/collection/geometry/Clip.spec.js +16 -0
- package/dist/collection/geometry/Rectangle.spec.js +66 -0
- package/dist/collection/geometry/Sized.spec.js +16 -0
- package/dist/collection/interfaces/generated.js +0 -4
- package/dist/collection/network/ion/Form.spec.js +43 -0
- package/dist/esm/{index-b31d86ce.js → Campaign-4aa53f29.js} +15 -2
- package/dist/esm/cropper-handler_29.entry.js +1386 -0
- package/dist/esm/{index-590cb67e.js → index-48ef9564.js} +683 -304
- package/dist/esm/{imageSearch.store-9dde5360.js → index-976acf7e.js} +16124 -11292
- package/dist/esm/loader.js +4 -3
- package/dist/esm/polyfills/css-shim.js +1 -1
- package/dist/esm/{vviinn-carousel_3.entry.js → vviinn-carousel_2.entry.js} +106 -225
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +13 -7
- package/dist/esm/vviinn-vpr-button.entry.js +11 -13
- package/dist/esm/vviinn-widgets.js +7 -3
- package/dist/loader/index.d.ts +9 -0
- package/dist/loader/package.json +1 -0
- package/dist/types/Image/sizing.d.ts +4 -4
- package/dist/types/campaign/Campaign.d.ts +5 -5
- package/dist/types/campaign/VCSCampaignResponse.d.ts +1 -1
- package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +2 -2
- package/dist/types/components/vviinn-image-selector/vviinn-image-selector.d.ts +4 -0
- package/dist/types/components/vviinn-modal/vviinn-modal.d.ts +2 -0
- package/dist/types/components/vviinn-overlayed-modal/vviinn-overlayed-modal.d.ts +2 -0
- package/dist/types/components/vviinn-product-card/render-helpers.d.ts +3 -3
- package/dist/types/components/vviinn-slider/arrow.d.ts +2 -2
- package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +2 -2
- package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +9 -4
- package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +8 -0
- package/dist/types/components.d.ts +154 -54
- package/dist/types/error.d.ts +1 -1
- package/dist/types/geometry/Point.d.ts +1 -1
- package/dist/types/geometry/Rectangle.d.ts +1 -1
- package/dist/types/geometry/Sized.d.ts +1 -1
- package/dist/types/interfaces/generated.d.ts +192 -371
- package/dist/types/network/ion/File.d.ts +2 -2
- package/dist/types/network/ion/Form.d.ts +5 -5
- package/dist/types/network/ion/Link.d.ts +1 -1
- package/dist/types/network/ion/ValueObject.d.ts +4 -4
- package/dist/types/network/utils.d.ts +3 -3
- package/dist/types/recommendation/events.d.ts +5 -5
- package/dist/types/recommendation/recommendation.d.ts +1 -1
- package/dist/types/searchSession/searchSession.d.ts +7 -7
- package/dist/types/slider/GridMode.d.ts +1 -1
- package/dist/types/stencil-public-runtime.d.ts +98 -23
- package/dist/types/store/imageSearch.store.d.ts +1 -1
- package/dist/types/tracking/models.d.ts +2 -2
- package/dist/types/utils/event/Events.d.ts +1 -1
- package/dist/vviinn-widgets/p-312b0eb7.entry.js +1 -0
- package/dist/vviinn-widgets/p-414b2291.js +1 -0
- package/dist/vviinn-widgets/p-5b50c7e5.entry.js +1 -0
- package/dist/vviinn-widgets/p-8deaa5da.entry.js +1 -0
- package/dist/vviinn-widgets/p-c6209bc1.entry.js +1 -0
- package/{www/build/p-2f9ee951.js → dist/vviinn-widgets/p-d08ce429.js} +1 -1
- package/dist/vviinn-widgets/p-fa17e81f.js +2 -0
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +12 -12
- package/www/build/p-312b0eb7.entry.js +1 -0
- package/www/build/p-414b2291.js +1 -0
- package/www/build/p-5b50c7e5.entry.js +1 -0
- package/www/build/p-8deaa5da.entry.js +1 -0
- package/www/build/p-c6209bc1.entry.js +1 -0
- package/{dist/vviinn-widgets/p-2f9ee951.js → www/build/p-d08ce429.js} +1 -1
- package/www/build/p-d39b7d70.js +161 -0
- package/www/build/p-fa17e81f.js +2 -0
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +2 -2
- package/dist/cjs/Campaign-13258569.js +0 -18
- package/dist/cjs/Handler-176539c8.js +0 -331
- package/dist/cjs/cropper-handler.cjs.entry.js +0 -27
- package/dist/cjs/customized-slots-6e56c354.js +0 -54
- package/dist/cjs/highlight-box_22.cjs.entry.js +0 -770
- package/dist/cjs/index-a99edb90.js +0 -3235
- package/dist/cjs/vviinn-button.cjs.entry.js +0 -21
- package/dist/cjs/vviinn-error.cjs.entry.js +0 -19
- package/dist/cjs/vviinn-preloader.cjs.entry.js +0 -26
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +0 -65
- package/dist/cjs/vviinn-vps-widget.cjs.entry.js +0 -251
- package/dist/esm/Campaign-90ba7e06.js +0 -14
- package/dist/esm/Handler-f9b8735c.js +0 -309
- package/dist/esm/cropper-handler.entry.js +0 -23
- package/dist/esm/customized-slots-00afe247.js +0 -51
- package/dist/esm/highlight-box_22.entry.js +0 -745
- package/dist/esm/index-4d5b52ba.js +0 -3224
- package/dist/esm/vviinn-button.entry.js +0 -17
- package/dist/esm/vviinn-error.entry.js +0 -15
- package/dist/esm/vviinn-preloader.entry.js +0 -22
- package/dist/esm/vviinn-vps-button.entry.js +0 -61
- package/dist/esm/vviinn-vps-widget.entry.js +0 -247
- package/dist/vviinn-widgets/p-11f61564.js +0 -1
- package/dist/vviinn-widgets/p-12851e97.entry.js +0 -1
- package/dist/vviinn-widgets/p-18fd769b.js +0 -1
- package/dist/vviinn-widgets/p-339c6838.js +0 -1
- package/dist/vviinn-widgets/p-3b2c91c0.entry.js +0 -1
- package/dist/vviinn-widgets/p-45df9f28.entry.js +0 -1
- package/dist/vviinn-widgets/p-57ed5303.entry.js +0 -1
- package/dist/vviinn-widgets/p-69850e5b.js +0 -1
- package/dist/vviinn-widgets/p-7c2f762a.entry.js +0 -1
- package/dist/vviinn-widgets/p-7c3b7388.entry.js +0 -1
- package/dist/vviinn-widgets/p-85006f41.entry.js +0 -1
- package/dist/vviinn-widgets/p-8a3dd76d.entry.js +0 -1
- package/dist/vviinn-widgets/p-99e58be7.entry.js +0 -1
- package/dist/vviinn-widgets/p-a2b450b6.entry.js +0 -1
- package/dist/vviinn-widgets/p-bcc1ccf0.js +0 -1
- package/dist/vviinn-widgets/p-e6fee8d2.js +0 -1
- package/www/build/p-11f61564.js +0 -1
- package/www/build/p-12851e97.entry.js +0 -1
- package/www/build/p-18fd769b.js +0 -1
- package/www/build/p-339c6838.js +0 -1
- package/www/build/p-3b2c91c0.entry.js +0 -1
- package/www/build/p-45df9f28.entry.js +0 -1
- package/www/build/p-57ed5303.entry.js +0 -1
- package/www/build/p-69850e5b.js +0 -1
- package/www/build/p-7c2f762a.entry.js +0 -1
- package/www/build/p-7c3b7388.entry.js +0 -1
- package/www/build/p-85006f41.entry.js +0 -1
- package/www/build/p-8a3dd76d.entry.js +0 -1
- package/www/build/p-99e58be7.entry.js +0 -1
- package/www/build/p-9e2c131a.js +0 -125
- package/www/build/p-a2b450b6.entry.js +0 -1
- package/www/build/p-bcc1ccf0.js +0 -1
- package/www/build/p-e6fee8d2.js +0 -1
|
@@ -2,22 +2,101 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const Campaign = require('./Campaign-13258569.js');
|
|
9
|
-
const Handler = require('./Handler-176539c8.js');
|
|
10
|
-
const index$2 = require('./index-a99edb90.js');
|
|
5
|
+
const index$1 = require('./index-a4becaff.js');
|
|
6
|
+
const index = require('./index-48c94264.js');
|
|
7
|
+
const Campaign = require('./Campaign-a94a827a.js');
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
/**
|
|
10
|
+
* The `Apply` class provides the `ap` which is used to apply a function to an argument under a type constructor.
|
|
11
|
+
*
|
|
12
|
+
* `Apply` can be used to lift functions of two or more arguments to work on values wrapped with the type constructor
|
|
13
|
+
* `f`.
|
|
14
|
+
*
|
|
15
|
+
* Instances must satisfy the following law in addition to the `Functor` laws:
|
|
16
|
+
*
|
|
17
|
+
* 1. Associative composition: `F.ap(F.ap(F.map(fbc, bc => ab => a => bc(ab(a))), fab), fa) <-> F.ap(fbc, F.ap(fab, fa))`
|
|
18
|
+
*
|
|
19
|
+
* Formally, `Apply` represents a strong lax semi-monoidal endofunctor.
|
|
20
|
+
*
|
|
21
|
+
* @example
|
|
22
|
+
* import * as O from 'fp-ts/Option'
|
|
23
|
+
* import { pipe } from 'fp-ts/function'
|
|
24
|
+
*
|
|
25
|
+
* const f = (a: string) => (b: number) => (c: boolean) => a + String(b) + String(c)
|
|
26
|
+
* const fa: O.Option<string> = O.some('s')
|
|
27
|
+
* const fb: O.Option<number> = O.some(1)
|
|
28
|
+
* const fc: O.Option<boolean> = O.some(true)
|
|
29
|
+
*
|
|
30
|
+
* assert.deepStrictEqual(
|
|
31
|
+
* pipe(
|
|
32
|
+
* // lift a function
|
|
33
|
+
* O.some(f),
|
|
34
|
+
* // apply the first argument
|
|
35
|
+
* O.ap(fa),
|
|
36
|
+
* // apply the second argument
|
|
37
|
+
* O.ap(fb),
|
|
38
|
+
* // apply the third argument
|
|
39
|
+
* O.ap(fc)
|
|
40
|
+
* ),
|
|
41
|
+
* O.some('s1true')
|
|
42
|
+
* )
|
|
43
|
+
*
|
|
44
|
+
* @since 2.0.0
|
|
45
|
+
*/
|
|
46
|
+
function curried(f, n, acc) {
|
|
47
|
+
return function (x) {
|
|
48
|
+
var combined = Array(acc.length + 1);
|
|
49
|
+
for (var i = 0; i < acc.length; i++) {
|
|
50
|
+
combined[i] = acc[i];
|
|
51
|
+
}
|
|
52
|
+
combined[acc.length] = x;
|
|
53
|
+
return n === 0 ? f.apply(null, combined) : curried(f, n - 1, combined);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
var tupleConstructors = {
|
|
57
|
+
1: function (a) { return [a]; },
|
|
58
|
+
2: function (a) { return function (b) { return [a, b]; }; },
|
|
59
|
+
3: function (a) { return function (b) { return function (c) { return [a, b, c]; }; }; },
|
|
60
|
+
4: function (a) { return function (b) { return function (c) { return function (d) { return [a, b, c, d]; }; }; }; },
|
|
61
|
+
5: function (a) { return function (b) { return function (c) { return function (d) { return function (e) { return [a, b, c, d, e]; }; }; }; }; }
|
|
62
|
+
};
|
|
63
|
+
function getTupleConstructor(len) {
|
|
64
|
+
if (!index.has.call(tupleConstructors, len)) {
|
|
65
|
+
tupleConstructors[len] = curried(index.tuple, len - 1, []);
|
|
66
|
+
}
|
|
67
|
+
return tupleConstructors[len];
|
|
68
|
+
}
|
|
69
|
+
function sequenceT(F) {
|
|
70
|
+
return function () {
|
|
71
|
+
var args = [];
|
|
72
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
73
|
+
args[_i] = arguments[_i];
|
|
74
|
+
}
|
|
75
|
+
var len = args.length;
|
|
76
|
+
var f = getTupleConstructor(len);
|
|
77
|
+
var fas = F.map(args[0], f);
|
|
78
|
+
for (var i = 1; i < len; i++) {
|
|
79
|
+
fas = F.ap(fas, args[i]);
|
|
80
|
+
}
|
|
81
|
+
return fas;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const vviinnCarouselCss = ":host{--vviinn-progressbar-width:0;--vviinn-carousel-item-width:150px;--vviinn-carousel-columns-internal:var(--vviinn-carousel-columns, 4);--vviinn-carousel-image-width-system:140px}.body{display:flex;position:relative;width:var(--vviinn-carousel-content-width);flex-direction:column}.content-wrapper *{box-sizing:border-box}.content-wrapper{overflow-y:hidden;overflow-x:auto;flex-grow:1}.bullets{margin-top:16px;display:flex;flex-direction:row;grid-gap:24px;justify-content:center}.bullet{width:10px;height:10px;background:#e0e0e0;border-radius:50%;cursor:pointer}.bullet.active{background:#161616}.content:not(.show-scrollbar),.content.grid{scrollbar-color:#fff0 #fff0}.content:not(.show-scrollbar)::-webkit-scrollbar,.content.grid::-webkit-scrollbar{opacity:0}.content{display:flex;flex-direction:row;grid-gap:8px;scroll-snap-type:x mandatory;overflow-y:hidden;overflow-x:auto;flex-grow:1;padding-bottom:16px}.content.left>*{scroll-snap-align:start}.content.right>*{scroll-snap-align:end}:host(.continuity) button{border-radius:2px}:host(.grid) button{border-radius:50%}button{align-items:center;background-color:white;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);cursor:pointer;display:grid;height:40px;justify-items:center;position:absolute;top:calc(50% - 20px);width:40px;z-index:1;padding:0;margin:0}button{fill:#525252}button:disabled{display:none}button.prev svg{transform:rotate(180deg);margin-left:-5px}.prev{left:0}.next{right:0}.items-group{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--vviinn-carousel-columns-internal), 1fr);min-width:100%}vviinn-product-card::part(price-container){text-align:center}:host(.classic) vviinn-product-card::part(title),:host(.classic) vviinn-product-card::part(brand),:host(.classic) vviinn-product-card::part(type){text-align:center}@media (max-width: 480px){:host(.modern) button{display:none}.items-group{grid-template-columns:repeat(2, 1fr)}}";
|
|
13
86
|
|
|
14
87
|
const COLUMNS_NUMBER_CSS_VAR = "--vviinn-carousel-columns-internal";
|
|
15
88
|
const CAROUSEL_WIDTH_CSS_VAR = "--vviinn-carousel-content-width";
|
|
16
89
|
const CAROUSEL_IMAGE_WIDTH_CSS_VAR = "--vviinn-carousel-image-width";
|
|
17
90
|
const CONTENT_GROUP_CSS_CLASS = "items-group";
|
|
18
|
-
|
|
91
|
+
const VviinnCarousel = class {
|
|
19
92
|
constructor(hostRef) {
|
|
20
|
-
index.registerInstance(this, hostRef);
|
|
93
|
+
index$1.registerInstance(this, hostRef);
|
|
94
|
+
this.columns = 0;
|
|
95
|
+
this.resizeObserver = new ResizeObserver(() => this.handleResize());
|
|
96
|
+
this.mutationObserver = new MutationObserver(() => this.cloneSlottedContent());
|
|
97
|
+
this.isLastGroup = () => this.activeContentGroup === this.getContentGroups().length - 1 &&
|
|
98
|
+
this.mode === "grid";
|
|
99
|
+
this.isFirstGroup = () => this.activeContentGroup === 0 && this.mode === "grid";
|
|
21
100
|
this.moveDirection = "right";
|
|
22
101
|
this.contentGroups = [];
|
|
23
102
|
this.activeContentGroup = 0;
|
|
@@ -25,13 +104,10 @@ let VviinnCarousel = class {
|
|
|
25
104
|
this.mode = "continuity";
|
|
26
105
|
this.imageWidth = 140;
|
|
27
106
|
this.showScroll = true;
|
|
107
|
+
this.campaignTypeId = undefined;
|
|
108
|
+
this.widgetElementId = undefined;
|
|
109
|
+
this.gridArrowsDynamic = undefined;
|
|
28
110
|
this.recommendations = [];
|
|
29
|
-
this.columns = 0;
|
|
30
|
-
this.resizeObserver = new ResizeObserver(() => this.handleResize());
|
|
31
|
-
this.mutationObserver = new MutationObserver(() => this.cloneSlottedContent());
|
|
32
|
-
this.isLastGroup = () => this.activeContentGroup === this.getContentGroups().length - 1 &&
|
|
33
|
-
this.mode === "grid";
|
|
34
|
-
this.isFirstGroup = () => this.activeContentGroup === 0 && this.mode === "grid";
|
|
35
111
|
}
|
|
36
112
|
componentWillLoad() {
|
|
37
113
|
this.isRTL = document.dir === "rtl";
|
|
@@ -191,10 +267,10 @@ let VviinnCarousel = class {
|
|
|
191
267
|
};
|
|
192
268
|
}
|
|
193
269
|
renderRecommendation(recommendation, rank) {
|
|
194
|
-
return (index.h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.mode === "continuity", campaignTypeId: this.campaignTypeId, index: rank, widgetElementId: this.widgetElementId }));
|
|
270
|
+
return (index$1.h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.mode === "continuity", campaignTypeId: this.campaignTypeId, index: rank, widgetElementId: this.widgetElementId }));
|
|
195
271
|
}
|
|
196
272
|
renderRecommendationGroup(elements) {
|
|
197
|
-
return (index.h("div", { class: CONTENT_GROUP_CSS_CLASS, part: "items-group" }, elements));
|
|
273
|
+
return (index$1.h("div", { class: CONTENT_GROUP_CSS_CLASS, part: "items-group" }, ...elements));
|
|
198
274
|
}
|
|
199
275
|
renderRecommendationGroups(elements) {
|
|
200
276
|
return elements.map((el) => this.renderRecommendationGroup(el));
|
|
@@ -209,213 +285,24 @@ let VviinnCarousel = class {
|
|
|
209
285
|
}
|
|
210
286
|
renderGrid() {
|
|
211
287
|
const recommendations = this.renderRecommendationsElements();
|
|
212
|
-
const grouppedContent =
|
|
288
|
+
const grouppedContent = index._Array.chunksOf(this.getColumnsNumber())(recommendations);
|
|
213
289
|
return this.renderRecommendationGroups(grouppedContent);
|
|
214
290
|
}
|
|
215
291
|
renderBullets() {
|
|
216
292
|
const numberOfBullets = Math.ceil(this.recommendations.length / this.getColumnsNumber());
|
|
217
293
|
const bulletsArray = Array.from(Array(numberOfBullets).keys());
|
|
218
|
-
return bulletsArray.map((index
|
|
294
|
+
return bulletsArray.map((index) => (index$1.h("div", { class: {
|
|
219
295
|
bullet: true,
|
|
220
|
-
active: this.activeContentGroup === index
|
|
221
|
-
}, onClick: () => this.scroll(index
|
|
296
|
+
active: this.activeContentGroup === index,
|
|
297
|
+
}, onClick: () => this.scroll(index) })));
|
|
222
298
|
}
|
|
223
299
|
render() {
|
|
224
|
-
return (index.h(index.Host, { class: this.getClassMap() }, index.h("div", { class: Object.assign({ body: true }, this.getClassMap()) }, index.h("button", { class: "prev", onClick: () => this.showPrev(), part: "carousel-button", disabled: this.gridArrowsDynamic && this.isFirstGroup() }, index.h(
|
|
300
|
+
return (index$1.h(index$1.Host, { class: this.getClassMap() }, index$1.h("div", { class: Object.assign({ body: true }, this.getClassMap()) }, index$1.h("button", { class: "prev", onClick: () => this.showPrev(), part: "carousel-button", disabled: this.gridArrowsDynamic && this.isFirstGroup() }, index$1.h(Campaign.ChevronIcon, null)), index$1.h("div", { class: this.getContentClassMap(), onScroll: () => this.processScrollbarWidth() }, this.renderRecommendations()), index$1.h("button", { class: "next", onClick: () => this.showNext(), part: "carousel-button", disabled: this.gridArrowsDynamic && this.isLastGroup() }, index$1.h(Campaign.ChevronIcon, null))), this.showBullets() && (index$1.h("div", { class: "bullets" }, this.renderBullets()))));
|
|
225
301
|
}
|
|
226
|
-
get el() { return index.getElement(this); }
|
|
302
|
+
get el() { return index$1.getElement(this); }
|
|
227
303
|
};
|
|
228
304
|
VviinnCarousel.style = vviinnCarouselCss;
|
|
229
305
|
|
|
230
|
-
class GtagAnalytics {
|
|
231
|
-
sendImpression(product) {
|
|
232
|
-
var _a, _b, _c;
|
|
233
|
-
gtag('event', 'view_item_list', {
|
|
234
|
-
items: [
|
|
235
|
-
{
|
|
236
|
-
id: product.productId,
|
|
237
|
-
name: product.title,
|
|
238
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
239
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
240
|
-
list_name: 'VI VPR View',
|
|
241
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
242
|
-
}
|
|
243
|
-
]
|
|
244
|
-
});
|
|
245
|
-
return undefined;
|
|
246
|
-
}
|
|
247
|
-
sendClick(product) {
|
|
248
|
-
var _a, _b, _c;
|
|
249
|
-
gtag('event', 'select_content', {
|
|
250
|
-
content_type: 'product',
|
|
251
|
-
items: [
|
|
252
|
-
{
|
|
253
|
-
id: product.productId,
|
|
254
|
-
name: product.title,
|
|
255
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
256
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
257
|
-
list_name: 'VI VPR View',
|
|
258
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
259
|
-
}
|
|
260
|
-
]
|
|
261
|
-
});
|
|
262
|
-
return undefined;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
class GAnalytics {
|
|
267
|
-
constructor() {
|
|
268
|
-
ga('require', 'ec');
|
|
269
|
-
}
|
|
270
|
-
convertProduct(product) {
|
|
271
|
-
var _a, _b, _c;
|
|
272
|
-
return {
|
|
273
|
-
id: product.productId,
|
|
274
|
-
name: product.title,
|
|
275
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
276
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
277
|
-
list: 'VI VPR View',
|
|
278
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
279
|
-
};
|
|
280
|
-
}
|
|
281
|
-
sendImpression(product) {
|
|
282
|
-
ga('ec:addImpression', this.convertProduct(product));
|
|
283
|
-
return undefined;
|
|
284
|
-
}
|
|
285
|
-
sendClick(product) {
|
|
286
|
-
var _a, _b, _c;
|
|
287
|
-
ga('ec:addProduct', {
|
|
288
|
-
id: product.productId,
|
|
289
|
-
name: product.title,
|
|
290
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
291
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
292
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
293
|
-
});
|
|
294
|
-
ga('ec:setAction', 'click', { list: 'VI VPR View' });
|
|
295
|
-
return undefined;
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
const getGtagAnalytics = () => imageSearch_store._function.pipe(imageSearch_store.Option.fromNullable(window.gtag), imageSearch_store.Option.map(() => new GtagAnalytics()));
|
|
300
|
-
const getCommonAnalytics = () => imageSearch_store._function.pipe(imageSearch_store.Option.fromNullable(window.ga), imageSearch_store.Option.map(() => new GAnalytics()));
|
|
301
|
-
const analyticsMonoid = imageSearch_store.Option.getMonoid(imageSearch_store.Semigroup.first());
|
|
302
|
-
const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
|
|
303
|
-
|
|
304
|
-
const FIT_EXPR = /fit\/\d+\//;
|
|
305
|
-
const containsFit = (url) => {
|
|
306
|
-
return imageSearch_store._function.pipe(url.match(FIT_EXPR), imageSearch_store.Either.fromNullable(url), imageSearch_store.Either.map(() => url));
|
|
307
|
-
};
|
|
308
|
-
const processWidth = (url, size) => {
|
|
309
|
-
return imageSearch_store._function.pipe(containsFit(url), imageSearch_store.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), imageSearch_store.Either.getOrElse(() => url));
|
|
310
|
-
};
|
|
311
|
-
const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
|
|
312
|
-
const FormattedPrice = (props) => {
|
|
313
|
-
const locale = props.locale;
|
|
314
|
-
const priceType = props.priceType;
|
|
315
|
-
const formattedPrice = new Intl.NumberFormat(locale, {
|
|
316
|
-
minimumFractionDigits: 2,
|
|
317
|
-
}).format(props.price);
|
|
318
|
-
const prefixElement = props.prefix ? (index.h("span", { part: "price-prefix" }, props.prefix + " ")) : null;
|
|
319
|
-
const currencyElement = props.currency ? (index.h("span", { part: "currency" }, " " + props.currency)) : null;
|
|
320
|
-
return (index.h("span", { class: "price-amount", part: `price-amount${priceType ? "-" + priceType : ""}` },
|
|
321
|
-
prefixElement,
|
|
322
|
-
formattedPrice,
|
|
323
|
-
currencyElement));
|
|
324
|
-
};
|
|
325
|
-
const Price = (props) => {
|
|
326
|
-
return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
|
|
327
|
-
index.h("span", { class: "price-sale", part: "price-sale" },
|
|
328
|
-
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale, priceType: "sale" })),
|
|
329
|
-
index.h("span", { class: "price-outdated", part: "price-outdated" },
|
|
330
|
-
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "outdated" })),
|
|
331
|
-
]) : (index.h("span", { class: "price-regular", part: "price-regular" },
|
|
332
|
-
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "regular" })))));
|
|
333
|
-
};
|
|
334
|
-
const Image = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
335
|
-
index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image", width: props.width, height: props.height, src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
336
|
-
const ResponsiveImage = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
337
|
-
index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
338
|
-
|
|
339
|
-
const vviinnProductCardCss = ":host{align-items:center;display:flex;flex-direction:column;gap:8px;height:100%}.price-container{display:flex;flex-direction:column}.price-sale,.price-regular{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#161616}.price-outdated{font-style:normal;font-weight:normal;font-size:16px;line-height:24px;color:#757575;text-decoration:line-through}.product-type{word-wrap:anywhere}.image{display:grid;align-content:center;-o-object-position:50% 50%;object-position:50% 50%;-o-object-fit:contain;object-fit:contain;text-align:center;box-sizing:border-box}img.responsive{width:100%;height:auto;aspect-ratio:1}.brand,.type{display:none}.title{-webkit-box-orient:vertical;-webkit-line-clamp:2;color:#161616;display:-webkit-box;font-size:16px;font-style:normal;font-weight:500;line-height:24px;margin-bottom:8px;overflow:hidden}.deeplink{text-decoration:none}.image-link{display:contents}picture{position:relative;width:100%}:host(.dimmed) picture::before{content:\"\";width:100%;height:100%;box-sizing:border-box;background:#f7f7f7;display:block;top:0;left:0;position:absolute;mix-blend-mode:multiply}";
|
|
340
|
-
|
|
341
|
-
let VviinnProductCard = class {
|
|
342
|
-
constructor(hostRef) {
|
|
343
|
-
index.registerInstance(this, hostRef);
|
|
344
|
-
this.vviinnProductLoad = index.createEvent(this, "vviinnProductLoad", 7);
|
|
345
|
-
this.vviinnProductView = index.createEvent(this, "vviinnProductView", 7);
|
|
346
|
-
this.vviinnProductClick = index.createEvent(this, "vviinnProductClick", 7);
|
|
347
|
-
this.currency = undefined;
|
|
348
|
-
this.imageRatio = 1;
|
|
349
|
-
this.imageWidth = 200;
|
|
350
|
-
this.locale = undefined;
|
|
351
|
-
this.pricePrefix = undefined;
|
|
352
|
-
this.responsive = false;
|
|
353
|
-
this.dimmedBackground = false;
|
|
354
|
-
/** @internal */
|
|
355
|
-
this.index = 0;
|
|
356
|
-
this.imageLoaded = false;
|
|
357
|
-
this.productData = null;
|
|
358
|
-
this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
|
|
359
|
-
}
|
|
360
|
-
connectedCallback() {
|
|
361
|
-
this.productData = this.getProductData();
|
|
362
|
-
}
|
|
363
|
-
getWidgetType() {
|
|
364
|
-
return this.campaignTypeId === "VPR" || this.campaignTypeId === "VCS"
|
|
365
|
-
? "VPR"
|
|
366
|
-
: "VPS";
|
|
367
|
-
}
|
|
368
|
-
getProductData() {
|
|
369
|
-
var _a;
|
|
370
|
-
return {
|
|
371
|
-
productId: this.productId,
|
|
372
|
-
productRank: this.index,
|
|
373
|
-
productName: this.productTitle,
|
|
374
|
-
widgetType: this.getWidgetType(),
|
|
375
|
-
campaignTypeId: this.campaignTypeId,
|
|
376
|
-
campaignTypeName: Campaign.campaignTypeNames[this.campaignTypeId],
|
|
377
|
-
widgetId: (_a = this.buttonElementId) !== null && _a !== void 0 ? _a : this.widgetElementId,
|
|
378
|
-
};
|
|
379
|
-
}
|
|
380
|
-
intersectionCallback(data) {
|
|
381
|
-
if (data.some((entry) => entry.isIntersecting)) {
|
|
382
|
-
imageSearch_store._function.pipe(getAnalyticsModule, imageSearch_store.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
|
|
383
|
-
this.vviinnProductView.emit(this.productData);
|
|
384
|
-
this.intersectionObserver.disconnect();
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
componentDidLoad() {
|
|
388
|
-
this.vviinnProductLoad.emit(this.productData);
|
|
389
|
-
this.intersectionObserver.observe(this.el);
|
|
390
|
-
const links = this.el.shadowRoot.querySelectorAll("a");
|
|
391
|
-
links.forEach((link) => link.addEventListener("click", (event) => {
|
|
392
|
-
event.preventDefault();
|
|
393
|
-
event.stopImmediatePropagation();
|
|
394
|
-
this.vviinnProductClick.emit(this.productData);
|
|
395
|
-
imageSearch_store._function.pipe(getAnalyticsModule, imageSearch_store.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
|
|
396
|
-
}));
|
|
397
|
-
}
|
|
398
|
-
getProduct() {
|
|
399
|
-
return imageSearch_store.imageSearchState.results.find((r) => r.productId === this.productId);
|
|
400
|
-
}
|
|
401
|
-
renderImage() {
|
|
402
|
-
const props = {
|
|
403
|
-
width: this.imageWidth,
|
|
404
|
-
height: this.imageWidth * this.imageRatio,
|
|
405
|
-
src: this.image,
|
|
406
|
-
title: this.productTitle,
|
|
407
|
-
lazy: false,
|
|
408
|
-
};
|
|
409
|
-
return this.responsive ? ResponsiveImage(props) : Image(props);
|
|
410
|
-
}
|
|
411
|
-
render() {
|
|
412
|
-
var _a, _b, _c;
|
|
413
|
-
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 : imageSearch_store.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : imageSearch_store.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : imageSearch_store.state.locale })));
|
|
414
|
-
}
|
|
415
|
-
get el() { return index.getElement(this); }
|
|
416
|
-
};
|
|
417
|
-
VviinnProductCard.style = vviinnProductCardCss;
|
|
418
|
-
|
|
419
306
|
const createBearerString = (x) => `Bearer ${x}`;
|
|
420
307
|
const createAuthedHeader = (x) => new Headers({
|
|
421
308
|
Authorization: x,
|
|
@@ -425,22 +312,22 @@ const createFetchAuthOptions = (x) => {
|
|
|
425
312
|
headers: x,
|
|
426
313
|
};
|
|
427
314
|
};
|
|
428
|
-
const createBearAuthedHeader =
|
|
315
|
+
const createBearAuthedHeader = index._function.flow(createBearerString, createAuthedHeader, createFetchAuthOptions);
|
|
429
316
|
|
|
430
|
-
const sequenceToEither =
|
|
431
|
-
const apiGet = (path, data = {}) =>
|
|
317
|
+
const sequenceToEither = sequenceT(index.Apply);
|
|
318
|
+
const apiGet = (path, data = {}) => index.pipe(sequenceToEither(index.getApiPath(), index.createInitGetRequest), index.fromEither, index.chainW(index.makeRequest(path, data)));
|
|
432
319
|
|
|
433
320
|
const getVPRRecommendations = (productId) => (color) => (campaigns) => (options) => {
|
|
434
|
-
const url =
|
|
321
|
+
const url = index._function.pipe(campaigns, index.map(encodeURIComponent), index.match$1(() => `product/${productId}/similar-products${color ? `?color=${color}` : ""}`, (encodedCampaignsIds) => `product/${productId}/similar-products?campaigns=${encodedCampaignsIds}${color ? `&color=${color}` : ""}`));
|
|
435
322
|
return apiGet(url, options);
|
|
436
323
|
};
|
|
437
324
|
|
|
438
325
|
const getVCSRecommendations = (productId) => (color) => (campaigns) => (options) => {
|
|
439
|
-
const url =
|
|
326
|
+
const url = index._function.pipe(campaigns, index.map(encodeURIComponent), index.match$1(() => `product/${productId}/cross-selling-products${color ? `?color=${color}` : ""}`, (encodedCampaignsIds) => `product/${productId}/cross-selling-products?campaigns=${encodedCampaignsIds}${color ? `&color=${color}` : ""}`));
|
|
440
327
|
return apiGet(url, options);
|
|
441
328
|
};
|
|
442
329
|
|
|
443
|
-
const getRecommendationsService = (campaignType) =>
|
|
330
|
+
const getRecommendationsService = (campaignType) => index._function.pipe(Campaign.fromString(campaignType), Campaign.fold(() => getVPRRecommendations, () => getVCSRecommendations));
|
|
444
331
|
|
|
445
332
|
function isFunction(value) {
|
|
446
333
|
return typeof value === 'function';
|
|
@@ -769,7 +656,7 @@ class SafeSubscriber extends Subscriber {
|
|
|
769
656
|
let partialObserver;
|
|
770
657
|
if (isFunction(observerOrNext) || !observerOrNext) {
|
|
771
658
|
partialObserver = {
|
|
772
|
-
next: observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined,
|
|
659
|
+
next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
|
|
773
660
|
error: error !== null && error !== void 0 ? error : undefined,
|
|
774
661
|
complete: complete !== null && complete !== void 0 ? complete : undefined,
|
|
775
662
|
};
|
|
@@ -1064,50 +951,44 @@ var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
|
1064
951
|
}
|
|
1065
952
|
return t;
|
|
1066
953
|
};
|
|
1067
|
-
|
|
954
|
+
const VviinnVprWidget = class {
|
|
1068
955
|
constructor(hostRef) {
|
|
1069
|
-
index.registerInstance(this, hostRef);
|
|
1070
|
-
this.vviinnWidgetLoad = index.createEvent(this, "vviinnWidgetLoad", 7);
|
|
1071
|
-
this.vviinnProductClick = index.createEvent(this, "vviinnProductClick", 7);
|
|
1072
|
-
this.vviinnProductView = index.createEvent(this, "vviinnProductView", 7);
|
|
1073
|
-
this.vviinnProductLoad = index.createEvent(this, "vviinnProductLoad", 7);
|
|
1074
|
-
this.vviinnNoResult = index.createEvent(this, "vviinnNoResult", 7);
|
|
1075
|
-
this.vviinnRecommendationsLoaded = index.createEvent(this, "vviinnRecommendationsLoaded", 7);
|
|
1076
|
-
|
|
956
|
+
index$1.registerInstance(this, hostRef);
|
|
957
|
+
this.vviinnWidgetLoad = index$1.createEvent(this, "vviinnWidgetLoad", 7);
|
|
958
|
+
this.vviinnProductClick = index$1.createEvent(this, "vviinnProductClick", 7);
|
|
959
|
+
this.vviinnProductView = index$1.createEvent(this, "vviinnProductView", 7);
|
|
960
|
+
this.vviinnProductLoad = index$1.createEvent(this, "vviinnProductLoad", 7);
|
|
961
|
+
this.vviinnNoResult = index$1.createEvent(this, "vviinnNoResult", 7);
|
|
962
|
+
this.vviinnRecommendationsLoaded = index$1.createEvent(this, "vviinnRecommendationsLoaded", 7);
|
|
963
|
+
this.productImageLoadedSubject = new Subject();
|
|
964
|
+
this.setTrackingDeactivated = (result) => {
|
|
965
|
+
if (result.status === "rejected") {
|
|
966
|
+
this.trackingDeactivated = true;
|
|
967
|
+
}
|
|
968
|
+
};
|
|
1077
969
|
this.blockTitle = "Recommended products";
|
|
1078
|
-
/** Ratio of each recommended product image */
|
|
1079
970
|
this.imageRatio = 1;
|
|
1080
|
-
/** Width of each recommended product image */
|
|
1081
971
|
this.imageWidth = 300;
|
|
1082
|
-
|
|
972
|
+
this.productId = undefined;
|
|
973
|
+
this.token = undefined;
|
|
1083
974
|
this.currencySign = "€";
|
|
1084
|
-
|
|
975
|
+
this.pricePrefix = undefined;
|
|
1085
976
|
this.mode = "continuity";
|
|
1086
|
-
/** Campaign type */
|
|
1087
977
|
this.campaignType = "VPR";
|
|
1088
|
-
/** Locale for currency formatting */
|
|
1089
978
|
this.locale = "de-DE";
|
|
1090
|
-
/** comma-separated list of campaign-ids */
|
|
1091
979
|
this.campaigns = "";
|
|
1092
|
-
|
|
980
|
+
this.color = undefined;
|
|
1093
981
|
this.gridArrowsDynamic = false;
|
|
1094
|
-
|
|
982
|
+
this.noResultText = undefined;
|
|
1095
983
|
this.noResultShow = true;
|
|
1096
|
-
/** @internal */
|
|
1097
984
|
this.apiPath = "https://api.vviinn.com";
|
|
1098
|
-
/** @internal */
|
|
1099
985
|
this.useCarousel = true;
|
|
1100
986
|
this.showScroll = true;
|
|
1101
987
|
this.cssUrl = null;
|
|
988
|
+
this.buttonElementId = undefined;
|
|
1102
989
|
this.recommendations = [];
|
|
1103
990
|
this.trackingDeactivated = false;
|
|
1104
991
|
this.hasErrorOnLoad = false;
|
|
1105
|
-
this.productImageLoadedSubject = new Subject();
|
|
1106
|
-
this.setTrackingDeactivated = (result) => {
|
|
1107
|
-
if (result.status === "rejected") {
|
|
1108
|
-
this.trackingDeactivated = true;
|
|
1109
|
-
}
|
|
1110
|
-
};
|
|
1111
992
|
}
|
|
1112
993
|
getEventData() {
|
|
1113
994
|
return {
|
|
@@ -1127,7 +1008,7 @@ let VviinnVprWidget = class {
|
|
|
1127
1008
|
this.getRecommendations();
|
|
1128
1009
|
}
|
|
1129
1010
|
handleApiPathChange(newPath) {
|
|
1130
|
-
|
|
1011
|
+
index.state.apiPath = newPath;
|
|
1131
1012
|
this.getRecommendations();
|
|
1132
1013
|
}
|
|
1133
1014
|
handleProductLoading({ detail }) {
|
|
@@ -1137,14 +1018,14 @@ let VviinnVprWidget = class {
|
|
|
1137
1018
|
if (this.trackingDeactivated)
|
|
1138
1019
|
return;
|
|
1139
1020
|
const { productRank, productId, productName, widgetType, widgetId, campaignTypeId, campaignTypeName } = detail, rest = __rest(detail, ["productRank", "productId", "productName", "widgetType", "widgetId", "campaignTypeId", "campaignTypeName"]);
|
|
1140
|
-
const productViewEvent = index
|
|
1021
|
+
const productViewEvent = index.createProductViewVprEvent(Object.assign({ session_id: this.uiSessionId, rank: productRank, product: productId }, rest));
|
|
1141
1022
|
this.trackingApi
|
|
1142
1023
|
.trackEvent(productViewEvent)
|
|
1143
1024
|
.then(this.setTrackingDeactivated);
|
|
1144
1025
|
}
|
|
1145
1026
|
async trackProductClick({ detail }) {
|
|
1146
1027
|
const { productRank, productId, productName, widgetType, widgetId, campaignTypeId, campaignTypeName } = detail, rest = __rest(detail, ["productRank", "productId", "productName", "widgetType", "widgetId", "campaignTypeId", "campaignTypeName"]);
|
|
1147
|
-
const productClickEvent = index
|
|
1028
|
+
const productClickEvent = index.createProductClickVprEvent(Object.assign({ session_id: this.uiSessionId, rank: productRank, product: productId }, rest));
|
|
1148
1029
|
if (!this.trackingDeactivated) {
|
|
1149
1030
|
await this.trackingApi
|
|
1150
1031
|
.trackEvent(productClickEvent)
|
|
@@ -1157,15 +1038,15 @@ let VviinnVprWidget = class {
|
|
|
1157
1038
|
}
|
|
1158
1039
|
connectedCallback() {
|
|
1159
1040
|
var _a;
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1041
|
+
index.state.apiPath = this.apiPath;
|
|
1042
|
+
index.state.currencySign = this.currencySign;
|
|
1043
|
+
index.state.locale = this.locale;
|
|
1163
1044
|
this.id = (_a = this.buttonElementId) !== null && _a !== void 0 ? _a : this.el.id;
|
|
1164
|
-
this.uiSessionId = index
|
|
1165
|
-
this.trackingApi = index
|
|
1045
|
+
this.uiSessionId = index.v4();
|
|
1046
|
+
this.trackingApi = index.createTrackingApi(this.apiPath, this.token);
|
|
1166
1047
|
if (this.trackingDeactivated)
|
|
1167
1048
|
return;
|
|
1168
|
-
const widgetOpenEvent = index
|
|
1049
|
+
const widgetOpenEvent = index.createWidgetVprEvent({
|
|
1169
1050
|
action: "open",
|
|
1170
1051
|
session_id: this.uiSessionId,
|
|
1171
1052
|
});
|
|
@@ -1176,7 +1057,7 @@ let VviinnVprWidget = class {
|
|
|
1176
1057
|
disconnectedCallback() {
|
|
1177
1058
|
if (this.trackingDeactivated)
|
|
1178
1059
|
return;
|
|
1179
|
-
const widgetCloseEvent = index
|
|
1060
|
+
const widgetCloseEvent = index.createWidgetVprEvent({
|
|
1180
1061
|
action: "close",
|
|
1181
1062
|
session_id: this.uiSessionId,
|
|
1182
1063
|
});
|
|
@@ -1185,8 +1066,8 @@ let VviinnVprWidget = class {
|
|
|
1185
1066
|
.then(this.setTrackingDeactivated);
|
|
1186
1067
|
}
|
|
1187
1068
|
async componentWillLoad() {
|
|
1188
|
-
|
|
1189
|
-
|
|
1069
|
+
index.state.pricePrefix = this.pricePrefix;
|
|
1070
|
+
index.state.currencySign = this.currencySign;
|
|
1190
1071
|
this.vviinnWidgetLoad.emit(this.getEventData());
|
|
1191
1072
|
this.getRecommendations();
|
|
1192
1073
|
}
|
|
@@ -1195,9 +1076,9 @@ let VviinnVprWidget = class {
|
|
|
1195
1076
|
return;
|
|
1196
1077
|
const campaignType = this.campaignType.length > 0 ? this.campaignType : "VPR";
|
|
1197
1078
|
const headers = createBearAuthedHeader(this.token);
|
|
1198
|
-
const request =
|
|
1079
|
+
const request = index._function.pipe(index.TaskEither.of(getRecommendationsService(campaignType)), index.TaskEither.ap(index.TaskEither.of(this.productId)), index.TaskEither.ap(index.TaskEither.of(this.color)), index.TaskEither.ap(index.TaskEither.of(index.checkEmpryString(this.campaigns))), index.TaskEither.ap(index.TaskEither.of(headers)), index.TaskEither.flatten);
|
|
1199
1080
|
const runRequest = await request();
|
|
1200
|
-
|
|
1081
|
+
index._function.pipe(runRequest, index.Either.fold((error) => {
|
|
1201
1082
|
this.handleError(error);
|
|
1202
1083
|
this.vviinnNoResult.emit(this.getEventData());
|
|
1203
1084
|
this.vviinnRecommendationsLoaded.emit();
|
|
@@ -1209,7 +1090,7 @@ let VviinnVprWidget = class {
|
|
|
1209
1090
|
handleRecommendationsSuccess(data) {
|
|
1210
1091
|
var _a;
|
|
1211
1092
|
this.recommendations = (_a = data === null || data === void 0 ? void 0 : data.extended) !== null && _a !== void 0 ? _a : data;
|
|
1212
|
-
|
|
1093
|
+
index.imageSearchState.results = this.recommendations;
|
|
1213
1094
|
this.productIds = this.recommendations.map((r) => r.productId);
|
|
1214
1095
|
this.productImageLoadedSubject.subscribe((id) => {
|
|
1215
1096
|
this.productIds = this.productIds.filter((x) => x !== id);
|
|
@@ -1222,32 +1103,32 @@ let VviinnVprWidget = class {
|
|
|
1222
1103
|
return this.cssUrl && this.cssUrl.length > 0;
|
|
1223
1104
|
}
|
|
1224
1105
|
renderExternalCSS() {
|
|
1225
|
-
return this.isExternalCSS() ? (index.h("link", { href: this.cssUrl, rel: "stylesheet" })) : ("");
|
|
1106
|
+
return this.isExternalCSS() ? (index$1.h("link", { href: this.cssUrl, rel: "stylesheet" })) : ("");
|
|
1226
1107
|
}
|
|
1227
1108
|
render() {
|
|
1228
1109
|
var _a;
|
|
1229
1110
|
if (this.recommendations.length === 0 && this.noResultShow === false)
|
|
1230
1111
|
return null;
|
|
1231
|
-
return (index.h(index.Host, { class: {
|
|
1112
|
+
return (index$1.h(index$1.Host, { class: {
|
|
1232
1113
|
loaded: true,
|
|
1233
1114
|
empty: this.recommendations.length == 0,
|
|
1234
1115
|
[this.mode]: true,
|
|
1235
|
-
}, "aria-hidden": "false" }, index.h(index.Fragment, null, this.renderExternalCSS(), index.h("style", null,
|
|
1236
|
-
(this.useCarousel ? this.renderCarousel() : this.renderResults()), this.recommendations.length === 0 && this.hasErrorOnLoad && (index.h("p", { class: "no-result-text" }, `${(_a = this === null || this === void 0 ? void 0 : this.noResultText) !== null && _a !== void 0 ? _a : "No results! Please, try again later."}`)))));
|
|
1116
|
+
}, "aria-hidden": "false" }, index$1.h(index$1.Fragment, null, this.renderExternalCSS(), index$1.h("style", null, index.state.fallbackStyles), index$1.h("h2", { part: "recommendations-title" }, this.blockTitle), this.recommendations.length > 0 &&
|
|
1117
|
+
(this.useCarousel ? this.renderCarousel() : this.renderResults()), this.recommendations.length === 0 && this.hasErrorOnLoad && (index$1.h("p", { class: "no-result-text" }, `${(_a = this === null || this === void 0 ? void 0 : this.noResultText) !== null && _a !== void 0 ? _a : "No results! Please, try again later."}`)))));
|
|
1237
1118
|
}
|
|
1238
|
-
renderRecommendation(recommendation, index
|
|
1239
|
-
return (index.h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.useDimmedBackgroundInCard(), campaignTypeId: this.campaignType, index: index
|
|
1119
|
+
renderRecommendation(recommendation, index) {
|
|
1120
|
+
return (index$1.h("vviinn-product-card", { part: "product-part", productId: recommendation.productId, productTitle: recommendation.title, deeplink: recommendation.deeplink, image: recommendation.image.thumbnail, brand: recommendation.brand, imageWidth: this.imageWidth, imageRatio: 1, price: recommendation.price.actual, salePrice: recommendation.price.sale, responsive: this.mode === "grid", dimmedBackground: this.useDimmedBackgroundInCard(), campaignTypeId: this.campaignType, index: index, widgetElementId: this.id }));
|
|
1240
1121
|
}
|
|
1241
1122
|
useDimmedBackgroundInCard() {
|
|
1242
1123
|
return this.mode === "continuity" || !this.useCarousel;
|
|
1243
1124
|
}
|
|
1244
1125
|
renderResults() {
|
|
1245
|
-
return (index.h("div", { class: "recommendations-grid", part: "recommendations-grid" }, this.recommendations.map((r, i) => this.renderRecommendation(r, i))));
|
|
1126
|
+
return (index$1.h("div", { class: "recommendations-grid", part: "recommendations-grid" }, this.recommendations.map((r, i) => this.renderRecommendation(r, i))));
|
|
1246
1127
|
}
|
|
1247
1128
|
renderCarousel() {
|
|
1248
|
-
return (index.h("vviinn-carousel", { mode: this.mode, campaignTypeId: this.campaignType, imageWidth: this.imageWidth, showScroll: this.showScroll, recommendations: this.recommendations, widgetElementId: this.id, gridArrowsDynamic: this.gridArrowsDynamic }));
|
|
1129
|
+
return (index$1.h("vviinn-carousel", { mode: this.mode, campaignTypeId: this.campaignType, imageWidth: this.imageWidth, showScroll: this.showScroll, recommendations: this.recommendations, widgetElementId: this.id, gridArrowsDynamic: this.gridArrowsDynamic }));
|
|
1249
1130
|
}
|
|
1250
|
-
get el() { return index.getElement(this); }
|
|
1131
|
+
get el() { return index$1.getElement(this); }
|
|
1251
1132
|
static get watchers() { return {
|
|
1252
1133
|
"productId": ["handleProductIdChange"],
|
|
1253
1134
|
"campaignType": ["handleCampaignTypeChange"],
|
|
@@ -1258,5 +1139,4 @@ let VviinnVprWidget = class {
|
|
|
1258
1139
|
VviinnVprWidget.style = vviinnVprWidgetCss;
|
|
1259
1140
|
|
|
1260
1141
|
exports.vviinn_carousel = VviinnCarousel;
|
|
1261
|
-
exports.vviinn_product_card = VviinnProductCard;
|
|
1262
1142
|
exports.vviinn_vpr_widget = VviinnVprWidget;
|