@nyris/nyris-webapp 0.3.23 → 0.3.25

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 (117) hide show
  1. package/README.md +1 -1
  2. package/build/asset-manifest.json +12 -18
  3. package/build/index.html +1 -1
  4. package/build/{precache-manifest.550e76235499efc131a68c80392f6bfc.js → precache-manifest.3eed67031bd288eaf7ff98cd02aef6d7.js} +11 -35
  5. package/build/service-worker.js +1 -1
  6. package/build/static/css/main.0d30f026.chunk.css +2 -0
  7. package/build/static/css/main.0d30f026.chunk.css.map +1 -0
  8. package/build/static/js/2.ad8c5320.chunk.js +3 -0
  9. package/build/static/js/{2.f0507df9.chunk.js.LICENSE.txt → 2.ad8c5320.chunk.js.LICENSE.txt} +0 -15
  10. package/build/static/js/2.ad8c5320.chunk.js.map +1 -0
  11. package/build/static/js/main.7c54ad4d.chunk.js +3 -0
  12. package/build/static/js/main.7c54ad4d.chunk.js.map +1 -0
  13. package/package.json +5 -3
  14. package/src/App.tsx +24 -15
  15. package/src/Router.tsx +6 -41
  16. package/src/Store/Store.ts +14 -23
  17. package/src/Store/{Auth.ts → auth/Auth.ts} +6 -17
  18. package/src/Store/auth/types.ts +11 -0
  19. package/src/Store/constants.ts +21 -0
  20. package/src/Store/nyris/Nyris.ts +67 -0
  21. package/src/Store/nyris/types.ts +11 -0
  22. package/src/Store/{Search.ts → search/Search.ts} +3 -63
  23. package/src/Store/search/search.initialState.ts +28 -0
  24. package/src/Store/search/types.ts +34 -0
  25. package/src/components/DetailItem.tsx +29 -25
  26. package/src/components/DragDropFile.tsx +8 -3
  27. package/src/components/Feedback.tsx +11 -14
  28. package/src/components/FooterMobile.tsx +3 -51
  29. package/src/components/FooterResult.tsx +1 -1
  30. package/src/components/Header.tsx +29 -30
  31. package/src/components/HeaderMobile.tsx +14 -21
  32. package/src/components/Layout.tsx +11 -27
  33. package/src/components/PanelResult/index.tsx +1 -1
  34. package/src/components/{LoadingScreen → ProductList}/index.tsx +3 -3
  35. package/src/components/appMobile.scss +2 -21
  36. package/src/components/carousel/ImagePreviewCarousel.tsx +2 -1
  37. package/src/components/clear-refinements/clear-refinements.tsx +1 -1
  38. package/src/components/common.scss +2 -0
  39. package/src/components/drawer/cameraCustom.tsx +7 -14
  40. package/src/components/input/inputSearch.tsx +9 -8
  41. package/src/components/pre-filter/{desktop/index.tsx → index.tsx} +5 -5
  42. package/src/components/results/ItemResult.tsx +40 -34
  43. package/src/constants.ts +12 -0
  44. package/src/hooks/useVisualSearch.tsx +2 -2
  45. package/src/i18n.ts +10 -0
  46. package/src/index.css +13 -0
  47. package/src/index.tsx +0 -20
  48. package/src/{modules/LandingPage/indexNewVersion.tsx → page/landingPage/AppMD.tsx} +2 -4
  49. package/src/{modules/LandingPage → page/landingPage}/AppMobile.tsx +4 -5
  50. package/src/{modules/LandingPage → page/landingPage}/common.scss +2 -8
  51. package/src/page/result/index.tsx +8 -10
  52. package/src/services/Feedback.ts +48 -71
  53. package/src/services/{filter.tsx → filter.ts} +1 -1
  54. package/src/services/types.ts +30 -39
  55. package/src/translations.ts +22 -0
  56. package/src/types.ts +13 -66
  57. package/build/js/test.js +0 -84
  58. package/build/static/css/main.c956b74c.chunk.css +0 -2
  59. package/build/static/css/main.c956b74c.chunk.css.map +0 -1
  60. package/build/static/js/2.f0507df9.chunk.js +0 -3
  61. package/build/static/js/2.f0507df9.chunk.js.map +0 -1
  62. package/build/static/js/main.247c7b7e.chunk.js +0 -3
  63. package/build/static/js/main.247c7b7e.chunk.js.map +0 -1
  64. package/build/static/media/Rectangle.4dd8b747.png +0 -0
  65. package/build/static/media/icon_company.2b2a0a61.svg +0 -3
  66. package/build/static/media/icon_email.132d632b.svg +0 -3
  67. package/build/static/media/icon_phone.09335da9.svg +0 -3
  68. package/build/static/media/icon_textArea.f6d78b61.svg +0 -3
  69. package/build/static/media/icon_users.2013c76e.svg +0 -3
  70. package/public/js/test.js +0 -84
  71. package/src/App.css +0 -65
  72. package/src/Store/Nyris.ts +0 -77
  73. package/src/components/AppContainer.tsx +0 -126
  74. package/src/components/CategoryFilter.tsx +0 -17
  75. package/src/components/Codes.tsx +0 -20
  76. package/src/components/CustomHits/index.tsx +0 -47
  77. package/src/components/Footer.tsx +0 -96
  78. package/src/components/FooterMD.tsx +0 -54
  79. package/src/components/FooterNewVersion.tsx +0 -12
  80. package/src/components/HeaderMd.tsx +0 -38
  81. package/src/components/HeaderNewVersion.tsx +0 -112
  82. package/src/components/Navigation.tsx +0 -34
  83. package/src/components/PredictedCategories.tsx +0 -14
  84. package/src/components/Refine.tsx +0 -28
  85. package/src/components/RelevantSort.tsx +0 -12
  86. package/src/components/Result.tsx +0 -210
  87. package/src/components/Saved/AllItem.tsx +0 -32
  88. package/src/components/Saved/Category.tsx +0 -16
  89. package/src/components/auto-complete/basic.tsx +0 -153
  90. package/src/components/autocomplete/plugins/popular-searches/popular-searches.css +0 -3
  91. package/src/components/autocomplete/plugins/popular-searches/popular-searches.tsx +0 -75
  92. package/src/components/button/clear-fillter.tsx +0 -30
  93. package/src/components/camera/screenshot.tsx +0 -33
  94. package/src/components/count/count.tsx +0 -20
  95. package/src/components/hitItem/hits.tsx +0 -50
  96. package/src/components/hitItem/infinitiHits.tsx +0 -33
  97. package/src/components/icon/icon.tsx +0 -13
  98. package/src/components/icon_textArea.svg +0 -3
  99. package/src/components/refinement-list/index.tsx +0 -42
  100. package/src/components/results/pagination.tsx +0 -34
  101. package/src/components/search/ListSearch.tsx +0 -209
  102. package/src/defaults.ts +0 -37
  103. package/src/modules/LandingPage/App.tsx +0 -318
  104. package/src/modules/LandingPage/AppMD.tsx +0 -399
  105. package/src/modules/LandingPage/index.tsx +0 -186
  106. package/src/modules/LandingPage/propsType.ts +0 -43
  107. package/src/page/Auth/login.tsx +0 -7
  108. package/src/page/Exception/404.tsx +0 -11
  109. package/src/page/History/index.tsx +0 -76
  110. package/src/page/Profile/index.tsx +0 -140
  111. package/src/page/ResultMobile/index.tsx +0 -12
  112. package/src/page/Saved/MockData.ts +0 -223
  113. package/src/page/Saved/index.tsx +0 -166
  114. package/src/page/Support/MockData.ts +0 -45
  115. package/src/page/Support/index.tsx +0 -492
  116. package/src/page/result/MockData.ts +0 -50
  117. /package/build/static/js/{main.247c7b7e.chunk.js.LICENSE.txt → main.7c54ad4d.chunk.js.LICENSE.txt} +0 -0
@@ -1,88 +1,65 @@
1
- import NyrisAPI, {FeedbackEventPayload, NyrisAPISettings, RectCoords,} from '@nyris/nyris-api';
2
- import {RootState} from '../Store/Store';
3
- import {ToastHelper} from "../helpers/ToastHelper";
1
+ import NyrisAPI, {
2
+ FeedbackEventPayload,
3
+ NyrisAPISettings,
4
+ RectCoords,
5
+ } from '@nyris/nyris-api';
6
+ import { RootState } from '../Store/Store';
7
+ import { ToastHelper } from '../helpers/ToastHelper';
4
8
 
5
9
  export const feedbackSuccessEpic = async (
6
- state: RootState,
7
- success: boolean,
10
+ state: RootState,
11
+ success: boolean,
8
12
  ) => {
9
- const {search, settings} = state;
10
- const sessionId = search.sessionId;
11
- const requestId = search.requestId || search.sessionId;
13
+ const { search, settings } = state;
14
+ const sessionId = search.sessionId;
15
+ const requestId = search.requestId || search.sessionId;
12
16
 
13
- try {
14
- const res = await sendFeedbackByApi(settings, sessionId, requestId, {
15
- event: 'feedback',
16
- data: {success},
17
- });
18
- ToastHelper.success('Thank you for your feedback.');
19
- return res;
20
- } catch (err: any) {
21
- console.log(err)
22
- }
17
+ try {
18
+ const res = await sendFeedbackByApi(settings, sessionId, requestId, {
19
+ event: 'feedback',
20
+ data: { success },
21
+ });
22
+ ToastHelper.success('Thank you for your feedback.');
23
+ return res;
24
+ } catch (err: any) {
25
+ console.log(err);
26
+ }
23
27
  };
24
28
 
25
29
  export const feedbackClickEpic = async (state: RootState, position: number) => {
26
- const {search, settings} = state;
27
- return await sendFeedbackByApi(settings, search.sessionId, search.requestId, {
28
- event: 'click',
29
- data: {positions: [position]},
30
- });
30
+ const { search, settings } = state;
31
+ return await sendFeedbackByApi(settings, search.sessionId, search.requestId, {
32
+ event: 'click',
33
+ data: { positions: [position] },
34
+ });
31
35
  };
32
36
 
33
- // export const feedbackTextSearchEpic = async (
34
- // state: RootState,
35
- // query: string,
36
- // page: number,
37
- // productIds: string[],
38
- // ) => {
39
- // try {
40
- // const { search, settings } = state;
41
- // const eventData = {
42
- // query,
43
- // page,
44
- // product_ids: productIds,
45
- // };
46
- // const textSearchEvent = { event: 'text-search', data: eventData };
47
- // // @ts-ignore
48
- // return await sendFeedbackByApi(
49
- // settings,
50
- // search.sessionId,
51
- // search.requestId,
52
- // textSearchEvent,
53
- // );
54
- // } catch (error) {
55
- // console.log('error feedbackTextSearchEpic', error);
56
- // }
57
- // };
58
-
59
37
  export const feedbackRegionEpic = async (
60
- state: RootState,
61
- region: RectCoords,
38
+ state: RootState,
39
+ region: RectCoords,
62
40
  ) => {
63
- const {settings, search} = state;
64
- const {sessionId, requestId} = search;
65
- const {x1, x2, y1, y2} = region;
66
- const payload: FeedbackEventPayload = {
67
- event: 'region',
68
- data: {rect: {x: x1, y: y1, w: x2 - x1, h: y2 - y1}},
69
- };
70
- return await sendFeedbackByApi(settings, sessionId, requestId, payload);
41
+ const { settings, search } = state;
42
+ const { sessionId, requestId } = search;
43
+ const { x1, x2, y1, y2 } = region;
44
+ const payload: FeedbackEventPayload = {
45
+ event: 'region',
46
+ data: { rect: { x: x1, y: y1, w: x2 - x1, h: y2 - y1 } },
47
+ };
48
+ return await sendFeedbackByApi(settings, sessionId, requestId, payload);
71
49
  };
72
50
 
73
51
  export const sendFeedbackByApi = async (
74
- settings: NyrisAPISettings,
75
- sessionId: string | undefined,
76
- requestId: string | undefined,
77
- payload: FeedbackEventPayload,
52
+ settings: NyrisAPISettings,
53
+ sessionId: string | undefined,
54
+ requestId: string | undefined,
55
+ payload: FeedbackEventPayload,
78
56
  ) => {
79
- const api = new NyrisAPI(settings);
80
- if (sessionId && requestId) {
81
- try {
82
- await api.sendFeedback(sessionId, requestId, payload).then(res => {
83
- });
84
- } catch (error) {
85
- console.log('error sendFeedbackByApi321', error);
86
- }
57
+ const api = new NyrisAPI(settings);
58
+ if (sessionId && requestId) {
59
+ try {
60
+ await api.sendFeedback(sessionId, requestId, payload).then(res => {});
61
+ } catch (error) {
62
+ console.log('error sendFeedbackByApi321', error);
87
63
  }
64
+ }
88
65
  };
@@ -14,7 +14,7 @@ export const getFilters = async (
14
14
  };
15
15
 
16
16
  export const searchFilters = async (
17
- key: any = 'machineType',
17
+ key: any = '',
18
18
  value: string,
19
19
  settingsNyris: NyrisAPISettings,
20
20
  ) => {
@@ -1,50 +1,41 @@
1
- // import {SearchAction, SearchState} from "./actions/searchActions";
2
- // import {NyrisAction, NyrisAppState} from "./actions/nyrisAppActions";
3
-
4
-
5
- import {MDSettings} from "../types";
6
-
7
1
  export interface SearchServiceSettings {
8
- xOptions: boolean | string,
9
- customSearchRequest?: ((file: Blob, client: any) => Promise<any>),
10
- responseHook?: ((response: any) => any),
11
- apiKey: string,
12
- imageMatchingUrl?: string,
13
- imageMatchingUrlBySku?: string,
14
- imageMatchingSubmitManualUrl?: string,
15
- regionProposalUrl?: string,
16
- responseFormat?: string,
17
- feedbackUrl?: string,
18
- exampleImages: string[],
19
- resultTemplate?: string,
20
- noImageUrl?: string,
21
- materialDesign?: MDSettings,
22
- preview: boolean,
23
- regions: boolean,
24
- jpegQuality: number,
25
- maxWidth: number,
26
- maxHeight: number,
27
- useRecommendations: boolean
2
+ xOptions: boolean | string;
3
+ customSearchRequest?: (file: Blob, client: any) => Promise<any>;
4
+ responseHook?: (response: any) => any;
5
+ apiKey: string;
6
+ imageMatchingUrl?: string;
7
+ imageMatchingUrlBySku?: string;
8
+ imageMatchingSubmitManualUrl?: string;
9
+ regionProposalUrl?: string;
10
+ responseFormat?: string;
11
+ feedbackUrl?: string;
12
+ exampleImages: string[];
13
+ noImageUrl?: string;
14
+ preview: boolean;
15
+ regions: boolean;
16
+ jpegQuality: number;
17
+ maxWidth: number;
18
+ maxHeight: number;
28
19
  }
29
20
 
30
21
  export interface Crop {
31
- x: number,
32
- y: number,
33
- w: number,
34
- h: number
22
+ x: number;
23
+ y: number;
24
+ w: number;
25
+ h: number;
35
26
  }
36
27
 
37
28
  export interface WH {
38
- w: number,
39
- h: number
29
+ w: number;
30
+ h: number;
40
31
  }
41
32
 
42
33
  export interface Result {
43
- position: number,
44
- sku?: string,
45
- title?: string,
46
- l?: string,
47
- img?: { url?: string },
48
- // There can be also any other data
49
- [x: string]: any
34
+ position: number;
35
+ sku?: string;
36
+ title?: string;
37
+ l?: string;
38
+ img?: { url?: string };
39
+ // There can be also any other data
40
+ [x: string]: any;
50
41
  }
@@ -0,0 +1,22 @@
1
+ export const translations = {
2
+ en: {
3
+ translation: {
4
+ Search: 'Search',
5
+ 'Choose an image': 'Choose an image',
6
+ 'or drag it here': 'or drag it here',
7
+ 'Manufacturer Number': 'Manufacturer Number',
8
+ 'Close group': 'Close group',
9
+ 'Show group': 'Show group',
10
+ },
11
+ },
12
+ de: {
13
+ translation: {
14
+ Search: 'Suche',
15
+ 'Choose an image': 'Bild wählen',
16
+ 'or drag it here': 'oder hierhin ziehen',
17
+ 'Manufacturer Number': 'Herst. Teile-Nr.',
18
+ 'Close group': 'Schließe Gruppe',
19
+ 'Show group': 'Zeige Gruppe',
20
+ },
21
+ },
22
+ };
package/src/types.ts CHANGED
@@ -1,22 +1,6 @@
1
1
  import { NyrisAPISettings } from '@nyris/nyris-api';
2
- import { NyrisAppState } from 'Store/Nyris';
3
- import { SearchState } from 'Store/Search';
4
-
5
- export interface MDSettings {
6
- customFontFamily?: string;
7
- appBarLogoUrl: string;
8
- appBarTitle: string;
9
- appBarCustomBackgroundColor?: string;
10
- appBarCustomTextColor?: string;
11
- primaryColor: string;
12
- secondaryColor: string;
13
- resultFirstRowProperty: string;
14
- resultSecondRowProperty: string;
15
-
16
- resultLinkText?: string;
17
- resultLinkIcon?: string;
18
- active?: boolean;
19
- }
2
+ import { NyrisAppState } from 'Store/nyris/types';
3
+ import { SearchState } from 'Store/search/types';
20
4
 
21
5
  export interface AlgoliaSettings {
22
6
  apiKey: string;
@@ -29,10 +13,9 @@ export interface AppSettings extends NyrisAPISettings {
29
13
  preview: boolean;
30
14
  cadSearch?: boolean;
31
15
  noImageUrl?: string;
32
- resultTemplate?: string;
33
16
  regions: boolean;
34
17
  instantRedirectPatterns: string[];
35
- themePage: ThemeChoice;
18
+ theme: SearchSuiteSettings;
36
19
  algolia?: AlgoliaSettings;
37
20
  productCtaText?: string;
38
21
  appTitle?: string;
@@ -47,28 +30,19 @@ export interface AppSettings extends NyrisAPISettings {
47
30
  alogoliaFilterField?: string;
48
31
  headerText?: string;
49
32
  brandName?: string;
50
- }
51
-
52
- export interface DefaultThemeSettings {
53
- active: boolean;
33
+ shareOption?: boolean;
34
+ language?: string;
35
+ itemIdLabel?: string;
54
36
  }
55
37
 
56
38
  export interface SearchSuiteSettings {
57
- active?: boolean;
58
- appBarLogoUrl: string;
59
- appBarLogoUrlAlt: string;
60
- headerColor: string;
61
- logoWidth: string;
62
- logoHeight: string;
63
- mobileFooterImageColor: string;
64
- primaryColor: string;
65
- secondaryColor: string;
66
- }
67
-
68
- export interface ThemeChoice {
69
- default?: DefaultThemeSettings;
70
- materialDesign?: MDSettings;
71
- searchSuite?: SearchSuiteSettings;
39
+ appBarLogoUrl?: string;
40
+ headerColor?: string;
41
+ logoWidth?: string;
42
+ logoHeight?: string;
43
+ mobileFooterImageColor?: string;
44
+ primaryColor?: string;
45
+ secondaryColor?: string;
72
46
  }
73
47
 
74
48
  export type AppState = {
@@ -81,30 +55,3 @@ export interface CanvasWithId {
81
55
  canvas: HTMLCanvasElement;
82
56
  id: string;
83
57
  }
84
-
85
- export interface SearchServiceSettings {
86
- xOptions: boolean | string;
87
- customSearchRequest?: (file: Blob, client: any) => Promise<any>;
88
- responseHook?: (response: any) => any;
89
- apiKey: string;
90
- imageMatchingUrl?: string;
91
- imageMatchingUrlBySku?: string;
92
- imageMatchingSubmitManualUrl?: string;
93
- regionProposalUrl?: string;
94
- responseFormat?: string;
95
- feedbackUrl?: string;
96
- exampleImages: string[];
97
- resultTemplate?: string;
98
- noImageUrl?: string;
99
- materialDesign?: MDSettings;
100
- preview: boolean;
101
- regions: boolean;
102
- jpegQuality: number;
103
- maxWidth: number;
104
- maxHeight: number;
105
- useRecommendations: boolean;
106
- }
107
-
108
- export interface AlgoliaResult {
109
- sku: string;
110
- }
package/build/js/test.js DELETED
@@ -1,84 +0,0 @@
1
- var settings = {
2
- apiKey: 'ZKbb76cwHmBUoXR4uqwD5PqaJK3wobdZ',
3
- // apiKeyDMGMori: 'nlLoWoR4GqT1BVbdkYiVsp85oMokpzMS',
4
- maxWidth: 300,
5
- maxHeight: 300,
6
- jpegQuality: 0.9,
7
- regions: true,
8
- preview: true,
9
- useRecommendations: false,
10
- xOptions:
11
- 'default +estimated-category similarity.threshold=0.05 similarity.threshold.discard=0.05 exact.threshold.perfect=200 similarity.threshold.perfect=2 scoring.indicative-min-hits=1 scoring.promo-min-hits=20 scoring.interpolation-cutoff=0 +barcode +barcode-detection',
12
- baseUrl: 'https://api.i.nyris.io',
13
- resultTemplate: 'default',
14
- responseFormat: 'application/offers.complete+json',
15
- exampleImages: [
16
- 'https://storage.googleapis.com/nyris/share/examples_search/example_1.jpg',
17
- 'https://storage.googleapis.com/nyris/share/examples_search/example_2.jpg',
18
- 'https://storage.googleapis.com/nyris/share/examples_search/example_3.jpg',
19
- 'https://storage.googleapis.com/nyris/share/examples_search/example_4.jpg',
20
- ],
21
- deactivated: false,
22
- cadSearch: false,
23
- themePage: {
24
- default: {
25
- active: false,
26
- },
27
- materialDesign: {
28
- active: false,
29
- appBarLogoUrl: 'https://nyris.io/wp-content/themes/nyris/img/logo.svg',
30
- appBarTitle: '',
31
- appBarCustomBackgroundColor: 'black',
32
- appBarCustomTextColor: 'white',
33
-
34
- primaryColor: '#e31b5d',
35
- secondaryColor: '#ccc',
36
- resultFirstRowProperty: 'title',
37
- resultSecondRowProperty: 'price',
38
- resultLinkText: 'show',
39
- resultLinkIcon: 'eye',
40
- },
41
- searchSuite: {
42
- active: true,
43
- moreInfoText: 'more info',
44
- },
45
- },
46
- imageMatchingUrl: 'https://api.nyris.io/find/v1',
47
- imageMatchingUrlBySku: 'https://api.nyris.io/recommend/v1',
48
- imageMatchingSubmitManualUrl: 'https://api.nyris.io/find/v1/manual',
49
- regionProposalUrl: 'https://api.nyris.io/find/v1/regions',
50
- feedbackUrl: 'https://api.nyris.io/feedback/v1',
51
- algolia: {
52
- apiKey: '6d20d5463452614ea94aae323d8d038e',
53
- appId: 'HBDJYUK5G4',
54
- indexName: 'dmg-mori',
55
- },
56
- refinements: [
57
- {
58
- type: 'list',
59
- header: 'Brands',
60
- attribute: 'brand',
61
- },
62
- {
63
- type: 'list',
64
- header: 'Norm',
65
- attribute: 'keyword_0',
66
- options: {
67
- searchable: true,
68
- },
69
- },
70
- {
71
- type: 'list',
72
- header: 'Category',
73
- attribute: 'custom_category',
74
- },
75
- ],
76
- autocompleteSearchConfig: {
77
- placeholders: ['brand', 'keyword_0', 'custom_category'],
78
- debouncing: 800,
79
- detachedMediaQuery: '(max-width: 776px)',
80
- },
81
- visualSearchFilterKey: 'machineType',
82
- };
83
- settings['customSearchRequest'] = null;
84
- settings['responseHook'] = null;