@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
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { connectRelevantSort } from "react-instantsearch-dom";
|
|
3
|
-
|
|
4
|
-
function RelevantSortComponent({ isRelevantSorted, refine }: any) {
|
|
5
|
-
return (
|
|
6
|
-
<button onClick={() => refine(isRelevantSorted ? 0 : undefined)}>
|
|
7
|
-
Show {isRelevantSorted ? "all" : "relevant"} results
|
|
8
|
-
</button>
|
|
9
|
-
);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
export const RelevantSort = connectRelevantSort(RelevantSortComponent);
|
|
@@ -1,210 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { OfferNyrisResult as ResultData } from "@nyris/nyris-api";
|
|
3
|
-
|
|
4
|
-
// TODO this needs refactoring: Make it one block with parameters for first line, second line, image url ..
|
|
5
|
-
|
|
6
|
-
interface Options {
|
|
7
|
-
result: any;
|
|
8
|
-
noImageUrl: string;
|
|
9
|
-
onImageClick: (e: React.MouseEvent) => void;
|
|
10
|
-
onLinkClick: (e: React.MouseEvent) => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const renderPrice = (result: ResultData) =>
|
|
14
|
-
result.p ? "" + (result.p.vi / 100).toFixed(2) + " " + result.p.c : "";
|
|
15
|
-
|
|
16
|
-
const renderDefault = ({
|
|
17
|
-
result,
|
|
18
|
-
noImageUrl,
|
|
19
|
-
onImageClick,
|
|
20
|
-
onLinkClick,
|
|
21
|
-
}: Options) => {
|
|
22
|
-
return (
|
|
23
|
-
<>
|
|
24
|
-
<a
|
|
25
|
-
href={result.l}
|
|
26
|
-
className="imageLink"
|
|
27
|
-
title="Click the image so see similar products"
|
|
28
|
-
onClick={onImageClick}
|
|
29
|
-
onAuxClick={onLinkClick}
|
|
30
|
-
>
|
|
31
|
-
<div className="prdctImg">
|
|
32
|
-
<div className="imgWrap">
|
|
33
|
-
<img
|
|
34
|
-
src={(result.img && result.img.url + "?r=512x512") || noImageUrl}
|
|
35
|
-
alt={result.title}
|
|
36
|
-
/>
|
|
37
|
-
</div>
|
|
38
|
-
</div>
|
|
39
|
-
</a>
|
|
40
|
-
<div className="prdctDetailsWrap">
|
|
41
|
-
<div>
|
|
42
|
-
<div className="prdctTitle">{result.title}</div>
|
|
43
|
-
<div className="prdctMeta">
|
|
44
|
-
<span className="prdctPrice">{renderPrice(result)}</span>
|
|
45
|
-
</div>
|
|
46
|
-
<a
|
|
47
|
-
onClick={onLinkClick}
|
|
48
|
-
onAuxClick={onLinkClick}
|
|
49
|
-
className="prdctShopLink"
|
|
50
|
-
href={result.l}
|
|
51
|
-
target="_blank"
|
|
52
|
-
rel="noopener noreferrer"
|
|
53
|
-
>
|
|
54
|
-
Buy Now
|
|
55
|
-
</a>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
</>
|
|
59
|
-
);
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
const renderSnr = ({
|
|
63
|
-
result,
|
|
64
|
-
noImageUrl,
|
|
65
|
-
onImageClick,
|
|
66
|
-
onLinkClick,
|
|
67
|
-
}: Options) => (
|
|
68
|
-
<>
|
|
69
|
-
<a
|
|
70
|
-
href={result.l}
|
|
71
|
-
className="imageLink"
|
|
72
|
-
onClick={onImageClick}
|
|
73
|
-
onAuxClick={onLinkClick}
|
|
74
|
-
>
|
|
75
|
-
<div className="prdctImg">
|
|
76
|
-
<div className="imgWrap">
|
|
77
|
-
<img
|
|
78
|
-
src={(result.img && result.img.url + "?r=512x512") || noImageUrl}
|
|
79
|
-
alt={result.title}
|
|
80
|
-
/>
|
|
81
|
-
</div>
|
|
82
|
-
</div>
|
|
83
|
-
</a>
|
|
84
|
-
<div className="prdctDetailsWrap">
|
|
85
|
-
<div>
|
|
86
|
-
<div className="prdctTitle">{result.sku}</div>
|
|
87
|
-
<div
|
|
88
|
-
className="prdctMeta"
|
|
89
|
-
style={{ height: "5em", whiteSpace: "normal" }}
|
|
90
|
-
>
|
|
91
|
-
{result.title}
|
|
92
|
-
</div>
|
|
93
|
-
<a
|
|
94
|
-
style={{ backgroundImage: "none", paddingLeft: "10px" }}
|
|
95
|
-
className="prdctShopLink"
|
|
96
|
-
href={result.l}
|
|
97
|
-
target="_blank"
|
|
98
|
-
rel="noopener noreferrer"
|
|
99
|
-
onClick={onLinkClick}
|
|
100
|
-
onAuxClick={onLinkClick}
|
|
101
|
-
>
|
|
102
|
-
Info
|
|
103
|
-
</a>
|
|
104
|
-
</div>
|
|
105
|
-
</div>
|
|
106
|
-
</>
|
|
107
|
-
);
|
|
108
|
-
|
|
109
|
-
const renderSnrMultilink = (
|
|
110
|
-
{ result, noImageUrl, onImageClick }: Options,
|
|
111
|
-
onLinkClick: (url: string) => void
|
|
112
|
-
) => (
|
|
113
|
-
<>
|
|
114
|
-
<a
|
|
115
|
-
href={result.l}
|
|
116
|
-
className="imageLink"
|
|
117
|
-
onClick={onImageClick}
|
|
118
|
-
onAuxClick={onImageClick}
|
|
119
|
-
>
|
|
120
|
-
<div className="prdctImg">
|
|
121
|
-
<div className="imgWrap">
|
|
122
|
-
<img
|
|
123
|
-
src={(result.img && result.img.url + "?r=512x512") || noImageUrl}
|
|
124
|
-
alt={result.title}
|
|
125
|
-
/>
|
|
126
|
-
</div>
|
|
127
|
-
</div>
|
|
128
|
-
</a>
|
|
129
|
-
<div className="prdctDetailsWrap">
|
|
130
|
-
<div>
|
|
131
|
-
<div className="prdctTitle">{result.sku}</div>
|
|
132
|
-
<div
|
|
133
|
-
className="prdctMeta"
|
|
134
|
-
style={{ height: "5em", whiteSpace: "normal" }}
|
|
135
|
-
>
|
|
136
|
-
{result.title}
|
|
137
|
-
</div>
|
|
138
|
-
{result.l.map((l: { text: string; href: string }) => (
|
|
139
|
-
<a
|
|
140
|
-
style={{ backgroundImage: "none", paddingLeft: "10px" }}
|
|
141
|
-
className="prdctShopLink"
|
|
142
|
-
href={l.href}
|
|
143
|
-
onClick={() => onLinkClick(l.href)}
|
|
144
|
-
onAuxClick={() => onLinkClick(l.href)}
|
|
145
|
-
target="_blank"
|
|
146
|
-
key={l.href}
|
|
147
|
-
rel="noopener noreferrer"
|
|
148
|
-
>
|
|
149
|
-
{l.text}
|
|
150
|
-
</a>
|
|
151
|
-
))}
|
|
152
|
-
</div>
|
|
153
|
-
</div>
|
|
154
|
-
</>
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
export interface ResultProps {
|
|
158
|
-
result: any;
|
|
159
|
-
style: any;
|
|
160
|
-
template?: string;
|
|
161
|
-
onImageClick: (pos: number, url: string) => void;
|
|
162
|
-
onLinkClick: (pos: number, url: string) => void;
|
|
163
|
-
noImageUrl?: string;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
const Result: React.FC<ResultProps> = ({
|
|
167
|
-
result,
|
|
168
|
-
style,
|
|
169
|
-
template,
|
|
170
|
-
onImageClick,
|
|
171
|
-
onLinkClick,
|
|
172
|
-
noImageUrl,
|
|
173
|
-
}) => {
|
|
174
|
-
let options: Options = {
|
|
175
|
-
onImageClick: (e: React.MouseEvent) => {
|
|
176
|
-
e.preventDefault();
|
|
177
|
-
onImageClick(result.position, result.img.url);
|
|
178
|
-
},
|
|
179
|
-
onLinkClick: (e: React.MouseEvent) => {
|
|
180
|
-
e.preventDefault();
|
|
181
|
-
onLinkClick(result.position, result.l);
|
|
182
|
-
},
|
|
183
|
-
noImageUrl: noImageUrl || "images/ic_cam_large_noimage.png",
|
|
184
|
-
result,
|
|
185
|
-
};
|
|
186
|
-
|
|
187
|
-
let resultInner = null;
|
|
188
|
-
switch (template) {
|
|
189
|
-
case "snr":
|
|
190
|
-
resultInner = renderSnr(options);
|
|
191
|
-
break;
|
|
192
|
-
case "snr-multilink":
|
|
193
|
-
resultInner = renderSnrMultilink(options, (url) =>
|
|
194
|
-
onLinkClick(result.position, url)
|
|
195
|
-
);
|
|
196
|
-
break;
|
|
197
|
-
case "default":
|
|
198
|
-
default:
|
|
199
|
-
resultInner = renderDefault(options);
|
|
200
|
-
break;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
return (
|
|
204
|
-
<div className="prdctItem" style={{ ...style }}>
|
|
205
|
-
{resultInner}
|
|
206
|
-
</div>
|
|
207
|
-
);
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
export default Result;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { Grid } from "@material-ui/core";
|
|
2
|
-
import ItemResult from "components/results/ItemResult";
|
|
3
|
-
import React from "react";
|
|
4
|
-
|
|
5
|
-
interface Props {
|
|
6
|
-
dataItem: any[];
|
|
7
|
-
isHover?: boolean
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
function AllItem(props: Props) {
|
|
11
|
-
const { dataItem } = props;
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Grid container spacing={2}>
|
|
15
|
-
{dataItem &&
|
|
16
|
-
dataItem.map((item: any, index: any) => {
|
|
17
|
-
return (
|
|
18
|
-
<Grid item sm={3} key={index}>
|
|
19
|
-
<ItemResult
|
|
20
|
-
dataItem={item}
|
|
21
|
-
isHover={true}
|
|
22
|
-
// handlerToggleModal={handlerToggleModal}
|
|
23
|
-
// handlerToggleModalShare={() => setOpenModalShare(true)}
|
|
24
|
-
/>
|
|
25
|
-
</Grid>
|
|
26
|
-
);
|
|
27
|
-
})}
|
|
28
|
-
</Grid>
|
|
29
|
-
);
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export default AllItem;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Grid } from "@material-ui/core";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
interface Props {
|
|
5
|
-
nameCategory?: string;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
function CategoryItemSaved(props: Props) {
|
|
9
|
-
return (
|
|
10
|
-
<Grid container>
|
|
11
|
-
<Grid item xs={4}></Grid>
|
|
12
|
-
</Grid>
|
|
13
|
-
);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export default CategoryItemSaved;
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
import { autocomplete } from '@algolia/autocomplete-js';
|
|
2
|
-
import algoliasearch from 'algoliasearch/lite';
|
|
3
|
-
import { popularSearchesPluginCreator } from 'components/autocomplete/plugins/popular-searches/popular-searches';
|
|
4
|
-
import { debounce } from 'lodash';
|
|
5
|
-
import React, {
|
|
6
|
-
createElement,
|
|
7
|
-
Fragment,
|
|
8
|
-
useCallback,
|
|
9
|
-
useEffect,
|
|
10
|
-
useMemo,
|
|
11
|
-
useRef,
|
|
12
|
-
useState,
|
|
13
|
-
} from 'react';
|
|
14
|
-
import { render } from 'react-dom';
|
|
15
|
-
import { connectSearchBox } from 'react-instantsearch-dom';
|
|
16
|
-
import { useHistory } from 'react-router-dom';
|
|
17
|
-
import { onResetRequestImage, updateValueTextSearchMobile } from 'Store/Search';
|
|
18
|
-
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
19
|
-
import { AlgoliaSettings, AppState } from 'types';
|
|
20
|
-
interface Props {
|
|
21
|
-
containerRefInputMobile?: any;
|
|
22
|
-
isiImageThumbSearchInput?: boolean;
|
|
23
|
-
isResetImage?: boolean;
|
|
24
|
-
imageThumbSearchInput?: any;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function AutocompleteBasicComponent(props: Props) {
|
|
28
|
-
const {
|
|
29
|
-
containerRefInputMobile,
|
|
30
|
-
refine,
|
|
31
|
-
isResetImage,
|
|
32
|
-
imageThumbSearchInput,
|
|
33
|
-
}: any = props;
|
|
34
|
-
const [refBoxFilter, setRefBoxFilter] = useState<any>(null);
|
|
35
|
-
const { settings, search } = useAppSelector<AppState>((state: any) => state);
|
|
36
|
-
const { apiKey, appId, indexName } = settings.algolia as AlgoliaSettings;
|
|
37
|
-
const searchClient = algoliasearch(appId, apiKey);
|
|
38
|
-
const history = useHistory();
|
|
39
|
-
const dispatch = useAppDispatch();
|
|
40
|
-
const { textSearchInputMobile } = search;
|
|
41
|
-
const panelContainerRef = useRef<HTMLDivElement>(null);
|
|
42
|
-
const [refPanelContainer, setRefPanelContainer] = useState<any>(null);
|
|
43
|
-
|
|
44
|
-
useEffect(() => {
|
|
45
|
-
if (isResetImage) {
|
|
46
|
-
dispatch(onResetRequestImage(''));
|
|
47
|
-
setTimeout(() => {
|
|
48
|
-
refine(textSearchInputMobile);
|
|
49
|
-
}, 300);
|
|
50
|
-
return;
|
|
51
|
-
}
|
|
52
|
-
}, [isResetImage, dispatch, refine, textSearchInputMobile]);
|
|
53
|
-
|
|
54
|
-
useEffect(() => {
|
|
55
|
-
if (imageThumbSearchInput !== '') {
|
|
56
|
-
dispatch(updateValueTextSearchMobile(''));
|
|
57
|
-
}
|
|
58
|
-
}, [imageThumbSearchInput, dispatch]);
|
|
59
|
-
|
|
60
|
-
useEffect(() => {
|
|
61
|
-
setRefPanelContainer(panelContainerRef);
|
|
62
|
-
}, [panelContainerRef]);
|
|
63
|
-
|
|
64
|
-
useEffect(() => {
|
|
65
|
-
setRefBoxFilter(containerRefInputMobile);
|
|
66
|
-
}, [containerRefInputMobile]);
|
|
67
|
-
|
|
68
|
-
const plugins = useMemo(
|
|
69
|
-
() => [
|
|
70
|
-
popularSearchesPluginCreator({
|
|
71
|
-
searchClient,
|
|
72
|
-
onSelect({ item }: any) {
|
|
73
|
-
dispatch(updateValueTextSearchMobile(item?.keyword));
|
|
74
|
-
refine(`${item?.keyword}`);
|
|
75
|
-
if (history.location.pathname !== '/result') {
|
|
76
|
-
history.push('/result');
|
|
77
|
-
}
|
|
78
|
-
},
|
|
79
|
-
indexName,
|
|
80
|
-
handerCloseModal() {
|
|
81
|
-
setRefPanelContainer(<div></div>);
|
|
82
|
-
},
|
|
83
|
-
}),
|
|
84
|
-
],
|
|
85
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
86
|
-
[searchClient],
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
useEffect(() => {
|
|
90
|
-
if (!refBoxFilter?.current || !refPanelContainer.current) {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const autocompleteInstance = autocomplete({
|
|
94
|
-
container: refBoxFilter.current,
|
|
95
|
-
panelContainer: refPanelContainer.current,
|
|
96
|
-
panelPlacement: 'full-width',
|
|
97
|
-
renderer: { createElement, Fragment, render: () => {} },
|
|
98
|
-
initialState: {
|
|
99
|
-
query: textSearchInputMobile,
|
|
100
|
-
},
|
|
101
|
-
translations: {
|
|
102
|
-
detachedCancelButtonText: `‹`,
|
|
103
|
-
submitButtonTitle: 's',
|
|
104
|
-
},
|
|
105
|
-
placeholder: textSearchInputMobile ? textSearchInputMobile : 'Search',
|
|
106
|
-
plugins,
|
|
107
|
-
openOnFocus: true,
|
|
108
|
-
onSubmit,
|
|
109
|
-
render({ sections, components }, root) {
|
|
110
|
-
render(
|
|
111
|
-
<Fragment>
|
|
112
|
-
<div className="aa-PanelLayout aa-Panel--scollable ">
|
|
113
|
-
{sections}
|
|
114
|
-
</div>
|
|
115
|
-
</Fragment>,
|
|
116
|
-
root,
|
|
117
|
-
);
|
|
118
|
-
},
|
|
119
|
-
|
|
120
|
-
...props,
|
|
121
|
-
});
|
|
122
|
-
return () => {
|
|
123
|
-
// Waiting for an 'unsubscribe' method on Autocomplete plugin API
|
|
124
|
-
plugins.forEach((plugin: any) => {
|
|
125
|
-
if (typeof plugin.unsubscribe === 'function') {
|
|
126
|
-
plugin.unsubscribe();
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
|
|
130
|
-
autocompleteInstance?.destroy();
|
|
131
|
-
};
|
|
132
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
133
|
-
}, [plugins, refBoxFilter, refPanelContainer, textSearchInputMobile]);
|
|
134
|
-
|
|
135
|
-
const onSubmit = ({ state }: any) => {
|
|
136
|
-
debounceSearch(state?.query);
|
|
137
|
-
dispatch(updateValueTextSearchMobile(state?.query));
|
|
138
|
-
if (history.location.pathname !== '/result') {
|
|
139
|
-
history.push('/result');
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
const debounceSearch = useCallback(
|
|
143
|
-
debounce((nextValue: any) => refine(nextValue), 200),
|
|
144
|
-
[],
|
|
145
|
-
);
|
|
146
|
-
|
|
147
|
-
return <div className="panel-container-custom" ref={panelContainerRef} />;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const AutocompleteBasicMobileComponent = connectSearchBox<any>(
|
|
151
|
-
AutocompleteBasicComponent,
|
|
152
|
-
);
|
|
153
|
-
export default AutocompleteBasicMobileComponent;
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import type { OnSelectParams } from '@algolia/autocomplete-core';
|
|
3
|
-
import { createQuerySuggestionsPlugin } from '@algolia/autocomplete-plugin-query-suggestions';
|
|
4
|
-
import type { AutocompleteQuerySuggestionsHit } from '@algolia/autocomplete-plugin-query-suggestions/dist/esm/types';
|
|
5
|
-
import type { SearchClient } from 'algoliasearch/lite';
|
|
6
|
-
|
|
7
|
-
type PopularSearchesPluginCreatorParams = {
|
|
8
|
-
searchClient: SearchClient;
|
|
9
|
-
onSelect?: (params: OnSelectParams<AutocompleteQuerySuggestionsHit>) => void;
|
|
10
|
-
indexName?: any;
|
|
11
|
-
handerCloseModal?: any;
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export function popularSearchesPluginCreator({
|
|
15
|
-
searchClient,
|
|
16
|
-
onSelect: customOnSelect,
|
|
17
|
-
indexName,
|
|
18
|
-
handerCloseModal,
|
|
19
|
-
}: PopularSearchesPluginCreatorParams) {
|
|
20
|
-
return createQuerySuggestionsPlugin({
|
|
21
|
-
searchClient,
|
|
22
|
-
indexName: indexName,
|
|
23
|
-
categoryAttribute: ['brand', 'keyword_0', 'custom_category'],
|
|
24
|
-
getSearchParams({ state }) {
|
|
25
|
-
return { hitsPerPage: 5 };
|
|
26
|
-
},
|
|
27
|
-
transformSource({ source, onTapAhead }) {
|
|
28
|
-
return {
|
|
29
|
-
...source,
|
|
30
|
-
onSelect(params) {
|
|
31
|
-
if (typeof customOnSelect === 'function') {
|
|
32
|
-
customOnSelect(params);
|
|
33
|
-
}
|
|
34
|
-
},
|
|
35
|
-
templates: {
|
|
36
|
-
/* header() {
|
|
37
|
-
return (
|
|
38
|
-
<div>
|
|
39
|
-
<span className="aa-SourceHeaderTitle">Suggested searches</span>
|
|
40
|
-
</div>
|
|
41
|
-
);
|
|
42
|
-
},*/
|
|
43
|
-
item({ item }: any) {
|
|
44
|
-
return (
|
|
45
|
-
<div className="aa-ItemWrapper d-flex">
|
|
46
|
-
{/*<div className="aa-ItemContent">
|
|
47
|
-
<div className="aa-ItemContentBody">
|
|
48
|
-
<div className="aa-ItemContentTitle">
|
|
49
|
-
<Typography>{item.keyword}</Typography>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</div>*/}
|
|
53
|
-
{/* <div className="aa-ItemActions">
|
|
54
|
-
<button
|
|
55
|
-
type="button"
|
|
56
|
-
className="aa-ItemActionButton"
|
|
57
|
-
title={`Fill query with "${item.title}"`}
|
|
58
|
-
onClick={event => {
|
|
59
|
-
event.preventDefault();
|
|
60
|
-
event.stopPropagation();
|
|
61
|
-
onTapAhead(item);
|
|
62
|
-
}}
|
|
63
|
-
></button>
|
|
64
|
-
</div>*/}
|
|
65
|
-
</div>
|
|
66
|
-
);
|
|
67
|
-
},
|
|
68
|
-
noResults() {
|
|
69
|
-
return 'No products for this query.';
|
|
70
|
-
},
|
|
71
|
-
},
|
|
72
|
-
};
|
|
73
|
-
},
|
|
74
|
-
});
|
|
75
|
-
}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { Button } from "@material-ui/core";
|
|
2
|
-
import { ClearRefinementsProps } from "components/clear-refinements/clear-refinements";
|
|
3
|
-
import React, { memo, useCallback } from "react";
|
|
4
|
-
import { connectCurrentRefinements } from "react-instantsearch-dom";
|
|
5
|
-
|
|
6
|
-
interface Props {}
|
|
7
|
-
|
|
8
|
-
function ClearFillter({
|
|
9
|
-
children,
|
|
10
|
-
type = "native",
|
|
11
|
-
className,
|
|
12
|
-
items,
|
|
13
|
-
refine,
|
|
14
|
-
}: ClearRefinementsProps) {
|
|
15
|
-
|
|
16
|
-
const handleButtonClick = useCallback(() => refine(items), [refine, items]);
|
|
17
|
-
return (
|
|
18
|
-
<Button
|
|
19
|
-
type={type}
|
|
20
|
-
disabled={!items.length}
|
|
21
|
-
className={className}
|
|
22
|
-
onClick={handleButtonClick}
|
|
23
|
-
>
|
|
24
|
-
{children}
|
|
25
|
-
</Button>
|
|
26
|
-
);
|
|
27
|
-
}
|
|
28
|
-
export const ClearRefinements = connectCurrentRefinements<any>(
|
|
29
|
-
memo(ClearFillter)
|
|
30
|
-
);
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from "react";
|
|
2
|
-
import Webcam from "react-webcam";
|
|
3
|
-
|
|
4
|
-
const WebcamCapture = () => {
|
|
5
|
-
const webcamRef: any = React.useRef(null);
|
|
6
|
-
const [imgSrc, setImgSrc] = React.useState(null);
|
|
7
|
-
const videoConstraints = {
|
|
8
|
-
width: { min: 480 },
|
|
9
|
-
height: { min: 720 },
|
|
10
|
-
aspectRatio: 0.6666666667
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const capture = React.useCallback(() => {
|
|
14
|
-
const imageSrc = webcamRef.current.getScreenshot();
|
|
15
|
-
setImgSrc(imageSrc);
|
|
16
|
-
}, [webcamRef, setImgSrc]);
|
|
17
|
-
|
|
18
|
-
return (
|
|
19
|
-
<>
|
|
20
|
-
<Webcam
|
|
21
|
-
audio={false}
|
|
22
|
-
ref={webcamRef}
|
|
23
|
-
screenshotFormat="image/jpeg"
|
|
24
|
-
// videoConstraints={videoConstraints}
|
|
25
|
-
videoConstraints={videoConstraints}
|
|
26
|
-
|
|
27
|
-
/>
|
|
28
|
-
<button onClick={capture}>Capture photo</button>
|
|
29
|
-
{imgSrc && <img src={imgSrc} />}
|
|
30
|
-
</>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
export default WebcamCapture;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import classNames from "classnames";
|
|
3
|
-
|
|
4
|
-
export type CountProps = {
|
|
5
|
-
children: React.ReactNode;
|
|
6
|
-
className?: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export function Count({ children, className }: CountProps) {
|
|
10
|
-
return (
|
|
11
|
-
<div
|
|
12
|
-
className={classNames(
|
|
13
|
-
"bg-neutral-light text-brand-black w-5 h-5 small-bold rounded-full flex items-center justify-center",
|
|
14
|
-
className
|
|
15
|
-
)}
|
|
16
|
-
>
|
|
17
|
-
{children}
|
|
18
|
-
</div>
|
|
19
|
-
);
|
|
20
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { Hit as AlgoliaHit } from "@algolia/client-search";
|
|
3
|
-
import { useHits, UseHitsProps } from "react-instantsearch-hooks";
|
|
4
|
-
import { useAppDispatch } from "Store/Store";
|
|
5
|
-
import { useEffect } from "react";
|
|
6
|
-
import { resultSearchText } from "Store/Search";
|
|
7
|
-
import { useState } from "react";
|
|
8
|
-
import { CircularProgress } from "@material-ui/core";
|
|
9
|
-
|
|
10
|
-
export type HitsProps<THit> = React.ComponentProps<"div"> &
|
|
11
|
-
UseHitsProps & {
|
|
12
|
-
hitComponent: (props: { hit: THit }) => JSX.Element;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
export function Hits<THit extends AlgoliaHit<Record<string, unknown>>>({
|
|
16
|
-
hitComponent: Hit,
|
|
17
|
-
...props
|
|
18
|
-
}: HitsProps<THit>) {
|
|
19
|
-
|
|
20
|
-
const { hits } = useHits(props);
|
|
21
|
-
const dispatch = useAppDispatch();
|
|
22
|
-
const [isLoading, setLoading] = useState<boolean>(false);
|
|
23
|
-
|
|
24
|
-
useEffect(() => {
|
|
25
|
-
setLoading(true);
|
|
26
|
-
setTimeout(() => {
|
|
27
|
-
setLoading(false);
|
|
28
|
-
}, 1000);
|
|
29
|
-
}, []);
|
|
30
|
-
|
|
31
|
-
useEffect(() => {
|
|
32
|
-
if (hits?.length > 0) {
|
|
33
|
-
dispatch(resultSearchText(hits));
|
|
34
|
-
}
|
|
35
|
-
}, []);
|
|
36
|
-
|
|
37
|
-
return (
|
|
38
|
-
<>
|
|
39
|
-
{isLoading ? (
|
|
40
|
-
<CircularProgress />
|
|
41
|
-
) : (
|
|
42
|
-
<>
|
|
43
|
-
{hits.map((hit: any, index: any) => (
|
|
44
|
-
<Hit key={index} hit={hit as unknown as THit} />
|
|
45
|
-
))}
|
|
46
|
-
</>
|
|
47
|
-
)}
|
|
48
|
-
</>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Grid } from "@material-ui/core";
|
|
2
|
-
import ItemResult from "components/results/ItemResult";
|
|
3
|
-
import React from "react";
|
|
4
|
-
import {
|
|
5
|
-
useInfiniteHits,
|
|
6
|
-
UseInfiniteHitsProps,
|
|
7
|
-
} from "react-instantsearch-hooks";
|
|
8
|
-
|
|
9
|
-
function InfiniteHits(props: any) {
|
|
10
|
-
const { hits, isLastPage, showMore } = useInfiniteHits(props);
|
|
11
|
-
console.log("props", useInfiniteHits(props));
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
{hits.map((hit: any, index: any) => {
|
|
16
|
-
return (
|
|
17
|
-
<Grid item xs={3}>
|
|
18
|
-
<ItemResult
|
|
19
|
-
dataItem={hit?.hit}
|
|
20
|
-
// handlerToggleModal={() => {
|
|
21
|
-
// handlerToggleModal(hit?.hit);
|
|
22
|
-
// }}
|
|
23
|
-
// handlerToggleModalShare={() => setOpenModalShare(true)}
|
|
24
|
-
// indexItem={hit.__position}
|
|
25
|
-
/>
|
|
26
|
-
</Grid>
|
|
27
|
-
);
|
|
28
|
-
})}
|
|
29
|
-
</>
|
|
30
|
-
);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export default InfiniteHits;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
<svg width="12" height="10" viewBox="0 0 12 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M2.14286 0H9.85714V0.857143H2.14286V0ZM9.85714 2.14286H2.14286V3H9.85714V2.14286ZM2.14286 4.28571H9.85714V5.14286H2.14286V4.28571ZM11.1429 9.42857H0.857143C0.629888 9.42833 0.412008 9.33795 0.251315 9.17726C0.0906207 9.01656 0.000238243 8.79868 0 8.57143V6.42857H0.857143V8.57143H11.1429V6.42857H12V8.57143C11.9998 8.79868 11.9094 9.01656 11.7487 9.17726C11.588 9.33795 11.3701 9.42833 11.1429 9.42857ZM9.85714 6.42857H2.14286V7.28571H9.85714V6.42857Z" fill="#55566B"/>
|
|
3
|
-
</svg>
|