vviinn-widgets 2.20.2 → 2.20.8
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} +597 -83
- package/dist/cjs/{imageSearch.store-fbe0600a.js → index-48c94264.js} +15672 -12145
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-5466077a.js → package-be7ef5cc.js} +1 -1
- package/dist/cjs/{vviinn-carousel_3.cjs.entry.js → vviinn-carousel_2.cjs.entry.js} +138 -337
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +1 -1
- 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.css +0 -1
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +1 -1
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +4 -3
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +11 -6
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +11 -6
- package/dist/esm/{highlight-box_22.entry.js → cropper-handler_27.entry.js} +529 -20
- package/dist/esm/{imageSearch.store-cccd9b24.js → index-976acf7e.js} +15828 -12315
- package/dist/esm/{index-714e572a.js → index-c26521a2.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{package-a1bd1e95.js → package-d8a7718d.js} +1 -1
- package/dist/esm/vviinn-button.entry.js +1 -1
- package/dist/esm/{vviinn-carousel_3.entry.js → vviinn-carousel_2.entry.js} +94 -292
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +1 -1
- package/dist/esm/vviinn-vpr-button.entry.js +2 -2
- package/dist/esm/vviinn-vps-button.entry.js +2 -2
- package/dist/esm/vviinn-widgets.js +1 -1
- package/dist/types/recommendation/events.d.ts +1 -0
- package/dist/vviinn-widgets/{p-55eef9fc.entry.js → p-30c48d8b.entry.js} +1 -1
- package/dist/vviinn-widgets/p-414b2291.js +1 -0
- package/dist/vviinn-widgets/{p-c24caccd.js → p-47607583.js} +1 -1
- package/dist/vviinn-widgets/p-5470b28c.entry.js +1 -0
- package/dist/vviinn-widgets/p-76733c1f.js +1 -0
- package/dist/vviinn-widgets/{p-e3146599.entry.js → p-7e39f0cf.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-7d93f947.entry.js → p-b9cb513f.entry.js} +1 -1
- package/dist/vviinn-widgets/p-c15a5fcc.entry.js +1 -0
- package/dist/vviinn-widgets/{p-47b1b862.entry.js → p-f89d4f2c.entry.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +1 -1
- package/www/build/{p-55eef9fc.entry.js → p-30c48d8b.entry.js} +1 -1
- package/www/build/p-414b2291.js +1 -0
- package/www/build/{p-c24caccd.js → p-47607583.js} +1 -1
- package/www/build/p-5470b28c.entry.js +1 -0
- package/www/build/p-6df81ae4.js +161 -0
- package/www/build/p-76733c1f.js +1 -0
- package/www/build/{p-e3146599.entry.js → p-7e39f0cf.entry.js} +1 -1
- package/www/build/{p-7d93f947.entry.js → p-b9cb513f.entry.js} +1 -1
- package/www/build/p-c15a5fcc.entry.js +1 -0
- package/www/build/p-e0153ae2.css +6 -0
- package/www/build/{p-47b1b862.entry.js → p-f89d4f2c.entry.js} +1 -1
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +12 -2
- package/dist/cjs/Handler-de64afa5.js +0 -317
- package/dist/cjs/cropper-handler.cjs.entry.js +0 -28
- package/dist/cjs/index-c4851793.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 -266
- package/dist/esm/Handler-7bfee84f.js +0 -294
- package/dist/esm/cropper-handler.entry.js +0 -24
- package/dist/esm/index-fdc32fbc.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 -262
- package/dist/vviinn-widgets/p-0ef48c85.entry.js +0 -1
- package/dist/vviinn-widgets/p-2f7bf983.js +0 -1
- package/dist/vviinn-widgets/p-34b551fb.entry.js +0 -1
- package/dist/vviinn-widgets/p-3abc679c.js +0 -1
- package/dist/vviinn-widgets/p-3b99c62d.js +0 -1
- package/dist/vviinn-widgets/p-8036a003.entry.js +0 -1
- package/dist/vviinn-widgets/p-80d38a22.entry.js +0 -1
- package/dist/vviinn-widgets/p-91822e21.js +0 -1
- package/dist/vviinn-widgets/p-b9f04a14.entry.js +0 -1
- package/dist/vviinn-widgets/p-bae2af67.entry.js +0 -1
- package/www/build/p-0ef48c85.entry.js +0 -1
- package/www/build/p-2f7bf983.js +0 -1
- package/www/build/p-34b551fb.entry.js +0 -1
- package/www/build/p-3abc679c.js +0 -1
- package/www/build/p-3b99c62d.js +0 -1
- package/www/build/p-8036a003.entry.js +0 -1
- package/www/build/p-80d38a22.entry.js +0 -1
- package/www/build/p-91822e21.js +0 -1
- package/www/build/p-a67898be.css +0 -1
- package/www/build/p-b9f04a14.entry.js +0 -1
- package/www/build/p-bae2af67.entry.js +0 -1
- package/www/build/p-e296f9f6.js +0 -1
|
@@ -3,11 +3,46 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-a4becaff.js');
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const index$1 = require('./index-610c6c1f.js');
|
|
6
|
+
const index$1 = require('./index-48c94264.js');
|
|
7
|
+
const index$2 = require('./index-610c6c1f.js');
|
|
9
8
|
const customizedSlots = require('./customized-slots-aee3f39d.js');
|
|
10
9
|
const Campaign = require('./Campaign-13258569.js');
|
|
10
|
+
const _package = require('./package-be7ef5cc.js');
|
|
11
|
+
|
|
12
|
+
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;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}";
|
|
13
|
+
|
|
14
|
+
const CropperHandler = class {
|
|
15
|
+
constructor(hostRef) {
|
|
16
|
+
index.registerInstance(this, hostRef);
|
|
17
|
+
this.handler = undefined;
|
|
18
|
+
this.disabled = false;
|
|
19
|
+
}
|
|
20
|
+
render() {
|
|
21
|
+
return (index.h(index.Host, { part: `handle ${index$1.getCursorValue(this.handler.direction)}`, class: {
|
|
22
|
+
disabled: this.disabled,
|
|
23
|
+
[index$1.getCursorValue(this.handler.direction)]: true,
|
|
24
|
+
}, style: {
|
|
25
|
+
"--size": "20px",
|
|
26
|
+
cursor: index$1.getCursorValue(this.handler.direction),
|
|
27
|
+
}, draggable: false }));
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
CropperHandler.style = cropperHandlerCss;
|
|
31
|
+
|
|
32
|
+
const fromRectangle = (shape, target) => {
|
|
33
|
+
const top = `${shape.y}px`;
|
|
34
|
+
const left = `${shape.x}px`;
|
|
35
|
+
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
36
|
+
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
37
|
+
return {
|
|
38
|
+
top,
|
|
39
|
+
right,
|
|
40
|
+
bottom,
|
|
41
|
+
left,
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
45
|
+
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
11
46
|
|
|
12
47
|
// -------------------------------------------------------------------------------------
|
|
13
48
|
// -------------------------------------------------------------------------------------
|
|
@@ -29,21 +64,6 @@ var Ord = {
|
|
|
29
64
|
compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
|
|
30
65
|
};
|
|
31
66
|
|
|
32
|
-
const fromRectangle = (shape, target) => {
|
|
33
|
-
const top = `${shape.y}px`;
|
|
34
|
-
const left = `${shape.x}px`;
|
|
35
|
-
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
36
|
-
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
37
|
-
return {
|
|
38
|
-
top,
|
|
39
|
-
right,
|
|
40
|
-
bottom,
|
|
41
|
-
left,
|
|
42
|
-
};
|
|
43
|
-
};
|
|
44
|
-
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
45
|
-
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
46
|
-
|
|
47
67
|
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;user-select:none;--size:10px;--x-position:0;--y-position:0}img{-webkit-user-select:none;-moz-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);animation:0.25s linear fadein;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}@keyframes fadein{from{transform:translate(var(--x-position), var(--y-position)) scale(0)}to{transform:translate(var(--x-position), var(--y-position)) scale(1)}}";
|
|
48
68
|
|
|
49
69
|
const HighlightBox = class {
|
|
@@ -51,10 +71,10 @@ const HighlightBox = class {
|
|
|
51
71
|
index.registerInstance(this, hostRef);
|
|
52
72
|
}
|
|
53
73
|
getInsetValue() {
|
|
54
|
-
return
|
|
74
|
+
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(() => ""));
|
|
55
75
|
}
|
|
56
76
|
renderImage() {
|
|
57
|
-
return
|
|
77
|
+
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(() => ""));
|
|
58
78
|
}
|
|
59
79
|
render() {
|
|
60
80
|
return index.h(index.Host, null, this.renderImage());
|
|
@@ -91,19 +111,19 @@ const ImageCropper = class {
|
|
|
91
111
|
handleHandlerMove(event) {
|
|
92
112
|
event.preventDefault();
|
|
93
113
|
event.stopPropagation();
|
|
94
|
-
const destination =
|
|
95
|
-
const distance =
|
|
114
|
+
const destination = index$1.fromMouseEvent(event);
|
|
115
|
+
const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
96
116
|
const transformedHandler = {
|
|
97
117
|
position: distance,
|
|
98
118
|
direction: this.handlerMoveDirection,
|
|
99
119
|
};
|
|
100
|
-
|
|
101
|
-
const newSearchArea =
|
|
120
|
+
index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((area) => {
|
|
121
|
+
const newSearchArea = index$1.transform(area, transformedHandler);
|
|
102
122
|
if (this.outOfBounds(newSearchArea))
|
|
103
123
|
return;
|
|
104
|
-
|
|
124
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
|
|
105
125
|
this.mouseStartPoint = destination;
|
|
106
|
-
|
|
126
|
+
index$1.imageSearchState.detectedObject = undefined;
|
|
107
127
|
}));
|
|
108
128
|
}
|
|
109
129
|
outOfBounds(area) {
|
|
@@ -117,23 +137,23 @@ const ImageCropper = class {
|
|
|
117
137
|
handleCropperMove(ev) {
|
|
118
138
|
ev.preventDefault();
|
|
119
139
|
ev.stopPropagation();
|
|
120
|
-
const destination =
|
|
121
|
-
const distance =
|
|
122
|
-
|
|
123
|
-
const newSearchArea =
|
|
140
|
+
const destination = index$1.fromMouseEvent(ev);
|
|
141
|
+
const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
142
|
+
index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((searchArea) => {
|
|
143
|
+
const newSearchArea = index$1.move(searchArea, distance);
|
|
124
144
|
if (newSearchArea.x < 0 ||
|
|
125
145
|
newSearchArea.y < 0 ||
|
|
126
146
|
this.bounds.height - (newSearchArea.y + newSearchArea.height) < 0 ||
|
|
127
147
|
this.bounds.width - (newSearchArea.x + newSearchArea.width) < 0)
|
|
128
148
|
return;
|
|
129
|
-
|
|
130
|
-
|
|
149
|
+
index$1.imageSearchState.detectedObject = undefined;
|
|
150
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
|
|
131
151
|
this.mouseStartPoint = destination;
|
|
132
152
|
}));
|
|
133
153
|
}
|
|
134
154
|
handlePointerDown(event) {
|
|
135
155
|
event.stopPropagation();
|
|
136
|
-
this.mouseStartPoint =
|
|
156
|
+
this.mouseStartPoint = index$1.fromMouseEvent(event);
|
|
137
157
|
// should be htmlelement or handler
|
|
138
158
|
const target = findTarget(event);
|
|
139
159
|
if (target.localName === "cropper-handler") {
|
|
@@ -153,18 +173,18 @@ const ImageCropper = class {
|
|
|
153
173
|
this.el.removeEventListener("pointermove", this.pointerMoveListener);
|
|
154
174
|
document.removeEventListener("pointerup", this.pointerReleaseListener);
|
|
155
175
|
this.mouseStartPoint = undefined;
|
|
156
|
-
|
|
176
|
+
index$1.makeRectangularSearchRequest();
|
|
157
177
|
this.vviinnImageCrop.emit(this.basicEventData);
|
|
158
178
|
}
|
|
159
179
|
getStyleMap() {
|
|
160
|
-
return
|
|
180
|
+
return index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((rectangle) => {
|
|
161
181
|
return {
|
|
162
182
|
width: `${rectangle.width}px`,
|
|
163
183
|
height: `${rectangle.height}px`,
|
|
164
184
|
transform: `translate3d(${rectangle.x}px, ${rectangle.y}px, 0)`,
|
|
165
185
|
cursor: this.handleMove ? "move" : "default",
|
|
166
186
|
};
|
|
167
|
-
}),
|
|
187
|
+
}), index$1.Option.getOrElse(() => {
|
|
168
188
|
return {};
|
|
169
189
|
}));
|
|
170
190
|
}
|
|
@@ -173,7 +193,7 @@ const ImageCropper = class {
|
|
|
173
193
|
"crop-area": true,
|
|
174
194
|
active: this.handleMove,
|
|
175
195
|
disabled: this.disabled,
|
|
176
|
-
}, draggable: false, style: this.getStyleMap(), onContextMenu: () => false, onPointerDown: (ev) => this.handlePointerDown(ev) },
|
|
196
|
+
}, 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) }))))));
|
|
177
197
|
}
|
|
178
198
|
get el() { return index.getElement(this); }
|
|
179
199
|
};
|
|
@@ -200,12 +220,12 @@ const SearchFilters = class {
|
|
|
200
220
|
}
|
|
201
221
|
selectFilter(filter) {
|
|
202
222
|
this.selectedCategoryId = getFilterId(filter);
|
|
203
|
-
|
|
223
|
+
index$1.imageSearchState.activeIonLink = filter;
|
|
204
224
|
this.vviinnSelectFilter.emit(Object.assign(Object.assign({}, this.basicEventData), { action: "select", filterName: filter.name }));
|
|
205
225
|
}
|
|
206
226
|
clearSelectedFilter() {
|
|
207
227
|
this.selectedCategoryId = null;
|
|
208
|
-
|
|
228
|
+
index$1.imageSearchState.activeIonLink = undefined;
|
|
209
229
|
this.findSelectedFilter().blur();
|
|
210
230
|
this.vviinnSelectFilter.emit(Object.assign(Object.assign({}, this.basicEventData), { action: "deselect" }));
|
|
211
231
|
}
|
|
@@ -232,7 +252,7 @@ const SearchFilters = class {
|
|
|
232
252
|
}, style: { "animation-delay": `${n * 10}ms` }, onPointerUp: (ev) => {
|
|
233
253
|
ev.stopPropagation();
|
|
234
254
|
this.handleFilterSelection(f);
|
|
235
|
-
}, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$
|
|
255
|
+
}, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$2.CheckIcon, null) : null, f.name))), index.h("div", { class: {
|
|
236
256
|
filter: true,
|
|
237
257
|
"show-more": true,
|
|
238
258
|
hidden: this.filter.filters.length <= FILTERS_COUNT,
|
|
@@ -258,31 +278,31 @@ const VviinnDetectedObject = class {
|
|
|
258
278
|
this.position = ["0", "0"];
|
|
259
279
|
}
|
|
260
280
|
getObjectPosition() {
|
|
261
|
-
return
|
|
262
|
-
const objectRectangle =
|
|
263
|
-
const { x, y } =
|
|
281
|
+
return index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
|
|
282
|
+
const objectRectangle = index$1.fromAlt(index$1.foldValueObject(this.detectedObject).rectangle);
|
|
283
|
+
const { x, y } = index$1._function.pipe(objectRectangle, index$1.scaleWithSized(bounds), index$1.center);
|
|
264
284
|
return [`${x}px`, `${y}px`];
|
|
265
|
-
}),
|
|
285
|
+
}), index$1.Option.getOrElse(() => ["0", "0"]));
|
|
266
286
|
}
|
|
267
287
|
selectDetectedObject() {
|
|
268
|
-
|
|
269
|
-
const rectangle =
|
|
270
|
-
const transformedRect =
|
|
271
|
-
const scaledRect =
|
|
272
|
-
|
|
273
|
-
|
|
288
|
+
index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
|
|
289
|
+
const rectangle = index$1.foldValueObject(this.detectedObject).rectangle;
|
|
290
|
+
const transformedRect = index$1.fromAlt(rectangle);
|
|
291
|
+
const scaledRect = index$1.scaleWithSized(bounds)(transformedRect);
|
|
292
|
+
index$1.imageSearchState.detectedObject = this.detectedObject;
|
|
293
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(scaledRect);
|
|
274
294
|
}));
|
|
275
|
-
|
|
295
|
+
index$1.makeRectangularSearchRequest();
|
|
276
296
|
this.vviinnSelectObject.emit(Object.assign(Object.assign({}, this.basicEventData), { detectedObject: this.detectedObject }));
|
|
277
297
|
}
|
|
278
298
|
isActive() {
|
|
279
299
|
if (!this.detectedObject)
|
|
280
300
|
return false;
|
|
281
|
-
if (!
|
|
301
|
+
if (!index$1.imageSearchState.detectedObject)
|
|
282
302
|
return false;
|
|
283
|
-
const thisObject =
|
|
284
|
-
const savedObject =
|
|
285
|
-
return
|
|
303
|
+
const thisObject = index$1.foldValueObject(this.detectedObject);
|
|
304
|
+
const savedObject = index$1.foldValueObject(index$1.imageSearchState.detectedObject);
|
|
305
|
+
return index$1.detectedObjectEq.equals(thisObject, savedObject);
|
|
286
306
|
}
|
|
287
307
|
render() {
|
|
288
308
|
return (index.h(index.Host, { class: {
|
|
@@ -307,6 +327,18 @@ const VviinnEmptyResults = class {
|
|
|
307
327
|
};
|
|
308
328
|
VviinnEmptyResults.style = vviinnEmptyResultsCss;
|
|
309
329
|
|
|
330
|
+
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}";
|
|
331
|
+
|
|
332
|
+
const VviinnError = class {
|
|
333
|
+
constructor(hostRef) {
|
|
334
|
+
index.registerInstance(this, hostRef);
|
|
335
|
+
}
|
|
336
|
+
render() {
|
|
337
|
+
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" })));
|
|
338
|
+
}
|
|
339
|
+
};
|
|
340
|
+
VviinnError.style = vviinnErrorCss;
|
|
341
|
+
|
|
310
342
|
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}}";
|
|
311
343
|
|
|
312
344
|
const VviinnExampleImage = class {
|
|
@@ -322,9 +354,9 @@ const VviinnExampleImage = class {
|
|
|
322
354
|
}
|
|
323
355
|
async selectImage() {
|
|
324
356
|
this.selected = true;
|
|
325
|
-
const file = await
|
|
326
|
-
const processResult = await
|
|
327
|
-
|
|
357
|
+
const file = await index$1.toFile(this.src);
|
|
358
|
+
const processResult = await index$1.processSelectedFile(file);
|
|
359
|
+
index$1._function.pipe(processResult, index$1.Either.match(() => this.vviinnNoResult.emit(this.basicEventData), () => this.vviinnImageUpload.emit(this.basicEventData)));
|
|
328
360
|
this.selected = false;
|
|
329
361
|
}
|
|
330
362
|
handleKeyPress({ key }) {
|
|
@@ -333,8 +365,8 @@ const VviinnExampleImage = class {
|
|
|
333
365
|
this.selectImage();
|
|
334
366
|
}
|
|
335
367
|
showPreloader() {
|
|
336
|
-
return ((
|
|
337
|
-
|
|
368
|
+
return ((index$1.imageSearchState.objectDetectionInProgress ||
|
|
369
|
+
index$1.imageSearchState.loading) &&
|
|
338
370
|
this.selected);
|
|
339
371
|
}
|
|
340
372
|
render() {
|
|
@@ -380,12 +412,12 @@ const VviinnImageSelector = class {
|
|
|
380
412
|
}
|
|
381
413
|
async handleInputChange(event) {
|
|
382
414
|
const input = event.target;
|
|
383
|
-
const processingResult = await
|
|
384
|
-
|
|
415
|
+
const processingResult = await index$1.processSelectedFile(input.files[0]);
|
|
416
|
+
index$1._function.pipe(processingResult, index$1.match(() => this.vviinnNoResult.emit(this.basicEventData), () => this.vviinnImageUpload.emit(this.basicEventData)));
|
|
385
417
|
input.value = null;
|
|
386
418
|
}
|
|
387
419
|
isLoading() {
|
|
388
|
-
return
|
|
420
|
+
return index$1.imageSearchState.loading;
|
|
389
421
|
}
|
|
390
422
|
startUploadWatcher(upload) {
|
|
391
423
|
if (upload) {
|
|
@@ -405,8 +437,8 @@ VviinnImageSelector.style = vviinnImageSelectorCss;
|
|
|
405
437
|
const vviinnImageViewCss = ":host{display:grid;position:relative;justify-self:center;direction:ltr}img{box-sizing:border-box;filter:brightness(60%);position:relative;-webkit-user-select:none;-moz-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}";
|
|
406
438
|
|
|
407
439
|
const getImageSizes = (i) => {
|
|
408
|
-
const dimensions =
|
|
409
|
-
const resize =
|
|
440
|
+
const dimensions = index$1.dimensionsFromImage(i);
|
|
441
|
+
const resize = index$1.scaleByLargestSide(288);
|
|
410
442
|
const newDimensions = resize(dimensions);
|
|
411
443
|
const sizes = newDimensions.map((d) => d.size);
|
|
412
444
|
return [sizes[0], sizes[1]];
|
|
@@ -418,34 +450,34 @@ const VviinnImageView = class {
|
|
|
418
450
|
}
|
|
419
451
|
handleInitialImageLoad(ev) {
|
|
420
452
|
const target = ev.target;
|
|
421
|
-
const imageBounds =
|
|
453
|
+
const imageBounds = index$1.fromImage(target);
|
|
422
454
|
const padding = 12;
|
|
423
|
-
const { x, y } =
|
|
455
|
+
const { x, y } = index$1.move(imageBounds, { x: padding, y: padding });
|
|
424
456
|
const searchArea = {
|
|
425
457
|
x,
|
|
426
458
|
y,
|
|
427
459
|
width: imageBounds.width - padding * 2,
|
|
428
460
|
height: imageBounds.height - padding * 2,
|
|
429
461
|
};
|
|
430
|
-
|
|
431
|
-
|
|
462
|
+
index$1.imageSearchState.imageBounds = index$1.Option.some(imageBounds);
|
|
463
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(searchArea);
|
|
432
464
|
}
|
|
433
465
|
renderDetectedObject(object) {
|
|
434
466
|
return (index.h("vviinn-detected-object", { detectedObject: object, basicEventData: this.basicEventData }));
|
|
435
467
|
}
|
|
436
468
|
renderImage() {
|
|
437
|
-
return
|
|
469
|
+
return index$1._function.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.image), index$1.Option.map(([url, refImage]) => {
|
|
438
470
|
const [width, height] = getImageSizes(refImage);
|
|
439
471
|
const image = (index.h("img", { decoding: "async", width: width, height: height, src: url, onLoad: (el) => this.handleInitialImageLoad(el), draggable: false }));
|
|
440
472
|
return image;
|
|
441
|
-
}),
|
|
473
|
+
}), index$1.Option.getOrElse(() => null));
|
|
442
474
|
}
|
|
443
475
|
renderCropper() {
|
|
444
|
-
return
|
|
476
|
+
return index$1._function.pipe(index$1.imageSearchState.imageUrl, index$1.Option.map(() => index.h("image-cropper", { basicEventData: this.basicEventData })), index$1.Option.getOrElse(() => null));
|
|
445
477
|
}
|
|
446
478
|
render() {
|
|
447
|
-
return (index.h(index.Host, null,
|
|
448
|
-
|
|
479
|
+
return (index.h(index.Host, null, index$1.imageSearchState.loading ||
|
|
480
|
+
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))));
|
|
449
481
|
}
|
|
450
482
|
};
|
|
451
483
|
VviinnImageView.style = vviinnImageViewCss;
|
|
@@ -516,7 +548,7 @@ const VviinnOnboardingCard1 = class {
|
|
|
516
548
|
customizedSlots.slotChangeListener(this, this.el);
|
|
517
549
|
}
|
|
518
550
|
render() {
|
|
519
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-1-icon" }, index.h(index$
|
|
551
|
+
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.")))));
|
|
520
552
|
}
|
|
521
553
|
get el() { return index.getElement(this); }
|
|
522
554
|
};
|
|
@@ -532,7 +564,7 @@ const VviinnOnboardingCard2 = class {
|
|
|
532
564
|
customizedSlots.slotChangeListener(this, this.el);
|
|
533
565
|
}
|
|
534
566
|
render() {
|
|
535
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-2-icon" }, index.h(index$
|
|
567
|
+
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.")))));
|
|
536
568
|
}
|
|
537
569
|
get el() { return index.getElement(this); }
|
|
538
570
|
};
|
|
@@ -548,7 +580,7 @@ const VviinnOnboardingCard3 = class {
|
|
|
548
580
|
customizedSlots.slotChangeListener(this, this.el);
|
|
549
581
|
}
|
|
550
582
|
render() {
|
|
551
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-3-icon" }, index.h(index$
|
|
583
|
+
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.")))));
|
|
552
584
|
}
|
|
553
585
|
get el() { return index.getElement(this); }
|
|
554
586
|
};
|
|
@@ -584,6 +616,23 @@ const VviinnOverlayedModal = class {
|
|
|
584
616
|
};
|
|
585
617
|
VviinnOverlayedModal.style = vviinnOverlayedModalCss;
|
|
586
618
|
|
|
619
|
+
const vviinnPreloaderCss = ":host{--preloader-size:24px;--preloader-width:calc(var(--preloader-size) / 6);transform-origin:center;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}@keyframes rotate{from{transform:rotate(-360deg)}to{transform:rotate(360deg)}}";
|
|
620
|
+
|
|
621
|
+
const VviinnPreloader = class {
|
|
622
|
+
constructor(hostRef) {
|
|
623
|
+
index.registerInstance(this, hostRef);
|
|
624
|
+
}
|
|
625
|
+
isActive() {
|
|
626
|
+
return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
|
|
627
|
+
}
|
|
628
|
+
render() {
|
|
629
|
+
return (index.h(index.Host, { class: {
|
|
630
|
+
active: this.isActive(),
|
|
631
|
+
} }));
|
|
632
|
+
}
|
|
633
|
+
};
|
|
634
|
+
VviinnPreloader.style = vviinnPreloaderCss;
|
|
635
|
+
|
|
587
636
|
const vviinnPrivacyBadgeCss = ":host{display:block;background:#F4F4F4;padding:17px}.content{display:grid;grid-template-columns:min-content auto;grid-gap:9px}.content p{color:#525252;font-size:12px;line-height:16px;margin:unset}";
|
|
588
637
|
|
|
589
638
|
const VviinnPrivacyBadge = class {
|
|
@@ -600,6 +649,208 @@ const VviinnPrivacyBadge = class {
|
|
|
600
649
|
};
|
|
601
650
|
VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
|
|
602
651
|
|
|
652
|
+
class GtagAnalytics {
|
|
653
|
+
sendImpression(product) {
|
|
654
|
+
var _a, _b, _c;
|
|
655
|
+
gtag('event', 'view_item_list', {
|
|
656
|
+
items: [
|
|
657
|
+
{
|
|
658
|
+
id: product.productId,
|
|
659
|
+
name: product.title,
|
|
660
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
661
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
662
|
+
list_name: 'VI VPR View',
|
|
663
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
664
|
+
}
|
|
665
|
+
]
|
|
666
|
+
});
|
|
667
|
+
return undefined;
|
|
668
|
+
}
|
|
669
|
+
sendClick(product) {
|
|
670
|
+
var _a, _b, _c;
|
|
671
|
+
gtag('event', 'select_content', {
|
|
672
|
+
content_type: 'product',
|
|
673
|
+
items: [
|
|
674
|
+
{
|
|
675
|
+
id: product.productId,
|
|
676
|
+
name: product.title,
|
|
677
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
678
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
679
|
+
list_name: 'VI VPR View',
|
|
680
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
681
|
+
}
|
|
682
|
+
]
|
|
683
|
+
});
|
|
684
|
+
return undefined;
|
|
685
|
+
}
|
|
686
|
+
}
|
|
687
|
+
|
|
688
|
+
class GAnalytics {
|
|
689
|
+
constructor() {
|
|
690
|
+
ga('require', 'ec');
|
|
691
|
+
}
|
|
692
|
+
convertProduct(product) {
|
|
693
|
+
var _a, _b, _c;
|
|
694
|
+
return {
|
|
695
|
+
id: product.productId,
|
|
696
|
+
name: product.title,
|
|
697
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
698
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
699
|
+
list: 'VI VPR View',
|
|
700
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
sendImpression(product) {
|
|
704
|
+
ga('ec:addImpression', this.convertProduct(product));
|
|
705
|
+
return undefined;
|
|
706
|
+
}
|
|
707
|
+
sendClick(product) {
|
|
708
|
+
var _a, _b, _c;
|
|
709
|
+
ga('ec:addProduct', {
|
|
710
|
+
id: product.productId,
|
|
711
|
+
name: product.title,
|
|
712
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
713
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
714
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
715
|
+
});
|
|
716
|
+
ga('ec:setAction', 'click', { list: 'VI VPR View' });
|
|
717
|
+
return undefined;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
const getGtagAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.gtag), index$1.Option.map(() => new GtagAnalytics()));
|
|
722
|
+
const getCommonAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.ga), index$1.Option.map(() => new GAnalytics()));
|
|
723
|
+
const analyticsMonoid = index$1.Option.getMonoid(index$1.Semigroup.first());
|
|
724
|
+
const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
|
|
725
|
+
|
|
726
|
+
const FIT_EXPR = /fit\/\d+\//;
|
|
727
|
+
const containsFit = (url) => {
|
|
728
|
+
return index$1._function.pipe(url.match(FIT_EXPR), index$1.Either.fromNullable(url), index$1.Either.map(() => url));
|
|
729
|
+
};
|
|
730
|
+
const processWidth = (url, size) => {
|
|
731
|
+
return index$1._function.pipe(containsFit(url), index$1.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), index$1.Either.getOrElse(() => url));
|
|
732
|
+
};
|
|
733
|
+
const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
|
|
734
|
+
const FormattedPrice = (props) => {
|
|
735
|
+
const locale = props.locale;
|
|
736
|
+
const priceType = props.priceType;
|
|
737
|
+
const formattedPrice = new Intl.NumberFormat(locale, {
|
|
738
|
+
minimumFractionDigits: 2,
|
|
739
|
+
}).format(props.price);
|
|
740
|
+
const prefixElement = props.prefix ? (index.h("span", { part: "price-prefix" }, props.prefix + " ")) : null;
|
|
741
|
+
const currencyElement = props.currency ? (index.h("span", { part: "currency" }, " " + props.currency)) : null;
|
|
742
|
+
return (index.h("span", { class: "price-amount", part: `price-amount${priceType ? "-" + priceType : ""}` },
|
|
743
|
+
prefixElement,
|
|
744
|
+
formattedPrice,
|
|
745
|
+
currencyElement));
|
|
746
|
+
};
|
|
747
|
+
const Price = (props) => {
|
|
748
|
+
return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
|
|
749
|
+
index.h("span", { class: "price-sale", part: "price-sale" },
|
|
750
|
+
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale, priceType: "sale" })),
|
|
751
|
+
index.h("span", { class: "price-outdated", part: "price-outdated" },
|
|
752
|
+
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "outdated" })),
|
|
753
|
+
]) : (index.h("span", { class: "price-regular", part: "price-regular" },
|
|
754
|
+
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale, priceType: "regular" })))));
|
|
755
|
+
};
|
|
756
|
+
const Image = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
757
|
+
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 })));
|
|
758
|
+
const ResponsiveImage = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
759
|
+
index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
760
|
+
|
|
761
|
+
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}";
|
|
762
|
+
|
|
763
|
+
const VviinnProductCard = class {
|
|
764
|
+
constructor(hostRef) {
|
|
765
|
+
index.registerInstance(this, hostRef);
|
|
766
|
+
this.vviinnProductLoad = index.createEvent(this, "vviinnProductLoad", 7);
|
|
767
|
+
this.vviinnProductView = index.createEvent(this, "vviinnProductView", 7);
|
|
768
|
+
this.vviinnProductClick = index.createEvent(this, "vviinnProductClick", 7);
|
|
769
|
+
this.productData = null;
|
|
770
|
+
this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
|
|
771
|
+
this.brand = undefined;
|
|
772
|
+
this.currency = undefined;
|
|
773
|
+
this.deeplink = undefined;
|
|
774
|
+
this.image = undefined;
|
|
775
|
+
this.imageRatio = 1;
|
|
776
|
+
this.imageWidth = 200;
|
|
777
|
+
this.locale = undefined;
|
|
778
|
+
this.price = undefined;
|
|
779
|
+
this.pricePrefix = undefined;
|
|
780
|
+
this.productId = undefined;
|
|
781
|
+
this.productTitle = undefined;
|
|
782
|
+
this.productType = undefined;
|
|
783
|
+
this.salePrice = undefined;
|
|
784
|
+
this.responsive = false;
|
|
785
|
+
this.campaignTypeId = undefined;
|
|
786
|
+
this.dimmedBackground = false;
|
|
787
|
+
this.widgetElementId = undefined;
|
|
788
|
+
this.buttonElementId = undefined;
|
|
789
|
+
this.widgetVersion = undefined;
|
|
790
|
+
this.index = 0;
|
|
791
|
+
this.imageLoaded = false;
|
|
792
|
+
}
|
|
793
|
+
connectedCallback() {
|
|
794
|
+
this.productData = this.getProductData();
|
|
795
|
+
}
|
|
796
|
+
getWidgetType() {
|
|
797
|
+
return this.campaignTypeId === "VPR" || this.campaignTypeId === "VCS"
|
|
798
|
+
? "VPR"
|
|
799
|
+
: "VPS";
|
|
800
|
+
}
|
|
801
|
+
getProductData() {
|
|
802
|
+
var _a;
|
|
803
|
+
return {
|
|
804
|
+
productId: this.productId,
|
|
805
|
+
productRank: this.index,
|
|
806
|
+
productName: this.productTitle,
|
|
807
|
+
productType: this.productType,
|
|
808
|
+
widgetType: this.getWidgetType(),
|
|
809
|
+
campaignTypeId: this.campaignTypeId,
|
|
810
|
+
campaignTypeName: Campaign.campaignTypeNames[this.campaignTypeId],
|
|
811
|
+
widgetId: (_a = this.buttonElementId) !== null && _a !== void 0 ? _a : this.widgetElementId,
|
|
812
|
+
widgetVersion: this.widgetVersion,
|
|
813
|
+
};
|
|
814
|
+
}
|
|
815
|
+
intersectionCallback(data) {
|
|
816
|
+
if (data.some((entry) => entry.isIntersecting)) {
|
|
817
|
+
index$1._function.pipe(getAnalyticsModule, index$1.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
|
|
818
|
+
this.vviinnProductView.emit(this.productData);
|
|
819
|
+
this.intersectionObserver.disconnect();
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
componentDidLoad() {
|
|
823
|
+
this.vviinnProductLoad.emit(this.productData);
|
|
824
|
+
this.intersectionObserver.observe(this.el);
|
|
825
|
+
const links = this.el.shadowRoot.querySelectorAll("a");
|
|
826
|
+
links.forEach((link) => link.addEventListener("click", (event) => {
|
|
827
|
+
event.preventDefault();
|
|
828
|
+
event.stopImmediatePropagation();
|
|
829
|
+
this.vviinnProductClick.emit(this.productData);
|
|
830
|
+
index$1._function.pipe(getAnalyticsModule, index$1.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
|
|
831
|
+
}));
|
|
832
|
+
}
|
|
833
|
+
getProduct() {
|
|
834
|
+
return index$1.imageSearchState.results.find((r) => r.productId === this.productId);
|
|
835
|
+
}
|
|
836
|
+
renderImage() {
|
|
837
|
+
const props = {
|
|
838
|
+
width: this.imageWidth,
|
|
839
|
+
height: this.imageWidth * this.imageRatio,
|
|
840
|
+
src: this.image,
|
|
841
|
+
title: this.productTitle,
|
|
842
|
+
lazy: false,
|
|
843
|
+
};
|
|
844
|
+
return this.responsive ? ResponsiveImage(props) : Image(props);
|
|
845
|
+
}
|
|
846
|
+
render() {
|
|
847
|
+
var _a, _b, _c;
|
|
848
|
+
return (index.h(index.Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount-sale, price-amount-outdated, price-amount-regular, price-container, price-outdated, price-regular, price-sale, price-prefix, title" }, index.h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), index.h(Linked, { deeplink: this.deeplink, part: "deeplink" }, index.h("span", { class: "title", part: "title" }, this.productTitle)), index.h("span", { class: "brand", part: "brand" }, this.brand), index.h("span", { class: "type", part: "type" }, this.productType), index.h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : index$1.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : index$1.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : index$1.state.locale })));
|
|
849
|
+
}
|
|
850
|
+
get el() { return index.getElement(this); }
|
|
851
|
+
};
|
|
852
|
+
VviinnProductCard.style = vviinnProductCardCss;
|
|
853
|
+
|
|
603
854
|
const vviinnServerErrorCss = ":host{display:block}";
|
|
604
855
|
|
|
605
856
|
const VviinnServerError = class {
|
|
@@ -633,7 +884,7 @@ const getStyleMap = (data) => {
|
|
|
633
884
|
};
|
|
634
885
|
};
|
|
635
886
|
const Arrow = ({ kind, tabindex, disabled, onClick, onKeyDown, }) => (index.h("div", { class: getStyleMap({ kind, disabled }), onClick: onClick, tabindex: tabindex, onKeyDown: onKeyDown },
|
|
636
|
-
index.h(index$
|
|
887
|
+
index.h(index$2.ArrowIcon, null)));
|
|
637
888
|
|
|
638
889
|
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), 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}";
|
|
639
890
|
|
|
@@ -642,7 +893,7 @@ const VviinnSlider = class {
|
|
|
642
893
|
index.registerInstance(this, hostRef);
|
|
643
894
|
this.elementsCount = 0;
|
|
644
895
|
this.internalPosition = 0;
|
|
645
|
-
this.swipeStartPosition =
|
|
896
|
+
this.swipeStartPosition = index$1.Option.none;
|
|
646
897
|
this.isRTL = false;
|
|
647
898
|
this.showBullets = true;
|
|
648
899
|
this.position = 0;
|
|
@@ -676,7 +927,7 @@ const VviinnSlider = class {
|
|
|
676
927
|
this.setActiveCssClassToSlide(index);
|
|
677
928
|
}
|
|
678
929
|
renderBullets() {
|
|
679
|
-
return this.showBullets ? (index.h("div", { class: "controls" },
|
|
930
|
+
return this.showBullets ? (index.h("div", { class: "controls" }, index$1.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
|
|
680
931
|
bullet: true,
|
|
681
932
|
active: i == Math.abs(this.internalPosition) % this.elementsCount,
|
|
682
933
|
}, onClick: () => this.goToSlide(i) }))))) : null;
|
|
@@ -717,13 +968,13 @@ const VviinnSlider = class {
|
|
|
717
968
|
handleTouchStart(event) {
|
|
718
969
|
if (!this.showBullets)
|
|
719
970
|
return;
|
|
720
|
-
this.swipeStartPosition =
|
|
971
|
+
this.swipeStartPosition = index$1._function.pipe(event.touches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
|
|
721
972
|
}
|
|
722
973
|
handleTouchEnd(event) {
|
|
723
974
|
if (!this.showBullets)
|
|
724
975
|
return;
|
|
725
|
-
const swipeEndPosition =
|
|
726
|
-
|
|
976
|
+
const swipeEndPosition = index$1._function.pipe(event.changedTouches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
|
|
977
|
+
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) => {
|
|
727
978
|
switch (swipeDirection) {
|
|
728
979
|
case 1:
|
|
729
980
|
return this.nextSlide();
|
|
@@ -763,6 +1014,264 @@ const VviinnTeaser = class {
|
|
|
763
1014
|
};
|
|
764
1015
|
VviinnTeaser.style = vviinnTeaserCss;
|
|
765
1016
|
|
|
1017
|
+
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: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: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: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:min-content auto}.image{margin-bottom:8px}.image-wrapper{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}";
|
|
1018
|
+
|
|
1019
|
+
var __rest = (undefined && undefined.__rest) || function (s, e) {
|
|
1020
|
+
var t = {};
|
|
1021
|
+
for (var p in s)
|
|
1022
|
+
if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
1023
|
+
t[p] = s[p];
|
|
1024
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
1025
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
1026
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
1027
|
+
t[p[i]] = s[p[i]];
|
|
1028
|
+
}
|
|
1029
|
+
return t;
|
|
1030
|
+
};
|
|
1031
|
+
const filterInt = (value) => /^[-+]?(\d+|Infinity)$/.test(value) ? Number(value) : NaN;
|
|
1032
|
+
const notEmptyString = (s) => !index$1.isEmpty(s);
|
|
1033
|
+
const notNan = (n) => !isNaN(n);
|
|
1034
|
+
const VviinnVpsWidget = class {
|
|
1035
|
+
constructor(hostRef) {
|
|
1036
|
+
index.registerInstance(this, hostRef);
|
|
1037
|
+
this.globalSlotsChanged = index.createEvent(this, "globalSlotsChanged", 7);
|
|
1038
|
+
this.vviinnWidgetLoad = index.createEvent(this, "vviinnWidgetLoad", 7);
|
|
1039
|
+
this.vviinnWidgetOpen = index.createEvent(this, "vviinnWidgetOpen", 7);
|
|
1040
|
+
this.vviinnWidgetClose = index.createEvent(this, "vviinnWidgetClose", 7);
|
|
1041
|
+
this.vviinnProductClick = index.createEvent(this, "vviinnProductClick", 7);
|
|
1042
|
+
this.vviinnProductView = index.createEvent(this, "vviinnProductView", 7);
|
|
1043
|
+
this.vviinnProductLoad = index.createEvent(this, "vviinnProductLoad", 7);
|
|
1044
|
+
this.vviinnImageUpload = index.createEvent(this, "vviinnImageUpload", 7);
|
|
1045
|
+
this.vviinnImageCrop = index.createEvent(this, "vviinnImageCrop", 7);
|
|
1046
|
+
this.vviinnSelectObject = index.createEvent(this, "vviinnSelectObject", 7);
|
|
1047
|
+
this.vviinnSelectFilter = index.createEvent(this, "vviinnSelectFilter", 7);
|
|
1048
|
+
this.vviinnNoResult = index.createEvent(this, "vviinnNoResult", 7);
|
|
1049
|
+
this.imageSource = null;
|
|
1050
|
+
this.setTrackingDeactivated = (result) => {
|
|
1051
|
+
if (result.status === "rejected") {
|
|
1052
|
+
this.trackingDeactivated = true;
|
|
1053
|
+
}
|
|
1054
|
+
};
|
|
1055
|
+
this.getBasicEventData = () => {
|
|
1056
|
+
var _a;
|
|
1057
|
+
return {
|
|
1058
|
+
widgetType: "VPS",
|
|
1059
|
+
campaignTypeId: "VPS",
|
|
1060
|
+
campaignTypeName: Campaign.campaignTypeNames["VPS"],
|
|
1061
|
+
widgetId: (_a = this.buttonElementId) !== null && _a !== void 0 ? _a : this.id,
|
|
1062
|
+
widgetVersion: _package.version,
|
|
1063
|
+
};
|
|
1064
|
+
};
|
|
1065
|
+
this.token = undefined;
|
|
1066
|
+
this.apiPath = "https://api.vviinn.com";
|
|
1067
|
+
this.active = false;
|
|
1068
|
+
this.currencySign = "€";
|
|
1069
|
+
this.locale = "de-DE";
|
|
1070
|
+
this.campaignId = undefined;
|
|
1071
|
+
this.showingInButton = false;
|
|
1072
|
+
this.buttonElementId = undefined;
|
|
1073
|
+
this.buttonPressed = undefined;
|
|
1074
|
+
this.mode = "modal";
|
|
1075
|
+
this.resetVpsButton = undefined;
|
|
1076
|
+
this.slidePosition = 0;
|
|
1077
|
+
this.width = 0;
|
|
1078
|
+
this.wrongImageFormat = false;
|
|
1079
|
+
this.trackingDeactivated = false;
|
|
1080
|
+
}
|
|
1081
|
+
componentDidLoad() {
|
|
1082
|
+
const slots = this.el.querySelectorAll("[slot]");
|
|
1083
|
+
this.globalSlotsChanged.emit(Array.from(slots));
|
|
1084
|
+
}
|
|
1085
|
+
activeWatcher(value) {
|
|
1086
|
+
if (value) {
|
|
1087
|
+
this.overflow = document.body.style.overflow;
|
|
1088
|
+
document.body.style.overflow = "hidden";
|
|
1089
|
+
this.trackOpenEvent();
|
|
1090
|
+
}
|
|
1091
|
+
else {
|
|
1092
|
+
document.body.style.overflow = this.overflow;
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
buttonPressedWatcher(pressed) {
|
|
1096
|
+
if (!pressed)
|
|
1097
|
+
return;
|
|
1098
|
+
if (this.mode === "modal") {
|
|
1099
|
+
this.active = true;
|
|
1100
|
+
this.vviinnWidgetOpen.emit(this.getBasicEventData());
|
|
1101
|
+
}
|
|
1102
|
+
}
|
|
1103
|
+
trackProductView({ detail }) {
|
|
1104
|
+
if (this.trackingDeactivated)
|
|
1105
|
+
return;
|
|
1106
|
+
const { productRank, productId, productName, widgetType, widgetId, campaignTypeId, campaignTypeName } = detail, rest = __rest(detail, ["productRank", "productId", "productName", "widgetType", "widgetId", "campaignTypeId", "campaignTypeName"]);
|
|
1107
|
+
const productViewEvent = index$1.createProductViewVpsEvent(Object.assign({ session_id: this.uiSessionId, rank: productRank, product: productId }, rest));
|
|
1108
|
+
this.trackingApi
|
|
1109
|
+
.trackEvent(productViewEvent)
|
|
1110
|
+
.then(this.setTrackingDeactivated);
|
|
1111
|
+
}
|
|
1112
|
+
async trackProductClick({ detail }) {
|
|
1113
|
+
const { productRank, productId, productName, widgetType, widgetId, campaignTypeId, campaignTypeName } = detail, rest = __rest(detail, ["productRank", "productId", "productName", "widgetType", "widgetId", "campaignTypeId", "campaignTypeName"]);
|
|
1114
|
+
const productClickEvent = index$1.createProductClickVpsEvent(Object.assign({ session_id: this.uiSessionId, rank: productRank, product: productId }, rest));
|
|
1115
|
+
const product = index$1.imageSearchState.results.find((r) => r.productId === detail.productId);
|
|
1116
|
+
if (!product || !product.deeplink)
|
|
1117
|
+
return;
|
|
1118
|
+
if (!this.trackingDeactivated) {
|
|
1119
|
+
await this.trackingApi
|
|
1120
|
+
.trackEvent(this.trackingDeactivated ? null : productClickEvent)
|
|
1121
|
+
.then(this.setTrackingDeactivated)
|
|
1122
|
+
.finally(() => {
|
|
1123
|
+
window.location.href = product.deeplink;
|
|
1124
|
+
});
|
|
1125
|
+
}
|
|
1126
|
+
else {
|
|
1127
|
+
window.location.href = product.deeplink;
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
trachSearchAreaChanges() {
|
|
1131
|
+
if (this.trackingDeactivated)
|
|
1132
|
+
return;
|
|
1133
|
+
const searchEvent = index$1.createSearchEvent({
|
|
1134
|
+
session_id: this.uiSessionId,
|
|
1135
|
+
source: this.imageSource,
|
|
1136
|
+
search_area: "manual-selection",
|
|
1137
|
+
});
|
|
1138
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1139
|
+
}
|
|
1140
|
+
trackDetectedObject() {
|
|
1141
|
+
if (this.trackingDeactivated)
|
|
1142
|
+
return;
|
|
1143
|
+
const searchEvent = index$1.createSearchEvent({
|
|
1144
|
+
session_id: this.uiSessionId,
|
|
1145
|
+
source: this.imageSource,
|
|
1146
|
+
search_area: "attention-point",
|
|
1147
|
+
});
|
|
1148
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1149
|
+
}
|
|
1150
|
+
trackFilter({ detail }) {
|
|
1151
|
+
if (this.trackingDeactivated)
|
|
1152
|
+
return;
|
|
1153
|
+
const searchEvent = index$1.createFilterEvent({
|
|
1154
|
+
session_id: this.uiSessionId,
|
|
1155
|
+
source: this.imageSource,
|
|
1156
|
+
kind: "category",
|
|
1157
|
+
action: detail.action,
|
|
1158
|
+
});
|
|
1159
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1160
|
+
}
|
|
1161
|
+
connectedCallback() {
|
|
1162
|
+
index$1.state.apiPath = this.apiPath;
|
|
1163
|
+
index$1.state.currencySign = this.currencySign;
|
|
1164
|
+
index$1.state.locale = this.locale;
|
|
1165
|
+
index$1.imageSearchState.token = this.token;
|
|
1166
|
+
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}`));
|
|
1167
|
+
this.uiSessionId = index$1.v4();
|
|
1168
|
+
this.trackingApi = index$1.createTrackingApi(this.apiPath, this.token);
|
|
1169
|
+
this.id = this.el.id;
|
|
1170
|
+
}
|
|
1171
|
+
componentWillLoad() {
|
|
1172
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
1173
|
+
this.vviinnWidgetLoad.emit(this.getBasicEventData());
|
|
1174
|
+
}
|
|
1175
|
+
trackOpenEvent() {
|
|
1176
|
+
if (this.trackingDeactivated)
|
|
1177
|
+
return;
|
|
1178
|
+
const widgetOpenEvent = index$1.createWidgetVpsEvent({
|
|
1179
|
+
action: "open",
|
|
1180
|
+
session_id: this.uiSessionId,
|
|
1181
|
+
});
|
|
1182
|
+
this.trackingApi
|
|
1183
|
+
.trackEvent(widgetOpenEvent)
|
|
1184
|
+
.then(this.setTrackingDeactivated);
|
|
1185
|
+
}
|
|
1186
|
+
handleImageSelection(source) {
|
|
1187
|
+
this.imageSource = source;
|
|
1188
|
+
this.slidePosition = 1;
|
|
1189
|
+
const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
|
|
1190
|
+
const overlay = root.shadowRoot.querySelector("vviinn-overlay");
|
|
1191
|
+
const modal = overlay.querySelector("vviinn-modal");
|
|
1192
|
+
const modalBody = modal.shadowRoot.querySelector(".body");
|
|
1193
|
+
modalBody.scrollTop = 0;
|
|
1194
|
+
this.trackInitialSearch();
|
|
1195
|
+
}
|
|
1196
|
+
trackInitialSearch() {
|
|
1197
|
+
if (this.trackingDeactivated)
|
|
1198
|
+
return;
|
|
1199
|
+
const searchEvent = index$1.createSearchEvent({
|
|
1200
|
+
session_id: this.uiSessionId,
|
|
1201
|
+
source: this.imageSource,
|
|
1202
|
+
search_area: "full",
|
|
1203
|
+
});
|
|
1204
|
+
this.trackingApi.trackEvent(searchEvent).then(this.setTrackingDeactivated);
|
|
1205
|
+
}
|
|
1206
|
+
resetState() {
|
|
1207
|
+
this.resetScroll("onboarding-block");
|
|
1208
|
+
this.slidePosition = 0;
|
|
1209
|
+
index$1.imageSearchState.image = index$1.Option.none;
|
|
1210
|
+
index$1.imageSearchState.imageUrl = index$1.Option.none;
|
|
1211
|
+
index$1.imageSearchState.imageBounds = index$1.Option.none;
|
|
1212
|
+
index$1.imageSearchState.searchArea = index$1.Option.none;
|
|
1213
|
+
index$1.imageSearchState.results = [];
|
|
1214
|
+
index$1.imageSearchState.filters = [];
|
|
1215
|
+
index$1.imageSearchState.detectedObjects = [];
|
|
1216
|
+
index$1.imageSearchState.activeIonLink = undefined;
|
|
1217
|
+
index$1.imageSearchState.rectangleSearchForm = undefined;
|
|
1218
|
+
index$1.imageSearchState.loading = false;
|
|
1219
|
+
this.resetScroll("results-block");
|
|
1220
|
+
}
|
|
1221
|
+
haveErrors() {
|
|
1222
|
+
return this.wrongImageFormat || index$1.imageSearchState.serverError;
|
|
1223
|
+
}
|
|
1224
|
+
resetScroll(elementId, behavior = "auto") {
|
|
1225
|
+
const element = this.el.shadowRoot.getElementById(elementId);
|
|
1226
|
+
element.scroll({ top: 0, left: 0, behavior });
|
|
1227
|
+
}
|
|
1228
|
+
handleModalClose() {
|
|
1229
|
+
this.active = false;
|
|
1230
|
+
this.resetState();
|
|
1231
|
+
const elementsToReset = ["onboarding-block", "results-block"];
|
|
1232
|
+
elementsToReset.forEach((name) => this.resetScroll(name));
|
|
1233
|
+
if (this.trackingDeactivated)
|
|
1234
|
+
return;
|
|
1235
|
+
const widgetCloseEvent = index$1.createWidgetVpsEvent({
|
|
1236
|
+
action: "close",
|
|
1237
|
+
session_id: this.uiSessionId,
|
|
1238
|
+
});
|
|
1239
|
+
this.trackingApi
|
|
1240
|
+
.trackEvent(widgetCloseEvent)
|
|
1241
|
+
.then(this.setTrackingDeactivated);
|
|
1242
|
+
}
|
|
1243
|
+
render() {
|
|
1244
|
+
var _a;
|
|
1245
|
+
return (index.h(index.Host, null, !this.showingInButton && index.h(customizedSlots.SlotSkeleton, null), index.h("vviinn-overlayed-modal", { class: { "first-screen": this.slidePosition === 0 }, active: this.active, resetState: this.resetState.bind(this), onVviinnWidgetClose: () => this.handleModalClose(), buttonElementId: (_a = this.buttonElementId) !== null && _a !== void 0 ? _a : this.id, widgetVersion: _package.version, hideBackButton: this.mode === "upload", 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: {
|
|
1246
|
+
error: this.haveErrors(),
|
|
1247
|
+
"start-page_block": true,
|
|
1248
|
+
} }, index.h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, handler: () => (this.wrongImageFormat = false) }), index.h("vviinn-server-error", { class: { hidden: !index$1.imageSearchState.serverError }, handler: () => (index$1.imageSearchState.serverError = false) }), index.h("vviinn-teaser", { class: { hidden: this.haveErrors() } }), index.h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onVviinnImageUpload: () => {
|
|
1249
|
+
this.active = true;
|
|
1250
|
+
this.handleImageSelection("upload");
|
|
1251
|
+
if (this.mode === "upload") {
|
|
1252
|
+
this.vviinnWidgetOpen.emit(this.getBasicEventData());
|
|
1253
|
+
}
|
|
1254
|
+
}, onVviinnNoResult: () => (this.wrongImageFormat = true), resetVpsButton: this.resetVpsButton, basicEventData: this.getBasicEventData(), part: "select-image_button", startUpload: this.buttonPressed &&
|
|
1255
|
+
this.showingInButton &&
|
|
1256
|
+
this.mode === "upload" }, 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", onVviinnImageUpload: () => this.handleImageSelection("example"), onVviinnNoResult: () => this.resetScroll("onboarding-block", "smooth"), basicEventData: this.getBasicEventData() })))), index.h("vviinn-slide", { class: { "results-page": true, active: this.slidePosition == 1 } }, index.h("div", { class: "image-wrapper" }, index.h("vviinn-image-view", { basicEventData: this.getBasicEventData() }), index.h("div", { class: "filters-wrapper" }, index.h("div", { class: "filters" }, index$1.imageSearchState.filters.map((filter) => (index.h("search-filters", { filter: filter, basicEventData: this.getBasicEventData() })))))), index.h("div", { id: "results-block", class: "products-wrapper" }, index.h("div", { class: {
|
|
1257
|
+
"nothing-found": true,
|
|
1258
|
+
hidden: index$1.imageSearchState.results.length > 0,
|
|
1259
|
+
} }, index.h("vviinn-empty-results", null), index.h("vviinn-onboarding", null)), index.h("div", { class: {
|
|
1260
|
+
hidden: index$1.imageSearchState.results.length <= 0,
|
|
1261
|
+
products: true,
|
|
1262
|
+
} }, index$1.imageSearchState.results.map((p, i) => {
|
|
1263
|
+
var _a;
|
|
1264
|
+
return (index.h("vviinn-product-card", { key: p.productId, hidden: true, productTitle: p.title, productId: p.productId, productType: p.productType, 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", campaignTypeId: "VPS", index: i, widgetElementId: this.id, buttonElementId: this.buttonElementId, widgetVersion: _package.version }));
|
|
1265
|
+
}))))))));
|
|
1266
|
+
}
|
|
1267
|
+
get el() { return index.getElement(this); }
|
|
1268
|
+
static get watchers() { return {
|
|
1269
|
+
"active": ["activeWatcher"],
|
|
1270
|
+
"buttonPressed": ["buttonPressedWatcher"]
|
|
1271
|
+
}; }
|
|
1272
|
+
};
|
|
1273
|
+
VviinnVpsWidget.style = vviinnVpsWidgetCss;
|
|
1274
|
+
|
|
766
1275
|
const vviinnWrongFormatCss = ":host{display:block}";
|
|
767
1276
|
|
|
768
1277
|
const VviinnWrongFormat = class {
|
|
@@ -776,11 +1285,13 @@ const VviinnWrongFormat = class {
|
|
|
776
1285
|
};
|
|
777
1286
|
VviinnWrongFormat.style = vviinnWrongFormatCss;
|
|
778
1287
|
|
|
1288
|
+
exports.cropper_handler = CropperHandler;
|
|
779
1289
|
exports.highlight_box = HighlightBox;
|
|
780
1290
|
exports.image_cropper = ImageCropper;
|
|
781
1291
|
exports.search_filters = SearchFilters;
|
|
782
1292
|
exports.vviinn_detected_object = VviinnDetectedObject;
|
|
783
1293
|
exports.vviinn_empty_results = VviinnEmptyResults;
|
|
1294
|
+
exports.vviinn_error = VviinnError;
|
|
784
1295
|
exports.vviinn_example_image = VviinnExampleImage;
|
|
785
1296
|
exports.vviinn_example_images = VviinnExampleImages;
|
|
786
1297
|
exports.vviinn_image_selector = VviinnImageSelector;
|
|
@@ -792,9 +1303,12 @@ exports.vviinn_onboarding_card_2 = VviinnOnboardingCard2;
|
|
|
792
1303
|
exports.vviinn_onboarding_card_3 = VviinnOnboardingCard3;
|
|
793
1304
|
exports.vviinn_overlay = VviinnOverlay;
|
|
794
1305
|
exports.vviinn_overlayed_modal = VviinnOverlayedModal;
|
|
1306
|
+
exports.vviinn_preloader = VviinnPreloader;
|
|
795
1307
|
exports.vviinn_privacy_badge = VviinnPrivacyBadge;
|
|
1308
|
+
exports.vviinn_product_card = VviinnProductCard;
|
|
796
1309
|
exports.vviinn_server_error = VviinnServerError;
|
|
797
1310
|
exports.vviinn_slide = VviinnSlide;
|
|
798
1311
|
exports.vviinn_slider = VviinnSlider;
|
|
799
1312
|
exports.vviinn_teaser = VviinnTeaser;
|
|
1313
|
+
exports.vviinn_vps_widget = VviinnVpsWidget;
|
|
800
1314
|
exports.vviinn_wrong_format = VviinnWrongFormat;
|