@monkvision/inspection-capture-web 4.0.10 → 4.0.12

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.
@@ -140,6 +140,7 @@ function PhotoCapture(_a) {
140
140
  });
141
141
  allowRedirect();
142
142
  onComplete === null || onComplete === void 0 ? void 0 : onComplete();
143
+ sightState.setIsInspectionCompleted(true);
143
144
  })
144
145
  .catch(function (err) {
145
146
  loading.onError(err);
@@ -173,6 +174,6 @@ function PhotoCapture(_a) {
173
174
  onCloseTutorial: closeTutorial,
174
175
  allowSkipTutorial: allowSkipTutorial,
175
176
  };
176
- return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: PhotoCapture_styles_1.styles['container'] }, { children: [currentScreen === PhotoCaptureScreen.CAMERA && isViolatingEnforcedOrientation && ((0, jsx_runtime_1.jsxs)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorContainer'] }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorTitleContainer'] }, { children: [(0, jsx_runtime_1.jsx)(common_ui_web_1.Icon, { icon: 'rotate', primaryColor: 'text-primary', size: 30 }), (0, jsx_runtime_1.jsx)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorTitle'] }, { children: t('photo.orientationError.title') }))] })), (0, jsx_runtime_1.jsx)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorDescription'] }, { children: t('photo.orientationError.description') }))] }))), currentScreen === PhotoCaptureScreen.CAMERA && !isViolatingEnforcedOrientation && ((0, jsx_runtime_1.jsx)(camera_web_1.Camera, __assign({ HUDComponent: PhotoCaptureHUD_1.PhotoCaptureHUD, onPictureTaken: handlePictureTaken, hudProps: hudProps }, adaptiveCameraConfig))), currentScreen === PhotoCaptureScreen.GALLERY && ((0, jsx_runtime_1.jsx)(common_ui_web_1.InspectionGallery, __assign({ inspectionId: inspectionId, apiConfig: apiConfig, captureMode: true, lang: lang, showBackButton: true, sights: sights, allowSkipRetake: allowSkipRetake, onBack: handleGalleryBack, onNavigateToCapture: handleNavigateToCapture, onValidate: handleGalleryValidate, enableAddDamage: enableAddDamage, validateButtonLabel: validateButtonLabel }, complianceOptions))), (0, jsx_runtime_1.jsx)(common_ui_web_1.BackdropDialog, { show: isBadConnectionWarningDialogDisplayed, showCancelButton: false, dialogIcon: 'warning-outline', dialogIconPrimaryColor: 'caution-base', message: t('photo.badConnectionWarning.message'), confirmLabel: t('photo.badConnectionWarning.confirm'), onConfirm: closeBadConnectionWarningDialog })] })));
177
+ return ((0, jsx_runtime_1.jsxs)("div", __assign({ style: PhotoCapture_styles_1.styles['container'] }, { children: [currentScreen === PhotoCaptureScreen.CAMERA && isViolatingEnforcedOrientation && ((0, jsx_runtime_1.jsxs)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorContainer'] }, { children: [(0, jsx_runtime_1.jsxs)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorTitleContainer'] }, { children: [(0, jsx_runtime_1.jsx)(common_ui_web_1.Icon, { icon: 'rotate', primaryColor: 'text-primary', size: 30 }), (0, jsx_runtime_1.jsx)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorTitle'] }, { children: t('photo.orientationError.title') }))] })), (0, jsx_runtime_1.jsx)("div", __assign({ style: PhotoCapture_styles_1.styles['orientationErrorDescription'] }, { children: t('photo.orientationError.description') }))] }))), currentScreen === PhotoCaptureScreen.CAMERA && !isViolatingEnforcedOrientation && ((0, jsx_runtime_1.jsx)(camera_web_1.Camera, __assign({ HUDComponent: PhotoCaptureHUD_1.PhotoCaptureHUD, onPictureTaken: handlePictureTaken, hudProps: hudProps }, adaptiveCameraConfig))), currentScreen === PhotoCaptureScreen.GALLERY && ((0, jsx_runtime_1.jsx)(common_ui_web_1.InspectionGallery, __assign({ inspectionId: inspectionId, apiConfig: apiConfig, captureMode: true, lang: lang, showBackButton: true, sights: sights, allowSkipRetake: allowSkipRetake, onBack: handleGalleryBack, onNavigateToCapture: handleNavigateToCapture, onValidate: handleGalleryValidate, enableAddDamage: enableAddDamage, validateButtonLabel: validateButtonLabel, isInspectionCompleted: sightState.isInspectionCompleted }, complianceOptions))), (0, jsx_runtime_1.jsx)(common_ui_web_1.BackdropDialog, { show: isBadConnectionWarningDialogDisplayed, showCancelButton: false, dialogIcon: 'warning-outline', dialogIconPrimaryColor: 'caution-base', message: t('photo.badConnectionWarning.message'), confirmLabel: t('photo.badConnectionWarning.confirm'), onConfirm: closeBadConnectionWarningDialog })] })));
177
178
  }
178
179
  exports.PhotoCapture = PhotoCapture;
@@ -54,6 +54,6 @@ var PhotoCapture_1 = require("./PhotoCapture");
54
54
  * );
55
55
  * }
56
56
  */
57
- exports.PhotoCaptureHOC = (0, common_1.i18nWrap)(function (props) {
57
+ exports.PhotoCaptureHOC = (0, common_1.i18nWrap)(function PhotoCaptureHOC(props) {
58
58
  return ((0, jsx_runtime_1.jsx)(common_1.MonkProvider, { children: (0, jsx_runtime_1.jsx)(PhotoCapture_1.PhotoCapture, __assign({}, props)) }));
59
59
  }, i18n_1.i18nInspectionCaptureWeb);
@@ -1,3 +1,4 @@
1
+ import { Dispatch, SetStateAction } from 'react';
1
2
  import { MonkApiConfig } from '@monkvision/network';
2
3
  import { LoadingState } from '@monkvision/common';
3
4
  import { ComplianceOptions, Sight, TaskName } from '@monkvision/types';
@@ -37,6 +38,14 @@ export interface PhotoCaptureSightState {
37
38
  * Callback that can be used to retry fetching this state object from the API in case the previous fetch failed.
38
39
  */
39
40
  retryLoadingInspection: () => void;
41
+ /**
42
+ * Boolean indicating if the inspection is completed or not.
43
+ */
44
+ isInspectionCompleted: boolean;
45
+ /**
46
+ * Callback used to manually update the completion state of the inspection.
47
+ */
48
+ setIsInspectionCompleted: Dispatch<SetStateAction<boolean>>;
40
49
  }
41
50
  /**
42
51
  * Parameters of the usePhotoCaptureSightState hook.
@@ -67,7 +67,8 @@ function usePhotoCaptureSightState(_a) {
67
67
  var _b = (0, react_1.useState)(0), retryCount = _b[0], setRetryCount = _b[1];
68
68
  var _c = (0, react_1.useState)(null), lastPictureTakenUri = _c[0], setLastPictureTakenUri = _c[1];
69
69
  var _d = (0, react_1.useState)(captureSights[0]), selectedSight = _d[0], setSelectedSight = _d[1];
70
- var _e = (0, react_1.useState)([]), sightsTaken = _e[0], setSightsTaken = _e[1];
70
+ var _e = (0, react_1.useState)(false), isInspectionCompleted = _e[0], setIsInspectionCompleted = _e[1];
71
+ var _f = (0, react_1.useState)([]), sightsTaken = _f[0], setSightsTaken = _f[1];
71
72
  var getInspection = (0, network_1.useMonkApi)(apiConfig).getInspection;
72
73
  var handleError = (0, monitoring_1.useMonitoring)().handleError;
73
74
  var state = (0, common_1.useMonkState)().state;
@@ -117,6 +118,9 @@ function usePhotoCaptureSightState(_a) {
117
118
  }
118
119
  setLastPictureTakenUri(getLastPictureTakenUri(inspectionId, response));
119
120
  loading.onSuccess();
121
+ setIsInspectionCompleted(!response.entities.tasks.some(function (task) {
122
+ return task.inspectionId === inspectionId && task.status === types_1.ProgressStatus.NOT_STARTED;
123
+ }));
120
124
  }
121
125
  catch (err) {
122
126
  handleError(err);
@@ -187,6 +191,8 @@ function usePhotoCaptureSightState(_a) {
187
191
  });
188
192
  };
189
193
  return (0, common_1.useObjectMemo)({
194
+ isInspectionCompleted: isInspectionCompleted,
195
+ setIsInspectionCompleted: setIsInspectionCompleted,
190
196
  selectedSight: selectedSight,
191
197
  sightsTaken: sightsTaken,
192
198
  selectSight: selectSight,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@monkvision/inspection-capture-web",
3
- "version": "4.0.10",
3
+ "version": "4.0.12",
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.0.10",
32
- "@monkvision/camera-web": "4.0.10",
33
- "@monkvision/common": "4.0.10",
34
- "@monkvision/common-ui-web": "4.0.10",
35
- "@monkvision/network": "4.0.10",
36
- "@monkvision/sights": "4.0.10",
31
+ "@monkvision/analytics": "4.0.12",
32
+ "@monkvision/camera-web": "4.0.12",
33
+ "@monkvision/common": "4.0.12",
34
+ "@monkvision/common-ui-web": "4.0.12",
35
+ "@monkvision/network": "4.0.12",
36
+ "@monkvision/sights": "4.0.12",
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.0.10",
48
- "@monkvision/eslint-config-typescript": "4.0.10",
49
- "@monkvision/eslint-config-typescript-react": "4.0.10",
50
- "@monkvision/jest-config": "4.0.10",
51
- "@monkvision/prettier-config": "4.0.10",
52
- "@monkvision/test-utils": "4.0.10",
53
- "@monkvision/typescript-config": "4.0.10",
47
+ "@monkvision/eslint-config-base": "4.0.12",
48
+ "@monkvision/eslint-config-typescript": "4.0.12",
49
+ "@monkvision/eslint-config-typescript-react": "4.0.12",
50
+ "@monkvision/jest-config": "4.0.12",
51
+ "@monkvision/prettier-config": "4.0.12",
52
+ "@monkvision/test-utils": "4.0.12",
53
+ "@monkvision/typescript-config": "4.0.12",
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": "e3e512ea9f21560bd9625c32749d5a56898bed72"
96
+ "gitHead": "ea97b32b05c280175bbeda6b6af10f1cf1a192bf"
97
97
  }