@nyris/nyris-webapp 0.3.70 → 0.3.71

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,14 +1,14 @@
1
1
  {
2
2
  "name": "@nyris/nyris-webapp",
3
- "version": "0.3.70",
3
+ "version": "0.3.71",
4
4
  "dependencies": {
5
5
  "@auth0/auth0-react": "^2.2.4",
6
6
  "@emailjs/browser": "^4.3.3",
7
7
  "@material-ui/core": "^4.12.4",
8
8
  "@material-ui/icons": "^4.11.3",
9
9
  "@material-ui/lab": "^4.0.0-alpha.61",
10
- "@nyris/nyris-api": "^0.3.70",
11
- "@nyris/nyris-react-components": "^0.3.70",
10
+ "@nyris/nyris-api": "^0.3.71",
11
+ "@nyris/nyris-react-components": "^0.3.71",
12
12
  "@reduxjs/toolkit": "^2.2.1",
13
13
  "@splidejs/react-splide": "^0.7.12",
14
14
  "@testing-library/jest-dom": "^5.17.0",
@@ -97,6 +97,7 @@ var settings = {
97
97
  emailTemplateId: '',
98
98
  supportNumber: '',
99
99
  description: '',
100
+ prefilterFieldName: '',
100
101
  },
101
102
  cadenas: {
102
103
  catalog: '',
@@ -11,6 +11,7 @@ import {
11
11
  import { useImageSearch } from 'hooks/useImageSearch';
12
12
  import { useHistory } from 'react-router-dom';
13
13
  import { Icon } from '@nyris/nyris-react-components';
14
+ import { useTranslation } from 'react-i18next';
14
15
 
15
16
  function ExperienceVisualSearch({
16
17
  experienceVisualSearchBlobs,
@@ -26,28 +27,26 @@ function ExperienceVisualSearch({
26
27
 
27
28
  const { singleImageSearch } = useImageSearch();
28
29
 
30
+ const { t } = useTranslation();
31
+
32
+ const [expand, setExpand] = useState(false);
33
+
29
34
  useEffect(() => {
35
+ let intervalId: any;
30
36
  if (document.body.getBoundingClientRect().width >= 776) {
31
37
  if (!showModal) {
32
- interval.current = setInterval(() => {
33
- if (button?.current) {
34
- (button.current as HTMLElement).classList.toggle('hover');
35
- }
38
+ intervalId = setInterval(() => {
39
+ setExpand(s => !s);
36
40
  }, 3000);
37
41
  } else if (interval?.current) {
38
42
  clearInterval(interval?.current);
39
- if (
40
- button?.current &&
41
- !(button.current as HTMLElement).classList.contains('hover')
42
- ) {
43
- (button.current as HTMLElement).classList.toggle('hover');
44
- }
43
+ setExpand(false);
45
44
  }
46
45
  return () => {
47
- if (interval?.current) {
48
- clearInterval(interval?.current);
49
- }
46
+ clearInterval(intervalId);
50
47
  };
48
+ } else {
49
+ setExpand(true);
51
50
  }
52
51
  }, [showModal]);
53
52
 
@@ -72,13 +71,25 @@ function ExperienceVisualSearch({
72
71
 
73
72
  return (
74
73
  <>
75
- <div
76
- ref={button}
77
- className="experience-visual-button"
78
- onClick={() => modalToggle(true)}
79
- >
80
- <span />
81
- <ExperienceIcon />
74
+ <div className="flex flex-col items-center">
75
+ <div
76
+ ref={button}
77
+ className={`group bg-[#3E36DC] w-[215px] desktop:w-10 hover:w-[215px] hover:gap-2 ${
78
+ expand ? 'desktop:w-[215px] gap-2' : ''
79
+ } h-10 flex flex-row justify-center items-center rounded-full cursor-pointer my-8 transition-all duration-300`}
80
+ onClick={() => modalToggle(true)}
81
+ >
82
+ <span
83
+ className={`${
84
+ expand ? 'flex-grow max-w-fit' : 'flex-grow-0 w-0'
85
+ } group-hover:flex-grow group-hover:max-w-fit overflow-hidden whitespace-nowrap text-sm font-semibold leading-4 text-center text-white break-keep transition-all duration-300`}
86
+ >
87
+ {t('Experience Visual Search')}
88
+ </span>
89
+ <div className="flex flex-grow-0">
90
+ <ExperienceIcon className="" />
91
+ </div>
92
+ </div>
82
93
  </div>
83
94
  {showModal &&
84
95
  createPortal(
@@ -104,10 +115,10 @@ function ExperienceVisualSearch({
104
115
  }}
105
116
  />
106
117
  <div className="custom-modal-body-title">
107
- Experience Visual Search
118
+ {t('Experience Visual Search')}
108
119
  </div>
109
120
  <div className="custom-modal-body-subtitle">
110
- Start your visual search by selecting an image below.
121
+ {t('Start your visual search by selecting an image below.')}
111
122
  </div>
112
123
  <div className="custom-modal-body-content experience-visual-search-images">
113
124
  {new Array(4).fill(1).map((val, index) => {
@@ -1,5 +1,6 @@
1
1
  import { Icon } from '@nyris/nyris-react-components';
2
2
  import { useState } from 'react';
3
+ import { useTranslation } from 'react-i18next';
3
4
 
4
5
  function Feedback({
5
6
  submitFeedback,
@@ -10,6 +11,8 @@ function Feedback({
10
11
  }) {
11
12
  const [isHovered, setIsHovered] = useState(false);
12
13
 
14
+ const { t } = useTranslation();
15
+
13
16
  return (
14
17
  <div
15
18
  className={`feedback-wrapper`}
@@ -18,7 +21,7 @@ function Feedback({
18
21
  transition: 'background-color 0.3s ease',
19
22
  }}
20
23
  >
21
- <p className="desktop:w-[146px]">Are these results useful?</p>
24
+ <p className="desktop:w-[146px]">{t('Are these results useful?')}</p>
22
25
  <div
23
26
  className="feedback-icon-wrapper"
24
27
  onClick={() => submitFeedback(false)}
@@ -294,6 +294,7 @@ function ImagePreviewComponent({
294
294
  borderRadius: '16px',
295
295
  zIndex: 1000,
296
296
  height: 'fit-content',
297
+ alignItems: 'center',
297
298
  }}
298
299
  >
299
300
  <Icon name="info" color="white" width={12} height={12} />
@@ -306,7 +307,7 @@ function ImagePreviewComponent({
306
307
  >
307
308
  {showAdjustInfo
308
309
  ? t('Crop the image for better results')
309
- : 'Crop the image for better results'}
310
+ : t('Adjust the selection frame for better results')}
310
311
  </p>
311
312
  </div>
312
313
  )}
@@ -396,7 +397,7 @@ function ImagePreviewComponent({
396
397
  >
397
398
  {showAdjustInfo
398
399
  ? t('Crop the image for better results')
399
- : 'Crop the image for better results'}
400
+ : t('Adjust the selection frame for better results')}
400
401
  </p>
401
402
  </div>
402
403
  )}
@@ -155,7 +155,7 @@ function InquiryBanner({
155
155
  justifyContent: 'space-between',
156
156
  }}
157
157
  >
158
- <p>Inquiry</p>
158
+ <p>{t('Inquiry')}</p>
159
159
  <Icon name="email" color="#fff" width={16} height={12} />
160
160
  </div>
161
161
  </div>
@@ -190,7 +190,7 @@ function InquiryBanner({
190
190
  justifyContent: 'space-between',
191
191
  }}
192
192
  >
193
- <p> Call us</p>
193
+ <p> {t('Call us')}</p>
194
194
  <Icon name="call" color="#fff" width={16} height={16} />
195
195
  </div>
196
196
  </a>
@@ -11,6 +11,7 @@ import toast from 'react-hot-toast';
11
11
  import { useAppSelector } from 'Store/Store';
12
12
  import { useMediaQuery } from 'react-responsive';
13
13
  import { Icon } from '@nyris/nyris-react-components';
14
+ import { useTranslation } from 'react-i18next';
14
15
  interface Props {
15
16
  requestImage: any;
16
17
  selectedRegion: any;
@@ -60,6 +61,7 @@ export default function InquiryModal({
60
61
  },
61
62
  [setInformation],
62
63
  );
64
+ const { t } = useTranslation();
63
65
 
64
66
  useEffect(() => emailjs.init('SMGihPnuEGcYLm0V4'), []);
65
67
  useEffect(() => {
@@ -173,8 +175,8 @@ export default function InquiryModal({
173
175
  }}
174
176
  >
175
177
  {requestImage
176
- ? 'Submit your image for inquiry'
177
- : 'Submit your inquiry'}
178
+ ? t('Submit your image for inquiry')
179
+ : t('Submit your inquiry')}
178
180
  </p>
179
181
  <div
180
182
  onClick={() => setIsInquiryModalOpen(false)}
@@ -223,7 +225,7 @@ export default function InquiryModal({
223
225
  marginBottom: '8px',
224
226
  }}
225
227
  >
226
- Your email (required)
228
+ {t('Your email (required)')}
227
229
  </p>
228
230
  <input
229
231
  value={email}
@@ -239,7 +241,7 @@ export default function InquiryModal({
239
241
  />
240
242
  {!emailValid && !isUndefined(emailValid) && (
241
243
  <p style={{ color: 'red', fontSize: '12px', paddingTop: '8px' }}>
242
- Please enter a valid email.
244
+ {t('Please enter a valid email.')}
243
245
  </p>
244
246
  )}
245
247
  </div>
@@ -259,21 +261,23 @@ export default function InquiryModal({
259
261
  color: '#2B2C46',
260
262
  }}
261
263
  >
262
- Machine
264
+ {settings.support.prefilterFieldName}
263
265
  </p>
264
266
  <Tooltip
265
267
  title={
266
- 'Please select a pre-filter before search request to refine and yield accurate results.'
268
+ t('Please select a search criteria before search request to refine and yield accurate results.')
267
269
  }
268
270
  placement="top"
269
271
  arrow={true}
270
272
  >
271
- <Icon
272
- name="info"
273
- style={{ cursor: 'pointer' }}
274
- width={12}
275
- height={12}
276
- />
273
+ <div>
274
+ <Icon
275
+ name="info"
276
+ style={{ cursor: 'pointer' }}
277
+ width={12}
278
+ height={12}
279
+ />
280
+ </div>
277
281
  </Tooltip>
278
282
  </div>
279
283
 
@@ -288,7 +292,7 @@ export default function InquiryModal({
288
292
  backgroundColor: '#fff',
289
293
  }}
290
294
  >
291
- {preFilterValues.join(', ') || 'Pre-filter is not selected'}
295
+ {preFilterValues.join(', ') || t('Search criteria is not selected')}
292
296
  </div>
293
297
  </div>
294
298
  )}
@@ -303,7 +307,7 @@ export default function InquiryModal({
303
307
  color: '#2B2C46',
304
308
  }}
305
309
  >
306
- <p>Additional information</p>
310
+ <p>{t('Additional information')}</p>
307
311
  <p>{`${information.length}/150`}</p>
308
312
  </div>
309
313
  <TextareaAutosize
@@ -337,7 +341,7 @@ export default function InquiryModal({
337
341
  }}
338
342
  onClick={() => setIsInquiryModalOpen(false)}
339
343
  >
340
- Cancel
344
+ {t('Cancel')}
341
345
  </button>
342
346
  <button
343
347
  style={{
@@ -357,7 +361,7 @@ export default function InquiryModal({
357
361
  disabled={!emailValid}
358
362
  onClick={handleInquiry}
359
363
  >
360
- Send
364
+ {t('Send')}
361
365
  </button>
362
366
  </div>
363
367
  </div>
@@ -2,6 +2,7 @@ import React, { useState } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
 
4
4
  import { Icon, makeFileHandler } from '@nyris/nyris-react-components';
5
+ import { useTranslation } from 'react-i18next';
5
6
 
6
7
  function UploadDisclaimer({
7
8
  onClose,
@@ -13,7 +14,7 @@ function UploadDisclaimer({
13
14
  isMobile: boolean;
14
15
  }) {
15
16
  const [dontShowAgain, setDontShowAgain] = useState(false);
16
-
17
+ const { t } = useTranslation();
17
18
  return (
18
19
  <>
19
20
  {createPortal(
@@ -21,7 +22,9 @@ function UploadDisclaimer({
21
22
  <div className="bg-white w-80">
22
23
  <div className="p-4">
23
24
  <div className="flex justify-between items-center">
24
- <div className="font-bold text-xl">Replace Current Data?</div>
25
+ <div className="font-bold text-xl">
26
+ {t('Replace Current Data?')}
27
+ </div>
25
28
  <Icon
26
29
  name="close"
27
30
  className="cursor-pointer"
@@ -31,8 +34,9 @@ function UploadDisclaimer({
31
34
  />
32
35
  </div>
33
36
  <p className="text-sm mt-4">
34
- Uploading a new image will overwrite your current search
35
- parameters, text, and results. Are you sure you want to proceed?
37
+ {t(
38
+ `Uploading a new image will overwrite your current search parameters, text, and results. Are you sure you want to proceed?`,
39
+ )}
36
40
  </p>
37
41
  <div className="mt-4 gap-x-2 flex">
38
42
  <input
@@ -42,7 +46,7 @@ function UploadDisclaimer({
42
46
  setDontShowAgain(e.target.checked);
43
47
  }}
44
48
  />
45
- Don't show this again
49
+ {t(`Don't show this again`)}
46
50
  </div>
47
51
  </div>
48
52
  <div className="flex">
@@ -50,7 +54,7 @@ function UploadDisclaimer({
50
54
  className="w-1/2 h-16 p-4 text-start text-sm text-white bg-[#2B2C46]"
51
55
  onClick={() => onClose()}
52
56
  >
53
- Cancel
57
+ {t(`Cancel`)}
54
58
  </button>
55
59
  <label
56
60
  className="w-1/2 h-16 p-4 text-start text-sm text-white bg-[#E31B5D] cursor-pointer"
@@ -61,7 +65,7 @@ function UploadDisclaimer({
61
65
  }
62
66
  }}
63
67
  >
64
- Continue
68
+ {t(`Continue`)}
65
69
  </label>
66
70
  <input
67
71
  type="file"
@@ -1,6 +1,7 @@
1
1
  import React from 'react';
2
2
  import { getCroppedCanvas } from 'helpers/getCroppedCanvas';
3
3
  import { useMediaQuery } from 'react-responsive';
4
+ import { useTranslation } from 'react-i18next';
4
5
 
5
6
  function RfqBanner({
6
7
  requestImage,
@@ -16,7 +17,7 @@ function RfqBanner({
16
17
  selectedRegion: any;
17
18
  }) {
18
19
  const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
19
-
20
+ const { t } = useTranslation();
20
21
  return (
21
22
  <div
22
23
  style={{
@@ -66,8 +67,8 @@ function RfqBanner({
66
67
  }}
67
68
  >
68
69
  {isMobile
69
- ? 'No matches found?'
70
- : 'No matches found for your request?'}
70
+ ? `${t('No matches found')}?`
71
+ : `${t('No matches found for your request')}?`}
71
72
  </div>
72
73
  <div
73
74
  style={{
@@ -78,7 +79,7 @@ function RfqBanner({
78
79
  fontWeight: 'normal',
79
80
  }}
80
81
  >
81
- Get personalised help from our team of product experts.
82
+ {t('Get personalised help from our team of product experts.')}
82
83
  </div>
83
84
  </div>
84
85
  <button
@@ -400,7 +400,7 @@ function ResultComponent(props: Props) {
400
400
  <div className={'feedback-floating'}>
401
401
  <div className="feedback-section">
402
402
  <div className="feedback-success">
403
- Thanks for your feedback!
403
+ {t('Thank you for your feedback')}
404
404
  </div>
405
405
  </div>
406
406
  </div>
@@ -32,6 +32,33 @@ export const translations = {
32
32
  Cancel: 'Cancel',
33
33
  Apply: 'Apply',
34
34
  'Back to request image': 'Back to request image',
35
+ 'Please select a search criteria before search request to refine and yield accurate results.':
36
+ 'Please select a search criteria before search request to refine and yield accurate results.',
37
+ 'Search criteria is not selected':
38
+ 'Search criteria is not selected',
39
+ Inquiry: 'Inquiry',
40
+ 'Call us': 'Call us',
41
+ 'Submit your inquiry': 'Submit your inquiry',
42
+ 'Submit your image for inquiry': 'Submit your image for inquiry',
43
+ 'Your email (required)': 'Your email (required)',
44
+ 'Please enter a valid email.': 'Please enter a valid email.',
45
+ 'Additional information': 'Additional information',
46
+ Send: 'Send',
47
+ 'Experience Visual Search': 'Experience Visual Search',
48
+ 'Start your visual search by selecting an image below.':
49
+ 'Start your visual search by selecting an image below.',
50
+ 'Are these results useful?': 'Are these results useful?',
51
+ 'Thank you for your feedback': 'Thank you for your feedback',
52
+ 'Select a Filter': 'Select a Filter',
53
+ 'Get personalised help from our team of product experts.':
54
+ 'Get personalised help from our team of product experts.',
55
+ 'Adjust the selection frame for better results':
56
+ 'Adjust the selection frame for better results',
57
+ 'Replace Current Data?': 'Replace Current Data?',
58
+ 'Uploading a new image will overwrite your current search parameters, text, and results. Are you sure you want to proceed?':
59
+ 'Uploading a new image will overwrite your current search parameters, text, and results. Are you sure you want to proceed?',
60
+ "Don't show this again": "Don't show this again",
61
+ Continue: 'Continue',
35
62
  },
36
63
  },
37
64
  de: {
@@ -49,11 +76,11 @@ export const translations = {
49
76
  'Items per page': 'Artikel pro Seite',
50
77
  'Search with an image': 'Bildsuche',
51
78
  'Clear text search': 'Suchtext löschen',
52
- 'View details': 'Details anzeigen',
79
+ 'View details': 'Anzeige der Details',
53
80
  'Clear image search': 'Bildsuche zurück setzen',
54
81
  'Add or change pre-filter': 'Vorfilter hinzufügen oder ändern',
55
82
  'Expand all': 'Alles anzeigen',
56
- 'Collapse all': 'Alles einklappen',
83
+ 'Collapse all': 'Alle ausblenden',
57
84
  Brand: 'Marke',
58
85
  'Product name': 'Produktname',
59
86
  loading: 'Lädt',
@@ -61,13 +88,40 @@ export const translations = {
61
88
  'Keine Produkte entsprechen Ihren Suchkriterien.',
62
89
  'Please upload an image or enter a keyword to search.':
63
90
  'Für die Suche bitte Bild hochladen oder Stichwort eingeben.',
64
- 'No matches found': 'Keine Treffer für Ihre Anfrage gefunden',
65
91
  'No matches found for your request':
66
92
  'Keine Treffer für Ihre Anfrage gefunden',
67
93
  'Clear all': 'Alles löschen',
68
94
  Cancel: 'Abbrechen',
69
95
  Apply: 'Anwenden',
70
96
  'Back to request image': 'Zurück zur Bildanfrage',
97
+ 'Please select a search criteria before search request to refine and yield accurate results.':
98
+ 'Bitte wählen Sie vor der Suchanfrage ein Suchkriterium aus, um die Suche zu verfeinern und genaue Ergebnisse zu erhalten.',
99
+ 'Search criteria is not selected':
100
+ 'Suchkriterien sind nicht ausgewählt',
101
+ Inquiry: 'Anfrage',
102
+ 'Call us': 'Rufen Sie uns an',
103
+ 'Submit your inquiry': 'Senden Sie Ihre Anfrage',
104
+ 'Submit your image for inquiry': 'Senden Sie Ihr Bild für eine Anfrage',
105
+ 'Your email (required)': 'Ihre E-Mail (erforderlich)',
106
+ 'Please enter a valid email.': 'Bitte geben Sie eine gültige E-Mailadresse an',
107
+ 'Additional information': 'Zusätzliche Informationen',
108
+ Send: 'Senden',
109
+ 'Experience Visual Search': 'Erleben Sie die visuelle Suche',
110
+ 'Start your visual search by selecting an image below.':
111
+ 'Beginnen Sie Ihre visuelle Suche und wählen eines der Bilder aus.',
112
+ 'Are these results useful?': 'Sind diese Ergebnisse nützlich?',
113
+ 'Thank you for your feedback': 'Vielen Dank für Ihr Feedback',
114
+ 'Select a Filter': 'Filter wählen',
115
+ 'Get personalised help from our team of product experts.':
116
+ 'Holen Sie sich persönliche Hilfe von unserem Team von Produktexperten.',
117
+ 'No matches found': 'Keine Treffer gefunden',
118
+ 'Adjust the selection frame for better results':
119
+ 'Anpassen des Rahmens für bessere Ergebnisse',
120
+ 'Replace Current Data?': 'Aktuelle Daten ersetzen?',
121
+ 'Uploading a new image will overwrite your current search parameters, text, and results. Are you sure you want to proceed?':
122
+ 'Durch das Hochladen eines neuen Bildes werden Ihre aktuellen Suchparameter, Texte und Ergebnisse überschrieben. Möchten Sie wirklich fortfahren?',
123
+ "Don't show this again": 'Nicht mehr anzeigen',
124
+ Continue: 'Fortfahren',
71
125
  },
72
126
  },
73
127
  pt: {
@@ -94,15 +148,43 @@ export const translations = {
94
148
  Brand: 'Marca',
95
149
  loading: 'Carregando',
96
150
  'No products were found matching your search criteria.':
97
- 'Nenhum produto foi encontrado com estes critérios ',
151
+ 'Nenhum produto foi encontrado com estes critérios.',
98
152
  'Please upload an image or enter a keyword to search.':
99
153
  'Faça o upload de uma imagem ou busque via texto',
100
- 'No matches found': 'No matches found',
101
- 'No matches found for your request': 'No matches found for your request',
102
- 'Clear all': 'Clear all',
103
- Cancel: 'Cancel',
104
- Apply: 'Apply',
154
+ 'No matches found':
155
+ 'Não foram encontrados resultados para sua solicitação',
156
+ 'No matches found for your request':
157
+ 'Não foram encontrados resultados para sua solicitação',
158
+ 'Clear all': 'Limpar tudo',
159
+ Cancel: 'Cancelar',
160
+ Apply: 'Aplicar',
105
161
  'Back to request image': 'Retroceder para imagem inicial',
162
+ 'Please select a search criteria before search request to refine and yield accurate results.':
163
+ 'Selecione um critérios de pesquisa antes da solicitação de pesquisa para refinar e produzir resultados precisos.',
164
+ 'Search criteria is not selected':
165
+ 'Os critérios de pesquisa não estão selecionados',
166
+ Inquiry: 'Inquérito',
167
+ 'Call us': 'Contactar-nos',
168
+ 'Submit your inquiry': 'Enviar o seu pedido',
169
+ 'Submit your image for inquiry': 'Envie sua imagem para consulta',
170
+ 'Your email (required)': 'Seu e-mail (obrigatório)',
171
+ 'Please enter a valid email.': 'Introduza um e-mail válido.',
172
+ 'Additional information': 'Informações adicionais',
173
+ Send: 'Enviar',
174
+ 'Experience Visual Search': 'Experience Visual Search',
175
+ 'Start your visual search by selecting an image below.':
176
+ 'Start your visual search by selecting an image below.',
177
+ 'Thank you for your feedback': 'Obrigado pelo seu feedback',
178
+ 'Select a Filter': 'Selecione um filtro',
179
+ 'Get personalised help from our team of product experts.':
180
+ 'Obtenha ajuda personalizada de nossa equipe de especialistas em produtos.',
181
+ 'Adjust the selection frame for better results':
182
+ 'Ajuste a caixa de busca para melhores resultados',
183
+ 'Replace Current Data?': 'Substituir os dados atuais?',
184
+ 'Uploading a new image will overwrite your current search parameters, text, and results. Are you sure you want to proceed?':
185
+ 'Carregar uma nova imagem substituirá seus parâmetros de pesquisa, texto e resultados atuais. Tem certeza de que deseja prosseguir?',
186
+ "Don't show this again": 'Não mostrar isso novamente',
187
+ Continue: 'Continuar',
106
188
  },
107
189
  },
108
190
  };
package/src/types.ts CHANGED
@@ -21,6 +21,7 @@ export interface Support {
21
21
  emailInquiry?: boolean;
22
22
  supportNumber?: string;
23
23
  emailTemplateId?: string;
24
+ prefilterFieldName?: string;
24
25
  }
25
26
 
26
27
  export interface Rfq {