@monkvision/network 4.5.6 → 5.0.0
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/lib/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkvision/network",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.6.0",
|
|
4
4
|
"license": "BSD-3-Clause-Clear",
|
|
5
5
|
"packageManager": "yarn@3.2.4",
|
|
6
6
|
"description": "MonkJs core package used to communicate with the API",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@monkvision/common": "4.
|
|
32
|
-
"@monkvision/sights": "4.
|
|
31
|
+
"@monkvision/common": "4.6.0",
|
|
32
|
+
"@monkvision/sights": "4.6.0",
|
|
33
33
|
"jsonwebtoken": "^9.0.2",
|
|
34
34
|
"jwt-decode": "^4.0.0",
|
|
35
35
|
"ky": "^1.2.0",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"react-router-dom": "^6.22.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@monkvision/eslint-config-base": "4.
|
|
46
|
-
"@monkvision/eslint-config-typescript": "4.
|
|
47
|
-
"@monkvision/jest-config": "4.
|
|
48
|
-
"@monkvision/prettier-config": "4.
|
|
49
|
-
"@monkvision/types": "4.
|
|
50
|
-
"@monkvision/typescript-config": "4.
|
|
45
|
+
"@monkvision/eslint-config-base": "4.6.0",
|
|
46
|
+
"@monkvision/eslint-config-typescript": "4.6.0",
|
|
47
|
+
"@monkvision/jest-config": "4.6.0",
|
|
48
|
+
"@monkvision/prettier-config": "4.6.0",
|
|
49
|
+
"@monkvision/types": "4.6.0",
|
|
50
|
+
"@monkvision/typescript-config": "4.6.0",
|
|
51
51
|
"@types/jest": "^29.2.2",
|
|
52
52
|
"@types/jsonwebtoken": "^9.0.5",
|
|
53
53
|
"@types/node": "^18.11.9",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Dispatch } from 'react';
|
|
2
2
|
import { MonkCreatedOneImageAction } from '@monkvision/common';
|
|
3
|
-
import { ComplianceOptions, Image, MonkPicture, TaskName } from '@monkvision/types';
|
|
3
|
+
import { ComplianceOptions, Image, MonkPicture, TaskName, VehiclePart } from '@monkvision/types';
|
|
4
4
|
import { MonkApiConfig } from '../config';
|
|
5
5
|
import { ApiImage } from '../models';
|
|
6
6
|
import { MonkApiResponse } from '../types';
|
|
@@ -17,10 +17,19 @@ export declare enum ImageUploadType {
|
|
|
17
17
|
* add damage workflow.
|
|
18
18
|
*/
|
|
19
19
|
CLOSE_UP_2_SHOT = "close_up_2_shot",
|
|
20
|
+
/**
|
|
21
|
+
* Upload type corresponding to a close-up picture (add-damage) in the PhotoCapture process, when using the
|
|
22
|
+
* part-select-shot add damage workflow.
|
|
23
|
+
*/
|
|
24
|
+
PART_SELECT_SHOT = "part_select_shot",
|
|
20
25
|
/**
|
|
21
26
|
* Upload type corresponding to a video frame in the VideoCapture process.
|
|
22
27
|
*/
|
|
23
|
-
VIDEO_FRAME = "video_frame"
|
|
28
|
+
VIDEO_FRAME = "video_frame",
|
|
29
|
+
/**
|
|
30
|
+
* Upload type corresponding to a manual photo in the VideoCapture process.
|
|
31
|
+
*/
|
|
32
|
+
VIDEO_MANUAL_PHOTO = "video_manual_photo"
|
|
24
33
|
}
|
|
25
34
|
/**
|
|
26
35
|
* Options specififed when adding a beauty shot (normal "sight" image) to an inspection.
|
|
@@ -91,6 +100,35 @@ export interface Add2ShotCloseUpImageOptions {
|
|
|
91
100
|
*/
|
|
92
101
|
compliance?: ComplianceOptions;
|
|
93
102
|
}
|
|
103
|
+
/**
|
|
104
|
+
* Options specified when adding a close up (an "add damage" image) to an inspection using the part select process.
|
|
105
|
+
*/
|
|
106
|
+
export interface AddPartSelectCloseUpImageOptions {
|
|
107
|
+
/**
|
|
108
|
+
* The type of the image upload : `ImageUploadType.PART_SELECT_SHOT`;
|
|
109
|
+
*/
|
|
110
|
+
uploadType: ImageUploadType.PART_SELECT_SHOT;
|
|
111
|
+
/**
|
|
112
|
+
* The picture to add to the inspection.
|
|
113
|
+
*/
|
|
114
|
+
picture: MonkPicture;
|
|
115
|
+
/**
|
|
116
|
+
* The ID of the inspection to add the image to.
|
|
117
|
+
*/
|
|
118
|
+
inspectionId: string;
|
|
119
|
+
/**
|
|
120
|
+
* List of damage parts chosen by User with part selected wireframe
|
|
121
|
+
*/
|
|
122
|
+
vehicleParts: VehiclePart[];
|
|
123
|
+
/**
|
|
124
|
+
* Boolean indicating if a thumbnail request will be sent when addImage is called.
|
|
125
|
+
*/
|
|
126
|
+
useThumbnailCaching?: boolean;
|
|
127
|
+
/**
|
|
128
|
+
* Additional options used to configure the compliance locally.
|
|
129
|
+
*/
|
|
130
|
+
compliance?: ComplianceOptions;
|
|
131
|
+
}
|
|
94
132
|
/**
|
|
95
133
|
* Options specififed when adding a video frame to a VideoCapture inspection.
|
|
96
134
|
*/
|
|
@@ -117,10 +155,27 @@ export interface AddVideoFrameOptions {
|
|
|
117
155
|
*/
|
|
118
156
|
timestamp: number;
|
|
119
157
|
}
|
|
158
|
+
/**
|
|
159
|
+
* Options specififed when adding a manual video photo to a VideoCapture inspection.
|
|
160
|
+
*/
|
|
161
|
+
export interface AddVideoManualPhotoOptions {
|
|
162
|
+
/**
|
|
163
|
+
* The type of the image upload : `ImageUploadType.VIDEO_MANUAL_PHOTO`;
|
|
164
|
+
*/
|
|
165
|
+
uploadType: ImageUploadType.VIDEO_MANUAL_PHOTO;
|
|
166
|
+
/**
|
|
167
|
+
* The picture to add to the inspection.
|
|
168
|
+
*/
|
|
169
|
+
picture: MonkPicture;
|
|
170
|
+
/**
|
|
171
|
+
* The ID of the inspection to add the video frame to.
|
|
172
|
+
*/
|
|
173
|
+
inspectionId: string;
|
|
174
|
+
}
|
|
120
175
|
/**
|
|
121
176
|
* Union type describing the different options that can be specified when adding a picture to an inspection.
|
|
122
177
|
*/
|
|
123
|
-
export type AddImageOptions = AddBeautyShotImageOptions | Add2ShotCloseUpImageOptions | AddVideoFrameOptions;
|
|
178
|
+
export type AddImageOptions = AddBeautyShotImageOptions | Add2ShotCloseUpImageOptions | AddVideoFrameOptions | AddVideoManualPhotoOptions | AddPartSelectCloseUpImageOptions;
|
|
124
179
|
/**
|
|
125
180
|
* Type definition for the result of the `addImage` API request.
|
|
126
181
|
*/
|
|
@@ -72,13 +72,22 @@ var ImageUploadType;
|
|
|
72
72
|
* add damage workflow.
|
|
73
73
|
*/
|
|
74
74
|
ImageUploadType["CLOSE_UP_2_SHOT"] = "close_up_2_shot";
|
|
75
|
+
/**
|
|
76
|
+
* Upload type corresponding to a close-up picture (add-damage) in the PhotoCapture process, when using the
|
|
77
|
+
* part-select-shot add damage workflow.
|
|
78
|
+
*/
|
|
79
|
+
ImageUploadType["PART_SELECT_SHOT"] = "part_select_shot";
|
|
75
80
|
/**
|
|
76
81
|
* Upload type corresponding to a video frame in the VideoCapture process.
|
|
77
82
|
*/
|
|
78
83
|
ImageUploadType["VIDEO_FRAME"] = "video_frame";
|
|
84
|
+
/**
|
|
85
|
+
* Upload type corresponding to a manual photo in the VideoCapture process.
|
|
86
|
+
*/
|
|
87
|
+
ImageUploadType["VIDEO_MANUAL_PHOTO"] = "video_manual_photo";
|
|
79
88
|
})(ImageUploadType = exports.ImageUploadType || (exports.ImageUploadType = {}));
|
|
80
89
|
function getImageType(options) {
|
|
81
|
-
if (
|
|
90
|
+
if ([ImageUploadType.CLOSE_UP_2_SHOT, ImageUploadType.PART_SELECT_SHOT].includes(options.uploadType)) {
|
|
82
91
|
return types_1.ImageType.CLOSE_UP;
|
|
83
92
|
}
|
|
84
93
|
return types_1.ImageType.BEAUTY_SHOT;
|
|
@@ -95,6 +104,23 @@ function getImageLabel(options) {
|
|
|
95
104
|
nl: "Videoframe ".concat(options.frameIndex),
|
|
96
105
|
};
|
|
97
106
|
}
|
|
107
|
+
if (options.uploadType === ImageUploadType.VIDEO_MANUAL_PHOTO) {
|
|
108
|
+
return {
|
|
109
|
+
en: "Video Manual Photo",
|
|
110
|
+
fr: "Photo Manuelle Vid\u00E9o",
|
|
111
|
+
de: "Foto Manuell Video",
|
|
112
|
+
nl: "Foto-handleiding Video",
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
if (options.uploadType === ImageUploadType.PART_SELECT_SHOT) {
|
|
116
|
+
var partsTranslation = options.vehicleParts.map(function (part) { return common_1.vehiclePartLabels[part]; });
|
|
117
|
+
return {
|
|
118
|
+
en: "Close Up on ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')),
|
|
119
|
+
fr: "Photo Zoom\u00E9e sur ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')),
|
|
120
|
+
de: "Gezoomtes an ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')),
|
|
121
|
+
nl: "Nabij aan ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
98
124
|
return {
|
|
99
125
|
en: options.firstShot ? 'Close Up (part)' : 'Close Up (damage)',
|
|
100
126
|
fr: options.firstShot ? 'Photo Zoomée (partie)' : 'Photo Zoomée (dégât)',
|
|
@@ -144,7 +170,7 @@ function createBeautyShotImageData(options, filetype) {
|
|
|
144
170
|
};
|
|
145
171
|
return { filename: filename, body: body };
|
|
146
172
|
}
|
|
147
|
-
function
|
|
173
|
+
function create2ShotCloseUpImageData(options, filetype) {
|
|
148
174
|
var _a, _b;
|
|
149
175
|
var prefix = options.firstShot ? 'closeup-part' : 'closeup-damage';
|
|
150
176
|
var filename = "".concat(prefix, "-").concat(options.inspectionId, "-").concat(Date.now(), ".").concat(filetype);
|
|
@@ -167,6 +193,29 @@ function createCloseUpImageData(options, filetype) {
|
|
|
167
193
|
};
|
|
168
194
|
return { filename: filename, body: body };
|
|
169
195
|
}
|
|
196
|
+
function createPartSelectCloseUpImageData(options, filetype) {
|
|
197
|
+
var _a, _b;
|
|
198
|
+
var filename = "part-select-".concat(options.inspectionId, "-").concat(Date.now(), ".").concat(filetype);
|
|
199
|
+
var body = {
|
|
200
|
+
acquisition: {
|
|
201
|
+
strategy: 'upload_multipart_form_keys',
|
|
202
|
+
file_key: MULTIPART_KEY_IMAGE,
|
|
203
|
+
},
|
|
204
|
+
image_type: types_1.ImageType.CLOSE_UP,
|
|
205
|
+
tasks: [
|
|
206
|
+
types_1.TaskName.DAMAGE_DETECTION,
|
|
207
|
+
{
|
|
208
|
+
name: types_1.TaskName.COMPLIANCES,
|
|
209
|
+
wait_for_result: ((_a = options.compliance) === null || _a === void 0 ? void 0 : _a.enableCompliance) && ((_b = options.compliance) === null || _b === void 0 ? void 0 : _b.useLiveCompliance),
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
detailed_viewpoint: {
|
|
213
|
+
centers_on: options.vehicleParts,
|
|
214
|
+
},
|
|
215
|
+
additional_data: getAdditionalData(options),
|
|
216
|
+
};
|
|
217
|
+
return { filename: filename, body: body };
|
|
218
|
+
}
|
|
170
219
|
function createVideoFrameData(options, filetype) {
|
|
171
220
|
var filename = "video-frame-".concat(options.frameIndex, ".").concat(filetype);
|
|
172
221
|
var body = {
|
|
@@ -179,14 +228,30 @@ function createVideoFrameData(options, filetype) {
|
|
|
179
228
|
};
|
|
180
229
|
return { filename: filename, body: body };
|
|
181
230
|
}
|
|
231
|
+
function createVideoManualPhotoData(options, filetype) {
|
|
232
|
+
var filename = "video-manual-photo-".concat(Date.now(), ".").concat(filetype);
|
|
233
|
+
var body = {
|
|
234
|
+
acquisition: {
|
|
235
|
+
strategy: 'upload_multipart_form_keys',
|
|
236
|
+
file_key: MULTIPART_KEY_IMAGE,
|
|
237
|
+
},
|
|
238
|
+
tasks: [types_1.TaskName.DAMAGE_DETECTION],
|
|
239
|
+
additional_data: getAdditionalData(options),
|
|
240
|
+
};
|
|
241
|
+
return { filename: filename, body: body };
|
|
242
|
+
}
|
|
182
243
|
function getAddImageData(options, filetype) {
|
|
183
244
|
switch (options.uploadType) {
|
|
184
245
|
case ImageUploadType.BEAUTY_SHOT:
|
|
185
246
|
return createBeautyShotImageData(options, filetype);
|
|
186
247
|
case ImageUploadType.CLOSE_UP_2_SHOT:
|
|
187
|
-
return
|
|
248
|
+
return create2ShotCloseUpImageData(options, filetype);
|
|
249
|
+
case ImageUploadType.PART_SELECT_SHOT:
|
|
250
|
+
return createPartSelectCloseUpImageData(options, filetype);
|
|
188
251
|
case ImageUploadType.VIDEO_FRAME:
|
|
189
252
|
return createVideoFrameData(options, filetype);
|
|
253
|
+
case ImageUploadType.VIDEO_MANUAL_PHOTO:
|
|
254
|
+
return createVideoManualPhotoData(options, filetype);
|
|
190
255
|
default:
|
|
191
256
|
throw new Error('Unknown image upload type.');
|
|
192
257
|
}
|
|
@@ -276,6 +341,7 @@ function addImage(options, config, dispatch) {
|
|
|
276
341
|
body = _a.sent();
|
|
277
342
|
image = (0, mappers_1.mapApiImage)(body, options.inspectionId, config.thumbnailDomain, options.compliance);
|
|
278
343
|
if (options.uploadType !== ImageUploadType.VIDEO_FRAME &&
|
|
344
|
+
options.uploadType !== ImageUploadType.VIDEO_MANUAL_PHOTO &&
|
|
279
345
|
options.useThumbnailCaching !== false) {
|
|
280
346
|
precacheThumbnail(image).catch(function (error) {
|
|
281
347
|
return console.error("Thumbnail GET request failed: ".concat(error));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkvision/network",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0",
|
|
4
4
|
"license": "BSD-3-Clause-Clear",
|
|
5
5
|
"packageManager": "yarn@3.2.4",
|
|
6
6
|
"description": "MonkJs core package used to communicate with the API",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@monkvision/common": "
|
|
32
|
-
"@monkvision/sights": "
|
|
31
|
+
"@monkvision/common": "5.0.0",
|
|
32
|
+
"@monkvision/sights": "5.0.0",
|
|
33
33
|
"jsonwebtoken": "^9.0.2",
|
|
34
34
|
"jwt-decode": "^4.0.0",
|
|
35
35
|
"ky": "^1.2.0",
|
|
@@ -42,12 +42,12 @@
|
|
|
42
42
|
"react-router-dom": "^6.22.3"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@monkvision/eslint-config-base": "
|
|
46
|
-
"@monkvision/eslint-config-typescript": "
|
|
47
|
-
"@monkvision/jest-config": "
|
|
48
|
-
"@monkvision/prettier-config": "
|
|
49
|
-
"@monkvision/types": "
|
|
50
|
-
"@monkvision/typescript-config": "
|
|
45
|
+
"@monkvision/eslint-config-base": "5.0.0",
|
|
46
|
+
"@monkvision/eslint-config-typescript": "5.0.0",
|
|
47
|
+
"@monkvision/jest-config": "5.0.0",
|
|
48
|
+
"@monkvision/prettier-config": "5.0.0",
|
|
49
|
+
"@monkvision/types": "5.0.0",
|
|
50
|
+
"@monkvision/typescript-config": "5.0.0",
|
|
51
51
|
"@types/jest": "^29.2.2",
|
|
52
52
|
"@types/jsonwebtoken": "^9.0.5",
|
|
53
53
|
"@types/node": "^18.11.9",
|
|
@@ -84,5 +84,5 @@
|
|
|
84
84
|
"url": "https://github.com/monkvision/monkjs/issues"
|
|
85
85
|
},
|
|
86
86
|
"homepage": "https://github.com/monkvision/monkjs",
|
|
87
|
-
"gitHead": "
|
|
87
|
+
"gitHead": "6426efb1b64fde310666b5556fc76aeb7c8f2584"
|
|
88
88
|
}
|