vviinn-widgets 2.215.3 → 2.216.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.
Files changed (41) hide show
  1. package/dist/cjs/{index-D9aqF1Pk.js → index-bn8_Qi8U.js} +1 -1
  2. package/dist/cjs/{search.store-B_zxc87K.js → search.store-D6AWQWQ5.js} +11 -1
  3. package/dist/cjs/vviinn-button_6.cjs.entry.js +1 -1
  4. package/dist/cjs/vviinn-camera_12.cjs.entry.js +2 -2
  5. package/dist/cjs/vviinn-carousel_10.cjs.entry.js +2 -2
  6. package/dist/cjs/vviinn-shop-the-look.cjs.entry.js +5 -17
  7. package/dist/cjs/vviinn-text-search.cjs.entry.js +1 -1
  8. package/dist/collection/components/vviinn-shop-the-look/helpers.js +5 -8
  9. package/dist/collection/store/search.store.js +9 -0
  10. package/dist/esm/{index-D8FY9QQF.js → index-CQdC4_WT.js} +1 -1
  11. package/dist/esm/{search.store-D4TKj1zR.js → search.store-BIcjmGOC.js} +11 -2
  12. package/dist/esm/vviinn-button_6.entry.js +1 -1
  13. package/dist/esm/vviinn-camera_12.entry.js +2 -2
  14. package/dist/esm/vviinn-carousel_10.entry.js +2 -2
  15. package/dist/esm/vviinn-shop-the-look.entry.js +5 -17
  16. package/dist/esm/vviinn-text-search.entry.js +1 -1
  17. package/dist/types/components/vviinn-shop-the-look/helpers.d.ts +0 -1
  18. package/dist/types/store/search.store.d.ts +8 -0
  19. package/{www/build/p-df2564fa.entry.js → dist/vviinn-widgets/p-2085820d.entry.js} +1 -1
  20. package/dist/vviinn-widgets/p-2f0be83c.entry.js +1 -0
  21. package/dist/vviinn-widgets/{p-e9e037a4.entry.js → p-6b18661a.entry.js} +1 -1
  22. package/{www/build/p-CtgJk7gu.js → dist/vviinn-widgets/p-CG9ZSQJc.js} +1 -1
  23. package/dist/vviinn-widgets/{p-CUj1CE_I.js → p-DSzFfOPO.js} +1 -1
  24. package/dist/vviinn-widgets/p-c4a92e67.entry.js +1 -0
  25. package/{www/build/p-bd24634a.entry.js → dist/vviinn-widgets/p-f3d516d5.entry.js} +1 -1
  26. package/dist/vviinn-widgets/vviinn-widgets.esm.js +1 -1
  27. package/package.json +1 -1
  28. package/{dist/vviinn-widgets/p-df2564fa.entry.js → www/build/p-2085820d.entry.js} +1 -1
  29. package/www/build/p-2f0be83c.entry.js +1 -0
  30. package/www/build/{p-9a1a9983.js → p-458fed7b.js} +1 -1
  31. package/www/build/{p-e9e037a4.entry.js → p-6b18661a.entry.js} +1 -1
  32. package/{dist/vviinn-widgets/p-CtgJk7gu.js → www/build/p-CG9ZSQJc.js} +1 -1
  33. package/www/build/{p-CUj1CE_I.js → p-DSzFfOPO.js} +1 -1
  34. package/www/build/p-c4a92e67.entry.js +1 -0
  35. package/{dist/vviinn-widgets/p-bd24634a.entry.js → www/build/p-f3d516d5.entry.js} +1 -1
  36. package/www/build/vviinn-widgets.esm.js +1 -1
  37. package/www/index.html +1 -1
  38. package/dist/vviinn-widgets/p-5ffbf3c6.entry.js +0 -1
  39. package/dist/vviinn-widgets/p-93a7156b.entry.js +0 -1
  40. package/www/build/p-5ffbf3c6.entry.js +0 -1
  41. package/www/build/p-93a7156b.entry.js +0 -1
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
- var search_store = require('./search.store-B_zxc87K.js');
4
+ var search_store = require('./search.store-D6AWQWQ5.js');
5
5
  var store = require('./store-jPZ4ROqV.js');
6
6
 
7
7
  const PlusIcon = () => (index.h("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: "plus-icon", "aria-hidden": "true" },
@@ -8593,7 +8593,7 @@ const encodeToBase64UTF8 = (str) => {
8593
8593
  return btoa(String.fromCharCode.apply(null, utf8Array));
8594
8594
  };
8595
8595
 
8596
- const version = "2.215.3";
8596
+ const version = "2.216.0";
8597
8597
 
8598
8598
  const appStateGlobalDefaults = {
8599
8599
  excluded: null,
@@ -8727,6 +8727,15 @@ const uploadImageFile = (store, token, imageType = "image", searchId, apiPath, c
8727
8727
  inner: error,
8728
8728
  })), Rectangle.chain$1((body) => processVisualSearch(store, body, token, apiPath, isHiResUpdate)))));
8729
8729
  };
8730
+ const makeVisualSearchByUrlRequest = async (store, imageUrl, token, apiPath, campaignId) => {
8731
+ const state = useStore(store);
8732
+ const body = Object.assign(Object.assign({ query: {
8733
+ url: imageUrl,
8734
+ }, objectDetection: {
8735
+ include: true,
8736
+ } }, addNestedIfNotEmpty("staticFilters", Object.assign({}, addIfNotEmpty("excluded", state.excluded)))), addIfNotEmpty("campaign", campaignId || state.campaignIdVisualSearch || state.campaignId));
8737
+ return processVisualSearch(store, body, token, apiPath)();
8738
+ };
8730
8739
  const makeUploadFileRequest = (store, token, apiPath, campaignId) => async (file) => {
8731
8740
  var _a;
8732
8741
  const state = useStore(store);
@@ -8894,6 +8903,7 @@ exports.makeAutoSuggestRequest = makeAutoSuggestRequest;
8894
8903
  exports.makeProductListingPageRequest = makeProductListingPageRequest;
8895
8904
  exports.makeTextSearchRequest = makeTextSearchRequest;
8896
8905
  exports.makeUploadFileRequest = makeUploadFileRequest;
8906
+ exports.makeVisualSearchByUrlRequest = makeVisualSearchByUrlRequest;
8897
8907
  exports.makeVisualSearchRequest = makeVisualSearchRequest;
8898
8908
  exports.parseStringToExcluded = parseStringToExcluded;
8899
8909
  exports.resetStore = resetStore;
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
4
  var store = require('./store-jPZ4ROqV.js');
5
- var search_store = require('./search.store-B_zxc87K.js');
5
+ var search_store = require('./search.store-D6AWQWQ5.js');
6
6
  var index$1 = require('./index-CBteD3gC.js');
7
7
  var SecondaryActionIcon = require('./SecondaryActionIcon-Ng84u7-b.js');
8
8
  var index$2 = require('./index-CvMi8_tX.js');
@@ -2,9 +2,9 @@
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
- var search_store = require('./search.store-B_zxc87K.js');
5
+ var search_store = require('./search.store-D6AWQWQ5.js');
6
6
  var index$2 = require('./index-CBteD3gC.js');
7
- var index$1 = require('./index-D9aqF1Pk.js');
7
+ var index$1 = require('./index-bn8_Qi8U.js');
8
8
  var store = require('./store-jPZ4ROqV.js');
9
9
  var cropperUtils = require('./cropperUtils-DCDOLeBS.js');
10
10
  var openProductLink = require('./openProductLink-BwHUGXtr.js');
@@ -1,10 +1,10 @@
1
1
  'use strict';
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
- var search_store = require('./search.store-B_zxc87K.js');
4
+ var search_store = require('./search.store-D6AWQWQ5.js');
5
5
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
6
6
  var store = require('./store-jPZ4ROqV.js');
7
- var index$1 = require('./index-D9aqF1Pk.js');
7
+ var index$1 = require('./index-bn8_Qi8U.js');
8
8
  var constants = require('./constants-BlwqMvns.js');
9
9
  var index$2 = require('./index-CBteD3gC.js');
10
10
  var index$3 = require('./index-CvMi8_tX.js');
@@ -4,7 +4,7 @@ var index = require('./index-D38ORu31.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
5
  var cropperUtils = require('./cropperUtils-DCDOLeBS.js');
6
6
  var swiperElement = require('./swiper-element-DjtzojCR.js');
7
- var search_store = require('./search.store-B_zxc87K.js');
7
+ var search_store = require('./search.store-D6AWQWQ5.js');
8
8
  var SecondaryActionIcon = require('./SecondaryActionIcon-Ng84u7-b.js');
9
9
  var index$1 = require('./index-CvMi8_tX.js');
10
10
  var store = require('./store-jPZ4ROqV.js');
@@ -148,17 +148,6 @@ const calculateImageBounds = (imageElement) => {
148
148
  };
149
149
  };
150
150
 
151
- /**
152
- * Create a File object from an image URL for upload
153
- */
154
- const createImageFile = async (imageUrl) => {
155
- const imageResponse = await fetch(imageUrl);
156
- const imageBlob = await imageResponse.blob();
157
- return new File([imageBlob], "image.jpg", {
158
- type: "image/jpeg",
159
- });
160
- };
161
-
162
151
  const isDesktop = search_store.isDesktop;
163
152
  const getVisibilityThreshold = (isDesktop) => {
164
153
  return isDesktop
@@ -230,15 +219,14 @@ const calculateModalPosition = (imageElement, detectedObject, containerElement,
230
219
  };
231
220
  const performVisualSearch = async (params) => {
232
221
  try {
233
- const imageFile = await createImageFile(params.imageUrl);
234
- const result = await search_store.makeUploadFileRequest("shopTheLook", params.token, params.apiPath, params.campaignId)(imageFile);
235
- return Rectangle.EitherExports.fold((error) => Rectangle.EitherExports.left(`Upload failed: ${error.inner}`), (uploadResponse) => {
222
+ const result = await search_store.makeVisualSearchByUrlRequest("shopTheLook", params.imageUrl, params.token, params.apiPath, params.campaignId);
223
+ return Rectangle.EitherExports.fold((error) => Rectangle.EitherExports.left(`Visual search failed: ${error.inner}`), (response) => {
236
224
  var _a, _b;
237
- const detectedObjects = ((_b = (_a = uploadResponse.interactions) === null || _a === void 0 ? void 0 : _a.suggestedSearchAreas) === null || _b === void 0 ? void 0 : _b.map((area) => area.rectangle)) || [];
225
+ const detectedObjects = ((_b = (_a = response.interactions) === null || _a === void 0 ? void 0 : _a.suggestedSearchAreas) === null || _b === void 0 ? void 0 : _b.map((area) => area.rectangle)) || [];
238
226
  return Rectangle.EitherExports.right({
239
227
  detectedObjects,
240
228
  searchResults: [],
241
- visualSearchId: uploadResponse.requestId || null,
229
+ visualSearchId: response.requestId || null,
242
230
  });
243
231
  })(result);
244
232
  }
@@ -2,7 +2,7 @@
2
2
 
3
3
  var index = require('./index-D38ORu31.js');
4
4
  var Rectangle = require('./Rectangle-7dF6_xf3.js');
5
- var search_store = require('./search.store-B_zxc87K.js');
5
+ var search_store = require('./search.store-D6AWQWQ5.js');
6
6
  var index$2 = require('./index-CBteD3gC.js');
7
7
  var store = require('./store-jPZ4ROqV.js');
8
8
  var index$1 = require('./index-CvMi8_tX.js');
@@ -2,8 +2,7 @@ import * as E from "fp-ts/lib/Either";
2
2
  import { INTERSECTION_THRESHOLDS } from "./constants";
3
3
  import { isDesktop as sharedIsDesktop, isSmallMobile as sharedIsSmallMobile, } from "../../helpers/device/checkDeviceType";
4
4
  import { calculateImageBounds } from "../../Image/bounds";
5
- import { createImageFile } from "../../Image/upload";
6
- import { makeUploadFileRequest, makeVisualSearchRequest, shopTheLookState, } from "../../store/search.store";
5
+ import { makeUploadFileRequest, makeVisualSearchByUrlRequest, makeVisualSearchRequest, shopTheLookState, } from "../../store/search.store";
7
6
  import { imageFromFileTask } from "../../Image/fromFile";
8
7
  export const isDesktop = sharedIsDesktop;
9
8
  export const isSmallMobile = sharedIsSmallMobile;
@@ -83,7 +82,6 @@ export const calculateModalPosition = (imageElement, detectedObject, containerEl
83
82
  return { x: screenX, y: screenY, anchor };
84
83
  };
85
84
  export { calculateImageBounds } from "../../Image/bounds";
86
- export { createImageFile } from "../../Image/upload";
87
85
  export { setupIntersectionObserver, } from "../../dom";
88
86
  export const resetSearchState = () => ({
89
87
  detectedObjects: [],
@@ -95,15 +93,14 @@ export const resetSearchState = () => ({
95
93
  });
96
94
  export const performVisualSearch = async (params) => {
97
95
  try {
98
- const imageFile = await createImageFile(params.imageUrl);
99
- const result = await makeUploadFileRequest("shopTheLook", params.token, params.apiPath, params.campaignId)(imageFile);
100
- return E.fold((error) => E.left(`Upload failed: ${error.inner}`), (uploadResponse) => {
96
+ const result = await makeVisualSearchByUrlRequest("shopTheLook", params.imageUrl, params.token, params.apiPath, params.campaignId);
97
+ return E.fold((error) => E.left(`Visual search failed: ${error.inner}`), (response) => {
101
98
  var _a, _b;
102
- const detectedObjects = ((_b = (_a = uploadResponse.interactions) === null || _a === void 0 ? void 0 : _a.suggestedSearchAreas) === null || _b === void 0 ? void 0 : _b.map((area) => area.rectangle)) || [];
99
+ const detectedObjects = ((_b = (_a = response.interactions) === null || _a === void 0 ? void 0 : _a.suggestedSearchAreas) === null || _b === void 0 ? void 0 : _b.map((area) => area.rectangle)) || [];
103
100
  return E.right({
104
101
  detectedObjects,
105
102
  searchResults: [],
106
- visualSearchId: uploadResponse.requestId || null,
103
+ visualSearchId: response.requestId || null,
107
104
  });
108
105
  })(result);
109
106
  }
@@ -147,6 +147,15 @@ const uploadImageFile = (store, token, imageType = "image", searchId, apiPath, c
147
147
  inner: error,
148
148
  })), TE.chain((body) => processVisualSearch(store, body, token, apiPath, isHiResUpdate)))));
149
149
  };
150
+ export const makeVisualSearchByUrlRequest = async (store, imageUrl, token, apiPath, campaignId) => {
151
+ const state = useStore(store);
152
+ const body = Object.assign(Object.assign({ query: {
153
+ url: imageUrl,
154
+ }, objectDetection: {
155
+ include: true,
156
+ } }, addNestedIfNotEmpty("staticFilters", Object.assign({}, addIfNotEmpty("excluded", state.excluded)))), addIfNotEmpty("campaign", campaignId || state.campaignIdVisualSearch || state.campaignId));
157
+ return processVisualSearch(store, body, token, apiPath)();
158
+ };
150
159
  export const makeUploadFileRequest = (store, token, apiPath, campaignId) => async (file) => {
151
160
  var _a;
152
161
  const state = useStore(store);
@@ -1,5 +1,5 @@
1
1
  import { h } from './index-RkvPN2Rk.js';
2
- import { h as addIfNotEmpty, p as parseStringToExcluded, n as isValueMatch, o as isIntervalMatch, q as valueToString, r as extractFilterValue } from './search.store-D4TKj1zR.js';
2
+ import { j as addIfNotEmpty, p as parseStringToExcluded, o as isValueMatch, q as isIntervalMatch, r as valueToString, t as extractFilterValue } from './search.store-BIcjmGOC.js';
3
3
  import { i as instance } from './store-BJxQCbNV.js';
4
4
 
5
5
  const PlusIcon = () => (h("svg", { width: "32", height: "32", viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", class: "plus-icon", "aria-hidden": "true" },
@@ -8591,7 +8591,7 @@ const encodeToBase64UTF8 = (str) => {
8591
8591
  return btoa(String.fromCharCode.apply(null, utf8Array));
8592
8592
  };
8593
8593
 
8594
- const version = "2.215.3";
8594
+ const version = "2.216.0";
8595
8595
 
8596
8596
  const appStateGlobalDefaults = {
8597
8597
  excluded: null,
@@ -8725,6 +8725,15 @@ const uploadImageFile = (store, token, imageType = "image", searchId, apiPath, c
8725
8725
  inner: error,
8726
8726
  })), chain$1((body) => processVisualSearch(store, body, token, apiPath, isHiResUpdate)))));
8727
8727
  };
8728
+ const makeVisualSearchByUrlRequest = async (store, imageUrl, token, apiPath, campaignId) => {
8729
+ const state = useStore(store);
8730
+ const body = Object.assign(Object.assign({ query: {
8731
+ url: imageUrl,
8732
+ }, objectDetection: {
8733
+ include: true,
8734
+ } }, addNestedIfNotEmpty("staticFilters", Object.assign({}, addIfNotEmpty("excluded", state.excluded)))), addIfNotEmpty("campaign", campaignId || state.campaignIdVisualSearch || state.campaignId));
8735
+ return processVisualSearch(store, body, token, apiPath)();
8736
+ };
8728
8737
  const makeUploadFileRequest = (store, token, apiPath, campaignId) => async (file) => {
8729
8738
  var _a;
8730
8739
  const state = useStore(store);
@@ -8871,4 +8880,4 @@ const clearAutoSuggestCompletions = (store) => {
8871
8880
  state.autoSuggestCompletions = [];
8872
8881
  };
8873
8882
 
8874
- export { checkDeviceType as A, isMobile as B, fromString as C, fold as D, _ArrayExports as _, makeUploadFileRequest as a, imageFromFileTask as b, setTextSearchQuery as c, clearAutoSuggestCompletions as d, makeAutoSuggestRequest as e, campaignTypeNames as f, getAcceptableFileFormats as g, addIfNotEmpty as h, isDesktop as i, makeTextSearchRequest as j, getAcceptableFileFormatsForDisplay as k, searchState as l, makeVisualSearchRequest as m, isValueMatch as n, isIntervalMatch as o, parseStringToExcluded as p, valueToString as q, extractFilterValue as r, shopTheLookState as s, toFile as t, useSearchStore as u, version as v, getImageSizes as w, checkImageType as x, resetStore as y, makeProductListingPageRequest as z };
8883
+ export { makeProductListingPageRequest as A, checkDeviceType as B, isMobile as C, fromString as D, fold as E, _ArrayExports as _, makeVisualSearchByUrlRequest as a, imageFromFileTask as b, makeUploadFileRequest as c, setTextSearchQuery as d, clearAutoSuggestCompletions as e, makeAutoSuggestRequest as f, getAcceptableFileFormats as g, campaignTypeNames as h, isDesktop as i, addIfNotEmpty as j, makeTextSearchRequest as k, getAcceptableFileFormatsForDisplay as l, makeVisualSearchRequest as m, searchState as n, isValueMatch as o, parseStringToExcluded as p, isIntervalMatch as q, valueToString as r, shopTheLookState as s, extractFilterValue as t, useSearchStore as u, version as v, toFile as w, getImageSizes as x, checkImageType as y, resetStore as z };
@@ -1,6 +1,6 @@
1
1
  import { h, r as registerInstance, H as Host, c as createEvent, g as getElement, F as Fragment } from './index-RkvPN2Rk.js';
2
2
  import { i as instance } from './store-BJxQCbNV.js';
3
- import { k as getAcceptableFileFormatsForDisplay, f as campaignTypeNames, h as addIfNotEmpty, l as searchState, u as useSearchStore, v as version } from './search.store-D4TKj1zR.js';
3
+ import { l as getAcceptableFileFormatsForDisplay, h as campaignTypeNames, j as addIfNotEmpty, n as searchState, u as useSearchStore, v as version } from './search.store-BIcjmGOC.js';
4
4
  import { s as slotChangeListener, a as addEventListenersWithSignal } from './index-OsoUj2Au.js';
5
5
  import { S as SecondaryActionIcon } from './SecondaryActionIcon-FWFzrhba.js';
6
6
  import { m as modalParts, c as carouselParts, p as productCardParts, r as recommendationsParts, i as initializeLocale } from './index-BtnjaTty.js';
@@ -1,8 +1,8 @@
1
1
  import { h, r as registerInstance, c as createEvent, H as Host, g as getElement, F as Fragment } from './index-RkvPN2Rk.js';
2
2
  import { _ as _functionExports, E as EitherExports, f as fold, b as fromImage, a as divideOnSized, e as isLeft, m as match, O as OptionExports } from './Rectangle-dmgo4KMB.js';
3
- import { t as toFile, a as makeUploadFileRequest, w as getImageSizes, v as version, f as campaignTypeNames, h as addIfNotEmpty, m as makeVisualSearchRequest, u as useSearchStore, x as checkImageType, g as getAcceptableFileFormats, c as setTextSearchQuery, y as resetStore, j as makeTextSearchRequest, z as makeProductListingPageRequest, A as checkDeviceType, p as parseStringToExcluded } from './search.store-D4TKj1zR.js';
3
+ import { w as toFile, c as makeUploadFileRequest, x as getImageSizes, v as version, h as campaignTypeNames, j as addIfNotEmpty, m as makeVisualSearchRequest, u as useSearchStore, y as checkImageType, g as getAcceptableFileFormats, d as setTextSearchQuery, z as resetStore, k as makeTextSearchRequest, A as makeProductListingPageRequest, B as checkDeviceType, p as parseStringToExcluded } from './search.store-BIcjmGOC.js';
4
4
  import { s as slotChangeListener, a as addEventListenersWithSignal, p as productCardSlotNames, v as vprIconSlotName, f as findSlotElements, g as getSlotNames, b as setElementInteractivity, S as SlotSkeleton } from './index-OsoUj2Au.js';
5
- import { g as getRemoveFilterAriaLabel, F as FilterIconClose, P as PlusIcon, R as RESULTS_CALCULATED_COLUMNS_CSS_VAR, c as createWidgetEvent, a as createFilterEvent, v as v4, b as createAddToBasketEvent, d as createAddToWishlistEvent, e as createResultEventByType, f as createProductEventByType, h as getCustomLabels, t as triggerFilter, i as getIntervalLabel, j as triggerRemoveIntervalFilter, k as announceToScreenReader, s as syncRequestFilters, l as isSubFilterActive, m as RenderFilterButton, n as createImageSearchEvent } from './index-D8FY9QQF.js';
5
+ import { g as getRemoveFilterAriaLabel, F as FilterIconClose, P as PlusIcon, R as RESULTS_CALCULATED_COLUMNS_CSS_VAR, c as createWidgetEvent, a as createFilterEvent, v as v4, b as createAddToBasketEvent, d as createAddToWishlistEvent, e as createResultEventByType, f as createProductEventByType, h as getCustomLabels, t as triggerFilter, i as getIntervalLabel, j as triggerRemoveIntervalFilter, k as announceToScreenReader, s as syncRequestFilters, l as isSubFilterActive, m as RenderFilterButton, n as createImageSearchEvent } from './index-CQdC4_WT.js';
6
6
  import { i as instance, t as trackEvent, a as isTrackingEnabled, d as defaultConfig } from './store-BJxQCbNV.js';
7
7
  import { M as MIN_SEARCH_AREA_SIZE, S as SUPPORTED_ASPECT_RATIO, a as MIN_IMAGE_SIDE_FOR_CROPPER, C as Cropper, c as cropperOptions, g as getCropBoxData, i as isCropBoxChangeMinimal, D as DEFAULT_IMAGE_SIZE } from './cropperUtils-CkB6bG3L.js';
8
8
  import { r as renderExternalCSS, o as openProductLink } from './openProductLink-CJ9Wo3Ye.js';
@@ -1,8 +1,8 @@
1
1
  import { h, r as registerInstance, c as createEvent, f as forceUpdate, F as Fragment, H as Host, g as getElement } from './index-RkvPN2Rk.js';
2
- import { f as campaignTypeNames, h as addIfNotEmpty, _ as _ArrayExports, u as useSearchStore, B as isMobile, C as fromString, D as fold, v as version } from './search.store-D4TKj1zR.js';
2
+ import { h as campaignTypeNames, j as addIfNotEmpty, _ as _ArrayExports, u as useSearchStore, C as isMobile, D as fromString, E as fold, v as version } from './search.store-BIcjmGOC.js';
3
3
  import { X as has, Y as tuple, _ as _functionExports, g as requireSemigroup, O as OptionExports, v as pipe$1, N as chainW, Z as makeRequest, L as fromEither, $ as resolveApiPath, a0 as createInitPostRequest, a1 as Apply, a2 as TaskEitherExports, E as EitherExports } from './Rectangle-dmgo4KMB.js';
4
4
  import { i as instance, d as defaultConfig, t as trackEvent, a as isTrackingEnabled } from './store-BJxQCbNV.js';
5
- import { S as SET_MODE_IMAGE_WIDTH_CSS_VAR, C as CONTENT_GROUP_CSS_CLASS, o as CAROUSEL_IMAGE_WIDTH_CSS_VAR, p as CAROUSEL_CONTENT_WIDTH_CSS_VAR, R as RESULTS_CALCULATED_COLUMNS_CSS_VAR, D as DEFAULT_COLUMNS_NUMBER, h as getCustomLabels, q as SCROLL_POSITION_TOLERANCE, r as triggerResetFilters, t as triggerFilter, k as announceToScreenReader, i as getIntervalLabel, u as isPriceFilter, l as isSubFilterActive, m as RenderFilterButton, s as syncRequestFilters, P as PlusIcon, w as CUSTOM_LABELS_DELIMITER, v as v4, c as createWidgetEvent, e as createResultEventByType, b as createAddToBasketEvent, d as createAddToWishlistEvent, f as createProductEventByType, x as getRecommendationsBody } from './index-D8FY9QQF.js';
5
+ import { S as SET_MODE_IMAGE_WIDTH_CSS_VAR, C as CONTENT_GROUP_CSS_CLASS, o as CAROUSEL_IMAGE_WIDTH_CSS_VAR, p as CAROUSEL_CONTENT_WIDTH_CSS_VAR, R as RESULTS_CALCULATED_COLUMNS_CSS_VAR, D as DEFAULT_COLUMNS_NUMBER, h as getCustomLabels, q as SCROLL_POSITION_TOLERANCE, r as triggerResetFilters, t as triggerFilter, k as announceToScreenReader, i as getIntervalLabel, u as isPriceFilter, l as isSubFilterActive, m as RenderFilterButton, s as syncRequestFilters, P as PlusIcon, w as CUSTOM_LABELS_DELIMITER, v as v4, c as createWidgetEvent, e as createResultEventByType, b as createAddToBasketEvent, d as createAddToWishlistEvent, f as createProductEventByType, x as getRecommendationsBody } from './index-CQdC4_WT.js';
6
6
  import { P as PRODUCT_CARD_IMAGE_WIDTH, D as DISCOVERY_WIDGET_IMAGE_RESOLUTION_WIDTH, c as PRODUCT_CARD_IMAGE_RESOLUTION_WIDTH } from './constants-rqiiCPBX.js';
7
7
  import { s as slotChangeListener, a as addEventListenersWithSignal, i as isElementInSelector, S as SlotSkeleton } from './index-OsoUj2Au.js';
8
8
  import { o as energyLabelParts, i as initializeLocale, j as extendedFiltersParts, h as filtersParts, q as imageParts, e as contentCardParts, l as listCardParts, p as productCardParts, t as priceRangeParts } from './index-BtnjaTty.js';
@@ -2,7 +2,7 @@ import { h, r as registerInstance, c as createEvent, H as Host, g as getElement
2
2
  import { a as divideOnSized, E as EitherExports } from './Rectangle-dmgo4KMB.js';
3
3
  import { C as Cropper, c as cropperOptions, g as getCropBoxData, i as isCropBoxChangeMinimal } from './cropperUtils-CkB6bG3L.js';
4
4
  import { g as getSwiperStyles, c as configureSwiperElement, r as register, e as extractSlideIndex, s as setupIntersectionObserver } from './swiper-element-Er2KrWw1.js';
5
- import { i as isDesktop$1, s as shopTheLookState, m as makeVisualSearchRequest, a as makeUploadFileRequest, b as imageFromFileTask, g as getAcceptableFileFormats } from './search.store-D4TKj1zR.js';
5
+ import { i as isDesktop$1, s as shopTheLookState, m as makeVisualSearchRequest, a as makeVisualSearchByUrlRequest, b as imageFromFileTask, c as makeUploadFileRequest, g as getAcceptableFileFormats } from './search.store-BIcjmGOC.js';
6
6
  import { S as SecondaryActionIcon } from './SecondaryActionIcon-FWFzrhba.js';
7
7
  import { i as initializeLocale, a as shopTheLookParts } from './index-BtnjaTty.js';
8
8
  import { d as defaultConfig } from './store-BJxQCbNV.js';
@@ -146,17 +146,6 @@ const calculateImageBounds = (imageElement) => {
146
146
  };
147
147
  };
148
148
 
149
- /**
150
- * Create a File object from an image URL for upload
151
- */
152
- const createImageFile = async (imageUrl) => {
153
- const imageResponse = await fetch(imageUrl);
154
- const imageBlob = await imageResponse.blob();
155
- return new File([imageBlob], "image.jpg", {
156
- type: "image/jpeg",
157
- });
158
- };
159
-
160
149
  const isDesktop = isDesktop$1;
161
150
  const getVisibilityThreshold = (isDesktop) => {
162
151
  return isDesktop
@@ -228,15 +217,14 @@ const calculateModalPosition = (imageElement, detectedObject, containerElement,
228
217
  };
229
218
  const performVisualSearch = async (params) => {
230
219
  try {
231
- const imageFile = await createImageFile(params.imageUrl);
232
- const result = await makeUploadFileRequest("shopTheLook", params.token, params.apiPath, params.campaignId)(imageFile);
233
- return EitherExports.fold((error) => EitherExports.left(`Upload failed: ${error.inner}`), (uploadResponse) => {
220
+ const result = await makeVisualSearchByUrlRequest("shopTheLook", params.imageUrl, params.token, params.apiPath, params.campaignId);
221
+ return EitherExports.fold((error) => EitherExports.left(`Visual search failed: ${error.inner}`), (response) => {
234
222
  var _a, _b;
235
- const detectedObjects = ((_b = (_a = uploadResponse.interactions) === null || _a === void 0 ? void 0 : _a.suggestedSearchAreas) === null || _b === void 0 ? void 0 : _b.map((area) => area.rectangle)) || [];
223
+ const detectedObjects = ((_b = (_a = response.interactions) === null || _a === void 0 ? void 0 : _a.suggestedSearchAreas) === null || _b === void 0 ? void 0 : _b.map((area) => area.rectangle)) || [];
236
224
  return EitherExports.right({
237
225
  detectedObjects,
238
226
  searchResults: [],
239
- visualSearchId: uploadResponse.requestId || null,
227
+ visualSearchId: response.requestId || null,
240
228
  });
241
229
  })(result);
242
230
  }
@@ -1,6 +1,6 @@
1
1
  import { h, r as registerInstance, c as createEvent, H as Host, g as getElement } from './index-RkvPN2Rk.js';
2
2
  import { _ as _functionExports, f as fold } from './Rectangle-dmgo4KMB.js';
3
- import { c as setTextSearchQuery, d as clearAutoSuggestCompletions, e as makeAutoSuggestRequest, v as version, f as campaignTypeNames, h as addIfNotEmpty, j as makeTextSearchRequest, u as useSearchStore } from './search.store-D4TKj1zR.js';
3
+ import { d as setTextSearchQuery, e as clearAutoSuggestCompletions, f as makeAutoSuggestRequest, v as version, h as campaignTypeNames, j as addIfNotEmpty, k as makeTextSearchRequest, u as useSearchStore } from './search.store-BIcjmGOC.js';
4
4
  import { s as slotChangeListener, f as findSlotElements } from './index-OsoUj2Au.js';
5
5
  import { i as instance, d as defaultConfig } from './store-BJxQCbNV.js';
6
6
  import { i as initializeLocale, b as searchBarParts, s as searchModalFirstScreenParts } from './index-BtnjaTty.js';
@@ -23,7 +23,6 @@ export declare const shouldKeepImageVisible: (params: VisibilityUpdateParams) =>
23
23
  export declare const shouldRenderDetectedObjects: (imageState: ImageState | null, isActiveSlide: boolean) => boolean;
24
24
  export declare const calculateModalPosition: (imageElement: HTMLImageElement, detectedObject: Rectangle, containerElement?: HTMLElement, preCalculatedImageBounds?: Rectangle | null) => ModalPosition;
25
25
  export { calculateImageBounds } from "../../Image/bounds";
26
- export { createImageFile } from "../../Image/upload";
27
26
  export { setupIntersectionObserver, type IntersectionObserverConfig, } from "../../dom";
28
27
  export declare const resetSearchState: () => {
29
28
  detectedObjects: any[];
@@ -43,6 +43,14 @@ declare const componentsState: SearchStore, onChangeComponentsState: OnChangeHan
43
43
  declare const shopTheLookState: SearchStore, onChangeShopTheLookState: OnChangeHandler<SearchStore>;
44
44
  export type ResetMode = "appStateOnly" | "receivedDataOnly" | "appStateAndReceivedData" | "all" | "manual";
45
45
  export declare const resetStore: (store: SearchStoreName, mode?: ResetMode, excludedFields?: (keyof SearchStore)[]) => void;
46
+ export declare const makeVisualSearchByUrlRequest: (store: SearchStoreName, imageUrl: string, token: string, apiPath?: string, campaignId?: string | null) => Promise<import("fp-ts/lib/Either").Either<import("../error").BasicError<string | Response>, {
47
+ requestId?: import("../interfaces/generated").components["schemas"]["request-id"];
48
+ data?: {
49
+ products: import("../interfaces/generated").components["schemas"]["response-products"];
50
+ };
51
+ interactions?: import("../interfaces/generated").components["schemas"]["interactions"];
52
+ stream?: import("../interfaces/generated").components["schemas"]["stream"];
53
+ }>>;
46
54
  export declare const makeUploadFileRequest: (store: SearchStoreName, token: string, apiPath?: string, campaignId?: string | null) => (file: File) => Promise<import("fp-ts/lib/Either").Either<import("../error").BasicError<string | Response>, {
47
55
  requestId?: import("../interfaces/generated").components["schemas"]["request-id"];
48
56
  data?: {