@nyris/nyris-webapp 0.2.2 → 0.2.6
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 +8 -8
- package/build/index.html +1 -1
- package/build/{precache-manifest.cb68a164d02e603fb74c60f899e3582f.js → precache-manifest.aa7c9d32340f77d86c9a3347b54ba2a5.js} +8 -8
- package/build/service-worker.js +1 -1
- package/build/static/js/2.a591d52a.chunk.js +3 -0
- package/build/static/js/{2.b56c1bca.chunk.js.LICENSE.txt → 2.a591d52a.chunk.js.LICENSE.txt} +0 -0
- package/build/static/js/2.a591d52a.chunk.js.map +1 -0
- package/build/static/js/main.5a3dcfb4.chunk.js +2 -0
- package/build/static/js/main.5a3dcfb4.chunk.js.map +1 -0
- package/package.json +4 -3
- package/public/index.html +11 -0
- package/src/App.tsx +25 -7
- package/src/actions/searchActions.ts +10 -2
- package/src/epics/feedback.ts +1 -1
- package/src/epics/index.ts +17 -1
- package/src/index.tsx +3 -2
- package/build/static/js/2.b56c1bca.chunk.js +0 -3
- package/build/static/js/2.b56c1bca.chunk.js.map +0 -1
- package/build/static/js/main.0c8a54f7.chunk.js +0 -2
- package/build/static/js/main.0c8a54f7.chunk.js.map +0 -1
|
@@ -40,7 +40,8 @@ export interface SearchState {
|
|
|
40
40
|
requestImage?: CanvasWithId
|
|
41
41
|
requestCadFile?: File
|
|
42
42
|
categoryPredictions: CategoryPrediction[]
|
|
43
|
-
codes: Code[]
|
|
43
|
+
codes: Code[],
|
|
44
|
+
errorMessage: string
|
|
44
45
|
}
|
|
45
46
|
|
|
46
47
|
const initialState : SearchState = {
|
|
@@ -52,7 +53,8 @@ const initialState : SearchState = {
|
|
|
52
53
|
fetchingRegions: false,
|
|
53
54
|
filterOptions: [],
|
|
54
55
|
categoryPredictions: [],
|
|
55
|
-
codes: []
|
|
56
|
+
codes: [],
|
|
57
|
+
errorMessage: ''
|
|
56
58
|
};
|
|
57
59
|
|
|
58
60
|
|
|
@@ -102,6 +104,12 @@ export const reducer = (state : SearchState = initialState, action: SearchAction
|
|
|
102
104
|
regions: action.regions,
|
|
103
105
|
selectedRegion: selectFirstCenteredRegion(action.regions, 0.3, state.selectedRegion)
|
|
104
106
|
};
|
|
107
|
+
case "REGION_REQUEST_FAIL":
|
|
108
|
+
return {
|
|
109
|
+
...state,
|
|
110
|
+
fetchingRegions: false,
|
|
111
|
+
errorMessage: action.exception.response.data.detail
|
|
112
|
+
};
|
|
105
113
|
case "SEARCH_REQUEST_START":
|
|
106
114
|
return {
|
|
107
115
|
...state,
|
package/src/epics/feedback.ts
CHANGED
|
@@ -19,7 +19,7 @@ const feedbackSuccessEpic: EpicConf = (action$, state$, {api}) => action$.pipe(
|
|
|
19
19
|
|
|
20
20
|
const feedbackRegionEpic: EpicConf = (action$, state$, {api}) => action$.pipe(
|
|
21
21
|
ofType('REGION_CHANGED'),
|
|
22
|
-
debounceTime(
|
|
22
|
+
debounceTime(1200),
|
|
23
23
|
withLatestFrom(state$),
|
|
24
24
|
tap(async ([action, state]) => {
|
|
25
25
|
if (action.type === 'REGION_CHANGED') {
|
package/src/epics/index.ts
CHANGED
|
@@ -100,9 +100,24 @@ const startSearchOnRegionsSuccessful: EpicConf = (action$, state$) => action$.pi
|
|
|
100
100
|
})
|
|
101
101
|
);
|
|
102
102
|
|
|
103
|
+
const startSearchOnRegionsFailed: EpicConf = (action$, state$) => action$.pipe(
|
|
104
|
+
ofType('REGION_REQUEST_FAIL'),
|
|
105
|
+
withLatestFrom(state$),
|
|
106
|
+
switchMap(async ([action, { search: { requestImage}}]) : Promise<AppAction> => {
|
|
107
|
+
if (action.type !== 'REGION_REQUEST_FAIL') {
|
|
108
|
+
throw new Error(`Wrong action type ${action.type}`);
|
|
109
|
+
}
|
|
110
|
+
if (!requestImage) {
|
|
111
|
+
throw new Error(`No requestImage`);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return searchOffersForImage(requestImage.canvas);
|
|
115
|
+
})
|
|
116
|
+
);
|
|
117
|
+
|
|
103
118
|
const startSearchOnRegionChange: EpicConf = (action$, state$) => action$.pipe(
|
|
104
119
|
ofType('REGION_CHANGED'),
|
|
105
|
-
debounceTime(
|
|
120
|
+
debounceTime(1200),
|
|
106
121
|
withLatestFrom(state$),
|
|
107
122
|
switchMap(async ([action, { search: { requestImage}}]) : Promise<AppAction> => {
|
|
108
123
|
if (action.type !== 'REGION_CHANGED') {
|
|
@@ -124,6 +139,7 @@ const rootEpic = combineEpics(
|
|
|
124
139
|
startSearchOnImageLoaded,
|
|
125
140
|
startSearchOnCadLoaded,
|
|
126
141
|
startSearchOnRegionsSuccessful,
|
|
142
|
+
startSearchOnRegionsFailed,
|
|
127
143
|
startSearchOnRegionChange,
|
|
128
144
|
onSearchSuccessShowResults,
|
|
129
145
|
onSearchSuccessShowFeedbackDelayed,
|
package/src/index.tsx
CHANGED
|
@@ -111,13 +111,14 @@ const mapStateToProps = (state: AppState) => ({
|
|
|
111
111
|
previewSelection: state.search.selectedRegion,
|
|
112
112
|
regions: state.search.regions,
|
|
113
113
|
duration: state.search.duration,
|
|
114
|
-
requestId: state.search.requestId
|
|
114
|
+
requestId: state.search.requestId,
|
|
115
|
+
toastErrorMessage: state.search.errorMessage
|
|
115
116
|
},
|
|
116
117
|
settings: state.settings,
|
|
117
118
|
previewImage: state.search.requestImage,
|
|
118
119
|
loading: state.search.fetchingRegions || state.search.fetchingResults,
|
|
119
120
|
feedbackState: state.nyrisDesign.feedbackState,
|
|
120
|
-
mdSettings: state.settings.materialDesign || defaultMdSettings
|
|
121
|
+
mdSettings: state.settings.materialDesign || defaultMdSettings,
|
|
121
122
|
});
|
|
122
123
|
|
|
123
124
|
|