vviinn-widgets 2.4.2 → 2.4.3

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.
Files changed (93) hide show
  1. package/dist/cjs/Handler-d1a8a86a.js +329 -0
  2. package/dist/cjs/{app-globals-d999d944.js → app-globals-474864e0.js} +1 -1
  3. package/dist/cjs/cropper-handler.cjs.entry.js +27 -0
  4. package/dist/cjs/{customized-slots-90e8e849.js → customized-slots-0aa6c3d6.js} +1 -1
  5. package/dist/cjs/{cropper-handler_27.cjs.entry.js → highlight-box_22.cjs.entry.js} +85 -469
  6. package/dist/cjs/{index-c0d08aca.js → imageSearch.store-076370bf.js} +10575 -14822
  7. package/dist/cjs/index-34d20028.js +3222 -0
  8. package/dist/cjs/{index-e8cf5dc5.js → index-61403ab1.js} +1 -1
  9. package/dist/cjs/{index-53400160.js → index-a87f1a44.js} +1 -1
  10. package/dist/cjs/loader.cjs.js +3 -3
  11. package/dist/cjs/{vviinn-carousel_2.cjs.entry.js → vviinn-carousel_3.cjs.entry.js} +212 -25
  12. package/dist/cjs/vviinn-error.cjs.entry.js +19 -0
  13. package/dist/cjs/vviinn-preloader.cjs.entry.js +26 -0
  14. package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +2 -2
  15. package/dist/cjs/vviinn-vpr-button.cjs.entry.js +2 -2
  16. package/dist/cjs/vviinn-vps-button.cjs.entry.js +3 -3
  17. package/dist/cjs/vviinn-vps-widget.cjs.entry.js +162 -0
  18. package/dist/cjs/vviinn-widgets.cjs.js +3 -3
  19. package/dist/collection/components/image-search/search-filters/search-filters.js +1 -1
  20. package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +3 -0
  21. package/dist/collection/openApi/index.js +1 -1
  22. package/dist/esm/Handler-639a4cb3.js +308 -0
  23. package/dist/esm/{app-globals-f91c6f94.js → app-globals-3888cd41.js} +1 -1
  24. package/dist/esm/cropper-handler.entry.js +23 -0
  25. package/dist/esm/{customized-slots-7be7f3b8.js → customized-slots-863113e2.js} +1 -1
  26. package/dist/esm/{cropper-handler_27.entry.js → highlight-box_22.entry.js} +21 -400
  27. package/dist/esm/{index-840ec915.js → imageSearch.store-b516d12e.js} +10749 -14986
  28. package/dist/esm/index-2f8fb0fe.js +3213 -0
  29. package/dist/esm/{index-00c7b7c2.js → index-36978848.js} +2 -2
  30. package/dist/esm/{index-d7147986.js → index-56c062df.js} +1 -1
  31. package/dist/esm/loader.js +3 -3
  32. package/dist/esm/{vviinn-carousel_2.entry.js → vviinn-carousel_3.entry.js} +190 -4
  33. package/dist/esm/vviinn-error.entry.js +15 -0
  34. package/dist/esm/vviinn-preloader.entry.js +22 -0
  35. package/dist/esm/vviinn-recommendations-sidebar.entry.js +2 -2
  36. package/dist/esm/vviinn-vpr-button.entry.js +2 -2
  37. package/dist/esm/vviinn-vps-button.entry.js +3 -3
  38. package/dist/esm/vviinn-vps-widget.entry.js +158 -0
  39. package/dist/esm/vviinn-widgets.js +3 -3
  40. package/dist/types/components/image-search/search-filters/search-filters.d.ts +1 -1
  41. package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +1 -1
  42. package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +2 -1
  43. package/dist/types/components.d.ts +1 -1
  44. package/dist/types/openApi/index.d.ts +2 -2
  45. package/dist/types/tracking/event.d.ts +1 -1
  46. package/dist/types/tracking/index.d.ts +8 -8
  47. package/dist/types/tracking/models.d.ts +1 -1
  48. package/dist/vviinn-widgets/{p-2d4cb17f.entry.js → p-0a9cee09.entry.js} +1 -1
  49. package/dist/vviinn-widgets/p-28678772.js +1 -0
  50. package/dist/vviinn-widgets/{p-07d8ba79.entry.js → p-2e6ecda7.entry.js} +1 -1
  51. package/dist/vviinn-widgets/{p-dc2da207.js → p-47183c9a.js} +1 -1
  52. package/dist/vviinn-widgets/p-535611cd.entry.js +1 -0
  53. package/dist/vviinn-widgets/p-606ff863.js +1 -0
  54. package/dist/vviinn-widgets/p-9cc6f0dd.entry.js +1 -0
  55. package/{www/build/p-ce96f232.js → dist/vviinn-widgets/p-ac0a2989.js} +1 -1
  56. package/dist/vviinn-widgets/p-ad29e9c5.entry.js +1 -0
  57. package/{www/build/p-a66512b2.js → dist/vviinn-widgets/p-b4caf042.js} +1 -1
  58. package/dist/vviinn-widgets/p-b547a6d0.entry.js +1 -0
  59. package/dist/vviinn-widgets/{p-7d5af04d.js → p-c853cba8.js} +1 -1
  60. package/dist/vviinn-widgets/p-d2097302.entry.js +1 -0
  61. package/dist/vviinn-widgets/p-d8d49616.entry.js +1 -0
  62. package/dist/vviinn-widgets/p-f582db5c.js +1 -0
  63. package/dist/vviinn-widgets/{p-9c7297c8.entry.js → p-f9410382.entry.js} +1 -1
  64. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  65. package/package.json +3 -3
  66. package/www/build/{p-2d4cb17f.entry.js → p-0a9cee09.entry.js} +1 -1
  67. package/www/build/p-28678772.js +1 -0
  68. package/www/build/{p-07d8ba79.entry.js → p-2e6ecda7.entry.js} +1 -1
  69. package/www/build/{p-dc2da207.js → p-47183c9a.js} +1 -1
  70. package/www/build/p-535611cd.entry.js +1 -0
  71. package/www/build/p-606ff863.js +1 -0
  72. package/www/build/p-7c313f33.js +125 -0
  73. package/www/build/p-9cc6f0dd.entry.js +1 -0
  74. package/{dist/vviinn-widgets/p-ce96f232.js → www/build/p-ac0a2989.js} +1 -1
  75. package/www/build/p-ad29e9c5.entry.js +1 -0
  76. package/{dist/vviinn-widgets/p-a66512b2.js → www/build/p-b4caf042.js} +1 -1
  77. package/www/build/p-b547a6d0.entry.js +1 -0
  78. package/www/build/{p-7d5af04d.js → p-c853cba8.js} +1 -1
  79. package/www/build/p-d2097302.entry.js +1 -0
  80. package/www/build/p-d8d49616.entry.js +1 -0
  81. package/www/build/p-e0153ae2.css +6 -0
  82. package/www/build/p-f582db5c.js +1 -0
  83. package/www/build/{p-9c7297c8.entry.js → p-f9410382.entry.js} +1 -1
  84. package/www/build/vviinn-widgets.esm.js +1 -1
  85. package/www/index.html +1 -1
  86. package/dist/vviinn-widgets/p-196479f9.js +0 -1
  87. package/dist/vviinn-widgets/p-ae524f97.entry.js +0 -1
  88. package/dist/vviinn-widgets/p-fce4183d.entry.js +0 -1
  89. package/www/build/p-196479f9.js +0 -1
  90. package/www/build/p-32bb0615.js +0 -1
  91. package/www/build/p-a67898be.css +0 -1
  92. package/www/build/p-ae524f97.entry.js +0 -1
  93. package/www/build/p-fce4183d.entry.js +0 -1
@@ -1,41 +1,8 @@
1
- import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-d7147986.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-840ec915.js';
3
- import { C as CheckIcon, O as OnboardingCard1Icon, a as OnboardingCard2Icon, b as OnboardingCard3Icon, A as ArrowIcon } from './index-00c7b7c2.js';
4
- import { s as slotChangeListener } from './customized-slots-7be7f3b8.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));
1
+ import { r as registerInstance, h, H as Host, c as createEvent, g as getElement } from './index-56c062df.js';
2
+ import { O as Option, j as sequenceToOption, i as imageSearchState, a as _function, t as transform, k as move, l as makeRectangularSearchRequest, n as fromAlt, o as foldValueObject, p as scaleWithSized, q as center, r as detectedObjectEq, u as toFile, v as processSelectedFile, E as Either, w as match, x as fromImage, y as dimensionsFromImage, z as scaleByLargestSide, N as NonEmptyArray } from './imageSearch.store-b516d12e.js';
3
+ import { p as pipe, m as pointDiffSemigroup, o as fromMouseEvent } from './Handler-639a4cb3.js';
4
+ import { c as CheckIcon, O as OnboardingCard1Icon, d as OnboardingCard2Icon, e as OnboardingCard3Icon, A as ArrowIcon } from './index-36978848.js';
5
+ import { s as slotChangeListener } from './customized-slots-863113e2.js';
39
6
 
40
7
  // -------------------------------------------------------------------------------------
41
8
  // -------------------------------------------------------------------------------------
@@ -57,6 +24,21 @@ var Ord = {
57
24
  compare: function (first, second) { return (first < second ? -1 : first > second ? 1 : 0); }
58
25
  };
59
26
 
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
+
60
42
  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)}}";
61
43
 
62
44
  let HighlightBox = class {
@@ -311,18 +293,6 @@ let VviinnEmptyResults = class {
311
293
  };
312
294
  VviinnEmptyResults.style = vviinnEmptyResultsCss;
313
295
 
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
-
326
296
  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}}";
327
297
 
328
298
  let VviinnExampleImage = class {
@@ -565,23 +535,6 @@ let VviinnOverlayedModal = class {
565
535
  };
566
536
  VviinnOverlayedModal.style = vviinnOverlayedModalCss;
567
537
 
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
-
585
538
  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}";
586
539
 
587
540
  let VviinnPrivacyBadge = class {
@@ -598,190 +551,6 @@ let VviinnPrivacyBadge = class {
598
551
  };
599
552
  VviinnPrivacyBadge.style = vviinnPrivacyBadgeCss;
600
553
 
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
-
785
554
  const vviinnServerErrorCss = ":host{display:block}";
786
555
 
787
556
  let VviinnServerError = class {
@@ -937,154 +706,6 @@ let VviinnTeaser = class {
937
706
  };
938
707
  VviinnTeaser.style = vviinnTeaserCss;
939
708
 
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
-
1088
709
  const vviinnWrongFormatCss = ":host{display:block}";
1089
710
 
1090
711
  let VviinnWrongFormat = class {
@@ -1098,4 +719,4 @@ let VviinnWrongFormat = class {
1098
719
  };
1099
720
  VviinnWrongFormat.style = vviinnWrongFormatCss;
1100
721
 
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 };
722
+ 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 };