@nyris/nyris-webapp 0.3.30 → 0.3.32

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 (28) hide show
  1. package/build/asset-manifest.json +13 -13
  2. package/build/index.html +1 -1
  3. package/build/{precache-manifest.1bafefb0503a5f6e261392890797084b.js → precache-manifest.a2c0b5a7cde6667444733c63d9fcb7d5.js} +12 -12
  4. package/build/service-worker.js +1 -1
  5. package/build/static/css/main.d0b21fa5.chunk.css +2 -0
  6. package/build/static/css/main.d0b21fa5.chunk.css.map +1 -0
  7. package/build/static/js/2.985a6e2d.chunk.js +3 -0
  8. package/build/static/js/2.985a6e2d.chunk.js.map +1 -0
  9. package/build/static/js/main.1e8d5e32.chunk.js +3 -0
  10. package/build/static/js/main.1e8d5e32.chunk.js.map +1 -0
  11. package/build/static/media/info-tooltip.5feeef22.svg +3 -0
  12. package/package.json +5 -4
  13. package/src/common/assets/icons/info-tooltip.svg +2 -2
  14. package/src/components/DragDropFile.tsx +66 -46
  15. package/src/components/appMobile.scss +12 -6
  16. package/src/components/input/inputSearch.tsx +67 -48
  17. package/src/components/results/ItemResult.tsx +1 -1
  18. package/src/page/landingPage/common.scss +7 -2
  19. package/src/page/result/index.tsx +51 -19
  20. package/build/static/css/main.30e70922.chunk.css +0 -2
  21. package/build/static/css/main.30e70922.chunk.css.map +0 -1
  22. package/build/static/js/2.5ae21a8b.chunk.js +0 -3
  23. package/build/static/js/2.5ae21a8b.chunk.js.map +0 -1
  24. package/build/static/js/main.2e801006.chunk.js +0 -3
  25. package/build/static/js/main.2e801006.chunk.js.map +0 -1
  26. package/build/static/media/info-tooltip.19eb6e6a.svg +0 -3
  27. /package/build/static/js/{2.5ae21a8b.chunk.js.LICENSE.txt → 2.985a6e2d.chunk.js.LICENSE.txt} +0 -0
  28. /package/build/static/js/{main.2e801006.chunk.js.LICENSE.txt → main.1e8d5e32.chunk.js.LICENSE.txt} +0 -0
@@ -0,0 +1,3 @@
1
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M2.66658 10.9888C3.65328 11.6481 4.81331 12 6 12C7.5913 12 9.11742 11.3679 10.2426 10.2426C11.3679 9.11742 12 7.5913 12 6C12 4.81331 11.6481 3.65328 10.9888 2.66658C10.3295 1.67989 9.39246 0.910851 8.2961 0.456725C7.19975 0.0025997 5.99335 -0.11622 4.82946 0.115291C3.66557 0.346802 2.59648 0.918247 1.75736 1.75736C0.918247 2.59648 0.346802 3.66557 0.115291 4.82946C-0.11622 5.99335 0.0025997 7.19975 0.456725 8.2961C0.910851 9.39246 1.67989 10.3295 2.66658 10.9888ZM3.14278 1.72387C3.98852 1.15877 4.98284 0.857145 6 0.857145C7.36397 0.857145 8.67208 1.39898 9.63655 2.36345C10.601 3.32793 11.1429 4.63603 11.1429 6C11.1429 7.01716 10.8412 8.01148 10.2761 8.85722C9.71103 9.70296 8.90782 10.3621 7.96809 10.7514C7.02835 11.1406 5.9943 11.2425 4.99668 11.044C3.99906 10.8456 3.08269 10.3558 2.36345 9.63655C1.64421 8.91731 1.1544 8.00094 0.955964 7.00332C0.757526 6.00571 0.859372 4.97165 1.24862 4.03192C1.63787 3.09218 2.29705 2.28898 3.14278 1.72387ZM6 2.57143C5.87285 2.57143 5.74857 2.60913 5.64285 2.67977C5.53713 2.75041 5.45473 2.85081 5.40608 2.96827C5.35742 3.08574 5.34469 3.215 5.36949 3.3397C5.3943 3.4644 5.45553 3.57895 5.54543 3.66885C5.63534 3.75876 5.74988 3.81999 5.87458 3.84479C5.99929 3.8696 6.12854 3.85686 6.24601 3.80821C6.36348 3.75955 6.46388 3.67715 6.53452 3.57144C6.60515 3.46572 6.64286 3.34143 6.64286 3.21429C6.64286 3.04379 6.57513 2.88028 6.45457 2.75972C6.33401 2.63916 6.1705 2.57143 6 2.57143ZM6.42857 8.57143V5.14286H4.71428V6H5.57143V8.57143H4.28571V9.42857H7.71428V8.57143H6.42857Z" fill="white"/>
3
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyris/nyris-webapp",
3
- "version": "0.3.30",
3
+ "version": "0.3.32",
4
4
  "homepage": "./",
5
5
  "dependencies": {
6
6
  "@algolia/autocomplete-js": "^1.7.1",
@@ -12,8 +12,8 @@
12
12
  "@material-ui/data-grid": "^4.0.0-alpha.37",
13
13
  "@material-ui/icons": "^4.4.1",
14
14
  "@material-ui/lab": "^4.0.0-alpha.60",
15
- "@nyris/nyris-api": "^0.3.30",
16
- "@nyris/nyris-react-components": "^0.3.30",
15
+ "@nyris/nyris-api": "^0.3.32",
16
+ "@nyris/nyris-react-components": "^0.3.32",
17
17
  "@reduxjs/toolkit": "^1.6.1",
18
18
  "@splidejs/react-splide": "^0.7.12",
19
19
  "@types/blueimp-load-image": "^2.23.4",
@@ -30,6 +30,7 @@
30
30
  "blueimp-load-image": "^2.24.0",
31
31
  "classnames": "^2.2.6",
32
32
  "framer-motion": "^4.1.17",
33
+ "heic2any": "0.0.4",
33
34
  "history": "^4.10.1",
34
35
  "i18next": "^22.4.14",
35
36
  "jotai": "^1.4.7",
@@ -40,7 +41,7 @@
40
41
  "qs": "^6.10.3",
41
42
  "react": "^17.0.0",
42
43
  "react-dom": "^16.13.1",
43
- "react-dropzone": "^10.1.8",
44
+ "react-dropzone": "^14.2.3",
44
45
  "react-hook-form": "^7.27.1",
45
46
  "react-hot-toast": "^2.4.0",
46
47
  "react-i18next": "^12.2.0",
@@ -1,3 +1,3 @@
1
- <svg width="13" height="12" viewBox="0 0 13 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M3.16658 10.9888C4.15328 11.6481 5.31331 12 6.5 12C8.0913 12 9.61742 11.3679 10.7426 10.2426C11.8679 9.11742 12.5 7.5913 12.5 6C12.5 4.81331 12.1481 3.65328 11.4888 2.66658C10.8295 1.67989 9.89246 0.910851 8.7961 0.456725C7.69975 0.0025997 6.49335 -0.11622 5.32946 0.115291C4.16557 0.346802 3.09648 0.918247 2.25736 1.75736C1.41825 2.59648 0.846802 3.66557 0.615291 4.82946C0.38378 5.99335 0.5026 7.19975 0.956725 8.2961C1.41085 9.39246 2.17989 10.3295 3.16658 10.9888ZM3.64278 1.72387C4.48852 1.15877 5.48284 0.857145 6.5 0.857145C7.86397 0.857145 9.17208 1.39898 10.1366 2.36345C11.101 3.32793 11.6429 4.63603 11.6429 6C11.6429 7.01716 11.3412 8.01148 10.7761 8.85722C10.211 9.70296 9.40782 10.3621 8.46809 10.7514C7.52835 11.1406 6.4943 11.2425 5.49668 11.044C4.49906 10.8456 3.58269 10.3558 2.86345 9.63655C2.14421 8.91731 1.6544 8.00094 1.45596 7.00332C1.25753 6.00571 1.35937 4.97165 1.74862 4.03192C2.13787 3.09218 2.79705 2.28898 3.64278 1.72387ZM6.5 2.57143C6.37285 2.57143 6.24857 2.60913 6.14285 2.67977C6.03713 2.75041 5.95473 2.85081 5.90608 2.96827C5.85742 3.08574 5.84469 3.215 5.86949 3.3397C5.8943 3.4644 5.95553 3.57895 6.04543 3.66885C6.13534 3.75876 6.24988 3.81999 6.37458 3.84479C6.49929 3.8696 6.62854 3.85686 6.74601 3.80821C6.86348 3.75955 6.96388 3.67715 7.03452 3.57144C7.10515 3.46572 7.14286 3.34143 7.14286 3.21429C7.14286 3.04379 7.07513 2.88028 6.95457 2.75972C6.83401 2.63916 6.6705 2.57143 6.5 2.57143ZM6.92857 8.57143V5.14286H5.21428V6H6.07143V8.57143H4.78571V9.42857H8.21428V8.57143H6.92857Z" fill="white"/>
1
+ <svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M2.66658 10.9888C3.65328 11.6481 4.81331 12 6 12C7.5913 12 9.11742 11.3679 10.2426 10.2426C11.3679 9.11742 12 7.5913 12 6C12 4.81331 11.6481 3.65328 10.9888 2.66658C10.3295 1.67989 9.39246 0.910851 8.2961 0.456725C7.19975 0.0025997 5.99335 -0.11622 4.82946 0.115291C3.66557 0.346802 2.59648 0.918247 1.75736 1.75736C0.918247 2.59648 0.346802 3.66557 0.115291 4.82946C-0.11622 5.99335 0.0025997 7.19975 0.456725 8.2961C0.910851 9.39246 1.67989 10.3295 2.66658 10.9888ZM3.14278 1.72387C3.98852 1.15877 4.98284 0.857145 6 0.857145C7.36397 0.857145 8.67208 1.39898 9.63655 2.36345C10.601 3.32793 11.1429 4.63603 11.1429 6C11.1429 7.01716 10.8412 8.01148 10.2761 8.85722C9.71103 9.70296 8.90782 10.3621 7.96809 10.7514C7.02835 11.1406 5.9943 11.2425 4.99668 11.044C3.99906 10.8456 3.08269 10.3558 2.36345 9.63655C1.64421 8.91731 1.1544 8.00094 0.955964 7.00332C0.757526 6.00571 0.859372 4.97165 1.24862 4.03192C1.63787 3.09218 2.29705 2.28898 3.14278 1.72387ZM6 2.57143C5.87285 2.57143 5.74857 2.60913 5.64285 2.67977C5.53713 2.75041 5.45473 2.85081 5.40608 2.96827C5.35742 3.08574 5.34469 3.215 5.36949 3.3397C5.3943 3.4644 5.45553 3.57895 5.54543 3.66885C5.63534 3.75876 5.74988 3.81999 5.87458 3.84479C5.99929 3.8696 6.12854 3.85686 6.24601 3.80821C6.36348 3.75955 6.46388 3.67715 6.53452 3.57144C6.60515 3.46572 6.64286 3.34143 6.64286 3.21429C6.64286 3.04379 6.57513 2.88028 6.45457 2.75972C6.33401 2.63916 6.1705 2.57143 6 2.57143ZM6.42857 8.57143V5.14286H4.71428V6H5.57143V8.57143H4.28571V9.42857H7.71428V8.57143H6.42857Z" fill="white"/>
3
3
  </svg>
@@ -19,6 +19,7 @@ import { useState } from 'react';
19
19
  import IconUpload from 'common/assets/images/Icon_Upload.svg';
20
20
  import { RectCoords } from '@nyris/nyris-api';
21
21
  import { useTranslation } from 'react-i18next';
22
+ import heic2any from 'heic2any';
22
23
 
23
24
  interface Props {
24
25
  acceptTypes: any;
@@ -37,55 +38,74 @@ function DragDropFile(props: Props) {
37
38
  } = searchState;
38
39
  const [isLoadingLoadFile, setLoadingLoadFile] = useState<any>(false);
39
40
  const { t } = useTranslation();
40
- const { getRootProps, getInputProps, isDragActive } = useDropzone({
41
- onDrop: async (fs: File[]) => {
42
- history.push('/result');
43
- dispatch(updateStatusLoading(true));
44
- dispatch(loadingActionResults());
45
- onChangeLoading(true);
46
- let payload: any;
47
- let filters: any[] = [];
48
- setLoadingLoadFile(true);
49
- console.log('fs', fs);
50
- dispatch(setImageSearchInput(URL.createObjectURL(fs[0])));
51
- let image = await createImage(fs[0]);
52
- dispatch(setRequestImage(image));
53
- const preFilter = [
54
- {
55
- key: settings.visualSearchFilterKey,
56
- values: [`${keyFilter}`],
57
- },
58
- ];
59
- let region: RectCoords | undefined;
60
- if (settings.regions) {
61
- let res = await findRegions(image, settings);
62
- dispatch(setRegions(res.regions));
63
- region = res.selectedRegion;
64
- dispatch(setSelectedRegion(region));
65
- }
41
+ const handleVisualSearch = async (blob: Blob) => {
42
+ history.push('/result');
43
+ dispatch(updateStatusLoading(true));
44
+ dispatch(loadingActionResults());
45
+ onChangeLoading(true);
46
+ let payload: any;
47
+ let filters: any[] = [];
48
+ setLoadingLoadFile(true);
49
+ dispatch(setImageSearchInput(URL.createObjectURL(blob)));
50
+ // @ts-ignore
51
+ let image = await createImage(blob);
66
52
 
67
- return findByImage({
68
- image,
69
- settings,
70
- region,
71
- filters: keyFilter ? preFilter : undefined,
72
- }).then((res: any) => {
73
- res?.results.map((item: any) => {
74
- filters.push({
75
- sku: item.sku,
76
- score: item.score,
77
- });
53
+ dispatch(setRequestImage(image));
54
+ const preFilter = [
55
+ {
56
+ key: settings.visualSearchFilterKey,
57
+ values: [`${keyFilter}`],
58
+ },
59
+ ];
60
+ let region: RectCoords | undefined;
61
+ if (settings.regions) {
62
+ let res = await findRegions(image, settings);
63
+ dispatch(setRegions(res.regions));
64
+ region = res.selectedRegion;
65
+ dispatch(setSelectedRegion(region));
66
+ }
67
+
68
+ return findByImage({
69
+ image,
70
+ settings,
71
+ region,
72
+ filters: keyFilter ? preFilter : undefined,
73
+ }).then((res: any) => {
74
+ res?.results.map((item: any) => {
75
+ filters.push({
76
+ sku: item.sku,
77
+ score: item.score,
78
78
  });
79
- payload = {
80
- ...res,
81
- filters,
82
- };
83
- dispatch(setSearchResults(payload));
84
- setLoadingLoadFile(false);
85
- onChangeLoading(false);
86
- dispatch(updateStatusLoading(false));
87
- return dispatch(showFeedback());
88
79
  });
80
+ payload = {
81
+ ...res,
82
+ filters,
83
+ };
84
+ dispatch(setSearchResults(payload));
85
+ setLoadingLoadFile(false);
86
+ onChangeLoading(false);
87
+ dispatch(updateStatusLoading(false));
88
+ return dispatch(showFeedback());
89
+ });
90
+ };
91
+ const { getRootProps, getInputProps, isDragActive } = useDropzone({
92
+ onDrop: async (fs: File[]) => {
93
+ var file = fs[0];
94
+ if (file.type === 'image/heic') {
95
+ heic2any({
96
+ blob: file as Blob,
97
+ toType: 'image/png',
98
+ quality: 1.0,
99
+ })
100
+ .then(function (resultBlob) {
101
+ handleVisualSearch(resultBlob as Blob);
102
+ })
103
+ .catch(function (error) {
104
+ console.error('Error converting HEIC to PNG:', error);
105
+ });
106
+ } else {
107
+ handleVisualSearch(fs[0]);
108
+ }
89
109
  },
90
110
  });
91
111
 
@@ -176,11 +176,10 @@
176
176
 
177
177
  .box-item-result {
178
178
  height: 100%;
179
- padding: 0 11px;
180
- gap: 8px !important;
179
+ // padding: 0 11px;
180
+ // gap: 8px !important;
181
181
  // justify-content: center;
182
182
  width: calc(180 * 2px + 30px);
183
-
184
183
  .wrap-main-item-result {
185
184
  width: 180px;
186
185
  max-width: 180px !important;
@@ -190,6 +189,13 @@
190
189
  }
191
190
  }
192
191
  }
192
+ @media screen and (max-width: 370px) {
193
+ .box-item-result {
194
+ padding: 0 0px;
195
+ display: flex;
196
+ justify-content: center;
197
+ }
198
+ }
193
199
  }
194
200
  }
195
201
 
@@ -692,13 +698,13 @@
692
698
  }
693
699
  }
694
700
 
695
- @media screen and (max-width: 375px) {
701
+ @media screen and (max-width: 400px) {
696
702
  .box-item-result {
697
703
  height: 100%;
698
704
  // padding: 0 11px;
699
- gap: 8px !important;
705
+ gap: 12px !important;
700
706
  // justify-content: center;
701
- width: calc(180 * 2px + 10px) !important;
707
+ width: calc(180 * 2px) !important;
702
708
 
703
709
  .wrap-main-item-result {
704
710
  width: 170px !important;
@@ -31,6 +31,7 @@ import PreFilterComponent from 'components/pre-filter';
31
31
  import { RectCoords } from '@nyris/nyris-api';
32
32
  import { truncateString } from 'helpers/truncateString';
33
33
  import { useTranslation } from 'react-i18next';
34
+ import heic2any from 'heic2any';
34
35
 
35
36
  const SearchBox = (props: any) => {
36
37
  const { refine, onToggleFilterMobile }: any = props;
@@ -87,58 +88,76 @@ const SearchBox = (props: any) => {
87
88
  }, 500),
88
89
  [],
89
90
  );
91
+ const handleVisualSearch = async (blob: Blob) => {
92
+ dispatch(updateStatusLoading(true));
93
+ dispatch(loadingActionResults());
94
+ if (history.location.pathname !== '/result') {
95
+ history.push('/result');
96
+ }
97
+ let payload: any;
98
+ let filters: any[] = [];
99
+ let region: RectCoords | undefined;
100
+ dispatch(setImageSearchInput(URL.createObjectURL(blob)));
101
+ // @ts-ignore
102
+ let image = await createImage(blob);
103
+ dispatch(setRequestImage(image));
104
+ const preFilter = [
105
+ {
106
+ key: settings.visualSearchFilterKey,
107
+ values: [`${keyFilter}`],
108
+ },
109
+ ];
90
110
 
91
- const { getInputProps } = useDropzone({
92
- onDrop: async (fs: File[]) => {
93
- dispatch(updateStatusLoading(true));
94
- dispatch(loadingActionResults());
95
- if (history.location.pathname !== '/result') {
96
- history.push('/result');
97
- }
98
- let payload: any;
99
- let filters: any[] = [];
100
- let region: RectCoords | undefined;
101
- dispatch(setImageSearchInput(URL.createObjectURL(fs[0])));
102
- let image = await createImage(fs[0]);
103
- dispatch(setRequestImage(image));
104
- const preFilter = [
105
- {
106
- key: settings.visualSearchFilterKey,
107
- values: [`${keyFilter}`],
108
- },
109
- ];
110
-
111
- if (settings.regions) {
112
- let res = await findRegions(image, settings);
113
- dispatch(setRegions(res.regions));
114
- region = res.selectedRegion;
115
- dispatch(setSelectedRegion(region));
116
- }
111
+ if (settings.regions) {
112
+ let res = await findRegions(image, settings);
113
+ dispatch(setRegions(res.regions));
114
+ region = res.selectedRegion;
115
+ dispatch(setSelectedRegion(region));
116
+ }
117
117
 
118
- return findByImage({
119
- image,
120
- settings,
121
- filters: keyFilter ? preFilter : undefined,
122
- region,
123
- })
124
- .then((res: any) => {
125
- res?.results.map((item: any) => {
126
- filters.push({
127
- sku: item.sku,
128
- score: item.score,
129
- });
118
+ return findByImage({
119
+ image,
120
+ settings,
121
+ filters: keyFilter ? preFilter : undefined,
122
+ region,
123
+ })
124
+ .then((res: any) => {
125
+ res?.results.map((item: any) => {
126
+ filters.push({
127
+ sku: item.sku,
128
+ score: item.score,
130
129
  });
131
- payload = {
132
- ...res,
133
- filters,
134
- };
135
- dispatch(setSearchResults(payload));
136
- dispatch(updateStatusLoading(false));
137
- })
138
- .catch((e: any) => {
139
- console.log('error input search', e);
140
- dispatch(updateStatusLoading(false));
141
130
  });
131
+ payload = {
132
+ ...res,
133
+ filters,
134
+ };
135
+ dispatch(setSearchResults(payload));
136
+ dispatch(updateStatusLoading(false));
137
+ })
138
+ .catch((e: any) => {
139
+ console.log('error input search', e);
140
+ dispatch(updateStatusLoading(false));
141
+ });
142
+ };
143
+ const { getInputProps } = useDropzone({
144
+ onDrop: async (fs: File[]) => {
145
+ var file = fs[0];
146
+ if (file.type === 'image/heic') {
147
+ heic2any({
148
+ blob: file as Blob,
149
+ toType: 'image/png',
150
+ quality: 1.0,
151
+ })
152
+ .then(function (resultBlob) {
153
+ handleVisualSearch(resultBlob as Blob);
154
+ })
155
+ .catch(function (error) {
156
+ console.error('Error converting HEIC to PNG:', error);
157
+ });
158
+ } else {
159
+ handleVisualSearch(fs[0]);
160
+ }
142
161
  },
143
162
  });
144
163
 
@@ -299,7 +299,7 @@ function ItemResult(props: Props) {
299
299
  placement="top"
300
300
  arrow={true}
301
301
  disableHoverListener={
302
- dataItem[settings.field.productName].length < 35 ||
302
+ dataItem[settings.field.productName]?.length < 35 ||
303
303
  !settings.warehouseVariant
304
304
  }
305
305
  >
@@ -1025,7 +1025,7 @@ button {
1025
1025
  align-items: center;
1026
1026
  max-width: 320px;
1027
1027
  .box-preview {
1028
- padding: 30px;
1028
+ padding-top: 32px;
1029
1029
  width: 100%;
1030
1030
  // border: 2px dashed #55566b;
1031
1031
  display: flex;
@@ -1034,6 +1034,10 @@ button {
1034
1034
  height: 100%;
1035
1035
  position: relative;
1036
1036
  // transition: ease-in-out 0.5s;
1037
+ @media only screen and (max-width: 776px) {
1038
+ padding-bottom: 32px;
1039
+
1040
+ }
1037
1041
  .preview-item {
1038
1042
  // height: 100%;
1039
1043
  display: flex;
@@ -1072,6 +1076,7 @@ button {
1072
1076
  display: flex;
1073
1077
  flex-wrap: wrap;
1074
1078
  gap: 24px;
1079
+ padding-left: 2px;
1075
1080
  .wrap-main-item-result {
1076
1081
  display: flex;
1077
1082
  flex-direction: column;
@@ -1103,7 +1108,7 @@ button {
1103
1108
  }
1104
1109
 
1105
1110
  .box-notify {
1106
- height: 40px;
1111
+ height: 50px;
1107
1112
  background: #f3f3f5;
1108
1113
  border-top: 1px solid #e9e9ec;
1109
1114
  .select-choose-page {
@@ -77,6 +77,9 @@ function ResultComponent(props: Props) {
77
77
  const [filterString, setFilterString] = useState<string>();
78
78
  const { t } = useTranslation();
79
79
  const [showAdjustInfo, setAdjustInfo] = useState(false);
80
+ const [showAdjustInfoBasedOnConfidence, setShowAdjustInfoBasedOnConfidence] =
81
+ useState(false);
82
+
80
83
  const imageUploadRef = useRef(null);
81
84
 
82
85
  useEffect(() => {
@@ -89,7 +92,7 @@ function ResultComponent(props: Props) {
89
92
  setAdjustInfo(true);
90
93
  const timeout = setTimeout(() => {
91
94
  setAdjustInfo(false);
92
- }, 5000);
95
+ }, 4000);
93
96
  imageUploadRef.current = imageThumbSearchInput;
94
97
  return () => {
95
98
  clearTimeout(timeout);
@@ -150,6 +153,15 @@ function ResultComponent(props: Props) {
150
153
  const { canvas }: any = requestImage;
151
154
  findImageByApiNyris(canvas, r).then((res: any) => {
152
155
  dispatch(updateResultChangePosition(res));
156
+ const highConfidence = res.results.find(
157
+ (data: { score: number }) => data.score >= 0.65,
158
+ );
159
+ if (!highConfidence) {
160
+ setShowAdjustInfoBasedOnConfidence(true);
161
+ }
162
+ setTimeout(() => {
163
+ setShowAdjustInfoBasedOnConfidence(false);
164
+ }, 4000);
153
165
  });
154
166
  return dispatch(showFeedback());
155
167
  }, 250),
@@ -376,21 +388,31 @@ function ResultComponent(props: Props) {
376
388
  />
377
389
  </Box>
378
390
  </Box>
379
- {showAdjustInfo && (
391
+ {(showAdjustInfoBasedOnConfidence ||
392
+ showAdjustInfo) && (
380
393
  <Box
381
394
  className="box-title_col-left"
382
- display="flex"
383
395
  alignItems="center"
384
- style={{ backgroundColor: '#3E36DC' }}
396
+ style={{
397
+ backgroundColor: '#3E36DC',
398
+ display: 'flex',
399
+ columnGap: '6px',
400
+ padding: '5px',
401
+ }}
385
402
  >
386
- <IconInfo style={{ marginRight: 2 }} />
403
+ <IconInfo />
387
404
  <Typography
388
- style={{ fontSize: 9, color: '#fff' }}
405
+ style={{
406
+ fontSize: 10,
407
+ color: '#fff',
408
+ width: '280px',
409
+ }}
389
410
  >
390
- {t(
391
- 'Adjust the search frame around your object for improved results',
392
- )}
393
- .
411
+ {showAdjustInfo
412
+ ? t(
413
+ 'Adjust the search frame around your object for improved results',
414
+ )
415
+ : 'Use the cropping tool for improved image accuracy and enhanced results'}
394
416
  </Typography>
395
417
  </Box>
396
418
  )}
@@ -451,22 +473,32 @@ function ResultComponent(props: Props) {
451
473
  dotColor={'#FBD914'}
452
474
  />
453
475
  </Box>
454
- {showAdjustInfo && (
476
+ {(showAdjustInfoBasedOnConfidence ||
477
+ showAdjustInfo) && (
455
478
  <Box
456
479
  className="box-title_col-left"
457
- display="flex"
458
480
  alignItems="center"
459
481
  style={{
460
482
  backgroundColor: '#3E36DC',
461
- marginBottom: '35px',
483
+ marginBottom: '25px',
484
+ display: 'flex',
485
+ columnGap: '6px',
486
+ padding: '5px',
462
487
  }}
463
488
  >
464
- <IconInfo style={{ marginRight: 2 }} />
465
- <Typography style={{ fontSize: 9, color: '#fff' }}>
466
- {t(
467
- 'Adjust the search frame around your object for improved results',
468
- )}
469
- .
489
+ <IconInfo />
490
+ <Typography
491
+ style={{
492
+ fontSize: 10,
493
+ color: '#fff',
494
+ width: '300px',
495
+ }}
496
+ >
497
+ {showAdjustInfo
498
+ ? t(
499
+ 'Adjust the search frame around your object for improved results',
500
+ )
501
+ : 'Use the cropping tool for improved image accuracy and enhanced results'}
470
502
  </Typography>
471
503
  </Box>
472
504
  )}