@nyris/nyris-webapp 0.3.22 → 0.3.24
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/README.md +1 -1
- package/build/asset-manifest.json +12 -18
- package/build/index.html +1 -1
- package/build/{precache-manifest.6f6124db008881782a26c64db1f10264.js → precache-manifest.982b135daeb2c083ccf4eeeddf132bf3.js} +11 -35
- package/build/service-worker.js +1 -1
- package/build/static/css/{main.c956b74c.chunk.css → main.1e43a778.chunk.css} +2 -2
- package/build/static/css/main.1e43a778.chunk.css.map +1 -0
- package/build/static/js/2.fe9108d5.chunk.js +3 -0
- package/build/static/js/{2.a2732c2b.chunk.js.LICENSE.txt → 2.fe9108d5.chunk.js.LICENSE.txt} +0 -15
- package/build/static/js/2.fe9108d5.chunk.js.map +1 -0
- package/build/static/js/main.83cb88a3.chunk.js +3 -0
- package/build/static/js/main.83cb88a3.chunk.js.map +1 -0
- package/package.json +3 -3
- package/src/App.tsx +6 -14
- package/src/Router.tsx +6 -41
- package/src/Store/Store.ts +14 -23
- package/src/components/DetailItem.tsx +33 -22
- package/src/components/FooterMobile.tsx +3 -51
- package/src/components/FooterResult.tsx +1 -1
- package/src/components/HeaderMobile.tsx +13 -20
- package/src/components/HeaderNewVersion.tsx +5 -83
- package/src/components/Layout.tsx +3 -19
- package/src/components/PanelResult/index.tsx +1 -1
- package/src/components/clear-refinements/clear-refinements.tsx +1 -1
- package/src/components/drawer/cameraCustom.tsx +6 -12
- package/src/components/input/inputSearch.tsx +3 -3
- package/src/components/pre-filter/desktop/index.tsx +2 -2
- package/src/components/results/ItemResult.tsx +8 -8
- package/src/defaults.ts +19 -35
- package/src/helpers/CommonHelper.ts +10 -6
- package/src/hooks/useVisualSearch.tsx +1 -1
- package/src/index.css +13 -0
- package/src/index.tsx +0 -20
- package/src/modules/LandingPage/AppMD.tsx +59 -386
- package/src/modules/LandingPage/AppMobile.tsx +1 -1
- package/src/modules/LandingPage/propsType.ts +35 -37
- package/src/page/result/index.tsx +2 -2
- package/src/services/Feedback.ts +48 -71
- package/src/services/filter.tsx +1 -1
- package/src/services/types.ts +30 -39
- package/src/types.ts +8 -63
- package/build/js/test.js +0 -84
- package/build/static/css/main.c956b74c.chunk.css.map +0 -1
- package/build/static/js/2.a2732c2b.chunk.js +0 -3
- package/build/static/js/2.a2732c2b.chunk.js.map +0 -1
- package/build/static/js/main.93b05e17.chunk.js +0 -3
- package/build/static/js/main.93b05e17.chunk.js.map +0 -1
- package/build/static/media/Rectangle.4dd8b747.png +0 -0
- package/build/static/media/icon_company.2b2a0a61.svg +0 -3
- package/build/static/media/icon_email.132d632b.svg +0 -3
- package/build/static/media/icon_phone.09335da9.svg +0 -3
- package/build/static/media/icon_textArea.f6d78b61.svg +0 -3
- package/build/static/media/icon_users.2013c76e.svg +0 -3
- package/public/js/test.js +0 -84
- package/src/App.css +0 -65
- package/src/components/AppContainer.tsx +0 -126
- package/src/components/CategoryFilter.tsx +0 -17
- package/src/components/Codes.tsx +0 -20
- package/src/components/CustomHits/index.tsx +0 -47
- package/src/components/Footer.tsx +0 -96
- package/src/components/FooterMD.tsx +0 -54
- package/src/components/HeaderMd.tsx +0 -38
- package/src/components/Navigation.tsx +0 -34
- package/src/components/PredictedCategories.tsx +0 -14
- package/src/components/Refine.tsx +0 -28
- package/src/components/RelevantSort.tsx +0 -12
- package/src/components/Result.tsx +0 -210
- package/src/components/Saved/AllItem.tsx +0 -32
- package/src/components/Saved/Category.tsx +0 -16
- package/src/components/auto-complete/basic.tsx +0 -153
- package/src/components/autocomplete/plugins/popular-searches/popular-searches.css +0 -3
- package/src/components/autocomplete/plugins/popular-searches/popular-searches.tsx +0 -75
- package/src/components/button/clear-fillter.tsx +0 -30
- package/src/components/camera/screenshot.tsx +0 -33
- package/src/components/count/count.tsx +0 -20
- package/src/components/hitItem/hits.tsx +0 -50
- package/src/components/hitItem/infinitiHits.tsx +0 -33
- package/src/components/icon/icon.tsx +0 -13
- package/src/components/icon_textArea.svg +0 -3
- package/src/components/refinement-list/index.tsx +0 -42
- package/src/components/results/pagination.tsx +0 -34
- package/src/components/search/ListSearch.tsx +0 -209
- package/src/modules/LandingPage/App.tsx +0 -318
- package/src/modules/LandingPage/index.tsx +0 -186
- package/src/modules/LandingPage/indexNewVersion.tsx +0 -72
- package/src/page/Auth/login.tsx +0 -7
- package/src/page/Exception/404.tsx +0 -11
- package/src/page/History/index.tsx +0 -76
- package/src/page/Profile/index.tsx +0 -140
- package/src/page/ResultMobile/index.tsx +0 -12
- package/src/page/Saved/MockData.ts +0 -223
- package/src/page/Saved/index.tsx +0 -166
- package/src/page/Support/MockData.ts +0 -45
- package/src/page/Support/index.tsx +0 -492
- /package/build/static/js/{main.93b05e17.chunk.js.LICENSE.txt → main.83cb88a3.chunk.js.LICENSE.txt} +0 -0
package/src/services/Feedback.ts
CHANGED
|
@@ -1,88 +1,65 @@
|
|
|
1
|
-
import NyrisAPI, {
|
|
2
|
-
|
|
3
|
-
|
|
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
|
-
|
|
7
|
-
|
|
10
|
+
state: RootState,
|
|
11
|
+
success: boolean,
|
|
8
12
|
) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
13
|
+
const { search, settings } = state;
|
|
14
|
+
const sessionId = search.sessionId;
|
|
15
|
+
const requestId = search.requestId || search.sessionId;
|
|
12
16
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
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
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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
|
-
|
|
61
|
-
|
|
38
|
+
state: RootState,
|
|
39
|
+
region: RectCoords,
|
|
62
40
|
) => {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
52
|
+
settings: NyrisAPISettings,
|
|
53
|
+
sessionId: string | undefined,
|
|
54
|
+
requestId: string | undefined,
|
|
55
|
+
payload: FeedbackEventPayload,
|
|
78
56
|
) => {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
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
|
};
|
package/src/services/filter.tsx
CHANGED
package/src/services/types.ts
CHANGED
|
@@ -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
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
x: number;
|
|
23
|
+
y: number;
|
|
24
|
+
w: number;
|
|
25
|
+
h: number;
|
|
35
26
|
}
|
|
36
27
|
|
|
37
28
|
export interface WH {
|
|
38
|
-
|
|
39
|
-
|
|
29
|
+
w: number;
|
|
30
|
+
h: number;
|
|
40
31
|
}
|
|
41
32
|
|
|
42
33
|
export interface Result {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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
|
}
|
package/src/types.ts
CHANGED
|
@@ -2,22 +2,6 @@ import { NyrisAPISettings } from '@nyris/nyris-api';
|
|
|
2
2
|
import { NyrisAppState } from 'Store/Nyris';
|
|
3
3
|
import { SearchState } from 'Store/Search';
|
|
4
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
|
-
}
|
|
20
|
-
|
|
21
5
|
export interface AlgoliaSettings {
|
|
22
6
|
apiKey: string;
|
|
23
7
|
appId: 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
|
-
|
|
18
|
+
theme: SearchSuiteSettings;
|
|
36
19
|
algolia?: AlgoliaSettings;
|
|
37
20
|
productCtaText?: string;
|
|
38
21
|
appTitle?: string;
|
|
@@ -49,26 +32,15 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
49
32
|
brandName?: string;
|
|
50
33
|
}
|
|
51
34
|
|
|
52
|
-
export interface DefaultThemeSettings {
|
|
53
|
-
active: boolean;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
35
|
export interface SearchSuiteSettings {
|
|
57
36
|
active?: boolean;
|
|
58
|
-
appBarLogoUrl
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
secondaryColor: string;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
export interface ThemeChoice {
|
|
69
|
-
default?: DefaultThemeSettings;
|
|
70
|
-
materialDesign?: MDSettings;
|
|
71
|
-
searchSuite?: SearchSuiteSettings;
|
|
37
|
+
appBarLogoUrl?: string;
|
|
38
|
+
headerColor?: string;
|
|
39
|
+
logoWidth?: string;
|
|
40
|
+
logoHeight?: string;
|
|
41
|
+
mobileFooterImageColor?: string;
|
|
42
|
+
primaryColor?: string;
|
|
43
|
+
secondaryColor?: string;
|
|
72
44
|
}
|
|
73
45
|
|
|
74
46
|
export type AppState = {
|
|
@@ -81,30 +53,3 @@ export interface CanvasWithId {
|
|
|
81
53
|
canvas: HTMLCanvasElement;
|
|
82
54
|
id: string;
|
|
83
55
|
}
|
|
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;
|