vviinn-widgets 2.44.2 → 2.46.0
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/VisualSearchIcon-1180d079.js +8 -0
- package/dist/cjs/{customized-slots-49c03dc1.js → customized-slots-1b59bd38.js} +1 -0
- package/dist/cjs/{index-7ff2ab5f.js → index-279a6a0f.js} +75 -75
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/{package-5912f89d.js → package-3b910c03.js} +1 -1
- package/dist/cjs/{search-filters_16.cjs.entry.js → search-filters_17.cjs.entry.js} +116 -55
- package/dist/cjs/{imageSearch.store-dc4e98b3.js → search.store-0b319593.js} +55 -21
- package/dist/cjs/vviinn-button.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-carousel_4.cjs.entry.js +60 -51
- package/dist/cjs/vviinn-preloader.cjs.entry.js +2 -2
- package/dist/cjs/vviinn-recommendations-sidebar.cjs.entry.js +4 -2
- package/dist/cjs/vviinn-vpr-button.cjs.entry.js +3 -3
- package/dist/cjs/vviinn-vps-button.cjs.entry.js +7 -4
- package/dist/cjs/vviinn-vps-widget.cjs.entry.js +65 -40
- package/dist/cjs/vviinn-widgets.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/customized-slots.js +1 -0
- package/dist/collection/components/image-search/search-filters/search-filters.js +5 -5
- package/dist/collection/components/vviinn-error/vviinn-empty-results/vviinn-empty-results.js +2 -1
- package/dist/collection/components/vviinn-example-image/vviinn-example-image.js +1 -1
- package/dist/collection/components/vviinn-icons/icons/ArrowIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/BasketIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/CameraActionIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/CameraIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/CheckCircleIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/CheckIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/ChevronIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/CloseIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/CrossIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/GalleryActionIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/LoaderIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/MinusIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/PlusIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/RoundCameraIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/SecondaryActionIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/TextSearchIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/UpdateIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/UploadActionIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/VisualSearchIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/icons/WarningIcon.js +2 -0
- package/dist/collection/components/vviinn-icons/index.js +20 -18
- package/dist/collection/components/vviinn-image-selector/vviinn-image-selector.js +1 -1
- package/dist/collection/components/vviinn-image-view/vviinn-detected-object/vviinn-detected-object.js +7 -7
- package/dist/collection/components/vviinn-image-view/vviinn-image-view.js +7 -8
- package/dist/collection/components/vviinn-modal/vviinn-modal.js +2 -2
- package/dist/collection/components/vviinn-preloader/vviinn-preloader.js +2 -2
- package/dist/collection/components/vviinn-privacy-badge/vviinn-privacy-badge.css +1 -0
- package/dist/collection/components/vviinn-product-card/vviinn-product-card.js +2 -2
- package/dist/collection/components/vviinn-text-search/vviinn-text-search.css +63 -0
- package/dist/collection/components/vviinn-text-search/vviinn-text-search.js +118 -0
- package/dist/collection/components/vviinn-vpr-widget/vviinn-vpr-vidget.js +7 -4
- package/dist/collection/components/vviinn-vps-button/stories/vviinn-vps-button.stories.js +2 -0
- package/dist/collection/components/vviinn-vps-button/vviinn-vps-button.js +20 -1
- package/dist/collection/components/vviinn-vps-widget/stories/vviinn-vps-widget.stories.js +2 -0
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.css +15 -1
- package/dist/collection/components/vviinn-vps-widget/vviinn-vps-widget.js +77 -31
- package/dist/collection/locale/resources-vps.js +2 -0
- package/dist/collection/network/request.js +1 -1
- package/dist/collection/searchSession/searchSession.js +5 -10
- package/dist/collection/store/{imageSearch.store.js → search.store.js} +34 -5
- package/dist/esm/VisualSearchIcon-13f7da6a.js +6 -0
- package/dist/esm/{customized-slots-9a9f8c20.js → customized-slots-3bea41d2.js} +1 -0
- package/dist/esm/{index-53105ad4.js → index-9c15b8f1.js} +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{package-b2424850.js → package-cae9f186.js} +1 -1
- package/dist/esm/{search-filters_16.entry.js → search-filters_17.entry.js} +85 -25
- package/dist/esm/{imageSearch.store-c0f2a178.js → search.store-5eebcfbe.js} +54 -21
- package/dist/esm/vviinn-button.entry.js +1 -1
- package/dist/esm/vviinn-carousel_4.entry.js +19 -10
- package/dist/esm/vviinn-preloader.entry.js +2 -2
- package/dist/esm/vviinn-recommendations-sidebar.entry.js +4 -2
- package/dist/esm/vviinn-vpr-button.entry.js +2 -2
- package/dist/esm/vviinn-vps-button.entry.js +8 -5
- package/dist/esm/vviinn-vps-widget.entry.js +61 -36
- package/dist/esm/vviinn-widgets.js +1 -1
- package/dist/types/components/vviinn-icons/icons/ArrowIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/BasketIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/CameraActionIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/CameraIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/CheckCircleIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/CheckIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/ChevronIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/CloseIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/CrossIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/GalleryActionIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/LoaderIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/MinusIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/PlusIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/RoundCameraIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/SecondaryActionIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/TextSearchIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/UpdateIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/UploadActionIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/VisualSearchIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/icons/WarningIcon.d.ts +1 -0
- package/dist/types/components/vviinn-icons/index.d.ts +20 -17
- package/dist/types/components/vviinn-text-search/vviinn-text-search.d.ts +18 -0
- package/dist/types/components/vviinn-vpr-widget/vviinn-vpr-vidget.d.ts +1 -0
- package/dist/types/components/vviinn-vps-button/vviinn-vps-button.d.ts +2 -0
- package/dist/types/components/vviinn-vps-widget/vviinn-vps-widget.d.ts +9 -0
- package/dist/types/components.d.ts +37 -0
- package/dist/types/network/request.d.ts +1 -1
- package/dist/types/searchSession/searchSession.d.ts +17 -3
- package/dist/types/store/{imageSearch.store.d.ts → search.store.d.ts} +6 -4
- package/{www/build/p-987a8e9f.js → dist/vviinn-widgets/p-04cdf7c5.js} +1 -1
- package/dist/vviinn-widgets/{p-7f2c9319.entry.js → p-185e2420.entry.js} +1 -1
- package/dist/vviinn-widgets/p-1a1d85b7.js +1 -0
- package/dist/vviinn-widgets/p-3d2759e3.entry.js +1 -0
- package/dist/vviinn-widgets/{p-da7273ce.js → p-41ab810c.js} +1 -1
- package/dist/vviinn-widgets/{p-ed082ecf.entry.js → p-4c726a51.entry.js} +1 -1
- package/dist/vviinn-widgets/p-ae471f24.entry.js +11 -0
- package/dist/vviinn-widgets/p-b21ebac9.js +1 -0
- package/dist/vviinn-widgets/p-c96f5909.entry.js +1 -0
- package/dist/vviinn-widgets/p-d1592ac5.entry.js +1 -0
- package/dist/vviinn-widgets/p-d162fe72.entry.js +1 -0
- package/dist/vviinn-widgets/{p-010b4979.entry.js → p-ec7b07a0.entry.js} +1 -1
- package/dist/vviinn-widgets/p-ed482314.js +1 -0
- package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
- package/package.json +1 -1
- package/{dist/vviinn-widgets/p-987a8e9f.js → www/build/p-04cdf7c5.js} +1 -1
- package/www/build/{p-7f2c9319.entry.js → p-185e2420.entry.js} +1 -1
- package/www/build/p-1a1d85b7.js +1 -0
- package/www/build/p-3d2759e3.entry.js +1 -0
- package/www/build/{p-da7273ce.js → p-41ab810c.js} +1 -1
- package/www/build/{p-ed082ecf.entry.js → p-4c726a51.entry.js} +1 -1
- package/www/build/p-ae471f24.entry.js +11 -0
- package/www/build/p-b21ebac9.js +1 -0
- package/www/build/p-c96f5909.entry.js +1 -0
- package/www/build/p-d1592ac5.entry.js +1 -0
- package/www/build/p-d162fe72.entry.js +1 -0
- package/www/build/{p-010b4979.entry.js → p-ec7b07a0.entry.js} +1 -1
- package/www/build/p-ed482314.js +1 -0
- package/www/build/vviinn-widgets.esm.js +1 -1
- package/dist/cjs/index-28052f80.js +0 -48
- package/dist/esm/index-ac58a953.js +0 -34
- package/dist/vviinn-widgets/p-044c5f45.entry.js +0 -1
- package/dist/vviinn-widgets/p-726774f9.js +0 -1
- package/dist/vviinn-widgets/p-7f19baa1.js +0 -1
- package/dist/vviinn-widgets/p-a7cc44b3.entry.js +0 -1
- package/dist/vviinn-widgets/p-ab938400.entry.js +0 -1
- package/dist/vviinn-widgets/p-b1e9dd46.entry.js +0 -1
- package/dist/vviinn-widgets/p-c8ef8d6c.js +0 -1
- package/dist/vviinn-widgets/p-ecd1c141.entry.js +0 -11
- package/www/build/p-044c5f45.entry.js +0 -1
- package/www/build/p-726774f9.js +0 -1
- package/www/build/p-7f19baa1.js +0 -1
- package/www/build/p-a7cc44b3.entry.js +0 -1
- package/www/build/p-ab938400.entry.js +0 -1
- package/www/build/p-b1e9dd46.entry.js +0 -1
- package/www/build/p-c8ef8d6c.js +0 -1
- package/www/build/p-ecd1c141.entry.js +0 -11
|
@@ -3,10 +3,34 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-5619b5ec.js');
|
|
6
|
-
const
|
|
6
|
+
const search_store = require('./search.store-0b319593.js');
|
|
7
7
|
const i18next = require('./i18next-74ff3413.js');
|
|
8
|
-
const
|
|
9
|
-
|
|
8
|
+
const customizedSlots = require('./customized-slots-1b59bd38.js');
|
|
9
|
+
|
|
10
|
+
const ArrowIcon = () => (index.h("svg", { width: "12", height: "20", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
11
|
+
index.h("path", { d: "M0 10 10 0l1.4 1.4L2.8 10l8.6 8.6L10 20 0 10Z" })));
|
|
12
|
+
|
|
13
|
+
const MinusIcon = () => (index.h("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
14
|
+
index.h("path", { d: "M8.00001 17.3333C7.62223 17.3333 7.30556 17.2056 7.05001 16.95C6.79445 16.6944 6.66667 16.3778 6.66667 16C6.66667 15.6222 6.79445 15.3056 7.05001 15.05C7.30556 14.7944 7.62223 14.6667 8.00001 14.6667H24C24.3778 14.6667 24.6944 14.7944 24.95 15.05C25.2056 15.3056 25.3333 15.6222 25.3333 16C25.3333 16.3778 25.2056 16.6944 24.95 16.95C24.6944 17.2056 24.3778 17.3333 24 17.3333H8.00001Z", fill: "white" })));
|
|
15
|
+
|
|
16
|
+
const PlusIcon = () => (index.h("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
17
|
+
index.h("path", { d: "M14.6667 17.3333H8.00001C7.62223 17.3333 7.30556 17.2056 7.05001 16.95C6.79445 16.6944 6.66667 16.3778 6.66667 16C6.66667 15.6222 6.79445 15.3056 7.05001 15.05C7.30556 14.7944 7.62223 14.6667 8.00001 14.6667H14.6667V8.00001C14.6667 7.62223 14.7944 7.30556 15.05 7.05001C15.3056 6.79445 15.6222 6.66667 16 6.66667C16.3778 6.66667 16.6944 6.79445 16.95 7.05001C17.2056 7.30556 17.3333 7.62223 17.3333 8.00001V14.6667H24C24.3778 14.6667 24.6944 14.7944 24.95 15.05C25.2056 15.3056 25.3333 15.6222 25.3333 16C25.3333 16.3778 25.2056 16.6944 24.95 16.95C24.6944 17.2056 24.3778 17.3333 24 17.3333H17.3333V24C17.3333 24.3778 17.2056 24.6944 16.95 24.95C16.6944 25.2056 16.3778 25.3333 16 25.3333C15.6222 25.3333 15.3056 25.2056 15.05 24.95C14.7944 24.6944 14.6667 24.3778 14.6667 24V17.3333Z", fill: "white" })));
|
|
18
|
+
|
|
19
|
+
const RoundCameraIcon = () => (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "80", height: "80", viewBox: "0 0 80 80", fill: "none" },
|
|
20
|
+
index.h("circle", { cx: "40", cy: "40", r: "36", fill: "white" }),
|
|
21
|
+
index.h("circle", { cx: "40", cy: "40", r: "39", fill: "white", "fill-opacity": "0.16", stroke: "white", "stroke-width": "2" }),
|
|
22
|
+
index.h("path", { "fill-rule": "evenodd", "clip-rule": "evenodd", d: "M48 29.3333H50.6667C53.6133 29.3333 56 31.72 56 34.6667V45.3333H53.3333V34.6667C53.3333 33.2 52.1333 32 50.6667 32H46.5733L45.7867 30.8133L43.9067 28H36.0933L34.2133 30.8133L33.4267 32H29.3333C27.8667 32 26.6667 33.2 26.6667 34.6667V48C26.6667 49.4667 27.8667 50.6667 29.3333 50.6667H36V53.3333H29.3333C26.3867 53.3333 24 50.9467 24 48V34.6667C24 31.72 26.3867 29.3333 29.3333 29.3333H32L34.6667 25.3333H45.3333L48 29.3333ZM40 34.6667C43.68 34.6667 46.6667 37.6533 46.6667 41.3333L46.6533 41.3467C46.6533 42.6933 46.24 43.96 45.5467 45.0133L51.6 51.0667L49.72 52.9467L43.6667 46.8933C42.6133 47.5867 41.36 48 40 48C36.32 48 33.3333 45.0133 33.3333 41.3333C33.3333 37.6533 36.32 34.6667 40 34.6667ZM36 41.3333C36 43.5333 37.8 45.3333 40 45.3333C42.2 45.3333 44 43.5333 44 41.3333C44 39.1333 42.2 37.3333 40 37.3333C37.8 37.3333 36 39.1333 36 41.3333Z", fill: "#161616" })));
|
|
23
|
+
|
|
24
|
+
const SecondaryActionIcon = () => (index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" },
|
|
25
|
+
index.h("path", { d: "M7.82499 13L12.725 17.9C12.925 18.1 13.0208 18.3333 13.0125 18.6C13.0042 18.8667 12.9 19.1 12.7 19.3C12.5 19.4833 12.2667 19.5792 12 19.5875C11.7333 19.5958 11.5 19.5 11.3 19.3L4.69999 12.7C4.59999 12.6 4.52915 12.4917 4.48749 12.375C4.44582 12.2583 4.42499 12.1333 4.42499 12C4.42499 11.8667 4.44582 11.7417 4.48749 11.625C4.52915 11.5083 4.59999 11.4 4.69999 11.3L11.3 4.69999C11.4833 4.51665 11.7125 4.42499 11.9875 4.42499C12.2625 4.42499 12.5 4.51665 12.7 4.69999C12.9 4.89999 13 5.13749 13 5.41249C13 5.68749 12.9 5.92499 12.7 6.12499L7.82499 11H19C19.2833 11 19.5208 11.0958 19.7125 11.2875C19.9042 11.4792 20 11.7167 20 12C20 12.2833 19.9042 12.5208 19.7125 12.7125C19.5208 12.9042 19.2833 13 19 13H7.82499Z", fill: "currentColor" })));
|
|
26
|
+
|
|
27
|
+
const TextSearchIcon = () => (index.h("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
28
|
+
index.h("path", { d: "M20.6 4.57C17.39 4.19 16.88 3.68 16.42 0.37C16.38 0.15 16.22 0 16.01 0C15.8 0 15.63 0.15 15.59 0.37C15.12 3.66 14.63 4.13 11.41 4.57C11.17 4.61 11.01 4.77 11.01 5C11.01 5.23 11.17 5.39 11.41 5.42C14.63 5.81 15.14 6.31 15.59 9.62C15.63 9.84 15.8 10 16.01 10C16.22 10 16.39 9.84 16.42 9.62C16.89 6.31 17.39 5.81 20.6 5.42C20.84 5.38 21 5.22 21 5C21 4.78 20.83 4.6 20.6 4.57Z", fill: "#525252" }),
|
|
29
|
+
index.h("path", { d: "M14 12C14 9.24 11.76 7 9 7C6.24 7 4 9.24 4 12C4 14.76 6.24 17 9 17C10.02 17 10.96 16.69 11.75 16.17L16.29 20.71L17.7 19.3L13.16 14.76C13.68 13.97 13.99 13.02 13.99 12.01L14 12ZM9 15C7.35 15 6 13.65 6 12C6 10.35 7.35 9 9 9C10.65 9 12 10.35 12 12C12 13.65 10.65 15 9 15Z", fill: "#525252" })));
|
|
30
|
+
|
|
31
|
+
const WarningIcon = () => (index.h("svg", { slot: "icon", class: "icon", width: "32", height: "32", fill: "none", xmlns: "http://www.w3.org/2000/svg" },
|
|
32
|
+
index.h("path", { d: "M16 2a14 14 0 1 0 0 28 14 14 0 0 0 0-28Zm0 26a12 12 0 1 1 0-24 12 12 0 0 1 0 24Z", fill: "#525252" }),
|
|
33
|
+
index.h("path", { d: "M17 8h-2v11h2V8Zm-1 14a1.5 1.5 0 1 0 0 3 1.5 1.5 0 0 0 0-3Z", fill: "#525252" })));
|
|
10
34
|
|
|
11
35
|
// -------------------------------------------------------------------------------------
|
|
12
36
|
// -------------------------------------------------------------------------------------
|
|
@@ -75,12 +99,12 @@ const SearchFilters = class {
|
|
|
75
99
|
: this.selectFilter(filter);
|
|
76
100
|
}
|
|
77
101
|
selectFilter(selectedFilter) {
|
|
78
|
-
|
|
102
|
+
search_store.searchState.activeIonLink = selectedFilter;
|
|
79
103
|
this.selectedFilter = parseFilters(selectedFilter, this.filterType);
|
|
80
104
|
this.vviinnSelectFilter.emit(Object.assign(Object.assign({}, this.basicEventData), { action: "select", kind: this.getFilterKind() }));
|
|
81
105
|
}
|
|
82
106
|
clearSelectedFilter(selectedFilter) {
|
|
83
|
-
|
|
107
|
+
search_store.searchState.activeIonLink = selectedFilter.clear;
|
|
84
108
|
this.selectedFilter = parseFilters(selectedFilter.clear, this.filterType);
|
|
85
109
|
this.vviinnSelectFilter.emit(Object.assign(Object.assign({}, this.basicEventData), { action: "deselect", kind: this.getFilterKind() }));
|
|
86
110
|
}
|
|
@@ -115,12 +139,12 @@ const SearchFilters = class {
|
|
|
115
139
|
filter: true,
|
|
116
140
|
active: filterActive,
|
|
117
141
|
}, style: { "animation-delay": `${index$1 * 10}ms` }, onPointerUp: (ev) => {
|
|
118
|
-
if (
|
|
142
|
+
if (search_store.searchState.loading)
|
|
119
143
|
return;
|
|
120
144
|
ev.stopPropagation();
|
|
121
145
|
this.handleFilterSelection(filter);
|
|
122
146
|
}, onKeyPress: (ev) => {
|
|
123
|
-
if (
|
|
147
|
+
if (search_store.searchState.loading)
|
|
124
148
|
return;
|
|
125
149
|
this.handleEnter(ev, filter);
|
|
126
150
|
} }, filter.name));
|
|
@@ -151,31 +175,31 @@ const VviinnDetectedObject = class {
|
|
|
151
175
|
this.position = ["0", "0"];
|
|
152
176
|
}
|
|
153
177
|
getObjectPosition() {
|
|
154
|
-
return
|
|
155
|
-
const objectRectangle =
|
|
156
|
-
const { x, y } =
|
|
178
|
+
return search_store._function.pipe(search_store.searchState.imageBounds, search_store.Option.map((bounds) => {
|
|
179
|
+
const objectRectangle = search_store.fromAlt(search_store.foldValueObject(this.detectedObject).rectangle);
|
|
180
|
+
const { x, y } = search_store._function.pipe(objectRectangle, search_store.scaleWithSized(bounds), search_store.center);
|
|
157
181
|
return [`${x}px`, `${y}px`];
|
|
158
|
-
}),
|
|
182
|
+
}), search_store.Option.getOrElse(() => ["0", "0"]));
|
|
159
183
|
}
|
|
160
184
|
selectDetectedObject() {
|
|
161
|
-
|
|
162
|
-
const rectangle =
|
|
163
|
-
const transformedRect =
|
|
164
|
-
const scaledRect =
|
|
165
|
-
|
|
166
|
-
|
|
185
|
+
search_store._function.pipe(search_store.searchState.imageBounds, search_store.Option.map((bounds) => {
|
|
186
|
+
const rectangle = search_store.foldValueObject(this.detectedObject).rectangle;
|
|
187
|
+
const transformedRect = search_store.fromAlt(rectangle);
|
|
188
|
+
const scaledRect = search_store.scaleWithSized(bounds)(transformedRect);
|
|
189
|
+
search_store.searchState.detectedObject = this.detectedObject;
|
|
190
|
+
search_store.searchState.searchArea = search_store.Option.some(scaledRect);
|
|
167
191
|
}));
|
|
168
|
-
|
|
192
|
+
search_store.makeRectangularSearchRequest();
|
|
169
193
|
this.vviinnSelectObject.emit(Object.assign(Object.assign({}, this.basicEventData), { detectedObject: this.detectedObject }));
|
|
170
194
|
}
|
|
171
195
|
isActive() {
|
|
172
196
|
if (!this.detectedObject)
|
|
173
197
|
return false;
|
|
174
|
-
if (!
|
|
198
|
+
if (!search_store.searchState.detectedObject)
|
|
175
199
|
return false;
|
|
176
|
-
const thisObject =
|
|
177
|
-
const savedObject =
|
|
178
|
-
return
|
|
200
|
+
const thisObject = search_store.foldValueObject(this.detectedObject);
|
|
201
|
+
const savedObject = search_store.foldValueObject(search_store.searchState.detectedObject);
|
|
202
|
+
return search_store.detectedObjectEq.equals(thisObject, savedObject);
|
|
179
203
|
}
|
|
180
204
|
render() {
|
|
181
205
|
return (index.h(index.Host, { class: {
|
|
@@ -194,7 +218,7 @@ const VviinnEmptyResults = class {
|
|
|
194
218
|
this.handler = undefined;
|
|
195
219
|
}
|
|
196
220
|
render() {
|
|
197
|
-
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(
|
|
221
|
+
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(WarningIcon, null), index.h("h4", { slot: "title" }, i18next.instance.t("emptyResultsBlock.title")), search_store.searchState.searchType === "image" && (index.h("button", { slot: "action", onClick: this.handler }, i18next.instance.t("emptyResultsBlock.button"))))));
|
|
198
222
|
}
|
|
199
223
|
};
|
|
200
224
|
|
|
@@ -294,8 +318,8 @@ const VviinnExampleImage = class {
|
|
|
294
318
|
const ctx = canvas.getContext("2d");
|
|
295
319
|
ctx.drawImage(video, dx, dy, cropDimension, cropDimension, 0, 0, canvas.width, canvas.height);
|
|
296
320
|
const dataURI = canvas.toDataURL("image/jpeg");
|
|
297
|
-
file = await
|
|
298
|
-
|
|
321
|
+
file = await search_store.toFile(dataURI);
|
|
322
|
+
search_store._function.pipe(await search_store.processSelectedFile(file), search_store.Either.match(() => this.vviinnNoResult.emit(this.basicEventData), () => this.vviinnImageUploadFinished.emit()));
|
|
299
323
|
this.selected = false;
|
|
300
324
|
this.videoInitialized = false;
|
|
301
325
|
this.vviinnCameraEnabled.emit(false);
|
|
@@ -323,7 +347,7 @@ const VviinnExampleImage = class {
|
|
|
323
347
|
hidden: !this.videoInitialized || this.selected,
|
|
324
348
|
}, autoplay: true, playsinline: true, muted: true }), index.h("img", { src: this.exampleImageSource, width: this.width, height: this.height, tabindex: 1, class: { hidden: this.videoInitialized || this.selected } }), index.h("img", { id: "captured-image-placeholder", class: { hidden: !this.selected } }), index.h("div", { class: "container", id: "container" }, index.h("div", { class: {
|
|
325
349
|
hidden: !this.videoInitialized,
|
|
326
|
-
}, id: "photo-frame" }), this.zoomCapabilities && this.videoInitialized && (index.h("div", { class: "buttons-group zoom-buttons" }, index.h("button", { onClick: () => this.onZoom("out") }, index.h(
|
|
350
|
+
}, id: "photo-frame" }), this.zoomCapabilities && this.videoInitialized && (index.h("div", { class: "buttons-group zoom-buttons" }, index.h("button", { onClick: () => this.onZoom("out") }, index.h(MinusIcon, null)), index.h("button", { onClick: () => this.onZoom("in") }, index.h(PlusIcon, null)))), index.h("div", { class: "buttons-group" }, index.h("button", { class: { "photo-button": true, visible: this.videoInitialized }, onClick: () => this.selectImage() }, index.h(RoundCameraIcon, null))))));
|
|
327
351
|
}
|
|
328
352
|
get el() { return index.getElement(this); }
|
|
329
353
|
static get watchers() { return {
|
|
@@ -350,8 +374,8 @@ const VviinnImageSelector = class {
|
|
|
350
374
|
async handleInputChange(event) {
|
|
351
375
|
this.vviinnImageUpload.emit(this.basicEventData);
|
|
352
376
|
const input = event.target;
|
|
353
|
-
const processingResult = await
|
|
354
|
-
|
|
377
|
+
const processingResult = await search_store.processSelectedFile(input.files[0]);
|
|
378
|
+
search_store._function.pipe(processingResult, search_store.match$1(({ kind }) => this.vviinnNoResult.emit(Object.assign(Object.assign({}, this.basicEventData), { reason: kind })), () => this.vviinnImageUploadFinished.emit()));
|
|
355
379
|
input.value = null;
|
|
356
380
|
}
|
|
357
381
|
startUploadWatcher(upload) {
|
|
@@ -369,7 +393,7 @@ const VviinnImageSelector = class {
|
|
|
369
393
|
};
|
|
370
394
|
VviinnImageSelector.style = vviinnImageSelectorCss;
|
|
371
395
|
|
|
372
|
-
var cropper =
|
|
396
|
+
var cropper = search_store.createCommonjsModule(function (module, exports) {
|
|
373
397
|
/*!
|
|
374
398
|
* Cropper.js v1.5.13
|
|
375
399
|
* https://fengyuanchen.github.io/cropperjs
|
|
@@ -382,7 +406,7 @@ var cropper = imageSearch_store.createCommonjsModule(function (module, exports)
|
|
|
382
406
|
|
|
383
407
|
(function (global, factory) {
|
|
384
408
|
module.exports = factory() ;
|
|
385
|
-
})(
|
|
409
|
+
})(search_store.commonjsGlobal, (function () {
|
|
386
410
|
function ownKeys(object, enumerableOnly) {
|
|
387
411
|
var keys = Object.keys(object);
|
|
388
412
|
if (Object.getOwnPropertySymbols) {
|
|
@@ -3652,8 +3676,8 @@ const cropperOptions = {
|
|
|
3652
3676
|
viewMode: 1,
|
|
3653
3677
|
};
|
|
3654
3678
|
const getImageSizes = (i) => {
|
|
3655
|
-
const dimensions =
|
|
3656
|
-
const resize =
|
|
3679
|
+
const dimensions = search_store.dimensionsFromImage(i);
|
|
3680
|
+
const resize = search_store.scaleByLargestSide(DEFAULT_IMAGE_SIZE);
|
|
3657
3681
|
const newDimensions = resize(dimensions);
|
|
3658
3682
|
const sizes = newDimensions.map((d) => d.size);
|
|
3659
3683
|
return [sizes[0], sizes[1]];
|
|
@@ -3684,9 +3708,9 @@ const VviinnImageView = class {
|
|
|
3684
3708
|
index.registerInstance(this, hostRef);
|
|
3685
3709
|
this.vviinnImageCrop = index.createEvent(this, "vviinnImageCrop", 7);
|
|
3686
3710
|
this.cropEnd = () => {
|
|
3687
|
-
|
|
3688
|
-
|
|
3689
|
-
|
|
3711
|
+
search_store.searchState.searchArea = search_store.Option.some(this.getCropboxData());
|
|
3712
|
+
search_store.makeRectangularSearchRequest();
|
|
3713
|
+
search_store.searchState.detectedObject = undefined;
|
|
3690
3714
|
this.vviinnImageCrop.emit(this.basicEventData);
|
|
3691
3715
|
};
|
|
3692
3716
|
this.basicEventData = undefined;
|
|
@@ -3727,7 +3751,7 @@ const VviinnImageView = class {
|
|
|
3727
3751
|
data = this.cropper.getData(true);
|
|
3728
3752
|
this.cropper.destroy();
|
|
3729
3753
|
}
|
|
3730
|
-
const imageBounds =
|
|
3754
|
+
const imageBounds = search_store.fromImage(imageElement);
|
|
3731
3755
|
const { x, y, width, height } = imageBounds;
|
|
3732
3756
|
const searchArea = {
|
|
3733
3757
|
x,
|
|
@@ -3735,8 +3759,8 @@ const VviinnImageView = class {
|
|
|
3735
3759
|
width: width - width * INITIAL_CROP_AREA_OFFSET,
|
|
3736
3760
|
height: height - height * INITIAL_CROP_AREA_OFFSET,
|
|
3737
3761
|
};
|
|
3738
|
-
|
|
3739
|
-
|
|
3762
|
+
search_store.searchState.imageBounds = search_store.Option.some(imageBounds);
|
|
3763
|
+
search_store.searchState.searchArea = search_store.Option.some(searchArea);
|
|
3740
3764
|
if (width / height < SUPPORTED_ASPECT_RATIO ||
|
|
3741
3765
|
height / width < SUPPORTED_ASPECT_RATIO) {
|
|
3742
3766
|
this.setShowAspectRatioError(true);
|
|
@@ -3756,14 +3780,13 @@ const VviinnImageView = class {
|
|
|
3756
3780
|
return (index.h("vviinn-detected-object", { detectedObject: object, basicEventData: this.basicEventData }));
|
|
3757
3781
|
}
|
|
3758
3782
|
renderImage() {
|
|
3759
|
-
return
|
|
3783
|
+
return search_store._function.pipe(search_store.sequenceToOption(search_store.searchState.imageUrl, search_store.searchState.image), search_store.Option.map(([url, refImage]) => {
|
|
3760
3784
|
const [width, height] = getImageSizes(refImage);
|
|
3761
3785
|
return (index.h("img", { decoding: "async", width: width, height: height, src: url, draggable: false, onLoad: () => this.loadImage() }));
|
|
3762
|
-
}),
|
|
3786
|
+
}), search_store.Option.getOrElse(() => null));
|
|
3763
3787
|
}
|
|
3764
3788
|
render() {
|
|
3765
|
-
return (index.h(index.Host, null, index.h("div", { class: "container" }, index.h("div", { class: "image-container" }, this.renderImage(),
|
|
3766
|
-
imageSearch_store.imageSearchState.objectDetectionInProgress) &&
|
|
3789
|
+
return (index.h(index.Host, null, index.h("div", { class: "container" }, index.h("div", { class: "image-container" }, this.renderImage(), search_store.searchState.detectedObjects.map((o) => this.renderDetectedObject(o))), (search_store.searchState.loading || search_store.searchState.objectDetectionInProgress) &&
|
|
3767
3790
|
!this.showAspectRatioError &&
|
|
3768
3791
|
!this.hidePreloader ? (index.h("div", { class: "image-preloader" }, index.h("vviinn-preloader", null))) : null)));
|
|
3769
3792
|
}
|
|
@@ -3811,16 +3834,16 @@ const VviinnModal = class {
|
|
|
3811
3834
|
this.slider = true;
|
|
3812
3835
|
}
|
|
3813
3836
|
renderImage() {
|
|
3814
|
-
return
|
|
3837
|
+
return search_store._function.pipe(search_store.sequenceToOption(search_store.searchState.imageUrl, search_store.searchState.image), search_store.Option.map(([url]) => {
|
|
3815
3838
|
const image = (index.h("img", { width: "28", height: "28", src: url, class: "title-image" }));
|
|
3816
3839
|
return image;
|
|
3817
|
-
}),
|
|
3840
|
+
}), search_store.Option.getOrElse(() => null));
|
|
3818
3841
|
}
|
|
3819
3842
|
render() {
|
|
3820
3843
|
return (index.h(index.Host, { exportparts: "secondary-action, title, close-button", class: { closed: !this.active, "first-screen": this.isFirstScreen }, onAnimationEnd: (ev) => this.handleAnimationEnd(ev) }, index.h("div", { class: "head" }, !this.hideBackButton && (index.h("button", { part: "secondary-action", onClick: () => {
|
|
3821
3844
|
this.resetState();
|
|
3822
3845
|
this.resetTopScroll();
|
|
3823
|
-
} }, index.h(
|
|
3846
|
+
} }, index.h(SecondaryActionIcon, null))), index.h("div", { class: "title", part: "title" }, this.renderImage(), index.h("slot", { name: "vviinn-image-search-modal-title" }, i18next.instance.t("imageSearchModalTitle"))), index.h("button", { onClick: () => this.close(), class: "close-button", part: "close-button" }, index.h("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", viewBox: "0 0 24 24", fill: "none" }, index.h("path", { d: "M12 13.3892L6.91958 18.4696C6.72248 18.6667 6.49095 18.7653 6.225 18.7653C5.95905 18.7653 5.72753 18.6667 5.53043 18.4696C5.33333 18.2725 5.23478 18.041 5.23478 17.775C5.23478 17.5091 5.33333 17.2776 5.53043 17.0805L10.6109 12L5.53043 6.9196C5.33333 6.7225 5.23478 6.49098 5.23478 6.22503C5.23478 5.95908 5.33333 5.72755 5.53043 5.53045C5.72753 5.33335 5.95905 5.2348 6.225 5.2348C6.49095 5.2348 6.72248 5.33335 6.91958 5.53045L12 10.6109L17.0804 5.53045C17.2775 5.33335 17.5091 5.2348 17.775 5.2348C18.041 5.2348 18.2725 5.33335 18.4696 5.53045C18.6667 5.72755 18.7652 5.95908 18.7652 6.22503C18.7652 6.49098 18.6667 6.7225 18.4696 6.9196L13.3892 12L18.4696 17.0805C18.6667 17.2776 18.7652 17.5091 18.7652 17.775C18.7652 18.041 18.6667 18.2725 18.4696 18.4696C18.2725 18.6667 18.041 18.7653 17.775 18.7653C17.5091 18.7653 17.2775 18.6667 17.0804 18.4696L12 13.3892Z", fill: "currentColor" })))), index.h("div", { class: "body" }, index.h("slot", null))));
|
|
3824
3847
|
}
|
|
3825
3848
|
get el() { return index.getElement(this); }
|
|
3826
3849
|
};
|
|
@@ -3857,7 +3880,7 @@ const VviinnOverlayedModal = class {
|
|
|
3857
3880
|
};
|
|
3858
3881
|
VviinnOverlayedModal.style = vviinnOverlayedModalCss;
|
|
3859
3882
|
|
|
3860
|
-
const vviinnPrivacyBadgeCss = ":host{color:#525252;font-size:12px;line-height:16px;text-align:center}:host(.invisible){color:transparent}@media (max-width: 768px){:host(.invisible){display:none}}";
|
|
3883
|
+
const vviinnPrivacyBadgeCss = ":host{color:#525252;font-size:12px;line-height:16px;text-align:center;margin-top:24px}:host(.invisible){color:transparent}@media (max-width: 768px){:host(.invisible){display:none}}";
|
|
3861
3884
|
|
|
3862
3885
|
const VviinnPrivacyBadge = class {
|
|
3863
3886
|
constructor(hostRef) {
|
|
@@ -3880,7 +3903,7 @@ const VviinnServerError = class {
|
|
|
3880
3903
|
this.handler = undefined;
|
|
3881
3904
|
}
|
|
3882
3905
|
render() {
|
|
3883
|
-
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(
|
|
3906
|
+
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(WarningIcon, null), index.h("h4", { slot: "title" }, i18next.instance.t("serverErrorBlock.title")), index.h("button", { slot: "action", onClick: this.handler }, i18next.instance.t("serverErrorBlock.button")))));
|
|
3884
3907
|
}
|
|
3885
3908
|
};
|
|
3886
3909
|
|
|
@@ -3904,7 +3927,7 @@ const getStyleMap = (data) => {
|
|
|
3904
3927
|
};
|
|
3905
3928
|
};
|
|
3906
3929
|
const Arrow = ({ kind, tabindex, disabled, onClick, onKeyDown, }) => (index.h("div", { class: getStyleMap({ kind, disabled }), onClick: onClick, tabindex: tabindex, onKeyDown: onKeyDown },
|
|
3907
|
-
index.h(
|
|
3930
|
+
index.h(ArrowIcon, null)));
|
|
3908
3931
|
|
|
3909
3932
|
const vviinnSliderCss = ":host{--color-primary-system:#0F62FE;--color-primary-hover-system:#014CDA;--color-icons-system:#2F8EDF;--spacer:8px}:host{--num-items:0;--position:0;display:grid;grid-gap:20px;justify-items:center;position:relative}.items-wrapper{overflow:hidden;width:100%}.items{box-sizing:border-box;display:grid;grid-auto-flow:column;grid-template-columns:repeat(var(--num-items), 100%);transform:translateX(calc(-100% * var(--position)));transition:transform 0.33s ease-in-out}.controls{display:grid;grid-gap:16px;grid-template-columns:repeat(var(--num-items), min-content)}.bullet{background:#e0e0e0;border-radius:50%;box-sizing:border-box;cursor:pointer;height:8px;width:8px;transition:background 0.1s ease-in-out}.bullet:hover{background:#c6c6c6}.bullet.active{background:var(--color-primary, var(--color-primary-system))}.bullet:active{background:transparent;border:2px solid var(--color-primary, var(--color-primary-system))}.arrow-wrapper{align-items:center;cursor:pointer;background:white;border:2px solid white;bottom:0;box-sizing:border-box;display:grid;height:calc(var(--spacer) * 6);justify-items:center;margin:auto;position:absolute;top:0;transform:translate3d(0, -50%, 0);transition:border 0.25ms ease-in-out;width:calc(var(--spacer) * 4)}.arrow-wrapper:active{border-color:var(--color-primary, var(--color-primary-system));opacity:0.75}.arrow-wrapper:focus{border-color:var(--color-primary, var(--color-primary-system));opacity:0.5;outline:none}.prev{left:0}.next{right:0}.next>svg{transform:rotate3d(0, 1, 0, 180deg)}.arrow-wrapper>svg{transition:fill 0.25ms ease-in-out;fill:#a8a8a8}.arrow-wrapper:hover>svg{fill:#8d8d8d}";
|
|
3910
3933
|
|
|
@@ -3913,7 +3936,7 @@ const VviinnSlider = class {
|
|
|
3913
3936
|
index.registerInstance(this, hostRef);
|
|
3914
3937
|
this.elementsCount = 0;
|
|
3915
3938
|
this.internalPosition = 0;
|
|
3916
|
-
this.swipeStartPosition =
|
|
3939
|
+
this.swipeStartPosition = search_store.Option.none;
|
|
3917
3940
|
this.isRTL = false;
|
|
3918
3941
|
this.showBullets = true;
|
|
3919
3942
|
this.position = 0;
|
|
@@ -3947,7 +3970,7 @@ const VviinnSlider = class {
|
|
|
3947
3970
|
this.setActiveCssClassToSlide(index);
|
|
3948
3971
|
}
|
|
3949
3972
|
renderBullets() {
|
|
3950
|
-
return this.showBullets ? (index.h("div", { class: "controls" },
|
|
3973
|
+
return this.showBullets ? (index.h("div", { class: "controls" }, search_store.NonEmptyArray.range(0, this.elementsCount - 1).map((i) => (index.h("div", { class: {
|
|
3951
3974
|
bullet: true,
|
|
3952
3975
|
active: i == Math.abs(this.internalPosition) % this.elementsCount,
|
|
3953
3976
|
}, onClick: () => this.goToSlide(i) }))))) : null;
|
|
@@ -3988,13 +4011,13 @@ const VviinnSlider = class {
|
|
|
3988
4011
|
handleTouchStart(event) {
|
|
3989
4012
|
if (!this.showBullets)
|
|
3990
4013
|
return;
|
|
3991
|
-
this.swipeStartPosition =
|
|
4014
|
+
this.swipeStartPosition = search_store._function.pipe(event.touches[0], search_store.Option.fromNullable, search_store.Option.map((t) => t.clientX));
|
|
3992
4015
|
}
|
|
3993
4016
|
handleTouchEnd(event) {
|
|
3994
4017
|
if (!this.showBullets)
|
|
3995
4018
|
return;
|
|
3996
|
-
const swipeEndPosition =
|
|
3997
|
-
|
|
4019
|
+
const swipeEndPosition = search_store._function.pipe(event.changedTouches[0], search_store.Option.fromNullable, search_store.Option.map((t) => t.clientX));
|
|
4020
|
+
search_store._function.pipe(search_store.sequenceToOption(this.swipeStartPosition, swipeEndPosition), search_store.Option.map(([start, end]) => Ord.compare(start, end)), search_store.Option.map((swipeDirection) => {
|
|
3998
4021
|
switch (swipeDirection) {
|
|
3999
4022
|
case 1:
|
|
4000
4023
|
return this.nextSlide();
|
|
@@ -4034,13 +4057,50 @@ const VviinnTeaser = class {
|
|
|
4034
4057
|
};
|
|
4035
4058
|
VviinnTeaser.style = vviinnTeaserCss;
|
|
4036
4059
|
|
|
4060
|
+
const vviinnTextSearchCss = ":host{display:block;position:relative;width:100%}.text-search-input{width:100%;height:48px;padding:0 16px;font-size:16px;box-sizing:border-box;font-style:normal;font-weight:400;border-radius:8px;border:1px solid #e0e0e0;transition:border-color 0.2s;outline:none;overflow:hidden}.text-search-input::-moz-placeholder{color:#a8a8a8}.text-search-input::placeholder{color:#a8a8a8}.text-search-input:focus,.text-search-input:active{border-color:#8d8d8d}.text-search-button{position:absolute;right:1px;top:1px;border:none;border-radius:0 7px 7px 0;width:46px;height:46px;display:flex;justify-content:center;align-items:center;background-color:#f4f4f4;transition:background-color 0.2s;cursor:pointer}.text-search-button:not(:disabled):hover{background-color:#e0e0e0}.text-search-button:disabled{cursor:unset}vviinn-preloader{--preloader-size:16px;display:flex;color:#525252}";
|
|
4061
|
+
|
|
4062
|
+
const VviinnTextSearch = class {
|
|
4063
|
+
constructor(hostRef) {
|
|
4064
|
+
index.registerInstance(this, hostRef);
|
|
4065
|
+
this.vviinnTextSearchFinished = index.createEvent(this, "vviinnTextSearchFinished", 7);
|
|
4066
|
+
this.clearSearchQuery = false;
|
|
4067
|
+
this.initialSearchQuery = "";
|
|
4068
|
+
this.searchQuery = this.initialSearchQuery;
|
|
4069
|
+
}
|
|
4070
|
+
componentWillLoad() {
|
|
4071
|
+
customizedSlots.slotChangeListener(this, this.el);
|
|
4072
|
+
}
|
|
4073
|
+
handleInputChange(event) {
|
|
4074
|
+
this.searchQuery = event.target.value;
|
|
4075
|
+
}
|
|
4076
|
+
handleKeyPress(event) {
|
|
4077
|
+
if (event.key === "Enter") {
|
|
4078
|
+
this.handleSearch();
|
|
4079
|
+
}
|
|
4080
|
+
}
|
|
4081
|
+
async handleSearch() {
|
|
4082
|
+
if (!this.searchQuery)
|
|
4083
|
+
return;
|
|
4084
|
+
await search_store.processSelectedText(this.searchQuery);
|
|
4085
|
+
this.vviinnTextSearchFinished.emit(this.searchQuery);
|
|
4086
|
+
if (this.clearSearchQuery) {
|
|
4087
|
+
this.searchQuery = "";
|
|
4088
|
+
}
|
|
4089
|
+
}
|
|
4090
|
+
render() {
|
|
4091
|
+
return (index.h(index.Host, { exportparts: "text-search-input" }, index.h("input", { class: "text-search-input", part: "text-search-input", type: "text", placeholder: i18next.instance.t("textSearchPlaceholder"), value: this.searchQuery, onInput: (event) => this.handleInputChange(event), onKeyUp: (event) => this.handleKeyPress(event) }), index.h("button", { class: "text-search-button", onClick: () => this.handleSearch(), disabled: search_store.searchState.loading }, search_store.searchState.loading && search_store.searchState.searchType === "text" ? (index.h("vviinn-preloader", null)) : (index.h("slot", { name: "vviinn-text-search-icon" }, index.h(TextSearchIcon, null))))));
|
|
4092
|
+
}
|
|
4093
|
+
get el() { return index.getElement(this); }
|
|
4094
|
+
};
|
|
4095
|
+
VviinnTextSearch.style = vviinnTextSearchCss;
|
|
4096
|
+
|
|
4037
4097
|
const VviinnWrongAspectRatio = class {
|
|
4038
4098
|
constructor(hostRef) {
|
|
4039
4099
|
index.registerInstance(this, hostRef);
|
|
4040
4100
|
this.handler = undefined;
|
|
4041
4101
|
}
|
|
4042
4102
|
render() {
|
|
4043
|
-
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(
|
|
4103
|
+
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(WarningIcon, null), index.h("h4", { slot: "title" }, i18next.instance.t("wrongAspectRatioBlock.title")), index.h("button", { slot: "action", onClick: this.handler }, i18next.instance.t("wrongAspectRatioBlock.button")))));
|
|
4044
4104
|
}
|
|
4045
4105
|
};
|
|
4046
4106
|
|
|
@@ -4050,7 +4110,7 @@ const VviinnWrongFormat = class {
|
|
|
4050
4110
|
this.handler = undefined;
|
|
4051
4111
|
}
|
|
4052
4112
|
render() {
|
|
4053
|
-
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(
|
|
4113
|
+
return (index.h(index.Host, null, index.h("vviinn-error", null, index.h(WarningIcon, null), index.h("h4", { slot: "title" }, i18next.instance.t("wrongFormatBlock.title")), index.h("span", { slot: "text" }, i18next.instance.t("wrongFormatBlock.text")), index.h("button", { slot: "action", onClick: this.handler }, i18next.instance.t("wrongFormatBlock.button")))));
|
|
4054
4114
|
}
|
|
4055
4115
|
};
|
|
4056
4116
|
|
|
@@ -4068,5 +4128,6 @@ exports.vviinn_server_error = VviinnServerError;
|
|
|
4068
4128
|
exports.vviinn_slide = VviinnSlide;
|
|
4069
4129
|
exports.vviinn_slider = VviinnSlider;
|
|
4070
4130
|
exports.vviinn_teaser = VviinnTeaser;
|
|
4131
|
+
exports.vviinn_text_search = VviinnTextSearch;
|
|
4071
4132
|
exports.vviinn_wrong_aspect_ratio = VviinnWrongAspectRatio;
|
|
4072
4133
|
exports.vviinn_wrong_format = VviinnWrongFormat;
|
|
@@ -16476,12 +16476,14 @@ function getJson(x) {
|
|
|
16476
16476
|
}
|
|
16477
16477
|
const request = (url, request = {}) => _function.pipe(safeRequest(url, request), TaskEither.chain(processResponce), TaskEither.chain((x) => getJson(x)));
|
|
16478
16478
|
const initRequestSemigroup = mergeInitRequests;
|
|
16479
|
-
const makeRequest = (path, init) => ([apiPath, options
|
|
16479
|
+
const makeRequest = (path, init) => ([apiPath, options]) => {
|
|
16480
16480
|
const url = new URL(path, apiPath);
|
|
16481
16481
|
const fullOptions = initRequestSemigroup.concat(options, init);
|
|
16482
16482
|
return _function.pipe(request(url.toString(), fullOptions), TaskEither.mapLeft(basicErrorFromResponse));
|
|
16483
16483
|
};
|
|
16484
16484
|
|
|
16485
|
+
const sequenceToEither = Apply$1.sequenceT(Either.Apply);
|
|
16486
|
+
|
|
16485
16487
|
const isEmpty = (x) => x.length === 0;
|
|
16486
16488
|
const checkEmpty = (x) => isEmpty(x) ? left("entity is empty") : right(x);
|
|
16487
16489
|
const existAndNotEmpty = (x) => pipe(x, fromNullable$1("entity not exist"), chain$2(checkEmpty));
|
|
@@ -16491,20 +16493,6 @@ const parseExcluded = (value) => value
|
|
|
16491
16493
|
.map((value) => (value ? `excluded[]=${value}` : ""))
|
|
16492
16494
|
.join("&");
|
|
16493
16495
|
|
|
16494
|
-
const createBearerHeaders = (token) => new Headers({
|
|
16495
|
-
Authorization: `Bearer ${token}`,
|
|
16496
|
-
});
|
|
16497
|
-
const checkToken = (token) => pipe(token, existAndNotEmpty, Either.mapLeft(() => invalidTokenError));
|
|
16498
|
-
const processBearerToken = (token) => pipe(token, checkToken, Either.map(createBearerHeaders));
|
|
16499
|
-
|
|
16500
|
-
const sequenceToEither = Apply$1.sequenceT(Either.Apply);
|
|
16501
|
-
|
|
16502
|
-
const imageFormFromFile = (file) => {
|
|
16503
|
-
const body = new FormData();
|
|
16504
|
-
body.append("image", file);
|
|
16505
|
-
return body;
|
|
16506
|
-
};
|
|
16507
|
-
|
|
16508
16496
|
const readFilters = (filters) => Object.entries(filters).map(([name, filters]) => {
|
|
16509
16497
|
return { name, filters };
|
|
16510
16498
|
});
|
|
@@ -16516,7 +16504,7 @@ const detectedObjectEq = {
|
|
|
16516
16504
|
x.rectangle.height === y.rectangle.height &&
|
|
16517
16505
|
x.rectangle.width === y.rectangle.width,
|
|
16518
16506
|
};
|
|
16519
|
-
const
|
|
16507
|
+
const imageSearchSessionClient = (initialData, campaignId = none, excludedFilters) => {
|
|
16520
16508
|
const searchUrl = "search/session";
|
|
16521
16509
|
const requestUrl = _function.pipe(campaignId, fold(() => {
|
|
16522
16510
|
const params = [];
|
|
@@ -16535,6 +16523,10 @@ const searchSessionClient = (initialData, campaignId = none, excludedFilters) =>
|
|
|
16535
16523
|
}));
|
|
16536
16524
|
return _function.pipe(sequenceToEither(getApiPath(), createInitPostRequest), fromEither, chainW(makeRequest(requestUrl, initialData)));
|
|
16537
16525
|
};
|
|
16526
|
+
const textSearchSessionClient = (initialData) => {
|
|
16527
|
+
const requestUrl = "multi-search";
|
|
16528
|
+
return _function.pipe(sequenceToEither(getApiPath(), createInitPostRequest), fromEither, chainW(makeRequest(requestUrl, initialData)));
|
|
16529
|
+
};
|
|
16538
16530
|
|
|
16539
16531
|
var ObjectMemberName;
|
|
16540
16532
|
(function (ObjectMemberName) {
|
|
@@ -16724,6 +16716,18 @@ const fromFile = async (f) => {
|
|
|
16724
16716
|
const sequenceToOption = Apply$1.sequenceT(Option.Apply);
|
|
16725
16717
|
const checkEmpryString = (x) => x.length > 0 ? Option.some(x) : Option.none;
|
|
16726
16718
|
|
|
16719
|
+
const createBearerHeaders = (token) => new Headers({
|
|
16720
|
+
Authorization: `Bearer ${token}`,
|
|
16721
|
+
});
|
|
16722
|
+
const checkToken = (token) => pipe(token, existAndNotEmpty, Either.mapLeft(() => invalidTokenError));
|
|
16723
|
+
const processBearerToken = (token) => pipe(token, checkToken, Either.map(createBearerHeaders));
|
|
16724
|
+
|
|
16725
|
+
const imageFormFromFile = (file) => {
|
|
16726
|
+
const body = new FormData();
|
|
16727
|
+
body.append("image", file);
|
|
16728
|
+
return body;
|
|
16729
|
+
};
|
|
16730
|
+
|
|
16727
16731
|
/**
|
|
16728
16732
|
* Find the first element returned by an option based selector function
|
|
16729
16733
|
*
|
|
@@ -17276,6 +17280,7 @@ const { state, onChange } = createStore({
|
|
|
17276
17280
|
serverError: false,
|
|
17277
17281
|
loading: false,
|
|
17278
17282
|
});
|
|
17283
|
+
const searchState = state;
|
|
17279
17284
|
const updateState = async (response) => {
|
|
17280
17285
|
var _a;
|
|
17281
17286
|
state.results = response.value;
|
|
@@ -17318,6 +17323,7 @@ const makeRectangularSearchRequest = async () => {
|
|
|
17318
17323
|
}));
|
|
17319
17324
|
};
|
|
17320
17325
|
const uploadFile = (file) => {
|
|
17326
|
+
state.searchType = "image";
|
|
17321
17327
|
state.loading = true;
|
|
17322
17328
|
const fileForm = imageFormFromFile(file);
|
|
17323
17329
|
const tokenWithFile = sequenceToEither(processBearerToken(state.token), right(fileForm));
|
|
@@ -17326,7 +17332,7 @@ const uploadFile = (file) => {
|
|
|
17326
17332
|
headers,
|
|
17327
17333
|
body,
|
|
17328
17334
|
};
|
|
17329
|
-
}), fromEither, chain((request) =>
|
|
17335
|
+
}), fromEither, chain((request) => imageSearchSessionClient(request, state.campaignId, state.excluded)), map((sessionResponse) => {
|
|
17330
17336
|
updateState(sessionResponse);
|
|
17331
17337
|
detectObjects(sessionResponse);
|
|
17332
17338
|
state.loading = false;
|
|
@@ -17337,7 +17343,34 @@ const uploadFile = (file) => {
|
|
|
17337
17343
|
return error;
|
|
17338
17344
|
}));
|
|
17339
17345
|
};
|
|
17340
|
-
const
|
|
17346
|
+
const uploadText = (query) => {
|
|
17347
|
+
state.searchType = "text";
|
|
17348
|
+
state.loading = true;
|
|
17349
|
+
const body = JSON.stringify({
|
|
17350
|
+
query,
|
|
17351
|
+
campaign: Option.getOrElse(() => "")(state.campaignId),
|
|
17352
|
+
});
|
|
17353
|
+
const tokenWithBody = sequenceToEither(processBearerToken(state.token), right(body));
|
|
17354
|
+
return pipe(tokenWithBody, map$4(([headers, body]) => {
|
|
17355
|
+
headers.set("Content-Type", "application/json");
|
|
17356
|
+
return {
|
|
17357
|
+
headers,
|
|
17358
|
+
body,
|
|
17359
|
+
};
|
|
17360
|
+
}), fromEither, chain((request) => textSearchSessionClient(request)), map((sessionResponse) => {
|
|
17361
|
+
var _a, _b;
|
|
17362
|
+
state.results = (_b = (_a = sessionResponse.data) === null || _a === void 0 ? void 0 : _a.products) !== null && _b !== void 0 ? _b : [];
|
|
17363
|
+
state.loading = false;
|
|
17364
|
+
return sessionResponse;
|
|
17365
|
+
}), mapLeft((error) => {
|
|
17366
|
+
state.serverError = true;
|
|
17367
|
+
state.loading = false;
|
|
17368
|
+
return error;
|
|
17369
|
+
}));
|
|
17370
|
+
};
|
|
17371
|
+
const processSelectedText = async (query) => {
|
|
17372
|
+
return await uploadText(query)();
|
|
17373
|
+
};
|
|
17341
17374
|
onChange("activeIonLink", async (newLink) => {
|
|
17342
17375
|
const link = newLink ? newLink : state.resetCategoryLink;
|
|
17343
17376
|
if (!link)
|
|
@@ -17359,8 +17392,8 @@ onChange("serverError", () => {
|
|
|
17359
17392
|
state.loading = false;
|
|
17360
17393
|
});
|
|
17361
17394
|
const setSelectedImage = (image) => {
|
|
17362
|
-
|
|
17363
|
-
|
|
17395
|
+
searchState.image = Option.some(image);
|
|
17396
|
+
searchState.imageUrl = Option.some(image.src);
|
|
17364
17397
|
};
|
|
17365
17398
|
const processSelectedFile = async (file) => {
|
|
17366
17399
|
const originFile = checkFileWithExtention(file);
|
|
@@ -17395,7 +17428,6 @@ exports.fromEither = fromEither;
|
|
|
17395
17428
|
exports.fromImage = fromImage;
|
|
17396
17429
|
exports.getApiPath = getApiPath;
|
|
17397
17430
|
exports.has = has;
|
|
17398
|
-
exports.imageSearchState = imageSearchState;
|
|
17399
17431
|
exports.isEmpty = isEmpty$1;
|
|
17400
17432
|
exports.makeRectangularSearchRequest = makeRectangularSearchRequest;
|
|
17401
17433
|
exports.makeRequest = makeRequest;
|
|
@@ -17405,8 +17437,10 @@ exports.match$1 = match$1;
|
|
|
17405
17437
|
exports.parseExcluded = parseExcluded;
|
|
17406
17438
|
exports.pipe = pipe;
|
|
17407
17439
|
exports.processSelectedFile = processSelectedFile;
|
|
17440
|
+
exports.processSelectedText = processSelectedText;
|
|
17408
17441
|
exports.scaleByLargestSide = scaleByLargestSide;
|
|
17409
17442
|
exports.scaleWithSized = scaleWithSized;
|
|
17443
|
+
exports.searchState = searchState;
|
|
17410
17444
|
exports.sequenceToOption = sequenceToOption;
|
|
17411
17445
|
exports.state = state$1;
|
|
17412
17446
|
exports.toFile = toFile;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-5619b5ec.js');
|
|
6
|
-
const
|
|
6
|
+
const VisualSearchIcon = require('./VisualSearchIcon-1180d079.js');
|
|
7
7
|
|
|
8
8
|
const vviinnButtonCss = ":host{display:block}.open-button{align-items:center;background:rgba(255, 255, 255, 0.8);border-radius:50%;border:none;box-shadow:0px 2px 6px rgba(0, 0, 0, 0.15);box-sizing:border-box;cursor:pointer;display:grid;height:40px;justify-items:center;padding:0;width:40px;transition:all 0.25s ease-in-out}.raw-open-button{background:none;border:none;cursor:pointer}.open-button:hover{box-shadow:0px 2px 6px rgba(0, 0, 0, 0.25)}.open-button:focus{border:2px solid rgba(15, 98, 254, 0.5);outline:none}.open-button:active{background:#f4f4f4;outline:none}";
|
|
9
9
|
|
|
@@ -13,7 +13,7 @@ const VviinnButton = class {
|
|
|
13
13
|
this.addStyle = true;
|
|
14
14
|
}
|
|
15
15
|
render() {
|
|
16
|
-
return (index.h(index.Host, { exportparts: "button" }, index.h("button", { class: this.addStyle ? "open-button" : "raw-open-button", part: "button" }, index.h("slot", null, index.h(
|
|
16
|
+
return (index.h(index.Host, { exportparts: "button" }, index.h("button", { class: this.addStyle ? "open-button" : "raw-open-button", part: "button" }, index.h("slot", null, index.h(VisualSearchIcon.VisualSearchIcon, null)))));
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
VviinnButton.style = vviinnButtonCss;
|