vviinn-widgets 2.0.0 → 2.2.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/Handler-d1a8a86a.js +329 -0
- package/dist/cjs/{app-globals-de6924b5.js → app-globals-d0251be8.js} +1 -1
- package/dist/cjs/cropper-handler.cjs.entry.js +27 -0
- package/dist/cjs/customized-slots-14b77e4a.js +53 -0
- package/dist/cjs/{cropper-handler_28.cjs.entry.js → highlight-box_22.cjs.entry.js} +48 -437
- package/dist/{esm/Array-e81cf4a3.js → cjs/imageSearch.store-d9ed1a5b.js} +10009 -3391
- package/dist/cjs/{index-7adce49f.js → index-141137b2.js} +14 -362
- package/dist/cjs/{index-8a276115.js → index-a5e15a0c.js} +7 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/vviinn-carousel_5.cjs.entry.js +1232 -0
- package/dist/cjs/vviinn-error.cjs.entry.js +19 -0
- package/dist/cjs/vviinn-preloader.cjs.entry.js +26 -0
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +43 -0
- package/dist/cjs/vviinn-vps-widget.cjs.entry.js +97 -0
- package/dist/cjs/vviinn-widgets.cjs.js +3 -3
- package/dist/collection/collection-manifest.json +2 -0
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.css +22 -18
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +78 -68
- package/dist/collection/components/vviinn-icons/index.js +4 -0
- package/dist/collection/components/vviinn-product-card/render-helpers.js +4 -4
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.css +5 -6
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +26 -5
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.css +238 -0
- package/dist/collection/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.js +200 -0
- package/dist/collection/components/vviinn-vpr-button/stories/kek.stories.js +18 -0
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.css +35 -0
- package/dist/collection/components/vviinn-vpr-button/vviinn-vpr-button.js +149 -0
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +148 -28
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +31 -8
- package/dist/esm/Handler-639a4cb3.js +308 -0
- package/dist/esm/{app-globals-0a626970.js → app-globals-b6113170.js} +1 -1
- package/dist/esm/cropper-handler.entry.js +23 -0
- package/dist/esm/customized-slots-a952fb80.js +50 -0
- package/dist/esm/{cropper-handler_28.entry.js → highlight-box_22.entry.js} +21 -404
- package/dist/{cjs/Array-cce2fde8.js → esm/imageSearch.store-4ca31230.js} +8705 -2137
- package/dist/esm/{index-e77e65ae.js → index-017f18de.js} +6 -2
- package/dist/esm/{index-0ccfcee5.js → index-3e85e294.js} +14 -362
- package/dist/esm/loader.js +3 -3
- package/dist/esm/vviinn-carousel_5.entry.js +1224 -0
- package/dist/esm/vviinn-error.entry.js +15 -0
- package/dist/esm/vviinn-preloader.entry.js +22 -0
- package/dist/esm/vviinn-vps-button.entry.js +39 -0
- package/dist/esm/vviinn-vps-widget.entry.js +93 -0
- package/dist/esm/vviinn-widgets.js +3 -3
- package/dist/types/campaign/Campaign.d.ts +1 -1
- package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +13 -7
- package/dist/types/components/vviinn-icons/index.d.ts +2 -0
- package/dist/types/components/vviinn-product-card/render-helpers.d.ts +3 -2
- package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +2 -0
- package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +25 -0
- package/dist/types/components/vviinn-vpr-button/stories/kek.stories.d.ts +7 -0
- package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +14 -0
- package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +36 -8
- package/dist/types/components.d.ts +62 -10
- package/dist/vviinn-widgets/p-0ed1ef7e.entry.js +1 -0
- package/dist/vviinn-widgets/{p-6c4fd1db.js → p-16e49514.js} +1 -1
- package/dist/vviinn-widgets/p-3da18d7f.js +1 -0
- package/dist/vviinn-widgets/p-62a1b042.entry.js +1 -0
- package/dist/vviinn-widgets/p-68900093.entry.js +1 -0
- package/dist/vviinn-widgets/p-6c4c240d.entry.js +1 -0
- package/dist/vviinn-widgets/p-95e53d99.entry.js +1 -0
- package/dist/vviinn-widgets/p-9fee20e7.entry.js +1 -0
- package/dist/vviinn-widgets/p-d7894eaf.js +1 -0
- package/dist/vviinn-widgets/p-db0be4cd.js +1 -0
- package/dist/vviinn-widgets/p-eb15116d.entry.js +1 -0
- package/dist/vviinn-widgets/{p-489aee23.js → p-f00fddbb.js} +1 -1
- package/dist/vviinn-widgets/p-f582db5c.js +1 -0
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +3 -1
- package/www/build/p-0ed1ef7e.entry.js +1 -0
- package/www/build/{p-6c4fd1db.js → p-16e49514.js} +1 -1
- package/www/build/p-1cc0cdfd.js +1 -0
- package/www/build/p-3da18d7f.js +1 -0
- package/www/build/p-62a1b042.entry.js +1 -0
- package/www/build/p-68900093.entry.js +1 -0
- package/www/build/p-6c4c240d.entry.js +1 -0
- package/www/build/p-95e53d99.entry.js +1 -0
- package/www/build/p-9fee20e7.entry.js +1 -0
- package/www/build/p-a67898be.css +1 -0
- package/www/build/p-d7894eaf.js +1 -0
- package/www/build/p-db0be4cd.js +1 -0
- package/www/build/p-eb15116d.entry.js +1 -0
- package/www/build/{p-489aee23.js → p-f00fddbb.js} +1 -1
- package/www/build/p-f582db5c.js +1 -0
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +177 -8
- package/dist/cjs/imageSearch.store-39fce56c.js +0 -6926
- package/dist/cjs/vviinn-carousel.cjs.entry.js +0 -222
- package/dist/cjs/vviinn-vpr-widget.cjs.entry.js +0 -106
- package/dist/esm/imageSearch.store-b887ff78.js +0 -6893
- package/dist/esm/vviinn-carousel.entry.js +0 -218
- package/dist/esm/vviinn-vpr-widget.entry.js +0 -102
- package/dist/vviinn-widgets/p-2bf74c28.js +0 -1
- package/dist/vviinn-widgets/p-3063e23a.js +0 -1
- package/dist/vviinn-widgets/p-9145c82e.entry.js +0 -1
- package/dist/vviinn-widgets/p-ddcac3f8.js +0 -1
- package/dist/vviinn-widgets/p-f05da9f1.entry.js +0 -1
- package/dist/vviinn-widgets/p-f12f823d.entry.js +0 -1
- package/www/build/p-2bf74c28.js +0 -1
- package/www/build/p-3063e23a.js +0 -1
- package/www/build/p-9145c82e.entry.js +0 -1
- package/www/build/p-cbae3071.js +0 -125
- package/www/build/p-ddcac3f8.js +0 -1
- package/www/build/p-e0153ae2.css +0 -6
- package/www/build/p-f05da9f1.entry.js +0 -1
- package/www/build/p-f12f823d.entry.js +0 -1
|
@@ -2,44 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const imageSearch_store = require('./imageSearch.store-
|
|
7
|
-
const
|
|
8
|
-
const index$1 = require('./index-
|
|
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 ${imageSearch_store.getCursorValue(this.handler.direction)}`, class: {
|
|
19
|
-
disabled: this.disabled,
|
|
20
|
-
[imageSearch_store.getCursorValue(this.handler.direction)]: true,
|
|
21
|
-
}, style: {
|
|
22
|
-
"--size": "20px",
|
|
23
|
-
cursor: imageSearch_store.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));
|
|
5
|
+
const index = require('./index-141137b2.js');
|
|
6
|
+
const imageSearch_store = require('./imageSearch.store-d9ed1a5b.js');
|
|
7
|
+
const Handler = require('./Handler-d1a8a86a.js');
|
|
8
|
+
const index$1 = require('./index-a5e15a0c.js');
|
|
9
|
+
const customizedSlots = require('./customized-slots-14b77e4a.js');
|
|
43
10
|
|
|
44
11
|
// -------------------------------------------------------------------------------------
|
|
45
12
|
// -------------------------------------------------------------------------------------
|
|
@@ -61,6 +28,21 @@ var Ord = {
|
|
|
61
28
|
compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
|
|
62
29
|
};
|
|
63
30
|
|
|
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
|
+
|
|
64
46
|
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)}}";
|
|
65
47
|
|
|
66
48
|
let HighlightBox = class {
|
|
@@ -68,10 +50,10 @@ let HighlightBox = class {
|
|
|
68
50
|
index.registerInstance(this, hostRef);
|
|
69
51
|
}
|
|
70
52
|
getInsetValue() {
|
|
71
|
-
return
|
|
53
|
+
return Handler.pipe(imageSearch_store.sequenceToOption(imageSearch_store.imageSearchState.searchArea, imageSearch_store.imageSearchState.imageBounds), imageSearch_store.Option.map(([selection, image]) => getClipValue(selection, image)), imageSearch_store.Option.getOrElse(() => ""));
|
|
72
54
|
}
|
|
73
55
|
renderImage() {
|
|
74
|
-
return
|
|
56
|
+
return Handler.pipe(imageSearch_store.sequenceToOption(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.imageSearchState.imageBounds), imageSearch_store.Option.map(([url, bounds]) => (index.h("img", { src: url, width: bounds.width, height: bounds.height, style: { "clip-path": `${this.getInsetValue()}` } }))), imageSearch_store.Option.getOrElse(() => ""));
|
|
75
57
|
}
|
|
76
58
|
render() {
|
|
77
59
|
return index.h(index.Host, null, this.renderImage());
|
|
@@ -100,13 +82,13 @@ let ImageCropper = class {
|
|
|
100
82
|
handleHandlerMove(event) {
|
|
101
83
|
event.preventDefault();
|
|
102
84
|
event.stopPropagation();
|
|
103
|
-
const destination =
|
|
104
|
-
const distance =
|
|
85
|
+
const destination = Handler.fromMouseEvent(event);
|
|
86
|
+
const distance = Handler.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
105
87
|
const transformedHandler = {
|
|
106
88
|
position: distance,
|
|
107
89
|
direction: this.handlerMoveDirection,
|
|
108
90
|
};
|
|
109
|
-
|
|
91
|
+
imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((area) => {
|
|
110
92
|
const newSearchArea = imageSearch_store.transform(area, transformedHandler);
|
|
111
93
|
if (newSearchArea.width < MIN_SEARCHAREA_SIZE ||
|
|
112
94
|
newSearchArea.height < MIN_SEARCHAREA_SIZE ||
|
|
@@ -123,9 +105,9 @@ let ImageCropper = class {
|
|
|
123
105
|
handleCropperMove(ev) {
|
|
124
106
|
ev.preventDefault();
|
|
125
107
|
ev.stopPropagation();
|
|
126
|
-
const destination =
|
|
127
|
-
const distance =
|
|
128
|
-
|
|
108
|
+
const destination = Handler.fromMouseEvent(ev);
|
|
109
|
+
const distance = Handler.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
110
|
+
imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((searchArea) => {
|
|
129
111
|
const newSearchArea = imageSearch_store.move(searchArea, distance);
|
|
130
112
|
if (newSearchArea.x < 0 ||
|
|
131
113
|
newSearchArea.y < 0 ||
|
|
@@ -139,7 +121,7 @@ let ImageCropper = class {
|
|
|
139
121
|
}
|
|
140
122
|
handlePointerDown(event) {
|
|
141
123
|
event.stopPropagation();
|
|
142
|
-
this.mouseStartPoint =
|
|
124
|
+
this.mouseStartPoint = Handler.fromMouseEvent(event);
|
|
143
125
|
// should be htmlelement or handler
|
|
144
126
|
const target = findTarget(event);
|
|
145
127
|
if (target.localName === "cropper-handler") {
|
|
@@ -162,7 +144,7 @@ let ImageCropper = class {
|
|
|
162
144
|
imageSearch_store.makeRectangularSearchRequest();
|
|
163
145
|
}
|
|
164
146
|
getStyleMap() {
|
|
165
|
-
return
|
|
147
|
+
return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.searchArea, imageSearch_store.Option.map((rectangle) => {
|
|
166
148
|
return {
|
|
167
149
|
width: `${rectangle.width}px`,
|
|
168
150
|
height: `${rectangle.height}px`,
|
|
@@ -256,14 +238,14 @@ let VviinnDetectedObject = class {
|
|
|
256
238
|
this.position = ["0", "0"];
|
|
257
239
|
}
|
|
258
240
|
getObjectPosition() {
|
|
259
|
-
return
|
|
241
|
+
return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageBounds, imageSearch_store.Option.map((bounds) => {
|
|
260
242
|
const objectRectangle = imageSearch_store.fromAlt(imageSearch_store.foldValueObject(this.detectedObject).rectangle);
|
|
261
|
-
const { x, y } =
|
|
243
|
+
const { x, y } = imageSearch_store._function.pipe(objectRectangle, imageSearch_store.scaleWithSized(bounds), imageSearch_store.center);
|
|
262
244
|
return [`${x}px`, `${y}px`];
|
|
263
245
|
}), imageSearch_store.Option.getOrElse(() => ["0", "0"]));
|
|
264
246
|
}
|
|
265
247
|
selectDetectedObject() {
|
|
266
|
-
|
|
248
|
+
imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageBounds, imageSearch_store.Option.map((bounds) => {
|
|
267
249
|
const rectangle = imageSearch_store.foldValueObject(this.detectedObject).rectangle;
|
|
268
250
|
const transformedRect = imageSearch_store.fromAlt(rectangle);
|
|
269
251
|
const scaledRect = imageSearch_store.scaleWithSized(bounds)(transformedRect);
|
|
@@ -305,18 +287,6 @@ let VviinnEmptyResults = class {
|
|
|
305
287
|
};
|
|
306
288
|
VviinnEmptyResults.style = vviinnEmptyResultsCss;
|
|
307
289
|
|
|
308
|
-
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}";
|
|
309
|
-
|
|
310
|
-
let VviinnError = class {
|
|
311
|
-
constructor(hostRef) {
|
|
312
|
-
index.registerInstance(this, hostRef);
|
|
313
|
-
}
|
|
314
|
-
render() {
|
|
315
|
-
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" })));
|
|
316
|
-
}
|
|
317
|
-
};
|
|
318
|
-
VviinnError.style = vviinnErrorCss;
|
|
319
|
-
|
|
320
290
|
const vviinnExampleImageCss = ":host{display:block;margin-bottom:8px;position:relative}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;pointer-events:none;position:absolute;right:12px;z-index:4}vviinn-preloader{--preloader-size:12px}@media (max-width: 640px){.image-preloader{display:block}}";
|
|
321
291
|
|
|
322
292
|
let VviinnExampleImage = class {
|
|
@@ -333,7 +303,7 @@ let VviinnExampleImage = class {
|
|
|
333
303
|
this.selected = true;
|
|
334
304
|
const file = await imageSearch_store.toFile(this.src);
|
|
335
305
|
const processResult = await imageSearch_store.processSelectedFile(file);
|
|
336
|
-
|
|
306
|
+
imageSearch_store._function.pipe(processResult, imageSearch_store.Either.match(() => this.exampleImageError.emit(), () => this.exampleImageSelected.emit()));
|
|
337
307
|
this.selected = false;
|
|
338
308
|
}
|
|
339
309
|
showPreloader() {
|
|
@@ -347,53 +317,6 @@ let VviinnExampleImage = class {
|
|
|
347
317
|
};
|
|
348
318
|
VviinnExampleImage.style = vviinnExampleImageCss;
|
|
349
319
|
|
|
350
|
-
const defaultSlotsNames = [
|
|
351
|
-
"vviinn-onboarding-title",
|
|
352
|
-
"vviinn-onboarding-card-1-icon",
|
|
353
|
-
"vviinn-onboarding-card-1-text",
|
|
354
|
-
"vviinn-onboarding-card-2-icon",
|
|
355
|
-
"vviinn-onboarding-card-2-text",
|
|
356
|
-
"vviinn-onboarding-card-3-icon",
|
|
357
|
-
"vviinn-onboarding-card-3-text",
|
|
358
|
-
"vviinn-example-images-title",
|
|
359
|
-
"vviinn-example-images-1",
|
|
360
|
-
"vviinn-example-images-2",
|
|
361
|
-
"vviinn-example-images-3",
|
|
362
|
-
"vviinn-example-images-4",
|
|
363
|
-
"vviinn-teaser-text",
|
|
364
|
-
"vviinn-image-upload-button-text",
|
|
365
|
-
"vviinn-privacy-badge-text"
|
|
366
|
-
];
|
|
367
|
-
const renderNamedSlot = (name) => index.h("slot", { name: name });
|
|
368
|
-
const SlotSkeleton = () => defaultSlotsNames.map(renderNamedSlot);
|
|
369
|
-
const getSlots = (element) => Array.from(element.shadowRoot.querySelectorAll("slot"));
|
|
370
|
-
const getNameAttribute = (element) => element.getAttribute("name");
|
|
371
|
-
const getSlotAttribute = (element) => element.getAttribute("slot");
|
|
372
|
-
const elementContainSlot = (slot) => (container) => {
|
|
373
|
-
const name1 = getNameAttribute(slot);
|
|
374
|
-
const name2 = getSlotAttribute(container);
|
|
375
|
-
return name1 === name2;
|
|
376
|
-
};
|
|
377
|
-
const getContentToReplace = (targets) => (acc, content) => {
|
|
378
|
-
const replaceCandidate = targets.find(elementContainSlot(content));
|
|
379
|
-
if (replaceCandidate) {
|
|
380
|
-
acc.set(content, replaceCandidate);
|
|
381
|
-
}
|
|
382
|
-
return acc;
|
|
383
|
-
};
|
|
384
|
-
const replaceSlotContent = (content, target) => {
|
|
385
|
-
target.innerHTML = content.outerHTML;
|
|
386
|
-
};
|
|
387
|
-
const slotChangeListener = (component, element) => {
|
|
388
|
-
component.connectedCallback = function () {
|
|
389
|
-
document.addEventListener("globalSlotsChanged", ({ detail }) => {
|
|
390
|
-
const slotsToReplace = getSlots(element).reduce(getContentToReplace(detail), new Map());
|
|
391
|
-
slotsToReplace.forEach(replaceSlotContent);
|
|
392
|
-
}, true);
|
|
393
|
-
};
|
|
394
|
-
component.connectedCallback.call(component);
|
|
395
|
-
};
|
|
396
|
-
|
|
397
320
|
const vviinnExampleImagesCss = "h3{font-size:22px;font-weight:600;line-height:32px;margin:0;margin-bottom:16px;text-align:center}.images{display:block;-moz-column-count:2;column-count:2;-moz-column-gap:16px;column-gap:16px}";
|
|
398
321
|
|
|
399
322
|
let VviinnExampleImages = class {
|
|
@@ -409,7 +332,7 @@ let VviinnExampleImages = class {
|
|
|
409
332
|
this.imageSelectedError.emit();
|
|
410
333
|
}
|
|
411
334
|
componentWillLoad() {
|
|
412
|
-
slotChangeListener(this, this.el);
|
|
335
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
413
336
|
}
|
|
414
337
|
render() {
|
|
415
338
|
return (index.h(index.Host, null, index.h("slot", { name: "vviinn-example-images-title" }, index.h("h3", null, "Mit den Beispielbildern die Suche direkt ausprobieren")), index.h("div", { class: "images" }, index.h("slot", { name: "vviinn-example-images-1" }, index.h("vviinn-example-image", { width: 240, height: 320, src: "https://cdn.vviinn.com/0/fit/240/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDEtTC5qcGc=" })), index.h("slot", { name: "vviinn-example-images-2" }, index.h("vviinn-example-image", { width: 240, height: 240, src: "https://cdn.vviinn.com/0/fit/240/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDItTS5qcGc=" })), index.h("slot", { name: "vviinn-example-images-3" }, index.h("vviinn-example-image", { width: 240, height: 240, src: "https://cdn.vviinn.com/0/fit/240/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDMtTS5qcGc=" })), index.h("slot", { name: "vviinn-example-images-4" }, index.h("vviinn-example-image", { width: 240, height: 320, src: "https://cdn.vviinn.com/0/fit/240/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDQtTC5qcGc=" })))));
|
|
@@ -429,7 +352,7 @@ let VviinnImageSelector = class {
|
|
|
429
352
|
async handleInputChange(event) {
|
|
430
353
|
const input = event.target;
|
|
431
354
|
const processingResult = await imageSearch_store.processSelectedFile(input.files[0]);
|
|
432
|
-
|
|
355
|
+
imageSearch_store._function.pipe(processingResult, imageSearch_store.match(() => this.imageSelectedError.emit(), () => this.imageSelected.emit()));
|
|
433
356
|
input.value = null;
|
|
434
357
|
}
|
|
435
358
|
isLoading() {
|
|
@@ -472,14 +395,14 @@ let VviinnImageView = class {
|
|
|
472
395
|
return index.h("vviinn-detected-object", { detectedObject: object });
|
|
473
396
|
}
|
|
474
397
|
renderImage() {
|
|
475
|
-
return
|
|
398
|
+
return imageSearch_store._function.pipe(imageSearch_store.sequenceToOption(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.imageSearchState.image), imageSearch_store.Option.map(([url, refImage]) => {
|
|
476
399
|
const [width, height] = getImageSizes(refImage);
|
|
477
400
|
const image = (index.h("img", { decoding: "async", width: width, height: height, src: url, onLoad: (el) => this.handleInitialImageLoad(el), draggable: false }));
|
|
478
401
|
return image;
|
|
479
402
|
}), imageSearch_store.Option.getOrElse(() => null));
|
|
480
403
|
}
|
|
481
404
|
renderCropper() {
|
|
482
|
-
return
|
|
405
|
+
return imageSearch_store._function.pipe(imageSearch_store.imageSearchState.imageUrl, imageSearch_store.Option.map(() => index.h("image-cropper", null)), imageSearch_store.Option.getOrElse(() => null));
|
|
483
406
|
}
|
|
484
407
|
render() {
|
|
485
408
|
return (index.h(index.Host, null, imageSearch_store.imageSearchState.loading ||
|
|
@@ -522,7 +445,7 @@ let VviinnOnboarding = class {
|
|
|
522
445
|
index.registerInstance(this, hostRef);
|
|
523
446
|
}
|
|
524
447
|
componentWillLoad() {
|
|
525
|
-
slotChangeListener(this, this.el);
|
|
448
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
526
449
|
}
|
|
527
450
|
render() {
|
|
528
451
|
return (index.h(index.Host, null, index.h("slot", { name: "vviinn-onboarding-title" }, index.h("h3", null, "So funktioniert es")), index.h("vviinn-slider", { showArrows: true }, index.h("vviinn-slide", null, index.h("vviinn-onboarding-card-1", null)), index.h("vviinn-slide", null, index.h("vviinn-onboarding-card-2", null)), index.h("vviinn-slide", null, index.h("vviinn-onboarding-card-3", null)))));
|
|
@@ -538,7 +461,7 @@ let VviinnOnboardingCard1 = class {
|
|
|
538
461
|
index.registerInstance(this, hostRef);
|
|
539
462
|
}
|
|
540
463
|
componentWillLoad() {
|
|
541
|
-
slotChangeListener(this, this.el);
|
|
464
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
542
465
|
}
|
|
543
466
|
render() {
|
|
544
467
|
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-1-icon" }, index.h(index$1.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.")))));
|
|
@@ -554,7 +477,7 @@ let VviinnOnboardingCard2 = class {
|
|
|
554
477
|
index.registerInstance(this, hostRef);
|
|
555
478
|
}
|
|
556
479
|
componentWillLoad() {
|
|
557
|
-
slotChangeListener(this, this.el);
|
|
480
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
558
481
|
}
|
|
559
482
|
render() {
|
|
560
483
|
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-2-icon" }, index.h(index$1.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.")))));
|
|
@@ -570,7 +493,7 @@ let VviinnOnboardingCard3 = class {
|
|
|
570
493
|
index.registerInstance(this, hostRef);
|
|
571
494
|
}
|
|
572
495
|
componentWillLoad() {
|
|
573
|
-
slotChangeListener(this, this.el);
|
|
496
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
574
497
|
}
|
|
575
498
|
render() {
|
|
576
499
|
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-3-icon" }, index.h(index$1.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.")))));
|
|
@@ -606,23 +529,6 @@ let VviinnOverlayedModal = class {
|
|
|
606
529
|
};
|
|
607
530
|
VviinnOverlayedModal.style = vviinnOverlayedModalCss;
|
|
608
531
|
|
|
609
|
-
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)}}";
|
|
610
|
-
|
|
611
|
-
let VviinnPreloader = class {
|
|
612
|
-
constructor(hostRef) {
|
|
613
|
-
index.registerInstance(this, hostRef);
|
|
614
|
-
}
|
|
615
|
-
isActive() {
|
|
616
|
-
return (imageSearch_store.imageSearchState.loading || imageSearch_store.imageSearchState.objectDetectionInProgress);
|
|
617
|
-
}
|
|
618
|
-
render() {
|
|
619
|
-
return (index.h(index.Host, { class: {
|
|
620
|
-
active: this.isActive(),
|
|
621
|
-
} }));
|
|
622
|
-
}
|
|
623
|
-
};
|
|
624
|
-
VviinnPreloader.style = vviinnPreloaderCss;
|
|
625
|
-
|
|
626
532
|
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}";
|
|
627
533
|
|
|
628
534
|
let VviinnPrivacyBadge = class {
|
|
@@ -630,7 +536,7 @@ let VviinnPrivacyBadge = class {
|
|
|
630
536
|
index.registerInstance(this, hostRef);
|
|
631
537
|
}
|
|
632
538
|
componentWillLoad() {
|
|
633
|
-
slotChangeListener(this, this.el);
|
|
539
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
634
540
|
}
|
|
635
541
|
render() {
|
|
636
542
|
return (index.h(index.Host, null, index.h("slot", null, index.h("div", { class: "content" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "16", height: "16", fill: "none" }, index.h("defs", null), index.h("path", { fill: "#525252", d: "M8.5 11V7h-2v1h1v3H6v1h4v-1H8.5zM8 4a.75.75 0 100 1.5A.75.75 0 008 4z" }), index.h("path", { fill: "#525252", d: "M8 15A7 7 0 118 1a7 7 0 010 14zM8 2a6 6 0 100 12A6 6 0 008 2z" })), index.h("slot", { name: "vviinn-privacy-badge-text" }, index.h("p", null, "Wir gehen sorgf\u00E4ltig mit Deinen Daten um. Deine Bilder werden nur zum Zweck der Bildsuche gespeichert."))))));
|
|
@@ -639,174 +545,6 @@ let VviinnPrivacyBadge = class {
|
|
|
639
545
|
};
|
|
640
546
|
VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
|
|
641
547
|
|
|
642
|
-
class GtagAnalytics {
|
|
643
|
-
sendImpression(product) {
|
|
644
|
-
var _a, _b, _c;
|
|
645
|
-
gtag('event', 'view_item_list', {
|
|
646
|
-
items: [
|
|
647
|
-
{
|
|
648
|
-
id: product.productId,
|
|
649
|
-
name: product.title,
|
|
650
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
651
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
652
|
-
list_name: 'VI VPR View',
|
|
653
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
654
|
-
}
|
|
655
|
-
]
|
|
656
|
-
});
|
|
657
|
-
return undefined;
|
|
658
|
-
}
|
|
659
|
-
sendClick(product) {
|
|
660
|
-
var _a, _b, _c;
|
|
661
|
-
gtag('event', 'select_content', {
|
|
662
|
-
content_type: 'product',
|
|
663
|
-
items: [
|
|
664
|
-
{
|
|
665
|
-
id: product.productId,
|
|
666
|
-
name: product.title,
|
|
667
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
668
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
669
|
-
list_name: 'VI VPR View',
|
|
670
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
671
|
-
}
|
|
672
|
-
]
|
|
673
|
-
});
|
|
674
|
-
return undefined;
|
|
675
|
-
}
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
class GAnalytics {
|
|
679
|
-
constructor() {
|
|
680
|
-
ga('require', 'ec');
|
|
681
|
-
}
|
|
682
|
-
convertProduct(product) {
|
|
683
|
-
var _a, _b, _c;
|
|
684
|
-
return {
|
|
685
|
-
id: product.productId,
|
|
686
|
-
name: product.title,
|
|
687
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
688
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
689
|
-
list: 'VI VPR View',
|
|
690
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
691
|
-
};
|
|
692
|
-
}
|
|
693
|
-
sendImpression(product) {
|
|
694
|
-
ga('ec:addImpression', this.convertProduct(product));
|
|
695
|
-
return undefined;
|
|
696
|
-
}
|
|
697
|
-
sendClick(product) {
|
|
698
|
-
var _a, _b, _c;
|
|
699
|
-
ga('ec:addProduct', {
|
|
700
|
-
id: product.productId,
|
|
701
|
-
name: product.title,
|
|
702
|
-
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
703
|
-
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
704
|
-
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
705
|
-
});
|
|
706
|
-
ga('ec:setAction', 'click', { list: 'VI VPR View' });
|
|
707
|
-
return undefined;
|
|
708
|
-
}
|
|
709
|
-
}
|
|
710
|
-
|
|
711
|
-
const getGtagAnalytics = () => _Array._function.pipe(imageSearch_store.Option.fromNullable(window.gtag), imageSearch_store.Option.map(() => new GtagAnalytics()));
|
|
712
|
-
const getCommonAnalytics = () => _Array._function.pipe(imageSearch_store.Option.fromNullable(window.ga), imageSearch_store.Option.map(() => new GAnalytics()));
|
|
713
|
-
const analyticsMonoid = imageSearch_store.Option.getMonoid(_Array.Semigroup.first());
|
|
714
|
-
const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
|
|
715
|
-
|
|
716
|
-
const FIT_EXPR = /fit\/\d+\//;
|
|
717
|
-
const containsFit = (url) => {
|
|
718
|
-
return _Array._function.pipe(url.match(FIT_EXPR), imageSearch_store.Either.fromNullable(url), imageSearch_store.Either.map(() => url));
|
|
719
|
-
};
|
|
720
|
-
const processWidth = (url, size) => {
|
|
721
|
-
return _Array._function.pipe(containsFit(url), imageSearch_store.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), imageSearch_store.Either.getOrElse(() => url));
|
|
722
|
-
};
|
|
723
|
-
const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
|
|
724
|
-
const FormattedPrice = (props) => {
|
|
725
|
-
var _a;
|
|
726
|
-
const locale = props.locale;
|
|
727
|
-
const formattedPrice = new Intl.NumberFormat(locale, {
|
|
728
|
-
minimumFractionDigits: 2,
|
|
729
|
-
}).format(props.price);
|
|
730
|
-
const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
|
|
731
|
-
return (index.h("span", { class: "price-amount", part: "price-amount" }, fullPrice));
|
|
732
|
-
};
|
|
733
|
-
const Price = (props) => {
|
|
734
|
-
const priceEl = (index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale }));
|
|
735
|
-
return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
|
|
736
|
-
index.h("span", { class: "price-sale", part: "price-sale" },
|
|
737
|
-
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale })),
|
|
738
|
-
index.h("span", { class: "price-outdated", part: "price-outdated" }, priceEl),
|
|
739
|
-
]) : (index.h("span", { class: "price-regular", part: "price-regular" }, priceEl))));
|
|
740
|
-
};
|
|
741
|
-
const Image = (props) => (index.h("picture", null,
|
|
742
|
-
index.h("img", { loading: "lazy", part: "image", class: "image", width: props.width, height: props.height, src: processWidth(props.src, props.width), alt: props.title })));
|
|
743
|
-
const ResponsiveImage = (props) => (index.h("picture", null,
|
|
744
|
-
index.h("img", { loading: "lazy", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title })));
|
|
745
|
-
|
|
746
|
-
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;max-width:-webkit-min-content;max-width:-moz-min-content;max-width:min-content;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;max-width:-webkit-min-content;max-width:-moz-min-content;max-width:min-content}.deeplink{text-decoration:none}picture{position:relative}: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}";
|
|
747
|
-
|
|
748
|
-
let VviinnProductCard = class {
|
|
749
|
-
constructor(hostRef) {
|
|
750
|
-
index.registerInstance(this, hostRef);
|
|
751
|
-
this.recommendationLoad = index.createEvent(this, "recommendationLoad", 7);
|
|
752
|
-
this.recommendationView = index.createEvent(this, "recommendationView", 7);
|
|
753
|
-
this.recommendationClick = index.createEvent(this, "recommendationClick", 7);
|
|
754
|
-
this.currency = undefined;
|
|
755
|
-
this.imageRatio = 1;
|
|
756
|
-
this.imageWidth = 200;
|
|
757
|
-
this.locale = undefined;
|
|
758
|
-
this.pricePrefix = undefined;
|
|
759
|
-
this.responsive = false;
|
|
760
|
-
this.dimmedBackground = false;
|
|
761
|
-
this.imageLoaded = false;
|
|
762
|
-
this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
|
|
763
|
-
}
|
|
764
|
-
intersectionCallback(data) {
|
|
765
|
-
if (data.some((entry) => entry.isIntersecting)) {
|
|
766
|
-
_Array._function.pipe(getAnalyticsModule, imageSearch_store.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
|
|
767
|
-
this.recommendationView.emit(this.productId);
|
|
768
|
-
this.intersectionObserver.disconnect();
|
|
769
|
-
}
|
|
770
|
-
}
|
|
771
|
-
componentDidLoad() {
|
|
772
|
-
this.recommendationLoad.emit(this.productId);
|
|
773
|
-
this.intersectionObserver.observe(this.el);
|
|
774
|
-
const links = this.el.shadowRoot.querySelectorAll("a");
|
|
775
|
-
links.forEach((link) => link.addEventListener("mousedown", (event) => {
|
|
776
|
-
this.recommendationClick.emit(this.productId);
|
|
777
|
-
if (window.ga) {
|
|
778
|
-
event.preventDefault();
|
|
779
|
-
}
|
|
780
|
-
_Array._function.pipe(getAnalyticsModule, imageSearch_store.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
|
|
781
|
-
if (window.ga) {
|
|
782
|
-
ga("send", "event", "UX", "click", "Results", {
|
|
783
|
-
hitCallback: function () {
|
|
784
|
-
document.location.href = this.deeplink;
|
|
785
|
-
},
|
|
786
|
-
});
|
|
787
|
-
}
|
|
788
|
-
}));
|
|
789
|
-
}
|
|
790
|
-
getProduct() {
|
|
791
|
-
return imageSearch_store.imageSearchState.results.find((r) => r.productId === this.productId);
|
|
792
|
-
}
|
|
793
|
-
renderImage() {
|
|
794
|
-
const props = {
|
|
795
|
-
width: this.imageWidth,
|
|
796
|
-
height: this.imageWidth * this.imageRatio,
|
|
797
|
-
src: this.image,
|
|
798
|
-
title: this.productTitle
|
|
799
|
-
};
|
|
800
|
-
return this.responsive ? ResponsiveImage(props) : Image(props);
|
|
801
|
-
}
|
|
802
|
-
render() {
|
|
803
|
-
var _a, _b, _c;
|
|
804
|
-
return (index.h(index.Host, { exportparts: "brand, currency, deeplink, image, type, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title", class: { dimmed: this.dimmedBackground } }, index.h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), index.h(Linked, { deeplink: this.deeplink, part: "deeplink" }, index.h("span", { class: "title", part: "title" }, this.productTitle)), index.h("span", { class: "brand", part: "brand" }, this.brand), index.h("span", { class: "type", part: "type" }, this.productType), index.h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : imageSearch_store.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : imageSearch_store.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : imageSearch_store.state.locale })));
|
|
805
|
-
}
|
|
806
|
-
get el() { return index.getElement(this); }
|
|
807
|
-
};
|
|
808
|
-
VviinnProductCard.style = vviinnProductCardCss;
|
|
809
|
-
|
|
810
548
|
const vviinnServerErrorCss = ":host{display:block}";
|
|
811
549
|
|
|
812
550
|
let VviinnServerError = class {
|
|
@@ -879,7 +617,7 @@ let VviinnSlider = class {
|
|
|
879
617
|
this.setActiveCssClassToSlide(index);
|
|
880
618
|
}
|
|
881
619
|
renderBullets() {
|
|
882
|
-
return this.showBullets ? (index.h("div", { class: "controls" },
|
|
620
|
+
return this.showBullets ? (index.h("div", { class: "controls" }, imageSearch_store.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
|
|
883
621
|
bullet: true,
|
|
884
622
|
active: i == this.internalPosition % this.elementsCount,
|
|
885
623
|
}, onClick: () => this.goToSlide(i) }))))) : null;
|
|
@@ -916,13 +654,13 @@ let VviinnSlider = class {
|
|
|
916
654
|
handleTouchStart(event) {
|
|
917
655
|
if (!this.showBullets)
|
|
918
656
|
return;
|
|
919
|
-
this.swipeStartPosition =
|
|
657
|
+
this.swipeStartPosition = imageSearch_store._function.pipe(event.touches[0], imageSearch_store.Option.fromNullable, imageSearch_store.Option.map((t) => t.clientX));
|
|
920
658
|
}
|
|
921
659
|
handleTouchEnd(event) {
|
|
922
660
|
if (!this.showBullets)
|
|
923
661
|
return;
|
|
924
|
-
const swipeEndPosition =
|
|
925
|
-
|
|
662
|
+
const swipeEndPosition = imageSearch_store._function.pipe(event.changedTouches[0], imageSearch_store.Option.fromNullable, imageSearch_store.Option.map((t) => t.clientX));
|
|
663
|
+
imageSearch_store._function.pipe(imageSearch_store.sequenceToOption(this.swipeStartPosition, swipeEndPosition), imageSearch_store.Option.map(([start, end]) => Ord.compare(start, end)), imageSearch_store.Option.map((swipeDirection) => {
|
|
926
664
|
switch (swipeDirection) {
|
|
927
665
|
case 1:
|
|
928
666
|
return this.nextSlide();
|
|
@@ -953,7 +691,7 @@ let VviinnTeaser = class {
|
|
|
953
691
|
index.registerInstance(this, hostRef);
|
|
954
692
|
}
|
|
955
693
|
componentWillLoad() {
|
|
956
|
-
slotChangeListener(this, this.el);
|
|
694
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
957
695
|
}
|
|
958
696
|
render() {
|
|
959
697
|
return (index.h(index.Host, null, index.h("slot", null, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "64", height: "64", fill: "none" }, index.h("defs", null), index.h("path", { fill: "#C6C6C6", d: "M48 28a11.98 11.98 0 00-9.77 18.942L28 57.172 30.828 60l10.23-10.23A11.994 11.994 0 1048 28zm0 20a8 8 0 118-8 8.009 8.009 0 01-8 8zM34 24a6 6 0 10-6-6 6.006 6.006 0 006 6zm0-8a2 2 0 110 4 2 2 0 010-4z" }), index.h("path", { fill: "#C6C6C6", d: "M24 48H8V35.993L18 26l11.172 11.172L32 34.336 20.828 23.165a4 4 0 00-5.656 0L8 30.336V8h40v12h4V8a4.004 4.004 0 00-4-4H8a4.004 4.004 0 00-4 4v40a4.005 4.005 0 004 4h16v-4z" })), index.h("span", { class: "vviinn-teaser-text" }, index.h("slot", { name: "vviinn-teaser-text" }, "Finde Produkte auf ", index.h("br", null), " einem Foto")))));
|
|
@@ -962,127 +700,6 @@ let VviinnTeaser = class {
|
|
|
962
700
|
};
|
|
963
701
|
VviinnTeaser.style = vviinnTeaserCss;
|
|
964
702
|
|
|
965
|
-
const vviinnVpsButtonCss = "";
|
|
966
|
-
|
|
967
|
-
let VviinnVpsButton = class {
|
|
968
|
-
constructor(hostRef) {
|
|
969
|
-
index.registerInstance(this, hostRef);
|
|
970
|
-
this.globalSlotsChanged = index.createEvent(this, "globalSlotsChanged", 7);
|
|
971
|
-
/** Currency sign will shown after price */
|
|
972
|
-
this.currencySign = "€";
|
|
973
|
-
/** Locale for currency formatting */
|
|
974
|
-
this.locale = "de-DE";
|
|
975
|
-
this.pressed = false;
|
|
976
|
-
}
|
|
977
|
-
handleModalClosed() {
|
|
978
|
-
this.pressed = false;
|
|
979
|
-
}
|
|
980
|
-
componentDidLoad() {
|
|
981
|
-
const slots = this.el.querySelectorAll("[slot]");
|
|
982
|
-
this.globalSlotsChanged.emit(Array.from(slots));
|
|
983
|
-
}
|
|
984
|
-
handleKeyDown(ev) {
|
|
985
|
-
if (ev.code !== "Enter" && ev.code !== "Space")
|
|
986
|
-
return;
|
|
987
|
-
this.pressed = true;
|
|
988
|
-
}
|
|
989
|
-
handleClick() {
|
|
990
|
-
this.pressed = true;
|
|
991
|
-
}
|
|
992
|
-
render() {
|
|
993
|
-
return (index.h(index.Host, { tabindex: "0", role: "button", pressed: this.pressed, onClick: () => this.handleClick(), onKeyDown: (ev) => this.handleKeyDown(ev) }, index.h("slot", null, index.h(index$1.CameraIcon, null)), index.h(SlotSkeleton, null), index.h("vviinn-vps-widget", { active: this.pressed, "currency-sign": "\u20AC", token: this.token, locale: this.locale, apiPath: this.apiPath, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title, product-card" })));
|
|
994
|
-
}
|
|
995
|
-
get el() { return index.getElement(this); }
|
|
996
|
-
};
|
|
997
|
-
VviinnVpsButton.style = vviinnVpsButtonCss;
|
|
998
|
-
|
|
999
|
-
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}";
|
|
1000
|
-
|
|
1001
|
-
let VviinnVpsWidget = class {
|
|
1002
|
-
constructor(hostRef) {
|
|
1003
|
-
index.registerInstance(this, hostRef);
|
|
1004
|
-
/** When true modal window with widget will be shown */
|
|
1005
|
-
this.active = false;
|
|
1006
|
-
/** Currency sign will shown after price */
|
|
1007
|
-
this.currencySign = "€";
|
|
1008
|
-
/** Locale for currency formatting */
|
|
1009
|
-
this.locale = "de-DE";
|
|
1010
|
-
this.slidePosition = 0;
|
|
1011
|
-
this.width = 0;
|
|
1012
|
-
this.wrongImageFormat = false;
|
|
1013
|
-
}
|
|
1014
|
-
activeWatcher(value) {
|
|
1015
|
-
if (value) {
|
|
1016
|
-
this.overflow = document.body.style.overflow;
|
|
1017
|
-
document.body.style.overflow = "hidden";
|
|
1018
|
-
}
|
|
1019
|
-
else {
|
|
1020
|
-
document.body.style.overflow = this.overflow;
|
|
1021
|
-
}
|
|
1022
|
-
}
|
|
1023
|
-
componentWillLoad() {
|
|
1024
|
-
slotChangeListener(this, this.el);
|
|
1025
|
-
}
|
|
1026
|
-
connectedCallback() {
|
|
1027
|
-
imageSearch_store.state$1.apiPath = this.apiPath;
|
|
1028
|
-
imageSearch_store.state$1.currencySign = this.currencySign;
|
|
1029
|
-
imageSearch_store.state$1.locale = this.locale;
|
|
1030
|
-
imageSearch_store.imageSearchState.token = this.token;
|
|
1031
|
-
}
|
|
1032
|
-
handleImageSelection() {
|
|
1033
|
-
this.slidePosition = 1;
|
|
1034
|
-
const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
|
|
1035
|
-
const overlay = root.shadowRoot.querySelector("vviinn-overlay");
|
|
1036
|
-
const modal = overlay.querySelector("vviinn-modal");
|
|
1037
|
-
const modalBody = modal.shadowRoot.querySelector(".body");
|
|
1038
|
-
modalBody.scrollTop = 0;
|
|
1039
|
-
}
|
|
1040
|
-
resetState() {
|
|
1041
|
-
this.resetScroll("onboarding-block");
|
|
1042
|
-
this.slidePosition = 0;
|
|
1043
|
-
imageSearch_store.imageSearchState.image = imageSearch_store.Option.none;
|
|
1044
|
-
imageSearch_store.imageSearchState.imageUrl = imageSearch_store.Option.none;
|
|
1045
|
-
imageSearch_store.imageSearchState.imageBounds = imageSearch_store.Option.none;
|
|
1046
|
-
imageSearch_store.imageSearchState.searchArea = imageSearch_store.Option.none;
|
|
1047
|
-
imageSearch_store.imageSearchState.results = [];
|
|
1048
|
-
imageSearch_store.imageSearchState.filters = [];
|
|
1049
|
-
imageSearch_store.imageSearchState.detectedObjects = [];
|
|
1050
|
-
imageSearch_store.imageSearchState.activeIonLink = undefined;
|
|
1051
|
-
imageSearch_store.imageSearchState.rectangleSearchForm = undefined;
|
|
1052
|
-
this.resetScroll("results-block");
|
|
1053
|
-
}
|
|
1054
|
-
haveErrors() {
|
|
1055
|
-
return this.wrongImageFormat || imageSearch_store.imageSearchState.serverError;
|
|
1056
|
-
}
|
|
1057
|
-
resetScroll(elementId, behavior = "auto") {
|
|
1058
|
-
const element = this.el.shadowRoot.getElementById(elementId);
|
|
1059
|
-
element.scroll({ top: 0, left: 0, behavior });
|
|
1060
|
-
}
|
|
1061
|
-
handleModalClose() {
|
|
1062
|
-
this.active = false;
|
|
1063
|
-
this.resetState();
|
|
1064
|
-
const elementsToReset = ["onboarding-block", "results-block"];
|
|
1065
|
-
elementsToReset.forEach((name) => this.resetScroll(name));
|
|
1066
|
-
}
|
|
1067
|
-
render() {
|
|
1068
|
-
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" }, index.h("vviinn-slider", { showBullets: false, position: this.slidePosition }, index.h("vviinn-slide", { class: { "start-page": true } }, index.h("div", { class: {
|
|
1069
|
-
error: this.haveErrors(),
|
|
1070
|
-
"start-page_block": true,
|
|
1071
|
-
} }, index.h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, onActionClick: () => (this.wrongImageFormat = false) }), index.h("vviinn-server-error", { class: { hidden: !imageSearch_store.imageSearchState.serverError }, onActionClick: () => (imageSearch_store.imageSearchState.serverError = false) }), index.h("vviinn-teaser", { class: { hidden: this.haveErrors() } }), index.h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection(), 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", { onImageSelected: () => this.handleImageSelection(), 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" }, imageSearch_store.imageSearchState.filters.map((filter) => (index.h("search-filters", { filter: filter })))))), index.h("div", { id: "results-block", class: "products-wrapper" }, index.h("div", { class: { "nothing-found": true, hidden: imageSearch_store.imageSearchState.results.length > 0 } }, index.h("vviinn-empty-results", null), index.h("vviinn-onboarding", null)), index.h("div", { class: {
|
|
1072
|
-
hidden: imageSearch_store.imageSearchState.results.length <= 0,
|
|
1073
|
-
products: true,
|
|
1074
|
-
} }, imageSearch_store.imageSearchState.results.map((p) => {
|
|
1075
|
-
var _a;
|
|
1076
|
-
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" }));
|
|
1077
|
-
}))))))));
|
|
1078
|
-
}
|
|
1079
|
-
get el() { return index.getElement(this); }
|
|
1080
|
-
static get watchers() { return {
|
|
1081
|
-
"active": ["activeWatcher"]
|
|
1082
|
-
}; }
|
|
1083
|
-
};
|
|
1084
|
-
VviinnVpsWidget.style = vviinnVpsWidgetCss;
|
|
1085
|
-
|
|
1086
703
|
const vviinnWrongFormatCss = ":host{display:block}";
|
|
1087
704
|
|
|
1088
705
|
let VviinnWrongFormat = class {
|
|
@@ -1096,13 +713,11 @@ let VviinnWrongFormat = class {
|
|
|
1096
713
|
};
|
|
1097
714
|
VviinnWrongFormat.style = vviinnWrongFormatCss;
|
|
1098
715
|
|
|
1099
|
-
exports.cropper_handler = CropperHandler;
|
|
1100
716
|
exports.highlight_box = HighlightBox;
|
|
1101
717
|
exports.image_cropper = ImageCropper;
|
|
1102
718
|
exports.search_filters = SearchFilters;
|
|
1103
719
|
exports.vviinn_detected_object = VviinnDetectedObject;
|
|
1104
720
|
exports.vviinn_empty_results = VviinnEmptyResults;
|
|
1105
|
-
exports.vviinn_error = VviinnError;
|
|
1106
721
|
exports.vviinn_example_image = VviinnExampleImage;
|
|
1107
722
|
exports.vviinn_example_images = VviinnExampleImages;
|
|
1108
723
|
exports.vviinn_image_selector = VviinnImageSelector;
|
|
@@ -1114,13 +729,9 @@ exports.vviinn_onboarding_card_2 = VviinnOnboardingCard2;
|
|
|
1114
729
|
exports.vviinn_onboarding_card_3 = VviinnOnboardingCard3;
|
|
1115
730
|
exports.vviinn_overlay = VviinnOverlay;
|
|
1116
731
|
exports.vviinn_overlayed_modal = VviinnOverlayedModal;
|
|
1117
|
-
exports.vviinn_preloader = VviinnPreloader;
|
|
1118
732
|
exports.vviinn_privacy_badge = VviinnPrivacyBadge;
|
|
1119
|
-
exports.vviinn_product_card = VviinnProductCard;
|
|
1120
733
|
exports.vviinn_server_error = VviinnServerError;
|
|
1121
734
|
exports.vviinn_slide = VviinnSlide;
|
|
1122
735
|
exports.vviinn_slider = VviinnSlider;
|
|
1123
736
|
exports.vviinn_teaser = VviinnTeaser;
|
|
1124
|
-
exports.vviinn_vps_button = VviinnVpsButton;
|
|
1125
|
-
exports.vviinn_vps_widget = VviinnVpsWidget;
|
|
1126
737
|
exports.vviinn_wrong_format = VviinnWrongFormat;
|