@oneblink/apps-react 5.3.0 → 5.3.1-beta.3

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.
@@ -1,27 +1,21 @@
1
1
  /// <reference types="react" />
2
- export declare const CustomAccordion: import("@emotion/styled").StyledComponent<import("@mui/material").AccordionProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
3
- export declare const CustomAccordionSummary: import("@emotion/styled").StyledComponent<{
4
- children?: import("react").ReactNode;
5
- classes?: Partial<import("@mui/material").AccordionSummaryClasses> | undefined;
6
- expandIcon?: import("react").ReactNode;
7
- sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
8
- } & Omit<{
9
- action?: import("react").Ref<import("@mui/material").ButtonBaseActions> | undefined;
10
- centerRipple?: boolean | undefined;
11
- children?: import("react").ReactNode;
12
- classes?: Partial<import("@mui/material").ButtonBaseClasses> | undefined;
2
+ export declare const CustomAccordion: import("@emotion/styled").StyledComponent<{
3
+ children: NonNullable<import("react").ReactNode>;
4
+ classes?: Partial<import("@mui/material").AccordionClasses> | undefined;
5
+ defaultExpanded?: boolean | undefined;
13
6
  disabled?: boolean | undefined;
14
- disableRipple?: boolean | undefined;
15
- disableTouchRipple?: boolean | undefined;
16
- focusRipple?: boolean | undefined;
17
- focusVisibleClassName?: string | undefined;
18
- LinkComponent?: import("react").ElementType<any> | undefined;
19
- onFocusVisible?: import("react").FocusEventHandler<any> | undefined;
7
+ disableGutters?: boolean | undefined;
8
+ expanded?: boolean | undefined;
9
+ onChange?: ((event: import("react").SyntheticEvent<Element, Event>, expanded: boolean) => void) | undefined;
20
10
  sx?: import("@mui/material").SxProps<import("@mui/material").Theme> | undefined;
21
- tabIndex?: number | undefined;
22
- TouchRippleProps?: Partial<import("@mui/material/ButtonBase/TouchRipple").TouchRippleProps> | undefined;
23
- touchRippleRef?: import("react").Ref<import("@mui/material/ButtonBase/TouchRipple").TouchRippleActions> | undefined;
24
- }, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
11
+ TransitionComponent?: import("react").JSXElementConstructor<import("@mui/material/transitions").TransitionProps & {
12
+ children?: import("react").ReactElement<any, any> | undefined;
13
+ }> | undefined;
14
+ TransitionProps?: import("@mui/material/transitions").TransitionProps | undefined;
15
+ } & Omit<import("@mui/material").PaperOwnProps, "onChange" | "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
16
+ ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
17
+ }, "children" | "disabled" | "sx" | "onChange" | "elevation" | keyof import("@mui/material/OverridableComponent").CommonProps | "variant" | "disableGutters" | "square" | "defaultExpanded" | "expanded" | "TransitionComponent" | "TransitionProps"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
18
+ export declare const CustomAccordionSummary: import("@emotion/styled").StyledComponent<import("@mui/material").AccordionSummaryOwnProps & Omit<import("@mui/material").ButtonBaseOwnProps, "classes"> & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "key" | keyof import("react").HTMLAttributes<HTMLDivElement>> & {
25
19
  ref?: ((instance: HTMLDivElement | null) => void) | import("react").RefObject<HTMLDivElement> | null | undefined;
26
- }, "children" | "disabled" | "sx" | "tabIndex" | "action" | keyof import("@mui/material/OverridableComponent").CommonProps | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "expandIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
20
+ }, "className" | "style" | "children" | "disabled" | "sx" | "tabIndex" | "action" | "classes" | "centerRipple" | "disableRipple" | "disableTouchRipple" | "focusRipple" | "focusVisibleClassName" | "LinkComponent" | "onFocusVisible" | "TouchRippleProps" | "touchRippleRef" | "expandIcon"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
27
21
  export declare const CustomAccordionDetails: import("@emotion/styled").StyledComponent<import("@mui/material").AccordionDetailsProps & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme>, {}, {}>;
@@ -9,17 +9,7 @@ export declare const UnorderedList: import("@emotion/styled").StyledComponent<im
9
9
  type ListProps = {
10
10
  spaced?: boolean;
11
11
  };
12
- export declare const ListItem: import("@emotion/styled").StyledComponent<Omit<import("@mui/system").SystemProps<Theme> & {
13
- align?: "right" | "left" | "inherit" | "center" | "justify" | undefined;
14
- children?: React.ReactNode;
15
- classes?: Partial<import("@mui/material").TypographyClasses> | undefined;
16
- gutterBottom?: boolean | undefined;
17
- noWrap?: boolean | undefined;
18
- paragraph?: boolean | undefined;
19
- sx?: import("@mui/material").SxProps<Theme> | undefined;
20
- variant?: "button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline" | undefined;
21
- variantMapping?: Partial<Record<"button" | "caption" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "inherit" | "subtitle1" | "subtitle2" | "body1" | "body2" | "overline", string>> | undefined;
22
- } & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
12
+ export declare const ListItem: import("@emotion/styled").StyledComponent<Omit<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<Pick<React.DetailedHTMLProps<React.HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "key" | keyof React.HTMLAttributes<HTMLSpanElement>> & {
23
13
  ref?: ((instance: HTMLSpanElement | null) => void) | React.RefObject<HTMLSpanElement> | null | undefined;
24
- }, "children" | ("p" | "top" | "right" | "bottom" | "left" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform") | "sx" | "align" | keyof import("@mui/material/OverridableComponent").CommonProps | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping">, "ref"> & import("@mui/system").MUIStyledCommonProps<Theme> & ListProps, {}, {}>;
14
+ }, "className" | "p" | "style" | "children" | "top" | "right" | "bottom" | "left" | "border" | "borderTop" | "borderRight" | "borderBottom" | "borderLeft" | "borderColor" | "borderRadius" | "display" | "displayPrint" | "overflow" | "textOverflow" | "visibility" | "whiteSpace" | "flexBasis" | "flexDirection" | "flexWrap" | "justifyContent" | "alignItems" | "alignContent" | "order" | "flex" | "flexGrow" | "flexShrink" | "alignSelf" | "justifyItems" | "justifySelf" | "gap" | "columnGap" | "rowGap" | "gridColumn" | "gridRow" | "gridAutoFlow" | "gridAutoColumns" | "gridAutoRows" | "gridTemplateColumns" | "gridTemplateRows" | "gridTemplateAreas" | "gridArea" | "bgcolor" | "color" | "zIndex" | "position" | "boxShadow" | "width" | "maxWidth" | "minWidth" | "height" | "maxHeight" | "minHeight" | "boxSizing" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "my" | "pt" | "pr" | "pb" | "pl" | "px" | "py" | "margin" | "marginTop" | "marginRight" | "marginBottom" | "marginLeft" | "marginX" | "marginY" | "marginInline" | "marginInlineStart" | "marginInlineEnd" | "marginBlock" | "marginBlockStart" | "marginBlockEnd" | "padding" | "paddingTop" | "paddingRight" | "paddingBottom" | "paddingLeft" | "paddingX" | "paddingY" | "paddingInline" | "paddingInlineStart" | "paddingInlineEnd" | "paddingBlock" | "paddingBlockStart" | "paddingBlockEnd" | "typography" | "fontFamily" | "fontSize" | "fontStyle" | "fontWeight" | "letterSpacing" | "lineHeight" | "textAlign" | "textTransform" | "sx" | "align" | "classes" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping">, "ref"> & import("@mui/system").MUIStyledCommonProps<Theme> & ListProps, {}, {}>;
25
15
  export {};
@@ -1,18 +1,10 @@
1
1
  import * as React from 'react';
2
- import clsx from 'clsx';
3
- import jsQR from 'jsqr';
4
- import OnLoading from '../components/renderer/OnLoading';
2
+ import { Html5QrcodeScanner } from 'html5-qrcode';
5
3
  import CopyToClipboardButton from '../components/renderer/CopyToClipboardButton';
6
- import quaggaReader from '../services/barcode-readers/quagger.js';
7
4
  import useBooleanState from '../hooks/useBooleanState';
8
5
  import LookupButton from '../components/renderer/LookupButton';
9
6
  import FormElementLabelContainer from '../components/renderer/FormElementLabelContainer';
10
- import { Sentry } from '@oneblink/apps';
11
7
  import useLookupNotification, { LookupNotificationContext, } from '../hooks/useLookupNotification';
12
- const MS_BETWEEN_IMAGE_PROCESSING = 10;
13
- const fadedSquareWidthInPixels = 200;
14
- const fadedSquareHeightInPixels = 150;
15
- const redLineHeightInPixels = 1;
16
8
  function FormElementBarcodeScanner({ id, element, value, onChange, validationMessage, displayValidationMessage, isDirty, setIsDirty, }) {
17
9
  const [isCameraOpen, startBarcodeScanner, stopBarcodeScanner] = useBooleanState(false);
18
10
  const [error, setError] = React.useState(null);
@@ -58,7 +50,7 @@ function FormElementBarcodeScanner({ id, element, value, onChange, validationMes
58
50
  React.createElement("div", null,
59
51
  React.createElement("h4", { className: "title is-4" }, "Whoops..."),
60
52
  React.createElement("p", null, error.message))))),
61
- isCameraOpen ? (React.createElement(BarcodeScanner, { element: element, onScan: handleScan, onClose: stopBarcodeScanner })) : (React.createElement("div", null,
53
+ isCameraOpen ? (React.createElement(BarcodeScanner, { id: `${id}==BARCODE_SCANNER`, onScan: handleScan, onClose: stopBarcodeScanner })) : (React.createElement("div", null,
62
54
  React.createElement("div", { className: "field has-addons" },
63
55
  React.createElement("div", { className: "control is-expanded has-icons-right" },
64
56
  React.createElement("input", { type: "text", placeholder: element.placeholderValue, id: id, name: element.name, className: "input ob-input cypress-barcode-scanner-control has-margin-bottom-8", value: text, onChange: (e) => onChange(element, {
@@ -74,239 +66,34 @@ function FormElementBarcodeScanner({ id, element, value, onChange, validationMes
74
66
  React.createElement("div", { className: "has-text-danger ob-error__text cypress-validation-message" }, validationMessage))))));
75
67
  }
76
68
  export default React.memo(FormElementBarcodeScanner);
77
- function BarcodeScanner({ element, onScan, onClose }) {
78
- const videoElementRef = React.useRef(null);
79
- const figureElementRef = React.useRef(null);
80
- const [{ isLoading = false, selectedDeviceId, error }, setState] = React.useState({
81
- isLoading: true,
82
- selectedDeviceId: undefined,
83
- error: undefined,
84
- });
85
- const [camera, setCamera] = React.useState(null);
86
- const setError = React.useCallback((error) => {
87
- setState({
88
- error,
89
- isLoading: false,
90
- selectedDeviceId: undefined,
91
- });
92
- }, []);
93
- // Create timeout using $timeout outside of the scan function so
94
- // so that we can cancel it when navigating away from screen
95
- const scanImageForBarcode = React.useCallback((videoElement, waitInMS, options, checkStop) => {
96
- const restrictedBarcodeTypes = element.restrictedBarcodeTypes || [];
97
- // Using $timeout here instead of $interval as we dont know
98
- // exactly how long each processing of the image will take.
99
- setTimeout(async () => {
100
- if (checkStop())
101
- return;
102
- const canvasElement = document.createElement('canvas');
103
- canvasElement.width = options.sourceWidth;
104
- canvasElement.height = options.sourceHeight;
105
- const canvasContext = canvasElement.getContext('2d');
106
- if (canvasContext) {
107
- canvasContext.drawImage(videoElement, options.sourceX, options.sourceY, canvasElement.width, canvasElement.height, 0, 0, canvasElement.width, canvasElement.height);
108
- if (!element.restrictBarcodeTypes ||
109
- (element.restrictedBarcodeTypes || []).indexOf('qr_reader') > -1) {
110
- const imageData = canvasContext.getImageData(0, 0, canvasElement.width, canvasElement.height);
111
- const code = jsQR(imageData.data, imageData.width, imageData.height, {
112
- inversionAttempts: 'dontInvert',
113
- });
114
- if (code) {
115
- return onScan(code.data);
116
- }
117
- }
118
- }
119
- if (!element.restrictBarcodeTypes ||
120
- !(restrictedBarcodeTypes.length === 1 &&
121
- restrictedBarcodeTypes[0] === 'qr_reader')) {
122
- const base64Image = canvasElement.toDataURL('image/png');
123
- const quaggaResult = await quaggaReader(base64Image, restrictedBarcodeTypes);
124
- if (quaggaResult) {
125
- return onScan(quaggaResult);
126
- }
127
- }
128
- if (checkStop())
129
- return;
130
- scanImageForBarcode(videoElement, MS_BETWEEN_IMAGE_PROCESSING, options, checkStop);
131
- }, waitInMS);
132
- }, [element.restrictBarcodeTypes, element.restrictedBarcodeTypes, onScan]);
133
- const switchCamera = React.useCallback(() => {
134
- if (!camera) {
135
- return;
136
- }
137
- // We will just be rotating between the available camera.
138
- const nextDeviceIndex = camera.availableDevices.findIndex((mediaDeviceInfo) => mediaDeviceInfo.deviceId === camera.activeDeviceId) + 1;
139
- const nextDevice = camera.availableDevices[nextDeviceIndex] || camera.availableDevices[0];
140
- setState({
141
- error: undefined,
142
- isLoading: true,
143
- selectedDeviceId: nextDevice.deviceId,
144
- });
145
- }, [camera]);
69
+ function BarcodeScanner({ id, onScan, onClose }) {
70
+ const [html5QrcodeScanner, setHtml5QrcodeScanner] = React.useState(null);
146
71
  React.useEffect(() => {
147
- if (!videoElementRef.current) {
148
- return;
149
- }
150
- const newCamera = new HTML5Camera(videoElementRef.current);
151
- setCamera(newCamera);
72
+ const verbose = true;
73
+ const newHtml5QrcodeScanner = new Html5QrcodeScanner(id, {
74
+ fps: 10,
75
+ qrbox: {
76
+ width: 250,
77
+ height: 250,
78
+ },
79
+ }, verbose);
80
+ setHtml5QrcodeScanner(newHtml5QrcodeScanner);
152
81
  return () => {
153
- newCamera.close();
82
+ newHtml5QrcodeScanner.clear();
154
83
  };
155
- }, []);
84
+ }, [id]);
156
85
  React.useEffect(() => {
157
- if (!camera ||
158
- error ||
159
- // If attempting to open the device that is currently open,
160
- // we will not attempt to open again.
161
- (selectedDeviceId && camera.activeDeviceId === selectedDeviceId)) {
162
- return;
163
- }
164
- let ignore = false;
165
- (async () => {
166
- try {
167
- const videoElement = videoElementRef.current;
168
- const figureElement = figureElementRef.current;
169
- if (!videoElement || !figureElement) {
170
- return;
171
- }
172
- console.log('Opening camera with:', selectedDeviceId || 'UNKNOWN');
173
- await camera.open(selectedDeviceId);
174
- if (ignore) {
175
- return;
176
- }
177
- setState({
178
- error: undefined,
179
- isLoading: false,
180
- selectedDeviceId,
181
- });
182
- // @ts-expect-error ???
183
- const fadedSquareElement = figureElement.getElementsByClassName('ob-barcode-scanner__square')[0];
184
- // @ts-expect-error ???
185
- const redLineElement = figureElement.getElementsByClassName('ob-barcode-scanner__line')[0];
186
- console.log('videoElement Width pixels', videoElement.clientWidth);
187
- console.log('videoElement Height pixels', videoElement.clientHeight);
188
- console.log('videoElement Width', videoElement.videoWidth);
189
- console.log('videoElement Height', videoElement.videoHeight);
190
- // Faded Square needs its values set in pixels
191
- const fadedSquareLeftInPixels = (videoElement.clientWidth - fadedSquareWidthInPixels) / 2;
192
- console.log('fadedSquareLeftInPixels', fadedSquareLeftInPixels);
193
- const fadedSquareTopInPixels = (videoElement.clientHeight - fadedSquareHeightInPixels) / 2;
194
- console.log('fadedSquareTopInPixels', fadedSquareTopInPixels);
195
- fadedSquareElement.style.borderBottom = `${fadedSquareTopInPixels}px`;
196
- fadedSquareElement.style.borderTop = `${fadedSquareTopInPixels}px`;
197
- fadedSquareElement.style.borderLeft = `${fadedSquareLeftInPixels}px`;
198
- fadedSquareElement.style.borderRight = `${fadedSquareLeftInPixels}px`;
199
- fadedSquareElement.style.borderColor = 'rgba(0, 0, 0, 0.25)';
200
- fadedSquareElement.style.borderStyle = 'solid';
201
- redLineElement.style.height = `${redLineHeightInPixels}px`;
202
- redLineElement.style.top = `${(videoElement.clientHeight - redLineHeightInPixels) / 2}px`;
203
- redLineElement.style.left = `${fadedSquareLeftInPixels}px`;
204
- redLineElement.style.right = `${fadedSquareLeftInPixels}px`;
205
- // Need to calculate the actual width, which is not in pixels
206
- const ratio = videoElement.videoWidth / videoElement.clientWidth;
207
- console.log('pixel to video Ratio', ratio);
208
- const left = ratio * fadedSquareLeftInPixels;
209
- console.log('left in video measurement', left);
210
- const top = ratio * fadedSquareTopInPixels;
211
- console.log('top in video measurement', top);
212
- const fadedSquareWidth = fadedSquareWidthInPixels * ratio;
213
- console.log('red square in video measurement', fadedSquareWidth);
214
- // Wait a little before scanning the first image
215
- // to prevent image processing staring before
216
- // camera is ready.
217
- scanImageForBarcode(videoElement, 250, {
218
- sourceX: left,
219
- sourceY: top,
220
- sourceWidth: fadedSquareWidth,
221
- sourceHeight: fadedSquareWidth,
222
- }, () => ignore);
223
- }
224
- catch (error) {
225
- if (ignore) {
226
- return;
227
- }
228
- console.warn('Error while attempting to open camera', error);
229
- Sentry.captureException(error);
230
- switch (error.name) {
231
- case 'NotSupportedError': {
232
- setError(new Error('Your browser does not support accessing your camera. Please click "Cancel" below and type in the barcode value manually.'));
233
- break;
234
- }
235
- case 'NotAllowedError': {
236
- setError(new Error('Cannot scan for barcodes without granting the application access to the camera. Please click "Cancel" below to try again.'));
237
- break;
238
- }
239
- default: {
240
- setError(new Error('An unknown error has occurred, please click "Cancel" below to try again. If the problem persists, please contact support.'));
241
- }
242
- }
243
- }
244
- })();
245
- return () => {
246
- ignore = true;
247
- };
248
- }, [camera, error, scanImageForBarcode, selectedDeviceId, setError]);
86
+ html5QrcodeScanner === null || html5QrcodeScanner === void 0 ? void 0 : html5QrcodeScanner.render(function onScanSuccess(decodedText, decodedResult) {
87
+ console.log(`Code matched = ${decodedText}`, decodedResult);
88
+ onScan(decodedText);
89
+ }, function onScanFailure() {
90
+ // do nothing and keep scanning
91
+ });
92
+ }, [html5QrcodeScanner, onScan]);
249
93
  return (React.createElement("div", null,
250
- React.createElement("figure", { className: "ob-figure", ref: figureElementRef },
251
- React.createElement("div", { className: "figure-content has-text-centered" },
252
- isLoading && React.createElement(OnLoading, { small: true }),
253
- !!error && (React.createElement("div", null,
254
- React.createElement("h4", { className: "title is-4" }, "Whoops..."),
255
- React.createElement("p", null, error.message))),
256
- React.createElement("div", { className: clsx('is-relative', {
257
- 'is-hidden': isLoading || error,
258
- }) },
259
- React.createElement("div", { className: "ob-barcode-scanner__square" }),
260
- React.createElement("div", { className: "ob-barcode-scanner__line" }),
261
- React.createElement("video", { ref: videoElementRef, autoPlay: true, playsInline: true, className: "ob-barcode-scanner__video" })))),
94
+ React.createElement("figure", { className: "ob-figure" },
95
+ React.createElement("div", { id: id })),
262
96
  React.createElement("div", { className: "buttons ob-buttons" },
263
- React.createElement("button", { type: "button", className: "button ob-button ob-button__cancel is-light cypress-cancel-scan-barcode-button", onClick: onClose }, "Cancel"),
264
- ((camera === null || camera === void 0 ? void 0 : camera.availableDevices.length) || 1) > 1 && (React.createElement("button", { type: "button", className: "button ob-button ob-button__switch-camera is-primary cypress-switch-camera-button", onClick: switchCamera }, "Switch Camera")))));
265
- }
266
- class HTML5Camera {
267
- constructor(htmlVideoElement) {
268
- this.htmlVideoElement = htmlVideoElement;
269
- this.availableDevices = [];
270
- this.mediaStream = undefined;
271
- }
272
- get activeDeviceId() {
273
- var _a;
274
- if (this.mediaStream) {
275
- const [activeMediaStreamTrack] = this.mediaStream.getTracks();
276
- return (_a = activeMediaStreamTrack === null || activeMediaStreamTrack === void 0 ? void 0 : activeMediaStreamTrack.getSettings()) === null || _a === void 0 ? void 0 : _a.deviceId;
277
- }
278
- }
279
- async open(deviceId) {
280
- if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {
281
- const error = new Error();
282
- error.name = 'NotSupportedError';
283
- throw error;
284
- }
285
- this.close();
286
- const constraints = {
287
- video: {
288
- facingMode: deviceId ? undefined : 'environment',
289
- deviceId: deviceId ? { exact: deviceId } : undefined,
290
- },
291
- };
292
- const mediaStream = await navigator.mediaDevices.getUserMedia(constraints);
293
- this.mediaStream = mediaStream;
294
- this.htmlVideoElement.srcObject = mediaStream;
295
- if (!this.availableDevices.length) {
296
- const availableDevices = await navigator.mediaDevices.enumerateDevices();
297
- this.availableDevices = availableDevices.filter((mediaDeviceInfo) => mediaDeviceInfo.kind === 'videoinput' && !!mediaDeviceInfo.deviceId);
298
- }
299
- await new Promise((resolve) => this.htmlVideoElement.addEventListener('canplay', resolve, {
300
- once: true,
301
- }));
302
- }
303
- close() {
304
- if (this.mediaStream) {
305
- this.mediaStream.getTracks().forEach((track) => {
306
- track.stop();
307
- });
308
- this.mediaStream = undefined;
309
- }
310
- }
97
+ React.createElement("button", { type: "button", className: "button ob-button ob-button__cancel is-light cypress-cancel-scan-barcode-button", onClick: onClose }, "Cancel"))));
311
98
  }
312
99
  //# sourceMappingURL=FormElementBarcodeScanner.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"FormElementBarcodeScanner.js","sourceRoot":"","sources":["../../src/form-elements/FormElementBarcodeScanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B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C,MAAM,EAAE;YACjC,MAAM,gBAAgB,GAAG,MAAM,SAAS,CAAC,YAAY,CAAC,gBAAgB,EAAE,CAAA;YACxE,IAAI,CAAC,gBAAgB,GAAG,gBAAgB,CAAC,MAAM,CAC7C,CAAC,eAAe,EAAE,EAAE,CAClB,eAAe,CAAC,IAAI,KAAK,YAAY,IAAI,CAAC,CAAC,eAAe,CAAC,QAAQ,CACtE,CAAA;SACF;QAED,MAAM,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAC5B,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,SAAS,EAAE,OAAO,EAAE;YACzD,IAAI,EAAE,IAAI;SACX,CAAC,CACH,CAAA;IACH,CAAC;IAED,KAAK;QACH,IAAI,IAAI,CAAC,WAAW,EAAE;YACpB,IAAI,CAAC,WAAW,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;gBAC7C,KAAK,CAAC,IAAI,EAAE,CAAA;YACd,CAAC,CAAC,CAAA;YACF,IAAI,CAAC,WAAW,GAAG,SAAS,CAAA;SAC7B;IACH,CAAC;CACF","sourcesContent":["import * as React from 'react'\nimport clsx from 'clsx'\nimport jsQR from 'jsqr'\n\nimport OnLoading from '../components/renderer/OnLoading'\nimport CopyToClipboardButton from '../components/renderer/CopyToClipboardButton'\nimport quaggaReader from '../services/barcode-readers/quagger.js'\nimport useBooleanState from '../hooks/useBooleanState'\nimport LookupButton from '../components/renderer/LookupButton'\nimport { FormTypes } from '@oneblink/types'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport { Sentry } from '@oneblink/apps'\nimport useLookupNotification, {\n LookupNotificationContext,\n} from '../hooks/useLookupNotification'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\n\nconst MS_BETWEEN_IMAGE_PROCESSING = 10\nconst fadedSquareWidthInPixels = 200\nconst fadedSquareHeightInPixels = 150\nconst redLineHeightInPixels = 1\n\ntype Props = {\n id: string\n element: FormTypes.BarcodeScannerElement\n value: unknown | undefined\n onChange: FormElementValueChangeHandler<string>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n} & IsDirtyProps\n\nfunction FormElementBarcodeScanner({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n isDirty,\n setIsDirty,\n}: Props) {\n const [isCameraOpen, startBarcodeScanner, stopBarcodeScanner] =\n useBooleanState(false)\n const [error, setError] = React.useState<Error | null>(null)\n const { onLookup } = useLookupNotification(value)\n const handleScan = React.useCallback(\n (newValue: string | undefined) => {\n setIsDirty()\n onChange(element, {\n value: newValue,\n })\n stopBarcodeScanner()\n onLookup()\n },\n [element, onChange, onLookup, setIsDirty, stopBarcodeScanner],\n )\n\n const openBarcodeScanner = React.useCallback(() => {\n if (window.cordova) {\n setError(null)\n // @ts-expect-error ???\n window.cordova.plugins.barcodeScanner.scan(\n // @ts-expect-error ???\n (result) => {\n if (!result.cancelled) {\n handleScan(result.text)\n }\n },\n // @ts-expect-error ???\n (error) => {\n setError(\n new Error(\n `An error has occurred: \"${error}\". Please click \"Cancel\" below to try again. If the problem persists, please contact support.`,\n ),\n )\n },\n {\n showFlipCameraButton: true,\n showTorchButton: true,\n },\n )\n } else {\n startBarcodeScanner()\n }\n }, [handleScan, startBarcodeScanner])\n\n const { isLookingUp } = React.useContext(LookupNotificationContext)\n const isDisplayingValidationMessage =\n (isDirty || displayValidationMessage) && !!validationMessage && !isLookingUp\n\n const text = typeof value === 'string' ? value : ''\n return (\n <div className=\"cypress-barcode-scanner-element\">\n <FormElementLabelContainer\n className=\"ob-barcode-scanner\"\n element={element}\n id={id}\n required={element.required}\n >\n {error && (\n <figure className=\"ob-figure\">\n <div className=\"figure-content has-text-centered\">\n <div>\n <h4 className=\"title is-4\">Whoops...</h4>\n <p>{error.message}</p>\n </div>\n </div>\n </figure>\n )}\n\n {isCameraOpen ? (\n <BarcodeScanner\n element={element}\n onScan={handleScan}\n onClose={stopBarcodeScanner}\n />\n ) : (\n <div>\n <div className=\"field has-addons\">\n <div className=\"control is-expanded has-icons-right\">\n <input\n type=\"text\"\n placeholder={element.placeholderValue}\n id={id}\n name={element.name}\n className=\"input ob-input cypress-barcode-scanner-control has-margin-bottom-8\"\n value={text}\n onChange={(e) =>\n onChange(element, {\n value: e.target.value || undefined,\n })\n }\n required={element.required}\n disabled={element.readOnly}\n onBlur={setIsDirty}\n />\n <span className=\"ob-input-icon icon is-small is-right\">\n <i className=\"material-icons is-size-5\">document_scanner</i>\n </span>\n </div>\n {!!element.readOnly && !!value && (\n <div className=\"control\">\n <CopyToClipboardButton\n className=\"button is-input-addon copy-button cypress-copy-to-clipboard-button\"\n text={text}\n />\n </div>\n )}\n <LookupButton\n isInputButton\n value={value}\n validationMessage={validationMessage}\n lookupButtonConfig={element.lookupButton}\n />\n </div>\n\n <button\n type=\"button\"\n className=\"button ob-button ob-button__open is-primary cypress-start-scan-barcode-button\"\n disabled={element.readOnly}\n onClick={openBarcodeScanner}\n >\n Scan Barcode\n </button>\n </div>\n )}\n\n {isDisplayingValidationMessage && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-validation-message\">\n {validationMessage}\n </div>\n </div>\n )}\n </FormElementLabelContainer>\n </div>\n )\n}\n\nexport default React.memo(FormElementBarcodeScanner)\n\ntype BarcodeScannerProps = {\n element: FormTypes.BarcodeScannerElement\n onScan: (barcode: string | undefined) => void\n onClose: () => void\n}\n\nfunction BarcodeScanner({ element, onScan, onClose }: BarcodeScannerProps) {\n const videoElementRef = React.useRef<HTMLVideoElement>(null)\n const figureElementRef = React.useRef<HTMLDivElement>(null)\n\n const [{ isLoading = false, selectedDeviceId, error }, setState] =\n React.useState<{\n isLoading: boolean\n selectedDeviceId: string | undefined\n error: Error | undefined\n }>({\n isLoading: true,\n selectedDeviceId: undefined,\n error: undefined,\n })\n const [camera, setCamera] = React.useState<HTML5Camera | null>(null)\n\n const setError = React.useCallback((error: Error) => {\n setState({\n error,\n isLoading: false,\n selectedDeviceId: undefined,\n })\n }, [])\n\n // Create timeout using $timeout outside of the scan function so\n // so that we can cancel it when navigating away from screen\n const scanImageForBarcode = React.useCallback(\n (\n videoElement: HTMLVideoElement,\n waitInMS: number,\n options: {\n sourceX: number\n sourceY: number\n sourceWidth: number\n sourceHeight: number\n },\n checkStop: () => boolean,\n ) => {\n const restrictedBarcodeTypes = element.restrictedBarcodeTypes || []\n // Using $timeout here instead of $interval as we dont know\n // exactly how long each processing of the image will take.\n setTimeout(async () => {\n if (checkStop()) return\n const canvasElement = document.createElement('canvas')\n\n canvasElement.width = options.sourceWidth\n canvasElement.height = options.sourceHeight\n\n const canvasContext = canvasElement.getContext('2d')\n if (canvasContext) {\n canvasContext.drawImage(\n videoElement,\n options.sourceX,\n options.sourceY,\n canvasElement.width,\n canvasElement.height,\n 0,\n 0,\n canvasElement.width,\n canvasElement.height,\n )\n\n if (\n !element.restrictBarcodeTypes ||\n (element.restrictedBarcodeTypes || []).indexOf('qr_reader') > -1\n ) {\n const imageData = canvasContext.getImageData(\n 0,\n 0,\n canvasElement.width,\n canvasElement.height,\n )\n\n const code = jsQR(\n imageData.data,\n imageData.width,\n imageData.height,\n {\n inversionAttempts: 'dontInvert',\n },\n )\n\n if (code) {\n return onScan(code.data)\n }\n }\n }\n\n if (\n !element.restrictBarcodeTypes ||\n !(\n restrictedBarcodeTypes.length === 1 &&\n restrictedBarcodeTypes[0] === 'qr_reader'\n )\n ) {\n const base64Image = canvasElement.toDataURL('image/png')\n const quaggaResult = await quaggaReader(\n base64Image,\n restrictedBarcodeTypes,\n )\n if (quaggaResult) {\n return onScan(quaggaResult)\n }\n }\n\n if (checkStop()) return\n\n scanImageForBarcode(\n videoElement,\n MS_BETWEEN_IMAGE_PROCESSING,\n options,\n checkStop,\n )\n }, waitInMS)\n },\n [element.restrictBarcodeTypes, element.restrictedBarcodeTypes, onScan],\n )\n\n const switchCamera = React.useCallback(() => {\n if (!camera) {\n return\n }\n\n // We will just be rotating between the available camera.\n const nextDeviceIndex =\n camera.availableDevices.findIndex(\n (mediaDeviceInfo) => mediaDeviceInfo.deviceId === camera.activeDeviceId,\n ) + 1\n const nextDevice =\n camera.availableDevices[nextDeviceIndex] || camera.availableDevices[0]\n setState({\n error: undefined,\n isLoading: true,\n selectedDeviceId: nextDevice.deviceId,\n })\n }, [camera])\n\n React.useEffect(() => {\n if (!videoElementRef.current) {\n return\n }\n\n const newCamera = new HTML5Camera(videoElementRef.current)\n setCamera(newCamera)\n\n return () => {\n newCamera.close()\n }\n }, [])\n\n React.useEffect(() => {\n if (\n !camera ||\n error ||\n // If attempting to open the device that is currently open,\n // we will not attempt to open again.\n (selectedDeviceId && camera.activeDeviceId === selectedDeviceId)\n ) {\n return\n }\n\n let ignore = false\n\n ;(async () => {\n try {\n const videoElement = videoElementRef.current\n const figureElement = figureElementRef.current\n if (!videoElement || !figureElement) {\n return\n }\n\n console.log('Opening camera with:', selectedDeviceId || 'UNKNOWN')\n await camera.open(selectedDeviceId)\n\n if (ignore) {\n return\n }\n\n setState({\n error: undefined,\n isLoading: false,\n selectedDeviceId,\n })\n\n // @ts-expect-error ???\n const fadedSquareElement: HTMLDivElement =\n figureElement.getElementsByClassName('ob-barcode-scanner__square')[0]\n // @ts-expect-error ???\n const redLineElement: HTMLDivElement =\n figureElement.getElementsByClassName('ob-barcode-scanner__line')[0]\n console.log('videoElement Width pixels', videoElement.clientWidth)\n console.log('videoElement Height pixels', videoElement.clientHeight)\n console.log('videoElement Width', videoElement.videoWidth)\n console.log('videoElement Height', videoElement.videoHeight)\n\n // Faded Square needs its values set in pixels\n const fadedSquareLeftInPixels =\n (videoElement.clientWidth - fadedSquareWidthInPixels) / 2\n console.log('fadedSquareLeftInPixels', fadedSquareLeftInPixels)\n const fadedSquareTopInPixels =\n (videoElement.clientHeight - fadedSquareHeightInPixels) / 2\n console.log('fadedSquareTopInPixels', fadedSquareTopInPixels)\n\n fadedSquareElement.style.borderBottom = `${fadedSquareTopInPixels}px`\n fadedSquareElement.style.borderTop = `${fadedSquareTopInPixels}px`\n fadedSquareElement.style.borderLeft = `${fadedSquareLeftInPixels}px`\n fadedSquareElement.style.borderRight = `${fadedSquareLeftInPixels}px`\n fadedSquareElement.style.borderColor = 'rgba(0, 0, 0, 0.25)'\n fadedSquareElement.style.borderStyle = 'solid'\n\n redLineElement.style.height = `${redLineHeightInPixels}px`\n redLineElement.style.top = `${\n (videoElement.clientHeight - redLineHeightInPixels) / 2\n }px`\n redLineElement.style.left = `${fadedSquareLeftInPixels}px`\n redLineElement.style.right = `${fadedSquareLeftInPixels}px`\n\n // Need to calculate the actual width, which is not in pixels\n const ratio = videoElement.videoWidth / videoElement.clientWidth\n console.log('pixel to video Ratio', ratio)\n\n const left = ratio * fadedSquareLeftInPixels\n console.log('left in video measurement', left)\n const top = ratio * fadedSquareTopInPixels\n console.log('top in video measurement', top)\n\n const fadedSquareWidth = fadedSquareWidthInPixels * ratio\n console.log('red square in video measurement', fadedSquareWidth)\n\n // Wait a little before scanning the first image\n // to prevent image processing staring before\n // camera is ready.\n scanImageForBarcode(\n videoElement,\n 250,\n {\n sourceX: left,\n sourceY: top,\n sourceWidth: fadedSquareWidth,\n sourceHeight: fadedSquareWidth,\n },\n () => ignore,\n )\n } catch (error) {\n if (ignore) {\n return\n }\n console.warn('Error while attempting to open camera', error)\n Sentry.captureException(error)\n switch ((error as Error).name) {\n case 'NotSupportedError': {\n setError(\n new Error(\n 'Your browser does not support accessing your camera. Please click \"Cancel\" below and type in the barcode value manually.',\n ),\n )\n break\n }\n case 'NotAllowedError': {\n setError(\n new Error(\n 'Cannot scan for barcodes without granting the application access to the camera. Please click \"Cancel\" below to try again.',\n ),\n )\n break\n }\n default: {\n setError(\n new Error(\n 'An unknown error has occurred, please click \"Cancel\" below to try again. If the problem persists, please contact support.',\n ),\n )\n }\n }\n }\n })()\n\n return () => {\n ignore = true\n }\n }, [camera, error, scanImageForBarcode, selectedDeviceId, setError])\n\n return (\n <div>\n <figure className=\"ob-figure\" ref={figureElementRef}>\n <div className=\"figure-content has-text-centered\">\n {isLoading && <OnLoading small />}\n\n {!!error && (\n <div>\n <h4 className=\"title is-4\">Whoops...</h4>\n <p>{error.message}</p>\n </div>\n )}\n\n <div\n className={clsx('is-relative', {\n 'is-hidden': isLoading || error,\n })}\n >\n <div className=\"ob-barcode-scanner__square\"></div>\n <div className=\"ob-barcode-scanner__line\"></div>\n <video\n ref={videoElementRef}\n autoPlay\n playsInline\n className=\"ob-barcode-scanner__video\"\n />\n </div>\n </div>\n </figure>\n\n <div className=\"buttons ob-buttons\">\n <button\n type=\"button\"\n className=\"button ob-button ob-button__cancel is-light cypress-cancel-scan-barcode-button\"\n onClick={onClose}\n >\n Cancel\n </button>\n {(camera?.availableDevices.length || 1) > 1 && (\n <button\n type=\"button\"\n className=\"button ob-button ob-button__switch-camera is-primary cypress-switch-camera-button\"\n onClick={switchCamera}\n >\n Switch Camera\n </button>\n )}\n </div>\n </div>\n )\n}\n\nclass HTML5Camera {\n availableDevices: MediaDeviceInfo[]\n htmlVideoElement: HTMLVideoElement\n mediaStream: MediaStream | undefined\n\n constructor(htmlVideoElement: HTMLVideoElement) {\n this.htmlVideoElement = htmlVideoElement\n this.availableDevices = []\n this.mediaStream = undefined\n }\n\n get activeDeviceId(): string | undefined {\n if (this.mediaStream) {\n const [activeMediaStreamTrack] = this.mediaStream.getTracks()\n return activeMediaStreamTrack?.getSettings()?.deviceId\n }\n }\n\n async open(deviceId?: string) {\n if (!navigator.mediaDevices || !navigator.mediaDevices.getUserMedia) {\n const error = new Error()\n error.name = 'NotSupportedError'\n throw error\n }\n\n this.close()\n\n const constraints = {\n video: {\n facingMode: deviceId ? undefined : 'environment',\n deviceId: deviceId ? { exact: deviceId } : undefined,\n },\n }\n const mediaStream = await navigator.mediaDevices.getUserMedia(constraints)\n this.mediaStream = mediaStream\n this.htmlVideoElement.srcObject = mediaStream\n\n if (!this.availableDevices.length) {\n const availableDevices = await navigator.mediaDevices.enumerateDevices()\n this.availableDevices = availableDevices.filter(\n (mediaDeviceInfo) =>\n mediaDeviceInfo.kind === 'videoinput' && !!mediaDeviceInfo.deviceId,\n )\n }\n\n await new Promise((resolve) =>\n this.htmlVideoElement.addEventListener('canplay', resolve, {\n once: true,\n }),\n )\n }\n\n close() {\n if (this.mediaStream) {\n this.mediaStream.getTracks().forEach((track) => {\n track.stop()\n })\n this.mediaStream = undefined\n }\n }\n}\n"]}
1
+ {"version":3,"file":"FormElementBarcodeScanner.js","sourceRoot":"","sources":["../../src/form-elements/FormElementBarcodeScanner.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAA;AACjD,OAAO,qBAAqB,MAAM,8CAA8C,CAAA;AAChF,OAAO,eAAe,MAAM,0BAA0B,CAAA;AACtD,OAAO,YAAY,MAAM,qCAAqC,CAAA;AAE9D,OAAO,yBAAyB,MAAM,kDAAkD,CAAA;AACxF,OAAO,qBAAqB,EAAE,EAC5B,yBAAyB,GAC1B,MAAM,gCAAgC,CAAA;AAYvC,SAAS,yBAAyB,CAAC,EACjC,EAAE,EACF,OAAO,EACP,KAAK,EACL,QAAQ,EACR,iBAAiB,EACjB,wBAAwB,EACxB,OAAO,EACP,UAAU,GACJ;IACN,MAAM,CAAC,YAAY,EAAE,mBAAmB,EAAE,kBAAkB,CAAC,GAC3D,eAAe,CAAC,KAAK,CAAC,CAAA;IACxB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,KAAK,CAAC,QAAQ,CAAe,IAAI,CAAC,CAAA;IAC5D,MAAM,EAAE,QAAQ,EAAE,GAAG,qBAAqB,CAAC,KAAK,CAAC,CAAA;IACjD,MAAM,UAAU,GAAG,KAAK,CAAC,WAAW,CAClC,CAAC,QAA4B,EAAE,EAAE;QAC/B,UAAU,EAAE,CAAA;QACZ,QAAQ,CAAC,OAAO,EAAE;YAChB,KAAK,EAAE,QAAQ;SA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a;YAC/C,OAAO,CAAC,GAAG,CAAC,kBAAkB,WAAW,EAAE,EAAE,aAAa,CAAC,CAAA;YAC3D,MAAM,CAAC,WAAW,CAAC,CAAA;QACrB,CAAC,EACD,SAAS,aAAa;YACpB,+BAA+B;QACjC,CAAC,CACF,CAAA;IACH,CAAC,EAAE,CAAC,kBAAkB,EAAE,MAAM,CAAC,CAAC,CAAA;IAEhC,OAAO,CACL;QACE,gCAAQ,SAAS,EAAC,WAAW;YAC3B,6BAAK,EAAE,EAAE,EAAE,GAAI,CACR;QACT,6BAAK,SAAS,EAAC,oBAAoB;YACjC,gCACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,gFAAgF,EAC1F,OAAO,EAAE,OAAO,aAGT,CACL,CACF,CACP,CAAA;AACH,CAAC","sourcesContent":["import * as React from 'react'\nimport { Html5QrcodeScanner } from 'html5-qrcode'\nimport CopyToClipboardButton from '../components/renderer/CopyToClipboardButton'\nimport useBooleanState from '../hooks/useBooleanState'\nimport LookupButton from '../components/renderer/LookupButton'\nimport { FormTypes } from '@oneblink/types'\nimport FormElementLabelContainer from '../components/renderer/FormElementLabelContainer'\nimport useLookupNotification, {\n LookupNotificationContext,\n} from '../hooks/useLookupNotification'\nimport { FormElementValueChangeHandler, IsDirtyProps } from '../types/form'\n\ntype Props = {\n id: string\n element: FormTypes.BarcodeScannerElement\n value: unknown | undefined\n onChange: FormElementValueChangeHandler<string>\n displayValidationMessage: boolean\n validationMessage: string | undefined\n} & IsDirtyProps\n\nfunction FormElementBarcodeScanner({\n id,\n element,\n value,\n onChange,\n validationMessage,\n displayValidationMessage,\n isDirty,\n setIsDirty,\n}: Props) {\n const [isCameraOpen, startBarcodeScanner, stopBarcodeScanner] =\n useBooleanState(false)\n const [error, setError] = React.useState<Error | null>(null)\n const { onLookup } = useLookupNotification(value)\n const handleScan = React.useCallback(\n (newValue: string | undefined) => {\n setIsDirty()\n onChange(element, {\n value: newValue,\n })\n stopBarcodeScanner()\n onLookup()\n },\n [element, onChange, onLookup, setIsDirty, stopBarcodeScanner],\n )\n\n const openBarcodeScanner = React.useCallback(() => {\n if (window.cordova) {\n setError(null)\n // @ts-expect-error ???\n window.cordova.plugins.barcodeScanner.scan(\n // @ts-expect-error ???\n (result) => {\n if (!result.cancelled) {\n handleScan(result.text)\n }\n },\n // @ts-expect-error ???\n (error) => {\n setError(\n new Error(\n `An error has occurred: \"${error}\". Please click \"Cancel\" below to try again. If the problem persists, please contact support.`,\n ),\n )\n },\n {\n showFlipCameraButton: true,\n showTorchButton: true,\n },\n )\n } else {\n startBarcodeScanner()\n }\n }, [handleScan, startBarcodeScanner])\n\n const { isLookingUp } = React.useContext(LookupNotificationContext)\n const isDisplayingValidationMessage =\n (isDirty || displayValidationMessage) && !!validationMessage && !isLookingUp\n\n const text = typeof value === 'string' ? value : ''\n return (\n <div className=\"cypress-barcode-scanner-element\">\n <FormElementLabelContainer\n className=\"ob-barcode-scanner\"\n element={element}\n id={id}\n required={element.required}\n >\n {error && (\n <figure className=\"ob-figure\">\n <div className=\"figure-content has-text-centered\">\n <div>\n <h4 className=\"title is-4\">Whoops...</h4>\n <p>{error.message}</p>\n </div>\n </div>\n </figure>\n )}\n\n {isCameraOpen ? (\n <BarcodeScanner\n id={`${id}==BARCODE_SCANNER`}\n onScan={handleScan}\n onClose={stopBarcodeScanner}\n />\n ) : (\n <div>\n <div className=\"field has-addons\">\n <div className=\"control is-expanded has-icons-right\">\n <input\n type=\"text\"\n placeholder={element.placeholderValue}\n id={id}\n name={element.name}\n className=\"input ob-input cypress-barcode-scanner-control has-margin-bottom-8\"\n value={text}\n onChange={(e) =>\n onChange(element, {\n value: e.target.value || undefined,\n })\n }\n required={element.required}\n disabled={element.readOnly}\n onBlur={setIsDirty}\n />\n <span className=\"ob-input-icon icon is-small is-right\">\n <i className=\"material-icons is-size-5\">document_scanner</i>\n </span>\n </div>\n {!!element.readOnly && !!value && (\n <div className=\"control\">\n <CopyToClipboardButton\n className=\"button is-input-addon copy-button cypress-copy-to-clipboard-button\"\n text={text}\n />\n </div>\n )}\n <LookupButton\n isInputButton\n value={value}\n validationMessage={validationMessage}\n lookupButtonConfig={element.lookupButton}\n />\n </div>\n\n <button\n type=\"button\"\n className=\"button ob-button ob-button__open is-primary cypress-start-scan-barcode-button\"\n disabled={element.readOnly}\n onClick={openBarcodeScanner}\n >\n Scan Barcode\n </button>\n </div>\n )}\n\n {isDisplayingValidationMessage && (\n <div role=\"alert\" className=\"has-margin-top-8\">\n <div className=\"has-text-danger ob-error__text cypress-validation-message\">\n {validationMessage}\n </div>\n </div>\n )}\n </FormElementLabelContainer>\n </div>\n )\n}\n\nexport default React.memo(FormElementBarcodeScanner)\n\ntype BarcodeScannerProps = {\n id: string\n onScan: (barcode: string | undefined) => void\n onClose: () => void\n}\n\nfunction BarcodeScanner({ id, onScan, onClose }: BarcodeScannerProps) {\n const [html5QrcodeScanner, setHtml5QrcodeScanner] =\n React.useState<Html5QrcodeScanner | null>(null)\n\n React.useEffect(() => {\n const verbose = true\n const newHtml5QrcodeScanner = new Html5QrcodeScanner(\n id,\n {\n fps: 10,\n qrbox: {\n width: 250,\n height: 250,\n },\n },\n verbose,\n )\n setHtml5QrcodeScanner(newHtml5QrcodeScanner)\n return () => {\n newHtml5QrcodeScanner.clear()\n }\n }, [id])\n\n React.useEffect(() => {\n html5QrcodeScanner?.render(\n function onScanSuccess(decodedText, decodedResult) {\n console.log(`Code matched = ${decodedText}`, decodedResult)\n onScan(decodedText)\n },\n function onScanFailure() {\n // do nothing and keep scanning\n },\n )\n }, [html5QrcodeScanner, onScan])\n\n return (\n <div>\n <figure className=\"ob-figure\">\n <div id={id} />\n </figure>\n <div className=\"buttons ob-buttons\">\n <button\n type=\"button\"\n className=\"button ob-button ob-button__cancel is-light cypress-cancel-scan-barcode-button\"\n onClick={onClose}\n >\n Cancel\n </button>\n </div>\n </div>\n )\n}\n"]}
package/dist/styles.css CHANGED
@@ -176,7 +176,8 @@ fieldset[disabled] .file-name, fieldset[disabled] .select select, .select fields
176
176
  top: 0;
177
177
  }
178
178
 
179
- /* Bulma Base */ /*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */
179
+ /* Bulma Base */
180
+ /*! minireset.css v0.0.6 | MIT License | github.com/jgthms/minireset.css */
180
181
  html,
181
182
  body,
182
183
  p,
@@ -6029,8 +6030,8 @@ a.has-text-danger-dark:hover, a.has-text-danger-dark:focus {
6029
6030
  }
6030
6031
  .button.is-loading::after {
6031
6032
  position: absolute;
6032
- left: calc(50% - (1em * 0.5));
6033
- top: calc(50% - (1em * 0.5));
6033
+ left: calc(50% - 1em * 0.5);
6034
+ top: calc(50% - 1em * 0.5);
6034
6035
  position: absolute !important;
6035
6036
  }
6036
6037
  .button.is-static {
@@ -7328,7 +7329,7 @@ input[type=range].slider:not([orient=vertical]).has-output:disabled + output, in
7328
7329
  input[type=range].slider:not([orient=vertical]).has-output {
7329
7330
  display: inline-block;
7330
7331
  vertical-align: middle;
7331
- width: calc(100% - ( 4.2rem ));
7332
+ width: calc(100% - (4.2rem));
7332
7333
  }
7333
7334
  input[type=range].slider:not([orient=vertical]).has-output + output {
7334
7335
  display: inline-block;
@@ -7447,7 +7448,7 @@ input[type=range].slider:disabled::-ms-thumb {
7447
7448
  transform: scale(1);
7448
7449
  }
7449
7450
  input[type=range].slider:not([orient=vertical]) {
7450
- min-height: calc(( 1rem + 2px ) * 1.25);
7451
+ min-height: calc((1rem + 2px) * 1.25);
7451
7452
  }
7452
7453
  input[type=range].slider:not([orient=vertical])::-webkit-slider-runnable-track {
7453
7454
  height: 0.5rem;
@@ -7490,7 +7491,7 @@ input[type=range].slider[orient=vertical]::-webkit-slider-thumb {
7490
7491
  margin-left: -0.25rem;
7491
7492
  }
7492
7493
  input[type=range].slider.is-small:not([orient=vertical]) {
7493
- min-height: calc(( 0.75rem + 2px ) * 1.25);
7494
+ min-height: calc((0.75rem + 2px) * 1.25);
7494
7495
  }
7495
7496
  input[type=range].slider.is-small:not([orient=vertical])::-webkit-slider-runnable-track {
7496
7497
  height: 0.375rem;
@@ -7533,7 +7534,7 @@ input[type=range].slider.is-small[orient=vertical]::-webkit-slider-thumb {
7533
7534
  margin-left: -0.1875rem;
7534
7535
  }
7535
7536
  input[type=range].slider.is-medium:not([orient=vertical]) {
7536
- min-height: calc(( 1.25rem + 2px ) * 1.25);
7537
+ min-height: calc((1.25rem + 2px) * 1.25);
7537
7538
  }
7538
7539
  input[type=range].slider.is-medium:not([orient=vertical])::-webkit-slider-runnable-track {
7539
7540
  height: 0.625rem;
@@ -7576,7 +7577,7 @@ input[type=range].slider.is-medium[orient=vertical]::-webkit-slider-thumb {
7576
7577
  margin-left: -0.3125rem;
7577
7578
  }
7578
7579
  input[type=range].slider.is-large:not([orient=vertical]) {
7579
- min-height: calc(( 1.5rem + 2px ) * 1.25);
7580
+ min-height: calc((1.5rem + 2px) * 1.25);
7580
7581
  }
7581
7582
  input[type=range].slider.is-large:not([orient=vertical])::-webkit-slider-runnable-track {
7582
7583
  height: 0.75rem;
package/dist/styles.scss CHANGED
@@ -20,7 +20,7 @@ $size-9: 0.25rem;
20
20
  //
21
21
  // Bulma Variables
22
22
  //
23
- @import 'bulma/sass/utilities/_all';
23
+ @import 'bulma/sass/utilities/_all.sass';
24
24
 
25
25
  //
26
26
  // Our Variables
@@ -31,8 +31,8 @@ $secondary: $grey-lighter;
31
31
  //
32
32
  // Bulma Styles
33
33
  //
34
- @import 'bulma/sass/base/_all';
35
- @import 'bulma/sass/helpers/_all';
34
+ @import 'bulma/sass/base/_all.sass';
35
+ @import 'bulma/sass/helpers/_all.sass';
36
36
  @import 'bulma/sass/layout/section.sass';
37
37
  @import 'bulma/sass/grid/columns.sass';
38
38
 
package/package.json CHANGED
@@ -1,89 +1,88 @@
1
1
  {
2
2
  "name": "@oneblink/apps-react",
3
3
  "description": "Helper functions for OneBlink apps in ReactJS.",
4
- "version": "5.3.0",
4
+ "version": "5.3.1-beta.3",
5
5
  "author": "OneBlink <developers@oneblink.io> (https://oneblink.io)",
6
6
  "bugs": {
7
7
  "url": "https://github.com/oneblink/apps-react/issues"
8
8
  },
9
9
  "dependencies": {
10
- "@emotion/react": "^11.10.6",
11
- "@emotion/styled": "^11.10.6",
12
- "@mui/icons-material": "^5.11.11",
13
- "@oneblink/sdk-core": "^5.0.0-beta.2",
14
- "@react-google-maps/api": "2.18.1",
10
+ "@emotion/react": "^11.11.1",
11
+ "@emotion/styled": "^11.11.0",
12
+ "@mui/icons-material": "^5.14.16",
13
+ "@oneblink/sdk-core": "^5.0.0",
14
+ "@react-google-maps/api": "2.19.2",
15
15
  "blueimp-load-image": "^5.16.0",
16
16
  "bulma": "^0.9.3",
17
17
  "bulma-slider": "2.0.4",
18
18
  "bulma-steps": "^2.2.1",
19
19
  "bulma-toast": "^2.4.1",
20
- "clsx": "^1.2.1",
20
+ "clsx": "^2.0.0",
21
21
  "color": "^4.2.3",
22
22
  "copy-to-clipboard": "^3.3.3",
23
- "date-fns": "^2.29.3",
23
+ "date-fns": "^2.30.0",
24
24
  "escape-string-regexp": "^5.0.0",
25
25
  "file-saver": "^2.0.5",
26
26
  "flatpickr": "^4.6.13",
27
- "jsqr": "^1.4.0",
27
+ "html5-qrcode": "^2.3.8",
28
28
  "lodash.clonedeep": "^4.5.0",
29
29
  "lodash.debounce": "^4.0.8",
30
30
  "lodash.throttle": "^4.1.1",
31
31
  "morph-expressions": "^1.1.1",
32
- "quagga": "^0.12.1",
33
- "query-string": "^7.1.1",
34
- "react-google-recaptcha": "^2.1.0",
32
+ "query-string": "^8.1.0",
33
+ "react-google-recaptcha": "^3.1.0",
35
34
  "react-input-mask": "^2.0.4",
36
35
  "react-signature-canvas": "^1.0.6",
37
36
  "react-table": "^7.8.0",
38
- "sanitize-html": "^2.10.0",
37
+ "sanitize-html": "^2.11.0",
39
38
  "use-resize-observer": "^9.1.0",
40
- "uuid": "^9.0.0",
39
+ "uuid": "^9.0.1",
41
40
  "validate.js": "^0.13.1",
42
- "xml2js": "^0.5.0"
41
+ "xml2js": "^0.6.2"
43
42
  },
44
43
  "devDependencies": {
45
- "@babel/preset-env": "^7.21.4",
44
+ "@babel/preset-env": "^7.23.2",
46
45
  "@microsoft/eslint-plugin-sdl": "^0.2.0",
47
- "@mui/lab": "^5.0.0-alpha.135",
48
- "@mui/material": "^5.10.1",
49
- "@mui/x-date-pickers": "^6.9.1",
50
- "@oneblink/apps": "^7.0.0-beta.2",
51
- "@oneblink/release-cli": "^2.1.0",
46
+ "@mui/lab": "^5.0.0-alpha.152",
47
+ "@mui/material": "^5.14.17",
48
+ "@mui/x-date-pickers": "^6.18.0",
49
+ "@oneblink/apps": "^7.0.1-beta.2",
50
+ "@oneblink/release-cli": "^2.1.1",
52
51
  "@oneblink/types": "github:oneblink/types",
53
- "@types/blueimp-load-image": "^5.16.0",
54
- "@types/color": "^3.0.3",
55
- "@types/file-saver": "^2.0.5",
56
- "@types/filesystem": "^0.0.32",
52
+ "@types/blueimp-load-image": "^5.16.4",
53
+ "@types/color": "^3.0.5",
54
+ "@types/file-saver": "^2.0.6",
55
+ "@types/filesystem": "^0.0.34",
57
56
  "@types/jest": "^27.4.1",
58
- "@types/lodash.clonedeep": "^4.5.7",
59
- "@types/lodash.debounce": "^4.0.7",
60
- "@types/lodash.throttle": "^4.1.7",
57
+ "@types/lodash.clonedeep": "^4.5.8",
58
+ "@types/lodash.debounce": "^4.0.8",
59
+ "@types/lodash.throttle": "^4.1.8",
61
60
  "@types/react": "^17.0.43",
62
- "@types/react-google-recaptcha": "^2.1.5",
63
- "@types/react-input-mask": "^3.0.2",
61
+ "@types/react-google-recaptcha": "^2.1.7",
62
+ "@types/react-input-mask": "^3.0.4",
64
63
  "@types/react-router-dom": "^5.3.3",
65
- "@types/react-signature-canvas": "^1.0.2",
66
- "@types/react-table": "^7.7.14",
67
- "@types/sanitize-html": "^2.9.0",
68
- "@types/ua-parser-js": "^0.7.36",
69
- "@types/uuid": "^9.0.1",
70
- "@types/xml2js": "^0.4.11",
71
- "@typescript-eslint/eslint-plugin": "^5.57.0",
72
- "@typescript-eslint/parser": "^5.57.0",
64
+ "@types/react-signature-canvas": "^1.0.4",
65
+ "@types/react-table": "^7.7.17",
66
+ "@types/sanitize-html": "^2.9.3",
67
+ "@types/ua-parser-js": "^0.7.38",
68
+ "@types/uuid": "^9.0.6",
69
+ "@types/xml2js": "^0.4.13",
70
+ "@typescript-eslint/eslint-plugin": "^6.10.0",
71
+ "@typescript-eslint/parser": "^6.10.0",
73
72
  "copyfiles": "^2.4.1",
74
- "eslint": "^8.37.0",
75
- "eslint-config-prettier": "^8.8.0",
76
- "eslint-plugin-prettier": "^4.2.1",
77
- "eslint-plugin-react": "^7.32.2",
73
+ "eslint": "^8.53.0",
74
+ "eslint-config-prettier": "^9.0.0",
75
+ "eslint-plugin-prettier": "^5.0.1",
76
+ "eslint-plugin-react": "^7.33.2",
78
77
  "eslint-plugin-react-hooks": "^4.6.0",
79
78
  "fixpack": "^4.0.0",
80
79
  "jest": "^27.5.1",
81
- "prettier": "^2.8.7",
82
- "prettier-plugin-jsdoc": "^0.4.2",
80
+ "prettier": "^3.0.3",
81
+ "prettier-plugin-jsdoc": "^1.1.1",
83
82
  "react": "^17.0.2",
84
83
  "react-dom": "^17.0.2",
85
84
  "react-router-dom": "^5.3.0",
86
- "sass": "^1.60.0",
85
+ "sass": "^1.69.5",
87
86
  "ts-jest": "^27.1.4",
88
87
  "tsc-watch": "^6.0.0",
89
88
  "typedoc": "^0.24.8",
@@ -93,8 +92,8 @@
93
92
  "doc": "docs"
94
93
  },
95
94
  "engines": {
96
- "node": ">=18",
97
- "npm": ">=8"
95
+ "node": ">=20",
96
+ "npm": ">=10"
98
97
  },
99
98
  "files": [
100
99
  "dist"
@@ -104,7 +103,7 @@
104
103
  "main": "./dist/index.js",
105
104
  "module": "./dist/index.js",
106
105
  "peerDependencies": {
107
- "@mui/lab": "^5.0.0 || ^5.0.0-alpha.135",
106
+ "@mui/lab": "^5.0.0 || ^5.0.0-alpha.152",
108
107
  "@mui/material": "^5.6.1",
109
108
  "@mui/x-date-pickers": "^6.9.1",
110
109
  "@oneblink/apps": "*",