@nyris/nyris-webapp 0.3.47 → 0.3.49
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/build/asset-manifest.json +17 -12
- package/build/index.html +1 -1
- package/build/js/settings.example.js +87 -13
- package/build/{precache-manifest.694373c4d80fe3bb40d0d6526b473852.js → precache-manifest.943318a8942503f5324468a411afba1b.js} +30 -10
- package/build/service-worker.js +1 -1
- package/build/static/css/main.24b5a712.chunk.css +2 -0
- package/build/static/css/main.24b5a712.chunk.css.map +1 -0
- package/build/static/js/2.3399db0d.chunk.js +3 -0
- package/build/static/js/2.3399db0d.chunk.js.map +1 -0
- package/build/static/js/main.42571815.chunk.js +3 -0
- package/build/static/js/main.42571815.chunk.js.map +1 -0
- package/build/static/media/add.ba46a4bf.svg +4 -0
- package/build/static/media/arrow_left.fd9d4390.svg +3 -0
- package/build/static/media/arrow_right.c6fdab0b.svg +3 -0
- package/build/static/media/minus.3fce6c0a.svg +3 -0
- package/build/static/media/settings.e3c8138b.svg +3 -0
- package/package.json +3 -3
- package/public/js/settings.example.js +87 -13
- package/src/Store/Store.ts +1 -0
- package/src/Store/search/Search.ts +36 -0
- package/src/Store/search/search.initialState.ts +1 -0
- package/src/Store/search/types.ts +1 -0
- package/src/common/assets/icons/add.svg +4 -0
- package/src/common/assets/icons/minus.svg +3 -0
- package/src/common/assets/icons/settings.svg +3 -0
- package/src/components/HeaderMobile.tsx +41 -12
- package/src/components/ImagePreviewMobile.tsx +4 -14
- package/src/components/Inquiry/InquiryBanner.tsx +1 -1
- package/src/components/Layout.tsx +19 -1
- package/src/components/MobilePostFilter.tsx +14 -5
- package/src/components/PanelResult/PostFilter.tsx +314 -0
- package/src/components/PanelResult/{index.tsx → PostFilterAlgolia.tsx} +44 -15
- package/src/components/PanelResult/expandable-panel.tsx +20 -14
- package/src/components/ProductAttribute.tsx +38 -34
- package/src/components/ProductDetailView.tsx +92 -22
- package/src/components/ProductList/index.tsx +0 -3
- package/src/components/ProductList/useProductList.ts +6 -3
- package/src/components/SelectedPostFilter.tsx +103 -0
- package/src/components/SidePanel.tsx +18 -8
- package/src/components/common.scss +4 -0
- package/src/components/current-refinements/getCurrentRefinement.ts +10 -18
- package/src/components/icon-label/icon-label.tsx +23 -18
- package/src/components/input/inputSearch.tsx +2 -2
- package/src/components/pre-filter/index.tsx +16 -10
- package/src/components/results/ItemResult.tsx +99 -24
- package/src/hooks/useFilter.ts +92 -0
- package/src/hooks/useFilteredResult.ts +29 -0
- package/src/index.css +2 -1
- package/src/page/landingPage/AppMD.tsx +1 -5
- package/src/page/landingPage/common.scss +10 -3
- package/src/page/result/index.tsx +39 -31
- package/src/services/image.ts +0 -5
- package/src/translations.ts +9 -0
- package/src/types.ts +3 -5
- package/build/static/css/main.21021ebe.chunk.css +0 -2
- package/build/static/css/main.21021ebe.chunk.css.map +0 -1
- package/build/static/js/2.3e652625.chunk.js +0 -3
- package/build/static/js/2.3e652625.chunk.js.map +0 -1
- package/build/static/js/main.37e28702.chunk.js +0 -3
- package/build/static/js/main.37e28702.chunk.js.map +0 -1
- /package/build/static/js/{2.3e652625.chunk.js.LICENSE.txt → 2.3399db0d.chunk.js.LICENSE.txt} +0 -0
- /package/build/static/js/{main.37e28702.chunk.js.LICENSE.txt → main.42571815.chunk.js.LICENSE.txt} +0 -0
|
@@ -6,6 +6,7 @@ import { ReactComponent as IconDisLike } from 'common/assets/icons/icon_dislike.
|
|
|
6
6
|
import { ReactComponent as IconLike } from 'common/assets/icons/icon_like.svg';
|
|
7
7
|
import { ReactComponent as IconSearchImage } from 'common/assets/icons/icon_search_image2.svg';
|
|
8
8
|
import { ReactComponent as Box3dIcon } from 'common/assets/icons/3d.svg';
|
|
9
|
+
import { ReactComponent as IconSettings } from 'common/assets/icons/settings.svg';
|
|
9
10
|
|
|
10
11
|
import React, { memo, useEffect, useState } from 'react';
|
|
11
12
|
import NoImage from 'common/assets/images/no-image.svg';
|
|
@@ -22,7 +23,7 @@ import { useMediaQuery } from 'react-responsive';
|
|
|
22
23
|
import { feedbackClickEpic, feedbackConversionEpic } from 'services/Feedback';
|
|
23
24
|
import ProductDetailView from 'components/ProductDetailView';
|
|
24
25
|
import ProductAttribute from '../ProductAttribute';
|
|
25
|
-
import { get } from 'lodash';
|
|
26
|
+
import { get, isUndefined } from 'lodash';
|
|
26
27
|
|
|
27
28
|
interface Props {
|
|
28
29
|
dataItem: any;
|
|
@@ -34,7 +35,6 @@ interface Props {
|
|
|
34
35
|
handlerFeedback?: any;
|
|
35
36
|
handlerGroupItem?: any;
|
|
36
37
|
isGroupItem?: boolean;
|
|
37
|
-
moreInfoText?: string;
|
|
38
38
|
handlerCloseGroup?: any;
|
|
39
39
|
main_image_link?: any;
|
|
40
40
|
}
|
|
@@ -116,6 +116,13 @@ function ItemResult(props: Props) {
|
|
|
116
116
|
dataItem,
|
|
117
117
|
settings.field?.ctaLinkField ? settings.field?.ctaLinkField : 'links.main',
|
|
118
118
|
);
|
|
119
|
+
const secondaryCTALink = get(
|
|
120
|
+
dataItem,
|
|
121
|
+
settings.field?.secondaryCTALinkField
|
|
122
|
+
? settings.field?.secondaryCTALinkField
|
|
123
|
+
: '',
|
|
124
|
+
);
|
|
125
|
+
|
|
119
126
|
const manufacturerNumber = get(dataItem, settings.field.manufacturerNumber);
|
|
120
127
|
return (
|
|
121
128
|
<Box className="wrap-main-item-result">
|
|
@@ -235,7 +242,7 @@ function ItemResult(props: Props) {
|
|
|
235
242
|
justifyContent={'space-between'}
|
|
236
243
|
flexDirection={'column'}
|
|
237
244
|
style={{ color: '#2B2C46' }}
|
|
238
|
-
gridGap={
|
|
245
|
+
gridGap={6}
|
|
239
246
|
>
|
|
240
247
|
{settings.CTAButtonText && (
|
|
241
248
|
<Typography
|
|
@@ -252,7 +259,10 @@ function ItemResult(props: Props) {
|
|
|
252
259
|
display="flex"
|
|
253
260
|
justifyContent={'space-between'}
|
|
254
261
|
flexDirection={'row'}
|
|
255
|
-
style={{
|
|
262
|
+
style={{
|
|
263
|
+
color: '#2B2C46',
|
|
264
|
+
marginTop: !settings.CTAButtonText ? 8 : -6,
|
|
265
|
+
}}
|
|
256
266
|
gridGap={8}
|
|
257
267
|
>
|
|
258
268
|
<Tooltip
|
|
@@ -274,25 +284,28 @@ function ItemResult(props: Props) {
|
|
|
274
284
|
</Typography>
|
|
275
285
|
</Tooltip>
|
|
276
286
|
|
|
277
|
-
{settings.warehouseVariant &&
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
>
|
|
284
|
-
<span
|
|
287
|
+
{settings.warehouseVariant &&
|
|
288
|
+
!isUndefined(
|
|
289
|
+
get(dataItem, settings.field.warehouseStockValue),
|
|
290
|
+
) && (
|
|
291
|
+
<Typography
|
|
292
|
+
className="text-f12 max-line-1 fw-400"
|
|
285
293
|
style={{
|
|
286
|
-
color:
|
|
287
|
-
? '#00C070'
|
|
288
|
-
: '#c54545',
|
|
289
|
-
fontWeight: 600,
|
|
294
|
+
color: '#2B2C46',
|
|
290
295
|
}}
|
|
291
296
|
>
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
297
|
+
<span
|
|
298
|
+
style={{
|
|
299
|
+
color: get(dataItem, settings.field.warehouseStockValue)
|
|
300
|
+
? '#00C070'
|
|
301
|
+
: '#c54545',
|
|
302
|
+
fontWeight: 600,
|
|
303
|
+
}}
|
|
304
|
+
>
|
|
305
|
+
{get(dataItem, settings.field.warehouseStockValue) || 0}
|
|
306
|
+
</span>
|
|
307
|
+
</Typography>
|
|
308
|
+
)}
|
|
296
309
|
</Box>
|
|
297
310
|
<Box
|
|
298
311
|
display="flex"
|
|
@@ -330,8 +343,13 @@ function ItemResult(props: Props) {
|
|
|
330
343
|
>
|
|
331
344
|
{settings.field.warehouseNumber && (
|
|
332
345
|
<ProductAttribute
|
|
333
|
-
title={
|
|
334
|
-
|
|
346
|
+
title={
|
|
347
|
+
get(dataItem, settings.field.warehouseNumber) ||
|
|
348
|
+
settings.field.warehouseNumber
|
|
349
|
+
}
|
|
350
|
+
value={
|
|
351
|
+
get(dataItem, settings.field.warehouseNumberValue) || 'N/A'
|
|
352
|
+
}
|
|
335
353
|
padding="4px 8px"
|
|
336
354
|
width={{ xs: '49%' }}
|
|
337
355
|
/>
|
|
@@ -339,9 +357,13 @@ function ItemResult(props: Props) {
|
|
|
339
357
|
|
|
340
358
|
{settings.field.warehouseShelfNumber && (
|
|
341
359
|
<ProductAttribute
|
|
342
|
-
title={
|
|
360
|
+
title={
|
|
361
|
+
get(dataItem, settings.field.warehouseShelfNumber) ||
|
|
362
|
+
settings.field.warehouseShelfNumber
|
|
363
|
+
}
|
|
343
364
|
value={
|
|
344
|
-
dataItem
|
|
365
|
+
get(dataItem, settings.field.warehouseShelfNumberValue) ||
|
|
366
|
+
'N/A'
|
|
345
367
|
}
|
|
346
368
|
padding="4px 8px"
|
|
347
369
|
width={{ xs: '49%' }}
|
|
@@ -350,6 +372,59 @@ function ItemResult(props: Props) {
|
|
|
350
372
|
</Box>
|
|
351
373
|
)}
|
|
352
374
|
<div>
|
|
375
|
+
{settings.secondaryCTAButtonText && (
|
|
376
|
+
<Box
|
|
377
|
+
style={{
|
|
378
|
+
boxShadow: '-2px 2px 4px rgba(170, 171, 181, 0.5)',
|
|
379
|
+
// marginBottom: 22,
|
|
380
|
+
height: 40,
|
|
381
|
+
background: '#2B2C46',
|
|
382
|
+
borderRadius: 4,
|
|
383
|
+
padding: '0px 8px',
|
|
384
|
+
marginTop: '8px',
|
|
385
|
+
}}
|
|
386
|
+
display={'flex'}
|
|
387
|
+
justifyItems={'center'}
|
|
388
|
+
alignItems={'center'}
|
|
389
|
+
justifyContent={'space-between'}
|
|
390
|
+
>
|
|
391
|
+
<Box
|
|
392
|
+
style={{
|
|
393
|
+
display: 'flex',
|
|
394
|
+
justifyContent: 'space-between',
|
|
395
|
+
width: '100%',
|
|
396
|
+
padding: 0,
|
|
397
|
+
cursor: secondaryCTALink ? 'pointer' : 'normal',
|
|
398
|
+
}}
|
|
399
|
+
onClick={() => {
|
|
400
|
+
if (secondaryCTALink) {
|
|
401
|
+
feedbackConversionEpic(state, indexItem, dataItem.sku);
|
|
402
|
+
window.open(`${secondaryCTALink}`, '_blank');
|
|
403
|
+
}
|
|
404
|
+
}}
|
|
405
|
+
>
|
|
406
|
+
<Typography
|
|
407
|
+
className="text-white max-line-2"
|
|
408
|
+
style={{
|
|
409
|
+
overflow: 'hidden',
|
|
410
|
+
textOverflow: 'ellipsis',
|
|
411
|
+
fontWeight: 500,
|
|
412
|
+
fontSize: '12px',
|
|
413
|
+
letterSpacing: '0.27px',
|
|
414
|
+
wordBreak: 'break-all',
|
|
415
|
+
maxWidth: !isMobile && secondaryCTALink ? '136px' : '164x',
|
|
416
|
+
paddingRight: '8px',
|
|
417
|
+
}}
|
|
418
|
+
align="left"
|
|
419
|
+
>
|
|
420
|
+
{settings.secondaryCTAButtonText}
|
|
421
|
+
</Typography>
|
|
422
|
+
{!isMobile && secondaryCTALink && (
|
|
423
|
+
<IconSettings color="white" />
|
|
424
|
+
)}
|
|
425
|
+
</Box>
|
|
426
|
+
</Box>
|
|
427
|
+
)}
|
|
353
428
|
{!settings.CTAButtonText ? (
|
|
354
429
|
<Tooltip
|
|
355
430
|
title={dataItem[settings.field.productName]}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { useAppSelector } from 'Store/Store';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
// Function to count occurrences and create array of objects
|
|
5
|
+
function countOccurrences(inputArray: any[]) {
|
|
6
|
+
const countMap: any = {};
|
|
7
|
+
inputArray.forEach((value: string | number) => {
|
|
8
|
+
countMap[value] = (countMap[value] || 0) + 1;
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
return Object.entries(countMap).map(([value, count]) => ({
|
|
12
|
+
value,
|
|
13
|
+
count,
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const getNextFilters = (data: any[], postFilters: any): any => {
|
|
18
|
+
const nextFilters: any = {};
|
|
19
|
+
|
|
20
|
+
data?.forEach(element => {
|
|
21
|
+
const filters = element.filters || {};
|
|
22
|
+
const keys = Object.keys(filters);
|
|
23
|
+
|
|
24
|
+
for (let i = 0; i < keys.length; i++) {
|
|
25
|
+
const xKey = keys[i];
|
|
26
|
+
|
|
27
|
+
let isNextFilter = keys.every(yKey => {
|
|
28
|
+
if (xKey !== yKey) {
|
|
29
|
+
const postFilter = postFilters[yKey] || {};
|
|
30
|
+
const filter = filters[yKey] || {};
|
|
31
|
+
|
|
32
|
+
const postFilterValues = Object.keys(postFilter).filter(
|
|
33
|
+
key => postFilter[key],
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (postFilterValues?.length > 0) {
|
|
37
|
+
return postFilterValues?.some(element => {
|
|
38
|
+
return filter?.includes(element);
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
return true;
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
if (isNextFilter) {
|
|
47
|
+
if (nextFilters[xKey]) {
|
|
48
|
+
nextFilters[xKey] = [...nextFilters[xKey], ...filters[xKey]];
|
|
49
|
+
} else {
|
|
50
|
+
nextFilters[xKey] = filters[xKey];
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
return nextFilters;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const useFilter = (data: any) => {
|
|
60
|
+
const { postFilter } = useAppSelector(state => state.search);
|
|
61
|
+
|
|
62
|
+
const filters = useMemo(() => {
|
|
63
|
+
return getNextFilters(data, postFilter);
|
|
64
|
+
}, [data, postFilter]);
|
|
65
|
+
|
|
66
|
+
const filterCount = useMemo(() => {
|
|
67
|
+
const resultObject: any = {};
|
|
68
|
+
for (const key in filters) {
|
|
69
|
+
if (filters.hasOwnProperty(key)) {
|
|
70
|
+
resultObject[key] = countOccurrences(filters[key]);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return resultObject;
|
|
75
|
+
}, [filters]);
|
|
76
|
+
|
|
77
|
+
// If there is no item for a selected filter add the filter with count 0
|
|
78
|
+
Object.keys(postFilter).forEach(key => {
|
|
79
|
+
const filter = postFilter[key];
|
|
80
|
+
Object.keys(filter).forEach(value => {
|
|
81
|
+
const isNextFilter = filterCount[key].some((data: { value: string }) => {
|
|
82
|
+
return data.value === value;
|
|
83
|
+
});
|
|
84
|
+
|
|
85
|
+
if (!isNextFilter) {
|
|
86
|
+
filterCount[key].push({ value, count: 0 });
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return filterCount;
|
|
92
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { useAppSelector } from 'Store/Store';
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
|
|
4
|
+
function filterResultsBasedOnPostFilter(results: any, postFilter: any): any[] {
|
|
5
|
+
return results?.filter((result: { filters: { [x: string]: any } }) => {
|
|
6
|
+
return Object.keys(postFilter).every(filterType => {
|
|
7
|
+
const filter = postFilter[filterType];
|
|
8
|
+
|
|
9
|
+
const filterValues = Object.keys(filter).filter(key => filter[key]);
|
|
10
|
+
|
|
11
|
+
if (filterValues.length > 0) {
|
|
12
|
+
const resultFilterValues = result.filters[filterType];
|
|
13
|
+
if (resultFilterValues) {
|
|
14
|
+
return filterValues?.some((value: any) =>
|
|
15
|
+
resultFilterValues.includes(value),
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
return true;
|
|
20
|
+
});
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export const useFilteredResult = (data: any) => {
|
|
25
|
+
const { postFilter } = useAppSelector(state => state.search);
|
|
26
|
+
return useMemo(() => {
|
|
27
|
+
return filterResultsBasedOnPostFilter(data, postFilter || {});
|
|
28
|
+
}, [data, postFilter]);
|
|
29
|
+
};
|
package/src/index.css
CHANGED
|
@@ -5,6 +5,7 @@ body {
|
|
|
5
5
|
sans-serif;
|
|
6
6
|
-webkit-font-smoothing: antialiased;
|
|
7
7
|
-moz-osx-font-smoothing: grayscale;
|
|
8
|
+
color: #2B2C46
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
|
|
@@ -403,7 +404,7 @@ button,
|
|
|
403
404
|
input,
|
|
404
405
|
select,
|
|
405
406
|
textarea {
|
|
406
|
-
color:
|
|
407
|
+
color: #2B2C46;
|
|
407
408
|
font-family: Roboto, Arial, Helvetica, sans-serif;
|
|
408
409
|
font-size: 17px;
|
|
409
410
|
line-height: 1.5;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Box } from '@material-ui/core';
|
|
2
2
|
import React, { useState } from 'react';
|
|
3
3
|
import './common.scss';
|
|
4
|
-
import { cadExtensions } from '@nyris/nyris-api';
|
|
5
4
|
import algoliasearch from 'algoliasearch/lite';
|
|
6
5
|
import DragDropFile from 'components/DragDropFile';
|
|
7
6
|
import CustomSearchBox from 'components/input/inputSearch';
|
|
@@ -16,10 +15,7 @@ function AppMD() {
|
|
|
16
15
|
const searchClient = algoliasearch(appId, apiKey);
|
|
17
16
|
searchClient.initIndex(indexName);
|
|
18
17
|
|
|
19
|
-
const acceptTypes = ['image/*']
|
|
20
|
-
.concat(settings.cadSearch ? cadExtensions : [])
|
|
21
|
-
.join(',');
|
|
22
|
-
|
|
18
|
+
const acceptTypes = ['image/*'];
|
|
23
19
|
const InfiniteHits = ({ hits }: any) => {
|
|
24
20
|
return <div></div>;
|
|
25
21
|
};
|
|
@@ -1664,7 +1664,7 @@ button {
|
|
|
1664
1664
|
&.toggle {
|
|
1665
1665
|
// transition: all 0.1s ease-in-out;
|
|
1666
1666
|
// transition: all 0.5s ease-in;
|
|
1667
|
-
max-width:
|
|
1667
|
+
max-width: 32px;
|
|
1668
1668
|
> * {
|
|
1669
1669
|
display: none !important;
|
|
1670
1670
|
}
|
|
@@ -1679,7 +1679,6 @@ button {
|
|
|
1679
1679
|
z-index: 222;
|
|
1680
1680
|
}
|
|
1681
1681
|
.col-left__bottom {
|
|
1682
|
-
margin-top: 32px;
|
|
1683
1682
|
width: 100%;
|
|
1684
1683
|
padding: 0 24px;
|
|
1685
1684
|
button {
|
|
@@ -2052,7 +2051,7 @@ button {
|
|
|
2052
2051
|
height: 48px;
|
|
2053
2052
|
overflow: hidden;
|
|
2054
2053
|
padding-right: 12px !important;
|
|
2055
|
-
|
|
2054
|
+
.input-wrapper {
|
|
2056
2055
|
width: 100%;
|
|
2057
2056
|
display: flex;
|
|
2058
2057
|
justify-content: center;
|
|
@@ -2181,4 +2180,12 @@ button {
|
|
|
2181
2180
|
|
|
2182
2181
|
.product-image:hover{
|
|
2183
2182
|
transform: scale(1.1);
|
|
2183
|
+
}
|
|
2184
|
+
|
|
2185
|
+
.result-wrapper {
|
|
2186
|
+
max-width: calc(192px * 4 + 96px);
|
|
2187
|
+
width: 100%;
|
|
2188
|
+
@media screen and (min-width: 2047px) {
|
|
2189
|
+
max-width: 1300px;
|
|
2190
|
+
}
|
|
2184
2191
|
}
|
|
@@ -50,6 +50,7 @@ import InquiryBanner from 'components/Inquiry/InquiryBanner';
|
|
|
50
50
|
import { useQuery } from 'hooks/useQuery';
|
|
51
51
|
import { ReactComponent as PoweredByNyrisImage } from 'common/assets/images/powered_by_nyris.svg';
|
|
52
52
|
import Feedback from 'components/Feedback';
|
|
53
|
+
import { SelectedPostFilter } from 'components/SelectedPostFilter';
|
|
53
54
|
|
|
54
55
|
interface Props {
|
|
55
56
|
allSearchResults: any;
|
|
@@ -61,7 +62,7 @@ function ResultComponent(props: Props) {
|
|
|
61
62
|
const refBoxResult: any = useRef(null);
|
|
62
63
|
const stateGlobal = useAppSelector(state => state);
|
|
63
64
|
const { search, settings } = stateGlobal;
|
|
64
|
-
|
|
65
|
+
const { allSearchResults } = props;
|
|
65
66
|
const {
|
|
66
67
|
requestImage,
|
|
67
68
|
regions,
|
|
@@ -69,9 +70,9 @@ function ResultComponent(props: Props) {
|
|
|
69
70
|
preFilter,
|
|
70
71
|
loadingSearchAlgolia,
|
|
71
72
|
imageThumbSearchInput,
|
|
73
|
+
results,
|
|
72
74
|
} = search;
|
|
73
75
|
|
|
74
|
-
const moreInfoText = settings?.productCtaText;
|
|
75
76
|
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
76
77
|
const [imageSelection, setImageSelection] = useState<any>(null);
|
|
77
78
|
const executeScroll = () => refBoxResult.current.scrollIntoView('-100px');
|
|
@@ -299,10 +300,11 @@ function ResultComponent(props: Props) {
|
|
|
299
300
|
|
|
300
301
|
const debouncedOnImageSelectionChange = useCallback(
|
|
301
302
|
debounce((r: RectCoords) => {
|
|
303
|
+
setImageSelection(r);
|
|
302
304
|
feedbackRegionEpic(stateGlobal, r);
|
|
303
305
|
dispatch(selectionChanged(r));
|
|
304
306
|
findItemsInSelection(r);
|
|
305
|
-
},
|
|
307
|
+
}, 50),
|
|
306
308
|
[findItemsInSelection, stateGlobal.search],
|
|
307
309
|
);
|
|
308
310
|
|
|
@@ -311,11 +313,10 @@ function ResultComponent(props: Props) {
|
|
|
311
313
|
const showPostFilter = useMemo(() => {
|
|
312
314
|
return (
|
|
313
315
|
isPostFilterEnabled &&
|
|
314
|
-
|
|
315
|
-
|
|
316
|
+
((allSearchResults?.hits.length > 0 && isAlgoliaEnabled) ||
|
|
317
|
+
results?.length > 0)
|
|
316
318
|
);
|
|
317
|
-
|
|
318
|
-
}, [isPostFilterEnabled, props.allSearchResults?.hits, isAlgoliaEnabled]);
|
|
319
|
+
}, [isPostFilterEnabled, allSearchResults, isAlgoliaEnabled, results]);
|
|
319
320
|
|
|
320
321
|
const showSidePanel = useMemo(() => {
|
|
321
322
|
return requestImage || (isPostFilterEnabled && showPostFilter);
|
|
@@ -431,7 +432,7 @@ function ResultComponent(props: Props) {
|
|
|
431
432
|
flexDirection: 'column',
|
|
432
433
|
}}
|
|
433
434
|
>
|
|
434
|
-
{!isMobile && (
|
|
435
|
+
{!isMobile && settings.algolia.enabled && (
|
|
435
436
|
<Box className="wrap-box-refinements">
|
|
436
437
|
<CurrentRefinements statusSwitchButton={true} />
|
|
437
438
|
</Box>
|
|
@@ -441,7 +442,6 @@ function ResultComponent(props: Props) {
|
|
|
441
442
|
<ImagePreviewMobile
|
|
442
443
|
requestImage={requestImage}
|
|
443
444
|
imageSelection={imageSelection}
|
|
444
|
-
setImageSelection={setImageSelection}
|
|
445
445
|
debouncedOnImageSelectionChange={
|
|
446
446
|
debouncedOnImageSelectionChange
|
|
447
447
|
}
|
|
@@ -482,27 +482,35 @@ function ResultComponent(props: Props) {
|
|
|
482
482
|
/>
|
|
483
483
|
</div>
|
|
484
484
|
)}
|
|
485
|
-
<
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
sendFeedBackAction={sendFeedBackAction}
|
|
489
|
-
moreInfoText={moreInfoText}
|
|
490
|
-
requestImage={requestImage}
|
|
491
|
-
searchQuery={searchQuery}
|
|
492
|
-
/>
|
|
493
|
-
<Box
|
|
494
|
-
className="pagination-result"
|
|
495
|
-
style={{
|
|
496
|
-
width: '100%',
|
|
497
|
-
margin: !isMobile ? '20px auto' : '',
|
|
498
|
-
marginBottom:
|
|
499
|
-
isMobile && !requestImage ? '64px' : '20px',
|
|
500
|
-
padding: '0 20%',
|
|
501
|
-
alignSelf: 'end',
|
|
502
|
-
}}
|
|
485
|
+
<div
|
|
486
|
+
className="box-item-result ml-auto mr-auto"
|
|
487
|
+
style={{ height: 'fit-content' }}
|
|
503
488
|
>
|
|
504
|
-
{
|
|
505
|
-
|
|
489
|
+
{!isMobile && !settings.algolia.enabled && (
|
|
490
|
+
<SelectedPostFilter />
|
|
491
|
+
)}
|
|
492
|
+
<ProductList
|
|
493
|
+
getUrlToCanvasFile={getUrlToCanvasFile}
|
|
494
|
+
setLoading={false}
|
|
495
|
+
sendFeedBackAction={sendFeedBackAction}
|
|
496
|
+
requestImage={requestImage}
|
|
497
|
+
searchQuery={searchQuery}
|
|
498
|
+
/>
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
{props.allSearchResults?.hits.length > 0 &&
|
|
502
|
+
(requestImage || searchQuery) && (
|
|
503
|
+
<Box
|
|
504
|
+
className="pagination-result"
|
|
505
|
+
style={{
|
|
506
|
+
width: '100%',
|
|
507
|
+
margin: !isMobile ? '20px auto' : '',
|
|
508
|
+
marginBottom:
|
|
509
|
+
isMobile && !requestImage ? '64px' : '20px',
|
|
510
|
+
padding: '0 20%',
|
|
511
|
+
alignSelf: 'end',
|
|
512
|
+
}}
|
|
513
|
+
>
|
|
506
514
|
<Pagination
|
|
507
515
|
showFirst={false}
|
|
508
516
|
translations={{
|
|
@@ -514,8 +522,8 @@ function ResultComponent(props: Props) {
|
|
|
514
522
|
),
|
|
515
523
|
}}
|
|
516
524
|
/>
|
|
517
|
-
|
|
518
|
-
|
|
525
|
+
</Box>
|
|
526
|
+
)}
|
|
519
527
|
|
|
520
528
|
{requestImage &&
|
|
521
529
|
!loadingSearchAlgolia &&
|
package/src/services/image.ts
CHANGED
package/src/translations.ts
CHANGED
|
@@ -27,6 +27,9 @@ export const translations = {
|
|
|
27
27
|
'Please upload an image or enter a keyword to search.',
|
|
28
28
|
'No matches found': 'No matches found',
|
|
29
29
|
'No matches found for your request': 'No matches found for your request',
|
|
30
|
+
'Clear all': 'Clear all',
|
|
31
|
+
Cancel: 'Cancel',
|
|
32
|
+
Apply: 'Apply',
|
|
30
33
|
},
|
|
31
34
|
},
|
|
32
35
|
de: {
|
|
@@ -58,6 +61,9 @@ export const translations = {
|
|
|
58
61
|
'No matches found': 'Keine Treffer für Ihre Anfrage gefunden',
|
|
59
62
|
'No matches found for your request':
|
|
60
63
|
'Keine Treffer für Ihre Anfrage gefunden',
|
|
64
|
+
'Clear all': 'Alles löschen',
|
|
65
|
+
Cancel: 'Abbrechen',
|
|
66
|
+
Apply: 'Anwenden',
|
|
61
67
|
},
|
|
62
68
|
},
|
|
63
69
|
pt: {
|
|
@@ -89,6 +95,9 @@ export const translations = {
|
|
|
89
95
|
'Faça o upload de uma imagem ou busque via texto',
|
|
90
96
|
'No matches found': 'No matches found',
|
|
91
97
|
'No matches found for your request': 'No matches found for your request',
|
|
98
|
+
'Clear all': 'Clear all',
|
|
99
|
+
Cancel: 'Cancel',
|
|
100
|
+
Apply: 'Apply',
|
|
92
101
|
},
|
|
93
102
|
},
|
|
94
103
|
};
|
package/src/types.ts
CHANGED
|
@@ -34,6 +34,7 @@ export interface Cadenas {
|
|
|
34
34
|
}
|
|
35
35
|
export interface Field {
|
|
36
36
|
ctaLinkField: string;
|
|
37
|
+
secondaryCTALinkField?: string;
|
|
37
38
|
productName: string;
|
|
38
39
|
productDetails: string;
|
|
39
40
|
manufacturerNumber: string;
|
|
@@ -53,8 +54,8 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
53
54
|
auth0: Auth0Settings;
|
|
54
55
|
brandName?: string;
|
|
55
56
|
cadenas?: Cadenas;
|
|
56
|
-
|
|
57
|
-
|
|
57
|
+
CTAButtonText?: string;
|
|
58
|
+
secondaryCTAButtonText?: string;
|
|
58
59
|
field: Field;
|
|
59
60
|
headerText?: string;
|
|
60
61
|
instantRedirectPatterns: string[];
|
|
@@ -65,7 +66,6 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
65
66
|
preFilterOption?: boolean;
|
|
66
67
|
preFilterTitle?: string;
|
|
67
68
|
preview: boolean;
|
|
68
|
-
productCtaText?: string;
|
|
69
69
|
refinements?: any;
|
|
70
70
|
regions: boolean;
|
|
71
71
|
rfq?: Rfq;
|
|
@@ -73,13 +73,11 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
73
73
|
showFeedback?: boolean;
|
|
74
74
|
showFeedbackAndShare?: boolean;
|
|
75
75
|
showGroup?: boolean;
|
|
76
|
-
showMoreInfo?: boolean; // deprecated
|
|
77
76
|
showPoweredByNyris?: boolean;
|
|
78
77
|
support?: Support;
|
|
79
78
|
theme: SearchSuiteSettings;
|
|
80
79
|
visualSearchFilterKey?: string;
|
|
81
80
|
warehouseVariant?: boolean;
|
|
82
|
-
CTAButtonText?: string;
|
|
83
81
|
}
|
|
84
82
|
|
|
85
83
|
export interface SearchSuiteSettings {
|