scandit-datacapture-frameworks-core 8.2.0 → 8.3.0-beta.1

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 (33) hide show
  1. package/dist/dts/ClusteringMode.d.ts +6 -0
  2. package/dist/dts/camera/Camera.d.ts +16 -3
  3. package/dist/dts/camera/CameraSettings.d.ts +4 -0
  4. package/dist/dts/camera/FocusGesture.d.ts +6 -0
  5. package/dist/dts/camera/FocusGestureListener.d.ts +5 -0
  6. package/dist/dts/camera/FocusGestureListenerEvents.d.ts +3 -0
  7. package/dist/dts/camera/MacroMode.d.ts +5 -0
  8. package/dist/dts/camera/SwipeToZoom.d.ts +14 -0
  9. package/dist/dts/camera/TapToFocus.d.ts +15 -0
  10. package/dist/dts/camera/TorchSwitchControl.d.ts +5 -0
  11. package/dist/dts/camera/ZoomGesture.d.ts +5 -0
  12. package/dist/dts/camera/ZoomGestureListener.d.ts +5 -0
  13. package/dist/dts/camera/ZoomGestureListenerEvents.d.ts +4 -0
  14. package/dist/dts/camera/ZoomSwitchControl.d.ts +7 -0
  15. package/dist/dts/camera/controller/CameraController.d.ts +8 -0
  16. package/dist/dts/camera/index.d.ts +5 -0
  17. package/dist/dts/camerahelpers/MacroModeListenerEvents.d.ts +3 -0
  18. package/dist/dts/camerahelpers/TorchListenerEvents.d.ts +3 -0
  19. package/dist/dts/camerahelpers/index.d.ts +2 -0
  20. package/dist/dts/common/Payload.d.ts +36 -1
  21. package/dist/dts/defaults/CoreDefaults.d.ts +5 -1
  22. package/dist/dts/defaults/getCoreDefaults.d.ts +1 -1
  23. package/dist/dts/frame/FrameData.d.ts +6 -0
  24. package/dist/dts/frame/MacroModeListener.d.ts +4 -0
  25. package/dist/dts/frame/TorchListener.d.ts +4 -0
  26. package/dist/dts/frame/index.d.ts +2 -0
  27. package/dist/dts/generated/CoreProxyAdapter.d.ts +71 -0
  28. package/dist/dts/index.d.ts +1 -0
  29. package/dist/dts/view/DataCaptureView.d.ts +7 -0
  30. package/dist/dts/view/DataCaptureViewController.d.ts +22 -2
  31. package/dist/index.js +850 -62
  32. package/dist/index.js.map +1 -1
  33. package/package.json +3 -3
package/dist/index.js CHANGED
@@ -391,6 +391,50 @@ class FactoryMaker {
391
391
  }
392
392
  FactoryMaker.instances = new Map();
393
393
 
394
+ var FocusGestureListenerEvents;
395
+ (function (FocusGestureListenerEvents) {
396
+ FocusGestureListenerEvents["onFocusGesture"] = "FocusGestureListener.onFocusGesture";
397
+ })(FocusGestureListenerEvents || (FocusGestureListenerEvents = {}));
398
+
399
+ /******************************************************************************
400
+ Copyright (c) Microsoft Corporation.
401
+
402
+ Permission to use, copy, modify, and/or distribute this software for any
403
+ purpose with or without fee is hereby granted.
404
+
405
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
406
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
407
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
408
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
409
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
410
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
411
+ PERFORMANCE OF THIS SOFTWARE.
412
+ ***************************************************************************** */
413
+ /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
414
+
415
+
416
+ function __decorate(decorators, target, key, desc) {
417
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
418
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
419
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
420
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
421
+ }
422
+
423
+ function __awaiter(thisArg, _arguments, P, generator) {
424
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
425
+ return new (P || (P = Promise))(function (resolve, reject) {
426
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
427
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
428
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
429
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
430
+ });
431
+ }
432
+
433
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
434
+ var e = new Error(message);
435
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
436
+ };
437
+
394
438
  function ignoreFromSerialization(target, propertyName) {
395
439
  target.ignoredProperties = target.ignoredProperties || [];
396
440
  target.ignoredProperties.push(propertyName);
@@ -462,8 +506,46 @@ class TapToFocus extends DefaultSerializeable {
462
506
  constructor() {
463
507
  super();
464
508
  this.type = 'tapToFocus';
509
+ this.showUIIndicator = true;
510
+ this.listeners = [];
511
+ }
512
+ addListener(listener) {
513
+ if (!this.listeners.includes(listener)) {
514
+ const wasEmpty = this.listeners.length === 0;
515
+ this.listeners.push(listener);
516
+ if (wasEmpty && this.onListenersChanged) {
517
+ this.onListenersChanged();
518
+ }
519
+ }
520
+ }
521
+ removeListener(listener) {
522
+ if (this.listeners.includes(listener)) {
523
+ this.listeners.splice(this.listeners.indexOf(listener), 1);
524
+ if (this.listeners.length === 0 && this.onListenersChanged) {
525
+ this.onListenersChanged();
526
+ }
527
+ }
528
+ }
529
+ triggerFocus(point) {
530
+ return __awaiter(this, void 0, void 0, function* () {
531
+ if (this._controller) {
532
+ yield this._controller.triggerFocus(point);
533
+ }
534
+ });
465
535
  }
466
536
  }
537
+ __decorate([
538
+ nameForSerialization('showUIIndicator')
539
+ ], TapToFocus.prototype, "showUIIndicator", void 0);
540
+ __decorate([
541
+ ignoreFromSerialization
542
+ ], TapToFocus.prototype, "listeners", void 0);
543
+ __decorate([
544
+ ignoreFromSerialization
545
+ ], TapToFocus.prototype, "onListenersChanged", void 0);
546
+ __decorate([
547
+ ignoreFromSerialization
548
+ ], TapToFocus.prototype, "_controller", void 0);
467
549
 
468
550
  class PrivateFocusGestureDeserializer {
469
551
  static fromJSON(json) {
@@ -480,8 +562,49 @@ class SwipeToZoom extends DefaultSerializeable {
480
562
  constructor() {
481
563
  super();
482
564
  this.type = 'swipeToZoom';
565
+ this.listeners = [];
566
+ }
567
+ addListener(listener) {
568
+ if (!this.listeners.includes(listener)) {
569
+ const wasEmpty = this.listeners.length === 0;
570
+ this.listeners.push(listener);
571
+ if (wasEmpty && this.onListenersChanged) {
572
+ this.onListenersChanged();
573
+ }
574
+ }
575
+ }
576
+ removeListener(listener) {
577
+ if (this.listeners.includes(listener)) {
578
+ this.listeners.splice(this.listeners.indexOf(listener), 1);
579
+ if (this.listeners.length === 0 && this.onListenersChanged) {
580
+ this.onListenersChanged();
581
+ }
582
+ }
583
+ }
584
+ triggerZoomIn() {
585
+ return __awaiter(this, void 0, void 0, function* () {
586
+ if (this._controller) {
587
+ yield this._controller.triggerZoomIn();
588
+ }
589
+ });
590
+ }
591
+ triggerZoomOut() {
592
+ return __awaiter(this, void 0, void 0, function* () {
593
+ if (this._controller) {
594
+ yield this._controller.triggerZoomOut();
595
+ }
596
+ });
483
597
  }
484
598
  }
599
+ __decorate([
600
+ ignoreFromSerialization
601
+ ], SwipeToZoom.prototype, "listeners", void 0);
602
+ __decorate([
603
+ ignoreFromSerialization
604
+ ], SwipeToZoom.prototype, "onListenersChanged", void 0);
605
+ __decorate([
606
+ ignoreFromSerialization
607
+ ], SwipeToZoom.prototype, "_controller", void 0);
485
608
 
486
609
  class PrivateZoomGestureDeserializer {
487
610
  static fromJSON(json) {
@@ -494,44 +617,11 @@ class PrivateZoomGestureDeserializer {
494
617
  }
495
618
  }
496
619
 
497
- /******************************************************************************
498
- Copyright (c) Microsoft Corporation.
499
-
500
- Permission to use, copy, modify, and/or distribute this software for any
501
- purpose with or without fee is hereby granted.
502
-
503
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
504
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
505
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
506
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
507
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
508
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
509
- PERFORMANCE OF THIS SOFTWARE.
510
- ***************************************************************************** */
511
- /* global Reflect, Promise, SuppressedError, Symbol, Iterator */
512
-
513
-
514
- function __decorate(decorators, target, key, desc) {
515
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
516
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
517
- else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
518
- return c > 3 && r && Object.defineProperty(target, key, r), r;
519
- }
520
-
521
- function __awaiter(thisArg, _arguments, P, generator) {
522
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
523
- return new (P || (P = Promise))(function (resolve, reject) {
524
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
525
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
526
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
527
- step((generator = generator.apply(thisArg, _arguments || [])).next());
528
- });
529
- }
530
-
531
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
532
- var e = new Error(message);
533
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
534
- };
620
+ var ZoomGestureListenerEvents;
621
+ (function (ZoomGestureListenerEvents) {
622
+ ZoomGestureListenerEvents["onZoomInGesture"] = "ZoomGestureListener.onZoomInGesture";
623
+ ZoomGestureListenerEvents["onZoomOutGesture"] = "ZoomGestureListener.onZoomOutGesture";
624
+ })(ZoomGestureListenerEvents || (ZoomGestureListenerEvents = {}));
535
625
 
536
626
  var CameraPosition;
537
627
  (function (CameraPosition) {
@@ -545,6 +635,16 @@ var FrameSourceListenerEvents;
545
635
  FrameSourceListenerEvents["didChangeState"] = "FrameSourceListener.onStateChanged";
546
636
  })(FrameSourceListenerEvents || (FrameSourceListenerEvents = {}));
547
637
 
638
+ var TorchListenerEvents;
639
+ (function (TorchListenerEvents) {
640
+ TorchListenerEvents["didChangeTorchToState"] = "TorchListener.onTorchStateChanged";
641
+ })(TorchListenerEvents || (TorchListenerEvents = {}));
642
+
643
+ var MacroModeListenerEvents;
644
+ (function (MacroModeListenerEvents) {
645
+ MacroModeListenerEvents["didChangeMacroMode"] = "MacroModeListener.onMacroModeChanged";
646
+ })(MacroModeListenerEvents || (MacroModeListenerEvents = {}));
647
+
548
648
  var FrameSourceState;
549
649
  (function (FrameSourceState) {
550
650
  FrameSourceState["On"] = "on";
@@ -1297,6 +1397,11 @@ var ScanIntention;
1297
1397
  ScanIntention["SmartSelection"] = "smartSelection";
1298
1398
  })(ScanIntention || (ScanIntention = {}));
1299
1399
 
1400
+ /**
1401
+ * Symbol returned by parseIfShouldHandle when an event should be skipped
1402
+ * (filtered out based on viewId/modeId mismatch).
1403
+ */
1404
+ const SKIP = Symbol('EventDataParser.SKIP');
1300
1405
  class EventDataParser {
1301
1406
  static parse(data) {
1302
1407
  if (data == null) {
@@ -1304,6 +1409,58 @@ class EventDataParser {
1304
1409
  }
1305
1410
  return JSON.parse(data);
1306
1411
  }
1412
+ /**
1413
+ * Check if an event should be handled based on viewId/modeId filtering.
1414
+ * Used by React Native new architecture for pre-parse filtering to avoid
1415
+ * unnecessary JSON parsing of events not intended for this consumer.
1416
+ *
1417
+ * @param ev The event payload to check
1418
+ * @param ids Object containing optional viewId and/or modeId to match against
1419
+ * @returns true if the event should be handled, false if it should be skipped
1420
+ */
1421
+ static shouldHandle(ev, ids) {
1422
+ // If event has no filter fields (old arch, Cordova, Capacitor), proceed to parse
1423
+ if (ev.viewId === undefined && ev.modeId === undefined) {
1424
+ return true;
1425
+ }
1426
+ // Check viewId match if both are specified
1427
+ if (ids.viewId !== undefined && ev.viewId !== undefined && ev.viewId !== ids.viewId) {
1428
+ return false;
1429
+ }
1430
+ // Check modeId match if both are specified
1431
+ if (ids.modeId !== undefined && ev.modeId !== undefined && ev.modeId !== ids.modeId) {
1432
+ return false;
1433
+ }
1434
+ return true;
1435
+ }
1436
+ /**
1437
+ * Parse event data if it should be handled, otherwise return SKIP.
1438
+ *
1439
+ * Filtering is performed in two stages:
1440
+ * 1. Pre-parse: if the event wrapper carries viewId/modeId, skip parsing entirely on mismatch.
1441
+ * 2. Post-parse: verify the parsed payload's viewId/modeId matches the expected ids.
1442
+ *
1443
+ * @param ev The event payload to check and parse
1444
+ * @param ids Object containing optional viewId and/or modeId to match against
1445
+ * @returns SKIP if filtered out, null if parse failed, or parsed data
1446
+ */
1447
+ static parseIfShouldHandle(ev, ids) {
1448
+ if (!this.shouldHandle(ev, ids)) {
1449
+ return SKIP;
1450
+ }
1451
+ const parsed = this.parse(ev.data);
1452
+ if (parsed === null) {
1453
+ return null;
1454
+ }
1455
+ const data = parsed;
1456
+ if (ids.modeId !== undefined && data.modeId !== undefined && data.modeId !== ids.modeId) {
1457
+ return SKIP;
1458
+ }
1459
+ if (ids.viewId !== undefined && data.viewId !== undefined && data.viewId !== ids.viewId) {
1460
+ return SKIP;
1461
+ }
1462
+ return parsed;
1463
+ }
1307
1464
  }
1308
1465
 
1309
1466
  class Observable extends DefaultSerializeable {
@@ -1442,6 +1599,19 @@ class CoreProxyAdapter {
1442
1599
  return result.data === 'true';
1443
1600
  });
1444
1601
  }
1602
+ /**
1603
+ * Checks if macro mode is available for the current device
1604
+ */
1605
+ isMacroModeAvailable() {
1606
+ return __awaiter(this, void 0, void 0, function* () {
1607
+ const result = yield this.proxy.$executeCore({
1608
+ moduleName: 'CoreModule',
1609
+ methodName: 'isMacroModeAvailable',
1610
+ isEventRegistration: false,
1611
+ });
1612
+ return result.data === 'true';
1613
+ });
1614
+ }
1445
1615
  /**
1446
1616
  * Registers a persistent listener for frame source state change events
1447
1617
  */
@@ -1468,6 +1638,58 @@ class CoreProxyAdapter {
1468
1638
  return result;
1469
1639
  });
1470
1640
  }
1641
+ /**
1642
+ * Registers a persistent listener for torch state change events
1643
+ */
1644
+ registerTorchStateListener() {
1645
+ return __awaiter(this, void 0, void 0, function* () {
1646
+ const result = yield this.proxy.$executeCore({
1647
+ moduleName: 'CoreModule',
1648
+ methodName: 'registerTorchStateListener',
1649
+ isEventRegistration: true,
1650
+ });
1651
+ return result;
1652
+ });
1653
+ }
1654
+ /**
1655
+ * Unregisters the torch state event listener
1656
+ */
1657
+ unregisterTorchStateListener() {
1658
+ return __awaiter(this, void 0, void 0, function* () {
1659
+ const result = yield this.proxy.$executeCore({
1660
+ moduleName: 'CoreModule',
1661
+ methodName: 'unregisterTorchStateListener',
1662
+ isEventRegistration: false,
1663
+ });
1664
+ return result;
1665
+ });
1666
+ }
1667
+ /**
1668
+ * Registers a persistent listener for macro mode change events
1669
+ */
1670
+ registerMacroModeListener() {
1671
+ return __awaiter(this, void 0, void 0, function* () {
1672
+ const result = yield this.proxy.$executeCore({
1673
+ moduleName: 'CoreModule',
1674
+ methodName: 'registerMacroModeListener',
1675
+ isEventRegistration: true,
1676
+ });
1677
+ return result;
1678
+ });
1679
+ }
1680
+ /**
1681
+ * Unregisters the macro mode event listener
1682
+ */
1683
+ unregisterMacroModeListener() {
1684
+ return __awaiter(this, void 0, void 0, function* () {
1685
+ const result = yield this.proxy.$executeCore({
1686
+ moduleName: 'CoreModule',
1687
+ methodName: 'unregisterMacroModeListener',
1688
+ isEventRegistration: false,
1689
+ });
1690
+ return result;
1691
+ });
1692
+ }
1471
1693
  /**
1472
1694
  * Gets the last frame data by frame ID as JSON
1473
1695
  * @param frameId Unique frame identifier
@@ -1689,6 +1911,113 @@ class CoreProxyAdapter {
1689
1911
  return result;
1690
1912
  });
1691
1913
  }
1914
+ /**
1915
+ * Registers a persistent listener for focus gesture events
1916
+ * @param viewId View identifier
1917
+ */
1918
+ registerFocusGestureListener(_a) {
1919
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
1920
+ const result = yield this.proxy.$executeCore({
1921
+ moduleName: 'CoreModule',
1922
+ methodName: 'registerFocusGestureListener',
1923
+ isEventRegistration: true,
1924
+ viewId,
1925
+ });
1926
+ return result;
1927
+ });
1928
+ }
1929
+ /**
1930
+ * Unregisters the focus gesture event listener
1931
+ * @param viewId View identifier
1932
+ */
1933
+ unregisterFocusGestureListener(_a) {
1934
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
1935
+ const result = yield this.proxy.$executeCore({
1936
+ moduleName: 'CoreModule',
1937
+ methodName: 'unregisterFocusGestureListener',
1938
+ isEventRegistration: false,
1939
+ viewId,
1940
+ });
1941
+ return result;
1942
+ });
1943
+ }
1944
+ /**
1945
+ * Triggers a focus as if the focus gesture was performed
1946
+ * @param viewId View identifier
1947
+ * @param pointJson Point in view coordinates as JSON string
1948
+ */
1949
+ triggerFocus(_a) {
1950
+ return __awaiter(this, arguments, void 0, function* ({ viewId, pointJson }) {
1951
+ const result = yield this.proxy.$executeCore({
1952
+ moduleName: 'CoreModule',
1953
+ methodName: 'triggerFocus',
1954
+ isEventRegistration: false,
1955
+ viewId,
1956
+ pointJson,
1957
+ });
1958
+ return result;
1959
+ });
1960
+ }
1961
+ /**
1962
+ * Triggers a zoom in gesture as if the zoom gesture was performed
1963
+ * @param viewId View identifier
1964
+ */
1965
+ triggerZoomIn(_a) {
1966
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
1967
+ const result = yield this.proxy.$executeCore({
1968
+ moduleName: 'CoreModule',
1969
+ methodName: 'triggerZoomIn',
1970
+ isEventRegistration: false,
1971
+ viewId,
1972
+ });
1973
+ return result;
1974
+ });
1975
+ }
1976
+ /**
1977
+ * Triggers a zoom out gesture as if the zoom gesture was performed
1978
+ * @param viewId View identifier
1979
+ */
1980
+ triggerZoomOut(_a) {
1981
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
1982
+ const result = yield this.proxy.$executeCore({
1983
+ moduleName: 'CoreModule',
1984
+ methodName: 'triggerZoomOut',
1985
+ isEventRegistration: false,
1986
+ viewId,
1987
+ });
1988
+ return result;
1989
+ });
1990
+ }
1991
+ /**
1992
+ * Registers a persistent listener for zoom gesture events
1993
+ * @param viewId View identifier
1994
+ */
1995
+ registerZoomGestureListener(_a) {
1996
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
1997
+ const result = yield this.proxy.$executeCore({
1998
+ moduleName: 'CoreModule',
1999
+ methodName: 'registerZoomGestureListener',
2000
+ isEventRegistration: true,
2001
+ viewId,
2002
+ });
2003
+ return result;
2004
+ });
2005
+ }
2006
+ /**
2007
+ * Unregisters the zoom gesture event listener
2008
+ * @param viewId View identifier
2009
+ */
2010
+ unregisterZoomGestureListener(_a) {
2011
+ return __awaiter(this, arguments, void 0, function* ({ viewId }) {
2012
+ const result = yield this.proxy.$executeCore({
2013
+ moduleName: 'CoreModule',
2014
+ methodName: 'unregisterZoomGestureListener',
2015
+ isEventRegistration: false,
2016
+ viewId,
2017
+ });
2018
+ return result;
2019
+ });
2020
+ }
1692
2021
  /**
1693
2022
  * Updates the DataCaptureView configuration
1694
2023
  * @param viewJson Updated view configuration as JSON string
@@ -1767,7 +2096,10 @@ class ImageFrameSourceController extends BaseController {
1767
2096
  this._proxy.dispose();
1768
2097
  }
1769
2098
  handleDidChangeStateEvent(ev) {
1770
- const event = EventDataParser.parse(ev.data);
2099
+ const event = EventDataParser.parseIfShouldHandle(ev, {});
2100
+ if (event === SKIP) {
2101
+ return;
2102
+ }
1771
2103
  if (event === null) {
1772
2104
  console.error('ImageFrameSourceController didChangeState payload is null');
1773
2105
  return;
@@ -1869,10 +2201,17 @@ class PrivateFrameData {
1869
2201
  get imageBuffers() {
1870
2202
  return this._imageBuffers;
1871
2203
  }
2204
+ get imageBuffer() {
2205
+ return this._imageBuffers[0];
2206
+ }
1872
2207
  get orientation() {
1873
2208
  return this._orientation;
1874
2209
  }
2210
+ get timestamp() {
2211
+ return this._timestamp;
2212
+ }
1875
2213
  static fromJSON(json) {
2214
+ var _a;
1876
2215
  const frameData = new PrivateFrameData();
1877
2216
  frameData._imageBuffers = json.imageBuffers.map((imageBufferJSON) => {
1878
2217
  const imageBuffer = new ImageBuffer();
@@ -1882,12 +2221,14 @@ class PrivateFrameData {
1882
2221
  return imageBuffer;
1883
2222
  });
1884
2223
  frameData._orientation = json.orientation;
2224
+ frameData._timestamp = (_a = json.timestamp) !== null && _a !== void 0 ? _a : -1;
1885
2225
  return frameData;
1886
2226
  }
1887
2227
  static empty() {
1888
2228
  const frameData = new PrivateFrameData();
1889
2229
  frameData._imageBuffers = [];
1890
2230
  frameData._orientation = 90;
2231
+ frameData._timestamp = -1;
1891
2232
  return frameData;
1892
2233
  }
1893
2234
  }
@@ -1972,14 +2313,18 @@ class Camera extends DefaultSerializeable {
1972
2313
  this.settings = null;
1973
2314
  this._desiredTorchState = TorchState.Off;
1974
2315
  this._desiredState = FrameSourceState.Off;
2316
+ this._hasTorchStateListeners = false;
2317
+ this._hasMacroModeListeners = false;
1975
2318
  this.currentCameraState = FrameSourceState.Off;
1976
2319
  this.listeners = [];
2320
+ this.torchListeners = [];
2321
+ this.macroModeListeners = [];
1977
2322
  this._context = null;
1978
2323
  this.nativeReadyResolver = null;
1979
2324
  this.nativeReadyRejecter = null;
1980
2325
  this.nativeReadyPromise = null;
1981
2326
  this.nativeReadyTimeout = null;
1982
- this.position = position || Camera.coreDefaults.Camera.defaultPosition;
2327
+ this._position = position || Camera.coreDefaults.Camera.defaultPosition;
1983
2328
  this.settings = settings || null;
1984
2329
  this._desiredTorchState = desiredTorchState || TorchState.Off;
1985
2330
  this._desiredState = desiredState || FrameSourceState.Off;
@@ -2027,6 +2372,58 @@ class Camera extends DefaultSerializeable {
2027
2372
  }
2028
2373
  this.listeners.splice(this.listeners.indexOf(listener), 1);
2029
2374
  }
2375
+ addTorchListener(listener) {
2376
+ if (this.torchListeners.includes(listener)) {
2377
+ return;
2378
+ }
2379
+ this.torchListeners.push(listener);
2380
+ this._hasTorchStateListeners = this.torchListeners.length > 0;
2381
+ if (this.torchListeners.length === 1) {
2382
+ void this.controller.subscribeTorchListener();
2383
+ }
2384
+ if (this.isActiveCamera) {
2385
+ void this.didChange();
2386
+ }
2387
+ }
2388
+ removeTorchListener(listener) {
2389
+ if (!this.torchListeners.includes(listener)) {
2390
+ return;
2391
+ }
2392
+ this.torchListeners.splice(this.torchListeners.indexOf(listener), 1);
2393
+ this._hasTorchStateListeners = this.torchListeners.length > 0;
2394
+ if (this.torchListeners.length === 0) {
2395
+ void this.controller.unsubscribeTorchListener();
2396
+ }
2397
+ if (this.isActiveCamera) {
2398
+ void this.didChange();
2399
+ }
2400
+ }
2401
+ addMacroModeListener(listener) {
2402
+ if (this.macroModeListeners.includes(listener)) {
2403
+ return;
2404
+ }
2405
+ this.macroModeListeners.push(listener);
2406
+ this._hasMacroModeListeners = this.macroModeListeners.length > 0;
2407
+ if (this.macroModeListeners.length === 1) {
2408
+ void this.controller.subscribeMacroModeListener();
2409
+ }
2410
+ if (this.isActiveCamera) {
2411
+ void this.didChange();
2412
+ }
2413
+ }
2414
+ removeMacroModeListener(listener) {
2415
+ if (!this.macroModeListeners.includes(listener)) {
2416
+ return;
2417
+ }
2418
+ this.macroModeListeners.splice(this.macroModeListeners.indexOf(listener), 1);
2419
+ this._hasMacroModeListeners = this.macroModeListeners.length > 0;
2420
+ if (this.macroModeListeners.length === 0) {
2421
+ void this.controller.unsubscribeMacroModeListener();
2422
+ }
2423
+ if (this.isActiveCamera) {
2424
+ void this.didChange();
2425
+ }
2426
+ }
2030
2427
  applySettings(settings) {
2031
2428
  return __awaiter(this, void 0, void 0, function* () {
2032
2429
  this.settings = settings;
@@ -2096,6 +2493,22 @@ class Camera extends DefaultSerializeable {
2096
2493
  }
2097
2494
  return Camera.atPosition(defaultPosition);
2098
2495
  }
2496
+ static isMacroModeAvailable() {
2497
+ return __awaiter(this, void 0, void 0, function* () {
2498
+ const proxy = FactoryMaker.getInstance('CoreProxy');
2499
+ if (!proxy) {
2500
+ return false;
2501
+ }
2502
+ const adapter = new CoreProxyAdapter(proxy);
2503
+ return yield adapter.isMacroModeAvailable();
2504
+ });
2505
+ }
2506
+ get position() {
2507
+ return this._position;
2508
+ }
2509
+ get isTorchAvailable() {
2510
+ return this.controller.getIsTorchAvailable();
2511
+ }
2099
2512
  get desiredState() {
2100
2513
  return this._desiredState;
2101
2514
  }
@@ -2138,18 +2551,33 @@ __decorate([
2138
2551
  __decorate([
2139
2552
  serializationDefault({})
2140
2553
  ], Camera.prototype, "settings", void 0);
2554
+ __decorate([
2555
+ nameForSerialization('position')
2556
+ ], Camera.prototype, "_position", void 0);
2141
2557
  __decorate([
2142
2558
  nameForSerialization('desiredTorchState')
2143
2559
  ], Camera.prototype, "_desiredTorchState", void 0);
2144
2560
  __decorate([
2145
2561
  nameForSerialization('desiredState')
2146
2562
  ], Camera.prototype, "_desiredState", void 0);
2563
+ __decorate([
2564
+ nameForSerialization('hasTorchStateListeners')
2565
+ ], Camera.prototype, "_hasTorchStateListeners", void 0);
2566
+ __decorate([
2567
+ nameForSerialization('hasMacroModeListeners')
2568
+ ], Camera.prototype, "_hasMacroModeListeners", void 0);
2147
2569
  __decorate([
2148
2570
  ignoreFromSerialization
2149
2571
  ], Camera.prototype, "currentCameraState", void 0);
2150
2572
  __decorate([
2151
2573
  ignoreFromSerialization
2152
2574
  ], Camera.prototype, "listeners", void 0);
2575
+ __decorate([
2576
+ ignoreFromSerialization
2577
+ ], Camera.prototype, "torchListeners", void 0);
2578
+ __decorate([
2579
+ ignoreFromSerialization
2580
+ ], Camera.prototype, "macroModeListeners", void 0);
2153
2581
  __decorate([
2154
2582
  ignoreFromSerialization
2155
2583
  ], Camera.prototype, "_context", void 0);
@@ -2466,6 +2894,14 @@ class CameraController extends BaseController {
2466
2894
  this.handleDidChangeStateEventWrapper = (ev) => {
2467
2895
  return this.handleDidChangeStateEvent(ev);
2468
2896
  };
2897
+ // Arrow function wrapper to avoid .bind(this) and always use current class state
2898
+ this.handleDidChangeTorchToStateEventWrapper = (ev) => {
2899
+ return this.handleDidChangeTorchToStateEvent(ev);
2900
+ };
2901
+ // Arrow function wrapper to avoid .bind(this) and always use current class state
2902
+ this.handleDidChangeMacroModeEventWrapper = (ev) => {
2903
+ return this.handleDidChangeMacroModeEvent(ev);
2904
+ };
2469
2905
  this.camera = camera;
2470
2906
  this.adapter = new CoreProxyAdapter(this._proxy);
2471
2907
  void this.subscribeListener();
@@ -2476,14 +2912,14 @@ class CameraController extends BaseController {
2476
2912
  getCurrentState() {
2477
2913
  return __awaiter(this, void 0, void 0, function* () {
2478
2914
  return yield this.adapter.getCameraState({
2479
- cameraPosition: JSON.stringify(this.privateCamera.position)
2915
+ cameraPosition: JSON.stringify(this.privateCamera._position)
2480
2916
  });
2481
2917
  });
2482
2918
  }
2483
2919
  getIsTorchAvailable() {
2484
2920
  return __awaiter(this, void 0, void 0, function* () {
2485
2921
  return yield this.adapter.isTorchAvailable({
2486
- cameraPosition: JSON.stringify(this.privateCamera.position)
2922
+ cameraPosition: JSON.stringify(this.privateCamera._position)
2487
2923
  });
2488
2924
  });
2489
2925
  }
@@ -2508,20 +2944,78 @@ class CameraController extends BaseController {
2508
2944
  this._proxy.eventEmitter.off(FrameSourceListenerEvents.didChangeState, this.handleDidChangeStateEventWrapper);
2509
2945
  });
2510
2946
  }
2947
+ subscribeTorchListener() {
2948
+ return __awaiter(this, void 0, void 0, function* () {
2949
+ yield this.adapter.registerTorchStateListener();
2950
+ this._proxy.subscribeForEvents([TorchListenerEvents.didChangeTorchToState]);
2951
+ this._proxy.eventEmitter.on(TorchListenerEvents.didChangeTorchToState, this.handleDidChangeTorchToStateEventWrapper);
2952
+ });
2953
+ }
2954
+ unsubscribeTorchListener() {
2955
+ return __awaiter(this, void 0, void 0, function* () {
2956
+ yield this.adapter.unregisterTorchStateListener();
2957
+ this._proxy.unsubscribeFromEvents([TorchListenerEvents.didChangeTorchToState]);
2958
+ this._proxy.eventEmitter.off(TorchListenerEvents.didChangeTorchToState, this.handleDidChangeTorchToStateEventWrapper);
2959
+ });
2960
+ }
2961
+ subscribeMacroModeListener() {
2962
+ return __awaiter(this, void 0, void 0, function* () {
2963
+ yield this.adapter.registerMacroModeListener();
2964
+ this._proxy.subscribeForEvents([MacroModeListenerEvents.didChangeMacroMode]);
2965
+ this._proxy.eventEmitter.on(MacroModeListenerEvents.didChangeMacroMode, this.handleDidChangeMacroModeEventWrapper);
2966
+ });
2967
+ }
2968
+ unsubscribeMacroModeListener() {
2969
+ return __awaiter(this, void 0, void 0, function* () {
2970
+ yield this.adapter.unregisterMacroModeListener();
2971
+ this._proxy.unsubscribeFromEvents([MacroModeListenerEvents.didChangeMacroMode]);
2972
+ this._proxy.eventEmitter.off(MacroModeListenerEvents.didChangeMacroMode, this.handleDidChangeMacroModeEventWrapper);
2973
+ });
2974
+ }
2511
2975
  dispose() {
2512
2976
  void this.unsubscribeListener();
2977
+ void this.unsubscribeTorchListener();
2978
+ void this.unsubscribeMacroModeListener();
2513
2979
  this._proxy.dispose();
2514
2980
  }
2515
2981
  handleDidChangeStateEvent(ev) {
2516
- const event = EventDataParser.parse(ev.data);
2517
- if (event) {
2518
- if (event.cameraPosition !== this.privateCamera.position || !this.privateCamera.isActiveCamera) {
2519
- return;
2520
- }
2521
- this.privateCamera.currentCameraState = event.state;
2522
- this.privateCamera.listeners.forEach(listener => {
2982
+ const event = EventDataParser.parseIfShouldHandle(ev, {});
2983
+ if (event === SKIP || event === null) {
2984
+ return;
2985
+ }
2986
+ if (event.cameraPosition !== this.privateCamera._position || !this.privateCamera.isActiveCamera) {
2987
+ return;
2988
+ }
2989
+ this.privateCamera.currentCameraState = event.state;
2990
+ this.privateCamera.listeners.forEach(listener => {
2991
+ var _a;
2992
+ (_a = listener === null || listener === void 0 ? void 0 : listener.didChangeState) === null || _a === void 0 ? void 0 : _a.call(listener, this.camera, this.privateCamera._desiredState);
2993
+ });
2994
+ }
2995
+ handleDidChangeTorchToStateEvent(ev) {
2996
+ const event = EventDataParser.parseIfShouldHandle(ev, {});
2997
+ if (event === SKIP || event === null) {
2998
+ return;
2999
+ }
3000
+ if (this.privateCamera.isActiveCamera) {
3001
+ const torchState = event.state;
3002
+ this.privateCamera.desiredTorchState = torchState;
3003
+ this.privateCamera.torchListeners.forEach(listener => {
3004
+ var _a;
3005
+ (_a = listener === null || listener === void 0 ? void 0 : listener.didChangeTorchToState) === null || _a === void 0 ? void 0 : _a.call(listener, torchState);
3006
+ });
3007
+ }
3008
+ }
3009
+ handleDidChangeMacroModeEvent(ev) {
3010
+ const event = EventDataParser.parseIfShouldHandle(ev, {});
3011
+ if (event === SKIP || event === null) {
3012
+ return;
3013
+ }
3014
+ if (this.privateCamera.isActiveCamera) {
3015
+ const macroMode = event.macroMode;
3016
+ this.privateCamera.macroModeListeners.forEach(listener => {
2523
3017
  var _a;
2524
- (_a = listener === null || listener === void 0 ? void 0 : listener.didChangeState) === null || _a === void 0 ? void 0 : _a.call(listener, this.camera, this.privateCamera._desiredState);
3018
+ (_a = listener === null || listener === void 0 ? void 0 : listener.didChangeMacroMode) === null || _a === void 0 ? void 0 : _a.call(listener, macroMode);
2525
3019
  });
2526
3020
  }
2527
3021
  }
@@ -2737,7 +3231,10 @@ class DataCaptureContextController extends BaseController {
2737
3231
  });
2738
3232
  }
2739
3233
  handleDidChangeStatusEvent(eventPayload) {
2740
- const event = EventDataParser.parse(eventPayload.data);
3234
+ const event = EventDataParser.parseIfShouldHandle(eventPayload, {});
3235
+ if (event === SKIP) {
3236
+ return;
3237
+ }
2741
3238
  if (event === null) {
2742
3239
  console.error('DataCaptureContextController didChangeStatus payload is null');
2743
3240
  return;
@@ -2994,11 +3491,23 @@ __decorate([
2994
3491
  var DataCaptureViewEvents;
2995
3492
  (function (DataCaptureViewEvents) {
2996
3493
  DataCaptureViewEvents["didChangeSize"] = "DataCaptureViewListener.onSizeChanged";
3494
+ DataCaptureViewEvents["onFocusGesture"] = "FocusGestureListener.onFocusGesture";
2997
3495
  })(DataCaptureViewEvents || (DataCaptureViewEvents = {}));
2998
3496
  class DataCaptureViewController extends BaseController {
2999
3497
  constructor(view) {
3000
3498
  super('DataCaptureViewProxy');
3001
3499
  this._listenerRegistered = false;
3500
+ this._focusGestureListenerRegistered = false;
3501
+ this._zoomGestureListenerRegistered = false;
3502
+ this.handleOnFocusGestureEventWrapper = (eventPayload) => {
3503
+ return this.handleOnFocusGestureEvent(eventPayload);
3504
+ };
3505
+ this.handleOnZoomInGestureEventWrapper = (eventPayload) => {
3506
+ return this.handleOnZoomInGestureEvent(eventPayload);
3507
+ };
3508
+ this.handleOnZoomOutGestureEventWrapper = (eventPayload) => {
3509
+ return this.handleOnZoomOutGestureEvent(eventPayload);
3510
+ };
3002
3511
  // Arrow function wrapper to avoid .bind(this) and always use current class state
3003
3512
  this.handleDidChangeSizeEventWrapper = (eventPayload) => {
3004
3513
  return this.handleDidChangeSizeEvent(eventPayload);
@@ -3018,6 +3527,21 @@ class DataCaptureViewController extends BaseController {
3018
3527
  return Quadrilateral['fromJSON'](JSON.parse(result));
3019
3528
  });
3020
3529
  }
3530
+ triggerFocus(point) {
3531
+ return __awaiter(this, void 0, void 0, function* () {
3532
+ yield this.adapter.triggerFocus({ viewId: this.view.viewId, pointJson: JSON.stringify(point.toJSON()) });
3533
+ });
3534
+ }
3535
+ triggerZoomIn() {
3536
+ return __awaiter(this, void 0, void 0, function* () {
3537
+ yield this.adapter.triggerZoomIn({ viewId: this.view.viewId });
3538
+ });
3539
+ }
3540
+ triggerZoomOut() {
3541
+ return __awaiter(this, void 0, void 0, function* () {
3542
+ yield this.adapter.triggerZoomOut({ viewId: this.view.viewId });
3543
+ });
3544
+ }
3021
3545
  setPositionAndSize(top, left, width, height, shouldBeUnderWebView) {
3022
3546
  return this._proxy.$setDataCaptureViewPositionAndSize({ top, left, width, height, shouldBeUnderWebView });
3023
3547
  }
@@ -3047,6 +3571,8 @@ class DataCaptureViewController extends BaseController {
3047
3571
  }
3048
3572
  dispose() {
3049
3573
  void this.unsubscribeListener();
3574
+ void this.unsubscribeFocusGestureListener();
3575
+ void this.unsubscribeZoomGestureListener();
3050
3576
  this._proxy.dispose();
3051
3577
  }
3052
3578
  subscribeListener() {
@@ -3071,16 +3597,168 @@ class DataCaptureViewController extends BaseController {
3071
3597
  this._listenerRegistered = false;
3072
3598
  });
3073
3599
  }
3600
+ updateFocusGestureListenerSubscription(focusGesture, shouldSubscribe) {
3601
+ return __awaiter(this, void 0, void 0, function* () {
3602
+ if (!focusGesture) {
3603
+ if (this._focusGestureListenerRegistered) {
3604
+ yield this.unsubscribeFocusGestureListener();
3605
+ }
3606
+ return;
3607
+ }
3608
+ const privateFocusGesture = focusGesture;
3609
+ const hasListeners = privateFocusGesture.listeners && privateFocusGesture.listeners.length > 0;
3610
+ if (shouldSubscribe && hasListeners && !this._focusGestureListenerRegistered) {
3611
+ yield this.subscribeFocusGestureListener();
3612
+ }
3613
+ else if (!hasListeners && this._focusGestureListenerRegistered) {
3614
+ yield this.unsubscribeFocusGestureListener();
3615
+ }
3616
+ });
3617
+ }
3618
+ subscribeFocusGestureListener() {
3619
+ return __awaiter(this, void 0, void 0, function* () {
3620
+ if (this._focusGestureListenerRegistered || !this.isViewCreated()) {
3621
+ return;
3622
+ }
3623
+ yield this.adapter.registerFocusGestureListener({ viewId: this.view.viewId });
3624
+ this._proxy.subscribeForEvents([FocusGestureListenerEvents.onFocusGesture]);
3625
+ this._proxy.eventEmitter.on(FocusGestureListenerEvents.onFocusGesture, this.handleOnFocusGestureEventWrapper);
3626
+ this._focusGestureListenerRegistered = true;
3627
+ });
3628
+ }
3629
+ unsubscribeFocusGestureListener() {
3630
+ return __awaiter(this, void 0, void 0, function* () {
3631
+ if (!this._focusGestureListenerRegistered) {
3632
+ return;
3633
+ }
3634
+ yield this.adapter.unregisterFocusGestureListener({ viewId: this.view.viewId });
3635
+ this._proxy.unsubscribeFromEvents([FocusGestureListenerEvents.onFocusGesture]);
3636
+ this._proxy.eventEmitter.off(FocusGestureListenerEvents.onFocusGesture, this.handleOnFocusGestureEventWrapper);
3637
+ this._focusGestureListenerRegistered = false;
3638
+ });
3639
+ }
3640
+ handleOnFocusGestureEvent(eventPayload) {
3641
+ const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
3642
+ if (event === SKIP) {
3643
+ return;
3644
+ }
3645
+ if (event === null) {
3646
+ console.error('DataCaptureViewController onFocusGesture payload is null');
3647
+ return;
3648
+ }
3649
+ const focusGesture = this.view.focusGesture;
3650
+ if (!focusGesture) {
3651
+ return;
3652
+ }
3653
+ const privateFocusGesture = focusGesture;
3654
+ if (!privateFocusGesture.listeners || privateFocusGesture.listeners.length === 0) {
3655
+ return;
3656
+ }
3657
+ const point = PointWithUnit['fromJSON'](event.point);
3658
+ privateFocusGesture.listeners.forEach(listener => {
3659
+ if (listener.didFocusGesture) {
3660
+ listener.didFocusGesture(focusGesture, point);
3661
+ }
3662
+ });
3663
+ }
3664
+ updateZoomGestureListenerSubscription(zoomGesture, shouldSubscribe) {
3665
+ return __awaiter(this, void 0, void 0, function* () {
3666
+ if (!zoomGesture) {
3667
+ if (this._zoomGestureListenerRegistered) {
3668
+ yield this.unsubscribeZoomGestureListener();
3669
+ }
3670
+ return;
3671
+ }
3672
+ const privateZoomGesture = zoomGesture;
3673
+ const hasListeners = privateZoomGesture.listeners && privateZoomGesture.listeners.length > 0;
3674
+ if (shouldSubscribe && hasListeners && !this._zoomGestureListenerRegistered) {
3675
+ yield this.subscribeZoomGestureListener();
3676
+ }
3677
+ else if (!hasListeners && this._zoomGestureListenerRegistered) {
3678
+ yield this.unsubscribeZoomGestureListener();
3679
+ }
3680
+ });
3681
+ }
3682
+ subscribeZoomGestureListener() {
3683
+ return __awaiter(this, void 0, void 0, function* () {
3684
+ if (this._zoomGestureListenerRegistered || !this.isViewCreated()) {
3685
+ return;
3686
+ }
3687
+ yield this.adapter.registerZoomGestureListener({ viewId: this.view.viewId });
3688
+ this._proxy.subscribeForEvents([ZoomGestureListenerEvents.onZoomInGesture, ZoomGestureListenerEvents.onZoomOutGesture]);
3689
+ this._proxy.eventEmitter.on(ZoomGestureListenerEvents.onZoomInGesture, this.handleOnZoomInGestureEventWrapper);
3690
+ this._proxy.eventEmitter.on(ZoomGestureListenerEvents.onZoomOutGesture, this.handleOnZoomOutGestureEventWrapper);
3691
+ this._zoomGestureListenerRegistered = true;
3692
+ });
3693
+ }
3694
+ unsubscribeZoomGestureListener() {
3695
+ return __awaiter(this, void 0, void 0, function* () {
3696
+ if (!this._zoomGestureListenerRegistered) {
3697
+ return;
3698
+ }
3699
+ yield this.adapter.unregisterZoomGestureListener({ viewId: this.view.viewId });
3700
+ this._proxy.unsubscribeFromEvents([ZoomGestureListenerEvents.onZoomInGesture, ZoomGestureListenerEvents.onZoomOutGesture]);
3701
+ this._proxy.eventEmitter.off(ZoomGestureListenerEvents.onZoomInGesture, this.handleOnZoomInGestureEventWrapper);
3702
+ this._proxy.eventEmitter.off(ZoomGestureListenerEvents.onZoomOutGesture, this.handleOnZoomOutGestureEventWrapper);
3703
+ this._zoomGestureListenerRegistered = false;
3704
+ });
3705
+ }
3706
+ handleOnZoomInGestureEvent(eventPayload) {
3707
+ const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
3708
+ if (event === SKIP) {
3709
+ return;
3710
+ }
3711
+ if (event === null) {
3712
+ console.error('DataCaptureViewController onZoomInGesture payload is null');
3713
+ return;
3714
+ }
3715
+ const zoomGesture = this.view.zoomGesture;
3716
+ if (!zoomGesture) {
3717
+ return;
3718
+ }
3719
+ const privateZoomGesture = zoomGesture;
3720
+ if (!privateZoomGesture.listeners || privateZoomGesture.listeners.length === 0) {
3721
+ return;
3722
+ }
3723
+ privateZoomGesture.listeners.forEach(listener => {
3724
+ if (listener.didZoomInGesture) {
3725
+ listener.didZoomInGesture(zoomGesture);
3726
+ }
3727
+ });
3728
+ }
3729
+ handleOnZoomOutGestureEvent(eventPayload) {
3730
+ const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
3731
+ if (event === SKIP) {
3732
+ return;
3733
+ }
3734
+ if (event === null) {
3735
+ console.error('DataCaptureViewController onZoomOutGesture payload is null');
3736
+ return;
3737
+ }
3738
+ const zoomGesture = this.view.zoomGesture;
3739
+ if (!zoomGesture) {
3740
+ return;
3741
+ }
3742
+ const privateZoomGesture = zoomGesture;
3743
+ if (!privateZoomGesture.listeners || privateZoomGesture.listeners.length === 0) {
3744
+ return;
3745
+ }
3746
+ privateZoomGesture.listeners.forEach(listener => {
3747
+ if (listener.didZoomOutGesture) {
3748
+ listener.didZoomOutGesture(zoomGesture);
3749
+ }
3750
+ });
3751
+ }
3074
3752
  createView() {
3075
3753
  return this._proxy.$createDataCaptureView({ viewJson: JSON.stringify(this.view.toJSON()) });
3076
3754
  }
3077
3755
  handleDidChangeSizeEvent(eventPayload) {
3078
- const event = EventDataParser.parse(eventPayload.data);
3079
- if (event === null) {
3080
- console.error('DataCaptureViewController didChangeSize payload is null');
3756
+ const event = EventDataParser.parseIfShouldHandle(eventPayload, { viewId: this.view.viewId });
3757
+ if (event === SKIP) {
3081
3758
  return;
3082
3759
  }
3083
- if (event.viewId !== this.view.viewId) {
3760
+ if (event === null) {
3761
+ console.error('DataCaptureViewController didChangeSize payload is null');
3084
3762
  return;
3085
3763
  }
3086
3764
  const size = Size['fromJSON'](event.size);
@@ -3152,14 +3830,42 @@ class BaseDataCaptureView extends DefaultSerializeable {
3152
3830
  return this._focusGesture;
3153
3831
  }
3154
3832
  set focusGesture(newValue) {
3833
+ if (this._focusGesture) {
3834
+ const privateFocusGesture = this._focusGesture;
3835
+ privateFocusGesture.onListenersChanged = undefined;
3836
+ privateFocusGesture._controller = null;
3837
+ void this.controller.updateFocusGestureListenerSubscription(this._focusGesture, false);
3838
+ }
3155
3839
  this._focusGesture = newValue;
3840
+ if (newValue) {
3841
+ const privateFocusGesture = newValue;
3842
+ privateFocusGesture._controller = this.controller;
3843
+ privateFocusGesture.onListenersChanged = () => {
3844
+ void this.controller.updateFocusGestureListenerSubscription(newValue, true);
3845
+ };
3846
+ void this.controller.updateFocusGestureListenerSubscription(newValue, true);
3847
+ }
3156
3848
  void this.controller.updateView();
3157
3849
  }
3158
3850
  get zoomGesture() {
3159
3851
  return this._zoomGesture;
3160
3852
  }
3161
3853
  set zoomGesture(newValue) {
3854
+ if (this._zoomGesture) {
3855
+ const privateZoomGesture = this._zoomGesture;
3856
+ privateZoomGesture.onListenersChanged = undefined;
3857
+ privateZoomGesture._controller = null;
3858
+ void this.controller.updateZoomGestureListenerSubscription(this._zoomGesture, false);
3859
+ }
3162
3860
  this._zoomGesture = newValue;
3861
+ if (newValue) {
3862
+ const privateZoomGesture = newValue;
3863
+ privateZoomGesture._controller = this.controller;
3864
+ privateZoomGesture.onListenersChanged = () => {
3865
+ void this.controller.updateZoomGestureListenerSubscription(newValue, true);
3866
+ };
3867
+ void this.controller.updateZoomGestureListenerSubscription(newValue, true);
3868
+ }
3163
3869
  void this.controller.updateView();
3164
3870
  }
3165
3871
  get logoStyle() {
@@ -3169,6 +3875,13 @@ class BaseDataCaptureView extends DefaultSerializeable {
3169
3875
  this._logoStyle = newValue;
3170
3876
  void this.controller.updateView();
3171
3877
  }
3878
+ get shouldShowZoomNotification() {
3879
+ return this._shouldShowZoomNotification;
3880
+ }
3881
+ set shouldShowZoomNotification(newValue) {
3882
+ this._shouldShowZoomNotification = newValue;
3883
+ void this.controller.updateView();
3884
+ }
3172
3885
  get privateContext() {
3173
3886
  return this.context;
3174
3887
  }
@@ -3178,6 +3891,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
3178
3891
  return view;
3179
3892
  }
3180
3893
  constructor(context) {
3894
+ var _a;
3181
3895
  super();
3182
3896
  this.parentId = null;
3183
3897
  this.overlays = [];
@@ -3194,6 +3908,7 @@ class BaseDataCaptureView extends DefaultSerializeable {
3194
3908
  this._focusGesture = this.coreDefaults.DataCaptureView.focusGesture;
3195
3909
  this._zoomGesture = this.coreDefaults.DataCaptureView.zoomGesture;
3196
3910
  this._logoStyle = this.coreDefaults.DataCaptureView.logoStyle;
3911
+ this._shouldShowZoomNotification = (_a = this.coreDefaults.DataCaptureView.shouldShowZoomNotification) !== null && _a !== void 0 ? _a : true;
3197
3912
  this.controller = new DataCaptureViewController(this);
3198
3913
  }
3199
3914
  addOverlay(overlay) {
@@ -3243,6 +3958,15 @@ class BaseDataCaptureView extends DefaultSerializeable {
3243
3958
  viewQuadrilateralForFrameQuadrilateral(quadrilateral) {
3244
3959
  return this.controller.viewQuadrilateralForFrameQuadrilateral(quadrilateral);
3245
3960
  }
3961
+ triggerFocus(point) {
3962
+ return this.controller.triggerFocus(point);
3963
+ }
3964
+ triggerZoomIn() {
3965
+ return this.controller.triggerZoomIn();
3966
+ }
3967
+ triggerZoomOut() {
3968
+ return this.controller.triggerZoomOut();
3969
+ }
3246
3970
  addControl(control) {
3247
3971
  return __awaiter(this, void 0, void 0, function* () {
3248
3972
  if (!this.controls.includes(control)) {
@@ -3326,6 +4050,10 @@ class BaseDataCaptureView extends DefaultSerializeable {
3326
4050
  }
3327
4051
  return this.controller.hide();
3328
4052
  }
4053
+ setProperty(name, value) {
4054
+ this[name] = value;
4055
+ void this.controller.updateView();
4056
+ }
3329
4057
  }
3330
4058
  __decorate([
3331
4059
  ignoreFromSerialization
@@ -3367,6 +4095,9 @@ __decorate([
3367
4095
  __decorate([
3368
4096
  nameForSerialization('logoStyle')
3369
4097
  ], BaseDataCaptureView.prototype, "_logoStyle", void 0);
4098
+ __decorate([
4099
+ nameForSerialization('shouldShowZoomNotification')
4100
+ ], BaseDataCaptureView.prototype, "_shouldShowZoomNotification", void 0);
3370
4101
  __decorate([
3371
4102
  ignoreFromSerialization
3372
4103
  ], BaseDataCaptureView.prototype, "controller", void 0);
@@ -3376,7 +4107,7 @@ __decorate([
3376
4107
 
3377
4108
  class ZoomSwitchControl extends DefaultSerializeable {
3378
4109
  constructor() {
3379
- super(...arguments);
4110
+ super();
3380
4111
  this.type = 'zoom';
3381
4112
  this.icon = {
3382
4113
  zoomedOut: { default: null, pressed: null },
@@ -3385,6 +4116,12 @@ class ZoomSwitchControl extends DefaultSerializeable {
3385
4116
  this.view = null;
3386
4117
  this.anchor = null;
3387
4118
  this.offset = null;
4119
+ this.contentDescriptionWhenZoomedOut = null;
4120
+ this.contentDescriptionWhenZoomedIn = null;
4121
+ this.accessibilityLabelWhenZoomedOut = null;
4122
+ this.accessibilityLabelWhenZoomedIn = null;
4123
+ this.accessibilityHintWhenZoomedOut = null;
4124
+ this.accessibilityHintWhenZoomedIn = null;
3388
4125
  }
3389
4126
  get zoomedOutImage() {
3390
4127
  var _a, _b;
@@ -3461,7 +4198,7 @@ __decorate([
3461
4198
 
3462
4199
  class TorchSwitchControl extends DefaultSerializeable {
3463
4200
  constructor() {
3464
- super(...arguments);
4201
+ super();
3465
4202
  this.type = 'torch';
3466
4203
  this.icon = {
3467
4204
  on: { default: null, pressed: null },
@@ -3470,6 +4207,10 @@ class TorchSwitchControl extends DefaultSerializeable {
3470
4207
  this.view = null;
3471
4208
  this.anchor = null;
3472
4209
  this.offset = null;
4210
+ this.accessibilityLabelWhenOff = null;
4211
+ this.accessibilityHintWhenOff = null;
4212
+ this.accessibilityLabelWhenOn = null;
4213
+ this.accessibilityHintWhenOn = null;
3473
4214
  }
3474
4215
  get torchOffImage() {
3475
4216
  var _a, _b;
@@ -3551,6 +4292,18 @@ class TorchSwitchControl extends DefaultSerializeable {
3551
4292
  __decorate([
3552
4293
  ignoreFromSerialization
3553
4294
  ], TorchSwitchControl.prototype, "view", void 0);
4295
+ __decorate([
4296
+ nameForSerialization('accessibilityLabelWhenOff')
4297
+ ], TorchSwitchControl.prototype, "accessibilityLabelWhenOff", void 0);
4298
+ __decorate([
4299
+ nameForSerialization('accessibilityHintWhenOff')
4300
+ ], TorchSwitchControl.prototype, "accessibilityHintWhenOff", void 0);
4301
+ __decorate([
4302
+ nameForSerialization('accessibilityLabelWhenOn')
4303
+ ], TorchSwitchControl.prototype, "accessibilityLabelWhenOn", void 0);
4304
+ __decorate([
4305
+ nameForSerialization('accessibilityHintWhenOn')
4306
+ ], TorchSwitchControl.prototype, "accessibilityHintWhenOn", void 0);
3554
4307
 
3555
4308
  var VideoResolution;
3556
4309
  (function (VideoResolution) {
@@ -3620,11 +4373,14 @@ class CameraSettings extends DefaultSerializeable {
3620
4373
  return settings;
3621
4374
  }
3622
4375
  constructor(settings) {
3623
- var _a, _b, _c, _d, _e, _f;
4376
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
3624
4377
  super();
3625
4378
  this.preferredResolution = CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
3626
4379
  this.zoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
3627
4380
  this.zoomGestureZoomFactor = CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
4381
+ this.torchLevel = CameraSettings.coreDefaults.Camera.Settings.torchLevel;
4382
+ this.macroMode = CameraSettings.coreDefaults.Camera.Settings.macroMode;
4383
+ this.adaptiveExposure = CameraSettings.coreDefaults.Camera.Settings.adaptiveExposure;
3628
4384
  this.focusHiddenProperties = [
3629
4385
  'range',
3630
4386
  'manualLensPosition',
@@ -3640,10 +4396,13 @@ class CameraSettings extends DefaultSerializeable {
3640
4396
  this.preferredResolution = (_a = settings === null || settings === void 0 ? void 0 : settings.preferredResolution) !== null && _a !== void 0 ? _a : CameraSettings.coreDefaults.Camera.Settings.preferredResolution;
3641
4397
  this.zoomFactor = (_b = settings === null || settings === void 0 ? void 0 : settings.zoomFactor) !== null && _b !== void 0 ? _b : CameraSettings.coreDefaults.Camera.Settings.zoomFactor;
3642
4398
  this.zoomGestureZoomFactor = (_c = settings === null || settings === void 0 ? void 0 : settings.zoomGestureZoomFactor) !== null && _c !== void 0 ? _c : CameraSettings.coreDefaults.Camera.Settings.zoomGestureZoomFactor;
4399
+ this.torchLevel = (_d = settings === null || settings === void 0 ? void 0 : settings.torchLevel) !== null && _d !== void 0 ? _d : CameraSettings.coreDefaults.Camera.Settings.torchLevel;
4400
+ this.macroMode = (_e = settings === null || settings === void 0 ? void 0 : settings.macroMode) !== null && _e !== void 0 ? _e : CameraSettings.coreDefaults.Camera.Settings.macroMode;
4401
+ this.adaptiveExposure = (_f = settings === null || settings === void 0 ? void 0 : settings.adaptiveExposure) !== null && _f !== void 0 ? _f : CameraSettings.coreDefaults.Camera.Settings.adaptiveExposure;
3643
4402
  this.focus = {
3644
- range: (_d = settings === null || settings === void 0 ? void 0 : settings.focusRange) !== null && _d !== void 0 ? _d : CameraSettings.coreDefaults.Camera.Settings.focusRange,
3645
- focusGestureStrategy: (_e = settings === null || settings === void 0 ? void 0 : settings.focusGestureStrategy) !== null && _e !== void 0 ? _e : CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
3646
- shouldPreferSmoothAutoFocus: (_f = settings === null || settings === void 0 ? void 0 : settings.shouldPreferSmoothAutoFocus) !== null && _f !== void 0 ? _f : CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
4403
+ range: (_g = settings === null || settings === void 0 ? void 0 : settings.focusRange) !== null && _g !== void 0 ? _g : CameraSettings.coreDefaults.Camera.Settings.focusRange,
4404
+ focusGestureStrategy: (_h = settings === null || settings === void 0 ? void 0 : settings.focusGestureStrategy) !== null && _h !== void 0 ? _h : CameraSettings.coreDefaults.Camera.Settings.focusGestureStrategy,
4405
+ shouldPreferSmoothAutoFocus: (_j = settings === null || settings === void 0 ? void 0 : settings.shouldPreferSmoothAutoFocus) !== null && _j !== void 0 ? _j : CameraSettings.coreDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
3647
4406
  };
3648
4407
  if (settings !== undefined && settings !== null) {
3649
4408
  Object.getOwnPropertyNames(settings).forEach(propertyName => {
@@ -3665,10 +4424,26 @@ class CameraSettings extends DefaultSerializeable {
3665
4424
  return this[name];
3666
4425
  }
3667
4426
  }
4427
+ __decorate([
4428
+ nameForSerialization('torchLevel')
4429
+ ], CameraSettings.prototype, "torchLevel", void 0);
4430
+ __decorate([
4431
+ nameForSerialization('macroMode')
4432
+ ], CameraSettings.prototype, "macroMode", void 0);
4433
+ __decorate([
4434
+ nameForSerialization('adaptiveExposure')
4435
+ ], CameraSettings.prototype, "adaptiveExposure", void 0);
3668
4436
  __decorate([
3669
4437
  ignoreFromSerialization
3670
4438
  ], CameraSettings.prototype, "focusHiddenProperties", void 0);
3671
4439
 
4440
+ var MacroMode;
4441
+ (function (MacroMode) {
4442
+ MacroMode["Auto"] = "auto";
4443
+ MacroMode["Off"] = "off";
4444
+ MacroMode["On"] = "on";
4445
+ })(MacroMode || (MacroMode = {}));
4446
+
3672
4447
  const NoViewfinder = { type: 'none' };
3673
4448
 
3674
4449
  class RectangularViewfinderAnimation extends DefaultSerializeable {
@@ -3833,6 +4608,7 @@ class LaserlineViewfinder extends DefaultSerializeable {
3833
4608
  }
3834
4609
 
3835
4610
  function parseDefaults(jsonDefaults) {
4611
+ var _a, _b, _c;
3836
4612
  const coreDefaults = {
3837
4613
  Camera: {
3838
4614
  Settings: {
@@ -3842,6 +4618,9 @@ function parseDefaults(jsonDefaults) {
3842
4618
  zoomGestureZoomFactor: jsonDefaults.Camera.Settings.zoomGestureZoomFactor,
3843
4619
  focusGestureStrategy: jsonDefaults.Camera.Settings.focusGestureStrategy,
3844
4620
  shouldPreferSmoothAutoFocus: jsonDefaults.Camera.Settings.shouldPreferSmoothAutoFocus,
4621
+ torchLevel: (_a = jsonDefaults.Camera.Settings.torchLevel) !== null && _a !== void 0 ? _a : 1.0,
4622
+ macroMode: ((_b = jsonDefaults.Camera.Settings.macroMode) !== null && _b !== void 0 ? _b : 'auto'),
4623
+ adaptiveExposure: (_c = jsonDefaults.Camera.Settings.adaptiveExposure) !== null && _c !== void 0 ? _c : false,
3845
4624
  properties: jsonDefaults.Camera.Settings.properties,
3846
4625
  },
3847
4626
  defaultPosition: (jsonDefaults.Camera.defaultPosition || null),
@@ -3855,6 +4634,7 @@ function parseDefaults(jsonDefaults) {
3855
4634
  focusGesture: PrivateFocusGestureDeserializer['fromJSON'](JSON.parse(jsonDefaults.DataCaptureView.focusGesture)),
3856
4635
  zoomGesture: PrivateZoomGestureDeserializer['fromJSON'](JSON.parse(jsonDefaults.DataCaptureView.zoomGesture)),
3857
4636
  logoStyle: jsonDefaults.DataCaptureView.logoStyle,
4637
+ shouldShowZoomNotification: jsonDefaults.DataCaptureView.shouldShowZoomNotification,
3858
4638
  },
3859
4639
  RectangularViewfinder: Object
3860
4640
  .keys(jsonDefaults.RectangularViewfinder.styles)
@@ -4298,5 +5078,13 @@ function generateIdentifier() {
4298
5078
  });
4299
5079
  }
4300
5080
 
4301
- export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, Brush, CORE_PROXY_TYPE_NAMES, Camera, CameraController, CameraOwnershipHelper, CameraOwnershipManager, CameraPosition, CameraSettings, Color, ContextStatus, ControlImage, CoreProxyAdapter, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureStrategy, FocusRange, FontFamily, FrameDataController, FrameDataSettings, FrameDataSettingsBuilder, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MarginsWithUnit, MeasureUnit, NativeProxy, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomSwitchControl, createNativeProxy, ensureCoreDefaults, generateIdentifier, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, registerCoreProxies, registerProxies, serializationDefault, setCoreDefaultsLoader };
5081
+ var ClusteringMode;
5082
+ (function (ClusteringMode) {
5083
+ ClusteringMode["Disabled"] = "disabled";
5084
+ ClusteringMode["Manual"] = "manual";
5085
+ ClusteringMode["Auto"] = "auto";
5086
+ ClusteringMode["AutoWithManualCorrection"] = "autoWithManualCorrection";
5087
+ })(ClusteringMode || (ClusteringMode = {}));
5088
+
5089
+ export { AimerViewfinder, Anchor, BaseController, BaseDataCaptureView, Brush, CORE_PROXY_TYPE_NAMES, Camera, CameraController, CameraOwnershipHelper, CameraOwnershipManager, CameraPosition, CameraSettings, ClusteringMode, Color, ContextStatus, ControlImage, CoreProxyAdapter, DataCaptureContext, DataCaptureContextEvents, DataCaptureContextSettings, DataCaptureViewController, DataCaptureViewEvents, DefaultSerializeable, Direction, EventDataParser, EventEmitter, Expiration, FactoryMaker, Feedback, FocusGestureListenerEvents, FocusGestureStrategy, FocusRange, FontFamily, FrameDataController, FrameDataSettings, FrameDataSettingsBuilder, FrameSourceListenerEvents, FrameSourceState, HTMLElementState, HtmlElementPosition, HtmlElementSize, ImageBuffer, ImageFrameSource, LaserlineViewfinder, LicenseInfo, LogoStyle, MacroMode, MacroModeListenerEvents, MarginsWithUnit, MeasureUnit, NativeProxy, NoViewfinder, NoneLocationSelection, NumberWithUnit, Observable, OpenSourceSoftwareLicenseInfo, Orientation, Point, PointWithUnit, PrivateFocusGestureDeserializer, PrivateFrameData, PrivateZoomGestureDeserializer, Quadrilateral, RadiusLocationSelection, Rect, RectWithUnit, RectangularLocationSelection, RectangularViewfinder, RectangularViewfinderAnimation, RectangularViewfinderLineStyle, RectangularViewfinderStyle, SKIP, ScanIntention, ScanditIcon, ScanditIconBuilder, ScanditIconShape, ScanditIconType, Size, SizeWithAspect, SizeWithUnit, SizeWithUnitAndAspect, SizingMode, Sound, SwipeToZoom, TapToFocus, TextAlignment, TorchListenerEvents, TorchState, TorchSwitchControl, Vibration, VibrationType, VideoResolution, WaveFormVibration, ZoomGestureListenerEvents, ZoomSwitchControl, createNativeProxy, ensureCoreDefaults, generateIdentifier, getCoreDefaults, ignoreFromSerialization, ignoreFromSerializationIfNull, loadCoreDefaults, nameForSerialization, registerCoreProxies, registerProxies, serializationDefault, setCoreDefaultsLoader };
4302
5090
  //# sourceMappingURL=index.js.map