vviinn-widgets 2.15.2 → 2.16.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/{highlight-box_22.cjs.entry.js → cropper-handler_27.cjs.entry.js} +510 -89
- package/dist/cjs/{imageSearch.store-8987ae77.js → index-4ea3a37f.js} +14723 -11183
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/vviinn-button.cjs.entry.js +21 -0
- package/dist/cjs/{vviinn-button_6.cjs.entry.js → vviinn-carousel_2.cjs.entry.js} +27 -332
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +67 -0
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +54 -0
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +1 -1
- package/dist/cjs/vviinn-widgets.cjs.js +1 -1
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +1 -1
- package/dist/collection/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.js +2 -21
- package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +4 -4
- package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.css +3 -2
- package/dist/collection/components/vviinn-overlayed-modal/vviinn-overlayed-modal.css +1 -0
- package/dist/collection/components/vviinn-slider/vviinn-slider.css +5 -4
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +1 -1
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +1 -1
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +1 -1
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +7 -8
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +1 -1
- package/dist/esm/{highlight-box_22.entry.js → cropper-handler_27.entry.js} +441 -25
- package/dist/esm/{imageSearch.store-7be7e733.js → index-492f97b7.js} +14983 -11455
- package/dist/esm/{index-6f22c68e.js → index-84a46578.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/vviinn-button.entry.js +17 -0
- package/dist/esm/{vviinn-button_6.entry.js → vviinn-carousel_2.entry.js} +4 -305
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +63 -0
- package/dist/esm/vviinn-vpr-button.entry.js +50 -0
- package/dist/esm/vviinn-vps-button.entry.js +2 -2
- package/dist/esm/vviinn-widgets.js +1 -1
- package/dist/types/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.d.ts +0 -1
- package/dist/types/components.d.ts +0 -2
- package/dist/vviinn-widgets/p-18bb4ada.entry.js +1 -0
- package/dist/vviinn-widgets/p-249af9d5.entry.js +1 -0
- package/dist/vviinn-widgets/p-2573d0c3.js +1 -0
- package/dist/vviinn-widgets/p-3e92671c.entry.js +1 -0
- package/dist/vviinn-widgets/{p-b1a3c4c6.js → p-90742d1c.js} +1 -1
- package/dist/vviinn-widgets/p-99a98699.entry.js +1 -0
- package/dist/vviinn-widgets/p-af5be84d.entry.js +1 -0
- package/dist/vviinn-widgets/{p-570623b1.entry.js → p-d57f4a28.entry.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/p-001a9e47.js +1 -0
- package/www/build/p-18bb4ada.entry.js +1 -0
- package/www/build/p-249af9d5.entry.js +1 -0
- package/www/build/p-2573d0c3.js +1 -0
- package/www/build/p-3e92671c.entry.js +1 -0
- package/www/build/{p-b1a3c4c6.js → p-90742d1c.js} +1 -1
- package/www/build/p-99a98699.entry.js +1 -0
- package/www/build/p-a67898be.css +1 -0
- package/www/build/p-af5be84d.entry.js +1 -0
- package/www/build/{p-570623b1.entry.js → p-d57f4a28.entry.js} +1 -1
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +1 -60
- package/dist/cjs/Handler-176539c8.js +0 -331
- package/dist/cjs/cropper-handler.cjs.entry.js +0 -27
- package/dist/cjs/index-cf5f9c72.js +0 -3235
- 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-widget.cjs.entry.js +0 -200
- package/dist/esm/Handler-f9b8735c.js +0 -309
- package/dist/esm/cropper-handler.entry.js +0 -23
- package/dist/esm/index-18ec919d.js +0 -3224
- package/dist/esm/vviinn-error.entry.js +0 -15
- package/dist/esm/vviinn-preloader.entry.js +0 -22
- package/dist/esm/vviinn-vps-widget.entry.js +0 -196
- package/dist/vviinn-widgets/p-0f37e35e.js +0 -1
- package/dist/vviinn-widgets/p-11f61564.js +0 -1
- package/dist/vviinn-widgets/p-28d20956.entry.js +0 -1
- package/dist/vviinn-widgets/p-40f67f35.entry.js +0 -1
- package/dist/vviinn-widgets/p-88d472cc.entry.js +0 -1
- package/dist/vviinn-widgets/p-c59a3856.entry.js +0 -1
- package/dist/vviinn-widgets/p-d3e45b13.entry.js +0 -1
- package/dist/vviinn-widgets/p-d8a8cca5.entry.js +0 -1
- package/dist/vviinn-widgets/p-fb95aa1e.js +0 -1
- package/www/build/p-0f37e35e.js +0 -1
- package/www/build/p-11f61564.js +0 -1
- package/www/build/p-28d20956.entry.js +0 -1
- package/www/build/p-40f67f35.entry.js +0 -1
- package/www/build/p-88d472cc.entry.js +0 -1
- package/www/build/p-951b98b6.js +0 -125
- package/www/build/p-c59a3856.entry.js +0 -1
- package/www/build/p-d3e45b13.entry.js +0 -1
- package/www/build/p-d8a8cca5.entry.js +0 -1
- package/www/build/p-e0153ae2.css +0 -6
- package/www/build/p-fb95aa1e.js +0 -1
|
@@ -3,11 +3,44 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-1077e27c.js');
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const index$1 = require('./index-b2b8f092.js');
|
|
6
|
+
const index$1 = require('./index-4ea3a37f.js');
|
|
7
|
+
const index$2 = require('./index-b2b8f092.js');
|
|
9
8
|
const customizedSlots = require('./customized-slots-84e1c444.js');
|
|
10
9
|
|
|
10
|
+
const cropperHandlerCss = ":host{--size:20px;background:transparent;border:4px solid white;box-sizing:content-box;display:block;height:var(--size);touch-action:none;position:absolute;width:var(--size);z-index:4;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.disabled){opacity:0.25}:host(.nw-resize){border-bottom:none;border-right:none;top:0;left:0}:host(.ne-resize){border-left:none;border-bottom:none;right:0;top:0}:host(.sw-resize){border-right:none;border-top:none;left:0;bottom:0}:host(.se-resize){border-left:none;border-top:none;bottom:0;right:0}";
|
|
11
|
+
|
|
12
|
+
let CropperHandler = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return (index.h(index.Host, { part: `handle ${index$1.getCursorValue(this.handler.direction)}`, class: {
|
|
19
|
+
disabled: this.disabled,
|
|
20
|
+
[index$1.getCursorValue(this.handler.direction)]: true,
|
|
21
|
+
}, style: {
|
|
22
|
+
"--size": "20px",
|
|
23
|
+
cursor: index$1.getCursorValue(this.handler.direction),
|
|
24
|
+
}, draggable: false }));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
CropperHandler.style = cropperHandlerCss;
|
|
28
|
+
|
|
29
|
+
const fromRectangle = (shape, target) => {
|
|
30
|
+
const top = `${shape.y}px`;
|
|
31
|
+
const left = `${shape.x}px`;
|
|
32
|
+
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
33
|
+
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
34
|
+
return {
|
|
35
|
+
top,
|
|
36
|
+
right,
|
|
37
|
+
bottom,
|
|
38
|
+
left,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
42
|
+
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
43
|
+
|
|
11
44
|
// -------------------------------------------------------------------------------------
|
|
12
45
|
// -------------------------------------------------------------------------------------
|
|
13
46
|
// instances
|
|
@@ -28,21 +61,6 @@ var Ord = {
|
|
|
28
61
|
compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
|
|
29
62
|
};
|
|
30
63
|
|
|
31
|
-
const fromRectangle = (shape, target) => {
|
|
32
|
-
const top = `${shape.y}px`;
|
|
33
|
-
const left = `${shape.x}px`;
|
|
34
|
-
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
35
|
-
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
36
|
-
return {
|
|
37
|
-
top,
|
|
38
|
-
right,
|
|
39
|
-
bottom,
|
|
40
|
-
left,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
44
|
-
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
45
|
-
|
|
46
64
|
const highlightBoxCss = ":host{display:grid;position:absolute;box-sizing:border-box;border:none;width:100%;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;--size:10px;--x-position:0;--y-position:0}img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pointer{position:absolute;width:var(--size);height:var(--size);background:black;border-radius:50%;z-index:2;cursor:pointer;transform:translate(var(--x-position), var(--y-position)) scale(0);-webkit-animation:0.25s linear fadein;animation:0.25s linear fadein;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.pointer::after{content:\"\";cursor:pointer;border:5px solid black;border-radius:50%;width:var(--size);height:var(--size);display:block;transform:translate(calc(-50% + var(--size) * 0.5), calc(-50% + var(--size) * 0.5));padding:calc(var(--size) * 0.5);opacity:.75}@-webkit-keyframes fadein{from{transform:translate(var(--x-position), var(--y-position)) scale(0)}to{transform:translate(var(--x-position), var(--y-position)) scale(1)}}@keyframes fadein{from{transform:translate(var(--x-position), var(--y-position)) scale(0)}to{transform:translate(var(--x-position), var(--y-position)) scale(1)}}";
|
|
47
65
|
|
|
48
66
|
let HighlightBox = class {
|
|
@@ -50,10 +68,10 @@ let HighlightBox = class {
|
|
|
50
68
|
index.registerInstance(this, hostRef);
|
|
51
69
|
}
|
|
52
70
|
getInsetValue() {
|
|
53
|
-
return
|
|
71
|
+
return index$1.pipe(index$1.sequenceToOption(index$1.imageSearchState.searchArea, index$1.imageSearchState.imageBounds), index$1.Option.map(([selection, image]) => getClipValue(selection, image)), index$1.Option.getOrElse(() => ""));
|
|
54
72
|
}
|
|
55
73
|
renderImage() {
|
|
56
|
-
return
|
|
74
|
+
return index$1.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.imageBounds), index$1.Option.map(([url, bounds]) => (index.h("img", { src: url, width: bounds.width, height: bounds.height, style: { "clip-path": `${this.getInsetValue()}` } }))), index$1.Option.getOrElse(() => ""));
|
|
57
75
|
}
|
|
58
76
|
render() {
|
|
59
77
|
return index.h(index.Host, null, this.renderImage());
|
|
@@ -89,19 +107,19 @@ let ImageCropper = class {
|
|
|
89
107
|
handleHandlerMove(event) {
|
|
90
108
|
event.preventDefault();
|
|
91
109
|
event.stopPropagation();
|
|
92
|
-
const destination =
|
|
93
|
-
const distance =
|
|
110
|
+
const destination = index$1.fromMouseEvent(event);
|
|
111
|
+
const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
94
112
|
const transformedHandler = {
|
|
95
113
|
position: distance,
|
|
96
114
|
direction: this.handlerMoveDirection,
|
|
97
115
|
};
|
|
98
|
-
|
|
99
|
-
const newSearchArea =
|
|
116
|
+
index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((area) => {
|
|
117
|
+
const newSearchArea = index$1.transform(area, transformedHandler);
|
|
100
118
|
if (this.outOfBounds(newSearchArea))
|
|
101
119
|
return;
|
|
102
|
-
|
|
120
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
|
|
103
121
|
this.mouseStartPoint = destination;
|
|
104
|
-
|
|
122
|
+
index$1.imageSearchState.detectedObject = undefined;
|
|
105
123
|
}));
|
|
106
124
|
}
|
|
107
125
|
outOfBounds(area) {
|
|
@@ -115,23 +133,23 @@ let ImageCropper = class {
|
|
|
115
133
|
handleCropperMove(ev) {
|
|
116
134
|
ev.preventDefault();
|
|
117
135
|
ev.stopPropagation();
|
|
118
|
-
const destination =
|
|
119
|
-
const distance =
|
|
120
|
-
|
|
121
|
-
const newSearchArea =
|
|
136
|
+
const destination = index$1.fromMouseEvent(ev);
|
|
137
|
+
const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
138
|
+
index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((searchArea) => {
|
|
139
|
+
const newSearchArea = index$1.move(searchArea, distance);
|
|
122
140
|
if (newSearchArea.x < 0 ||
|
|
123
141
|
newSearchArea.y < 0 ||
|
|
124
142
|
this.bounds.height - (newSearchArea.y + newSearchArea.height) < 0 ||
|
|
125
143
|
this.bounds.width - (newSearchArea.x + newSearchArea.width) < 0)
|
|
126
144
|
return;
|
|
127
|
-
|
|
128
|
-
|
|
145
|
+
index$1.imageSearchState.detectedObject = undefined;
|
|
146
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
|
|
129
147
|
this.mouseStartPoint = destination;
|
|
130
148
|
}));
|
|
131
149
|
}
|
|
132
150
|
handlePointerDown(event) {
|
|
133
151
|
event.stopPropagation();
|
|
134
|
-
this.mouseStartPoint =
|
|
152
|
+
this.mouseStartPoint = index$1.fromMouseEvent(event);
|
|
135
153
|
// should be htmlelement or handler
|
|
136
154
|
const target = findTarget(event);
|
|
137
155
|
if (target.localName === "cropper-handler") {
|
|
@@ -151,18 +169,18 @@ let ImageCropper = class {
|
|
|
151
169
|
this.el.removeEventListener("pointermove", this.pointerMoveListener);
|
|
152
170
|
document.removeEventListener("pointerup", this.pointerReleaseListener);
|
|
153
171
|
this.mouseStartPoint = undefined;
|
|
154
|
-
|
|
172
|
+
index$1.makeRectangularSearchRequest();
|
|
155
173
|
this.cropperChanged.emit();
|
|
156
174
|
}
|
|
157
175
|
getStyleMap() {
|
|
158
|
-
return
|
|
176
|
+
return index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((rectangle) => {
|
|
159
177
|
return {
|
|
160
178
|
width: `${rectangle.width}px`,
|
|
161
179
|
height: `${rectangle.height}px`,
|
|
162
180
|
transform: `translate3d(${rectangle.x}px, ${rectangle.y}px, 0)`,
|
|
163
181
|
cursor: this.handleMove ? "move" : "default",
|
|
164
182
|
};
|
|
165
|
-
}),
|
|
183
|
+
}), index$1.Option.getOrElse(() => {
|
|
166
184
|
return {};
|
|
167
185
|
}));
|
|
168
186
|
}
|
|
@@ -171,7 +189,7 @@ let ImageCropper = class {
|
|
|
171
189
|
"crop-area": true,
|
|
172
190
|
active: this.handleMove,
|
|
173
191
|
disabled: this.disabled,
|
|
174
|
-
}, draggable: false, style: this.getStyleMap(), onContextMenu: () => false, onPointerDown: (ev) => this.handlePointerDown(ev) },
|
|
192
|
+
}, draggable: false, style: this.getStyleMap(), onContextMenu: () => false, onPointerDown: (ev) => this.handlePointerDown(ev) }, index$1.imageSearchState.cropperHandlers.map((handler) => (index.h("cropper-handler", { disabled: this.disabled, handler: handler, onPointerDown: (ev) => this.handlePointerDown(ev) }))))));
|
|
175
193
|
}
|
|
176
194
|
get el() { return index.getElement(this); }
|
|
177
195
|
};
|
|
@@ -197,12 +215,12 @@ let SearchFilters = class {
|
|
|
197
215
|
}
|
|
198
216
|
selectFilter(filter) {
|
|
199
217
|
this.selectedCategoryId = getFilterId(filter);
|
|
200
|
-
|
|
218
|
+
index$1.imageSearchState.activeIonLink = filter;
|
|
201
219
|
this.filterSelected.emit("select");
|
|
202
220
|
}
|
|
203
221
|
clearSelectedFilter() {
|
|
204
222
|
this.selectedCategoryId = null;
|
|
205
|
-
|
|
223
|
+
index$1.imageSearchState.activeIonLink = undefined;
|
|
206
224
|
this.findSelectedFilter().blur();
|
|
207
225
|
this.filterSelected.emit("deselect");
|
|
208
226
|
}
|
|
@@ -229,7 +247,7 @@ let SearchFilters = class {
|
|
|
229
247
|
}, style: { "animation-delay": `${n * 10}ms` }, onPointerUp: (ev) => {
|
|
230
248
|
ev.stopPropagation();
|
|
231
249
|
this.handleFilterSelection(f);
|
|
232
|
-
}, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$
|
|
250
|
+
}, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$2.CheckIcon, null) : null, f.name))), index.h("div", { class: {
|
|
233
251
|
filter: true,
|
|
234
252
|
"show-more": true,
|
|
235
253
|
hidden: this.filter.filters.length <= FILTERS_COUNT,
|
|
@@ -253,31 +271,31 @@ let VviinnDetectedObject = class {
|
|
|
253
271
|
this.position = ["0", "0"];
|
|
254
272
|
}
|
|
255
273
|
getObjectPosition() {
|
|
256
|
-
return
|
|
257
|
-
const objectRectangle =
|
|
258
|
-
const { x, y } =
|
|
274
|
+
return index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
|
|
275
|
+
const objectRectangle = index$1.fromAlt(index$1.foldValueObject(this.detectedObject).rectangle);
|
|
276
|
+
const { x, y } = index$1._function.pipe(objectRectangle, index$1.scaleWithSized(bounds), index$1.center);
|
|
259
277
|
return [`${x}px`, `${y}px`];
|
|
260
|
-
}),
|
|
278
|
+
}), index$1.Option.getOrElse(() => ["0", "0"]));
|
|
261
279
|
}
|
|
262
280
|
selectDetectedObject() {
|
|
263
|
-
|
|
264
|
-
const rectangle =
|
|
265
|
-
const transformedRect =
|
|
266
|
-
const scaledRect =
|
|
267
|
-
|
|
268
|
-
|
|
281
|
+
index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
|
|
282
|
+
const rectangle = index$1.foldValueObject(this.detectedObject).rectangle;
|
|
283
|
+
const transformedRect = index$1.fromAlt(rectangle);
|
|
284
|
+
const scaledRect = index$1.scaleWithSized(bounds)(transformedRect);
|
|
285
|
+
index$1.imageSearchState.detectedObject = this.detectedObject;
|
|
286
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(scaledRect);
|
|
269
287
|
}));
|
|
270
|
-
|
|
288
|
+
index$1.makeRectangularSearchRequest();
|
|
271
289
|
this.detectedObjectClicked.emit();
|
|
272
290
|
}
|
|
273
291
|
isActive() {
|
|
274
292
|
if (!this.detectedObject)
|
|
275
293
|
return false;
|
|
276
|
-
if (!
|
|
294
|
+
if (!index$1.imageSearchState.detectedObject)
|
|
277
295
|
return false;
|
|
278
|
-
const thisObject =
|
|
279
|
-
const savedObject =
|
|
280
|
-
return
|
|
296
|
+
const thisObject = index$1.foldValueObject(this.detectedObject);
|
|
297
|
+
const savedObject = index$1.foldValueObject(index$1.imageSearchState.detectedObject);
|
|
298
|
+
return index$1.detectedObjectEq.equals(thisObject, savedObject);
|
|
281
299
|
}
|
|
282
300
|
render() {
|
|
283
301
|
return (index.h(index.Host, { class: {
|
|
@@ -303,6 +321,18 @@ let VviinnEmptyResults = class {
|
|
|
303
321
|
};
|
|
304
322
|
VviinnEmptyResults.style = vviinnEmptyResultsCss;
|
|
305
323
|
|
|
324
|
+
const vviinnErrorCss = ":host{background:#F4F4F4;border-radius:8px;display:grid;grid-gap:20px;padding:24px;text-align:center}::slotted(svg){display:grid;align-self:center}::slotted(h4){margin:unset;font-weight:600;font-size:18px;line-height:24px}::slotted(span){font-size:14px;line-height:20px}::slotted(button){-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;background:transparent;color:var(--color-primary, var(--color-primary-system));font-weight:600;font-size:16px;line-height:20px;cursor:pointer}";
|
|
325
|
+
|
|
326
|
+
let VviinnError = class {
|
|
327
|
+
constructor(hostRef) {
|
|
328
|
+
index.registerInstance(this, hostRef);
|
|
329
|
+
}
|
|
330
|
+
render() {
|
|
331
|
+
return (index.h(index.Host, null, index.h("slot", { name: "icon" }), index.h("slot", { name: "title" }), index.h("slot", { name: "text" }), index.h("slot", { name: "action" })));
|
|
332
|
+
}
|
|
333
|
+
};
|
|
334
|
+
VviinnError.style = vviinnErrorCss;
|
|
335
|
+
|
|
306
336
|
const vviinnExampleImageCss = ":host{display:block;margin-bottom:8px;position:relative}:host(:focus){border:2px solid var(--color-primary)}img{width:100%;height:auto;cursor:pointer}.image-preloader{background:rgba(0, 0, 0, 0.25);border-radius:4px;bottom:12px;display:none;padding:4px 6px;position:absolute;right:12px;z-index:4}vviinn-preloader{--preloader-size:12px}@media (max-width: 640px){.image-preloader{display:block}}";
|
|
307
337
|
|
|
308
338
|
let VviinnExampleImage = class {
|
|
@@ -313,14 +343,13 @@ let VviinnExampleImage = class {
|
|
|
313
343
|
this.src = "";
|
|
314
344
|
this.width = 0;
|
|
315
345
|
this.height = 0;
|
|
316
|
-
this.tabIndex = -1;
|
|
317
346
|
this.selected = false;
|
|
318
347
|
}
|
|
319
348
|
async selectImage() {
|
|
320
349
|
this.selected = true;
|
|
321
|
-
const file = await
|
|
322
|
-
const processResult = await
|
|
323
|
-
|
|
350
|
+
const file = await index$1.toFile(this.src);
|
|
351
|
+
const processResult = await index$1.processSelectedFile(file);
|
|
352
|
+
index$1._function.pipe(processResult, index$1.Either.match(() => this.exampleImageError.emit(), () => this.exampleImageSelected.emit()));
|
|
324
353
|
this.selected = false;
|
|
325
354
|
}
|
|
326
355
|
handleKeyPress({ key }) {
|
|
@@ -329,12 +358,12 @@ let VviinnExampleImage = class {
|
|
|
329
358
|
this.selectImage();
|
|
330
359
|
}
|
|
331
360
|
showPreloader() {
|
|
332
|
-
return ((
|
|
333
|
-
|
|
361
|
+
return ((index$1.imageSearchState.objectDetectionInProgress ||
|
|
362
|
+
index$1.imageSearchState.loading) &&
|
|
334
363
|
this.selected);
|
|
335
364
|
}
|
|
336
365
|
render() {
|
|
337
|
-
return (index.h(index.Host, {
|
|
366
|
+
return (index.h(index.Host, { onClick: () => this.selectImage(), onKeyUp: (ev) => this.handleKeyPress(ev) }, this.showPreloader() ? (index.h("div", { class: "image-preloader" }, index.h("vviinn-preloader", null))) : null, index.h("img", { src: this.src, width: this.width, height: this.height, tabindex: 1 })));
|
|
338
367
|
}
|
|
339
368
|
};
|
|
340
369
|
VviinnExampleImage.style = vviinnExampleImageCss;
|
|
@@ -362,13 +391,13 @@ let VviinnExampleImages = class {
|
|
|
362
391
|
firstExampleImage.focus();
|
|
363
392
|
}
|
|
364
393
|
render() {
|
|
365
|
-
return (index.h(index.Host, { onFocus: () => this.delegateFocus() }, index.h("slot", { name: "vviinn-example-images-title" }, index.h("h3", null, "Mit den Beispielbildern die Suche direkt ausprobieren")), index.h("div", { class: "images", ref: (el) => (this.imagesBlock = el) }, index.h("slot", { name: "vviinn-example-images-1" }, index.h("vviinn-example-image", { width: 480, height: 640, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDEtTC5qcGc="
|
|
394
|
+
return (index.h(index.Host, { onFocus: () => this.delegateFocus() }, index.h("slot", { name: "vviinn-example-images-title" }, index.h("h3", null, "Mit den Beispielbildern die Suche direkt ausprobieren")), index.h("div", { class: "images", ref: (el) => (this.imagesBlock = el) }, index.h("slot", { name: "vviinn-example-images-1" }, index.h("vviinn-example-image", { width: 480, height: 640, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDEtTC5qcGc=" })), index.h("slot", { name: "vviinn-example-images-2" }, index.h("vviinn-example-image", { width: 280, height: 480, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDItTS5qcGc=" })), index.h("slot", { name: "vviinn-example-images-3" }, index.h("vviinn-example-image", { width: 280, height: 480, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDMtTS5qcGc=" })), index.h("slot", { name: "vviinn-example-images-4" }, index.h("vviinn-example-image", { width: 480, height: 640, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDQtTC5qcGc=" })))));
|
|
366
395
|
}
|
|
367
396
|
get el() { return index.getElement(this); }
|
|
368
397
|
};
|
|
369
398
|
VviinnExampleImages.style = vviinnExampleImagesCss;
|
|
370
399
|
|
|
371
|
-
const vviinnImageSelectorCss = ":host{display:block}:host(::hover){background:whitesmoke}.visually-hidden{clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}label{cursor:pointer;display:grid;
|
|
400
|
+
const vviinnImageSelectorCss = ":host{display:block}:host(::hover){background:whitesmoke}.visually-hidden{clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%);height:1px;overflow:hidden;position:absolute;white-space:nowrap;width:1px}label{cursor:pointer;display:grid;width:100%;height:100%;transition:background 0.1s ease-in-out}";
|
|
372
401
|
|
|
373
402
|
let VviinnImageSelector = class {
|
|
374
403
|
constructor(hostRef) {
|
|
@@ -378,12 +407,12 @@ let VviinnImageSelector = class {
|
|
|
378
407
|
}
|
|
379
408
|
async handleInputChange(event) {
|
|
380
409
|
const input = event.target;
|
|
381
|
-
const processingResult = await
|
|
382
|
-
|
|
410
|
+
const processingResult = await index$1.processSelectedFile(input.files[0]);
|
|
411
|
+
index$1._function.pipe(processingResult, index$1.match(() => this.imageSelectedError.emit(), () => this.imageSelected.emit()));
|
|
383
412
|
input.value = null;
|
|
384
413
|
}
|
|
385
414
|
isLoading() {
|
|
386
|
-
return (
|
|
415
|
+
return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
|
|
387
416
|
}
|
|
388
417
|
render() {
|
|
389
418
|
return (index.h(index.Host, { exportparts: "button" }, this.isLoading() ? index.h("vviinn-preloader", null) : null, this.isLoading() ? null : (index.h("label", { htmlFor: "fileInput", part: "button" }, index.h("slot", { name: "upload-button-text" }, "Upload image"))), index.h("input", { id: "fileInput", class: "visually-hidden", type: "file", accept: "image/*", onChange: (event) => this.handleInputChange(event) })));
|
|
@@ -394,8 +423,8 @@ VviinnImageSelector.style = vviinnImageSelectorCss;
|
|
|
394
423
|
const vviinnImageViewCss = ":host{display:grid;position:relative;justify-self:center}img{box-sizing:border-box;filter:brightness(60%);position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:-1}.image-preloader{background:rgba(0, 0, 0, 0.25);border-radius:4px;bottom:18px;padding:4px 6px;pointer-events:none;position:absolute;right:18px;z-index:4}vviinn-preloader{--preloader-size:12px}";
|
|
395
424
|
|
|
396
425
|
const getImageSizes = (i) => {
|
|
397
|
-
const dimensions =
|
|
398
|
-
const resize =
|
|
426
|
+
const dimensions = index$1.dimensionsFromImage(i);
|
|
427
|
+
const resize = index$1.scaleByLargestSide(288);
|
|
399
428
|
const newDimensions = resize(dimensions);
|
|
400
429
|
const sizes = newDimensions.map((d) => d.size);
|
|
401
430
|
return [sizes[0], sizes[1]];
|
|
@@ -406,34 +435,34 @@ let VviinnImageView = class {
|
|
|
406
435
|
}
|
|
407
436
|
handleInitialImageLoad(ev) {
|
|
408
437
|
const target = ev.target;
|
|
409
|
-
const imageBounds =
|
|
438
|
+
const imageBounds = index$1.fromImage(target);
|
|
410
439
|
const padding = 12;
|
|
411
|
-
const { x, y } =
|
|
440
|
+
const { x, y } = index$1.move(imageBounds, { x: padding, y: padding });
|
|
412
441
|
const searchArea = {
|
|
413
442
|
x,
|
|
414
443
|
y,
|
|
415
444
|
width: imageBounds.width - padding * 2,
|
|
416
445
|
height: imageBounds.height - padding * 2,
|
|
417
446
|
};
|
|
418
|
-
|
|
419
|
-
|
|
447
|
+
index$1.imageSearchState.imageBounds = index$1.Option.some(imageBounds);
|
|
448
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(searchArea);
|
|
420
449
|
}
|
|
421
450
|
renderDetectedObject(object) {
|
|
422
451
|
return index.h("vviinn-detected-object", { detectedObject: object });
|
|
423
452
|
}
|
|
424
453
|
renderImage() {
|
|
425
|
-
return
|
|
454
|
+
return index$1._function.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.image), index$1.Option.map(([url, refImage]) => {
|
|
426
455
|
const [width, height] = getImageSizes(refImage);
|
|
427
456
|
const image = (index.h("img", { decoding: "async", width: width, height: height, src: url, onLoad: (el) => this.handleInitialImageLoad(el), draggable: false }));
|
|
428
457
|
return image;
|
|
429
|
-
}),
|
|
458
|
+
}), index$1.Option.getOrElse(() => null));
|
|
430
459
|
}
|
|
431
460
|
renderCropper() {
|
|
432
|
-
return
|
|
461
|
+
return index$1._function.pipe(index$1.imageSearchState.imageUrl, index$1.Option.map(() => index.h("image-cropper", null)), index$1.Option.getOrElse(() => null));
|
|
433
462
|
}
|
|
434
463
|
render() {
|
|
435
|
-
return (index.h(index.Host, null,
|
|
436
|
-
|
|
464
|
+
return (index.h(index.Host, null, index$1.imageSearchState.loading ||
|
|
465
|
+
index$1.imageSearchState.objectDetectionInProgress ? (index.h("div", { class: "image-preloader" }, index.h("vviinn-preloader", null))) : null, index.h("highlight-box", null), this.renderImage(), this.renderCropper(), index$1.imageSearchState.detectedObjects.map((o) => this.renderDetectedObject(o))));
|
|
437
466
|
}
|
|
438
467
|
};
|
|
439
468
|
VviinnImageView.style = vviinnImageViewCss;
|
|
@@ -491,7 +520,7 @@ let VviinnOnboardingCard1 = class {
|
|
|
491
520
|
customizedSlots.slotChangeListener(this, this.el);
|
|
492
521
|
}
|
|
493
522
|
render() {
|
|
494
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-1-icon" }, index.h(index$
|
|
523
|
+
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-1-icon" }, index.h(index$2.OnboardingCard1Icon, null)), index.h("slot", { name: "onboarding-card-1-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Starte die Bildsuche"), index.h("p", null, "Lade ein Bild aus Deiner Galerie hoch oder fotografiere ein Produkt mit Deiner Kamera.")))));
|
|
495
524
|
}
|
|
496
525
|
get el() { return index.getElement(this); }
|
|
497
526
|
};
|
|
@@ -507,7 +536,7 @@ let VviinnOnboardingCard2 = class {
|
|
|
507
536
|
customizedSlots.slotChangeListener(this, this.el);
|
|
508
537
|
}
|
|
509
538
|
render() {
|
|
510
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-2-icon" }, index.h(index$
|
|
539
|
+
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-2-icon" }, index.h(index$2.OnboardingCard2Icon, null)), index.h("slot", { name: "onboarding-card-2-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Verfeiner deine Suche"), index.h("p", null, "Du kannst den Bildrahmen selber festlegen und so die Produkte genau ausw\u00E4hlen.")))));
|
|
511
540
|
}
|
|
512
541
|
get el() { return index.getElement(this); }
|
|
513
542
|
};
|
|
@@ -523,7 +552,7 @@ let VviinnOnboardingCard3 = class {
|
|
|
523
552
|
customizedSlots.slotChangeListener(this, this.el);
|
|
524
553
|
}
|
|
525
554
|
render() {
|
|
526
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-3-icon" }, index.h(index$
|
|
555
|
+
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-3-icon" }, index.h(index$2.OnboardingCard3Icon, null)), index.h("slot", { name: "onboarding-card-3-text" }, index.h("div", { class: "text" }, index.h("h4", null, "Ohne Hintergrund"), index.h("p", null, "Die besten Ergebnisse erh\u00E4ltst Du, wenn das gesuchte Objekt mit einfarbigem und hellem Hintergrund zu sehen ist.")))));
|
|
527
556
|
}
|
|
528
557
|
get el() { return index.getElement(this); }
|
|
529
558
|
};
|
|
@@ -541,7 +570,7 @@ let VviinnOverlay = class {
|
|
|
541
570
|
};
|
|
542
571
|
VviinnOverlay.style = vviinnOverlayCss;
|
|
543
572
|
|
|
544
|
-
const vviinnOverlayedModalCss = ":host{display:none}:host(.active){display:block}vviinn-overlay{align-items:center;display:grid;justify-items:center}@media (max-width: 415px){vviinn-modal{border-radius:4px 4px 0 0;height:100vh;margin-top:32px;transform:translateY(100%);width:100vw}vviinn-overlay{align-items:end;display:grid;justify-items:center}}";
|
|
573
|
+
const vviinnOverlayedModalCss = ":host{display:none}:host(.active){display:block}vviinn-overlay{align-items:center;display:grid;justify-items:center;cursor:default}@media (max-width: 415px){vviinn-modal{border-radius:4px 4px 0 0;height:100vh;margin-top:32px;transform:translateY(100%);width:100vw}vviinn-overlay{align-items:end;display:grid;justify-items:center}}";
|
|
545
574
|
|
|
546
575
|
let VviinnOverlayedModal = class {
|
|
547
576
|
constructor(hostRef) {
|
|
@@ -556,6 +585,23 @@ let VviinnOverlayedModal = class {
|
|
|
556
585
|
};
|
|
557
586
|
VviinnOverlayedModal.style = vviinnOverlayedModalCss;
|
|
558
587
|
|
|
588
|
+
const vviinnPreloaderCss = ":host{--preloader-size:24px;--preloader-width:calc(var(--preloader-size) / 6);transform-origin:center;-webkit-animation:rotate 3s linear infinite;animation:rotate 3s linear infinite;border:var(--preloader-width) solid white;border-radius:50%;border-top-color:transparent;display:none;outline:0;width:var(--preloader-size);height:var(--preloader-size);box-sizing:border-box}:host(.active){display:flex}@-webkit-keyframes rotate{from{transform:rotate(-360deg)}to{transform:rotate(360deg)}}@keyframes rotate{from{transform:rotate(-360deg)}to{transform:rotate(360deg)}}";
|
|
589
|
+
|
|
590
|
+
let VviinnPreloader = class {
|
|
591
|
+
constructor(hostRef) {
|
|
592
|
+
index.registerInstance(this, hostRef);
|
|
593
|
+
}
|
|
594
|
+
isActive() {
|
|
595
|
+
return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
|
|
596
|
+
}
|
|
597
|
+
render() {
|
|
598
|
+
return (index.h(index.Host, { class: {
|
|
599
|
+
active: this.isActive(),
|
|
600
|
+
} }));
|
|
601
|
+
}
|
|
602
|
+
};
|
|
603
|
+
VviinnPreloader.style = vviinnPreloaderCss;
|
|
604
|
+
|
|
559
605
|
const vviinnPrivacyBadgeCss = ":host{display:block;background:#F4F4F4;padding:17px}.content{display:grid;grid-template-columns:-webkit-min-content auto;grid-template-columns:min-content auto;grid-gap:9px}.content p{color:#525252;font-size:12px;line-height:16px;margin:unset}";
|
|
560
606
|
|
|
561
607
|
let VviinnPrivacyBadge = class {
|
|
@@ -572,6 +618,187 @@ let VviinnPrivacyBadge = class {
|
|
|
572
618
|
};
|
|
573
619
|
VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
|
|
574
620
|
|
|
621
|
+
class GtagAnalytics {
|
|
622
|
+
sendImpression(product) {
|
|
623
|
+
var _a, _b, _c;
|
|
624
|
+
gtag('event', 'view_item_list', {
|
|
625
|
+
items: [
|
|
626
|
+
{
|
|
627
|
+
id: product.productId,
|
|
628
|
+
name: product.title,
|
|
629
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
630
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
631
|
+
list_name: 'VI VPR View',
|
|
632
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
633
|
+
}
|
|
634
|
+
]
|
|
635
|
+
});
|
|
636
|
+
return undefined;
|
|
637
|
+
}
|
|
638
|
+
sendClick(product) {
|
|
639
|
+
var _a, _b, _c;
|
|
640
|
+
gtag('event', 'select_content', {
|
|
641
|
+
content_type: 'product',
|
|
642
|
+
items: [
|
|
643
|
+
{
|
|
644
|
+
id: product.productId,
|
|
645
|
+
name: product.title,
|
|
646
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
647
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
648
|
+
list_name: 'VI VPR View',
|
|
649
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
650
|
+
}
|
|
651
|
+
]
|
|
652
|
+
});
|
|
653
|
+
return undefined;
|
|
654
|
+
}
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
class GAnalytics {
|
|
658
|
+
constructor() {
|
|
659
|
+
ga('require', 'ec');
|
|
660
|
+
}
|
|
661
|
+
convertProduct(product) {
|
|
662
|
+
var _a, _b, _c;
|
|
663
|
+
return {
|
|
664
|
+
id: product.productId,
|
|
665
|
+
name: product.title,
|
|
666
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
667
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
668
|
+
list: 'VI VPR View',
|
|
669
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
670
|
+
};
|
|
671
|
+
}
|
|
672
|
+
sendImpression(product) {
|
|
673
|
+
ga('ec:addImpression', this.convertProduct(product));
|
|
674
|
+
return undefined;
|
|
675
|
+
}
|
|
676
|
+
sendClick(product) {
|
|
677
|
+
var _a, _b, _c;
|
|
678
|
+
ga('ec:addProduct', {
|
|
679
|
+
id: product.productId,
|
|
680
|
+
name: product.title,
|
|
681
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
682
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
683
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
684
|
+
});
|
|
685
|
+
ga('ec:setAction', 'click', { list: 'VI VPR View' });
|
|
686
|
+
return undefined;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
const getGtagAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.gtag), index$1.Option.map(() => new GtagAnalytics()));
|
|
691
|
+
const getCommonAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.ga), index$1.Option.map(() => new GAnalytics()));
|
|
692
|
+
const analyticsMonoid = index$1.Option.getMonoid(index$1.Semigroup.first());
|
|
693
|
+
const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
|
|
694
|
+
|
|
695
|
+
const FIT_EXPR = /fit\/\d+\//;
|
|
696
|
+
const containsFit = (url) => {
|
|
697
|
+
return index$1._function.pipe(url.match(FIT_EXPR), index$1.Either.fromNullable(url), index$1.Either.map(() => url));
|
|
698
|
+
};
|
|
699
|
+
const processWidth = (url, size) => {
|
|
700
|
+
return index$1._function.pipe(containsFit(url), index$1.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), index$1.Either.getOrElse(() => url));
|
|
701
|
+
};
|
|
702
|
+
const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
|
|
703
|
+
const FormattedPrice = (props) => {
|
|
704
|
+
var _a;
|
|
705
|
+
const locale = props.locale;
|
|
706
|
+
const priceType = props.priceType;
|
|
707
|
+
const formattedPrice = new Intl.NumberFormat(locale, {
|
|
708
|
+
minimumFractionDigits: 2,
|
|
709
|
+
}).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));
|
|
712
|
+
};
|
|
713
|
+
const Price = (props) => {
|
|
714
|
+
return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
|
|
715
|
+
index.h("span", { class: "price-sale", part: "price-sale" },
|
|
716
|
+
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale, priceType: "sale" })),
|
|
717
|
+
index.h("span", { class: "price-outdated", part: "price-outdated" },
|
|
718
|
+
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "outdated" })),
|
|
719
|
+
]) : (index.h("span", { class: "price-regular", part: "price-regular" },
|
|
720
|
+
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "regular" })))));
|
|
721
|
+
};
|
|
722
|
+
const Image = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
723
|
+
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 })));
|
|
724
|
+
const ResponsiveImage = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
725
|
+
index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
726
|
+
|
|
727
|
+
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}";
|
|
728
|
+
|
|
729
|
+
let VviinnProductCard = class {
|
|
730
|
+
constructor(hostRef) {
|
|
731
|
+
index.registerInstance(this, hostRef);
|
|
732
|
+
this.recommendationLoad = index.createEvent(this, "recommendationLoad", 7);
|
|
733
|
+
this.recommendationView = index.createEvent(this, "recommendationView", 7);
|
|
734
|
+
this.recommendationClick = index.createEvent(this, "recommendationClick", 7);
|
|
735
|
+
this.productImageLoaded = index.createEvent(this, "productImageLoaded", 7);
|
|
736
|
+
this.currency = undefined;
|
|
737
|
+
this.imageRatio = 1;
|
|
738
|
+
this.imageWidth = 200;
|
|
739
|
+
this.locale = undefined;
|
|
740
|
+
this.pricePrefix = undefined;
|
|
741
|
+
this.responsive = false;
|
|
742
|
+
this.dimmedBackground = false;
|
|
743
|
+
/** @internal */
|
|
744
|
+
this.index = 0;
|
|
745
|
+
this.imageLoaded = false;
|
|
746
|
+
this.productData = null;
|
|
747
|
+
this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
|
|
748
|
+
}
|
|
749
|
+
connectedCallback() {
|
|
750
|
+
this.productData = this.getProductData();
|
|
751
|
+
}
|
|
752
|
+
getProductData() {
|
|
753
|
+
return {
|
|
754
|
+
product: this.productId,
|
|
755
|
+
rank: this.index,
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
intersectionCallback(data) {
|
|
759
|
+
if (data.some((entry) => entry.isIntersecting)) {
|
|
760
|
+
index$1._function.pipe(getAnalyticsModule, index$1.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
|
|
761
|
+
this.recommendationView.emit(this.productData);
|
|
762
|
+
this.intersectionObserver.disconnect();
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
componentDidLoad() {
|
|
766
|
+
this.recommendationLoad.emit(this.productData);
|
|
767
|
+
this.intersectionObserver.observe(this.el);
|
|
768
|
+
const links = this.el.shadowRoot.querySelectorAll("a");
|
|
769
|
+
links.forEach((link) => link.addEventListener("click", (event) => {
|
|
770
|
+
event.preventDefault();
|
|
771
|
+
event.stopImmediatePropagation();
|
|
772
|
+
this.recommendationClick.emit(this.getProductData());
|
|
773
|
+
index$1._function.pipe(getAnalyticsModule, index$1.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
|
|
774
|
+
}));
|
|
775
|
+
}
|
|
776
|
+
getProduct() {
|
|
777
|
+
return index$1.imageSearchState.results.find((r) => r.productId === this.productId);
|
|
778
|
+
}
|
|
779
|
+
renderImage() {
|
|
780
|
+
const props = {
|
|
781
|
+
width: this.imageWidth,
|
|
782
|
+
height: this.imageWidth * this.imageRatio,
|
|
783
|
+
src: this.image,
|
|
784
|
+
title: this.productTitle,
|
|
785
|
+
lazy: false,
|
|
786
|
+
};
|
|
787
|
+
return this.responsive
|
|
788
|
+
? ResponsiveImage(props, () => this.kek())
|
|
789
|
+
: Image(props, () => this.kek());
|
|
790
|
+
}
|
|
791
|
+
kek() {
|
|
792
|
+
this.productImageLoaded.emit(this.productId);
|
|
793
|
+
}
|
|
794
|
+
render() {
|
|
795
|
+
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 })));
|
|
797
|
+
}
|
|
798
|
+
get el() { return index.getElement(this); }
|
|
799
|
+
};
|
|
800
|
+
VviinnProductCard.style = vviinnProductCardCss;
|
|
801
|
+
|
|
575
802
|
const vviinnServerErrorCss = ":host{display:block}";
|
|
576
803
|
|
|
577
804
|
let VviinnServerError = class {
|
|
@@ -605,16 +832,16 @@ const getStyleMap = (data) => {
|
|
|
605
832
|
};
|
|
606
833
|
};
|
|
607
834
|
const Arrow = ({ kind, tabindex, disabled, onClick, onKeyDown, }) => (index.h("div", { class: getStyleMap({ kind, disabled }), onClick: onClick, tabindex: tabindex, onKeyDown: onKeyDown },
|
|
608
|
-
index.h(index$
|
|
835
|
+
index.h(index$2.ArrowIcon, null)));
|
|
609
836
|
|
|
610
|
-
const vviinnSliderCss = ":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{--num-items:0;--position:0;display:grid;grid-gap:20px;justify-items:center;position:relative}.items-wrapper{overflow:hidden;width:100%}.items{box-sizing:border-box;display:grid;grid-auto-flow:column;grid-template-columns:repeat(var(--num-items), 100%);transform:translateX(calc(-100% * var(--position)));transition:transform 0.33s ease-in-out}.controls{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--num-items), -webkit-min-content);grid-template-columns:repeat(var(--num-items), min-content)}.bullet{background:#
|
|
837
|
+
const vviinnSliderCss = ":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{--num-items:0;--position:0;display:grid;grid-gap:20px;justify-items:center;position:relative}.items-wrapper{overflow:hidden;width:100%}.items{box-sizing:border-box;display:grid;grid-auto-flow:column;grid-template-columns:repeat(var(--num-items), 100%);transform:translateX(calc(-100% * var(--position)));transition:transform 0.33s ease-in-out}.controls{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--num-items), -webkit-min-content);grid-template-columns:repeat(var(--num-items), min-content)}.bullet{background:#e0e0e0;border-radius:50%;box-sizing:border-box;cursor:pointer;height:8px;width:8px;transition:background 0.1s ease-in-out}.bullet:hover{background:#c6c6c6}.bullet.active{background:var(--color-primary, var(--color-primary-system))}.bullet:active{background:transparent;border:2px solid var(--color-primary, var(--color-primary-system))}.arrow-wrapper{align-items:center;cursor:pointer;background:white;border:2px solid white;bottom:0;box-sizing:border-box;display:grid;height:calc(var(--spacer) * 6);justify-items:center;margin:auto;position:absolute;top:0;transform:translate3d(0, -50%, 0);transition:border 0.25ms ease-in-out;width:calc(var(--spacer) * 4)}.arrow-wrapper:active{border-color:var(--color-primary, var(--color-primary-system));opacity:0.75}.arrow-wrapper:focus{border-color:var(--color-primary, var(--color-primary-system));opacity:0.5;outline:none}.prev{left:0}.next{right:0}.next>svg{transform:rotate3d(0, 1, 0, 180deg)}.arrow-wrapper>svg{transition:fill 0.25ms ease-in-out;fill:#a8a8a8}.arrow-wrapper:hover>svg{fill:#8d8d8d}";
|
|
611
838
|
|
|
612
839
|
let VviinnSlider = class {
|
|
613
840
|
constructor(hostRef) {
|
|
614
841
|
index.registerInstance(this, hostRef);
|
|
615
842
|
this.elementsCount = 0;
|
|
616
843
|
this.internalPosition = 0;
|
|
617
|
-
this.swipeStartPosition =
|
|
844
|
+
this.swipeStartPosition = index$1.Option.none;
|
|
618
845
|
this.showBullets = true;
|
|
619
846
|
this.position = 0;
|
|
620
847
|
this.showArrows = false;
|
|
@@ -644,7 +871,7 @@ let VviinnSlider = class {
|
|
|
644
871
|
this.setActiveCssClassToSlide(index);
|
|
645
872
|
}
|
|
646
873
|
renderBullets() {
|
|
647
|
-
return this.showBullets ? (index.h("div", { class: "controls" },
|
|
874
|
+
return this.showBullets ? (index.h("div", { class: "controls" }, index$1.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
|
|
648
875
|
bullet: true,
|
|
649
876
|
active: i == this.internalPosition % this.elementsCount,
|
|
650
877
|
}, onClick: () => this.goToSlide(i) }))))) : null;
|
|
@@ -681,13 +908,13 @@ let VviinnSlider = class {
|
|
|
681
908
|
handleTouchStart(event) {
|
|
682
909
|
if (!this.showBullets)
|
|
683
910
|
return;
|
|
684
|
-
this.swipeStartPosition =
|
|
911
|
+
this.swipeStartPosition = index$1._function.pipe(event.touches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
|
|
685
912
|
}
|
|
686
913
|
handleTouchEnd(event) {
|
|
687
914
|
if (!this.showBullets)
|
|
688
915
|
return;
|
|
689
|
-
const swipeEndPosition =
|
|
690
|
-
|
|
916
|
+
const swipeEndPosition = index$1._function.pipe(event.changedTouches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
|
|
917
|
+
index$1._function.pipe(index$1.sequenceToOption(this.swipeStartPosition, swipeEndPosition), index$1.Option.map(([start, end]) => Ord.compare(start, end)), index$1.Option.map((swipeDirection) => {
|
|
691
918
|
switch (swipeDirection) {
|
|
692
919
|
case 1:
|
|
693
920
|
return this.nextSlide();
|
|
@@ -727,6 +954,195 @@ let VviinnTeaser = class {
|
|
|
727
954
|
};
|
|
728
955
|
VviinnTeaser.style = vviinnTeaserCss;
|
|
729
956
|
|
|
957
|
+
const vviinnVpsWidgetCss = ":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{display:block}.hidden{visibility:hidden;height:1px}vviinn-overlayed-modal.first-screen::part(title),vviinn-overlayed-modal.first-screen::part(secondary-action){visibility:hidden}.start-page{display:grid;grid-template-columns:repeat(2, 1fr);min-height:580px}.start-page_block{align-content:start;border-right:1px solid #f4f4f4;display:grid;padding:48px}.start-page_block.error{align-content:center}#onboarding-block{border-right:unset;box-sizing:border-box;grid-gap:24px;overflow-y:auto;position:relative;width:100%}vviinn-teaser{margin-bottom:32px;margin-top:-24px}vviinn-image-selector{align-items:center;background:var(--color-primary, var(--color-primary-system));border-color:var(--color-primary, var(--color-primary-system));border-radius:2px;color:white;display:grid;font-size:16px;font-weight:600;height:56px;justify-items:center;margin-bottom:16px;transition:background 0.1s ease-in-out}vviinn-image-selector:hover{background:var(--color-primary-hover, var(--color-primary-hover-system));border-color:var(--color-primary-hover, var(--color-primary-hover-system))}vviinn-image-selector:active{border-color:black}.upload-button-content{display:grid;align-items:center;justify-items:start;justify-content:center;grid-template-columns:-webkit-max-content auto;grid-template-columns:max-content auto;grid-gap:16px}.results-page{display:grid;grid-template-columns:336px auto;box-sizing:border-box}.results-page>*{padding:24px;box-sizing:border-box}.products{align-content:center;align-items:start;box-sizing:border-box;display:grid;grid-gap:32px 16px;grid-template-columns:repeat(auto-fill, minmax(152px, 1fr));justify-items:center;padding:24px;padding-right:0;position:absolute;width:calc(100% - 16px)}.products.hidden{display:none}vviinn-empty-results{width:280px;align-self:center;justify-self:center}.products-wrapper{display:grid;overflow-y:auto;overflow-x:hidden;padding:unset;position:relative;width:100%}.image-wrapper{border-right:1px solid #f4f4f4;display:grid;grid-template-rows:-webkit-min-content 170px;grid-template-rows:min-content 170px;grid-gap:24px;min-width:100%}.onboarding-wrapper{position:absolute;width:100%;padding:48px;box-sizing:border-box;display:grid;grid-gap:64px;padding-bottom:24px}vviinn-product-card{gap:0;width:100%}vviinn-product-card::part(image){border:1px solid #eaeaea;margin-bottom:8px}vviinn-product-card::part(price-container),vviinn-product-card::part(deeplink),vviinn-product-card::part(title){align-self:start}search-filters span{display:none}search-filters::part(filter){background:#f4f4f4;border-radius:4px;border:1px solid #f4f4f4;box-sizing:border-box;color:#161616;font-size:14px;font-weight:600;line-height:20px}search-filters::part(show-more-filters){border:1px solid #f4f4f4;border-radius:4px;box-sizing:border-box;color:#161616;font-size:14px;font-weight:600;line-height:20px;padding:6px 16px}search-filters::part(show-more-filters):hover{background:#eaeaea}search-filters::part(filter):hover{background:#eaeaea}search-filters::part(filter):focus{outline:none;border:1px solid var(--color-primary, var(--color-primary-system))}search-filters::part(filter active){background:rgba(15, 98, 254, 0.15);color:var(--color-primary, var(--color-primary-system))}.filters-wrapper{overflow:auto}.results-page:not(.active){display:none}.nothing-found{display:grid;grid-gap:64px;justify-self:center;padding-top:64px;padding-bottom:16px;position:absolute;width:60%}@media (max-width: 768px){.start-page_block{padding:24px}.onboarding-wrapper{padding:24px}}@media (max-width: 640px){.start-page{grid-template-rows:-webkit-min-content;grid-template-rows:min-content;grid-template-columns:unset;grid-gap:48px;padding:24px 0 48px 0}}@media (max-width: 640px) and (min-width: 415px){.onboarding-wrapper{position:unset}#onboarding-block{overflow:unset}.start-page.active{height:1px;overflow:auto}}@media (max-width: 415px){.results-page>*{box-sizing:border-box;padding:24px}vviinn-slide{padding-bottom:48px}.start-page_block:last-of-type{border-right:unset;overflow-y:unset;position:static;box-sizing:border-box;width:unset}.start-page_block{padding:0 24px}vviinn-teaser{margin-top:24px}.onboarding-wrapper{position:static;width:unset;padding:unset;box-sizing:border-box}.results-page{grid-template-columns:unset;grid-template-rows:-webkit-min-content auto;grid-template-rows:min-content auto}.image{margin-bottom:8px}.image-wrapper{grid-template-rows:-webkit-min-content auto;grid-template-rows:min-content auto;width:100%}.products-wrapper{align-content:start;position:static;overflow-y:unset;width:100%;padding-top:0}.products{position:static;padding:0;width:unset;grid-gap:32px 16px;justify-content:center}.nothing-found{position:static;grid-gap:64px;padding:unset;align-content:start;width:unset}}@media (max-width: 320px){.products{grid-template-columns:unset}}vviinn-wrong-format,vviinn-server-error{width:280px;align-self:center;justify-self:center}";
|
|
958
|
+
|
|
959
|
+
const filterInt = (value) => /^[-+]?(\d+|Infinity)$/.test(value) ? Number(value) : NaN;
|
|
960
|
+
const notEmptyString = (s) => !index$1.isEmpty(s);
|
|
961
|
+
const notNan = (n) => !isNaN(n);
|
|
962
|
+
let VviinnVpsWidget = class {
|
|
963
|
+
constructor(hostRef) {
|
|
964
|
+
index.registerInstance(this, hostRef);
|
|
965
|
+
/** @internal */
|
|
966
|
+
this.apiPath = "https://api.vviinn.com";
|
|
967
|
+
/** When true modal window with widget will be shown */
|
|
968
|
+
this.active = false;
|
|
969
|
+
/** Currency sign will shown after price */
|
|
970
|
+
this.currencySign = "€";
|
|
971
|
+
/** Locale for currency formatting */
|
|
972
|
+
this.locale = "de-DE";
|
|
973
|
+
this.slidePosition = 0;
|
|
974
|
+
this.width = 0;
|
|
975
|
+
this.wrongImageFormat = false;
|
|
976
|
+
this.trackingDeactivated = false;
|
|
977
|
+
this.imageSource = null;
|
|
978
|
+
this.setTrackingDeactivated = (result) => {
|
|
979
|
+
if (result.status === "rejected") {
|
|
980
|
+
this.trackingDeactivated = true;
|
|
981
|
+
}
|
|
982
|
+
};
|
|
983
|
+
}
|
|
984
|
+
activeWatcher(value) {
|
|
985
|
+
if (value) {
|
|
986
|
+
this.overflow = document.body.style.overflow;
|
|
987
|
+
document.body.style.overflow = "hidden";
|
|
988
|
+
this.trackOpenEvent();
|
|
989
|
+
}
|
|
990
|
+
else {
|
|
991
|
+
document.body.style.overflow = this.overflow;
|
|
992
|
+
}
|
|
993
|
+
}
|
|
994
|
+
trackRecommendationView({ detail }) {
|
|
995
|
+
if (this.trackingDeactivated)
|
|
996
|
+
return;
|
|
997
|
+
const recommendationViewEvent = index$1.createProductViewVpsEvent(Object.assign({ session_id: this.uiSessionId }, detail));
|
|
998
|
+
this.trackingApi
|
|
999
|
+
.trackEvent(recommendationViewEvent)
|
|
1000
|
+
.then(this.setTrackingDeactivated);
|
|
1001
|
+
}
|
|
1002
|
+
async trackRecommendationClick({ detail }) {
|
|
1003
|
+
const recommendationClickEvent = index$1.createProductClickVpsEvent(Object.assign({ session_id: this.uiSessionId }, detail));
|
|
1004
|
+
if (!this.trackingDeactivated) {
|
|
1005
|
+
await this.trackingApi
|
|
1006
|
+
.trackEvent(this.trackingDeactivated ? null : recommendationClickEvent)
|
|
1007
|
+
.then(this.setTrackingDeactivated);
|
|
1008
|
+
}
|
|
1009
|
+
const product = index$1.imageSearchState.results.find((r) => r.productId === detail.product);
|
|
1010
|
+
if (!product || !product.deeplink)
|
|
1011
|
+
return;
|
|
1012
|
+
window.location.href = product.deeplink;
|
|
1013
|
+
}
|
|
1014
|
+
trachSearchAreaChanges() {
|
|
1015
|
+
if (this.trackingDeactivated)
|
|
1016
|
+
return;
|
|
1017
|
+
const searchEvent = index$1.createSearchEvent({
|
|
1018
|
+
session_id: this.uiSessionId,
|
|
1019
|
+
source: this.imageSource,
|
|
1020
|
+
search_area: "manual-selection",
|
|
1021
|
+
});
|
|
1022
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1023
|
+
}
|
|
1024
|
+
trackDetectedObject() {
|
|
1025
|
+
if (this.trackingDeactivated)
|
|
1026
|
+
return;
|
|
1027
|
+
const searchEvent = index$1.createSearchEvent({
|
|
1028
|
+
session_id: this.uiSessionId,
|
|
1029
|
+
source: this.imageSource,
|
|
1030
|
+
search_area: "attention-point",
|
|
1031
|
+
});
|
|
1032
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1033
|
+
}
|
|
1034
|
+
trackFilter({ detail }) {
|
|
1035
|
+
if (this.trackingDeactivated)
|
|
1036
|
+
return;
|
|
1037
|
+
const searchEvent = index$1.createFilterEvent({
|
|
1038
|
+
session_id: this.uiSessionId,
|
|
1039
|
+
source: this.imageSource,
|
|
1040
|
+
kind: "category",
|
|
1041
|
+
action: detail,
|
|
1042
|
+
});
|
|
1043
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1044
|
+
}
|
|
1045
|
+
componentWillLoad() {
|
|
1046
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
1047
|
+
}
|
|
1048
|
+
connectedCallback() {
|
|
1049
|
+
index$1.state.apiPath = this.apiPath;
|
|
1050
|
+
index$1.state.currencySign = this.currencySign;
|
|
1051
|
+
index$1.state.locale = this.locale;
|
|
1052
|
+
index$1.imageSearchState.token = this.token;
|
|
1053
|
+
index$1.imageSearchState.campaignId = index$1._function.pipe(this.campaignId, index$1.Option.fromNullable, index$1.Option.chain(index$1.Option.fromPredicate(notEmptyString)), index$1.Option.map(filterInt), index$1.Option.chain(index$1.Option.fromPredicate(notNan)), index$1.Option.map((s) => `${s}`));
|
|
1054
|
+
this.uiSessionId = index$1.v4();
|
|
1055
|
+
this.trackingApi = index$1.createTrackingApi(this.apiPath, this.token);
|
|
1056
|
+
}
|
|
1057
|
+
trackOpenEvent() {
|
|
1058
|
+
if (this.trackingDeactivated)
|
|
1059
|
+
return;
|
|
1060
|
+
const widgetOpenEvent = index$1.createWidgetVpsEvent({
|
|
1061
|
+
action: "open",
|
|
1062
|
+
session_id: this.uiSessionId,
|
|
1063
|
+
});
|
|
1064
|
+
this.trackingApi
|
|
1065
|
+
.trackEvent(widgetOpenEvent)
|
|
1066
|
+
.then(this.setTrackingDeactivated);
|
|
1067
|
+
}
|
|
1068
|
+
handleImageSelection(source) {
|
|
1069
|
+
this.imageSource = source;
|
|
1070
|
+
this.slidePosition = 1;
|
|
1071
|
+
const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
|
|
1072
|
+
const overlay = root.shadowRoot.querySelector("vviinn-overlay");
|
|
1073
|
+
const modal = overlay.querySelector("vviinn-modal");
|
|
1074
|
+
const modalBody = modal.shadowRoot.querySelector(".body");
|
|
1075
|
+
modalBody.scrollTop = 0;
|
|
1076
|
+
this.trackInitialSearch();
|
|
1077
|
+
}
|
|
1078
|
+
trackInitialSearch() {
|
|
1079
|
+
if (this.trackingDeactivated)
|
|
1080
|
+
return;
|
|
1081
|
+
const searchEvent = index$1.createSearchEvent({
|
|
1082
|
+
session_id: this.uiSessionId,
|
|
1083
|
+
source: this.imageSource,
|
|
1084
|
+
search_area: "full",
|
|
1085
|
+
});
|
|
1086
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1087
|
+
}
|
|
1088
|
+
resetState() {
|
|
1089
|
+
this.resetScroll("onboarding-block");
|
|
1090
|
+
this.slidePosition = 0;
|
|
1091
|
+
index$1.imageSearchState.image = index$1.Option.none;
|
|
1092
|
+
index$1.imageSearchState.imageUrl = index$1.Option.none;
|
|
1093
|
+
index$1.imageSearchState.imageBounds = index$1.Option.none;
|
|
1094
|
+
index$1.imageSearchState.searchArea = index$1.Option.none;
|
|
1095
|
+
index$1.imageSearchState.results = [];
|
|
1096
|
+
index$1.imageSearchState.filters = [];
|
|
1097
|
+
index$1.imageSearchState.detectedObjects = [];
|
|
1098
|
+
index$1.imageSearchState.activeIonLink = undefined;
|
|
1099
|
+
index$1.imageSearchState.rectangleSearchForm = undefined;
|
|
1100
|
+
this.resetScroll("results-block");
|
|
1101
|
+
}
|
|
1102
|
+
haveErrors() {
|
|
1103
|
+
return this.wrongImageFormat || index$1.imageSearchState.serverError;
|
|
1104
|
+
}
|
|
1105
|
+
resetScroll(elementId, behavior = "auto") {
|
|
1106
|
+
const element = this.el.shadowRoot.getElementById(elementId);
|
|
1107
|
+
element.scroll({ top: 0, left: 0, behavior });
|
|
1108
|
+
}
|
|
1109
|
+
handleModalClose() {
|
|
1110
|
+
this.active = false;
|
|
1111
|
+
this.resetState();
|
|
1112
|
+
const elementsToReset = ["onboarding-block", "results-block"];
|
|
1113
|
+
elementsToReset.forEach((name) => this.resetScroll(name));
|
|
1114
|
+
if (this.trackingDeactivated)
|
|
1115
|
+
return;
|
|
1116
|
+
const widgetOpenEvent = index$1.createWidgetVpsEvent({
|
|
1117
|
+
action: "close",
|
|
1118
|
+
session_id: this.uiSessionId,
|
|
1119
|
+
});
|
|
1120
|
+
this.trackingApi
|
|
1121
|
+
.trackEvent(widgetOpenEvent)
|
|
1122
|
+
.then(this.setTrackingDeactivated);
|
|
1123
|
+
}
|
|
1124
|
+
render() {
|
|
1125
|
+
return (index.h(index.Host, null, index.h("vviinn-overlayed-modal", { class: { "first-screen": this.slidePosition === 0 }, active: this.active, onSecondaryActionClicked: () => this.resetState(), onModalClosed: () => this.handleModalClose(), exportparts: "secondary-action, title, close-button, example-images" }, index.h("vviinn-slider", { showBullets: false, position: this.slidePosition }, index.h("vviinn-slide", { class: { "start-page": true } }, index.h("div", { class: {
|
|
1126
|
+
error: this.haveErrors(),
|
|
1127
|
+
"start-page_block": true,
|
|
1128
|
+
} }, index.h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, onActionClick: () => (this.wrongImageFormat = false) }), index.h("vviinn-server-error", { class: { hidden: !index$1.imageSearchState.serverError }, onActionClick: () => (index$1.imageSearchState.serverError = false) }), index.h("vviinn-teaser", { class: { hidden: this.haveErrors() } }), index.h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection("upload"), onImageSelectedError: () => (this.wrongImageFormat = true), part: "select-image_button" }, index.h("span", { slot: "upload-button-text", class: "upload-button-content" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "29", height: "28", fill: "none" }, index.h("defs", null), index.h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M10.271 3.89A.875.875 0 0111 3.5h7c.293 0 .566.146.728.39l1.49 2.235h3.033a2.625 2.625 0 012.625 2.625V21a2.625 2.625 0 01-2.625 2.625H5.75A2.625 2.625 0 013.125 21V8.75A2.625 2.625 0 015.75 6.125h3.031l1.49-2.235zm1.197 1.36l-1.49 2.235a.875.875 0 01-.729.39H5.75a.875.875 0 00-.875.875V21a.875.875 0 00.875.875h17.5a.875.875 0 00.875-.875V8.75a.875.875 0 00-.875-.875h-3.5a.875.875 0 01-.729-.39l-1.49-2.235h-6.063z", "clip-rule": "evenodd" }), index.h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M14.5 11.375a3.062 3.062 0 100 6.125 3.062 3.062 0 000-6.125zm-4.813 3.063a4.812 4.812 0 119.625 0 4.812 4.812 0 01-9.625 0z", "clip-rule": "evenodd" })), index.h("slot", { name: "vviinn-image-upload-button-text" }, index.h("span", null, "Kamera oder Bild ausw\u00E4hlen")))), index.h("vviinn-privacy-badge", { class: { hidden: this.haveErrors() } })), index.h("div", { id: "onboarding-block", class: "start-page_block" }, index.h("div", { class: "onboarding-wrapper" }, index.h("vviinn-onboarding", null), index.h("vviinn-example-images", { part: "example-images", onImageSelected: () => this.handleImageSelection("example"), onImageSelectedError: () => this.resetScroll("onboarding-block", "smooth") })))), index.h("vviinn-slide", { class: { "results-page": true, active: this.slidePosition == 1 } }, index.h("div", { class: "image-wrapper" }, index.h("vviinn-image-view", null), index.h("div", { class: "filters-wrapper" }, index.h("div", { class: "filters" }, index$1.imageSearchState.filters.map((filter) => (index.h("search-filters", { filter: filter })))))), index.h("div", { id: "results-block", class: "products-wrapper" }, index.h("div", { class: {
|
|
1129
|
+
"nothing-found": true,
|
|
1130
|
+
hidden: index$1.imageSearchState.results.length > 0,
|
|
1131
|
+
} }, index.h("vviinn-empty-results", null), index.h("vviinn-onboarding", null)), index.h("div", { class: {
|
|
1132
|
+
hidden: index$1.imageSearchState.results.length <= 0,
|
|
1133
|
+
products: true,
|
|
1134
|
+
} }, index$1.imageSearchState.results.map((p, i) => {
|
|
1135
|
+
var _a;
|
|
1136
|
+
return (index.h("vviinn-product-card", { hidden: true, productTitle: p.title, productId: p.productId, brand: p.brand, deeplink: p.deeplink, price: p.price.actual, salePrice: p.price.sale, imageWidth: 160, image: (_a = p.image.thumbnail) !== null && _a !== void 0 ? _a : p.image.original, part: "product-card", index: i }));
|
|
1137
|
+
}))))))));
|
|
1138
|
+
}
|
|
1139
|
+
get el() { return index.getElement(this); }
|
|
1140
|
+
static get watchers() { return {
|
|
1141
|
+
"active": ["activeWatcher"]
|
|
1142
|
+
}; }
|
|
1143
|
+
};
|
|
1144
|
+
VviinnVpsWidget.style = vviinnVpsWidgetCss;
|
|
1145
|
+
|
|
730
1146
|
const vviinnWrongFormatCss = ":host{display:block}";
|
|
731
1147
|
|
|
732
1148
|
let VviinnWrongFormat = class {
|
|
@@ -740,11 +1156,13 @@ let VviinnWrongFormat = class {
|
|
|
740
1156
|
};
|
|
741
1157
|
VviinnWrongFormat.style = vviinnWrongFormatCss;
|
|
742
1158
|
|
|
1159
|
+
exports.cropper_handler = CropperHandler;
|
|
743
1160
|
exports.highlight_box = HighlightBox;
|
|
744
1161
|
exports.image_cropper = ImageCropper;
|
|
745
1162
|
exports.search_filters = SearchFilters;
|
|
746
1163
|
exports.vviinn_detected_object = VviinnDetectedObject;
|
|
747
1164
|
exports.vviinn_empty_results = VviinnEmptyResults;
|
|
1165
|
+
exports.vviinn_error = VviinnError;
|
|
748
1166
|
exports.vviinn_example_image = VviinnExampleImage;
|
|
749
1167
|
exports.vviinn_example_images = VviinnExampleImages;
|
|
750
1168
|
exports.vviinn_image_selector = VviinnImageSelector;
|
|
@@ -756,9 +1174,12 @@ exports.vviinn_onboarding_card_2 = VviinnOnboardingCard2;
|
|
|
756
1174
|
exports.vviinn_onboarding_card_3 = VviinnOnboardingCard3;
|
|
757
1175
|
exports.vviinn_overlay = VviinnOverlay;
|
|
758
1176
|
exports.vviinn_overlayed_modal = VviinnOverlayedModal;
|
|
1177
|
+
exports.vviinn_preloader = VviinnPreloader;
|
|
759
1178
|
exports.vviinn_privacy_badge = VviinnPrivacyBadge;
|
|
1179
|
+
exports.vviinn_product_card = VviinnProductCard;
|
|
760
1180
|
exports.vviinn_server_error = VviinnServerError;
|
|
761
1181
|
exports.vviinn_slide = VviinnSlide;
|
|
762
1182
|
exports.vviinn_slider = VviinnSlider;
|
|
763
1183
|
exports.vviinn_teaser = VviinnTeaser;
|
|
1184
|
+
exports.vviinn_vps_widget = VviinnVpsWidget;
|
|
764
1185
|
exports.vviinn_wrong_format = VviinnWrongFormat;
|