@monkvision/network
Advanced tools
Comparing version 4.5.6 to 4.6.0
{ | ||
"name": "@monkvision/network", | ||
"version": "4.5.5", | ||
"version": "4.5.6", | ||
"license": "BSD-3-Clause-Clear", | ||
@@ -31,4 +31,4 @@ "packageManager": "yarn@3.2.4", | ||
"dependencies": { | ||
"@monkvision/common": "4.5.5", | ||
"@monkvision/sights": "4.5.5", | ||
"@monkvision/common": "4.5.6", | ||
"@monkvision/sights": "4.5.6", | ||
"jsonwebtoken": "^9.0.2", | ||
@@ -46,8 +46,8 @@ "jwt-decode": "^4.0.0", | ||
"devDependencies": { | ||
"@monkvision/eslint-config-base": "4.5.5", | ||
"@monkvision/eslint-config-typescript": "4.5.5", | ||
"@monkvision/jest-config": "4.5.5", | ||
"@monkvision/prettier-config": "4.5.5", | ||
"@monkvision/types": "4.5.5", | ||
"@monkvision/typescript-config": "4.5.5", | ||
"@monkvision/eslint-config-base": "4.5.6", | ||
"@monkvision/eslint-config-typescript": "4.5.6", | ||
"@monkvision/jest-config": "4.5.6", | ||
"@monkvision/prettier-config": "4.5.6", | ||
"@monkvision/types": "4.5.6", | ||
"@monkvision/typescript-config": "4.5.6", | ||
"@types/jest": "^29.2.2", | ||
@@ -54,0 +54,0 @@ "@types/jsonwebtoken": "^9.0.5", |
import { Dispatch } from 'react'; | ||
import { MonkCreatedOneImageAction } from '@monkvision/common'; | ||
import { ComplianceOptions, Image, MonkPicture, TaskName } from '@monkvision/types'; | ||
import { ComplianceOptions, Image, MonkPicture, TaskName, VehiclePart } from '@monkvision/types'; | ||
import { MonkApiConfig } from '../config'; | ||
@@ -21,5 +21,14 @@ import { ApiImage } from '../models'; | ||
/** | ||
* Upload type corresponding to a close-up picture (add-damage) in the PhotoCapture process, when using the | ||
* part-select-shot add damage workflow. | ||
*/ | ||
PART_SELECT_SHOT = "part_select_shot", | ||
/** | ||
* Upload type corresponding to a video frame in the VideoCapture process. | ||
*/ | ||
VIDEO_FRAME = "video_frame" | ||
VIDEO_FRAME = "video_frame", | ||
/** | ||
* Upload type corresponding to a manual photo in the VideoCapture process. | ||
*/ | ||
VIDEO_MANUAL_PHOTO = "video_manual_photo" | ||
} | ||
@@ -96,2 +105,31 @@ /** | ||
/** | ||
* Options specified when adding a close up (an "add damage" image) to an inspection using the part select process. | ||
*/ | ||
export interface AddPartSelectCloseUpImageOptions { | ||
/** | ||
* The type of the image upload : `ImageUploadType.PART_SELECT_SHOT`; | ||
*/ | ||
uploadType: ImageUploadType.PART_SELECT_SHOT; | ||
/** | ||
* The picture to add to the inspection. | ||
*/ | ||
picture: MonkPicture; | ||
/** | ||
* The ID of the inspection to add the image to. | ||
*/ | ||
inspectionId: string; | ||
/** | ||
* List of damage parts chosen by User with part selected wireframe | ||
*/ | ||
vehicleParts: VehiclePart[]; | ||
/** | ||
* Boolean indicating if a thumbnail request will be sent when addImage is called. | ||
*/ | ||
useThumbnailCaching?: boolean; | ||
/** | ||
* Additional options used to configure the compliance locally. | ||
*/ | ||
compliance?: ComplianceOptions; | ||
} | ||
/** | ||
* Options specififed when adding a video frame to a VideoCapture inspection. | ||
@@ -123,5 +161,22 @@ */ | ||
/** | ||
* Options specififed when adding a manual video photo to a VideoCapture inspection. | ||
*/ | ||
export interface AddVideoManualPhotoOptions { | ||
/** | ||
* The type of the image upload : `ImageUploadType.VIDEO_MANUAL_PHOTO`; | ||
*/ | ||
uploadType: ImageUploadType.VIDEO_MANUAL_PHOTO; | ||
/** | ||
* The picture to add to the inspection. | ||
*/ | ||
picture: MonkPicture; | ||
/** | ||
* The ID of the inspection to add the video frame to. | ||
*/ | ||
inspectionId: string; | ||
} | ||
/** | ||
* Union type describing the different options that can be specified when adding a picture to an inspection. | ||
*/ | ||
export type AddImageOptions = AddBeautyShotImageOptions | Add2ShotCloseUpImageOptions | AddVideoFrameOptions; | ||
export type AddImageOptions = AddBeautyShotImageOptions | Add2ShotCloseUpImageOptions | AddVideoFrameOptions | AddVideoManualPhotoOptions | AddPartSelectCloseUpImageOptions; | ||
/** | ||
@@ -128,0 +183,0 @@ * Type definition for the result of the `addImage` API request. |
@@ -76,8 +76,17 @@ "use strict"; | ||
/** | ||
* Upload type corresponding to a close-up picture (add-damage) in the PhotoCapture process, when using the | ||
* part-select-shot add damage workflow. | ||
*/ | ||
ImageUploadType["PART_SELECT_SHOT"] = "part_select_shot"; | ||
/** | ||
* Upload type corresponding to a video frame in the VideoCapture process. | ||
*/ | ||
ImageUploadType["VIDEO_FRAME"] = "video_frame"; | ||
/** | ||
* Upload type corresponding to a manual photo in the VideoCapture process. | ||
*/ | ||
ImageUploadType["VIDEO_MANUAL_PHOTO"] = "video_manual_photo"; | ||
})(ImageUploadType = exports.ImageUploadType || (exports.ImageUploadType = {})); | ||
function getImageType(options) { | ||
if (options.uploadType === ImageUploadType.CLOSE_UP_2_SHOT) { | ||
if ([ImageUploadType.CLOSE_UP_2_SHOT, ImageUploadType.PART_SELECT_SHOT].includes(options.uploadType)) { | ||
return types_1.ImageType.CLOSE_UP; | ||
@@ -99,2 +108,19 @@ } | ||
} | ||
if (options.uploadType === ImageUploadType.VIDEO_MANUAL_PHOTO) { | ||
return { | ||
en: "Video Manual Photo", | ||
fr: "Photo Manuelle Vid\u00E9o", | ||
de: "Foto Manuell Video", | ||
nl: "Foto-handleiding Video", | ||
}; | ||
} | ||
if (options.uploadType === ImageUploadType.PART_SELECT_SHOT) { | ||
var partsTranslation = options.vehicleParts.map(function (part) { return common_1.vehiclePartLabels[part]; }); | ||
return { | ||
en: "Close Up on ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')), | ||
fr: "Photo Zoom\u00E9e sur ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')), | ||
de: "Gezoomtes an ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')), | ||
nl: "Nabij aan ".concat(partsTranslation.map(function (part) { return part.en; }).join(', ')), | ||
}; | ||
} | ||
return { | ||
@@ -149,3 +175,3 @@ en: options.firstShot ? 'Close Up (part)' : 'Close Up (damage)', | ||
} | ||
function createCloseUpImageData(options, filetype) { | ||
function create2ShotCloseUpImageData(options, filetype) { | ||
var _a, _b; | ||
@@ -173,2 +199,25 @@ var prefix = options.firstShot ? 'closeup-part' : 'closeup-damage'; | ||
} | ||
function createPartSelectCloseUpImageData(options, filetype) { | ||
var _a, _b; | ||
var filename = "part-select-".concat(options.inspectionId, "-").concat(Date.now(), ".").concat(filetype); | ||
var body = { | ||
acquisition: { | ||
strategy: 'upload_multipart_form_keys', | ||
file_key: MULTIPART_KEY_IMAGE, | ||
}, | ||
image_type: types_1.ImageType.CLOSE_UP, | ||
tasks: [ | ||
types_1.TaskName.DAMAGE_DETECTION, | ||
{ | ||
name: types_1.TaskName.COMPLIANCES, | ||
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), | ||
}, | ||
], | ||
detailed_viewpoint: { | ||
centers_on: options.vehicleParts, | ||
}, | ||
additional_data: getAdditionalData(options), | ||
}; | ||
return { filename: filename, body: body }; | ||
} | ||
function createVideoFrameData(options, filetype) { | ||
@@ -186,2 +235,14 @@ var filename = "video-frame-".concat(options.frameIndex, ".").concat(filetype); | ||
} | ||
function createVideoManualPhotoData(options, filetype) { | ||
var filename = "video-manual-photo-".concat(Date.now(), ".").concat(filetype); | ||
var body = { | ||
acquisition: { | ||
strategy: 'upload_multipart_form_keys', | ||
file_key: MULTIPART_KEY_IMAGE, | ||
}, | ||
tasks: [types_1.TaskName.DAMAGE_DETECTION], | ||
additional_data: getAdditionalData(options), | ||
}; | ||
return { filename: filename, body: body }; | ||
} | ||
function getAddImageData(options, filetype) { | ||
@@ -192,5 +253,9 @@ switch (options.uploadType) { | ||
case ImageUploadType.CLOSE_UP_2_SHOT: | ||
return createCloseUpImageData(options, filetype); | ||
return create2ShotCloseUpImageData(options, filetype); | ||
case ImageUploadType.PART_SELECT_SHOT: | ||
return createPartSelectCloseUpImageData(options, filetype); | ||
case ImageUploadType.VIDEO_FRAME: | ||
return createVideoFrameData(options, filetype); | ||
case ImageUploadType.VIDEO_MANUAL_PHOTO: | ||
return createVideoManualPhotoData(options, filetype); | ||
default: | ||
@@ -285,2 +350,3 @@ throw new Error('Unknown image upload type.'); | ||
if (options.uploadType !== ImageUploadType.VIDEO_FRAME && | ||
options.uploadType !== ImageUploadType.VIDEO_MANUAL_PHOTO && | ||
options.useThumbnailCaching !== false) { | ||
@@ -287,0 +353,0 @@ precacheThumbnail(image).catch(function (error) { |
@@ -75,3 +75,4 @@ import { TranslationObject } from '@monkvision/types'; | ||
compliances?: ApiCompliance; | ||
detailed_viewpoint?: ApiViewpointComponent; | ||
additional_data?: ApiImageAdditionalData; | ||
} |
{ | ||
"name": "@monkvision/network", | ||
"version": "4.5.6", | ||
"version": "4.6.0", | ||
"license": "BSD-3-Clause-Clear", | ||
@@ -31,4 +31,4 @@ "packageManager": "yarn@3.2.4", | ||
"dependencies": { | ||
"@monkvision/common": "4.5.6", | ||
"@monkvision/sights": "4.5.6", | ||
"@monkvision/common": "4.6.0", | ||
"@monkvision/sights": "4.6.0", | ||
"jsonwebtoken": "^9.0.2", | ||
@@ -46,8 +46,8 @@ "jwt-decode": "^4.0.0", | ||
"devDependencies": { | ||
"@monkvision/eslint-config-base": "4.5.6", | ||
"@monkvision/eslint-config-typescript": "4.5.6", | ||
"@monkvision/jest-config": "4.5.6", | ||
"@monkvision/prettier-config": "4.5.6", | ||
"@monkvision/types": "4.5.6", | ||
"@monkvision/typescript-config": "4.5.6", | ||
"@monkvision/eslint-config-base": "4.6.0", | ||
"@monkvision/eslint-config-typescript": "4.6.0", | ||
"@monkvision/jest-config": "4.6.0", | ||
"@monkvision/prettier-config": "4.6.0", | ||
"@monkvision/types": "4.6.0", | ||
"@monkvision/typescript-config": "4.6.0", | ||
"@types/jest": "^29.2.2", | ||
@@ -89,3 +89,3 @@ "@types/jsonwebtoken": "^9.0.5", | ||
"homepage": "https://github.com/monkvision/monkjs", | ||
"gitHead": "c12e283e4abf1f810fdbc924a2d199652b92db30" | ||
"gitHead": "68caf5a157e344b2187519616c9fe35eecafc65b" | ||
} |
227303
4648
+ Added@monkvision/analytics@4.6.0(transitive)
+ Added@monkvision/common@4.6.0(transitive)
+ Added@monkvision/monitoring@4.6.0(transitive)
+ Added@monkvision/sights@4.6.0(transitive)
+ Added@monkvision/types@4.6.0(transitive)
- Removed@monkvision/analytics@4.5.6(transitive)
- Removed@monkvision/common@4.5.6(transitive)
- Removed@monkvision/monitoring@4.5.6(transitive)
- Removed@monkvision/sights@4.5.6(transitive)
- Removed@monkvision/types@4.5.6(transitive)
Updated@monkvision/common@4.6.0
Updated@monkvision/sights@4.6.0