vviinn-widgets 2.3.1 → 2.4.2
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/{app-globals-6b5da080.js → app-globals-d999d944.js} +1 -1
- package/dist/cjs/{highlight-box_22.cjs.entry.js → cropper-handler_27.cjs.entry.js} +486 -92
- package/dist/cjs/{customized-slots-8bc78ad4.js → customized-slots-90e8e849.js} +1 -1
- package/dist/cjs/{index-5b9a60ac.js → index-53400160.js} +1 -1
- package/dist/cjs/{imageSearch.store-042e9f45.js → index-c0d08aca.js} +15288 -11038
- package/dist/cjs/{index-553c2b4f.js → index-e8cf5dc5.js} +1 -1
- package/dist/cjs/loader.cjs.js +3 -3
- package/dist/cjs/{vviinn-carousel_3.cjs.entry.js → vviinn-carousel_2.cjs.entry.js} +50 -206
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +3 -3
- package/dist/cjs/vviinn-widgets.cjs.js +3 -3
- package/dist/collection/components/image-search/image-view/image-cropper/image-cropper.js +27 -7
- package/dist/collection/components/image-search/search-filters/search-filters.js +24 -1
- package/dist/collection/components/vviinn-carousel/vviinn-carousel.js +3 -3
- package/dist/collection/components/vviinn-example-images/vviinn-example-images.js +4 -4
- package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +18 -1
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +57 -12
- package/dist/collection/components/vviinn-vpr-widget/stories/args.js +8 -8
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +46 -10
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-widget.css +5 -0
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +106 -10
- package/dist/collection/network/utils.js +1 -1
- package/dist/collection/openApi/index.js +27 -0
- package/dist/collection/{components/vviinn-vpr-widget/GridMode.js → recommendation/events.js} +0 -0
- package/dist/collection/store/store.js +7 -9
- package/dist/collection/store/tracking.store.js +3 -0
- package/dist/collection/tracking/event.js +3 -0
- package/dist/collection/tracking/filter.js +5 -0
- package/dist/collection/tracking/index.js +13 -0
- package/dist/collection/tracking/models.js +6 -0
- package/dist/collection/tracking/product.js +18 -0
- package/dist/collection/tracking/search.js +5 -0
- package/dist/collection/tracking/widget.js +10 -0
- package/dist/esm/{app-globals-90d99f95.js → app-globals-f91c6f94.js} +1 -1
- package/dist/esm/{highlight-box_22.entry.js → cropper-handler_27.entry.js} +417 -28
- package/dist/esm/{customized-slots-65b2467d.js → customized-slots-7be7f3b8.js} +1 -1
- package/dist/esm/{index-ac2e3b9d.js → index-00c7b7c2.js} +2 -2
- package/dist/esm/{imageSearch.store-f35e14f8.js → index-840ec915.js} +15232 -10993
- package/dist/esm/{index-d7c7df1c.js → index-d7147986.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{vviinn-carousel_3.entry.js → vviinn-carousel_2.entry.js} +42 -197
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +2 -2
- package/dist/esm/vviinn-vpr-button.entry.js +2 -2
- package/dist/esm/vviinn-vps-button.entry.js +3 -3
- package/dist/esm/vviinn-widgets.js +3 -3
- package/dist/types/Image/error.d.ts +1 -0
- package/dist/types/Image/form.d.ts +1 -0
- package/dist/types/Image/fromFile.d.ts +1 -0
- package/dist/types/Image/imageToB64.d.ts +1 -0
- package/dist/types/Image/index.d.ts +1 -0
- package/dist/types/Image/renderPromise.d.ts +1 -0
- package/dist/types/Image/resizeImage.d.ts +1 -0
- package/dist/types/Image/sizing.d.ts +1 -0
- package/dist/types/Image/toFile.d.ts +1 -0
- package/dist/types/analytics/GAnalytics.d.ts +1 -0
- package/dist/types/analytics/GeneralAnalytics.d.ts +1 -0
- package/dist/types/analytics/GtagAnalytics.d.ts +1 -0
- package/dist/types/analytics/ProductAnalytics.d.ts +1 -0
- package/dist/types/campaign/Campaign.d.ts +1 -0
- package/dist/types/campaign/CampaignService.d.ts +1 -0
- package/dist/types/campaign/VCSCampaign.d.ts +1 -0
- package/dist/types/campaign/VCSCampaignResponse.d.ts +1 -0
- package/dist/types/campaign/VCSCampaignService.d.ts +1 -0
- package/dist/types/campaign/VPRCampaignResponse.d.ts +1 -0
- package/dist/types/campaign/VPRCampaignService.d.ts +1 -0
- package/dist/types/components/customized-slots.d.ts +1 -0
- package/dist/types/components/image-search/image-view/highlight-box/highlight-box.d.ts +1 -0
- package/dist/types/components/image-search/image-view/image-cropper/cropper-handler/cropper-handler.d.ts +1 -0
- package/dist/types/components/image-search/image-view/image-cropper/image-cropper.d.ts +4 -0
- package/dist/types/components/image-search/search-filters/search-filters.d.ts +4 -0
- package/dist/types/components/vviinn-carousel/vviinn-carousel.d.ts +1 -0
- package/dist/types/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.d.ts +1 -0
- package/dist/types/components/vviinn-error/vviinn-error.d.ts +1 -0
- package/dist/types/components/vviinn-error/vviinn-server-error/vviinn-server-error.d.ts +1 -0
- package/dist/types/components/vviinn-error/vviinn-wrong-format/vviinn-wrong-format.d.ts +1 -0
- package/dist/types/components/vviinn-example-images/vviinn-example-image/vviinn-example-image.d.ts +1 -0
- package/dist/types/components/vviinn-example-images/vviinn-example-images.d.ts +1 -0
- package/dist/types/components/vviinn-icons/index.d.ts +1 -0
- package/dist/types/components/vviinn-image-selector/vviinn-image-selector.d.ts +1 -0
- package/dist/types/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.d.ts +3 -0
- package/dist/types/components/vviinn-image-view/vviinn-image-view.d.ts +1 -0
- package/dist/types/components/vviinn-modal/vviinn-modal.d.ts +1 -0
- package/dist/types/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-1/vviinn-onboarding-card-1.d.ts +1 -0
- package/dist/types/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-2/vviinn-onboarding-card-2.d.ts +1 -0
- package/dist/types/components/vviinn-onboarding/onboarding-cards/vviinn-onboarding-card-3/vviinn-onboarding-card-3.d.ts +1 -0
- package/dist/types/components/vviinn-onboarding/vviinn-onboarding.d.ts +1 -0
- package/dist/types/components/vviinn-overlay/vviinn-overlay.d.ts +1 -0
- package/dist/types/components/vviinn-overlayed-modal/vviinn-overlayed-modal.d.ts +1 -0
- package/dist/types/components/vviinn-preloader/vviinn-preloader.d.ts +1 -0
- package/dist/types/components/vviinn-privacy-badge/vviinn-privacy-badge.d.ts +1 -0
- package/dist/types/components/vviinn-product-card/render-helpers.d.ts +1 -0
- package/dist/types/components/vviinn-product-card/stories/args.d.ts +1 -0
- package/dist/types/components/vviinn-product-card/stories/decorators.d.ts +1 -0
- package/dist/types/components/vviinn-product-card/stories/vviinn-product-card.stories.d.ts +1 -0
- package/dist/types/components/vviinn-product-card/vviinn-product-card.d.ts +9 -3
- package/dist/types/components/vviinn-slider/arrow.d.ts +1 -0
- package/dist/types/components/vviinn-slider/vviinn-slide/vviinn-slide.d.ts +1 -0
- package/dist/types/components/vviinn-slider/vviinn-slider.d.ts +1 -0
- package/dist/types/components/vviinn-teaser/vviinn-teaser.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-button/recommendations-sidebar/recommendations-sidebar.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-button/stories/args.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-button/stories/vviinn-vpr-button.stories.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-button/vviinn-vpr-button.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-widget/stories/args.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-widget/stories/decorators.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-widget/stories/vviinn-vpr-widget.stories.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-widget/token-helpers.d.ts +1 -0
- package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +9 -1
- package/dist/types/components/vviinn-vps-button/stories/vviinn-vps-button.stories.d.ts +1 -0
- package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +1 -0
- package/dist/types/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.d.ts +1 -0
- package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +13 -1
- package/dist/types/components.d.ts +10 -4
- package/dist/types/cropper/Cropper.d.ts +1 -0
- package/dist/types/cropper/Handler.d.ts +1 -0
- package/dist/types/dom/index.d.ts +1 -0
- package/dist/types/error.d.ts +1 -0
- package/dist/types/file/index.d.ts +1 -0
- package/dist/types/geometry/Clip.d.ts +1 -0
- package/dist/types/geometry/Point.d.ts +1 -0
- package/dist/types/geometry/Rectangle.d.ts +1 -0
- package/dist/types/geometry/RectangleAlt.d.ts +1 -0
- package/dist/types/geometry/Sized.d.ts +1 -0
- package/dist/types/global.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/interfaces/generated.d.ts +1 -0
- package/dist/types/interfaces/recommendation.d.ts +1 -0
- package/dist/types/network/apiClient.d.ts +1 -0
- package/dist/types/network/ion/File.d.ts +1 -0
- package/dist/types/network/ion/Form.d.ts +1 -0
- package/dist/types/network/ion/Link.d.ts +1 -0
- package/dist/types/network/ion/ValueObject.d.ts +1 -0
- package/dist/types/network/request.d.ts +1 -0
- package/dist/types/network/utils.d.ts +1 -0
- package/dist/types/openApi/index.d.ts +6 -0
- package/dist/types/recommendation/events.d.ts +6 -0
- package/dist/types/recommendation/recommendation.d.ts +1 -0
- package/dist/types/searchSession/searchSession.d.ts +1 -0
- package/dist/types/sentry.d.ts +1 -0
- package/dist/types/slider/GridMode.d.ts +1 -0
- package/dist/types/store/file-processing.d.ts +1 -0
- package/dist/types/store/imageSearch.store.d.ts +1 -0
- package/dist/types/store/store.d.ts +8 -6
- package/dist/types/store/tracking.store.d.ts +4 -0
- package/dist/types/stories/image-selector.stories.d.ts +1 -0
- package/dist/types/stories/image-view.stories.d.ts +1 -0
- package/dist/types/stories/modal.stories.d.ts +1 -0
- package/dist/types/stories/onboarding.stories.d.ts +1 -0
- package/dist/types/stories/overlay.stories.d.ts +1 -0
- package/dist/types/stories/overlayedModal.stories.d.ts +1 -0
- package/dist/types/stories/privacy-badge.stories.d.ts +1 -0
- package/dist/types/stories/slider.stories.d.ts +1 -0
- package/dist/types/stories/teaser.stories.d.ts +1 -0
- package/dist/types/stories/vps-widget.stories.d.ts +1 -0
- package/dist/types/stories/vviinn-product.stories.d.ts +1 -0
- package/dist/types/tracking/event.d.ts +4 -0
- package/dist/types/tracking/filter.d.ts +3 -0
- package/dist/types/tracking/index.d.ts +9 -0
- package/dist/types/tracking/models.d.ts +13 -0
- package/dist/types/tracking/product.d.ts +7 -0
- package/dist/types/tracking/search.d.ts +3 -0
- package/dist/types/tracking/widget.d.ts +5 -0
- package/dist/types/utils/collections/collectionsUtils.d.ts +1 -0
- package/dist/types/utils/either.d.ts +1 -0
- package/dist/types/utils/enum/enumUtils.d.ts +1 -0
- package/dist/types/utils/event/Events.d.ts +1 -0
- package/dist/types/utils/number/index.d.ts +1 -0
- package/dist/types/utils/option/option.d.ts +1 -0
- package/dist/types/utils/semigroup/semigroupDiff.d.ts +1 -0
- package/dist/types/utils/token/tokenUtils.d.ts +1 -0
- package/dist/vviinn-widgets/{p-e362fa80.entry.js → p-07d8ba79.entry.js} +1 -1
- package/dist/vviinn-widgets/p-196479f9.js +1 -0
- package/dist/vviinn-widgets/{p-a5b69a48.entry.js → p-2d4cb17f.entry.js} +1 -1
- package/dist/vviinn-widgets/{p-679ea2ce.js → p-7d5af04d.js} +1 -1
- package/dist/vviinn-widgets/{p-4530ca32.entry.js → p-9c7297c8.entry.js} +1 -1
- package/{www/build/p-55491d9b.js → dist/vviinn-widgets/p-a66512b2.js} +1 -1
- package/dist/vviinn-widgets/p-ae524f97.entry.js +1 -0
- package/{www/build/p-e882fbeb.js → dist/vviinn-widgets/p-ce96f232.js} +1 -1
- package/dist/vviinn-widgets/{p-b4b46a70.js → p-dc2da207.js} +1 -1
- package/dist/vviinn-widgets/p-fce4183d.entry.js +1 -0
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +11 -3
- package/www/build/{p-e362fa80.entry.js → p-07d8ba79.entry.js} +1 -1
- package/www/build/p-196479f9.js +1 -0
- package/www/build/{p-a5b69a48.entry.js → p-2d4cb17f.entry.js} +1 -1
- package/www/build/p-32bb0615.js +1 -0
- package/www/build/{p-679ea2ce.js → p-7d5af04d.js} +1 -1
- package/www/build/{p-4530ca32.entry.js → p-9c7297c8.entry.js} +1 -1
- package/{dist/vviinn-widgets/p-55491d9b.js → www/build/p-a66512b2.js} +1 -1
- package/www/build/p-ae524f97.entry.js +1 -0
- package/{dist/vviinn-widgets/p-e882fbeb.js → www/build/p-ce96f232.js} +1 -1
- package/www/build/{p-b4b46a70.js → p-dc2da207.js} +1 -1
- package/www/build/p-fce4183d.entry.js +1 -0
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/www/index.html +1 -107
- package/dist/cjs/Handler-d1a8a86a.js +0 -329
- package/dist/cjs/cropper-handler.cjs.entry.js +0 -27
- 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 -97
- package/dist/esm/Handler-639a4cb3.js +0 -308
- package/dist/esm/cropper-handler.entry.js +0 -23
- 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 -93
- package/dist/types/components/vviinn-vpr-widget/GridMode.d.ts +0 -1
- package/dist/vviinn-widgets/p-1c141479.entry.js +0 -1
- package/dist/vviinn-widgets/p-320844ea.entry.js +0 -1
- package/dist/vviinn-widgets/p-6239a782.entry.js +0 -1
- package/dist/vviinn-widgets/p-757849fd.entry.js +0 -1
- package/dist/vviinn-widgets/p-80f0d4e0.js +0 -1
- package/dist/vviinn-widgets/p-935b4f49.entry.js +0 -1
- package/dist/vviinn-widgets/p-b0243e84.entry.js +0 -1
- package/dist/vviinn-widgets/p-f582db5c.js +0 -1
- package/www/build/p-1c141479.entry.js +0 -1
- package/www/build/p-320844ea.entry.js +0 -1
- package/www/build/p-4379b1c2.js +0 -1
- package/www/build/p-6239a782.entry.js +0 -1
- package/www/build/p-757849fd.entry.js +0 -1
- package/www/build/p-80f0d4e0.js +0 -1
- package/www/build/p-935b4f49.entry.js +0 -1
- package/www/build/p-b0243e84.entry.js +0 -1
- package/www/build/p-f582db5c.js +0 -1
|
@@ -2,11 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
const index = require('./index-
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
|
|
5
|
+
const index = require('./index-e8cf5dc5.js');
|
|
6
|
+
const index$1 = require('./index-c0d08aca.js');
|
|
7
|
+
const index$2 = require('./index-53400160.js');
|
|
8
|
+
const customizedSlots = require('./customized-slots-90e8e849.js');
|
|
9
|
+
|
|
10
|
+
const cropperHandlerCss = ":host{--size:20px;background:transparent;border:4px solid white;box-sizing:content-box;display:block;height:var(--size);touch-action:none;position:absolute;width:var(--size);z-index:4;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}:host(.disabled){opacity:0.25}:host(.nw-resize){border-bottom:none;border-right:none;top:0;left:0}:host(.ne-resize){border-left:none;border-bottom:none;right:0;top:0}:host(.sw-resize){border-right:none;border-top:none;left:0;bottom:0}:host(.se-resize){border-left:none;border-top:none;bottom:0;right:0}";
|
|
11
|
+
|
|
12
|
+
let CropperHandler = class {
|
|
13
|
+
constructor(hostRef) {
|
|
14
|
+
index.registerInstance(this, hostRef);
|
|
15
|
+
this.disabled = false;
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
return (index.h(index.Host, { part: `handle ${index$1.getCursorValue(this.handler.direction)}`, class: {
|
|
19
|
+
disabled: this.disabled,
|
|
20
|
+
[index$1.getCursorValue(this.handler.direction)]: true,
|
|
21
|
+
}, style: {
|
|
22
|
+
"--size": "20px",
|
|
23
|
+
cursor: index$1.getCursorValue(this.handler.direction),
|
|
24
|
+
}, draggable: false }));
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
CropperHandler.style = cropperHandlerCss;
|
|
28
|
+
|
|
29
|
+
const fromRectangle = (shape, target) => {
|
|
30
|
+
const top = `${shape.y}px`;
|
|
31
|
+
const left = `${shape.x}px`;
|
|
32
|
+
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
33
|
+
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
34
|
+
return {
|
|
35
|
+
top,
|
|
36
|
+
right,
|
|
37
|
+
bottom,
|
|
38
|
+
left,
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
42
|
+
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
10
43
|
|
|
11
44
|
// -------------------------------------------------------------------------------------
|
|
12
45
|
// -------------------------------------------------------------------------------------
|
|
@@ -28,21 +61,6 @@ var Ord = {
|
|
|
28
61
|
compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
|
|
29
62
|
};
|
|
30
63
|
|
|
31
|
-
const fromRectangle = (shape, target) => {
|
|
32
|
-
const top = `${shape.y}px`;
|
|
33
|
-
const left = `${shape.x}px`;
|
|
34
|
-
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
35
|
-
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
36
|
-
return {
|
|
37
|
-
top,
|
|
38
|
-
right,
|
|
39
|
-
bottom,
|
|
40
|
-
left,
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
44
|
-
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
45
|
-
|
|
46
64
|
const highlightBoxCss = ":host{display:grid;position:absolute;box-sizing:border-box;border:none;width:100%;height:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;--size:10px;--x-position:0;--y-position:0}img{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.pointer{position:absolute;width:var(--size);height:var(--size);background:black;border-radius:50%;z-index:2;cursor:pointer;transform:translate(var(--x-position), var(--y-position)) scale(0);-webkit-animation:0.25s linear fadein;animation:0.25s linear fadein;-webkit-animation-fill-mode:forwards;animation-fill-mode:forwards}.pointer::after{content:\"\";cursor:pointer;border:5px solid black;border-radius:50%;width:var(--size);height:var(--size);display:block;transform:translate(calc(-50% + var(--size) * 0.5), calc(-50% + var(--size) * 0.5));padding:calc(var(--size) * 0.5);opacity:.75}@-webkit-keyframes fadein{from{transform:translate(var(--x-position), var(--y-position)) scale(0)}to{transform:translate(var(--x-position), var(--y-position)) scale(1)}}@keyframes fadein{from{transform:translate(var(--x-position), var(--y-position)) scale(0)}to{transform:translate(var(--x-position), var(--y-position)) scale(1)}}";
|
|
47
65
|
|
|
48
66
|
let HighlightBox = class {
|
|
@@ -50,10 +68,10 @@ let HighlightBox = class {
|
|
|
50
68
|
index.registerInstance(this, hostRef);
|
|
51
69
|
}
|
|
52
70
|
getInsetValue() {
|
|
53
|
-
return
|
|
71
|
+
return index$1.pipe(index$1.sequenceToOption(index$1.imageSearchState.searchArea, index$1.imageSearchState.imageBounds), index$1.Option.map(([selection, image]) => getClipValue(selection, image)), index$1.Option.getOrElse(() => ""));
|
|
54
72
|
}
|
|
55
73
|
renderImage() {
|
|
56
|
-
return
|
|
74
|
+
return index$1.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.imageBounds), index$1.Option.map(([url, bounds]) => (index.h("img", { src: url, width: bounds.width, height: bounds.height, style: { "clip-path": `${this.getInsetValue()}` } }))), index$1.Option.getOrElse(() => ""));
|
|
57
75
|
}
|
|
58
76
|
render() {
|
|
59
77
|
return index.h(index.Host, null, this.renderImage());
|
|
@@ -71,6 +89,7 @@ const MIN_SEARCHAREA_SIZE = 40;
|
|
|
71
89
|
let ImageCropper = class {
|
|
72
90
|
constructor(hostRef) {
|
|
73
91
|
index.registerInstance(this, hostRef);
|
|
92
|
+
this.cropperChanged = index.createEvent(this, "cropperChanged", 7);
|
|
74
93
|
this.disabled = false;
|
|
75
94
|
this.handleMove = false;
|
|
76
95
|
this.mouseStartPoint = undefined;
|
|
@@ -82,46 +101,49 @@ let ImageCropper = class {
|
|
|
82
101
|
handleHandlerMove(event) {
|
|
83
102
|
event.preventDefault();
|
|
84
103
|
event.stopPropagation();
|
|
85
|
-
const destination =
|
|
86
|
-
const distance =
|
|
104
|
+
const destination = index$1.fromMouseEvent(event);
|
|
105
|
+
const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
87
106
|
const transformedHandler = {
|
|
88
107
|
position: distance,
|
|
89
108
|
direction: this.handlerMoveDirection,
|
|
90
109
|
};
|
|
91
|
-
|
|
92
|
-
const newSearchArea =
|
|
93
|
-
if (newSearchArea
|
|
94
|
-
newSearchArea.height < MIN_SEARCHAREA_SIZE ||
|
|
95
|
-
newSearchArea.x < 0 ||
|
|
96
|
-
newSearchArea.y < 0 ||
|
|
97
|
-
this.bounds.height - (newSearchArea.y + newSearchArea.height) < 0 ||
|
|
98
|
-
this.bounds.width - (newSearchArea.x + newSearchArea.width) < 0)
|
|
110
|
+
index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((area) => {
|
|
111
|
+
const newSearchArea = index$1.transform(area, transformedHandler);
|
|
112
|
+
if (this.outOfBounds(newSearchArea))
|
|
99
113
|
return;
|
|
100
|
-
|
|
114
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
|
|
101
115
|
this.mouseStartPoint = destination;
|
|
102
|
-
|
|
116
|
+
index$1.imageSearchState.detectedObject = undefined;
|
|
103
117
|
}));
|
|
104
118
|
}
|
|
119
|
+
outOfBounds(area) {
|
|
120
|
+
return (area.width < MIN_SEARCHAREA_SIZE ||
|
|
121
|
+
area.height < MIN_SEARCHAREA_SIZE ||
|
|
122
|
+
area.x < 0 ||
|
|
123
|
+
area.y < 0 ||
|
|
124
|
+
this.bounds.height - (area.y + area.height) < 0 ||
|
|
125
|
+
this.bounds.width - (area.x + area.width) < 0);
|
|
126
|
+
}
|
|
105
127
|
handleCropperMove(ev) {
|
|
106
128
|
ev.preventDefault();
|
|
107
129
|
ev.stopPropagation();
|
|
108
|
-
const destination =
|
|
109
|
-
const distance =
|
|
110
|
-
|
|
111
|
-
const newSearchArea =
|
|
130
|
+
const destination = index$1.fromMouseEvent(ev);
|
|
131
|
+
const distance = index$1.pointDiffSemigroup.concat(destination, this.mouseStartPoint);
|
|
132
|
+
index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((searchArea) => {
|
|
133
|
+
const newSearchArea = index$1.move(searchArea, distance);
|
|
112
134
|
if (newSearchArea.x < 0 ||
|
|
113
135
|
newSearchArea.y < 0 ||
|
|
114
136
|
this.bounds.height - (newSearchArea.y + newSearchArea.height) < 0 ||
|
|
115
137
|
this.bounds.width - (newSearchArea.x + newSearchArea.width) < 0)
|
|
116
138
|
return;
|
|
117
|
-
|
|
118
|
-
|
|
139
|
+
index$1.imageSearchState.detectedObject = undefined;
|
|
140
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(newSearchArea);
|
|
119
141
|
this.mouseStartPoint = destination;
|
|
120
142
|
}));
|
|
121
143
|
}
|
|
122
144
|
handlePointerDown(event) {
|
|
123
145
|
event.stopPropagation();
|
|
124
|
-
this.mouseStartPoint =
|
|
146
|
+
this.mouseStartPoint = index$1.fromMouseEvent(event);
|
|
125
147
|
// should be htmlelement or handler
|
|
126
148
|
const target = findTarget(event);
|
|
127
149
|
if (target.localName === "cropper-handler") {
|
|
@@ -141,17 +163,18 @@ let ImageCropper = class {
|
|
|
141
163
|
this.el.removeEventListener("pointermove", this.pointerMoveListener);
|
|
142
164
|
document.removeEventListener("pointerup", this.pointerReleaseListener);
|
|
143
165
|
this.mouseStartPoint = undefined;
|
|
144
|
-
|
|
166
|
+
index$1.makeRectangularSearchRequest();
|
|
167
|
+
this.cropperChanged.emit();
|
|
145
168
|
}
|
|
146
169
|
getStyleMap() {
|
|
147
|
-
return
|
|
170
|
+
return index$1._function.pipe(index$1.imageSearchState.searchArea, index$1.Option.map((rectangle) => {
|
|
148
171
|
return {
|
|
149
172
|
width: `${rectangle.width}px`,
|
|
150
173
|
height: `${rectangle.height}px`,
|
|
151
174
|
transform: `translate3d(${rectangle.x}px, ${rectangle.y}px, 0)`,
|
|
152
175
|
cursor: this.handleMove ? "move" : "default",
|
|
153
176
|
};
|
|
154
|
-
}),
|
|
177
|
+
}), index$1.Option.getOrElse(() => {
|
|
155
178
|
return {};
|
|
156
179
|
}));
|
|
157
180
|
}
|
|
@@ -160,7 +183,7 @@ let ImageCropper = class {
|
|
|
160
183
|
"crop-area": true,
|
|
161
184
|
active: this.handleMove,
|
|
162
185
|
disabled: this.disabled,
|
|
163
|
-
}, draggable: false, style: this.getStyleMap(), onContextMenu: () => false, onPointerDown: (ev) => this.handlePointerDown(ev) },
|
|
186
|
+
}, 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) }))))));
|
|
164
187
|
}
|
|
165
188
|
get el() { return index.getElement(this); }
|
|
166
189
|
};
|
|
@@ -174,6 +197,7 @@ const getFilterId = (filter) => filter.href.split("/").reverse()[0];
|
|
|
174
197
|
let SearchFilters = class {
|
|
175
198
|
constructor(hostRef) {
|
|
176
199
|
index.registerInstance(this, hostRef);
|
|
200
|
+
this.filterSelected = index.createEvent(this, "filterSelected", 7);
|
|
177
201
|
this.filter = null;
|
|
178
202
|
this.selectedCategoryId = null;
|
|
179
203
|
this.hideFilters = true;
|
|
@@ -185,12 +209,14 @@ let SearchFilters = class {
|
|
|
185
209
|
}
|
|
186
210
|
selectFilter(filter) {
|
|
187
211
|
this.selectedCategoryId = getFilterId(filter);
|
|
188
|
-
|
|
212
|
+
index$1.imageSearchState.activeIonLink = filter;
|
|
213
|
+
this.filterSelected.emit("select");
|
|
189
214
|
}
|
|
190
215
|
clearSelectedFilter() {
|
|
191
216
|
this.selectedCategoryId = null;
|
|
192
|
-
|
|
217
|
+
index$1.imageSearchState.activeIonLink = undefined;
|
|
193
218
|
this.findSelectedFilter().blur();
|
|
219
|
+
this.filterSelected.emit("deselect");
|
|
194
220
|
}
|
|
195
221
|
findSelectedFilter() {
|
|
196
222
|
return this.el.shadowRoot.querySelector(ACTIVE_FILTER_CLASSNAME);
|
|
@@ -215,7 +241,7 @@ let SearchFilters = class {
|
|
|
215
241
|
}, style: { "animation-delay": `${n * 10}ms` }, onPointerUp: (ev) => {
|
|
216
242
|
ev.stopPropagation();
|
|
217
243
|
this.handleFilterSelection(f);
|
|
218
|
-
}, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$
|
|
244
|
+
}, onKeyPress: (ev) => this.handleEnter(ev, f) }, this.isFilterSelected(f) ? index.h(index$2.CheckIcon, null) : null, f.name))), index.h("div", { class: {
|
|
219
245
|
filter: true,
|
|
220
246
|
"show-more": true,
|
|
221
247
|
hidden: this.filter.filters.length <= FILTERS_COUNT,
|
|
@@ -235,33 +261,35 @@ const vviinnDetectedObjectCss = ":host{--color-primary-system:#0F62FE;--color-pr
|
|
|
235
261
|
let VviinnDetectedObject = class {
|
|
236
262
|
constructor(hostRef) {
|
|
237
263
|
index.registerInstance(this, hostRef);
|
|
264
|
+
this.detectedObjectClicked = index.createEvent(this, "detectedObjectClicked", 7);
|
|
238
265
|
this.position = ["0", "0"];
|
|
239
266
|
}
|
|
240
267
|
getObjectPosition() {
|
|
241
|
-
return
|
|
242
|
-
const objectRectangle =
|
|
243
|
-
const { x, y } =
|
|
268
|
+
return index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
|
|
269
|
+
const objectRectangle = index$1.fromAlt(index$1.foldValueObject(this.detectedObject).rectangle);
|
|
270
|
+
const { x, y } = index$1._function.pipe(objectRectangle, index$1.scaleWithSized(bounds), index$1.center);
|
|
244
271
|
return [`${x}px`, `${y}px`];
|
|
245
|
-
}),
|
|
272
|
+
}), index$1.Option.getOrElse(() => ["0", "0"]));
|
|
246
273
|
}
|
|
247
274
|
selectDetectedObject() {
|
|
248
|
-
|
|
249
|
-
const rectangle =
|
|
250
|
-
const transformedRect =
|
|
251
|
-
const scaledRect =
|
|
252
|
-
|
|
253
|
-
|
|
275
|
+
index$1._function.pipe(index$1.imageSearchState.imageBounds, index$1.Option.map((bounds) => {
|
|
276
|
+
const rectangle = index$1.foldValueObject(this.detectedObject).rectangle;
|
|
277
|
+
const transformedRect = index$1.fromAlt(rectangle);
|
|
278
|
+
const scaledRect = index$1.scaleWithSized(bounds)(transformedRect);
|
|
279
|
+
index$1.imageSearchState.detectedObject = this.detectedObject;
|
|
280
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(scaledRect);
|
|
254
281
|
}));
|
|
255
|
-
|
|
282
|
+
index$1.makeRectangularSearchRequest();
|
|
283
|
+
this.detectedObjectClicked.emit();
|
|
256
284
|
}
|
|
257
285
|
isActive() {
|
|
258
286
|
if (!this.detectedObject)
|
|
259
287
|
return false;
|
|
260
|
-
if (!
|
|
288
|
+
if (!index$1.imageSearchState.detectedObject)
|
|
261
289
|
return false;
|
|
262
|
-
const thisObject =
|
|
263
|
-
const savedObject =
|
|
264
|
-
return
|
|
290
|
+
const thisObject = index$1.foldValueObject(this.detectedObject);
|
|
291
|
+
const savedObject = index$1.foldValueObject(index$1.imageSearchState.detectedObject);
|
|
292
|
+
return index$1.detectedObjectEq.equals(thisObject, savedObject);
|
|
265
293
|
}
|
|
266
294
|
render() {
|
|
267
295
|
return (index.h(index.Host, { class: {
|
|
@@ -287,6 +315,18 @@ let VviinnEmptyResults = class {
|
|
|
287
315
|
};
|
|
288
316
|
VviinnEmptyResults.style = vviinnEmptyResultsCss;
|
|
289
317
|
|
|
318
|
+
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}";
|
|
319
|
+
|
|
320
|
+
let VviinnError = class {
|
|
321
|
+
constructor(hostRef) {
|
|
322
|
+
index.registerInstance(this, hostRef);
|
|
323
|
+
}
|
|
324
|
+
render() {
|
|
325
|
+
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" })));
|
|
326
|
+
}
|
|
327
|
+
};
|
|
328
|
+
VviinnError.style = vviinnErrorCss;
|
|
329
|
+
|
|
290
330
|
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}}";
|
|
291
331
|
|
|
292
332
|
let VviinnExampleImage = class {
|
|
@@ -301,14 +341,14 @@ let VviinnExampleImage = class {
|
|
|
301
341
|
}
|
|
302
342
|
async selectImage(_event) {
|
|
303
343
|
this.selected = true;
|
|
304
|
-
const file = await
|
|
305
|
-
const processResult = await
|
|
306
|
-
|
|
344
|
+
const file = await index$1.toFile(this.src);
|
|
345
|
+
const processResult = await index$1.processSelectedFile(file);
|
|
346
|
+
index$1._function.pipe(processResult, index$1.Either.match(() => this.exampleImageError.emit(), () => this.exampleImageSelected.emit()));
|
|
307
347
|
this.selected = false;
|
|
308
348
|
}
|
|
309
349
|
showPreloader() {
|
|
310
|
-
return ((
|
|
311
|
-
|
|
350
|
+
return ((index$1.imageSearchState.objectDetectionInProgress ||
|
|
351
|
+
index$1.imageSearchState.loading) &&
|
|
312
352
|
this.selected);
|
|
313
353
|
}
|
|
314
354
|
render() {
|
|
@@ -335,7 +375,7 @@ let VviinnExampleImages = class {
|
|
|
335
375
|
customizedSlots.slotChangeListener(this, this.el);
|
|
336
376
|
}
|
|
337
377
|
render() {
|
|
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:
|
|
378
|
+
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: 480, height: 640, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDEtTC5qcGc=" })), index.h("slot", { name: "vviinn-example-images-2" }, index.h("vviinn-example-image", { width: 280, height: 480, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDItTS5qcGc=" })), index.h("slot", { name: "vviinn-example-images-3" }, index.h("vviinn-example-image", { width: 280, height: 480, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDMtTS5qcGc=" })), index.h("slot", { name: "vviinn-example-images-4" }, index.h("vviinn-example-image", { width: 480, height: 640, src: "https://cdn.vviinn.com/0/fit/480/0/ce/0/Z3M6Ly9haWFhcy1pbWdwcm94eS9leGFtcGxlcy9pbWctaW5zcGlyYXRpb24tMDQtTC5qcGc=" })))));
|
|
339
379
|
}
|
|
340
380
|
get el() { return index.getElement(this); }
|
|
341
381
|
};
|
|
@@ -351,12 +391,12 @@ let VviinnImageSelector = class {
|
|
|
351
391
|
}
|
|
352
392
|
async handleInputChange(event) {
|
|
353
393
|
const input = event.target;
|
|
354
|
-
const processingResult = await
|
|
355
|
-
|
|
394
|
+
const processingResult = await index$1.processSelectedFile(input.files[0]);
|
|
395
|
+
index$1._function.pipe(processingResult, index$1.match(() => this.imageSelectedError.emit(), () => this.imageSelected.emit()));
|
|
356
396
|
input.value = null;
|
|
357
397
|
}
|
|
358
398
|
isLoading() {
|
|
359
|
-
return (
|
|
399
|
+
return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
|
|
360
400
|
}
|
|
361
401
|
render() {
|
|
362
402
|
return (index.h(index.Host, { exportparts: "button" }, this.isLoading() ? index.h("vviinn-preloader", null) : null, this.isLoading() ? null : (index.h("label", { htmlFor: "fileInput", part: "button" }, index.h("slot", { name: "upload-button-text" }, "Upload image"))), index.h("input", { id: "fileInput", class: "visually-hidden", type: "file", accept: "image/*", onChange: (event) => this.handleInputChange(event) })));
|
|
@@ -367,8 +407,8 @@ VviinnImageSelector.style = vviinnImageSelectorCss;
|
|
|
367
407
|
const vviinnImageViewCss = ":host{display:grid;position:relative;justify-self:center}img{box-sizing:border-box;filter:brightness(60%);position:relative;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:-1}.image-preloader{background:rgba(0, 0, 0, 0.25);border-radius:4px;bottom:18px;padding:4px 6px;pointer-events:none;position:absolute;right:18px;z-index:4}vviinn-preloader{--preloader-size:12px}";
|
|
368
408
|
|
|
369
409
|
const getImageSizes = (i) => {
|
|
370
|
-
const dimensions =
|
|
371
|
-
const resize =
|
|
410
|
+
const dimensions = index$1.dimensionsFromImage(i);
|
|
411
|
+
const resize = index$1.scaleByLargestSide(288);
|
|
372
412
|
const newDimensions = resize(dimensions);
|
|
373
413
|
const sizes = newDimensions.map(d => d.size);
|
|
374
414
|
return [sizes[0], sizes[1]];
|
|
@@ -379,34 +419,34 @@ let VviinnImageView = class {
|
|
|
379
419
|
}
|
|
380
420
|
handleInitialImageLoad(ev) {
|
|
381
421
|
const target = ev.target;
|
|
382
|
-
const imageBounds =
|
|
422
|
+
const imageBounds = index$1.fromImage(target);
|
|
383
423
|
const padding = 12;
|
|
384
|
-
const { x, y } =
|
|
424
|
+
const { x, y } = index$1.move(imageBounds, { x: padding, y: padding });
|
|
385
425
|
const searchArea = {
|
|
386
426
|
x,
|
|
387
427
|
y,
|
|
388
428
|
width: imageBounds.width - padding * 2,
|
|
389
429
|
height: imageBounds.height - padding * 2,
|
|
390
430
|
};
|
|
391
|
-
|
|
392
|
-
|
|
431
|
+
index$1.imageSearchState.imageBounds = index$1.Option.some(imageBounds);
|
|
432
|
+
index$1.imageSearchState.searchArea = index$1.Option.some(searchArea);
|
|
393
433
|
}
|
|
394
434
|
renderDetectedObject(object) {
|
|
395
435
|
return index.h("vviinn-detected-object", { detectedObject: object });
|
|
396
436
|
}
|
|
397
437
|
renderImage() {
|
|
398
|
-
return
|
|
438
|
+
return index$1._function.pipe(index$1.sequenceToOption(index$1.imageSearchState.imageUrl, index$1.imageSearchState.image), index$1.Option.map(([url, refImage]) => {
|
|
399
439
|
const [width, height] = getImageSizes(refImage);
|
|
400
440
|
const image = (index.h("img", { decoding: "async", width: width, height: height, src: url, onLoad: (el) => this.handleInitialImageLoad(el), draggable: false }));
|
|
401
441
|
return image;
|
|
402
|
-
}),
|
|
442
|
+
}), index$1.Option.getOrElse(() => null));
|
|
403
443
|
}
|
|
404
444
|
renderCropper() {
|
|
405
|
-
return
|
|
445
|
+
return index$1._function.pipe(index$1.imageSearchState.imageUrl, index$1.Option.map(() => index.h("image-cropper", null)), index$1.Option.getOrElse(() => null));
|
|
406
446
|
}
|
|
407
447
|
render() {
|
|
408
|
-
return (index.h(index.Host, null,
|
|
409
|
-
|
|
448
|
+
return (index.h(index.Host, null, index$1.imageSearchState.loading ||
|
|
449
|
+
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))));
|
|
410
450
|
}
|
|
411
451
|
};
|
|
412
452
|
VviinnImageView.style = vviinnImageViewCss;
|
|
@@ -464,7 +504,7 @@ let VviinnOnboardingCard1 = class {
|
|
|
464
504
|
customizedSlots.slotChangeListener(this, this.el);
|
|
465
505
|
}
|
|
466
506
|
render() {
|
|
467
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-1-icon" }, index.h(index$
|
|
507
|
+
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.")))));
|
|
468
508
|
}
|
|
469
509
|
get el() { return index.getElement(this); }
|
|
470
510
|
};
|
|
@@ -480,7 +520,7 @@ let VviinnOnboardingCard2 = class {
|
|
|
480
520
|
customizedSlots.slotChangeListener(this, this.el);
|
|
481
521
|
}
|
|
482
522
|
render() {
|
|
483
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-2-icon" }, index.h(index$
|
|
523
|
+
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.")))));
|
|
484
524
|
}
|
|
485
525
|
get el() { return index.getElement(this); }
|
|
486
526
|
};
|
|
@@ -496,7 +536,7 @@ let VviinnOnboardingCard3 = class {
|
|
|
496
536
|
customizedSlots.slotChangeListener(this, this.el);
|
|
497
537
|
}
|
|
498
538
|
render() {
|
|
499
|
-
return (index.h(index.Host, null, index.h("slot", { name: "onboarding-card-3-icon" }, index.h(index$
|
|
539
|
+
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.")))));
|
|
500
540
|
}
|
|
501
541
|
get el() { return index.getElement(this); }
|
|
502
542
|
};
|
|
@@ -529,6 +569,23 @@ let VviinnOverlayedModal = class {
|
|
|
529
569
|
};
|
|
530
570
|
VviinnOverlayedModal.style = vviinnOverlayedModalCss;
|
|
531
571
|
|
|
572
|
+
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)}}";
|
|
573
|
+
|
|
574
|
+
let VviinnPreloader = class {
|
|
575
|
+
constructor(hostRef) {
|
|
576
|
+
index.registerInstance(this, hostRef);
|
|
577
|
+
}
|
|
578
|
+
isActive() {
|
|
579
|
+
return (index$1.imageSearchState.loading || index$1.imageSearchState.objectDetectionInProgress);
|
|
580
|
+
}
|
|
581
|
+
render() {
|
|
582
|
+
return (index.h(index.Host, { class: {
|
|
583
|
+
active: this.isActive(),
|
|
584
|
+
} }));
|
|
585
|
+
}
|
|
586
|
+
};
|
|
587
|
+
VviinnPreloader.style = vviinnPreloaderCss;
|
|
588
|
+
|
|
532
589
|
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}";
|
|
533
590
|
|
|
534
591
|
let VviinnPrivacyBadge = class {
|
|
@@ -545,6 +602,190 @@ let VviinnPrivacyBadge = class {
|
|
|
545
602
|
};
|
|
546
603
|
VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
|
|
547
604
|
|
|
605
|
+
class GtagAnalytics {
|
|
606
|
+
sendImpression(product) {
|
|
607
|
+
var _a, _b, _c;
|
|
608
|
+
gtag('event', 'view_item_list', {
|
|
609
|
+
items: [
|
|
610
|
+
{
|
|
611
|
+
id: product.productId,
|
|
612
|
+
name: product.title,
|
|
613
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
614
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
615
|
+
list_name: 'VI VPR View',
|
|
616
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
617
|
+
}
|
|
618
|
+
]
|
|
619
|
+
});
|
|
620
|
+
return undefined;
|
|
621
|
+
}
|
|
622
|
+
sendClick(product) {
|
|
623
|
+
var _a, _b, _c;
|
|
624
|
+
gtag('event', 'select_content', {
|
|
625
|
+
content_type: 'product',
|
|
626
|
+
items: [
|
|
627
|
+
{
|
|
628
|
+
id: product.productId,
|
|
629
|
+
name: product.title,
|
|
630
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
631
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
632
|
+
list_name: 'VI VPR View',
|
|
633
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
634
|
+
}
|
|
635
|
+
]
|
|
636
|
+
});
|
|
637
|
+
return undefined;
|
|
638
|
+
}
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
class GAnalytics {
|
|
642
|
+
constructor() {
|
|
643
|
+
ga('require', 'ec');
|
|
644
|
+
}
|
|
645
|
+
convertProduct(product) {
|
|
646
|
+
var _a, _b, _c;
|
|
647
|
+
return {
|
|
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: 'VI VPR View',
|
|
653
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
654
|
+
};
|
|
655
|
+
}
|
|
656
|
+
sendImpression(product) {
|
|
657
|
+
ga('ec:addImpression', this.convertProduct(product));
|
|
658
|
+
return undefined;
|
|
659
|
+
}
|
|
660
|
+
sendClick(product) {
|
|
661
|
+
var _a, _b, _c;
|
|
662
|
+
ga('ec:addProduct', {
|
|
663
|
+
id: product.productId,
|
|
664
|
+
name: product.title,
|
|
665
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
666
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
667
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
668
|
+
});
|
|
669
|
+
ga('ec:setAction', 'click', { list: 'VI VPR View' });
|
|
670
|
+
return undefined;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
|
|
674
|
+
const getGtagAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.gtag), index$1.Option.map(() => new GtagAnalytics()));
|
|
675
|
+
const getCommonAnalytics = () => index$1._function.pipe(index$1.Option.fromNullable(window.ga), index$1.Option.map(() => new GAnalytics()));
|
|
676
|
+
const analyticsMonoid = index$1.Option.getMonoid(index$1.Semigroup.first());
|
|
677
|
+
const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
|
|
678
|
+
|
|
679
|
+
const FIT_EXPR = /fit\/\d+\//;
|
|
680
|
+
const containsFit = (url) => {
|
|
681
|
+
return index$1._function.pipe(url.match(FIT_EXPR), index$1.Either.fromNullable(url), index$1.Either.map(() => url));
|
|
682
|
+
};
|
|
683
|
+
const processWidth = (url, size) => {
|
|
684
|
+
return index$1._function.pipe(containsFit(url), index$1.Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), index$1.Either.getOrElse(() => url));
|
|
685
|
+
};
|
|
686
|
+
const Linked = (props, child) => props.deeplink ? (index.h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
|
|
687
|
+
const FormattedPrice = (props) => {
|
|
688
|
+
var _a;
|
|
689
|
+
const locale = props.locale;
|
|
690
|
+
const formattedPrice = new Intl.NumberFormat(locale, {
|
|
691
|
+
minimumFractionDigits: 2,
|
|
692
|
+
}).format(props.price);
|
|
693
|
+
const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
|
|
694
|
+
return (index.h("span", { class: "price-amount", part: "price-amount" }, fullPrice));
|
|
695
|
+
};
|
|
696
|
+
const Price = (props) => {
|
|
697
|
+
const priceEl = (index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale }));
|
|
698
|
+
return (index.h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
|
|
699
|
+
index.h("span", { class: "price-sale", part: "price-sale" },
|
|
700
|
+
index.h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale })),
|
|
701
|
+
index.h("span", { class: "price-outdated", part: "price-outdated" }, priceEl),
|
|
702
|
+
]) : (index.h("span", { class: "price-regular", part: "price-regular" }, priceEl))));
|
|
703
|
+
};
|
|
704
|
+
const Image = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
705
|
+
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 })));
|
|
706
|
+
const ResponsiveImage = (props, onLoadEnd = () => undefined) => (index.h("picture", null,
|
|
707
|
+
index.h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
708
|
+
|
|
709
|
+
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}";
|
|
710
|
+
|
|
711
|
+
let VviinnProductCard = class {
|
|
712
|
+
constructor(hostRef) {
|
|
713
|
+
index.registerInstance(this, hostRef);
|
|
714
|
+
this.recommendationLoad = index.createEvent(this, "recommendationLoad", 7);
|
|
715
|
+
this.recommendationView = index.createEvent(this, "recommendationView", 7);
|
|
716
|
+
this.recommendationClick = index.createEvent(this, "recommendationClick", 7);
|
|
717
|
+
this.productImageLoaded = index.createEvent(this, "productImageLoaded", 7);
|
|
718
|
+
this.currency = undefined;
|
|
719
|
+
this.imageRatio = 1;
|
|
720
|
+
this.imageWidth = 200;
|
|
721
|
+
this.locale = undefined;
|
|
722
|
+
this.pricePrefix = undefined;
|
|
723
|
+
this.responsive = false;
|
|
724
|
+
this.dimmedBackground = false;
|
|
725
|
+
/** @internal */
|
|
726
|
+
this.index = 0;
|
|
727
|
+
this.imageLoaded = false;
|
|
728
|
+
this.productData = null;
|
|
729
|
+
this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
|
|
730
|
+
}
|
|
731
|
+
connectedCallback() {
|
|
732
|
+
this.productData = {
|
|
733
|
+
product: this.productId,
|
|
734
|
+
rank: this.index
|
|
735
|
+
};
|
|
736
|
+
}
|
|
737
|
+
intersectionCallback(data) {
|
|
738
|
+
if (data.some((entry) => entry.isIntersecting)) {
|
|
739
|
+
index$1._function.pipe(getAnalyticsModule, index$1.Option.map((analytics) => analytics.sendImpression(this.getProduct())));
|
|
740
|
+
this.recommendationView.emit(this.productData);
|
|
741
|
+
this.intersectionObserver.disconnect();
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
componentDidLoad() {
|
|
745
|
+
this.recommendationLoad.emit(this.productData);
|
|
746
|
+
this.intersectionObserver.observe(this.el);
|
|
747
|
+
const links = this.el.shadowRoot.querySelectorAll("a");
|
|
748
|
+
links.forEach((link) => link.addEventListener("mousedown", (event) => {
|
|
749
|
+
this.recommendationClick.emit(this.productData);
|
|
750
|
+
if (window.ga) {
|
|
751
|
+
event.preventDefault();
|
|
752
|
+
}
|
|
753
|
+
index$1._function.pipe(getAnalyticsModule, index$1.Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
|
|
754
|
+
if (window.ga) {
|
|
755
|
+
ga("send", "event", "UX", "click", "Results", {
|
|
756
|
+
hitCallback: function () {
|
|
757
|
+
document.location.href = this.deeplink;
|
|
758
|
+
},
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
}));
|
|
762
|
+
}
|
|
763
|
+
getProduct() {
|
|
764
|
+
return index$1.imageSearchState.results.find((r) => r.productId === this.productId);
|
|
765
|
+
}
|
|
766
|
+
renderImage() {
|
|
767
|
+
const props = {
|
|
768
|
+
width: this.imageWidth,
|
|
769
|
+
height: this.imageWidth * this.imageRatio,
|
|
770
|
+
src: this.image,
|
|
771
|
+
title: this.productTitle,
|
|
772
|
+
lazy: false,
|
|
773
|
+
};
|
|
774
|
+
return this.responsive
|
|
775
|
+
? ResponsiveImage(props, () => this.kek())
|
|
776
|
+
: Image(props, () => this.kek());
|
|
777
|
+
}
|
|
778
|
+
kek() {
|
|
779
|
+
this.productImageLoaded.emit(this.productId);
|
|
780
|
+
}
|
|
781
|
+
render() {
|
|
782
|
+
var _a, _b, _c;
|
|
783
|
+
return (index.h(index.Host, { part: "product-card", class: { dimmed: this.dimmedBackground }, exportparts: "brand, currency, deeplink, image, image-link, price-amount, price-container, price-outdated, price-prefix, price-regular, price-sale, title" }, index.h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), index.h(Linked, { deeplink: this.deeplink, part: "deeplink" }, index.h("span", { class: "title", part: "title" }, this.productTitle)), index.h("span", { class: "brand", part: "brand" }, this.brand), index.h("span", { class: "type", part: "type" }, this.productType), index.h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : index$1.state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : index$1.state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : index$1.state.locale })));
|
|
784
|
+
}
|
|
785
|
+
get el() { return index.getElement(this); }
|
|
786
|
+
};
|
|
787
|
+
VviinnProductCard.style = vviinnProductCardCss;
|
|
788
|
+
|
|
548
789
|
const vviinnServerErrorCss = ":host{display:block}";
|
|
549
790
|
|
|
550
791
|
let VviinnServerError = class {
|
|
@@ -578,7 +819,7 @@ const getStyleMap = (data) => {
|
|
|
578
819
|
};
|
|
579
820
|
};
|
|
580
821
|
const Arrow = ({ kind, tabindex, disabled, onClick, onKeyDown, }) => (index.h("div", { class: getStyleMap({ kind, disabled }), onClick: onClick, tabindex: tabindex, onKeyDown: onKeyDown },
|
|
581
|
-
index.h(index$
|
|
822
|
+
index.h(index$2.ArrowIcon, null)));
|
|
582
823
|
|
|
583
824
|
const vviinnSliderCss = ":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{--num-items:0;--position:0;display:grid;grid-gap:20px;justify-items:center;position:relative}.items-wrapper{overflow:hidden;width:100%}.items{box-sizing:border-box;display:grid;grid-auto-flow:column;grid-template-columns:repeat(var(--num-items), 100%);transform:translateX(calc(-100% * var(--position)));transition:transform 0.33s ease-in-out}.controls{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--num-items), -webkit-min-content);grid-template-columns:repeat(var(--num-items), min-content)}.bullet{background:#E0E0E0;border-radius:50%;box-sizing:border-box;cursor:pointer;height:8px;width:8px;transition:background 0.1s ease-in-out}.bullet:hover{background:#C6C6C6}.bullet.active{background:var(--color-primary, var(--color-primary-system))}.bullet:active{background:transparent;border:2px solid var(--color-primary, var(--color-primary-system))}.arrow-wrapper{align-items:center;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}";
|
|
584
825
|
|
|
@@ -587,7 +828,7 @@ let VviinnSlider = class {
|
|
|
587
828
|
index.registerInstance(this, hostRef);
|
|
588
829
|
this.elementsCount = 0;
|
|
589
830
|
this.internalPosition = 0;
|
|
590
|
-
this.swipeStartPosition =
|
|
831
|
+
this.swipeStartPosition = index$1.Option.none;
|
|
591
832
|
this.showBullets = true;
|
|
592
833
|
this.position = 0;
|
|
593
834
|
this.showArrows = false;
|
|
@@ -617,7 +858,7 @@ let VviinnSlider = class {
|
|
|
617
858
|
this.setActiveCssClassToSlide(index);
|
|
618
859
|
}
|
|
619
860
|
renderBullets() {
|
|
620
|
-
return this.showBullets ? (index.h("div", { class: "controls" },
|
|
861
|
+
return this.showBullets ? (index.h("div", { class: "controls" }, index$1.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
|
|
621
862
|
bullet: true,
|
|
622
863
|
active: i == this.internalPosition % this.elementsCount,
|
|
623
864
|
}, onClick: () => this.goToSlide(i) }))))) : null;
|
|
@@ -654,13 +895,13 @@ let VviinnSlider = class {
|
|
|
654
895
|
handleTouchStart(event) {
|
|
655
896
|
if (!this.showBullets)
|
|
656
897
|
return;
|
|
657
|
-
this.swipeStartPosition =
|
|
898
|
+
this.swipeStartPosition = index$1._function.pipe(event.touches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
|
|
658
899
|
}
|
|
659
900
|
handleTouchEnd(event) {
|
|
660
901
|
if (!this.showBullets)
|
|
661
902
|
return;
|
|
662
|
-
const swipeEndPosition =
|
|
663
|
-
|
|
903
|
+
const swipeEndPosition = index$1._function.pipe(event.changedTouches[0], index$1.Option.fromNullable, index$1.Option.map((t) => t.clientX));
|
|
904
|
+
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) => {
|
|
664
905
|
switch (swipeDirection) {
|
|
665
906
|
case 1:
|
|
666
907
|
return this.nextSlide();
|
|
@@ -700,6 +941,154 @@ let VviinnTeaser = class {
|
|
|
700
941
|
};
|
|
701
942
|
VviinnTeaser.style = vviinnTeaserCss;
|
|
702
943
|
|
|
944
|
+
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}";
|
|
945
|
+
|
|
946
|
+
let VviinnVpsWidget = class {
|
|
947
|
+
constructor(hostRef) {
|
|
948
|
+
index.registerInstance(this, hostRef);
|
|
949
|
+
/** @internal */
|
|
950
|
+
this.apiPath = "https://api.vviinn.com";
|
|
951
|
+
/** When true modal window with widget will be shown */
|
|
952
|
+
this.active = false;
|
|
953
|
+
/** Currency sign will shown after price */
|
|
954
|
+
this.currencySign = "€";
|
|
955
|
+
/** Locale for currency formatting */
|
|
956
|
+
this.locale = "de-DE";
|
|
957
|
+
this.slidePosition = 0;
|
|
958
|
+
this.width = 0;
|
|
959
|
+
this.wrongImageFormat = false;
|
|
960
|
+
this.imageSource = null;
|
|
961
|
+
}
|
|
962
|
+
activeWatcher(value) {
|
|
963
|
+
if (value) {
|
|
964
|
+
this.overflow = document.body.style.overflow;
|
|
965
|
+
document.body.style.overflow = "hidden";
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
document.body.style.overflow = this.overflow;
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
trackRecommendationView({ detail }) {
|
|
972
|
+
const recommendationViewEvent = index$1.createProductViewVpsEvent(Object.assign({ session_id: this.uiSessionId }, detail));
|
|
973
|
+
this.trackingApi.trackEvent(recommendationViewEvent);
|
|
974
|
+
}
|
|
975
|
+
trackRecommendationClick({ detail }) {
|
|
976
|
+
const recommendationClickEvent = index$1.createProductViewVpsEvent(Object.assign({ sessionId: this.uiSessionId }, detail));
|
|
977
|
+
this.trackingApi.trackEvent(recommendationClickEvent);
|
|
978
|
+
}
|
|
979
|
+
trachSearchAreaChanges() {
|
|
980
|
+
const searchEvent = index$1.createSearchEvent({
|
|
981
|
+
session_id: this.uiSessionId,
|
|
982
|
+
source: this.imageSource,
|
|
983
|
+
search_area: "manual-selection",
|
|
984
|
+
});
|
|
985
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
986
|
+
}
|
|
987
|
+
trackDetectedObject() {
|
|
988
|
+
const searchEvent = index$1.createSearchEvent({
|
|
989
|
+
session_id: this.uiSessionId,
|
|
990
|
+
source: this.imageSource,
|
|
991
|
+
search_area: "attention-point",
|
|
992
|
+
});
|
|
993
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
994
|
+
}
|
|
995
|
+
trackFilter({ detail }) {
|
|
996
|
+
const searchEvent = index$1.createFilterEvent({
|
|
997
|
+
session_id: this.uiSessionId,
|
|
998
|
+
source: this.imageSource,
|
|
999
|
+
kind: "category",
|
|
1000
|
+
action: detail,
|
|
1001
|
+
});
|
|
1002
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
1003
|
+
}
|
|
1004
|
+
componentWillLoad() {
|
|
1005
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
1006
|
+
}
|
|
1007
|
+
connectedCallback() {
|
|
1008
|
+
index$1.state.apiPath = this.apiPath;
|
|
1009
|
+
index$1.state.currencySign = this.currencySign;
|
|
1010
|
+
index$1.state.locale = this.locale;
|
|
1011
|
+
index$1.imageSearchState.token = this.token;
|
|
1012
|
+
this.uiSessionId = index$1.v4();
|
|
1013
|
+
this.trackingApi = index$1.createTrackingApi(this.apiPath, this.token);
|
|
1014
|
+
const widgetOpenEvent = index$1.createWidgetVpsEvent({
|
|
1015
|
+
action: "open",
|
|
1016
|
+
session_id: this.uiSessionId,
|
|
1017
|
+
});
|
|
1018
|
+
this.trackingApi.trackEvent(widgetOpenEvent);
|
|
1019
|
+
}
|
|
1020
|
+
handleImageSelection(source) {
|
|
1021
|
+
this.imageSource = source;
|
|
1022
|
+
this.slidePosition = 1;
|
|
1023
|
+
const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
|
|
1024
|
+
const overlay = root.shadowRoot.querySelector("vviinn-overlay");
|
|
1025
|
+
const modal = overlay.querySelector("vviinn-modal");
|
|
1026
|
+
const modalBody = modal.shadowRoot.querySelector(".body");
|
|
1027
|
+
modalBody.scrollTop = 0;
|
|
1028
|
+
this.trackInitialSearch();
|
|
1029
|
+
}
|
|
1030
|
+
trackInitialSearch() {
|
|
1031
|
+
const searchEvent = index$1.createSearchEvent({
|
|
1032
|
+
session_id: this.uiSessionId,
|
|
1033
|
+
source: this.imageSource,
|
|
1034
|
+
search_area: "full",
|
|
1035
|
+
});
|
|
1036
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
1037
|
+
}
|
|
1038
|
+
resetState() {
|
|
1039
|
+
this.resetScroll("onboarding-block");
|
|
1040
|
+
this.slidePosition = 0;
|
|
1041
|
+
index$1.imageSearchState.image = index$1.Option.none;
|
|
1042
|
+
index$1.imageSearchState.imageUrl = index$1.Option.none;
|
|
1043
|
+
index$1.imageSearchState.imageBounds = index$1.Option.none;
|
|
1044
|
+
index$1.imageSearchState.searchArea = index$1.Option.none;
|
|
1045
|
+
index$1.imageSearchState.results = [];
|
|
1046
|
+
index$1.imageSearchState.filters = [];
|
|
1047
|
+
index$1.imageSearchState.detectedObjects = [];
|
|
1048
|
+
index$1.imageSearchState.activeIonLink = undefined;
|
|
1049
|
+
index$1.imageSearchState.rectangleSearchForm = undefined;
|
|
1050
|
+
this.resetScroll("results-block");
|
|
1051
|
+
}
|
|
1052
|
+
haveErrors() {
|
|
1053
|
+
return this.wrongImageFormat || index$1.imageSearchState.serverError;
|
|
1054
|
+
}
|
|
1055
|
+
resetScroll(elementId, behavior = "auto") {
|
|
1056
|
+
const element = this.el.shadowRoot.getElementById(elementId);
|
|
1057
|
+
element.scroll({ top: 0, left: 0, behavior });
|
|
1058
|
+
}
|
|
1059
|
+
handleModalClose() {
|
|
1060
|
+
this.active = false;
|
|
1061
|
+
this.resetState();
|
|
1062
|
+
const elementsToReset = ["onboarding-block", "results-block"];
|
|
1063
|
+
elementsToReset.forEach((name) => this.resetScroll(name));
|
|
1064
|
+
const widgetOpenEvent = index$1.createWidgetVpsEvent({
|
|
1065
|
+
action: "close",
|
|
1066
|
+
session_id: this.uiSessionId,
|
|
1067
|
+
});
|
|
1068
|
+
this.trackingApi.trackEvent(widgetOpenEvent);
|
|
1069
|
+
}
|
|
1070
|
+
render() {
|
|
1071
|
+
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: {
|
|
1072
|
+
error: this.haveErrors(),
|
|
1073
|
+
"start-page_block": true,
|
|
1074
|
+
} }, index.h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, onActionClick: () => (this.wrongImageFormat = false) }), index.h("vviinn-server-error", { class: { hidden: !index$1.imageSearchState.serverError }, onActionClick: () => (index$1.imageSearchState.serverError = false) }), index.h("vviinn-teaser", { class: { hidden: this.haveErrors() } }), index.h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection("upload"), onImageSelectedError: () => (this.wrongImageFormat = true), part: "select-image_button" }, index.h("span", { slot: "upload-button-text", class: "upload-button-content" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "29", height: "28", fill: "none" }, index.h("defs", null), index.h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M10.271 3.89A.875.875 0 0111 3.5h7c.293 0 .566.146.728.39l1.49 2.235h3.033a2.625 2.625 0 012.625 2.625V21a2.625 2.625 0 01-2.625 2.625H5.75A2.625 2.625 0 013.125 21V8.75A2.625 2.625 0 015.75 6.125h3.031l1.49-2.235zm1.197 1.36l-1.49 2.235a.875.875 0 01-.729.39H5.75a.875.875 0 00-.875.875V21a.875.875 0 00.875.875h17.5a.875.875 0 00.875-.875V8.75a.875.875 0 00-.875-.875h-3.5a.875.875 0 01-.729-.39l-1.49-2.235h-6.063z", "clip-rule": "evenodd" }), index.h("path", { fill: "#fff", "fill-rule": "evenodd", d: "M14.5 11.375a3.062 3.062 0 100 6.125 3.062 3.062 0 000-6.125zm-4.813 3.063a4.812 4.812 0 119.625 0 4.812 4.812 0 01-9.625 0z", "clip-rule": "evenodd" })), index.h("slot", { name: "vviinn-image-upload-button-text" }, index.h("span", null, "Kamera oder Bild ausw\u00E4hlen")))), index.h("vviinn-privacy-badge", { class: { hidden: this.haveErrors() } })), index.h("div", { id: "onboarding-block", class: "start-page_block" }, index.h("div", { class: "onboarding-wrapper" }, index.h("vviinn-onboarding", null), index.h("vviinn-example-images", { onImageSelected: () => this.handleImageSelection("example"), onImageSelectedError: () => this.resetScroll("onboarding-block", "smooth") })))), index.h("vviinn-slide", { class: { "results-page": true, active: this.slidePosition == 1 } }, index.h("div", { class: "image-wrapper" }, index.h("vviinn-image-view", null), index.h("div", { class: "filters-wrapper" }, index.h("div", { class: "filters" }, index$1.imageSearchState.filters.map((filter) => (index.h("search-filters", { filter: filter })))))), index.h("div", { id: "results-block", class: "products-wrapper" }, index.h("div", { class: {
|
|
1075
|
+
"nothing-found": true,
|
|
1076
|
+
hidden: index$1.imageSearchState.results.length > 0,
|
|
1077
|
+
} }, index.h("vviinn-empty-results", null), index.h("vviinn-onboarding", null)), index.h("div", { class: {
|
|
1078
|
+
hidden: index$1.imageSearchState.results.length <= 0,
|
|
1079
|
+
products: true,
|
|
1080
|
+
} }, index$1.imageSearchState.results.map((p, i) => {
|
|
1081
|
+
var _a;
|
|
1082
|
+
return (index.h("vviinn-product-card", { hidden: true, productTitle: p.title, productId: p.productId, brand: p.brand, deeplink: p.deeplink, price: p.price.actual, salePrice: p.price.sale, imageWidth: 160, image: (_a = p.image.thumbnail) !== null && _a !== void 0 ? _a : p.image.original, part: "product-card", index: i }));
|
|
1083
|
+
}))))))));
|
|
1084
|
+
}
|
|
1085
|
+
get el() { return index.getElement(this); }
|
|
1086
|
+
static get watchers() { return {
|
|
1087
|
+
"active": ["activeWatcher"]
|
|
1088
|
+
}; }
|
|
1089
|
+
};
|
|
1090
|
+
VviinnVpsWidget.style = vviinnVpsWidgetCss;
|
|
1091
|
+
|
|
703
1092
|
const vviinnWrongFormatCss = ":host{display:block}";
|
|
704
1093
|
|
|
705
1094
|
let VviinnWrongFormat = class {
|
|
@@ -713,11 +1102,13 @@ let VviinnWrongFormat = class {
|
|
|
713
1102
|
};
|
|
714
1103
|
VviinnWrongFormat.style = vviinnWrongFormatCss;
|
|
715
1104
|
|
|
1105
|
+
exports.cropper_handler = CropperHandler;
|
|
716
1106
|
exports.highlight_box = HighlightBox;
|
|
717
1107
|
exports.image_cropper = ImageCropper;
|
|
718
1108
|
exports.search_filters = SearchFilters;
|
|
719
1109
|
exports.vviinn_detected_object = VviinnDetectedObject;
|
|
720
1110
|
exports.vviinn_empty_results = VviinnEmptyResults;
|
|
1111
|
+
exports.vviinn_error = VviinnError;
|
|
721
1112
|
exports.vviinn_example_image = VviinnExampleImage;
|
|
722
1113
|
exports.vviinn_example_images = VviinnExampleImages;
|
|
723
1114
|
exports.vviinn_image_selector = VviinnImageSelector;
|
|
@@ -729,9 +1120,12 @@ exports.vviinn_onboarding_card_2 = VviinnOnboardingCard2;
|
|
|
729
1120
|
exports.vviinn_onboarding_card_3 = VviinnOnboardingCard3;
|
|
730
1121
|
exports.vviinn_overlay = VviinnOverlay;
|
|
731
1122
|
exports.vviinn_overlayed_modal = VviinnOverlayedModal;
|
|
1123
|
+
exports.vviinn_preloader = VviinnPreloader;
|
|
732
1124
|
exports.vviinn_privacy_badge = VviinnPrivacyBadge;
|
|
1125
|
+
exports.vviinn_product_card = VviinnProductCard;
|
|
733
1126
|
exports.vviinn_server_error = VviinnServerError;
|
|
734
1127
|
exports.vviinn_slide = VviinnSlide;
|
|
735
1128
|
exports.vviinn_slider = VviinnSlider;
|
|
736
1129
|
exports.vviinn_teaser = VviinnTeaser;
|
|
1130
|
+
exports.vviinn_vps_widget = VviinnVpsWidget;
|
|
737
1131
|
exports.vviinn_wrong_format = VviinnWrongFormat;
|