vviinn-widgets 2.3.0 → 2.4.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/{app-globals-30781f30.js → app-globals-324e9cd0.js} +1 -1
- package/dist/cjs/{highlight-box_22.cjs.entry.js → cropper-handler_27.cjs.entry.js} +485 -91
- package/dist/cjs/{customized-slots-5d904d8e.js → customized-slots-703cd28d.js} +1 -1
- package/dist/cjs/{index-363cfe0b.js → index-6078b9e5.js} +5 -7
- package/dist/cjs/{imageSearch.store-128957a4.js → index-a00145c0.js} +15288 -11038
- package/dist/cjs/{index-741a970d.js → index-a821350a.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} +47 -203
- 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 +4 -4
- 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-icons/index.js +4 -6
- 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-button/vviinn-vps-button.css +3 -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-345e497d.js → app-globals-02b550a1.js} +1 -1
- package/dist/esm/{highlight-box_22.entry.js → cropper-handler_27.entry.js} +416 -27
- package/dist/esm/{customized-slots-a76a8d41.js → customized-slots-472f6e69.js} +1 -1
- package/dist/esm/{imageSearch.store-8eab0da1.js → index-26769494.js} +15232 -10993
- package/dist/esm/{index-9e125c6c.js → index-711602a5.js} +6 -8
- package/dist/esm/{index-6fa21e24.js → index-b908268d.js} +1 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{vviinn-carousel_3.entry.js → vviinn-carousel_2.entry.js} +39 -194
- 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 +4 -4
- 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-13842a39.js +1 -0
- package/dist/vviinn-widgets/p-19b7a59e.entry.js +1 -0
- package/dist/vviinn-widgets/p-4a7d9763.entry.js +1 -0
- package/dist/vviinn-widgets/{p-a95c00c9.entry.js → p-4fb28a11.entry.js} +1 -1
- package/dist/vviinn-widgets/p-6715be5d.entry.js +1 -0
- package/dist/vviinn-widgets/{p-3734a3ef.entry.js → p-70f54b8b.entry.js} +1 -1
- package/dist/vviinn-widgets/p-817158df.js +1 -0
- package/{www/build/p-78ccc9eb.js → dist/vviinn-widgets/p-cd711bcd.js} +1 -1
- package/dist/vviinn-widgets/{p-e67cae57.js → p-e031c06c.js} +1 -1
- package/dist/vviinn-widgets/{p-e1ba8626.js → p-ee679114.js} +1 -1
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +11 -3
- package/www/build/p-13842a39.js +1 -0
- package/www/build/p-19b7a59e.entry.js +1 -0
- package/www/build/p-4a7d9763.entry.js +1 -0
- package/www/build/{p-a95c00c9.entry.js → p-4fb28a11.entry.js} +1 -1
- package/www/build/p-6715be5d.entry.js +1 -0
- package/www/build/{p-3734a3ef.entry.js → p-70f54b8b.entry.js} +1 -1
- package/www/build/p-817158df.js +1 -0
- package/www/build/p-92df8b33.js +125 -0
- package/{dist/vviinn-widgets/p-78ccc9eb.js → www/build/p-cd711bcd.js} +1 -1
- package/www/build/p-e0153ae2.css +6 -0
- package/www/build/{p-e67cae57.js → p-e031c06c.js} +1 -1
- package/www/build/{p-e1ba8626.js → p-ee679114.js} +1 -1
- 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-126775a2.js +0 -1
- package/dist/vviinn-widgets/p-1f0c8cf6.entry.js +0 -1
- package/dist/vviinn-widgets/p-59edfbe2.js +0 -1
- package/dist/vviinn-widgets/p-71809bed.entry.js +0 -1
- package/dist/vviinn-widgets/p-9d24f51e.entry.js +0 -1
- package/dist/vviinn-widgets/p-9ea96a69.entry.js +0 -1
- package/dist/vviinn-widgets/p-e38f4aa2.entry.js +0 -1
- package/dist/vviinn-widgets/p-f47e82b2.entry.js +0 -1
- package/dist/vviinn-widgets/p-f582db5c.js +0 -1
- package/dist/vviinn-widgets/p-fb14e3cc.entry.js +0 -1
- package/www/build/p-126775a2.js +0 -1
- package/www/build/p-1f0c8cf6.entry.js +0 -1
- package/www/build/p-4379b1c2.js +0 -1
- package/www/build/p-59edfbe2.js +0 -1
- package/www/build/p-71809bed.entry.js +0 -1
- package/www/build/p-9d24f51e.entry.js +0 -1
- package/www/build/p-9ea96a69.entry.js +0 -1
- package/www/build/p-a67898be.css +0 -1
- package/www/build/p-e38f4aa2.entry.js +0 -1
- package/www/build/p-f47e82b2.entry.js +0 -1
- package/www/build/p-f582db5c.js +0 -1
- package/www/build/p-fb14e3cc.entry.js +0 -1
|
@@ -1,8 +1,41 @@
|
|
|
1
|
-
import { r as registerInstance, h, H as Host,
|
|
2
|
-
import { O as Option,
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-b908268d.js';
|
|
2
|
+
import { g as getCursorValue, p as pipe, O as Option, s as sequenceToOption, i as imageSearchState, a as pointDiffSemigroup, _ as _function, t as transform, m as move, f as fromMouseEvent, b as makeRectangularSearchRequest, c as fromAlt, d as foldValueObject, e as scaleWithSized, h as center, j as detectedObjectEq, k as toFile, l as processSelectedFile, E as Either, n as match, o as fromImage, q as dimensionsFromImage, r as scaleByLargestSide, S as Semigroup, u as state, N as NonEmptyArray, v as createProductViewVpsEvent, w as createSearchEvent, x as createFilterEvent, y as v4, z as createTrackingApi, A as createWidgetVpsEvent } from './index-26769494.js';
|
|
3
|
+
import { C as CheckIcon, O as OnboardingCard1Icon, a as OnboardingCard2Icon, b as OnboardingCard3Icon, A as ArrowIcon } from './index-711602a5.js';
|
|
4
|
+
import { s as slotChangeListener } from './customized-slots-472f6e69.js';
|
|
5
|
+
|
|
6
|
+
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}";
|
|
7
|
+
|
|
8
|
+
let CropperHandler = class {
|
|
9
|
+
constructor(hostRef) {
|
|
10
|
+
registerInstance(this, hostRef);
|
|
11
|
+
this.disabled = false;
|
|
12
|
+
}
|
|
13
|
+
render() {
|
|
14
|
+
return (h(Host, { part: `handle ${getCursorValue(this.handler.direction)}`, class: {
|
|
15
|
+
disabled: this.disabled,
|
|
16
|
+
[getCursorValue(this.handler.direction)]: true,
|
|
17
|
+
}, style: {
|
|
18
|
+
"--size": "20px",
|
|
19
|
+
cursor: getCursorValue(this.handler.direction),
|
|
20
|
+
}, draggable: false }));
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
CropperHandler.style = cropperHandlerCss;
|
|
24
|
+
|
|
25
|
+
const fromRectangle = (shape, target) => {
|
|
26
|
+
const top = `${shape.y}px`;
|
|
27
|
+
const left = `${shape.x}px`;
|
|
28
|
+
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
29
|
+
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
30
|
+
return {
|
|
31
|
+
top,
|
|
32
|
+
right,
|
|
33
|
+
bottom,
|
|
34
|
+
left,
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
38
|
+
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
6
39
|
|
|
7
40
|
// -------------------------------------------------------------------------------------
|
|
8
41
|
// -------------------------------------------------------------------------------------
|
|
@@ -24,21 +57,6 @@ var Ord = {
|
|
|
24
57
|
compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
|
|
25
58
|
};
|
|
26
59
|
|
|
27
|
-
const fromRectangle = (shape, target) => {
|
|
28
|
-
const top = `${shape.y}px`;
|
|
29
|
-
const left = `${shape.x}px`;
|
|
30
|
-
const right = `${target.width - (shape.x + shape.width)}px`;
|
|
31
|
-
const bottom = `${target.height - (shape.y + shape.height)}px`;
|
|
32
|
-
return {
|
|
33
|
-
top,
|
|
34
|
-
right,
|
|
35
|
-
bottom,
|
|
36
|
-
left,
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
const printClip = (clip) => `inset(${clip.top} ${clip.right} ${clip.bottom} ${clip.left})`;
|
|
40
|
-
const getClipValue = (shape, target) => printClip(fromRectangle(shape, target));
|
|
41
|
-
|
|
42
60
|
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)}}";
|
|
43
61
|
|
|
44
62
|
let HighlightBox = class {
|
|
@@ -67,6 +85,7 @@ const MIN_SEARCHAREA_SIZE = 40;
|
|
|
67
85
|
let ImageCropper = class {
|
|
68
86
|
constructor(hostRef) {
|
|
69
87
|
registerInstance(this, hostRef);
|
|
88
|
+
this.cropperChanged = createEvent(this, "cropperChanged", 7);
|
|
70
89
|
this.disabled = false;
|
|
71
90
|
this.handleMove = false;
|
|
72
91
|
this.mouseStartPoint = undefined;
|
|
@@ -86,18 +105,21 @@ let ImageCropper = class {
|
|
|
86
105
|
};
|
|
87
106
|
_function.pipe(imageSearchState.searchArea, Option.map((area) => {
|
|
88
107
|
const newSearchArea = transform(area, transformedHandler);
|
|
89
|
-
if (newSearchArea
|
|
90
|
-
newSearchArea.height < MIN_SEARCHAREA_SIZE ||
|
|
91
|
-
newSearchArea.x < 0 ||
|
|
92
|
-
newSearchArea.y < 0 ||
|
|
93
|
-
this.bounds.height - (newSearchArea.y + newSearchArea.height) < 0 ||
|
|
94
|
-
this.bounds.width - (newSearchArea.x + newSearchArea.width) < 0)
|
|
108
|
+
if (this.outOfBounds(newSearchArea))
|
|
95
109
|
return;
|
|
96
110
|
imageSearchState.searchArea = Option.some(newSearchArea);
|
|
97
111
|
this.mouseStartPoint = destination;
|
|
98
112
|
imageSearchState.detectedObject = undefined;
|
|
99
113
|
}));
|
|
100
114
|
}
|
|
115
|
+
outOfBounds(area) {
|
|
116
|
+
return (area.width < MIN_SEARCHAREA_SIZE ||
|
|
117
|
+
area.height < MIN_SEARCHAREA_SIZE ||
|
|
118
|
+
area.x < 0 ||
|
|
119
|
+
area.y < 0 ||
|
|
120
|
+
this.bounds.height - (area.y + area.height) < 0 ||
|
|
121
|
+
this.bounds.width - (area.x + area.width) < 0);
|
|
122
|
+
}
|
|
101
123
|
handleCropperMove(ev) {
|
|
102
124
|
ev.preventDefault();
|
|
103
125
|
ev.stopPropagation();
|
|
@@ -138,6 +160,7 @@ let ImageCropper = class {
|
|
|
138
160
|
document.removeEventListener("pointerup", this.pointerReleaseListener);
|
|
139
161
|
this.mouseStartPoint = undefined;
|
|
140
162
|
makeRectangularSearchRequest();
|
|
163
|
+
this.cropperChanged.emit();
|
|
141
164
|
}
|
|
142
165
|
getStyleMap() {
|
|
143
166
|
return _function.pipe(imageSearchState.searchArea, Option.map((rectangle) => {
|
|
@@ -170,6 +193,7 @@ const getFilterId = (filter) => filter.href.split("/").reverse()[0];
|
|
|
170
193
|
let SearchFilters = class {
|
|
171
194
|
constructor(hostRef) {
|
|
172
195
|
registerInstance(this, hostRef);
|
|
196
|
+
this.filterSelected = createEvent(this, "filterSelected", 7);
|
|
173
197
|
this.filter = null;
|
|
174
198
|
this.selectedCategoryId = null;
|
|
175
199
|
this.hideFilters = true;
|
|
@@ -182,11 +206,13 @@ let SearchFilters = class {
|
|
|
182
206
|
selectFilter(filter) {
|
|
183
207
|
this.selectedCategoryId = getFilterId(filter);
|
|
184
208
|
imageSearchState.activeIonLink = filter;
|
|
209
|
+
this.filterSelected.emit("select");
|
|
185
210
|
}
|
|
186
211
|
clearSelectedFilter() {
|
|
187
212
|
this.selectedCategoryId = null;
|
|
188
213
|
imageSearchState.activeIonLink = undefined;
|
|
189
214
|
this.findSelectedFilter().blur();
|
|
215
|
+
this.filterSelected.emit("deselect");
|
|
190
216
|
}
|
|
191
217
|
findSelectedFilter() {
|
|
192
218
|
return this.el.shadowRoot.querySelector(ACTIVE_FILTER_CLASSNAME);
|
|
@@ -231,6 +257,7 @@ const vviinnDetectedObjectCss = ":host{--color-primary-system:#0F62FE;--color-pr
|
|
|
231
257
|
let VviinnDetectedObject = class {
|
|
232
258
|
constructor(hostRef) {
|
|
233
259
|
registerInstance(this, hostRef);
|
|
260
|
+
this.detectedObjectClicked = createEvent(this, "detectedObjectClicked", 7);
|
|
234
261
|
this.position = ["0", "0"];
|
|
235
262
|
}
|
|
236
263
|
getObjectPosition() {
|
|
@@ -249,6 +276,7 @@ let VviinnDetectedObject = class {
|
|
|
249
276
|
imageSearchState.searchArea = Option.some(scaledRect);
|
|
250
277
|
}));
|
|
251
278
|
makeRectangularSearchRequest();
|
|
279
|
+
this.detectedObjectClicked.emit();
|
|
252
280
|
}
|
|
253
281
|
isActive() {
|
|
254
282
|
if (!this.detectedObject)
|
|
@@ -283,6 +311,18 @@ let VviinnEmptyResults = class {
|
|
|
283
311
|
};
|
|
284
312
|
VviinnEmptyResults.style = vviinnEmptyResultsCss;
|
|
285
313
|
|
|
314
|
+
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}";
|
|
315
|
+
|
|
316
|
+
let VviinnError = class {
|
|
317
|
+
constructor(hostRef) {
|
|
318
|
+
registerInstance(this, hostRef);
|
|
319
|
+
}
|
|
320
|
+
render() {
|
|
321
|
+
return (h(Host, null, h("slot", { name: "icon" }), h("slot", { name: "title" }), h("slot", { name: "text" }), h("slot", { name: "action" })));
|
|
322
|
+
}
|
|
323
|
+
};
|
|
324
|
+
VviinnError.style = vviinnErrorCss;
|
|
325
|
+
|
|
286
326
|
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}}";
|
|
287
327
|
|
|
288
328
|
let VviinnExampleImage = class {
|
|
@@ -525,6 +565,23 @@ let VviinnOverlayedModal = class {
|
|
|
525
565
|
};
|
|
526
566
|
VviinnOverlayedModal.style = vviinnOverlayedModalCss;
|
|
527
567
|
|
|
568
|
+
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)}}";
|
|
569
|
+
|
|
570
|
+
let VviinnPreloader = class {
|
|
571
|
+
constructor(hostRef) {
|
|
572
|
+
registerInstance(this, hostRef);
|
|
573
|
+
}
|
|
574
|
+
isActive() {
|
|
575
|
+
return (imageSearchState.loading || imageSearchState.objectDetectionInProgress);
|
|
576
|
+
}
|
|
577
|
+
render() {
|
|
578
|
+
return (h(Host, { class: {
|
|
579
|
+
active: this.isActive(),
|
|
580
|
+
} }));
|
|
581
|
+
}
|
|
582
|
+
};
|
|
583
|
+
VviinnPreloader.style = vviinnPreloaderCss;
|
|
584
|
+
|
|
528
585
|
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}";
|
|
529
586
|
|
|
530
587
|
let VviinnPrivacyBadge = class {
|
|
@@ -541,6 +598,190 @@ let VviinnPrivacyBadge = class {
|
|
|
541
598
|
};
|
|
542
599
|
VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
|
|
543
600
|
|
|
601
|
+
class GtagAnalytics {
|
|
602
|
+
sendImpression(product) {
|
|
603
|
+
var _a, _b, _c;
|
|
604
|
+
gtag('event', 'view_item_list', {
|
|
605
|
+
items: [
|
|
606
|
+
{
|
|
607
|
+
id: product.productId,
|
|
608
|
+
name: product.title,
|
|
609
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
610
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
611
|
+
list_name: 'VI VPR View',
|
|
612
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
613
|
+
}
|
|
614
|
+
]
|
|
615
|
+
});
|
|
616
|
+
return undefined;
|
|
617
|
+
}
|
|
618
|
+
sendClick(product) {
|
|
619
|
+
var _a, _b, _c;
|
|
620
|
+
gtag('event', 'select_content', {
|
|
621
|
+
content_type: 'product',
|
|
622
|
+
items: [
|
|
623
|
+
{
|
|
624
|
+
id: product.productId,
|
|
625
|
+
name: product.title,
|
|
626
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
627
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
628
|
+
list_name: 'VI VPR View',
|
|
629
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
630
|
+
}
|
|
631
|
+
]
|
|
632
|
+
});
|
|
633
|
+
return undefined;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
class GAnalytics {
|
|
638
|
+
constructor() {
|
|
639
|
+
ga('require', 'ec');
|
|
640
|
+
}
|
|
641
|
+
convertProduct(product) {
|
|
642
|
+
var _a, _b, _c;
|
|
643
|
+
return {
|
|
644
|
+
id: product.productId,
|
|
645
|
+
name: product.title,
|
|
646
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
647
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
648
|
+
list: 'VI VPR View',
|
|
649
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
sendImpression(product) {
|
|
653
|
+
ga('ec:addImpression', this.convertProduct(product));
|
|
654
|
+
return undefined;
|
|
655
|
+
}
|
|
656
|
+
sendClick(product) {
|
|
657
|
+
var _a, _b, _c;
|
|
658
|
+
ga('ec:addProduct', {
|
|
659
|
+
id: product.productId,
|
|
660
|
+
name: product.title,
|
|
661
|
+
brand: (_a = product.brand) !== null && _a !== void 0 ? _a : '',
|
|
662
|
+
category: (_b = product.productType) !== null && _b !== void 0 ? _b : '',
|
|
663
|
+
price: Math.min(...[product.price.actual, (_c = product.price.sale) !== null && _c !== void 0 ? _c : Infinity])
|
|
664
|
+
});
|
|
665
|
+
ga('ec:setAction', 'click', { list: 'VI VPR View' });
|
|
666
|
+
return undefined;
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
|
|
670
|
+
const getGtagAnalytics = () => _function.pipe(Option.fromNullable(window.gtag), Option.map(() => new GtagAnalytics()));
|
|
671
|
+
const getCommonAnalytics = () => _function.pipe(Option.fromNullable(window.ga), Option.map(() => new GAnalytics()));
|
|
672
|
+
const analyticsMonoid = Option.getMonoid(Semigroup.first());
|
|
673
|
+
const getAnalyticsModule = analyticsMonoid.concat(getGtagAnalytics(), getCommonAnalytics());
|
|
674
|
+
|
|
675
|
+
const FIT_EXPR = /fit\/\d+\//;
|
|
676
|
+
const containsFit = (url) => {
|
|
677
|
+
return _function.pipe(url.match(FIT_EXPR), Either.fromNullable(url), Either.map(() => url));
|
|
678
|
+
};
|
|
679
|
+
const processWidth = (url, size) => {
|
|
680
|
+
return _function.pipe(containsFit(url), Either.map((url) => url.replace(FIT_EXPR, `fit/${size}/`)), Either.getOrElse(() => url));
|
|
681
|
+
};
|
|
682
|
+
const Linked = (props, child) => props.deeplink ? (h("a", { class: props.part, part: props.part, href: props.deeplink }, child)) : (child);
|
|
683
|
+
const FormattedPrice = (props) => {
|
|
684
|
+
var _a;
|
|
685
|
+
const locale = props.locale;
|
|
686
|
+
const formattedPrice = new Intl.NumberFormat(locale, {
|
|
687
|
+
minimumFractionDigits: 2,
|
|
688
|
+
}).format(props.price);
|
|
689
|
+
const fullPrice = `${(_a = props.prefix) !== null && _a !== void 0 ? _a : ""} ${formattedPrice} ${props.currency}`;
|
|
690
|
+
return (h("span", { class: "price-amount", part: "price-amount" }, fullPrice));
|
|
691
|
+
};
|
|
692
|
+
const Price = (props) => {
|
|
693
|
+
const priceEl = (h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.price, locale: props.locale }));
|
|
694
|
+
return (h("span", { class: "price-container", part: "price-container" }, props.salePrice ? ([
|
|
695
|
+
h("span", { class: "price-sale", part: "price-sale" },
|
|
696
|
+
h(FormattedPrice, { prefix: props.prefix, currency: props.currency, price: props.salePrice, locale: props.locale })),
|
|
697
|
+
h("span", { class: "price-outdated", part: "price-outdated" }, priceEl),
|
|
698
|
+
]) : (h("span", { class: "price-regular", part: "price-regular" }, priceEl))));
|
|
699
|
+
};
|
|
700
|
+
const Image = (props, onLoadEnd = () => undefined) => (h("picture", null,
|
|
701
|
+
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 })));
|
|
702
|
+
const ResponsiveImage = (props, onLoadEnd = () => undefined) => (h("picture", null,
|
|
703
|
+
h("img", { loading: props.lazy ? "lazy" : "eager", part: "image", class: "image responsive", src: processWidth(props.src, props.width), alt: props.title, onLoad: onLoadEnd })));
|
|
704
|
+
|
|
705
|
+
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}";
|
|
706
|
+
|
|
707
|
+
let VviinnProductCard = class {
|
|
708
|
+
constructor(hostRef) {
|
|
709
|
+
registerInstance(this, hostRef);
|
|
710
|
+
this.recommendationLoad = createEvent(this, "recommendationLoad", 7);
|
|
711
|
+
this.recommendationView = createEvent(this, "recommendationView", 7);
|
|
712
|
+
this.recommendationClick = createEvent(this, "recommendationClick", 7);
|
|
713
|
+
this.productImageLoaded = createEvent(this, "productImageLoaded", 7);
|
|
714
|
+
this.currency = undefined;
|
|
715
|
+
this.imageRatio = 1;
|
|
716
|
+
this.imageWidth = 200;
|
|
717
|
+
this.locale = undefined;
|
|
718
|
+
this.pricePrefix = undefined;
|
|
719
|
+
this.responsive = false;
|
|
720
|
+
this.dimmedBackground = false;
|
|
721
|
+
/** @internal */
|
|
722
|
+
this.index = 0;
|
|
723
|
+
this.imageLoaded = false;
|
|
724
|
+
this.productData = null;
|
|
725
|
+
this.intersectionObserver = new IntersectionObserver(this.intersectionCallback.bind(this), { threshold: 1.0 });
|
|
726
|
+
}
|
|
727
|
+
connectedCallback() {
|
|
728
|
+
this.productData = {
|
|
729
|
+
product: this.productId,
|
|
730
|
+
rank: this.index
|
|
731
|
+
};
|
|
732
|
+
}
|
|
733
|
+
intersectionCallback(data) {
|
|
734
|
+
if (data.some((entry) => entry.isIntersecting)) {
|
|
735
|
+
_function.pipe(getAnalyticsModule, Option.map((analytics) => analytics.sendImpression(this.getProduct())));
|
|
736
|
+
this.recommendationView.emit(this.productData);
|
|
737
|
+
this.intersectionObserver.disconnect();
|
|
738
|
+
}
|
|
739
|
+
}
|
|
740
|
+
componentDidLoad() {
|
|
741
|
+
this.recommendationLoad.emit(this.productData);
|
|
742
|
+
this.intersectionObserver.observe(this.el);
|
|
743
|
+
const links = this.el.shadowRoot.querySelectorAll("a");
|
|
744
|
+
links.forEach((link) => link.addEventListener("mousedown", (event) => {
|
|
745
|
+
this.recommendationClick.emit(this.productData);
|
|
746
|
+
if (window.ga) {
|
|
747
|
+
event.preventDefault();
|
|
748
|
+
}
|
|
749
|
+
_function.pipe(getAnalyticsModule, Option.match(() => null, (analytics) => analytics.sendClick(this.getProduct())));
|
|
750
|
+
if (window.ga) {
|
|
751
|
+
ga("send", "event", "UX", "click", "Results", {
|
|
752
|
+
hitCallback: function () {
|
|
753
|
+
document.location.href = this.deeplink;
|
|
754
|
+
},
|
|
755
|
+
});
|
|
756
|
+
}
|
|
757
|
+
}));
|
|
758
|
+
}
|
|
759
|
+
getProduct() {
|
|
760
|
+
return imageSearchState.results.find((r) => r.productId === this.productId);
|
|
761
|
+
}
|
|
762
|
+
renderImage() {
|
|
763
|
+
const props = {
|
|
764
|
+
width: this.imageWidth,
|
|
765
|
+
height: this.imageWidth * this.imageRatio,
|
|
766
|
+
src: this.image,
|
|
767
|
+
title: this.productTitle,
|
|
768
|
+
lazy: false,
|
|
769
|
+
};
|
|
770
|
+
return this.responsive
|
|
771
|
+
? ResponsiveImage(props, () => this.kek())
|
|
772
|
+
: Image(props, () => this.kek());
|
|
773
|
+
}
|
|
774
|
+
kek() {
|
|
775
|
+
this.productImageLoaded.emit(this.productId);
|
|
776
|
+
}
|
|
777
|
+
render() {
|
|
778
|
+
var _a, _b, _c;
|
|
779
|
+
return (h(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" }, h(Linked, { deeplink: this.deeplink, part: "image-link" }, this.renderImage()), h(Linked, { deeplink: this.deeplink, part: "deeplink" }, h("span", { class: "title", part: "title" }, this.productTitle)), h("span", { class: "brand", part: "brand" }, this.brand), h("span", { class: "type", part: "type" }, this.productType), h(Price, { prefix: (_a = this.pricePrefix) !== null && _a !== void 0 ? _a : state.pricePrefix, currency: (_b = this.currency) !== null && _b !== void 0 ? _b : state.currencySign, price: this.price, salePrice: this.salePrice, locale: (_c = this.locale) !== null && _c !== void 0 ? _c : state.locale })));
|
|
780
|
+
}
|
|
781
|
+
get el() { return getElement(this); }
|
|
782
|
+
};
|
|
783
|
+
VviinnProductCard.style = vviinnProductCardCss;
|
|
784
|
+
|
|
544
785
|
const vviinnServerErrorCss = ":host{display:block}";
|
|
545
786
|
|
|
546
787
|
let VviinnServerError = class {
|
|
@@ -696,6 +937,154 @@ let VviinnTeaser = class {
|
|
|
696
937
|
};
|
|
697
938
|
VviinnTeaser.style = vviinnTeaserCss;
|
|
698
939
|
|
|
940
|
+
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}";
|
|
941
|
+
|
|
942
|
+
let VviinnVpsWidget = class {
|
|
943
|
+
constructor(hostRef) {
|
|
944
|
+
registerInstance(this, hostRef);
|
|
945
|
+
/** @internal */
|
|
946
|
+
this.apiPath = "https://api.vviinn.com";
|
|
947
|
+
/** When true modal window with widget will be shown */
|
|
948
|
+
this.active = false;
|
|
949
|
+
/** Currency sign will shown after price */
|
|
950
|
+
this.currencySign = "€";
|
|
951
|
+
/** Locale for currency formatting */
|
|
952
|
+
this.locale = "de-DE";
|
|
953
|
+
this.slidePosition = 0;
|
|
954
|
+
this.width = 0;
|
|
955
|
+
this.wrongImageFormat = false;
|
|
956
|
+
this.imageSource = null;
|
|
957
|
+
}
|
|
958
|
+
activeWatcher(value) {
|
|
959
|
+
if (value) {
|
|
960
|
+
this.overflow = document.body.style.overflow;
|
|
961
|
+
document.body.style.overflow = "hidden";
|
|
962
|
+
}
|
|
963
|
+
else {
|
|
964
|
+
document.body.style.overflow = this.overflow;
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
trackRecommendationView({ detail }) {
|
|
968
|
+
const recommendationViewEvent = createProductViewVpsEvent(Object.assign({ session_id: this.uiSessionId }, detail));
|
|
969
|
+
this.trackingApi.trackEvent(recommendationViewEvent);
|
|
970
|
+
}
|
|
971
|
+
trackRecommendationClick({ detail }) {
|
|
972
|
+
const recommendationClickEvent = createProductViewVpsEvent(Object.assign({ sessionId: this.uiSessionId }, detail));
|
|
973
|
+
this.trackingApi.trackEvent(recommendationClickEvent);
|
|
974
|
+
}
|
|
975
|
+
trachSearchAreaChanges() {
|
|
976
|
+
const searchEvent = createSearchEvent({
|
|
977
|
+
session_id: this.uiSessionId,
|
|
978
|
+
source: this.imageSource,
|
|
979
|
+
search_area: "manual-selection",
|
|
980
|
+
});
|
|
981
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
982
|
+
}
|
|
983
|
+
trackDetectedObject() {
|
|
984
|
+
const searchEvent = createSearchEvent({
|
|
985
|
+
session_id: this.uiSessionId,
|
|
986
|
+
source: this.imageSource,
|
|
987
|
+
search_area: "attention-point",
|
|
988
|
+
});
|
|
989
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
990
|
+
}
|
|
991
|
+
trackFilter({ detail }) {
|
|
992
|
+
const searchEvent = createFilterEvent({
|
|
993
|
+
session_id: this.uiSessionId,
|
|
994
|
+
source: this.imageSource,
|
|
995
|
+
kind: "category",
|
|
996
|
+
action: detail,
|
|
997
|
+
});
|
|
998
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
999
|
+
}
|
|
1000
|
+
componentWillLoad() {
|
|
1001
|
+
slotChangeListener(this, this.el);
|
|
1002
|
+
}
|
|
1003
|
+
connectedCallback() {
|
|
1004
|
+
state.apiPath = this.apiPath;
|
|
1005
|
+
state.currencySign = this.currencySign;
|
|
1006
|
+
state.locale = this.locale;
|
|
1007
|
+
imageSearchState.token = this.token;
|
|
1008
|
+
this.uiSessionId = v4();
|
|
1009
|
+
this.trackingApi = createTrackingApi(this.apiPath, this.token);
|
|
1010
|
+
const widgetOpenEvent = createWidgetVpsEvent({
|
|
1011
|
+
action: "open",
|
|
1012
|
+
session_id: this.uiSessionId,
|
|
1013
|
+
});
|
|
1014
|
+
this.trackingApi.trackEvent(widgetOpenEvent);
|
|
1015
|
+
}
|
|
1016
|
+
handleImageSelection(source) {
|
|
1017
|
+
this.imageSource = source;
|
|
1018
|
+
this.slidePosition = 1;
|
|
1019
|
+
const root = this.el.shadowRoot.querySelector("vviinn-overlayed-modal");
|
|
1020
|
+
const overlay = root.shadowRoot.querySelector("vviinn-overlay");
|
|
1021
|
+
const modal = overlay.querySelector("vviinn-modal");
|
|
1022
|
+
const modalBody = modal.shadowRoot.querySelector(".body");
|
|
1023
|
+
modalBody.scrollTop = 0;
|
|
1024
|
+
this.trackInitialSearch();
|
|
1025
|
+
}
|
|
1026
|
+
trackInitialSearch() {
|
|
1027
|
+
const searchEvent = createSearchEvent({
|
|
1028
|
+
session_id: this.uiSessionId,
|
|
1029
|
+
source: this.imageSource,
|
|
1030
|
+
search_area: "full",
|
|
1031
|
+
});
|
|
1032
|
+
this.trackingApi.trackEvent(searchEvent);
|
|
1033
|
+
}
|
|
1034
|
+
resetState() {
|
|
1035
|
+
this.resetScroll("onboarding-block");
|
|
1036
|
+
this.slidePosition = 0;
|
|
1037
|
+
imageSearchState.image = Option.none;
|
|
1038
|
+
imageSearchState.imageUrl = Option.none;
|
|
1039
|
+
imageSearchState.imageBounds = Option.none;
|
|
1040
|
+
imageSearchState.searchArea = Option.none;
|
|
1041
|
+
imageSearchState.results = [];
|
|
1042
|
+
imageSearchState.filters = [];
|
|
1043
|
+
imageSearchState.detectedObjects = [];
|
|
1044
|
+
imageSearchState.activeIonLink = undefined;
|
|
1045
|
+
imageSearchState.rectangleSearchForm = undefined;
|
|
1046
|
+
this.resetScroll("results-block");
|
|
1047
|
+
}
|
|
1048
|
+
haveErrors() {
|
|
1049
|
+
return this.wrongImageFormat || imageSearchState.serverError;
|
|
1050
|
+
}
|
|
1051
|
+
resetScroll(elementId, behavior = "auto") {
|
|
1052
|
+
const element = this.el.shadowRoot.getElementById(elementId);
|
|
1053
|
+
element.scroll({ top: 0, left: 0, behavior });
|
|
1054
|
+
}
|
|
1055
|
+
handleModalClose() {
|
|
1056
|
+
this.active = false;
|
|
1057
|
+
this.resetState();
|
|
1058
|
+
const elementsToReset = ["onboarding-block", "results-block"];
|
|
1059
|
+
elementsToReset.forEach((name) => this.resetScroll(name));
|
|
1060
|
+
const widgetOpenEvent = createWidgetVpsEvent({
|
|
1061
|
+
action: "close",
|
|
1062
|
+
session_id: this.uiSessionId,
|
|
1063
|
+
});
|
|
1064
|
+
this.trackingApi.trackEvent(widgetOpenEvent);
|
|
1065
|
+
}
|
|
1066
|
+
render() {
|
|
1067
|
+
return (h(Host, null, 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" }, h("vviinn-slider", { showBullets: false, position: this.slidePosition }, h("vviinn-slide", { class: { "start-page": true } }, h("div", { class: {
|
|
1068
|
+
error: this.haveErrors(),
|
|
1069
|
+
"start-page_block": true,
|
|
1070
|
+
} }, h("vviinn-wrong-format", { class: { hidden: !this.wrongImageFormat }, onActionClick: () => (this.wrongImageFormat = false) }), h("vviinn-server-error", { class: { hidden: !imageSearchState.serverError }, onActionClick: () => (imageSearchState.serverError = false) }), h("vviinn-teaser", { class: { hidden: this.haveErrors() } }), h("vviinn-image-selector", { class: { hidden: this.haveErrors() }, onImageSelected: () => this.handleImageSelection("upload"), onImageSelectedError: () => (this.wrongImageFormat = true), part: "select-image_button" }, h("span", { slot: "upload-button-text", class: "upload-button-content" }, h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "29", height: "28", fill: "none" }, h("defs", null), 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" }), 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" })), h("slot", { name: "vviinn-image-upload-button-text" }, h("span", null, "Kamera oder Bild ausw\u00E4hlen")))), h("vviinn-privacy-badge", { class: { hidden: this.haveErrors() } })), h("div", { id: "onboarding-block", class: "start-page_block" }, h("div", { class: "onboarding-wrapper" }, h("vviinn-onboarding", null), h("vviinn-example-images", { onImageSelected: () => this.handleImageSelection("example"), onImageSelectedError: () => this.resetScroll("onboarding-block", "smooth") })))), h("vviinn-slide", { class: { "results-page": true, active: this.slidePosition == 1 } }, h("div", { class: "image-wrapper" }, h("vviinn-image-view", null), h("div", { class: "filters-wrapper" }, h("div", { class: "filters" }, imageSearchState.filters.map((filter) => (h("search-filters", { filter: filter })))))), h("div", { id: "results-block", class: "products-wrapper" }, h("div", { class: {
|
|
1071
|
+
"nothing-found": true,
|
|
1072
|
+
hidden: imageSearchState.results.length > 0,
|
|
1073
|
+
} }, h("vviinn-empty-results", null), h("vviinn-onboarding", null)), h("div", { class: {
|
|
1074
|
+
hidden: imageSearchState.results.length <= 0,
|
|
1075
|
+
products: true,
|
|
1076
|
+
} }, imageSearchState.results.map((p, i) => {
|
|
1077
|
+
var _a;
|
|
1078
|
+
return (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 }));
|
|
1079
|
+
}))))))));
|
|
1080
|
+
}
|
|
1081
|
+
get el() { return getElement(this); }
|
|
1082
|
+
static get watchers() { return {
|
|
1083
|
+
"active": ["activeWatcher"]
|
|
1084
|
+
}; }
|
|
1085
|
+
};
|
|
1086
|
+
VviinnVpsWidget.style = vviinnVpsWidgetCss;
|
|
1087
|
+
|
|
699
1088
|
const vviinnWrongFormatCss = ":host{display:block}";
|
|
700
1089
|
|
|
701
1090
|
let VviinnWrongFormat = class {
|
|
@@ -709,4 +1098,4 @@ let VviinnWrongFormat = class {
|
|
|
709
1098
|
};
|
|
710
1099
|
VviinnWrongFormat.style = vviinnWrongFormatCss;
|
|
711
1100
|
|
|
712
|
-
export { HighlightBox as highlight_box, ImageCropper as image_cropper, SearchFilters as search_filters, VviinnDetectedObject as vviinn_detected_object, VviinnEmptyResults as vviinn_empty_results, VviinnExampleImage as vviinn_example_image, VviinnExampleImages as vviinn_example_images, VviinnImageSelector as vviinn_image_selector, VviinnImageView as vviinn_image_view, VviinnModal as vviinn_modal, VviinnOnboarding as vviinn_onboarding, VviinnOnboardingCard1 as vviinn_onboarding_card_1, VviinnOnboardingCard2 as vviinn_onboarding_card_2, VviinnOnboardingCard3 as vviinn_onboarding_card_3, VviinnOverlay as vviinn_overlay, VviinnOverlayedModal as vviinn_overlayed_modal, VviinnPrivacyBadge as vviinn_privacy_badge, VviinnServerError as vviinn_server_error, VviinnSlide as vviinn_slide, VviinnSlider as vviinn_slider, VviinnTeaser as vviinn_teaser, VviinnWrongFormat as vviinn_wrong_format };
|
|
1101
|
+
export { CropperHandler as cropper_handler, HighlightBox as highlight_box, ImageCropper as image_cropper, SearchFilters as search_filters, VviinnDetectedObject as vviinn_detected_object, VviinnEmptyResults as vviinn_empty_results, VviinnError as vviinn_error, VviinnExampleImage as vviinn_example_image, VviinnExampleImages as vviinn_example_images, VviinnImageSelector as vviinn_image_selector, VviinnImageView as vviinn_image_view, VviinnModal as vviinn_modal, VviinnOnboarding as vviinn_onboarding, VviinnOnboardingCard1 as vviinn_onboarding_card_1, VviinnOnboardingCard2 as vviinn_onboarding_card_2, VviinnOnboardingCard3 as vviinn_onboarding_card_3, VviinnOverlay as vviinn_overlay, VviinnOverlayedModal as vviinn_overlayed_modal, VviinnPreloader as vviinn_preloader, VviinnPrivacyBadge as vviinn_privacy_badge, VviinnProductCard as vviinn_product_card, VviinnServerError as vviinn_server_error, VviinnSlide as vviinn_slide, VviinnSlider as vviinn_slider, VviinnTeaser as vviinn_teaser, VviinnVpsWidget as vviinn_vps_widget, VviinnWrongFormat as vviinn_wrong_format };
|