@robotical/webapp-types 3.21.17 → 3.21.19
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/dist-types/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "marty-web-app",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.19",
|
|
4
4
|
"private": true,
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": ">=20"
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@robotical/cog-shooter-game": "^0.1.27",
|
|
17
17
|
"@robotical/jumping-game": "^0.1.29",
|
|
18
18
|
"@robotical/martyblocks": "^4.0.67",
|
|
19
|
-
"@robotical/martyblocksjr": "^4.3.
|
|
19
|
+
"@robotical/martyblocksjr": "^4.3.3",
|
|
20
20
|
"@robotical/maze": "^0.1.22",
|
|
21
21
|
"@robotical/rc-sequencer": "^1.1.15",
|
|
22
22
|
"@robotical/ricjs-robotical-addons": "^1.2.8",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { RaftTypeE } from "../../../types/raft";
|
|
2
|
-
export type QRScannerErrorDisposition = "permission-denied" | "detector-unavailable" | "unexpected";
|
|
2
|
+
export type QRScannerErrorDisposition = "permission-denied" | "no-camera" | "camera-in-use" | "detector-unavailable" | "unexpected";
|
|
3
3
|
export declare const classifyQRScannerError: (error: unknown) => QRScannerErrorDisposition;
|
|
4
4
|
export declare const reportQRScannerError: (error: unknown) => QRScannerErrorDisposition;
|
|
5
5
|
type Props = {
|
|
@@ -82,6 +82,16 @@ export var classifyQRScannerError = function (error) {
|
|
|
82
82
|
causeName === "PermissionDeniedError") {
|
|
83
83
|
return "permission-denied";
|
|
84
84
|
}
|
|
85
|
+
if (errorKind === "no-camera" ||
|
|
86
|
+
errorName === "NotFoundError" ||
|
|
87
|
+
causeName === "NotFoundError") {
|
|
88
|
+
return "no-camera";
|
|
89
|
+
}
|
|
90
|
+
if (errorKind === "in-use" ||
|
|
91
|
+
errorName === "NotReadableError" ||
|
|
92
|
+
causeName === "NotReadableError") {
|
|
93
|
+
return "camera-in-use";
|
|
94
|
+
}
|
|
85
95
|
if ((errorName === "NotSupportedError" || causeName === "NotSupportedError") &&
|
|
86
96
|
[errorMessage, causeMessage].some(function (message) {
|
|
87
97
|
return typeof message === "string" &&
|
|
@@ -97,6 +107,14 @@ export var reportQRScannerError = function (error) {
|
|
|
97
107
|
Logger.warn(SHOW_LOGS, TAG, "QR camera permission was not granted", error);
|
|
98
108
|
return disposition;
|
|
99
109
|
}
|
|
110
|
+
if (disposition === "no-camera") {
|
|
111
|
+
Logger.warn(SHOW_LOGS, TAG, "No QR camera was found", error);
|
|
112
|
+
return disposition;
|
|
113
|
+
}
|
|
114
|
+
if (disposition === "camera-in-use") {
|
|
115
|
+
Logger.warn(SHOW_LOGS, TAG, "QR camera is already in use", error);
|
|
116
|
+
return disposition;
|
|
117
|
+
}
|
|
100
118
|
var cause = getErrorProperty(error, "cause");
|
|
101
119
|
if (cause !== undefined) {
|
|
102
120
|
Logger.error(SHOW_LOGS, TAG, "QR scanner failed", cause, error);
|
|
@@ -197,12 +215,20 @@ function QRContent(_a) {
|
|
|
197
215
|
if (!isActiveRef.current) {
|
|
198
216
|
return;
|
|
199
217
|
}
|
|
200
|
-
|
|
201
|
-
|
|
218
|
+
var disposition = reportQRScannerError(error);
|
|
219
|
+
if (disposition === "detector-unavailable") {
|
|
220
|
+
resetBarcodeDetectorModule();
|
|
221
|
+
onScannerUnavailable();
|
|
222
|
+
window.applicationManager.toaster.error("QR scanning is unavailable. Please use LED verification or select QR Code Verification to try again.", { autoClose: false });
|
|
223
|
+
}
|
|
224
|
+
else if (disposition === "no-camera") {
|
|
225
|
+
onScannerUnavailable();
|
|
226
|
+
window.applicationManager.toaster.error("No camera was found. Connect a camera and select QR Code Verification to try again, or use LED verification.", { autoClose: false });
|
|
227
|
+
}
|
|
228
|
+
else if (disposition === "camera-in-use") {
|
|
229
|
+
onScannerUnavailable();
|
|
230
|
+
window.applicationManager.toaster.error("The camera is already in use. Close the other app using it and select QR Code Verification to try again, or use LED verification.", { autoClose: false });
|
|
202
231
|
}
|
|
203
|
-
resetBarcodeDetectorModule();
|
|
204
|
-
onScannerUnavailable();
|
|
205
|
-
window.applicationManager.toaster.error("QR scanning is unavailable. Please use LED verification or select QR Code Verification to try again.", { autoClose: false });
|
|
206
232
|
};
|
|
207
233
|
var isWebapp = ((_b = window.applicationManager.deviceInfo) === null || _b === void 0 ? void 0 : _b.manufacturer) === "Webapp";
|
|
208
234
|
return (_jsx("div", __assign({ className: styles.QRcontainer }, { children: _jsx("div", __assign({ className: styles.QRscannerContainer }, { children: _jsx(SwitchableCameraScanner, { styles: { container: { transform: isWebapp ? 'scaleX(-1)' : 'none' } }, onError: onScannerError, formats: [
|