@nyris/nyris-webapp 0.3.48 → 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.
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14.3007 8.43552V8V7.55875L15.4009 6.59603C15.8197 6.22695 15.9116 5.60988 15.6187 5.13475L14.2663 2.84254C14.0618 2.4883 13.684 2.26991 13.2749 2.26949C13.1504 2.26854 13.0265 2.28789 12.9082 2.3268L11.5157 2.7967C11.2752 2.63694 11.0244 2.49336 10.765 2.36691L10.4727 0.922825C10.3645 0.378294 9.88166 -0.0104241 9.3266 0.000213077H6.64472C6.08966 -0.0104241 5.60678 0.378294 5.49862 0.922825L5.20636 2.36691C4.94501 2.49333 4.69232 2.6369 4.44994 2.7967L3.08608 2.30388C2.96648 2.27272 2.84263 2.26111 2.71932 2.26949C2.31028 2.26991 1.93247 2.4883 1.72795 2.84254L0.375548 5.13475C0.0996813 5.60867 0.198168 6.2116 0.610498 6.5731L1.69356 7.56448V8V8.44125L0.610498 9.40397C0.186011 9.76843 0.0866989 10.3861 0.375548 10.8653L1.72795 13.1575C1.93247 13.5117 2.31028 13.7301 2.71932 13.7305C2.84388 13.7315 2.96775 13.7121 3.08608 13.6732L4.47859 13.2033C4.71901 13.3631 4.96979 13.5066 5.22929 13.6331L5.52154 15.0772C5.6297 15.6217 6.11258 16.0104 6.66764 15.9998H9.37244C9.92751 16.0104 10.4104 15.6217 10.5185 15.0772L10.8108 13.6331C11.0721 13.5067 11.3248 13.3631 11.5672 13.2033L12.954 13.6732C13.0723 13.7121 13.1962 13.7315 13.3208 13.7305C13.7298 13.7301 14.1076 13.5117 14.3121 13.1575L15.6187 10.8653C15.8946 10.3913 15.7961 9.7884 15.3837 9.4269L14.3007 8.43552ZM13.2749 12.5844L11.3094 11.9197C10.8492 12.3094 10.3234 12.6141 9.75639 12.8194L9.34952 14.8766H6.64472L6.23786 12.8423C5.67536 12.6312 5.15234 12.327 4.69062 11.9426L2.71932 12.5844L1.36693 10.2922L2.92562 8.91688C2.81966 8.32369 2.81966 7.71642 2.92562 7.12323L1.36693 5.7078L2.71932 3.41559L4.68489 4.08033C5.14501 3.6906 5.67088 3.38594 6.23786 3.18064L6.64472 1.12339H9.34952L9.75639 3.15772C10.3189 3.36885 10.8419 3.67298 11.3036 4.05741L13.2749 3.41559L14.6273 5.7078L13.0686 7.08312C13.1746 7.67631 13.1746 8.28358 13.0686 8.87677L14.6273 10.2922L13.2749 12.5844ZM7.99712 11.4383C6.0982 11.4383 4.55882 9.89892 4.55882 8C4.55882 6.10108 6.0982 4.5617 7.99712 4.5617C9.89604 4.5617 11.4354 6.10108 11.4354 8C11.4447 8.91471 11.0854 9.79466 10.4386 10.4415C9.79178 11.0883 8.91183 11.4476 7.99712 11.4383ZM7.99712 5.7078C7.38493 5.69354 6.79358 5.93045 6.36058 6.36345C5.92757 6.79646 5.69066 7.38781 5.70492 8C5.69066 8.61219 5.92757 9.20354 6.36058 9.63655C6.79358 10.0695 7.38493 10.3065 7.99712 10.2922C8.60931 10.3065 9.20066 10.0695 9.63367 9.63655C10.0667 9.20354 10.3036 8.61219 10.2893 8C10.3036 7.38781 10.0667 6.79646 9.63367 6.36345C9.20066 5.93045 8.60931 5.69354 7.99712 5.7078Z" fill="currentColor"/>
3
+ </svg>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nyris/nyris-webapp",
3
- "version": "0.3.48",
3
+ "version": "0.3.49",
4
4
  "homepage": "./",
5
5
  "dependencies": {
6
6
  "@algolia/autocomplete-js": "^1.7.1",
@@ -13,8 +13,8 @@
13
13
  "@material-ui/data-grid": "^4.0.0-alpha.37",
14
14
  "@material-ui/icons": "^4.4.1",
15
15
  "@material-ui/lab": "^4.0.0-alpha.60",
16
- "@nyris/nyris-api": "^0.3.48",
17
- "@nyris/nyris-react-components": "^0.3.48",
16
+ "@nyris/nyris-api": "^0.3.49",
17
+ "@nyris/nyris-react-components": "^0.3.49",
18
18
  "@reduxjs/toolkit": "^1.6.1",
19
19
  "@splidejs/react-splide": "^0.7.12",
20
20
  "@types/blueimp-load-image": "^2.23.4",
@@ -69,10 +69,13 @@ var settings = {
69
69
  headerText: '',
70
70
  itemIdLabel: 'SKU',
71
71
  preFilterTitle: '',
72
- CTAButtonText: '',
72
+ CTAButtonText: 'View More',
73
+ secondaryCTAButtonText: 'Configure Now',
74
+
73
75
  //field mappins
74
76
  field: {
75
77
  ctaLinkField: 'main_offer_link',
78
+ secondaryCTALinkField: 'main_offer_link',
76
79
  productName: 'title',
77
80
  productDetails: 'keyword_1',
78
81
  manufacturerNumber: 'keyword_0',
@@ -0,0 +1,3 @@
1
+ <svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M14.3007 8.43552V8V7.55875L15.4009 6.59603C15.8197 6.22695 15.9116 5.60988 15.6187 5.13475L14.2663 2.84254C14.0618 2.4883 13.684 2.26991 13.2749 2.26949C13.1504 2.26854 13.0265 2.28789 12.9082 2.3268L11.5157 2.7967C11.2752 2.63694 11.0244 2.49336 10.765 2.36691L10.4727 0.922825C10.3645 0.378294 9.88166 -0.0104241 9.3266 0.000213077H6.64472C6.08966 -0.0104241 5.60678 0.378294 5.49862 0.922825L5.20636 2.36691C4.94501 2.49333 4.69232 2.6369 4.44994 2.7967L3.08608 2.30388C2.96648 2.27272 2.84263 2.26111 2.71932 2.26949C2.31028 2.26991 1.93247 2.4883 1.72795 2.84254L0.375548 5.13475C0.0996813 5.60867 0.198168 6.2116 0.610498 6.5731L1.69356 7.56448V8V8.44125L0.610498 9.40397C0.186011 9.76843 0.0866989 10.3861 0.375548 10.8653L1.72795 13.1575C1.93247 13.5117 2.31028 13.7301 2.71932 13.7305C2.84388 13.7315 2.96775 13.7121 3.08608 13.6732L4.47859 13.2033C4.71901 13.3631 4.96979 13.5066 5.22929 13.6331L5.52154 15.0772C5.6297 15.6217 6.11258 16.0104 6.66764 15.9998H9.37244C9.92751 16.0104 10.4104 15.6217 10.5185 15.0772L10.8108 13.6331C11.0721 13.5067 11.3248 13.3631 11.5672 13.2033L12.954 13.6732C13.0723 13.7121 13.1962 13.7315 13.3208 13.7305C13.7298 13.7301 14.1076 13.5117 14.3121 13.1575L15.6187 10.8653C15.8946 10.3913 15.7961 9.7884 15.3837 9.4269L14.3007 8.43552ZM13.2749 12.5844L11.3094 11.9197C10.8492 12.3094 10.3234 12.6141 9.75639 12.8194L9.34952 14.8766H6.64472L6.23786 12.8423C5.67536 12.6312 5.15234 12.327 4.69062 11.9426L2.71932 12.5844L1.36693 10.2922L2.92562 8.91688C2.81966 8.32369 2.81966 7.71642 2.92562 7.12323L1.36693 5.7078L2.71932 3.41559L4.68489 4.08033C5.14501 3.6906 5.67088 3.38594 6.23786 3.18064L6.64472 1.12339H9.34952L9.75639 3.15772C10.3189 3.36885 10.8419 3.67298 11.3036 4.05741L13.2749 3.41559L14.6273 5.7078L13.0686 7.08312C13.1746 7.67631 13.1746 8.28358 13.0686 8.87677L14.6273 10.2922L13.2749 12.5844ZM7.99712 11.4383C6.0982 11.4383 4.55882 9.89892 4.55882 8C4.55882 6.10108 6.0982 4.5617 7.99712 4.5617C9.89604 4.5617 11.4354 6.10108 11.4354 8C11.4447 8.91471 11.0854 9.79466 10.4386 10.4415C9.79178 11.0883 8.91183 11.4476 7.99712 11.4383ZM7.99712 5.7078C7.38493 5.69354 6.79358 5.93045 6.36058 6.36345C5.92757 6.79646 5.69066 7.38781 5.70492 8C5.69066 8.61219 5.92757 9.20354 6.36058 9.63655C6.79358 10.0695 7.38493 10.3065 7.99712 10.2922C8.60931 10.3065 9.20066 10.0695 9.63367 9.63655C10.0667 9.20354 10.3036 8.61219 10.2893 8C10.3036 7.38781 10.0667 6.79646 9.63367 6.36345C9.20066 5.93045 8.60931 5.69354 7.99712 5.7078Z" fill="currentColor"/>
3
+ </svg>
@@ -88,7 +88,15 @@ function HeaderMobileComponent(props: Props): JSX.Element {
88
88
  dispatch(updateQueryText(''));
89
89
  setValueInput('');
90
90
  }
91
+ } else {
92
+ if (settings.algolia?.enabled) {
93
+ // not an ideal solution: fixes text search not working after removing image
94
+ setTimeout(() => {
95
+ refine(searchQuery);
96
+ }, 100);
97
+ }
91
98
  }
99
+ // eslint-disable-next-line react-hooks/exhaustive-deps
92
100
  }, [imageThumbSearchInput, dispatch, refine, history, settings.algolia]);
93
101
 
94
102
  useEffect(() => {
@@ -16,14 +16,12 @@ import {
16
16
  updateStatusLoading,
17
17
  } from 'Store/search/Search';
18
18
  import { useHistory } from 'react-router-dom';
19
- import { connectSearchBox } from 'react-instantsearch-dom';
20
19
  import { find } from 'services/image';
21
20
  import { isEmpty } from 'lodash';
22
21
 
23
22
  function ImagePreviewMobileComponent({
24
23
  requestImage,
25
24
  imageSelection,
26
- setImageSelection,
27
25
  debouncedOnImageSelectionChange,
28
26
  filteredRegions,
29
27
  showAdjustInfo,
@@ -32,14 +30,13 @@ function ImagePreviewMobileComponent({
32
30
  }: {
33
31
  requestImage: any;
34
32
  imageSelection: any;
35
- setImageSelection: any;
33
+
36
34
  debouncedOnImageSelectionChange: any;
37
35
  filteredRegions: any;
38
36
  showAdjustInfoBasedOnConfidence: any;
39
37
  showAdjustInfo: any;
40
38
  }) {
41
39
  const { t } = useTranslation();
42
- const { refine }: any = rest;
43
40
  const [editActive, setEditActive] = useState(false);
44
41
  const settings = useAppSelector(state => state.settings);
45
42
  const { preFilter } = useAppSelector(state => state.search);
@@ -60,12 +57,7 @@ function ImagePreviewMobileComponent({
60
57
  history.push('/');
61
58
  }
62
59
  dispatch(reset(''));
63
- if (isAlgoliaEnabled) {
64
- // not an ideal solution: fixes text search not working after removing image
65
- setTimeout(() => {
66
- refine(searchQuery);
67
- }, 100);
68
- }
60
+
69
61
  if (!isAlgoliaEnabled) {
70
62
  let payload: any;
71
63
  let filters: any[] = [];
@@ -127,7 +119,6 @@ function ImagePreviewMobileComponent({
127
119
  <Preview
128
120
  key={requestImage?.id}
129
121
  onSelectionChange={(r: RectCoords) => {
130
- setImageSelection(r);
131
122
  debouncedOnImageSelectionChange(r);
132
123
  }}
133
124
  image={requestImage?.canvas}
@@ -235,7 +226,5 @@ function ImagePreviewMobileComponent({
235
226
  </Box>
236
227
  );
237
228
  }
238
- const ImagePreviewMobile = connectSearchBox<any>(
239
- memo(ImagePreviewMobileComponent),
240
- );
229
+ const ImagePreviewMobile = memo(ImagePreviewMobileComponent);
241
230
  export default ImagePreviewMobile;
@@ -9,6 +9,8 @@ import { ReactComponent as IconSearchImage } from 'common/assets/icons/icon_sear
9
9
  import { ReactComponent as IconShare } from 'common/assets/icons/Fill.svg';
10
10
  import { ReactComponent as IconDisLike } from 'common/assets/icons/icon_dislike.svg';
11
11
  import { ReactComponent as IconLike } from 'common/assets/icons/icon_like.svg';
12
+ import { ReactComponent as IconSettings } from 'common/assets/icons/settings.svg';
13
+
12
14
  import { AppState } from 'types';
13
15
  import { useAppSelector } from 'Store/Store';
14
16
  import { prepareImageList } from '../helpers/CommonHelper';
@@ -76,6 +78,13 @@ function ProductDetailView(props: Props) {
76
78
  settings.field?.ctaLinkField ? settings.field?.ctaLinkField : 'links.main',
77
79
  );
78
80
 
81
+ const secondaryCTALink = get(
82
+ dataItem,
83
+ settings.field?.secondaryCTALinkField
84
+ ? settings.field?.secondaryCTALinkField
85
+ : '',
86
+ );
87
+
79
88
  useEffect(() => {
80
89
  if (dataItem) {
81
90
  checkDataItemResult(dataItem);
@@ -446,6 +455,51 @@ function ProductDetailView(props: Props) {
446
455
  backgroundColor: '#F3F3F5',
447
456
  }}
448
457
  >
458
+ {settings.secondaryCTAButtonText && (
459
+ <Box
460
+ style={{
461
+ background: '#2B2C46',
462
+ boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
463
+ borderRadius: 4,
464
+ marginTop: 8,
465
+ }}
466
+ display={'flex'}
467
+ justifyContent={'space-between'}
468
+ alignItems={'center'}
469
+ className="btn-detail-item"
470
+ >
471
+ <Box
472
+ style={{
473
+ display: 'flex',
474
+ justifyContent: 'space-between',
475
+ alignItems: 'center',
476
+ width: '100%',
477
+ padding: '0px 12px',
478
+ minHeight: 64,
479
+ cursor: secondaryCTALink ? 'pointer' : 'normal',
480
+ }}
481
+ onClick={() => {
482
+ if (secondaryCTALink) {
483
+ window.open(`${secondaryCTALink}`, '_blank');
484
+ }
485
+ }}
486
+ >
487
+ <Typography
488
+ className="text-f18 fw-700 text-white max-line-2"
489
+ align="left"
490
+ style={{
491
+ letterSpacing: '0.55px',
492
+ maxWidth: '500px',
493
+ paddingRight: '4px',
494
+ }}
495
+ >
496
+ {settings.secondaryCTAButtonText}
497
+ </Typography>
498
+ {secondaryCTALink && <IconSettings color="white" />}
499
+ </Box>
500
+ </Box>
501
+ )}
502
+
449
503
  <Box
450
504
  style={{
451
505
  background: settings.theme?.primaryColor,
@@ -496,6 +550,7 @@ function ProductDetailView(props: Props) {
496
550
  )}
497
551
  </Box>
498
552
  </Box>
553
+
499
554
  {productDetails && (
500
555
  <Box className="w-100">
501
556
  <Button
@@ -102,7 +102,6 @@ function SidePanel({
102
102
  <Preview
103
103
  key={requestImage?.id}
104
104
  onSelectionChange={(r: RectCoords) => {
105
- setImageSelection(r);
106
105
  debouncedOnImageSelectionChange(r);
107
106
  }}
108
107
  image={requestImage?.canvas}
@@ -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';
@@ -115,6 +116,13 @@ function ItemResult(props: Props) {
115
116
  dataItem,
116
117
  settings.field?.ctaLinkField ? settings.field?.ctaLinkField : 'links.main',
117
118
  );
119
+ const secondaryCTALink = get(
120
+ dataItem,
121
+ settings.field?.secondaryCTALinkField
122
+ ? settings.field?.secondaryCTALinkField
123
+ : '',
124
+ );
125
+
118
126
  const manufacturerNumber = get(dataItem, settings.field.manufacturerNumber);
119
127
  return (
120
128
  <Box className="wrap-main-item-result">
@@ -234,7 +242,7 @@ function ItemResult(props: Props) {
234
242
  justifyContent={'space-between'}
235
243
  flexDirection={'column'}
236
244
  style={{ color: '#2B2C46' }}
237
- gridGap={8}
245
+ gridGap={6}
238
246
  >
239
247
  {settings.CTAButtonText && (
240
248
  <Typography
@@ -251,7 +259,10 @@ function ItemResult(props: Props) {
251
259
  display="flex"
252
260
  justifyContent={'space-between'}
253
261
  flexDirection={'row'}
254
- style={{ color: '#2B2C46', marginTop: 8 }}
262
+ style={{
263
+ color: '#2B2C46',
264
+ marginTop: !settings.CTAButtonText ? 8 : -6,
265
+ }}
255
266
  gridGap={8}
256
267
  >
257
268
  <Tooltip
@@ -361,6 +372,59 @@ function ItemResult(props: Props) {
361
372
  </Box>
362
373
  )}
363
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
+ )}
364
428
  {!settings.CTAButtonText ? (
365
429
  <Tooltip
366
430
  title={dataItem[settings.field.productName]}
@@ -300,10 +300,11 @@ function ResultComponent(props: Props) {
300
300
 
301
301
  const debouncedOnImageSelectionChange = useCallback(
302
302
  debounce((r: RectCoords) => {
303
+ setImageSelection(r);
303
304
  feedbackRegionEpic(stateGlobal, r);
304
305
  dispatch(selectionChanged(r));
305
306
  findItemsInSelection(r);
306
- }, 500),
307
+ }, 50),
307
308
  [findItemsInSelection, stateGlobal.search],
308
309
  );
309
310
 
@@ -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
  }
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;
@@ -54,6 +55,7 @@ export interface AppSettings extends NyrisAPISettings {
54
55
  brandName?: string;
55
56
  cadenas?: Cadenas;
56
57
  CTAButtonText?: string;
58
+ secondaryCTAButtonText?: string;
57
59
  field: Field;
58
60
  headerText?: string;
59
61
  instantRedirectPatterns: string[];