@nyris/nyris-webapp 0.3.4 → 0.3.9
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 +18 -32
- package/build/index.html +1 -1
- package/build/{precache-manifest.9800bdc87f5a2c5d6d8a5d1a5287598f.js → precache-manifest.a97813497ab8d37548141e5e2618d0dc.js} +13 -89
- package/build/service-worker.js +1 -1
- package/build/static/css/2.43a1c8b7.chunk.css +2 -0
- package/build/static/css/2.43a1c8b7.chunk.css.map +1 -0
- package/build/static/css/main.0481043c.chunk.css +2 -0
- package/build/static/css/main.0481043c.chunk.css.map +1 -0
- package/build/static/js/2.6e13adbe.chunk.js +3 -0
- package/build/static/js/2.6e13adbe.chunk.js.LICENSE.txt +79 -0
- package/build/static/js/2.6e13adbe.chunk.js.map +1 -0
- package/build/static/js/main.f5da7aa4.chunk.js +2 -0
- package/build/static/js/main.f5da7aa4.chunk.js.map +1 -0
- package/build/static/js/{runtime-main.b418ff16.js → runtime-main.f5553a9b.js} +1 -1
- package/build/static/js/{runtime-main.b418ff16.js.map → runtime-main.f5553a9b.js.map} +1 -1
- package/package.json +7 -30
- package/src/App.css +64 -20
- package/src/App.test.tsx +49 -0
- package/src/App.tsx +242 -17
- package/src/AppMD.tsx +320 -0
- package/src/actions/nyrisAppActions.ts +76 -0
- package/src/actions/searchActions.ts +217 -0
- package/src/components/ExampleImages.tsx +17 -32
- package/src/components/Feedback.tsx +48 -87
- package/src/components/FiltersList.tsx +67 -0
- package/src/components/Header.tsx +17 -32
- package/src/components/Result.tsx +113 -186
- package/src/components/Sidebar.tsx +42 -0
- package/src/defaults.ts +3 -4
- package/src/epics/feedback.ts +59 -0
- package/src/epics/index.ts +154 -0
- package/src/epics/search.ts +164 -0
- package/src/epics/types.ts +12 -0
- package/src/{common/assets/fonts → fonts}/roboto-bold-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-bold-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-italic-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-italic-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-regular-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/roboto-regular-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bold-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bold-webfont.woff2 +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bolditalic-webfont.woff +0 -0
- package/src/{common/assets/fonts → fonts}/robotocondensed-bolditalic-webfont.woff2 +0 -0
- package/src/{common/assets/images → images}/fav/android-icon-192x192.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-114x114.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-120x120.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-144x144.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-152x152.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-180x180.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-57x57.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-60x60.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-72x72.png +0 -0
- package/src/{common/assets/images → images}/fav/apple-icon-76x76.png +0 -0
- package/src/{common/assets/images → images}/fav/browserconfig.xml +0 -0
- package/src/{common/assets/images → images}/fav/favicon-16x16.png +0 -0
- package/src/{common/assets/images → images}/fav/favicon-32x32.png +0 -0
- package/src/{common/assets/images → images}/fav/favicon-96x96.png +0 -0
- package/src/{common/assets/images → images}/fav/manifest.json +0 -0
- package/src/{common/assets/images → images}/ic_cam.png +0 -0
- package/src/{common/assets/images → images}/ic_cam.svg +0 -0
- package/src/{common/assets/images → images}/ic_cam_large.png +0 -0
- package/src/{common/assets/images → images}/ic_cam_large.svg +0 -0
- package/src/{common/assets/images → images}/ic_cam_large_noimage.png +0 -0
- package/src/{common/assets/images → images}/ic_close_feedback.png +0 -0
- package/src/{common/assets/images → images}/ic_close_feedback.svg +0 -0
- package/src/{common/assets/images → images}/ic_shopNow.png +0 -0
- package/src/{common/assets/images → images}/ic_shopNow.svg +0 -0
- package/src/{common/assets/images → images}/ic_shopNowLight.png +0 -0
- package/src/{common/assets/images → images}/ic_shopNowLight.svg +0 -0
- package/src/{common/assets/images → images}/nyris_logo.png +0 -0
- package/src/{common/assets/images → images}/rewe.svg +0 -0
- package/src/{common/assets/images → images}/sectionTransBack.png +0 -0
- package/src/{common/assets/images → images}/sectionTransBack.svg +0 -0
- package/src/{common/assets/images → images}/sectionTransTop.png +0 -0
- package/src/{common/assets/images → images}/sectionTransTop.svg +0 -0
- package/src/index.css +415 -572
- package/src/index.tsx +191 -39
- package/src/types.ts +3 -42
- package/tsconfig.json +8 -3
- package/build/js/settings.example.js +0 -31
- package/build/js/test.js +0 -56
- package/build/static/css/2.8285176a.chunk.css +0 -2
- package/build/static/css/2.8285176a.chunk.css.map +0 -1
- package/build/static/css/main.6676fe1f.chunk.css +0 -2
- package/build/static/css/main.6676fe1f.chunk.css.map +0 -1
- package/build/static/js/2.29ddd567.chunk.js +0 -3
- package/build/static/js/2.29ddd567.chunk.js.LICENSE.txt +0 -124
- package/build/static/js/2.29ddd567.chunk.js.map +0 -1
- package/build/static/js/main.c35ded37.chunk.js +0 -2
- package/build/static/js/main.c35ded37.chunk.js.map +0 -1
- package/build/static/media/Fill.37094b44.svg +0 -3
- package/build/static/media/Montserrat-Bold.5a052e98.otf +0 -0
- package/build/static/media/Montserrat-Light.21789e89.otf +0 -0
- package/build/static/media/Montserrat-Medium.a53e0373.otf +0 -0
- package/build/static/media/Montserrat-Regular.71cdc681.otf +0 -0
- package/build/static/media/Montserrat-SemiBold.f613d915.otf +0 -0
- package/build/static/media/Rectangle.4dd8b747.png +0 -0
- package/build/static/media/admin.9529c7f6.svg +0 -3
- package/build/static/media/bg-support-page.6ac55268.svg +0 -9
- package/build/static/media/book_mark.8e294c0b.svg +0 -3
- package/build/static/media/icon_dislike.94607ca6.svg +0 -3
- package/build/static/media/icon_like.a4fb1b18.svg +0 -3
- package/build/static/media/icon_modal_image.3068d0ea.svg +0 -21
- package/build/static/media/icon_search_image.c2c728c0.svg +0 -3
- package/build/static/media/nyris_logo.22d8f250.svg +0 -3
- package/build/static/media/reload_icon.4b579a74.svg +0 -3
- package/build/static/media/save_search.bebaeebf.svg +0 -3
- package/build/static/media/support.289c3a3c.svg +0 -3
- package/build/static/media/translate_icon.f0492297.svg +0 -3
- package/public/js/settings.example.js +0 -31
- package/public/js/test.js +0 -56
- package/src/Router.tsx +0 -97
- package/src/Store/Auth.ts +0 -44
- package/src/Store/Nyris.ts +0 -77
- package/src/Store/Search.ts +0 -270
- package/src/Store/Store.ts +0 -53
- package/src/Store/common.d.ts +0 -10
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Bold.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Light.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Medium.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-Regular.otf +0 -0
- package/src/common/assets/fonts/Montserrat_OTF/Montserrat-SemiBold.otf +0 -0
- package/src/common/assets/icons/Fill.png +0 -0
- package/src/common/assets/icons/Fill.svg +0 -3
- package/src/common/assets/icons/Icon_wechat.png +0 -0
- package/src/common/assets/icons/Icon_whatsapp.png +0 -0
- package/src/common/assets/icons/admin.png +0 -0
- package/src/common/assets/icons/admin.svg +0 -3
- package/src/common/assets/icons/book_mark.png +0 -0
- package/src/common/assets/icons/book_mark.svg +0 -3
- package/src/common/assets/icons/icon_barcode.png +0 -0
- package/src/common/assets/icons/icon_camera.png +0 -0
- package/src/common/assets/icons/icon_dislike.svg +0 -3
- package/src/common/assets/icons/icon_disslike.png +0 -0
- package/src/common/assets/icons/icon_email.png +0 -0
- package/src/common/assets/icons/icon_like.png +0 -0
- package/src/common/assets/icons/icon_like.svg +0 -3
- package/src/common/assets/icons/icon_modal_image.png +0 -0
- package/src/common/assets/icons/icon_modal_image.svg +0 -21
- package/src/common/assets/icons/icon_picture.png +0 -0
- package/src/common/assets/icons/icon_search_image.png +0 -0
- package/src/common/assets/icons/icon_search_image.svg +0 -3
- package/src/common/assets/icons/nyris_logo.svg +0 -3
- package/src/common/assets/icons/reload_icon.png +0 -0
- package/src/common/assets/icons/reload_icon.svg +0 -3
- package/src/common/assets/icons/save_search.png +0 -0
- package/src/common/assets/icons/save_search.svg +0 -3
- package/src/common/assets/icons/setting_search_icon.png +0 -0
- package/src/common/assets/icons/support.png +0 -0
- package/src/common/assets/icons/support.svg +0 -3
- package/src/common/assets/icons/translate_icon.png +0 -0
- package/src/common/assets/icons/translate_icon.svg +0 -3
- package/src/common/assets/icons/view_off.png +0 -0
- package/src/common/assets/images/Rectangle.png +0 -0
- package/src/common/assets/images/bg-support-page.svg +0 -9
- package/src/common/assets/images/image_test.png +0 -0
- package/src/components/CustomHits/index.tsx +0 -57
- package/src/components/DetailItem.tsx +0 -175
- package/src/components/DragDropFile.tsx +0 -188
- package/src/components/FilterComponent.tsx +0 -33
- package/src/components/Footer.tsx +0 -29
- package/src/components/FooterMD.tsx +0 -54
- package/src/components/FooterNewVersion.tsx +0 -12
- package/src/components/FooterResult.tsx +0 -47
- package/src/components/HeaderMd.tsx +0 -38
- package/src/components/HeaderNewVersion.tsx +0 -92
- package/src/components/Layout.tsx +0 -46
- package/src/components/LoadingScreen/index.tsx +0 -29
- package/src/components/Navigation.tsx +0 -34
- package/src/components/Panigation/Pagination.tsx +0 -140
- package/src/components/Panigation/cx.js +0 -3
- package/src/components/Panigation/isModifierClick.js +0 -10
- package/src/components/Saved/AllItem.tsx +0 -32
- package/src/components/Saved/Category.tsx +0 -16
- package/src/components/carousel/DefaultCarousel.tsx +0 -48
- package/src/components/common.d.ts +0 -9
- package/src/components/common.scss +0 -54
- package/src/components/default-select.tsx +0 -44
- package/src/components/hitItem/hits.tsx +0 -50
- package/src/components/hitItem/infinitiHits.tsx +0 -33
- package/src/components/input/inputSearch.tsx +0 -77
- package/src/components/modal/DefaultModal.tsx +0 -28
- package/src/components/results/ItemResult.tsx +0 -155
- package/src/components/search/ListSearch.tsx +0 -209
- package/src/modules/LandingPage/App.tsx +0 -318
- package/src/modules/LandingPage/AppMD.tsx +0 -399
- package/src/modules/LandingPage/common.scss +0 -1304
- package/src/modules/LandingPage/index.tsx +0 -193
- package/src/modules/LandingPage/indexNewVersion.tsx +0 -110
- package/src/modules/LandingPage/propsType.ts +0 -43
- 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 -87
- package/src/page/Saved/MockData.ts +0 -223
- package/src/page/Saved/index.tsx +0 -166
- package/src/page/Support/index.tsx +0 -160
- package/src/page/result/MockData.ts +0 -36
- package/src/page/result/index.tsx +0 -468
- package/src/services/Feedback.ts +0 -65
- package/src/services/findByImage.ts +0 -24
- package/src/services/findRegionsCustom.ts +0 -15
- package/src/services/image.ts +0 -107
- package/src/services/nyris.ts +0 -123
- package/src/services/session.ts +0 -20
- package/src/services/types.ts +0 -82
package/src/services/nyris.ts
DELETED
|
@@ -1,123 +0,0 @@
|
|
|
1
|
-
import loadImage from "blueimp-load-image";
|
|
2
|
-
import { Crop, WH } from "./types";
|
|
3
|
-
|
|
4
|
-
export function getElementSize(
|
|
5
|
-
elem: HTMLImageElement | HTMLVideoElement | HTMLCanvasElement
|
|
6
|
-
) {
|
|
7
|
-
const img = elem as HTMLImageElement;
|
|
8
|
-
const video = elem as HTMLVideoElement;
|
|
9
|
-
return [
|
|
10
|
-
img.naturalWidth || video.videoWidth || elem.width,
|
|
11
|
-
img.naturalHeight || video.videoHeight || elem.height,
|
|
12
|
-
];
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export function getThumbSizeArea(
|
|
16
|
-
maxWidth: number,
|
|
17
|
-
maxHeight: number,
|
|
18
|
-
originalWidth: number,
|
|
19
|
-
originalHeight: number
|
|
20
|
-
): WH {
|
|
21
|
-
const targetArea = maxWidth * maxHeight;
|
|
22
|
-
|
|
23
|
-
const aspectRatio = originalWidth / originalHeight;
|
|
24
|
-
const width = Math.sqrt(targetArea * aspectRatio);
|
|
25
|
-
return {
|
|
26
|
-
w: width,
|
|
27
|
-
h: width / aspectRatio,
|
|
28
|
-
};
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// TODO get rid of crop type
|
|
32
|
-
export function toCanvas(
|
|
33
|
-
elem: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement,
|
|
34
|
-
newSize?: WH,
|
|
35
|
-
canvas?: HTMLCanvasElement,
|
|
36
|
-
crop?: Crop
|
|
37
|
-
): HTMLCanvasElement {
|
|
38
|
-
let [ow, oh] = getElementSize(elem);
|
|
39
|
-
if (!crop) {
|
|
40
|
-
crop = {
|
|
41
|
-
x: 0,
|
|
42
|
-
y: 0,
|
|
43
|
-
w: ow,
|
|
44
|
-
h: oh,
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
const sx = crop.x;
|
|
48
|
-
const sy = crop.y;
|
|
49
|
-
const sw = crop.w;
|
|
50
|
-
const sh = crop.h;
|
|
51
|
-
|
|
52
|
-
const dw = (newSize && newSize.w) || ow;
|
|
53
|
-
const dh = (newSize && newSize.h) || oh;
|
|
54
|
-
|
|
55
|
-
if (!canvas) canvas = document.createElement("canvas");
|
|
56
|
-
|
|
57
|
-
canvas.width = dw;
|
|
58
|
-
canvas.height = dh;
|
|
59
|
-
// @ts-ignore
|
|
60
|
-
canvas.getContext("2d").drawImage(
|
|
61
|
-
elem,
|
|
62
|
-
sx,
|
|
63
|
-
sy,
|
|
64
|
-
sw,
|
|
65
|
-
sh,
|
|
66
|
-
0,
|
|
67
|
-
0, // dx dy
|
|
68
|
-
dw,
|
|
69
|
-
dh
|
|
70
|
-
);
|
|
71
|
-
return canvas;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
export function canvasToJpgBlob(
|
|
75
|
-
canvas: HTMLCanvasElement,
|
|
76
|
-
quality: number
|
|
77
|
-
): Promise<Blob> {
|
|
78
|
-
return new Promise((resolve, reject) => {
|
|
79
|
-
canvas.toBlob(
|
|
80
|
-
(blob) => {
|
|
81
|
-
if (blob) {
|
|
82
|
-
resolve(blob);
|
|
83
|
-
} else {
|
|
84
|
-
reject();
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
"image/jpeg",
|
|
88
|
-
quality
|
|
89
|
-
);
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
export const rectToCrop = ({ x1, x2, y1, y2 }: any): Crop => ({
|
|
94
|
-
x: x1,
|
|
95
|
-
y: y1,
|
|
96
|
-
w: x2 - x1,
|
|
97
|
-
h: y2 - y1,
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
export function fileOrBlobToCanvas(
|
|
101
|
-
file: File | string
|
|
102
|
-
): Promise<HTMLCanvasElement> {
|
|
103
|
-
return new Promise((resolve, reject) => {
|
|
104
|
-
// File can also be an image element
|
|
105
|
-
loadImage(
|
|
106
|
-
file,
|
|
107
|
-
(data) => {
|
|
108
|
-
const c = data as HTMLCanvasElement;
|
|
109
|
-
if (c) {
|
|
110
|
-
resolve(c);
|
|
111
|
-
} else {
|
|
112
|
-
reject();
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
canvas: true,
|
|
117
|
-
orientation: true,
|
|
118
|
-
crossOrigin: "anonymous",
|
|
119
|
-
}
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
});
|
|
123
|
-
}
|
package/src/services/session.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
import {NyrisAPISettings} from "@nyris/nyris-api";
|
|
3
|
-
|
|
4
|
-
const httpClient = axios.create();
|
|
5
|
-
|
|
6
|
-
export const createSessionByApi = async (settings: NyrisAPISettings) => {
|
|
7
|
-
const { apiKey, baseUrl} = settings;
|
|
8
|
-
try {
|
|
9
|
-
let headers: any = {
|
|
10
|
-
"X-Api-Key": apiKey,
|
|
11
|
-
};
|
|
12
|
-
return await httpClient.request({
|
|
13
|
-
method: "POST",
|
|
14
|
-
url: `${baseUrl}/find/v1/session`,
|
|
15
|
-
headers,
|
|
16
|
-
});
|
|
17
|
-
} catch (error: any) {
|
|
18
|
-
console.log("error createAction:", error);
|
|
19
|
-
}
|
|
20
|
-
};
|
package/src/services/types.ts
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
// import {SearchAction, SearchState} from "./actions/searchActions";
|
|
2
|
-
// import {NyrisAction, NyrisAppState} from "./actions/nyrisAppActions";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
import {MDSettings} from "../types";
|
|
6
|
-
|
|
7
|
-
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
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface ImageSearchOptions {
|
|
31
|
-
geoLocation?: { lat: number, lon: number, dist: number };
|
|
32
|
-
crop?: { x: number, y: number, w: number, h: number };
|
|
33
|
-
maxWidth: number;
|
|
34
|
-
maxHeight: number;
|
|
35
|
-
useRecommendations: boolean;
|
|
36
|
-
jpegQuality: number;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface RectCoords {
|
|
40
|
-
x1: number,
|
|
41
|
-
y1: number,
|
|
42
|
-
x2: number,
|
|
43
|
-
y2: number
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
export type Region = {
|
|
47
|
-
className?: string,
|
|
48
|
-
confidence?: number
|
|
49
|
-
} & RectCoords
|
|
50
|
-
|
|
51
|
-
export interface Crop {
|
|
52
|
-
x: number,
|
|
53
|
-
y: number,
|
|
54
|
-
w: number,
|
|
55
|
-
h: number
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
export interface WH {
|
|
59
|
-
w: number,
|
|
60
|
-
h: number
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
// export type AppState = {
|
|
64
|
-
// search: SearchState,
|
|
65
|
-
// settings: SearchServiceSettings,
|
|
66
|
-
// nyrisDesign: NyrisAppState
|
|
67
|
-
// };
|
|
68
|
-
|
|
69
|
-
// export type AppAction =
|
|
70
|
-
// | SearchAction
|
|
71
|
-
// | NyrisAction
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
export interface Result {
|
|
75
|
-
position: number,
|
|
76
|
-
sku?: string,
|
|
77
|
-
title?: string,
|
|
78
|
-
l?: string,
|
|
79
|
-
img?: { url?: string },
|
|
80
|
-
// There can be also any other ddata
|
|
81
|
-
[x: string]: any
|
|
82
|
-
}
|