@nyris/nyris-webapp 0.3.77 → 0.3.78

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/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@nyris/nyris-webapp",
3
- "version": "0.3.77",
3
+ "version": "0.3.78",
4
4
  "dependencies": {
5
5
  "@auth0/auth0-react": "^2.2.4",
6
6
  "@emailjs/browser": "^4.3.3",
7
- "@nyris/nyris-api": "^0.3.77",
8
- "@nyris/nyris-react-components": "^0.3.77",
7
+ "@nyris/nyris-api": "^0.3.78",
8
+ "@nyris/nyris-react-components": "^0.3.78",
9
9
  "@radix-ui/react-accordion": "^1.2.2",
10
10
  "@radix-ui/react-dialog": "^1.1.4",
11
11
  "@radix-ui/react-popover": "^1.1.4",
@@ -10,7 +10,6 @@ import { RectCoords } from '@nyris/nyris-api';
10
10
 
11
11
  import { DEFAULT_REGION } from '../constants';
12
12
  import { useImageSearch } from 'hooks/useImageSearch';
13
- import useFilteredRegions from 'hooks/useFilteredRegions';
14
13
  import useRequestStore from 'stores/request/requestStore';
15
14
  import useResultStore from 'stores/result/resultStore';
16
15
 
@@ -33,7 +32,6 @@ function ImagePreviewComponent({
33
32
  const requestImages = useRequestStore(state => state.requestImages);
34
33
  const resetRegions = useRequestStore(state => state.resetRegions);
35
34
  const setRequestImages = useRequestStore(state => state.setRequestImages);
36
- const query = useRequestStore(state => state.query);
37
35
  const regions = useRequestStore(state => state.regions);
38
36
  const updateRegion = useRequestStore(state => state.updateRegion);
39
37
  const resetRequestStore = useRequestStore(state => state.reset);
@@ -50,11 +48,6 @@ function ImagePreviewComponent({
50
48
 
51
49
  const previewWrapperRef = useRef<any>(null);
52
50
 
53
- const filteredRegions = useFilteredRegions(
54
- detectedRegions[currentIndex],
55
- regions[currentIndex],
56
- );
57
-
58
51
  const onImageRemove = () => {
59
52
  resetRegions();
60
53
  setRequestImages([]);
@@ -67,6 +60,8 @@ function ImagePreviewComponent({
67
60
  // eslint-disable-next-line react-hooks/exhaustive-deps
68
61
  const findItemsInSelection = useCallback(
69
62
  debounce(async (r: RectCoords, image: HTMLCanvasElement) => {
63
+ updateRegion(r, 0);
64
+
70
65
  singleImageSearch({
71
66
  image: image,
72
67
  settings,
@@ -94,7 +89,6 @@ function ImagePreviewComponent({
94
89
  // eslint-disable-next-line react-hooks/exhaustive-deps
95
90
  const debouncedOnImageSelectionChange = useCallback(
96
91
  debounce((r: RectCoords, index?: number) => {
97
- updateRegion(r, 0);
98
92
  findItemsInSelection(r, requestImages[0]);
99
93
  }, 0),
100
94
  [findItemsInSelection, requestImages, updateRegion],
@@ -137,7 +131,7 @@ function ImagePreviewComponent({
137
131
  }}
138
132
  image={requestImages[currentIndex]}
139
133
  selection={regions[currentIndex] || DEFAULT_REGION}
140
- regions={filteredRegions || []}
134
+ regions={detectedRegions[currentIndex] || []}
141
135
  dotColor={'#FBD914'}
142
136
  minCropWidth={30}
143
137
  minCropHeight={30}
@@ -213,7 +207,7 @@ function ImagePreviewComponent({
213
207
  }}
214
208
  image={requestImages[currentIndex]}
215
209
  selection={regions[currentIndex] || DEFAULT_REGION}
216
- regions={[]}
210
+ regions={detectedRegions[currentIndex] || []}
217
211
  minWidth={Math.min(
218
212
  80 *
219
213
  (requestImages[currentIndex]?.width /
@@ -71,15 +71,11 @@ function ProductList({ sendFeedBackAction }: Props): JSX.Element {
71
71
  sendFeedBackAction(value);
72
72
  }}
73
73
  isGroupItem={settings.showGroup ? product?.isGroup : false}
74
- main_image_link={(() => {
75
- if (query || items.length !== 0) {
76
- return product['image(main_similarity)']
77
- ? product['image(main_similarity)']
78
- : product['main_image_link'];
79
- } else {
80
- return productsFromFindApi[i]?.image;
81
- }
82
- })()}
74
+ main_image_link={
75
+ product['image(main_similarity)']
76
+ ? product['image(main_similarity)']
77
+ : product['main_image_link']
78
+ }
83
79
  />
84
80
  );
85
81
  })}