argous 1.2.217 → 1.2.219

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.
Files changed (82) hide show
  1. package/dist/components/Carousel/Carousel.js +2 -2
  2. package/dist/components/Editor/skins/content/dark/content.min.css +1 -0
  3. package/dist/components/Editor/skins/content/default/content.min.css +1 -0
  4. package/dist/components/Editor/skins/content/document/content.min.css +1 -0
  5. package/dist/components/Editor/skins/content/tinymce-5/content.min.css +1 -0
  6. package/dist/components/Editor/skins/content/tinymce-5-dark/content.min.css +1 -0
  7. package/dist/components/Editor/skins/content/writer/content.min.css +1 -0
  8. package/dist/components/Editor/skins/ui/oxide/content.inline.min.css +1 -0
  9. package/dist/components/Editor/skins/ui/oxide/content.min.css +1 -0
  10. package/dist/components/Editor/skins/ui/oxide/skin.min.css +1 -0
  11. package/dist/components/Editor/skins/ui/oxide/skin.shadowdom.min.css +1 -0
  12. package/dist/components/Editor/skins/ui/oxide-dark/content.inline.min.css +1 -0
  13. package/dist/components/Editor/skins/ui/oxide-dark/content.min.css +1 -0
  14. package/dist/components/Editor/skins/ui/oxide-dark/skin.min.css +1 -0
  15. package/dist/components/Editor/skins/ui/oxide-dark/skin.shadowdom.min.css +1 -0
  16. package/dist/components/Editor/skins/ui/tinymce-5/content.inline.min.css +1 -0
  17. package/dist/components/Editor/skins/ui/tinymce-5/content.min.css +1 -0
  18. package/dist/components/Editor/skins/ui/tinymce-5/skin.min.css +1 -0
  19. package/dist/components/Editor/skins/ui/tinymce-5/skin.shadowdom.min.css +1 -0
  20. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.inline.min.css +1 -0
  21. package/dist/components/Editor/skins/ui/tinymce-5-dark/content.min.css +1 -0
  22. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.min.css +1 -0
  23. package/dist/components/Editor/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +1 -0
  24. package/dist/components/Editor/tinymce/icons/default/icons.js +194 -0
  25. package/dist/components/Editor/tinymce/icons/default/icons.min.js +1 -0
  26. package/dist/components/Editor/tinymce/skins/content/dark/content.css +66 -0
  27. package/dist/components/Editor/tinymce/skins/content/dark/content.min.css +2 -0
  28. package/dist/components/Editor/tinymce/skins/content/default/content.css +61 -0
  29. package/dist/components/Editor/tinymce/skins/content/default/content.min.css +2 -0
  30. package/dist/components/Editor/tinymce/skins/content/document/content.css +66 -0
  31. package/dist/components/Editor/tinymce/skins/content/document/content.min.css +2 -0
  32. package/dist/components/Editor/tinymce/skins/content/tinymce-5/content.css +61 -0
  33. package/dist/components/Editor/tinymce/skins/content/tinymce-5/content.min.css +2 -0
  34. package/dist/components/Editor/tinymce/skins/content/tinymce-5-dark/content.css +66 -0
  35. package/dist/components/Editor/tinymce/skins/content/tinymce-5-dark/content.min.css +2 -0
  36. package/dist/components/Editor/tinymce/skins/content/writer/content.css +62 -0
  37. package/dist/components/Editor/tinymce/skins/content/writer/content.min.css +2 -0
  38. package/dist/components/Editor/tinymce/skins/ui/oxide/content.css +785 -0
  39. package/dist/components/Editor/tinymce/skins/ui/oxide/content.inline.css +779 -0
  40. package/dist/components/Editor/tinymce/skins/ui/oxide/content.inline.min.css +2 -0
  41. package/dist/components/Editor/tinymce/skins/ui/oxide/content.min.css +2 -0
  42. package/dist/components/Editor/tinymce/skins/ui/oxide/skin.css +3763 -0
  43. package/dist/components/Editor/tinymce/skins/ui/oxide/skin.min.css +2 -0
  44. package/dist/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.css +30 -0
  45. package/dist/components/Editor/tinymce/skins/ui/oxide/skin.shadowdom.min.css +2 -0
  46. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/content.css +766 -0
  47. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.css +779 -0
  48. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/content.inline.min.css +2 -0
  49. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/content.min.css +2 -0
  50. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/skin.css +3766 -0
  51. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/skin.min.css +2 -0
  52. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.css +30 -0
  53. package/dist/components/Editor/tinymce/skins/ui/oxide-dark/skin.shadowdom.min.css +2 -0
  54. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/content.css +785 -0
  55. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.css +779 -0
  56. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/content.inline.min.css +2 -0
  57. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/content.min.css +2 -0
  58. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/skin.css +3857 -0
  59. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/skin.min.css +2 -0
  60. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.css +30 -0
  61. package/dist/components/Editor/tinymce/skins/ui/tinymce-5/skin.shadowdom.min.css +2 -0
  62. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.css +766 -0
  63. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.css +779 -0
  64. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.inline.min.css +2 -0
  65. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/content.min.css +2 -0
  66. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.css +3857 -0
  67. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.min.css +2 -0
  68. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.css +30 -0
  69. package/dist/components/Editor/tinymce/skins/ui/tinymce-5-dark/skin.shadowdom.min.css +2 -0
  70. package/dist/components/TextToHtml/TextToHtml.js +5 -16
  71. package/dist/components/TextToHtml/icons/resize_area.svg +2 -0
  72. package/dist/components/TextToHtml/style.css +40 -0
  73. package/dist/components/Zoom/style.css +25 -0
  74. package/lib/components/Carousel/Carousel.js +2 -2
  75. package/lib/components/TextToHtml/TextToHtml.js +4 -17
  76. package/package.json +1 -1
  77. package/dist/components/CodeReader/CodeReader.d.ts +0 -29
  78. package/dist/components/CodeReader/CodeReader.js +0 -487
  79. package/dist/components/CodeReader/index.d.ts +0 -1
  80. package/dist/components/CodeReader/index.js +0 -8
  81. package/dist/components/Editor/ScriptLoader.d.ts +0 -20
  82. package/dist/components/Editor/ScriptLoader.js +0 -70
@@ -1,487 +0,0 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- var __importDefault = (this && this.__importDefault) || function (mod) {
33
- return (mod && mod.__esModule) ? mod : { "default": mod };
34
- };
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.types = void 0;
37
- var core_1 = require("@material-ui/core");
38
- var clsx_1 = __importDefault(require("clsx"));
39
- var react_1 = __importStar(require("react"));
40
- var react_barcode_scanner_webcam_1 = __importDefault(require("react-barcode-scanner-webcam"));
41
- var io5_1 = require("react-icons/io5");
42
- var react_qr_reader_1 = require("react-qr-reader");
43
- var GENERIC_ID = 'generic';
44
- var UNIMED_CARD_ID = 'unimed-qr-card';
45
- var RESET_MS = 2000;
46
- var BORDER_RADIUS = '.75rem';
47
- var ICON_SIZE = 24;
48
- var SMALL_ICON_SIZE = 20;
49
- var TARGET_BOX_SHADOW = '0px 0px 0px 135px rgb(0 0 0 / 20%), 0px 1px 36px -12px rgb(0 0 0 / 10%), 0px 1px 48px -24px rgb(0 0 0 / 20%)';
50
- var BLUE_COLOR = function (theme) { return theme.palette.secondary.main; };
51
- var GREEN_COLOR = function (theme) { return theme.palette.primary.main; };
52
- var PURPLE_COLOR = '#972add';
53
- var useStyles = core_1.makeStyles(function (theme) {
54
- var _a, _b;
55
- return ({
56
- container: {
57
- position: 'relative'
58
- },
59
- camOptions: {
60
- position: 'absolute',
61
- top: 0,
62
- left: 0,
63
- width: '100%',
64
- height: 'calc(75% + 1px)',
65
- marginTop: 'calc(12% + 2px)',
66
- overflow: 'hidden',
67
- transition: 'opacity 1s'
68
- },
69
- target: {
70
- position: 'relative',
71
- top: '50%',
72
- left: '50%',
73
- width: '50%',
74
- height: '50%',
75
- transform: 'translate(-50%, -50%)',
76
- borderRadius: BORDER_RADIUS,
77
- boxShadow: TARGET_BOX_SHADOW,
78
- WebkitBoxShadow: TARGET_BOX_SHADOW
79
- },
80
- showEl: {
81
- opacity: 1
82
- },
83
- flipCam: {
84
- position: 'absolute',
85
- right: 0,
86
- bottom: 0,
87
- '&>button': {
88
- color: '#fff',
89
- '&:hover': {
90
- backgroundColor: 'rgba(255, 255, 255, .08)'
91
- }
92
- }
93
- },
94
- camMessageContainer: {
95
- position: 'absolute',
96
- top: '-50%',
97
- width: '100%',
98
- height: '50%',
99
- display: 'flex',
100
- flexDirection: 'column',
101
- alignItems: 'center',
102
- justifyContent: 'center',
103
- color: '#fff'
104
- },
105
- camMessage: (_a = {
106
- lineHeight: 1.25
107
- },
108
- _a[theme.breakpoints.down(500)] = {
109
- fontSize: '0.8rem'
110
- },
111
- _a),
112
- camMessageIcon: (_b = {
113
- margin: '.375rem',
114
- width: ICON_SIZE,
115
- height: ICON_SIZE
116
- },
117
- _b[theme.breakpoints.down(500)] = {
118
- width: SMALL_ICON_SIZE,
119
- height: SMALL_ICON_SIZE
120
- },
121
- _b),
122
- externalDeviceMessageContainer: {
123
- display: 'flex',
124
- flexDirection: 'column',
125
- alignItems: 'center',
126
- justifyContent: 'center',
127
- color: theme.palette.text.primary
128
- },
129
- externalDeviceMessageIconContainer: {
130
- display: 'flex',
131
- alignItems: 'center'
132
- },
133
- externalDeviceMessageIcon: {
134
- margin: '.375rem'
135
- },
136
- externalDeviceMessage: {
137
- lineHeight: 1.25
138
- },
139
- readIndicatorContainer: {
140
- position: 'relative',
141
- display: 'grid',
142
- placeItems: 'center',
143
- margin: function (_a) {
144
- var indicatorSize = _a.indicatorSize;
145
- return indicatorSize / 3.33333333333;
146
- },
147
- minHeight: function (_a) {
148
- var indicatorSize = _a.indicatorSize;
149
- return (indicatorSize / 2);
150
- },
151
- minWidth: function (_a) {
152
- var indicatorSize = _a.indicatorSize;
153
- return (indicatorSize / 2);
154
- }
155
- },
156
- readIndicatorUpstairs: {
157
- position: 'absolute',
158
- display: 'grid',
159
- placeItems: 'center'
160
- },
161
- readIndicator: {
162
- position: 'relative',
163
- height: function (_a) {
164
- var indicatorSize = _a.indicatorSize;
165
- return indicatorSize;
166
- },
167
- width: function (_a) {
168
- var indicatorSize = _a.indicatorSize;
169
- return indicatorSize;
170
- },
171
- display: 'inline-block',
172
- border: '2px solid #0000',
173
- borderRadius: '50%',
174
- borderLeftColor: GREEN_COLOR(theme),
175
- animation: '$rotate 1.2s linear infinite',
176
- transition: 'border .4s ease-in'
177
- },
178
- readIndicatorReaded: {
179
- animation: 'none',
180
- borderColor: GREEN_COLOR(theme),
181
- transition: 'border .4s ease-out'
182
- },
183
- '@keyframes rotate': {
184
- '50%': {
185
- borderLeftColor: PURPLE_COLOR
186
- },
187
- '75%': {
188
- borderLeftColor: BLUE_COLOR(theme)
189
- },
190
- '100%': {
191
- transform: 'rotate(360deg)'
192
- }
193
- },
194
- checkIcon: {
195
- display: 'none',
196
- position: 'absolute',
197
- top: '50%',
198
- left: function (_a) {
199
- var CHECK_ICON_WIDTH = _a.CHECK_ICON_WIDTH;
200
- return "calc(50% - " + CHECK_ICON_WIDTH + "px)";
201
- },
202
- height: function (_a) {
203
- var CHECK_ICON_HEIGHT = _a.CHECK_ICON_HEIGHT;
204
- return CHECK_ICON_HEIGHT;
205
- },
206
- width: function (_a) {
207
- var CHECK_ICON_WIDTH = _a.CHECK_ICON_WIDTH;
208
- return CHECK_ICON_WIDTH;
209
- },
210
- borderTop: "2px solid " + GREEN_COLOR(theme),
211
- borderRight: "2px solid " + GREEN_COLOR(theme),
212
- transform: 'scaleX(-1) rotate(135deg)',
213
- transformOrigin: 'left top',
214
- animation: '$checkIcon .8s ease'
215
- },
216
- checkIconReaded: {
217
- display: 'block'
218
- },
219
- '@keyframes checkIcon': {
220
- '0%': {
221
- height: 0,
222
- width: 0,
223
- opacity: 1
224
- },
225
- '20%': {
226
- height: 0,
227
- width: function (_a) {
228
- var CHECK_ICON_WIDTH = _a.CHECK_ICON_WIDTH;
229
- return CHECK_ICON_WIDTH;
230
- },
231
- opacity: 1
232
- },
233
- '40%': {
234
- height: function (_a) {
235
- var CHECK_ICON_HEIGHT = _a.CHECK_ICON_HEIGHT;
236
- return CHECK_ICON_HEIGHT;
237
- },
238
- width: function (_a) {
239
- var CHECK_ICON_WIDTH = _a.CHECK_ICON_WIDTH;
240
- return CHECK_ICON_WIDTH;
241
- },
242
- opacity: 1
243
- },
244
- '100%': {
245
- height: function (_a) {
246
- var CHECK_ICON_HEIGHT = _a.CHECK_ICON_HEIGHT;
247
- return CHECK_ICON_HEIGHT;
248
- },
249
- width: function (_a) {
250
- var CHECK_ICON_WIDTH = _a.CHECK_ICON_WIDTH;
251
- return CHECK_ICON_WIDTH;
252
- },
253
- opacity: 1
254
- }
255
- },
256
- hiddenReader: {
257
- position: 'absolute',
258
- top: 0,
259
- left: 0,
260
- width: '100%',
261
- height: '100%',
262
- zIndex: -1,
263
- overflow: 'hidden'
264
- }
265
- });
266
- });
267
- var createObject = function (typeConfig, validation, code) {
268
- var type = typeConfig.type;
269
- var initialValidation = typeConfig.initialValidation;
270
- var obj = {};
271
- var divider = undefined;
272
- var sectionLen = undefined;
273
- var cutCode = function () { return code = code.substring(sectionLen + 1); };
274
- var getSection = function () { return code.substring(0, sectionLen); };
275
- var getSectionLen = function () { return sectionLen = code.indexOf(divider); };
276
- var cutAndGetLen = function () {
277
- cutCode();
278
- getSectionLen();
279
- };
280
- if (type === UNIMED_CARD_ID) {
281
- var physicalCard = (validation === initialValidation[0]);
282
- var virtualCard = (validation === initialValidation[1]);
283
- divider = '=';
284
- sectionLen = code.indexOf(divider);
285
- var dateFormat = function (string) { return string.replace(/[^0-9]/g, '/'); };
286
- if (physicalCard) {
287
- obj.type = 'Cartão físico';
288
- obj.card = getSection();
289
- cutAndGetLen();
290
- obj.name = getSection();
291
- cutAndGetLen();
292
- obj.birthday = dateFormat(getSection());
293
- cutAndGetLen();
294
- obj.genre = getSection();
295
- cutAndGetLen();
296
- obj.cns = getSection();
297
- cutAndGetLen();
298
- obj.expiry = dateFormat(getSection());
299
- cutAndGetLen();
300
- obj.via = getSection();
301
- cutAndGetLen();
302
- obj.redeAtendimento = getSection();
303
- cutAndGetLen();
304
- obj.cdProdutoAns = getSection();
305
- }
306
- if (virtualCard) {
307
- obj.type = 'Cartão virtual';
308
- obj.card = getSection();
309
- cutAndGetLen();
310
- obj.name = getSection();
311
- cutAndGetLen();
312
- obj.birthday = dateFormat(getSection());
313
- cutAndGetLen();
314
- obj.genre = getSection();
315
- cutAndGetLen();
316
- obj.cns = getSection();
317
- cutAndGetLen();
318
- obj.expiry = dateFormat(getSection());
319
- cutAndGetLen();
320
- obj.redeAtendimento = getSection();
321
- cutAndGetLen();
322
- obj.cdProdutoAns = getSection();
323
- cutAndGetLen();
324
- cutAndGetLen();
325
- obj.token = code;
326
- }
327
- }
328
- else
329
- obj.code = code;
330
- return obj;
331
- };
332
- exports.types = {
333
- card: {
334
- type: UNIMED_CARD_ID,
335
- initialValidation: ['1=01=', '2=01=']
336
- },
337
- generic: {
338
- type: GENERIC_ID,
339
- initialValidation: ''
340
- }
341
- };
342
- var initialStateTypeConfig = {
343
- type: '',
344
- initialValidation: []
345
- };
346
- var initialState = {
347
- verify: false,
348
- code: ''
349
- };
350
- var CodeReader = function (_a) {
351
- var _b = _a.id, id = _b === void 0 ? '' : _b, _c = _a.type, type = _c === void 0 ? GENERIC_ID : _c, _d = _a.message, message = _d === void 0 ? '' : _d, _e = _a.icon, Icon = _e === void 0 ? false : _e, _f = _a.iconSize, iconSize = _f === void 0 ? 20 : _f, _g = _a.indicator, indicator = _g === void 0 ? true : _g, _h = _a.indicatorSize, indicatorSize = _h === void 0 ? 40 : _h, _j = _a.target, target = _j === void 0 ? true : _j, _k = _a.camMessage, camMessage = _k === void 0 ? '' : _k, _l = _a.camIcon, CamIcon = _l === void 0 ? false : _l, _m = _a.flipCamButton, flipCamButton = _m === void 0 ? true : _m, _o = _a.flipCamIcon, FlipCamIcon = _o === void 0 ? io5_1.IoCameraReverseOutline : _o, _p = _a.onRead, onRead = _p === void 0 ? function (data) { return ''; } : _p;
352
- var elId = (id ? id + "-" : '') + "code-reader";
353
- var _q = react_1.useState('user'), facingMode = _q[0], setFacingMode = _q[1]; // user || environment
354
- var _r = react_1.useState(false), hasAnyDevice = _r[0], setHasAnyDevice = _r[1];
355
- var _s = react_1.useState(initialState), state = _s[0], setState = _s[1];
356
- var _t = react_1.useState(initialStateTypeConfig), typeConfig = _t[0], setTypeConfig = _t[1];
357
- var _u = react_1.useState(false), readed = _u[0], setReaded = _u[1];
358
- var _v = react_1.useState(false), externalDeviceMessage = _v[0], setExternalDeviceMessage = _v[1];
359
- var CHECK_ICON_WIDTH = (indicatorSize / 4);
360
- var CHECK_ICON_HEIGHT = (CHECK_ICON_WIDTH * 2);
361
- var classes = useStyles({ readed: readed, indicatorSize: indicatorSize, CHECK_ICON_WIDTH: CHECK_ICON_WIDTH, CHECK_ICON_HEIGHT: CHECK_ICON_HEIGHT });
362
- var logicSetState = function (type, field, value) { return setState(function (values) {
363
- var _a, _b;
364
- return (__assign(__assign({}, values), (_a = {}, _a[type] = type && field ? __assign(__assign({}, values[type]), (_b = {}, _b[field] = value, _b)) : value, _a)));
365
- }); };
366
- var getTypeConfig = function (type) {
367
- var arrTypes = Object.values(exports.types);
368
- arrTypes.forEach(function (item) { return (item.type === type) && setTypeConfig(item); });
369
- };
370
- react_1.useEffect(function () { return getTypeConfig(type); }, [type]);
371
- react_1.useEffect(function () { return readed && setTimeout(function () { return setReaded(false); }, 5000); }, [readed]);
372
- var verifyCode = react_1.useCallback(function (code) {
373
- var validation = '';
374
- var type = typeConfig.type;
375
- var initialValidation = typeConfig.initialValidation;
376
- var generic = (type === GENERIC_ID);
377
- var verify = function (item) {
378
- if (!item || validation || (!item && validation))
379
- return;
380
- var len = item.length;
381
- var part = code.substring(0, len);
382
- if (item === part) {
383
- validation = item;
384
- code = code.substring(len);
385
- }
386
- };
387
- if (!generic)
388
- (initialValidation.length > 1) ? initialValidation.forEach(function (validationItem) { return verify(validationItem); }) : verify(initialValidation[0]);
389
- if (generic || (validation && type)) {
390
- var data = createObject(typeConfig, validation, code);
391
- if (data) {
392
- onRead && onRead(data);
393
- setReaded(true);
394
- }
395
- }
396
- setState(initialState);
397
- }, [onRead, typeConfig]);
398
- react_1.useEffect(function () { return state.verify && verifyCode(state.code); }, [state.code, state.verify, verifyCode]);
399
- //_[ CAM CODE READER ]___________________________________________________________________________
400
- function detectDevices() {
401
- var mediaDevices = navigator.mediaDevices;
402
- if (!mediaDevices || !mediaDevices.enumerateDevices)
403
- return;
404
- mediaDevices.enumerateDevices().then(function (devices) { return setHasAnyDevice(devices.some(function (device) { return device.kind === 'videoinput'; })); });
405
- }
406
- react_1.useEffect(function () {
407
- detectDevices();
408
- setTimeout(function () { return setExternalDeviceMessage(true); }, 50);
409
- var stateInterval = setInterval(function () { return setState(__assign({}, initialState)); }, RESET_MS);
410
- var devicesInterval = setInterval(function () { return detectDevices(); }, 1000);
411
- return function () {
412
- clearInterval(stateInterval);
413
- clearInterval(devicesInterval);
414
- };
415
- }, []);
416
- var toggleFacingMode = function (e) { return setFacingMode(function (mode) { return (mode === 'user') ? 'environment' : 'user'; }); };
417
- var setCode = function (code) { return setState(function (states) { return (__assign(__assign({}, states), { verify: true, code: code })); }); };
418
- var readQrCode = function (data) {
419
- var code = data === null || data === void 0 ? void 0 : data.text;
420
- code && setCode(code);
421
- };
422
- var readBarCode = function (error, result) {
423
- var code = result === null || result === void 0 ? void 0 : result.text;
424
- code && setCode(code);
425
- };
426
- //_[ USB CODE READER ]___________________________________________________________________________
427
- var usbCodeReader = react_1.useCallback(function (e) {
428
- if (e.key === 'Enter')
429
- logicSetState('verify', '', true);
430
- if (e.key !== 'Shift')
431
- setState(function (values) { return (__assign(__assign({}, values), { code: values.code += e.key })); });
432
- }, []);
433
- react_1.useEffect(function () {
434
- document.addEventListener('keydown', function (e) { return usbCodeReader(e); });
435
- return function () { return document.removeEventListener('keydown', function (e) { return usbCodeReader(e); }); };
436
- }, [usbCodeReader]);
437
- return react_1.default.createElement("div", { id: elId + "-container", className: classes.container },
438
- !hasAnyDevice && externalDeviceMessage && react_1.default.createElement(ExternalDeviceMessage, __assign({}, { elId: elId, readed: readed, message: message, Icon: Icon, iconSize: iconSize, indicator: indicator, classes: classes })),
439
- hasAnyDevice &&
440
- (react_1.default.createElement(react_1.Fragment, { key: elId + "-cam-fragment" },
441
- react_1.default.createElement(react_qr_reader_1.QrReader, { videoId: elId + "-video", scanDelay: 300, constraints: { facingMode: facingMode }, onResult: readQrCode }),
442
- react_1.default.createElement("div", { className: classes.hiddenReader },
443
- react_1.default.createElement(react_barcode_scanner_webcam_1.default, { onUpdate: readBarCode })),
444
- react_1.default.createElement(CamOptions, __assign({}, { elId: elId, toggleFacingMode: toggleFacingMode, flipCamButton: flipCamButton, FlipCamIcon: FlipCamIcon, target: target, CamIcon: CamIcon, camMessage: camMessage, classes: classes })))));
445
- };
446
- exports.default = CodeReader;
447
- var ExternalDeviceMessage = function (_a) {
448
- var elId = _a.elId, readed = _a.readed, message = _a.message, Icon = _a.Icon, iconSize = _a.iconSize, indicator = _a.indicator, classes = _a.classes;
449
- return react_1.default.createElement("div", { className: classes.externalDeviceMessageContainer },
450
- (!indicator && Icon) && react_1.default.createElement(Icon, { id: elId + "-icon", size: iconSize, className: classes.externalDeviceMessageIcon }),
451
- message && react_1.default.createElement(core_1.Typography, { align: 'center', className: classes.externalDeviceMessage },
452
- react_1.default.createElement("b", null, message)),
453
- indicator &&
454
- (react_1.default.createElement("div", { className: classes.readIndicatorContainer },
455
- !!(!readed && Icon) && react_1.default.createElement(Icon, { id: elId + "-icon", size: iconSize }),
456
- react_1.default.createElement("div", { className: classes.readIndicatorUpstairs },
457
- react_1.default.createElement(ReadIndicator, __assign({}, { readed: readed, classes: classes }))))));
458
- };
459
- var ReadIndicator = function (_a) {
460
- var _b, _c;
461
- var readed = _a.readed, classes = _a.classes;
462
- return react_1.default.createElement("div", { className: clsx_1.default(classes.readIndicator, (_b = {}, _b[classes.readIndicatorReaded] = readed, _b)) },
463
- react_1.default.createElement("div", { className: clsx_1.default(classes.checkIcon, (_c = {}, _c[classes.checkIconReaded] = readed, _c)) }));
464
- };
465
- var CamOptions = function (_a) {
466
- var elId = _a.elId, toggleFacingMode = _a.toggleFacingMode, flipCamButton = _a.flipCamButton, FlipCamIcon = _a.FlipCamIcon, target = _a.target, CamIcon = _a.CamIcon, camMessage = _a.camMessage, classes = _a.classes;
467
- return react_1.default.createElement("div", { className: classes.camOptions },
468
- target && react_1.default.createElement(Target, __assign({ id: elId + "-target" }, { CamIcon: CamIcon, camMessage: camMessage, classes: classes })),
469
- flipCamButton && react_1.default.createElement(FlipCamButton, __assign({ id: elId + "-flipcam" }, { toggleFacingMode: toggleFacingMode, FlipCamIcon: FlipCamIcon, classes: classes })));
470
- };
471
- var Target = function (_a) {
472
- var id = _a.id, CamIcon = _a.CamIcon, camMessage = _a.camMessage, classes = _a.classes;
473
- return react_1.default.createElement("div", __assign({}, { id: id }, { className: classes.target }),
474
- react_1.default.createElement(CamMessage, __assign({ id: id + "-cam-message" }, { CamIcon: CamIcon, camMessage: camMessage, classes: classes })));
475
- };
476
- var CamMessage = function (_a) {
477
- var id = _a.id, CamIcon = _a.CamIcon, camMessage = _a.camMessage, classes = _a.classes;
478
- return react_1.default.createElement("div", __assign({}, { id: id }, { className: classes.camMessageContainer }),
479
- CamIcon && react_1.default.createElement(CamIcon, { className: classes.camMessageIcon }),
480
- react_1.default.createElement(core_1.Typography, { align: 'center', className: classes.camMessage },
481
- react_1.default.createElement("b", null, camMessage)));
482
- };
483
- var FlipCamButton = function (_a) {
484
- var id = _a.id, toggleFacingMode = _a.toggleFacingMode, FlipCamIcon = _a.FlipCamIcon, classes = _a.classes;
485
- return react_1.default.createElement("div", __assign({}, { id: id }, { className: classes.flipCam }),
486
- react_1.default.createElement(core_1.IconButton, { onClick: toggleFacingMode }, FlipCamIcon && react_1.default.createElement(FlipCamIcon, null)));
487
- };
@@ -1 +0,0 @@
1
- export { default } from "./CodeReader";
@@ -1,8 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- var CodeReader_1 = require("./CodeReader");
8
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(CodeReader_1).default; } });
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright (c) 2017-present, Ephox, Inc.
3
- *
4
- * This source code is licensed under the Apache 2 license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- */
8
- export declare type callbackFn = () => void;
9
- export interface IStateObj {
10
- listeners: callbackFn[];
11
- scriptId: string;
12
- scriptLoading: boolean;
13
- scriptLoaded: boolean;
14
- }
15
- interface ScriptLoaderInterface {
16
- load: (doc: Document, url: string, async: boolean, defer: boolean, delay: number, callback: callbackFn) => void;
17
- reinitialize: () => void;
18
- }
19
- declare const ScriptLoader: ScriptLoaderInterface;
20
- export { ScriptLoader };
@@ -1,70 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright (c) 2017-present, Ephox, Inc.
4
- *
5
- * This source code is licensed under the Apache 2 license found in the
6
- * LICENSE file in the root directory of this source tree.
7
- *
8
- */
9
- Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ScriptLoader = void 0;
11
- var Utils_1 = require("./Utils");
12
- var createState = function () { return ({
13
- listeners: [],
14
- scriptId: Utils_1.uuid('tiny-script'),
15
- scriptLoading: false,
16
- scriptLoaded: false
17
- }); };
18
- var CreateScriptLoader = function () {
19
- var state = createState();
20
- var injectScriptTag = function (scriptId, doc, url, async, defer, callback) {
21
- var scriptTag = doc.createElement('script');
22
- scriptTag.referrerPolicy = 'origin';
23
- scriptTag.type = 'application/javascript';
24
- scriptTag.id = scriptId;
25
- scriptTag.src = url;
26
- scriptTag.async = async;
27
- scriptTag.defer = defer;
28
- // scriptTag.appendChild(document.createTextNode(url));
29
- var handler = function () {
30
- scriptTag.removeEventListener('load', handler);
31
- callback();
32
- };
33
- scriptTag.addEventListener('load', handler);
34
- if (doc.head) {
35
- doc.head.appendChild(scriptTag);
36
- }
37
- // document.body.appendChild(scriptTag);
38
- };
39
- var load = function (doc, url, async, defer, delay, callback) {
40
- var scriptTagInjection = function () { return injectScriptTag(state.scriptId, doc, url, async, defer, function () {
41
- state.listeners.forEach(function (fn) { return fn(); });
42
- state.scriptLoaded = true;
43
- }); };
44
- if (state.scriptLoaded) {
45
- callback();
46
- }
47
- else {
48
- state.listeners.push(callback);
49
- if (!state.scriptLoading) {
50
- state.scriptLoading = true;
51
- if (delay > 0) {
52
- setTimeout(scriptTagInjection, delay);
53
- }
54
- else {
55
- scriptTagInjection();
56
- }
57
- }
58
- }
59
- };
60
- // Only to be used by tests.
61
- var reinitialize = function () {
62
- state = createState();
63
- };
64
- return {
65
- load: load,
66
- reinitialize: reinitialize
67
- };
68
- };
69
- var ScriptLoader = CreateScriptLoader();
70
- exports.ScriptLoader = ScriptLoader;