@monkvision/inspection-capture-web 4.2.4 → 4.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/README.md
CHANGED
|
@@ -67,6 +67,7 @@ export function MonkPhotoCapturePage({ authToken }) {
|
|
|
67
67
|
| apiConfig | ApiConfig | The api config used to communicate with the API. Make sure that the user described in the auth token is the same one as the one that created the inspection provided in the `inspectionId` prop. | ✔️ | |
|
|
68
68
|
| onClose | `() => void` | Callback called when the user clicks on the Close button. If this callback is not provided, the button will not be displayed on the screen. | | |
|
|
69
69
|
| onComplete | `() => void` | Callback called when inspection capture is complete. | | |
|
|
70
|
+
| onPictureTaken | `(picture: MonkPicture) => void` | Callback called when the user has taken a picture in the Capture process. | | |
|
|
70
71
|
| lang | <code>string | null</code> | The language to be used by this component. | | `'en'` |
|
|
71
72
|
| enforceOrientation | `DeviceOrientation` | Use this prop to enforce a specific device orientation for the Camera screen. | | |
|
|
72
73
|
| maxUploadDurationWarning | `number` | Max upload duration in milliseconds before showing a bad connection warning to the user. Use `-1` to never display the warning. | | `15000` |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CameraProps } from '@monkvision/camera-web';
|
|
2
2
|
import { MonkApiConfig } from '@monkvision/network';
|
|
3
|
-
import { CameraConfig, CaptureAppConfig, ComplianceOptions, CompressionOptions, Sight } from '@monkvision/types';
|
|
3
|
+
import { CameraConfig, CaptureAppConfig, ComplianceOptions, CompressionOptions, MonkPicture, Sight } from '@monkvision/types';
|
|
4
4
|
import { PhotoCaptureHUDProps } from './PhotoCaptureHUD';
|
|
5
5
|
/**
|
|
6
6
|
* Props of the PhotoCapture component.
|
|
@@ -30,6 +30,10 @@ export interface PhotoCaptureProps extends Pick<CameraProps<PhotoCaptureHUDProps
|
|
|
30
30
|
* Callback called when inspection capture is complete.
|
|
31
31
|
*/
|
|
32
32
|
onComplete?: () => void;
|
|
33
|
+
/**
|
|
34
|
+
* Callback called when a picture has been taken by the user.
|
|
35
|
+
*/
|
|
36
|
+
onPictureTaken?: (picture: MonkPicture) => void;
|
|
33
37
|
/**
|
|
34
38
|
* The language to be used by this component.
|
|
35
39
|
*
|
|
@@ -41,4 +45,4 @@ export interface PhotoCaptureProps extends Pick<CameraProps<PhotoCaptureHUDProps
|
|
|
41
45
|
*/
|
|
42
46
|
validateButtonLabel?: string;
|
|
43
47
|
}
|
|
44
|
-
export declare function PhotoCapture({ sights, inspectionId, apiConfig, additionalTasks, tasksBySight, startTasksOnComplete, onClose, onComplete, maxUploadDurationWarning, showCloseButton, enableCompliance, enableCompliancePerSight, complianceIssues, complianceIssuesPerSight, customComplianceThresholds, customComplianceThresholdsPerSight, useLiveCompliance, allowSkipRetake, enableAddDamage, sightGuidelines, enableTutorial, allowSkipTutorial, enableSightTutorial, enableSightGuidelines, useAdaptiveImageQuality, lang, enforceOrientation, validateButtonLabel, ...initialCameraConfig }: PhotoCaptureProps): JSX.Element;
|
|
48
|
+
export declare function PhotoCapture({ sights, inspectionId, apiConfig, additionalTasks, tasksBySight, startTasksOnComplete, onClose, onComplete, onPictureTaken, maxUploadDurationWarning, showCloseButton, enableCompliance, enableCompliancePerSight, complianceIssues, complianceIssuesPerSight, customComplianceThresholds, customComplianceThresholdsPerSight, useLiveCompliance, allowSkipRetake, enableAddDamage, sightGuidelines, enableTutorial, allowSkipTutorial, enableSightTutorial, enableSightGuidelines, useAdaptiveImageQuality, lang, enforceOrientation, validateButtonLabel, ...initialCameraConfig }: PhotoCaptureProps): JSX.Element;
|
|
@@ -42,7 +42,7 @@ var PhotoCaptureScreen;
|
|
|
42
42
|
})(PhotoCaptureScreen || (PhotoCaptureScreen = {}));
|
|
43
43
|
// No ts-doc for this component : the component exported is PhotoCaptureHOC
|
|
44
44
|
function PhotoCapture(_a) {
|
|
45
|
-
var sights = _a.sights, inspectionId = _a.inspectionId, apiConfig = _a.apiConfig, additionalTasks = _a.additionalTasks, tasksBySight = _a.tasksBySight, _b = _a.startTasksOnComplete, startTasksOnComplete = _b === void 0 ? true : _b, onClose = _a.onClose, onComplete = _a.onComplete, _c = _a.maxUploadDurationWarning, maxUploadDurationWarning = _c === void 0 ? 15000 : _c, _d = _a.showCloseButton, showCloseButton = _d === void 0 ? false : _d, _e = _a.enableCompliance, enableCompliance = _e === void 0 ? true : _e, enableCompliancePerSight = _a.enableCompliancePerSight, complianceIssues = _a.complianceIssues, complianceIssuesPerSight = _a.complianceIssuesPerSight, customComplianceThresholds = _a.customComplianceThresholds, customComplianceThresholdsPerSight = _a.customComplianceThresholdsPerSight, _f = _a.useLiveCompliance, useLiveCompliance = _f === void 0 ? false : _f, _g = _a.allowSkipRetake, allowSkipRetake = _g === void 0 ? false : _g, _h = _a.enableAddDamage, enableAddDamage = _h === void 0 ? true : _h, sightGuidelines = _a.sightGuidelines, _j = _a.enableTutorial, enableTutorial = _j === void 0 ? types_1.PhotoCaptureTutorialOption.FIRST_TIME_ONLY : _j, _k = _a.allowSkipTutorial, allowSkipTutorial = _k === void 0 ? true : _k, _l = _a.enableSightTutorial, enableSightTutorial = _l === void 0 ? true : _l, _m = _a.enableSightGuidelines, enableSightGuidelines = _m === void 0 ? true : _m, _o = _a.useAdaptiveImageQuality, useAdaptiveImageQuality = _o === void 0 ? true : _o, lang = _a.lang, enforceOrientation = _a.enforceOrientation, validateButtonLabel = _a.validateButtonLabel, initialCameraConfig = __rest(_a, ["sights", "inspectionId", "apiConfig", "additionalTasks", "tasksBySight", "startTasksOnComplete", "onClose", "onComplete", "maxUploadDurationWarning", "showCloseButton", "enableCompliance", "enableCompliancePerSight", "complianceIssues", "complianceIssuesPerSight", "customComplianceThresholds", "customComplianceThresholdsPerSight", "useLiveCompliance", "allowSkipRetake", "enableAddDamage", "sightGuidelines", "enableTutorial", "allowSkipTutorial", "enableSightTutorial", "enableSightGuidelines", "useAdaptiveImageQuality", "lang", "enforceOrientation", "validateButtonLabel"]);
|
|
45
|
+
var sights = _a.sights, inspectionId = _a.inspectionId, apiConfig = _a.apiConfig, additionalTasks = _a.additionalTasks, tasksBySight = _a.tasksBySight, _b = _a.startTasksOnComplete, startTasksOnComplete = _b === void 0 ? true : _b, onClose = _a.onClose, onComplete = _a.onComplete, onPictureTaken = _a.onPictureTaken, _c = _a.maxUploadDurationWarning, maxUploadDurationWarning = _c === void 0 ? 15000 : _c, _d = _a.showCloseButton, showCloseButton = _d === void 0 ? false : _d, _e = _a.enableCompliance, enableCompliance = _e === void 0 ? true : _e, enableCompliancePerSight = _a.enableCompliancePerSight, complianceIssues = _a.complianceIssues, complianceIssuesPerSight = _a.complianceIssuesPerSight, customComplianceThresholds = _a.customComplianceThresholds, customComplianceThresholdsPerSight = _a.customComplianceThresholdsPerSight, _f = _a.useLiveCompliance, useLiveCompliance = _f === void 0 ? false : _f, _g = _a.allowSkipRetake, allowSkipRetake = _g === void 0 ? false : _g, _h = _a.enableAddDamage, enableAddDamage = _h === void 0 ? true : _h, sightGuidelines = _a.sightGuidelines, _j = _a.enableTutorial, enableTutorial = _j === void 0 ? types_1.PhotoCaptureTutorialOption.FIRST_TIME_ONLY : _j, _k = _a.allowSkipTutorial, allowSkipTutorial = _k === void 0 ? true : _k, _l = _a.enableSightTutorial, enableSightTutorial = _l === void 0 ? true : _l, _m = _a.enableSightGuidelines, enableSightGuidelines = _m === void 0 ? true : _m, _o = _a.useAdaptiveImageQuality, useAdaptiveImageQuality = _o === void 0 ? true : _o, lang = _a.lang, enforceOrientation = _a.enforceOrientation, validateButtonLabel = _a.validateButtonLabel, initialCameraConfig = __rest(_a, ["sights", "inspectionId", "apiConfig", "additionalTasks", "tasksBySight", "startTasksOnComplete", "onClose", "onComplete", "onPictureTaken", "maxUploadDurationWarning", "showCloseButton", "enableCompliance", "enableCompliancePerSight", "complianceIssues", "complianceIssuesPerSight", "customComplianceThresholds", "customComplianceThresholdsPerSight", "useLiveCompliance", "allowSkipRetake", "enableAddDamage", "sightGuidelines", "enableTutorial", "allowSkipTutorial", "enableSightTutorial", "enableSightGuidelines", "useAdaptiveImageQuality", "lang", "enforceOrientation", "validateButtonLabel"]);
|
|
46
46
|
(0, common_1.useI18nSync)(lang);
|
|
47
47
|
var complianceOptions = (0, common_1.useObjectMemo)({
|
|
48
48
|
enableCompliance: enableCompliance,
|
|
@@ -107,6 +107,7 @@ function PhotoCapture(_a) {
|
|
|
107
107
|
addDamageHandle: addDamageHandle,
|
|
108
108
|
uploadQueue: uploadQueue,
|
|
109
109
|
tasksBySight: tasksBySight,
|
|
110
|
+
onPictureTaken: onPictureTaken,
|
|
110
111
|
});
|
|
111
112
|
var handleOpenGallery = function () {
|
|
112
113
|
setCurrentScreen(PhotoCaptureScreen.GALLERY);
|
|
@@ -24,6 +24,10 @@ export interface UseTakePictureParams {
|
|
|
24
24
|
* will be used.
|
|
25
25
|
*/
|
|
26
26
|
tasksBySight?: Record<string, TaskName[]>;
|
|
27
|
+
/**
|
|
28
|
+
* User defined callback that can be called when a picture has been taken in the PhotoCapture process.
|
|
29
|
+
*/
|
|
30
|
+
onPictureTaken?: (picture: MonkPicture) => void;
|
|
27
31
|
}
|
|
28
32
|
/**
|
|
29
33
|
* Callback called when the user has taken a picture.
|
|
@@ -32,4 +36,4 @@ export type HandleTakePictureFunction = (picture: MonkPicture) => void;
|
|
|
32
36
|
/**
|
|
33
37
|
* Custom hook used to generate the callback called when the user has taken a picture to handle picture upload etc.
|
|
34
38
|
*/
|
|
35
|
-
export declare function usePictureTaken({ sightState, addDamageHandle, uploadQueue, tasksBySight, }: UseTakePictureParams): HandleTakePictureFunction;
|
|
39
|
+
export declare function usePictureTaken({ sightState, addDamageHandle, uploadQueue, tasksBySight, onPictureTaken, }: UseTakePictureParams): HandleTakePictureFunction;
|
|
@@ -8,10 +8,11 @@ var useAddDamageMode_1 = require("./useAddDamageMode");
|
|
|
8
8
|
* Custom hook used to generate the callback called when the user has taken a picture to handle picture upload etc.
|
|
9
9
|
*/
|
|
10
10
|
function usePictureTaken(_a) {
|
|
11
|
-
var sightState = _a.sightState, addDamageHandle = _a.addDamageHandle, uploadQueue = _a.uploadQueue, tasksBySight = _a.tasksBySight;
|
|
11
|
+
var sightState = _a.sightState, addDamageHandle = _a.addDamageHandle, uploadQueue = _a.uploadQueue, tasksBySight = _a.tasksBySight, onPictureTaken = _a.onPictureTaken;
|
|
12
12
|
var trackEvent = (0, analytics_1.useAnalytics)().trackEvent;
|
|
13
13
|
return (0, react_1.useCallback)(function (picture) {
|
|
14
14
|
var _a;
|
|
15
|
+
onPictureTaken === null || onPictureTaken === void 0 ? void 0 : onPictureTaken(picture);
|
|
15
16
|
sightState.setLastPictureTakenUri(picture.uri);
|
|
16
17
|
var upload = addDamageHandle.mode === useAddDamageMode_1.PhotoCaptureMode.SIGHT
|
|
17
18
|
? {
|
|
@@ -39,6 +40,7 @@ function usePictureTaken(_a) {
|
|
|
39
40
|
uploadQueue.push,
|
|
40
41
|
sightState.takeSelectedSight,
|
|
41
42
|
addDamageHandle.updatePhotoCaptureModeAfterPictureTaken,
|
|
43
|
+
onPictureTaken,
|
|
42
44
|
]);
|
|
43
45
|
}
|
|
44
46
|
exports.usePictureTaken = usePictureTaken;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@monkvision/inspection-capture-web",
|
|
3
|
-
"version": "4.2.
|
|
3
|
+
"version": "4.2.6",
|
|
4
4
|
"license": "BSD-3-Clause-Clear",
|
|
5
5
|
"packageManager": "yarn@3.2.4",
|
|
6
6
|
"description": "MonkJs inspection capture package for React (web) used to implement the Monk inspection capture workflow",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"lint:fix": "yarn run prettier:fix && yarn run eslint:fix"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@monkvision/analytics": "4.2.
|
|
32
|
-
"@monkvision/camera-web": "4.2.
|
|
33
|
-
"@monkvision/common": "4.2.
|
|
34
|
-
"@monkvision/common-ui-web": "4.2.
|
|
35
|
-
"@monkvision/network": "4.2.
|
|
36
|
-
"@monkvision/sights": "4.2.
|
|
31
|
+
"@monkvision/analytics": "4.2.6",
|
|
32
|
+
"@monkvision/camera-web": "4.2.6",
|
|
33
|
+
"@monkvision/common": "4.2.6",
|
|
34
|
+
"@monkvision/common-ui-web": "4.2.6",
|
|
35
|
+
"@monkvision/network": "4.2.6",
|
|
36
|
+
"@monkvision/sights": "4.2.6",
|
|
37
37
|
"i18next": "^23.4.5",
|
|
38
38
|
"react-i18next": "^13.2.0"
|
|
39
39
|
},
|
|
@@ -44,13 +44,13 @@
|
|
|
44
44
|
"react-router-dom": "^6.22.3"
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
|
-
"@monkvision/eslint-config-base": "4.2.
|
|
48
|
-
"@monkvision/eslint-config-typescript": "4.2.
|
|
49
|
-
"@monkvision/eslint-config-typescript-react": "4.2.
|
|
50
|
-
"@monkvision/jest-config": "4.2.
|
|
51
|
-
"@monkvision/prettier-config": "4.2.
|
|
52
|
-
"@monkvision/test-utils": "4.2.
|
|
53
|
-
"@monkvision/typescript-config": "4.2.
|
|
47
|
+
"@monkvision/eslint-config-base": "4.2.6",
|
|
48
|
+
"@monkvision/eslint-config-typescript": "4.2.6",
|
|
49
|
+
"@monkvision/eslint-config-typescript-react": "4.2.6",
|
|
50
|
+
"@monkvision/jest-config": "4.2.6",
|
|
51
|
+
"@monkvision/prettier-config": "4.2.6",
|
|
52
|
+
"@monkvision/test-utils": "4.2.6",
|
|
53
|
+
"@monkvision/typescript-config": "4.2.6",
|
|
54
54
|
"@testing-library/react": "^12.1.5",
|
|
55
55
|
"@testing-library/react-hooks": "^8.0.1",
|
|
56
56
|
"@types/copyfiles": "^2",
|
|
@@ -93,5 +93,5 @@
|
|
|
93
93
|
"url": "https://github.com/monkvision/monkjs/issues"
|
|
94
94
|
},
|
|
95
95
|
"homepage": "https://github.com/monkvision/monkjs",
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "0f60c8e33e04a582b60cb0a664ae9b3160c84a51"
|
|
97
97
|
}
|