jclib-ui 1.0.276 → 1.0.277
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/jclib-ui.es.js +8 -3
- package/dist/jclib-ui.es.js.map +1 -1
- package/dist/jclib-ui.umd.js +16 -16
- package/dist/jclib-ui.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/jclib-ui.es.js
CHANGED
|
@@ -16076,15 +16076,20 @@ var Vo = /* @__PURE__ */ function() {
|
|
|
16076
16076
|
return Go({ constraints: i2, scanDelay: u2, onResult: c2, videoId: f2 }), React.createElement("section", { className: s2, style: n2 }, React.createElement("div", { style: Xo(Xo({}, Wo.container), r) }, !!a2 && React.createElement(a2, null), React.createElement("video", { muted: true, id: f2, style: Xo(Xo(Xo({}, Wo.video), o2), { transform: "user" === (null == i2 ? void 0 : i2.facingMode) && "scaleX(-1)" }) })));
|
|
16077
16077
|
};
|
|
16078
16078
|
jo.displayName = "QrReader", jo.defaultProps = { constraints: { facingMode: "user" }, videoId: "video", scanDelay: 500 };
|
|
16079
|
+
const ERR_NOT_FOUND = "Requested device not found";
|
|
16080
|
+
const ERR_PERMIS_DENIED = "Permission denied";
|
|
16081
|
+
const ERR_DEFAULT = "Dispositivo de câmera não foi encontrado, está indisponível ou bloqueado!";
|
|
16079
16082
|
function QRCodeReader({ onResult, setVisible, title, helpLink }) {
|
|
16080
16083
|
const [error, setError] = useState("");
|
|
16081
16084
|
const [fatalError, setFatalError] = useState(false);
|
|
16082
16085
|
function handleResult(result, error2) {
|
|
16083
|
-
|
|
16084
|
-
|
|
16085
|
-
if (
|
|
16086
|
+
let errorMess = error2 == null ? void 0 : error2.message;
|
|
16087
|
+
if (errorMess) {
|
|
16088
|
+
if ([ERR_NOT_FOUND, ERR_PERMIS_DENIED].includes(errorMess)) {
|
|
16089
|
+
errorMess = ERR_DEFAULT;
|
|
16086
16090
|
setFatalError(true);
|
|
16087
16091
|
}
|
|
16092
|
+
setError(`Ocorreu um erro ao fazer a leitura: ${errorMess}`);
|
|
16088
16093
|
}
|
|
16089
16094
|
if (result && onResult) {
|
|
16090
16095
|
onResult(result);
|